| 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_VIEWS_BROWSER_ACTION_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_BROWSER_ACTION_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_BROWSER_ACTION_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_BROWSER_ACTION_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/extensions/image_loading_tracker.h" | 10 #include "chrome/browser/extensions/image_loading_tracker.h" |
| 11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
| 12 #include "ui/views/context_menu_controller.h" | 12 #include "ui/views/context_menu_controller.h" |
| 13 #include "ui/views/controls/button/menu_button.h" | 13 #include "ui/views/controls/button/menu_button.h" |
| 14 #include "ui/views/controls/button/menu_button_listener.h" | 14 #include "ui/views/controls/button/menu_button_listener.h" |
| 15 #include "ui/views/drag_controller.h" | 15 #include "ui/views/drag_controller.h" |
| 16 #include "ui/views/view.h" | 16 #include "ui/views/view.h" |
| 17 | 17 |
| 18 class Browser; | 18 class Browser; |
| 19 class BrowserActionButton; | 19 class BrowserActionButton; |
| 20 class ExtensionAction; | 20 class ExtensionAction; |
| 21 | 21 |
| 22 namespace extensions { | 22 namespace extensions { |
| 23 class Extension; | 23 class Extension; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace gfx { |
| 27 class Image; |
| 28 } |
| 29 |
| 26 namespace views { | 30 namespace views { |
| 27 class MenuItemView; | 31 class MenuItemView; |
| 28 class MenuRunner; | 32 class MenuRunner; |
| 29 } | 33 } |
| 30 | 34 |
| 31 //////////////////////////////////////////////////////////////////////////////// | 35 //////////////////////////////////////////////////////////////////////////////// |
| 32 // BrowserActionView | 36 // BrowserActionView |
| 33 // A single entry in the browser action container. This contains the actual | 37 // A single entry in the browser action container. This contains the actual |
| 34 // BrowserActionButton, as well as the logic to paint the badge. | 38 // BrowserActionButton, as well as the logic to paint the badge. |
| 35 class BrowserActionView : public views::View { | 39 class BrowserActionView : public views::View { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // Notifications when to set button state to pushed/not pushed (for when the | 164 // Notifications when to set button state to pushed/not pushed (for when the |
| 161 // popup/context menu is hidden or shown by the container). | 165 // popup/context menu is hidden or shown by the container). |
| 162 void SetButtonPushed(); | 166 void SetButtonPushed(); |
| 163 void SetButtonNotPushed(); | 167 void SetButtonNotPushed(); |
| 164 | 168 |
| 165 // Whether the browser action is enabled on this tab. Note that we cannot use | 169 // Whether the browser action is enabled on this tab. Note that we cannot use |
| 166 // the built-in views enabled/SetEnabled because disabled views do not | 170 // the built-in views enabled/SetEnabled because disabled views do not |
| 167 // receive drag events. | 171 // receive drag events. |
| 168 bool IsEnabled(int tab_id) const; | 172 bool IsEnabled(int tab_id) const; |
| 169 | 173 |
| 174 // Returns button icon so it can be accessed during tests. |
| 175 gfx::ImageSkia GetIconForTest(); |
| 176 |
| 170 protected: | 177 protected: |
| 171 // Overridden from views::View: | 178 // Overridden from views::View: |
| 172 virtual void ViewHierarchyChanged(bool is_add, | 179 virtual void ViewHierarchyChanged(bool is_add, |
| 173 View* parent, | 180 View* parent, |
| 174 View* child) OVERRIDE; | 181 View* child) OVERRIDE; |
| 175 | 182 |
| 176 private: | 183 private: |
| 177 virtual ~BrowserActionButton(); | 184 virtual ~BrowserActionButton(); |
| 178 | 185 |
| 179 // Register an extension command if the extension has an active one. | 186 // Register an extension command if the extension has an active one. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 226 |
| 220 // Responsible for running the menu. | 227 // Responsible for running the menu. |
| 221 scoped_ptr<views::MenuRunner> menu_runner_; | 228 scoped_ptr<views::MenuRunner> menu_runner_; |
| 222 | 229 |
| 223 friend class base::DeleteHelper<BrowserActionButton>; | 230 friend class base::DeleteHelper<BrowserActionButton>; |
| 224 | 231 |
| 225 DISALLOW_COPY_AND_ASSIGN(BrowserActionButton); | 232 DISALLOW_COPY_AND_ASSIGN(BrowserActionButton); |
| 226 }; | 233 }; |
| 227 | 234 |
| 228 #endif // CHROME_BROWSER_UI_VIEWS_BROWSER_ACTION_VIEW_H_ | 235 #endif // CHROME_BROWSER_UI_VIEWS_BROWSER_ACTION_VIEW_H_ |
| OLD | NEW |