summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-10 23:37:03 +0000
committerlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-10 23:37:03 +0000
commitb7c8d9b3f731d50cf6afa0ec9c15843d2101bfc1 (patch)
tree90293a66b17c390c8c4b40839a9fb8fc84a6d7f4
parent9eaa331b9d4e9644eae6d2e1eafc5e990b51abaf (diff)
downloadchromium_src-b7c8d9b3f731d50cf6afa0ec9c15843d2101bfc1.zip
chromium_src-b7c8d9b3f731d50cf6afa0ec9c15843d2101bfc1.tar.gz
chromium_src-b7c8d9b3f731d50cf6afa0ec9c15843d2101bfc1.tar.bz2
Enable crash-reporting for Mac host, for users who opt in.
This enables the Web UI for opting in, and sets an option in the Host config accordingly. The host, during startup, reads the config option and enables crash-reporting if set. BUG=136579 Review URL: https://chromiumcodereview.appspot.com/11447003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172183 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--remoting/base/breakpad_mac.mm3
-rw-r--r--remoting/host/host_config.cc1
-rw-r--r--remoting/host/host_config.h2
-rw-r--r--remoting/host/setup/daemon_controller_mac.cc27
-rw-r--r--remoting/host/usage_stats_consent_mac.cc22
5 files changed, 44 insertions, 11 deletions
diff --git a/remoting/base/breakpad_mac.mm b/remoting/base/breakpad_mac.mm
index abc2159..1dbd11f 100644
--- a/remoting/base/breakpad_mac.mm
+++ b/remoting/base/breakpad_mac.mm
@@ -56,8 +56,7 @@ void InitializeCrashReporting() {
forKey:@BREAKPAD_REPORT_INTERVAL];
}
if (![breakpad_config objectForKey:@BREAKPAD_URL]) {
- // TODO(lambroslambrou): Use the production URL once permission is granted.
- [breakpad_config setObject:@"https://clients2.google.com/cr/staging_report"
+ [breakpad_config setObject:@"https://clients2.google.com/cr/report"
forKey:@BREAKPAD_URL];
}
diff --git a/remoting/host/host_config.cc b/remoting/host/host_config.cc
index 96053e6..94b5d49b 100644
--- a/remoting/host/host_config.cc
+++ b/remoting/host/host_config.cc
@@ -15,5 +15,6 @@ const char kHostIdConfigPath[] = "host_id";
const char kHostNameConfigPath[] = "host_name";
const char kHostSecretHashConfigPath[] = "host_secret_hash";
const char kPrivateKeyConfigPath[] = "private_key";
+const char kUsageStatsConsentConfigPath[] = "usage_stats_consent";
} // namespace remoting
diff --git a/remoting/host/host_config.h b/remoting/host/host_config.h
index e7d95f1..a8233b5 100644
--- a/remoting/host/host_config.h
+++ b/remoting/host/host_config.h
@@ -36,6 +36,8 @@ extern const char kHostNameConfigPath[];
extern const char kHostSecretHashConfigPath[];
// Private keys used for host authentication.
extern const char kPrivateKeyConfigPath[];
+// Whether consent is given for usage stats reporting.
+extern const char kUsageStatsConsentConfigPath[];
// HostConfig interace provides read-only access to host configuration.
class HostConfig {
diff --git a/remoting/host/setup/daemon_controller_mac.cc b/remoting/host/setup/daemon_controller_mac.cc
index f82dabd..430077cd 100644
--- a/remoting/host/setup/daemon_controller_mac.cc
+++ b/remoting/host/setup/daemon_controller_mac.cc
@@ -60,10 +60,12 @@ class DaemonControllerMac : public remoting::DaemonController {
void DoGetConfig(const GetConfigCallback& callback);
void DoGetVersion(const GetVersionCallback& callback);
void DoSetConfigAndStart(scoped_ptr<base::DictionaryValue> config,
+ bool consent,
const CompletionCallback& done);
void DoUpdateConfig(scoped_ptr<base::DictionaryValue> config,
const CompletionCallback& done_callback);
void DoStop(const CompletionCallback& done_callback);
+ void DoGetUsageStatsConsent(const GetUsageStatsConsentCallback& callback);
void ShowPreferencePane(const std::string& config_data,
const CompletionCallback& done_callback);
@@ -130,12 +132,12 @@ void DaemonControllerMac::GetConfig(const GetConfigCallback& callback) {
void DaemonControllerMac::SetConfigAndStart(
scoped_ptr<base::DictionaryValue> config,
- bool /* consent */,
+ bool consent,
const CompletionCallback& done) {
auth_thread_.message_loop_proxy()->PostTask(
FROM_HERE, base::Bind(
&DaemonControllerMac::DoSetConfigAndStart, base::Unretained(this),
- base::Passed(&config), done));
+ base::Passed(&config), consent, done));
}
void DaemonControllerMac::UpdateConfig(
@@ -165,9 +167,10 @@ void DaemonControllerMac::GetVersion(const GetVersionCallback& callback) {
void DaemonControllerMac::GetUsageStatsConsent(
const GetUsageStatsConsentCallback& callback) {
- // Crash dump collection is not implemented on Mac yet.
- // http://crbug.com/130678.
- callback.Run(false, false, false);
+ auth_thread_.message_loop_proxy()->PostTask(
+ FROM_HERE,
+ base::Bind(&DaemonControllerMac::DoGetUsageStatsConsent,
+ base::Unretained(this), callback));
}
void DaemonControllerMac::DoGetConfig(const GetConfigCallback& callback) {
@@ -213,7 +216,9 @@ void DaemonControllerMac::DoGetVersion(const GetVersionCallback& callback) {
void DaemonControllerMac::DoSetConfigAndStart(
scoped_ptr<base::DictionaryValue> config,
+ bool consent,
const CompletionCallback& done) {
+ config->SetBoolean(kUsageStatsConsentConfigPath, consent);
std::string config_data;
base::JSONWriter::Write(config.get(), &config_data);
ShowPreferencePane(config_data, done);
@@ -238,6 +243,18 @@ void DaemonControllerMac::DoUpdateConfig(
ShowPreferencePane(config_data, done_callback);
}
+void DaemonControllerMac::DoGetUsageStatsConsent(
+ const GetUsageStatsConsentCallback& callback) {
+ bool allowed = false;
+ FilePath config_file_path(kHostConfigFilePath);
+ JsonHostConfig host_config(config_file_path);
+ if (host_config.Read()) {
+ host_config.GetBoolean(kUsageStatsConsentConfigPath, &allowed);
+ }
+ // set_by_policy is not yet supported.
+ callback.Run(true, allowed, false /* set_by_policy */);
+}
+
void DaemonControllerMac::ShowPreferencePane(
const std::string& config_data, const CompletionCallback& done_callback) {
if (DoShowPreferencePane(config_data)) {
diff --git a/remoting/host/usage_stats_consent_mac.cc b/remoting/host/usage_stats_consent_mac.cc
index f256415..00655a4 100644
--- a/remoting/host/usage_stats_consent_mac.cc
+++ b/remoting/host/usage_stats_consent_mac.cc
@@ -6,17 +6,31 @@
#include <string>
+#include "base/command_line.h"
+#include "base/file_path.h"
#include "base/logging.h"
+#include "remoting/host/config_file_watcher.h"
+#include "remoting/host/json_host_config.h"
namespace remoting {
bool GetUsageStatsConsent(bool* allowed, bool* set_by_policy) {
*set_by_policy = false;
-
- // For now, leave Breakpad disabled.
- // TODO(lambroslambrou): Enable it for users who have given consent.
*allowed = false;
- return true;
+
+ // Normally, the ConfigFileWatcher class would be used for retrieving config
+ // settings, but this code needs to execute before Breakpad is initialised,
+ // which itself should happen as early as possible during startup.
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(kHostConfigSwitchName)) {
+ FilePath config_file_path =
+ command_line->GetSwitchValuePath(kHostConfigSwitchName);
+ JsonHostConfig host_config(config_file_path);
+ if (host_config.Read()) {
+ return host_config.GetBoolean(kUsageStatsConsentConfigPath, allowed);
+ }
+ }
+ return false;
}
bool IsUsageStatsAllowed() {