OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // The ChromeNotifierService works together with sync to maintain the state of | 5 // The ChromeNotifierService works together with sync to maintain the state of |
6 // user notifications, which can then be presented in the notification center, | 6 // user notifications, which can then be presented in the notification center, |
7 // via the Notification UI Manager. | 7 // via the Notification UI Manager. |
8 | 8 |
9 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" | 9 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" |
10 | 10 |
11 #include "chrome/browser/notifications/notification.h" | 11 #include "chrome/browser/notifications/notification.h" |
12 #include "chrome/browser/notifications/notification_ui_manager.h" | 12 #include "chrome/browser/notifications/notification_ui_manager.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
15 #include "sync/api/sync_change.h" | 15 #include "sync/api/sync_change.h" |
16 #include "sync/api/sync_change_processor.h" | 16 #include "sync/api/sync_change_processor.h" |
17 #include "sync/api/sync_error_factory.h" | 17 #include "sync/api/sync_error_factory.h" |
18 #include "sync/protocol/sync.pb.h" | 18 #include "sync/protocol/sync.pb.h" |
19 #include "sync/protocol/synced_notification_specifics.pb.h" | 19 #include "sync/protocol/synced_notification_specifics.pb.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" |
21 | 21 |
22 namespace notifier { | 22 namespace notifier { |
23 | 23 |
24 ChromeNotifierService::ChromeNotifierService(Profile* profile, | 24 ChromeNotifierService::ChromeNotifierService(Profile* profile, |
25 NotificationUIManager* manager) | 25 NotificationUIManager* manager) |
26 : profile_(profile), notification_manager_(manager) {} | 26 : profile_(profile), notification_manager_(manager) {} |
27 ChromeNotifierService::~ChromeNotifierService() {} | 27 ChromeNotifierService::~ChromeNotifierService() {} |
28 | 28 |
29 // Methods from ProfileKeyedService. | 29 // Methods from BrowserContextKeyedService. |
30 void ChromeNotifierService::Shutdown() { | 30 void ChromeNotifierService::Shutdown() { |
31 } | 31 } |
32 | 32 |
33 // syncer::SyncableService implementation. | 33 // syncer::SyncableService implementation. |
34 | 34 |
35 // This is called at startup to sync with the server. | 35 // This is called at startup to sync with the server. |
36 // This code is not thread safe. | 36 // This code is not thread safe. |
37 syncer::SyncMergeResult ChromeNotifierService::MergeDataAndStartSyncing( | 37 syncer::SyncMergeResult ChromeNotifierService::MergeDataAndStartSyncing( |
38 syncer::ModelType type, | 38 syncer::ModelType type, |
39 const syncer::SyncDataList& initial_sync_data, | 39 const syncer::SyncDataList& initial_sync_data, |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 void ChromeNotifierService::Add(scoped_ptr<SyncedNotification> notification) { | 273 void ChromeNotifierService::Add(scoped_ptr<SyncedNotification> notification) { |
274 SyncedNotification* notification_copy = notification.get(); | 274 SyncedNotification* notification_copy = notification.get(); |
275 // Take ownership of the object and put it into our local storage. | 275 // Take ownership of the object and put it into our local storage. |
276 notification_data_.push_back(notification.release()); | 276 notification_data_.push_back(notification.release()); |
277 | 277 |
278 // Get the contained bitmaps, and show the notification once we have them. | 278 // Get the contained bitmaps, and show the notification once we have them. |
279 notification_copy->Show(notification_manager_, this, profile_); | 279 notification_copy->Show(notification_manager_, this, profile_); |
280 } | 280 } |
281 | 281 |
282 } // namespace notifier | 282 } // namespace notifier |
OLD | NEW |