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

Side by Side Diff: chrome/browser/extensions/crx_installer.cc

Issue 1575523002: Comparison and streaming operators for base::Version (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
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/browser/extensions/crx_installer.h" 5 #include "chrome/browser/extensions/crx_installer.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 261
262 if (minimum_version_.IsValid() && 262 if (minimum_version_.IsValid() &&
263 extension->version()->CompareTo(minimum_version_) < 0) { 263 extension->version()->CompareTo(minimum_version_) < 0) {
264 return CrxInstallError(l10n_util::GetStringFUTF16( 264 return CrxInstallError(l10n_util::GetStringFUTF16(
265 IDS_EXTENSION_INSTALL_UNEXPECTED_VERSION, 265 IDS_EXTENSION_INSTALL_UNEXPECTED_VERSION,
266 base::ASCIIToUTF16(minimum_version_.GetString() + "+"), 266 base::ASCIIToUTF16(minimum_version_.GetString() + "+"),
267 base::ASCIIToUTF16(extension->version()->GetString()))); 267 base::ASCIIToUTF16(extension->version()->GetString())));
268 } 268 }
269 269
270 if (expected_version_.IsValid() && fail_install_if_unexpected_version_ && 270 if (expected_version_.IsValid() && fail_install_if_unexpected_version_ &&
271 !expected_version_.Equals(*extension->version())) { 271 expected_version_ != *extension->version()) {
272 return CrxInstallError(l10n_util::GetStringFUTF16( 272 return CrxInstallError(l10n_util::GetStringFUTF16(
273 IDS_EXTENSION_INSTALL_UNEXPECTED_VERSION, 273 IDS_EXTENSION_INSTALL_UNEXPECTED_VERSION,
274 base::ASCIIToUTF16(expected_version_.GetString()), 274 base::ASCIIToUTF16(expected_version_.GetString()),
275 base::ASCIIToUTF16(extension->version()->GetString()))); 275 base::ASCIIToUTF16(extension->version()->GetString())));
276 } 276 }
277 277
278 // Make sure the manifests match if we want to bypass the prompt. 278 // Make sure the manifests match if we want to bypass the prompt.
279 if (approved_) { 279 if (approved_) {
280 bool valid = false; 280 bool valid = false;
281 if (expected_manifest_check_level_ == 281 if (expected_manifest_check_level_ ==
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 // If there is a client, tell the client about installation. 812 // If there is a client, tell the client about installation.
813 if (client_) 813 if (client_)
814 client_->OnInstallSuccess(extension(), install_icon_.get()); 814 client_->OnInstallSuccess(extension(), install_icon_.get());
815 815
816 // We update the extension's granted permissions if the user already 816 // We update the extension's granted permissions if the user already
817 // approved the install (client_ is non NULL), or we are allowed to install 817 // approved the install (client_ is non NULL), or we are allowed to install
818 // this silently. 818 // this silently.
819 if ((client_ || allow_silent_install_) && 819 if ((client_ || allow_silent_install_) &&
820 grant_permissions_ && 820 grant_permissions_ &&
821 (!expected_version_.IsValid() || 821 (!expected_version_.IsValid() ||
822 expected_version_.Equals(*extension()->version()))) { 822 expected_version_ == *extension()->version())) {
823 PermissionsUpdater perms_updater(profile()); 823 PermissionsUpdater perms_updater(profile());
824 perms_updater.InitializePermissions(extension()); 824 perms_updater.InitializePermissions(extension());
825 perms_updater.GrantActivePermissions(extension()); 825 perms_updater.GrantActivePermissions(extension());
826 } 826 }
827 } 827 }
828 828
829 service_weak_->OnExtensionInstalled( 829 service_weak_->OnExtensionInstalled(
830 extension(), page_ordinal_, install_flags_); 830 extension(), page_ordinal_, install_flags_);
831 NotifyCrxInstallComplete(true); 831 NotifyCrxInstallComplete(true);
832 } 832 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension( 917 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension(
918 service->profile(), extension()); 918 service->profile(), extension());
919 client_->ShowDialog( 919 client_->ShowDialog(
920 this, extension(), nullptr, 920 this, extension(), nullptr,
921 make_scoped_ptr(new ExtensionInstallPrompt::Prompt(type)), 921 make_scoped_ptr(new ExtensionInstallPrompt::Prompt(type)),
922 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); 922 ExtensionInstallPrompt::GetDefaultShowDialogCallback());
923 } 923 }
924 } 924 }
925 925
926 } // namespace extensions 926 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698