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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 return; | 567 return; |
568 navigation_state_.SetNavigationCompleted(frame_id); | 568 navigation_state_.SetNavigationCompleted(frame_id); |
569 if (!navigation_state_.CanSendEvents(frame_id)) | 569 if (!navigation_state_.CanSendEvents(frame_id)) |
570 return; | 570 return; |
571 DCHECK( | 571 DCHECK( |
572 navigation_state_.GetUrl(frame_id) == validated_url || | 572 navigation_state_.GetUrl(frame_id) == validated_url || |
573 (navigation_state_.GetUrl(frame_id) == GURL(content::kAboutSrcDocURL) && | 573 (navigation_state_.GetUrl(frame_id) == GURL(content::kAboutSrcDocURL) && |
574 validated_url == GURL(content::kAboutBlankURL))) | 574 validated_url == GURL(content::kAboutBlankURL))) |
575 << "validated URL is " << validated_url << " but we expected " | 575 << "validated URL is " << validated_url << " but we expected " |
576 << navigation_state_.GetUrl(frame_id); | 576 << navigation_state_.GetUrl(frame_id); |
577 DCHECK_EQ(navigation_state_.IsMainFrame(frame_id), is_main_frame); | 577 // TODO(creis): Diagnose. |
| 578 //DCHECK_EQ(navigation_state_.IsMainFrame(frame_id), is_main_frame); |
578 | 579 |
579 // The load might already have finished by the time we finished parsing. For | 580 // The load might already have finished by the time we finished parsing. For |
580 // compatibility reasons, we artifically delay the load completed signal until | 581 // compatibility reasons, we artifically delay the load completed signal until |
581 // after parsing was completed. | 582 // after parsing was completed. |
582 if (!navigation_state_.GetParsingFinished(frame_id)) | 583 if (!navigation_state_.GetParsingFinished(frame_id)) |
583 return; | 584 return; |
584 helpers::DispatchOnCompleted(web_contents(), | 585 helpers::DispatchOnCompleted(web_contents(), |
585 navigation_state_.GetUrl(frame_id), | 586 navigation_state_.GetUrl(frame_id), |
586 is_main_frame, | 587 is_main_frame, |
587 frame_num); | 588 frame_num); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 } | 860 } |
860 | 861 |
861 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { | 862 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { |
862 web_navigation_event_router_.reset(new WebNavigationEventRouter(profile_)); | 863 web_navigation_event_router_.reset(new WebNavigationEventRouter(profile_)); |
863 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 864 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); |
864 } | 865 } |
865 | 866 |
866 #endif // OS_ANDROID | 867 #endif // OS_ANDROID |
867 | 868 |
868 } // namespace extensions | 869 } // namespace extensions |
OLD | NEW |