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> |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 namespace WebKit { | 29 namespace WebKit { |
30 class WebView; | 30 class WebView; |
31 } | 31 } |
32 | 32 |
33 namespace safe_browsing { | 33 namespace safe_browsing { |
34 class PhishingClassifierDelegate; | 34 class PhishingClassifierDelegate; |
35 } | 35 } |
36 | 36 |
37 namespace webkit_glue { | 37 namespace webkit_glue { |
38 class ImageResourceFetcher; | 38 class MultiResolutionImageResourceFetcher; |
39 } | 39 } |
40 | 40 |
41 // This class holds the Chrome specific parts of RenderView, and has the same | 41 // This class holds the Chrome specific parts of RenderView, and has the same |
42 // lifetime. | 42 // lifetime. |
43 class ChromeRenderViewObserver : public content::RenderViewObserver, | 43 class ChromeRenderViewObserver : public content::RenderViewObserver, |
44 public WebKit::WebPermissionClient { | 44 public WebKit::WebPermissionClient { |
45 public: | 45 public: |
46 // translate_helper can be NULL. | 46 // translate_helper can be NULL. |
47 ChromeRenderViewObserver( | 47 ChromeRenderViewObserver( |
48 content::RenderView* render_view, | 48 content::RenderView* render_view, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 void OnWebUIJavaScript(const string16& frame_xpath, | 124 void OnWebUIJavaScript(const string16& frame_xpath, |
125 const string16& jscript, | 125 const string16& jscript, |
126 int id, | 126 int id, |
127 bool notify_result); | 127 bool notify_result); |
128 void OnCaptureSnapshot(); | 128 void OnCaptureSnapshot(); |
129 void OnHandleMessageFromExternalHost(const std::string& message, | 129 void OnHandleMessageFromExternalHost(const std::string& message, |
130 const std::string& origin, | 130 const std::string& origin, |
131 const std::string& target); | 131 const std::string& target); |
132 void OnJavaScriptStressTestControl(int cmd, int param); | 132 void OnJavaScriptStressTestControl(int cmd, int param); |
133 void OnDownloadFavicon(int id, const GURL& image_url, int image_size); | 133 void OnDownloadFavicon(int id, const GURL& image_url, const std::vector<int>&
image_size); |
134 void OnSetIsPrerendering(bool is_prerendering); | 134 void OnSetIsPrerendering(bool is_prerendering); |
135 void OnSetAllowDisplayingInsecureContent(bool allow); | 135 void OnSetAllowDisplayingInsecureContent(bool allow); |
136 void OnSetAllowRunningInsecureContent(bool allow); | 136 void OnSetAllowRunningInsecureContent(bool allow); |
137 void OnSetClientSidePhishingDetection(bool enable_phishing_detection); | 137 void OnSetClientSidePhishingDetection(bool enable_phishing_detection); |
138 void OnSetVisuallyDeemphasized(bool deemphasized); | 138 void OnSetVisuallyDeemphasized(bool deemphasized); |
139 void OnStartFrameSniffer(const string16& frame_name); | 139 void OnStartFrameSniffer(const string16& frame_name); |
140 void OnGetFPS(); | 140 void OnGetFPS(); |
141 void OnAddStrictSecurityHost(const std::string& host); | 141 void OnAddStrictSecurityHost(const std::string& host); |
142 | 142 |
143 void CapturePageInfoLater(bool preliminary_capture, base::TimeDelta delay); | 143 void CapturePageInfoLater(bool preliminary_capture, base::TimeDelta delay); |
(...skipping 16 matching lines...) Expand all Loading... |
160 | 160 |
161 // Capture a snapshot of a view. This is used to allow an extension | 161 // Capture a snapshot of a view. This is used to allow an extension |
162 // to get a snapshot of a tab using chrome.tabs.captureVisibleTab(). | 162 // to get a snapshot of a tab using chrome.tabs.captureVisibleTab(). |
163 bool CaptureSnapshot(WebKit::WebView* view, SkBitmap* snapshot); | 163 bool CaptureSnapshot(WebKit::WebView* view, SkBitmap* snapshot); |
164 | 164 |
165 ExternalHostBindings* GetExternalHostBindings(); | 165 ExternalHostBindings* GetExternalHostBindings(); |
166 | 166 |
167 // This callback is triggered when DownloadFavicon completes, either | 167 // This callback is triggered when DownloadFavicon completes, either |
168 // succesfully or with a failure. See DownloadFavicon for more | 168 // succesfully or with a failure. See DownloadFavicon for more |
169 // details. | 169 // details. |
170 void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher, | 170 void DidDownloadFavicon( |
171 const SkBitmap& image); | 171 webkit_glue::MultiResolutionImageResourceFetcher* fetcher, |
| 172 const std::vector<SkBitmap>& images); |
172 | 173 |
173 // Requests to download a favicon image. When done, the RenderView | 174 // Requests to download a favicon image. When done, the RenderView |
174 // is notified by way of DidDownloadFavicon. Returns true if the | 175 // is notified by way of DidDownloadFavicon. Returns true if the |
175 // request was successfully started, false otherwise. id is used to | 176 // request was successfully started, false otherwise. id is used to |
176 // uniquely identify the request and passed back to the | 177 // uniquely identify the request and passed back to the |
177 // DidDownloadFavicon method. If the image has multiple frames, the | 178 // DidDownloadFavicon method. If the image has multiple frames, the |
178 // frame whose size is image_size is returned. If the image doesn't | 179 // frame whose size is image_size is returned. If the image doesn't |
179 // have a frame at the specified size, the first is returned. | 180 // have a frame at the specified size, the first is returned. |
180 bool DownloadFavicon(int id, const GURL& image_url, int image_size); | 181 bool DownloadFavicon(int id, const GURL& image_url, const std::vector<int>& im
age_size); |
181 | 182 |
182 // Decodes a data: URL image or returns an empty image in case of failure. | 183 // Decodes a data: URL image or returns an empty image in case of failure. |
183 SkBitmap ImageFromDataUrl(const GURL&) const; | 184 SkBitmap ImageFromDataUrl(const GURL&) const; |
184 | 185 |
185 // Determines if a host is in the strict security host set. | 186 // Determines if a host is in the strict security host set. |
186 bool IsStrictSecurityHost(const std::string& host); | 187 bool IsStrictSecurityHost(const std::string& host); |
187 | 188 |
188 // Checks if |origin| correponds to an installed extension that has been | 189 // Checks if |origin| correponds to an installed extension that has been |
189 // granted the |permission|. | 190 // granted the |permission|. |
190 bool HasExtensionPermission(const WebKit::WebSecurityOrigin& origin, | 191 bool HasExtensionPermission(const WebKit::WebSecurityOrigin& origin, |
(...skipping 20 matching lines...) Expand all Loading... |
211 GURL last_indexed_url_; | 212 GURL last_indexed_url_; |
212 | 213 |
213 // Insecure content may be permitted for the duration of this render view. | 214 // Insecure content may be permitted for the duration of this render view. |
214 bool allow_displaying_insecure_content_; | 215 bool allow_displaying_insecure_content_; |
215 bool allow_running_insecure_content_; | 216 bool allow_running_insecure_content_; |
216 std::set<std::string> strict_security_hosts_; | 217 std::set<std::string> strict_security_hosts_; |
217 | 218 |
218 // External host exposed through automation controller. | 219 // External host exposed through automation controller. |
219 scoped_ptr<ExternalHostBindings> external_host_bindings_; | 220 scoped_ptr<ExternalHostBindings> external_host_bindings_; |
220 | 221 |
221 typedef std::vector<linked_ptr<webkit_glue::ImageResourceFetcher> > | 222 typedef std::vector<linked_ptr<webkit_glue::MultiResolutionImageResourceFetche
r> > |
222 ImageResourceFetcherList; | 223 ImageResourceFetcherList; |
223 | 224 |
224 // ImageResourceFetchers schedule via DownloadImage. | 225 // ImageResourceFetchers schedule via DownloadImage. |
225 ImageResourceFetcherList image_fetchers_; | 226 ImageResourceFetcherList image_fetchers_; |
226 | 227 |
227 // A color page overlay when visually de-emaphasized. | 228 // A color page overlay when visually de-emaphasized. |
228 scoped_ptr<WebViewColorOverlay> dimmed_color_overlay_; | 229 scoped_ptr<WebViewColorOverlay> dimmed_color_overlay_; |
229 | 230 |
230 // Used to delay calling CapturePageInfo. | 231 // Used to delay calling CapturePageInfo. |
231 base::Timer capture_timer_; | 232 base::Timer capture_timer_; |
232 | 233 |
233 DISALLOW_COPY_AND_ASSIGN(ChromeRenderViewObserver); | 234 DISALLOW_COPY_AND_ASSIGN(ChromeRenderViewObserver); |
234 }; | 235 }; |
235 | 236 |
236 #endif // CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_ | 237 #endif // CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_ |
OLD | NEW |