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_dispatcher.h" | 20 #include "chrome/renderer/extensions/extension_dispatcher.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 IPC_MESSAGE_HANDLER(ChromeViewMsg_StartFrameSniffer, OnStartFrameSniffer) | |
zel
2011/09/05 17:15:44
#if defined(OS_CHROMEOS)?
altimofeev
2011/09/06 14:47:52
Done.
| |
241 IPC_MESSAGE_UNHANDLED(handled = false) | 243 IPC_MESSAGE_UNHANDLED(handled = false) |
242 IPC_END_MESSAGE_MAP() | 244 IPC_END_MESSAGE_MAP() |
243 | 245 |
244 // Filter only. | 246 // Filter only. |
245 IPC_BEGIN_MESSAGE_MAP(ChromeRenderViewObserver, message) | 247 IPC_BEGIN_MESSAGE_MAP(ChromeRenderViewObserver, message) |
246 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) | 248 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) |
247 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsPrerendering, OnSetIsPrerendering); | 249 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsPrerendering, OnSetIsPrerendering); |
248 IPC_END_MESSAGE_MAP() | 250 IPC_END_MESSAGE_MAP() |
249 | 251 |
250 return handled; | 252 return handled; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 void ChromeRenderViewObserver::OnSetClientSidePhishingDetection( | 336 void ChromeRenderViewObserver::OnSetClientSidePhishingDetection( |
335 bool enable_phishing_detection) { | 337 bool enable_phishing_detection) { |
336 #if defined(ENABLE_SAFE_BROWSING) && !defined(OS_CHROMEOS) | 338 #if defined(ENABLE_SAFE_BROWSING) && !defined(OS_CHROMEOS) |
337 phishing_classifier_ = enable_phishing_detection ? | 339 phishing_classifier_ = enable_phishing_detection ? |
338 safe_browsing::PhishingClassifierDelegate::Create( | 340 safe_browsing::PhishingClassifierDelegate::Create( |
339 render_view(), NULL) : | 341 render_view(), NULL) : |
340 NULL; | 342 NULL; |
341 #endif | 343 #endif |
342 } | 344 } |
343 | 345 |
346 void ChromeRenderViewObserver::OnStartFrameSniffer(const string16& frame_name) { | |
347 new FrameSniffer(render_view(), frame_name); | |
348 } | |
349 | |
344 bool ChromeRenderViewObserver::allowDatabase( | 350 bool ChromeRenderViewObserver::allowDatabase( |
345 WebFrame* frame, | 351 WebFrame* frame, |
346 const WebString& name, | 352 const WebString& name, |
347 const WebString& display_name, | 353 const WebString& display_name, |
348 unsigned long estimated_size) { | 354 unsigned long estimated_size) { |
349 return content_settings_->AllowDatabase( | 355 return content_settings_->AllowDatabase( |
350 frame, name, display_name, estimated_size); | 356 frame, name, display_name, estimated_size); |
351 } | 357 } |
352 | 358 |
353 bool ChromeRenderViewObserver::allowFileSystem(WebFrame* frame) { | 359 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()) { | 989 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) && !data.empty()) { |
984 // Decode the favicon using WebKit's image decoder. | 990 // Decode the favicon using WebKit's image decoder. |
985 webkit_glue::ImageDecoder decoder(gfx::Size(kFaviconSize, kFaviconSize)); | 991 webkit_glue::ImageDecoder decoder(gfx::Size(kFaviconSize, kFaviconSize)); |
986 const unsigned char* src_data = | 992 const unsigned char* src_data = |
987 reinterpret_cast<const unsigned char*>(&data[0]); | 993 reinterpret_cast<const unsigned char*>(&data[0]); |
988 | 994 |
989 return decoder.Decode(src_data, data.size()); | 995 return decoder.Decode(src_data, data.size()); |
990 } | 996 } |
991 return SkBitmap(); | 997 return SkBitmap(); |
992 } | 998 } |
OLD | NEW |