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