OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/views/frame/browser_frame_ashwin.h" | 5 #include "chrome/browser/ui/views/frame/browser_frame_ashwin.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "chrome/browser/metro_utils/metro_chrome_win.h" | 9 #include "chrome/browser/metro_utils/metro_chrome_win.h" |
10 #include "ui/aura/remote_root_window_host_win.h" | 10 #include "ui/aura/remote_root_window_host_win.h" |
11 | 11 |
12 BrowserFrameAshWin::BrowserFrameAshWin(BrowserFrame* browser_frame, | 12 BrowserFrameAshWin::BrowserFrameAshWin(BrowserFrame* browser_frame, |
13 BrowserView* browser_view) | 13 BrowserView* browser_view) |
14 : BrowserFrameAsh(browser_frame, browser_view) { | 14 : BrowserFrameAsh(browser_frame, browser_view) { |
15 } | 15 } |
16 | 16 |
17 BrowserFrameAshWin::~BrowserFrameAshWin() { | 17 BrowserFrameAshWin::~BrowserFrameAshWin() { |
18 } | 18 } |
19 | 19 |
20 void BrowserFrameAshWin::OnWindowFocused(aura::Window* gained_focus, | 20 void BrowserFrameAshWin::OnWindowFocused(aura::Window* gained_focus, |
21 aura::Window* lost_focus) { | 21 aura::Window* lost_focus) { |
22 BrowserFrameAsh::OnWindowFocused(gained_focus, lost_focus); | 22 BrowserFrameAsh::OnWindowFocused(gained_focus, lost_focus); |
23 if (GetNativeWindow() != gained_focus) | 23 if (GetNativeWindow() != gained_focus) |
24 return; | 24 return; |
25 | 25 |
26 // If the activated window is in Metro mode, and the viewer process window is | 26 // If the activated window is in Metro mode, and the viewer process window is |
27 // not in the foreground, activate Metro Chrome. | 27 // not in the foreground, activate Metro Chrome. |
28 if (!aura::RemoteWindowTreeHostWin::Instance()->IsForegroundWindow()) { | 28 if (!aura::RemoteRootWindowHostWin::Instance()->IsForegroundWindow()) { |
29 // PostTask because ActivateMetroChrome can not be called nested in another | 29 // PostTask because ActivateMetroChrome can not be called nested in another |
30 // ::SendMessage(). | 30 // ::SendMessage(). |
31 base::MessageLoop::current()->PostTask( | 31 base::MessageLoop::current()->PostTask( |
32 FROM_HERE, | 32 FROM_HERE, |
33 base::Bind(base::IgnoreResult(chrome::ActivateMetroChrome))); | 33 base::Bind(base::IgnoreResult(chrome::ActivateMetroChrome))); |
34 } | 34 } |
35 } | 35 } |
OLD | NEW |