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

Side by Side Diff: chrome/browser/extensions/extension_host.cc

Issue 6374009: Get rid of a few more interfaces from RenderViewHostDelegate that aren't need... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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
« no previous file with comments | « chrome/browser/extensions/extension_host.h ('k') | chrome/browser/fav_icon_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/extensions/extension_host.h" 5 #include "chrome/browser/extensions/extension_host.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/singleton.h" 10 #include "base/singleton.h"
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 void ExtensionHost::HandleMouseUp() { 750 void ExtensionHost::HandleMouseUp() {
751 } 751 }
752 752
753 void ExtensionHost::HandleMouseActivate() { 753 void ExtensionHost::HandleMouseActivate() {
754 } 754 }
755 755
756 ViewType::Type ExtensionHost::GetRenderViewType() const { 756 ViewType::Type ExtensionHost::GetRenderViewType() const {
757 return extension_host_type_; 757 return extension_host_type_;
758 } 758 }
759 759
760 bool ExtensionHost::OnMessageReceived(const IPC::Message& message) {
761 bool handled = true;
762 IPC_BEGIN_MESSAGE_MAP(ExtensionHost, message)
763 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser)
764 IPC_MESSAGE_UNHANDLED(handled = false)
765 IPC_END_MESSAGE_MAP()
766 return handled;
767 }
768
760 const GURL& ExtensionHost::GetURL() const { 769 const GURL& ExtensionHost::GetURL() const {
761 return url_; 770 return url_;
762 } 771 }
763 772
764 void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) { 773 void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) {
765 if (view_.get()) 774 if (view_.get())
766 view_->RenderViewCreated(); 775 view_->RenderViewCreated();
767 776
768 // TODO(mpcomplete): This is duplicated in DidNavigate, which means that 777 // TODO(mpcomplete): This is duplicated in DidNavigate, which means that
769 // we'll create 2 EFDs for the first navigation. We should try to find a 778 // we'll create 2 EFDs for the first navigation. We should try to find a
770 // better way to unify them. 779 // better way to unify them.
771 // See http://code.google.com/p/chromium/issues/detail?id=18240 780 // See http://code.google.com/p/chromium/issues/detail?id=18240
772 extension_function_dispatcher_.reset( 781 extension_function_dispatcher_.reset(
773 ExtensionFunctionDispatcher::Create(render_view_host, this, url_)); 782 ExtensionFunctionDispatcher::Create(render_view_host, this, url_));
774 783
775 if (extension_host_type_ == ViewType::EXTENSION_POPUP || 784 if (extension_host_type_ == ViewType::EXTENSION_POPUP ||
776 extension_host_type_ == ViewType::EXTENSION_INFOBAR) { 785 extension_host_type_ == ViewType::EXTENSION_INFOBAR) {
777 render_view_host->EnablePreferredSizeChangedMode( 786 render_view_host->EnablePreferredSizeChangedMode(
778 kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow); 787 kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow);
779 } 788 }
780 } 789 }
781 790
782 RenderViewHostDelegate::FileSelect* ExtensionHost::GetFileSelectDelegate() {
783 if (file_select_helper_.get() == NULL)
784 file_select_helper_.reset(new FileSelectHelper(profile()));
785 return file_select_helper_.get();
786 }
787
788 int ExtensionHost::GetBrowserWindowID() const { 791 int ExtensionHost::GetBrowserWindowID() const {
789 // Hosts not attached to any browser window have an id of -1. This includes 792 // Hosts not attached to any browser window have an id of -1. This includes
790 // those mentioned below, and background pages. 793 // those mentioned below, and background pages.
791 int window_id = extension_misc::kUnknownWindowId; 794 int window_id = extension_misc::kUnknownWindowId;
792 if (extension_host_type_ == ViewType::EXTENSION_POPUP || 795 if (extension_host_type_ == ViewType::EXTENSION_POPUP ||
793 extension_host_type_ == ViewType::EXTENSION_INFOBAR) { 796 extension_host_type_ == ViewType::EXTENSION_INFOBAR) {
794 // If the host is bound to a browser, then extract its window id. 797 // If the host is bound to a browser, then extract its window id.
795 // Extensions hosted in ExternalTabContainer objects may not have 798 // Extensions hosted in ExternalTabContainer objects may not have
796 // an associated browser. 799 // an associated browser.
797 const Browser* browser = GetBrowser(); 800 const Browser* browser = GetBrowser();
798 if (browser) 801 if (browser)
799 window_id = ExtensionTabUtil::GetWindowId(browser); 802 window_id = ExtensionTabUtil::GetWindowId(browser);
800 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { 803 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) {
801 NOTREACHED(); 804 NOTREACHED();
802 } 805 }
803 return window_id; 806 return window_id;
804 } 807 }
808
809 void ExtensionHost::OnRunFileChooser(
810 const ViewHostMsg_RunFileChooser_Params& params) {
811 if (file_select_helper_.get() == NULL)
812 file_select_helper_.reset(new FileSelectHelper(profile()));
813 file_select_helper_->RunFileChooser(render_view_host_, params);
814 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_host.h ('k') | chrome/browser/fav_icon_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698