Chromium Code Reviews| 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 #include "chrome/renderer/chrome_render_view_observer.h" | 5 #include "chrome/renderer/chrome_render_view_observer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 327 for (size_t i = 0; i < webui_javascript_.size(); ++i) { | 327 for (size_t i = 0; i < webui_javascript_.size(); ++i) { |
| 328 render_view()->GetMainRenderFrame()->ExecuteJavaScript( | 328 render_view()->GetMainRenderFrame()->ExecuteJavaScript( |
| 329 webui_javascript_[i]); | 329 webui_javascript_[i]); |
| 330 } | 330 } |
| 331 webui_javascript_.clear(); | 331 webui_javascript_.clear(); |
| 332 } | 332 } |
| 333 } | 333 } |
| 334 | 334 |
| 335 void ChromeRenderViewObserver::DidStopLoading() { | 335 void ChromeRenderViewObserver::DidStopLoading() { |
| 336 WebFrame* main_frame = render_view()->GetWebView()->mainFrame(); | 336 WebFrame* main_frame = render_view()->GetWebView()->mainFrame(); |
| 337 GURL osdd_url = main_frame->document().openSearchDescriptionURL(); | 337 |
| 338 if (!osdd_url.is_empty()) { | 338 // Only WebLocalFrames host the document associated with a frame and need to |
| 339 Send(new ChromeViewHostMsg_PageHasOSDD( | 339 // process meta or OSDD tags. |
| 340 routing_id(), main_frame->document().url(), osdd_url, | 340 if (main_frame->isWebLocalFrame()) { |
| 341 search_provider::AUTODETECTED_PROVIDER)); | 341 GURL osdd_url = main_frame->document().openSearchDescriptionURL(); |
| 342 if (!osdd_url.is_empty()) { | |
| 343 Send(new ChromeViewHostMsg_PageHasOSDD( | |
| 344 routing_id(), main_frame->document().url(), osdd_url, | |
| 345 search_provider::AUTODETECTED_PROVIDER)); | |
| 346 } | |
| 347 | |
| 348 // Don't capture pages including refresh meta tag. | |
| 349 if (HasRefreshMetaTag(main_frame)) | |
| 350 return; | |
| 342 } | 351 } |
| 343 | 352 |
| 344 // Don't capture pages including refresh meta tag. | |
| 345 if (HasRefreshMetaTag(main_frame)) | |
| 346 return; | |
| 347 | |
| 348 CapturePageInfoLater( | 353 CapturePageInfoLater( |
|
Lei Zhang
2014/12/16 23:46:57
I think you want this to be for WebLocalFrame only
nasko
2014/12/16 23:48:59
I'm not certain and the CapturePageInfo already ha
Lei Zhang
2014/12/17 00:14:20
It looks like creis@ has plans to move the Capture
| |
| 349 false, // preliminary_capture | 354 false, // preliminary_capture |
| 350 base::TimeDelta::FromMilliseconds( | 355 base::TimeDelta::FromMilliseconds( |
| 351 render_view()->GetContentStateImmediately() ? | 356 render_view()->GetContentStateImmediately() ? |
| 352 0 : kDelayForCaptureMs)); | 357 0 : kDelayForCaptureMs)); |
| 353 } | 358 } |
| 354 | 359 |
| 355 void ChromeRenderViewObserver::DidCommitProvisionalLoad( | 360 void ChromeRenderViewObserver::DidCommitProvisionalLoad( |
| 356 WebLocalFrame* frame, bool is_new_navigation) { | 361 WebLocalFrame* frame, bool is_new_navigation) { |
| 357 // Don't capture pages being not new, or including refresh meta tag. | 362 // Don't capture pages being not new, or including refresh meta tag. |
| 358 if (!is_new_navigation || HasRefreshMetaTag(frame)) | 363 if (!is_new_navigation || HasRefreshMetaTag(frame)) |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 472 WebElement element = node.to<WebElement>(); | 477 WebElement element = node.to<WebElement>(); |
| 473 if (!element.hasHTMLTagName(tag_name)) | 478 if (!element.hasHTMLTagName(tag_name)) |
| 474 continue; | 479 continue; |
| 475 WebString value = element.getAttribute(attribute_name); | 480 WebString value = element.getAttribute(attribute_name); |
| 476 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) | 481 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) |
| 477 continue; | 482 continue; |
| 478 return true; | 483 return true; |
| 479 } | 484 } |
| 480 return false; | 485 return false; |
| 481 } | 486 } |
| OLD | NEW |