OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_MENU_MODEL_H_ | 5 #ifndef CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_MENU_MODEL_H_ |
6 #define CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_MENU_MODEL_H_ | 6 #define CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_MENU_MODEL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "ui/base/models/simple_menu_model.h" | 13 #include "ui/base/models/simple_menu_model.h" |
14 | 14 |
15 namespace gfx { | 15 namespace gfx { |
16 class Image; | 16 class Image; |
17 } | 17 } |
18 | 18 |
19 class StatusIconMenuModelTest; | |
20 | |
21 // StatusIconMenuModel contains the state of the SimpleMenuModel as well as that | 19 // StatusIconMenuModel contains the state of the SimpleMenuModel as well as that |
22 // of its delegate. This is done so that we can easily identify when the menu | 20 // of its delegate. This is done so that we can easily identify when the menu |
23 // model state has changed and can tell the status icon to update the menu. This | 21 // model state has changed and can tell the status icon to update the menu. This |
24 // is necessary some platforms which do not notify us before showing the menu | 22 // is necessary some platforms which do not notify us before showing the menu |
25 // (like Ubuntu Unity). | 23 // (like Ubuntu Unity). |
26 class StatusIconMenuModel | 24 class StatusIconMenuModel |
27 : public ui::SimpleMenuModel, | 25 : public ui::SimpleMenuModel, |
28 public ui::SimpleMenuModel::Delegate, | 26 public ui::SimpleMenuModel::Delegate, |
29 public base::SupportsWeakPtr<StatusIconMenuModel> { | 27 public base::SupportsWeakPtr<StatusIconMenuModel> { |
30 public: | 28 public: |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 ItemStateMap item_states_; | 108 ItemStateMap item_states_; |
111 | 109 |
112 base::ObserverList<Observer> observer_list_; | 110 base::ObserverList<Observer> observer_list_; |
113 | 111 |
114 Delegate* delegate_; | 112 Delegate* delegate_; |
115 | 113 |
116 DISALLOW_COPY_AND_ASSIGN(StatusIconMenuModel); | 114 DISALLOW_COPY_AND_ASSIGN(StatusIconMenuModel); |
117 }; | 115 }; |
118 | 116 |
119 #endif // CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_MENU_MODEL_H_ | 117 #endif // CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_MENU_MODEL_H_ |
OLD | NEW |