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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 GURL existing_url = navigation_state_.GetUrl(frame_id); | 683 GURL existing_url = navigation_state_.GetUrl(frame_id); |
684 if (existing_url == url) | 684 if (existing_url == url) |
685 return false; | 685 return false; |
686 | 686 |
687 url_canon::Replacements<char> replacements; | 687 url_canon::Replacements<char> replacements; |
688 replacements.ClearRef(); | 688 replacements.ClearRef(); |
689 return existing_url.ReplaceComponents(replacements) == | 689 return existing_url.ReplaceComponents(replacements) == |
690 url.ReplaceComponents(replacements); | 690 url.ReplaceComponents(replacements); |
691 } | 691 } |
692 | 692 |
693 bool WebNavigationGetFrameFunction::RunImpl() { | 693 bool WebNavigationGetFrameFunction::RunSync() { |
694 scoped_ptr<GetFrame::Params> params(GetFrame::Params::Create(*args_)); | 694 scoped_ptr<GetFrame::Params> params(GetFrame::Params::Create(*args_)); |
695 EXTENSION_FUNCTION_VALIDATE(params.get()); | 695 EXTENSION_FUNCTION_VALIDATE(params.get()); |
696 int tab_id = params->details.tab_id; | 696 int tab_id = params->details.tab_id; |
697 int frame_id = params->details.frame_id; | 697 int frame_id = params->details.frame_id; |
698 int process_id = params->details.process_id; | 698 int process_id = params->details.process_id; |
699 | 699 |
700 SetResult(base::Value::CreateNullValue()); | 700 SetResult(base::Value::CreateNullValue()); |
701 | 701 |
702 content::WebContents* web_contents; | 702 content::WebContents* web_contents; |
703 if (!ExtensionTabUtil::GetTabById(tab_id, | 703 if (!ExtensionTabUtil::GetTabById(tab_id, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 frame_navigation_state.GetErrorOccurredInFrame(internal_frame_id); | 740 frame_navigation_state.GetErrorOccurredInFrame(internal_frame_id); |
741 FrameNavigationState::FrameID parent_frame_id = | 741 FrameNavigationState::FrameID parent_frame_id = |
742 frame_navigation_state.GetParentFrameID(internal_frame_id); | 742 frame_navigation_state.GetParentFrameID(internal_frame_id); |
743 frame_details.parent_frame_id = helpers::GetFrameId( | 743 frame_details.parent_frame_id = helpers::GetFrameId( |
744 frame_navigation_state.IsMainFrame(parent_frame_id), | 744 frame_navigation_state.IsMainFrame(parent_frame_id), |
745 parent_frame_id.frame_num); | 745 parent_frame_id.frame_num); |
746 results_ = GetFrame::Results::Create(frame_details); | 746 results_ = GetFrame::Results::Create(frame_details); |
747 return true; | 747 return true; |
748 } | 748 } |
749 | 749 |
750 bool WebNavigationGetAllFramesFunction::RunImpl() { | 750 bool WebNavigationGetAllFramesFunction::RunSync() { |
751 scoped_ptr<GetAllFrames::Params> params(GetAllFrames::Params::Create(*args_)); | 751 scoped_ptr<GetAllFrames::Params> params(GetAllFrames::Params::Create(*args_)); |
752 EXTENSION_FUNCTION_VALIDATE(params.get()); | 752 EXTENSION_FUNCTION_VALIDATE(params.get()); |
753 int tab_id = params->details.tab_id; | 753 int tab_id = params->details.tab_id; |
754 | 754 |
755 SetResult(base::Value::CreateNullValue()); | 755 SetResult(base::Value::CreateNullValue()); |
756 | 756 |
757 content::WebContents* web_contents; | 757 content::WebContents* web_contents; |
758 if (!ExtensionTabUtil::GetTabById(tab_id, | 758 if (!ExtensionTabUtil::GetTabById(tab_id, |
759 GetProfile(), | 759 GetProfile(), |
760 include_incognito(), | 760 include_incognito(), |
(...skipping 76 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 |