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

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

Issue 62193002: Integrate UI and reset logic into AutomaticProfileResetter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: First draft. Created 7 years, 1 month 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_reset_global_error.cc
diff --git a/chrome/browser/profile_resetter/profile_reset_global_error.cc b/chrome/browser/profile_resetter/profile_reset_global_error.cc
index 03c78c7bef8bf5a1c436b02af49980fc0bdd7532..2fcf0d0ab2488a87f8380171bd1a8418903fe53e 100644
--- a/chrome/browser/profile_resetter/profile_reset_global_error.cc
+++ b/chrome/browser/profile_resetter/profile_reset_global_error.cc
@@ -6,6 +6,12 @@
#include "base/metrics/histogram.h"
#include "chrome/app/chrome_command_ids.h"
+#include "chrome/browser/profile_resetter/automatic_profile_resetter.h"
+#include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/global_error/global_error_service.h"
+#include "chrome/browser/ui/global_error/global_error_service_factory.h"
#include "chrome/browser/ui/profile_reset_bubble.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -13,12 +19,8 @@
namespace {
-// The maximum number of ignored bubbles we track in the NumNoThanksPerReset
-// histogram.
-const int kMaxIgnored = 50;
-
-// The number of buckets we want the NumNoThanksPerReset histogram to use.
-const int kNumIgnoredBuckets = 5;
+const char kResetProfileSettingsURL[] =
+ "chrome://settings/resetProfileSettings";
} // namespace
@@ -26,7 +28,12 @@ const int kNumIgnoredBuckets = 5;
// ProfileResetGlobalError ---------------------------------------------------
ProfileResetGlobalError::ProfileResetGlobalError(Profile* profile)
- : profile_(profile), num_times_bubble_view_shown_(0), bubble_view_(NULL) {}
+ : profile_(profile), has_shown_bubble_view_(false), bubble_view_(NULL) {
+ AutomaticProfileResetter* automatic_profile_resetter =
+ AutomaticProfileResetterFactory::GetForBrowserContext(profile_);
+ DCHECK(automatic_profile_resetter);
+ automatic_profile_resetter_ = automatic_profile_resetter->AsWeakPtr();
+}
ProfileResetGlobalError::~ProfileResetGlobalError() {}
@@ -43,20 +50,26 @@ string16 ProfileResetGlobalError::MenuItemLabel() {
}
void ProfileResetGlobalError::ExecuteMenuItem(Browser* browser) {
- ShowBubbleView(browser);
+ browser->OpenURL(content::OpenURLParams(
+ GURL(kResetProfileSettingsURL), content::Referrer(),
+ NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false));
}
bool ProfileResetGlobalError::HasBubbleView() { return true; }
bool ProfileResetGlobalError::HasShownBubbleView() {
- return num_times_bubble_view_shown_ > 0;
+ return has_shown_bubble_view_;
}
void ProfileResetGlobalError::ShowBubbleView(Browser* browser) {
if (bubble_view_)
return;
- ++num_times_bubble_view_shown_;
+
+ has_shown_bubble_view_ = true;
bubble_view_ = ShowProfileResetBubble(AsWeakPtr(), browser);
+
+ if (automatic_profile_resetter_)
+ automatic_profile_resetter_->NotifyDidShowResetBubble();
}
void ProfileResetGlobalError::OnBubbleViewDidClose() {
@@ -65,16 +78,13 @@ void ProfileResetGlobalError::OnBubbleViewDidClose() {
void ProfileResetGlobalError::OnBubbleViewResetButtonPressed(
bool send_feedback) {
- // TODO(engedy): Integrate with the AutomaticProfileResetter.
- UMA_HISTOGRAM_CUSTOM_COUNTS("SettingsResetBubble.NumNoThanksPerReset",
- num_times_bubble_view_shown_ - 1,
- 0,
- kMaxIgnored,
- kNumIgnoredBuckets);
+ if (automatic_profile_resetter_)
+ automatic_profile_resetter_->TriggerProfileReset(send_feedback);
}
void ProfileResetGlobalError::OnBubbleViewNoThanksButtonPressed() {
- // TODO(engedy): Integrate with the AutomaticProfileResetter.
+ if (automatic_profile_resetter_)
+ automatic_profile_resetter_->SkipProfileReset();
}
GlobalErrorBubbleViewBase* ProfileResetGlobalError::GetBubbleView() {

Powered by Google App Engine
This is Rietveld 408576698