Commit 43f9004f authored by felt@chromium.org's avatar felt@chromium.org

Privacy policy links for extended safe browsing reporting

The extended safe browsing reporting opt-in should point to the whitepaper section on malware. This CL:
- Adds a "privacy policy" link to the dialog
- Updates the existing URL to point to the specific malware section instead of the generic privacy policy

BUG=383866

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277930 0039d316-1c4b-4281-b951-d872f2087c98
parent 60317c93
......@@ -11420,7 +11420,7 @@ Chrome ran out of memory.
Privacy policy
</message>
<message name="IDS_SAFE_BROWSING_PRIVACY_POLICY_URL" translateable="false">
http://www.google.com/chrome/intl/[GRITLANGCODE]/privacy.html
http://www.google.com/chrome/intl/[GRITLANGCODE]/chrome/browser/privacy/whitepaper.html#malware
</message>
<message name="IDS_SAFE_BROWSING_MALWARE_V2_REPORTING_AGREE" desc="SafeBrowsing Malware v2 Details label next to checkbox">
Automatically report details of possible security incidents to Google. <ph name="PRIVACY_PAGE_LINK">$1</ph>
......
......@@ -7,14 +7,19 @@
#include "base/metrics/histogram.h"
#include "base/prefs/pref_service.h"
#include "base/supports_user_data.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/views/constrained_window_views.h"
#include "content/public/browser/page_navigator.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/controls/link.h"
#include "ui/views/controls/message_box_view.h"
#include "ui/views/widget/widget.h"
using content::OpenURLParams;
namespace {
const void* kDialogStatusKey = &kDialogStatusKey;
......@@ -35,6 +40,7 @@ class DialogStatusData : public base::SupportsUserData::Data {
void DownloadFeedbackDialogView::Show(
gfx::NativeWindow parent_window,
Profile* profile,
content::PageNavigator* navigator,
const UserDecisionCallback& callback) {
// This dialog should only be shown if it hasn't been shown before.
DCHECK(!profile->GetPrefs()->HasPrefPath(
......@@ -52,7 +58,7 @@ void DownloadFeedbackDialogView::Show(
if (data->currently_shown() == false) {
data->set_currently_shown(true);
DownloadFeedbackDialogView* window =
new DownloadFeedbackDialogView(profile, callback);
new DownloadFeedbackDialogView(profile, navigator, callback);
CreateBrowserModalDialogViews(window, parent_window)->Show();
} else {
callback.Run(false);
......@@ -61,17 +67,22 @@ void DownloadFeedbackDialogView::Show(
DownloadFeedbackDialogView::DownloadFeedbackDialogView(
Profile* profile,
content::PageNavigator* navigator,
const UserDecisionCallback& callback)
: profile_(profile),
navigator_(navigator),
callback_(callback),
explanation_box_view_(new views::MessageBoxView(
views::MessageBoxView::InitParams(l10n_util::GetStringUTF16(
IDS_FEEDBACK_SERVICE_DIALOG_EXPLANATION)))),
link_view_(new views::Link(l10n_util::GetStringUTF16(
IDS_SAFE_BROWSING_PRIVACY_POLICY_PAGE_V2))),
title_text_(l10n_util::GetStringUTF16(IDS_FEEDBACK_SERVICE_DIALOG_TITLE)),
ok_button_text_(l10n_util::GetStringUTF16(
IDS_FEEDBACK_SERVICE_DIALOG_OK_BUTTON_LABEL)),
cancel_button_text_(l10n_util::GetStringUTF16(
IDS_FEEDBACK_SERVICE_DIALOG_CANCEL_BUTTON_LABEL)) {
link_view_->set_listener(this);
}
DownloadFeedbackDialogView::~DownloadFeedbackDialogView() {}
......@@ -131,3 +142,19 @@ const views::Widget* DownloadFeedbackDialogView::GetWidget() const {
views::View* DownloadFeedbackDialogView::GetContentsView() {
return explanation_box_view_;
}
views::View* DownloadFeedbackDialogView::CreateExtraView() {
return link_view_;
}
void DownloadFeedbackDialogView::LinkClicked(
views::Link* source, int event_flags) {
WindowOpenDisposition disposition =
ui::DispositionFromEventFlags(event_flags);
content::OpenURLParams params(
GURL(l10n_util::GetStringUTF8(IDS_SAFE_BROWSING_PRIVACY_POLICY_URL)),
content::Referrer(),
disposition == CURRENT_TAB ? NEW_FOREGROUND_TAB : disposition,
content::PAGE_TRANSITION_LINK, false);
navigator_->OpenURL(params);
}
......@@ -8,18 +8,24 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "chrome/common/pref_names.h"
#include "ui/views/controls/link_listener.h"
#include "ui/views/window/dialog_delegate.h"
namespace views {
class MessageBoxView;
}
namespace content {
class PageNavigator;
}
class Profile;
// Asks the user whether s/he wants to participate in the Safe Browsing
// download feedback program. Shown only for downloads marked DANGEROUS_HOST
// or UNCOMMON_DOWNLOAD. The user should only see this dialog once.
class DownloadFeedbackDialogView : public views::DialogDelegate {
class DownloadFeedbackDialogView : public views::DialogDelegate,
public views::LinkListener {
public:
// Callback with the user's decision. |accepted| is true if the user clicked
// Accept(). Otherwise, assume the user cancelled.
......@@ -28,11 +34,13 @@ class DownloadFeedbackDialogView : public views::DialogDelegate {
static void Show(
gfx::NativeWindow parent_window,
Profile* profile,
content::PageNavigator* navigator,
const UserDecisionCallback& callback);
private:
DownloadFeedbackDialogView(
Profile* profile,
content::PageNavigator* navigator,
const UserDecisionCallback& callback);
virtual ~DownloadFeedbackDialogView();
......@@ -51,10 +59,16 @@ class DownloadFeedbackDialogView : public views::DialogDelegate {
ui::DialogButton button) const OVERRIDE;
virtual bool Cancel() OVERRIDE;
virtual bool Accept() OVERRIDE;
virtual views::View* CreateExtraView() OVERRIDE;
// views::LinkListener:
virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
Profile* profile_;
content::PageNavigator* navigator_;
const UserDecisionCallback callback_;
views::MessageBoxView* explanation_box_view_;
views::Link* link_view_;
base::string16 title_text_;
base::string16 ok_button_text_;
base::string16 cancel_button_text_;
......
......@@ -561,6 +561,7 @@ void DownloadItemView::ButtonPressed(views::Button* sender,
DownloadFeedbackDialogView::Show(
shelf_->get_parent()->GetNativeWindow(),
shelf_->browser()->profile(),
shelf_->GetNavigator(),
base::Bind(
&DownloadItemView::PossiblySubmitDownloadToFeedbackService,
weak_ptr_factory_.GetWeakPtr()));
......
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