summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbattre <battre@chromium.org>2016-02-02 12:23:47 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-02 20:25:52 +0000
commit49b301af778077ee4ef3c5178bf07d491a349141 (patch)
tree426c5ede7d26f6c7c9d075d33fb37f860199fc31
parent1d2028928dd25de5b9bc8a4b552cf2fd03f78e2f (diff)
downloadchromium_src-49b301af778077ee4ef3c5178bf07d491a349141.zip
chromium_src-49b301af778077ee4ef3c5178bf07d491a349141.tar.gz
chromium_src-49b301af778077ee4ef3c5178bf07d491a349141.tar.bz2
Disable sending reset reports to Google Feedback
BUG=235037 TBR=bauerb@chromium.org Review URL: https://codereview.chromium.org/1659063003 Cr-Commit-Position: refs/heads/master@{#373019}
-rw-r--r--chrome/browser/profile_resetter/profile_resetter_unittest.cc69
-rw-r--r--chrome/browser/profile_resetter/resettable_settings_snapshot.cc96
-rw-r--r--chrome/browser/profile_resetter/resettable_settings_snapshot.h10
-rw-r--r--chrome/browser/ui/webui/options/reset_profile_settings_handler.cc5
-rw-r--r--chrome/browser/ui/webui/settings/reset_settings_handler.cc5
5 files changed, 0 insertions, 185 deletions
diff --git a/chrome/browser/profile_resetter/profile_resetter_unittest.cc b/chrome/browser/profile_resetter/profile_resetter_unittest.cc
index 94ec478..7a34e6e 100644
--- a/chrome/browser/profile_resetter/profile_resetter_unittest.cc
+++ b/chrome/browser/profile_resetter/profile_resetter_unittest.cc
@@ -7,7 +7,6 @@
#include <stddef.h>
#include <utility>
-#include "base/json/json_string_value_serializer.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/utf_string_conversions.h"
@@ -914,74 +913,6 @@ TEST_F(ProfileResetterTest, CheckSnapshots) {
}
}
-TEST_F(ProfileResetterTest, FeedbackSerializationTest) {
- // 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) {
- std::string report = SerializeSettingsReport(nonorganic_snap, field_mask);
- JSONStringValueDeserializer json(report);
- std::string error;
- scoped_ptr<base::Value> root(json.Deserialize(NULL, &error));
- ASSERT_TRUE(root) << error;
- ASSERT_TRUE(root->IsType(base::Value::TYPE_DICTIONARY)) << error;
-
- base::DictionaryValue* dict =
- static_cast<base::DictionaryValue*>(root.get());
-
- base::ListValue* startup_urls = NULL;
- int startup_type = 0;
- std::string homepage;
- bool homepage_is_ntp = true;
- bool show_home_button = true;
- std::string default_search_engine;
- base::ListValue* extensions = NULL;
- base::ListValue* shortcuts = NULL;
-
- EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::STARTUP_MODE),
- dict->GetList("startup_urls", &startup_urls));
- EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::STARTUP_MODE),
- dict->GetInteger("startup_type", &startup_type));
- EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::HOMEPAGE),
- dict->GetString("homepage", &homepage));
- EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::HOMEPAGE),
- dict->GetBoolean("homepage_is_ntp", &homepage_is_ntp));
- EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::HOMEPAGE),
- dict->GetBoolean("show_home_button", &show_home_button));
- EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::DSE_URL),
- dict->GetString("default_search_engine", &default_search_engine));
- EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::EXTENSIONS),
- dict->GetList("enabled_extensions", &extensions));
- EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::SHORTCUTS),
- dict->GetList("shortcuts", &shortcuts));
- }
-}
-
TEST_F(ProfileResetterTest, FeedbackSerializationAsProtoTest) {
// Reset to non organic defaults.
ResetAndWait(ProfileResetter::DEFAULT_SEARCH_ENGINE |
diff --git a/chrome/browser/profile_resetter/resettable_settings_snapshot.cc b/chrome/browser/profile_resetter/resettable_settings_snapshot.cc
index 32444ff..42c0187 100644
--- a/chrome/browser/profile_resetter/resettable_settings_snapshot.cc
+++ b/chrome/browser/profile_resetter/resettable_settings_snapshot.cc
@@ -5,7 +5,6 @@
#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/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -22,8 +21,6 @@
#include "chrome/common/pref_names.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
-#include "components/feedback/feedback_data.h"
-#include "components/feedback/feedback_util.h"
#include "components/prefs/pref_service.h"
#include "components/search_engines/template_url_service.h"
#include "components/version_info/version_info.h"
@@ -32,24 +29,8 @@
#include "grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
-using feedback::FeedbackData;
-
namespace {
-// Feedback bucket label.
-const char kProfileResetWebUIBucket[] = "ProfileResetReport";
-
-// Dictionary keys for feedback report.
-const char kDefaultSearchEnginePath[] = "default_search_engine";
-const char kEnabledExtensions[] = "enabled_extensions";
-const char kHomepageIsNewTabPage[] = "homepage_is_ntp";
-const char kHomepagePath[] = "homepage";
-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,
const base::string16& key,
@@ -170,68 +151,6 @@ void ResettableSettingsSnapshot::SetShortcutsAndReport(
callback.Run();
}
-std::string SerializeSettingsReport(const ResettableSettingsSnapshot& snapshot,
- int field_mask) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::DictionaryValue dict;
-
- if (field_mask & ResettableSettingsSnapshot::STARTUP_MODE) {
- base::ListValue* list = new base::ListValue;
- const std::vector<GURL>& urls = snapshot.startup_urls();
- for (std::vector<GURL>::const_iterator i = urls.begin();
- i != urls.end(); ++i)
- list->AppendString(i->spec());
- dict.Set(kStartupURLPath, list);
- dict.SetInteger(kStartupTypePath, snapshot.startup_type());
- }
-
- if (field_mask & ResettableSettingsSnapshot::HOMEPAGE) {
- dict.SetString(kHomepagePath, snapshot.homepage());
- dict.SetBoolean(kHomepageIsNewTabPage, snapshot.homepage_is_ntp());
- dict.SetBoolean(kShowHomeButton, snapshot.show_home_button());
- }
-
- if (field_mask & ResettableSettingsSnapshot::DSE_URL)
- dict.SetString(kDefaultSearchEnginePath, snapshot.dse_url());
-
- if (field_mask & ResettableSettingsSnapshot::EXTENSIONS) {
- base::ListValue* list = new base::ListValue;
- const ResettableSettingsSnapshot::ExtensionList& extensions =
- snapshot.enabled_extensions();
- for (ResettableSettingsSnapshot::ExtensionList::const_iterator i =
- extensions.begin(); i != extensions.end(); ++i) {
- // Replace "\"" to simplify server-side analysis.
- std::string ext_name;
- base::ReplaceChars(i->second, "\"", "\'", &ext_name);
- list->AppendString(i->first + ";" + ext_name);
- }
- dict.Set(kEnabledExtensions, list);
- }
-
- if (field_mask & ResettableSettingsSnapshot::SHORTCUTS) {
- base::ListValue* list = new base::ListValue;
- const std::vector<ShortcutCommand>& shortcuts = snapshot.shortcuts();
- for (std::vector<ShortcutCommand>::const_iterator i = shortcuts.begin();
- i != shortcuts.end(); ++i) {
- base::string16 arguments;
- // Replace "\"" to simplify server-side analysis.
- base::ReplaceChars(i->second, base::ASCIIToUTF16("\""),
- base::ASCIIToUTF16("\'"), &arguments);
- list->AppendString(arguments);
- }
- dict.Set(kShortcuts, list);
- }
-
- dict.SetString(kGuid, snapshot.guid());
-
- static_assert(ResettableSettingsSnapshot::ALL_FIELDS == 31,
- "new field needs to be serialized here");
-
- std::string json;
- base::JSONWriter::Write(dict, &json);
- return json;
-}
-
scoped_ptr<reset_report::ChromeResetReport> SerializeSettingsReportToProto(
const ResettableSettingsSnapshot& snapshot,
int field_mask) {
@@ -288,21 +207,6 @@ scoped_ptr<reset_report::ChromeResetReport> SerializeSettingsReportToProto(
return report;
}
-void SendSettingsFeedback(const std::string& report,
- Profile* profile) {
- scoped_refptr<FeedbackData> feedback_data = new FeedbackData();
- feedback_data->set_category_tag(kProfileResetWebUIBucket);
- feedback_data->set_description(report);
-
- feedback_data->set_image(make_scoped_ptr(new std::string));
- feedback_data->set_context(profile);
-
- feedback_data->set_page_url("");
- feedback_data->set_user_email("");
-
- feedback_util::SendReport(feedback_data);
-}
-
void SendSettingsFeedbackProto(const reset_report::ChromeResetReport& report,
Profile* profile) {
ResetReportUploaderFactory::GetForBrowserContext(profile)
diff --git a/chrome/browser/profile_resetter/resettable_settings_snapshot.h b/chrome/browser/profile_resetter/resettable_settings_snapshot.h
index 55d78dd..fecaa4b 100644
--- a/chrome/browser/profile_resetter/resettable_settings_snapshot.h
+++ b/chrome/browser/profile_resetter/resettable_settings_snapshot.h
@@ -123,11 +123,6 @@ class ResettableSettingsSnapshot {
DISALLOW_COPY_AND_ASSIGN(ResettableSettingsSnapshot);
};
-// Serializes specified |snapshot| members to JSON format. |field_mask| is a bit
-// mask of ResettableSettingsSnapshot::Field values.
-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(
@@ -135,11 +130,6 @@ scoped_ptr<reset_report::ChromeResetReport> SerializeSettingsReportToProto(
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);
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 4a33b1f..17c2474 100644
--- a/chrome/browser/ui/webui/options/reset_profile_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/reset_profile_settings_handler.cc
@@ -151,11 +151,6 @@ void ResetProfileSettingsHandler::OnResetProfileSettingsDone(
int difference = setting_snapshot_->FindDifferentFields(current_snapshot);
if (difference) {
setting_snapshot_->Subtract(current_snapshot);
- 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)
diff --git a/chrome/browser/ui/webui/settings/reset_settings_handler.cc b/chrome/browser/ui/webui/settings/reset_settings_handler.cc
index 9a6e28f..84e3243 100644
--- a/chrome/browser/ui/webui/settings/reset_settings_handler.cc
+++ b/chrome/browser/ui/webui/settings/reset_settings_handler.cc
@@ -135,11 +135,6 @@ void ResetSettingsHandler::OnResetProfileSettingsDone(
int difference = setting_snapshot_->FindDifferentFields(current_snapshot);
if (difference) {
setting_snapshot_->Subtract(current_snapshot);
- 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)