| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 if (old_host) { | 262 if (old_host) { |
| 263 RenderFrameDeleted(old_host); | 263 RenderFrameDeleted(old_host); |
| 264 navigation_state_.FrameHostDeleted(old_host); | 264 navigation_state_.FrameHostDeleted(old_host); |
| 265 } | 265 } |
| 266 | 266 |
| 267 navigation_state_.FrameHostCreated(new_host); | 267 navigation_state_.FrameHostCreated(new_host); |
| 268 } | 268 } |
| 269 | 269 |
| 270 void WebNavigationTabObserver::DidStartNavigation( | 270 void WebNavigationTabObserver::DidStartNavigation( |
| 271 content::NavigationHandle* navigation_handle) { | 271 content::NavigationHandle* navigation_handle) { |
| 272 if (navigation_handle->IsSynchronousNavigation() || | 272 if (navigation_handle->IsSamePage() || |
| 273 !FrameNavigationState::IsValidUrl(navigation_handle->GetURL())) { | 273 !FrameNavigationState::IsValidUrl(navigation_handle->GetURL())) { |
| 274 return; | 274 return; |
| 275 } | 275 } |
| 276 | 276 |
| 277 helpers::DispatchOnBeforeNavigate(navigation_handle); | 277 helpers::DispatchOnBeforeNavigate(navigation_handle); |
| 278 } | 278 } |
| 279 | 279 |
| 280 void WebNavigationTabObserver::DidFinishNavigation( | 280 void WebNavigationTabObserver::DidFinishNavigation( |
| 281 content::NavigationHandle* navigation_handle) { | 281 content::NavigationHandle* navigation_handle) { |
| 282 if (navigation_handle->HasCommitted() && !navigation_handle->IsErrorPage()) { | 282 if (navigation_handle->HasCommitted() && !navigation_handle->IsErrorPage()) { |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 return g_factory.Pointer(); | 577 return g_factory.Pointer(); |
| 578 } | 578 } |
| 579 | 579 |
| 580 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { | 580 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 581 web_navigation_event_router_.reset(new WebNavigationEventRouter( | 581 web_navigation_event_router_.reset(new WebNavigationEventRouter( |
| 582 Profile::FromBrowserContext(browser_context_))); | 582 Profile::FromBrowserContext(browser_context_))); |
| 583 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 583 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 584 } | 584 } |
| 585 | 585 |
| 586 } // namespace extensions | 586 } // namespace extensions |
| OLD | NEW |