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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) { | 73 bool is_extension_active) { |
74 // TODO(jstritar): We should try to remove this special case. Also, these | 74 // TODO(jstritar): We should try to remove this special case. Also, these |
75 // whitelist entries need to be updated when the kManagement permission | 75 // whitelist entries need to be updated when the kManagement permission |
76 // changes. | 76 // changes. |
77 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT && | 77 if (is_extension_active && |
78 extension->permissions_data()->HasAPIPermission( | 78 extension->permissions_data()->HasAPIPermission( |
79 extensions::APIPermission::kManagement)) { | 79 extensions::APIPermission::kManagement)) { |
80 blink::WebSecurityPolicy::addOriginAccessWhitelistEntry( | 80 blink::WebSecurityPolicy::addOriginAccessWhitelistEntry( |
81 extension->url(), | 81 extension->url(), |
82 blink::WebString::fromUTF8(content::kChromeUIScheme), | 82 blink::WebString::fromUTF8(content::kChromeUIScheme), |
83 blink::WebString::fromUTF8(chrome::kChromeUIExtensionIconHost), | 83 blink::WebString::fromUTF8(chrome::kChromeUIExtensionIconHost), |
84 false); | 84 false); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 } | 371 } |
372 | 372 |
373 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage( | 373 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage( |
374 bool adblock, | 374 bool adblock, |
375 bool adblock_plus, | 375 bool adblock_plus, |
376 bool other) { | 376 bool other) { |
377 webrequest_adblock_ = adblock; | 377 webrequest_adblock_ = adblock; |
378 webrequest_adblock_plus_ = adblock_plus; | 378 webrequest_adblock_plus_ = adblock_plus; |
379 webrequest_other_ = other; | 379 webrequest_other_ = other; |
380 } | 380 } |
OLD | NEW |