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/ui/views/ash/balloon_view_ash.h" | 5 #include "chrome/browser/ui/views/ash/balloon_view_ash.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/web_notification/web_notification_tray.h" | 8 #include "ash/system/web_notification/web_notification_tray.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 ImageDownload(const Notification& notification, | 50 ImageDownload(const Notification& notification, |
51 const GURL& url, | 51 const GURL& url, |
52 int size, | 52 int size, |
53 const SetImageCallback& callback); | 53 const SetImageCallback& callback); |
54 virtual ~ImageDownload(); | 54 virtual ~ImageDownload(); |
55 | 55 |
56 private: | 56 private: |
57 // FaviconHelper callback. | 57 // FaviconHelper callback. |
58 virtual void Downloaded(int download_id, | 58 virtual void Downloaded(int download_id, |
59 const GURL& image_url, | 59 const GURL& image_url, |
60 bool errored, | |
61 int requested_size, | 60 int requested_size, |
62 const std::vector<SkBitmap>& bitmaps); | 61 const std::vector<SkBitmap>& bitmaps); |
63 | 62 |
64 const GURL& url_; | 63 const GURL& url_; |
65 int size_; | 64 int size_; |
66 SetImageCallback callback_; | 65 SetImageCallback callback_; |
67 | 66 |
68 DISALLOW_COPY_AND_ASSIGN(ImageDownload); | 67 DISALLOW_COPY_AND_ASSIGN(ImageDownload); |
69 }; | 68 }; |
70 | 69 |
(...skipping 21 matching lines...) Expand all Loading... |
92 AsWeakPtr())); | 91 AsWeakPtr())); |
93 } | 92 } |
94 | 93 |
95 | 94 |
96 BalloonViewAsh::ImageDownload::~ImageDownload() { | 95 BalloonViewAsh::ImageDownload::~ImageDownload() { |
97 } | 96 } |
98 | 97 |
99 void BalloonViewAsh::ImageDownload::Downloaded( | 98 void BalloonViewAsh::ImageDownload::Downloaded( |
100 int download_id, | 99 int download_id, |
101 const GURL& image_url, | 100 const GURL& image_url, |
102 bool errored, | |
103 int requested_size, | 101 int requested_size, |
104 const std::vector<SkBitmap>& bitmaps) { | 102 const std::vector<SkBitmap>& bitmaps) { |
105 if (bitmaps.empty()) | 103 if (bitmaps.empty()) |
106 return; | 104 return; |
107 gfx::ImageSkia image(bitmaps[0]); | 105 gfx::ImageSkia image(bitmaps[0]); |
108 callback_.Run(image); | 106 callback_.Run(image); |
109 } | 107 } |
110 | 108 |
111 BalloonViewAsh::BalloonViewAsh(BalloonCollection* collection) | 109 BalloonViewAsh::BalloonViewAsh(BalloonCollection* collection) |
112 : collection_(collection), | 110 : collection_(collection), |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 optional_fields->GetString(ui::notifications::kImageUrlKey, &url); | 192 optional_fields->GetString(ui::notifications::kImageUrlKey, &url); |
195 if (!url.empty()) { | 193 if (!url.empty()) { |
196 downloads_.push_back(linked_ptr<ImageDownload>(new ImageDownload( | 194 downloads_.push_back(linked_ptr<ImageDownload>(new ImageDownload( |
197 notification, GURL(url), | 195 notification, GURL(url), |
198 message_center::kNotificationPreferredImageSize, | 196 message_center::kNotificationPreferredImageSize, |
199 base::Bind(&BalloonViewAsh::SetNotificationImage, | 197 base::Bind(&BalloonViewAsh::SetNotificationImage, |
200 base::Unretained(this), notification.notification_id())))); | 198 base::Unretained(this), notification.notification_id())))); |
201 } | 199 } |
202 } | 200 } |
203 } | 201 } |
OLD | NEW |