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

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

Issue 10675011: Rename the remaining usage of Monitor to Display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 5 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/monitor_manager.cc ('k') | ui/aura/single_display_manager.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 <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.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 "ui/aura/aura_switches.h" 14 #include "ui/aura/aura_switches.h"
15 #include "ui/aura/client/activation_client.h" 15 #include "ui/aura/client/activation_client.h"
16 #include "ui/aura/client/capture_client.h" 16 #include "ui/aura/client/capture_client.h"
17 #include "ui/aura/client/event_client.h" 17 #include "ui/aura/client/event_client.h"
18 #include "ui/aura/env.h" 18 #include "ui/aura/env.h"
19 #include "ui/aura/event.h" 19 #include "ui/aura/event.h"
20 #include "ui/aura/event_filter.h" 20 #include "ui/aura/event_filter.h"
21 #include "ui/aura/focus_manager.h" 21 #include "ui/aura/focus_manager.h"
22 #include "ui/aura/monitor_manager.h" 22 #include "ui/aura/display_manager.h"
23 #include "ui/aura/root_window_host.h" 23 #include "ui/aura/root_window_host.h"
24 #include "ui/aura/root_window_observer.h" 24 #include "ui/aura/root_window_observer.h"
25 #include "ui/aura/window.h" 25 #include "ui/aura/window.h"
26 #include "ui/aura/window_delegate.h" 26 #include "ui/aura/window_delegate.h"
27 #include "ui/base/gestures/gesture_recognizer.h" 27 #include "ui/base/gestures/gesture_recognizer.h"
28 #include "ui/base/gestures/gesture_types.h" 28 #include "ui/base/gestures/gesture_types.h"
29 #include "ui/base/hit_test.h" 29 #include "ui/base/hit_test.h"
30 #include "ui/compositor/compositor.h" 30 #include "ui/compositor/compositor.h"
31 #include "ui/compositor/dip_util.h" 31 #include "ui/compositor/dip_util.h"
32 #include "ui/compositor/layer.h" 32 #include "ui/compositor/layer.h"
(...skipping 24 matching lines...) Expand all
57 void GetEventFiltersToNotify(Window* target, EventFilters* filters) { 57 void GetEventFiltersToNotify(Window* target, EventFilters* filters) {
58 while (target) { 58 while (target) {
59 if (target->event_filter()) 59 if (target->event_filter())
60 filters->push_back(target->event_filter()); 60 filters->push_back(target->event_filter());
61 target = target->parent(); 61 target = target->parent();
62 } 62 }
63 if (Env::GetInstance()->event_filter()) 63 if (Env::GetInstance()->event_filter())
64 filters->push_back(Env::GetInstance()->event_filter()); 64 filters->push_back(Env::GetInstance()->event_filter());
65 } 65 }
66 66
67 float GetDeviceScaleFactorFromMonitor(const aura::Window* window) { 67 float GetDeviceScaleFactorFromDisplay(const aura::Window* window) {
68 MonitorManager* monitor_manager = Env::GetInstance()->monitor_manager(); 68 DisplayManager* display_manager = Env::GetInstance()->display_manager();
69 return monitor_manager->GetDisplayNearestWindow(window).device_scale_factor(); 69 return display_manager->GetDisplayNearestWindow(window).device_scale_factor();
70 } 70 }
71 71
72 Window* ConsumerToWindow(ui::GestureConsumer* consumer) { 72 Window* ConsumerToWindow(ui::GestureConsumer* consumer) {
73 return consumer && !consumer->ignores_events() ? 73 return consumer && !consumer->ignores_events() ?
74 static_cast<Window*>(consumer) : NULL; 74 static_cast<Window*>(consumer) : NULL;
75 } 75 }
76 76
77 } // namespace 77 } // namespace
78 78
79 CompositorLock::CompositorLock(RootWindow* root_window) 79 CompositorLock::CompositorLock(RootWindow* root_window)
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 147 }
148 148
149 // static 149 // static
150 RootWindow* RootWindow::GetForAcceleratedWidget( 150 RootWindow* RootWindow::GetForAcceleratedWidget(
151 gfx::AcceleratedWidget widget) { 151 gfx::AcceleratedWidget widget) {
152 RootWindowHost* host = RootWindowHost::GetForAcceleratedWidget(widget); 152 RootWindowHost* host = RootWindowHost::GetForAcceleratedWidget(widget);
153 return host ? host->GetRootWindow() : NULL; 153 return host ? host->GetRootWindow() : NULL;
154 } 154 }
155 155
156 void RootWindow::Init() { 156 void RootWindow::Init() {
157 compositor()->SetScaleAndSize(GetDeviceScaleFactorFromMonitor(this), 157 compositor()->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(this),
158 host_->GetBounds().size()); 158 host_->GetBounds().size());
159 Window::Init(ui::LAYER_NOT_DRAWN); 159 Window::Init(ui::LAYER_NOT_DRAWN);
160 last_mouse_location_ = 160 last_mouse_location_ =
161 ui::ConvertPointToDIP(layer(), host_->QueryMouseLocation()); 161 ui::ConvertPointToDIP(layer(), host_->QueryMouseLocation());
162 compositor()->SetRootLayer(layer()); 162 compositor()->SetRootLayer(layer());
163 SetBounds( 163 SetBounds(
164 ui::ConvertRectToDIP(layer(), gfx::Rect(host_->GetBounds().size()))); 164 ui::ConvertRectToDIP(layer(), gfx::Rect(host_->GetBounds().size())));
165 Show(); 165 Show();
166 host_->SetRootWindow(this); 166 host_->SetRootWindow(this);
167 } 167 }
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 ui::GestureStatus status = ProcessGestureEvent(target, &translated_event); 383 ui::GestureStatus status = ProcessGestureEvent(target, &translated_event);
384 return status != ui::GESTURE_STATUS_UNKNOWN; 384 return status != ui::GESTURE_STATUS_UNKNOWN;
385 } 385 }
386 386
387 return false; 387 return false;
388 } 388 }
389 389
390 void RootWindow::OnHostResized(const gfx::Size& size_in_pixel) { 390 void RootWindow::OnHostResized(const gfx::Size& size_in_pixel) {
391 DispatchHeldMouseMove(); 391 DispatchHeldMouseMove();
392 // The compositor should have the same size as the native root window host. 392 // The compositor should have the same size as the native root window host.
393 // Get the latest scale from monitor because it might have been changed. 393 // Get the latest scale from display because it might have been changed.
394 compositor_->SetScaleAndSize(GetDeviceScaleFactorFromMonitor(this), 394 compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(this),
395 size_in_pixel); 395 size_in_pixel);
396 gfx::Size old(bounds().size()); 396 gfx::Size old(bounds().size());
397 // The layer, and all the observers should be notified of the 397 // The layer, and all the observers should be notified of the
398 // transformed size of the root window. 398 // transformed size of the root window.
399 gfx::Rect bounds(ui::ConvertSizeToDIP(layer(), size_in_pixel)); 399 gfx::Rect bounds(ui::ConvertSizeToDIP(layer(), size_in_pixel));
400 layer()->transform().TransformRect(&bounds); 400 layer()->transform().TransformRect(&bounds);
401 SetBounds(bounds); 401 SetBounds(bounds);
402 FOR_EACH_OBSERVER(RootWindowObserver, observers_, 402 FOR_EACH_OBSERVER(RootWindowObserver, observers_,
403 OnRootWindowResized(this, old)); 403 OnRootWindowResized(this, old));
404 } 404 }
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 void RootWindow::UnlockCompositor() { 976 void RootWindow::UnlockCompositor() {
977 DCHECK(compositor_lock_); 977 DCHECK(compositor_lock_);
978 compositor_lock_ = NULL; 978 compositor_lock_ = NULL;
979 if (draw_on_compositor_unlock_) { 979 if (draw_on_compositor_unlock_) {
980 draw_on_compositor_unlock_ = false; 980 draw_on_compositor_unlock_ = false;
981 ScheduleDraw(); 981 ScheduleDraw();
982 } 982 }
983 } 983 }
984 984
985 } // namespace aura 985 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/monitor_manager.cc ('k') | ui/aura/single_display_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698