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

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

Issue 492014: Extensions: don't send EXTENSION_PROCESS_CRASHED when the extension process i... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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') | no next file » | 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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 extension_host_type_(host_type) { 124 extension_host_type_(host_type) {
125 render_view_host_ = new RenderViewHost(site_instance, this, MSG_ROUTING_NONE); 125 render_view_host_ = new RenderViewHost(site_instance, this, MSG_ROUTING_NONE);
126 render_view_host_->AllowBindings(BindingsPolicy::EXTENSION); 126 render_view_host_->AllowBindings(BindingsPolicy::EXTENSION);
127 if (enable_dom_automation_) 127 if (enable_dom_automation_)
128 render_view_host_->AllowBindings(BindingsPolicy::DOM_AUTOMATION); 128 render_view_host_->AllowBindings(BindingsPolicy::DOM_AUTOMATION);
129 129
130 // Listen for when the render process' handle is available so we can add it 130 // Listen for when the render process' handle is available so we can add it
131 // to the task manager then. 131 // to the task manager then.
132 registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED, 132 registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED,
133 Source<RenderProcessHost>(render_process_host())); 133 Source<RenderProcessHost>(render_process_host()));
134 registrar_.Add(this, NotificationType::RENDERER_PROCESS_CLOSED,
135 Source<RenderProcessHost>(render_process_host()));
134 } 136 }
135 137
136 ExtensionHost::~ExtensionHost() { 138 ExtensionHost::~ExtensionHost() {
137 NotificationService::current()->Notify( 139 NotificationService::current()->Notify(
138 NotificationType::EXTENSION_HOST_DESTROYED, 140 NotificationType::EXTENSION_HOST_DESTROYED,
139 Source<Profile>(profile_), 141 Source<Profile>(profile_),
140 Details<ExtensionHost>(this)); 142 Details<ExtensionHost>(this));
141 ProcessCreationQueue::get()->Remove(this); 143 ProcessCreationQueue::get()->Remove(this);
142 render_view_host_->Shutdown(); // deletes render_view_host 144 render_view_host_->Shutdown(); // deletes render_view_host
143 } 145 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 DCHECK(extension_->GetBackgroundPageReady()); 226 DCHECK(extension_->GetBackgroundPageReady());
225 NavigateToURL(url_); 227 NavigateToURL(url_);
226 } else if (type == NotificationType::BROWSER_THEME_CHANGED) { 228 } else if (type == NotificationType::BROWSER_THEME_CHANGED) {
227 InsertThemeCSS(); 229 InsertThemeCSS();
228 } else if (type == NotificationType::RENDERER_PROCESS_CREATED) { 230 } else if (type == NotificationType::RENDERER_PROCESS_CREATED) {
229 LOG(INFO) << "Sending EXTENSION_PROCESS_CREATED"; 231 LOG(INFO) << "Sending EXTENSION_PROCESS_CREATED";
230 NotificationService::current()->Notify( 232 NotificationService::current()->Notify(
231 NotificationType::EXTENSION_PROCESS_CREATED, 233 NotificationType::EXTENSION_PROCESS_CREATED,
232 Source<Profile>(profile_), 234 Source<Profile>(profile_),
233 Details<ExtensionHost>(this)); 235 Details<ExtensionHost>(this));
236 } else if (type == NotificationType::RENDERER_PROCESS_CLOSED) {
237 Details<RenderProcessHost::RendererClosedDetails> closed_details =
238 static_cast<Details<RenderProcessHost::RendererClosedDetails> >(
239 details);
240 if (!closed_details->did_crash)
241 return;
242
Matt Perry 2009/12/11 01:54:52 nit: add DCHECK(closed_details->was_extension_rend
243 LOG(INFO) << "Sending EXTENSION_PROCESS_CRASHED for " + extension_->name();
244 NotificationService::current()->Notify(
245 NotificationType::EXTENSION_PROCESS_CRASHED,
246 Source<Profile>(profile_),
247 Details<ExtensionHost>(this));
234 } else { 248 } else {
235 NOTREACHED(); 249 NOTREACHED();
236 } 250 }
237 } 251 }
238 252
239 void ExtensionHost::UpdatePreferredSize(const gfx::Size& new_size) { 253 void ExtensionHost::UpdatePreferredSize(const gfx::Size& new_size) {
240 if (view_.get()) 254 if (view_.get())
241 view_->UpdatePreferredSize(new_size); 255 view_->UpdatePreferredSize(new_size);
242 } 256 }
243 257
244 void ExtensionHost::RenderViewGone(RenderViewHost* render_view_host) {
245 LOG(INFO) << "Sending EXTENSION_PROCESS_CRASHED for " + extension_->name();
246 DCHECK_EQ(render_view_host_, render_view_host);
247 NotificationService::current()->Notify(
248 NotificationType::EXTENSION_PROCESS_CRASHED,
249 Source<Profile>(profile_),
250 Details<ExtensionHost>(this));
251 }
252
253 void ExtensionHost::DidNavigate(RenderViewHost* render_view_host, 258 void ExtensionHost::DidNavigate(RenderViewHost* render_view_host,
254 const ViewHostMsg_FrameNavigate_Params& params) { 259 const ViewHostMsg_FrameNavigate_Params& params) {
255 // We only care when the outer frame changes. 260 // We only care when the outer frame changes.
256 switch (params.transition) { 261 switch (params.transition) {
257 case PageTransition::AUTO_SUBFRAME: 262 case PageTransition::AUTO_SUBFRAME:
258 case PageTransition::MANUAL_SUBFRAME: 263 case PageTransition::MANUAL_SUBFRAME:
259 return; 264 return;
260 } 265 }
261 266
262 if (!params.url.SchemeIs(chrome::kExtensionScheme)) { 267 if (!params.url.SchemeIs(chrome::kExtensionScheme)) {
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 // Extensions hosted in ExternalTabContainer objects may not have 623 // Extensions hosted in ExternalTabContainer objects may not have
619 // an associated browser. 624 // an associated browser.
620 Browser* browser = GetBrowser(); 625 Browser* browser = GetBrowser();
621 if (browser) 626 if (browser)
622 window_id = ExtensionTabUtil::GetWindowId(browser); 627 window_id = ExtensionTabUtil::GetWindowId(browser);
623 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { 628 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) {
624 NOTREACHED(); 629 NOTREACHED();
625 } 630 }
626 return window_id; 631 return window_id;
627 } 632 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698