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

Side by Side Diff: ui/base/win/shell.cc

Issue 8851007: WIP / Do not commit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
« no previous file with comments | « ui/base/win/shell.h ('k') | webkit/glue/webkit_glue.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/base/win/shell.h" 5 #include "ui/base/win/shell.h"
6 6
7 #include <shellapi.h> 7 #include <shellapi.h>
8 #include <shlobj.h> // Must be before propkey. 8 #include <shlobj.h> // Must be before propkey.
9 #include <propkey.h> 9 #include <propkey.h>
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 // Cleanup. 72 // Cleanup.
73 base::UnloadNativeLibrary(shell32_library); 73 base::UnloadNativeLibrary(shell32_library);
74 } 74 }
75 75
76 } // namespace 76 } // namespace
77 77
78 // Open an item via a shell execute command. Error code checking and casting 78 // Open an item via a shell execute command. Error code checking and casting
79 // explanation: http://msdn2.microsoft.com/en-us/library/ms647732.aspx 79 // explanation: http://msdn2.microsoft.com/en-us/library/ms647732.aspx
80 bool OpenItemViaShell(const FilePath& full_path) { 80 bool OpenItemViaShell(const FilePath& full_path,
81 HINSTANCE h = ::ShellExecuteW( 81 base::ProcessHandle* process_handle) {
82 NULL, NULL, full_path.value().c_str(), NULL, 82 SHELLEXECUTEINFO sei = { sizeof(sei) };
83 full_path.DirName().value().c_str(), SW_SHOWNORMAL); 83 if (process_handle)
84 84 sei.fMask = SEE_MASK_NOCLOSEPROCESS;
85 LONG_PTR error = reinterpret_cast<LONG_PTR>(h); 85 sei.nShow = SW_SHOWNORMAL;
86 if (error > 32) 86 sei.lpVerb = NULL;
87 sei.lpFile = full_path.value().c_str();
88 sei.lpDirectory = full_path.DirName().value().c_str();
89 if (::ShellExecuteExW(&sei)) {
90 process_handle = sei.hProcess;
87 return true; 91 return true;
88 92 }
93 LONG_PTR error = reinterpret_cast<LONG_PTR>(sei.hInstApp);
89 if ((error == SE_ERR_NOASSOC)) 94 if ((error == SE_ERR_NOASSOC))
90 return OpenItemWithExternalApp(full_path.value()); 95 return OpenItemWithExternalApp(full_path.value());
91
92 return false; 96 return false;
93 } 97 }
94 98
95 bool OpenItemViaShellNoZoneCheck(const FilePath& full_path) { 99 bool OpenItemViaShellNoZoneCheck(const FilePath& full_path) {
96 SHELLEXECUTEINFO sei = { sizeof(sei) }; 100 SHELLEXECUTEINFO sei = { sizeof(sei) };
97 sei.fMask = SEE_MASK_NOZONECHECKS | SEE_MASK_FLAG_DDEWAIT; 101 sei.fMask = SEE_MASK_NOZONECHECKS | SEE_MASK_FLAG_DDEWAIT;
98 sei.nShow = SW_SHOWNORMAL; 102 sei.nShow = SW_SHOWNORMAL;
99 sei.lpVerb = NULL; 103 sei.lpVerb = NULL;
100 sei.lpFile = full_path.value().c_str(); 104 sei.lpFile = full_path.value().c_str();
101 if (::ShellExecuteExW(&sei)) 105 if (::ShellExecuteExW(&sei))
(...skipping 18 matching lines...) Expand all
120 void SetAppIdForWindow(const string16& app_id, HWND hwnd) { 124 void SetAppIdForWindow(const string16& app_id, HWND hwnd) {
121 SetAppIdAndIconForWindow(app_id, string16(), hwnd); 125 SetAppIdAndIconForWindow(app_id, string16(), hwnd);
122 } 126 }
123 127
124 void SetAppIconForWindow(const string16& app_icon, HWND hwnd) { 128 void SetAppIconForWindow(const string16& app_icon, HWND hwnd) {
125 SetAppIdAndIconForWindow(string16(), app_icon, hwnd); 129 SetAppIdAndIconForWindow(string16(), app_icon, hwnd);
126 } 130 }
127 131
128 } // namespace win 132 } // namespace win
129 } // namespace ui 133 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/win/shell.h ('k') | webkit/glue/webkit_glue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698