| 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_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 class ExtensionAction; | 13 class ExtensionAction; |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 | 16 |
| 17 // Interface for a class that controls the the extension icons that show up in | 17 // Interface for a class that controls the the extension icons that show up in |
| 18 // the location bar. Depending on switches, these icons can have differing | 18 // the location bar. Depending on switches, these icons can have differing |
| 19 // behavior. | 19 // behavior. |
| 20 class LocationBarController { | 20 class LocationBarController { |
| 21 public: | 21 public: |
| 22 // The reaction that the UI should take after executing |OnClicked|. | 22 // The reaction that the UI should take after executing |OnClicked|. |
| 23 enum Action { | 23 enum Action { |
| 24 ACTION_NONE, | 24 ACTION_NONE, |
| 25 ACTION_SHOW_POPUP, | 25 ACTION_SHOW_POPUP, |
| 26 ACTION_SHOW_CONTEXT_MENU, | 26 ACTION_SHOW_CONTEXT_MENU, |
| 27 ACTION_SHOW_SCRIPT_POPUP, |
| 27 }; | 28 }; |
| 28 | 29 |
| 29 virtual ~LocationBarController() {} | 30 virtual ~LocationBarController() {} |
| 30 | 31 |
| 31 // Utility to add any actions to |out| which aren't present in |actions|. | 32 // Utility to add any actions to |out| which aren't present in |actions|. |
| 32 static void AddMissingActions( | 33 static void AddMissingActions( |
| 33 const std::set<ExtensionAction*>& actions, | 34 const std::set<ExtensionAction*>& actions, |
| 34 std::vector<ExtensionAction*>* out); | 35 std::vector<ExtensionAction*>* out); |
| 35 | 36 |
| 36 // Gets the action data for all extensions. | 37 // Gets the action data for all extensions. |
| 37 virtual std::vector<ExtensionAction*> GetCurrentActions() = 0; | 38 virtual std::vector<ExtensionAction*> GetCurrentActions() = 0; |
| 38 | 39 |
| 39 // Notifies this that the badge for an extension has been clicked with some | 40 // Notifies this that the badge for an extension has been clicked with some |
| 40 // mouse button (1 for left, 2 for middle, and 3 for right click), and | 41 // mouse button (1 for left, 2 for middle, and 3 for right click), and |
| 41 // returns the action that should be taken in response (if any). | 42 // returns the action that should be taken in response (if any). |
| 42 // TODO(kalman): make mouse_button an enum. | 43 // TODO(kalman): make mouse_button an enum. |
| 43 virtual Action OnClicked(const std::string& extension_id, | 44 virtual Action OnClicked(const std::string& extension_id, |
| 44 int mouse_button) = 0; | 45 int mouse_button) = 0; |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 } // namespace extensions | 48 } // namespace extensions |
| 48 | 49 |
| 49 #endif // CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ | 50 #endif // CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ |
| OLD | NEW |