- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / installer / util / google_chrome_sxs_distribution.cc
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // This file defines implementation of GoogleChromeSxSDistribution.
6
7 #include "chrome/installer/util/google_chrome_sxs_distribution.h"
8
9 #include "base/command_line.h"
10 #include "base/logging.h"
11
12 #include "installer_util_strings.h"  // NOLINT
13
14 namespace {
15
16 const wchar_t kChromeSxSGuid[] = L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}";
17 const wchar_t kChannelName[] = L"canary";
18 const wchar_t kBrowserAppId[] = L"ChromeCanary";
19 const wchar_t kBrowserProgIdPrefix[] = L"ChromeSSHTM";
20 const wchar_t kBrowserProgIdDesc[] = L"Chrome Canary HTML Document";
21 const int kSxSIconIndex = 4;
22 const wchar_t kCommandExecuteImplUuid[] =
23     L"{1BEAC3E3-B852-44F4-B468-8906C062422E}";
24
25 // The Chrome App Launcher Canary icon is index 6; see chrome_exe.rc.
26 const int kSxSAppLauncherIconIndex = 6;
27
28 }  // namespace
29
30 GoogleChromeSxSDistribution::GoogleChromeSxSDistribution()
31     : GoogleChromeDistribution() {
32   GoogleChromeDistribution::set_product_guid(kChromeSxSGuid);
33 }
34
35 string16 GoogleChromeSxSDistribution::GetBaseAppName() {
36   return L"Google Chrome Canary";
37 }
38
39 string16 GoogleChromeSxSDistribution::GetShortcutName(
40     ShortcutType shortcut_type) {
41   switch (shortcut_type) {
42     case SHORTCUT_CHROME_ALTERNATE:
43       // This should never be called. Returning the same string as Google Chrome
44       // preserves behavior, but it will result in a naming collision.
45       NOTREACHED();
46       return GoogleChromeDistribution::GetShortcutName(shortcut_type);
47     case SHORTCUT_APP_LAUNCHER:
48       return installer::GetLocalizedString(
49           IDS_APP_LIST_SHORTCUT_NAME_CANARY_BASE);
50     default:
51       DCHECK_EQ(shortcut_type, SHORTCUT_CHROME);
52       return installer::GetLocalizedString(IDS_SXS_SHORTCUT_NAME_BASE);
53   }
54 }
55
56 string16 GoogleChromeSxSDistribution::GetBaseAppId() {
57   return kBrowserAppId;
58 }
59
60 string16 GoogleChromeSxSDistribution::GetBrowserProgIdPrefix() {
61   return kBrowserProgIdPrefix;
62 }
63
64 string16 GoogleChromeSxSDistribution::GetBrowserProgIdDesc() {
65   return kBrowserProgIdDesc;
66 }
67
68 string16 GoogleChromeSxSDistribution::GetInstallSubDir() {
69   return GoogleChromeDistribution::GetInstallSubDir().append(
70       installer::kSxSSuffix);
71 }
72
73 string16 GoogleChromeSxSDistribution::GetUninstallRegPath() {
74   return GoogleChromeDistribution::GetUninstallRegPath().append(
75       installer::kSxSSuffix);
76 }
77
78 BrowserDistribution::DefaultBrowserControlPolicy
79     GoogleChromeSxSDistribution::GetDefaultBrowserControlPolicy() {
80   return DEFAULT_BROWSER_OS_CONTROL_ONLY;
81 }
82
83 int GoogleChromeSxSDistribution::GetIconIndex(ShortcutType shortcut_type) {
84   if (shortcut_type == SHORTCUT_APP_LAUNCHER)
85     return kSxSAppLauncherIconIndex;
86   DCHECK(shortcut_type == SHORTCUT_CHROME ||
87          shortcut_type == SHORTCUT_CHROME_ALTERNATE) << shortcut_type;
88   return kSxSIconIndex;
89 }
90
91 bool GoogleChromeSxSDistribution::GetChromeChannel(string16* channel) {
92   *channel = kChannelName;
93   return true;
94 }
95
96 bool GoogleChromeSxSDistribution::GetCommandExecuteImplClsid(
97     string16* handler_class_uuid) {
98   if (handler_class_uuid)
99     *handler_class_uuid = kCommandExecuteImplUuid;
100   return true;
101 }
102
103 bool GoogleChromeSxSDistribution::AppHostIsSupported() {
104   return false;
105 }
106
107 bool GoogleChromeSxSDistribution::ShouldSetExperimentLabels() {
108   return true;
109 }
110
111 bool GoogleChromeSxSDistribution::HasUserExperiments() {
112   return true;
113 }
114
115 string16 GoogleChromeSxSDistribution::ChannelName() {
116   return kChannelName;
117 }