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

Side by Side Diff: chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.mm

Issue 11011002: Switch FaviconTabHelper to use WebContentsUserData. (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
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/cocoa/tab_contents/favicon_util_mac.h" 5 #include "chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.h"
6 6
7 #include "chrome/browser/favicon/favicon_tab_helper.h" 7 #include "chrome/browser/favicon/favicon_tab_helper.h"
8 #include "chrome/browser/ui/tab_contents/tab_contents.h" 8 #include "chrome/browser/ui/tab_contents/tab_contents.h"
9 #include "grit/ui_resources.h" 9 #include "grit/ui_resources.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
11 11
12 namespace mac { 12 namespace mac {
13 13
14 NSImage* FaviconForTabContents(TabContents* contents) { 14 NSImage* FaviconForTabContents(TabContents* contents) {
15 if (contents && contents->favicon_tab_helper()->FaviconIsValid()) { 15 FaviconTabHelper* favicon_tab_helper =
16 NSImage* image = contents->favicon_tab_helper()->GetFavicon().AsNSImage(); 16 contents ? FaviconTabHelper::FromWebContents(contents->web_contents())
stevenjb 2012/10/01 17:56:51 This seems like a common enough pattern that it wo
Avi (use Gerrit) 2012/10/01 19:23:57 I'm on a quest to kill TabContents (see the bug li
stevenjb 2012/10/01 19:31:46 Fair enough.
17 : NULL;
18 if (favicon_tab_helper && favicon_tab_helper->FaviconIsValid()) {
19 NSImage* image = favicon_tab_helper->GetFavicon().AsNSImage();
17 // The |image| could be nil if the bitmap is null. In that case, fallback 20 // The |image| could be nil if the bitmap is null. In that case, fallback
18 // to the default image. 21 // to the default image.
19 if (image) { 22 if (image) {
20 return image; 23 return image;
21 } 24 }
22 } 25 }
23 26
24 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 27 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
25 return rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).ToNSImage(); 28 return rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).ToNSImage();
26 } 29 }
27 30
28 } // namespace mac 31 } // namespace mac
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698