OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
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 "ui/viewer/viewer_host_win.h" | |
6 | |
7 #include "ui/aura/client/stacking_client.h" | |
8 #include "ui/aura/display_manager.h" | |
9 #include "ui/aura/env.h" | |
10 #include "ui/aura/focus_manager.h" | |
11 #include "ui/aura/root_window.h" | |
12 #include "ui/aura/shared/root_window_capture_client.h" | |
13 #include "ui/aura/single_display_manager.h" | |
14 | |
15 class ViewerStackingClient : public aura::client::StackingClient { | |
16 public: | |
17 explicit ViewerStackingClient(aura::RootWindow* root_window) | |
18 : root_window_(root_window) { | |
19 aura::client::SetStackingClient(this); | |
20 } | |
21 | |
22 virtual ~ViewerStackingClient() { | |
23 aura::client::SetStackingClient(NULL); | |
24 } | |
25 | |
26 // Overridden from aura::client::StackingClient: | |
27 virtual aura::Window* GetDefaultParent(aura::Window* window, | |
28 const gfx::Rect& bounds) OVERRIDE { | |
29 return root_window_; | |
30 } | |
31 | |
32 private: | |
33 aura::RootWindow* root_window_; | |
34 | |
35 scoped_ptr<aura::shared::RootWindowCaptureClient> capture_client_; | |
36 | |
37 DISALLOW_COPY_AND_ASSIGN(ViewerStackingClient); | |
38 }; | |
39 | |
40 ViewerHostWin::ViewerHostWin() { | |
41 aura::DisplayManager::set_use_fullscreen_host_window(true); | |
42 aura::Env::GetInstance()->SetDisplayManager(new aura::SingleDisplayManager); | |
43 root_window_.reset(aura::DisplayManager::CreateRootWindowForPrimaryDisplay()); | |
44 root_window_capture_client_.reset( | |
45 new aura::shared::RootWindowCaptureClient(root_window_.get())); | |
46 focus_manager_.reset(new aura::FocusManager); | |
47 root_window_->set_focus_manager(focus_manager_.get()); | |
48 stacking_client_.reset(new ViewerStackingClient(root_window_.get())); | |
49 root_window_->ShowRootWindow(); | |
50 } | |
51 | |
52 ViewerHostWin::~ViewerHostWin() { | |
53 } | |
OLD | NEW |