Chromium Code Reviews

Side by Side Diff: app/win_util.cc

Issue 112064: Linux: call xdg-open on downloaded files to open them. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix typos Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
« no previous file with comments | « app/win_util.h ('k') | chrome/browser/download/download_file.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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "app/win_util.h" 5 #include "app/win_util.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 #include <atlapp.h> 8 #include <atlapp.h>
9 #include <commdlg.h> 9 #include <commdlg.h>
10 #include <dwmapi.h> 10 #include <dwmapi.h>
(...skipping 159 matching lines...)
170 LONG_PTR error = reinterpret_cast<LONG_PTR>(h); 170 LONG_PTR error = reinterpret_cast<LONG_PTR>(h);
171 if (error > 32) 171 if (error > 32)
172 return true; 172 return true;
173 173
174 if ((error == SE_ERR_NOASSOC) && ask_for_app) 174 if ((error == SE_ERR_NOASSOC) && ask_for_app)
175 return OpenItemWithExternalApp(full_path.value()); 175 return OpenItemWithExternalApp(full_path.value());
176 176
177 return false; 177 return false;
178 } 178 }
179 179
180 bool OpenItemViaShellNoZoneCheck(const FilePath& full_path, 180 bool OpenItemViaShellNoZoneCheck(const FilePath& full_path) {
181 bool ask_for_app) {
182 SHELLEXECUTEINFO sei = { sizeof(sei) }; 181 SHELLEXECUTEINFO sei = { sizeof(sei) };
183 sei.fMask = SEE_MASK_NOZONECHECKS | SEE_MASK_FLAG_DDEWAIT; 182 sei.fMask = SEE_MASK_NOZONECHECKS | SEE_MASK_FLAG_DDEWAIT;
184 sei.nShow = SW_SHOWNORMAL; 183 sei.nShow = SW_SHOWNORMAL;
185 sei.lpVerb = NULL; 184 sei.lpVerb = NULL;
186 sei.lpFile = full_path.value().c_str(); 185 sei.lpFile = full_path.value().c_str();
187 if (::ShellExecuteExW(&sei)) 186 if (::ShellExecuteExW(&sei))
188 return true; 187 return true;
189 LONG_PTR error = reinterpret_cast<LONG_PTR>(sei.hInstApp); 188 LONG_PTR error = reinterpret_cast<LONG_PTR>(sei.hInstApp);
190 if ((error == SE_ERR_NOASSOC) && ask_for_app) 189 if ((error == SE_ERR_NOASSOC))
191 return OpenItemWithExternalApp(full_path.value()); 190 return OpenItemWithExternalApp(full_path.value());
192 return false; 191 return false;
193 } 192 }
194 193
195 // Show the Windows "Open With" dialog box to ask the user to pick an app to 194 // Show the Windows "Open With" dialog box to ask the user to pick an app to
196 // open the file with. 195 // open the file with.
197 bool OpenItemWithExternalApp(const std::wstring& full_path) { 196 bool OpenItemWithExternalApp(const std::wstring& full_path) {
198 SHELLEXECUTEINFO sei = { sizeof(sei) }; 197 SHELLEXECUTEINFO sei = { sizeof(sei) };
199 sei.fMask = SEE_MASK_FLAG_DDEWAIT; 198 sei.fMask = SEE_MASK_FLAG_DDEWAIT;
200 sei.nShow = SW_SHOWNORMAL; 199 sei.nShow = SW_SHOWNORMAL;
(...skipping 614 matching lines...)
815 814
816 gfx::Font GetWindowTitleFont() { 815 gfx::Font GetWindowTitleFont() {
817 NONCLIENTMETRICS ncm; 816 NONCLIENTMETRICS ncm;
818 win_util::GetNonClientMetrics(&ncm); 817 win_util::GetNonClientMetrics(&ncm);
819 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); 818 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont));
820 ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); 819 ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont)));
821 return gfx::Font::CreateFont(caption_font); 820 return gfx::Font::CreateFont(caption_font);
822 } 821 }
823 822
824 } // namespace win_util 823 } // namespace win_util
OLDNEW
« no previous file with comments | « app/win_util.h ('k') | chrome/browser/download/download_file.cc » ('j') | no next file with comments »

Powered by Google App Engine