Chromium Code Reviews| Index: chrome/browser/notifications/sync_notifier/chrome_notifier_service.h |
| diff --git a/chrome/browser/notifications/sync_notifier/chrome_notifier_service.h b/chrome/browser/notifications/sync_notifier/chrome_notifier_service.h |
| index b500fcb624ff6fa6bca8091670a7462785042e39..6200ff29668238fdf986d5b77d21b45d704ab3b0 100644 |
| --- a/chrome/browser/notifications/sync_notifier/chrome_notifier_service.h |
| +++ b/chrome/browser/notifications/sync_notifier/chrome_notifier_service.h |
| @@ -30,12 +30,11 @@ struct Notifier; |
| } |
| namespace notifier { |
| -class SyncedNotificationAppInfoTemp; |
| +class SyncedNotificationAppInfo; |
| +class SyncedNotificationAppInfoService; |
| // The name of our first synced notification service. |
| -// TODO(petewil): remove this hardcoding once we have the synced notification |
| -// signalling sync data type set up to provide this. |
| -// crbug.com/248337 |
| +// TODO(petewil): Remove this once we figure out how to do UMA per name. |
| extern const char kFirstSyncedNotificationServiceId[]; |
| extern const char kServiceEnabledOnce[]; |
| extern const char kSyncedNotificationFirstRun[]; |
| @@ -102,11 +101,19 @@ class ChromeNotifierService : public syncer::SyncableService, |
| const std::string& notifier_id, |
| bool enabled); |
| + // When app ids are added or removed, unblock or remove associated messages. |
| + void SetAddedAppIds(std::vector<std::string> added_app_ids); |
|
dewittj
2014/03/17 21:43:43
nit: rename to OnAppIdsAdded
dewittj
2014/03/25 22:31:13
This comment was not addressed.
Pete Williamson
2014/03/26 18:12:55
Oops, missed that, done now. I think that my meth
|
| + void SetRemovedAppIds(std::vector<std::string> removed_app_ids); |
|
dewittj
2014/03/17 21:43:43
nit: rename to OnAppIdsRemoved
dewittj
2014/03/25 22:31:13
This comment was not addressed.
Pete Williamson
2014/03/26 18:12:55
Done.
|
| + |
| // Register the preferences we use to save state. |
| static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| Profile* profile() const { return profile_; } |
| + // Find and retun the sending service Id for this notification. |
| + std::string GetSendingServiceId( |
| + const SyncedNotification* synced_notification); |
| + |
| // Functions for test. |
| void AddForTest(scoped_ptr<notifier::SyncedNotification> notification); |
| @@ -166,10 +173,11 @@ class ChromeNotifierService : public syncer::SyncableService, |
| void BuildServiceListValueInplace( |
| std::set<std::string> services, base::ListValue* list_value); |
| - SyncedNotificationAppInfoTemp* FindAppInfo(const std::string& app_id) const; |
| + notifier::SyncedNotificationAppInfo* FindAppInfoByAppId( |
| + const std::string& app_id) const; |
| const Notification CreateWelcomeNotificationForService( |
| - SyncedNotificationAppInfoTemp* app_info); |
| + SyncedNotificationAppInfo* app_info); |
| // Preferences for storing which SyncedNotificationServices are enabled |
| StringListPrefMember enabled_sending_services_prefs_; |
| @@ -187,8 +195,11 @@ class ChromeNotifierService : public syncer::SyncableService, |
| bool synced_notification_first_run_; |
| static bool avoid_bitmap_fetching_for_test_; |
| base::ThreadChecker thread_checker_; |
| + // Unowned pointer to the App Info service. The lifetime is managed by the |
| + // profile service, this service depends on the App Info service, so it should |
| + // always be in scope whenever our service is active. |
| + SyncedNotificationAppInfoService* synced_notification_app_info_service_; |
| - ScopedVector<SyncedNotificationAppInfoTemp> app_info_data_; |
| // TODO(petewil): Consider whether a map would better suit our data. |
| // If there are many entries, lookup time may trump locality of reference. |
| ScopedVector<SyncedNotification> notification_data_; |
| @@ -202,6 +213,8 @@ class ChromeNotifierService : public syncer::SyncableService, |
| FRIEND_TEST_ALL_PREFIXES(ChromeNotifierServiceTest, |
| GetEnabledSendingServicesFromPreferencesTest); |
| FRIEND_TEST_ALL_PREFIXES(ChromeNotifierServiceTest, CheckFindAppInfo); |
| + FRIEND_TEST_ALL_PREFIXES(ChromeNotifierServiceTest, SetAddedAppIdsTest); |
| + FRIEND_TEST_ALL_PREFIXES(ChromeNotifierServiceTest, SetRemovedAppIdsTest); |
| DISALLOW_COPY_AND_ASSIGN(ChromeNotifierService); |
| }; |