| 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" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/favicon/favicon_util.h" | 12 #include "chrome/browser/favicon/favicon_util.h" |
| 13 #include "chrome/browser/notifications/balloon_collection.h" | 13 #include "chrome/browser/notifications/balloon_collection.h" |
| 14 #include "chrome/browser/notifications/notification.h" | 14 #include "chrome/browser/notifications/notification.h" |
| 15 #include "content/public/browser/render_process_host.h" | 15 #include "content/public/browser/render_process_host.h" |
| 16 #include "content/public/browser/render_view_host.h" | 16 #include "content/public/browser/render_view_host.h" |
| 17 #include "content/public/browser/site_instance.h" | 17 #include "content/public/browser/site_instance.h" |
| 18 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 19 #include "content/public/browser/web_contents_delegate.h" | 19 #include "content/public/browser/web_contents_delegate.h" |
| 20 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
| 21 #include "content/public/common/content_constants.h" |
| 21 #include "ipc/ipc_message.h" | 22 #include "ipc/ipc_message.h" |
| 22 #include "ipc/ipc_message_macros.h" | 23 #include "ipc/ipc_message_macros.h" |
| 23 #include "third_party/skia/include/core/SkBitmap.h" | 24 #include "third_party/skia/include/core/SkBitmap.h" |
| 24 #include "ui/gfx/image/image.h" | 25 #include "ui/gfx/image/image.h" |
| 25 #include "ui/message_center/message_center.h" | 26 #include "ui/message_center/message_center.h" |
| 26 #include "ui/message_center/message_center_constants.h" | 27 #include "ui/message_center/message_center_constants.h" |
| 27 #include "ui/message_center/notification_types.h" | 28 #include "ui/message_center/notification_types.h" |
| 28 #include "webkit/glue/image_resource_fetcher.h" | 29 #include "webkit/glue/image_resource_fetcher.h" |
| 29 | 30 |
| 30 namespace { | 31 namespace { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 return; | 83 return; |
| 83 } | 84 } |
| 84 | 85 |
| 85 content::WebContents* contents = | 86 content::WebContents* contents = |
| 86 content::WebContents::FromRenderViewHost(host); | 87 content::WebContents::FromRenderViewHost(host); |
| 87 if (!contents) { | 88 if (!contents) { |
| 88 LOG(WARNING) << "Notification needs an image but has no WebContents"; | 89 LOG(WARNING) << "Notification needs an image but has no WebContents"; |
| 89 return; | 90 return; |
| 90 } | 91 } |
| 91 | 92 |
| 92 contents->DownloadFavicon(url_, size_, base::Bind(&ImageDownload::Downloaded, | 93 contents->DownloadFavicon(url_, |
| 93 AsWeakPtr())); | 94 content::DOWNLOAD_OTHER, |
| 95 size_, |
| 96 base::Bind(&ImageDownload::Downloaded,AsWeakPtr())); |
| 94 } | 97 } |
| 95 | 98 |
| 96 | 99 |
| 97 BalloonViewAsh::ImageDownload::~ImageDownload() { | 100 BalloonViewAsh::ImageDownload::~ImageDownload() { |
| 98 } | 101 } |
| 99 | 102 |
| 100 void BalloonViewAsh::ImageDownload::Downloaded( | 103 void BalloonViewAsh::ImageDownload::Downloaded( |
| 101 int download_id, | 104 int download_id, |
| 102 const GURL& image_url, | 105 const GURL& image_url, |
| 103 int requested_size, | 106 int requested_size, |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 message_center::kNotificationButtonIconSize, | 228 message_center::kNotificationButtonIconSize, |
| 226 base::Bind(&BalloonViewAsh::SetNotificationButtonIcon, | 229 base::Bind(&BalloonViewAsh::SetNotificationButtonIcon, |
| 227 base::Unretained(this), | 230 base::Unretained(this), |
| 228 notification.notification_id(), | 231 notification.notification_id(), |
| 229 i)))); | 232 i)))); |
| 230 } | 233 } |
| 231 } | 234 } |
| 232 } | 235 } |
| 233 } | 236 } |
| 234 } | 237 } |
| OLD | NEW |