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

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

Issue 7265009: Revert 90464 - Move app/win/* files to base/win/, ui/base/win and chrome/common/ directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
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"
13 #include "app/win/shell.h"
12 #include "base/file_path.h" 14 #include "base/file_path.h"
13 #include "base/file_util.h" 15 #include "base/file_util.h"
14 #include "base/logging.h" 16 #include "base/logging.h"
15 #include "base/string_util.h" 17 #include "base/string_util.h"
16 #include "base/utf_string_conversions.h" 18 #include "base/utf_string_conversions.h"
17 #include "base/win/registry.h" 19 #include "base/win/registry.h"
18 #include "base/win/scoped_comptr.h" 20 #include "base/win/scoped_comptr.h"
19 #include "chrome/common/scoped_co_mem.h"
20 #include "chrome/installer/util/browser_distribution.h" 21 #include "chrome/installer/util/browser_distribution.h"
21 #include "googleurl/src/gurl.h" 22 #include "googleurl/src/gurl.h"
22 #include "ui/base/message_box_win.h" 23 #include "ui/base/message_box_win.h"
23 #include "ui/base/win/shell.h"
24 #include "ui/gfx/native_widget_types.h" 24 #include "ui/gfx/native_widget_types.h"
25 25
26 namespace platform_util { 26 namespace platform_util {
27 27
28 void ShowItemInFolder(const FilePath& full_path) { 28 void ShowItemInFolder(const FilePath& full_path) {
29 FilePath dir = full_path.DirName(); 29 FilePath dir = full_path.DirName();
30 // 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:\\".
31 if (dir.value() == L"" || !file_util::EnsureEndsWithSeparator(&dir)) 31 if (dir.value() == L"" || !file_util::EnsureEndsWithSeparator(&dir))
32 return; 32 return;
33 33
(...skipping 25 matching lines...) Expand all
59 if (!open_folder_and_select_itemsPtr) { 59 if (!open_folder_and_select_itemsPtr) {
60 ShellExecute(NULL, L"open", dir.value().c_str(), NULL, NULL, SW_SHOW); 60 ShellExecute(NULL, L"open", dir.value().c_str(), NULL, NULL, SW_SHOW);
61 return; 61 return;
62 } 62 }
63 63
64 base::win::ScopedComPtr<IShellFolder> desktop; 64 base::win::ScopedComPtr<IShellFolder> desktop;
65 HRESULT hr = SHGetDesktopFolder(desktop.Receive()); 65 HRESULT hr = SHGetDesktopFolder(desktop.Receive());
66 if (FAILED(hr)) 66 if (FAILED(hr))
67 return; 67 return;
68 68
69 chrome::common::ScopedCoMem<ITEMIDLIST> dir_item; 69 app::win::ScopedCoMem<ITEMIDLIST> dir_item;
70 hr = desktop->ParseDisplayName(NULL, NULL, 70 hr = desktop->ParseDisplayName(NULL, NULL,
71 const_cast<wchar_t *>(dir.value().c_str()), 71 const_cast<wchar_t *>(dir.value().c_str()),
72 NULL, &dir_item, NULL); 72 NULL, &dir_item, NULL);
73 if (FAILED(hr)) 73 if (FAILED(hr))
74 return; 74 return;
75 75
76 chrome::common::ScopedCoMem<ITEMIDLIST> file_item; 76 app::win::ScopedCoMem<ITEMIDLIST> file_item;
77 hr = desktop->ParseDisplayName(NULL, NULL, 77 hr = desktop->ParseDisplayName(NULL, NULL,
78 const_cast<wchar_t *>(full_path.value().c_str()), 78 const_cast<wchar_t *>(full_path.value().c_str()),
79 NULL, &file_item, NULL); 79 NULL, &file_item, NULL);
80 if (FAILED(hr)) 80 if (FAILED(hr))
81 return; 81 return;
82 82
83 const ITEMIDLIST* highlight[] = { 83 const ITEMIDLIST* highlight[] = {
84 {file_item}, 84 {file_item},
85 }; 85 };
86 86
(...skipping 16 matching lines...) Expand all
103 << full_path.value() << "\"" 103 << full_path.value() << "\""
104 << " hr = " << hr 104 << " hr = " << hr
105 << " " << reinterpret_cast<LPTSTR>(&message); 105 << " " << reinterpret_cast<LPTSTR>(&message);
106 if (message) 106 if (message)
107 LocalFree(message); 107 LocalFree(message);
108 } 108 }
109 } 109 }
110 } 110 }
111 111
112 void OpenItem(const FilePath& full_path) { 112 void OpenItem(const FilePath& full_path) {
113 ui::win::OpenItemViaShell(full_path); 113 app::win::OpenItemViaShell(full_path);
114 } 114 }
115 115
116 void OpenExternal(const GURL& url) { 116 void OpenExternal(const GURL& url) {
117 // Quote the input scheme to be sure that the command does not have 117 // Quote the input scheme to be sure that the command does not have
118 // parameters unexpected by the external program. This url should already 118 // parameters unexpected by the external program. This url should already
119 // have been escaped. 119 // have been escaped.
120 std::string escaped_url = url.spec(); 120 std::string escaped_url = url.spec();
121 escaped_url.insert(0, "\""); 121 escaped_url.insert(0, "\"");
122 escaped_url += "\""; 122 escaped_url += "\"";
123 123
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 194
195 bool CanSetAsDefaultBrowser() { 195 bool CanSetAsDefaultBrowser() {
196 return BrowserDistribution::GetDistribution()->CanSetAsDefault(); 196 return BrowserDistribution::GetDistribution()->CanSetAsDefault();
197 } 197 }
198 198
199 bool CanSetAsDefaultProtocolClient(const std::string& protocol) { 199 bool CanSetAsDefaultProtocolClient(const std::string& protocol) {
200 return CanSetAsDefaultBrowser(); 200 return CanSetAsDefaultBrowser();
201 } 201 }
202 202
203 } // namespace platform_util 203 } // namespace platform_util
OLDNEW
« no previous file with comments | « chrome/browser/importer/importer_unittest.cc ('k') | chrome/browser/tab_contents/web_drop_target_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698