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

Side by Side Diff: extensions/browser/extension_web_contents_observer.cc

Issue 890083002: [Extensions] Propagate activeTab hosts to extension background pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 "extensions/browser/extension_web_contents_observer.h" 5 #include "extensions/browser/extension_web_contents_observer.h"
6 6
7 #include "content/public/browser/child_process_security_policy.h" 7 #include "content/public/browser/child_process_security_policy.h"
8 #include "content/public/browser/render_process_host.h" 8 #include "content/public/browser/render_process_host.h"
9 #include "content/public/browser/render_view_host.h" 9 #include "content/public/browser/render_view_host.h"
10 #include "content/public/browser/site_instance.h" 10 #include "content/public/browser/site_instance.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 switch (type) { 68 switch (type) {
69 case Manifest::TYPE_EXTENSION: 69 case Manifest::TYPE_EXTENSION:
70 case Manifest::TYPE_USER_SCRIPT: 70 case Manifest::TYPE_USER_SCRIPT:
71 case Manifest::TYPE_HOSTED_APP: 71 case Manifest::TYPE_HOSTED_APP:
72 case Manifest::TYPE_LEGACY_PACKAGED_APP: 72 case Manifest::TYPE_LEGACY_PACKAGED_APP:
73 case Manifest::TYPE_PLATFORM_APP: 73 case Manifest::TYPE_PLATFORM_APP:
74 // Always send a Loaded message before ActivateExtension so that 74 // Always send a Loaded message before ActivateExtension so that
75 // ExtensionDispatcher knows what Extension is active, not just its ID. 75 // ExtensionDispatcher knows what Extension is active, not just its ID.
76 // This is important for classifying the Extension's JavaScript context 76 // This is important for classifying the Extension's JavaScript context
77 // correctly (see ExtensionDispatcher::ClassifyJavaScriptContext). 77 // correctly (see ExtensionDispatcher::ClassifyJavaScriptContext).
78 // We also have to include the tab-specific permissions here, since it's
79 // an extension process.
78 render_view_host->Send( 80 render_view_host->Send(
79 new ExtensionMsg_Loaded(std::vector<ExtensionMsg_Loaded_Params>( 81 new ExtensionMsg_Loaded(std::vector<ExtensionMsg_Loaded_Params>(
80 1, ExtensionMsg_Loaded_Params(extension)))); 82 1, ExtensionMsg_Loaded_Params(
83 extension, true /* include tab permissions */))));
81 render_view_host->Send( 84 render_view_host->Send(
82 new ExtensionMsg_ActivateExtension(extension->id())); 85 new ExtensionMsg_ActivateExtension(extension->id()));
83 break; 86 break;
84 87
85 case Manifest::TYPE_UNKNOWN: 88 case Manifest::TYPE_UNKNOWN:
86 case Manifest::TYPE_THEME: 89 case Manifest::TYPE_THEME:
87 case Manifest::TYPE_SHARED_MODULE: 90 case Manifest::TYPE_SHARED_MODULE:
88 break; 91 break;
89 92
90 case Manifest::NUM_LOAD_TYPES: 93 case Manifest::NUM_LOAD_TYPES:
(...skipping 29 matching lines...) Expand all
120 // site, so we can ignore that wrinkle here. 123 // site, so we can ignore that wrinkle here.
121 const GURL& site = render_view_host->GetSiteInstance()->GetSiteURL(); 124 const GURL& site = render_view_host->GetSiteInstance()->GetSiteURL();
122 125
123 if (!site.SchemeIs(kExtensionScheme)) 126 if (!site.SchemeIs(kExtensionScheme))
124 return std::string(); 127 return std::string();
125 128
126 return site.host(); 129 return site.host();
127 } 130 }
128 131
129 } // namespace extensions 132 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/active_tab/manifest.json ('k') | extensions/browser/process_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698