Chromium Code Reviews| 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 "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h" | 5 #include "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/sha1.h" | 8 #include "base/sha1.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 ChromeExtensionsDispatcherDelegate::CreateScriptContext( | 62 ChromeExtensionsDispatcherDelegate::CreateScriptContext( |
| 63 const v8::Handle<v8::Context>& v8_context, | 63 const v8::Handle<v8::Context>& v8_context, |
| 64 blink::WebFrame* frame, | 64 blink::WebFrame* frame, |
| 65 const extensions::Extension* extension, | 65 const extensions::Extension* extension, |
| 66 extensions::Feature::Context context_type) { | 66 extensions::Feature::Context context_type) { |
| 67 return scoped_ptr<extensions::ScriptContext>(new extensions::ChromeV8Context( | 67 return scoped_ptr<extensions::ScriptContext>(new extensions::ChromeV8Context( |
| 68 v8_context, frame, extension, context_type)); | 68 v8_context, frame, extension, context_type)); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void ChromeExtensionsDispatcherDelegate::InitOriginPermissions( | 71 void ChromeExtensionsDispatcherDelegate::InitOriginPermissions( |
| 72 const extensions::Extension* extension, | 72 const extensions::Extension* extension) { |
| 73 extensions::Feature::Context context_type) { | |
| 74 // TODO(jstritar): We should try to remove this special case. Also, these | 73 // TODO(jstritar): We should try to remove this special case. Also, these |
| 75 // whitelist entries need to be updated when the kManagement permission | 74 // whitelist entries need to be updated when the kManagement permission |
| 76 // changes. | 75 // changes. |
| 77 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT && | 76 if (extension->HasAPIPermission(extensions::APIPermission::kManagement)) { |
|
not at google - send to devlin
2014/06/06 18:55:19
I'm not confident that removing the context check
| |
| 78 extension->HasAPIPermission(extensions::APIPermission::kManagement)) { | |
| 79 blink::WebSecurityPolicy::addOriginAccessWhitelistEntry( | 77 blink::WebSecurityPolicy::addOriginAccessWhitelistEntry( |
| 80 extension->url(), | 78 extension->url(), |
| 81 blink::WebString::fromUTF8(content::kChromeUIScheme), | 79 blink::WebString::fromUTF8(content::kChromeUIScheme), |
| 82 blink::WebString::fromUTF8(chrome::kChromeUIExtensionIconHost), | 80 blink::WebString::fromUTF8(chrome::kChromeUIExtensionIconHost), |
| 83 false); | 81 false); |
| 84 } | 82 } |
| 85 } | 83 } |
| 86 | 84 |
| 87 void ChromeExtensionsDispatcherDelegate::RegisterNativeHandlers( | 85 void ChromeExtensionsDispatcherDelegate::RegisterNativeHandlers( |
| 88 extensions::Dispatcher* dispatcher, | 86 extensions::Dispatcher* dispatcher, |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 } | 368 } |
| 371 | 369 |
| 372 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage( | 370 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage( |
| 373 bool adblock, | 371 bool adblock, |
| 374 bool adblock_plus, | 372 bool adblock_plus, |
| 375 bool other) { | 373 bool other) { |
| 376 webrequest_adblock_ = adblock; | 374 webrequest_adblock_ = adblock; |
| 377 webrequest_adblock_plus_ = adblock_plus; | 375 webrequest_adblock_plus_ = adblock_plus; |
| 378 webrequest_other_ = other; | 376 webrequest_other_ = other; |
| 379 } | 377 } |
| OLD | NEW |