OLD | NEW |
---|---|
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/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 #include "components/signin/core/browser/about_signin_internals.h" | 68 #include "components/signin/core/browser/about_signin_internals.h" |
69 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 69 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
70 #include "components/signin/core/browser/signin_manager.h" | 70 #include "components/signin/core/browser/signin_manager.h" |
71 #include "components/signin/core/browser/signin_metrics.h" | 71 #include "components/signin/core/browser/signin_metrics.h" |
72 #include "components/sync_driver/change_processor.h" | 72 #include "components/sync_driver/change_processor.h" |
73 #include "components/sync_driver/data_type_controller.h" | 73 #include "components/sync_driver/data_type_controller.h" |
74 #include "components/sync_driver/device_info.h" | 74 #include "components/sync_driver/device_info.h" |
75 #include "components/sync_driver/pref_names.h" | 75 #include "components/sync_driver/pref_names.h" |
76 #include "components/sync_driver/system_encryptor.h" | 76 #include "components/sync_driver/system_encryptor.h" |
77 #include "components/sync_driver/user_selectable_sync_type.h" | 77 #include "components/sync_driver/user_selectable_sync_type.h" |
78 #include "components/variations/variations_associated_data.h" | |
78 #include "content/public/browser/browser_thread.h" | 79 #include "content/public/browser/browser_thread.h" |
79 #include "content/public/browser/notification_details.h" | 80 #include "content/public/browser/notification_details.h" |
80 #include "content/public/browser/notification_service.h" | 81 #include "content/public/browser/notification_service.h" |
81 #include "content/public/browser/notification_source.h" | 82 #include "content/public/browser/notification_source.h" |
82 #include "net/cookies/cookie_monster.h" | 83 #include "net/cookies/cookie_monster.h" |
83 #include "net/url_request/url_request_context_getter.h" | 84 #include "net/url_request/url_request_context_getter.h" |
84 #include "sync/api/sync_error.h" | 85 #include "sync/api/sync_error.h" |
85 #include "sync/internal_api/public/configure_reason.h" | 86 #include "sync/internal_api/public/configure_reason.h" |
86 #include "sync/internal_api/public/http_bridge_network_resources.h" | 87 #include "sync/internal_api/public/http_bridge_network_resources.h" |
87 #include "sync/internal_api/public/network_resources.h" | 88 #include "sync/internal_api/public/network_resources.h" |
(...skipping 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2448 base::WeakPtr<syncer::JsController> ProfileSyncService::GetJsController() { | 2449 base::WeakPtr<syncer::JsController> ProfileSyncService::GetJsController() { |
2449 return sync_js_controller_.AsWeakPtr(); | 2450 return sync_js_controller_.AsWeakPtr(); |
2450 } | 2451 } |
2451 | 2452 |
2452 void ProfileSyncService::SyncEvent(SyncEventCodes code) { | 2453 void ProfileSyncService::SyncEvent(SyncEventCodes code) { |
2453 UMA_HISTOGRAM_ENUMERATION("Sync.EventCodes", code, MAX_SYNC_EVENT_CODE); | 2454 UMA_HISTOGRAM_ENUMERATION("Sync.EventCodes", code, MAX_SYNC_EVENT_CODE); |
2454 } | 2455 } |
2455 | 2456 |
2456 // static | 2457 // static |
2457 bool ProfileSyncService::IsSyncEnabled() { | 2458 bool ProfileSyncService::IsSyncEnabled() { |
2459 // Disable sync experimentally to measure impact on startup time. | |
2460 // TODO(mlerman): Remove this after the experiment. crbug.com/454788 | |
Alexei Svitkine (slow)
2015/02/19 22:04:08
Nit: Add this comment above the other variations c
Mike Lerman
2015/02/20 16:38:02
Done.
| |
2461 if (!variations::GetVariationParamValue("LightSpeed", "DisableSync").empty()) | |
2462 return false; | |
Bernhard Bauer
2015/02/18 21:12:44
Nit: indent two spaces less.
Mike Lerman
2015/02/20 16:38:01
Done.
| |
2463 | |
2458 // We have switches::kEnableSync just in case we need to change back to | 2464 // We have switches::kEnableSync just in case we need to change back to |
2459 // sync-disabled-by-default on a platform. | 2465 // sync-disabled-by-default on a platform. |
2460 return !base::CommandLine::ForCurrentProcess()->HasSwitch( | 2466 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
2461 switches::kDisableSync); | 2467 switches::kDisableSync); |
2462 } | 2468 } |
2463 | 2469 |
2464 bool ProfileSyncService::IsManaged() const { | 2470 bool ProfileSyncService::IsManaged() const { |
2465 return sync_prefs_.IsManaged() || sync_disabled_by_admin_; | 2471 return sync_prefs_.IsManaged() || sync_disabled_by_admin_; |
2466 } | 2472 } |
2467 | 2473 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2744 | 2750 |
2745 base::MessageLoop* ProfileSyncService::GetSyncLoopForTest() const { | 2751 base::MessageLoop* ProfileSyncService::GetSyncLoopForTest() const { |
2746 if (sync_thread_) { | 2752 if (sync_thread_) { |
2747 return sync_thread_->message_loop(); | 2753 return sync_thread_->message_loop(); |
2748 } else if (backend_) { | 2754 } else if (backend_) { |
2749 return backend_->GetSyncLoopForTesting(); | 2755 return backend_->GetSyncLoopForTesting(); |
2750 } else { | 2756 } else { |
2751 return NULL; | 2757 return NULL; |
2752 } | 2758 } |
2753 } | 2759 } |
OLD | NEW |