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_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_ | 5 #ifndef CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_ |
6 #define CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_ | 6 #define CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/timer.h" | 14 #include "base/timer.h" |
15 #include "chrome/common/extensions/permissions/api_permission.h" | 15 #include "chrome/common/extensions/permissions/api_permission.h" |
16 #include "content/public/renderer/render_view_observer.h" | 16 #include "content/public/renderer/render_view_observer.h" |
17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPermissionClient.h
" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPermissionClient.h
" |
19 | 19 |
20 class ChromeRenderProcessObserver; | 20 class ChromeRenderProcessObserver; |
21 class ContentSettingsObserver; | 21 class ContentSettingsObserver; |
22 class ExtensionDispatcher; | |
23 class ExternalHostBindings; | 22 class ExternalHostBindings; |
24 class SkBitmap; | 23 class SkBitmap; |
25 class TranslateHelper; | 24 class TranslateHelper; |
26 struct ThumbnailScore; | 25 struct ThumbnailScore; |
27 class WebViewColorOverlay; | 26 class WebViewColorOverlay; |
28 | 27 |
| 28 namespace extensions { |
| 29 class Dispatcher; |
| 30 } |
| 31 |
29 namespace WebKit { | 32 namespace WebKit { |
30 class WebView; | 33 class WebView; |
31 } | 34 } |
32 | 35 |
33 namespace safe_browsing { | 36 namespace safe_browsing { |
34 class PhishingClassifierDelegate; | 37 class PhishingClassifierDelegate; |
35 } | 38 } |
36 | 39 |
37 namespace webkit_glue { | 40 namespace webkit_glue { |
38 class MultiResolutionImageResourceFetcher; | 41 class MultiResolutionImageResourceFetcher; |
39 } | 42 } |
40 | 43 |
41 // This class holds the Chrome specific parts of RenderView, and has the same | 44 // This class holds the Chrome specific parts of RenderView, and has the same |
42 // lifetime. | 45 // lifetime. |
43 class ChromeRenderViewObserver : public content::RenderViewObserver, | 46 class ChromeRenderViewObserver : public content::RenderViewObserver, |
44 public WebKit::WebPermissionClient { | 47 public WebKit::WebPermissionClient { |
45 public: | 48 public: |
46 // translate_helper can be NULL. | 49 // translate_helper can be NULL. |
47 ChromeRenderViewObserver( | 50 ChromeRenderViewObserver( |
48 content::RenderView* render_view, | 51 content::RenderView* render_view, |
49 ContentSettingsObserver* content_settings, | 52 ContentSettingsObserver* content_settings, |
50 ChromeRenderProcessObserver* chrome_render_process_observer, | 53 ChromeRenderProcessObserver* chrome_render_process_observer, |
51 ExtensionDispatcher* extension_dispatcher, | 54 extensions::Dispatcher* extension_dispatcher, |
52 TranslateHelper* translate_helper); | 55 TranslateHelper* translate_helper); |
53 virtual ~ChromeRenderViewObserver(); | 56 virtual ~ChromeRenderViewObserver(); |
54 | 57 |
55 private: | 58 private: |
56 // Holds the information received in OnWebUIJavaScript for later use | 59 // Holds the information received in OnWebUIJavaScript for later use |
57 // to call EvaluateScript() to preload javascript for WebUI tests. | 60 // to call EvaluateScript() to preload javascript for WebUI tests. |
58 struct WebUIJavaScript { | 61 struct WebUIJavaScript { |
59 string16 frame_xpath; | 62 string16 frame_xpath; |
60 string16 jscript; | 63 string16 jscript; |
61 int id; | 64 int id; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // Checks if |origin| correponds to an installed extension that has been | 193 // Checks if |origin| correponds to an installed extension that has been |
191 // granted the |permission|. | 194 // granted the |permission|. |
192 bool HasExtensionPermission(const WebKit::WebSecurityOrigin& origin, | 195 bool HasExtensionPermission(const WebKit::WebSecurityOrigin& origin, |
193 extensions::APIPermission::ID permission) const; | 196 extensions::APIPermission::ID permission) const; |
194 | 197 |
195 // Save the JavaScript to preload if a ViewMsg_WebUIJavaScript is received. | 198 // Save the JavaScript to preload if a ViewMsg_WebUIJavaScript is received. |
196 scoped_ptr<WebUIJavaScript> webui_javascript_; | 199 scoped_ptr<WebUIJavaScript> webui_javascript_; |
197 | 200 |
198 // Owned by ChromeContentRendererClient and outlive us. | 201 // Owned by ChromeContentRendererClient and outlive us. |
199 ChromeRenderProcessObserver* chrome_render_process_observer_; | 202 ChromeRenderProcessObserver* chrome_render_process_observer_; |
200 ExtensionDispatcher* extension_dispatcher_; | 203 extensions::Dispatcher* extension_dispatcher_; |
201 | 204 |
202 // Have the same lifetime as us. | 205 // Have the same lifetime as us. |
203 ContentSettingsObserver* content_settings_; | 206 ContentSettingsObserver* content_settings_; |
204 TranslateHelper* translate_helper_; | 207 TranslateHelper* translate_helper_; |
205 safe_browsing::PhishingClassifierDelegate* phishing_classifier_; | 208 safe_browsing::PhishingClassifierDelegate* phishing_classifier_; |
206 | 209 |
207 // Page_id from the last page we indexed. This prevents us from indexing the | 210 // Page_id from the last page we indexed. This prevents us from indexing the |
208 // same page twice in a row. | 211 // same page twice in a row. |
209 int32 last_indexed_page_id_; | 212 int32 last_indexed_page_id_; |
210 // The toplevel URL that was last indexed. This is used together with the | 213 // The toplevel URL that was last indexed. This is used together with the |
(...skipping 19 matching lines...) Expand all Loading... |
230 // A color page overlay when visually de-emaphasized. | 233 // A color page overlay when visually de-emaphasized. |
231 scoped_ptr<WebViewColorOverlay> dimmed_color_overlay_; | 234 scoped_ptr<WebViewColorOverlay> dimmed_color_overlay_; |
232 | 235 |
233 // Used to delay calling CapturePageInfo. | 236 // Used to delay calling CapturePageInfo. |
234 base::Timer capture_timer_; | 237 base::Timer capture_timer_; |
235 | 238 |
236 DISALLOW_COPY_AND_ASSIGN(ChromeRenderViewObserver); | 239 DISALLOW_COPY_AND_ASSIGN(ChromeRenderViewObserver); |
237 }; | 240 }; |
238 | 241 |
239 #endif // CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_ | 242 #endif // CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_ |
OLD | NEW |