| 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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 return; | 534 return; |
| 535 navigation_state_.SetNavigationCompleted(frame_id); | 535 navigation_state_.SetNavigationCompleted(frame_id); |
| 536 if (!navigation_state_.CanSendEvents(frame_id)) | 536 if (!navigation_state_.CanSendEvents(frame_id)) |
| 537 return; | 537 return; |
| 538 DCHECK( | 538 DCHECK( |
| 539 navigation_state_.GetUrl(frame_id) == validated_url || | 539 navigation_state_.GetUrl(frame_id) == validated_url || |
| 540 (navigation_state_.GetUrl(frame_id) == GURL(content::kAboutSrcDocURL) && | 540 (navigation_state_.GetUrl(frame_id) == GURL(content::kAboutSrcDocURL) && |
| 541 validated_url == GURL(content::kAboutBlankURL))) | 541 validated_url == GURL(content::kAboutBlankURL))) |
| 542 << "validated URL is " << validated_url << " but we expected " | 542 << "validated URL is " << validated_url << " but we expected " |
| 543 << navigation_state_.GetUrl(frame_id); | 543 << navigation_state_.GetUrl(frame_id); |
| 544 DCHECK_EQ(navigation_state_.IsMainFrame(frame_id), is_main_frame); | 544 // TODO(creis): Diagnose. |
| 545 //DCHECK_EQ(navigation_state_.IsMainFrame(frame_id), is_main_frame); |
| 545 | 546 |
| 546 // The load might already have finished by the time we finished parsing. For | 547 // The load might already have finished by the time we finished parsing. For |
| 547 // compatibility reasons, we artifically delay the load completed signal until | 548 // compatibility reasons, we artifically delay the load completed signal until |
| 548 // after parsing was completed. | 549 // after parsing was completed. |
| 549 if (!navigation_state_.GetParsingFinished(frame_id)) | 550 if (!navigation_state_.GetParsingFinished(frame_id)) |
| 550 return; | 551 return; |
| 551 helpers::DispatchOnCompleted(web_contents(), | 552 helpers::DispatchOnCompleted(web_contents(), |
| 552 navigation_state_.GetUrl(frame_id), | 553 navigation_state_.GetUrl(frame_id), |
| 553 is_main_frame, | 554 is_main_frame, |
| 554 frame_num); | 555 frame_num); |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 } | 834 } |
| 834 | 835 |
| 835 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { | 836 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 836 web_navigation_event_router_.reset(new WebNavigationEventRouter(profile_)); | 837 web_navigation_event_router_.reset(new WebNavigationEventRouter(profile_)); |
| 837 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 838 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); |
| 838 } | 839 } |
| 839 | 840 |
| 840 #endif // OS_ANDROID | 841 #endif // OS_ANDROID |
| 841 | 842 |
| 842 } // namespace extensions | 843 } // namespace extensions |
| OLD | NEW |