| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/keyboard_codes.h" | 9 #include "app/keyboard_codes.h" |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 Source<Profile>(profile_)); | 150 Source<Profile>(profile_)); |
| 151 } | 151 } |
| 152 | 152 |
| 153 ExtensionHost::~ExtensionHost() { | 153 ExtensionHost::~ExtensionHost() { |
| 154 NotificationService::current()->Notify( | 154 NotificationService::current()->Notify( |
| 155 NotificationType::EXTENSION_HOST_DESTROYED, | 155 NotificationType::EXTENSION_HOST_DESTROYED, |
| 156 Source<Profile>(profile_), | 156 Source<Profile>(profile_), |
| 157 Details<ExtensionHost>(this)); | 157 Details<ExtensionHost>(this)); |
| 158 ProcessCreationQueue::get()->Remove(this); | 158 ProcessCreationQueue::get()->Remove(this); |
| 159 render_view_host_->Shutdown(); // deletes render_view_host | 159 render_view_host_->Shutdown(); // deletes render_view_host |
| 160 | |
| 161 if (recently_deleted()->size() >= 20) | |
| 162 recently_deleted()->pop_front(); | |
| 163 recently_deleted()->push_back(this); | |
| 164 } | |
| 165 | |
| 166 ExtensionHost::HostPointerList* ExtensionHost::recently_deleted() { | |
| 167 return Singleton<HostPointerList>::get(); | |
| 168 } | 160 } |
| 169 | 161 |
| 170 void ExtensionHost::CreateView(Browser* browser) { | 162 void ExtensionHost::CreateView(Browser* browser) { |
| 171 #if defined(TOOLKIT_VIEWS) | 163 #if defined(TOOLKIT_VIEWS) |
| 172 view_.reset(new ExtensionView(this, browser)); | 164 view_.reset(new ExtensionView(this, browser)); |
| 173 // We own |view_|, so don't auto delete when it's removed from the view | 165 // We own |view_|, so don't auto delete when it's removed from the view |
| 174 // hierarchy. | 166 // hierarchy. |
| 175 view_->set_parent_owned(false); | 167 view_->set_parent_owned(false); |
| 176 #elif defined(OS_MACOSX) | 168 #elif defined(OS_MACOSX) |
| 177 view_.reset(new ExtensionViewMac(this, browser)); | 169 view_.reset(new ExtensionViewMac(this, browser)); |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 // Extensions hosted in ExternalTabContainer objects may not have | 768 // Extensions hosted in ExternalTabContainer objects may not have |
| 777 // an associated browser. | 769 // an associated browser. |
| 778 Browser* browser = GetBrowser(); | 770 Browser* browser = GetBrowser(); |
| 779 if (browser) | 771 if (browser) |
| 780 window_id = ExtensionTabUtil::GetWindowId(browser); | 772 window_id = ExtensionTabUtil::GetWindowId(browser); |
| 781 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { | 773 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { |
| 782 NOTREACHED(); | 774 NOTREACHED(); |
| 783 } | 775 } |
| 784 return window_id; | 776 return window_id; |
| 785 } | 777 } |
| OLD | NEW |