OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/renderer/chrome_render_view_observer.h" | 5 #include "chrome/renderer/chrome_render_view_observer.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "chrome/common/chrome_constants.h" | 11 #include "chrome/common/chrome_constants.h" |
12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/common/icon_messages.h" | 13 #include "chrome/common/icon_messages.h" |
14 #include "chrome/common/render_messages.h" | 14 #include "chrome/common/render_messages.h" |
15 #include "chrome/common/thumbnail_score.h" | 15 #include "chrome/common/thumbnail_score.h" |
16 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
17 #include "chrome/renderer/about_handler.h" | 17 #include "chrome/renderer/about_handler.h" |
| 18 #include "chrome/renderer/automation/dom_automation_controller.h" |
18 #include "chrome/renderer/content_settings_observer.h" | 19 #include "chrome/renderer/content_settings_observer.h" |
19 #include "chrome/renderer/automation/dom_automation_controller.h" | |
20 #include "chrome/renderer/extensions/extension_renderer_context.h" | 20 #include "chrome/renderer/extensions/extension_renderer_context.h" |
21 #include "chrome/renderer/external_host_bindings.h" | 21 #include "chrome/renderer/external_host_bindings.h" |
| 22 #include "chrome/renderer/frame_sniffer.h" |
22 #include "chrome/renderer/prerender/prerender_helper.h" | 23 #include "chrome/renderer/prerender/prerender_helper.h" |
23 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" | 24 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" |
24 #include "chrome/renderer/translate_helper.h" | 25 #include "chrome/renderer/translate_helper.h" |
25 #include "content/common/bindings_policy.h" | 26 #include "content/common/bindings_policy.h" |
26 #include "content/common/view_messages.h" | 27 #include "content/common/view_messages.h" |
27 #include "content/renderer/content_renderer_client.h" | 28 #include "content/renderer/content_renderer_client.h" |
28 #include "net/base/data_url.h" | 29 #include "net/base/data_url.h" |
29 #include "skia/ext/image_operations.h" | 30 #include "skia/ext/image_operations.h" |
30 #include "skia/ext/platform_canvas.h" | 31 #include "skia/ext/platform_canvas.h" |
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" | 32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 OnHandleMessageFromExternalHost) | 232 OnHandleMessageFromExternalHost) |
232 IPC_MESSAGE_HANDLER(ChromeViewMsg_JavaScriptStressTestControl, | 233 IPC_MESSAGE_HANDLER(ChromeViewMsg_JavaScriptStressTestControl, |
233 OnJavaScriptStressTestControl) | 234 OnJavaScriptStressTestControl) |
234 IPC_MESSAGE_HANDLER(IconMsg_DownloadFavicon, OnDownloadFavicon) | 235 IPC_MESSAGE_HANDLER(IconMsg_DownloadFavicon, OnDownloadFavicon) |
235 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAllowDisplayingInsecureContent, | 236 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAllowDisplayingInsecureContent, |
236 OnSetAllowDisplayingInsecureContent) | 237 OnSetAllowDisplayingInsecureContent) |
237 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAllowRunningInsecureContent, | 238 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAllowRunningInsecureContent, |
238 OnSetAllowRunningInsecureContent) | 239 OnSetAllowRunningInsecureContent) |
239 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetClientSidePhishingDetection, | 240 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetClientSidePhishingDetection, |
240 OnSetClientSidePhishingDetection) | 241 OnSetClientSidePhishingDetection) |
| 242 #if defined(OS_CHROMEOS) |
| 243 IPC_MESSAGE_HANDLER(ChromeViewMsg_StartFrameSniffer, OnStartFrameSniffer) |
| 244 #endif |
241 IPC_MESSAGE_UNHANDLED(handled = false) | 245 IPC_MESSAGE_UNHANDLED(handled = false) |
242 IPC_END_MESSAGE_MAP() | 246 IPC_END_MESSAGE_MAP() |
243 | 247 |
244 // Filter only. | 248 // Filter only. |
245 IPC_BEGIN_MESSAGE_MAP(ChromeRenderViewObserver, message) | 249 IPC_BEGIN_MESSAGE_MAP(ChromeRenderViewObserver, message) |
246 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) | 250 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) |
247 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsPrerendering, OnSetIsPrerendering); | 251 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsPrerendering, OnSetIsPrerendering); |
248 IPC_END_MESSAGE_MAP() | 252 IPC_END_MESSAGE_MAP() |
249 | 253 |
250 return handled; | 254 return handled; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 void ChromeRenderViewObserver::OnSetClientSidePhishingDetection( | 338 void ChromeRenderViewObserver::OnSetClientSidePhishingDetection( |
335 bool enable_phishing_detection) { | 339 bool enable_phishing_detection) { |
336 #if defined(ENABLE_SAFE_BROWSING) && !defined(OS_CHROMEOS) | 340 #if defined(ENABLE_SAFE_BROWSING) && !defined(OS_CHROMEOS) |
337 phishing_classifier_ = enable_phishing_detection ? | 341 phishing_classifier_ = enable_phishing_detection ? |
338 safe_browsing::PhishingClassifierDelegate::Create( | 342 safe_browsing::PhishingClassifierDelegate::Create( |
339 render_view(), NULL) : | 343 render_view(), NULL) : |
340 NULL; | 344 NULL; |
341 #endif | 345 #endif |
342 } | 346 } |
343 | 347 |
| 348 void ChromeRenderViewObserver::OnStartFrameSniffer(const string16& frame_name) { |
| 349 new FrameSniffer(render_view(), frame_name); |
| 350 } |
| 351 |
344 bool ChromeRenderViewObserver::allowDatabase( | 352 bool ChromeRenderViewObserver::allowDatabase( |
345 WebFrame* frame, | 353 WebFrame* frame, |
346 const WebString& name, | 354 const WebString& name, |
347 const WebString& display_name, | 355 const WebString& display_name, |
348 unsigned long estimated_size) { | 356 unsigned long estimated_size) { |
349 return content_settings_->AllowDatabase( | 357 return content_settings_->AllowDatabase( |
350 frame, name, display_name, estimated_size); | 358 frame, name, display_name, estimated_size); |
351 } | 359 } |
352 | 360 |
353 bool ChromeRenderViewObserver::allowFileSystem(WebFrame* frame) { | 361 bool ChromeRenderViewObserver::allowFileSystem(WebFrame* frame) { |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) && !data.empty()) { | 991 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) && !data.empty()) { |
984 // Decode the favicon using WebKit's image decoder. | 992 // Decode the favicon using WebKit's image decoder. |
985 webkit_glue::ImageDecoder decoder(gfx::Size(kFaviconSize, kFaviconSize)); | 993 webkit_glue::ImageDecoder decoder(gfx::Size(kFaviconSize, kFaviconSize)); |
986 const unsigned char* src_data = | 994 const unsigned char* src_data = |
987 reinterpret_cast<const unsigned char*>(&data[0]); | 995 reinterpret_cast<const unsigned char*>(&data[0]); |
988 | 996 |
989 return decoder.Decode(src_data, data.size()); | 997 return decoder.Decode(src_data, data.size()); |
990 } | 998 } |
991 return SkBitmap(); | 999 return SkBitmap(); |
992 } | 1000 } |
OLD | NEW |