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

Side by Side Diff: ash/wm/partial_screenshot_view.cc

Issue 10827145: Convert Aura to use ui::Event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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/wm/partial_screenshot_view.h ('k') | ash/wm/shelf_layout_manager.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/wm/partial_screenshot_view.h" 5 #include "ash/wm/partial_screenshot_view.h"
6 6
7 #include "ash/screenshot_delegate.h" 7 #include "ash/screenshot_delegate.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/wm/overlay_event_filter.h" 10 #include "ash/wm/overlay_event_filter.h"
11 #include "ui/aura/root_window.h" 11 #include "ui/aura/root_window.h"
12 #include "ui/base/cursor/cursor.h" 12 #include "ui/base/cursor/cursor.h"
13 #include "ui/base/event.h"
13 #include "ui/gfx/canvas.h" 14 #include "ui/gfx/canvas.h"
14 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
15 #include "ui/views/view.h" 16 #include "ui/views/view.h"
16 #include "ui/views/widget/widget.h" 17 #include "ui/views/widget/widget.h"
17 18
18 namespace ash { 19 namespace ash {
19 20
20 PartialScreenshotView::PartialScreenshotView( 21 PartialScreenshotView::PartialScreenshotView(
21 ScreenshotDelegate* screenshot_delegate) 22 ScreenshotDelegate* screenshot_delegate)
22 : is_dragging_(false), 23 : is_dragging_(false),
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 return ui::kCursorCross; 64 return ui::kCursorCross;
64 } 65 }
65 66
66 void PartialScreenshotView::Cancel() { 67 void PartialScreenshotView::Cancel() {
67 Shell::GetInstance()->overlay_filter()->Deactivate(); 68 Shell::GetInstance()->overlay_filter()->Deactivate();
68 views::Widget* widget = GetWidget(); 69 views::Widget* widget = GetWidget();
69 if (widget) 70 if (widget)
70 widget->Close(); 71 widget->Close();
71 } 72 }
72 73
73 bool PartialScreenshotView::IsCancelingKeyEvent(aura::KeyEvent* event) { 74 bool PartialScreenshotView::IsCancelingKeyEvent(ui::KeyEvent* event) {
74 return event->key_code() == ui::VKEY_ESCAPE; 75 return event->key_code() == ui::VKEY_ESCAPE;
75 } 76 }
76 77
77 aura::Window* PartialScreenshotView::GetWindow() { 78 aura::Window* PartialScreenshotView::GetWindow() {
78 return GetWidget()->GetNativeWindow(); 79 return GetWidget()->GetNativeWindow();
79 } 80 }
80 81
81 void PartialScreenshotView::OnPaint(gfx::Canvas* canvas) { 82 void PartialScreenshotView::OnPaint(gfx::Canvas* canvas) {
82 if (is_dragging_) { 83 if (is_dragging_) {
83 // Screenshot area representation: black rectangle with white 84 // Screenshot area representation: black rectangle with white
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 128
128 gfx::Rect PartialScreenshotView::GetScreenshotRect() const { 129 gfx::Rect PartialScreenshotView::GetScreenshotRect() const {
129 int left = std::min(start_position_.x(), current_position_.x()); 130 int left = std::min(start_position_.x(), current_position_.x());
130 int top = std::min(start_position_.y(), current_position_.y()); 131 int top = std::min(start_position_.y(), current_position_.y());
131 int width = ::abs(start_position_.x() - current_position_.x()); 132 int width = ::abs(start_position_.x() - current_position_.x());
132 int height = ::abs(start_position_.y() - current_position_.y()); 133 int height = ::abs(start_position_.y() - current_position_.y());
133 return gfx::Rect(left, top, width, height); 134 return gfx::Rect(left, top, width, height);
134 } 135 }
135 136
136 } // namespace ash 137 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/partial_screenshot_view.h ('k') | ash/wm/shelf_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698