Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: chrome/browser/extensions/api/web_navigation/web_navigation_api.cc

Issue 11778097: Revert revision 176015 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_helper s.h" 11 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_helper s.h"
12 #include "chrome/browser/extensions/event_router.h" 12 #include "chrome/browser/extensions/event_router.h"
13 #include "chrome/browser/extensions/extension_system.h" 13 #include "chrome/browser/extensions/extension_system.h"
14 #include "chrome/browser/extensions/extension_tab_util.h" 14 #include "chrome/browser/extensions/extension_tab_util.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/tab_contents/retargeting_details.h" 16 #include "chrome/browser/tab_contents/retargeting_details.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/browser_list.h" 18 #include "chrome/browser/ui/browser_list.h"
19 #include "chrome/browser/view_type_utils.h" 19 #include "chrome/browser/view_type_utils.h"
20 #include "chrome/common/chrome_notification_types.h" 20 #include "chrome/common/chrome_notification_types.h"
21 #include "chrome/common/extensions/api/web_navigation.h" 21 #include "chrome/common/extensions/api/web_navigation.h"
22 #include "content/public/browser/resource_request_details.h"
22 #include "content/public/browser/navigation_details.h" 23 #include "content/public/browser/navigation_details.h"
23 #include "content/public/browser/notification_service.h" 24 #include "content/public/browser/notification_service.h"
24 #include "content/public/browser/notification_types.h" 25 #include "content/public/browser/notification_types.h"
25 #include "content/public/browser/render_process_host.h" 26 #include "content/public/browser/render_process_host.h"
26 #include "content/public/browser/render_view_host.h" 27 #include "content/public/browser/render_view_host.h"
27 #include "content/public/browser/resource_request_details.h"
28 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
29 #include "content/public/common/url_constants.h" 29 #include "content/public/common/url_constants.h"
30 #include "net/base/net_errors.h" 30 #include "net/base/net_errors.h"
31 31
32 namespace GetFrame = extensions::api::web_navigation::GetFrame; 32 namespace GetFrame = extensions::api::web_navigation::GetFrame;
33 namespace GetAllFrames = extensions::api::web_navigation::GetAllFrames; 33 namespace GetAllFrames = extensions::api::web_navigation::GetAllFrames;
34 34
35 DEFINE_WEB_CONTENTS_USER_DATA_KEY(extensions::WebNavigationTabObserver); 35 DEFINE_WEB_CONTENTS_USER_DATA_KEY(extensions::WebNavigationTabObserver);
36 36
37 namespace extensions { 37 namespace extensions {
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 GURL existing_url = navigation_state_.GetUrl(frame_id); 657 GURL existing_url = navigation_state_.GetUrl(frame_id);
658 if (existing_url == url) 658 if (existing_url == url)
659 return false; 659 return false;
660 660
661 url_canon::Replacements<char> replacements; 661 url_canon::Replacements<char> replacements;
662 replacements.ClearRef(); 662 replacements.ClearRef();
663 return existing_url.ReplaceComponents(replacements) == 663 return existing_url.ReplaceComponents(replacements) ==
664 url.ReplaceComponents(replacements); 664 url.ReplaceComponents(replacements);
665 } 665 }
666 666
667 bool WebNavigationGetFrameFunction::RunImpl() { 667 bool GetFrameFunction::RunImpl() {
668 scoped_ptr<GetFrame::Params> params(GetFrame::Params::Create(*args_)); 668 scoped_ptr<GetFrame::Params> params(GetFrame::Params::Create(*args_));
669 EXTENSION_FUNCTION_VALIDATE(params.get()); 669 EXTENSION_FUNCTION_VALIDATE(params.get());
670 int tab_id = params->details.tab_id; 670 int tab_id = params->details.tab_id;
671 int frame_id = params->details.frame_id; 671 int frame_id = params->details.frame_id;
672 int process_id = params->details.process_id; 672 int process_id = params->details.process_id;
673 673
674 SetResult(Value::CreateNullValue()); 674 SetResult(Value::CreateNullValue());
675 675
676 content::WebContents* web_contents; 676 content::WebContents* web_contents;
677 if (!ExtensionTabUtil::GetTabById(tab_id, 677 if (!ExtensionTabUtil::GetTabById(tab_id,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 frame_navigation_state.GetErrorOccurredInFrame(internal_frame_id); 713 frame_navigation_state.GetErrorOccurredInFrame(internal_frame_id);
714 FrameNavigationState::FrameID parent_frame_id = 714 FrameNavigationState::FrameID parent_frame_id =
715 frame_navigation_state.GetParentFrameID(internal_frame_id); 715 frame_navigation_state.GetParentFrameID(internal_frame_id);
716 frame_details.parent_frame_id = helpers::GetFrameId( 716 frame_details.parent_frame_id = helpers::GetFrameId(
717 frame_navigation_state.IsMainFrame(parent_frame_id), 717 frame_navigation_state.IsMainFrame(parent_frame_id),
718 parent_frame_id.frame_num); 718 parent_frame_id.frame_num);
719 results_ = GetFrame::Results::Create(frame_details); 719 results_ = GetFrame::Results::Create(frame_details);
720 return true; 720 return true;
721 } 721 }
722 722
723 bool WebNavigationGetAllFramesFunction::RunImpl() { 723 bool GetAllFramesFunction::RunImpl() {
724 scoped_ptr<GetAllFrames::Params> params(GetAllFrames::Params::Create(*args_)); 724 scoped_ptr<GetAllFrames::Params> params(GetAllFrames::Params::Create(*args_));
725 EXTENSION_FUNCTION_VALIDATE(params.get()); 725 EXTENSION_FUNCTION_VALIDATE(params.get());
726 int tab_id = params->details.tab_id; 726 int tab_id = params->details.tab_id;
727 727
728 SetResult(Value::CreateNullValue()); 728 SetResult(Value::CreateNullValue());
729 729
730 content::WebContents* web_contents; 730 content::WebContents* web_contents;
731 if (!ExtensionTabUtil::GetTabById(tab_id, 731 if (!ExtensionTabUtil::GetTabById(tab_id,
732 profile(), 732 profile(),
733 include_incognito(), 733 include_incognito(),
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698