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