| 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/browser/prerender/prerender_contents.h" | 5 #include "chrome/browser/prerender/prerender_contents.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 } | 546 } |
| 547 | 547 |
| 548 void PrerenderContents::DocumentLoadedInFrame( | 548 void PrerenderContents::DocumentLoadedInFrame( |
| 549 content::RenderFrameHost* render_frame_host) { | 549 content::RenderFrameHost* render_frame_host) { |
| 550 if (!render_frame_host->GetParent()) | 550 if (!render_frame_host->GetParent()) |
| 551 NotifyPrerenderDomContentLoaded(); | 551 NotifyPrerenderDomContentLoaded(); |
| 552 } | 552 } |
| 553 | 553 |
| 554 void PrerenderContents::DidStartNavigation( | 554 void PrerenderContents::DidStartNavigation( |
| 555 content::NavigationHandle* navigation_handle) { | 555 content::NavigationHandle* navigation_handle) { |
| 556 if (!navigation_handle->IsInMainFrame() || navigation_handle->IsSamePage()) | 556 if (!navigation_handle->IsInMainFrame() || |
| 557 navigation_handle->IsSameDocument()) { |
| 557 return; | 558 return; |
| 559 } |
| 558 | 560 |
| 559 if (!CheckURL(navigation_handle->GetURL())) | 561 if (!CheckURL(navigation_handle->GetURL())) |
| 560 return; | 562 return; |
| 561 | 563 |
| 562 // Usually, this event fires if the user clicks or enters a new URL. | 564 // Usually, this event fires if the user clicks or enters a new URL. |
| 563 // Neither of these can happen in the case of an invisible prerender. | 565 // Neither of these can happen in the case of an invisible prerender. |
| 564 // So the cause is: Some JavaScript caused a new URL to be loaded. In that | 566 // So the cause is: Some JavaScript caused a new URL to be loaded. In that |
| 565 // case, the spinner would start again in the browser, so we must reset | 567 // case, the spinner would start again in the browser, so we must reset |
| 566 // has_stopped_loading_ so that the spinner won't be stopped. | 568 // has_stopped_loading_ so that the spinner won't be stopped. |
| 567 has_stopped_loading_ = false; | 569 has_stopped_loading_ = false; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 resource_throttles_.push_back(throttle); | 778 resource_throttles_.push_back(throttle); |
| 777 } | 779 } |
| 778 | 780 |
| 779 void PrerenderContents::AddNetworkBytes(int64_t bytes) { | 781 void PrerenderContents::AddNetworkBytes(int64_t bytes) { |
| 780 network_bytes_ += bytes; | 782 network_bytes_ += bytes; |
| 781 for (Observer& observer : observer_list_) | 783 for (Observer& observer : observer_list_) |
| 782 observer.OnPrerenderNetworkBytesChanged(this); | 784 observer.OnPrerenderNetworkBytesChanged(this); |
| 783 } | 785 } |
| 784 | 786 |
| 785 } // namespace prerender | 787 } // namespace prerender |
| OLD | NEW |