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

Side by Side Diff: ash/common/shelf/shelf_view.h

Issue 2718563008: mash: Use mojo for ShelfItemDelegate and [app] MenuItem. (Closed)
Patch Set: Address comments. Created 3 years, 9 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 (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_COMMON_SHELF_SHELF_VIEW_H_ 5 #ifndef ASH_COMMON_SHELF_SHELF_VIEW_H_
6 #define ASH_COMMON_SHELF_SHELF_VIEW_H_ 6 #define ASH_COMMON_SHELF_SHELF_VIEW_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "ash/common/shelf/ink_drop_button_listener.h" 13 #include "ash/common/shelf/ink_drop_button_listener.h"
14 #include "ash/common/shelf/shelf_button_pressed_metric_tracker.h" 14 #include "ash/common/shelf/shelf_button_pressed_metric_tracker.h"
15 #include "ash/common/shelf/shelf_item_delegate.h"
16 #include "ash/common/shelf/shelf_model_observer.h" 15 #include "ash/common/shelf/shelf_model_observer.h"
17 #include "ash/common/shelf/shelf_tooltip_manager.h" 16 #include "ash/common/shelf/shelf_tooltip_manager.h"
17 #include "ash/public/interfaces/shelf.mojom.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/weak_ptr.h"
19 #include "third_party/skia/include/core/SkColor.h" 20 #include "third_party/skia/include/core/SkColor.h"
20 #include "ui/app_list/views/app_list_drag_and_drop_host.h" 21 #include "ui/app_list/views/app_list_drag_and_drop_host.h"
21 #include "ui/views/animation/bounds_animator_observer.h" 22 #include "ui/views/animation/bounds_animator_observer.h"
22 #include "ui/views/animation/ink_drop_state.h" 23 #include "ui/views/animation/ink_drop_state.h"
23 #include "ui/views/context_menu_controller.h" 24 #include "ui/views/context_menu_controller.h"
24 #include "ui/views/controls/button/button.h" 25 #include "ui/views/controls/button/button.h"
25 #include "ui/views/focus/focus_manager.h" 26 #include "ui/views/focus/focus_manager.h"
26 #include "ui/views/view.h" 27 #include "ui/views/view.h"
27 #include "ui/views/view_model.h" 28 #include "ui/views/view_model.h"
28 29
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 284
284 // Overridden from ui::EventHandler: 285 // Overridden from ui::EventHandler:
285 void OnGestureEvent(ui::GestureEvent* event) override; 286 void OnGestureEvent(ui::GestureEvent* event) override;
286 287
287 // Overridden from ShelfModelObserver: 288 // Overridden from ShelfModelObserver:
288 void ShelfItemAdded(int model_index) override; 289 void ShelfItemAdded(int model_index) override;
289 void ShelfItemRemoved(int model_index, ShelfID id) override; 290 void ShelfItemRemoved(int model_index, ShelfID id) override;
290 void ShelfItemChanged(int model_index, const ShelfItem& old_item) override; 291 void ShelfItemChanged(int model_index, const ShelfItem& old_item) override;
291 void ShelfItemMoved(int start_index, int target_index) override; 292 void ShelfItemMoved(int start_index, int target_index) override;
292 void OnSetShelfItemDelegate(ShelfID id, 293 void OnSetShelfItemDelegate(ShelfID id,
293 ShelfItemDelegate* item_delegate) override; 294 mojom::ShelfItemDelegate* item_delegate) override;
295
296 // Handles the result of an item selection, records the |action| taken and
297 // optionally shows an application menu with the given |menu_items|.
298 void AfterItemSelected(const ShelfItem& item,
299 views::Button* sender,
300 std::unique_ptr<ui::Event> event,
301 views::InkDrop* ink_drop,
302 ShelfAction action,
303 std::vector<mojom::MenuItemPtr> menu_items);
294 304
295 // Show a list of all running items for this shelf |item|; it only shows a 305 // Show a list of all running items for this shelf |item|; it only shows a
296 // menu if there are multiple running items. |source| specifies the view 306 // menu if there are multiple running items. |source| specifies the view
297 // responsible for showing the menu, and the bubble will point towards it. 307 // responsible for showing the menu, and the bubble will point towards it.
298 // The |event_flags| are the flags of the event which triggered this menu. 308 // The |event_flags| are the flags of the event which triggered this menu.
299 // Returns |true| if a menu is shown. 309 // Returns |true| if a menu is shown.
300 bool ShowListMenuForView(const ShelfItem& item, 310 bool ShowListMenuForView(const ShelfItem& item,
301 views::View* source, 311 views::View* source,
302 const ui::Event& event, 312 const ui::Event& event,
303 views::InkDrop* ink_drop); 313 views::InkDrop* ink_drop);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 bool is_repost_event_on_same_item_; 465 bool is_repost_event_on_same_item_;
456 466
457 // Record the index for the last pressed shelf item. This variable is used to 467 // Record the index for the last pressed shelf item. This variable is used to
458 // check if a repost event occurs on the same shelf item as previous one. If 468 // check if a repost event occurs on the same shelf item as previous one. If
459 // so, the repost event should be ignored. 469 // so, the repost event should be ignored.
460 int last_pressed_index_; 470 int last_pressed_index_;
461 471
462 // Tracks UMA metrics based on shelf button press actions. 472 // Tracks UMA metrics based on shelf button press actions.
463 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_; 473 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_;
464 474
475 base::WeakPtrFactory<ShelfView> weak_factory_;
476
465 DISALLOW_COPY_AND_ASSIGN(ShelfView); 477 DISALLOW_COPY_AND_ASSIGN(ShelfView);
466 }; 478 };
467 479
468 } // namespace ash 480 } // namespace ash
469 481
470 #endif // ASH_COMMON_SHELF_SHELF_VIEW_H_ 482 #endif // ASH_COMMON_SHELF_SHELF_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698