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

Side by Side Diff: chrome/browser/extensions/api/extension_action/extension_action_api.h

Issue 496403003: Remove NOTIFICATION_EXTENSION_PAGE_ACTIONS_UPDATED (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest master for CQ Created 6 years, 3 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 | Annotate | Revision Log
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_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 26 matching lines...) Expand all
37 public: 37 public:
38 // Called when there is a change to the given |extension_action|. 38 // Called when there is a change to the given |extension_action|.
39 // |web_contents| is the web contents that was affected, and 39 // |web_contents| is the web contents that was affected, and
40 // |browser_context| is the associated BrowserContext. (The latter is 40 // |browser_context| is the associated BrowserContext. (The latter is
41 // included because ExtensionActionAPI is shared between normal and 41 // included because ExtensionActionAPI is shared between normal and
42 // incognito contexts, so |browser_context| may not equal 42 // incognito contexts, so |browser_context| may not equal
43 // |browser_context_|.) 43 // |browser_context_|.)
44 virtual void OnExtensionActionUpdated( 44 virtual void OnExtensionActionUpdated(
45 ExtensionAction* extension_action, 45 ExtensionAction* extension_action,
46 content::WebContents* web_contents, 46 content::WebContents* web_contents,
47 content::BrowserContext* browser_context) = 0; 47 content::BrowserContext* browser_context);
48
49 // Called when the page actions have been refreshed do to a possible change
50 // in count or visibility.
51 virtual void OnPageActionsUpdated(content::WebContents* web_contents);
48 52
49 // Called when the ExtensionActionAPI is shutting down, giving observers a 53 // Called when the ExtensionActionAPI is shutting down, giving observers a
50 // chance to unregister themselves if there is not a definitive lifecycle. 54 // chance to unregister themselves if there is not a definitive lifecycle.
51 virtual void OnExtensionActionAPIShuttingDown() {} 55 virtual void OnExtensionActionAPIShuttingDown();
52 56
53 protected: 57 protected:
54 virtual ~Observer() {} 58 virtual ~Observer();
55 }; 59 };
56 60
57 explicit ExtensionActionAPI(content::BrowserContext* context); 61 explicit ExtensionActionAPI(content::BrowserContext* context);
58 virtual ~ExtensionActionAPI(); 62 virtual ~ExtensionActionAPI();
59 63
60 // Convenience method to get the instance for a profile. 64 // Convenience method to get the instance for a profile.
61 static ExtensionActionAPI* Get(content::BrowserContext* context); 65 static ExtensionActionAPI* Get(content::BrowserContext* context);
62 66
63 static bool GetBrowserActionVisibility(const ExtensionPrefs* prefs, 67 static bool GetBrowserActionVisibility(const ExtensionPrefs* prefs,
64 const std::string& extension_id); 68 const std::string& extension_id);
(...skipping 11 matching lines...) Expand all
76 80
77 // Executes the action of the given |extension| on the |browser|'s active 81 // Executes the action of the given |extension| on the |browser|'s active
78 // web contents. If |grant_tab_permissions| is true, this will also grant 82 // web contents. If |grant_tab_permissions| is true, this will also grant
79 // activeTab to the extension (so this should only be done if this is through 83 // activeTab to the extension (so this should only be done if this is through
80 // a direct user action). Returns the action that should be taken. 84 // a direct user action). Returns the action that should be taken.
81 ExtensionAction::ShowAction ExecuteExtensionAction( 85 ExtensionAction::ShowAction ExecuteExtensionAction(
82 const Extension* extension, 86 const Extension* extension,
83 Browser* browser, 87 Browser* browser,
84 bool grant_active_tab_permissions); 88 bool grant_active_tab_permissions);
85 89
90 // Notifies that there has been a change in the given |extension_action|.
86 void NotifyChange(ExtensionAction* extension_action, 91 void NotifyChange(ExtensionAction* extension_action,
87 content::WebContents* web_contents, 92 content::WebContents* web_contents,
88 content::BrowserContext* browser_context); 93 content::BrowserContext* browser_context);
89 94
90 // Clears the values for all ExtensionActions for the tab associated with the 95 // Clears the values for all ExtensionActions for the tab associated with the
91 // given |web_contents|. 96 // given |web_contents| (and signals that page actions changed).
92 void ClearAllValuesForTab(content::WebContents* web_contents); 97 void ClearAllValuesForTab(content::WebContents* web_contents);
93 98
99 // Notifies that the current set of page actions for |web_contents| has
100 // changed, and signals the browser to update.
101 void NotifyPageActionsChanged(content::WebContents* web_contents);
102
94 private: 103 private:
95 friend class BrowserContextKeyedAPIFactory<ExtensionActionAPI>; 104 friend class BrowserContextKeyedAPIFactory<ExtensionActionAPI>;
96 105
97 // The DispatchEvent methods forward events to the |context|'s event router. 106 // The DispatchEvent methods forward events to the |context|'s event router.
98 void DispatchEventToExtension(content::BrowserContext* context, 107 void DispatchEventToExtension(content::BrowserContext* context,
99 const std::string& extension_id, 108 const std::string& extension_id,
100 const std::string& event_name, 109 const std::string& event_name,
101 scoped_ptr<base::ListValue> event_args); 110 scoped_ptr<base::ListValue> event_args);
102 111
103 // Called when either a browser or page action is executed. Figures out which 112 // Called when either a browser or page action is executed. Figures out which
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 class PageActionGetPopupFunction 473 class PageActionGetPopupFunction
465 : public extensions::ExtensionActionGetPopupFunction { 474 : public extensions::ExtensionActionGetPopupFunction {
466 public: 475 public:
467 DECLARE_EXTENSION_FUNCTION("pageAction.getPopup", PAGEACTION_GETPOPUP) 476 DECLARE_EXTENSION_FUNCTION("pageAction.getPopup", PAGEACTION_GETPOPUP)
468 477
469 protected: 478 protected:
470 virtual ~PageActionGetPopupFunction() {} 479 virtual ~PageActionGetPopupFunction() {}
471 }; 480 };
472 481
473 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H _ 482 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698