Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <tuple> | 7 #include <tuple> |
| 8 | 8 |
| 9 #include "content/public/browser/child_process_security_policy.h" | 9 #include "content/public/browser/child_process_security_policy.h" |
| 10 #include "extensions/browser/extension_registry.h" | 10 #include "extensions/browser/extension_registry.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 ++iter) { | 109 ++iter) { |
| 110 if (iter->process_id == process_id) | 110 if (iter->process_id == process_id) |
| 111 result.insert(iter->extension_id); | 111 result.insert(iter->extension_id); |
| 112 } | 112 } |
| 113 return result; | 113 return result; |
| 114 } | 114 } |
| 115 | 115 |
| 116 Feature::Context ProcessMap::GetMostLikelyContextType( | 116 Feature::Context ProcessMap::GetMostLikelyContextType( |
| 117 const Extension* extension, | 117 const Extension* extension, |
| 118 int process_id) const { | 118 int process_id) const { |
| 119 // WARNING: This logic must match Dispatcher::ClassifyJavaScriptContext, as | 119 // WARNING: This logic must match ScriptContextSet::ClassifyJavaScriptContext, |
| 120 // much as possible. | 120 // as much as possible. |
| 121 | 121 |
| 122 if (content::ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings( | 122 if (content::ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings( |
| 123 process_id)) { | 123 process_id)) { |
| 124 return Feature::WEBUI_CONTEXT; | 124 return Feature::WEBUI_CONTEXT; |
| 125 } | 125 } |
| 126 | 126 |
| 127 if (!extension) { | 127 if (!extension) { |
| 128 return Feature::WEB_PAGE_CONTEXT; | 128 return Feature::WEB_PAGE_CONTEXT; |
| 129 } | 129 } |
| 130 | 130 |
| 131 if (!Contains(extension->id(), process_id)) { | 131 if (!Contains(extension->id(), process_id)) { |
| 132 // This could equally be UNBLESSED_EXTENSION_CONTEXT, but we don't record | 132 // This could equally be UNBLESSED_EXTENSION_CONTEXT, but we don't record |
| 133 // which processes have extension frames in them. | 133 // which processes have extension frames in them. |
| 134 // TODO(kalman): Investigate this. | 134 // TODO(kalman): Investigate this. |
| 135 return Feature::CONTENT_SCRIPT_CONTEXT; | 135 return Feature::CONTENT_SCRIPT_CONTEXT; |
| 136 } | 136 } |
| 137 | 137 |
| 138 if (extension->is_hosted_app() && | 138 if (extension->is_hosted_app() && |
| 139 extension->location() != Manifest::COMPONENT) { | 139 extension->location() != Manifest::COMPONENT) { |
| 140 return Feature::BLESSED_WEB_PAGE_CONTEXT; | 140 return Feature::BLESSED_WEB_PAGE_CONTEXT; |
| 141 } | 141 } |
| 142 | 142 |
| 143 return Feature::BLESSED_EXTENSION_CONTEXT; | 143 return is_lock_screen_context_ ? Feature::LOCK_SCREEN_EXTENSION_CONTEXT |
|
Devlin
2017/06/03 02:19:14
If we expect no other lock-screen-type contexts, m
tbarzic
2017/06/05 19:35:40
At the moment, we could have web-page like context
| |
| 144 : Feature::BLESSED_EXTENSION_CONTEXT; | |
| 144 } | 145 } |
| 145 | 146 |
| 146 } // namespace extensions | 147 } // namespace extensions |
| OLD | NEW |