diff options
author | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-09 13:40:40 +0000 |
---|---|---|
committer | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-09 13:40:40 +0000 |
commit | 56f1a6ba817c77388d9df86c0f23db4dde7e0934 (patch) | |
tree | bd8c938c53f69f2ae1e104cf90cad49511e639b3 /chrome/browser/plugin_exceptions_table_model.h | |
parent | 763e638fc941c4295feb961ea1c9b127de28de6a (diff) | |
download | chromium_src-56f1a6ba817c77388d9df86c0f23db4dde7e0934.zip chromium_src-56f1a6ba817c77388d9df86c0f23db4dde7e0934.tar.gz chromium_src-56f1a6ba817c77388d9df86c0f23db4dde7e0934.tar.bz2 |
[Win] Add per-plugin exceptions to content settings.
Screenshot: http://imgur.com/yxEzO.png
BUG=39252
TEST=PluginExceptionsTableModel.*
Review URL: http://codereview.chromium.org/3307014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58929 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_exceptions_table_model.h')
-rw-r--r-- | chrome/browser/plugin_exceptions_table_model.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/chrome/browser/plugin_exceptions_table_model.h b/chrome/browser/plugin_exceptions_table_model.h new file mode 100644 index 0000000..8732a0d --- /dev/null +++ b/chrome/browser/plugin_exceptions_table_model.h @@ -0,0 +1,78 @@ +// 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_PLUGIN_EXCEPTIONS_TABLE_MODEL_H_ +#define CHROME_BROWSER_PLUGIN_EXCEPTIONS_TABLE_MODEL_H_ +#pragma once + +#include <deque> + +#include "chrome/browser/remove_rows_table_model.h" +#include "chrome/browser/host_content_settings_map.h" +#include "chrome/common/notification_observer.h" + +struct WebPluginInfo; + +class PluginExceptionsTableModel : public RemoveRowsTableModel, + public NotificationObserver { + public: + PluginExceptionsTableModel(HostContentSettingsMap* content_settings_map, + HostContentSettingsMap* otr_content_settings_map); + virtual ~PluginExceptionsTableModel() {} + + // Load plugin exceptions from the HostContentSettingsMaps. You should call + // this method after creating a new PluginExceptionsTableModel. + void LoadSettings(); + + // RemoveRowsTableModel methods: + virtual bool CanRemoveRows(const Rows& rows) const; + virtual void RemoveRows(const Rows& rows); + virtual void RemoveAll(); + + // TableModel methods: + virtual int RowCount(); + virtual std::wstring GetText(int row, int column_id); + virtual void SetObserver(TableModelObserver* observer); + virtual bool HasGroups() { return true; } + virtual Groups GetGroups(); + virtual int GetGroupID(int row); + + // NotificationObserver methods: + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); + + protected: + // Subclasses can override this method for testing. + virtual void GetPlugins(std::vector<WebPluginInfo>* plugins); + + private: + friend class PluginExceptionsTableModelTest; + + struct SettingsEntry { + HostContentSettingsMap::Pattern pattern; + int plugin_id; + ContentSetting setting; + bool is_otr; + }; + + void ClearSettings(); + void ReloadSettings(); + + HostContentSettingsMap* map_; + HostContentSettingsMap* otr_map_; + + std::deque<SettingsEntry> settings_; + std::deque<int> row_counts_; + std::deque<std::string> resources_; + TableModel::Groups groups_; + + NotificationRegistrar registrar_; + bool updates_disabled_; + TableModelObserver* observer_; + + DISALLOW_COPY_AND_ASSIGN(PluginExceptionsTableModel); +}; + +#endif // CHROME_BROWSER_PLUGIN_EXCEPTIONS_TABLE_MODEL_H_ |