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

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

Issue 1166393002: Reland "Encapsulate CSS selector declarative content condition tracking" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: crash fixes and tests Created 5 years, 6 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_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_
6 #define CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector>
11 10
12 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
15 #include "base/observer_list.h" 14 #include "base/observer_list.h"
16 #include "chrome/browser/extensions/active_tab_permission_granter.h" 15 #include "chrome/browser/extensions/active_tab_permission_granter.h"
17 #include "chrome/browser/extensions/extension_reenabler.h" 16 #include "chrome/browser/extensions/extension_reenabler.h"
18 #include "chrome/common/extensions/webstore_install_result.h" 17 #include "chrome/common/extensions/webstore_install_result.h"
19 #include "chrome/common/web_application_info.h" 18 #include "chrome/common/web_application_info.h"
20 #include "content/public/browser/notification_observer.h" 19 #include "content/public/browser/notification_observer.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 bool CanCreateBookmarkApp() const; 59 bool CanCreateBookmarkApp() const;
61 60
62 void UpdateShortcutOnLoadComplete() { 61 void UpdateShortcutOnLoadComplete() {
63 update_shortcut_on_load_complete_ = true; 62 update_shortcut_on_load_complete_ = true;
64 } 63 }
65 64
66 // ScriptExecutionObserver::Delegate 65 // ScriptExecutionObserver::Delegate
67 virtual void AddScriptExecutionObserver(ScriptExecutionObserver* observer); 66 virtual void AddScriptExecutionObserver(ScriptExecutionObserver* observer);
68 virtual void RemoveScriptExecutionObserver(ScriptExecutionObserver* observer); 67 virtual void RemoveScriptExecutionObserver(ScriptExecutionObserver* observer);
69 68
70 // App extensions ------------------------------------------------------------ 69 // App extensions ------------------------------------------------------------
not at google - send to devlin 2015/06/09 20:38:11 and in fact so does this.
Mike Wittman 2015/06/09 22:05:56 Done.
71 70
72 // Sets the extension denoting this as an app. If |extension| is non-null this 71 // Sets the extension denoting this as an app. If |extension| is non-null this
73 // tab becomes an app-tab. WebContents does not listen for unload events for 72 // tab becomes an app-tab. WebContents does not listen for unload events for
74 // the extension. It's up to consumers of WebContents to do that. 73 // the extension. It's up to consumers of WebContents to do that.
75 // 74 //
76 // NOTE: this should only be manipulated before the tab is added to a browser. 75 // NOTE: this should only be manipulated before the tab is added to a browser.
77 // TODO(sky): resolve if this is the right way to identify an app tab. If it 76 // TODO(sky): resolve if this is the right way to identify an app tab. If it
78 // is, than this should be passed in the constructor. 77 // is, than this should be passed in the constructor.
79 void SetExtensionApp(const Extension* extension); 78 void SetExtensionApp(const Extension* extension);
80 79
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // Sets a non-extension app icon associated with WebContents and fires an 117 // Sets a non-extension app icon associated with WebContents and fires an
119 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title. 118 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title.
120 void SetAppIcon(const SkBitmap& app_icon); 119 void SetAppIcon(const SkBitmap& app_icon);
121 120
122 // Sets the factory used to create inline webstore item installers. 121 // Sets the factory used to create inline webstore item installers.
123 // Used for testing. Takes ownership of the factory instance. 122 // Used for testing. Takes ownership of the factory instance.
124 void SetWebstoreInlineInstallerFactoryForTests( 123 void SetWebstoreInlineInstallerFactoryForTests(
125 WebstoreInlineInstallerFactory* factory); 124 WebstoreInlineInstallerFactory* factory);
126 125
127 private: 126 private:
127 // Utility function to invoke member functions on all relevant
128 // ContentRulesRegistries.
129 template <class Func>
130 void InvokeForContentRulesRegistries(const Func& func);
131
128 // Different types of action when web app info is available. 132 // Different types of action when web app info is available.
129 // OnDidGetApplicationInfo uses this to dispatch calls. 133 // OnDidGetApplicationInfo uses this to dispatch calls.
130 enum WebAppAction { 134 enum WebAppAction {
131 NONE, // No action at all. 135 NONE, // No action at all.
132 CREATE_SHORTCUT, // Bring up create application shortcut dialog. 136 CREATE_SHORTCUT, // Bring up create application shortcut dialog.
133 CREATE_HOSTED_APP, // Create and install a hosted app. 137 CREATE_HOSTED_APP, // Create and install a hosted app.
134 UPDATE_SHORTCUT // Update icon for app shortcut. 138 UPDATE_SHORTCUT // Update icon for app shortcut.
135 }; 139 };
136 140
137 explicit TabHelper(content::WebContents* web_contents); 141 explicit TabHelper(content::WebContents* web_contents);
(...skipping 26 matching lines...) Expand all
164 const std::string& webstore_item_id, 168 const std::string& webstore_item_id,
165 const GURL& requestor_url, 169 const GURL& requestor_url,
166 int listeners_mask); 170 int listeners_mask);
167 void OnGetAppInstallState(const GURL& requestor_url, 171 void OnGetAppInstallState(const GURL& requestor_url,
168 int return_route_id, 172 int return_route_id,
169 int callback_id); 173 int callback_id);
170 void OnRequest(const ExtensionHostMsg_Request_Params& params); 174 void OnRequest(const ExtensionHostMsg_Request_Params& params);
171 void OnContentScriptsExecuting( 175 void OnContentScriptsExecuting(
172 const ScriptExecutionObserver::ExecutingScriptsMap& extension_ids, 176 const ScriptExecutionObserver::ExecutingScriptsMap& extension_ids,
173 const GURL& on_url); 177 const GURL& on_url);
174 void OnWatchedPageChange(const std::vector<std::string>& css_selectors);
175 void OnDetailedConsoleMessageAdded(const base::string16& message, 178 void OnDetailedConsoleMessageAdded(const base::string16& message,
176 const base::string16& source, 179 const base::string16& source,
177 const StackTrace& stack_trace, 180 const StackTrace& stack_trace,
178 int32 severity_level); 181 int32 severity_level);
179 182
180 // App extensions related methods: 183 // App extensions related methods:
181 184
182 // Resets app_icon_ and if |extension| is non-null uses ImageLoader to load 185 // Resets app_icon_ and if |extension| is non-null uses ImageLoader to load
183 // the extension's image asynchronously. 186 // the extension's image asynchronously.
184 void UpdateExtensionAppIcon(const Extension* extension); 187 void UpdateExtensionAppIcon(const Extension* extension);
(...skipping 20 matching lines...) Expand all
205 const content::NotificationDetails& details) override; 208 const content::NotificationDetails& details) override;
206 209
207 // Requests application info for the specified page. This is an asynchronous 210 // Requests application info for the specified page. This is an asynchronous
208 // request. The delegate is notified by way of OnDidGetApplicationInfo when 211 // request. The delegate is notified by way of OnDidGetApplicationInfo when
209 // the data is available. 212 // the data is available.
210 void GetApplicationInfo(WebAppAction action); 213 void GetApplicationInfo(WebAppAction action);
211 214
212 // Sends our tab ID to |render_view_host|. 215 // Sends our tab ID to |render_view_host|.
213 void SetTabId(content::RenderViewHost* render_view_host); 216 void SetTabId(content::RenderViewHost* render_view_host);
214 217
215 // Data for app extensions --------------------------------------------------- 218 // Data for app extensions ---------------------------------------------------
not at google - send to devlin 2015/06/09 20:38:11 This comment seems entirely out of place. Can you
Mike Wittman 2015/06/09 22:05:56 Yes, I found this odd also. Removed.
216 219
220 Profile* profile_;
221
217 // Our content script observers. Declare at top so that it will outlive all 222 // Our content script observers. Declare at top so that it will outlive all
218 // other members, since they might add themselves as observers. 223 // other members, since they might add themselves as observers.
219 base::ObserverList<ScriptExecutionObserver> script_execution_observers_; 224 base::ObserverList<ScriptExecutionObserver> script_execution_observers_;
220 225
221 // If non-null this tab is an app tab and this is the extension the tab was 226 // If non-null this tab is an app tab and this is the extension the tab was
222 // created for. 227 // created for.
223 const Extension* extension_app_; 228 const Extension* extension_app_;
224 229
225 // Icon for extension_app_ (if non-null) or a manually-set icon for 230 // Icon for extension_app_ (if non-null) or a manually-set icon for
226 // non-extension apps. 231 // non-extension apps.
(...skipping 21 matching lines...) Expand all
248 scoped_ptr<ScriptExecutor> script_executor_; 253 scoped_ptr<ScriptExecutor> script_executor_;
249 254
250 scoped_ptr<LocationBarController> location_bar_controller_; 255 scoped_ptr<LocationBarController> location_bar_controller_;
251 256
252 scoped_ptr<ActiveScriptController> active_script_controller_; 257 scoped_ptr<ActiveScriptController> active_script_controller_;
253 258
254 scoped_ptr<ActiveTabPermissionGranter> active_tab_permission_granter_; 259 scoped_ptr<ActiveTabPermissionGranter> active_tab_permission_granter_;
255 260
256 scoped_ptr<BookmarkAppHelper> bookmark_app_helper_; 261 scoped_ptr<BookmarkAppHelper> bookmark_app_helper_;
257 262
258 Profile* profile_;
259
260 // Creates WebstoreInlineInstaller instances for inline install triggers. 263 // Creates WebstoreInlineInstaller instances for inline install triggers.
261 scoped_ptr<WebstoreInlineInstallerFactory> webstore_inline_installer_factory_; 264 scoped_ptr<WebstoreInlineInstallerFactory> webstore_inline_installer_factory_;
262 265
263 // The reenable prompt for disabled extensions, if any. 266 // The reenable prompt for disabled extensions, if any.
264 scoped_ptr<ExtensionReenabler> extension_reenabler_; 267 scoped_ptr<ExtensionReenabler> extension_reenabler_;
265 268
266 // Vend weak pointers that can be invalidated to stop in-progress loads. 269 // Vend weak pointers that can be invalidated to stop in-progress loads.
267 base::WeakPtrFactory<TabHelper> image_loader_ptr_factory_; 270 base::WeakPtrFactory<TabHelper> image_loader_ptr_factory_;
268 271
269 // Generic weak ptr factory for posting callbacks. 272 // Generic weak ptr factory for posting callbacks.
270 base::WeakPtrFactory<TabHelper> weak_ptr_factory_; 273 base::WeakPtrFactory<TabHelper> weak_ptr_factory_;
271 274
272 DISALLOW_COPY_AND_ASSIGN(TabHelper); 275 DISALLOW_COPY_AND_ASSIGN(TabHelper);
273 }; 276 };
274 277
275 } // namespace extensions 278 } // namespace extensions
276 279
277 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ 280 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698