[email protected] | 0477e8e6 | 2012-02-27 12:05:29 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 94fbaa4 | 2011-09-07 20:09:54 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #include "chrome/browser/platform_util.h" | ||||
6 | |||||
[email protected] | 94fbaa4 | 2011-09-07 20:09:54 | [diff] [blame] | 7 | #include "base/logging.h" |
[email protected] | f94f0f1 | 2011-09-14 21:14:01 | [diff] [blame] | 8 | #include "ui/aura/window.h" |
[email protected] | 94fbaa4 | 2011-09-07 20:09:54 | [diff] [blame] | 9 | |
[email protected] | 65d12044 | 2012-04-12 02:09:16 | [diff] [blame] | 10 | #if defined(USE_ASH) |
11 | #include "ash/wm/window_util.h" | ||||
12 | #endif | ||||
13 | |||||
[email protected] | 94fbaa4 | 2011-09-07 20:09:54 | [diff] [blame] | 14 | namespace platform_util { |
15 | |||||
[email protected] | 94fbaa4 | 2011-09-07 20:09:54 | [diff] [blame] | 16 | gfx::NativeWindow GetTopLevel(gfx::NativeView view) { |
[email protected] | 9331fce | 2011-11-30 21:48:32 | [diff] [blame] | 17 | return view->GetToplevelWindow(); |
[email protected] | 94fbaa4 | 2011-09-07 20:09:54 | [diff] [blame] | 18 | } |
19 | |||||
20 | gfx::NativeView GetParent(gfx::NativeView view) { | ||||
21 | return view->parent(); | ||||
22 | } | ||||
23 | |||||
24 | bool IsWindowActive(gfx::NativeWindow window) { | ||||
[email protected] | 65d12044 | 2012-04-12 02:09:16 | [diff] [blame] | 25 | #if defined(USE_ASH) |
[email protected] | 0477e8e6 | 2012-02-27 12:05:29 | [diff] [blame] | 26 | return ash::wm::IsActiveWindow(window); |
[email protected] | 65d12044 | 2012-04-12 02:09:16 | [diff] [blame] | 27 | #else |
28 | NOTIMPLEMENTED(); | ||||
29 | return false; | ||||
30 | #endif | ||||
[email protected] | 94fbaa4 | 2011-09-07 20:09:54 | [diff] [blame] | 31 | } |
32 | |||||
33 | void ActivateWindow(gfx::NativeWindow window) { | ||||
[email protected] | 65d12044 | 2012-04-12 02:09:16 | [diff] [blame] | 34 | #if defined(USE_ASH) |
[email protected] | 0477e8e6 | 2012-02-27 12:05:29 | [diff] [blame] | 35 | ash::wm::ActivateWindow(window); |
[email protected] | 65d12044 | 2012-04-12 02:09:16 | [diff] [blame] | 36 | #else |
37 | NOTIMPLEMENTED(); | ||||
38 | #endif | ||||
[email protected] | 94fbaa4 | 2011-09-07 20:09:54 | [diff] [blame] | 39 | } |
40 | |||||
41 | bool IsVisible(gfx::NativeView view) { | ||||
[email protected] | 908fbf4 | 2011-10-05 14:40:17 | [diff] [blame] | 42 | return view->IsVisible(); |
[email protected] | 94fbaa4 | 2011-09-07 20:09:54 | [diff] [blame] | 43 | } |
44 | |||||
45 | } // namespace platform_util |