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

Unified Diff: chrome/browser/extensions/extension_host.cc

Issue 10119003: Pull shell window stuff out of ExtensionHost and put in ShellWindow (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_host.cc
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index a685cd411c610095496a947669c997371f1d0b87..867b5c78961544079a881abce6589154f494bee3 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -159,28 +159,6 @@ ExtensionHost::~ExtensionHost() {
ProcessCreationQueue::GetInstance()->Remove(this);
}
-void ExtensionHost::CreateView(Browser* browser) {
-#if defined(TOOLKIT_VIEWS)
- view_.reset(new ExtensionView(this, browser));
- // We own |view_|, so don't auto delete when it's removed from the view
- // hierarchy.
- view_->set_parent_owned(false);
-#elif defined(OS_MACOSX)
- view_.reset(new ExtensionViewMac(this, browser));
- view_->Init();
-#elif defined(TOOLKIT_GTK)
- view_.reset(new ExtensionViewGtk(this, browser));
- view_->Init();
-#else
- // TODO(port)
- NOTREACHED();
-#endif
-}
-
-void ExtensionHost::CreateViewWithoutBrowser() {
- CreateView(NULL);
-}
-
WebContents* ExtensionHost::GetAssociatedWebContents() const {
return associated_web_contents_;
}
@@ -194,6 +172,9 @@ void ExtensionHost::SetAssociatedWebContents(
}
}
+content::WebContents* ExtensionHost::host_contents() const {
+ return host_contents_.get();
+}
content::RenderProcessHost* ExtensionHost::render_process_host() const {
return render_view_host()->GetProcess();
@@ -235,6 +216,10 @@ Browser* ExtensionHost::GetBrowser() {
return view() ? view()->browser() : NULL;
}
+content::ViewType ExtensionHost::extension_host_type() const {
+ return extension_host_type_;
+}
+
const GURL& ExtensionHost::GetURL() const {
return host_contents()->GetURL();
}
@@ -293,8 +278,8 @@ void ExtensionHost::Observe(int type,
void ExtensionHost::ResizeDueToAutoResize(WebContents* source,
const gfx::Size& new_size) {
- if (view_.get())
- view_->ResizeDueToAutoResize(new_size);
+ if (view())
+ view()->ResizeDueToAutoResize(new_size);
}
void ExtensionHost::RenderViewGone(base::TerminationStatus status) {
@@ -338,11 +323,10 @@ void ExtensionHost::DidStopLoading() {
if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP ||
extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG ||
extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR ||
- extension_host_type_ == chrome::VIEW_TYPE_APP_SHELL ||
extension_host_type_ == chrome::VIEW_TYPE_PANEL) {
#if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX)
- if (view_.get())
- view_->DidStopLoading();
+ if (view())
+ view()->DidStopLoading();
#endif
}
if (notify) {
@@ -358,8 +342,6 @@ void ExtensionHost::DidStopLoading() {
} else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) {
UMA_HISTOGRAM_TIMES("Extensions.InfobarLoadTime",
since_created_.Elapsed());
- } else if (extension_host_type_ == chrome::VIEW_TYPE_APP_SHELL) {
- UMA_HISTOGRAM_TIMES("Extensions.ShellLoadTime", since_created_.Elapsed());
} else if (extension_host_type_ == chrome::VIEW_TYPE_PANEL) {
UMA_HISTOGRAM_TIMES("Extensions.PanelLoadTime", since_created_.Elapsed());
}
@@ -406,16 +388,11 @@ void ExtensionHost::CloseContents(WebContents* contents) {
extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG ||
extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE ||
extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR ||
- extension_host_type_ == chrome::VIEW_TYPE_APP_SHELL ||
extension_host_type_ == chrome::VIEW_TYPE_PANEL) {
Close();
}
}
-bool ExtensionHost::ShouldSuppressDialogs() {
- return extension_->is_platform_app();
-}
-
void ExtensionHost::WillRunJavaScriptDialog() {
ExtensionProcessManager* pm =
ExtensionSystem::Get(profile_)->process_manager();
@@ -489,8 +466,8 @@ void ExtensionHost::OnRequest(const ExtensionHostMsg_Request_Params& params) {
void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) {
render_view_host_ = render_view_host;
- if (view_.get())
- view_->RenderViewCreated();
+ if (view())
+ view()->RenderViewCreated();
// If the host is bound to a browser, then extract its window id.
// Extensions hosted in ExternalTabContainer objects may not have

Powered by Google App Engine
This is Rietveld 408576698