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

Side by Side Diff: chrome/browser/chromeos/drive/drive_integration_service.cc

Issue 20029004: Initial call for DriveAppRegistry::Update should wait for notification start-up. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « no previous file | no next file » | 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/browser/chromeos/drive/drive_integration_service.h" 5 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
246 observers_.RemoveObserver(observer); 246 observers_.RemoveObserver(observer);
247 } 247 }
248 248
249 void DriveIntegrationService::OnNotificationReceived() { 249 void DriveIntegrationService::OnNotificationReceived() {
250 file_system_->CheckForUpdates(); 250 file_system_->CheckForUpdates();
251 drive_app_registry_->Update(); 251 drive_app_registry_->Update();
252 } 252 }
253 253
254 void DriveIntegrationService::OnPushNotificationEnabled(bool enabled) { 254 void DriveIntegrationService::OnPushNotificationEnabled(bool enabled) {
255 if (enabled)
256 drive_app_registry_->Update();
257
255 const char* status = (enabled ? "enabled" : "disabled"); 258 const char* status = (enabled ? "enabled" : "disabled");
256 util::Log("Push notification is %s", status); 259 util::Log("Push notification is %s", status);
257 } 260 }
258 261
259 bool DriveIntegrationService::IsDriveEnabled() { 262 bool DriveIntegrationService::IsDriveEnabled() {
260 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 263 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
261 264
262 if (!IsDriveEnabledForProfile(profile_)) 265 if (!IsDriveEnabledForProfile(profile_))
263 return false; 266 return false;
264 267
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 364
362 // Register for Google Drive invalidation notifications. 365 // Register for Google Drive invalidation notifications.
363 DriveNotificationManager* drive_notification_manager = 366 DriveNotificationManager* drive_notification_manager =
364 DriveNotificationManagerFactory::GetForProfile(profile_); 367 DriveNotificationManagerFactory::GetForProfile(profile_);
365 if (drive_notification_manager) { 368 if (drive_notification_manager) {
366 drive_notification_manager->AddObserver(this); 369 drive_notification_manager->AddObserver(this);
367 const bool registered = 370 const bool registered =
368 drive_notification_manager->push_notification_registered(); 371 drive_notification_manager->push_notification_registered();
369 const char* status = (registered ? "registered" : "not registered"); 372 const char* status = (registered ? "registered" : "not registered");
370 util::Log("Push notification is %s", status); 373 util::Log("Push notification is %s", status);
374
375 if (drive_notification_manager->push_notification_enabled())
376 drive_app_registry_->Update();
371 } 377 }
372 378
373 drive_app_registry_->Update();
374 AddDriveMountPoint(); 379 AddDriveMountPoint();
375 } 380 }
376 381
377 void DriveIntegrationService::DisableDrive() { 382 void DriveIntegrationService::DisableDrive() {
378 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 383 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
379 384
380 drive_disabled_ = true; 385 drive_disabled_ = true;
381 // Change the download directory to the default value if the download 386 // Change the download directory to the default value if the download
382 // destination is set to under Drive mount point. 387 // destination is set to under Drive mount point.
383 PrefService* pref_service = profile_->GetPrefs(); 388 PrefService* pref_service = profile_->GetPrefs();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 profile, NULL, base::FilePath(), NULL); 464 profile, NULL, base::FilePath(), NULL);
460 } else { 465 } else {
461 service = factory_for_test_.Run(profile); 466 service = factory_for_test_.Run(profile);
462 } 467 }
463 468
464 service->Initialize(); 469 service->Initialize();
465 return service; 470 return service;
466 } 471 }
467 472
468 } // namespace drive 473 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698