| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/extension_host.h" | 5 #include "extensions/browser/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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // ExtensionHost | 112 // ExtensionHost |
| 113 | 113 |
| 114 ExtensionHost::ExtensionHost(const Extension* extension, | 114 ExtensionHost::ExtensionHost(const Extension* extension, |
| 115 SiteInstance* site_instance, | 115 SiteInstance* site_instance, |
| 116 const GURL& url, | 116 const GURL& url, |
| 117 ViewType host_type) | 117 ViewType host_type) |
| 118 : delegate_(ExtensionsBrowserClient::Get()->CreateExtensionHostDelegate()), | 118 : delegate_(ExtensionsBrowserClient::Get()->CreateExtensionHostDelegate()), |
| 119 extension_(extension), | 119 extension_(extension), |
| 120 extension_id_(extension->id()), | 120 extension_id_(extension->id()), |
| 121 browser_context_(site_instance->GetBrowserContext()), | 121 browser_context_(site_instance->GetBrowserContext()), |
| 122 render_view_host_(NULL), | 122 render_view_host_(nullptr), |
| 123 did_stop_loading_(false), | 123 did_stop_loading_(false), |
| 124 document_element_available_(false), | 124 document_element_available_(false), |
| 125 initial_url_(url), | 125 initial_url_(url), |
| 126 extension_function_dispatcher_(browser_context_, this), | 126 extension_function_dispatcher_(browser_context_, this), |
| 127 extension_host_type_(host_type) { | 127 extension_host_type_(host_type) { |
| 128 // Not used for panels, see PanelHost. | 128 // Not used for panels, see PanelHost. |
| 129 DCHECK(host_type == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE || | 129 DCHECK(host_type == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE || |
| 130 host_type == VIEW_TYPE_EXTENSION_DIALOG || | 130 host_type == VIEW_TYPE_EXTENSION_DIALOG || |
| 131 host_type == VIEW_TYPE_EXTENSION_INFOBAR || | 131 host_type == VIEW_TYPE_EXTENSION_INFOBAR || |
| 132 host_type == VIEW_TYPE_EXTENSION_POPUP); | 132 host_type == VIEW_TYPE_EXTENSION_POPUP); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 const content::NotificationSource& source, | 220 const content::NotificationSource& source, |
| 221 const content::NotificationDetails& details) { | 221 const content::NotificationDetails& details) { |
| 222 switch (type) { | 222 switch (type) { |
| 223 case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: | 223 case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: |
| 224 // The extension object will be deleted after this notification has been | 224 // The extension object will be deleted after this notification has been |
| 225 // sent. NULL it out so that dirty pointer issues don't arise in cases | 225 // sent. NULL it out so that dirty pointer issues don't arise in cases |
| 226 // when multiple ExtensionHost objects pointing to the same Extension are | 226 // when multiple ExtensionHost objects pointing to the same Extension are |
| 227 // present. | 227 // present. |
| 228 if (extension_ == content::Details<UnloadedExtensionInfo>(details)-> | 228 if (extension_ == content::Details<UnloadedExtensionInfo>(details)-> |
| 229 extension) { | 229 extension) { |
| 230 extension_ = NULL; | 230 extension_ = nullptr; |
| 231 } | 231 } |
| 232 break; | 232 break; |
| 233 default: | 233 default: |
| 234 NOTREACHED() << "Unexpected notification sent."; | 234 NOTREACHED() << "Unexpected notification sent."; |
| 235 break; | 235 break; |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| 239 void ExtensionHost::RenderProcessGone(base::TerminationStatus status) { | 239 void ExtensionHost::RenderProcessGone(base::TerminationStatus status) { |
| 240 // During browser shutdown, we may use sudden termination on an extension | 240 // During browser shutdown, we may use sudden termination on an extension |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 return delegate_->CheckMediaAccessPermission( | 435 return delegate_->CheckMediaAccessPermission( |
| 436 web_contents, security_origin, type, extension()); | 436 web_contents, security_origin, type, extension()); |
| 437 } | 437 } |
| 438 | 438 |
| 439 bool ExtensionHost::IsNeverVisible(content::WebContents* web_contents) { | 439 bool ExtensionHost::IsNeverVisible(content::WebContents* web_contents) { |
| 440 ViewType view_type = extensions::GetViewType(web_contents); | 440 ViewType view_type = extensions::GetViewType(web_contents); |
| 441 return view_type == extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; | 441 return view_type == extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; |
| 442 } | 442 } |
| 443 | 443 |
| 444 } // namespace extensions | 444 } // namespace extensions |
| OLD | NEW |