summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 14:47:45 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 14:47:45 +0000
commit5f24f215c60528bd329930bf98373a52dfe08555 (patch)
treef26f29fd3404cacb55f55a038c094d14e2076a73 /chrome/browser/ui
parentc139f9bf6f6f5ce2e550c59952ff5bebb1430458 (diff)
downloadchromium_src-5f24f215c60528bd329930bf98373a52dfe08555.zip
chromium_src-5f24f215c60528bd329930bf98373a52dfe08555.tar.gz
chromium_src-5f24f215c60528bd329930bf98373a52dfe08555.tar.bz2
Move ContentSettingsDetails and Pattern out of HostContentSettingsMap as separate classes.
BUG=64753 TEST=compiles Review URL: http://codereview.chromium.org/5574001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68005 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/cocoa/content_exceptions_window_controller.mm7
-rw-r--r--chrome/browser/ui/cocoa/content_exceptions_window_controller_unittest.mm6
-rw-r--r--chrome/browser/ui/cocoa/content_settings_dialog_controller.mm11
-rw-r--r--chrome/browser/ui/cocoa/table_model_array_controller_unittest.mm6
-rw-r--r--chrome/browser/ui/views/options/content_filter_page_view.cc6
-rw-r--r--chrome/browser/ui/views/options/content_filter_page_view.h2
-rw-r--r--chrome/browser/ui/views/options/exception_editor_view.cc12
-rw-r--r--chrome/browser/ui/views/options/exception_editor_view.h8
-rw-r--r--chrome/browser/ui/views/options/exceptions_view.cc4
-rw-r--r--chrome/browser/ui/views/options/exceptions_view.h2
10 files changed, 31 insertions, 33 deletions
diff --git a/chrome/browser/ui/cocoa/content_exceptions_window_controller.mm b/chrome/browser/ui/cocoa/content_exceptions_window_controller.mm
index 1a6aa74..e9a426f6 100644
--- a/chrome/browser/ui/cocoa/content_exceptions_window_controller.mm
+++ b/chrome/browser/ui/cocoa/content_exceptions_window_controller.mm
@@ -49,7 +49,7 @@
forString:(NSString*)string
errorDescription:(NSString**)error {
if ([string length]) {
- if (HostContentSettingsMap::Pattern(
+ if (ContentSettingsPattern(
base::SysNSStringToUTF8(string)).IsValid()) {
*object = string;
return YES;
@@ -295,7 +295,7 @@ static ContentExceptionsWindowController*
return;
}
newException_.reset(new HostContentSettingsMap::PatternSettingPair);
- newException_->first = HostContentSettingsMap::Pattern(
+ newException_->first = ContentSettingsPattern(
l10n_util::GetStringUTF8(IDS_EXCEPTIONS_SAMPLE_PATTERN));
newException_->second = CONTENT_SETTING_BLOCK;
[tableView_ reloadData];
@@ -418,8 +418,7 @@ static ContentExceptionsWindowController*
// Modify it.
NSString* identifier = [tableColumn identifier];
if ([identifier isEqualToString:@"pattern"]) {
- entry.first = HostContentSettingsMap::Pattern(
- base::SysNSStringToUTF8(object));
+ entry.first = ContentSettingsPattern(base::SysNSStringToUTF8(object));
}
if ([identifier isEqualToString:@"action"]) {
int index = [object intValue];
diff --git a/chrome/browser/ui/cocoa/content_exceptions_window_controller_unittest.mm b/chrome/browser/ui/cocoa/content_exceptions_window_controller_unittest.mm
index 99dfb9d..d42e171 100644
--- a/chrome/browser/ui/cocoa/content_exceptions_window_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/content_exceptions_window_controller_unittest.mm
@@ -160,7 +160,7 @@ TEST_F(ContentExceptionsWindowControllerTest, Add) {
"",
&settings);
EXPECT_EQ(1u, settings.size());
- EXPECT_EQ(HostContentSettingsMap::Pattern("addedhost"), settings[0].first);
+ EXPECT_EQ(ContentSettingsPattern("addedhost"), settings[0].first);
}
TEST_F(ContentExceptionsWindowControllerTest, AddEscDoesNotAdd) {
@@ -202,7 +202,7 @@ TEST_F(ContentExceptionsWindowControllerTest, AddEditAddAdd) {
}
TEST_F(ContentExceptionsWindowControllerTest, AddExistingEditAdd) {
- settingsMap_->SetContentSetting(HostContentSettingsMap::Pattern("myhost"),
+ settingsMap_->SetContentSetting(ContentSettingsPattern("myhost"),
CONTENT_SETTINGS_TYPE_PLUGINS,
"",
CONTENT_SETTING_BLOCK);
@@ -226,7 +226,7 @@ TEST_F(ContentExceptionsWindowControllerTest, AddExistingEditAdd) {
}
TEST_F(ContentExceptionsWindowControllerTest, AddExistingDoesNotOverwrite) {
- settingsMap_->SetContentSetting(HostContentSettingsMap::Pattern("myhost"),
+ settingsMap_->SetContentSetting(ContentSettingsPattern("myhost"),
CONTENT_SETTINGS_TYPE_COOKIES,
"",
CONTENT_SETTING_SESSION_ONLY);
diff --git a/chrome/browser/ui/cocoa/content_settings_dialog_controller.mm b/chrome/browser/ui/cocoa/content_settings_dialog_controller.mm
index 7a574d0..855dc3a 100644
--- a/chrome/browser/ui/cocoa/content_settings_dialog_controller.mm
+++ b/chrome/browser/ui/cocoa/content_settings_dialog_controller.mm
@@ -9,6 +9,7 @@
#include "app/l10n_util.h"
#include "base/command_line.h"
#include "base/mac_util.h"
+#import "chrome/browser/content_settings/content_settings_details.h"
#import "chrome/browser/content_settings/host_content_settings_map.h"
#import "chrome/browser/geolocation/geolocation_content_settings_map.h"
#import "chrome/browser/geolocation/geolocation_exceptions_table_model.h"
@@ -49,8 +50,7 @@ ContentSettingsDialogController* g_instance = nil;
- (void)prefChanged:(const std::string&)prefName;
// Callback when content settings are changed.
-- (void)contentSettingsChanged:
- (HostContentSettingsMap::ContentSettingsDetails*)details;
+- (void)contentSettingsChanged:(ContentSettingsDetails*)details;
@end
@@ -80,8 +80,8 @@ class PrefObserverBridge : public NotificationObserver {
// This is sent when the "is managed" state changes.
// TODO(markusheintz): Move all content settings to this notification.
if (type == NotificationType::CONTENT_SETTINGS_CHANGED) {
- HostContentSettingsMap::ContentSettingsDetails* settings_details =
- Details<HostContentSettingsMap::ContentSettingsDetails>(details).ptr();
+ ContentSettingsDetails* settings_details =
+ Details<ContentSettingsDetails>(details).ptr();
[controller_ contentSettingsChanged:settings_details];
}
}
@@ -638,8 +638,7 @@ class PrefObserverDisabler {
}
}
-- (void)contentSettingsChanged:
- (HostContentSettingsMap::ContentSettingsDetails*)details {
+- (void)contentSettingsChanged:(ContentSettingsDetails*)details {
[self prefChanged:prefs::kBlockNonsandboxedPlugins];
[self prefChanged:prefs::kDefaultContentSettings];
}
diff --git a/chrome/browser/ui/cocoa/table_model_array_controller_unittest.mm b/chrome/browser/ui/cocoa/table_model_array_controller_unittest.mm
index c60c4cf..65b901f 100644
--- a/chrome/browser/ui/cocoa/table_model_array_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/table_model_array_controller_unittest.mm
@@ -35,8 +35,8 @@ class TableModelArrayControllerTest : public CocoaTest {
TestingProfile* profile = browser_helper_.profile();
HostContentSettingsMap* map = profile->GetHostContentSettingsMap();
- HostContentSettingsMap::Pattern example_com("[*.]example.com");
- HostContentSettingsMap::Pattern moose_org("[*.]moose.org");
+ ContentSettingsPattern example_com("[*.]example.com");
+ ContentSettingsPattern moose_org("[*.]moose.org");
map->SetContentSetting(example_com,
CONTENT_SETTINGS_TYPE_PLUGINS,
"a-foo",
@@ -138,7 +138,7 @@ TEST_F(TableModelArrayControllerTest, RemoveAll) {
TEST_F(TableModelArrayControllerTest, AddException) {
TestingProfile* profile = browser_helper_.profile();
HostContentSettingsMap* map = profile->GetHostContentSettingsMap();
- HostContentSettingsMap::Pattern example_com("[*.]example.com");
+ ContentSettingsPattern example_com("[*.]example.com");
map->SetContentSetting(example_com,
CONTENT_SETTINGS_TYPE_PLUGINS,
"c-blurp",
diff --git a/chrome/browser/ui/views/options/content_filter_page_view.cc b/chrome/browser/ui/views/options/content_filter_page_view.cc
index 320611d..ebceafa 100644
--- a/chrome/browser/ui/views/options/content_filter_page_view.cc
+++ b/chrome/browser/ui/views/options/content_filter_page_view.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "base/command_line.h"
+#include "chrome/browser/content_settings/content_settings_details.h"
#include "chrome/browser/geolocation/geolocation_content_settings_map.h"
#include "chrome/browser/geolocation/geolocation_exceptions_table_model.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
@@ -253,7 +254,7 @@ void ContentFilterPageView::ButtonPressed(views::Button* sender,
}
void ContentFilterPageView::NotifyContentSettingsChanged(
- const HostContentSettingsMap::ContentSettingsDetails *details) {
+ const ContentSettingsDetails* details) {
if (details->type() == CONTENT_SETTINGS_TYPE_DEFAULT ||
details->type() == content_type_) {
UpdateView();
@@ -265,8 +266,7 @@ void ContentFilterPageView::Observe(NotificationType type,
const NotificationDetails& details) {
if (type == NotificationType::CONTENT_SETTINGS_CHANGED) {
NotifyContentSettingsChanged(
- Details<HostContentSettingsMap::ContentSettingsDetails>
- (details).ptr());
+ Details<ContentSettingsDetails>(details).ptr());
} else {
OptionsPageBase::Observe(type, source, details);
}
diff --git a/chrome/browser/ui/views/options/content_filter_page_view.h b/chrome/browser/ui/views/options/content_filter_page_view.h
index a9f09e1..5f23583 100644
--- a/chrome/browser/ui/views/options/content_filter_page_view.h
+++ b/chrome/browser/ui/views/options/content_filter_page_view.h
@@ -39,7 +39,7 @@ class ContentFilterPageView : public OptionsPageView,
virtual void UpdateView();
virtual void NotifyContentSettingsChanged(
- const HostContentSettingsMap::ContentSettingsDetails *details);
+ const ContentSettingsDetails* details);
// OptionsPageView implementation:
virtual void InitControlLayout();
diff --git a/chrome/browser/ui/views/options/exception_editor_view.cc b/chrome/browser/ui/views/options/exception_editor_view.cc
index 93ca859..7b111d8 100644
--- a/chrome/browser/ui/views/options/exception_editor_view.cc
+++ b/chrome/browser/ui/views/options/exception_editor_view.cc
@@ -24,7 +24,7 @@ ExceptionEditorView::ExceptionEditorView(
ContentExceptionsTableModel* model,
bool allow_off_the_record,
int index,
- const HostContentSettingsMap::Pattern& pattern,
+ const ContentSettingsPattern& pattern,
ContentSetting setting,
bool is_off_the_record)
: delegate_(delegate),
@@ -63,7 +63,7 @@ std::wstring ExceptionEditorView::GetWindowTitle() const {
bool ExceptionEditorView::IsDialogButtonEnabled(
MessageBoxFlags::DialogButton button) const {
if (button == MessageBoxFlags::DIALOGBUTTON_OK) {
- return IsPatternValid(HostContentSettingsMap::Pattern(
+ return IsPatternValid(ContentSettingsPattern(
UTF16ToUTF8(pattern_tf_->text())),
incognito_cb_->checked());
}
@@ -75,7 +75,7 @@ bool ExceptionEditorView::Cancel() {
}
bool ExceptionEditorView::Accept() {
- HostContentSettingsMap::Pattern new_pattern(UTF16ToUTF8(pattern_tf_->text()));
+ ContentSettingsPattern new_pattern(UTF16ToUTF8(pattern_tf_->text()));
ContentSetting setting =
cb_model_.SettingForIndex(action_cb_->selected_item());
bool is_off_the_record = incognito_cb_->checked();
@@ -91,7 +91,7 @@ views::View* ExceptionEditorView::GetContentsView() {
void ExceptionEditorView::ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents) {
GetDialogClientView()->UpdateDialogButtons();
- UpdateImageView(pattern_iv_, IsPatternValid(HostContentSettingsMap::Pattern(
+ UpdateImageView(pattern_iv_, IsPatternValid(ContentSettingsPattern(
UTF16ToUTF8(pattern_tf_->text())), incognito_cb_->checked()));
}
@@ -110,7 +110,7 @@ void ExceptionEditorView::Init() {
pattern_iv_ = new views::ImageView;
- UpdateImageView(pattern_iv_, IsPatternValid(HostContentSettingsMap::Pattern(
+ UpdateImageView(pattern_iv_, IsPatternValid(ContentSettingsPattern(
UTF16ToUTF8(pattern_tf_->text())), is_off_the_record_));
action_cb_ = new views::Combobox(&cb_model_);
@@ -158,7 +158,7 @@ views::Label* ExceptionEditorView::CreateLabel(int message_id) {
}
bool ExceptionEditorView::IsPatternValid(
- const HostContentSettingsMap::Pattern& pattern,
+ const ContentSettingsPattern& pattern,
bool is_off_the_record) const {
bool is_valid_pattern = pattern.IsValid() &&
(model_->IndexOfExceptionByPattern(pattern, is_off_the_record) == -1);
diff --git a/chrome/browser/ui/views/options/exception_editor_view.h b/chrome/browser/ui/views/options/exception_editor_view.h
index d880360..db8ddf6 100644
--- a/chrome/browser/ui/views/options/exception_editor_view.h
+++ b/chrome/browser/ui/views/options/exception_editor_view.h
@@ -38,7 +38,7 @@ class ExceptionEditorView : public views::View,
public:
// Invoked when the user accepts the edit.
virtual void AcceptExceptionEdit(
- const HostContentSettingsMap::Pattern& pattern,
+ const ContentSettingsPattern& pattern,
ContentSetting setting,
bool is_off_the_record,
int index,
@@ -55,7 +55,7 @@ class ExceptionEditorView : public views::View,
ContentExceptionsTableModel* model,
bool allow_off_the_record,
int index,
- const HostContentSettingsMap::Pattern& pattern,
+ const ContentSettingsPattern& pattern,
ContentSetting setting,
bool is_off_the_record);
virtual ~ExceptionEditorView() {}
@@ -87,7 +87,7 @@ class ExceptionEditorView : public views::View,
// Returns true if we're adding a new item.
bool is_new() const { return index_ == -1; }
- bool IsPatternValid(const HostContentSettingsMap::Pattern& pattern,
+ bool IsPatternValid(const ContentSettingsPattern& pattern,
bool is_off_the_record) const;
void UpdateImageView(views::ImageView* image_view, bool is_valid);
@@ -99,7 +99,7 @@ class ExceptionEditorView : public views::View,
// Index of the item being edited. If -1, indices this is a new entry.
const bool allow_off_the_record_;
const int index_;
- const HostContentSettingsMap::Pattern pattern_;
+ const ContentSettingsPattern pattern_;
const ContentSetting setting_;
const bool is_off_the_record_;
diff --git a/chrome/browser/ui/views/options/exceptions_view.cc b/chrome/browser/ui/views/options/exceptions_view.cc
index eadaf75..0a622a1 100644
--- a/chrome/browser/ui/views/options/exceptions_view.cc
+++ b/chrome/browser/ui/views/options/exceptions_view.cc
@@ -128,7 +128,7 @@ std::wstring ExceptionsView::GetWindowTitle() const {
}
void ExceptionsView::AcceptExceptionEdit(
- const HostContentSettingsMap::Pattern& pattern,
+ const ContentSettingsPattern& pattern,
ContentSetting setting,
bool is_off_the_record,
int index,
@@ -234,7 +234,7 @@ void ExceptionsView::UpdateButtonState() {
void ExceptionsView::Add() {
ExceptionEditorView* view =
new ExceptionEditorView(this, &model_, allow_off_the_record_, -1,
- HostContentSettingsMap::Pattern(),
+ ContentSettingsPattern(),
CONTENT_SETTING_BLOCK, false);
view->Show(window()->GetNativeWindow());
diff --git a/chrome/browser/ui/views/options/exceptions_view.h b/chrome/browser/ui/views/options/exceptions_view.h
index 3624816..a0747be 100644
--- a/chrome/browser/ui/views/options/exceptions_view.h
+++ b/chrome/browser/ui/views/options/exceptions_view.h
@@ -69,7 +69,7 @@ class ExceptionsView : public ExceptionEditorView::Delegate,
// ExceptionEditorView::Delegate implementation.
virtual void AcceptExceptionEdit(
- const HostContentSettingsMap::Pattern& pattern,
+ const ContentSettingsPattern& pattern,
ContentSetting setting,
bool is_off_the_record,
int index,