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/extensions/api/web_navigation/web_navigation_api_consta
nts.h" | 10 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_consta
nts.h" |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 return true; | 738 return true; |
739 } | 739 } |
740 | 740 |
741 WebNavigationTabObserver* observer = | 741 WebNavigationTabObserver* observer = |
742 WebNavigationTabObserver::Get(web_contents); | 742 WebNavigationTabObserver::Get(web_contents); |
743 DCHECK(observer); | 743 DCHECK(observer); |
744 | 744 |
745 const FrameNavigationState& navigation_state = | 745 const FrameNavigationState& navigation_state = |
746 observer->frame_navigation_state(); | 746 observer->frame_navigation_state(); |
747 | 747 |
748 std::vector<linked_ptr<GetAllFrames::Results::DetailsElement> > result_list; | 748 std::vector<linked_ptr<GetAllFrames::Results::DetailsType> > result_list; |
749 for (FrameNavigationState::const_iterator it = navigation_state.begin(); | 749 for (FrameNavigationState::const_iterator it = navigation_state.begin(); |
750 it != navigation_state.end(); ++it) { | 750 it != navigation_state.end(); ++it) { |
751 FrameNavigationState::FrameID frame_id = *it; | 751 FrameNavigationState::FrameID frame_id = *it; |
752 FrameNavigationState::FrameID parent_frame_id = | 752 FrameNavigationState::FrameID parent_frame_id = |
753 navigation_state.GetParentFrameID(frame_id); | 753 navigation_state.GetParentFrameID(frame_id); |
754 GURL frame_url = navigation_state.GetUrl(frame_id); | 754 GURL frame_url = navigation_state.GetUrl(frame_id); |
755 if (!navigation_state.IsValidUrl(frame_url)) | 755 if (!navigation_state.IsValidUrl(frame_url)) |
756 continue; | 756 continue; |
757 linked_ptr<GetAllFrames::Results::DetailsElement> frame( | 757 linked_ptr<GetAllFrames::Results::DetailsType> frame( |
758 new GetAllFrames::Results::DetailsElement()); | 758 new GetAllFrames::Results::DetailsType()); |
759 frame->url = frame_url.spec(); | 759 frame->url = frame_url.spec(); |
760 frame->frame_id = helpers::GetFrameId( | 760 frame->frame_id = helpers::GetFrameId( |
761 navigation_state.IsMainFrame(frame_id), frame_id.frame_num); | 761 navigation_state.IsMainFrame(frame_id), frame_id.frame_num); |
762 frame->parent_frame_id = helpers::GetFrameId( | 762 frame->parent_frame_id = helpers::GetFrameId( |
763 navigation_state.IsMainFrame(parent_frame_id), | 763 navigation_state.IsMainFrame(parent_frame_id), |
764 parent_frame_id.frame_num); | 764 parent_frame_id.frame_num); |
765 frame->process_id = frame_id.render_view_host->GetProcess()->GetID(); | 765 frame->process_id = frame_id.render_view_host->GetProcess()->GetID(); |
766 frame->error_occurred = navigation_state.GetErrorOccurredInFrame(frame_id); | 766 frame->error_occurred = navigation_state.GetErrorOccurredInFrame(frame_id); |
767 result_list.push_back(frame); | 767 result_list.push_back(frame); |
768 } | 768 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 return &g_factory.Get(); | 808 return &g_factory.Get(); |
809 } | 809 } |
810 | 810 |
811 void WebNavigationAPI::OnListenerAdded( | 811 void WebNavigationAPI::OnListenerAdded( |
812 const extensions::EventListenerInfo& details) { | 812 const extensions::EventListenerInfo& details) { |
813 web_navigation_event_router_.reset(new WebNavigationEventRouter(profile_)); | 813 web_navigation_event_router_.reset(new WebNavigationEventRouter(profile_)); |
814 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 814 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); |
815 } | 815 } |
816 | 816 |
817 } // namespace extensions | 817 } // namespace extensions |
OLD | NEW |