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

Side by Side Diff: chrome/browser/ui/views/ash/balloon_view_ash.cc

Issue 11651002: Updated multiple item notification view to match latest mockups (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
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/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 12 matching lines...) Expand all
23 #include "ipc/ipc_message.h" 23 #include "ipc/ipc_message.h"
24 #include "ipc/ipc_message_macros.h" 24 #include "ipc/ipc_message_macros.h"
25 #include "ui/gfx/image/image_skia.h" 25 #include "ui/gfx/image/image_skia.h"
26 #include "ui/message_center/message_center.h" 26 #include "ui/message_center/message_center.h"
27 #include "webkit/glue/image_resource_fetcher.h" 27 #include "webkit/glue/image_resource_fetcher.h"
28 28
29 namespace { 29 namespace {
30 30
31 typedef base::Callback<void(const std::string&, const gfx::ImageSkia&)> Setter; 31 typedef base::Callback<void(const std::string&, const gfx::ImageSkia&)> Setter;
32 32
33 const int kPrimaryIconImageSize = 64; 33 const int kPrimaryIconImageSize = 80;
Jun Mukai 2012/12/19 00:33:53 It seems that this value is shared with values in
dharcourt 2012/12/19 01:47:44 Done.
34 const int kSecondaryIconImageSize = 15; 34 const int kSecondaryIconImageSize = 15;
Jun Mukai 2012/12/19 00:33:53 We don't use the secondary icon anymore right? the
dharcourt 2012/12/19 01:47:44 Done.
35 35
36 // Static. 36 // Static.
37 message_center::MessageCenter* GetMessageCenter() { 37 message_center::MessageCenter* GetMessageCenter() {
38 return ash::Shell::GetInstance()->GetWebNotificationTray()->message_center(); 38 return ash::Shell::GetInstance()->GetWebNotificationTray()->message_center();
39 } 39 }
40 40
41 // Static. 41 // Static.
42 std::string GetExtensionId(Balloon* balloon) { 42 std::string GetExtensionId(Balloon* balloon) {
43 const ExtensionURLInfo url(balloon->notification().origin_url()); 43 const ExtensionURLInfo url(balloon->notification().origin_url());
44 const ExtensionService* service = balloon->profile()->GetExtensionService(); 44 const ExtensionService* service = balloon->profile()->GetExtensionService();
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 if (!notification.icon().isNull()) { 193 if (!notification.icon().isNull()) {
194 center->SetNotificationPrimaryIcon(notification_id_, notification.icon()); 194 center->SetNotificationPrimaryIcon(notification_id_, notification.icon());
195 } else if (!notification.icon_url().is_empty()) { 195 } else if (!notification.icon_url().is_empty()) {
196 GetImageDownload(notification.icon_url()).AddCallback( 196 GetImageDownload(notification.icon_url()).AddCallback(
197 kPrimaryIconImageSize, 197 kPrimaryIconImageSize,
198 base::Bind( 198 base::Bind(
199 &message_center::MessageCenter::SetNotificationPrimaryIcon, 199 &message_center::MessageCenter::SetNotificationPrimaryIcon,
200 base::Unretained(center))); 200 base::Unretained(center)));
201 } 201 }
202 202
203 // Set up a download for the notification's secondary icon if appropriate. 203 // Set up a download for the notification's secondary icon if appropriate.
Jun Mukai 2012/12/19 00:33:53 is it necessary?
dharcourt 2012/12/19 01:47:44 Not any more. Removed.
204 const base::DictionaryValue* optional_fields = notification.optional_fields(); 204 const base::DictionaryValue* optional_fields = notification.optional_fields();
205 if (optional_fields && 205 if (optional_fields &&
206 optional_fields->HasKey(ui::notifications::kSecondIconUrlKey)) { 206 optional_fields->HasKey(ui::notifications::kSecondIconUrlKey)) {
207 string16 url; 207 string16 url;
208 optional_fields->GetString(ui::notifications::kSecondIconUrlKey, &url); 208 optional_fields->GetString(ui::notifications::kSecondIconUrlKey, &url);
209 if (!url.empty()) { 209 if (!url.empty()) {
210 GetImageDownload(GURL(url)).AddCallback( 210 GetImageDownload(GURL(url)).AddCallback(
211 kSecondaryIconImageSize, 211 kSecondaryIconImageSize,
212 base::Bind( 212 base::Bind(
213 &message_center::MessageCenter::SetNotificationSecondaryIcon, 213 &message_center::MessageCenter::SetNotificationSecondaryIcon,
214 base::Unretained(center))); 214 base::Unretained(center)));
215 } 215 }
216 } 216 }
217 217
218 // Start the downloads. 218 // Start the downloads.
219 for (ImageDownloads::const_iterator i = downloads_.begin(); 219 for (ImageDownloads::const_iterator i = downloads_.begin();
220 i != downloads_.end(); 220 i != downloads_.end();
221 ++i) { 221 ++i) {
222 i->second->Start(notification); 222 i->second->Start(notification);
223 } 223 }
224 } 224 }
225 225
226 BalloonViewAsh::ImageDownload& BalloonViewAsh::GetImageDownload( 226 BalloonViewAsh::ImageDownload& BalloonViewAsh::GetImageDownload(
227 const GURL& url) { 227 const GURL& url) {
228 if (!downloads_.count(url)) 228 if (!downloads_.count(url))
229 downloads_[url].reset(new ImageDownload(url)); 229 downloads_[url].reset(new ImageDownload(url));
230 return *downloads_[url]; 230 return *downloads_[url];
231 } 231 }
OLDNEW
« no previous file with comments | « no previous file | ui/message_center/message_view_multiple.h » ('j') | ui/message_center/message_view_multiple.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698