Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Side by Side Diff: chrome/installer/util/google_chrome_sxs_distribution.cc

Issue 15255004: Refactor of BrowserDistribution. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit test Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 int kSxSIconIndex = 4; 19 const int kSxSIconIndex = 4;
20 20
21 // The Chrome App Launcher Canary icon is index 6; see chrome_exe.rc.
22 const int kSxSAppLauncherIconIndex = 6;
23
21 } // namespace 24 } // namespace
22 25
23 GoogleChromeSxSDistribution::GoogleChromeSxSDistribution() 26 GoogleChromeSxSDistribution::GoogleChromeSxSDistribution()
24 : GoogleChromeDistribution() { 27 : GoogleChromeDistribution() {
25 GoogleChromeDistribution::set_product_guid(kChromeSxSGuid); 28 GoogleChromeDistribution::set_product_guid(kChromeSxSGuid);
26 } 29 }
27 30
28 string16 GoogleChromeSxSDistribution::GetBaseAppName() { 31 string16 GoogleChromeSxSDistribution::GetBaseAppName() {
29 return L"Google Chrome Canary"; 32 return L"Google Chrome Canary";
30 } 33 }
31 34
32 string16 GoogleChromeSxSDistribution::GetAppShortCutName() { 35 string16 GoogleChromeSxSDistribution::GetShortcutName(
33 const string16& shortcut_name = 36 ShortcutType shortcut_type) {
34 installer::GetLocalizedString(IDS_SXS_SHORTCUT_NAME_BASE); 37 switch (shortcut_type) {
35 return shortcut_name; 38 case SHORTCUT_CHROME_ALTERNATE:
39 // This should never be called. Returning the same string as Google Chrome
40 // preserves behavior, but it will result in a naming collision.
41 NOTREACHED();
42 return GoogleChromeDistribution::GetShortcutName(shortcut_type);
43 case SHORTCUT_APP_LAUNCHER:
44 return installer::GetLocalizedString(
45 IDS_APP_LIST_SHORTCUT_NAME_CANARY_BASE);
46 default:
47 DCHECK_EQ(shortcut_type, SHORTCUT_CHROME);
48 return installer::GetLocalizedString(IDS_SXS_SHORTCUT_NAME_BASE);
49 }
36 } 50 }
37 51
38 string16 GoogleChromeSxSDistribution::GetBaseAppId() { 52 string16 GoogleChromeSxSDistribution::GetBaseAppId() {
39 return kBrowserAppId; 53 return kBrowserAppId;
40 } 54 }
41 55
42 string16 GoogleChromeSxSDistribution::GetInstallSubDir() { 56 string16 GoogleChromeSxSDistribution::GetInstallSubDir() {
43 return GoogleChromeDistribution::GetInstallSubDir().append( 57 return GoogleChromeDistribution::GetInstallSubDir().append(
44 installer::kSxSSuffix); 58 installer::kSxSSuffix);
45 } 59 }
46 60
47 string16 GoogleChromeSxSDistribution::GetUninstallRegPath() { 61 string16 GoogleChromeSxSDistribution::GetUninstallRegPath() {
48 return GoogleChromeDistribution::GetUninstallRegPath().append( 62 return GoogleChromeDistribution::GetUninstallRegPath().append(
49 installer::kSxSSuffix); 63 installer::kSxSSuffix);
50 } 64 }
51 65
52 bool GoogleChromeSxSDistribution::CanSetAsDefault() { 66 bool GoogleChromeSxSDistribution::CanSetAsDefault() {
53 return false; 67 return false;
54 } 68 }
55 69
56 int GoogleChromeSxSDistribution::GetIconIndex() { 70 int GoogleChromeSxSDistribution::GetIconIndex(ShortcutType shortcut_type) {
71 if (shortcut_type == SHORTCUT_APP_LAUNCHER)
72 return kSxSAppLauncherIconIndex;
73 DCHECK(shortcut_type == SHORTCUT_CHROME ||
74 shortcut_type == SHORTCUT_CHROME_ALTERNATE) << shortcut_type;
57 return kSxSIconIndex; 75 return kSxSIconIndex;
58 } 76 }
59 77
60 bool GoogleChromeSxSDistribution::GetChromeChannel(string16* channel) { 78 bool GoogleChromeSxSDistribution::GetChromeChannel(string16* channel) {
61 *channel = kChannelName; 79 *channel = kChannelName;
62 return true; 80 return true;
63 } 81 }
64 82
65 bool GoogleChromeSxSDistribution::GetCommandExecuteImplClsid( 83 bool GoogleChromeSxSDistribution::GetCommandExecuteImplClsid(
66 string16* handler_class_uuid) { 84 string16* handler_class_uuid) {
67 return false; 85 return false;
68 } 86 }
69 87
70 bool GoogleChromeSxSDistribution::AppHostIsSupported() { 88 bool GoogleChromeSxSDistribution::AppHostIsSupported() {
71 return false; 89 return false;
72 } 90 }
73 91
74 bool GoogleChromeSxSDistribution::ShouldSetExperimentLabels() { 92 bool GoogleChromeSxSDistribution::ShouldSetExperimentLabels() {
75 return true; 93 return true;
76 } 94 }
77 95
78 bool GoogleChromeSxSDistribution::HasUserExperiments() { 96 bool GoogleChromeSxSDistribution::HasUserExperiments() {
79 return true; 97 return true;
80 } 98 }
81 99
82 string16 GoogleChromeSxSDistribution::ChannelName() { 100 string16 GoogleChromeSxSDistribution::ChannelName() {
83 return kChannelName; 101 return kChannelName;
84 } 102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698