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

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

Issue 12315071: Revert 184352 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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.h" 5 #include "chrome/common/extensions/extension.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 ExtensionResource Extension::GetResource( 380 ExtensionResource Extension::GetResource(
381 const std::string& relative_path) const { 381 const std::string& relative_path) const {
382 std::string new_path = relative_path; 382 std::string new_path = relative_path;
383 // We have some legacy data where resources have leading slashes. 383 // We have some legacy data where resources have leading slashes.
384 // See: http://crbug.com/121164 384 // See: http://crbug.com/121164
385 if (!new_path.empty() && new_path.at(0) == '/') 385 if (!new_path.empty() && new_path.at(0) == '/')
386 new_path.erase(0, 1); 386 new_path.erase(0, 1);
387 #if defined(OS_POSIX) 387 #if defined(OS_POSIX)
388 base::FilePath relative_file_path(new_path); 388 base::FilePath relative_file_path(new_path);
389 #elif defined(OS_WIN) 389 #elif defined(OS_WIN)
390 base::FilePath relative_file_path(base::UTF8ToWide(new_path)); 390 base::FilePath relative_file_path(UTF8ToWide(new_path));
391 #endif 391 #endif
392 ExtensionResource r(id(), path(), relative_file_path); 392 ExtensionResource r(id(), path(), relative_file_path);
393 if ((creation_flags() & Extension::FOLLOW_SYMLINKS_ANYWHERE)) { 393 if ((creation_flags() & Extension::FOLLOW_SYMLINKS_ANYWHERE)) {
394 r.set_follow_symlinks_anywhere(); 394 r.set_follow_symlinks_anywhere();
395 } 395 }
396 return r; 396 return r;
397 } 397 }
398 398
399 ExtensionResource Extension::GetResource( 399 ExtensionResource Extension::GetResource(
400 const base::FilePath& relative_file_path) const { 400 const base::FilePath& relative_file_path) const {
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 bool Extension::ShowConfigureContextMenus() const { 783 bool Extension::ShowConfigureContextMenus() const {
784 // Don't show context menu for component extensions. We might want to show 784 // Don't show context menu for component extensions. We might want to show
785 // options for component extension button but now there is no component 785 // options for component extension button but now there is no component
786 // extension with options. All other menu items like uninstall have 786 // extension with options. All other menu items like uninstall have
787 // no sense for component extensions. 787 // no sense for component extensions.
788 return location() != Manifest::COMPONENT; 788 return location() != Manifest::COMPONENT;
789 } 789 }
790 790
791 std::set<base::FilePath> Extension::GetBrowserImages() const { 791 std::set<base::FilePath> Extension::GetBrowserImages() const {
792 std::set<base::FilePath> image_paths; 792 std::set<base::FilePath> image_paths;
793 // TODO(viettrungluu): These |FilePath::FromWStringHack(base::UTF8ToWide())| 793 // TODO(viettrungluu): These |FilePath::FromWStringHack(UTF8ToWide())|
794 // indicate that we're doing something wrong. 794 // indicate that we're doing something wrong.
795 795
796 // Extension icons. 796 // Extension icons.
797 for (ExtensionIconSet::IconMap::const_iterator iter = icons().map().begin(); 797 for (ExtensionIconSet::IconMap::const_iterator iter = icons().map().begin();
798 iter != icons().map().end(); ++iter) { 798 iter != icons().map().end(); ++iter) {
799 image_paths.insert( 799 image_paths.insert(
800 base::FilePath::FromWStringHack(base::UTF8ToWide(iter->second))); 800 base::FilePath::FromWStringHack(UTF8ToWide(iter->second)));
801 } 801 }
802 802
803 // Theme images. 803 // Theme images.
804 DictionaryValue* theme_images = ThemeInfo::GetThemeImages(this); 804 DictionaryValue* theme_images = ThemeInfo::GetThemeImages(this);
805 if (theme_images) { 805 if (theme_images) {
806 for (DictionaryValue::Iterator it(*theme_images); !it.IsAtEnd(); 806 for (DictionaryValue::Iterator it(*theme_images); !it.IsAtEnd();
807 it.Advance()) { 807 it.Advance()) {
808 std::string val; 808 std::string val;
809 if (it.value().GetAsString(&val)) { 809 if (it.value().GetAsString(&val))
810 image_paths.insert(base::FilePath::FromWStringHack( 810 image_paths.insert(base::FilePath::FromWStringHack(UTF8ToWide(val)));
811 base::UTF8ToWide(val)));
812 }
813 } 811 }
814 } 812 }
815 813
816 const ActionInfo* page_action_info = ActionInfo::GetPageActionInfo(this); 814 const ActionInfo* page_action_info = ActionInfo::GetPageActionInfo(this);
817 if (page_action_info && !page_action_info->default_icon.empty()) { 815 if (page_action_info && !page_action_info->default_icon.empty()) {
818 for (ExtensionIconSet::IconMap::const_iterator iter = 816 for (ExtensionIconSet::IconMap::const_iterator iter =
819 page_action_info->default_icon.map().begin(); 817 page_action_info->default_icon.map().begin();
820 iter != page_action_info->default_icon.map().end(); 818 iter != page_action_info->default_icon.map().end();
821 ++iter) { 819 ++iter) {
822 image_paths.insert( 820 image_paths.insert(
823 base::FilePath::FromWStringHack(base::UTF8ToWide(iter->second))); 821 base::FilePath::FromWStringHack(UTF8ToWide(iter->second)));
824 } 822 }
825 } 823 }
826 824
827 const ActionInfo* browser_action = ActionInfo::GetBrowserActionInfo(this); 825 const ActionInfo* browser_action = ActionInfo::GetBrowserActionInfo(this);
828 if (browser_action && !browser_action->default_icon.empty()) { 826 if (browser_action && !browser_action->default_icon.empty()) {
829 for (ExtensionIconSet::IconMap::const_iterator iter = 827 for (ExtensionIconSet::IconMap::const_iterator iter =
830 browser_action->default_icon.map().begin(); 828 browser_action->default_icon.map().begin();
831 iter != browser_action->default_icon.map().end(); 829 iter != browser_action->default_icon.map().end();
832 ++iter) { 830 ++iter) {
833 image_paths.insert( 831 image_paths.insert(
834 base::FilePath::FromWStringHack(base::UTF8ToWide(iter->second))); 832 base::FilePath::FromWStringHack(UTF8ToWide(iter->second)));
835 } 833 }
836 } 834 }
837 835
838 return image_paths; 836 return image_paths;
839 } 837 }
840 838
841 ExtensionResource Extension::GetIconResource( 839 ExtensionResource Extension::GetIconResource(
842 int size, ExtensionIconSet::MatchType match_type) const { 840 int size, ExtensionIconSet::MatchType match_type) const {
843 std::string path = icons().Get(size, match_type); 841 std::string path = icons().Get(size, match_type);
844 return path.empty() ? ExtensionResource() : GetResource(path); 842 return path.empty() ? ExtensionResource() : GetResource(path);
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after
2734 2732
2735 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 2733 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
2736 const Extension* extension, 2734 const Extension* extension,
2737 const PermissionSet* permissions, 2735 const PermissionSet* permissions,
2738 Reason reason) 2736 Reason reason)
2739 : reason(reason), 2737 : reason(reason),
2740 extension(extension), 2738 extension(extension),
2741 permissions(permissions) {} 2739 permissions(permissions) {}
2742 2740
2743 } // namespace extensions 2741 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/child_process_logging_win.cc ('k') | chrome/common/extensions/extension_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698