| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 155 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| 156 content::Source<Profile>(profile_)); | 156 content::Source<Profile>(profile_)); |
| 157 } | 157 } |
| 158 | 158 |
| 159 ExtensionHost::~ExtensionHost() { | 159 ExtensionHost::~ExtensionHost() { |
| 160 if (extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE && | 160 if (extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE && |
| 161 extension_ && BackgroundInfo::HasLazyBackgroundPage(extension_)) { | 161 extension_ && BackgroundInfo::HasLazyBackgroundPage(extension_)) { |
| 162 UMA_HISTOGRAM_LONG_TIMES("Extensions.EventPageActiveTime", | 162 UMA_HISTOGRAM_LONG_TIMES("Extensions.EventPageActiveTime", |
| 163 since_created_.Elapsed()); | 163 since_created_.Elapsed()); |
| 164 } | 164 } |
| 165 // Clear the extension's renderer process out from any WebContents | |
| 166 // that might have it in their back history. | |
| 167 // TODO(jyasskin): Remove this hack by making extension reloading | |
| 168 // wait for renderer shutdown. | |
| 169 content::NotificationService::current()->Notify( | |
| 170 content::NOTIFICATION_RENDERER_PROCESS_CLOSING, | |
| 171 content::Source<content::RenderProcessHost>(render_process_host()), | |
| 172 content::NotificationService::NoDetails()); | |
| 173 | |
| 174 content::NotificationService::current()->Notify( | 165 content::NotificationService::current()->Notify( |
| 175 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 166 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
| 176 content::Source<Profile>(profile_), | 167 content::Source<Profile>(profile_), |
| 177 content::Details<ExtensionHost>(this)); | 168 content::Details<ExtensionHost>(this)); |
| 178 ProcessCreationQueue::GetInstance()->Remove(this); | 169 ProcessCreationQueue::GetInstance()->Remove(this); |
| 179 } | 170 } |
| 180 | 171 |
| 181 void ExtensionHost::CreateView(Browser* browser) { | 172 void ExtensionHost::CreateView(Browser* browser) { |
| 182 #if defined(TOOLKIT_VIEWS) | 173 #if defined(TOOLKIT_VIEWS) |
| 183 view_.reset(new ExtensionViewViews(this, browser)); | 174 view_.reset(new ExtensionViewViews(this, browser)); |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 | 617 |
| 627 void ExtensionHost::RequestMediaAccessPermission( | 618 void ExtensionHost::RequestMediaAccessPermission( |
| 628 content::WebContents* web_contents, | 619 content::WebContents* web_contents, |
| 629 const content::MediaStreamRequest& request, | 620 const content::MediaStreamRequest& request, |
| 630 const content::MediaResponseCallback& callback) { | 621 const content::MediaResponseCallback& callback) { |
| 631 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest( | 622 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest( |
| 632 web_contents, request, callback, extension()); | 623 web_contents, request, callback, extension()); |
| 633 } | 624 } |
| 634 | 625 |
| 635 } // namespace extensions | 626 } // namespace extensions |
| OLD | NEW |