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

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

Issue 426593007: Refactor guest view availability to be API not permission based. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MostLikelyContextType Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « extensions/browser/process_map.h ('k') | extensions/renderer/dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/process_map.h" 5 #include "extensions/browser/process_map.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 "extensions/browser/extension_registry.h" 8 #include "extensions/browser/extension_registry.h"
9 #include "extensions/browser/process_map_factory.h" 9 #include "extensions/browser/process_map_factory.h"
10 #include "extensions/common/extension.h" 10 #include "extensions/common/extension.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 std::set<std::string> ProcessMap::GetExtensionsInProcess(int process_id) const { 116 std::set<std::string> ProcessMap::GetExtensionsInProcess(int process_id) const {
117 std::set<std::string> result; 117 std::set<std::string> result;
118 for (ItemSet::const_iterator iter = items_.begin(); iter != items_.end(); 118 for (ItemSet::const_iterator iter = items_.begin(); iter != items_.end();
119 ++iter) { 119 ++iter) {
120 if (iter->process_id == process_id) 120 if (iter->process_id == process_id)
121 result.insert(iter->extension_id); 121 result.insert(iter->extension_id);
122 } 122 }
123 return result; 123 return result;
124 } 124 }
125 125
126 Feature::Context ProcessMap::GuessContextType(const Extension* extension, 126 Feature::Context ProcessMap::GetMostLikelyContextType(
127 int process_id) const { 127 const Extension* extension,
128 int process_id) const {
128 // WARNING: This logic must match Dispatcher::ClassifyJavaScriptContext, as 129 // WARNING: This logic must match Dispatcher::ClassifyJavaScriptContext, as
129 // much as possible. 130 // much as possible.
130 131
131 if (content::ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings( 132 if (content::ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings(
132 process_id)) { 133 process_id)) {
133 return Feature::WEBUI_CONTEXT; 134 return Feature::WEBUI_CONTEXT;
134 } 135 }
135 136
136 if (!extension) { 137 if (!extension) {
137 return Feature::WEB_PAGE_CONTEXT; 138 return Feature::WEB_PAGE_CONTEXT;
138 } 139 }
139 140
140 if (!Contains(extension->id(), process_id)) { 141 if (!Contains(extension->id(), process_id)) {
141 // This could equally be UNBLESSED_EXTENSION_CONTEXT, but we don't record 142 // This could equally be UNBLESSED_EXTENSION_CONTEXT, but we don't record
142 // which processes have extension frames in them. 143 // which processes have extension frames in them.
143 // TODO(kalman): Investigate this. 144 // TODO(kalman): Investigate this.
144 return Feature::CONTENT_SCRIPT_CONTEXT; 145 return Feature::CONTENT_SCRIPT_CONTEXT;
145 } 146 }
146 147
147 if (extension->is_hosted_app() && 148 if (extension->is_hosted_app() &&
148 extension->location() != Manifest::COMPONENT) { 149 extension->location() != Manifest::COMPONENT) {
149 return Feature::BLESSED_WEB_PAGE_CONTEXT; 150 return Feature::BLESSED_WEB_PAGE_CONTEXT;
150 } 151 }
151 152
152 return Feature::BLESSED_EXTENSION_CONTEXT; 153 return Feature::BLESSED_EXTENSION_CONTEXT;
153 } 154 }
154 155
155 } // namespace extensions 156 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/process_map.h ('k') | extensions/renderer/dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698