Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: chrome/browser/about_flags.cc

Issue 8919017: Split UserMetrics into API vs. implementation. Move API to content/public. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Version for commit (merged again). Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/app_controller_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/about_flags.h" 5 #include "chrome/browser/about_flags.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/browser/prefs/pref_service.h" 17 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/browser/prefs/scoped_user_pref_update.h" 18 #include "chrome/browser/prefs/scoped_user_pref_update.h"
19 #include "chrome/common/chrome_content_client.h" 19 #include "chrome/common/chrome_content_client.h"
20 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
22 #include "content/browser/user_metrics.h" 22 #include "content/public/browser/user_metrics.h"
23 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/gfx/gl/gl_switches.h" 25 #include "ui/gfx/gl/gl_switches.h"
26 26
27 #if defined(USE_AURA) 27 #if defined(USE_AURA)
28 #include "ui/aura/aura_switches.h" 28 #include "ui/aura/aura_switches.h"
29 #endif 29 #endif
30 30
31 using content::UserMetricsAction;
32
31 namespace about_flags { 33 namespace about_flags {
32 34
33 // Macros to simplify specifying the type. 35 // Macros to simplify specifying the type.
34 #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \ 36 #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \
35 Experiment::SINGLE_VALUE, command_line_switch, switch_value, NULL, 0 37 Experiment::SINGLE_VALUE, command_line_switch, switch_value, NULL, 0
36 #define SINGLE_VALUE_TYPE(command_line_switch) \ 38 #define SINGLE_VALUE_TYPE(command_line_switch) \
37 SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "") 39 SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "")
38 #define MULTI_VALUE_TYPE(choices) \ 40 #define MULTI_VALUE_TYPE(choices) \
39 Experiment::MULTI_VALUE, "", "", choices, arraysize(choices) 41 Experiment::MULTI_VALUE, "", "", choices, arraysize(choices)
40 42
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 #endif 690 #endif
689 } 691 }
690 692
691 void RecordUMAStatistics(const PrefService* prefs) { 693 void RecordUMAStatistics(const PrefService* prefs) {
692 std::set<std::string> flags; 694 std::set<std::string> flags;
693 GetEnabledFlags(prefs, &flags); 695 GetEnabledFlags(prefs, &flags);
694 for (std::set<std::string>::iterator it = flags.begin(); it != flags.end(); 696 for (std::set<std::string>::iterator it = flags.begin(); it != flags.end();
695 ++it) { 697 ++it) {
696 std::string action("AboutFlags_"); 698 std::string action("AboutFlags_");
697 action += *it; 699 action += *it;
698 UserMetrics::RecordComputedAction(action); 700 content::RecordComputedAction(action);
699 } 701 }
700 // Since flag metrics are recorded every startup, add a tick so that the 702 // Since flag metrics are recorded every startup, add a tick so that the
701 // stats can be made meaningful. 703 // stats can be made meaningful.
702 if (flags.size()) 704 if (flags.size())
703 UserMetrics::RecordAction(UserMetricsAction("AboutFlags_StartupTick")); 705 content::RecordAction(UserMetricsAction("AboutFlags_StartupTick"));
704 UserMetrics::RecordAction(UserMetricsAction("StartupTick")); 706 content::RecordAction(UserMetricsAction("StartupTick"));
705 } 707 }
706 708
707 ////////////////////////////////////////////////////////////////////////////// 709 //////////////////////////////////////////////////////////////////////////////
708 // FlagsState implementation. 710 // FlagsState implementation.
709 711
710 namespace { 712 namespace {
711 713
712 void FlagsState::ConvertFlagsToSwitches( 714 void FlagsState::ConvertFlagsToSwitches(
713 PrefService* prefs, CommandLine* command_line) { 715 PrefService* prefs, CommandLine* command_line) {
714 if (command_line->HasSwitch(switches::kNoExperiments)) 716 if (command_line->HasSwitch(switches::kNoExperiments))
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 } 867 }
866 868
867 const Experiment* GetExperiments(size_t* count) { 869 const Experiment* GetExperiments(size_t* count) {
868 *count = num_experiments; 870 *count = num_experiments;
869 return experiments; 871 return experiments;
870 } 872 }
871 873
872 } // namespace testing 874 } // namespace testing
873 875
874 } // namespace about_flags 876 } // namespace about_flags
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/app_controller_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698