| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "content/public/browser/notification_types.h" | 34 #include "content/public/browser/notification_types.h" |
| 35 #include "content/public/browser/render_process_host.h" | 35 #include "content/public/browser/render_process_host.h" |
| 36 #include "content/public/browser/render_view_host.h" | 36 #include "content/public/browser/render_view_host.h" |
| 37 #include "content/public/browser/render_widget_host_view.h" | 37 #include "content/public/browser/render_widget_host_view.h" |
| 38 #include "content/public/browser/site_instance.h" | 38 #include "content/public/browser/site_instance.h" |
| 39 #include "content/public/browser/web_contents.h" | 39 #include "content/public/browser/web_contents.h" |
| 40 #include "extensions/browser/event_router.h" | 40 #include "extensions/browser/event_router.h" |
| 41 #include "extensions/browser/extension_error.h" | 41 #include "extensions/browser/extension_error.h" |
| 42 #include "extensions/browser/extensions_browser_client.h" | 42 #include "extensions/browser/extensions_browser_client.h" |
| 43 #include "extensions/browser/process_manager.h" | 43 #include "extensions/browser/process_manager.h" |
| 44 #include "extensions/browser/runtime_data.h" |
| 44 #include "extensions/browser/view_type_utils.h" | 45 #include "extensions/browser/view_type_utils.h" |
| 45 #include "extensions/common/extension.h" | 46 #include "extensions/common/extension.h" |
| 46 #include "extensions/common/extension_urls.h" | 47 #include "extensions/common/extension_urls.h" |
| 47 #include "extensions/common/feature_switch.h" | 48 #include "extensions/common/feature_switch.h" |
| 48 #include "extensions/common/manifest_handlers/background_info.h" | 49 #include "extensions/common/manifest_handlers/background_info.h" |
| 49 #include "ui/base/l10n/l10n_util.h" | 50 #include "ui/base/l10n/l10n_util.h" |
| 50 #include "ui/base/window_open_disposition.h" | 51 #include "ui/base/window_open_disposition.h" |
| 51 | 52 |
| 52 using content::BrowserContext; | 53 using content::BrowserContext; |
| 53 using content::OpenURLParams; | 54 using content::OpenURLParams; |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 // If the document has already been marked as available for this host, then | 317 // If the document has already been marked as available for this host, then |
| 317 // bail. No need for the redundant setup. http://crbug.com/31170 | 318 // bail. No need for the redundant setup. http://crbug.com/31170 |
| 318 if (document_element_available_) | 319 if (document_element_available_) |
| 319 return; | 320 return; |
| 320 document_element_available_ = true; | 321 document_element_available_ = true; |
| 321 OnDocumentAvailable(); | 322 OnDocumentAvailable(); |
| 322 } | 323 } |
| 323 | 324 |
| 324 void ExtensionHost::OnDocumentAvailable() { | 325 void ExtensionHost::OnDocumentAvailable() { |
| 325 DCHECK(extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE); | 326 DCHECK(extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE); |
| 326 ExtensionService* service = GetExtensionService(); | 327 ExtensionSystem::GetForBrowserContext(browser_context_) |
| 327 if (service) | 328 ->runtime_data() |
| 328 service->SetBackgroundPageReady(extension_); | 329 ->SetBackgroundPageReady(extension_, true); |
| 329 content::NotificationService::current()->Notify( | 330 content::NotificationService::current()->Notify( |
| 330 chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, | 331 chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, |
| 331 content::Source<const Extension>(extension_), | 332 content::Source<const Extension>(extension_), |
| 332 content::NotificationService::NoDetails()); | 333 content::NotificationService::NoDetails()); |
| 333 } | 334 } |
| 334 | 335 |
| 335 void ExtensionHost::CloseContents(WebContents* contents) { | 336 void ExtensionHost::CloseContents(WebContents* contents) { |
| 336 Close(); | 337 Close(); |
| 337 } | 338 } |
| 338 | 339 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 | 471 |
| 471 void ExtensionHost::RequestMediaAccessPermission( | 472 void ExtensionHost::RequestMediaAccessPermission( |
| 472 content::WebContents* web_contents, | 473 content::WebContents* web_contents, |
| 473 const content::MediaStreamRequest& request, | 474 const content::MediaStreamRequest& request, |
| 474 const content::MediaResponseCallback& callback) { | 475 const content::MediaResponseCallback& callback) { |
| 475 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest( | 476 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest( |
| 476 web_contents, request, callback, extension()); | 477 web_contents, request, callback, extension()); |
| 477 } | 478 } |
| 478 | 479 |
| 479 } // namespace extensions | 480 } // namespace extensions |
| OLD | NEW |