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

Side by Side Diff: ui/views/controls/menu/menu_item_view.h

Issue 148143004: Add notification mechanism when BrowserActionButton's icon has been updated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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 UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_
6 #define UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ 6 #define UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // activated by way of space/return keys. Activating a focusable child results 54 // activated by way of space/return keys. Activating a focusable child results
55 // in |AcceleratorPressed| being invoked. Note, that as menus try not to steal 55 // in |AcceleratorPressed| being invoked. Note, that as menus try not to steal
56 // focus from the hosting window child views do not actually get focus. Instead 56 // focus from the hosting window child views do not actually get focus. Instead
57 // |SetHotTracked| is used as the user navigates around. 57 // |SetHotTracked| is used as the user navigates around.
58 // 58 //
59 // To show the menu use MenuRunner. See MenuRunner for details on how to run 59 // To show the menu use MenuRunner. See MenuRunner for details on how to run
60 // (show) the menu as well as for details on the life time of the menu. 60 // (show) the menu as well as for details on the life time of the menu.
61 61
62 class VIEWS_EXPORT MenuItemView : public View { 62 class VIEWS_EXPORT MenuItemView : public View {
63 public: 63 public:
64 // The LifecycleObserver will receive a notification when the MenuItemView has
65 // been deleted.
66 class LifecycleObserver {
67 public:
68 virtual ~LifecycleObserver() {}
69 virtual void OnDeleted(MenuItemView* view) = 0;
70 };
71
72 void set_lifecycle_observer(LifecycleObserver* lifecycle_observer) {
73 lifecycle_observer_ = lifecycle_observer;
74 }
75
64 friend class MenuController; 76 friend class MenuController;
65 77
66 // The menu item view's class name. 78 // The menu item view's class name.
67 static const char kViewClassName[]; 79 static const char kViewClassName[];
68 80
69 // ID used to identify menu items. 81 // ID used to identify menu items.
70 static const int kMenuItemViewID; 82 static const int kMenuItemViewID;
71 83
72 // ID used to identify empty menu items. 84 // ID used to identify empty menu items.
73 static const int kEmptyMenuItemViewID; 85 static const int kEmptyMenuItemViewID;
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 // |menu_position_| is the requested position with respect to the bounds. 531 // |menu_position_| is the requested position with respect to the bounds.
520 // |actual_menu_position_| is used by the controller to cache the 532 // |actual_menu_position_| is used by the controller to cache the
521 // position of the menu being shown. 533 // position of the menu being shown.
522 MenuPosition requested_menu_position_; 534 MenuPosition requested_menu_position_;
523 MenuPosition actual_menu_position_; 535 MenuPosition actual_menu_position_;
524 536
525 // If set to false, the right margin will be removed for menu lines 537 // If set to false, the right margin will be removed for menu lines
526 // containing other elements. 538 // containing other elements.
527 bool use_right_margin_; 539 bool use_right_margin_;
528 540
541 // The observer that we need to notify when the menu item view has been
542 // deleted.
543 LifecycleObserver* lifecycle_observer_;
544
529 DISALLOW_COPY_AND_ASSIGN(MenuItemView); 545 DISALLOW_COPY_AND_ASSIGN(MenuItemView);
530 }; 546 };
531 547
532 } // namespace views 548 } // namespace views
533 549
534 #endif // UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ 550 #endif // UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698