| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/domain_reliability/service_factory.h" | 5 #include "chrome/browser/domain_reliability/service_factory.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
| 12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 13 #include "components/domain_reliability/service.h" | 13 #include "components/domain_reliability/service.h" |
| 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 15 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
| 16 | 16 |
| 17 namespace domain_reliability { | 17 namespace domain_reliability { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 // Identifies Chrome as the source of Domain Reliability uploads it sends. | 21 // Identifies Chrome as the source of Domain Reliability uploads it sends. |
| 22 const char* kDomainReliabilityUploadReporterString = "chrome"; | 22 const char* kDomainReliabilityUploadReporterString = "chrome"; |
| 23 | 23 |
| 24 bool IsDomainReliabilityMonitoringEnabled() { | 24 bool IsDomainReliabilityMonitoringEnabled() { |
| 25 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 25 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 26 if (command_line->HasSwitch(switches::kDisableDomainReliability)) | 26 if (command_line->HasSwitch(switches::kDisableDomainReliability)) |
| 27 return false; | 27 return false; |
| 28 if (command_line->HasSwitch(switches::kEnableDomainReliability)) | 28 if (command_line->HasSwitch(switches::kEnableDomainReliability)) |
| 29 return true; | 29 return true; |
| 30 return base::FieldTrialList::FindFullName("DomRel-Enable") == "enable"; | 30 return base::FieldTrialList::FindFullName("DomRel-Enable") == "enable"; |
| 31 } | 31 } |
| 32 | 32 |
| 33 } // namespace | 33 } // namespace |
| 34 | 34 |
| 35 // static | 35 // static |
| (...skipping 26 matching lines...) Expand all Loading... |
| 62 if (!g_browser_process->local_state()->GetBoolean( | 62 if (!g_browser_process->local_state()->GetBoolean( |
| 63 prefs::kMetricsReportingEnabled)) { | 63 prefs::kMetricsReportingEnabled)) { |
| 64 return NULL; | 64 return NULL; |
| 65 } | 65 } |
| 66 | 66 |
| 67 return DomainReliabilityService::Create( | 67 return DomainReliabilityService::Create( |
| 68 kDomainReliabilityUploadReporterString); | 68 kDomainReliabilityUploadReporterString); |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace domain_reliability | 71 } // namespace domain_reliability |
| OLD | NEW |