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 #include "chrome/browser/notifications/sync_notifier/synced_notification.h" | 5 #include "chrome/browser/notifications/sync_notifier/synced_notification.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/notifications/notification.h" | 14 #include "chrome/browser/notifications/notification.h" |
15 #include "chrome/browser/notifications/notification_ui_manager.h" | 15 #include "chrome/browser/notifications/notification_ui_manager.h" |
16 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h" | 16 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h" |
17 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" | 17 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" |
| 18 #include "chrome/browser/profiles/profile.h" |
18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
19 #include "skia/ext/image_operations.h" | 20 #include "skia/ext/image_operations.h" |
20 #include "sync/protocol/sync.pb.h" | 21 #include "sync/protocol/sync.pb.h" |
21 #include "sync/protocol/synced_notification_specifics.pb.h" | 22 #include "sync/protocol/synced_notification_specifics.pb.h" |
22 #include "third_party/skia/include/core/SkPaint.h" | 23 #include "third_party/skia/include/core/SkPaint.h" |
23 #include "ui/gfx/canvas.h" | 24 #include "ui/gfx/canvas.h" |
24 #include "ui/gfx/color_utils.h" | 25 #include "ui/gfx/color_utils.h" |
25 #include "ui/gfx/image/image.h" | 26 #include "ui/gfx/image/image.h" |
26 #include "ui/gfx/size.h" | 27 #include "ui/gfx/size.h" |
27 #include "ui/gfx/skbitmap_operations.h" | 28 #include "ui/gfx/skbitmap_operations.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 // See if all bitmaps are accounted for, if so call Show(). | 302 // See if all bitmaps are accounted for, if so call Show(). |
302 if (AreAllBitmapsFetched()) { | 303 if (AreAllBitmapsFetched()) { |
303 Show(profile_); | 304 Show(profile_); |
304 } | 305 } |
305 } | 306 } |
306 | 307 |
307 void SyncedNotification::StartBitmapFetch() { | 308 void SyncedNotification::StartBitmapFetch() { |
308 // Now that we have queued and counted them all, start the fetching. | 309 // Now that we have queued and counted them all, start the fetching. |
309 ScopedVector<chrome::BitmapFetcher>::iterator iter; | 310 ScopedVector<chrome::BitmapFetcher>::iterator iter; |
310 for (iter = fetchers_.begin(); iter != fetchers_.end(); ++iter) { | 311 for (iter = fetchers_.begin(); iter != fetchers_.end(); ++iter) { |
311 (*iter)->Start(profile_); | 312 (*iter)->Start(profile_->GetRequestContext()); |
312 } | 313 } |
313 } | 314 } |
314 | 315 |
315 // This should detect even small changes in case the server updated the | 316 // This should detect even small changes in case the server updated the |
316 // notification. We ignore the timestamp if other fields match. | 317 // notification. We ignore the timestamp if other fields match. |
317 bool SyncedNotification::EqualsIgnoringReadState( | 318 bool SyncedNotification::EqualsIgnoringReadState( |
318 const SyncedNotification& other) const { | 319 const SyncedNotification& other) const { |
319 if (GetTitle() == other.GetTitle() && | 320 if (GetTitle() == other.GetTitle() && |
320 GetHeading() == other.GetHeading() && | 321 GetHeading() == other.GetHeading() && |
321 GetDescription() == other.GetDescription() && | 322 GetDescription() == other.GetDescription() && |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 specifics_.mutable_coalesced_notification()->set_read_state( | 758 specifics_.mutable_coalesced_notification()->set_read_state( |
758 sync_pb::CoalescedSyncedNotification_ReadState_UNREAD); | 759 sync_pb::CoalescedSyncedNotification_ReadState_UNREAD); |
759 else if (kRead == read_state) | 760 else if (kRead == read_state) |
760 specifics_.mutable_coalesced_notification()->set_read_state( | 761 specifics_.mutable_coalesced_notification()->set_read_state( |
761 sync_pb::CoalescedSyncedNotification_ReadState_READ); | 762 sync_pb::CoalescedSyncedNotification_ReadState_READ); |
762 else | 763 else |
763 NOTREACHED(); | 764 NOTREACHED(); |
764 } | 765 } |
765 | 766 |
766 } // namespace notifier | 767 } // namespace notifier |
OLD | NEW |