OLD | NEW |
1 // Copyright (c) 2010 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 "app/win/win_util.h" | |
15 #include "base/file_path.h" | 14 #include "base/file_path.h" |
16 #include "base/file_util.h" | 15 #include "base/file_util.h" |
17 #include "base/path_service.h" | 16 #include "base/path_service.h" |
18 #include "base/logging.h" | 17 #include "base/logging.h" |
19 #include "base/scoped_comptr_win.h" | 18 #include "base/scoped_comptr_win.h" |
20 #include "base/string_util.h" | 19 #include "base/string_util.h" |
21 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
22 #include "base/win/registry.h" | 21 #include "base/win/registry.h" |
23 #include "chrome/installer/util/google_update_settings.h" | 22 #include "chrome/installer/util/google_update_settings.h" |
24 #include "chrome/installer/util/google_update_constants.h" | 23 #include "chrome/installer/util/google_update_constants.h" |
25 #include "chrome/installer/util/install_util.h" | 24 #include "chrome/installer/util/install_util.h" |
26 #include "gfx/native_widget_types.h" | 25 #include "gfx/native_widget_types.h" |
27 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
| 27 #include "ui/base/message_box_win.h" |
28 | 28 |
29 namespace platform_util { | 29 namespace platform_util { |
30 | 30 |
31 void ShowItemInFolder(const FilePath& full_path) { | 31 void ShowItemInFolder(const FilePath& full_path) { |
32 FilePath dir = full_path.DirName(); | 32 FilePath dir = full_path.DirName(); |
33 // ParseDisplayName will fail if the directory is "C:", it must be "C:\\". | 33 // ParseDisplayName will fail if the directory is "C:", it must be "C:\\". |
34 if (dir.value() == L"" || !file_util::EnsureEndsWithSeparator(&dir)) | 34 if (dir.value() == L"" || !file_util::EnsureEndsWithSeparator(&dir)) |
35 return; | 35 return; |
36 | 36 |
37 typedef HRESULT (WINAPI *SHOpenFolderAndSelectItemsFuncPtr)( | 37 typedef HRESULT (WINAPI *SHOpenFolderAndSelectItemsFuncPtr)( |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } | 155 } |
156 | 156 |
157 bool IsVisible(gfx::NativeView view) { | 157 bool IsVisible(gfx::NativeView view) { |
158 // MSVC complains if we don't include != 0. | 158 // MSVC complains if we don't include != 0. |
159 return ::IsWindowVisible(view) != 0; | 159 return ::IsWindowVisible(view) != 0; |
160 } | 160 } |
161 | 161 |
162 void SimpleErrorBox(gfx::NativeWindow parent, | 162 void SimpleErrorBox(gfx::NativeWindow parent, |
163 const string16& title, | 163 const string16& title, |
164 const string16& message) { | 164 const string16& message) { |
165 app::win::MessageBox(parent, message, title, MB_OK | MB_SETFOREGROUND); | 165 ui::MessageBox(parent, message, title, MB_OK | MB_SETFOREGROUND); |
166 } | 166 } |
167 | 167 |
168 bool SimpleYesNoBox(gfx::NativeWindow parent, | 168 bool SimpleYesNoBox(gfx::NativeWindow parent, |
169 const string16& title, | 169 const string16& title, |
170 const string16& message) { | 170 const string16& message) { |
171 return app::win::MessageBox(parent, message.c_str(), title.c_str(), | 171 return ui::MessageBox(parent, message.c_str(), title.c_str(), |
172 MB_YESNO | MB_ICONWARNING | MB_SETFOREGROUND) == IDYES; | 172 MB_YESNO | MB_ICONWARNING | MB_SETFOREGROUND) == IDYES; |
173 } | 173 } |
174 | 174 |
175 std::string GetVersionStringModifier() { | 175 std::string GetVersionStringModifier() { |
176 #if defined(GOOGLE_CHROME_BUILD) | 176 #if defined(GOOGLE_CHROME_BUILD) |
177 FilePath module; | 177 FilePath module; |
178 string16 channel; | 178 string16 channel; |
179 if (PathService::Get(base::FILE_MODULE, &module)) { | 179 if (PathService::Get(base::FILE_MODULE, &module)) { |
180 bool is_system_install = | 180 bool is_system_install = |
181 !InstallUtil::IsPerUserInstall(module.value().c_str()); | 181 !InstallUtil::IsPerUserInstall(module.value().c_str()); |
182 | 182 |
183 GoogleUpdateSettings::GetChromeChannel(is_system_install, &channel); | 183 GoogleUpdateSettings::GetChromeChannel(is_system_install, &channel); |
184 } | 184 } |
185 return UTF16ToASCII(channel); | 185 return UTF16ToASCII(channel); |
186 #else | 186 #else |
187 return std::string(); | 187 return std::string(); |
188 #endif | 188 #endif |
189 } | 189 } |
190 | 190 |
191 } // namespace platform_util | 191 } // namespace platform_util |
OLD | NEW |