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

Side by Side Diff: chrome/browser/sync_file_system/sync_file_system_service.cc

Issue 14238037: Made it possible to tell whether an extension is being installed or updated. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Test that already_installed is true on update, false on install. Created 7 years, 7 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/sync_file_system/sync_file_system_service.h" 5 #include "chrome/browser/sync_file_system/sync_file_system_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 } 416 }
417 417
418 void SyncFileSystemService::Observe( 418 void SyncFileSystemService::Observe(
419 int type, 419 int type,
420 const content::NotificationSource& source, 420 const content::NotificationSource& source,
421 const content::NotificationDetails& details) { 421 const content::NotificationDetails& details) {
422 // Event notification sequence. 422 // Event notification sequence.
423 // 423 //
424 // (User action) (Notification type) 424 // (User action) (Notification type)
425 // Install: INSTALLED. 425 // Install: INSTALLED.
426 // Update: INSTALLED.
426 // Uninstall: UNLOADED(UNINSTALL). 427 // Uninstall: UNLOADED(UNINSTALL).
427 // Launch, Close: No notification. 428 // Launch, Close: No notification.
428 // Enable: EABLED. 429 // Enable: EABLED.
429 // Disable: UNLOADED(DISABLE). 430 // Disable: UNLOADED(DISABLE).
430 // Reload, Restart: UNLOADED(DISABLE) -> INSTALLED -> ENABLED. 431 // Reload, Restart: UNLOADED(DISABLE) -> INSTALLED -> ENABLED.
431 // 432 //
432 switch (type) { 433 switch (type) {
433 case chrome::NOTIFICATION_EXTENSION_INSTALLED: 434 case chrome::NOTIFICATION_EXTENSION_INSTALLED:
434 HandleExtensionInstalled(details); 435 HandleExtensionInstalled(details);
435 break; 436 break;
436 case chrome::NOTIFICATION_EXTENSION_UNLOADED: 437 case chrome::NOTIFICATION_EXTENSION_UNLOADED:
437 HandleExtensionUnloaded(type, details); 438 HandleExtensionUnloaded(type, details);
438 break; 439 break;
439 case chrome::NOTIFICATION_EXTENSION_ENABLED: 440 case chrome::NOTIFICATION_EXTENSION_ENABLED:
440 HandleExtensionEnabled(type, details); 441 HandleExtensionEnabled(type, details);
441 break; 442 break;
442 default: 443 default:
443 NOTREACHED() << "Unknown notification."; 444 NOTREACHED() << "Unknown notification.";
444 break; 445 break;
445 } 446 }
446 } 447 }
447 448
448 void SyncFileSystemService::HandleExtensionInstalled( 449 void SyncFileSystemService::HandleExtensionInstalled(
449 const content::NotificationDetails& details) { 450 const content::NotificationDetails& details) {
450 content::Details<const extensions::Extension> extension(details); 451 const extensions::Extension* extension =
452 content::Details<const extensions::InstalledExtensionInfo>(details)->
453 extension;
451 GURL app_origin = 454 GURL app_origin =
452 extensions::Extension::GetBaseURLFromExtensionId(extension->id()); 455 extensions::Extension::GetBaseURLFromExtensionId(extension->id());
453 DVLOG(1) << "Handle extension notification for INSTALLED: " << app_origin; 456 DVLOG(1) << "Handle extension notification for INSTALLED: " << app_origin;
454 // NOTE: When an app is uninstalled and re-installed in a sequence, 457 // NOTE: When an app is uninstalled and re-installed in a sequence,
455 // |local_file_service_| may still keeps |app_origin| as disabled origin. 458 // |local_file_service_| may still keeps |app_origin| as disabled origin.
456 local_file_service_->SetOriginEnabled(app_origin, true); 459 local_file_service_->SetOriginEnabled(app_origin, true);
457 } 460 }
458 461
459 void SyncFileSystemService::HandleExtensionUnloaded( 462 void SyncFileSystemService::HandleExtensionUnloaded(
460 int type, 463 int type,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 syncer::APPS); 531 syncer::APPS);
529 remote_file_service_->SetSyncEnabled(sync_enabled_); 532 remote_file_service_->SetSyncEnabled(sync_enabled_);
530 if (sync_enabled_) { 533 if (sync_enabled_) {
531 base::MessageLoopProxy::current()->PostTask( 534 base::MessageLoopProxy::current()->PostTask(
532 FROM_HERE, base::Bind(&SyncFileSystemService::MaybeStartSync, 535 FROM_HERE, base::Bind(&SyncFileSystemService::MaybeStartSync,
533 AsWeakPtr())); 536 AsWeakPtr()));
534 } 537 }
535 } 538 }
536 539
537 } // namespace sync_file_system 540 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698