Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1046)

Unified Diff: chrome/browser/profile_resetter/profile_resetter.cc

Issue 333193002: Adding a SW reporter component updater (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to ToT. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profile_resetter/profile_resetter.cc
diff --git a/chrome/browser/profile_resetter/profile_resetter.cc b/chrome/browser/profile_resetter/profile_resetter.cc
index d37e61c882cdce46253696a2b1549b2a94f2dd26..17f451f7d1c3a0c2099860ac1ebc94513079c275 100644
--- a/chrome/browser/profile_resetter/profile_resetter.cc
+++ b/chrome/browser/profile_resetter/profile_resetter.cc
@@ -4,9 +4,12 @@
#include "chrome/browser/profile_resetter/profile_resetter.h"
+#include <string>
+
#include "base/prefs/pref_service.h"
#include "base/prefs/scoped_user_pref_update.h"
#include "base/synchronization/cancellation_flag.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/browsing_data/browsing_data_helper.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -30,8 +33,8 @@
#if defined(OS_WIN)
#include "base/base_paths.h"
#include "base/path_service.h"
+#include "chrome/browser/component_updater/sw_reporter_installer_win.h"
#include "chrome/installer/util/shell_util.h"
-#include "content/public/browser/browser_thread.h"
namespace {
@@ -77,6 +80,7 @@ ProfileResetter::~ProfileResetter() {
void ProfileResetter::Reset(
ProfileResetter::ResettableFlags resettable_flags,
scoped_ptr<BrandcodedDefaultSettings> master_settings,
+ bool accepted_send_feedback,
const base::Closure& callback) {
DCHECK(CalledOnValidThread());
DCHECK(master_settings);
@@ -102,16 +106,16 @@ void ProfileResetter::Reset(
struct {
Resettable flag;
void (ProfileResetter::*method)();
- } flagToMethod [] = {
- { DEFAULT_SEARCH_ENGINE, &ProfileResetter::ResetDefaultSearchEngine },
- { HOMEPAGE, &ProfileResetter::ResetHomepage },
- { CONTENT_SETTINGS, &ProfileResetter::ResetContentSettings },
- { COOKIES_AND_SITE_DATA, &ProfileResetter::ResetCookiesAndSiteData },
- { EXTENSIONS, &ProfileResetter::ResetExtensions },
- { STARTUP_PAGES, &ProfileResetter::ResetStartupPages },
- { PINNED_TABS, &ProfileResetter::ResetPinnedTabs },
- { SHORTCUTS, &ProfileResetter::ResetShortcuts },
- };
+ } flagToMethod[] = {
+ {DEFAULT_SEARCH_ENGINE, &ProfileResetter::ResetDefaultSearchEngine},
+ {HOMEPAGE, &ProfileResetter::ResetHomepage},
+ {CONTENT_SETTINGS, &ProfileResetter::ResetContentSettings},
+ {COOKIES_AND_SITE_DATA, &ProfileResetter::ResetCookiesAndSiteData},
+ {EXTENSIONS, &ProfileResetter::ResetExtensions},
+ {STARTUP_PAGES, &ProfileResetter::ResetStartupPages},
+ {PINNED_TABS, &ProfileResetter::ResetPinnedTabs},
+ {SHORTCUTS, &ProfileResetter::ResetShortcuts},
+ };
ResettableFlags reset_triggered_for_flags = 0;
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(flagToMethod); ++i) {
@@ -121,6 +125,20 @@ void ProfileResetter::Reset(
}
}
+// When the user resets any of their settings on Windows and agreed to sending
+// feedback, run the software reporter tool to see if it could find the reason
+// why the user wanted a reset.
+#if defined(OS_WIN)
+ // The browser process and / or local_state can be NULL when running tests.
+ if (accepted_send_feedback && g_browser_process &&
+ g_browser_process->local_state() &&
+ g_browser_process->local_state()->GetBoolean(
+ prefs::kMetricsReportingEnabled)) {
+ ExecuteSwReporter(g_browser_process->component_updater(),
+ g_browser_process->local_state());
+ }
+#endif
+
DCHECK_EQ(resettable_flags, reset_triggered_for_flags);
}
« no previous file with comments | « chrome/browser/profile_resetter/profile_resetter.h ('k') | chrome/browser/profile_resetter/profile_resetter_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698