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 "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/path_service.h" | 17 #include "base/path_service.h" |
17 #include "base/logging.h" | |
18 #include "base/scoped_comptr_win.h" | |
19 #include "base/string_util.h" | 18 #include "base/string_util.h" |
20 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
21 #include "base/win/registry.h" | 20 #include "base/win/registry.h" |
| 21 #include "base/win/scoped_comptr.h" |
| 22 #include "chrome/installer/util/google_update_constants.h" |
22 #include "chrome/installer/util/google_update_settings.h" | 23 #include "chrome/installer/util/google_update_settings.h" |
23 #include "chrome/installer/util/google_update_constants.h" | |
24 #include "chrome/installer/util/install_util.h" | 24 #include "chrome/installer/util/install_util.h" |
25 #include "googleurl/src/gurl.h" | 25 #include "googleurl/src/gurl.h" |
26 #include "ui/base/message_box_win.h" | 26 #include "ui/base/message_box_win.h" |
27 #include "ui/gfx/native_widget_types.h" | 27 #include "ui/gfx/native_widget_types.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:\\". |
(...skipping 23 matching lines...) Expand all Loading... |
57 } | 57 } |
58 open_folder_and_select_itemsPtr = | 58 open_folder_and_select_itemsPtr = |
59 reinterpret_cast<SHOpenFolderAndSelectItemsFuncPtr> | 59 reinterpret_cast<SHOpenFolderAndSelectItemsFuncPtr> |
60 (GetProcAddress(shell32_base, "SHOpenFolderAndSelectItems")); | 60 (GetProcAddress(shell32_base, "SHOpenFolderAndSelectItems")); |
61 } | 61 } |
62 if (!open_folder_and_select_itemsPtr) { | 62 if (!open_folder_and_select_itemsPtr) { |
63 ShellExecute(NULL, L"open", dir.value().c_str(), NULL, NULL, SW_SHOW); | 63 ShellExecute(NULL, L"open", dir.value().c_str(), NULL, NULL, SW_SHOW); |
64 return; | 64 return; |
65 } | 65 } |
66 | 66 |
67 ScopedComPtr<IShellFolder> desktop; | 67 base::win::ScopedComPtr<IShellFolder> desktop; |
68 HRESULT hr = SHGetDesktopFolder(desktop.Receive()); | 68 HRESULT hr = SHGetDesktopFolder(desktop.Receive()); |
69 if (FAILED(hr)) | 69 if (FAILED(hr)) |
70 return; | 70 return; |
71 | 71 |
72 app::win::ScopedCoMem<ITEMIDLIST> dir_item; | 72 app::win::ScopedCoMem<ITEMIDLIST> dir_item; |
73 hr = desktop->ParseDisplayName(NULL, NULL, | 73 hr = desktop->ParseDisplayName(NULL, NULL, |
74 const_cast<wchar_t *>(dir.value().c_str()), | 74 const_cast<wchar_t *>(dir.value().c_str()), |
75 NULL, &dir_item, NULL); | 75 NULL, &dir_item, NULL); |
76 if (FAILED(hr)) | 76 if (FAILED(hr)) |
77 return; | 77 return; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 GoogleUpdateSettings::GetChromeChannel(is_system_install, &channel); | 205 GoogleUpdateSettings::GetChromeChannel(is_system_install, &channel); |
206 } | 206 } |
207 return UTF16ToASCII(channel); | 207 return UTF16ToASCII(channel); |
208 #else | 208 #else |
209 return std::string(); | 209 return std::string(); |
210 #endif | 210 #endif |
211 } | 211 } |
212 | 212 |
213 } // namespace platform_util | 213 } // namespace platform_util |
OLD | NEW |