| OLD | NEW |
| 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 "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 #include "base/win/registry.h" | 17 #include "base/win/registry.h" |
| 18 #include "base/win/scoped_comptr.h" | 18 #include "base/win/scoped_comptr.h" |
| 19 #include "chrome/common/scoped_co_mem.h" | 19 #include "chrome/common/scoped_co_mem.h" |
| 20 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
| 21 #include "ui/base/message_box_win.h" | |
| 22 #include "ui/base/win/shell.h" | 21 #include "ui/base/win/shell.h" |
| 23 #include "ui/gfx/native_widget_types.h" | 22 #include "ui/gfx/native_widget_types.h" |
| 24 | 23 |
| 25 namespace platform_util { | 24 namespace platform_util { |
| 26 | 25 |
| 27 void ShowItemInFolder(const FilePath& full_path) { | 26 void ShowItemInFolder(const FilePath& full_path) { |
| 28 FilePath dir = full_path.DirName(); | 27 FilePath dir = full_path.DirName(); |
| 29 // ParseDisplayName will fail if the directory is "C:", it must be "C:\\". | 28 // ParseDisplayName will fail if the directory is "C:", it must be "C:\\". |
| 30 if (dir.value() == L"" || !file_util::EnsureEndsWithSeparator(&dir)) | 29 if (dir.value() == L"" || !file_util::EnsureEndsWithSeparator(&dir)) |
| 31 return; | 30 return; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 169 |
| 171 void ActivateWindow(gfx::NativeWindow window) { | 170 void ActivateWindow(gfx::NativeWindow window) { |
| 172 ::SetForegroundWindow(window); | 171 ::SetForegroundWindow(window); |
| 173 } | 172 } |
| 174 | 173 |
| 175 bool IsVisible(gfx::NativeView view) { | 174 bool IsVisible(gfx::NativeView view) { |
| 176 // MSVC complains if we don't include != 0. | 175 // MSVC complains if we don't include != 0. |
| 177 return ::IsWindowVisible(view) != 0; | 176 return ::IsWindowVisible(view) != 0; |
| 178 } | 177 } |
| 179 | 178 |
| 180 void SimpleErrorBox(gfx::NativeWindow parent, | |
| 181 const string16& title, | |
| 182 const string16& message) { | |
| 183 ui::MessageBox(parent, message, title, | |
| 184 MB_OK | MB_SETFOREGROUND | MB_ICONWARNING | MB_TOPMOST); | |
| 185 } | |
| 186 | |
| 187 bool SimpleYesNoBox(gfx::NativeWindow parent, | |
| 188 const string16& title, | |
| 189 const string16& message) { | |
| 190 return ui::MessageBox(parent, message.c_str(), title.c_str(), | |
| 191 MB_YESNO | MB_ICONWARNING | MB_SETFOREGROUND) == IDYES; | |
| 192 } | |
| 193 | |
| 194 } // namespace platform_util | 179 } // namespace platform_util |
| OLD | NEW |