#include "chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_bubble_view_controller.h"
#include "base/check_is_test.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/feedback/show_feedback_page.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/url_identity.h"
#include "chrome/browser/ui/views/accessibility/non_accessible_image_view.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_content_view.h"
#include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.h"
#include "chrome/grit/generated_resources.h"
#include "components/content_settings/browser/ui/cookie_controls_util.h"
#include "components/content_settings/core/common/cookie_blocking_3pcd_status.h"
#include "components/content_settings/core/common/cookie_controls_enforcement.h"
#include "components/content_settings/core/common/features.h"
#include "components/content_settings/core/common/tracking_protection_feature.h"
#include "components/favicon/core/favicon_service.h"
#include "components/privacy_sandbox/privacy_sandbox_features.h"
#include "components/strings/grit/privacy_sandbox_strings.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
#include "cookie_controls_bubble_view_controller.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/ui_base_features.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/vector_icons.h"
#include "ui/views/view_class_properties.h"
namespace {
TrackingProtectionFeature;
FeatureType;
constexpr int kProgressBarHeight = …;
constexpr int kFaviconID = …;
constexpr UrlIdentity::TypeSet kUrlIdentityAllowedTypes = …;
constexpr UrlIdentity::FormatOptions kUrlIdentityOptions{ … };
const gfx::VectorIcon& GetToggleIcon(bool enabled) { … }
}
CookieControlsBubbleViewController::CookieControlsBubbleViewController(
CookieControlsBubbleView* bubble_view,
content_settings::CookieControlsController* controller,
content::WebContents* web_contents)
: … { … }
void CookieControlsBubbleViewController::OnUserClosedContentView() { … }
void CookieControlsBubbleViewController::SwitchToReloadingView() { … }
void CookieControlsBubbleViewController::OnFaviconFetched(
const favicon_base::FaviconImageResult& result) const { … }
void CookieControlsBubbleViewController::ApplyThirdPartyCookiesAllowedState(
CookieControlsEnforcement enforcement,
base::Time expiration) { … }
void CookieControlsBubbleViewController::ApplyThirdPartyCookiesBlockedState() { … }
void CookieControlsBubbleViewController::FillViewForThirdPartyCookies(
TrackingProtectionFeature cookies_feature,
base::Time expiration) { … }
std::u16string CookieControlsBubbleViewController::GetStatusLabel(
content_settings::TrackingProtectionBlockingStatus blocking_status) { … }
CookieControlsBubbleViewController::~CookieControlsBubbleViewController() =
default;
void CookieControlsBubbleViewController::OnStatusChanged(
bool controls_visible,
bool protections_on,
CookieControlsEnforcement enforcement,
CookieBlocking3pcdStatus blocking_status,
base::Time expiration,
std::vector<content_settings::TrackingProtectionFeature> features) { … }
void CookieControlsBubbleViewController::FillViewForTrackingProtection(
CookieControlsEnforcement enforcement,
base::Time expiration,
std::vector<content_settings::TrackingProtectionFeature> features) { … }
void CookieControlsBubbleViewController::
OnFinishedPageReloadWithChangedSettings() { … }
void CookieControlsBubbleViewController::OnReloadingViewTimeout() { … }
void CookieControlsBubbleViewController::CloseBubble() { … }
void CookieControlsBubbleViewController::SetCallbacks() { … }
void CookieControlsBubbleViewController::OnToggleButtonPressed(
bool toggled_on) { … }
void CookieControlsBubbleViewController::OnFeedbackButtonPressed() { … }
std::unique_ptr<views::View>
CookieControlsBubbleViewController::InitReloadingView(
content::WebContents* web_contents) { … }
void CookieControlsBubbleViewController::FetchFaviconFrom(
content::WebContents* web_contents) { … }
std::u16string CookieControlsBubbleViewController::GetSubjectUrlName(
content::WebContents* web_contents) const { … }
void CookieControlsBubbleViewController::SetSubjectUrlNameForTesting(
const std::u16string& name) { … }