| OLD | NEW |
| 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/shelf/shelf_view.h" | 5 #include "ash/shelf/shelf_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/aura/wm_window_aura.h" | 10 #include "ash/aura/wm_window_aura.h" |
| 11 #include "ash/common/ash_constants.h" | 11 #include "ash/common/ash_constants.h" |
| 12 #include "ash/common/ash_switches.h" | 12 #include "ash/common/ash_switches.h" |
| 13 #include "ash/common/shelf/app_list_button.h" | 13 #include "ash/common/shelf/app_list_button.h" |
| 14 #include "ash/common/shelf/overflow_bubble.h" | 14 #include "ash/common/shelf/overflow_bubble.h" |
| 15 #include "ash/common/shelf/overflow_bubble_view.h" | 15 #include "ash/common/shelf/overflow_bubble_view.h" |
| 16 #include "ash/common/shelf/overflow_button.h" | 16 #include "ash/common/shelf/overflow_button.h" |
| 17 #include "ash/common/shelf/shelf_constants.h" | 17 #include "ash/common/shelf/shelf_constants.h" |
| 18 #include "ash/common/shelf/shelf_delegate.h" |
| 18 #include "ash/common/shelf/shelf_menu_model.h" | 19 #include "ash/common/shelf/shelf_menu_model.h" |
| 19 #include "ash/common/shelf/shelf_model.h" | 20 #include "ash/common/shelf/shelf_model.h" |
| 20 #include "ash/common/shell_delegate.h" | 21 #include "ash/common/shell_delegate.h" |
| 21 #include "ash/common/wm/root_window_finder.h" | 22 #include "ash/common/wm/root_window_finder.h" |
| 22 #include "ash/common/wm_shell.h" | 23 #include "ash/common/wm_shell.h" |
| 23 #include "ash/drag_drop/drag_image_view.h" | 24 #include "ash/drag_drop/drag_image_view.h" |
| 24 #include "ash/scoped_target_root_window.h" | 25 #include "ash/scoped_target_root_window.h" |
| 25 #include "ash/shelf/shelf.h" | 26 #include "ash/shelf/shelf.h" |
| 26 #include "ash/shelf/shelf_button.h" | 27 #include "ash/shelf/shelf_button.h" |
| 27 #include "ash/shelf/shelf_delegate.h" | |
| 28 #include "ash/shelf/shelf_icon_observer.h" | 28 #include "ash/shelf/shelf_icon_observer.h" |
| 29 #include "ash/shelf/shelf_widget.h" | 29 #include "ash/shelf/shelf_widget.h" |
| 30 #include "ash/shell.h" | 30 #include "ash/shell.h" |
| 31 #include "base/auto_reset.h" | 31 #include "base/auto_reset.h" |
| 32 #include "base/metrics/histogram.h" | 32 #include "base/metrics/histogram.h" |
| 33 #include "grit/ash_strings.h" | 33 #include "grit/ash_strings.h" |
| 34 #include "ui/accessibility/ax_view_state.h" | 34 #include "ui/accessibility/ax_view_state.h" |
| 35 #include "ui/aura/client/screen_position_client.h" | 35 #include "ui/aura/client/screen_position_client.h" |
| 36 #include "ui/aura/window.h" | 36 #include "ui/aura/window.h" |
| 37 #include "ui/aura/window_event_dispatcher.h" | 37 #include "ui/aura/window_event_dispatcher.h" |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 drag_and_drop_shelf_id_(0), | 383 drag_and_drop_shelf_id_(0), |
| 384 drag_replaced_view_(nullptr), | 384 drag_replaced_view_(nullptr), |
| 385 dragged_off_shelf_(false), | 385 dragged_off_shelf_(false), |
| 386 snap_back_from_rip_off_view_(nullptr), | 386 snap_back_from_rip_off_view_(nullptr), |
| 387 overflow_mode_(false), | 387 overflow_mode_(false), |
| 388 main_shelf_(nullptr), | 388 main_shelf_(nullptr), |
| 389 dragged_off_from_overflow_to_shelf_(false), | 389 dragged_off_from_overflow_to_shelf_(false), |
| 390 is_repost_event_on_same_item_(false), | 390 is_repost_event_on_same_item_(false), |
| 391 last_pressed_index_(-1) { | 391 last_pressed_index_(-1) { |
| 392 DCHECK(model_); | 392 DCHECK(model_); |
| 393 DCHECK(delegate_); |
| 393 DCHECK(wm_shelf_); | 394 DCHECK(wm_shelf_); |
| 394 bounds_animator_.reset(new views::BoundsAnimator(this)); | 395 bounds_animator_.reset(new views::BoundsAnimator(this)); |
| 395 bounds_animator_->AddObserver(this); | 396 bounds_animator_->AddObserver(this); |
| 396 set_context_menu_controller(this); | 397 set_context_menu_controller(this); |
| 397 focus_search_.reset(new ShelfFocusSearch(view_model_.get())); | 398 focus_search_.reset(new ShelfFocusSearch(view_model_.get())); |
| 398 } | 399 } |
| 399 | 400 |
| 400 ShelfView::~ShelfView() { | 401 ShelfView::~ShelfView() { |
| 401 bounds_animator_->RemoveObserver(this); | 402 bounds_animator_->RemoveObserver(this); |
| 402 model_->RemoveObserver(this); | 403 model_->RemoveObserver(this); |
| (...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1906 | 1907 |
| 1907 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1908 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
| 1908 const gfx::Rect bounds = GetBoundsInScreen(); | 1909 const gfx::Rect bounds = GetBoundsInScreen(); |
| 1909 int distance = shelf_->SelectValueForShelfAlignment( | 1910 int distance = shelf_->SelectValueForShelfAlignment( |
| 1910 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1911 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
| 1911 bounds.x() - coordinate.x()); | 1912 bounds.x() - coordinate.x()); |
| 1912 return distance > 0 ? distance : 0; | 1913 return distance > 0 ? distance : 0; |
| 1913 } | 1914 } |
| 1914 | 1915 |
| 1915 } // namespace ash | 1916 } // namespace ash |
| OLD | NEW |