Commit e3da3b00 authored by Charlie Harrison's avatar Charlie Harrison Committed by Commit Bot

ContentSettingBubbleModel: ensure destruction on WebContentsDestroyed

ContentSettingBubbleContents owns the underlying bubble model. It is
also a WebContentsObserver. This CL destroys the bubble model in
WebContentsDestroyed, which allows the model to avoid paranoid
null checking throughout the code.

In the process, we also remove:
1. Notification observation about profile / web contents destruction.
   The profile should be alive as long as the web contents.

2. Storing the profile directly and accessing the raw ptr. Instead,
   just pull it off the web contents.

One subtle thing about this patch. On WebContentsDestroyed, we do not
synchronously destroy the underlying ContentSettingBubbleContents,
instead, we synchronously hide it and post a task which actually
deletes it. This means we need to be careful about properly null
checking the content_setting_bubble_model_. Thankfully, we can assume
that event listeners are not invoked on hidden widgets.

Bug: None
Change-Id: I0a1ff38a705ace8a9898a4c89f81d51d8474b4da
Reviewed-on: https://chromium-review.googlesource.com/c/1334097
Commit-Queue: Charlie Harrison <csharrison@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610852}
parent 6b8f64da
...@@ -151,9 +151,8 @@ void SetAllowRunningInsecureContent(content::RenderFrameHost* frame) { ...@@ -151,9 +151,8 @@ void SetAllowRunningInsecureContent(content::RenderFrameHost* frame) {
ContentSettingSimpleBubbleModel::ContentSettingSimpleBubbleModel( ContentSettingSimpleBubbleModel::ContentSettingSimpleBubbleModel(
Delegate* delegate, Delegate* delegate,
WebContents* web_contents, WebContents* web_contents,
Profile* profile,
ContentSettingsType content_type) ContentSettingsType content_type)
: ContentSettingBubbleModel(delegate, web_contents, profile), : ContentSettingBubbleModel(delegate, web_contents),
content_type_(content_type) { content_type_(content_type) {
// Notifications do not have a bubble. // Notifications do not have a bubble.
DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_NOTIFICATIONS); DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
...@@ -170,9 +169,7 @@ ContentSettingSimpleBubbleModel* ...@@ -170,9 +169,7 @@ ContentSettingSimpleBubbleModel*
void ContentSettingSimpleBubbleModel::SetTitle() { void ContentSettingSimpleBubbleModel::SetTitle() {
TabSpecificContentSettings* content_settings = TabSpecificContentSettings* content_settings =
web_contents() TabSpecificContentSettings::FromWebContents(web_contents());
? TabSpecificContentSettings::FromWebContents(web_contents())
: nullptr;
static const ContentSettingsTypeIdEntry kBlockedTitleIDs[] = { static const ContentSettingsTypeIdEntry kBlockedTitleIDs[] = {
{CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_TITLE}, {CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_TITLE},
...@@ -195,7 +192,7 @@ void ContentSettingSimpleBubbleModel::SetTitle() { ...@@ -195,7 +192,7 @@ void ContentSettingSimpleBubbleModel::SetTitle() {
}; };
const ContentSettingsTypeIdEntry* title_ids = kBlockedTitleIDs; const ContentSettingsTypeIdEntry* title_ids = kBlockedTitleIDs;
size_t num_title_ids = arraysize(kBlockedTitleIDs); size_t num_title_ids = arraysize(kBlockedTitleIDs);
if (content_settings && content_settings->IsContentAllowed(content_type()) && if (content_settings->IsContentAllowed(content_type()) &&
!content_settings->IsContentBlocked(content_type())) { !content_settings->IsContentBlocked(content_type())) {
title_ids = kAccessedTitleIDs; title_ids = kAccessedTitleIDs;
num_title_ids = arraysize(kAccessedTitleIDs); num_title_ids = arraysize(kAccessedTitleIDs);
...@@ -207,9 +204,7 @@ void ContentSettingSimpleBubbleModel::SetTitle() { ...@@ -207,9 +204,7 @@ void ContentSettingSimpleBubbleModel::SetTitle() {
void ContentSettingSimpleBubbleModel::SetMessage() { void ContentSettingSimpleBubbleModel::SetMessage() {
TabSpecificContentSettings* content_settings = TabSpecificContentSettings* content_settings =
web_contents() TabSpecificContentSettings::FromWebContents(web_contents());
? TabSpecificContentSettings::FromWebContents(web_contents())
: nullptr;
static const ContentSettingsTypeIdEntry kBlockedMessageIDs[] = { static const ContentSettingsTypeIdEntry kBlockedMessageIDs[] = {
{CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_MESSAGE}, {CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_MESSAGE},
...@@ -231,7 +226,7 @@ void ContentSettingSimpleBubbleModel::SetMessage() { ...@@ -231,7 +226,7 @@ void ContentSettingSimpleBubbleModel::SetMessage() {
}; };
const ContentSettingsTypeIdEntry* message_ids = kBlockedMessageIDs; const ContentSettingsTypeIdEntry* message_ids = kBlockedMessageIDs;
size_t num_message_ids = arraysize(kBlockedMessageIDs); size_t num_message_ids = arraysize(kBlockedMessageIDs);
if (content_settings && content_settings->IsContentAllowed(content_type()) && if (content_settings->IsContentAllowed(content_type()) &&
!content_settings->IsContentBlocked(content_type())) { !content_settings->IsContentBlocked(content_type())) {
message_ids = kAccessedMessageIDs; message_ids = kAccessedMessageIDs;
num_message_ids = arraysize(kAccessedMessageIDs); num_message_ids = arraysize(kAccessedMessageIDs);
...@@ -281,8 +276,7 @@ class ContentSettingMixedScriptBubbleModel ...@@ -281,8 +276,7 @@ class ContentSettingMixedScriptBubbleModel
: public ContentSettingSimpleBubbleModel { : public ContentSettingSimpleBubbleModel {
public: public:
ContentSettingMixedScriptBubbleModel(Delegate* delegate, ContentSettingMixedScriptBubbleModel(Delegate* delegate,
WebContents* web_contents, WebContents* web_contents);
Profile* profile);
~ContentSettingMixedScriptBubbleModel() override {} ~ContentSettingMixedScriptBubbleModel() override {}
...@@ -298,11 +292,9 @@ class ContentSettingMixedScriptBubbleModel ...@@ -298,11 +292,9 @@ class ContentSettingMixedScriptBubbleModel
ContentSettingMixedScriptBubbleModel::ContentSettingMixedScriptBubbleModel( ContentSettingMixedScriptBubbleModel::ContentSettingMixedScriptBubbleModel(
Delegate* delegate, Delegate* delegate,
WebContents* web_contents, WebContents* web_contents)
Profile* profile)
: ContentSettingSimpleBubbleModel(delegate, : ContentSettingSimpleBubbleModel(delegate,
web_contents, web_contents,
profile,
CONTENT_SETTINGS_TYPE_MIXEDSCRIPT) { CONTENT_SETTINGS_TYPE_MIXEDSCRIPT) {
content_settings::RecordMixedScriptAction( content_settings::RecordMixedScriptAction(
content_settings::MIXED_SCRIPT_ACTION_DISPLAYED_BUBBLE); content_settings::MIXED_SCRIPT_ACTION_DISPLAYED_BUBBLE);
...@@ -321,9 +313,6 @@ void ContentSettingMixedScriptBubbleModel::OnLearnMoreClicked() { ...@@ -321,9 +313,6 @@ void ContentSettingMixedScriptBubbleModel::OnLearnMoreClicked() {
void ContentSettingMixedScriptBubbleModel::OnCustomLinkClicked() { void ContentSettingMixedScriptBubbleModel::OnCustomLinkClicked() {
DCHECK(rappor_service()); DCHECK(rappor_service());
if (!web_contents())
return;
MixedContentSettingsTabHelper* mixed_content_settings = MixedContentSettingsTabHelper* mixed_content_settings =
MixedContentSettingsTabHelper::FromWebContents(web_contents()); MixedContentSettingsTabHelper::FromWebContents(web_contents());
if (mixed_content_settings) { if (mixed_content_settings) {
...@@ -365,11 +354,9 @@ enum RPHState { ...@@ -365,11 +354,9 @@ enum RPHState {
ContentSettingRPHBubbleModel::ContentSettingRPHBubbleModel( ContentSettingRPHBubbleModel::ContentSettingRPHBubbleModel(
Delegate* delegate, Delegate* delegate,
WebContents* web_contents, WebContents* web_contents,
Profile* profile,
ProtocolHandlerRegistry* registry) ProtocolHandlerRegistry* registry)
: ContentSettingSimpleBubbleModel(delegate, : ContentSettingSimpleBubbleModel(delegate,
web_contents, web_contents,
profile,
CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS), CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS),
registry_(registry), registry_(registry),
pending_handler_(ProtocolHandler::EmptyProtocolHandler()), pending_handler_(ProtocolHandler::EmptyProtocolHandler()),
...@@ -422,9 +409,6 @@ ContentSettingRPHBubbleModel::ContentSettingRPHBubbleModel( ...@@ -422,9 +409,6 @@ ContentSettingRPHBubbleModel::ContentSettingRPHBubbleModel(
ContentSettingRPHBubbleModel::~ContentSettingRPHBubbleModel() {} ContentSettingRPHBubbleModel::~ContentSettingRPHBubbleModel() {}
void ContentSettingRPHBubbleModel::CommitChanges() { void ContentSettingRPHBubbleModel::CommitChanges() {
if (!web_contents())
return;
PerformActionForSelectedItem(); PerformActionForSelectedItem();
// The user has one chance to deal with the RPH content setting UI, // The user has one chance to deal with the RPH content setting UI,
...@@ -438,9 +422,6 @@ void ContentSettingRPHBubbleModel::CommitChanges() { ...@@ -438,9 +422,6 @@ void ContentSettingRPHBubbleModel::CommitChanges() {
} }
void ContentSettingRPHBubbleModel::RegisterProtocolHandler() { void ContentSettingRPHBubbleModel::RegisterProtocolHandler() {
if (!web_contents())
return;
// A no-op if the handler hasn't been ignored, but needed in case the user // A no-op if the handler hasn't been ignored, but needed in case the user
// selects sequences like register/ignore/register. // selects sequences like register/ignore/register.
registry_->RemoveIgnoredHandler(pending_handler_); registry_->RemoveIgnoredHandler(pending_handler_);
...@@ -451,9 +432,6 @@ void ContentSettingRPHBubbleModel::RegisterProtocolHandler() { ...@@ -451,9 +432,6 @@ void ContentSettingRPHBubbleModel::RegisterProtocolHandler() {
} }
void ContentSettingRPHBubbleModel::UnregisterProtocolHandler() { void ContentSettingRPHBubbleModel::UnregisterProtocolHandler() {
if (!web_contents())
return;
registry_->OnDenyRegisterProtocolHandler(pending_handler_); registry_->OnDenyRegisterProtocolHandler(pending_handler_);
auto* settings = TabSpecificContentSettings::FromWebContents(web_contents()); auto* settings = TabSpecificContentSettings::FromWebContents(web_contents());
settings->set_pending_protocol_handler_setting(CONTENT_SETTING_BLOCK); settings->set_pending_protocol_handler_setting(CONTENT_SETTING_BLOCK);
...@@ -461,9 +439,6 @@ void ContentSettingRPHBubbleModel::UnregisterProtocolHandler() { ...@@ -461,9 +439,6 @@ void ContentSettingRPHBubbleModel::UnregisterProtocolHandler() {
} }
void ContentSettingRPHBubbleModel::IgnoreProtocolHandler() { void ContentSettingRPHBubbleModel::IgnoreProtocolHandler() {
if (!web_contents())
return;
registry_->OnIgnoreRegisterProtocolHandler(pending_handler_); registry_->OnIgnoreRegisterProtocolHandler(pending_handler_);
auto* settings = TabSpecificContentSettings::FromWebContents(web_contents()); auto* settings = TabSpecificContentSettings::FromWebContents(web_contents());
settings->set_pending_protocol_handler_setting(CONTENT_SETTING_DEFAULT); settings->set_pending_protocol_handler_setting(CONTENT_SETTING_DEFAULT);
...@@ -495,8 +470,7 @@ class ContentSettingMidiSysExBubbleModel ...@@ -495,8 +470,7 @@ class ContentSettingMidiSysExBubbleModel
: public ContentSettingSimpleBubbleModel { : public ContentSettingSimpleBubbleModel {
public: public:
ContentSettingMidiSysExBubbleModel(Delegate* delegate, ContentSettingMidiSysExBubbleModel(Delegate* delegate,
WebContents* web_contents, WebContents* web_contents);
Profile* profile);
~ContentSettingMidiSysExBubbleModel() override {} ~ContentSettingMidiSysExBubbleModel() override {}
private: private:
...@@ -509,11 +483,9 @@ class ContentSettingMidiSysExBubbleModel ...@@ -509,11 +483,9 @@ class ContentSettingMidiSysExBubbleModel
ContentSettingMidiSysExBubbleModel::ContentSettingMidiSysExBubbleModel( ContentSettingMidiSysExBubbleModel::ContentSettingMidiSysExBubbleModel(
Delegate* delegate, Delegate* delegate,
WebContents* web_contents, WebContents* web_contents)
Profile* profile)
: ContentSettingSimpleBubbleModel(delegate, : ContentSettingSimpleBubbleModel(delegate,
web_contents, web_contents,
profile,
CONTENT_SETTINGS_TYPE_MIDI_SYSEX) { CONTENT_SETTINGS_TYPE_MIDI_SYSEX) {
SetDomainsAndCustomLink(); SetDomainsAndCustomLink();
} }
...@@ -557,8 +529,6 @@ void ContentSettingMidiSysExBubbleModel::SetDomainsAndCustomLink() { ...@@ -557,8 +529,6 @@ void ContentSettingMidiSysExBubbleModel::SetDomainsAndCustomLink() {
} }
void ContentSettingMidiSysExBubbleModel::OnCustomLinkClicked() { void ContentSettingMidiSysExBubbleModel::OnCustomLinkClicked() {
if (!web_contents())
return;
// Reset this embedder's entry to default for each of the requesting // Reset this embedder's entry to default for each of the requesting
// origins currently on the page. // origins currently on the page.
const GURL& embedder_url = web_contents()->GetURL(); const GURL& embedder_url = web_contents()->GetURL();
...@@ -567,10 +537,10 @@ void ContentSettingMidiSysExBubbleModel::OnCustomLinkClicked() { ...@@ -567,10 +537,10 @@ void ContentSettingMidiSysExBubbleModel::OnCustomLinkClicked() {
const ContentSettingsUsagesState::StateMap& state_map = const ContentSettingsUsagesState::StateMap& state_map =
content_settings->midi_usages_state().state_map(); content_settings->midi_usages_state().state_map();
HostContentSettingsMap* map = HostContentSettingsMap* map =
HostContentSettingsMapFactory::GetForProfile(profile()); HostContentSettingsMapFactory::GetForProfile(GetProfile());
for (const std::pair<GURL, ContentSetting>& map_entry : state_map) { for (const std::pair<GURL, ContentSetting>& map_entry : state_map) {
PermissionUtil::ScopedRevocationReporter( PermissionUtil::ScopedRevocationReporter(
profile(), map_entry.first, embedder_url, GetProfile(), map_entry.first, embedder_url,
CONTENT_SETTINGS_TYPE_MIDI_SYSEX, PermissionSourceUI::PAGE_ACTION); CONTENT_SETTINGS_TYPE_MIDI_SYSEX, PermissionSourceUI::PAGE_ACTION);
map->SetContentSettingDefaultScope(map_entry.first, embedder_url, map->SetContentSettingDefaultScope(map_entry.first, embedder_url,
CONTENT_SETTINGS_TYPE_MIDI_SYSEX, CONTENT_SETTINGS_TYPE_MIDI_SYSEX,
...@@ -585,7 +555,6 @@ class ContentSettingDomainListBubbleModel ...@@ -585,7 +555,6 @@ class ContentSettingDomainListBubbleModel
public: public:
ContentSettingDomainListBubbleModel(Delegate* delegate, ContentSettingDomainListBubbleModel(Delegate* delegate,
WebContents* web_contents, WebContents* web_contents,
Profile* profile,
ContentSettingsType content_type); ContentSettingsType content_type);
~ContentSettingDomainListBubbleModel() override {} ~ContentSettingDomainListBubbleModel() override {}
...@@ -600,11 +569,9 @@ class ContentSettingDomainListBubbleModel ...@@ -600,11 +569,9 @@ class ContentSettingDomainListBubbleModel
ContentSettingDomainListBubbleModel::ContentSettingDomainListBubbleModel( ContentSettingDomainListBubbleModel::ContentSettingDomainListBubbleModel(
Delegate* delegate, Delegate* delegate,
WebContents* web_contents, WebContents* web_contents,
Profile* profile,
ContentSettingsType content_type) ContentSettingsType content_type)
: ContentSettingSimpleBubbleModel(delegate, : ContentSettingSimpleBubbleModel(delegate,
web_contents, web_contents,
profile,
content_type) { content_type) {
DCHECK_EQ(CONTENT_SETTINGS_TYPE_GEOLOCATION, content_type) DCHECK_EQ(CONTENT_SETTINGS_TYPE_GEOLOCATION, content_type)
<< "SetDomains currently only supports geolocation content type"; << "SetDomains currently only supports geolocation content type";
...@@ -650,8 +617,6 @@ void ContentSettingDomainListBubbleModel::SetDomainsAndCustomLink() { ...@@ -650,8 +617,6 @@ void ContentSettingDomainListBubbleModel::SetDomainsAndCustomLink() {
} }
void ContentSettingDomainListBubbleModel::OnCustomLinkClicked() { void ContentSettingDomainListBubbleModel::OnCustomLinkClicked() {
if (!web_contents())
return;
// Reset this embedder's entry to default for each of the requesting // Reset this embedder's entry to default for each of the requesting
// origins currently on the page. // origins currently on the page.
const GURL& embedder_url = web_contents()->GetURL(); const GURL& embedder_url = web_contents()->GetURL();
...@@ -660,10 +625,10 @@ void ContentSettingDomainListBubbleModel::OnCustomLinkClicked() { ...@@ -660,10 +625,10 @@ void ContentSettingDomainListBubbleModel::OnCustomLinkClicked() {
const ContentSettingsUsagesState::StateMap& state_map = const ContentSettingsUsagesState::StateMap& state_map =
content_settings->geolocation_usages_state().state_map(); content_settings->geolocation_usages_state().state_map();
HostContentSettingsMap* map = HostContentSettingsMap* map =
HostContentSettingsMapFactory::GetForProfile(profile()); HostContentSettingsMapFactory::GetForProfile(GetProfile());
for (const std::pair<GURL, ContentSetting>& map_entry : state_map) { for (const std::pair<GURL, ContentSetting>& map_entry : state_map) {
PermissionUtil::ScopedRevocationReporter( PermissionUtil::ScopedRevocationReporter(
profile(), map_entry.first, embedder_url, GetProfile(), map_entry.first, embedder_url,
CONTENT_SETTINGS_TYPE_GEOLOCATION, PermissionSourceUI::PAGE_ACTION); CONTENT_SETTINGS_TYPE_GEOLOCATION, PermissionSourceUI::PAGE_ACTION);
map->SetContentSettingDefaultScope(map_entry.first, embedder_url, map->SetContentSettingDefaultScope(map_entry.first, embedder_url,
CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTINGS_TYPE_GEOLOCATION,
...@@ -676,8 +641,7 @@ void ContentSettingDomainListBubbleModel::OnCustomLinkClicked() { ...@@ -676,8 +641,7 @@ void ContentSettingDomainListBubbleModel::OnCustomLinkClicked() {
class ContentSettingPluginBubbleModel : public ContentSettingSimpleBubbleModel { class ContentSettingPluginBubbleModel : public ContentSettingSimpleBubbleModel {
public: public:
ContentSettingPluginBubbleModel(Delegate* delegate, ContentSettingPluginBubbleModel(Delegate* delegate,
WebContents* web_contents, WebContents* web_contents);
Profile* profile);
private: private:
void OnLearnMoreClicked() override; void OnLearnMoreClicked() override;
...@@ -690,17 +654,15 @@ class ContentSettingPluginBubbleModel : public ContentSettingSimpleBubbleModel { ...@@ -690,17 +654,15 @@ class ContentSettingPluginBubbleModel : public ContentSettingSimpleBubbleModel {
ContentSettingPluginBubbleModel::ContentSettingPluginBubbleModel( ContentSettingPluginBubbleModel::ContentSettingPluginBubbleModel(
Delegate* delegate, Delegate* delegate,
WebContents* web_contents, WebContents* web_contents)
Profile* profile)
: ContentSettingSimpleBubbleModel(delegate, : ContentSettingSimpleBubbleModel(delegate,
web_contents, web_contents,
profile,
CONTENT_SETTINGS_TYPE_PLUGINS) { CONTENT_SETTINGS_TYPE_PLUGINS) {
const GURL& url = web_contents->GetURL(); const GURL& url = web_contents->GetURL();
bool managed_by_user = bool managed_by_user =
GetSettingManagedByUser(url, content_type(), profile, nullptr); GetSettingManagedByUser(url, content_type(), GetProfile(), nullptr);
HostContentSettingsMap* map = HostContentSettingsMap* map =
HostContentSettingsMapFactory::GetForProfile(profile); HostContentSettingsMapFactory::GetForProfile(GetProfile());
ContentSetting setting = PluginUtils::GetFlashPluginContentSetting( ContentSetting setting = PluginUtils::GetFlashPluginContentSetting(
map, url::Origin::Create(url), url, nullptr); map, url::Origin::Create(url), url, nullptr);
...@@ -721,7 +683,6 @@ ContentSettingPluginBubbleModel::ContentSettingPluginBubbleModel( ...@@ -721,7 +683,6 @@ ContentSettingPluginBubbleModel::ContentSettingPluginBubbleModel(
// Disable the "Run all plugins this time" link if the user already clicked // Disable the "Run all plugins this time" link if the user already clicked
// on the link and ran all plugins. // on the link and ran all plugins.
set_custom_link_enabled( set_custom_link_enabled(
web_contents &&
TabSpecificContentSettings::FromWebContents(web_contents) TabSpecificContentSettings::FromWebContents(web_contents)
->load_plugins_link_enabled()); ->load_plugins_link_enabled());
} }
...@@ -749,10 +710,6 @@ void ContentSettingPluginBubbleModel::OnCustomLinkClicked() { ...@@ -749,10 +710,6 @@ void ContentSettingPluginBubbleModel::OnCustomLinkClicked() {
} }
void ContentSettingPluginBubbleModel::RunPluginsOnPage() { void ContentSettingPluginBubbleModel::RunPluginsOnPage() {
// Web contents can be NULL if the tab was closed while the plugins
// settings bubble is visible.
if (!web_contents())
return;
#if BUILDFLAG(ENABLE_PLUGINS) #if BUILDFLAG(ENABLE_PLUGINS)
// TODO(bauerb): We should send the identifiers of blocked plugins here. // TODO(bauerb): We should send the identifiers of blocked plugins here.
ChromePluginServiceFilter::GetInstance()->AuthorizeAllPlugins( ChromePluginServiceFilter::GetInstance()->AuthorizeAllPlugins(
...@@ -768,11 +725,9 @@ void ContentSettingPluginBubbleModel::RunPluginsOnPage() { ...@@ -768,11 +725,9 @@ void ContentSettingPluginBubbleModel::RunPluginsOnPage() {
ContentSettingSingleRadioGroup::ContentSettingSingleRadioGroup( ContentSettingSingleRadioGroup::ContentSettingSingleRadioGroup(
Delegate* delegate, Delegate* delegate,
WebContents* web_contents, WebContents* web_contents,
Profile* profile,
ContentSettingsType content_type) ContentSettingsType content_type)
: ContentSettingSimpleBubbleModel(delegate, : ContentSettingSimpleBubbleModel(delegate,
web_contents, web_contents,
profile,
content_type), content_type),
block_setting_(CONTENT_SETTING_BLOCK) { block_setting_(CONTENT_SETTING_BLOCK) {
SetRadioGroup(); SetRadioGroup();
...@@ -877,7 +832,7 @@ void ContentSettingSingleRadioGroup::SetRadioGroup() { ...@@ -877,7 +832,7 @@ void ContentSettingSingleRadioGroup::SetRadioGroup() {
ContentSetting setting; ContentSetting setting;
bool managed_by_user = bool managed_by_user =
GetSettingManagedByUser(url, content_type(), profile(), &setting); GetSettingManagedByUser(url, content_type(), GetProfile(), &setting);
if (setting == CONTENT_SETTING_ALLOW) { if (setting == CONTENT_SETTING_ALLOW) {
radio_group.default_item = kAllowButtonIndex; radio_group.default_item = kAllowButtonIndex;
// |block_setting_| is already set to |CONTENT_SETTING_BLOCK|. // |block_setting_| is already set to |CONTENT_SETTING_BLOCK|.
...@@ -891,10 +846,10 @@ void ContentSettingSingleRadioGroup::SetRadioGroup() { ...@@ -891,10 +846,10 @@ void ContentSettingSingleRadioGroup::SetRadioGroup() {
void ContentSettingSingleRadioGroup::SetNarrowestContentSetting( void ContentSettingSingleRadioGroup::SetNarrowestContentSetting(
ContentSetting setting) { ContentSetting setting) {
if (!profile()) if (!GetProfile())
return; return;
auto* map = HostContentSettingsMapFactory::GetForProfile(profile()); auto* map = HostContentSettingsMapFactory::GetForProfile(GetProfile());
map->SetNarrowestContentSetting(bubble_content().radio_group.url, map->SetNarrowestContentSetting(bubble_content().radio_group.url,
bubble_content().radio_group.url, bubble_content().radio_group.url,
content_type(), setting); content_type(), setting);
...@@ -905,8 +860,7 @@ void ContentSettingSingleRadioGroup::SetNarrowestContentSetting( ...@@ -905,8 +860,7 @@ void ContentSettingSingleRadioGroup::SetNarrowestContentSetting(
class ContentSettingCookiesBubbleModel : public ContentSettingSingleRadioGroup { class ContentSettingCookiesBubbleModel : public ContentSettingSingleRadioGroup {
public: public:
ContentSettingCookiesBubbleModel(Delegate* delegate, ContentSettingCookiesBubbleModel(Delegate* delegate,
WebContents* web_contents, WebContents* web_contents);
Profile* profile);
~ContentSettingCookiesBubbleModel() override; ~ContentSettingCookiesBubbleModel() override;
// ContentSettingBubbleModel: // ContentSettingBubbleModel:
...@@ -920,11 +874,9 @@ class ContentSettingCookiesBubbleModel : public ContentSettingSingleRadioGroup { ...@@ -920,11 +874,9 @@ class ContentSettingCookiesBubbleModel : public ContentSettingSingleRadioGroup {
ContentSettingCookiesBubbleModel::ContentSettingCookiesBubbleModel( ContentSettingCookiesBubbleModel::ContentSettingCookiesBubbleModel(
Delegate* delegate, Delegate* delegate,
WebContents* web_contents, WebContents* web_contents)
Profile* profile)
: ContentSettingSingleRadioGroup(delegate, : ContentSettingSingleRadioGroup(delegate,
web_contents, web_contents,
profile,
CONTENT_SETTINGS_TYPE_COOKIES) { CONTENT_SETTINGS_TYPE_COOKIES) {
set_custom_link_enabled(true); set_custom_link_enabled(true);
} }
...@@ -934,7 +886,7 @@ ContentSettingCookiesBubbleModel::~ContentSettingCookiesBubbleModel() {} ...@@ -934,7 +886,7 @@ ContentSettingCookiesBubbleModel::~ContentSettingCookiesBubbleModel() {}
void ContentSettingCookiesBubbleModel::CommitChanges() { void ContentSettingCookiesBubbleModel::CommitChanges() {
// On some plattforms e.g. MacOS X it is possible to close a tab while the // On some plattforms e.g. MacOS X it is possible to close a tab while the
// cookies settings bubble is open. This resets the web contents to NULL. // cookies settings bubble is open. This resets the web contents to NULL.
if (settings_changed() && web_contents()) { if (settings_changed()) {
CollectedCookiesInfoBarDelegate::Create( CollectedCookiesInfoBarDelegate::Create(
InfoBarService::FromWebContents(web_contents())); InfoBarService::FromWebContents(web_contents()));
} }
...@@ -942,8 +894,6 @@ void ContentSettingCookiesBubbleModel::CommitChanges() { ...@@ -942,8 +894,6 @@ void ContentSettingCookiesBubbleModel::CommitChanges() {
} }
void ContentSettingCookiesBubbleModel::OnCustomLinkClicked() { void ContentSettingCookiesBubbleModel::OnCustomLinkClicked() {
if (!web_contents())
return;
content::NotificationService::current()->Notify( content::NotificationService::current()->Notify(
chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN,
content::Source<TabSpecificContentSettings>( content::Source<TabSpecificContentSettings>(
...@@ -957,9 +907,7 @@ void ContentSettingCookiesBubbleModel::OnCustomLinkClicked() { ...@@ -957,9 +907,7 @@ void ContentSettingCookiesBubbleModel::OnCustomLinkClicked() {
class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup, class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup,
public UrlListManager::Observer { public UrlListManager::Observer {
public: public:
ContentSettingPopupBubbleModel(Delegate* delegate, ContentSettingPopupBubbleModel(Delegate* delegate, WebContents* web_contents);
WebContents* web_contents,
Profile* profile);
~ContentSettingPopupBubbleModel() override; ~ContentSettingPopupBubbleModel() override;
// ContentSettingBubbleModel: // ContentSettingBubbleModel:
...@@ -968,11 +916,6 @@ class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup, ...@@ -968,11 +916,6 @@ class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup,
// PopupBlockerTabHelper::Observer: // PopupBlockerTabHelper::Observer:
void BlockedUrlAdded(int32_t id, const GURL& url) override; void BlockedUrlAdded(int32_t id, const GURL& url) override;
// content::NotificationObserver:
void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
private: private:
void OnListItemClicked(int index, int event_flags) override; void OnListItemClicked(int index, int event_flags) override;
...@@ -987,16 +930,11 @@ class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup, ...@@ -987,16 +930,11 @@ class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup,
ContentSettingPopupBubbleModel::ContentSettingPopupBubbleModel( ContentSettingPopupBubbleModel::ContentSettingPopupBubbleModel(
Delegate* delegate, Delegate* delegate,
WebContents* web_contents, WebContents* web_contents)
Profile* profile)
: ContentSettingSingleRadioGroup(delegate, : ContentSettingSingleRadioGroup(delegate,
web_contents, web_contents,
profile,
CONTENT_SETTINGS_TYPE_POPUPS), CONTENT_SETTINGS_TYPE_POPUPS),
url_list_observer_(this) { url_list_observer_(this) {
if (!web_contents)
return;
set_title(l10n_util::GetStringUTF16(IDS_BLOCKED_POPUPS_TITLE)); set_title(l10n_util::GetStringUTF16(IDS_BLOCKED_POPUPS_TITLE));
// Build blocked popup list. // Build blocked popup list.
...@@ -1015,25 +953,14 @@ void ContentSettingPopupBubbleModel::BlockedUrlAdded(int32_t id, ...@@ -1015,25 +953,14 @@ void ContentSettingPopupBubbleModel::BlockedUrlAdded(int32_t id,
AddListItem(CreateUrlListItem(id, url)); AddListItem(CreateUrlListItem(id, url));
} }
void ContentSettingPopupBubbleModel::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
ContentSettingSingleRadioGroup::Observe(type, source, details);
if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED)
url_list_observer_.RemoveAll();
}
void ContentSettingPopupBubbleModel::OnListItemClicked(int index, void ContentSettingPopupBubbleModel::OnListItemClicked(int index,
int event_flags) { int event_flags) {
if (web_contents()) {
auto* helper = PopupBlockerTabHelper::FromWebContents(web_contents()); auto* helper = PopupBlockerTabHelper::FromWebContents(web_contents());
helper->ShowBlockedPopup(item_id_from_item_index(index), helper->ShowBlockedPopup(item_id_from_item_index(index),
ui::DispositionFromEventFlags(event_flags)); ui::DispositionFromEventFlags(event_flags));
RemoveListItem(index); RemoveListItem(index);
content_settings::RecordPopupsAction( content_settings::RecordPopupsAction(
content_settings::POPUPS_ACTION_CLICKED_LIST_ITEM_CLICKED); content_settings::POPUPS_ACTION_CLICKED_LIST_ITEM_CLICKED);
}
} }
void ContentSettingPopupBubbleModel::CommitChanges() { void ContentSettingPopupBubbleModel::CommitChanges() {
...@@ -1071,16 +998,14 @@ const content::MediaStreamDevice& GetMediaDeviceById( ...@@ -1071,16 +998,14 @@ const content::MediaStreamDevice& GetMediaDeviceById(
ContentSettingMediaStreamBubbleModel::ContentSettingMediaStreamBubbleModel( ContentSettingMediaStreamBubbleModel::ContentSettingMediaStreamBubbleModel(
Delegate* delegate, Delegate* delegate,
WebContents* web_contents, WebContents* web_contents)
Profile* profile) : ContentSettingBubbleModel(delegate, web_contents),
: ContentSettingBubbleModel(delegate, web_contents, profile),
state_(TabSpecificContentSettings::MICROPHONE_CAMERA_NOT_ACCESSED) { state_(TabSpecificContentSettings::MICROPHONE_CAMERA_NOT_ACCESSED) {
// TODO(msramek): The media bubble has three states - mic only, camera only, // TODO(msramek): The media bubble has three states - mic only, camera only,
// and both. There is a lot of duplicated code which does the same thing // and both. There is a lot of duplicated code which does the same thing
// for camera and microphone separately. Consider refactoring it to avoid // for camera and microphone separately. Consider refactoring it to avoid
// duplication. // duplication.
DCHECK(profile);
// Initialize the content settings associated with the individual radio // Initialize the content settings associated with the individual radio
// buttons. // buttons.
radio_item_setting_[0] = CONTENT_SETTING_ASK; radio_item_setting_[0] = CONTENT_SETTING_ASK;
...@@ -1102,11 +1027,6 @@ ContentSettingMediaStreamBubbleModel::ContentSettingMediaStreamBubbleModel( ...@@ -1102,11 +1027,6 @@ ContentSettingMediaStreamBubbleModel::ContentSettingMediaStreamBubbleModel(
ContentSettingMediaStreamBubbleModel::~ContentSettingMediaStreamBubbleModel() {} ContentSettingMediaStreamBubbleModel::~ContentSettingMediaStreamBubbleModel() {}
void ContentSettingMediaStreamBubbleModel::CommitChanges() { void ContentSettingMediaStreamBubbleModel::CommitChanges() {
// On some platforms (e.g. MacOS X) it is possible to close a tab while the
// media stream bubble is open. This resets the web contents to NULL.
if (!web_contents())
return;
for (const auto& media_menu : bubble_content().media_menus) { for (const auto& media_menu : bubble_content().media_menus) {
const MediaMenu& menu = media_menu.second; const MediaMenu& menu = media_menu.second;
if (menu.selected_device.id != menu.default_device.id) if (menu.selected_device.id != menu.default_device.id)
...@@ -1260,9 +1180,6 @@ void ContentSettingMediaStreamBubbleModel::SetRadioGroup() { ...@@ -1260,9 +1180,6 @@ void ContentSettingMediaStreamBubbleModel::SetRadioGroup() {
void ContentSettingMediaStreamBubbleModel::UpdateSettings( void ContentSettingMediaStreamBubbleModel::UpdateSettings(
ContentSetting setting) { ContentSetting setting) {
if (!profile())
return;
TabSpecificContentSettings* tab_content_settings = TabSpecificContentSettings* tab_content_settings =
TabSpecificContentSettings::FromWebContents(web_contents()); TabSpecificContentSettings::FromWebContents(web_contents());
// The same urls must be used as in other places (e.g. the infobar) in // The same urls must be used as in other places (e.g. the infobar) in
...@@ -1270,19 +1187,20 @@ void ContentSettingMediaStreamBubbleModel::UpdateSettings( ...@@ -1270,19 +1187,20 @@ void ContentSettingMediaStreamBubbleModel::UpdateSettings(
// TODO(markusheintz): Extract to a helper so that there is only a single // TODO(markusheintz): Extract to a helper so that there is only a single
// place to touch. // place to touch.
HostContentSettingsMap* map = HostContentSettingsMap* map =
HostContentSettingsMapFactory::GetForProfile(profile()); HostContentSettingsMapFactory::GetForProfile(GetProfile());
if (MicrophoneAccessed()) { if (MicrophoneAccessed()) {
PermissionUtil::ScopedRevocationReporter scoped_revocation_reporter( PermissionUtil::ScopedRevocationReporter scoped_revocation_reporter(
profile(), tab_content_settings->media_stream_access_origin(), GURL(), GetProfile(), tab_content_settings->media_stream_access_origin(),
CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, PermissionSourceUI::PAGE_ACTION); GURL(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
PermissionSourceUI::PAGE_ACTION);
map->SetContentSettingDefaultScope( map->SetContentSettingDefaultScope(
tab_content_settings->media_stream_access_origin(), GURL(), tab_content_settings->media_stream_access_origin(), GURL(),
CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string(), setting); CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string(), setting);
} }
if (CameraAccessed()) { if (CameraAccessed()) {
PermissionUtil::ScopedRevocationReporter scoped_revocation_reporter( PermissionUtil::ScopedRevocationReporter scoped_revocation_reporter(
profile(), tab_content_settings->media_stream_access_origin(), GURL(), GetProfile(), tab_content_settings->media_stream_access_origin(),
CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, GURL(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA,
PermissionSourceUI::PAGE_ACTION); PermissionSourceUI::PAGE_ACTION);
map->SetContentSettingDefaultScope( map->SetContentSettingDefaultScope(
tab_content_settings->media_stream_access_origin(), GURL(), tab_content_settings->media_stream_access_origin(), GURL(),
...@@ -1293,7 +1211,7 @@ void ContentSettingMediaStreamBubbleModel::UpdateSettings( ...@@ -1293,7 +1211,7 @@ void ContentSettingMediaStreamBubbleModel::UpdateSettings(
void ContentSettingMediaStreamBubbleModel::UpdateDefaultDeviceForType( void ContentSettingMediaStreamBubbleModel::UpdateDefaultDeviceForType(
content::MediaStreamType type, content::MediaStreamType type,
const std::string& device) { const std::string& device) {
PrefService* prefs = profile()->GetPrefs(); PrefService* prefs = GetProfile()->GetPrefs();
if (type == content::MEDIA_DEVICE_AUDIO_CAPTURE) { if (type == content::MEDIA_DEVICE_AUDIO_CAPTURE) {
prefs->SetString(prefs::kDefaultAudioCaptureDevice, device); prefs->SetString(prefs::kDefaultAudioCaptureDevice, device);
} else { } else {
...@@ -1311,7 +1229,7 @@ void ContentSettingMediaStreamBubbleModel::SetMediaMenus() { ...@@ -1311,7 +1229,7 @@ void ContentSettingMediaStreamBubbleModel::SetMediaMenus() {
content_settings->media_stream_requested_video_device(); content_settings->media_stream_requested_video_device();
// Add microphone menu. // Add microphone menu.
PrefService* prefs = profile()->GetPrefs(); PrefService* prefs = GetProfile()->GetPrefs();
MediaCaptureDevicesDispatcher* dispatcher = MediaCaptureDevicesDispatcher* dispatcher =
MediaCaptureDevicesDispatcher::GetInstance(); MediaCaptureDevicesDispatcher::GetInstance();
const content::MediaStreamDevices& microphones = const content::MediaStreamDevices& microphones =
...@@ -1398,9 +1316,8 @@ void ContentSettingMediaStreamBubbleModel::OnMediaMenuClicked( ...@@ -1398,9 +1316,8 @@ void ContentSettingMediaStreamBubbleModel::OnMediaMenuClicked(
ContentSettingSubresourceFilterBubbleModel:: ContentSettingSubresourceFilterBubbleModel::
ContentSettingSubresourceFilterBubbleModel(Delegate* delegate, ContentSettingSubresourceFilterBubbleModel(Delegate* delegate,
WebContents* web_contents, WebContents* web_contents)
Profile* profile) : ContentSettingBubbleModel(delegate, web_contents) {
: ContentSettingBubbleModel(delegate, web_contents, profile) {
SetTitle(); SetTitle();
SetMessage(); SetMessage();
SetManageText(); SetManageText();
...@@ -1456,9 +1373,8 @@ ContentSettingSubresourceFilterBubbleModel::AsSubresourceFilterBubbleModel() { ...@@ -1456,9 +1373,8 @@ ContentSettingSubresourceFilterBubbleModel::AsSubresourceFilterBubbleModel() {
ContentSettingDownloadsBubbleModel::ContentSettingDownloadsBubbleModel( ContentSettingDownloadsBubbleModel::ContentSettingDownloadsBubbleModel(
Delegate* delegate, Delegate* delegate,
WebContents* web_contents, WebContents* web_contents)
Profile* profile) : ContentSettingBubbleModel(delegate, web_contents) {
: ContentSettingBubbleModel(delegate, web_contents, profile) {
SetTitle(); SetTitle();
SetManageText(); SetManageText();
SetRadioGroup(); SetRadioGroup();
...@@ -1467,12 +1383,11 @@ ContentSettingDownloadsBubbleModel::ContentSettingDownloadsBubbleModel( ...@@ -1467,12 +1383,11 @@ ContentSettingDownloadsBubbleModel::ContentSettingDownloadsBubbleModel(
ContentSettingDownloadsBubbleModel::~ContentSettingDownloadsBubbleModel() {} ContentSettingDownloadsBubbleModel::~ContentSettingDownloadsBubbleModel() {}
void ContentSettingDownloadsBubbleModel::CommitChanges() { void ContentSettingDownloadsBubbleModel::CommitChanges() {
if (profile() && if (selected_item() != bubble_content().radio_group.default_item) {
selected_item() != bubble_content().radio_group.default_item) {
ContentSetting setting = selected_item() == kAllowButtonIndex ContentSetting setting = selected_item() == kAllowButtonIndex
? CONTENT_SETTING_ALLOW ? CONTENT_SETTING_ALLOW
: CONTENT_SETTING_BLOCK; : CONTENT_SETTING_BLOCK;
auto* map = HostContentSettingsMapFactory::GetForProfile(profile()); auto* map = HostContentSettingsMapFactory::GetForProfile(GetProfile());
map->SetNarrowestContentSetting( map->SetNarrowestContentSetting(
bubble_content().radio_group.url, bubble_content().radio_group.url, bubble_content().radio_group.url, bubble_content().radio_group.url,
CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, setting); CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, setting);
...@@ -1517,13 +1432,10 @@ void ContentSettingDownloadsBubbleModel::SetRadioGroup() { ...@@ -1517,13 +1432,10 @@ void ContentSettingDownloadsBubbleModel::SetRadioGroup() {
} }
set_radio_group(radio_group); set_radio_group(radio_group);
set_radio_group_enabled(GetSettingManagedByUser( set_radio_group_enabled(GetSettingManagedByUser(
url, CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, profile(), nullptr)); url, CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, GetProfile(), nullptr));
} }
void ContentSettingDownloadsBubbleModel::SetTitle() { void ContentSettingDownloadsBubbleModel::SetTitle() {
if (!web_contents())
return;
DownloadRequestLimiter* download_request_limiter = DownloadRequestLimiter* download_request_limiter =
g_browser_process->download_request_limiter(); g_browser_process->download_request_limiter();
DCHECK(download_request_limiter); DCHECK(download_request_limiter);
...@@ -1554,16 +1466,11 @@ void ContentSettingDownloadsBubbleModel::OnManageButtonClicked() { ...@@ -1554,16 +1466,11 @@ void ContentSettingDownloadsBubbleModel::OnManageButtonClicked() {
// ContentSettingFramebustBlockBubbleModel ------------------------------------- // ContentSettingFramebustBlockBubbleModel -------------------------------------
ContentSettingFramebustBlockBubbleModel:: ContentSettingFramebustBlockBubbleModel::
ContentSettingFramebustBlockBubbleModel(Delegate* delegate, ContentSettingFramebustBlockBubbleModel(Delegate* delegate,
WebContents* web_contents, WebContents* web_contents)
Profile* profile)
: ContentSettingSingleRadioGroup(delegate, : ContentSettingSingleRadioGroup(delegate,
web_contents, web_contents,
profile,
CONTENT_SETTINGS_TYPE_POPUPS), CONTENT_SETTINGS_TYPE_POPUPS),
url_list_observer_(this) { url_list_observer_(this) {
if (!web_contents)
return;
set_title(l10n_util::GetStringUTF16(IDS_REDIRECT_BLOCKED_MESSAGE)); set_title(l10n_util::GetStringUTF16(IDS_REDIRECT_BLOCKED_MESSAGE));
auto* helper = FramebustBlockTabHelper::FromWebContents(web_contents); auto* helper = FramebustBlockTabHelper::FromWebContents(web_contents);
...@@ -1577,21 +1484,9 @@ ContentSettingFramebustBlockBubbleModel:: ...@@ -1577,21 +1484,9 @@ ContentSettingFramebustBlockBubbleModel::
ContentSettingFramebustBlockBubbleModel:: ContentSettingFramebustBlockBubbleModel::
~ContentSettingFramebustBlockBubbleModel() = default; ~ContentSettingFramebustBlockBubbleModel() = default;
void ContentSettingFramebustBlockBubbleModel::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED)
url_list_observer_.RemoveAll();
ContentSettingSingleRadioGroup::Observe(type, source, details);
}
void ContentSettingFramebustBlockBubbleModel::OnListItemClicked( void ContentSettingFramebustBlockBubbleModel::OnListItemClicked(
int index, int index,
int event_flags) { int event_flags) {
if (!web_contents())
return;
FramebustBlockTabHelper::FromWebContents(web_contents()) FramebustBlockTabHelper::FromWebContents(web_contents())
->OnBlockedUrlClicked(index); ->OnBlockedUrlClicked(index);
} }
...@@ -1619,45 +1514,46 @@ std::unique_ptr<ContentSettingBubbleModel> ...@@ -1619,45 +1514,46 @@ std::unique_ptr<ContentSettingBubbleModel>
ContentSettingBubbleModel::CreateContentSettingBubbleModel( ContentSettingBubbleModel::CreateContentSettingBubbleModel(
Delegate* delegate, Delegate* delegate,
WebContents* web_contents, WebContents* web_contents,
Profile* profile,
ContentSettingsType content_type) { ContentSettingsType content_type) {
DCHECK(web_contents);
if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) { if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) {
return std::make_unique<ContentSettingCookiesBubbleModel>( return std::make_unique<ContentSettingCookiesBubbleModel>(delegate,
delegate, web_contents, profile); web_contents);
} }
if (content_type == CONTENT_SETTINGS_TYPE_POPUPS) { if (content_type == CONTENT_SETTINGS_TYPE_POPUPS) {
return std::make_unique<ContentSettingPopupBubbleModel>( return std::make_unique<ContentSettingPopupBubbleModel>(delegate,
delegate, web_contents, profile); web_contents);
} }
if (content_type == CONTENT_SETTINGS_TYPE_GEOLOCATION) { if (content_type == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
return std::make_unique<ContentSettingDomainListBubbleModel>( return std::make_unique<ContentSettingDomainListBubbleModel>(
delegate, web_contents, profile, content_type); delegate, web_contents, content_type);
} }
if (content_type == CONTENT_SETTINGS_TYPE_PLUGINS) { if (content_type == CONTENT_SETTINGS_TYPE_PLUGINS) {
return std::make_unique<ContentSettingPluginBubbleModel>( return std::make_unique<ContentSettingPluginBubbleModel>(delegate,
delegate, web_contents, profile); web_contents);
} }
if (content_type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT) { if (content_type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT) {
return std::make_unique<ContentSettingMixedScriptBubbleModel>( return std::make_unique<ContentSettingMixedScriptBubbleModel>(delegate,
delegate, web_contents, profile); web_contents);
} }
if (content_type == CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS) { if (content_type == CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS) {
ProtocolHandlerRegistry* registry = ProtocolHandlerRegistry* registry =
ProtocolHandlerRegistryFactory::GetForBrowserContext(profile); ProtocolHandlerRegistryFactory::GetForBrowserContext(
web_contents->GetBrowserContext());
return std::make_unique<ContentSettingRPHBubbleModel>( return std::make_unique<ContentSettingRPHBubbleModel>(
delegate, web_contents, profile, registry); delegate, web_contents, registry);
} }
if (content_type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX) { if (content_type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX) {
return std::make_unique<ContentSettingMidiSysExBubbleModel>( return std::make_unique<ContentSettingMidiSysExBubbleModel>(delegate,
delegate, web_contents, profile); web_contents);
} }
if (content_type == CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS) { if (content_type == CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS) {
return std::make_unique<ContentSettingDownloadsBubbleModel>( return std::make_unique<ContentSettingDownloadsBubbleModel>(delegate,
delegate, web_contents, profile); web_contents);
} }
if (content_type == CONTENT_SETTINGS_TYPE_ADS) { if (content_type == CONTENT_SETTINGS_TYPE_ADS) {
return std::make_unique<ContentSettingSubresourceFilterBubbleModel>( return std::make_unique<ContentSettingSubresourceFilterBubbleModel>(
delegate, web_contents, profile); delegate, web_contents);
} }
if (content_type == CONTENT_SETTINGS_TYPE_IMAGES || if (content_type == CONTENT_SETTINGS_TYPE_IMAGES ||
content_type == CONTENT_SETTINGS_TYPE_JAVASCRIPT || content_type == CONTENT_SETTINGS_TYPE_JAVASCRIPT ||
...@@ -1666,24 +1562,19 @@ ContentSettingBubbleModel::CreateContentSettingBubbleModel( ...@@ -1666,24 +1562,19 @@ ContentSettingBubbleModel::CreateContentSettingBubbleModel(
content_type == CONTENT_SETTINGS_TYPE_CLIPBOARD_READ || content_type == CONTENT_SETTINGS_TYPE_CLIPBOARD_READ ||
content_type == CONTENT_SETTINGS_TYPE_SENSORS) { content_type == CONTENT_SETTINGS_TYPE_SENSORS) {
return std::make_unique<ContentSettingSingleRadioGroup>( return std::make_unique<ContentSettingSingleRadioGroup>(
delegate, web_contents, profile, content_type); delegate, web_contents, content_type);
} }
NOTREACHED() << "No bubble for the content type " << content_type << "."; NOTREACHED() << "No bubble for the content type " << content_type << ".";
return nullptr; return nullptr;
} }
ContentSettingBubbleModel::ContentSettingBubbleModel(Delegate* delegate, ContentSettingBubbleModel::ContentSettingBubbleModel(Delegate* delegate,
WebContents* web_contents, WebContents* web_contents)
Profile* profile)
: web_contents_(web_contents), : web_contents_(web_contents),
profile_(profile),
owner_(nullptr), owner_(nullptr),
delegate_(delegate), delegate_(delegate),
rappor_service_(g_browser_process->rappor_service()) { rappor_service_(g_browser_process->rappor_service()) {
registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, DCHECK(web_contents_);
content::Source<WebContents>(web_contents));
registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
content::Source<Profile>(profile_));
} }
ContentSettingBubbleModel::~ContentSettingBubbleModel() { ContentSettingBubbleModel::~ContentSettingBubbleModel() {
...@@ -1711,21 +1602,6 @@ ContentSettingBubbleModel::BubbleContent::BubbleContent() {} ...@@ -1711,21 +1602,6 @@ ContentSettingBubbleModel::BubbleContent::BubbleContent() {}
ContentSettingBubbleModel::BubbleContent::~BubbleContent() {} ContentSettingBubbleModel::BubbleContent::~BubbleContent() {}
void ContentSettingBubbleModel::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) {
DCHECK_EQ(web_contents_,
content::Source<WebContents>(source).ptr());
web_contents_ = nullptr;
} else {
DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type);
DCHECK_EQ(profile_, content::Source<Profile>(source).ptr());
profile_ = nullptr;
}
}
ContentSettingSimpleBubbleModel* ContentSettingSimpleBubbleModel*
ContentSettingBubbleModel::AsSimpleBubbleModel() { ContentSettingBubbleModel::AsSimpleBubbleModel() {
// In general, bubble models might not inherit from the simple bubble model. // In general, bubble models might not inherit from the simple bubble model.
...@@ -1753,6 +1629,10 @@ ContentSettingBubbleModel::AsFramebustBlockBubbleModel() { ...@@ -1753,6 +1629,10 @@ ContentSettingBubbleModel::AsFramebustBlockBubbleModel() {
return nullptr; return nullptr;
} }
Profile* ContentSettingBubbleModel::GetProfile() const {
return Profile::FromBrowserContext(web_contents_->GetBrowserContext());
}
void ContentSettingBubbleModel::AddListItem(const ListItem& item) { void ContentSettingBubbleModel::AddListItem(const ListItem& item) {
bubble_content_.list_items.push_back(item); bubble_content_.list_items.push_back(item);
if (owner_) if (owner_)
......
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
#include "chrome/common/custom_handlers/protocol_handler.h" #include "chrome/common/custom_handlers/protocol_handler.h"
#include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h" #include "components/content_settings/core/common/content_settings_types.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/common/media_stream_request.h" #include "content/public/common/media_stream_request.h"
#include "ui/gfx/image/image.h" #include "ui/gfx/image/image.h"
#include "url/gurl.h" #include "url/gurl.h"
...@@ -67,7 +65,7 @@ class ContentSettingFramebustBlockBubbleModel; ...@@ -67,7 +65,7 @@ class ContentSettingFramebustBlockBubbleModel;
// This model provides data for ContentSettingBubble, and also controls // This model provides data for ContentSettingBubble, and also controls
// the action triggered when the allow / block radio buttons are triggered. // the action triggered when the allow / block radio buttons are triggered.
class ContentSettingBubbleModel : public content::NotificationObserver { class ContentSettingBubbleModel {
public: public:
typedef ContentSettingBubbleModelDelegate Delegate; typedef ContentSettingBubbleModelDelegate Delegate;
...@@ -167,20 +165,14 @@ class ContentSettingBubbleModel : public content::NotificationObserver { ...@@ -167,20 +165,14 @@ class ContentSettingBubbleModel : public content::NotificationObserver {
static std::unique_ptr<ContentSettingBubbleModel> static std::unique_ptr<ContentSettingBubbleModel>
CreateContentSettingBubbleModel(Delegate* delegate, CreateContentSettingBubbleModel(Delegate* delegate,
content::WebContents* web_contents, content::WebContents* web_contents,
Profile* profile,
ContentSettingsType content_type); ContentSettingsType content_type);
~ContentSettingBubbleModel() override; virtual ~ContentSettingBubbleModel();
const BubbleContent& bubble_content() const { return bubble_content_; } const BubbleContent& bubble_content() const { return bubble_content_; }
void set_owner(Owner* owner) { owner_ = owner; } void set_owner(Owner* owner) { owner_ = owner; }
// content::NotificationObserver:
void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
virtual void OnListItemClicked(int index, int event_flags) {} virtual void OnListItemClicked(int index, int event_flags) {}
virtual void OnCustomLinkClicked() {} virtual void OnCustomLinkClicked() {}
virtual void OnManageButtonClicked() {} virtual void OnManageButtonClicked() {}
...@@ -221,13 +213,13 @@ class ContentSettingBubbleModel : public content::NotificationObserver { ...@@ -221,13 +213,13 @@ class ContentSettingBubbleModel : public content::NotificationObserver {
} }
protected: protected:
ContentSettingBubbleModel( // |web_contents| must outlive this.
Delegate* delegate, ContentSettingBubbleModel(Delegate* delegate,
content::WebContents* web_contents, content::WebContents* web_contents);
Profile* profile);
// Should always be non-nullptr.
content::WebContents* web_contents() const { return web_contents_; } content::WebContents* web_contents() const { return web_contents_; }
Profile* profile() const { return profile_; } Profile* GetProfile() const;
Delegate* delegate() const { return delegate_; } Delegate* delegate() const { return delegate_; }
int selected_item() const { return owner_->GetSelectedRadioOption(); } int selected_item() const { return owner_->GetSelectedRadioOption(); }
...@@ -274,12 +266,9 @@ class ContentSettingBubbleModel : public content::NotificationObserver { ...@@ -274,12 +266,9 @@ class ContentSettingBubbleModel : public content::NotificationObserver {
private: private:
content::WebContents* web_contents_; content::WebContents* web_contents_;
Profile* profile_;
Owner* owner_; Owner* owner_;
Delegate* delegate_; Delegate* delegate_;
BubbleContent bubble_content_; BubbleContent bubble_content_;
// A registrar for listening for WEB_CONTENTS_DESTROYED notifications.
content::NotificationRegistrar registrar_;
// The service used to record Rappor metrics. Can be set for testing. // The service used to record Rappor metrics. Can be set for testing.
rappor::RapporServiceImpl* rappor_service_; rappor::RapporServiceImpl* rappor_service_;
...@@ -291,7 +280,6 @@ class ContentSettingSimpleBubbleModel : public ContentSettingBubbleModel { ...@@ -291,7 +280,6 @@ class ContentSettingSimpleBubbleModel : public ContentSettingBubbleModel {
public: public:
ContentSettingSimpleBubbleModel(Delegate* delegate, ContentSettingSimpleBubbleModel(Delegate* delegate,
content::WebContents* web_contents, content::WebContents* web_contents,
Profile* profile,
ContentSettingsType content_type); ContentSettingsType content_type);
ContentSettingsType content_type() { return content_type_; } ContentSettingsType content_type() { return content_type_; }
...@@ -320,7 +308,6 @@ class ContentSettingRPHBubbleModel : public ContentSettingSimpleBubbleModel { ...@@ -320,7 +308,6 @@ class ContentSettingRPHBubbleModel : public ContentSettingSimpleBubbleModel {
public: public:
ContentSettingRPHBubbleModel(Delegate* delegate, ContentSettingRPHBubbleModel(Delegate* delegate,
content::WebContents* web_contents, content::WebContents* web_contents,
Profile* profile,
ProtocolHandlerRegistry* registry); ProtocolHandlerRegistry* registry);
~ContentSettingRPHBubbleModel() override; ~ContentSettingRPHBubbleModel() override;
...@@ -345,8 +332,7 @@ class ContentSettingRPHBubbleModel : public ContentSettingSimpleBubbleModel { ...@@ -345,8 +332,7 @@ class ContentSettingRPHBubbleModel : public ContentSettingSimpleBubbleModel {
class ContentSettingMediaStreamBubbleModel : public ContentSettingBubbleModel { class ContentSettingMediaStreamBubbleModel : public ContentSettingBubbleModel {
public: public:
ContentSettingMediaStreamBubbleModel(Delegate* delegate, ContentSettingMediaStreamBubbleModel(Delegate* delegate,
content::WebContents* web_contents, content::WebContents* web_contents);
Profile* profile);
~ContentSettingMediaStreamBubbleModel() override; ~ContentSettingMediaStreamBubbleModel() override;
...@@ -402,9 +388,9 @@ class ContentSettingMediaStreamBubbleModel : public ContentSettingBubbleModel { ...@@ -402,9 +388,9 @@ class ContentSettingMediaStreamBubbleModel : public ContentSettingBubbleModel {
class ContentSettingSubresourceFilterBubbleModel class ContentSettingSubresourceFilterBubbleModel
: public ContentSettingBubbleModel { : public ContentSettingBubbleModel {
public: public:
ContentSettingSubresourceFilterBubbleModel(Delegate* delegate, ContentSettingSubresourceFilterBubbleModel(
content::WebContents* web_contents, Delegate* delegate,
Profile* profile); content::WebContents* web_contents);
~ContentSettingSubresourceFilterBubbleModel() override; ~ContentSettingSubresourceFilterBubbleModel() override;
...@@ -429,8 +415,7 @@ class ContentSettingSubresourceFilterBubbleModel ...@@ -429,8 +415,7 @@ class ContentSettingSubresourceFilterBubbleModel
class ContentSettingDownloadsBubbleModel : public ContentSettingBubbleModel { class ContentSettingDownloadsBubbleModel : public ContentSettingBubbleModel {
public: public:
ContentSettingDownloadsBubbleModel(Delegate* delegate, ContentSettingDownloadsBubbleModel(Delegate* delegate,
content::WebContents* web_contents, content::WebContents* web_contents);
Profile* profile);
~ContentSettingDownloadsBubbleModel() override; ~ContentSettingDownloadsBubbleModel() override;
// ContentSettingBubbleModel overrides: // ContentSettingBubbleModel overrides:
...@@ -452,7 +437,6 @@ class ContentSettingSingleRadioGroup : public ContentSettingSimpleBubbleModel { ...@@ -452,7 +437,6 @@ class ContentSettingSingleRadioGroup : public ContentSettingSimpleBubbleModel {
public: public:
ContentSettingSingleRadioGroup(Delegate* delegate, ContentSettingSingleRadioGroup(Delegate* delegate,
content::WebContents* web_contents, content::WebContents* web_contents,
Profile* profile,
ContentSettingsType content_type); ContentSettingsType content_type);
~ContentSettingSingleRadioGroup() override; ~ContentSettingSingleRadioGroup() override;
...@@ -482,16 +466,10 @@ class ContentSettingFramebustBlockBubbleModel ...@@ -482,16 +466,10 @@ class ContentSettingFramebustBlockBubbleModel
public UrlListManager::Observer { public UrlListManager::Observer {
public: public:
ContentSettingFramebustBlockBubbleModel(Delegate* delegate, ContentSettingFramebustBlockBubbleModel(Delegate* delegate,
content::WebContents* web_contents, content::WebContents* web_contents);
Profile* profile);
~ContentSettingFramebustBlockBubbleModel() override; ~ContentSettingFramebustBlockBubbleModel() override;
// content::NotificationObserver:
void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
// ContentSettingBubbleModel: // ContentSettingBubbleModel:
void OnListItemClicked(int index, int event_flags) override; void OnListItemClicked(int index, int event_flags) override;
ContentSettingFramebustBlockBubbleModel* AsFramebustBlockBubbleModel() ContentSettingFramebustBlockBubbleModel* AsFramebustBlockBubbleModel()
......
...@@ -68,7 +68,7 @@ IN_PROC_BROWSER_TEST_F(ContentSettingBubbleModelMixedScriptTest, MainFrame) { ...@@ -68,7 +68,7 @@ IN_PROC_BROWSER_TEST_F(ContentSettingBubbleModelMixedScriptTest, MainFrame) {
ContentSettingBubbleModel::CreateContentSettingBubbleModel( ContentSettingBubbleModel::CreateContentSettingBubbleModel(
browser()->content_setting_bubble_model_delegate(), browser()->content_setting_bubble_model_delegate(),
browser()->tab_strip_model()->GetActiveWebContents(), browser()->tab_strip_model()->GetActiveWebContents(),
browser()->profile(), CONTENT_SETTINGS_TYPE_MIXEDSCRIPT)); CONTENT_SETTINGS_TYPE_MIXEDSCRIPT));
model->OnCustomLinkClicked(); model->OnCustomLinkClicked();
// Wait for reload // Wait for reload
...@@ -128,7 +128,7 @@ IN_PROC_BROWSER_TEST_F(ContentSettingsMixedScriptIgnoreCertErrorsTest, ...@@ -128,7 +128,7 @@ IN_PROC_BROWSER_TEST_F(ContentSettingsMixedScriptIgnoreCertErrorsTest,
ContentSettingBubbleModel::CreateContentSettingBubbleModel( ContentSettingBubbleModel::CreateContentSettingBubbleModel(
browser()->content_setting_bubble_model_delegate(), browser()->content_setting_bubble_model_delegate(),
browser()->tab_strip_model()->GetActiveWebContents(), browser()->tab_strip_model()->GetActiveWebContents(),
browser()->profile(), CONTENT_SETTINGS_TYPE_MIXEDSCRIPT)); CONTENT_SETTINGS_TYPE_MIXEDSCRIPT));
model->SetRapporServiceImplForTesting(&rappor_service); model->SetRapporServiceImplForTesting(&rappor_service);
model->OnCustomLinkClicked(); model->OnCustomLinkClicked();
...@@ -187,8 +187,7 @@ class ContentSettingBubbleModelMediaStreamTest : public InProcessBrowserTest { ...@@ -187,8 +187,7 @@ class ContentSettingBubbleModelMediaStreamTest : public InProcessBrowserTest {
state, std::string(), std::string(), std::string(), std::string()); state, std::string(), std::string(), std::string(), std::string());
std::unique_ptr<ContentSettingBubbleModel> bubble( std::unique_ptr<ContentSettingBubbleModel> bubble(
new ContentSettingMediaStreamBubbleModel( new ContentSettingMediaStreamBubbleModel(
browser()->content_setting_bubble_model_delegate(), original_tab, browser()->content_setting_bubble_model_delegate(), original_tab));
browser()->profile()));
// Click the manage button, which opens in a new tab or window. Wait until // Click the manage button, which opens in a new tab or window. Wait until
// it loads. // it loads.
...@@ -264,7 +263,7 @@ IN_PROC_BROWSER_TEST_F(ContentSettingBubbleModelPopupTest, ...@@ -264,7 +263,7 @@ IN_PROC_BROWSER_TEST_F(ContentSettingBubbleModelPopupTest,
ContentSettingBubbleModel::CreateContentSettingBubbleModel( ContentSettingBubbleModel::CreateContentSettingBubbleModel(
browser()->content_setting_bubble_model_delegate(), browser()->content_setting_bubble_model_delegate(),
browser()->tab_strip_model()->GetActiveWebContents(), browser()->tab_strip_model()->GetActiveWebContents(),
browser()->profile(), CONTENT_SETTINGS_TYPE_POPUPS)); CONTENT_SETTINGS_TYPE_POPUPS));
std::unique_ptr<FakeOwner> owner = std::unique_ptr<FakeOwner> owner =
FakeOwner::Create(*model, kDisallowButtonIndex); FakeOwner::Create(*model, kDisallowButtonIndex);
...@@ -341,7 +340,7 @@ IN_PROC_BROWSER_TEST_F(ContentSettingBubbleModelMixedScriptOopifTest, ...@@ -341,7 +340,7 @@ IN_PROC_BROWSER_TEST_F(ContentSettingBubbleModelMixedScriptOopifTest,
std::unique_ptr<ContentSettingBubbleModel> model( std::unique_ptr<ContentSettingBubbleModel> model(
ContentSettingBubbleModel::CreateContentSettingBubbleModel( ContentSettingBubbleModel::CreateContentSettingBubbleModel(
browser()->content_setting_bubble_model_delegate(), web_contents, browser()->content_setting_bubble_model_delegate(), web_contents,
browser()->profile(), CONTENT_SETTINGS_TYPE_MIXEDSCRIPT)); CONTENT_SETTINGS_TYPE_MIXEDSCRIPT));
model->OnCustomLinkClicked(); model->OnCustomLinkClicked();
// Wait for reload and verify that mixed content is allowed. // Wait for reload and verify that mixed content is allowed.
......
...@@ -54,8 +54,7 @@ class ContentSettingBubbleModelTest : public ChromeRenderViewHostTestHarness { ...@@ -54,8 +54,7 @@ class ContentSettingBubbleModelTest : public ChromeRenderViewHostTestHarness {
bool expect_reload_hint) { bool expect_reload_hint) {
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
ContentSettingBubbleModel::CreateContentSettingBubbleModel( ContentSettingBubbleModel::CreateContentSettingBubbleModel(
NULL, web_contents(), profile(), NULL, web_contents(), CONTENT_SETTINGS_TYPE_GEOLOCATION));
CONTENT_SETTINGS_TYPE_GEOLOCATION));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
EXPECT_TRUE(bubble_content.title.empty()); EXPECT_TRUE(bubble_content.title.empty());
...@@ -88,7 +87,7 @@ TEST_F(ContentSettingBubbleModelTest, ImageRadios) { ...@@ -88,7 +87,7 @@ TEST_F(ContentSettingBubbleModelTest, ImageRadios) {
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
ContentSettingBubbleModel::CreateContentSettingBubbleModel( ContentSettingBubbleModel::CreateContentSettingBubbleModel(
NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_IMAGES)); NULL, web_contents(), CONTENT_SETTINGS_TYPE_IMAGES));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
EXPECT_FALSE(bubble_content.title.empty()); EXPECT_FALSE(bubble_content.title.empty());
...@@ -107,7 +106,7 @@ TEST_F(ContentSettingBubbleModelTest, Cookies) { ...@@ -107,7 +106,7 @@ TEST_F(ContentSettingBubbleModelTest, Cookies) {
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
ContentSettingBubbleModel::CreateContentSettingBubbleModel( ContentSettingBubbleModel::CreateContentSettingBubbleModel(
NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES)); NULL, web_contents(), CONTENT_SETTINGS_TYPE_COOKIES));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
base::string16 title = bubble_content.title; base::string16 title = bubble_content.title;
...@@ -121,7 +120,7 @@ TEST_F(ContentSettingBubbleModelTest, Cookies) { ...@@ -121,7 +120,7 @@ TEST_F(ContentSettingBubbleModelTest, Cookies) {
content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES);
content_setting_bubble_model = content_setting_bubble_model =
ContentSettingBubbleModel::CreateContentSettingBubbleModel( ContentSettingBubbleModel::CreateContentSettingBubbleModel(
NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES); NULL, web_contents(), CONTENT_SETTINGS_TYPE_COOKIES);
const ContentSettingBubbleModel::BubbleContent& bubble_content_2 = const ContentSettingBubbleModel::BubbleContent& bubble_content_2 =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
...@@ -160,8 +159,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamMicAndCamera) { ...@@ -160,8 +159,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamMicAndCamera) {
std::string()); std::string());
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), new ContentSettingMediaStreamBubbleModel(nullptr, web_contents()));
profile()));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
EXPECT_EQ(bubble_content.title, EXPECT_EQ(bubble_content.title,
...@@ -217,8 +215,7 @@ TEST_F(ContentSettingBubbleModelTest, BlockedMediastreamMicAndCamera) { ...@@ -217,8 +215,7 @@ TEST_F(ContentSettingBubbleModelTest, BlockedMediastreamMicAndCamera) {
std::string()); std::string());
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), new ContentSettingMediaStreamBubbleModel(nullptr, web_contents()));
profile()));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
// Test if the correct radio item is selected for the blocked mediastream // Test if the correct radio item is selected for the blocked mediastream
...@@ -291,8 +288,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubble) { ...@@ -291,8 +288,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubble) {
std::string()); std::string());
{ {
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), new ContentSettingMediaStreamBubbleModel(nullptr, web_contents()));
profile()));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
// Test if the correct radio item is selected for the blocked mediastream // Test if the correct radio item is selected for the blocked mediastream
...@@ -314,8 +310,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubble) { ...@@ -314,8 +310,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubble) {
{ {
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), new ContentSettingMediaStreamBubbleModel(nullptr, web_contents()));
profile()));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
// Test that the reload hint is displayed. // Test that the reload hint is displayed.
...@@ -341,8 +336,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubble) { ...@@ -341,8 +336,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubble) {
{ {
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), new ContentSettingMediaStreamBubbleModel(nullptr, web_contents()));
profile()));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
// Test that the reload hint is not displayed any more. // Test that the reload hint is not displayed any more.
...@@ -389,8 +383,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubbleMediaMenus) { ...@@ -389,8 +383,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubbleMediaMenus) {
std::string()); std::string());
{ {
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), new ContentSettingMediaStreamBubbleModel(nullptr, web_contents()));
profile()));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
std::unique_ptr<FakeOwner> owner = FakeOwner::Create( std::unique_ptr<FakeOwner> owner = FakeOwner::Create(
...@@ -413,8 +406,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubbleMediaMenus) { ...@@ -413,8 +406,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubbleMediaMenus) {
} }
{ {
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), new ContentSettingMediaStreamBubbleModel(nullptr, web_contents()));
profile()));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
std::unique_ptr<FakeOwner> owner = FakeOwner::Create( std::unique_ptr<FakeOwner> owner = FakeOwner::Create(
...@@ -450,8 +442,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubbleMediaMenus) { ...@@ -450,8 +442,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubbleMediaMenus) {
{ {
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), new ContentSettingMediaStreamBubbleModel(nullptr, web_contents()));
profile()));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
std::unique_ptr<FakeOwner> owner = FakeOwner::Create( std::unique_ptr<FakeOwner> owner = FakeOwner::Create(
...@@ -476,8 +467,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubbleMediaMenus) { ...@@ -476,8 +467,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubbleMediaMenus) {
{ {
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), new ContentSettingMediaStreamBubbleModel(nullptr, web_contents()));
profile()));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
std::unique_ptr<FakeOwner> owner = FakeOwner::Create( std::unique_ptr<FakeOwner> owner = FakeOwner::Create(
...@@ -500,8 +490,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubbleMediaMenus) { ...@@ -500,8 +490,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubbleMediaMenus) {
{ {
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), new ContentSettingMediaStreamBubbleModel(nullptr, web_contents()));
profile()));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
std::unique_ptr<FakeOwner> owner = FakeOwner::Create( std::unique_ptr<FakeOwner> owner = FakeOwner::Create(
...@@ -540,8 +529,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamMic) { ...@@ -540,8 +529,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamMic) {
std::string()); std::string());
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), new ContentSettingMediaStreamBubbleModel(nullptr, web_contents()));
profile()));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
EXPECT_EQ(bubble_content.title, EXPECT_EQ(bubble_content.title,
...@@ -572,8 +560,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamMic) { ...@@ -572,8 +560,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamMic) {
std::string(), std::string(),
std::string()); std::string());
content_setting_bubble_model.reset( content_setting_bubble_model.reset(
new ContentSettingMediaStreamBubbleModel( new ContentSettingMediaStreamBubbleModel(nullptr, web_contents()));
nullptr, web_contents(), profile()));
const ContentSettingBubbleModel::BubbleContent& new_bubble_content = const ContentSettingBubbleModel::BubbleContent& new_bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
EXPECT_EQ(new_bubble_content.title, EXPECT_EQ(new_bubble_content.title,
...@@ -615,8 +602,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamCamera) { ...@@ -615,8 +602,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamCamera) {
std::string()); std::string());
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), new ContentSettingMediaStreamBubbleModel(nullptr, web_contents()));
profile()));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
EXPECT_EQ(bubble_content.title, EXPECT_EQ(bubble_content.title,
...@@ -647,8 +633,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamCamera) { ...@@ -647,8 +633,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamCamera) {
std::string(), std::string(),
std::string()); std::string());
content_setting_bubble_model.reset( content_setting_bubble_model.reset(
new ContentSettingMediaStreamBubbleModel( new ContentSettingMediaStreamBubbleModel(nullptr, web_contents()));
nullptr, web_contents(), profile()));
const ContentSettingBubbleModel::BubbleContent& new_bubble_content = const ContentSettingBubbleModel::BubbleContent& new_bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
EXPECT_EQ(new_bubble_content.title, EXPECT_EQ(new_bubble_content.title,
...@@ -693,8 +678,7 @@ TEST_F(ContentSettingBubbleModelTest, AccumulateMediastreamMicAndCamera) { ...@@ -693,8 +678,7 @@ TEST_F(ContentSettingBubbleModelTest, AccumulateMediastreamMicAndCamera) {
std::string()); std::string());
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), new ContentSettingMediaStreamBubbleModel(nullptr, web_contents()));
profile()));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
EXPECT_EQ(bubble_content.title, EXPECT_EQ(bubble_content.title,
...@@ -723,8 +707,7 @@ TEST_F(ContentSettingBubbleModelTest, AccumulateMediastreamMicAndCamera) { ...@@ -723,8 +707,7 @@ TEST_F(ContentSettingBubbleModelTest, AccumulateMediastreamMicAndCamera) {
std::string()); std::string());
content_setting_bubble_model.reset( content_setting_bubble_model.reset(
new ContentSettingMediaStreamBubbleModel( new ContentSettingMediaStreamBubbleModel(nullptr, web_contents()));
nullptr, web_contents(), profile()));
const ContentSettingBubbleModel::BubbleContent& new_bubble_content = const ContentSettingBubbleModel::BubbleContent& new_bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
EXPECT_EQ(new_bubble_content.title, EXPECT_EQ(new_bubble_content.title,
...@@ -755,7 +738,7 @@ TEST_F(ContentSettingBubbleModelTest, Plugins) { ...@@ -755,7 +738,7 @@ TEST_F(ContentSettingBubbleModelTest, Plugins) {
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
ContentSettingBubbleModel::CreateContentSettingBubbleModel( ContentSettingBubbleModel::CreateContentSettingBubbleModel(
NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_PLUGINS)); NULL, web_contents(), CONTENT_SETTINGS_TYPE_PLUGINS));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
EXPECT_FALSE(bubble_content.title.empty()); EXPECT_FALSE(bubble_content.title.empty());
...@@ -776,7 +759,7 @@ TEST_F(ContentSettingBubbleModelTest, PepperBroker) { ...@@ -776,7 +759,7 @@ TEST_F(ContentSettingBubbleModelTest, PepperBroker) {
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
ContentSettingBubbleModel::CreateContentSettingBubbleModel( ContentSettingBubbleModel::CreateContentSettingBubbleModel(
NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_PPAPI_BROKER)); NULL, web_contents(), CONTENT_SETTINGS_TYPE_PPAPI_BROKER));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
...@@ -793,7 +776,7 @@ TEST_F(ContentSettingBubbleModelTest, PepperBroker) { ...@@ -793,7 +776,7 @@ TEST_F(ContentSettingBubbleModelTest, PepperBroker) {
content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_PPAPI_BROKER);
content_setting_bubble_model = content_setting_bubble_model =
ContentSettingBubbleModel::CreateContentSettingBubbleModel( ContentSettingBubbleModel::CreateContentSettingBubbleModel(
NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_PPAPI_BROKER); NULL, web_contents(), CONTENT_SETTINGS_TYPE_PPAPI_BROKER);
const ContentSettingBubbleModel::BubbleContent& bubble_content_2 = const ContentSettingBubbleModel::BubbleContent& bubble_content_2 =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
...@@ -849,7 +832,7 @@ TEST_F(ContentSettingBubbleModelTest, FileURL) { ...@@ -849,7 +832,7 @@ TEST_F(ContentSettingBubbleModelTest, FileURL) {
CONTENT_SETTINGS_TYPE_IMAGES); CONTENT_SETTINGS_TYPE_IMAGES);
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
ContentSettingBubbleModel::CreateContentSettingBubbleModel( ContentSettingBubbleModel::CreateContentSettingBubbleModel(
nullptr, web_contents(), profile(), CONTENT_SETTINGS_TYPE_IMAGES)); nullptr, web_contents(), CONTENT_SETTINGS_TYPE_IMAGES));
base::string16 title = base::string16 title =
content_setting_bubble_model->bubble_content().radio_group.radio_items[0]; content_setting_bubble_model->bubble_content().radio_group.radio_items[0];
ASSERT_NE(base::string16::npos, title.find(base::UTF8ToUTF16(file_url))); ASSERT_NE(base::string16::npos, title.find(base::UTF8ToUTF16(file_url)));
...@@ -865,7 +848,7 @@ TEST_F(ContentSettingBubbleModelTest, RegisterProtocolHandler) { ...@@ -865,7 +848,7 @@ TEST_F(ContentSettingBubbleModelTest, RegisterProtocolHandler) {
"mailto", GURL("http://www.toplevel.example/"))); "mailto", GURL("http://www.toplevel.example/")));
ContentSettingRPHBubbleModel content_setting_bubble_model( ContentSettingRPHBubbleModel content_setting_bubble_model(
NULL, web_contents(), profile(), NULL); NULL, web_contents(), NULL);
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model.bubble_content(); content_setting_bubble_model.bubble_content();
...@@ -906,7 +889,7 @@ TEST_F(ContentSettingBubbleModelTest, RPHAllow) { ...@@ -906,7 +889,7 @@ TEST_F(ContentSettingBubbleModelTest, RPHAllow) {
content_settings->set_pending_protocol_handler(test_handler); content_settings->set_pending_protocol_handler(test_handler);
ContentSettingRPHBubbleModel content_setting_bubble_model( ContentSettingRPHBubbleModel content_setting_bubble_model(
NULL, web_contents(), profile(), &registry); NULL, web_contents(), &registry);
std::unique_ptr<FakeOwner> owner = std::unique_ptr<FakeOwner> owner =
FakeOwner::Create(content_setting_bubble_model, 0); FakeOwner::Create(content_setting_bubble_model, 0);
...@@ -971,7 +954,7 @@ TEST_F(ContentSettingBubbleModelTest, RPHDefaultDone) { ...@@ -971,7 +954,7 @@ TEST_F(ContentSettingBubbleModelTest, RPHDefaultDone) {
content_settings->set_pending_protocol_handler(test_handler); content_settings->set_pending_protocol_handler(test_handler);
ContentSettingRPHBubbleModel content_setting_bubble_model( ContentSettingRPHBubbleModel content_setting_bubble_model(
NULL, web_contents(), profile(), &registry); NULL, web_contents(), &registry);
std::unique_ptr<FakeOwner> owner = FakeOwner::Create( std::unique_ptr<FakeOwner> owner = FakeOwner::Create(
content_setting_bubble_model, content_setting_bubble_model,
content_setting_bubble_model.bubble_content().radio_group.default_item); content_setting_bubble_model.bubble_content().radio_group.default_item);
...@@ -991,8 +974,7 @@ TEST_F(ContentSettingBubbleModelTest, RPHDefaultDone) { ...@@ -991,8 +974,7 @@ TEST_F(ContentSettingBubbleModelTest, RPHDefaultDone) {
TEST_F(ContentSettingBubbleModelTest, SubresourceFilter) { TEST_F(ContentSettingBubbleModelTest, SubresourceFilter) {
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
new ContentSettingSubresourceFilterBubbleModel(nullptr, web_contents(), new ContentSettingSubresourceFilterBubbleModel(nullptr, web_contents()));
profile()));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
EXPECT_EQ(bubble_content.title, EXPECT_EQ(bubble_content.title,
...@@ -1019,7 +1001,7 @@ TEST_F(ContentSettingBubbleModelTest, PopupBubbleModelListItems) { ...@@ -1019,7 +1001,7 @@ TEST_F(ContentSettingBubbleModelTest, PopupBubbleModelListItems) {
PopupBlockerTabHelper::CreateForWebContents(web_contents()); PopupBlockerTabHelper::CreateForWebContents(web_contents());
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
ContentSettingBubbleModel::CreateContentSettingBubbleModel( ContentSettingBubbleModel::CreateContentSettingBubbleModel(
nullptr, web_contents(), profile(), CONTENT_SETTINGS_TYPE_POPUPS)); nullptr, web_contents(), CONTENT_SETTINGS_TYPE_POPUPS));
const auto& list_items = const auto& list_items =
content_setting_bubble_model->bubble_content().list_items; content_setting_bubble_model->bubble_content().list_items;
EXPECT_EQ(0U, list_items.size()); EXPECT_EQ(0U, list_items.size());
...@@ -1048,7 +1030,7 @@ TEST_F(ContentSettingBubbleModelTest, ValidUrl) { ...@@ -1048,7 +1030,7 @@ TEST_F(ContentSettingBubbleModelTest, ValidUrl) {
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
ContentSettingBubbleModel::CreateContentSettingBubbleModel( ContentSettingBubbleModel::CreateContentSettingBubbleModel(
NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES)); NULL, web_contents(), CONTENT_SETTINGS_TYPE_COOKIES));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
...@@ -1065,7 +1047,7 @@ TEST_F(ContentSettingBubbleModelTest, InvalidUrl) { ...@@ -1065,7 +1047,7 @@ TEST_F(ContentSettingBubbleModelTest, InvalidUrl) {
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
ContentSettingBubbleModel::CreateContentSettingBubbleModel( ContentSettingBubbleModel::CreateContentSettingBubbleModel(
NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES)); NULL, web_contents(), CONTENT_SETTINGS_TYPE_COOKIES));
const ContentSettingBubbleModel::BubbleContent& bubble_content = const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content(); content_setting_bubble_model->bubble_content();
......
...@@ -126,8 +126,7 @@ class ContentSettingMediaImageModel : public ContentSettingImageModel { ...@@ -126,8 +126,7 @@ class ContentSettingMediaImageModel : public ContentSettingImageModel {
std::unique_ptr<ContentSettingBubbleModel> CreateBubbleModelImpl( std::unique_ptr<ContentSettingBubbleModel> CreateBubbleModelImpl(
ContentSettingBubbleModel::Delegate* delegate, ContentSettingBubbleModel::Delegate* delegate,
WebContents* web_contents, WebContents* web_contents) override;
Profile* profile) override;
private: private:
DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaImageModel); DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaImageModel);
...@@ -215,13 +214,9 @@ ContentSettingSimpleImageModel::ContentSettingSimpleImageModel( ...@@ -215,13 +214,9 @@ ContentSettingSimpleImageModel::ContentSettingSimpleImageModel(
std::unique_ptr<ContentSettingBubbleModel> std::unique_ptr<ContentSettingBubbleModel>
ContentSettingSimpleImageModel::CreateBubbleModelImpl( ContentSettingSimpleImageModel::CreateBubbleModelImpl(
ContentSettingBubbleModel::Delegate* delegate, ContentSettingBubbleModel::Delegate* delegate,
WebContents* web_contents, WebContents* web_contents) {
Profile* profile) {
return ContentSettingBubbleModel::CreateContentSettingBubbleModel( return ContentSettingBubbleModel::CreateContentSettingBubbleModel(
delegate, delegate, web_contents, content_type());
web_contents,
profile,
content_type());
} }
// static // static
...@@ -548,10 +543,9 @@ bool ContentSettingMediaImageModel::UpdateAndGetVisibility( ...@@ -548,10 +543,9 @@ bool ContentSettingMediaImageModel::UpdateAndGetVisibility(
std::unique_ptr<ContentSettingBubbleModel> std::unique_ptr<ContentSettingBubbleModel>
ContentSettingMediaImageModel::CreateBubbleModelImpl( ContentSettingMediaImageModel::CreateBubbleModelImpl(
ContentSettingBubbleModel::Delegate* delegate, ContentSettingBubbleModel::Delegate* delegate,
WebContents* web_contents, WebContents* web_contents) {
Profile* profile) { return std::make_unique<ContentSettingMediaStreamBubbleModel>(delegate,
return std::make_unique<ContentSettingMediaStreamBubbleModel>( web_contents);
delegate, web_contents, profile);
} }
// Blocked Framebust ----------------------------------------------------------- // Blocked Framebust -----------------------------------------------------------
...@@ -573,10 +567,9 @@ bool ContentSettingFramebustBlockImageModel::UpdateAndGetVisibility( ...@@ -573,10 +567,9 @@ bool ContentSettingFramebustBlockImageModel::UpdateAndGetVisibility(
std::unique_ptr<ContentSettingBubbleModel> std::unique_ptr<ContentSettingBubbleModel>
ContentSettingFramebustBlockImageModel::CreateBubbleModelImpl( ContentSettingFramebustBlockImageModel::CreateBubbleModelImpl(
ContentSettingBubbleModel::Delegate* delegate, ContentSettingBubbleModel::Delegate* delegate,
WebContents* web_contents, WebContents* web_contents) {
Profile* profile) {
return std::make_unique<ContentSettingFramebustBlockBubbleModel>( return std::make_unique<ContentSettingFramebustBlockBubbleModel>(
delegate, web_contents, profile); delegate, web_contents);
} }
// Sensors --------------------------------------------------------------------- // Sensors ---------------------------------------------------------------------
...@@ -639,12 +632,12 @@ ContentSettingImageModel::ContentSettingImageModel(ImageType image_type) ...@@ -639,12 +632,12 @@ ContentSettingImageModel::ContentSettingImageModel(ImageType image_type)
std::unique_ptr<ContentSettingBubbleModel> std::unique_ptr<ContentSettingBubbleModel>
ContentSettingImageModel::CreateBubbleModel( ContentSettingImageModel::CreateBubbleModel(
ContentSettingBubbleModel::Delegate* delegate, ContentSettingBubbleModel::Delegate* delegate,
content::WebContents* web_contents, content::WebContents* web_contents) {
Profile* profile) { DCHECK(web_contents);
UMA_HISTOGRAM_ENUMERATION( UMA_HISTOGRAM_ENUMERATION(
"ContentSettings.ImagePressed", image_type(), "ContentSettings.ImagePressed", image_type(),
ContentSettingImageModel::ImageType::NUM_IMAGE_TYPES); ContentSettingImageModel::ImageType::NUM_IMAGE_TYPES);
return CreateBubbleModelImpl(delegate, web_contents, profile); return CreateBubbleModelImpl(delegate, web_contents);
} }
// static // static
......
...@@ -72,8 +72,7 @@ class ContentSettingImageModel { ...@@ -72,8 +72,7 @@ class ContentSettingImageModel {
// Creates the model for the bubble that will be attached to this image. // Creates the model for the bubble that will be attached to this image.
std::unique_ptr<ContentSettingBubbleModel> CreateBubbleModel( std::unique_ptr<ContentSettingBubbleModel> CreateBubbleModel(
ContentSettingBubbleModel::Delegate* delegate, ContentSettingBubbleModel::Delegate* delegate,
content::WebContents* web_contents, content::WebContents* web_contents);
Profile* profile);
// Whether the animation should be run for the given |web_contents|. // Whether the animation should be run for the given |web_contents|.
bool ShouldRunAnimation(content::WebContents* web_contents); bool ShouldRunAnimation(content::WebContents* web_contents);
...@@ -106,8 +105,7 @@ class ContentSettingImageModel { ...@@ -106,8 +105,7 @@ class ContentSettingImageModel {
// Internal implementation by subclasses of bubble model creation. // Internal implementation by subclasses of bubble model creation.
virtual std::unique_ptr<ContentSettingBubbleModel> CreateBubbleModelImpl( virtual std::unique_ptr<ContentSettingBubbleModel> CreateBubbleModelImpl(
ContentSettingBubbleModel::Delegate* delegate, ContentSettingBubbleModel::Delegate* delegate,
content::WebContents* web_contents, content::WebContents* web_contents) = 0;
Profile* profile) = 0;
void set_icon(const gfx::VectorIcon& icon, const gfx::VectorIcon& badge) { void set_icon(const gfx::VectorIcon& icon, const gfx::VectorIcon& badge) {
icon_ = &icon; icon_ = &icon;
...@@ -140,8 +138,7 @@ class ContentSettingSimpleImageModel : public ContentSettingImageModel { ...@@ -140,8 +138,7 @@ class ContentSettingSimpleImageModel : public ContentSettingImageModel {
// ContentSettingImageModel implementation. // ContentSettingImageModel implementation.
std::unique_ptr<ContentSettingBubbleModel> CreateBubbleModelImpl( std::unique_ptr<ContentSettingBubbleModel> CreateBubbleModelImpl(
ContentSettingBubbleModel::Delegate* delegate, ContentSettingBubbleModel::Delegate* delegate,
content::WebContents* web_contents, content::WebContents* web_contents) override;
Profile* profile) override;
ContentSettingsType content_type() { return content_type_; } ContentSettingsType content_type() { return content_type_; }
...@@ -159,8 +156,7 @@ class ContentSettingFramebustBlockImageModel : public ContentSettingImageModel { ...@@ -159,8 +156,7 @@ class ContentSettingFramebustBlockImageModel : public ContentSettingImageModel {
std::unique_ptr<ContentSettingBubbleModel> CreateBubbleModelImpl( std::unique_ptr<ContentSettingBubbleModel> CreateBubbleModelImpl(
ContentSettingBubbleModel::Delegate* delegate, ContentSettingBubbleModel::Delegate* delegate,
content::WebContents* web_contents, content::WebContents* web_contents) override;
Profile* profile) override;
private: private:
DISALLOW_COPY_AND_ASSIGN(ContentSettingFramebustBlockImageModel); DISALLOW_COPY_AND_ASSIGN(ContentSettingFramebustBlockImageModel);
......
...@@ -54,11 +54,10 @@ IN_PROC_BROWSER_TEST_F(ContentSettingImageModelBrowserTest, CreateBubbleModel) { ...@@ -54,11 +54,10 @@ IN_PROC_BROWSER_TEST_F(ContentSettingImageModelBrowserTest, CreateBubbleModel) {
ImageType::MIDI_SYSEX, ImageType::MIDI_SYSEX,
}; };
Profile* profile = browser()->profile();
for (auto type : content_settings_to_test) { for (auto type : content_settings_to_test) {
auto model = ContentSettingImageModel::CreateForContentType(type); auto model = ContentSettingImageModel::CreateForContentType(type);
std::unique_ptr<ContentSettingBubbleModel> bubble( std::unique_ptr<ContentSettingBubbleModel> bubble(
model->CreateBubbleModel(nullptr, web_contents, profile)); model->CreateBubbleModel(nullptr, web_contents));
// All of the above content settings should create a // All of the above content settings should create a
// ContentSettingSimpleBubbleModel that is tied to a particular setting, // ContentSettingSimpleBubbleModel that is tied to a particular setting,
...@@ -78,7 +77,7 @@ IN_PROC_BROWSER_TEST_F(ContentSettingImageModelBrowserTest, CreateBubbleModel) { ...@@ -78,7 +77,7 @@ IN_PROC_BROWSER_TEST_F(ContentSettingImageModelBrowserTest, CreateBubbleModel) {
std::vector<std::unique_ptr<ContentSettingImageModel>> models = std::vector<std::unique_ptr<ContentSettingImageModel>> models =
ContentSettingImageModel::GenerateContentSettingImageModels(); ContentSettingImageModel::GenerateContentSettingImageModels();
for (auto& model : models) { for (auto& model : models) {
EXPECT_TRUE(model->CreateBubbleModel(nullptr, web_contents, profile)); EXPECT_TRUE(model->CreateBubbleModel(nullptr, web_contents));
EXPECT_TRUE(image_types.insert(model->image_type()).second); EXPECT_TRUE(image_types.insert(model->image_type()).second);
} }
} }
...@@ -116,10 +115,8 @@ IN_PROC_BROWSER_TEST_F(ContentSettingImageModelBrowserTest, ...@@ -116,10 +115,8 @@ IN_PROC_BROWSER_TEST_F(ContentSettingImageModelBrowserTest,
browser()->tab_strip_model()->GetActiveWebContents(); browser()->tab_strip_model()->GetActiveWebContents();
auto model = ContentSettingImageModel::CreateForContentType(ImageType::ADS); auto model = ContentSettingImageModel::CreateForContentType(ImageType::ADS);
Profile* profile = browser()->profile();
std::unique_ptr<ContentSettingBubbleModel> bubble(model->CreateBubbleModel( std::unique_ptr<ContentSettingBubbleModel> bubble(model->CreateBubbleModel(
browser()->content_setting_bubble_model_delegate(), web_contents, browser()->content_setting_bubble_model_delegate(), web_contents));
profile));
content::TestNavigationObserver observer(nullptr); content::TestNavigationObserver observer(nullptr);
observer.StartWatchingNewWebContents(); observer.StartWatchingNewWebContents();
......
...@@ -128,8 +128,7 @@ IN_PROC_BROWSER_TEST_F(FramebustBlockBrowserTest, ModelAllowsRedirection) { ...@@ -128,8 +128,7 @@ IN_PROC_BROWSER_TEST_F(FramebustBlockBrowserTest, ModelAllowsRedirection) {
// Simulate clicking on the second blocked URL. // Simulate clicking on the second blocked URL.
ContentSettingFramebustBlockBubbleModel framebust_block_bubble_model( ContentSettingFramebustBlockBubbleModel framebust_block_bubble_model(
browser()->content_setting_bubble_model_delegate(), GetWebContents(), browser()->content_setting_bubble_model_delegate(), GetWebContents());
browser()->profile());
EXPECT_FALSE(clicked_index_.has_value()); EXPECT_FALSE(clicked_index_.has_value());
EXPECT_FALSE(clicked_url_.has_value()); EXPECT_FALSE(clicked_url_.has_value());
...@@ -166,8 +165,7 @@ IN_PROC_BROWSER_TEST_F(FramebustBlockBrowserTest, AllowRadioButtonSelected) { ...@@ -166,8 +165,7 @@ IN_PROC_BROWSER_TEST_F(FramebustBlockBrowserTest, AllowRadioButtonSelected) {
// Create a content bubble and simulate clicking on the first radio button // Create a content bubble and simulate clicking on the first radio button
// before closing it. // before closing it.
ContentSettingFramebustBlockBubbleModel framebust_block_bubble_model( ContentSettingFramebustBlockBubbleModel framebust_block_bubble_model(
browser()->content_setting_bubble_model_delegate(), GetWebContents(), browser()->content_setting_bubble_model_delegate(), GetWebContents());
browser()->profile());
std::unique_ptr<FakeOwner> owner = FakeOwner::Create( std::unique_ptr<FakeOwner> owner = FakeOwner::Create(
framebust_block_bubble_model, kDisallowRadioButtonIndex); framebust_block_bubble_model, kDisallowRadioButtonIndex);
...@@ -197,8 +195,7 @@ IN_PROC_BROWSER_TEST_F(FramebustBlockBrowserTest, DisallowRadioButtonSelected) { ...@@ -197,8 +195,7 @@ IN_PROC_BROWSER_TEST_F(FramebustBlockBrowserTest, DisallowRadioButtonSelected) {
// Create a content bubble and simulate clicking on the second radio button // Create a content bubble and simulate clicking on the second radio button
// before closing it. // before closing it.
ContentSettingFramebustBlockBubbleModel framebust_block_bubble_model( ContentSettingFramebustBlockBubbleModel framebust_block_bubble_model(
browser()->content_setting_bubble_model_delegate(), GetWebContents(), browser()->content_setting_bubble_model_delegate(), GetWebContents());
browser()->profile());
std::unique_ptr<FakeOwner> owner = std::unique_ptr<FakeOwner> owner =
FakeOwner::Create(framebust_block_bubble_model, kAllowRadioButtonIndex); FakeOwner::Create(framebust_block_bubble_model, kAllowRadioButtonIndex);
...@@ -223,8 +220,7 @@ IN_PROC_BROWSER_TEST_F(FramebustBlockBrowserTest, ManageButtonClicked) { ...@@ -223,8 +220,7 @@ IN_PROC_BROWSER_TEST_F(FramebustBlockBrowserTest, ManageButtonClicked) {
// Create a content bubble and simulate clicking on the second radio button // Create a content bubble and simulate clicking on the second radio button
// before closing it. // before closing it.
ContentSettingFramebustBlockBubbleModel framebust_block_bubble_model( ContentSettingFramebustBlockBubbleModel framebust_block_bubble_model(
browser()->content_setting_bubble_model_delegate(), GetWebContents(), browser()->content_setting_bubble_model_delegate(), GetWebContents());
browser()->profile());
content::TestNavigationObserver navigation_observer(nullptr); content::TestNavigationObserver navigation_observer(nullptr);
navigation_observer.StartWatchingNewWebContents(); navigation_observer.StartWatchingNewWebContents();
......
...@@ -383,6 +383,7 @@ ContentSettingBubbleContents::~ContentSettingBubbleContents() { ...@@ -383,6 +383,7 @@ ContentSettingBubbleContents::~ContentSettingBubbleContents() {
} }
void ContentSettingBubbleContents::WindowClosing() { void ContentSettingBubbleContents::WindowClosing() {
if (content_setting_bubble_model_)
content_setting_bubble_model_->CommitChanges(); content_setting_bubble_model_->CommitChanges();
} }
...@@ -424,6 +425,8 @@ void ContentSettingBubbleContents::OnNativeThemeChanged( ...@@ -424,6 +425,8 @@ void ContentSettingBubbleContents::OnNativeThemeChanged(
} }
base::string16 ContentSettingBubbleContents::GetWindowTitle() const { base::string16 ContentSettingBubbleContents::GetWindowTitle() const {
if (!content_setting_bubble_model_)
return base::string16();
return content_setting_bubble_model_->bubble_content().title; return content_setting_bubble_model_->bubble_content().title;
} }
...@@ -432,6 +435,7 @@ bool ContentSettingBubbleContents::ShouldShowCloseButton() const { ...@@ -432,6 +435,7 @@ bool ContentSettingBubbleContents::ShouldShowCloseButton() const {
} }
void ContentSettingBubbleContents::Init() { void ContentSettingBubbleContents::Init() {
DCHECK(content_setting_bubble_model_);
const ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); const ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
SetLayoutManager(std::make_unique<views::BoxLayout>( SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::kVertical, gfx::Insets(), views::BoxLayout::kVertical, gfx::Insets(),
...@@ -537,6 +541,7 @@ void ContentSettingBubbleContents::Init() { ...@@ -537,6 +541,7 @@ void ContentSettingBubbleContents::Init() {
} }
views::View* ContentSettingBubbleContents::CreateExtraView() { views::View* ContentSettingBubbleContents::CreateExtraView() {
DCHECK(content_setting_bubble_model_);
const auto& bubble_content = content_setting_bubble_model_->bubble_content(); const auto& bubble_content = content_setting_bubble_model_->bubble_content();
const auto* layout = ChromeLayoutProvider::Get(); const auto* layout = ChromeLayoutProvider::Get();
std::vector<View*> extra_views; std::vector<View*> extra_views;
...@@ -589,6 +594,9 @@ int ContentSettingBubbleContents::GetDialogButtons() const { ...@@ -589,6 +594,9 @@ int ContentSettingBubbleContents::GetDialogButtons() const {
base::string16 ContentSettingBubbleContents::GetDialogButtonLabel( base::string16 ContentSettingBubbleContents::GetDialogButtonLabel(
ui::DialogButton button) const { ui::DialogButton button) const {
if (!content_setting_bubble_model_)
return base::string16();
const base::string16& done_text = const base::string16& done_text =
content_setting_bubble_model_->bubble_content().done_button_text; content_setting_bubble_model_->bubble_content().done_button_text;
return done_text.empty() ? l10n_util::GetStringUTF16(IDS_DONE) : done_text; return done_text.empty() ? l10n_util::GetStringUTF16(IDS_DONE) : done_text;
...@@ -620,11 +628,20 @@ void ContentSettingBubbleContents::OnVisibilityChanged( ...@@ -620,11 +628,20 @@ void ContentSettingBubbleContents::OnVisibilityChanged(
} }
void ContentSettingBubbleContents::WebContentsDestroyed() { void ContentSettingBubbleContents::WebContentsDestroyed() {
// Destroy the bubble model to ensure that the underlying WebContents outlives
// it.
content_setting_bubble_model_->CommitChanges();
content_setting_bubble_model_.reset();
// Closing the widget should synchronously hide it (and post a task to delete
// it). Subsequent event listener methods should not be invoked on hidden
// widgets.
GetWidget()->Close(); GetWidget()->Close();
} }
void ContentSettingBubbleContents::ButtonPressed(views::Button* sender, void ContentSettingBubbleContents::ButtonPressed(views::Button* sender,
const ui::Event& event) { const ui::Event& event) {
DCHECK(content_setting_bubble_model_);
if (sender == manage_checkbox_) { if (sender == manage_checkbox_) {
content_setting_bubble_model_->OnManageCheckboxChecked( content_setting_bubble_model_->OnManageCheckboxChecked(
manage_checkbox_->checked()); manage_checkbox_->checked());
...@@ -645,6 +662,7 @@ void ContentSettingBubbleContents::ButtonPressed(views::Button* sender, ...@@ -645,6 +662,7 @@ void ContentSettingBubbleContents::ButtonPressed(views::Button* sender,
void ContentSettingBubbleContents::LinkClicked(views::Link* source, void ContentSettingBubbleContents::LinkClicked(views::Link* source,
int event_flags) { int event_flags) {
DCHECK(content_setting_bubble_model_);
if (source == custom_link_) { if (source == custom_link_) {
content_setting_bubble_model_->OnCustomLinkClicked(); content_setting_bubble_model_->OnCustomLinkClicked();
GetWidget()->Close(); GetWidget()->Close();
...@@ -656,6 +674,7 @@ void ContentSettingBubbleContents::LinkClicked(views::Link* source, ...@@ -656,6 +674,7 @@ void ContentSettingBubbleContents::LinkClicked(views::Link* source,
} }
void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) { void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) {
DCHECK(content_setting_bubble_model_);
MediaComboboxModel* model = MediaComboboxModel* model =
static_cast<MediaComboboxModel*>(combobox->model()); static_cast<MediaComboboxModel*>(combobox->model());
content_setting_bubble_model_->OnMediaMenuClicked( content_setting_bubble_model_->OnMediaMenuClicked(
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <utility> #include <utility>
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/themes/theme_properties.h" #include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
#include "chrome/browser/ui/content_settings/content_setting_image_model.h" #include "chrome/browser/ui/content_settings/content_setting_image_model.h"
...@@ -129,8 +128,7 @@ bool ContentSettingImageView::ShowBubble(const ui::Event& event) { ...@@ -129,8 +128,7 @@ bool ContentSettingImageView::ShowBubble(const ui::Event& event) {
views::View* const anchor = parent(); views::View* const anchor = parent();
bubble_view_ = new ContentSettingBubbleContents( bubble_view_ = new ContentSettingBubbleContents(
content_setting_image_model_->CreateBubbleModel( content_setting_image_model_->CreateBubbleModel(
delegate_->GetContentSettingBubbleModelDelegate(), web_contents, delegate_->GetContentSettingBubbleModelDelegate(), web_contents),
Profile::FromBrowserContext(web_contents->GetBrowserContext())),
web_contents, anchor, views::BubbleBorder::TOP_RIGHT); web_contents, anchor, views::BubbleBorder::TOP_RIGHT);
bubble_view_->SetHighlightedButton(this); bubble_view_->SetHighlightedButton(this);
views::Widget* bubble_widget = views::Widget* bubble_widget =
......
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