Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(849)

Side by Side Diff: chrome/browser/notifications/sync_notifier/synced_notification.cc

Issue 253623002: Remove BitmapFetcher's dependency on Profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/notifications/sync_notifier/image_holder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // See if all bitmaps are accounted for, if so call Show(). 276 // See if all bitmaps are accounted for, if so call Show().
276 if (AreAllBitmapsFetched()) { 277 if (AreAllBitmapsFetched()) {
277 Show(profile_); 278 Show(profile_);
278 } 279 }
279 } 280 }
280 281
281 void SyncedNotification::StartBitmapFetch() { 282 void SyncedNotification::StartBitmapFetch() {
282 // Now that we have queued and counted them all, start the fetching. 283 // Now that we have queued and counted them all, start the fetching.
283 ScopedVector<chrome::BitmapFetcher>::iterator iter; 284 ScopedVector<chrome::BitmapFetcher>::iterator iter;
284 for (iter = fetchers_.begin(); iter != fetchers_.end(); ++iter) { 285 for (iter = fetchers_.begin(); iter != fetchers_.end(); ++iter) {
285 (*iter)->Start(profile_); 286 (*iter)->Start(profile_->GetRequestContext());
286 } 287 }
287 } 288 }
288 289
289 // This should detect even small changes in case the server updated the 290 // This should detect even small changes in case the server updated the
290 // notification. We ignore the timestamp if other fields match. 291 // notification. We ignore the timestamp if other fields match.
291 bool SyncedNotification::EqualsIgnoringReadState( 292 bool SyncedNotification::EqualsIgnoringReadState(
292 const SyncedNotification& other) const { 293 const SyncedNotification& other) const {
293 if (GetTitle() == other.GetTitle() && 294 if (GetTitle() == other.GetTitle() &&
294 GetHeading() == other.GetHeading() && 295 GetHeading() == other.GetHeading() &&
295 GetDescription() == other.GetDescription() && 296 GetDescription() == other.GetDescription() &&
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 specifics_.mutable_coalesced_notification()->set_read_state( 732 specifics_.mutable_coalesced_notification()->set_read_state(
732 sync_pb::CoalescedSyncedNotification_ReadState_UNREAD); 733 sync_pb::CoalescedSyncedNotification_ReadState_UNREAD);
733 else if (kRead == read_state) 734 else if (kRead == read_state)
734 specifics_.mutable_coalesced_notification()->set_read_state( 735 specifics_.mutable_coalesced_notification()->set_read_state(
735 sync_pb::CoalescedSyncedNotification_ReadState_READ); 736 sync_pb::CoalescedSyncedNotification_ReadState_READ);
736 else 737 else
737 NOTREACHED(); 738 NOTREACHED();
738 } 739 }
739 740
740 } // namespace notifier 741 } // namespace notifier
OLDNEW
« no previous file with comments | « chrome/browser/notifications/sync_notifier/image_holder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698