Skip to content

Commit

Permalink
Make sure we don't trigger the incompatibility badge if the flag is t…
Browse files Browse the repository at this point in the history
…urned off when the user navigates to about:conflicts and finds a conflict.

Also, record an event when we show the incompatibilities badge to the user so we can find out how often this occurs in the field.

BUG=None
TEST=None

Review URL: http://codereview.chromium.org/6061011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70751 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
finnur@chromium.org committed Jan 7, 2011
1 parent cbf0e0a commit cfa4336
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
31 changes: 20 additions & 11 deletions chrome/browser/enumerate_modules_model_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -842,19 +842,28 @@ void EnumerateModulesModel::DoneScanning() {
HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules",
confirmed_bad_modules_detected_);

if (!limited_mode_) {
// Notifications are not available in limited mode.
if (limited_mode_)
return;

NotificationService::current()->Notify(
NotificationType::MODULE_LIST_ENUMERATED,
Source<EnumerateModulesModel>(this),
NotificationService::NoDetails());

// Command line flag must be enabled for the notification to get sent out.
// Otherwise we'd get the badge (while the feature is disabled) when we
// navigate to about:conflicts and find confirmed matches.
const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
if (!cmd_line.HasSwitch(switches::kConflictingModulesCheck))
return;

if (suspected_bad_modules_detected_ || confirmed_bad_modules_detected_) {
bool found_confirmed_bad_modules = confirmed_bad_modules_detected_ > 0;
NotificationService::current()->Notify(
NotificationType::MODULE_LIST_ENUMERATED,
NotificationType::MODULE_INCOMPATIBILITY_DETECTED,
Source<EnumerateModulesModel>(this),
NotificationService::NoDetails());

if (suspected_bad_modules_detected_ || confirmed_bad_modules_detected_) {
bool found_confirmed_bad_modules = confirmed_bad_modules_detected_ > 0;
NotificationService::current()->Notify(
NotificationType::MODULE_INCOMPATIBILITY_DETECTED,
Source<EnumerateModulesModel>(this),
Details<bool>(&found_confirmed_bad_modules));
}
Details<bool>(&found_confirmed_bad_modules));
}
}

Expand Down
13 changes: 13 additions & 0 deletions chrome/browser/ui/views/toolbar_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/accessibility/browser_accessibility_state.h"
#include "chrome/browser/background_page_tracker.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/themes/browser_theme_provider.h"
Expand Down Expand Up @@ -732,6 +733,15 @@ SkBitmap ToolbarView::GetAppMenuIcon(views::CustomButton::ButtonState state) {
}
SkBitmap icon = *tp->GetBitmapNamed(id);

#if defined(OS_WIN)
// Keep track of whether we were showing the badge before, so we don't send
// multiple UMA events for example when multiple Chrome windows are open.
static bool incompatibility_badge_showing = false;
// Save the old value before resetting it.
bool was_showing = incompatibility_badge_showing;
incompatibility_badge_showing = false;
#endif

bool add_badge = IsUpgradeRecommended() ||
ShouldShowIncompatibilityWarning() ||
ShouldShowBackgroundPageBadge();
Expand All @@ -753,7 +763,10 @@ SkBitmap ToolbarView::GetAppMenuIcon(views::CustomButton::ButtonState state) {
badge = *tp->GetBitmapNamed(IDR_BACKGROUND_BADGE);
} else if (ShouldShowIncompatibilityWarning()) {
#if defined(OS_WIN)
if (!was_showing)
UserMetrics::RecordAction(UserMetricsAction("ConflictBadge"), profile_);
badge = *tp->GetBitmapNamed(IDR_CONFLICT_BADGE);
incompatibility_badge_showing = true;
#else
NOTREACHED();
#endif
Expand Down

0 comments on commit cfa4336

Please sign in to comment.