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..c68e40d2b28c880a824fce53478d48651c666a04 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. |
|
dewittj
2014/03/24 17:35:50
per name of what?
Pete Williamson
2014/03/25 00:08:37
Comment improved.
|
| extern const char kFirstSyncedNotificationServiceId[]; |
| extern const char kServiceEnabledOnce[]; |
| extern const char kSyncedNotificationFirstRun[]; |
| @@ -102,14 +101,25 @@ 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); |
| + void SetRemovedAppIds(std::vector<std::string> removed_app_ids); |
| + |
| // 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); |
| + void SetSyncedNotificationAppInfoServiceForTest( |
| + SyncedNotificationAppInfoService* synced_notification_app_info_service); |
| + |
| // If we allow the tests to do bitmap fetching, they will attempt to fetch |
| // a URL from the web, which will fail. We can already test the majority |
| // of what we want without also trying to fetch bitmaps. Other tests will |
| @@ -166,10 +176,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 +198,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 +216,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); |
| }; |