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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 if (old_host) { | 261 if (old_host) { |
262 RenderFrameDeleted(old_host); | 262 RenderFrameDeleted(old_host); |
263 navigation_state_.FrameHostDeleted(old_host); | 263 navigation_state_.FrameHostDeleted(old_host); |
264 } | 264 } |
265 | 265 |
266 navigation_state_.FrameHostCreated(new_host); | 266 navigation_state_.FrameHostCreated(new_host); |
267 } | 267 } |
268 | 268 |
269 void WebNavigationTabObserver::DidStartNavigation( | 269 void WebNavigationTabObserver::DidStartNavigation( |
270 content::NavigationHandle* navigation_handle) { | 270 content::NavigationHandle* navigation_handle) { |
271 if (navigation_handle->IsSynchronousNavigation() || | 271 if (navigation_handle->IsSamePage() || |
272 !FrameNavigationState::IsValidUrl(navigation_handle->GetURL())) { | 272 !FrameNavigationState::IsValidUrl(navigation_handle->GetURL())) { |
273 return; | 273 return; |
274 } | 274 } |
275 | 275 |
276 helpers::DispatchOnBeforeNavigate(navigation_handle); | 276 helpers::DispatchOnBeforeNavigate(navigation_handle); |
277 } | 277 } |
278 | 278 |
279 void WebNavigationTabObserver::DidFinishNavigation( | 279 void WebNavigationTabObserver::DidFinishNavigation( |
280 content::NavigationHandle* navigation_handle) { | 280 content::NavigationHandle* navigation_handle) { |
281 if (navigation_handle->HasCommitted() && !navigation_handle->IsErrorPage()) { | 281 if (navigation_handle->HasCommitted() && !navigation_handle->IsErrorPage()) { |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 return g_factory.Pointer(); | 562 return g_factory.Pointer(); |
563 } | 563 } |
564 | 564 |
565 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { | 565 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { |
566 web_navigation_event_router_.reset(new WebNavigationEventRouter( | 566 web_navigation_event_router_.reset(new WebNavigationEventRouter( |
567 Profile::FromBrowserContext(browser_context_))); | 567 Profile::FromBrowserContext(browser_context_))); |
568 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 568 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
569 } | 569 } |
570 | 570 |
571 } // namespace extensions | 571 } // namespace extensions |
OLD | NEW |