| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_EXCEPTIONS_TABLE_MODEL_H_ | |
| 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_EXCEPTIONS_TABLE_MODEL_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "chrome/browser/notifications/desktop_notification_service.h" | |
| 13 #include "chrome/browser/remove_rows_table_model.h" | |
| 14 #include "content/common/notification_observer.h" | |
| 15 | |
| 16 class NotificationExceptionsTableModel : public RemoveRowsTableModel, | |
| 17 public NotificationObserver { | |
| 18 public: | |
| 19 explicit NotificationExceptionsTableModel( | |
| 20 DesktopNotificationService* service); | |
| 21 virtual ~NotificationExceptionsTableModel(); | |
| 22 | |
| 23 // Overridden from RemoveRowsTableModel: | |
| 24 virtual bool CanRemoveRows(const Rows& rows) const; | |
| 25 virtual void RemoveRows(const Rows& rows); | |
| 26 virtual void RemoveAll(); | |
| 27 | |
| 28 // Overridden from TableModel: | |
| 29 virtual int RowCount() OVERRIDE; | |
| 30 virtual string16 GetText(int row, int column_id) OVERRIDE; | |
| 31 virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE; | |
| 32 | |
| 33 // Overridden from NotificationObserver: | |
| 34 virtual void Observe(int type, | |
| 35 const NotificationSource& source, | |
| 36 const NotificationDetails& details); | |
| 37 private: | |
| 38 struct Entry; | |
| 39 | |
| 40 void LoadEntries(); | |
| 41 | |
| 42 DesktopNotificationService* service_; | |
| 43 | |
| 44 typedef std::vector<Entry> EntriesVector; | |
| 45 EntriesVector entries_; | |
| 46 | |
| 47 // We use this variable to prevent ourselves from handling further changes | |
| 48 // that we ourselves caused. | |
| 49 bool updates_disabled_; | |
| 50 NotificationRegistrar registrar_; | |
| 51 ui::TableModelObserver* observer_; | |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(NotificationExceptionsTableModel); | |
| 54 }; | |
| 55 | |
| 56 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_EXCEPTIONS_TABLE_MODEL_H_ | |
| OLD | NEW |