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 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 return true; | 715 return true; |
716 } | 716 } |
717 | 717 |
718 WebNavigationTabObserver* observer = | 718 WebNavigationTabObserver* observer = |
719 WebNavigationTabObserver::Get(web_contents); | 719 WebNavigationTabObserver::Get(web_contents); |
720 DCHECK(observer); | 720 DCHECK(observer); |
721 | 721 |
722 const FrameNavigationState& navigation_state = | 722 const FrameNavigationState& navigation_state = |
723 observer->frame_navigation_state(); | 723 observer->frame_navigation_state(); |
724 | 724 |
725 std::vector<linked_ptr<GetAllFrames::Results::DetailsElement> > result_list; | 725 std::vector<linked_ptr<GetAllFrames::Results::DetailsType> > result_list; |
726 for (FrameNavigationState::const_iterator it = navigation_state.begin(); | 726 for (FrameNavigationState::const_iterator it = navigation_state.begin(); |
727 it != navigation_state.end(); ++it) { | 727 it != navigation_state.end(); ++it) { |
728 FrameNavigationState::FrameID frame_id = *it; | 728 FrameNavigationState::FrameID frame_id = *it; |
729 FrameNavigationState::FrameID parent_frame_id = | 729 FrameNavigationState::FrameID parent_frame_id = |
730 navigation_state.GetParentFrameID(frame_id); | 730 navigation_state.GetParentFrameID(frame_id); |
731 GURL frame_url = navigation_state.GetUrl(frame_id); | 731 GURL frame_url = navigation_state.GetUrl(frame_id); |
732 if (!navigation_state.IsValidUrl(frame_url)) | 732 if (!navigation_state.IsValidUrl(frame_url)) |
733 continue; | 733 continue; |
734 linked_ptr<GetAllFrames::Results::DetailsElement> frame( | 734 linked_ptr<GetAllFrames::Results::DetailsType> frame( |
735 new GetAllFrames::Results::DetailsElement()); | 735 new GetAllFrames::Results::DetailsType()); |
736 frame->url = frame_url.spec(); | 736 frame->url = frame_url.spec(); |
737 frame->frame_id = helpers::GetFrameId( | 737 frame->frame_id = helpers::GetFrameId( |
738 navigation_state.IsMainFrame(frame_id), frame_id.frame_num); | 738 navigation_state.IsMainFrame(frame_id), frame_id.frame_num); |
739 frame->parent_frame_id = helpers::GetFrameId( | 739 frame->parent_frame_id = helpers::GetFrameId( |
740 navigation_state.IsMainFrame(parent_frame_id), | 740 navigation_state.IsMainFrame(parent_frame_id), |
741 parent_frame_id.frame_num); | 741 parent_frame_id.frame_num); |
742 frame->process_id = frame_id.render_view_host->GetProcess()->GetID(); | 742 frame->process_id = frame_id.render_view_host->GetProcess()->GetID(); |
743 frame->error_occurred = navigation_state.GetErrorOccurredInFrame(frame_id); | 743 frame->error_occurred = navigation_state.GetErrorOccurredInFrame(frame_id); |
744 result_list.push_back(frame); | 744 result_list.push_back(frame); |
745 } | 745 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 return &g_factory.Get(); | 785 return &g_factory.Get(); |
786 } | 786 } |
787 | 787 |
788 void WebNavigationAPI::OnListenerAdded( | 788 void WebNavigationAPI::OnListenerAdded( |
789 const extensions::EventListenerInfo& details) { | 789 const extensions::EventListenerInfo& details) { |
790 web_navigation_event_router_.reset(new WebNavigationEventRouter(profile_)); | 790 web_navigation_event_router_.reset(new WebNavigationEventRouter(profile_)); |
791 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 791 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); |
792 } | 792 } |
793 | 793 |
794 } // namespace extensions | 794 } // namespace extensions |
OLD | NEW |