OLD | NEW |
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 #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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 156 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
157 content::Source<Profile>(profile_)); | 157 content::Source<Profile>(profile_)); |
158 } | 158 } |
159 | 159 |
160 ExtensionHost::~ExtensionHost() { | 160 ExtensionHost::~ExtensionHost() { |
161 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE && | 161 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE && |
162 extension_ && BackgroundInfo::HasLazyBackgroundPage(extension_)) { | 162 extension_ && BackgroundInfo::HasLazyBackgroundPage(extension_)) { |
163 UMA_HISTOGRAM_LONG_TIMES("Extensions.EventPageActiveTime", | 163 UMA_HISTOGRAM_LONG_TIMES("Extensions.EventPageActiveTime", |
164 since_created_.Elapsed()); | 164 since_created_.Elapsed()); |
165 } | 165 } |
| 166 // Clear the extension's renderer process out from any WebContents |
| 167 // that might have it in their back history. |
| 168 // TODO(jyasskin): Remove this hack by making extension reloading |
| 169 // wait for renderer shutdown. |
| 170 content::NotificationService::current()->Notify( |
| 171 content::NOTIFICATION_RENDERER_PROCESS_CLOSING, |
| 172 content::Source<content::RenderProcessHost>(render_process_host()), |
| 173 content::NotificationService::NoDetails()); |
| 174 |
166 content::NotificationService::current()->Notify( | 175 content::NotificationService::current()->Notify( |
167 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 176 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
168 content::Source<Profile>(profile_), | 177 content::Source<Profile>(profile_), |
169 content::Details<ExtensionHost>(this)); | 178 content::Details<ExtensionHost>(this)); |
170 ProcessCreationQueue::GetInstance()->Remove(this); | 179 ProcessCreationQueue::GetInstance()->Remove(this); |
171 } | 180 } |
172 | 181 |
173 void ExtensionHost::CreateView(Browser* browser) { | 182 void ExtensionHost::CreateView(Browser* browser) { |
174 #if defined(TOOLKIT_VIEWS) | 183 #if defined(TOOLKIT_VIEWS) |
175 view_.reset(new ExtensionViewViews(this, browser)); | 184 view_.reset(new ExtensionViewViews(this, browser)); |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 content::IsAudioMediaType(request.audio_type), | 633 content::IsAudioMediaType(request.audio_type), |
625 content::IsVideoMediaType(request.video_type), | 634 content::IsVideoMediaType(request.video_type), |
626 &devices); | 635 &devices); |
627 | 636 |
628 // For tab capture device, we require the tabCapture permission. | 637 // For tab capture device, we require the tabCapture permission. |
629 RequestMediaAccessPermissionHelper::AuthorizeRequest( | 638 RequestMediaAccessPermissionHelper::AuthorizeRequest( |
630 devices, request, callback, extension(), false); | 639 devices, request, callback, extension(), false); |
631 } | 640 } |
632 | 641 |
633 } // namespace extensions | 642 } // namespace extensions |
OLD | NEW |