app_list: Re-enable people search.
[chromium-blink-merge.git] / chrome / browser / extensions / location_bar_controller.h
blobe67430a7cf5bc3cff21498fd807bff1e31f8a967
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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_
8 #include <map>
9 #include <vector>
11 #include "base/macros.h"
12 #include "base/memory/linked_ptr.h"
13 #include "base/scoped_observer.h"
14 #include "extensions/browser/extension_registry_observer.h"
16 class ExtensionAction;
18 namespace content {
19 class WebContents;
20 class BrowserContext;
23 namespace extensions {
24 class Extension;
25 class ExtensionActionManager;
26 class ExtensionRegistry;
28 // Provides the UI with the current page actions for extensions. The execution
29 // of these actions is handled in the ExtensionActionAPI.
30 class LocationBarController : public ExtensionRegistryObserver {
31 public:
32 explicit LocationBarController(content::WebContents* web_contents);
33 ~LocationBarController() override;
35 // Returns the actions which should be displayed in the location bar.
36 std::vector<ExtensionAction*> GetCurrentActions();
38 private:
39 // ExtensionRegistryObserver implementation.
40 void OnExtensionLoaded(content::BrowserContext* browser_context,
41 const Extension* extension) override;
42 void OnExtensionUnloaded(content::BrowserContext* browser_context,
43 const Extension* extension,
44 UnloadedExtensionInfo::Reason reason) override;
46 // The associated WebContents.
47 content::WebContents* web_contents_;
49 // The associated BrowserContext.
50 content::BrowserContext* browser_context_;
52 // The ExtensionActionManager to provide page actions.
53 ExtensionActionManager* action_manager_;
55 // Whether or not to show page actions in the location bar at all. (This is
56 // false with the toolbar redesign enabled.)
57 bool should_show_page_actions_;
59 // Manufactured page actions that have been generated for extensions that want
60 // to run a script, but were blocked.
61 typedef std::map<std::string, linked_ptr<ExtensionAction> >
62 ExtensionActionMap;
63 ExtensionActionMap active_script_actions_;
65 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
66 extension_registry_observer_;
68 DISALLOW_COPY_AND_ASSIGN(LocationBarController);
71 } // namespace extensions
73 #endif // CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_