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

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

Issue 10683005: Remove two deprecated methods from base::Version (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 8 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
« no previous file with comments | « chrome/browser/upgrade_detector_impl.cc ('k') | chrome/common/extensions/update_manifest.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) 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 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 bool Extension::CheckMinimumChromeVersion(string16* error) { 973 bool Extension::CheckMinimumChromeVersion(string16* error) {
974 if (!manifest_->HasKey(keys::kMinimumChromeVersion)) 974 if (!manifest_->HasKey(keys::kMinimumChromeVersion))
975 return true; 975 return true;
976 std::string minimum_version_string; 976 std::string minimum_version_string;
977 if (!manifest_->GetString(keys::kMinimumChromeVersion, 977 if (!manifest_->GetString(keys::kMinimumChromeVersion,
978 &minimum_version_string)) { 978 &minimum_version_string)) {
979 *error = ASCIIToUTF16(errors::kInvalidMinimumChromeVersion); 979 *error = ASCIIToUTF16(errors::kInvalidMinimumChromeVersion);
980 return false; 980 return false;
981 } 981 }
982 982
983 scoped_ptr<Version> minimum_version( 983 Version minimum_version(minimum_version_string);
984 Version::GetVersionFromString(minimum_version_string)); 984 if (!minimum_version.IsValid()) {
985 if (!minimum_version.get()) {
986 *error = ASCIIToUTF16(errors::kInvalidMinimumChromeVersion); 985 *error = ASCIIToUTF16(errors::kInvalidMinimumChromeVersion);
987 return false; 986 return false;
988 } 987 }
989 988
990 chrome::VersionInfo current_version_info; 989 chrome::VersionInfo current_version_info;
991 if (!current_version_info.is_valid()) { 990 if (!current_version_info.is_valid()) {
992 NOTREACHED(); 991 NOTREACHED();
993 return false; 992 return false;
994 } 993 }
995 994
996 scoped_ptr<Version> current_version( 995 Version current_version(current_version_info.Version());
997 Version::GetVersionFromString(current_version_info.Version())); 996 if (!current_version.IsValid()) {
998 if (!current_version.get()) {
999 DCHECK(false); 997 DCHECK(false);
1000 return false; 998 return false;
1001 } 999 }
1002 1000
1003 if (current_version->CompareTo(*minimum_version) < 0) { 1001 if (current_version.CompareTo(minimum_version) < 0) {
1004 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( 1002 *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
1005 errors::kChromeVersionTooLow, 1003 errors::kChromeVersionTooLow,
1006 l10n_util::GetStringUTF8(IDS_PRODUCT_NAME), 1004 l10n_util::GetStringUTF8(IDS_PRODUCT_NAME),
1007 minimum_version_string); 1005 minimum_version_string);
1008 return false; 1006 return false;
1009 } 1007 }
1010 return true; 1008 return true;
1011 } 1009 }
1012 1010
1013 bool Extension::LoadRequiredFeatures(string16* error) { 1011 bool Extension::LoadRequiredFeatures(string16* error) {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 1330
1333 return true; 1331 return true;
1334 } 1332 }
1335 1333
1336 bool Extension::LoadVersion(string16* error) { 1334 bool Extension::LoadVersion(string16* error) {
1337 std::string version_str; 1335 std::string version_str;
1338 if (!manifest_->GetString(keys::kVersion, &version_str)) { 1336 if (!manifest_->GetString(keys::kVersion, &version_str)) {
1339 *error = ASCIIToUTF16(errors::kInvalidVersion); 1337 *error = ASCIIToUTF16(errors::kInvalidVersion);
1340 return false; 1338 return false;
1341 } 1339 }
1342 version_.reset(Version::GetVersionFromString(version_str)); 1340 version_.reset(new Version(version_str));
1343 if (!version_.get() || 1341 if (!version_->IsValid() ||
1344 version_->components().size() > 4) { 1342 version_->components().size() > 4) {
1345 *error = ASCIIToUTF16(errors::kInvalidVersion); 1343 *error = ASCIIToUTF16(errors::kInvalidVersion);
1346 return false; 1344 return false;
1347 } 1345 }
1348 return true; 1346 return true;
1349 } 1347 }
1350 1348
1351 bool Extension::LoadManifestVersion(string16* error) { 1349 bool Extension::LoadManifestVersion(string16* error) {
1352 // Get the original value out of the dictionary so that we can validate it 1350 // Get the original value out of the dictionary so that we can validate it
1353 // more strictly. 1351 // more strictly.
(...skipping 2500 matching lines...) Expand 10 before | Expand all | Expand 10 after
3854 3852
3855 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 3853 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
3856 const Extension* extension, 3854 const Extension* extension,
3857 const ExtensionPermissionSet* permissions, 3855 const ExtensionPermissionSet* permissions,
3858 Reason reason) 3856 Reason reason)
3859 : reason(reason), 3857 : reason(reason),
3860 extension(extension), 3858 extension(extension),
3861 permissions(permissions) {} 3859 permissions(permissions) {}
3862 3860
3863 } // namespace extensions 3861 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/upgrade_detector_impl.cc ('k') | chrome/common/extensions/update_manifest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698