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

Side by Side Diff: chrome/common/extensions/extension_permission_set.cc

Issue 10310028: Making webRequest.addEventListener internal (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implicit internal permissions for webRequest Created 8 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/extensions/extension_permission_set.h" 5 #include "chrome/common/extensions/extension_permission_set.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 info->RegisterPermission( 315 info->RegisterPermission(
316 kInputMethodPrivate, "inputMethodPrivate", 0, 316 kInputMethodPrivate, "inputMethodPrivate", 0,
317 ExtensionPermissionMessage::kNone, kFlagCannotBeOptional); 317 ExtensionPermissionMessage::kNone, kFlagCannotBeOptional);
318 info->RegisterPermission( 318 info->RegisterPermission(
319 kEchoPrivate, "echoPrivate", 0, ExtensionPermissionMessage::kNone, 319 kEchoPrivate, "echoPrivate", 0, ExtensionPermissionMessage::kNone,
320 kFlagCannotBeOptional); 320 kFlagCannotBeOptional);
321 info->RegisterPermission( 321 info->RegisterPermission(
322 kTerminalPrivate, "terminalPrivate", 0, ExtensionPermissionMessage::kNone, 322 kTerminalPrivate, "terminalPrivate", 0, ExtensionPermissionMessage::kNone,
323 kFlagCannotBeOptional); 323 kFlagCannotBeOptional);
324 info->RegisterPermission( 324 info->RegisterPermission(
325 kWebRequestInternal, "webRequestInternal", 0,
326 ExtensionPermissionMessage::kNone, kFlagCannotBeOptional);
327 info->RegisterPermission(
325 kWebSocketProxyPrivate, "webSocketProxyPrivate", 0, 328 kWebSocketProxyPrivate, "webSocketProxyPrivate", 0,
326 ExtensionPermissionMessage::kNone, 329 ExtensionPermissionMessage::kNone,
327 kFlagCannotBeOptional); 330 kFlagCannotBeOptional);
328 info->RegisterPermission( 331 info->RegisterPermission(
329 kWebstorePrivate, "webstorePrivate", 0, 332 kWebstorePrivate, "webstorePrivate", 0,
330 ExtensionPermissionMessage::kNone, 333 ExtensionPermissionMessage::kNone,
331 kFlagCannotBeOptional); 334 kFlagCannotBeOptional);
332 335
333 // Full url access permissions. 336 // Full url access permissions.
334 info->RegisterPermission( 337 info->RegisterPermission(
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 871
869 void ExtensionPermissionSet::InitImplicitExtensionPermissions( 872 void ExtensionPermissionSet::InitImplicitExtensionPermissions(
870 const Extension* extension) { 873 const Extension* extension) {
871 // Add the implied permissions. 874 // Add the implied permissions.
872 if (!extension->plugins().empty()) 875 if (!extension->plugins().empty())
873 apis_.insert(ExtensionAPIPermission::kPlugin); 876 apis_.insert(ExtensionAPIPermission::kPlugin);
874 877
875 if (!extension->devtools_url().is_empty()) 878 if (!extension->devtools_url().is_empty())
876 apis_.insert(ExtensionAPIPermission::kDevtools); 879 apis_.insert(ExtensionAPIPermission::kDevtools);
877 880
881 // The webRequest permission implies the internal version as well.
882 if (apis_.find(ExtensionAPIPermission::kWebRequest) != apis_.end())
vabr (Chromium) 2012/05/14 18:10:35 Is this too ad-hoc?
battre 2012/05/15 09:23:38 I think this is fine, but somebody from the extens
vabr (Chromium) 2012/05/15 11:57:52 OK, I'll wait until further reviewers are roped in
Matt Perry 2012/05/16 23:47:00 Wait, this is a good point. Why do we need this at
battre 2012/05/17 08:56:19 It is added to kNonPermissionModuleNames[] in exte
Matt Perry 2012/05/17 18:44:45 It's best if we only load webRequestInternal for e
vabr (Chromium) 2012/05/17 21:23:37 Yes, I believe that this code does "add webRequest
883 apis_.insert(ExtensionAPIPermission::kWebRequestInternal);
884
878 // Add the scriptable hosts. 885 // Add the scriptable hosts.
879 for (UserScriptList::const_iterator content_script = 886 for (UserScriptList::const_iterator content_script =
880 extension->content_scripts().begin(); 887 extension->content_scripts().begin();
881 content_script != extension->content_scripts().end(); ++content_script) { 888 content_script != extension->content_scripts().end(); ++content_script) {
882 URLPatternSet::const_iterator pattern = 889 URLPatternSet::const_iterator pattern =
883 content_script->url_patterns().begin(); 890 content_script->url_patterns().begin();
884 for (; pattern != content_script->url_patterns().end(); ++pattern) 891 for (; pattern != content_script->url_patterns().end(); ++pattern)
885 scriptable_hosts_.AddPattern(*pattern); 892 scriptable_hosts_.AddPattern(*pattern);
886 } 893 }
887 } 894 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 ExtensionOAuth2Scopes current_scopes = scopes(); 969 ExtensionOAuth2Scopes current_scopes = scopes();
963 ExtensionOAuth2Scopes new_scopes = permissions->scopes(); 970 ExtensionOAuth2Scopes new_scopes = permissions->scopes();
964 ExtensionOAuth2Scopes delta_scopes; 971 ExtensionOAuth2Scopes delta_scopes;
965 std::set_difference(new_scopes.begin(), new_scopes.end(), 972 std::set_difference(new_scopes.begin(), new_scopes.end(),
966 current_scopes.begin(), current_scopes.end(), 973 current_scopes.begin(), current_scopes.end(),
967 std::inserter(delta_scopes, delta_scopes.begin())); 974 std::inserter(delta_scopes, delta_scopes.begin()));
968 975
969 // We have less privileges if there are additional scopes present. 976 // We have less privileges if there are additional scopes present.
970 return !delta_scopes.empty(); 977 return !delta_scopes.empty();
971 } 978 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698