| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 if (reinterpret_cast<ULONG_PTR>(ShellExecuteA(NULL, "open", | 167 if (reinterpret_cast<ULONG_PTR>(ShellExecuteA(NULL, "open", |
| 168 escaped_url.c_str(), NULL, NULL, | 168 escaped_url.c_str(), NULL, NULL, |
| 169 SW_SHOWNORMAL)) <= 32) { | 169 SW_SHOWNORMAL)) <= 32) { |
| 170 // We fail to execute the call. We could display a message to the user. | 170 // We fail to execute the call. We could display a message to the user. |
| 171 // TODO(nsylvain): we should also add a dialog to warn on errors. See | 171 // TODO(nsylvain): we should also add a dialog to warn on errors. See |
| 172 // bug 1136923. | 172 // bug 1136923. |
| 173 return; | 173 return; |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 #if !defined(USE_AURA) |
| 177 gfx::NativeWindow GetTopLevel(gfx::NativeView view) { | 178 gfx::NativeWindow GetTopLevel(gfx::NativeView view) { |
| 178 return ::GetAncestor(view, GA_ROOT); | 179 return ::GetAncestor(view, GA_ROOT); |
| 179 } | 180 } |
| 180 | 181 |
| 181 gfx::NativeView GetParent(gfx::NativeView view) { | 182 gfx::NativeView GetParent(gfx::NativeView view) { |
| 182 return ::GetParent(view); | 183 return ::GetParent(view); |
| 183 } | 184 } |
| 184 | 185 |
| 185 bool IsWindowActive(gfx::NativeWindow window) { | 186 bool IsWindowActive(gfx::NativeWindow window) { |
| 186 return ::GetForegroundWindow() == window; | 187 return ::GetForegroundWindow() == window; |
| 187 } | 188 } |
| 188 | 189 |
| 189 void ActivateWindow(gfx::NativeWindow window) { | 190 void ActivateWindow(gfx::NativeWindow window) { |
| 190 ::SetForegroundWindow(window); | 191 ::SetForegroundWindow(window); |
| 191 } | 192 } |
| 192 | 193 |
| 193 bool IsVisible(gfx::NativeView view) { | 194 bool IsVisible(gfx::NativeView view) { |
| 194 // MSVC complains if we don't include != 0. | 195 // MSVC complains if we don't include != 0. |
| 195 return ::IsWindowVisible(view) != 0; | 196 return ::IsWindowVisible(view) != 0; |
| 196 } | 197 } |
| 198 #endif |
| 197 | 199 |
| 198 } // namespace platform_util | 200 } // namespace platform_util |
| OLD | NEW |