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

Side by Side Diff: ash/magnifier/partial_magnification_controller.cc

Issue 184903003: Window ownership -> WindowTreeHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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 | « ash/magnifier/magnification_controller_unittest.cc ('k') | ash/root_window_controller.cc » ('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 "ash/magnifier/partial_magnification_controller.h" 5 #include "ash/magnifier/partial_magnification_controller.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ui/aura/window_event_dispatcher.h" 9 #include "ui/aura/window_event_dispatcher.h"
10 #include "ui/views/corewm/compound_event_filter.h" 10 #include "ui/views/corewm/compound_event_filter.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 void PartialMagnificationController::CreateMagnifierWindow() { 130 void PartialMagnificationController::CreateMagnifierWindow() {
131 if (zoom_widget_) 131 if (zoom_widget_)
132 return; 132 return;
133 133
134 aura::Window* root_window = GetCurrentRootWindow(); 134 aura::Window* root_window = GetCurrentRootWindow();
135 if (!root_window) 135 if (!root_window)
136 return; 136 return;
137 137
138 root_window->AddObserver(this); 138 root_window->AddObserver(this);
139 139
140 gfx::Point mouse(root_window->GetDispatcher()->GetLastMouseLocationInRoot()); 140 gfx::Point mouse(
141 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot());
141 142
142 zoom_widget_ = new views::Widget; 143 zoom_widget_ = new views::Widget;
143 views::Widget::InitParams params( 144 views::Widget::InitParams params(
144 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 145 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
145 params.can_activate = false; 146 params.can_activate = false;
146 params.accept_events = false; 147 params.accept_events = false;
147 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 148 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
148 params.parent = root_window; 149 params.parent = root_window;
149 zoom_widget_->Init(params); 150 zoom_widget_->Init(params);
150 zoom_widget_->SetBounds(gfx::Rect(mouse.x() - kMagnifierWidth / 2, 151 zoom_widget_->SetBounds(gfx::Rect(mouse.x() - kMagnifierWidth / 2,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // Recreate the magnifier window by updating the scale factor. 196 // Recreate the magnifier window by updating the scale factor.
196 SetScale(GetScale()); 197 SetScale(GetScale());
197 } 198 }
198 199
199 aura::Window* PartialMagnificationController::GetCurrentRootWindow() { 200 aura::Window* PartialMagnificationController::GetCurrentRootWindow() {
200 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 201 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
201 for (aura::Window::Windows::const_iterator iter = root_windows.begin(); 202 for (aura::Window::Windows::const_iterator iter = root_windows.begin();
202 iter != root_windows.end(); ++iter) { 203 iter != root_windows.end(); ++iter) {
203 aura::Window* root_window = *iter; 204 aura::Window* root_window = *iter;
204 if (root_window->ContainsPointInRoot( 205 if (root_window->ContainsPointInRoot(
205 root_window->GetDispatcher()->GetLastMouseLocationInRoot())) 206 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot()))
206 return root_window; 207 return root_window;
207 } 208 }
208 return NULL; 209 return NULL;
209 } 210 }
210 211
211 } // namespace ash 212 } // namespace ash
OLDNEW
« no previous file with comments | « ash/magnifier/magnification_controller_unittest.cc ('k') | ash/root_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698