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

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

Issue 10442017: Rename GetRootWindow() -> GetPrimaryRootWindow() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git-try -b linux_chromeos,win_aura Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/panel_layout_manager.cc ('k') | ash/wm/power_button_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/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/partial_screenshot_event_filter.h" 10 #include "ash/wm/partial_screenshot_event_filter.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 46 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
47 params.transparent = true; 47 params.transparent = true;
48 params.delegate = view; 48 params.delegate = view;
49 // The partial screenshot rectangle has to be at the real top of 49 // The partial screenshot rectangle has to be at the real top of
50 // the screen. 50 // the screen.
51 params.parent = Shell::GetInstance()->GetContainer( 51 params.parent = Shell::GetInstance()->GetContainer(
52 internal::kShellWindowId_OverlayContainer); 52 internal::kShellWindowId_OverlayContainer);
53 53
54 widget->Init(params); 54 widget->Init(params);
55 widget->SetContentsView(view); 55 widget->SetContentsView(view);
56 widget->SetBounds(Shell::GetRootWindow()->bounds()); 56 widget->SetBounds(Shell::GetPrimaryRootWindow()->bounds());
57 widget->GetNativeView()->SetName("PartialScreenshotView"); 57 widget->GetNativeView()->SetName("PartialScreenshotView");
58 widget->StackAtTop(); 58 widget->StackAtTop();
59 widget->Show(); 59 widget->Show();
60 // Captures mouse events in case that context menu already captures the 60 // Captures mouse events in case that context menu already captures the
61 // events. This will close the context menu. 61 // events. This will close the context menu.
62 widget->GetNativeView()->SetCapture(); 62 widget->GetNativeView()->SetCapture();
63 63
64 view->set_window(widget->GetNativeWindow()); 64 view->set_window(widget->GetNativeWindow());
65 Shell::GetInstance()->partial_screenshot_filter()->Activate(view); 65 Shell::GetInstance()->partial_screenshot_filter()->Activate(view);
66 } 66 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 return true; 110 return true;
111 } 111 }
112 112
113 void PartialScreenshotView::OnMouseReleased(const views::MouseEvent& event) { 113 void PartialScreenshotView::OnMouseReleased(const views::MouseEvent& event) {
114 Cancel(); 114 Cancel();
115 if (!is_dragging_) 115 if (!is_dragging_)
116 return; 116 return;
117 117
118 is_dragging_ = false; 118 is_dragging_ = false;
119 if (screenshot_delegate_) { 119 if (screenshot_delegate_) {
120 aura::RootWindow *root_window = Shell::GetRootWindow(); 120 aura::RootWindow *root_window = Shell::GetPrimaryRootWindow();
121 screenshot_delegate_->HandleTakePartialScreenshot( 121 screenshot_delegate_->HandleTakePartialScreenshot(
122 root_window, root_window->bounds().Intersect(GetScreenshotRect())); 122 root_window, root_window->bounds().Intersect(GetScreenshotRect()));
123 } 123 }
124 } 124 }
125 125
126 gfx::Rect PartialScreenshotView::GetScreenshotRect() const { 126 gfx::Rect PartialScreenshotView::GetScreenshotRect() const {
127 int left = std::min(start_position_.x(), current_position_.x()); 127 int left = std::min(start_position_.x(), current_position_.x());
128 int top = std::min(start_position_.y(), current_position_.y()); 128 int top = std::min(start_position_.y(), current_position_.y());
129 int width = ::abs(start_position_.x() - current_position_.x()); 129 int width = ::abs(start_position_.x() - current_position_.x());
130 int height = ::abs(start_position_.y() - current_position_.y()); 130 int height = ::abs(start_position_.y() - current_position_.y());
131 return gfx::Rect(left, top, width, height); 131 return gfx::Rect(left, top, width, height);
132 } 132 }
133 133
134 } // namespace ash 134 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/panel_layout_manager.cc ('k') | ash/wm/power_button_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698