Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc

Issue 2166523003: Add ref count to service workers for extension API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments from Devlin & MichaelN Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/extensions/chrome_content_browser_client_extensions_par t.h" 5 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par t.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 11 matching lines...) Expand all
22 #include "chrome/common/chrome_constants.h" 22 #include "chrome/common/chrome_constants.h"
23 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/extensions/extension_process_policy.h" 24 #include "chrome/common/extensions/extension_process_policy.h"
25 #include "components/guest_view/browser/guest_view_message_filter.h" 25 #include "components/guest_view/browser/guest_view_message_filter.h"
26 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
27 #include "content/public/browser/browser_url_handler.h" 27 #include "content/public/browser/browser_url_handler.h"
28 #include "content/public/browser/render_process_host.h" 28 #include "content/public/browser/render_process_host.h"
29 #include "content/public/browser/render_view_host.h" 29 #include "content/public/browser/render_view_host.h"
30 #include "content/public/browser/resource_dispatcher_host.h" 30 #include "content/public/browser/resource_dispatcher_host.h"
31 #include "content/public/browser/site_instance.h" 31 #include "content/public/browser/site_instance.h"
32 #include "content/public/browser/storage_partition.h"
32 #include "content/public/browser/vpn_service_proxy.h" 33 #include "content/public/browser/vpn_service_proxy.h"
33 #include "content/public/browser/web_contents.h" 34 #include "content/public/browser/web_contents.h"
34 #include "content/public/common/content_switches.h" 35 #include "content/public/common/content_switches.h"
35 #include "extensions/browser/api/web_request/web_request_api.h" 36 #include "extensions/browser/api/web_request/web_request_api.h"
36 #include "extensions/browser/api/web_request/web_request_api_helpers.h" 37 #include "extensions/browser/api/web_request/web_request_api_helpers.h"
37 #include "extensions/browser/bad_message.h" 38 #include "extensions/browser/bad_message.h"
38 #include "extensions/browser/extension_host.h" 39 #include "extensions/browser/extension_host.h"
39 #include "extensions/browser/extension_message_filter.h" 40 #include "extensions/browser/extension_message_filter.h"
40 #include "extensions/browser/extension_registry.h" 41 #include "extensions/browser/extension_registry.h"
41 #include "extensions/browser/extension_service_worker_message_filter.h" 42 #include "extensions/browser/extension_service_worker_message_filter.h"
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 content::RenderProcessHost* host) { 547 content::RenderProcessHost* host) {
547 int id = host->GetID(); 548 int id = host->GetID();
548 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); 549 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
549 550
550 host->AddFilter(new ChromeExtensionMessageFilter(id, profile)); 551 host->AddFilter(new ChromeExtensionMessageFilter(id, profile));
551 host->AddFilter(new ExtensionMessageFilter(id, profile)); 552 host->AddFilter(new ExtensionMessageFilter(id, profile));
552 host->AddFilter(new IOThreadExtensionMessageFilter(id, profile)); 553 host->AddFilter(new IOThreadExtensionMessageFilter(id, profile));
553 host->AddFilter(new ExtensionsGuestViewMessageFilter(id, profile)); 554 host->AddFilter(new ExtensionsGuestViewMessageFilter(id, profile));
554 if (extensions::ExtensionsClient::Get() 555 if (extensions::ExtensionsClient::Get()
555 ->ExtensionAPIEnabledInExtensionServiceWorkers()) { 556 ->ExtensionAPIEnabledInExtensionServiceWorkers()) {
556 host->AddFilter(new ExtensionServiceWorkerMessageFilter(id, profile)); 557 host->AddFilter(new ExtensionServiceWorkerMessageFilter(
558 id, profile, host->GetStoragePartition()->GetServiceWorkerContext()));
557 } 559 }
558 extension_web_request_api_helpers::SendExtensionWebRequestStatusToHost(host); 560 extension_web_request_api_helpers::SendExtensionWebRequestStatusToHost(host);
559 } 561 }
560 562
561 void ChromeContentBrowserClientExtensionsPart::SiteInstanceGotProcess( 563 void ChromeContentBrowserClientExtensionsPart::SiteInstanceGotProcess(
562 SiteInstance* site_instance) { 564 SiteInstance* site_instance) {
563 BrowserContext* context = site_instance->GetProcess()->GetBrowserContext(); 565 BrowserContext* context = site_instance->GetProcess()->GetBrowserContext();
564 ExtensionRegistry* registry = ExtensionRegistry::Get(context); 566 ExtensionRegistry* registry = ExtensionRegistry::Get(context);
565 if (!registry) 567 if (!registry)
566 return; 568 return;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 } 687 }
686 } 688 }
687 } 689 }
688 690
689 void ChromeContentBrowserClientExtensionsPart::ResourceDispatcherHostCreated() { 691 void ChromeContentBrowserClientExtensionsPart::ResourceDispatcherHostCreated() {
690 content::ResourceDispatcherHost::Get()->RegisterInterceptor( 692 content::ResourceDispatcherHost::Get()->RegisterInterceptor(
691 "Origin", kExtensionScheme, base::Bind(&OnHttpHeaderReceived)); 693 "Origin", kExtensionScheme, base::Bind(&OnHttpHeaderReceived));
692 } 694 }
693 695
694 } // namespace extensions 696 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698