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

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

Issue 8890086: Issue 71980: Extensions code should use UTF-16 for user-visible Unicode strings (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years 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
« no previous file with comments | « chrome/common/chrome_utility_messages.h ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 374
375 // Adds an extension to the scripting whitelist. Used for testing only. 375 // Adds an extension to the scripting whitelist. Used for testing only.
376 static void SetScriptingWhitelist(const ScriptingWhitelist& whitelist); 376 static void SetScriptingWhitelist(const ScriptingWhitelist& whitelist);
377 static const ScriptingWhitelist* GetScriptingWhitelist(); 377 static const ScriptingWhitelist* GetScriptingWhitelist();
378 378
379 // Parses the host and api permissions from the specified permission |key| 379 // Parses the host and api permissions from the specified permission |key|
380 // in the manifest |source|. 380 // in the manifest |source|.
381 bool ParsePermissions(const extensions::Manifest* source, 381 bool ParsePermissions(const extensions::Manifest* source,
382 const char* key, 382 const char* key,
383 int flags, 383 int flags,
384 std::string* error, 384 string16* error,
385 ExtensionAPIPermissionSet* api_permissions, 385 ExtensionAPIPermissionSet* api_permissions,
386 URLPatternSet* host_permissions); 386 URLPatternSet* host_permissions);
387 387
388 bool HasAPIPermission(ExtensionAPIPermission::ID permission) const; 388 bool HasAPIPermission(ExtensionAPIPermission::ID permission) const;
389 bool HasAPIPermission(const std::string& function_name) const; 389 bool HasAPIPermission(const std::string& function_name) const;
390 390
391 const URLPatternSet& GetEffectiveHostPermissions() const; 391 const URLPatternSet& GetEffectiveHostPermissions() const;
392 392
393 // Returns true if the extension can silently increase its permission level. 393 // Returns true if the extension can silently increase its permission level.
394 // Extensions that can silently increase permissions are installed through 394 // Extensions that can silently increase permissions are installed through
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 615
616 // Returns true if this extension id is from a trusted provider. 616 // Returns true if this extension id is from a trusted provider.
617 static bool IsTrustedId(const std::string& id); 617 static bool IsTrustedId(const std::string& id);
618 618
619 Extension(const FilePath& path, Location location); 619 Extension(const FilePath& path, Location location);
620 ~Extension(); 620 ~Extension();
621 621
622 // Initialize the extension from a parsed manifest. 622 // Initialize the extension from a parsed manifest.
623 // Takes ownership of the manifest |value|. 623 // Takes ownership of the manifest |value|.
624 bool InitFromValue(extensions::Manifest* value, int flags, 624 bool InitFromValue(extensions::Manifest* value, int flags,
625 std::string* error); 625 string16* error);
626 626
627 // Helper function for implementing HasCachedImage/GetCachedImage. A return 627 // Helper function for implementing HasCachedImage/GetCachedImage. A return
628 // value of NULL means there is no matching image cached (we allow caching an 628 // value of NULL means there is no matching image cached (we allow caching an
629 // empty SkBitmap). 629 // empty SkBitmap).
630 SkBitmap* GetCachedImageImpl(const ExtensionResource& source, 630 SkBitmap* GetCachedImageImpl(const ExtensionResource& source,
631 const gfx::Size& max_size) const; 631 const gfx::Size& max_size) const;
632 632
633 // Helper method that loads a UserScript object from a 633 // Helper method that loads a UserScript object from a
634 // dictionary in the content_script list of the manifest. 634 // dictionary in the content_script list of the manifest.
635 bool LoadUserScriptHelper(const base::DictionaryValue* content_script, 635 bool LoadUserScriptHelper(const base::DictionaryValue* content_script,
636 int definition_index, 636 int definition_index,
637 int flags, 637 int flags,
638 std::string* error, 638 string16* error,
639 UserScript* result); 639 UserScript* result);
640 640
641 // Helper method that loads either the include_globs or exclude_globs list 641 // Helper method that loads either the include_globs or exclude_globs list
642 // from an entry in the content_script lists of the manifest. 642 // from an entry in the content_script lists of the manifest.
643 bool LoadGlobsHelper(const base::DictionaryValue* content_script, 643 bool LoadGlobsHelper(const base::DictionaryValue* content_script,
644 int content_script_index, 644 int content_script_index,
645 const char* globs_property_name, 645 const char* globs_property_name,
646 std::string* error, 646 string16* error,
647 void(UserScript::*add_method)(const std::string& glob), 647 void(UserScript::*add_method)(const std::string& glob),
648 UserScript *instance); 648 UserScript *instance);
649 649
650 // Helpers to load various chunks of the manifest. 650 // Helpers to load various chunks of the manifest.
651 bool LoadExtent(const extensions::Manifest* manifest, 651 bool LoadExtent(const extensions::Manifest* manifest,
652 const char* key, 652 const char* key,
653 URLPatternSet* extent, 653 URLPatternSet* extent,
654 const char* list_error, 654 const char* list_error,
655 const char* value_error, 655 const char* value_error,
656 URLPattern::ParseOption parse_option, 656 URLPattern::ParseOption parse_option,
657 std::string* error); 657 string16* error);
658 bool LoadLaunchContainer(const extensions::Manifest* manifest, 658 bool LoadLaunchContainer(const extensions::Manifest* manifest,
659 std::string* error); 659 string16* error);
660 bool LoadLaunchURL(const extensions::Manifest* manifest, 660 bool LoadLaunchURL(const extensions::Manifest* manifest,
661 std::string* error); 661 string16* error);
662 bool LoadAppIsolation(const extensions::Manifest* manifest, 662 bool LoadAppIsolation(const extensions::Manifest* manifest,
663 std::string* error); 663 string16* error);
664 bool LoadWebIntentServices(const extensions::Manifest* manifest, 664 bool LoadWebIntentServices(const extensions::Manifest* manifest,
665 std::string* error); 665 string16* error);
666 666
667 // Helper method to load an ExtensionAction from the page_action or 667 // Helper method to load an ExtensionAction from the page_action or
668 // browser_action entries in the manifest. 668 // browser_action entries in the manifest.
669 ExtensionAction* LoadExtensionActionHelper( 669 ExtensionAction* LoadExtensionActionHelper(
670 const base::DictionaryValue* extension_action, std::string* error); 670 const base::DictionaryValue* extension_action, string16* error);
671 671
672 // Helper method to load an FileBrowserHandlerList from the manifest. 672 // Helper method to load an FileBrowserHandlerList from the manifest.
673 FileBrowserHandlerList* LoadFileBrowserHandlers( 673 FileBrowserHandlerList* LoadFileBrowserHandlers(
674 const base::ListValue* extension_actions, std::string* error); 674 const base::ListValue* extension_actions, string16* error);
675 // Helper method to load an FileBrowserHandler from manifest. 675 // Helper method to load an FileBrowserHandler from manifest.
676 FileBrowserHandler* LoadFileBrowserHandler( 676 FileBrowserHandler* LoadFileBrowserHandler(
677 const base::DictionaryValue* file_browser_handlers, std::string* error); 677 const base::DictionaryValue* file_browser_handlers, string16* error);
678 678
679 // Helper method to load an ExtensionSidebarDefaults from the sidebar manifest 679 // Helper method to load an ExtensionSidebarDefaults from the sidebar manifest
680 // entry. 680 // entry.
681 ExtensionSidebarDefaults* LoadExtensionSidebarDefaults( 681 ExtensionSidebarDefaults* LoadExtensionSidebarDefaults(
682 const base::DictionaryValue* sidebar, std::string* error); 682 const base::DictionaryValue* sidebar, string16* error);
683 683
684 // Returns true if the extension has more than one "UI surface". For example, 684 // Returns true if the extension has more than one "UI surface". For example,
685 // an extension that has a browser action and a page action. 685 // an extension that has a browser action and a page action.
686 bool HasMultipleUISurfaces() const; 686 bool HasMultipleUISurfaces() const;
687 687
688 // Updates the launch URL and extents for the extension using the given 688 // Updates the launch URL and extents for the extension using the given
689 // |override_url|. 689 // |override_url|.
690 void OverrideLaunchUrl(const GURL& override_url); 690 void OverrideLaunchUrl(const GURL& override_url);
691 691
692 // Returns true if this extension can specify |api|. 692 // Returns true if this extension can specify |api|.
693 bool CanSpecifyAPIPermission(const ExtensionAPIPermission* api, 693 bool CanSpecifyAPIPermission(const ExtensionAPIPermission* api,
694 std::string* error) const; 694 string16* error) const;
695 bool CanSpecifyComponentOnlyPermission() const; 695 bool CanSpecifyComponentOnlyPermission() const;
696 bool CanSpecifyExperimentalPermission() const; 696 bool CanSpecifyExperimentalPermission() const;
697 697
698 // Checks whether the host |pattern| is allowed for this extension, given API 698 // Checks whether the host |pattern| is allowed for this extension, given API
699 // permissions |permissions|. 699 // permissions |permissions|.
700 bool CanSpecifyHostPermission(const URLPattern& pattern, 700 bool CanSpecifyHostPermission(const URLPattern& pattern,
701 const ExtensionAPIPermissionSet& permissions) const; 701 const ExtensionAPIPermissionSet& permissions) const;
702 702
703 // Cached images for this extension. This should only be touched on the UI 703 // Cached images for this extension. This should only be touched on the UI
704 // thread. 704 // thread.
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 // only contain the removed permissions. 935 // only contain the removed permissions.
936 const ExtensionPermissionSet* permissions; 936 const ExtensionPermissionSet* permissions;
937 937
938 UpdatedExtensionPermissionsInfo( 938 UpdatedExtensionPermissionsInfo(
939 const Extension* extension, 939 const Extension* extension,
940 const ExtensionPermissionSet* permissions, 940 const ExtensionPermissionSet* permissions,
941 Reason reason); 941 Reason reason);
942 }; 942 };
943 943
944 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 944 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW
« no previous file with comments | « chrome/common/chrome_utility_messages.h ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698