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

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

Issue 444133003: Try run for https://codereview.chromium.org/426593007. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: app view fix 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/common/api/_api_features.json » ('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"
8 #include "extensions/browser/extension_registry.h"
7 #include "extensions/browser/process_map_factory.h" 9 #include "extensions/browser/process_map_factory.h"
10 #include "extensions/common/extension.h"
11 #include "extensions/common/features/feature.h"
8 12
9 namespace extensions { 13 namespace extensions {
10 14
11 // Item 15 // Item
12 struct ProcessMap::Item { 16 struct ProcessMap::Item {
13 Item() : process_id(0), site_instance_id(0) { 17 Item() : process_id(0), site_instance_id(0) {
14 } 18 }
15 19
16 // Purposely implicit constructor needed on older gcc's. See: 20 // Purposely implicit constructor needed on older gcc's. See:
17 // http://codereview.chromium.org/8769022/ 21 // http://codereview.chromium.org/8769022/
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 std::set<std::string> ProcessMap::GetExtensionsInProcess(int process_id) const { 116 std::set<std::string> ProcessMap::GetExtensionsInProcess(int process_id) const {
113 std::set<std::string> result; 117 std::set<std::string> result;
114 for (ItemSet::const_iterator iter = items_.begin(); iter != items_.end(); 118 for (ItemSet::const_iterator iter = items_.begin(); iter != items_.end();
115 ++iter) { 119 ++iter) {
116 if (iter->process_id == process_id) 120 if (iter->process_id == process_id)
117 result.insert(iter->extension_id); 121 result.insert(iter->extension_id);
118 } 122 }
119 return result; 123 return result;
120 } 124 }
121 125
126 Feature::Context ProcessMap::GuessContextType(const Extension* extension,
127 int process_id) const {
128 // WARNING: This logic must match Dispatcher::ClassifyJavaScriptContext, as
129 // much as possible.
130
131 if (content::ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings(
132 process_id)) {
133 return Feature::WEBUI_CONTEXT;
134 }
135
136 if (!extension) {
137 return Feature::WEB_PAGE_CONTEXT;
138 }
139
140 if (!Contains(extension->id(), process_id)) {
141 // This could equally be UNBLESSED_EXTENSION_CONTEXT, but we don't record
142 // which processes have extension frames in them.
143 // TODO(kalman): Investigate this.
144 return Feature::CONTENT_SCRIPT_CONTEXT;
145 }
146
147 if (extension->is_hosted_app() &&
148 extension->location() != Manifest::COMPONENT) {
149 return Feature::BLESSED_WEB_PAGE_CONTEXT;
150 }
151
152 return Feature::BLESSED_EXTENSION_CONTEXT;
153 }
154
122 } // namespace extensions 155 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/process_map.h ('k') | extensions/common/api/_api_features.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698