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

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

Issue 10966018: Make Extension::ShouldDisplayInLauncher driven by manifest property. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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.h" 5 #include "chrome/common/extensions/extension.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 return true; 1043 return true;
1044 } 1044 }
1045 1045
1046 bool Extension::LoadAppFeatures(string16* error) { 1046 bool Extension::LoadAppFeatures(string16* error) {
1047 if (!LoadExtent(keys::kWebURLs, &extent_, 1047 if (!LoadExtent(keys::kWebURLs, &extent_,
1048 errors::kInvalidWebURLs, errors::kInvalidWebURL, error) || 1048 errors::kInvalidWebURLs, errors::kInvalidWebURL, error) ||
1049 !LoadLaunchURL(error) || 1049 !LoadLaunchURL(error) ||
1050 !LoadLaunchContainer(error)) { 1050 !LoadLaunchContainer(error)) {
1051 return false; 1051 return false;
1052 } 1052 }
1053 1053 if (manifest_->HasKey(keys::kDisplayInLauncher) &&
1054 !manifest_->GetBoolean(keys::kDisplayInLauncher, &display_in_launcher_)) {
1055 *error = ASCIIToUTF16(errors::kInvalidDisplayInLauncher);
1056 return false;
1057 }
1054 return true; 1058 return true;
1055 } 1059 }
1056 1060
1057 bool Extension::LoadOAuth2Info(string16* error) { 1061 bool Extension::LoadOAuth2Info(string16* error) {
1058 if (!manifest_->HasKey(keys::kOAuth2)) 1062 if (!manifest_->HasKey(keys::kOAuth2))
1059 return true; 1063 return true;
1060 1064
1061 if (!manifest_->GetString(keys::kOAuth2ClientId, &oauth2_info_.client_id) || 1065 if (!manifest_->GetString(keys::kOAuth2ClientId, &oauth2_info_.client_id) ||
1062 oauth2_info_.client_id.empty()) { 1066 oauth2_info_.client_id.empty()) {
1063 *error = ASCIIToUTF16(errors::kInvalidOAuth2ClientId); 1067 *error = ASCIIToUTF16(errors::kInvalidOAuth2ClientId);
(...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after
2942 incognito_split_mode_(false), 2946 incognito_split_mode_(false),
2943 offline_enabled_(false), 2947 offline_enabled_(false),
2944 converted_from_user_script_(false), 2948 converted_from_user_script_(false),
2945 background_page_is_persistent_(true), 2949 background_page_is_persistent_(true),
2946 allow_background_js_access_(true), 2950 allow_background_js_access_(true),
2947 manifest_(manifest.release()), 2951 manifest_(manifest.release()),
2948 is_storage_isolated_(false), 2952 is_storage_isolated_(false),
2949 launch_container_(extension_misc::LAUNCH_TAB), 2953 launch_container_(extension_misc::LAUNCH_TAB),
2950 launch_width_(0), 2954 launch_width_(0),
2951 launch_height_(0), 2955 launch_height_(0),
2956 display_in_launcher_(true),
2952 wants_file_access_(false), 2957 wants_file_access_(false),
2953 creation_flags_(0) { 2958 creation_flags_(0) {
2954 DCHECK(path.empty() || path.IsAbsolute()); 2959 DCHECK(path.empty() || path.IsAbsolute());
2955 path_ = MaybeNormalizePath(path); 2960 path_ = MaybeNormalizePath(path);
2956 } 2961 }
2957 2962
2958 Extension::~Extension() { 2963 Extension::~Extension() {
2959 } 2964 }
2960 2965
2961 ExtensionResource Extension::GetResource( 2966 ExtensionResource Extension::GetResource(
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
3804 // apps, creates a new profile (which get default apps) and then enables sync 3809 // apps, creates a new profile (which get default apps) and then enables sync
3805 // for it, then their profile everywhere gets the default apps. 3810 // for it, then their profile everywhere gets the default apps.
3806 bool is_syncable = (location() == Extension::INTERNAL && 3811 bool is_syncable = (location() == Extension::INTERNAL &&
3807 !was_installed_by_default()); 3812 !was_installed_by_default());
3808 // Sync the chrome web store to maintain its position on the new tab page. 3813 // Sync the chrome web store to maintain its position on the new tab page.
3809 is_syncable |= (id() == extension_misc::kWebStoreAppId); 3814 is_syncable |= (id() == extension_misc::kWebStoreAppId);
3810 return is_syncable; 3815 return is_syncable;
3811 } 3816 }
3812 3817
3813 bool Extension::ShouldDisplayInLauncher() const { 3818 bool Extension::ShouldDisplayInLauncher() const {
3814 // All apps should be displayed on the NTP except for the Cloud Print App. 3819 // Only apps should be displayed on the NTP.
3815 bool should_display_in_launcher = is_app() && 3820 return is_app() && display_in_launcher_;
3816 id() != extension_misc::kCloudPrintAppId;
3817 #if defined(OS_CHROMEOS)
3818 // Wallpaper manager is a component app which can only be launched via context
3819 // menu or set wallpaper button in chrome settings page. We want to hide it
3820 // from launcher.
3821 return should_display_in_launcher &&
3822 id() != extension_misc::kWallpaperManagerId;
3823 #else
3824 return should_display_in_launcher;
3825 #endif
3826 } 3821 }
3827 3822
3828 bool Extension::InstallWarning::operator==(const InstallWarning& other) const { 3823 bool Extension::InstallWarning::operator==(const InstallWarning& other) const {
3829 return format == other.format && message == other.message; 3824 return format == other.format && message == other.message;
3830 } 3825 }
3831 3826
3832 void PrintTo(const Extension::InstallWarning& warning, ::std::ostream* os) { 3827 void PrintTo(const Extension::InstallWarning& warning, ::std::ostream* os) {
3833 *os << "InstallWarning("; 3828 *os << "InstallWarning(";
3834 switch (warning.format) { 3829 switch (warning.format) {
3835 case Extension::InstallWarning::FORMAT_TEXT: 3830 case Extension::InstallWarning::FORMAT_TEXT:
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
4021 4016
4022 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 4017 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
4023 const Extension* extension, 4018 const Extension* extension,
4024 const PermissionSet* permissions, 4019 const PermissionSet* permissions,
4025 Reason reason) 4020 Reason reason)
4026 : reason(reason), 4021 : reason(reason),
4027 extension(extension), 4022 extension(extension),
4028 permissions(permissions) {} 4023 permissions(permissions) {}
4029 4024
4030 } // namespace extensions 4025 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_manifest_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698