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/osdd_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" |
27 #include "content/public/renderer/render_frame.h" | 28 #include "content/public/renderer/render_frame.h" |
28 #include "content/public/renderer/render_view.h" | 29 #include "content/public/renderer/render_view.h" |
29 #include "extensions/common/constants.h" | 30 #include "extensions/common/constants.h" |
30 #include "printing/features/features.h" | 31 #include "printing/features/features.h" |
32 #include "services/service_manager/public/cpp/interface_provider.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" |
37 #include "third_party/WebKit/public/web/WebFrameContentDumper.h" | 39 #include "third_party/WebKit/public/web/WebFrameContentDumper.h" |
38 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 40 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
39 #include "third_party/WebKit/public/web/WebNode.h" | 41 #include "third_party/WebKit/public/web/WebNode.h" |
40 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 42 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
(...skipping 198 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::OSDDHandlerPtr osdd_handler; |
250 routing_id(), frame->document().url(), osdd_url)); | 252 render_frame()->GetRemoteInterfaces()->GetInterface( |
253 mojo::MakeRequest(&osdd_handler)); | |
Sam McNally
2017/03/15 00:38:48
GetInterface() has an overload that calls MakeRequ
martis
2017/03/15 05:00:56
Done.
| |
254 osdd_handler->OnPageHasOSDD(frame->document().url(), osdd_url); | |
251 } | 255 } |
252 } | 256 } |
253 | 257 |
254 void ChromeRenderFrameObserver::DidStartProvisionalLoad( | 258 void ChromeRenderFrameObserver::DidStartProvisionalLoad( |
255 blink::WebDataSource* data_source) { | 259 blink::WebDataSource* data_source) { |
256 // Let translate_helper do any preparatory work for loading a URL. | 260 // Let translate_helper do any preparatory work for loading a URL. |
257 if (!translate_helper_) | 261 if (!translate_helper_) |
258 return; | 262 return; |
259 | 263 |
260 translate_helper_->PrepareForUrl( | 264 translate_helper_->PrepareForUrl( |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
340 CapturePageText(FINAL_CAPTURE); | 344 CapturePageText(FINAL_CAPTURE); |
341 break; | 345 break; |
342 default: | 346 default: |
343 break; | 347 break; |
344 } | 348 } |
345 } | 349 } |
346 | 350 |
347 void ChromeRenderFrameObserver::OnDestruct() { | 351 void ChromeRenderFrameObserver::OnDestruct() { |
348 delete this; | 352 delete this; |
349 } | 353 } |
OLD | NEW |