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

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

Issue 1581473002: Remove base/win/metro.{cc|h} and some associated code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 4 years, 11 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
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>
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 new ChromeUtilityMsg_OpenFileViaShell(full_path)); 181 new ChromeUtilityMsg_OpenFileViaShell(full_path));
182 return; 182 return;
183 183
184 case OPEN_FOLDER: 184 case OPEN_FOLDER:
185 utility_process_host->Send( 185 utility_process_host->Send(
186 new ChromeUtilityMsg_OpenFolderViaShell(full_path)); 186 new ChromeUtilityMsg_OpenFolderViaShell(full_path));
187 return; 187 return;
188 } 188 }
189 } 189 }
190 190
191 void ActivateDesktopIfNecessary() {
192 DCHECK_CURRENTLY_ON(BrowserThread::UI);
193 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH)
194 chrome::ActivateDesktopHelper(chrome::ASH_KEEP_RUNNING);
195 }
196
197 } // namespace 191 } // namespace
198 192
199 void ShowItemInFolder(Profile* profile, const base::FilePath& full_path) { 193 void ShowItemInFolder(Profile* profile, const base::FilePath& full_path) {
200 ActivateDesktopIfNecessary();
201 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 194 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
202 base::Bind(&ShowItemInFolderOnFileThread, full_path)); 195 base::Bind(&ShowItemInFolderOnFileThread, full_path));
203 } 196 }
204 197
205 namespace internal { 198 namespace internal {
206 199
207 void PlatformOpenVerifiedItem(const base::FilePath& path, OpenItemType type) { 200 void PlatformOpenVerifiedItem(const base::FilePath& path, OpenItemType type) {
208 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
209 base::Bind(&ActivateDesktopIfNecessary));
210
211 if (base::FieldTrialList::FindFullName("IsolateShellOperations") == 201 if (base::FieldTrialList::FindFullName("IsolateShellOperations") ==
212 "Enabled") { 202 "Enabled") {
213 BrowserThread::PostTask( 203 BrowserThread::PostTask(
214 BrowserThread::IO, FROM_HERE, 204 BrowserThread::IO, FROM_HERE,
215 base::Bind(&OpenItemViaShellInUtilityProcess, path, type)); 205 base::Bind(&OpenItemViaShellInUtilityProcess, path, type));
216 } else { 206 } else {
217 switch (type) { 207 switch (type) {
218 case OPEN_FILE: 208 case OPEN_FILE:
219 ui::win::OpenFileViaShell(path); 209 ui::win::OpenFileViaShell(path);
220 break; 210 break;
221 211
222 case OPEN_FOLDER: 212 case OPEN_FOLDER:
223 ui::win::OpenFolderViaShell(path); 213 ui::win::OpenFolderViaShell(path);
224 break; 214 break;
225 } 215 }
226 } 216 }
227 } 217 }
228 218
229 } // namespace internal 219 } // namespace internal
230 220
231 void OpenExternal(Profile* profile, const GURL& url) { 221 void OpenExternal(Profile* profile, const GURL& url) {
232 DCHECK_CURRENTLY_ON(BrowserThread::UI); 222 DCHECK_CURRENTLY_ON(BrowserThread::UI);
233 223
234 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH &&
235 !url.SchemeIsHTTPOrHTTPS())
236 chrome::ActivateDesktopHelper(chrome::ASH_KEEP_RUNNING);
237
238 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 224 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
239 base::Bind(&OpenExternalOnFileThread, url)); 225 base::Bind(&OpenExternalOnFileThread, url));
240 } 226 }
241 227
242 } // namespace platform_util 228 } // namespace platform_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698