OLD | NEW |
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/renderer/dispatcher.h" | 5 #include "extensions/renderer/dispatcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 } | 1164 } |
1165 } | 1165 } |
1166 return false; | 1166 return false; |
1167 } | 1167 } |
1168 | 1168 |
1169 Feature::Context Dispatcher::ClassifyJavaScriptContext( | 1169 Feature::Context Dispatcher::ClassifyJavaScriptContext( |
1170 const Extension* extension, | 1170 const Extension* extension, |
1171 int extension_group, | 1171 int extension_group, |
1172 const GURL& url, | 1172 const GURL& url, |
1173 const blink::WebSecurityOrigin& origin) { | 1173 const blink::WebSecurityOrigin& origin) { |
| 1174 // WARNING: This logic must match ProcessMap::GuessContextType, as much as |
| 1175 // possible. |
| 1176 |
1174 DCHECK_GE(extension_group, 0); | 1177 DCHECK_GE(extension_group, 0); |
1175 if (extension_group == EXTENSION_GROUP_CONTENT_SCRIPTS) { | 1178 if (extension_group == EXTENSION_GROUP_CONTENT_SCRIPTS) { |
1176 return extension ? // TODO(kalman): when does this happen? | 1179 return extension ? // TODO(kalman): when does this happen? |
1177 Feature::CONTENT_SCRIPT_CONTEXT | 1180 Feature::CONTENT_SCRIPT_CONTEXT |
1178 : Feature::UNSPECIFIED_CONTEXT; | 1181 : Feature::UNSPECIFIED_CONTEXT; |
1179 } | 1182 } |
1180 | 1183 |
1181 // We have an explicit check for sandboxed pages before checking whether the | 1184 // We have an explicit check for sandboxed pages before checking whether the |
1182 // extension is active in this process because: | 1185 // extension is active in this process because: |
1183 // 1. Sandboxed pages run in the same process as regular extension pages, so | 1186 // 1. Sandboxed pages run in the same process as regular extension pages, so |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 return v8::Handle<v8::Object>(); | 1288 return v8::Handle<v8::Object>(); |
1286 | 1289 |
1287 if (bind_name) | 1290 if (bind_name) |
1288 *bind_name = split.back(); | 1291 *bind_name = split.back(); |
1289 | 1292 |
1290 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) | 1293 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) |
1291 : bind_object; | 1294 : bind_object; |
1292 } | 1295 } |
1293 | 1296 |
1294 } // namespace extensions | 1297 } // namespace extensions |
OLD | NEW |