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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/field_trial.h" | 10 #include "base/field_trial.h" |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 std::string switch_domain(""); | 511 std::string switch_domain(""); |
512 if (parsed_command_line.HasSwitch(switches::kSdchFilter)) { | 512 if (parsed_command_line.HasSwitch(switches::kSdchFilter)) { |
513 switch_domain = | 513 switch_domain = |
514 WideToASCII(parsed_command_line.GetSwitchValue(switches::kSdchFilter)); | 514 WideToASCII(parsed_command_line.GetSwitchValue(switches::kSdchFilter)); |
515 } | 515 } |
516 sdch_manager.EnableSdchSupport(switch_domain); | 516 sdch_manager.EnableSdchSupport(switch_domain); |
517 #endif | 517 #endif |
518 | 518 |
519 MetricsService* metrics = NULL; | 519 MetricsService* metrics = NULL; |
520 if (!parsed_command_line.HasSwitch(switches::kDisableMetrics)) { | 520 if (!parsed_command_line.HasSwitch(switches::kDisableMetrics)) { |
521 if (parsed_command_line.HasSwitch(switches::kMetricsRecordingOnly)) { | 521 bool record_only = |
| 522 parsed_command_line.HasSwitch(switches::kMetricsRecordingOnly); |
| 523 |
| 524 #if !defined(GOOGLE_CHROME_BUILD) |
| 525 record_only = true; |
| 526 #endif |
| 527 |
| 528 if (record_only) { |
522 local_state->transient()->SetBoolean(prefs::kMetricsReportingEnabled, | 529 local_state->transient()->SetBoolean(prefs::kMetricsReportingEnabled, |
523 false); | 530 false); |
524 } | 531 } |
525 metrics = browser_process->metrics_service(); | 532 metrics = browser_process->metrics_service(); |
526 DCHECK(metrics); | 533 DCHECK(metrics); |
527 | 534 |
528 // If we're testing then we don't care what the user preference is, we turn | 535 // If we're testing then we don't care what the user preference is, we turn |
529 // on recording, but not reporting, otherwise tests fail. | 536 // on recording, but not reporting, otherwise tests fail. |
530 if (parsed_command_line.HasSwitch(switches::kMetricsRecordingOnly)) { | 537 if (record_only) { |
531 metrics->StartRecordingOnly(); | 538 metrics->StartRecordingOnly(); |
532 } else { | 539 } else { |
533 // If the user permits metrics reporting with the checkbox in the | 540 // If the user permits metrics reporting with the checkbox in the |
534 // prefs, we turn on recording. | 541 // prefs, we turn on recording. |
535 bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled); | 542 bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled); |
536 | 543 |
537 metrics->SetUserPermitsUpload(enabled); | 544 metrics->SetUserPermitsUpload(enabled); |
538 if (enabled) | 545 if (enabled) |
539 metrics->Start(); | 546 metrics->Start(); |
540 } | 547 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 if (metrics) | 583 if (metrics) |
577 metrics->Stop(); | 584 metrics->Stop(); |
578 | 585 |
579 // browser_shutdown takes care of deleting browser_process, so we need to | 586 // browser_shutdown takes care of deleting browser_process, so we need to |
580 // release it. | 587 // release it. |
581 browser_process.release(); | 588 browser_process.release(); |
582 browser_shutdown::Shutdown(); | 589 browser_shutdown::Shutdown(); |
583 | 590 |
584 return result_code; | 591 return result_code; |
585 } | 592 } |
OLD | NEW |