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

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: Fixes mistake in previous 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 // If there is a client, tell the client about installation. 803 // If there is a client, tell the client about installation.
804 if (client_) 804 if (client_)
805 client_->OnInstallSuccess(extension(), install_icon_.get()); 805 client_->OnInstallSuccess(extension(), install_icon_.get());
806 806
807 // We update the extension's granted permissions if the user already 807 // We update the extension's granted permissions if the user already
808 // approved the install (client_ is non NULL), or we are allowed to install 808 // approved the install (client_ is non NULL), or we are allowed to install
809 // this silently. 809 // this silently.
810 if ((client_ || allow_silent_install_) && 810 if ((client_ || allow_silent_install_) &&
811 grant_permissions_ && 811 grant_permissions_ &&
812 (!expected_version_.IsValid() || 812 (!expected_version_.IsValid() ||
813 expected_version_.Equals(*extension()->version()))) { 813 expected_version_ == *extension()->version())) {
814 PermissionsUpdater perms_updater(profile()); 814 PermissionsUpdater perms_updater(profile());
815 perms_updater.InitializePermissions(extension()); 815 perms_updater.InitializePermissions(extension());
816 perms_updater.GrantActivePermissions(extension()); 816 perms_updater.GrantActivePermissions(extension());
817 } 817 }
818 } 818 }
819 819
820 service_weak_->OnExtensionInstalled( 820 service_weak_->OnExtensionInstalled(
821 extension(), page_ordinal_, install_flags_); 821 extension(), page_ordinal_, install_flags_);
822 NotifyCrxInstallComplete(true); 822 NotifyCrxInstallComplete(true);
823 } 823 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension( 908 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension(
909 service->profile(), extension()); 909 service->profile(), extension());
910 client_->ShowDialog( 910 client_->ShowDialog(
911 base::Bind(&CrxInstaller::OnInstallPromptDone, this), extension(), 911 base::Bind(&CrxInstaller::OnInstallPromptDone, this), extension(),
912 nullptr, make_scoped_ptr(new ExtensionInstallPrompt::Prompt(type)), 912 nullptr, make_scoped_ptr(new ExtensionInstallPrompt::Prompt(type)),
913 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); 913 ExtensionInstallPrompt::GetDefaultShowDialogCallback());
914 } 914 }
915 } 915 }
916 916
917 } // namespace extensions 917 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/chrome_extensions_browser_client.cc ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698