Commit 2b3b6552 authored by mad's avatar mad Committed by Commit bot

Offer to download the Software removal tool when the sw_reporter component...

Offer to download the Software removal tool when the sw_reporter component found something that it can handle.

For chrome/app/chrome_command_ids.h
TBR=cpu@chromium.org

BUG=416582

Review URL: https://codereview.chromium.org/599653002

Cr-Commit-Position: refs/heads/master@{#296594}
parent b47947f8
......@@ -213,6 +213,7 @@
#define IDC_DISTILL_PAGE 40244
#define IDC_HELP_MENU 40245
#define IDC_EXTENSIONS_OVERFLOW_MENU 40246
#define IDC_SHOW_SRT_BUBBLE 40247
// Spell-check
// Insert any additional suggestions before _LAST; these have to be consecutive.
......
......@@ -905,6 +905,25 @@ Signing in anyway will merge Chromium information like bookmarks, history, and o
</message>
</if>
<!-- SRT bubble messages -->
<if expr="is_win">
<if expr="use_titlecase">
<message name="IDS_SRT_MENU_ITEM" desc="In Title Case: Text for the Chrome menu option replacing Update required.">
Chromium Behaving Strangely?
</message>
</if>
<if expr="not use_titlecase">
<message name="IDS_SRT_MENU_ITEM" desc="Text for the Chrome menu option replacing Update required.">
Chromium behaving strangely?
</message>
</if>
<message name="IDS_SRT_BUBBLE_TITLE" desc="Text for the title of the software removal tool bubble view.">
Chromium behaving strangely?
</message>
<message name="IDS_SRT_BUBBLE_TEXT" desc="Text for the software removal tool bubble view full description.">
Chromium detected that your browser settings may have been changed by a program on your computer without your knowledge. You can use Google's Software Removal Tool to remove that program.
</message>
</if>
<!-- Sync/sign-in error messages -->
<if expr="not chromeos">
<message name="IDS_SYNC_PASSPHRASE_ERROR_BUBBLE_VIEW_MESSAGE" desc="Message in the sync error bubble view when the user needs to update their sync passphrase.">
......
......@@ -8065,6 +8065,11 @@ Keep your key file in a safe place. You will need it to create new versions of y
Help make Google Chrome better by reporting the current settings
</message>
<!-- SRT bubble messages -->
<message name="IDS_SRT_BUBBLE_DOWNLOAD_BUTTON_TEXT" desc="Download button of the software removal tool bubble">
Get the Software Removal Tool
</message>
<!-- Upgrade bubble messages -->
<message name="IDS_REENABLE_UPDATES" desc="Text for the button the user clicks to re-enable automatic updates.">
Enable autoupdate
......
......@@ -829,6 +829,25 @@ Signing in anyway will merge Chrome information like bookmarks, history, and oth
</message>
</if>
<!-- SRT bubble messages -->
<if expr="is_win">
<if expr="use_titlecase">
<message name="IDS_SRT_MENU_ITEM" desc="In Title Case: Text for the Chrome menu option replacing Update required.">
Chrome Behaving Strangely?
</message>
</if>
<if expr="not use_titlecase">
<message name="IDS_SRT_MENU_ITEM" desc="Text for the Chrome menu option replacing Update required.">
Chrome behaving strangely?
</message>
</if>
<message name="IDS_SRT_BUBBLE_TITLE" desc="Text for the title of the software removal tool bubble view.">
Chrome behaving strangely?
</message>
<message name="IDS_SRT_BUBBLE_TEXT" desc="Text for the software removal tool bubble view full description.">
Chrome detected that your browser settings may have been changed by a program on your computer without your knowledge. You can use Google's Software Removal Tool to remove that program.
</message>
</if>
<!-- Sync/sign-in error messages -->
<if expr="not chromeos">
<message name="IDS_SYNC_PASSPHRASE_ERROR_BUBBLE_VIEW_MESSAGE" desc="Message in the sync error bubble view when the user needs to update their sync passphrase.">
......
......@@ -8,6 +8,10 @@
class PrefRegistrySimple;
class PrefService;
namespace user_prefs {
class PrefRegistrySyncable;
}
namespace component_updater {
class ComponentUpdateService;
......@@ -17,9 +21,13 @@ class ComponentUpdateService;
void RegisterSwReporterComponent(ComponentUpdateService* cus,
PrefService* prefs);
// Register user preferences related to the SwReporter.
// Register local state preferences related to the SwReporter.
void RegisterPrefsForSwReporter(PrefRegistrySimple* registry);
// Register profile preferences related to the SwReporter.
void RegisterProfilePrefsForSwReporter(
user_prefs::PrefRegistrySyncable* registry);
} // namespace component_updater
#endif // CHROME_BROWSER_COMPONENT_UPDATER_SW_REPORTER_INSTALLER_WIN_H_
......@@ -484,6 +484,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
#endif
#if defined(OS_WIN)
component_updater::RegisterProfilePrefsForSwReporter(registry);
NetworkProfileBubble::RegisterProfilePrefs(registry);
#endif
......
......@@ -41,6 +41,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/component_updater/pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/search_engines/default_search_manager.h"
#include "components/search_engines/search_engines_pref_names.h"
......@@ -154,9 +155,9 @@ const PrefHashFilter::TrackedPreferenceMetadata kTrackedPrefs[] = {
PrefHashFilter::TRACKING_STRATEGY_ATOMIC
},
{
13, prefs::kProfileResetPromptMementoInProfilePrefs,
PrefHashFilter::ENFORCE_ON_LOAD,
PrefHashFilter::TRACKING_STRATEGY_ATOMIC
13, prefs::kProfileResetPromptMementoInProfilePrefs,
PrefHashFilter::ENFORCE_ON_LOAD,
PrefHashFilter::TRACKING_STRATEGY_ATOMIC
},
#endif
{
......@@ -194,6 +195,18 @@ const PrefHashFilter::TrackedPreferenceMetadata kTrackedPrefs[] = {
PrefHashFilter::ENFORCE_ON_LOAD,
PrefHashFilter::TRACKING_STRATEGY_ATOMIC
},
#if defined(OS_WIN)
{
19, prefs::kSwReporterPromptVersion,
PrefHashFilter::ENFORCE_ON_LOAD,
PrefHashFilter::TRACKING_STRATEGY_ATOMIC
},
{
20, prefs::kSwReporterPromptReason,
PrefHashFilter::ENFORCE_ON_LOAD,
PrefHashFilter::TRACKING_STRATEGY_ATOMIC
},
#endif
};
// One more than the last tracked preferences ID above.
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/safe_browsing/srt_global_error_win.h"
#include "base/callback.h"
#include "base/metrics/histogram.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/global_error/global_error_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/google_chrome_strings.h"
#include "ui/base/l10n/l10n_util.h"
namespace {
// The download link of the Software Removal Tool.
// TODO(mad): Should we only have the bubble show up on official Chrome build?
const char kSRTDownloadURL[] = "https://www.google.com/chrome/srt/";
// Enum values for the SRTPrompt histogram. Don't change order, always add
// to the end, before SRT_PROMPT_MAX, of course.
enum SRTPromptHistogramValue {
SRT_PROMPT_SHOWN = 0,
SRT_PROMPT_ACCEPTED = 1,
SRT_PROMPT_DENIED = 2,
SRT_PROMPT_MAX,
};
void RecordSRTPromptHistogram(SRTPromptHistogramValue value) {
UMA_HISTOGRAM_ENUMERATION("SRTPrompt", value, SRT_PROMPT_MAX);
}
} // namespace
// SRTGlobalError ------------------------------------------------------------
SRTGlobalError::SRTGlobalError(GlobalErrorService* global_error_service)
: global_error_service_(global_error_service) {
DCHECK(global_error_service_);
}
SRTGlobalError::~SRTGlobalError() {
}
bool SRTGlobalError::HasMenuItem() {
return true;
}
int SRTGlobalError::MenuItemCommandID() {
return IDC_SHOW_SRT_BUBBLE;
}
base::string16 SRTGlobalError::MenuItemLabel() {
return l10n_util::GetStringUTF16(IDS_SRT_MENU_ITEM);
}
void SRTGlobalError::ExecuteMenuItem(Browser* browser) {
// The menu item should never get executed while the bubble is shown, unless
// we eventually change it to NOT close on deactivate.
DCHECK(ShouldCloseOnDeactivate());
DCHECK(GetBubbleView() == NULL);
ShowBubbleView(browser);
}
void SRTGlobalError::ShowBubbleView(Browser* browser) {
RecordSRTPromptHistogram(SRT_PROMPT_SHOWN);
GlobalErrorWithStandardBubble::ShowBubbleView(browser);
}
base::string16 SRTGlobalError::GetBubbleViewTitle() {
return l10n_util::GetStringUTF16(IDS_SRT_BUBBLE_TITLE);
}
std::vector<base::string16> SRTGlobalError::GetBubbleViewMessages() {
std::vector<base::string16> messages;
messages.push_back(l10n_util::GetStringUTF16(IDS_SRT_BUBBLE_TEXT));
return messages;
}
base::string16 SRTGlobalError::GetBubbleViewAcceptButtonLabel() {
return l10n_util::GetStringUTF16(IDS_SRT_BUBBLE_DOWNLOAD_BUTTON_TEXT);
}
base::string16 SRTGlobalError::GetBubbleViewCancelButtonLabel() {
return l10n_util::GetStringUTF16(IDS_NO_THANKS);
}
void SRTGlobalError::OnBubbleViewDidClose(Browser* browser) {
}
void SRTGlobalError::BubbleViewAcceptButtonPressed(Browser* browser) {
RecordSRTPromptHistogram(SRT_PROMPT_ACCEPTED);
browser->OpenURL(content::OpenURLParams(GURL(kSRTDownloadURL),
content::Referrer(),
NEW_FOREGROUND_TAB,
ui::PAGE_TRANSITION_LINK,
false));
DismissGlobalError();
}
void SRTGlobalError::BubbleViewCancelButtonPressed(Browser* browser) {
RecordSRTPromptHistogram(SRT_PROMPT_DENIED);
DismissGlobalError();
}
void SRTGlobalError::DismissGlobalError() {
global_error_service_->RemoveGlobalError(this);
delete this;
}
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SAFE_BROWSING_SRT_GLOBAL_ERROR_WIN_H_
#define CHROME_BROWSER_SAFE_BROWSING_SRT_GLOBAL_ERROR_WIN_H_
#include <vector>
#include "base/basictypes.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/ui/global_error/global_error.h"
class GlobalErrorBubbleViewBase;
class GlobalErrorService;
// Encapsulates UI-related functionality for the software removal tool (SRT)
// prompt. The UI consists of two parts: (1.) the profile reset (pop-up) bubble,
// and (2.) a menu item in the wrench menu (provided by being a GlobalError).
class SRTGlobalError : public GlobalErrorWithStandardBubble,
public base::SupportsWeakPtr<SRTGlobalError> {
public:
explicit SRTGlobalError(GlobalErrorService* global_error_service);
virtual ~SRTGlobalError();
// GlobalError:
virtual bool HasMenuItem() OVERRIDE;
virtual int MenuItemCommandID() OVERRIDE;
virtual base::string16 MenuItemLabel() OVERRIDE;
virtual void ExecuteMenuItem(Browser* browser) OVERRIDE;
virtual void ShowBubbleView(Browser* browser) OVERRIDE;
// GlobalErrorWithStandardBubble.
virtual base::string16 GetBubbleViewTitle() OVERRIDE;
virtual std::vector<base::string16> GetBubbleViewMessages() OVERRIDE;
virtual base::string16 GetBubbleViewAcceptButtonLabel() OVERRIDE;
virtual base::string16 GetBubbleViewCancelButtonLabel() OVERRIDE;
virtual void OnBubbleViewDidClose(Browser* browser) OVERRIDE;
virtual void BubbleViewAcceptButtonPressed(Browser* browser) OVERRIDE;
virtual void BubbleViewCancelButtonPressed(Browser* browser) OVERRIDE;
private:
// When the user took action, the GlobalError can be dismissed.
void DismissGlobalError();
// Used to dismiss the GlobalError, then set to NULL.
GlobalErrorService* global_error_service_;
DISALLOW_COPY_AND_ASSIGN(SRTGlobalError);
};
#endif // CHROME_BROWSER_SAFE_BROWSING_SRT_GLOBAL_ERROR_WIN_H_
......@@ -767,7 +767,7 @@
'browser/net/quota_policy_channel_id_store.h',
'browser/net/referrer.cc',
'browser/net/referrer.h',
'browser/net/resource_prefetch_predictor_observer.cc',
'browser/net/resource_prefetch_predictor_observer.cc',
'browser/net/resource_prefetch_predictor_observer.h',
'browser/net/safe_search_util.cc',
'browser/net/safe_search_util.h',
......@@ -840,19 +840,19 @@
'browser/predictors/predictor_database_factory.h',
'browser/predictors/predictor_table_base.cc',
'browser/predictors/predictor_table_base.h',
'browser/predictors/resource_prefetch_common.cc',
'browser/predictors/resource_prefetch_common.h',
'browser/predictors/resource_prefetch_predictor.cc',
'browser/predictors/resource_prefetch_predictor.h',
'browser/predictors/resource_prefetch_predictor_factory.cc',
'browser/predictors/resource_prefetch_predictor_factory.h',
'browser/predictors/resource_prefetch_predictor_tab_helper.cc',
'browser/predictors/resource_prefetch_predictor_tab_helper.h',
'browser/predictors/resource_prefetch_predictor_tables.cc',
'browser/predictors/resource_prefetch_predictor_tables.h',
'browser/predictors/resource_prefetcher.cc',
'browser/predictors/resource_prefetcher.h',
'browser/predictors/resource_prefetcher_manager.cc',
'browser/predictors/resource_prefetch_common.cc',
'browser/predictors/resource_prefetch_common.h',
'browser/predictors/resource_prefetch_predictor.cc',
'browser/predictors/resource_prefetch_predictor.h',
'browser/predictors/resource_prefetch_predictor_factory.cc',
'browser/predictors/resource_prefetch_predictor_factory.h',
'browser/predictors/resource_prefetch_predictor_tab_helper.cc',
'browser/predictors/resource_prefetch_predictor_tab_helper.h',
'browser/predictors/resource_prefetch_predictor_tables.cc',
'browser/predictors/resource_prefetch_predictor_tables.h',
'browser/predictors/resource_prefetcher.cc',
'browser/predictors/resource_prefetcher.h',
'browser/predictors/resource_prefetcher_manager.cc',
'browser/predictors/resource_prefetcher_manager.h',
'browser/pref_service_flags_storage.cc',
'browser/pref_service_flags_storage.h',
......@@ -1054,6 +1054,8 @@
'browser/resources_util.h',
'browser/safe_browsing/safe_browsing_tab_observer.cc',
'browser/safe_browsing/safe_browsing_tab_observer.h',
'browser/safe_browsing/srt_global_error_win.cc',
'browser/safe_browsing/srt_global_error_win.h',
'browser/search/contextual_search_promo_source_android.cc',
'browser/search/contextual_search_promo_source_android.h',
'browser/search/iframe_source.cc',
......@@ -1069,7 +1071,7 @@
'browser/search/local_ntp_source.cc',
'browser/search/local_ntp_source.h',
'browser/search/most_visited_iframe_source.cc',
'browser/search/most_visited_iframe_source.h',
'browser/searuch/most_visited_iframe_source.h',
'browser/search/search.cc',
'browser/search/search.h',
'browser/search/suggestions/image_manager_impl.cc',
......
......@@ -11,9 +11,23 @@ namespace prefs {
const char kRecoveryComponentVersion[] = "recovery_component.version";
#if defined(OS_WIN)
// The last time SwReporter was triggered.
// The last exit code integer value returned by the SwReporter. Saved in local
// state.
const char kSwReporterLastExitCode[] = "software_reporter.last_exit_code";
// The last time SwReporter was triggered. Saved in local state.
const char kSwReporterLastTimeTriggered[] =
"software_reporter.last_time_triggered";
// The exit code integer value of the reporter run that triggered an SRT prompt.
// Stored in the protected prefs of the profile that owns the browser where the
// prompt was shown.
const char kSwReporterPromptReason[] = "software_reporter.prompt_reason";
// The version string of the reporter that triggered an SRT prompt. An empty
// string when the prompt wasn't shown yet. Stored in the protected prefs of the
// profile that owns the browser where the prompt was shown.
const char kSwReporterPromptVersion[] = "software_reporter.prompt_version";
#endif
} // namespace prefs
......@@ -12,7 +12,13 @@ namespace prefs {
extern const char kRecoveryComponentVersion[];
#if defined(OS_WIN)
// Local state prefs.
extern const char kSwReporterLastExitCode[];
extern const char kSwReporterLastTimeTriggered[];
// Profile prefs.
extern const char kSwReporterPromptReason[];
extern const char kSwReporterPromptVersion[];
#endif
} // namespace prefs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment