| 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 #ifndef ASH_SHELF_SHELF_VIEW_H_ | 5 #ifndef ASH_SHELF_SHELF_VIEW_H_ |
| 6 #define ASH_SHELF_SHELF_VIEW_H_ | 6 #define ASH_SHELF_SHELF_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 WmShelf* wm_shelf() const { return wm_shelf_; } | 77 WmShelf* wm_shelf() const { return wm_shelf_; } |
| 78 ShelfModel* model() const { return model_; } | 78 ShelfModel* model() const { return model_; } |
| 79 | 79 |
| 80 void Init(); | 80 void Init(); |
| 81 | 81 |
| 82 void OnShelfAlignmentChanged(); | 82 void OnShelfAlignmentChanged(); |
| 83 | 83 |
| 84 // Returns the ideal bounds of the specified item, or an empty rect if id | 84 // Returns the ideal bounds of the specified item, or an empty rect if id |
| 85 // isn't know. If the item is in an overflow shelf, the overflow icon location | 85 // isn't know. If the item is in an overflow shelf, the overflow icon location |
| 86 // will be returned. | 86 // will be returned. |
| 87 gfx::Rect GetIdealBoundsOfItemIcon(ShelfID id); | 87 gfx::Rect GetIdealBoundsOfItemIcon(const ShelfID& id); |
| 88 | 88 |
| 89 // Repositions the icon for the specified item by the midpoint of the window. | 89 // Repositions the icon for the specified item by the midpoint of the window. |
| 90 void UpdatePanelIconPosition(ShelfID id, const gfx::Point& midpoint); | 90 void UpdatePanelIconPosition(const ShelfID& id, const gfx::Point& midpoint); |
| 91 | 91 |
| 92 // Returns true if we're showing a menu. | 92 // Returns true if we're showing a menu. |
| 93 bool IsShowingMenu() const; | 93 bool IsShowingMenu() const; |
| 94 | 94 |
| 95 // Returns true if overflow bubble is shown. | 95 // Returns true if overflow bubble is shown. |
| 96 bool IsShowingOverflowBubble() const; | 96 bool IsShowingOverflowBubble() const; |
| 97 | 97 |
| 98 // Sets owner overflow bubble instance from which this shelf view pops | 98 // Sets owner overflow bubble instance from which this shelf view pops |
| 99 // out as overflow. | 99 // out as overflow. |
| 100 void set_owner_overflow_bubble(OverflowBubble* owner) { | 100 void set_owner_overflow_bubble(OverflowBubble* owner) { |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 // |dragging_| is set only if the mouse is dragged far enough. | 388 // |dragging_| is set only if the mouse is dragged far enough. |
| 389 ShelfButton* drag_view_ = nullptr; | 389 ShelfButton* drag_view_ = nullptr; |
| 390 | 390 |
| 391 // Position of the mouse down event in |drag_view_|'s coordinates. | 391 // Position of the mouse down event in |drag_view_|'s coordinates. |
| 392 gfx::Point drag_origin_; | 392 gfx::Point drag_origin_; |
| 393 | 393 |
| 394 // Index |drag_view_| was initially at. | 394 // Index |drag_view_| was initially at. |
| 395 int start_drag_index_ = -1; | 395 int start_drag_index_ = -1; |
| 396 | 396 |
| 397 // Used for the context menu of a particular item. | 397 // Used for the context menu of a particular item. |
| 398 ShelfID context_menu_id_ = 0; | 398 ShelfID context_menu_id_; |
| 399 | 399 |
| 400 std::unique_ptr<views::FocusSearch> focus_search_; | 400 std::unique_ptr<views::FocusSearch> focus_search_; |
| 401 | 401 |
| 402 // Manages the context menu, and the list menu. | 402 // Manages the context menu, and the list menu. |
| 403 std::unique_ptr<ui::MenuModel> menu_model_; | 403 std::unique_ptr<ui::MenuModel> menu_model_; |
| 404 std::unique_ptr<views::MenuModelAdapter> menu_model_adapter_; | 404 std::unique_ptr<views::MenuModelAdapter> menu_model_adapter_; |
| 405 std::unique_ptr<views::MenuRunner> launcher_menu_runner_; | 405 std::unique_ptr<views::MenuRunner> launcher_menu_runner_; |
| 406 std::unique_ptr<ScopedRootWindowForNewWindows> | 406 std::unique_ptr<ScopedRootWindowForNewWindows> |
| 407 scoped_root_window_for_new_windows_; | 407 scoped_root_window_for_new_windows_; |
| 408 | 408 |
| 409 // True when an item being inserted or removed in the model cancels a drag. | 409 // True when an item being inserted or removed in the model cancels a drag. |
| 410 bool cancelling_drag_model_changed_ = false; | 410 bool cancelling_drag_model_changed_ = false; |
| 411 | 411 |
| 412 // Index of the last hidden launcher item. If there are no hidden items this | 412 // Index of the last hidden launcher item. If there are no hidden items this |
| 413 // will be equal to last_visible_index_ + 1. | 413 // will be equal to last_visible_index_ + 1. |
| 414 mutable int last_hidden_index_ = 0; | 414 mutable int last_hidden_index_ = 0; |
| 415 | 415 |
| 416 // The timestamp of the event which closed the last menu - or 0. | 416 // The timestamp of the event which closed the last menu - or 0. |
| 417 base::TimeTicks closing_event_time_; | 417 base::TimeTicks closing_event_time_; |
| 418 | 418 |
| 419 // The timestamp of the last shelf item touch press event. | 419 // The timestamp of the last shelf item touch press event. |
| 420 base::TimeTicks touch_press_time_; | 420 base::TimeTicks touch_press_time_; |
| 421 | 421 |
| 422 // True if a drag and drop operation created/pinned the item in the launcher | 422 // True if a drag and drop operation created/pinned the item in the launcher |
| 423 // and it needs to be deleted/unpinned again if the operation gets cancelled. | 423 // and it needs to be deleted/unpinned again if the operation gets cancelled. |
| 424 bool drag_and_drop_item_pinned_ = false; | 424 bool drag_and_drop_item_pinned_ = false; |
| 425 | 425 |
| 426 // The ShelfItem which is currently used for a drag and a drop operation | 426 // The ShelfItem currently used for drag and drop; empty if none. |
| 427 // or 0 otherwise. | 427 ShelfID drag_and_drop_shelf_id_; |
| 428 ShelfID drag_and_drop_shelf_id_ = 0; | |
| 429 | 428 |
| 430 // The application ID of the application which we drag and drop. | 429 // The application ID of the application which we drag and drop. |
| 431 std::string drag_and_drop_app_id_; | 430 std::string drag_and_drop_app_id_; |
| 432 | 431 |
| 433 // The original launcher item's size before the dragging operation. | 432 // The original launcher item's size before the dragging operation. |
| 434 gfx::Size pre_drag_and_drop_size_; | 433 gfx::Size pre_drag_and_drop_size_; |
| 435 | 434 |
| 436 // The image proxy for drag operations when a drag and drop host exists and | 435 // The image proxy for drag operations when a drag and drop host exists and |
| 437 // the item can be dragged outside the app grid. | 436 // the item can be dragged outside the app grid. |
| 438 std::unique_ptr<ash::DragImageView> drag_image_; | 437 std::unique_ptr<ash::DragImageView> drag_image_; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_; | 470 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_; |
| 472 | 471 |
| 473 base::WeakPtrFactory<ShelfView> weak_factory_; | 472 base::WeakPtrFactory<ShelfView> weak_factory_; |
| 474 | 473 |
| 475 DISALLOW_COPY_AND_ASSIGN(ShelfView); | 474 DISALLOW_COPY_AND_ASSIGN(ShelfView); |
| 476 }; | 475 }; |
| 477 | 476 |
| 478 } // namespace ash | 477 } // namespace ash |
| 479 | 478 |
| 480 #endif // ASH_SHELF_SHELF_VIEW_H_ | 479 #endif // ASH_SHELF_SHELF_VIEW_H_ |
| OLD | NEW |