OLD | NEW |
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/wm/window_positioning_utils.h" | 8 #include "ash/wm/window_positioning_utils.h" |
8 #include "ash/wm/window_state.h" | 9 #include "ash/wm/window_state.h" |
9 #include "ash/wm/wm_event.h" | 10 #include "ash/wm/wm_event.h" |
10 #include "ash/wm/workspace/phantom_window_controller.h" | 11 #include "ash/wm/workspace/phantom_window_controller.h" |
11 #include "ash/wm_shell.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/gfx/geometry/vector2d.h" | 14 #include "ui/gfx/geometry/vector2d.h" |
15 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
16 | 16 |
17 namespace ash { | 17 namespace ash { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 // The default delay between the user pressing the size button and the buttons | 21 // The default delay between the user pressing the size button and the buttons |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // event. | 241 // event. |
242 UpdateSnapType(event); | 242 UpdateSnapType(event); |
243 | 243 |
244 if (in_snap_mode_ && (snap_type_ == SNAP_LEFT || snap_type_ == SNAP_RIGHT)) { | 244 if (in_snap_mode_ && (snap_type_ == SNAP_LEFT || snap_type_ == SNAP_RIGHT)) { |
245 WmWindow* window = WmWindow::Get(frame_->GetNativeWindow()); | 245 WmWindow* window = WmWindow::Get(frame_->GetNativeWindow()); |
246 wm::WindowState* window_state = window->GetWindowState(); | 246 wm::WindowState* window_state = window->GetWindowState(); |
247 const wm::WMEvent snap_event(snap_type_ == SNAP_LEFT | 247 const wm::WMEvent snap_event(snap_type_ == SNAP_LEFT |
248 ? wm::WM_EVENT_SNAP_LEFT | 248 ? wm::WM_EVENT_SNAP_LEFT |
249 : wm::WM_EVENT_SNAP_RIGHT); | 249 : wm::WM_EVENT_SNAP_RIGHT); |
250 window_state->OnWMEvent(&snap_event); | 250 window_state->OnWMEvent(&snap_event); |
251 WmShell::Get()->RecordUserMetricsAction( | 251 ShellPort::Get()->RecordUserMetricsAction( |
252 snap_type_ == SNAP_LEFT ? UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_LEFT | 252 snap_type_ == SNAP_LEFT ? UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_LEFT |
253 : UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_RIGHT); | 253 : UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_RIGHT); |
254 SetButtonsToNormalMode(FrameSizeButtonDelegate::ANIMATE_NO); | 254 SetButtonsToNormalMode(FrameSizeButtonDelegate::ANIMATE_NO); |
255 return true; | 255 return true; |
256 } | 256 } |
257 SetButtonsToNormalMode(FrameSizeButtonDelegate::ANIMATE_YES); | 257 SetButtonsToNormalMode(FrameSizeButtonDelegate::ANIMATE_YES); |
258 return false; | 258 return false; |
259 } | 259 } |
260 | 260 |
261 void FrameSizeButton::SetButtonsToNormalMode( | 261 void FrameSizeButton::SetButtonsToNormalMode( |
262 FrameSizeButtonDelegate::Animate animate) { | 262 FrameSizeButtonDelegate::Animate animate) { |
263 in_snap_mode_ = false; | 263 in_snap_mode_ = false; |
264 snap_type_ = SNAP_NONE; | 264 snap_type_ = SNAP_NONE; |
265 set_buttons_to_snap_mode_timer_.Stop(); | 265 set_buttons_to_snap_mode_timer_.Stop(); |
266 delegate_->SetButtonsToNormal(animate); | 266 delegate_->SetButtonsToNormal(animate); |
267 phantom_window_controller_.reset(); | 267 phantom_window_controller_.reset(); |
268 } | 268 } |
269 | 269 |
270 } // namespace ash | 270 } // namespace ash |
OLD | NEW |