summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/BUILD.gn5
-rw-r--r--chrome/browser/profile_resetter/BUILD.gn12
-rw-r--r--chrome/browser/profile_resetter/profile_reset_report.proto66
-rw-r--r--chrome/browser/profile_resetter/profile_resetter_unittest.cc54
-rw-r--r--chrome/browser/profile_resetter/reset_report_uploader.cc57
-rw-r--r--chrome/browser/profile_resetter/reset_report_uploader.h43
-rw-r--r--chrome/browser/profile_resetter/reset_report_uploader_factory.cc33
-rw-r--r--chrome/browser/profile_resetter/reset_report_uploader_factory.h44
-rw-r--r--chrome/browser/profile_resetter/resettable_settings_snapshot.cc74
-rw-r--r--chrome/browser/profile_resetter/resettable_settings_snapshot.h19
-rw-r--r--chrome/browser/ui/webui/options/reset_profile_settings_handler.cc7
-rw-r--r--chrome/browser/ui/webui/settings/reset_settings_handler.cc7
-rw-r--r--chrome/chrome_browser.gypi18
13 files changed, 438 insertions, 1 deletions
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 4ff216c..058be57 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -736,7 +736,10 @@ source_set("browser") {
sources += rebase_path(gypi_values.chrome_browser_non_mobile_sources,
".",
"//chrome")
- deps += [ "//components/feedback" ]
+ deps += [
+ "//chrome/browser/profile_resetter:profile_reset_report_proto",
+ "//components/feedback",
+ ]
}
if (!is_chrome_branded) {
diff --git a/chrome/browser/profile_resetter/BUILD.gn b/chrome/browser/profile_resetter/BUILD.gn
new file mode 100644
index 0000000..46a443d
--- /dev/null
+++ b/chrome/browser/profile_resetter/BUILD.gn
@@ -0,0 +1,12 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//third_party/protobuf/proto_library.gni")
+
+# GYP version: chrome/chrome_browser.gypi:probe_message_proto
+proto_library("profile_reset_report_proto") {
+ sources = [
+ "profile_reset_report.proto",
+ ]
+}
diff --git a/chrome/browser/profile_resetter/profile_reset_report.proto b/chrome/browser/profile_resetter/profile_reset_report.proto
new file mode 100644
index 0000000..4187c7a
--- /dev/null
+++ b/chrome/browser/profile_resetter/profile_reset_report.proto
@@ -0,0 +1,66 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Sync protocol for sending reset reports.
+
+syntax = "proto2";
+
+package reset_report;
+
+// Chrome requires this.
+option optimize_for = LITE_RUNTIME;
+
+// A Chrome reset report.
+message ChromeResetReport {
+ // A random ID to de-duplicate reports that are sent to multiple backends
+ // during a transition period.
+ optional string guid = 10;
+
+ // What tabs Chrome should show on startup. See SessionStartupPref in Chrome.
+ enum SessionStartupType {
+ // Indicates the user wants to open the New Tab page.
+ DEFAULT = 0;
+
+ // // Deprecated. See comment in session_startup_pref.cc
+ HOMEPAGE = 1;
+
+ // Indicates the user wants to restore the last session.
+ LAST = 2;
+
+ // Indicates the user wants to restore a specific set of URLs. The URLs
+ // are contained in urls.
+ URLS = 3;
+ }
+
+ optional SessionStartupType startup_type = 11;
+
+ // URLs to be shown by Chrome on startup, only activated in the browser if
+ // startup_type == 4.
+ repeated string startup_url_path = 12;
+
+ // Whether to show the home button in Chrome's UI.
+ optional bool show_home_button = 13;
+
+ // Whether the homepage corresponds to the New Tab Page instead of
+ // homepage_path.
+ optional bool homepage_is_new_tab_page = 14;
+
+ // Homepage URL, only used if homepage_is_new_tab_page == false.
+ optional string homepage_path = 15;
+
+ // URL of the default search engine.
+ optional string default_search_engine_path = 16;
+
+ message Extension {
+ optional string extension_id = 1;
+ optional string extension_name = 2;
+ }
+
+ repeated Extension enabled_extensions = 17;
+
+ // Full command line (executable and parameters) of shotcuts to start Chrome.
+ repeated string shortcuts = 18;
+
+ // next available tag number: 19.
+}
diff --git a/chrome/browser/profile_resetter/profile_resetter_unittest.cc b/chrome/browser/profile_resetter/profile_resetter_unittest.cc
index b394a89..5c6085d 100644
--- a/chrome/browser/profile_resetter/profile_resetter_unittest.cc
+++ b/chrome/browser/profile_resetter/profile_resetter_unittest.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/extensions/tab_helper.h"
#include "chrome/browser/prefs/session_startup_pref.h"
#include "chrome/browser/profile_resetter/brandcode_config_fetcher.h"
+#include "chrome/browser/profile_resetter/profile_reset_report.pb.h"
#include "chrome/browser/profile_resetter/profile_resetter_test_base.h"
#include "chrome/browser/profile_resetter/resettable_settings_snapshot.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
@@ -981,6 +982,59 @@ TEST_F(ProfileResetterTest, FeedbackSerializationTest) {
}
}
+TEST_F(ProfileResetterTest, FeedbackSerializationAsProtoTest) {
+ // Reset to non organic defaults.
+ ResetAndWait(ProfileResetter::DEFAULT_SEARCH_ENGINE |
+ ProfileResetter::HOMEPAGE |
+ ProfileResetter::STARTUP_PAGES,
+ kDistributionConfig);
+
+ scoped_refptr<Extension> ext = CreateExtension(
+ base::ASCIIToUTF16("example"),
+ base::FilePath(FILE_PATH_LITERAL("//nonexistent")),
+ Manifest::INVALID_LOCATION,
+ extensions::Manifest::TYPE_EXTENSION,
+ false);
+ ASSERT_TRUE(ext.get());
+ service_->AddExtension(ext.get());
+
+ ShortcutHandler shortcut;
+ ShortcutCommand command_line = shortcut.CreateWithArguments(
+ base::ASCIIToUTF16("chrome.lnk"),
+ base::ASCIIToUTF16("--profile-directory=Default foo.com"));
+
+ ResettableSettingsSnapshot nonorganic_snap(profile());
+ nonorganic_snap.RequestShortcuts(base::Closure());
+ // Let it enumerate shortcuts on the FILE thread.
+ base::MessageLoop::current()->RunUntilIdle();
+
+ static_assert(ResettableSettingsSnapshot::ALL_FIELDS == 31,
+ "this test needs to be expanded");
+ for (int field_mask = 0; field_mask <= ResettableSettingsSnapshot::ALL_FIELDS;
+ ++field_mask) {
+ scoped_ptr<reset_report::ChromeResetReport> report =
+ SerializeSettingsReportToProto(nonorganic_snap, field_mask);
+
+ EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::STARTUP_MODE),
+ report->startup_url_path_size() > 0);
+ EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::STARTUP_MODE),
+ report->has_startup_type());
+ EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::HOMEPAGE),
+ report->has_homepage_path());
+ EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::HOMEPAGE),
+ report->has_homepage_is_new_tab_page());
+ EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::HOMEPAGE),
+ report->has_show_home_button());
+ EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::DSE_URL),
+ report->has_default_search_engine_path());
+ EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::EXTENSIONS),
+ report->enabled_extensions_size() > 0);
+ EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::SHORTCUTS) &&
+ ShortcutHandler::IsSupported(),
+ report->shortcuts_size() > 0);
+ }
+}
+
struct FeedbackCapture {
void SetFeedback(Profile* profile,
const ResettableSettingsSnapshot& snapshot) {
diff --git a/chrome/browser/profile_resetter/reset_report_uploader.cc b/chrome/browser/profile_resetter/reset_report_uploader.cc
new file mode 100644
index 0000000..d1e304c
--- /dev/null
+++ b/chrome/browser/profile_resetter/reset_report_uploader.cc
@@ -0,0 +1,57 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <string>
+
+#include "base/logging.h"
+#include "chrome/browser/profile_resetter/profile_reset_report.pb.h"
+#include "chrome/browser/profile_resetter/reset_report_uploader.h"
+#include "content/public/browser/browser_context.h"
+#include "google_apis/google_api_keys.h"
+#include "net/base/escape.h"
+#include "net/base/load_flags.h"
+#include "net/url_request/url_fetcher.h"
+#include "net/url_request/url_request_context_getter.h"
+
+namespace {
+const char kResetReportUrl[] =
+ "https://sb-ssl.google.com/safebrowsing/clientreport/chrome-reset";
+
+GURL GetClientReportUrl(const std::string& report_url) {
+ GURL url(report_url);
+ std::string api_key = google_apis::GetAPIKey();
+ if (!api_key.empty())
+ url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true));
+
+ return url;
+}
+
+} // namespace
+
+ResetReportUploader::ResetReportUploader(content::BrowserContext* context)
+ : url_request_context_getter_(context->GetRequestContext()) {}
+
+ResetReportUploader::~ResetReportUploader() {}
+
+void ResetReportUploader::DispatchReport(
+ const reset_report::ChromeResetReport& report) {
+ std::string request_data;
+ CHECK(report.SerializeToString(&request_data));
+
+ // Note fetcher will be deleted by OnURLFetchComplete.
+ net::URLFetcher* fetcher =
+ net::URLFetcher::Create(GetClientReportUrl(kResetReportUrl),
+ net::URLFetcher::POST, this)
+ .release();
+ fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
+ net::LOAD_DO_NOT_SAVE_COOKIES |
+ net::LOAD_DISABLE_CACHE);
+ fetcher->SetRequestContext(url_request_context_getter_.get());
+ fetcher->SetUploadData("application/octet-stream", request_data);
+ fetcher->Start();
+}
+
+void ResetReportUploader::OnURLFetchComplete(const net::URLFetcher* source) {
+ delete source;
+}
diff --git a/chrome/browser/profile_resetter/reset_report_uploader.h b/chrome/browser/profile_resetter/reset_report_uploader.h
new file mode 100644
index 0000000..791f0a2
--- /dev/null
+++ b/chrome/browser/profile_resetter/reset_report_uploader.h
@@ -0,0 +1,43 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PROFILE_RESETTER_RESET_REPORT_UPLOADER_H_
+#define CHROME_BROWSER_PROFILE_RESETTER_RESET_REPORT_UPLOADER_H_
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "components/keyed_service/core/keyed_service.h"
+#include "net/url_request/url_fetcher_delegate.h"
+
+namespace content {
+class BrowserContext;
+}
+
+namespace net {
+class URLFetcher;
+class URLRequestContextGetter;
+}
+
+namespace reset_report {
+class ChromeResetReport;
+}
+
+// Service whose job is up upload ChromeResetReports.
+class ResetReportUploader : public KeyedService,
+ private net::URLFetcherDelegate {
+ public:
+ explicit ResetReportUploader(content::BrowserContext* context);
+ ~ResetReportUploader() override;
+
+ void DispatchReport(const reset_report::ChromeResetReport& report);
+
+ private:
+ void OnURLFetchComplete(const net::URLFetcher* source) override;
+
+ scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
+
+ DISALLOW_COPY_AND_ASSIGN(ResetReportUploader);
+};
+
+#endif // CHROME_BROWSER_PROFILE_RESETTER_RESET_REPORT_UPLOADER_H_
diff --git a/chrome/browser/profile_resetter/reset_report_uploader_factory.cc b/chrome/browser/profile_resetter/reset_report_uploader_factory.cc
new file mode 100644
index 0000000..7b567c4
--- /dev/null
+++ b/chrome/browser/profile_resetter/reset_report_uploader_factory.cc
@@ -0,0 +1,33 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/profile_resetter/reset_report_uploader_factory.h"
+
+#include "base/memory/singleton.h"
+#include "chrome/browser/profile_resetter/reset_report_uploader.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+
+// static
+ResetReportUploaderFactory* ResetReportUploaderFactory::GetInstance() {
+ return base::Singleton<ResetReportUploaderFactory>::get();
+}
+
+// static
+ResetReportUploader* ResetReportUploaderFactory::GetForBrowserContext(
+ content::BrowserContext* context) {
+ return static_cast<ResetReportUploader*>(
+ GetInstance()->GetServiceForBrowserContext(context, true /* create */));
+}
+
+ResetReportUploaderFactory::ResetReportUploaderFactory()
+ : BrowserContextKeyedServiceFactory(
+ "ResetReportUploaderFactory",
+ BrowserContextDependencyManager::GetInstance()) {}
+
+ResetReportUploaderFactory::~ResetReportUploaderFactory() {}
+
+KeyedService* ResetReportUploaderFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ return new ResetReportUploader(context);
+}
diff --git a/chrome/browser/profile_resetter/reset_report_uploader_factory.h b/chrome/browser/profile_resetter/reset_report_uploader_factory.h
new file mode 100644
index 0000000..b32c7eb
--- /dev/null
+++ b/chrome/browser/profile_resetter/reset_report_uploader_factory.h
@@ -0,0 +1,44 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PROFILE_RESETTER_RESET_REPORT_UPLOADER_FACTORY_H_
+#define CHROME_BROWSER_PROFILE_RESETTER_RESET_REPORT_UPLOADER_FACTORY_H_
+
+#include "base/basictypes.h"
+#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
+
+namespace base {
+template <typename T>
+struct DefaultSingletonTraits;
+}
+
+namespace content {
+class BrowserContext;
+}
+
+class ResetReportUploader;
+
+class ResetReportUploaderFactory : public BrowserContextKeyedServiceFactory {
+ public:
+ // Returns singleton instance of ResetReportUploaderFactory.
+ static ResetReportUploaderFactory* GetInstance();
+
+ // Returns the ResetReportUploader associated with |context|.
+ static ResetReportUploader* GetForBrowserContext(
+ content::BrowserContext* context);
+
+ private:
+ friend struct base::DefaultSingletonTraits<ResetReportUploaderFactory>;
+
+ ResetReportUploaderFactory();
+ ~ResetReportUploaderFactory() override;
+
+ // BrowserContextKeyedServiceFactory overrides:
+ KeyedService* BuildServiceInstanceFor(
+ content::BrowserContext* context) const override;
+
+ DISALLOW_COPY_AND_ASSIGN(ResetReportUploaderFactory);
+};
+
+#endif // CHROME_BROWSER_PROFILE_RESETTER_RESET_REPORT_UPLOADER_FACTORY_H_
diff --git a/chrome/browser/profile_resetter/resettable_settings_snapshot.cc b/chrome/browser/profile_resetter/resettable_settings_snapshot.cc
index 504876b..711fc74 100644
--- a/chrome/browser/profile_resetter/resettable_settings_snapshot.cc
+++ b/chrome/browser/profile_resetter/resettable_settings_snapshot.cc
@@ -4,13 +4,18 @@
#include "chrome/browser/profile_resetter/resettable_settings_snapshot.h"
+#include "base/guid.h"
#include "base/json/json_writer.h"
+#include "base/md5.h"
#include "base/prefs/pref_service.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/cancellation_flag.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/profile_resetter/profile_reset_report.pb.h"
+#include "chrome/browser/profile_resetter/reset_report_uploader.h"
+#include "chrome/browser/profile_resetter/reset_report_uploader_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/common/channel_info.h"
@@ -43,6 +48,7 @@ const char kShortcuts[] = "shortcuts";
const char kShowHomeButton[] = "show_home_button";
const char kStartupTypePath[] = "startup_type";
const char kStartupURLPath[] = "startup_urls";
+const char kGuid[] = "guid";
template <class StringType>
void AddPair(base::ListValue* list,
@@ -88,6 +94,10 @@ ResettableSettingsSnapshot::ResettableSettingsSnapshot(
// ExtensionSet is sorted but it seems to be an implementation detail.
std::sort(enabled_extensions_.begin(), enabled_extensions_.end());
+
+ // Calculate the MD5 sum of the GUID to make sure that no part of the GUID
+ // contains information identifying the sender of the report.
+ guid_ = base::MD5String(base::GenerateGUID());
}
ResettableSettingsSnapshot::~ResettableSettingsSnapshot() {
@@ -212,6 +222,8 @@ std::string SerializeSettingsReport(const ResettableSettingsSnapshot& snapshot,
dict.Set(kShortcuts, list);
}
+ dict.SetString(kGuid, snapshot.guid());
+
static_assert(ResettableSettingsSnapshot::ALL_FIELDS == 31,
"new field needs to be serialized here");
@@ -220,6 +232,62 @@ std::string SerializeSettingsReport(const ResettableSettingsSnapshot& snapshot,
return json;
}
+scoped_ptr<reset_report::ChromeResetReport> SerializeSettingsReportToProto(
+ const ResettableSettingsSnapshot& snapshot,
+ int field_mask) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ scoped_ptr<reset_report::ChromeResetReport> report(
+ new reset_report::ChromeResetReport());
+
+ if (field_mask & ResettableSettingsSnapshot::STARTUP_MODE) {
+ for (const auto& url : snapshot.startup_urls())
+ report->add_startup_url_path(url.spec());
+ switch (snapshot.startup_type()) {
+ case SessionStartupPref::DEFAULT:
+ report->set_startup_type(
+ reset_report::ChromeResetReport_SessionStartupType_DEFAULT);
+ break;
+ case SessionStartupPref::LAST:
+ report->set_startup_type(
+ reset_report::ChromeResetReport_SessionStartupType_LAST);
+ break;
+ case SessionStartupPref::URLS:
+ report->set_startup_type(
+ reset_report::ChromeResetReport_SessionStartupType_URLS);
+ break;
+ }
+ }
+
+ if (field_mask & ResettableSettingsSnapshot::HOMEPAGE) {
+ report->set_homepage_path(snapshot.homepage());
+ report->set_homepage_is_new_tab_page(snapshot.homepage_is_ntp());
+ report->set_show_home_button(snapshot.show_home_button());
+ }
+
+ if (field_mask & ResettableSettingsSnapshot::DSE_URL)
+ report->set_default_search_engine_path(snapshot.dse_url());
+
+ if (field_mask & ResettableSettingsSnapshot::EXTENSIONS) {
+ for (const auto& enabled_extension : snapshot.enabled_extensions()) {
+ reset_report::ChromeResetReport_Extension* new_extension =
+ report->add_enabled_extensions();
+ new_extension->set_extension_id(enabled_extension.first);
+ new_extension->set_extension_name(enabled_extension.second);
+ }
+ }
+
+ if (field_mask & ResettableSettingsSnapshot::SHORTCUTS) {
+ for (const auto& shortcut_command : snapshot.shortcuts())
+ report->add_shortcuts(base::UTF16ToUTF8(shortcut_command.second));
+ }
+
+ report->set_guid(snapshot.guid());
+
+ static_assert(ResettableSettingsSnapshot::ALL_FIELDS == 31,
+ "new field needs to be serialized here");
+ return report;
+}
+
void SendSettingsFeedback(const std::string& report,
Profile* profile) {
scoped_refptr<FeedbackData> feedback_data = new FeedbackData();
@@ -235,6 +303,12 @@ void SendSettingsFeedback(const std::string& report,
feedback_util::SendReport(feedback_data);
}
+void SendSettingsFeedbackProto(const reset_report::ChromeResetReport& report,
+ Profile* profile) {
+ ResetReportUploaderFactory::GetForBrowserContext(profile)
+ ->DispatchReport(report);
+}
+
scoped_ptr<base::ListValue> GetReadableFeedbackForSnapshot(
Profile* profile,
const ResettableSettingsSnapshot& snapshot) {
diff --git a/chrome/browser/profile_resetter/resettable_settings_snapshot.h b/chrome/browser/profile_resetter/resettable_settings_snapshot.h
index e602cef..d935ded 100644
--- a/chrome/browser/profile_resetter/resettable_settings_snapshot.h
+++ b/chrome/browser/profile_resetter/resettable_settings_snapshot.h
@@ -19,6 +19,9 @@
namespace base {
class ListValue;
}
+namespace reset_report {
+class ChromeResetReport;
+}
// ResettableSettingsSnapshot captures some settings values at constructor. It
// can calculate the difference between two snapshots. That is, modified fields.
@@ -66,6 +69,8 @@ class ResettableSettingsSnapshot {
return shortcuts_determined_;
}
+ std::string guid() const { return guid_; }
+
// Substitutes |enabled_extensions_| with
// |enabled_extensions_|\|snapshot.enabled_extensions_|.
void Subtract(const ResettableSettingsSnapshot& snapshot);
@@ -87,6 +92,9 @@ class ResettableSettingsSnapshot {
const base::Closure& callback,
const std::vector<ShortcutCommand>& shortcuts);
+ // Every ResettableSettingsSnapshot instance gets a randomly created GUID.
+ std::string guid_;
+
// Startup pages. URLs are always stored sorted.
SessionStartupPref startup_;
@@ -120,11 +128,22 @@ class ResettableSettingsSnapshot {
std::string SerializeSettingsReport(const ResettableSettingsSnapshot& snapshot,
int field_mask);
+// Serializes specified |snapshot| members to a protobuf. |field_mask| is a bit
+// mask of ResettableSettingsSnapshot::Field values.
+scoped_ptr<reset_report::ChromeResetReport> SerializeSettingsReportToProto(
+ const ResettableSettingsSnapshot& snapshot,
+ int field_mask);
+
// Sends |report| as a feedback. |report| is supposed to be result of
// SerializeSettingsReport().
void SendSettingsFeedback(const std::string& report,
Profile* profile);
+// Sends |report| as a feedback. |report| is supposed to be result of
+// SerializeSettingsReportToProto().
+void SendSettingsFeedbackProto(const reset_report::ChromeResetReport& report,
+ Profile* profile);
+
// Returns list of key/value pairs for all available reported information
// from the |profile| and some additional fields.
scoped_ptr<base::ListValue> GetReadableFeedbackForSnapshot(
diff --git a/chrome/browser/ui/webui/options/reset_profile_settings_handler.cc b/chrome/browser/ui/webui/options/reset_profile_settings_handler.cc
index 98143dd..b3ef573 100644
--- a/chrome/browser/ui/webui/options/reset_profile_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/reset_profile_settings_handler.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/google/google_brand.h"
#include "chrome/browser/profile_resetter/brandcode_config_fetcher.h"
#include "chrome/browser/profile_resetter/brandcoded_default_settings.h"
+#include "chrome/browser/profile_resetter/profile_reset_report.pb.h"
#include "chrome/browser/profile_resetter/profile_resetter.h"
#include "chrome/browser/profile_resetter/resettable_settings_snapshot.h"
#include "chrome/browser/profiles/profile.h"
@@ -149,6 +150,12 @@ void ResetProfileSettingsHandler::OnResetProfileSettingsDone(
std::string report = SerializeSettingsReport(*setting_snapshot_,
difference);
SendSettingsFeedback(report, profile);
+
+ // Send the same report as a protobuf to a different endpoint.
+ scoped_ptr<reset_report::ChromeResetReport> report_proto =
+ SerializeSettingsReportToProto(*setting_snapshot_, difference);
+ if (report_proto)
+ SendSettingsFeedbackProto(*report_proto, profile);
}
}
setting_snapshot_.reset();
diff --git a/chrome/browser/ui/webui/settings/reset_settings_handler.cc b/chrome/browser/ui/webui/settings/reset_settings_handler.cc
index df5b272..f901606 100644
--- a/chrome/browser/ui/webui/settings/reset_settings_handler.cc
+++ b/chrome/browser/ui/webui/settings/reset_settings_handler.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/google/google_brand.h"
#include "chrome/browser/profile_resetter/brandcode_config_fetcher.h"
#include "chrome/browser/profile_resetter/brandcoded_default_settings.h"
+#include "chrome/browser/profile_resetter/profile_reset_report.pb.h"
#include "chrome/browser/profile_resetter/profile_resetter.h"
#include "chrome/browser/profile_resetter/resettable_settings_snapshot.h"
#include "chrome/browser/profiles/profile.h"
@@ -119,6 +120,12 @@ void ResetSettingsHandler::OnResetProfileSettingsDone(
std::string report = SerializeSettingsReport(*setting_snapshot_,
difference);
SendSettingsFeedback(report, profile_);
+
+ // Send the same report as a protobuf to a different endpoint.
+ scoped_ptr<reset_report::ChromeResetReport> report_proto =
+ SerializeSettingsReportToProto(*setting_snapshot_, difference);
+ if (report_proto)
+ SendSettingsFeedbackProto(*report_proto, profile_);
}
}
setting_snapshot_.reset();
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index f5df7a0..b68fca0 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1286,6 +1286,10 @@
'browser/profile_resetter/brandcoded_default_settings.h',
'browser/profile_resetter/profile_resetter.cc',
'browser/profile_resetter/profile_resetter.h',
+ 'browser/profile_resetter/reset_report_uploader.cc',
+ 'browser/profile_resetter/reset_report_uploader.h',
+ 'browser/profile_resetter/reset_report_uploader_factory.cc',
+ 'browser/profile_resetter/reset_report_uploader_factory.h',
'browser/profile_resetter/resettable_settings_snapshot.cc',
'browser/profile_resetter/resettable_settings_snapshot.h',
'browser/profile_resetter/triggered_profile_resetter.cc',
@@ -3697,6 +3701,7 @@
'dependencies': [
'../components/components.gyp:feedback_component',
'../net/net.gyp:net_browser_services',
+ 'profile_reset_report_proto',
]
}],
['OS=="android"', {
@@ -3988,6 +3993,19 @@
},
'includes': [ '../build/protoc.gypi' ],
},
+ {
+ # Protobuf compiler / generator for reset reports
+ # protocol buffer.
+ # GN version: //chrome/browser/profile_resetter:profile_reset_report_proto
+ 'target_name': 'profile_reset_report_proto',
+ 'type': 'static_library',
+ 'sources': [ 'browser/profile_resetter/profile_reset_report.proto' ],
+ 'variables': {
+ 'proto_in_dir': 'browser/profile_resetter',
+ 'proto_out_dir': 'chrome/browser/profile_resetter',
+ },
+ 'includes': [ '../build/protoc.gypi' ]
+ },
],
'conditions': [
['android_java_ui == 1', {