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

Unified Diff: chrome/browser/ui/views/extensions/disabled_extensions_view.cc

Issue 11232060: Make sure sideload wipeout doesn't interfere with the tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 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/ui/views/extensions/disabled_extensions_view.cc
===================================================================
--- chrome/browser/ui/views/extensions/disabled_extensions_view.cc (revision 163351)
+++ chrome/browser/ui/views/extensions/disabled_extensions_view.cc (working copy)
@@ -9,9 +9,12 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/singleton_tabs.h"
+#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/extensions/feature_switch.h"
+#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/user_metrics.h"
#include "grit/generated_resources.h"
@@ -43,6 +46,9 @@
const int kHeadlineRowPadding = 10;
const int kMessageBubblePadding = 11;
+// How often to show the disabled extension (sideload wipeout) bubble.
+const int kShowSideloadWipeoutBubbleMax = 3;
+
// How many extensions to show in the bubble (max).
const int kMaxExtensionsToShow = 7;
@@ -52,22 +58,33 @@
// DisabledExtensionsView
// static
-bool DisabledExtensionsView::MaybeShow(Browser* browser,
+void DisabledExtensionsView::MaybeShow(Browser* browser,
views::View* anchor_view) {
#if !defined(OS_WIN)
Aaron Boodman 2012/10/23 15:20:20 Shouldn't be necessary anymore, right?
- // We are targeting registry-installed extensions, which is Windows-specific,
+ // We are targeting registry-installed extensions, which are Windows-specific,
// and extensions marked internal and not from the web store, which are mostly
// problematic on Windows.
- return false;
+ return;
#endif
if (!extensions::FeatureSwitch::sideload_wipeout()->IsEnabled())
- return false;
+ return;
static bool done_showing_ui = false;
if (done_showing_ui)
- return false; // Only show the bubble once per launch.
+ return; // Only show the bubble once per launch.
+ // A pref that counts how often the bubble has been shown.
+ IntegerPrefMember sideload_wipeout_bubble_shown;
+
+ sideload_wipeout_bubble_shown.Init(
+ prefs::kExtensionsSideloadWipeoutBubbleShown,
+ browser->profile()->GetPrefs(), NULL);
+ int bubble_shown_count = sideload_wipeout_bubble_shown.GetValue();
+ if (bubble_shown_count >= kShowSideloadWipeoutBubbleMax)
+ return;
+ sideload_wipeout_bubble_shown.SetValue(++bubble_shown_count);
+
// Fetch all disabled extensions.
ExtensionService* extension_service =
extensions::ExtensionSystem::Get(
@@ -82,10 +99,7 @@
bubble_delegate->StartFade(true);
done_showing_ui = true;
- return true;
}
-
- return false;
}
DisabledExtensionsView::DisabledExtensionsView(
@@ -123,7 +137,11 @@
} else if (sender == dismiss_button_) {
content::RecordAction(UserMetricsAction("DisabledExtension_Dismiss"));
- // No action required. Close will happen below.
+ IntegerPrefMember sideload_wipeout_bubble_shown;
Aaron Boodman 2012/10/23 15:23:38 I think that it's only supposed to be shown once,
Finnur 2012/10/23 15:43:10 That makes sense for the buttons, but I'm not as s
Peter Ludwig 2012/10/23 16:11:01 It's fine for the bubble to dismiss (and to never
Finnur 2012/10/23 16:55:44 Sounds good.
+ sideload_wipeout_bubble_shown.Init(
+ prefs::kExtensionsSideloadWipeoutBubbleShown,
+ browser_->profile()->GetPrefs(), NULL);
+ sideload_wipeout_bubble_shown.SetValue(kShowSideloadWipeoutBubbleMax);
} else {
NOTREACHED();
}

Powered by Google App Engine
This is Rietveld 408576698