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

Side by Side Diff: ash/frame/caption_buttons/frame_size_button.cc

Issue 2897993003: chromeos: converts WindowResizer to aura::Window (Closed)
Patch Set: remove include from exo Created 3 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
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/frame/caption_buttons/frame_size_button.h" 5 #include "ash/frame/caption_buttons/frame_size_button.h"
6 6
7 #include "ash/shell_port.h" 7 #include "ash/shell_port.h"
8 #include "ash/wm/window_positioning_utils.h" 8 #include "ash/wm/window_positioning_utils.h"
9 #include "ash/wm/window_state.h" 9 #include "ash/wm/window_state.h"
10 #include "ash/wm/wm_event.h" 10 #include "ash/wm/wm_event.h"
11 #include "ash/wm/workspace/phantom_window_controller.h" 11 #include "ash/wm/workspace/phantom_window_controller.h"
12 #include "ash/wm_window.h" 12 #include "ash/wm_window.h"
13 #include "base/i18n/rtl.h" 13 #include "base/i18n/rtl.h"
14 #include "ui/aura/window.h"
14 #include "ui/gfx/geometry/vector2d.h" 15 #include "ui/gfx/geometry/vector2d.h"
15 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
17 #include "ui/wm/core/coordinate_conversion.h"
16 18
17 namespace ash { 19 namespace ash {
18 20
19 namespace { 21 namespace {
20 22
21 // The default delay between the user pressing the size button and the buttons 23 // The default delay between the user pressing the size button and the buttons
22 // adjacent to the size button morphing into buttons for snapping left and 24 // adjacent to the size button morphing into buttons for snapping left and
23 // right. 25 // right.
24 const int kSetButtonsToSnapModeDelayMs = 150; 26 const int kSetButtonsToSnapModeDelayMs = 150;
25 27
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 case CAPTION_BUTTON_ICON_CLOSE: 205 case CAPTION_BUTTON_ICON_CLOSE:
204 case CAPTION_BUTTON_ICON_BACK: 206 case CAPTION_BUTTON_ICON_BACK:
205 case CAPTION_BUTTON_ICON_LOCATION: 207 case CAPTION_BUTTON_ICON_LOCATION:
206 case CAPTION_BUTTON_ICON_COUNT: 208 case CAPTION_BUTTON_ICON_COUNT:
207 NOTREACHED(); 209 NOTREACHED();
208 break; 210 break;
209 } 211 }
210 } 212 }
211 213
212 if (snap_type_ == SNAP_LEFT || snap_type_ == SNAP_RIGHT) { 214 if (snap_type_ == SNAP_LEFT || snap_type_ == SNAP_RIGHT) {
213 WmWindow* window = WmWindow::Get(frame_->GetNativeWindow()); 215 aura::Window* window = frame_->GetNativeWindow();
214 if (!phantom_window_controller_.get()) 216 if (!phantom_window_controller_.get()) {
215 phantom_window_controller_.reset(new PhantomWindowController(window)); 217 phantom_window_controller_.reset(
216 gfx::Rect phantom_bounds_in_parent = 218 new PhantomWindowController(WmWindow::Get(window)));
219 }
220 gfx::Rect phantom_bounds_in_screen =
217 (snap_type_ == SNAP_LEFT) 221 (snap_type_ == SNAP_LEFT)
218 ? wm::GetDefaultLeftSnappedWindowBoundsInParent(window) 222 ? wm::GetDefaultLeftSnappedWindowBoundsInParent(window)
219 : wm::GetDefaultRightSnappedWindowBoundsInParent(window); 223 : wm::GetDefaultRightSnappedWindowBoundsInParent(window);
220 phantom_window_controller_->Show( 224 ::wm::ConvertRectToScreen(window->parent(), &phantom_bounds_in_screen);
221 window->GetParent()->ConvertRectToScreen(phantom_bounds_in_parent)); 225 phantom_window_controller_->Show(phantom_bounds_in_screen);
222 } else { 226 } else {
223 phantom_window_controller_.reset(); 227 phantom_window_controller_.reset();
224 } 228 }
225 } 229 }
226 230
227 const FrameCaptionButton* FrameSizeButton::GetButtonToHover( 231 const FrameCaptionButton* FrameSizeButton::GetButtonToHover(
228 const gfx::Point& event_location_in_screen) const { 232 const gfx::Point& event_location_in_screen) const {
229 const FrameCaptionButton* closest_button = 233 const FrameCaptionButton* closest_button =
230 delegate_->GetButtonClosestTo(event_location_in_screen); 234 delegate_->GetButtonClosestTo(event_location_in_screen);
231 if ((closest_button->icon() == CAPTION_BUTTON_ICON_LEFT_SNAPPED || 235 if ((closest_button->icon() == CAPTION_BUTTON_ICON_LEFT_SNAPPED ||
(...skipping 29 matching lines...) Expand all
261 void FrameSizeButton::SetButtonsToNormalMode( 265 void FrameSizeButton::SetButtonsToNormalMode(
262 FrameSizeButtonDelegate::Animate animate) { 266 FrameSizeButtonDelegate::Animate animate) {
263 in_snap_mode_ = false; 267 in_snap_mode_ = false;
264 snap_type_ = SNAP_NONE; 268 snap_type_ = SNAP_NONE;
265 set_buttons_to_snap_mode_timer_.Stop(); 269 set_buttons_to_snap_mode_timer_.Stop();
266 delegate_->SetButtonsToNormal(animate); 270 delegate_->SetButtonsToNormal(animate);
267 phantom_window_controller_.reset(); 271 phantom_window_controller_.reset();
268 } 272 }
269 273
270 } // namespace ash 274 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_controller_unittest.cc ('k') | ash/shelf/shelf_window_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698