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 CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ |
6 #define CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ |
7 | 7 |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
| 11 #include "content/public/browser/host_zoom_map.h" |
11 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
12 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
13 #include "ui/base/accelerators/accelerator.h" | 14 #include "ui/base/accelerators/accelerator.h" |
14 #include "ui/base/models/button_menu_item_model.h" | 15 #include "ui/base/models/button_menu_item_model.h" |
15 #include "ui/base/models/simple_menu_model.h" | 16 #include "ui/base/models/simple_menu_model.h" |
16 | 17 |
17 class BookmarkSubMenuModel; | 18 class BookmarkSubMenuModel; |
18 class Browser; | 19 class Browser; |
19 class GlobalError; | 20 class GlobalError; |
20 class RecentTabsSubMenuModel; | 21 class RecentTabsSubMenuModel; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 scoped_ptr<EncodingMenuModel> encoding_menu_model_; | 71 scoped_ptr<EncodingMenuModel> encoding_menu_model_; |
71 | 72 |
72 DISALLOW_COPY_AND_ASSIGN(ToolsMenuModel); | 73 DISALLOW_COPY_AND_ASSIGN(ToolsMenuModel); |
73 }; | 74 }; |
74 | 75 |
75 // A menu model that builds the contents of the wrench menu. | 76 // A menu model that builds the contents of the wrench menu. |
76 class WrenchMenuModel : public ui::SimpleMenuModel, | 77 class WrenchMenuModel : public ui::SimpleMenuModel, |
77 public ui::SimpleMenuModel::Delegate, | 78 public ui::SimpleMenuModel::Delegate, |
78 public ui::ButtonMenuItemModel::Delegate, | 79 public ui::ButtonMenuItemModel::Delegate, |
79 public TabStripModelObserver, | 80 public TabStripModelObserver, |
| 81 public content::HostZoomMap::Observer, |
80 public content::NotificationObserver { | 82 public content::NotificationObserver { |
81 public: | 83 public: |
82 // TODO: remove |is_new_menu| and |supports_new_separators|. | 84 // TODO: remove |is_new_menu| and |supports_new_separators|. |
83 WrenchMenuModel(ui::AcceleratorProvider* provider, | 85 WrenchMenuModel(ui::AcceleratorProvider* provider, |
84 Browser* browser, | 86 Browser* browser, |
85 bool is_new_menu, | 87 bool is_new_menu, |
86 bool supports_new_separators); | 88 bool supports_new_separators); |
87 virtual ~WrenchMenuModel(); | 89 virtual ~WrenchMenuModel(); |
88 | 90 |
89 // Overridden for ButtonMenuItemModel::Delegate: | 91 // Overridden for ButtonMenuItemModel::Delegate: |
(...skipping 16 matching lines...) Expand all Loading... |
106 virtual void ActiveTabChanged(content::WebContents* old_contents, | 108 virtual void ActiveTabChanged(content::WebContents* old_contents, |
107 content::WebContents* new_contents, | 109 content::WebContents* new_contents, |
108 int index, | 110 int index, |
109 bool user_gesture) OVERRIDE; | 111 bool user_gesture) OVERRIDE; |
110 virtual void TabReplacedAt(TabStripModel* tab_strip_model, | 112 virtual void TabReplacedAt(TabStripModel* tab_strip_model, |
111 content::WebContents* old_contents, | 113 content::WebContents* old_contents, |
112 content::WebContents* new_contents, | 114 content::WebContents* new_contents, |
113 int index) OVERRIDE; | 115 int index) OVERRIDE; |
114 virtual void TabStripModelDeleted() OVERRIDE; | 116 virtual void TabStripModelDeleted() OVERRIDE; |
115 | 117 |
| 118 // Overriden from content::HostZoomMap::Observer: |
| 119 virtual void OnZoomLevelChanged(const std::string& host) OVERRIDE; |
| 120 |
116 // Overridden from content::NotificationObserver: | 121 // Overridden from content::NotificationObserver: |
117 virtual void Observe(int type, | 122 virtual void Observe(int type, |
118 const content::NotificationSource& source, | 123 const content::NotificationSource& source, |
119 const content::NotificationDetails& details) OVERRIDE; | 124 const content::NotificationDetails& details) OVERRIDE; |
120 | 125 |
121 // Getters. | 126 // Getters. |
122 Browser* browser() const { return browser_; } | 127 Browser* browser() const { return browser_; } |
123 | 128 |
124 BookmarkSubMenuModel* bookmark_sub_menu_model() const { | 129 BookmarkSubMenuModel* bookmark_sub_menu_model() const { |
125 return bookmark_sub_menu_model_.get(); | 130 return bookmark_sub_menu_model_.get(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 179 |
175 Browser* browser_; // weak | 180 Browser* browser_; // weak |
176 TabStripModel* tab_strip_model_; // weak | 181 TabStripModel* tab_strip_model_; // weak |
177 | 182 |
178 content::NotificationRegistrar registrar_; | 183 content::NotificationRegistrar registrar_; |
179 | 184 |
180 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); | 185 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); |
181 }; | 186 }; |
182 | 187 |
183 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ | 188 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ |
OLD | NEW |