diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-19 19:01:47 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-19 19:01:47 +0000 |
commit | 47115104dc1a6a06b85dc23cc4d5993847ea0fa7 (patch) | |
tree | edcb2976dbf42db35e85d711a08db8777187d67b /chrome/browser/content_exceptions_table_model.h | |
parent | 083d0031696fedc3ac35351c059a3097b6bfa87e (diff) | |
download | chromium_src-47115104dc1a6a06b85dc23cc4d5993847ea0fa7.zip chromium_src-47115104dc1a6a06b85dc23cc4d5993847ea0fa7.tar.gz chromium_src-47115104dc1a6a06b85dc23cc4d5993847ea0fa7.tar.bz2 |
GTK: Implement the exceptions dialog for the content filtering settings.
BUG=35178
TEST=none
Review URL: http://codereview.chromium.org/646060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39468 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/content_exceptions_table_model.h')
-rw-r--r-- | chrome/browser/content_exceptions_table_model.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/chrome/browser/content_exceptions_table_model.h b/chrome/browser/content_exceptions_table_model.h new file mode 100644 index 0000000..9ade4d8 --- /dev/null +++ b/chrome/browser/content_exceptions_table_model.h @@ -0,0 +1,54 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CONTENT_EXCEPTIONS_TABLE_MODEL_H_ +#define CHROME_BROWSER_CONTENT_EXCEPTIONS_TABLE_MODEL_H_ + +#include <string> + +#include "app/table_model.h" +#include "chrome/common/content_settings.h" +#include "chrome/common/content_settings_types.h" +#include "chrome/browser/host_content_settings_map.h" + +class ContentExceptionsTableModel : public TableModel { + public: + ContentExceptionsTableModel(HostContentSettingsMap* map, + ContentSettingsType content_type); + + HostContentSettingsMap* map() const { return map_; } + ContentSettingsType content_type() const { return content_type_; } + + const HostContentSettingsMap::HostSettingPair& entry_at(int index) { + return entries_[index]; + } + + // Adds a new exception on the map and table model. + void AddException(const std::string& host, ContentSetting setting); + + // Removes the exception at the specified index from both the map and model. + void RemoveException(int row); + + // Removes all the exceptions from both the map and model. + void RemoveAll(); + + // Returns the index of the specified exception given a host, or -1 if there + // is no exception for the specified host. + int IndexOfExceptionByHost(const std::string& host); + + // TableModel overrides: + virtual int RowCount(); + virtual std::wstring GetText(int row, int column_id); + virtual void SetObserver(TableModelObserver* observer); + + private: + HostContentSettingsMap* map_; + ContentSettingsType content_type_; + HostContentSettingsMap::SettingsForOneType entries_; + TableModelObserver* observer_; + + DISALLOW_COPY_AND_ASSIGN(ContentExceptionsTableModel); +}; + +#endif // CHROME_BROWSER_CONTENT_EXCEPTIONS_TABLE_MODEL_H_ |