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/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
16 #include "content/public/common/top_controls_state.h" | 16 #include "content/public/common/top_controls_state.h" |
17 #include "content/public/renderer/render_view_observer.h" | 17 #include "content/public/renderer/render_view_observer.h" |
18 #include "ui/gfx/size.h" | 18 #include "ui/gfx/size.h" |
19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
20 | 20 |
21 class ChromeRenderProcessObserver; | |
22 class ContentSettingsObserver; | 21 class ContentSettingsObserver; |
23 class SkBitmap; | 22 class SkBitmap; |
24 class TranslateHelper; | 23 class TranslateHelper; |
25 class WebViewColorOverlay; | 24 class WebViewColorOverlay; |
26 class WebViewAnimatingOverlay; | 25 class WebViewAnimatingOverlay; |
27 | 26 |
28 namespace blink { | 27 namespace blink { |
29 class WebView; | 28 class WebView; |
30 struct WebWindowFeatures; | 29 struct WebWindowFeatures; |
31 } | 30 } |
32 | 31 |
33 namespace safe_browsing { | 32 namespace safe_browsing { |
34 class PhishingClassifierDelegate; | 33 class PhishingClassifierDelegate; |
35 } | 34 } |
36 | 35 |
| 36 namespace web_cache { |
| 37 class WebCacheRenderProcessObserver; |
| 38 } |
| 39 |
37 // This class holds the Chrome specific parts of RenderView, and has the same | 40 // This class holds the Chrome specific parts of RenderView, and has the same |
38 // lifetime. | 41 // lifetime. |
39 class ChromeRenderViewObserver : public content::RenderViewObserver { | 42 class ChromeRenderViewObserver : public content::RenderViewObserver { |
40 public: | 43 public: |
41 // translate_helper can be NULL. | 44 // translate_helper can be NULL. |
42 ChromeRenderViewObserver( | 45 ChromeRenderViewObserver( |
43 content::RenderView* render_view, | 46 content::RenderView* render_view, |
44 ChromeRenderProcessObserver* chrome_render_process_observer); | 47 web_cache::WebCacheRenderProcessObserver* |
| 48 web_cache_render_process_observer); |
45 virtual ~ChromeRenderViewObserver(); | 49 virtual ~ChromeRenderViewObserver(); |
46 | 50 |
47 private: | 51 private: |
48 // RenderViewObserver implementation. | 52 // RenderViewObserver implementation. |
49 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 53 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
50 virtual void DidStartLoading() OVERRIDE; | 54 virtual void DidStartLoading() OVERRIDE; |
51 virtual void DidStopLoading() OVERRIDE; | 55 virtual void DidStopLoading() OVERRIDE; |
52 virtual void DidCommitProvisionalLoad(blink::WebLocalFrame* frame, | 56 virtual void DidCommitProvisionalLoad(blink::WebLocalFrame* frame, |
53 bool is_new_navigation) OVERRIDE; | 57 bool is_new_navigation) OVERRIDE; |
54 virtual void Navigate(const GURL& url) OVERRIDE; | 58 virtual void Navigate(const GURL& url) OVERRIDE; |
(...skipping 29 matching lines...) Expand all Loading... |
84 // Determines if a host is in the strict security host set. | 88 // Determines if a host is in the strict security host set. |
85 bool IsStrictSecurityHost(const std::string& host); | 89 bool IsStrictSecurityHost(const std::string& host); |
86 | 90 |
87 // Checks if a page contains <meta http-equiv="refresh" ...> tag. | 91 // Checks if a page contains <meta http-equiv="refresh" ...> tag. |
88 bool HasRefreshMetaTag(blink::WebFrame* frame); | 92 bool HasRefreshMetaTag(blink::WebFrame* frame); |
89 | 93 |
90 // Save the JavaScript to preload if a ViewMsg_WebUIJavaScript is received. | 94 // Save the JavaScript to preload if a ViewMsg_WebUIJavaScript is received. |
91 std::vector<base::string16> webui_javascript_; | 95 std::vector<base::string16> webui_javascript_; |
92 | 96 |
93 // Owned by ChromeContentRendererClient and outlive us. | 97 // Owned by ChromeContentRendererClient and outlive us. |
94 ChromeRenderProcessObserver* chrome_render_process_observer_; | 98 web_cache::WebCacheRenderProcessObserver* web_cache_render_process_observer_; |
95 | 99 |
96 // Have the same lifetime as us. | 100 // Have the same lifetime as us. |
97 TranslateHelper* translate_helper_; | 101 TranslateHelper* translate_helper_; |
98 safe_browsing::PhishingClassifierDelegate* phishing_classifier_; | 102 safe_browsing::PhishingClassifierDelegate* phishing_classifier_; |
99 | 103 |
100 // A color page overlay when visually de-emaphasized. | 104 // A color page overlay when visually de-emaphasized. |
101 scoped_ptr<WebViewColorOverlay> dimmed_color_overlay_; | 105 scoped_ptr<WebViewColorOverlay> dimmed_color_overlay_; |
102 | 106 |
103 // Used to delay calling CapturePageInfo. | 107 // Used to delay calling CapturePageInfo. |
104 base::Timer capture_timer_; | 108 base::Timer capture_timer_; |
105 | 109 |
106 DISALLOW_COPY_AND_ASSIGN(ChromeRenderViewObserver); | 110 DISALLOW_COPY_AND_ASSIGN(ChromeRenderViewObserver); |
107 }; | 111 }; |
108 | 112 |
109 #endif // CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_ | 113 #endif // CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_ |
OLD | NEW |