Commit 8e7b370a authored by Christian Dullweber's avatar Christian Dullweber Committed by Commit Bot

Log CookieControls UserActions from controller

Log these UserActions from the controller, so they get logged on
Android as well.

Bug: 1040091
Change-Id: I2f938d54c376b88d020e2a576d7dd2348c1b64ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2063130Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Christian Dullweber <dullweber@chromium.org>
Auto-Submit: Christian Dullweber <dullweber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742682}
parent 714b047e
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include <memory> #include <memory>
#include "base/bind.h" #include "base/bind.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h" #include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/content_settings/local_shared_objects_container.h" #include "chrome/browser/content_settings/local_shared_objects_container.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h" #include "chrome/browser/content_settings/tab_specific_content_settings.h"
...@@ -20,6 +22,8 @@ ...@@ -20,6 +22,8 @@
#include "content/public/common/url_constants.h" #include "content/public/common/url_constants.h"
#include "extensions/common/constants.h" #include "extensions/common/constants.h"
using base::UserMetricsAction;
CookieControlsController::CookieControlsController( CookieControlsController::CookieControlsController(
content::WebContents* web_contents) { content::WebContents* web_contents) {
DCHECK(web_contents); DCHECK(web_contents);
...@@ -76,9 +80,11 @@ CookieControlsController::Status CookieControlsController::GetStatus( ...@@ -76,9 +80,11 @@ CookieControlsController::Status CookieControlsController::GetStatus(
void CookieControlsController::OnCookieBlockingEnabledForSite( void CookieControlsController::OnCookieBlockingEnabledForSite(
bool block_third_party_cookies) { bool block_third_party_cookies) {
if (block_third_party_cookies) { if (block_third_party_cookies) {
base::RecordAction(UserMetricsAction("CookieControls.Bubble.TurnOn"));
should_reload_ = false; should_reload_ = false;
cookie_settings_->ResetThirdPartyCookieSetting(GetWebContents()->GetURL()); cookie_settings_->ResetThirdPartyCookieSetting(GetWebContents()->GetURL());
} else { } else {
base::RecordAction(UserMetricsAction("CookieControls.Bubble.TurnOff"));
should_reload_ = true; should_reload_ = true;
cookie_settings_->SetThirdPartyCookieSetting( cookie_settings_->SetThirdPartyCookieSetting(
GetWebContents()->GetURL(), ContentSetting::CONTENT_SETTING_ALLOW); GetWebContents()->GetURL(), ContentSetting::CONTENT_SETTING_ALLOW);
......
...@@ -272,12 +272,10 @@ void CookieControlsBubbleView::WindowClosing() { ...@@ -272,12 +272,10 @@ void CookieControlsBubbleView::WindowClosing() {
void CookieControlsBubbleView::OnDialogAccepted() { void CookieControlsBubbleView::OnDialogAccepted() {
if (intermediate_step_ == IntermediateStep::kTurnOffButton) { if (intermediate_step_ == IntermediateStep::kTurnOffButton) {
base::RecordAction(UserMetricsAction("CookieControls.Bubble.TurnOff"));
controller_->OnCookieBlockingEnabledForSite(false); controller_->OnCookieBlockingEnabledForSite(false);
} else { } else {
DCHECK_EQ(status_, CookieControlsController::Status::kDisabledForSite); DCHECK_EQ(status_, CookieControlsController::Status::kDisabledForSite);
DCHECK_EQ(intermediate_step_, IntermediateStep::kNone); DCHECK_EQ(intermediate_step_, IntermediateStep::kNone);
base::RecordAction(UserMetricsAction("CookieControls.Bubble.TurnOn"));
controller_->OnCookieBlockingEnabledForSite(true); controller_->OnCookieBlockingEnabledForSite(true);
} }
} }
......
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