 Chromium Code Reviews
 Chromium Code Reviews Issue 1381003004:
  Better distinguish didFinishLoad and didStopLoading  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1381003004:
  Better distinguish didFinishLoad and didStopLoading  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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 // Implements the Chrome Extensions WebNavigation API. | 5 // Implements the Chrome Extensions WebNavigation API. | 
| 6 | 6 | 
| 7 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" | 7 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" | 
| 8 | 8 | 
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" | 
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" | 
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 391 << "render_frame_host=" << render_frame_host | 391 << "render_frame_host=" << render_frame_host | 
| 392 << ", frame_num=" << render_frame_host->GetRoutingID() | 392 << ", frame_num=" << render_frame_host->GetRoutingID() | 
| 393 << ", url=" << validated_url << ")"; | 393 << ", url=" << validated_url << ")"; | 
| 394 // When showing replacement content, we might get load signals for frames | 394 // When showing replacement content, we might get load signals for frames | 
| 395 // that weren't reguarly loaded. | 395 // that weren't reguarly loaded. | 
| 396 if (!navigation_state_.IsValidFrame(render_frame_host)) | 396 if (!navigation_state_.IsValidFrame(render_frame_host)) | 
| 397 return; | 397 return; | 
| 398 navigation_state_.SetNavigationCompleted(render_frame_host); | 398 navigation_state_.SetNavigationCompleted(render_frame_host); | 
| 399 if (!navigation_state_.CanSendEvents(render_frame_host)) | 399 if (!navigation_state_.CanSendEvents(render_frame_host)) | 
| 400 return; | 400 return; | 
| 401 DCHECK(navigation_state_.GetUrl(render_frame_host) == validated_url || | 401 | 
| 402 (navigation_state_.GetUrl(render_frame_host) == | 402 // A new navigation might have started before the old one completed. | 
| 403 GURL(content::kAboutSrcDocURL) && | 403 // Ignore the old navigation completion in that case. | 
| 404 validated_url == GURL(url::kAboutBlankURL))) | 404 if (navigation_state_.GetUrl(render_frame_host) != validated_url && | 
| 
dcheng
2015/10/08 05:34:35
This first check seems obviously related to the co
 
Nate Chapin
2015/10/08 21:03:59
Done.
 | |
| 405 << "validated URL is " << validated_url << " but we expected " | 405 (navigation_state_.GetUrl(render_frame_host) != | 
| 406 << navigation_state_.GetUrl(render_frame_host); | 406 GURL(content::kAboutSrcDocURL) || | 
| 407 validated_url != GURL(url::kAboutBlankURL))) { | |
| 408 return; | |
| 409 } | |
| 407 | 410 | 
| 408 // The load might already have finished by the time we finished parsing. For | 411 // The load might already have finished by the time we finished parsing. For | 
| 409 // compatibility reasons, we artifically delay the load completed signal until | 412 // compatibility reasons, we artifically delay the load completed signal until | 
| 410 // after parsing was completed. | 413 // after parsing was completed. | 
| 411 if (!navigation_state_.GetParsingFinished(render_frame_host)) | 414 if (!navigation_state_.GetParsingFinished(render_frame_host)) | 
| 412 return; | 415 return; | 
| 413 helpers::DispatchOnCompleted(web_contents(), | 416 helpers::DispatchOnCompleted(web_contents(), | 
| 414 render_frame_host, | 417 render_frame_host, | 
| 415 navigation_state_.GetUrl(render_frame_host)); | 418 navigation_state_.GetUrl(render_frame_host)); | 
| 416 } | 419 } | 
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 625 return g_factory.Pointer(); | 628 return g_factory.Pointer(); | 
| 626 } | 629 } | 
| 627 | 630 | 
| 628 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { | 631 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { | 
| 629 web_navigation_event_router_.reset(new WebNavigationEventRouter( | 632 web_navigation_event_router_.reset(new WebNavigationEventRouter( | 
| 630 Profile::FromBrowserContext(browser_context_))); | 633 Profile::FromBrowserContext(browser_context_))); | 
| 631 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 634 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 
| 632 } | 635 } | 
| 633 | 636 | 
| 634 } // namespace extensions | 637 } // namespace extensions | 
| OLD | NEW |