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

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

Issue 173463: Update of the extension install UI: (Closed)
Patch Set: mpcompelte comments Created 11 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/extensions_service.h" 5 #include "chrome/browser/extensions/extensions_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 // Ensure extension is deleted unless we transfer ownership. 372 // Ensure extension is deleted unless we transfer ownership.
373 scoped_ptr<Extension> scoped_extension(extension); 373 scoped_ptr<Extension> scoped_extension(extension);
374 374
375 if (extensions_enabled() || 375 if (extensions_enabled() ||
376 extension->IsTheme() || 376 extension->IsTheme() ||
377 extension->location() == Extension::LOAD || 377 extension->location() == Extension::LOAD ||
378 Extension::IsExternalLocation(extension->location())) { 378 Extension::IsExternalLocation(extension->location())) {
379 Extension* old = GetExtensionByIdInternal(extension->id(), true, true); 379 Extension* old = GetExtensionByIdInternal(extension->id(), true, true);
380 if (old) { 380 if (old) {
381 if (extension->version()->CompareTo(*(old->version())) > 0) { 381 if (extension->version()->CompareTo(*(old->version())) > 0) {
382 bool higher_permissions = 382 bool allow_silent_upgrade = Extension::AllowSilentUpgrade(old, extension );
Matt Perry 2009/08/26 21:10:32 80 cols
383 (extension->GetPermissionClass() > old->GetPermissionClass());
384 383
385 // To upgrade an extension in place, unload the old one and 384 // To upgrade an extension in place, unload the old one and
386 // then load the new one. 385 // then load the new one.
387 UnloadExtension(old->id()); 386 UnloadExtension(old->id());
388 old = NULL; 387 old = NULL;
389 388
390 if (higher_permissions) { 389 if (!allow_silent_upgrade) {
391 // Extension was upgraded to a high permission class. Disable it and 390 // Extension has changed permissions significantly. Disable it and
392 // notify the user. 391 // notify the user.
393 extension_prefs_->SetExtensionState(extension, Extension::DISABLED); 392 extension_prefs_->SetExtensionState(extension, Extension::DISABLED);
394 NotificationService::current()->Notify( 393 NotificationService::current()->Notify(
395 NotificationType::EXTENSION_UPDATE_DISABLED, 394 NotificationType::EXTENSION_UPDATE_DISABLED,
396 Source<ExtensionsService>(this), 395 Source<ExtensionsService>(this),
397 Details<Extension>(extension)); 396 Details<Extension>(extension));
398 } 397 }
399 } else { 398 } else {
400 // We already have the extension of the same or older version. 399 // We already have the extension of the same or older version.
401 LOG(WARNING) << "Duplicate extension load attempt: " << extension->id(); 400 LOG(WARNING) << "Duplicate extension load attempt: " << extension->id();
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 linked_ptr<ExternalExtensionProvider>(test_provider); 670 linked_ptr<ExternalExtensionProvider>(test_provider);
672 } 671 }
673 672
674 void ExtensionsServiceBackend::OnExternalExtensionFound( 673 void ExtensionsServiceBackend::OnExternalExtensionFound(
675 const std::string& id, const Version* version, const FilePath& path, 674 const std::string& id, const Version* version, const FilePath& path,
676 Extension::Location location) { 675 Extension::Location location) {
677 frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(frontend_, 676 frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(frontend_,
678 &ExtensionsService::OnExternalExtensionFound, id, version->GetString(), 677 &ExtensionsService::OnExternalExtensionFound, id, version->GetString(),
679 path, location)); 678 path, location));
680 } 679 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_install_ui.cc ('k') | chrome/browser/views/extensions/extension_install_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698