| OLD | NEW |
| 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 10 matching lines...) Expand all Loading... |
| 21 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
| 22 #include "base/values.h" | 22 #include "base/values.h" |
| 23 #include "base/version.h" | 23 #include "base/version.h" |
| 24 #include "chrome/common/chrome_constants.h" | 24 #include "chrome/common/chrome_constants.h" |
| 25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/chrome_version_info.h" | 26 #include "chrome/common/chrome_version_info.h" |
| 27 // TODO(rdevlin.cronin): Remove these once all references have been removed as | 27 // TODO(rdevlin.cronin): Remove these once all references have been removed as |
| 28 // part of crbug.com/159265. | 28 // part of crbug.com/159265. |
| 29 #include "chrome/common/extensions/api/extension_action/action_info.h" | 29 #include "chrome/common/extensions/api/extension_action/action_info.h" |
| 30 #include "chrome/common/extensions/api/plugins/plugins_handler.h" | 30 #include "chrome/common/extensions/api/plugins/plugins_handler.h" |
| 31 #include "chrome/common/extensions/api/themes/theme_handler.h" | |
| 32 #include "chrome/common/extensions/background_info.h" | 31 #include "chrome/common/extensions/background_info.h" |
| 33 #include "chrome/common/extensions/extension_icon_set.h" | |
| 34 #include "chrome/common/extensions/extension_manifest_constants.h" | 32 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 35 #include "chrome/common/extensions/feature_switch.h" | 33 #include "chrome/common/extensions/feature_switch.h" |
| 36 #include "chrome/common/extensions/features/base_feature_provider.h" | 34 #include "chrome/common/extensions/features/base_feature_provider.h" |
| 37 #include "chrome/common/extensions/features/feature.h" | 35 #include "chrome/common/extensions/features/feature.h" |
| 38 #include "chrome/common/extensions/incognito_handler.h" | 36 #include "chrome/common/extensions/incognito_handler.h" |
| 39 #include "chrome/common/extensions/manifest.h" | 37 #include "chrome/common/extensions/manifest.h" |
| 40 #include "chrome/common/extensions/manifest_handler.h" | 38 #include "chrome/common/extensions/manifest_handler.h" |
| 41 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" | 39 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" |
| 42 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" | 40 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" |
| 43 #include "chrome/common/extensions/manifest_handlers/kiosk_enabled_info.h" | 41 #include "chrome/common/extensions/manifest_handlers/kiosk_enabled_info.h" |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 } | 656 } |
| 659 | 657 |
| 660 bool Extension::ShowConfigureContextMenus() const { | 658 bool Extension::ShowConfigureContextMenus() const { |
| 661 // Don't show context menu for component extensions. We might want to show | 659 // Don't show context menu for component extensions. We might want to show |
| 662 // options for component extension button but now there is no component | 660 // options for component extension button but now there is no component |
| 663 // extension with options. All other menu items like uninstall have | 661 // extension with options. All other menu items like uninstall have |
| 664 // no sense for component extensions. | 662 // no sense for component extensions. |
| 665 return location() != Manifest::COMPONENT; | 663 return location() != Manifest::COMPONENT; |
| 666 } | 664 } |
| 667 | 665 |
| 668 std::set<base::FilePath> Extension::GetBrowserImages() const { | |
| 669 std::set<base::FilePath> image_paths; | |
| 670 // TODO(viettrungluu): These |FilePath::FromWStringHack(UTF8ToWide())| | |
| 671 // indicate that we're doing something wrong. | |
| 672 | |
| 673 // Extension icons. | |
| 674 for (ExtensionIconSet::IconMap::const_iterator iter = | |
| 675 IconsInfo::GetIcons(this).map().begin(); | |
| 676 iter != IconsInfo::GetIcons(this).map().end(); ++iter) { | |
| 677 image_paths.insert( | |
| 678 base::FilePath::FromWStringHack(UTF8ToWide(iter->second))); | |
| 679 } | |
| 680 | |
| 681 // Theme images. | |
| 682 DictionaryValue* theme_images = ThemeInfo::GetThemeImages(this); | |
| 683 if (theme_images) { | |
| 684 for (DictionaryValue::Iterator it(*theme_images); !it.IsAtEnd(); | |
| 685 it.Advance()) { | |
| 686 std::string val; | |
| 687 if (it.value().GetAsString(&val)) | |
| 688 image_paths.insert(base::FilePath::FromWStringHack(UTF8ToWide(val))); | |
| 689 } | |
| 690 } | |
| 691 | |
| 692 const ActionInfo* page_action_info = ActionInfo::GetPageActionInfo(this); | |
| 693 if (page_action_info && !page_action_info->default_icon.empty()) { | |
| 694 for (ExtensionIconSet::IconMap::const_iterator iter = | |
| 695 page_action_info->default_icon.map().begin(); | |
| 696 iter != page_action_info->default_icon.map().end(); | |
| 697 ++iter) { | |
| 698 image_paths.insert( | |
| 699 base::FilePath::FromWStringHack(UTF8ToWide(iter->second))); | |
| 700 } | |
| 701 } | |
| 702 | |
| 703 const ActionInfo* browser_action = ActionInfo::GetBrowserActionInfo(this); | |
| 704 if (browser_action && !browser_action->default_icon.empty()) { | |
| 705 for (ExtensionIconSet::IconMap::const_iterator iter = | |
| 706 browser_action->default_icon.map().begin(); | |
| 707 iter != browser_action->default_icon.map().end(); | |
| 708 ++iter) { | |
| 709 image_paths.insert( | |
| 710 base::FilePath::FromWStringHack(UTF8ToWide(iter->second))); | |
| 711 } | |
| 712 } | |
| 713 | |
| 714 return image_paths; | |
| 715 } | |
| 716 | |
| 717 GURL Extension::GetFullLaunchURL() const { | 666 GURL Extension::GetFullLaunchURL() const { |
| 718 return launch_local_path().empty() ? GURL(launch_web_url()) : | 667 return launch_local_path().empty() ? GURL(launch_web_url()) : |
| 719 url().Resolve(launch_local_path()); | 668 url().Resolve(launch_local_path()); |
| 720 } | 669 } |
| 721 | 670 |
| 722 bool Extension::CanExecuteScriptOnPage(const GURL& document_url, | 671 bool Extension::CanExecuteScriptOnPage(const GURL& document_url, |
| 723 const GURL& top_frame_url, | 672 const GURL& top_frame_url, |
| 724 int tab_id, | 673 int tab_id, |
| 725 const UserScript* script, | 674 const UserScript* script, |
| 726 std::string* error) const { | 675 std::string* error) const { |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1801 | 1750 |
| 1802 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 1751 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
| 1803 const Extension* extension, | 1752 const Extension* extension, |
| 1804 const PermissionSet* permissions, | 1753 const PermissionSet* permissions, |
| 1805 Reason reason) | 1754 Reason reason) |
| 1806 : reason(reason), | 1755 : reason(reason), |
| 1807 extension(extension), | 1756 extension(extension), |
| 1808 permissions(permissions) {} | 1757 permissions(permissions) {} |
| 1809 | 1758 |
| 1810 } // namespace extensions | 1759 } // namespace extensions |
| OLD | NEW |