Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1292)

Side by Side Diff: chrome/browser/extensions/api/web_navigation/web_navigation_api.cc

Issue 1381003004: Better distinguish didFinishLoad and didStopLoading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix WebFrameTest.CallbackOrdering race Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/autofill/content/renderer/password_autofill_agent.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // srcdoc iframes will report a url of about:blank, still let it through.
405 << "validated URL is " << validated_url << " but we expected " 405 if (navigation_state_.GetUrl(render_frame_host) != validated_url &&
406 << navigation_state_.GetUrl(render_frame_host); 406 (navigation_state_.GetUrl(render_frame_host) !=
407 GURL(content::kAboutSrcDocURL) ||
408 validated_url != GURL(url::kAboutBlankURL))) {
409 return;
nasko 2015/10/12 23:48:24 Does your change imply that a DidFailLoad will be
410 }
407 411
408 // The load might already have finished by the time we finished parsing. For 412 // The load might already have finished by the time we finished parsing. For
409 // compatibility reasons, we artifically delay the load completed signal until 413 // compatibility reasons, we artifically delay the load completed signal until
410 // after parsing was completed. 414 // after parsing was completed.
411 if (!navigation_state_.GetParsingFinished(render_frame_host)) 415 if (!navigation_state_.GetParsingFinished(render_frame_host))
412 return; 416 return;
413 helpers::DispatchOnCompleted(web_contents(), 417 helpers::DispatchOnCompleted(web_contents(),
414 render_frame_host, 418 render_frame_host,
415 navigation_state_.GetUrl(render_frame_host)); 419 navigation_state_.GetUrl(render_frame_host));
416 } 420 }
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 return g_factory.Pointer(); 629 return g_factory.Pointer();
626 } 630 }
627 631
628 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { 632 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) {
629 web_navigation_event_router_.reset(new WebNavigationEventRouter( 633 web_navigation_event_router_.reset(new WebNavigationEventRouter(
630 Profile::FromBrowserContext(browser_context_))); 634 Profile::FromBrowserContext(browser_context_)));
631 EventRouter::Get(browser_context_)->UnregisterObserver(this); 635 EventRouter::Get(browser_context_)->UnregisterObserver(this);
632 } 636 }
633 637
634 } // namespace extensions 638 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | components/autofill/content/renderer/password_autofill_agent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698