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

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

Issue 10765021: Make the id used in IconMsg_DownloadFavicon unique (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
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" 8 #include "ash/system/status_area_widget.h"
9 #include "ash/system/web_notification/web_notification_tray.h" 9 #include "ash/system/web_notification/web_notification_tray.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "chrome/browser/favicon/favicon_util.h"
11 #include "chrome/browser/extensions/extension_service.h" 12 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/notifications/balloon_collection.h" 13 #include "chrome/browser/notifications/balloon_collection.h"
13 #include "chrome/browser/notifications/notification.h" 14 #include "chrome/browser/notifications/notification.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/icon_messages.h" 16 #include "chrome/common/icon_messages.h"
16 #include "content/public/browser/render_process_host.h" 17 #include "content/public/browser/render_process_host.h"
17 #include "content/public/browser/render_view_host.h" 18 #include "content/public/browser/render_view_host.h"
18 #include "content/public/browser/site_instance.h" 19 #include "content/public/browser/site_instance.h"
19 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
20 #include "content/public/browser/web_contents_delegate.h" 21 #include "content/public/browser/web_contents_delegate.h"
(...skipping 18 matching lines...) Expand all
39 public: 40 public:
40 IconFetcher(content::WebContents* web_contents, 41 IconFetcher(content::WebContents* web_contents,
41 const std::string& notification_id, 42 const std::string& notification_id,
42 const GURL& icon_url) 43 const GURL& icon_url)
43 : content::WebContentsObserver(web_contents), 44 : content::WebContentsObserver(web_contents),
44 request_id_(0), 45 request_id_(0),
45 notification_id_(notification_id), 46 notification_id_(notification_id),
46 icon_url_(icon_url) { 47 icon_url_(icon_url) {
47 Observe(web_contents); 48 Observe(web_contents);
48 content::RenderViewHost* host = web_contents->GetRenderViewHost(); 49 content::RenderViewHost* host = web_contents->GetRenderViewHost();
49 host->Send(new IconMsg_DownloadFavicon(host->GetRoutingID(), 50 request_id_ = FaviconUtil::DownloadFavicon(host,
50 ++request_id_, 51 icon_url,
51 icon_url, 52 kNotificationIconImageSize);
52 kNotificationIconImageSize));
53 } 53 }
54 54
55 // content::WebContentsObserver override. 55 // content::WebContentsObserver override.
56 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { 56 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE {
57 bool message_handled = false; // Allow other handlers to receive these. 57 bool message_handled = false; // Allow other handlers to receive these.
58 IPC_BEGIN_MESSAGE_MAP(IconFetcher, message) 58 IPC_BEGIN_MESSAGE_MAP(IconFetcher, message)
59 IPC_MESSAGE_HANDLER(IconHostMsg_DidDownloadFavicon, OnDidDownloadFavicon) 59 IPC_MESSAGE_HANDLER(IconHostMsg_DidDownloadFavicon, OnDidDownloadFavicon)
60 IPC_MESSAGE_UNHANDLED(message_handled = false) 60 IPC_MESSAGE_UNHANDLED(message_handled = false)
61 IPC_END_MESSAGE_MAP() 61 IPC_END_MESSAGE_MAP()
62 return message_handled; 62 return message_handled;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 ExtensionService* extension_service = 156 ExtensionService* extension_service =
157 balloon_->profile()->GetExtensionService(); 157 balloon_->profile()->GetExtensionService();
158 const GURL& origin = balloon_->notification().origin_url(); 158 const GURL& origin = balloon_->notification().origin_url();
159 const extensions::Extension* extension = 159 const extensions::Extension* extension =
160 extension_service->extensions()->GetExtensionOrAppByURL( 160 extension_service->extensions()->GetExtensionOrAppByURL(
161 ExtensionURLInfo(origin)); 161 ExtensionURLInfo(origin));
162 if (extension) 162 if (extension)
163 return extension->id(); 163 return extension->id();
164 return std::string(); 164 return std::string();
165 } 165 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698