Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: chrome/browser/extensions/extension_action_manager.h

Issue 415813003: Improve extension icon prediction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify icon logic, clean up unit tests Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_EXTENSION_ACTION_MANAGER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_MANAGER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_MANAGER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/scoped_observer.h" 11 #include "base/scoped_observer.h"
12 #include "chrome/common/extensions/api/extension_action/action_info.h"
12 #include "components/keyed_service/core/keyed_service.h" 13 #include "components/keyed_service/core/keyed_service.h"
13 #include "extensions/browser/extension_registry_observer.h" 14 #include "extensions/browser/extension_registry_observer.h"
14 15
15 class ExtensionAction; 16 class ExtensionAction;
16 class Profile; 17 class Profile;
17 18
18 namespace extensions { 19 namespace extensions {
19 20
20 class Extension; 21 class Extension;
21 class ExtensionRegistry; 22 class ExtensionRegistry;
(...skipping 12 matching lines...) Expand all
34 35
35 // Retrieves the page action, or browser action for |extension|. 36 // Retrieves the page action, or browser action for |extension|.
36 // If the result is not NULL, it remains valid until the extension is 37 // If the result is not NULL, it remains valid until the extension is
37 // unloaded. 38 // unloaded.
38 ExtensionAction* GetPageAction(const extensions::Extension& extension) const; 39 ExtensionAction* GetPageAction(const extensions::Extension& extension) const;
39 ExtensionAction* GetBrowserAction( 40 ExtensionAction* GetBrowserAction(
40 const extensions::Extension& extension) const; 41 const extensions::Extension& extension) const;
41 ExtensionAction* GetSystemIndicator( 42 ExtensionAction* GetSystemIndicator(
42 const extensions::Extension& extension) const; 43 const extensions::Extension& extension) const;
43 44
45 // Gets the best fit ExtensionAction for the given |extension|.
not at google - send to devlin 2014/08/07 22:14:15 you might want to say, "this takes into account th
gpdavis 2014/08/07 23:48:35 Done.
46 scoped_ptr<ExtensionAction> GetBestFitAction(
47 const extensions::Extension& extension,
48 extensions::ActionInfo::Type type) const;
49
44 private: 50 private:
45 // Implement ExtensionRegistryObserver. 51 // Implement ExtensionRegistryObserver.
46 virtual void OnExtensionUnloaded(content::BrowserContext* browser_context, 52 virtual void OnExtensionUnloaded(content::BrowserContext* browser_context,
47 const Extension* extension, 53 const Extension* extension,
48 UnloadedExtensionInfo::Reason reason) 54 UnloadedExtensionInfo::Reason reason)
49 OVERRIDE; 55 OVERRIDE;
50 56
51 Profile* profile_; 57 Profile* profile_;
52 58
53 // Listen to extension unloaded notifications. 59 // Listen to extension unloaded notifications.
54 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> 60 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
55 extension_registry_observer_; 61 extension_registry_observer_;
56 62
57 // Keyed by Extension ID. These maps are populated lazily when their 63 // Keyed by Extension ID. These maps are populated lazily when their
58 // ExtensionAction is first requested, and the entries are removed when the 64 // ExtensionAction is first requested, and the entries are removed when the
59 // extension is unloaded. Not every extension has a page action or browser 65 // extension is unloaded. Not every extension has a page action or browser
60 // action. 66 // action.
61 typedef std::map<std::string, linked_ptr<ExtensionAction> > ExtIdToActionMap; 67 typedef std::map<std::string, linked_ptr<ExtensionAction> > ExtIdToActionMap;
62 mutable ExtIdToActionMap page_actions_; 68 mutable ExtIdToActionMap page_actions_;
63 mutable ExtIdToActionMap browser_actions_; 69 mutable ExtIdToActionMap browser_actions_;
64 mutable ExtIdToActionMap system_indicators_; 70 mutable ExtIdToActionMap system_indicators_;
65 }; 71 };
66 72
67 } // namespace extensions 73 } // namespace extensions
68 74
69 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_MANAGER_H_ 75 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698