Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6519)

Unified Diff: chrome/browser/ui/content_settings/content_setting_bubble_model.cc

Issue 9479008: Re-factor location bar/toolbar code to get rid of the browser dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: call right overloaded method Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/content_settings/content_setting_bubble_model.cc
diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
index ad7398e27e9150f52078dce1af8fd7ffa5c912e0..497854242bfe0bbc9c4808aff342130f44846329 100644
--- a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
+++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
@@ -14,8 +14,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
#include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.h"
-#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/collected_cookies_infobar_delegate.h"
+#include "chrome/browser/ui/content_settings/content_setting_bubble_model_delegate.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/content_settings.h"
@@ -57,12 +57,12 @@ int GetIdForContentType(const ContentSettingsTypeIdEntry* entries,
class ContentSettingTitleAndLinkModel : public ContentSettingBubbleModel {
public:
- ContentSettingTitleAndLinkModel(Browser* browser,
+ ContentSettingTitleAndLinkModel(Delegate* delegate,
TabContentsWrapper* tab_contents,
Profile* profile,
ContentSettingsType content_type)
: ContentSettingBubbleModel(tab_contents, profile, content_type),
- browser_(browser) {
+ delegate_(delegate) {
// Notifications do not have a bubble.
DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
SetBlockedResources();
@@ -71,7 +71,7 @@ class ContentSettingTitleAndLinkModel : public ContentSettingBubbleModel {
}
virtual ~ContentSettingTitleAndLinkModel() {}
- Browser* browser() const { return browser_; }
+ Delegate* delegate() const { return delegate_; }
private:
void SetBlockedResources() {
@@ -131,22 +131,22 @@ class ContentSettingTitleAndLinkModel : public ContentSettingBubbleModel {
}
virtual void OnManageLinkClicked() {
- if (browser_)
- browser_->ShowContentSettingsPage(content_type());
+ if (delegate_)
+ delegate_->ShowContentSettingsPage(content_type());
}
- Browser* browser_;
+ Delegate* delegate_;
};
class ContentSettingTitleLinkAndCustomModel
: public ContentSettingTitleAndLinkModel {
public:
- ContentSettingTitleLinkAndCustomModel(Browser* browser,
+ ContentSettingTitleLinkAndCustomModel(Delegate* delegate,
TabContentsWrapper* tab_contents,
Profile* profile,
ContentSettingsType content_type)
: ContentSettingTitleAndLinkModel(
- browser, tab_contents, profile, content_type) {
+ delegate, tab_contents, profile, content_type) {
SetCustomLink();
}
@@ -171,11 +171,11 @@ class ContentSettingTitleLinkAndCustomModel
class ContentSettingSingleRadioGroup
: public ContentSettingTitleLinkAndCustomModel {
public:
- ContentSettingSingleRadioGroup(Browser* browser,
+ ContentSettingSingleRadioGroup(Delegate* delegate,
TabContentsWrapper* tab_contents,
Profile* profile,
ContentSettingsType content_type)
- : ContentSettingTitleLinkAndCustomModel(browser, tab_contents, profile,
+ : ContentSettingTitleLinkAndCustomModel(delegate, tab_contents, profile,
content_type),
block_setting_(CONTENT_SETTING_BLOCK),
selected_item_(0) {
@@ -333,12 +333,12 @@ class ContentSettingSingleRadioGroup
class ContentSettingCookiesBubbleModel : public ContentSettingSingleRadioGroup {
public:
- ContentSettingCookiesBubbleModel(Browser* browser,
+ ContentSettingCookiesBubbleModel(Delegate* delegate,
TabContentsWrapper* tab_contents,
Profile* profile,
ContentSettingsType content_type)
: ContentSettingSingleRadioGroup(
- browser, tab_contents, profile, content_type) {
+ delegate, tab_contents, profile, content_type) {
DCHECK_EQ(CONTENT_SETTINGS_TYPE_COOKIES, content_type);
set_custom_link_enabled(true);
}
@@ -360,18 +360,18 @@ class ContentSettingCookiesBubbleModel : public ContentSettingSingleRadioGroup {
content::Source<TabSpecificContentSettings>(
tab_contents()->content_settings()),
content::NotificationService::NoDetails());
- browser()->ShowCollectedCookiesDialog(tab_contents());
+ delegate()->ShowCollectedCookiesDialog(tab_contents());
}
};
class ContentSettingPluginBubbleModel : public ContentSettingSingleRadioGroup {
public:
- ContentSettingPluginBubbleModel(Browser* browser,
+ ContentSettingPluginBubbleModel(Delegate* delegate,
TabContentsWrapper* tab_contents,
Profile* profile,
ContentSettingsType content_type)
: ContentSettingSingleRadioGroup(
- browser, tab_contents, profile, content_type) {
+ delegate, tab_contents, profile, content_type) {
DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS);
set_custom_link_enabled(tab_contents && tab_contents->content_settings()->
load_plugins_link_enabled());
@@ -393,12 +393,12 @@ class ContentSettingPluginBubbleModel : public ContentSettingSingleRadioGroup {
class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup {
public:
- ContentSettingPopupBubbleModel(Browser* browser,
+ ContentSettingPopupBubbleModel(Delegate* delegate,
TabContentsWrapper* tab_contents,
Profile* profile,
ContentSettingsType content_type)
: ContentSettingSingleRadioGroup(
- browser, tab_contents, profile, content_type) {
+ delegate, tab_contents, profile, content_type) {
SetPopups();
}
@@ -435,12 +435,12 @@ class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup {
class ContentSettingDomainListBubbleModel
: public ContentSettingTitleAndLinkModel {
public:
- ContentSettingDomainListBubbleModel(Browser* browser,
+ ContentSettingDomainListBubbleModel(Delegate* delegate,
TabContentsWrapper* tab_contents,
Profile* profile,
ContentSettingsType content_type)
: ContentSettingTitleAndLinkModel(
- browser, tab_contents, profile, content_type) {
+ delegate, tab_contents, profile, content_type) {
DCHECK_EQ(CONTENT_SETTINGS_TYPE_GEOLOCATION, content_type) <<
"SetDomains currently only supports geolocation content type";
SetDomainsAndCustomLink();
@@ -511,27 +511,27 @@ class ContentSettingDomainListBubbleModel
// static
ContentSettingBubbleModel*
ContentSettingBubbleModel::CreateContentSettingBubbleModel(
- Browser* browser,
+ Delegate* delegate,
TabContentsWrapper* tab_contents,
Profile* profile,
ContentSettingsType content_type) {
if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) {
- return new ContentSettingCookiesBubbleModel(browser, tab_contents, profile,
+ return new ContentSettingCookiesBubbleModel(delegate, tab_contents, profile,
content_type);
}
if (content_type == CONTENT_SETTINGS_TYPE_POPUPS) {
- return new ContentSettingPopupBubbleModel(browser, tab_contents, profile,
+ return new ContentSettingPopupBubbleModel(delegate, tab_contents, profile,
content_type);
}
if (content_type == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
- return new ContentSettingDomainListBubbleModel(browser, tab_contents,
+ return new ContentSettingDomainListBubbleModel(delegate, tab_contents,
profile, content_type);
}
if (content_type == CONTENT_SETTINGS_TYPE_PLUGINS) {
- return new ContentSettingPluginBubbleModel(browser, tab_contents, profile,
+ return new ContentSettingPluginBubbleModel(delegate, tab_contents, profile,
content_type);
}
- return new ContentSettingSingleRadioGroup(browser, tab_contents, profile,
+ return new ContentSettingSingleRadioGroup(delegate, tab_contents, profile,
content_type);
}

Powered by Google App Engine
This is Rietveld 408576698