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

Side by Side Diff: chrome/browser/renderer_host/chrome_render_view_host_observer.cc

Issue 8496024: Don't close crashed tabs from extensions with background pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix info map Created 9 years, 1 month 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) 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/renderer_host/chrome_render_view_host_observer.h" 5 #include "chrome/browser/renderer_host/chrome_render_view_host_observer.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/dom_operation_notification_details.h" 8 #include "chrome/browser/dom_operation_notification_details.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/net/predictor.h" 10 #include "chrome/browser/net/predictor.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 SiteInstance* site_instance = render_view_host()->site_instance(); 132 SiteInstance* site_instance = render_view_host()->site_instance();
133 const GURL& site = site_instance->site(); 133 const GURL& site = site_instance->site();
134 134
135 if (!site.SchemeIs(chrome::kExtensionScheme)) 135 if (!site.SchemeIs(chrome::kExtensionScheme))
136 return NULL; 136 return NULL;
137 137
138 ExtensionService* service = profile_->GetExtensionService(); 138 ExtensionService* service = profile_->GetExtensionService();
139 if (!service) 139 if (!service)
140 return NULL; 140 return NULL;
141 141
142 // May be null if somebody typos a chrome-extension:// URL. 142 // Reload the extension if it extension has crashed.
Matt Perry 2011/11/10 22:07:59 it = the
Yoyo Zhou 2011/11/10 23:26:30 Fixed.
143 if (service->GetTerminatedExtension(site.host()))
144 service->ReloadExtension(site.host());
Matt Perry 2011/11/10 22:18:13 Wait, this won't work for unpacked extensions, rig
Yoyo Zhou 2011/11/10 23:26:30 Surprisingly, it does seem to work (although I'm s
Matt Perry 2011/11/10 23:28:21 We shouldn't block the UI thread on reload for thi
145
146 // May be null if the extension doesn't exist, for example if somebody typos
147 // a chrome-extension:// URL.
143 return service->GetExtensionByURL(site); 148 return service->GetExtensionByURL(site);
144 } 149 }
145 150
146 void ChromeRenderViewHostObserver::RemoveRenderViewHostForExtensions( 151 void ChromeRenderViewHostObserver::RemoveRenderViewHostForExtensions(
147 RenderViewHost* rvh) { 152 RenderViewHost* rvh) {
148 ExtensionProcessManager* process_manager = 153 ExtensionProcessManager* process_manager =
149 profile_->GetExtensionProcessManager(); 154 profile_->GetExtensionProcessManager();
150 if (process_manager) 155 if (process_manager)
151 process_manager->UnregisterRenderViewHost(rvh); 156 process_manager->UnregisterRenderViewHost(rvh);
152 } 157 }
153 158
154 void ChromeRenderViewHostObserver::OnDomOperationResponse( 159 void ChromeRenderViewHostObserver::OnDomOperationResponse(
155 const std::string& json_string, int automation_id) { 160 const std::string& json_string, int automation_id) {
156 DomOperationNotificationDetails details(json_string, automation_id); 161 DomOperationNotificationDetails details(json_string, automation_id);
157 content::NotificationService::current()->Notify( 162 content::NotificationService::current()->Notify(
158 chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, 163 chrome::NOTIFICATION_DOM_OPERATION_RESPONSE,
159 content::Source<RenderViewHost>(render_view_host()), 164 content::Source<RenderViewHost>(render_view_host()),
160 content::Details<DomOperationNotificationDetails>(&details)); 165 content::Details<DomOperationNotificationDetails>(&details));
161 } 166 }
162 167
163 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() { 168 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() {
164 content::NotificationService::current()->Notify( 169 content::NotificationService::current()->Notify(
165 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED, 170 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED,
166 content::Source<RenderViewHost>(render_view_host()), 171 content::Source<RenderViewHost>(render_view_host()),
167 content::NotificationService::NoDetails()); 172 content::NotificationService::NoDetails());
168 } 173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698