| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_frame_observer.h" | 5 #include "chrome/renderer/chrome_render_frame_observer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
| 16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 19 #include "chrome/common/chrome_isolated_world_ids.h" | 19 #include "chrome/common/chrome_isolated_world_ids.h" |
| 20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 21 #include "chrome/common/crash_keys.h" | 21 #include "chrome/common/crash_keys.h" |
| 22 #include "chrome/common/open_search_description_document_handler.mojom.h" |
| 22 #include "chrome/common/prerender_messages.h" | 23 #include "chrome/common/prerender_messages.h" |
| 23 #include "chrome/common/render_messages.h" | 24 #include "chrome/common/render_messages.h" |
| 24 #include "chrome/renderer/prerender/prerender_helper.h" | 25 #include "chrome/renderer/prerender/prerender_helper.h" |
| 25 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" | 26 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" |
| 26 #include "components/translate/content/renderer/translate_helper.h" | 27 #include "components/translate/content/renderer/translate_helper.h" |
| 28 #include "content/public/common/associated_interface_provider.h" |
| 27 #include "content/public/renderer/render_frame.h" | 29 #include "content/public/renderer/render_frame.h" |
| 28 #include "content/public/renderer/render_view.h" | 30 #include "content/public/renderer/render_view.h" |
| 29 #include "extensions/common/constants.h" | 31 #include "extensions/common/constants.h" |
| 30 #include "printing/features/features.h" | 32 #include "printing/features/features.h" |
| 31 #include "skia/ext/image_operations.h" | 33 #include "skia/ext/image_operations.h" |
| 32 #include "third_party/WebKit/public/platform/WebImage.h" | 34 #include "third_party/WebKit/public/platform/WebImage.h" |
| 33 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 35 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 34 #include "third_party/WebKit/public/web/WebDataSource.h" | 36 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 35 #include "third_party/WebKit/public/web/WebDocument.h" | 37 #include "third_party/WebKit/public/web/WebDocument.h" |
| 36 #include "third_party/WebKit/public/web/WebElement.h" | 38 #include "third_party/WebKit/public/web/WebElement.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 } | 241 } |
| 240 | 242 |
| 241 void ChromeRenderFrameObserver::DidFinishLoad() { | 243 void ChromeRenderFrameObserver::DidFinishLoad() { |
| 242 WebLocalFrame* frame = render_frame()->GetWebFrame(); | 244 WebLocalFrame* frame = render_frame()->GetWebFrame(); |
| 243 // Don't do anything for subframes. | 245 // Don't do anything for subframes. |
| 244 if (frame->parent()) | 246 if (frame->parent()) |
| 245 return; | 247 return; |
| 246 | 248 |
| 247 GURL osdd_url = frame->document().openSearchDescriptionURL(); | 249 GURL osdd_url = frame->document().openSearchDescriptionURL(); |
| 248 if (!osdd_url.is_empty()) { | 250 if (!osdd_url.is_empty()) { |
| 249 Send(new ChromeViewHostMsg_PageHasOSDD( | 251 chrome::mojom::OpenSearchDescriptionDocumentHandlerAssociatedPtr |
| 250 routing_id(), frame->document().url(), osdd_url)); | 252 osdd_handler; |
| 253 render_frame()->GetRemoteAssociatedInterfaces()->GetInterface( |
| 254 &osdd_handler); |
| 255 osdd_handler->PageHasOpenSearchDescriptionDocument( |
| 256 frame->document().url(), osdd_url); |
| 251 } | 257 } |
| 252 } | 258 } |
| 253 | 259 |
| 254 void ChromeRenderFrameObserver::DidStartProvisionalLoad( | 260 void ChromeRenderFrameObserver::DidStartProvisionalLoad( |
| 255 blink::WebDataSource* data_source) { | 261 blink::WebDataSource* data_source) { |
| 256 // Let translate_helper do any preparatory work for loading a URL. | 262 // Let translate_helper do any preparatory work for loading a URL. |
| 257 if (!translate_helper_) | 263 if (!translate_helper_) |
| 258 return; | 264 return; |
| 259 | 265 |
| 260 translate_helper_->PrepareForUrl( | 266 translate_helper_->PrepareForUrl( |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 CapturePageText(FINAL_CAPTURE); | 346 CapturePageText(FINAL_CAPTURE); |
| 341 break; | 347 break; |
| 342 default: | 348 default: |
| 343 break; | 349 break; |
| 344 } | 350 } |
| 345 } | 351 } |
| 346 | 352 |
| 347 void ChromeRenderFrameObserver::OnDestruct() { | 353 void ChromeRenderFrameObserver::OnDestruct() { |
| 348 delete this; | 354 delete this; |
| 349 } | 355 } |
| OLD | NEW |