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

Side by Side Diff: ash/utility/partial_screenshot_controller.cc

Issue 1924703002: Rename gfx::Display/Screen to display::Display/Screen in ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « ash/utility/partial_screenshot_controller.h ('k') | ash/wm/ash_native_cursor_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/utility/partial_screenshot_controller.h" 5 #include "ash/utility/partial_screenshot_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "ash/display/mouse_cursor_event_filter.h" 9 #include "ash/display/mouse_cursor_event_filter.h"
10 #include "ash/screenshot_delegate.h" 10 #include "ash/screenshot_delegate.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/shell_window_ids.h" 12 #include "ash/shell_window_ids.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "ui/compositor/paint_recorder.h" 14 #include "ui/compositor/paint_recorder.h"
15 #include "ui/display/screen.h"
15 #include "ui/events/event.h" 16 #include "ui/events/event.h"
16 #include "ui/events/event_handler.h" 17 #include "ui/events/event_handler.h"
17 #include "ui/gfx/canvas.h" 18 #include "ui/gfx/canvas.h"
18 #include "ui/gfx/screen.h"
19 #include "ui/wm/core/cursor_manager.h" 19 #include "ui/wm/core/cursor_manager.h"
20 20
21 namespace ash { 21 namespace ash {
22 22
23 namespace { 23 namespace {
24 24
25 // The size to increase the invalidated area in the layer to repaint. The area 25 // The size to increase the invalidated area in the layer to repaint. The area
26 // should be slightly bigger than the actual region because the region indicator 26 // should be slightly bigger than the actual region because the region indicator
27 // rectangles are drawn outside of the selected region. 27 // rectangles are drawn outside of the selected region.
28 const int kInvalidateRegionAdditionalSize = 3; 28 const int kInvalidateRegionAdditionalSize = 3;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 void PartialScreenshotController::StartPartialScreenshotSession( 140 void PartialScreenshotController::StartPartialScreenshotSession(
141 ScreenshotDelegate* screenshot_delegate) { 141 ScreenshotDelegate* screenshot_delegate) {
142 // Already in a screenshot session. 142 // Already in a screenshot session.
143 if (screenshot_delegate_) { 143 if (screenshot_delegate_) {
144 DCHECK_EQ(screenshot_delegate_, screenshot_delegate); 144 DCHECK_EQ(screenshot_delegate_, screenshot_delegate);
145 return; 145 return;
146 } 146 }
147 147
148 screenshot_delegate_ = screenshot_delegate; 148 screenshot_delegate_ = screenshot_delegate;
149 gfx::Screen::GetScreen()->AddObserver(this); 149 display::Screen::GetScreen()->AddObserver(this);
150 for (aura::Window* root : Shell::GetAllRootWindows()) { 150 for (aura::Window* root : Shell::GetAllRootWindows()) {
151 layers_[root] = new PartialScreenshotLayer( 151 layers_[root] = new PartialScreenshotLayer(
152 Shell::GetContainer(root, kShellWindowId_OverlayContainer)->layer()); 152 Shell::GetContainer(root, kShellWindowId_OverlayContainer)->layer());
153 } 153 }
154 154
155 cursor_setter_.reset(new ScopedCursorSetter( 155 cursor_setter_.reset(new ScopedCursorSetter(
156 Shell::GetInstance()->cursor_manager(), ui::kCursorCross)); 156 Shell::GetInstance()->cursor_manager(), ui::kCursorCross));
157 157
158 EnableMouseWarp(false); 158 EnableMouseWarp(false);
159 } 159 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 if (!region.IsEmpty()) { 192 if (!region.IsEmpty()) {
193 screenshot_delegate_->HandleTakePartialScreenshot( 193 screenshot_delegate_->HandleTakePartialScreenshot(
194 root_window_, gfx::IntersectRects(root_window_->bounds(), region)); 194 root_window_, gfx::IntersectRects(root_window_->bounds(), region));
195 } 195 }
196 Cancel(); 196 Cancel();
197 } 197 }
198 198
199 void PartialScreenshotController::Cancel() { 199 void PartialScreenshotController::Cancel() {
200 root_window_ = nullptr; 200 root_window_ = nullptr;
201 screenshot_delegate_ = nullptr; 201 screenshot_delegate_ = nullptr;
202 gfx::Screen::GetScreen()->RemoveObserver(this); 202 display::Screen::GetScreen()->RemoveObserver(this);
203 STLDeleteValues(&layers_); 203 STLDeleteValues(&layers_);
204 cursor_setter_.reset(); 204 cursor_setter_.reset();
205 EnableMouseWarp(true); 205 EnableMouseWarp(true);
206 } 206 }
207 207
208 void PartialScreenshotController::Update(const ui::LocatedEvent& event) { 208 void PartialScreenshotController::Update(const ui::LocatedEvent& event) {
209 // Update may happen without MaybeStart() if the partial screenshot session 209 // Update may happen without MaybeStart() if the partial screenshot session
210 // starts when dragging. 210 // starts when dragging.
211 if (!root_window_) 211 if (!root_window_)
212 MaybeStart(event); 212 MaybeStart(event);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 Complete(); 266 Complete();
267 break; 267 break;
268 default: 268 default:
269 // Do nothing. 269 // Do nothing.
270 break; 270 break;
271 } 271 }
272 event->StopPropagation(); 272 event->StopPropagation();
273 } 273 }
274 274
275 void PartialScreenshotController::OnDisplayAdded( 275 void PartialScreenshotController::OnDisplayAdded(
276 const gfx::Display& new_display) { 276 const display::Display& new_display) {
277 if (!screenshot_delegate_) 277 if (!screenshot_delegate_)
278 return; 278 return;
279 Cancel(); 279 Cancel();
280 } 280 }
281 281
282 void PartialScreenshotController::OnDisplayRemoved( 282 void PartialScreenshotController::OnDisplayRemoved(
283 const gfx::Display& old_display) { 283 const display::Display& old_display) {
284 if (!screenshot_delegate_) 284 if (!screenshot_delegate_)
285 return; 285 return;
286 Cancel(); 286 Cancel();
287 } 287 }
288 288
289 void PartialScreenshotController::OnDisplayMetricsChanged( 289 void PartialScreenshotController::OnDisplayMetricsChanged(
290 const gfx::Display& display, 290 const display::Display& display,
291 uint32_t changed_metrics) { 291 uint32_t changed_metrics) {}
292 }
293 292
294 } // namespace ash 293 } // namespace ash
OLDNEW
« no previous file with comments | « ash/utility/partial_screenshot_controller.h ('k') | ash/wm/ash_native_cursor_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698