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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 // When showing replacement content, we might get load signals for frames | 530 // When showing replacement content, we might get load signals for frames |
531 // that weren't reguarly loaded. | 531 // that weren't reguarly loaded. |
532 if (!navigation_state_.IsValidFrame(frame_id)) | 532 if (!navigation_state_.IsValidFrame(frame_id)) |
533 return; | 533 return; |
534 navigation_state_.SetNavigationCompleted(frame_id); | 534 navigation_state_.SetNavigationCompleted(frame_id); |
535 if (!navigation_state_.CanSendEvents(frame_id)) | 535 if (!navigation_state_.CanSendEvents(frame_id)) |
536 return; | 536 return; |
537 DCHECK( | 537 DCHECK( |
538 navigation_state_.GetUrl(frame_id) == validated_url || | 538 navigation_state_.GetUrl(frame_id) == validated_url || |
539 (navigation_state_.GetUrl(frame_id) == GURL(content::kAboutSrcDocURL) && | 539 (navigation_state_.GetUrl(frame_id) == GURL(content::kAboutSrcDocURL) && |
540 validated_url == GURL(content::kAboutBlankURL))) | 540 validated_url == GURL(url::kAboutBlankURL))) |
541 << "validated URL is " << validated_url << " but we expected " | 541 << "validated URL is " << validated_url << " but we expected " |
542 << navigation_state_.GetUrl(frame_id); | 542 << navigation_state_.GetUrl(frame_id); |
543 DCHECK_EQ(navigation_state_.IsMainFrame(frame_id), is_main_frame); | 543 DCHECK_EQ(navigation_state_.IsMainFrame(frame_id), is_main_frame); |
544 | 544 |
545 // The load might already have finished by the time we finished parsing. For | 545 // The load might already have finished by the time we finished parsing. For |
546 // compatibility reasons, we artifically delay the load completed signal until | 546 // compatibility reasons, we artifically delay the load completed signal until |
547 // after parsing was completed. | 547 // after parsing was completed. |
548 if (!navigation_state_.GetParsingFinished(frame_id)) | 548 if (!navigation_state_.GetParsingFinished(frame_id)) |
549 return; | 549 return; |
550 helpers::DispatchOnCompleted(web_contents(), | 550 helpers::DispatchOnCompleted(web_contents(), |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 | 837 |
838 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { | 838 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { |
839 web_navigation_event_router_.reset(new WebNavigationEventRouter( | 839 web_navigation_event_router_.reset(new WebNavigationEventRouter( |
840 Profile::FromBrowserContext(browser_context_))); | 840 Profile::FromBrowserContext(browser_context_))); |
841 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 841 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
842 } | 842 } |
843 | 843 |
844 #endif // OS_ANDROID | 844 #endif // OS_ANDROID |
845 | 845 |
846 } // namespace extensions | 846 } // namespace extensions |
OLD | NEW |