| 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/prerender/prerender_field_trial.h" | 5 #include "chrome/browser/prerender/prerender_field_trial.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 SplitStringUsingSubstr(elements[i], "=", &key_value); | 313 SplitStringUsingSubstr(elements[i], "=", &key_value); |
| 314 if (key_value.size() == 2 && key_value[0] == spec_key) | 314 if (key_value.size() == 2 && key_value[0] == spec_key) |
| 315 return key_value[1]; | 315 return key_value[1]; |
| 316 } | 316 } |
| 317 return string(); | 317 return string(); |
| 318 } | 318 } |
| 319 | 319 |
| 320 bool IsUnencryptedSyncEnabled(Profile* profile) { | 320 bool IsUnencryptedSyncEnabled(Profile* profile) { |
| 321 ProfileSyncService* service = ProfileSyncServiceFactory::GetInstance()-> | 321 ProfileSyncService* service = ProfileSyncServiceFactory::GetInstance()-> |
| 322 GetForProfile(profile); | 322 GetForProfile(profile); |
| 323 return service && service->GetSessionModelAssociator() && | 323 return service && service->GetOpenTabsUIDelegate() && |
| 324 !service->EncryptEverythingEnabled(); | 324 !service->EncryptEverythingEnabled(); |
| 325 } | 325 } |
| 326 | 326 |
| 327 // Indicates whether the Local Predictor is enabled based on field trial | 327 // Indicates whether the Local Predictor is enabled based on field trial |
| 328 // selection. | 328 // selection. |
| 329 bool IsLocalPredictorEnabled() { | 329 bool IsLocalPredictorEnabled() { |
| 330 #if defined(OS_ANDROID) || defined(OS_IOS) | 330 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 331 return false; | 331 return false; |
| 332 #endif | 332 #endif |
| 333 if (CommandLine::ForCurrentProcess()->HasSwitch( | 333 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 return GetLocalPredictorSpecValue(kSkipPrerenderLocalCanadidates) == | 470 return GetLocalPredictorSpecValue(kSkipPrerenderLocalCanadidates) == |
| 471 kEnabledGroup; | 471 kEnabledGroup; |
| 472 } | 472 } |
| 473 | 473 |
| 474 bool SkipLocalPredictorServiceCandidates() { | 474 bool SkipLocalPredictorServiceCandidates() { |
| 475 return GetLocalPredictorSpecValue(kSkipPrerenderServiceCanadidates) == | 475 return GetLocalPredictorSpecValue(kSkipPrerenderServiceCanadidates) == |
| 476 kEnabledGroup; | 476 kEnabledGroup; |
| 477 } | 477 } |
| 478 | 478 |
| 479 } // namespace prerender | 479 } // namespace prerender |
| OLD | NEW |