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> |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 if (message) | 111 if (message) |
112 LocalFree(message); | 112 LocalFree(message); |
113 } | 113 } |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 // Old ShellExecute crashes the process when the command for a given scheme | 117 // Old ShellExecute crashes the process when the command for a given scheme |
118 // is empty. This function tells if it is. | 118 // is empty. This function tells if it is. |
119 bool ValidateShellCommandForScheme(const std::string& scheme) { | 119 bool ValidateShellCommandForScheme(const std::string& scheme) { |
120 base::win::RegKey key; | 120 base::win::RegKey key; |
121 std::wstring registry_path = ASCIIToWide(scheme) + | 121 std::wstring registry_path = base::ASCIIToWide(scheme) + |
122 L"\\shell\\open\\command"; | 122 L"\\shell\\open\\command"; |
123 key.Open(HKEY_CLASSES_ROOT, registry_path.c_str(), KEY_READ); | 123 key.Open(HKEY_CLASSES_ROOT, registry_path.c_str(), KEY_READ); |
124 if (!key.Valid()) | 124 if (!key.Valid()) |
125 return false; | 125 return false; |
126 DWORD size = 0; | 126 DWORD size = 0; |
127 key.ReadValue(NULL, NULL, &size, NULL); | 127 key.ReadValue(NULL, NULL, &size, NULL); |
128 if (size <= 2) | 128 if (size <= 2) |
129 return false; | 129 return false; |
130 return true; | 130 return true; |
131 } | 131 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 ::SetForegroundWindow(window); | 197 ::SetForegroundWindow(window); |
198 } | 198 } |
199 | 199 |
200 bool IsVisible(gfx::NativeView view) { | 200 bool IsVisible(gfx::NativeView view) { |
201 // MSVC complains if we don't include != 0. | 201 // MSVC complains if we don't include != 0. |
202 return ::IsWindowVisible(view) != 0; | 202 return ::IsWindowVisible(view) != 0; |
203 } | 203 } |
204 #endif | 204 #endif |
205 | 205 |
206 } // namespace platform_util | 206 } // namespace platform_util |
OLD | NEW |