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

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: Move to content namespace. Update usages. Update extract_actions tool. 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') | content/browser/user_metrics.cc » ('J')
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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 #endif 683 #endif
682 } 684 }
683 685
684 void RecordUMAStatistics(const PrefService* prefs) { 686 void RecordUMAStatistics(const PrefService* prefs) {
685 std::set<std::string> flags; 687 std::set<std::string> flags;
686 GetEnabledFlags(prefs, &flags); 688 GetEnabledFlags(prefs, &flags);
687 for (std::set<std::string>::iterator it = flags.begin(); it != flags.end(); 689 for (std::set<std::string>::iterator it = flags.begin(); it != flags.end();
688 ++it) { 690 ++it) {
689 std::string action("AboutFlags_"); 691 std::string action("AboutFlags_");
690 action += *it; 692 action += *it;
691 UserMetrics::RecordComputedAction(action); 693 content::RecordComputedAction(action);
692 } 694 }
693 // Since flag metrics are recorded every startup, add a tick so that the 695 // Since flag metrics are recorded every startup, add a tick so that the
694 // stats can be made meaningful. 696 // stats can be made meaningful.
695 if (flags.size()) 697 if (flags.size())
696 UserMetrics::RecordAction(UserMetricsAction("AboutFlags_StartupTick")); 698 content::RecordAction(UserMetricsAction("AboutFlags_StartupTick"));
697 UserMetrics::RecordAction(UserMetricsAction("StartupTick")); 699 content::RecordAction(UserMetricsAction("StartupTick"));
698 } 700 }
699 701
700 ////////////////////////////////////////////////////////////////////////////// 702 //////////////////////////////////////////////////////////////////////////////
701 // FlagsState implementation. 703 // FlagsState implementation.
702 704
703 namespace { 705 namespace {
704 706
705 void FlagsState::ConvertFlagsToSwitches( 707 void FlagsState::ConvertFlagsToSwitches(
706 PrefService* prefs, CommandLine* command_line) { 708 PrefService* prefs, CommandLine* command_line) {
707 if (command_line->HasSwitch(switches::kNoExperiments)) 709 if (command_line->HasSwitch(switches::kNoExperiments))
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 } 860 }
859 861
860 const Experiment* GetExperiments(size_t* count) { 862 const Experiment* GetExperiments(size_t* count) {
861 *count = num_experiments; 863 *count = num_experiments;
862 return experiments; 864 return experiments;
863 } 865 }
864 866
865 } // namespace testing 867 } // namespace testing
866 868
867 } // namespace about_flags 869 } // namespace about_flags
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/app_controller_mac.mm » ('j') | content/browser/user_metrics.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698