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

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

Issue 7347011: Update URLPatternSet to contain a std::set instead of std::vector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows compile errors. Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_ 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 kHostsAll, 44 kHostsAll,
45 kFullAccess, 45 kFullAccess,
46 kClipboard, 46 kClipboard,
47 kEnumBoundary 47 kEnumBoundary
48 }; 48 };
49 49
50 // Creates the corresponding permission message for a list of hosts. This is 50 // Creates the corresponding permission message for a list of hosts. This is
51 // simply a convenience method around the constructor, since the messages 51 // simply a convenience method around the constructor, since the messages
52 // change depending on what hosts are present. 52 // change depending on what hosts are present.
53 static ExtensionPermissionMessage CreateFromHostList( 53 static ExtensionPermissionMessage CreateFromHostList(
54 const std::vector<std::string>& hosts); 54 const std::set<std::string>& hosts);
55 55
56 // Creates the corresponding permission message. 56 // Creates the corresponding permission message.
57 ExtensionPermissionMessage(ID id, const string16& message); 57 ExtensionPermissionMessage(ID id, const string16& message);
58 ~ExtensionPermissionMessage(); 58 ~ExtensionPermissionMessage();
59 59
60 // Gets the id of the permission message, which can be used in UMA 60 // Gets the id of the permission message, which can be used in UMA
61 // histograms. 61 // histograms.
62 ID id() const { return id_; } 62 ID id() const { return id_; }
63 63
64 // Gets a localized message describing this permission. Please note that 64 // Gets a localized message describing this permission. Please note that
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 // Passes ownership of the new set to the caller. 285 // Passes ownership of the new set to the caller.
286 static ExtensionPermissionSet* CreateUnion( 286 static ExtensionPermissionSet* CreateUnion(
287 const ExtensionPermissionSet* set1, const ExtensionPermissionSet* set2); 287 const ExtensionPermissionSet* set1, const ExtensionPermissionSet* set2);
288 288
289 // Gets the API permissions in this set as a set of strings. 289 // Gets the API permissions in this set as a set of strings.
290 std::set<std::string> GetAPIsAsStrings() const; 290 std::set<std::string> GetAPIsAsStrings() const;
291 291
292 // Gets a list of the distinct hosts for displaying to the user. 292 // Gets a list of the distinct hosts for displaying to the user.
293 // NOTE: do not use this for comparing permissions, since this disgards some 293 // NOTE: do not use this for comparing permissions, since this disgards some
294 // information. 294 // information.
295 std::vector<std::string> GetDistinctHostsForDisplay() const; 295 std::set<std::string> GetDistinctHostsForDisplay() const;
296 296
297 // Gets the localized permission messages that represent this set. 297 // Gets the localized permission messages that represent this set.
298 ExtensionPermissionMessages GetPermissionMessages() const; 298 ExtensionPermissionMessages GetPermissionMessages() const;
299 299
300 // Gets the localized permission messages that represent this set (represented 300 // Gets the localized permission messages that represent this set (represented
301 // as strings). 301 // as strings).
302 std::vector<string16> GetWarningMessages() const; 302 std::vector<string16> GetWarningMessages() const;
303 303
304 // Returns true if this is an empty set (e.g., the default permission set). 304 // Returns true if this is an empty set (e.g., the default permission set).
305 bool IsEmpty() const; 305 bool IsEmpty() const;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 const URLPatternSet& effective_hosts() const { return effective_hosts_; } 341 const URLPatternSet& effective_hosts() const { return effective_hosts_; }
342 342
343 const URLPatternSet& explicit_hosts() const { return explicit_hosts_; } 343 const URLPatternSet& explicit_hosts() const { return explicit_hosts_; }
344 344
345 const URLPatternSet& scriptable_hosts() const { return scriptable_hosts_; } 345 const URLPatternSet& scriptable_hosts() const { return scriptable_hosts_; }
346 346
347 private: 347 private:
348 FRIEND_TEST_ALL_PREFIXES(ExtensionPermissionSetTest, 348 FRIEND_TEST_ALL_PREFIXES(ExtensionPermissionSetTest,
349 HasLessHostPrivilegesThan); 349 HasLessHostPrivilegesThan);
350 350
351 static std::vector<std::string> GetDistinctHosts( 351 static std::set<std::string> GetDistinctHosts(
352 const URLPatternList& host_patterns, bool include_rcd); 352 const URLPatternSet& host_patterns, bool include_rcd);
353 353
354 // Initializes the set based on |extension|'s manifest data. 354 // Initializes the set based on |extension|'s manifest data.
355 void InitImplicitExtensionPermissions(const Extension* extension); 355 void InitImplicitExtensionPermissions(const Extension* extension);
356 356
357 // Initializes the effective host permission based on the data in this set. 357 // Initializes the effective host permission based on the data in this set.
358 void InitEffectiveHosts(); 358 void InitEffectiveHosts();
359 359
360 // Gets the permission messages for the API permissions. 360 // Gets the permission messages for the API permissions.
361 std::set<ExtensionPermissionMessage> GetSimplePermissionMessages() const; 361 std::set<ExtensionPermissionMessage> GetSimplePermissionMessages() const;
362 362
(...skipping 15 matching lines...) Expand all
378 URLPatternSet explicit_hosts_; 378 URLPatternSet explicit_hosts_;
379 379
380 // The list of hosts that can be scripted by content scripts. 380 // The list of hosts that can be scripted by content scripts.
381 URLPatternSet scriptable_hosts_; 381 URLPatternSet scriptable_hosts_;
382 382
383 // The list of hosts this effectively grants access to. 383 // The list of hosts this effectively grants access to.
384 URLPatternSet effective_hosts_; 384 URLPatternSet effective_hosts_;
385 }; 385 };
386 386
387 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_ 387 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_messages.cc ('k') | chrome/common/extensions/extension_permission_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698