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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 web_contents(), | 639 web_contents(), |
640 render_view_host->GetProcess()->GetID(), | 640 render_view_host->GetProcess()->GetID(), |
641 navigation_state_.GetUrl(frame_id), | 641 navigation_state_.GetUrl(frame_id), |
642 frame_num, | 642 frame_num, |
643 navigation_state_.IsMainFrame(frame_id), | 643 navigation_state_.IsMainFrame(frame_id), |
644 net::ERR_ABORTED); | 644 net::ERR_ABORTED); |
645 } | 645 } |
646 navigation_state_.FrameDetached(frame_id); | 646 navigation_state_.FrameDetached(frame_id); |
647 } | 647 } |
648 | 648 |
649 void WebNavigationTabObserver::WebContentsDestroyed(content::WebContents* tab) { | 649 void WebNavigationTabObserver::WebContentsDestroyed() { |
650 g_tab_observer.Get().erase(tab); | 650 g_tab_observer.Get().erase(web_contents()); |
651 registrar_.RemoveAll(); | 651 registrar_.RemoveAll(); |
652 SendErrorEvents(tab, NULL, FrameNavigationState::FrameID()); | 652 SendErrorEvents(web_contents(), NULL, FrameNavigationState::FrameID()); |
653 } | 653 } |
654 | 654 |
655 void WebNavigationTabObserver::SendErrorEvents( | 655 void WebNavigationTabObserver::SendErrorEvents( |
656 content::WebContents* web_contents, | 656 content::WebContents* web_contents, |
657 content::RenderViewHost* render_view_host, | 657 content::RenderViewHost* render_view_host, |
658 FrameNavigationState::FrameID id_to_skip) { | 658 FrameNavigationState::FrameID id_to_skip) { |
659 for (FrameNavigationState::const_iterator frame = navigation_state_.begin(); | 659 for (FrameNavigationState::const_iterator frame = navigation_state_.begin(); |
660 frame != navigation_state_.end(); ++frame) { | 660 frame != navigation_state_.end(); ++frame) { |
661 if (!navigation_state_.GetNavigationCompleted(*frame) && | 661 if (!navigation_state_.GetNavigationCompleted(*frame) && |
662 navigation_state_.CanSendEvents(*frame) && | 662 navigation_state_.CanSendEvents(*frame) && |
(...skipping 174 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 |