OLD | NEW |
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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
| 10 #include <vector> |
| 11 |
10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
11 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
12 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
13 #include "chrome/browser/extensions/active_tab_permission_granter.h" | 15 #include "chrome/browser/extensions/active_tab_permission_granter.h" |
14 #include "chrome/browser/extensions/app_notify_channel_setup.h" | 16 #include "chrome/browser/extensions/app_notify_channel_setup.h" |
15 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 17 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
16 #include "chrome/browser/extensions/image_loading_tracker.h" | 18 #include "chrome/browser/extensions/image_loading_tracker.h" |
17 #include "chrome/common/web_apps.h" | 19 #include "chrome/common/web_apps.h" |
18 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
20 #include "content/public/browser/web_contents_observer.h" | 22 #include "content/public/browser/web_contents_observer.h" |
21 #include "content/public/browser/web_contents_user_data.h" | 23 #include "content/public/browser/web_contents_user_data.h" |
22 #include "third_party/skia/include/core/SkBitmap.h" | 24 #include "third_party/skia/include/core/SkBitmap.h" |
23 | 25 |
24 struct WebApplicationInfo; | 26 struct WebApplicationInfo; |
25 | 27 |
26 namespace content { | 28 namespace content { |
27 struct LoadCommittedDetails; | 29 struct LoadCommittedDetails; |
28 } | 30 } |
29 | 31 |
30 namespace extensions { | 32 namespace extensions { |
31 class Extension; | 33 class Extension; |
32 class LocationBarController; | 34 class LocationBarController; |
| 35 class RulesRegistryService; |
33 class ScriptBadgeController; | 36 class ScriptBadgeController; |
34 class ScriptBubbleController; | 37 class ScriptBubbleController; |
35 class ScriptExecutor; | 38 class ScriptExecutor; |
36 | 39 |
37 // Per-tab extension helper. Also handles non-extension apps. | 40 // Per-tab extension helper. Also handles non-extension apps. |
38 class TabHelper : public content::WebContentsObserver, | 41 class TabHelper : public content::WebContentsObserver, |
39 public ExtensionFunctionDispatcher::Delegate, | 42 public ExtensionFunctionDispatcher::Delegate, |
40 public AppNotifyChannelSetup::Delegate, | 43 public AppNotifyChannelSetup::Delegate, |
41 public base::SupportsWeakPtr<TabHelper>, | 44 public base::SupportsWeakPtr<TabHelper>, |
42 public content::NotificationObserver, | 45 public content::NotificationObserver, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 int return_route_id, | 188 int return_route_id, |
186 int callback_id); | 189 int callback_id); |
187 void OnGetAppInstallState(const GURL& requestor_url, | 190 void OnGetAppInstallState(const GURL& requestor_url, |
188 int return_route_id, | 191 int return_route_id, |
189 int callback_id); | 192 int callback_id); |
190 void OnRequest(const ExtensionHostMsg_Request_Params& params); | 193 void OnRequest(const ExtensionHostMsg_Request_Params& params); |
191 void OnContentScriptsExecuting( | 194 void OnContentScriptsExecuting( |
192 const ScriptExecutionObserver::ExecutingScriptsMap& extension_ids, | 195 const ScriptExecutionObserver::ExecutingScriptsMap& extension_ids, |
193 int32 page_id, | 196 int32 page_id, |
194 const GURL& on_url); | 197 const GURL& on_url); |
| 198 void OnWatchedPageChange(const std::vector<std::string>& css_selectors); |
195 | 199 |
196 // App extensions related methods: | 200 // App extensions related methods: |
197 | 201 |
198 // Resets app_icon_ and if |extension| is non-null creates a new | 202 // Resets app_icon_ and if |extension| is non-null creates a new |
199 // ImageLoadingTracker to load the extension's image. | 203 // ImageLoadingTracker to load the extension's image. |
200 void UpdateExtensionAppIcon(const Extension* extension); | 204 void UpdateExtensionAppIcon(const Extension* extension); |
201 | 205 |
202 const Extension* GetExtension(const std::string& extension_app_id); | 206 const Extension* GetExtension(const std::string& extension_app_id); |
203 | 207 |
204 void OnImageLoaded(const gfx::Image& image); | 208 void OnImageLoaded(const gfx::Image& image); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 content::NotificationRegistrar registrar_; | 256 content::NotificationRegistrar registrar_; |
253 | 257 |
254 scoped_ptr<ScriptExecutor> script_executor_; | 258 scoped_ptr<ScriptExecutor> script_executor_; |
255 | 259 |
256 scoped_ptr<LocationBarController> location_bar_controller_; | 260 scoped_ptr<LocationBarController> location_bar_controller_; |
257 | 261 |
258 scoped_ptr<ActiveTabPermissionGranter> active_tab_permission_granter_; | 262 scoped_ptr<ActiveTabPermissionGranter> active_tab_permission_granter_; |
259 | 263 |
260 scoped_ptr<ScriptBubbleController> script_bubble_controller_; | 264 scoped_ptr<ScriptBubbleController> script_bubble_controller_; |
261 | 265 |
| 266 RulesRegistryService* rules_registry_service_; |
| 267 |
262 Profile* profile_; | 268 Profile* profile_; |
263 | 269 |
264 // Vend weak pointers that can be invalidated to stop in-progress loads. | 270 // Vend weak pointers that can be invalidated to stop in-progress loads. |
265 base::WeakPtrFactory<TabHelper> image_loader_ptr_factory_; | 271 base::WeakPtrFactory<TabHelper> image_loader_ptr_factory_; |
266 | 272 |
267 DISALLOW_COPY_AND_ASSIGN(TabHelper); | 273 DISALLOW_COPY_AND_ASSIGN(TabHelper); |
268 }; | 274 }; |
269 | 275 |
270 } // namespace extensions | 276 } // namespace extensions |
271 | 277 |
272 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ | 278 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ |
OLD | NEW |