summaryrefslogtreecommitdiffstats
path: root/chrome/browser/notifications
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-01 20:10:45 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-01 20:10:45 +0000
commit70cb9fac715057d31535d0f0739c7021a2c4ca94 (patch)
tree093c986029c0949a16b4df66379de57908ca3266 /chrome/browser/notifications
parent8f3aa37941ca80fa577b15f85dd0f860d17a9250 (diff)
downloadchromium_src-70cb9fac715057d31535d0f0739c7021a2c4ca94.zip
chromium_src-70cb9fac715057d31535d0f0739c7021a2c4ca94.tar.gz
chromium_src-70cb9fac715057d31535d0f0739c7021a2c4ca94.tar.bz2
Add NotificationExceptionTableModel.
Methods stubbed out for now, and not used anywhere yet. BUG=45547 TEST=none Review URL: http://codereview.chromium.org/2847041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51405 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications')
-rw-r--r--chrome/browser/notifications/notification_exceptions_table_model.cc55
-rw-r--r--chrome/browser/notifications/notification_exceptions_table_model.h50
-rw-r--r--chrome/browser/notifications/notification_exceptions_table_model_unittest.cc44
3 files changed, 149 insertions, 0 deletions
diff --git a/chrome/browser/notifications/notification_exceptions_table_model.cc b/chrome/browser/notifications/notification_exceptions_table_model.cc
new file mode 100644
index 0000000..e8e3c08
--- /dev/null
+++ b/chrome/browser/notifications/notification_exceptions_table_model.cc
@@ -0,0 +1,55 @@
+// 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.
+
+#include "chrome/browser/notifications/notification_exceptions_table_model.h"
+
+#include "app/l10n_util.h"
+#include "app/l10n_util_collator.h"
+#include "app/table_model_observer.h"
+#include "base/utf_string_conversions.h"
+#include "chrome/common/url_constants.h"
+#include "grit/generated_resources.h"
+
+NotificationExceptionsTableModel::NotificationExceptionsTableModel(
+ DesktopNotificationService* service)
+ : service_(service),
+ observer_(NULL) {
+}
+
+bool NotificationExceptionsTableModel::CanRemoveRows(
+ const Rows& rows) const {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+void NotificationExceptionsTableModel::RemoveRows(const Rows& rows) {
+ NOTIMPLEMENTED();
+}
+
+void NotificationExceptionsTableModel::RemoveAll() {
+ NOTIMPLEMENTED();
+}
+
+int NotificationExceptionsTableModel::RowCount() {
+ return static_cast<int>(entries_.size());
+}
+
+std::wstring NotificationExceptionsTableModel::GetText(int row,
+ int column_id) {
+ NOTIMPLEMENTED();
+ return std::wstring();
+}
+
+void NotificationExceptionsTableModel::SetObserver(
+ TableModelObserver* observer) {
+ observer_ = observer;
+}
+
+NotificationExceptionsTableModel::Entry::Entry(
+ const GURL& in_origin,
+ ContentSetting in_setting)
+ : origin(in_origin),
+ setting(in_setting) {
+}
+
diff --git a/chrome/browser/notifications/notification_exceptions_table_model.h b/chrome/browser/notifications/notification_exceptions_table_model.h
new file mode 100644
index 0000000..c171034
--- /dev/null
+++ b/chrome/browser/notifications/notification_exceptions_table_model.h
@@ -0,0 +1,50 @@
+// 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_NOTIFICATIONS_NOTIFICATION_EXCEPTIONS_TABLE_MODEL_H_
+#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_EXCEPTIONS_TABLE_MODEL_H_
+
+#include <set>
+#include <vector>
+
+#include "chrome/browser/notifications/desktop_notification_service.h"
+#include "chrome/browser/remove_rows_table_model.h"
+#include "chrome/common/content_settings.h"
+#include "chrome/common/content_settings_types.h"
+
+class NotificationExceptionsTableModel : public RemoveRowsTableModel {
+ public:
+ explicit NotificationExceptionsTableModel(
+ DesktopNotificationService* service);
+
+ // RemoveRowsTableModel overrides:
+ virtual bool CanRemoveRows(const Rows& rows) const;
+ virtual void RemoveRows(const Rows& rows);
+ virtual void RemoveAll();
+
+ // TableModel overrides:
+ virtual int RowCount();
+ virtual std::wstring GetText(int row, int column_id);
+ virtual void SetObserver(TableModelObserver* observer);
+
+ private:
+ struct Entry {
+ Entry(const GURL& origin, ContentSetting setting);
+
+ GURL origin;
+ ContentSetting setting;
+ };
+
+ DesktopNotificationService* service_;
+
+ typedef std::vector<Entry> EntriesVector;
+ EntriesVector entries_;
+
+ TableModelObserver* observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(NotificationExceptionsTableModel);
+};
+
+#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_EXCEPTIONS_TABLE_MODEL_H_
+
diff --git a/chrome/browser/notifications/notification_exceptions_table_model_unittest.cc b/chrome/browser/notifications/notification_exceptions_table_model_unittest.cc
new file mode 100644
index 0000000..a10ce71
--- /dev/null
+++ b/chrome/browser/notifications/notification_exceptions_table_model_unittest.cc
@@ -0,0 +1,44 @@
+// 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.
+
+#include "chrome/browser/notifications/notification_exceptions_table_model.h"
+
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
+#include "chrome/test/testing_profile.h"
+#include "grit/generated_resources.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class NotificationExceptionsTableModelTest
+ : public RenderViewHostTestHarness {
+ public:
+ NotificationExceptionsTableModelTest()
+ : ui_thread_(ChromeThread::UI, MessageLoop::current()) {
+ }
+
+ virtual ~NotificationExceptionsTableModelTest() {
+ }
+
+ virtual void SetUp() {
+ RenderViewHostTestHarness::SetUp();
+ ResetModel();
+ }
+
+ virtual void TearDown() {
+ model_.reset(NULL);
+ RenderViewHostTestHarness::TearDown();
+ }
+
+ virtual void ResetModel() {
+ model_.reset(new NotificationExceptionsTableModel(
+ profile()->GetDesktopNotificationService()));
+ }
+
+ protected:
+ ChromeThread ui_thread_;
+ scoped_ptr<NotificationExceptionsTableModel> model_;
+};
+
+TEST_F(NotificationExceptionsTableModelTest, CanCreate) {
+ EXPECT_EQ(0, model_->RowCount());
+}