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

Side by Side Diff: chrome/browser/platform_util_win.cc

Issue 7249003: Move GetVersionStringModifier() and GetChannel() from platform_util_* to chrome_version_info_* (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: correct nits Created 9 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/platform_util_mac.mm ('k') | chrome/browser/sync/profile_sync_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/platform_util.h" 5 #include "chrome/browser/platform_util.h"
6 6
7 #include <commdlg.h> 7 #include <commdlg.h>
8 #include <dwmapi.h> 8 #include <dwmapi.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
11 11
12 #include "app/win/scoped_co_mem.h" 12 #include "app/win/scoped_co_mem.h"
13 #include "app/win/shell.h" 13 #include "app/win/shell.h"
14 #include "base/file_path.h" 14 #include "base/file_path.h"
15 #include "base/file_util.h" 15 #include "base/file_util.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/path_service.h"
18 #include "base/string_util.h" 17 #include "base/string_util.h"
19 #include "base/utf_string_conversions.h" 18 #include "base/utf_string_conversions.h"
20 #include "base/win/registry.h" 19 #include "base/win/registry.h"
21 #include "base/win/scoped_comptr.h" 20 #include "base/win/scoped_comptr.h"
22 #include "chrome/installer/util/browser_distribution.h" 21 #include "chrome/installer/util/browser_distribution.h"
23 #include "chrome/installer/util/google_update_constants.h"
24 #include "chrome/installer/util/google_update_settings.h"
25 #include "chrome/installer/util/install_util.h"
26 #include "googleurl/src/gurl.h" 22 #include "googleurl/src/gurl.h"
27 #include "ui/base/message_box_win.h" 23 #include "ui/base/message_box_win.h"
28 #include "ui/gfx/native_widget_types.h" 24 #include "ui/gfx/native_widget_types.h"
29 25
30 namespace platform_util { 26 namespace platform_util {
31 27
32 void ShowItemInFolder(const FilePath& full_path) { 28 void ShowItemInFolder(const FilePath& full_path) {
33 FilePath dir = full_path.DirName(); 29 FilePath dir = full_path.DirName();
34 // ParseDisplayName will fail if the directory is "C:", it must be "C:\\". 30 // ParseDisplayName will fail if the directory is "C:", it must be "C:\\".
35 if (dir.value() == L"" || !file_util::EnsureEndsWithSeparator(&dir)) 31 if (dir.value() == L"" || !file_util::EnsureEndsWithSeparator(&dir))
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 MB_OK | MB_SETFOREGROUND | MB_ICONWARNING | MB_TOPMOST); 185 MB_OK | MB_SETFOREGROUND | MB_ICONWARNING | MB_TOPMOST);
190 } 186 }
191 187
192 bool SimpleYesNoBox(gfx::NativeWindow parent, 188 bool SimpleYesNoBox(gfx::NativeWindow parent,
193 const string16& title, 189 const string16& title,
194 const string16& message) { 190 const string16& message) {
195 return ui::MessageBox(parent, message.c_str(), title.c_str(), 191 return ui::MessageBox(parent, message.c_str(), title.c_str(),
196 MB_YESNO | MB_ICONWARNING | MB_SETFOREGROUND) == IDYES; 192 MB_YESNO | MB_ICONWARNING | MB_SETFOREGROUND) == IDYES;
197 } 193 }
198 194
199 std::string GetVersionStringModifier() {
200 #if defined(GOOGLE_CHROME_BUILD)
201 FilePath module;
202 string16 channel;
203 if (PathService::Get(base::FILE_MODULE, &module)) {
204 bool is_system_install =
205 !InstallUtil::IsPerUserInstall(module.value().c_str());
206
207 GoogleUpdateSettings::GetChromeChannelAndModifiers(is_system_install,
208 &channel);
209 }
210 return UTF16ToASCII(channel);
211 #else
212 return std::string();
213 #endif
214 }
215
216 Channel GetChannel() {
217 #if defined(GOOGLE_CHROME_BUILD)
218 std::wstring channel(L"unknown");
219
220 FilePath module;
221 if (PathService::Get(base::FILE_MODULE, &module)) {
222 bool is_system_install =
223 !InstallUtil::IsPerUserInstall(module.value().c_str());
224 channel = GoogleUpdateSettings::GetChromeChannel(is_system_install);
225 }
226
227 if (channel.empty()) {
228 return CHANNEL_STABLE;
229 } else if (channel == L"beta") {
230 return CHANNEL_BETA;
231 } else if (channel == L"dev") {
232 return CHANNEL_DEV;
233 } else if (channel == L"canary") {
234 return CHANNEL_CANARY;
235 }
236 #endif
237
238 return CHANNEL_UNKNOWN;
239 }
240
241 bool CanSetAsDefaultBrowser() { 195 bool CanSetAsDefaultBrowser() {
242 return BrowserDistribution::GetDistribution()->CanSetAsDefault(); 196 return BrowserDistribution::GetDistribution()->CanSetAsDefault();
243 } 197 }
244 198
245 bool CanSetAsDefaultProtocolClient(const std::string& protocol) { 199 bool CanSetAsDefaultProtocolClient(const std::string& protocol) {
246 return CanSetAsDefaultBrowser(); 200 return CanSetAsDefaultBrowser();
247 } 201 }
248 202
249 } // namespace platform_util 203 } // namespace platform_util
OLDNEW
« no previous file with comments | « chrome/browser/platform_util_mac.mm ('k') | chrome/browser/sync/profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698