summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-23 17:42:41 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-23 17:42:41 +0000
commit5ed7d45777c6cdaf0e3adc3792939c0b39955f1b (patch)
tree3f547e2952b3b05e483399798d5f99a1b14f011d
parent4f7251df426d5c347e57f1febee0a7943545db98 (diff)
downloadchromium_src-5ed7d45777c6cdaf0e3adc3792939c0b39955f1b.zip
chromium_src-5ed7d45777c6cdaf0e3adc3792939c0b39955f1b.tar.gz
chromium_src-5ed7d45777c6cdaf0e3adc3792939c0b39955f1b.tar.bz2
Enable UMA data upload in ChromeFrame
BUG=30508 r=ananta Review URL: http://codereview.chromium.org/502019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35223 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser_main.cc9
-rw-r--r--chrome/browser/metrics/metrics_log.cc11
-rw-r--r--chrome/browser/metrics/metrics_log.h8
-rw-r--r--chrome_frame/chrome_frame_automation.cc6
4 files changed, 23 insertions, 11 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index ff1d17d..e2cebeb 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -491,8 +491,8 @@ int BrowserMain(const MainFunctionParams& parameters) {
g_browser_process->set_application_locale("en-US");
} else {
// Mac starts it earlier in Platform::WillInitializeMainMessageLoop (because
- // it is needed when loading the MainMenu.nib and the language doesn't depend
- // on anything since it comes from Cocoa.
+ // it is needed when loading the MainMenu.nib and the language doesn't
+ // depend on anything since it comes from Cocoa.
#if defined(OS_MACOSX)
g_browser_process->set_application_locale(l10n_util::GetLocaleOverride());
#else
@@ -843,6 +843,11 @@ int BrowserMain(const MainFunctionParams& parameters) {
MetricsService* metrics = NULL;
if (!parsed_command_line.HasSwitch(switches::kDisableMetrics)) {
+#if defined(OS_WIN)
+ if (InstallUtil::IsChromeFrameProcess())
+ MetricsLog::set_version_extension("-F");
+#endif // defined(OS_WIN)
+
bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled);
bool record_only =
parsed_command_line.HasSwitch(switches::kMetricsRecordingOnly);
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index a55fc4a..46a197c 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -29,6 +29,9 @@ using base::TimeDelta;
extern "C" IMAGE_DOS_HEADER __ImageBase;
#endif
+// static
+std::string MetricsLog::version_extension_;
+
// libxml take xmlChar*, which is unsigned char*
inline const unsigned char* UnsignedChar(const char* input) {
return reinterpret_cast<const unsigned char*>(input);
@@ -76,10 +79,10 @@ void MetricsLog::CloseLog() {
locked_ = true;
int result = xmlTextWriterEndDocument(writer_);
- DCHECK(result >= 0);
+ DCHECK_GE(result, 0);
result = xmlTextWriterFlush(writer_);
- DCHECK(result >= 0);
+ DCHECK_GE(result, 0);
}
int MetricsLog::GetEncodedLogSize() {
@@ -297,6 +300,8 @@ std::string MetricsLog::GetVersionString() {
FileVersionInfo::CreateFileVersionInfoForCurrentModule());
if (version_info.get()) {
std::string version = WideToUTF8(version_info->product_version());
+ if (!version_extension_.empty())
+ version += version_extension_;
if (!version_info->is_official_build())
version.append("-devel");
return version;
@@ -683,7 +688,7 @@ void MetricsLog::RecordOmniboxOpenedURL(const AutocompleteLog& log) {
void MetricsLog::RecordHistogramDelta(const Histogram& histogram,
const Histogram::SampleSet& snapshot) {
DCHECK(!locked_);
- DCHECK(0 != snapshot.TotalCount());
+ DCHECK_NE(0, snapshot.TotalCount());
snapshot.CheckSize(histogram);
// We will ignore the MAX_INT/infinite value in the last element of range[].
diff --git a/chrome/browser/metrics/metrics_log.h b/chrome/browser/metrics/metrics_log.h
index bcdd4f5..c8e7691 100644
--- a/chrome/browser/metrics/metrics_log.h
+++ b/chrome/browser/metrics/metrics_log.h
@@ -106,6 +106,11 @@ class MetricsLog {
// Get the current version of the application as a string.
static std::string GetVersionString();
+ // Use |extension| in all uploaded appversions in addition to the standard
+ // version string.
+ static void set_version_extension(const std::string& extension) {
+ version_extension_ = extension;
+ }
protected:
// Returns a string containing the current time.
// Virtual so that it can be overridden for testing.
@@ -184,6 +189,9 @@ class MetricsLog {
void WriteProfileMetrics(const std::wstring& key,
const DictionaryValue& profile_metrics);
+ // An extension that is appended to the appversion in each log.
+ static std::string version_extension_;
+
base::Time start_time_;
base::Time end_time_;
diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc
index 7f88498..482fb2b 100644
--- a/chrome_frame/chrome_frame_automation.cc
+++ b/chrome_frame/chrome_frame_automation.cc
@@ -236,12 +236,6 @@ void ProxyFactory::CreateProxy(ProxyFactory::ProxyCacheEntry* entry,
command_line->AppendSwitchWithValue(switches::kAutomationClientChannelID,
ASCIIToWide(proxy->channel_id()));
- // The metrics bug out because they attempt to use URLFetcher with a
- // null URLRequestContext::default_request_context_. Turn them off for now.
- // TODO(robertshield): Figure out why this is. It appears to have something
- // to do with an improperly set up profile...
- command_line->AppendSwitch(switches::kDisableMetrics);
-
// Run Chrome in Chrome Frame mode. In practice, this modifies the paths
// and registry keys that Chrome looks in via the BrowserDistribution
// mechanism.