OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
6 | 6 |
7 #include <stack> | 7 #include <stack> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 | 460 |
461 void ProfileSyncService::AddObserver(Observer* observer) { | 461 void ProfileSyncService::AddObserver(Observer* observer) { |
462 observers_.AddObserver(observer); | 462 observers_.AddObserver(observer); |
463 } | 463 } |
464 | 464 |
465 void ProfileSyncService::RemoveObserver(Observer* observer) { | 465 void ProfileSyncService::RemoveObserver(Observer* observer) { |
466 observers_.RemoveObserver(observer); | 466 observers_.RemoveObserver(observer); |
467 } | 467 } |
468 | 468 |
469 void ProfileSyncService::SyncEvent(SyncEventCodes code) { | 469 void ProfileSyncService::SyncEvent(SyncEventCodes code) { |
470 static scoped_refptr<Histogram> histogram = | 470 UMA_HISTOGRAM_ENUMERATION("Sync.EventCodes", code, MAX_SYNC_EVENT_CODE); |
471 LinearHistogram::LinearHistogramFactoryGet("Sync.EventCodes", | |
472 MIN_SYNC_EVENT_CODE + 1, MAX_SYNC_EVENT_CODE - 1, | |
473 MAX_SYNC_EVENT_CODE); | |
474 histogram->SetFlags(kUmaTargetedHistogramFlag); | |
475 histogram->Add(code); | |
476 } | 471 } |
477 | 472 |
478 bool ProfileSyncService::IsSyncEnabled() { | 473 bool ProfileSyncService::IsSyncEnabled() { |
479 // We have switches::kEnableSync just in case we need to change back to | 474 // We have switches::kEnableSync just in case we need to change back to |
480 // sync-disabled-by-default on a platform. | 475 // sync-disabled-by-default on a platform. |
481 return !CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableSync); | 476 return !CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableSync); |
482 } | 477 } |
483 | 478 |
484 bool ProfileSyncService::ShouldPushChanges() { | 479 bool ProfileSyncService::ShouldPushChanges() { |
485 // True only after all bootstrapping has succeeded: the bookmark model is | 480 // True only after all bootstrapping has succeeded: the bookmark model is |
486 // loaded, the sync backend is initialized, the two domains are | 481 // loaded, the sync backend is initialized, the two domains are |
487 // consistent with one another, and no unrecoverable error has transpired. | 482 // consistent with one another, and no unrecoverable error has transpired. |
488 for (std::set<ChangeProcessor*>::const_iterator it = | 483 for (std::set<ChangeProcessor*>::const_iterator it = |
489 change_processors_.begin(); it != change_processors_.end(); ++it) { | 484 change_processors_.begin(); it != change_processors_.end(); ++it) { |
490 if (!(*it)->IsRunning()) return false; | 485 if (!(*it)->IsRunning()) return false; |
491 } | 486 } |
492 return true; | 487 return true; |
493 } | 488 } |
OLD | NEW |