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

Side by Side Diff: android_webview/browser/icon_helper.cc

Issue 12945007: Fix Notifications Icon loading. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "android_webview/browser/icon_helper.h" 5 #include "android_webview/browser/icon_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
12 #include "content/public/common/content_constants.h"
12 #include "content/public/common/favicon_url.h" 13 #include "content/public/common/favicon_url.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 14 #include "third_party/skia/include/core/SkBitmap.h"
14 15
15 using content::BrowserThread; 16 using content::BrowserThread;
16 using content::WebContents; 17 using content::WebContents;
17 18
18 namespace android_webview { 19 namespace android_webview {
19 20
20 IconHelper::IconHelper(WebContents* web_contents) 21 IconHelper::IconHelper(WebContents* web_contents)
21 : WebContentsObserver(web_contents), 22 : WebContentsObserver(web_contents),
(...skipping 30 matching lines...) Expand all
52 for (std::vector<content::FaviconURL>::const_iterator i = candidates.begin(); 53 for (std::vector<content::FaviconURL>::const_iterator i = candidates.begin();
53 i != candidates.end(); ++i) { 54 i != candidates.end(); ++i) {
54 if (!i->icon_url.is_valid()) 55 if (!i->icon_url.is_valid())
55 continue; 56 continue;
56 57
57 switch(i->icon_type) { 58 switch(i->icon_type) {
58 case content::FaviconURL::FAVICON: 59 case content::FaviconURL::FAVICON:
59 // TODO(acleung): only fetch the URL if favicon downloading is enabled. 60 // TODO(acleung): only fetch the URL if favicon downloading is enabled.
60 // (currently that is, the app has called WebIconDatabase.open() 61 // (currently that is, the app has called WebIconDatabase.open()
61 // but we should decouple that setting via a boolean setting) 62 // but we should decouple that setting via a boolean setting)
62 web_contents()->DownloadFavicon(i->icon_url, 0, base::Bind( 63 web_contents()->DownloadFavicon(i->icon_url,
63 &IconHelper::DownloadFaviconCallback, base::Unretained(this))); 64 content::DOWNLOAD_FAVICON,
65 0,
66 base::Bind(
67 &IconHelper::DownloadFaviconCallback, base::Unretained(this)));
64 break; 68 break;
65 case content::FaviconURL::TOUCH_ICON: 69 case content::FaviconURL::TOUCH_ICON:
66 if (listener_) 70 if (listener_)
67 listener_->OnReceivedTouchIconUrl(i->icon_url.spec(), false); 71 listener_->OnReceivedTouchIconUrl(i->icon_url.spec(), false);
68 break; 72 break;
69 case content::FaviconURL::TOUCH_PRECOMPOSED_ICON: 73 case content::FaviconURL::TOUCH_PRECOMPOSED_ICON:
70 if (listener_) 74 if (listener_)
71 listener_->OnReceivedTouchIconUrl(i->icon_url.spec(), true); 75 listener_->OnReceivedTouchIconUrl(i->icon_url.spec(), true);
72 break; 76 break;
73 case content::FaviconURL::INVALID_ICON: 77 case content::FaviconURL::INVALID_ICON:
74 // Silently ignore it. Only trigger a callback on valid icons. 78 // Silently ignore it. Only trigger a callback on valid icons.
75 break; 79 break;
76 default: 80 default:
77 NOTREACHED(); 81 NOTREACHED();
78 break; 82 break;
79 } 83 }
80 } 84 }
81 } 85 }
82 86
83 } // namespace android_webview 87 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/favicon/favicon_tab_helper.cc » ('j') | content/public/browser/web_contents.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698