diff options
author | gab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-09 18:53:22 +0000 |
---|---|---|
committer | gab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-09 18:53:22 +0000 |
commit | 9d1b0158bcf46195412d15b9d1be9d479caab740 (patch) | |
tree | 76bf98efe1a3981e300f1ce02b499ee7113839d9 /components | |
parent | b8da79f3624019a2bcd3916fc573f5f861840fb5 (diff) | |
download | chromium_src-9d1b0158bcf46195412d15b9d1be9d479caab740.zip chromium_src-9d1b0158bcf46195412d15b9d1be9d479caab740.tar.gz chromium_src-9d1b0158bcf46195412d15b9d1be9d479caab740.tar.bz2 |
Refactor SetClientID such that metrics rather than crash backs up the client id
in Google Update settings.
Consequentially, the backed up client_id now keeps its dashes and crash_keys
strips them at runtime rather than when backing it up
(https://codereview.chromium.org/372473004/ will add support for stripped
client_id backups for some time).
Also rename a lot of methods involved in setting the client id; having all of
them named "SetClientID" makes this series of calls very hard to follow!
BUG=391338
TBR=thestig
Review URL: https://codereview.chromium.org/365133005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282093 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r-- | components/breakpad/app/breakpad_client.cc | 3 | ||||
-rw-r--r-- | components/breakpad/app/breakpad_client.h | 4 | ||||
-rw-r--r-- | components/breakpad/app/breakpad_linux.cc | 2 | ||||
-rw-r--r-- | components/breakpad/app/breakpad_mac.mm | 4 | ||||
-rw-r--r-- | components/metrics/metrics_service.cc | 2 | ||||
-rw-r--r-- | components/metrics/metrics_service_client.h | 4 | ||||
-rw-r--r-- | components/metrics/test_metrics_service_client.cc | 3 | ||||
-rw-r--r-- | components/metrics/test_metrics_service_client.h | 2 |
8 files changed, 14 insertions, 10 deletions
diff --git a/components/breakpad/app/breakpad_client.cc b/components/breakpad/app/breakpad_client.cc index 84931ea..5c763ca 100644 --- a/components/breakpad/app/breakpad_client.cc +++ b/components/breakpad/app/breakpad_client.cc @@ -27,7 +27,8 @@ BreakpadClient* GetBreakpadClient() { BreakpadClient::BreakpadClient() {} BreakpadClient::~BreakpadClient() {} -void BreakpadClient::SetClientID(const std::string& client_id) { +void BreakpadClient::SetBreakpadClientIdFromGUID( + const std::string& client_guid) { } #if defined(OS_WIN) diff --git a/components/breakpad/app/breakpad_client.h b/components/breakpad/app/breakpad_client.h index fb3b205..7ade184c 100644 --- a/components/breakpad/app/breakpad_client.h +++ b/components/breakpad/app/breakpad_client.h @@ -46,7 +46,9 @@ class BreakpadClient { // Sets the Breakpad client ID, which is a unique identifier for the client // that is sending crash reports. After it is set, it should not be changed. - virtual void SetClientID(const std::string& client_id); + // |client_guid| may either be a full GUID or a GUID that was already stripped + // from its dashes. + virtual void SetBreakpadClientIdFromGUID(const std::string& client_guid); #if defined(OS_WIN) // Returns true if an alternative location to store the minidump files was diff --git a/components/breakpad/app/breakpad_linux.cc b/components/breakpad/app/breakpad_linux.cc index fe9388c..df9d588 100644 --- a/components/breakpad/app/breakpad_linux.cc +++ b/components/breakpad/app/breakpad_linux.cc @@ -206,7 +206,7 @@ void SetClientIdFromCommandLine(const CommandLine& command_line) { // Get the guid from the command line switch. std::string switch_value = command_line.GetSwitchValueASCII(switches::kEnableCrashReporter); - GetBreakpadClient()->SetClientID(switch_value); + GetBreakpadClient()->SetBreakpadClientIdFromGUID(switch_value); } // MIME substrings. diff --git a/components/breakpad/app/breakpad_mac.mm b/components/breakpad/app/breakpad_mac.mm index d46b0c4..6cb5504 100644 --- a/components/breakpad/app/breakpad_mac.mm +++ b/components/breakpad/app/breakpad_mac.mm @@ -238,9 +238,9 @@ void InitCrashReporter(const std::string& process_type) { if (!is_browser) { // Get the guid from the command line switch. - std::string guid = + std::string client_guid = command_line->GetSwitchValueASCII(switches::kEnableCrashReporter); - GetBreakpadClient()->SetClientID(guid); + GetBreakpadClient()->SetBreakpadClientIdFromGUID(client_guid); } logging::SetLogMessageHandler(&FatalMessageHandler); diff --git a/components/metrics/metrics_service.cc b/components/metrics/metrics_service.cc index b9d8dbb..797ec70 100644 --- a/components/metrics/metrics_service.cc +++ b/components/metrics/metrics_service.cc @@ -404,7 +404,7 @@ void MetricsService::EnableRecording() { recording_active_ = true; state_manager_->ForceClientIdCreation(); - client_->SetClientID(state_manager_->client_id()); + client_->SetMetricsClientId(state_manager_->client_id()); if (!log_manager_.current_log()) OpenNewLog(); diff --git a/components/metrics/metrics_service_client.h b/components/metrics/metrics_service_client.h index 1fcfb6e..d8e2c15 100644 --- a/components/metrics/metrics_service_client.h +++ b/components/metrics/metrics_service_client.h @@ -22,9 +22,9 @@ class MetricsServiceClient { public: virtual ~MetricsServiceClient() {} - // Register the client id with other services (e.g. crash reporting), called + // Registers the client id with other services (e.g. crash reporting), called // when metrics recording gets enabled. - virtual void SetClientID(const std::string& client_id) = 0; + virtual void SetMetricsClientId(const std::string& client_id) = 0; // Whether there's an "off the record" (aka "Incognito") session active. virtual bool IsOffTheRecordSessionActive() = 0; diff --git a/components/metrics/test_metrics_service_client.cc b/components/metrics/test_metrics_service_client.cc index 4e1a3c3..e5e9778 100644 --- a/components/metrics/test_metrics_service_client.cc +++ b/components/metrics/test_metrics_service_client.cc @@ -19,7 +19,8 @@ TestMetricsServiceClient::TestMetricsServiceClient() TestMetricsServiceClient::~TestMetricsServiceClient() { } -void TestMetricsServiceClient::SetClientID(const std::string& client_id) { +void TestMetricsServiceClient::SetMetricsClientId( + const std::string& client_id) { client_id_ = client_id; } diff --git a/components/metrics/test_metrics_service_client.h b/components/metrics/test_metrics_service_client.h index 0b7bdef..edbee2f 100644 --- a/components/metrics/test_metrics_service_client.h +++ b/components/metrics/test_metrics_service_client.h @@ -21,7 +21,7 @@ class TestMetricsServiceClient : public MetricsServiceClient { virtual ~TestMetricsServiceClient(); // MetricsServiceClient: - virtual void SetClientID(const std::string& client_id) OVERRIDE; + virtual void SetMetricsClientId(const std::string& client_id) OVERRIDE; virtual bool IsOffTheRecordSessionActive() OVERRIDE; virtual std::string GetApplicationLocale() OVERRIDE; virtual bool GetBrand(std::string* brand_code) OVERRIDE; |