| 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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 443 |
| 444 void ProfileSyncService::AddObserver(Observer* observer) { | 444 void ProfileSyncService::AddObserver(Observer* observer) { |
| 445 observers_.AddObserver(observer); | 445 observers_.AddObserver(observer); |
| 446 } | 446 } |
| 447 | 447 |
| 448 void ProfileSyncService::RemoveObserver(Observer* observer) { | 448 void ProfileSyncService::RemoveObserver(Observer* observer) { |
| 449 observers_.RemoveObserver(observer); | 449 observers_.RemoveObserver(observer); |
| 450 } | 450 } |
| 451 | 451 |
| 452 void ProfileSyncService::SyncEvent(SyncEventCodes code) { | 452 void ProfileSyncService::SyncEvent(SyncEventCodes code) { |
| 453 static LinearHistogram histogram("Sync.EventCodes", MIN_SYNC_EVENT_CODE, | 453 static scoped_refptr<Histogram> histogram = |
| 454 MAX_SYNC_EVENT_CODE - 1, | 454 LinearHistogram::LinearHistogramFactoryGet("Sync.EventCodes", |
| 455 MAX_SYNC_EVENT_CODE); | 455 MIN_SYNC_EVENT_CODE + 1, MAX_SYNC_EVENT_CODE - 1, |
| 456 histogram.SetFlags(kUmaTargetedHistogramFlag); | 456 MAX_SYNC_EVENT_CODE); |
| 457 histogram.Add(code); | 457 histogram->SetFlags(kUmaTargetedHistogramFlag); |
| 458 histogram->Add(code); |
| 458 } | 459 } |
| 459 | 460 |
| 460 bool ProfileSyncService::IsSyncEnabled() { | 461 bool ProfileSyncService::IsSyncEnabled() { |
| 461 // We have switches::kEnableSync just in case we need to change back to | 462 // We have switches::kEnableSync just in case we need to change back to |
| 462 // sync-disabled-by-default on a platform. | 463 // sync-disabled-by-default on a platform. |
| 463 return !CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableSync); | 464 return !CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableSync); |
| 464 } | 465 } |
| 465 | 466 |
| 466 bool ProfileSyncService::ShouldPushChanges() { | 467 bool ProfileSyncService::ShouldPushChanges() { |
| 467 // True only after all bootstrapping has succeeded: the bookmark model is | 468 // True only after all bootstrapping has succeeded: the bookmark model is |
| 468 // loaded, the sync backend is initialized, the two domains are | 469 // loaded, the sync backend is initialized, the two domains are |
| 469 // consistent with one another, and no unrecoverable error has transpired. | 470 // consistent with one another, and no unrecoverable error has transpired. |
| 470 return change_processor_->IsRunning(); | 471 return change_processor_->IsRunning(); |
| 471 } | 472 } |
| OLD | NEW |