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

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

Issue 11017079: Remove Shell::shelf()|status_area_widget()|launcher() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 2 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/ui/views/ash/balloon_collection_impl_ash.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/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/status_area_widget.h"
9 #include "ash/system/web_notification/web_notification_tray.h" 8 #include "ash/system/web_notification/web_notification_tray.h"
10 #include "base/logging.h" 9 #include "base/logging.h"
11 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/favicon/favicon_util.h" 11 #include "chrome/browser/favicon/favicon_util.h"
13 #include "chrome/browser/notifications/balloon_collection.h" 12 #include "chrome/browser/notifications/balloon_collection.h"
14 #include "chrome/browser/notifications/notification.h" 13 #include "chrome/browser/notifications/notification.h"
15 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/common/icon_messages.h" 15 #include "chrome/common/icon_messages.h"
17 #include "content/public/browser/render_process_host.h" 16 #include "content/public/browser/render_process_host.h"
18 #include "content/public/browser/render_view_host.h" 17 #include "content/public/browser/render_view_host.h"
19 #include "content/public/browser/site_instance.h" 18 #include "content/public/browser/site_instance.h"
20 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
21 #include "content/public/browser/web_contents_delegate.h" 20 #include "content/public/browser/web_contents_delegate.h"
22 #include "content/public/browser/web_contents_observer.h" 21 #include "content/public/browser/web_contents_observer.h"
23 #include "ipc/ipc_message.h" 22 #include "ipc/ipc_message.h"
24 #include "ipc/ipc_message_macros.h" 23 #include "ipc/ipc_message_macros.h"
25 #include "ui/gfx/image/image_skia.h" 24 #include "ui/gfx/image/image_skia.h"
26 #include "webkit/glue/image_resource_fetcher.h" 25 #include "webkit/glue/image_resource_fetcher.h"
27 26
28 namespace { 27 namespace {
29 28
30 const int kNotificationIconImageSize = 32; 29 const int kNotificationIconImageSize = 32;
31 30
32 ash::WebNotificationTray* GetWebNotificationTray() { 31 ash::WebNotificationTray* GetWebNotificationTray() {
33 return ash::Shell::GetInstance()-> 32 return ash::Shell::GetInstance()->GetWebNotificationTray();
34 status_area_widget()->web_notification_tray();
35 } 33 }
36 34
37 } // namespace 35 } // namespace
38 36
39 class BalloonViewAsh::IconFetcher : public content::WebContentsObserver { 37 class BalloonViewAsh::IconFetcher : public content::WebContentsObserver {
40 public: 38 public:
41 IconFetcher(content::WebContents* web_contents, 39 IconFetcher(content::WebContents* web_contents,
42 const std::string& notification_id, 40 const std::string& notification_id,
43 const GURL& icon_url) 41 const GURL& icon_url)
44 : content::WebContentsObserver(web_contents), 42 : content::WebContentsObserver(web_contents),
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 gfx::Size BalloonViewAsh::GetSize() const { 125 gfx::Size BalloonViewAsh::GetSize() const {
128 return gfx::Size(); 126 return gfx::Size();
129 } 127 }
130 128
131 BalloonHost* BalloonViewAsh::GetHost() const { 129 BalloonHost* BalloonViewAsh::GetHost() const {
132 return NULL; 130 return NULL;
133 } 131 }
134 132
135 void BalloonViewAsh::FetchIcon(const Notification& notification) { 133 void BalloonViewAsh::FetchIcon(const Notification& notification) {
136 if (!notification.icon().isNull()) { 134 if (!notification.icon().isNull()) {
137 ash::Shell::GetInstance()->status_area_widget()-> 135 ash::Shell::GetInstance()->GetWebNotificationTray()->SetNotificationImage(
138 web_notification_tray()->SetNotificationImage( 136 notification.notification_id(), notification.icon());
139 notification.notification_id(), notification.icon());
140 return; 137 return;
141 } 138 }
142 if (notification.icon_url().is_empty()) 139 if (notification.icon_url().is_empty())
143 return; 140 return;
144 content::RenderViewHost* rvh = notification.GetRenderViewHost(); 141 content::RenderViewHost* rvh = notification.GetRenderViewHost();
145 if (!rvh) { 142 if (!rvh) {
146 LOG(WARNING) << "Notification has icon url but no RenderViewHost"; 143 LOG(WARNING) << "Notification has icon url but no RenderViewHost";
147 return; 144 return;
148 } 145 }
149 content::WebContents* web_contents = 146 content::WebContents* web_contents =
(...skipping 11 matching lines...) Expand all
161 ExtensionService* extension_service = 158 ExtensionService* extension_service =
162 balloon_->profile()->GetExtensionService(); 159 balloon_->profile()->GetExtensionService();
163 const GURL& origin = balloon_->notification().origin_url(); 160 const GURL& origin = balloon_->notification().origin_url();
164 const extensions::Extension* extension = 161 const extensions::Extension* extension =
165 extension_service->extensions()->GetExtensionOrAppByURL( 162 extension_service->extensions()->GetExtensionOrAppByURL(
166 ExtensionURLInfo(origin)); 163 ExtensionURLInfo(origin));
167 if (extension) 164 if (extension)
168 return extension->id(); 165 return extension->id();
169 return std::string(); 166 return std::string();
170 } 167 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/ash/balloon_collection_impl_ash.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698