Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: ui/aura/root_window.cc

Issue 9616045: Aura/Ash split: Move ScreenAura to ash::ScreenAsh. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use a separate aura::TestScreen in tests instead, partially reverting to patchset 2 Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/root_window.h ('k') | ui/aura/root_window_observer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "ui/aura/root_window.h" 5 #include "ui/aura/root_window.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/string_split.h" 15 #include "base/string_split.h"
16 #include "ui/aura/aura_switches.h" 16 #include "ui/aura/aura_switches.h"
17 #include "ui/aura/client/activation_client.h" 17 #include "ui/aura/client/activation_client.h"
18 #include "ui/aura/env.h" 18 #include "ui/aura/env.h"
19 #include "ui/aura/root_window_host.h" 19 #include "ui/aura/root_window_host.h"
20 #include "ui/aura/root_window_observer.h" 20 #include "ui/aura/root_window_observer.h"
21 #include "ui/aura/event.h" 21 #include "ui/aura/event.h"
22 #include "ui/aura/event_filter.h" 22 #include "ui/aura/event_filter.h"
23 #include "ui/aura/focus_manager.h" 23 #include "ui/aura/focus_manager.h"
24 #include "ui/aura/gestures/gesture_recognizer.h" 24 #include "ui/aura/gestures/gesture_recognizer.h"
25 #include "ui/aura/screen_aura.h"
26 #include "ui/aura/window.h" 25 #include "ui/aura/window.h"
27 #include "ui/aura/window_delegate.h" 26 #include "ui/aura/window_delegate.h"
28 #include "ui/base/hit_test.h" 27 #include "ui/base/hit_test.h"
29 #include "ui/gfx/compositor/compositor.h" 28 #include "ui/gfx/compositor/compositor.h"
30 #include "ui/gfx/compositor/layer.h" 29 #include "ui/gfx/compositor/layer.h"
31 #include "ui/gfx/compositor/layer_animator.h" 30 #include "ui/gfx/compositor/layer_animator.h"
32 31
33 using std::string; 32 using std::string;
34 using std::vector; 33 using std::vector;
35 34
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // RootWindow, public: 83 // RootWindow, public:
85 84
86 RootWindow::RootWindow() 85 RootWindow::RootWindow()
87 : Window(NULL), 86 : Window(NULL),
88 host_(aura::RootWindowHost::Create(GetInitialHostWindowBounds())), 87 host_(aura::RootWindowHost::Create(GetInitialHostWindowBounds())),
89 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)), 88 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)),
90 ALLOW_THIS_IN_INITIALIZER_LIST(event_factory_(this)), 89 ALLOW_THIS_IN_INITIALIZER_LIST(event_factory_(this)),
91 mouse_button_flags_(0), 90 mouse_button_flags_(0),
92 last_cursor_(kCursorNull), 91 last_cursor_(kCursorNull),
93 cursor_shown_(true), 92 cursor_shown_(true),
94 ALLOW_THIS_IN_INITIALIZER_LIST(screen_(new ScreenAura(this))),
95 capture_window_(NULL), 93 capture_window_(NULL),
96 mouse_pressed_handler_(NULL), 94 mouse_pressed_handler_(NULL),
97 mouse_moved_handler_(NULL), 95 mouse_moved_handler_(NULL),
98 focused_window_(NULL), 96 focused_window_(NULL),
99 touch_event_handler_(NULL), 97 touch_event_handler_(NULL),
100 gesture_handler_(NULL), 98 gesture_handler_(NULL),
101 ALLOW_THIS_IN_INITIALIZER_LIST( 99 ALLOW_THIS_IN_INITIALIZER_LIST(
102 gesture_recognizer_(GestureRecognizer::Create(this))), 100 gesture_recognizer_(GestureRecognizer::Create(this))),
103 synthesize_mouse_move_(false), 101 synthesize_mouse_move_(false),
104 waiting_on_compositing_end_(false), 102 waiting_on_compositing_end_(false),
105 draw_on_compositing_end_(false) { 103 draw_on_compositing_end_(false) {
106 SetName("RootWindow"); 104 SetName("RootWindow");
107 gfx::Screen::SetInstance(screen_);
108 last_mouse_location_ = host_->QueryMouseLocation(); 105 last_mouse_location_ = host_->QueryMouseLocation();
109 106
110 ui::Compositor::Initialize(false); 107 ui::Compositor::Initialize(false);
111 compositor_.reset(new ui::Compositor(this, host_->GetAcceleratedWidget(), 108 compositor_.reset(new ui::Compositor(this, host_->GetAcceleratedWidget(),
112 host_->GetSize())); 109 host_->GetSize()));
113 DCHECK(compositor_.get()); 110 DCHECK(compositor_.get());
114 compositor_->AddObserver(this); 111 compositor_->AddObserver(this);
115 Init(); 112 Init();
116 } 113 }
117 114
(...skipping 23 matching lines...) Expand all
141 last_mouse_location_ = host_->QueryMouseLocation(); 138 last_mouse_location_ = host_->QueryMouseLocation();
142 synthesize_mouse_move_ = false; 139 synthesize_mouse_move_ = false;
143 } 140 }
144 141
145 gfx::Size RootWindow::GetHostSize() const { 142 gfx::Size RootWindow::GetHostSize() const {
146 gfx::Rect rect(host_->GetSize()); 143 gfx::Rect rect(host_->GetSize());
147 layer()->transform().TransformRect(&rect); 144 layer()->transform().TransformRect(&rect);
148 return rect.size(); 145 return rect.size();
149 } 146 }
150 147
151 void RootWindow::SetScreenWorkAreaInsets(const gfx::Insets& insets) {
152 if (screen_->work_area_insets() == insets)
153 return;
154 screen_->set_work_area_insets(insets);
155 FOR_EACH_OBSERVER(RootWindowObserver, observers_,
156 OnScreenWorkAreaInsetsChanged());
157 }
158
159 void RootWindow::SetCursor(gfx::NativeCursor cursor) { 148 void RootWindow::SetCursor(gfx::NativeCursor cursor) {
160 last_cursor_ = cursor; 149 last_cursor_ = cursor;
161 // A lot of code seems to depend on NULL cursors actually showing an arrow, 150 // A lot of code seems to depend on NULL cursors actually showing an arrow,
162 // so just pass everything along to the host. 151 // so just pass everything along to the host.
163 host_->SetCursor(cursor); 152 host_->SetCursor(cursor);
164 } 153 }
165 154
166 void RootWindow::ShowCursor(bool show) { 155 void RootWindow::ShowCursor(bool show) {
167 cursor_shown_ = show; 156 cursor_shown_ = show;
168 host_->ShowCursor(show); 157 host_->ShowCursor(show);
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 // is currently broken. See/ crbug.com/107931. 822 // is currently broken. See/ crbug.com/107931.
834 MouseEvent event(ui::ET_MOUSE_MOVED, 823 MouseEvent event(ui::ET_MOUSE_MOVED,
835 orig_mouse_location, 824 orig_mouse_location,
836 orig_mouse_location, 825 orig_mouse_location,
837 ui::EF_IS_SYNTHESIZED); 826 ui::EF_IS_SYNTHESIZED);
838 DispatchMouseEvent(&event); 827 DispatchMouseEvent(&event);
839 #endif 828 #endif
840 } 829 }
841 830
842 } // namespace aura 831 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window.h ('k') | ui/aura/root_window_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698