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

Side by Side Diff: chrome/browser/ui/web_applications/web_app_ui.cc

Issue 14322023: Don't request missing favicon on every page request. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync up to r199996 Created 7 years, 7 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/web_applications/web_app_ui.h" 5 #include "chrome/browser/ui/web_applications/web_app_ui.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 virtual void Observe(int type, 82 virtual void Observe(int type,
83 const content::NotificationSource& source, 83 const content::NotificationSource& source,
84 const content::NotificationDetails& details); 84 const content::NotificationDetails& details);
85 85
86 // Downloads icon via the FaviconTabHelper. 86 // Downloads icon via the FaviconTabHelper.
87 void DownloadIcon(); 87 void DownloadIcon();
88 88
89 // Favicon download callback. 89 // Favicon download callback.
90 void DidDownloadFavicon( 90 void DidDownloadFavicon(
91 int id, 91 int id,
92 int http_status_code,
92 const GURL& image_url, 93 const GURL& image_url,
93 int requested_size, 94 int requested_size,
94 const std::vector<SkBitmap>& bitmaps); 95 const std::vector<SkBitmap>& bitmaps);
95 96
96 // Checks if shortcuts exists on desktop, start menu and quick launch. 97 // Checks if shortcuts exists on desktop, start menu and quick launch.
97 void CheckExistingShortcuts(); 98 void CheckExistingShortcuts();
98 99
99 // Update shortcut files and icons. 100 // Update shortcut files and icons.
100 void UpdateShortcuts(); 101 void UpdateShortcuts();
101 void UpdateShortcutsOnFileThread(); 102 void UpdateShortcutsOnFileThread();
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 true, // favicon 186 true, // favicon
186 std::max(unprocessed_icons_.back().width, 187 std::max(unprocessed_icons_.back().width,
187 unprocessed_icons_.back().height), 188 unprocessed_icons_.back().height),
188 base::Bind(&UpdateShortcutWorker::DidDownloadFavicon, 189 base::Bind(&UpdateShortcutWorker::DidDownloadFavicon,
189 base::Unretained(this))); 190 base::Unretained(this)));
190 unprocessed_icons_.pop_back(); 191 unprocessed_icons_.pop_back();
191 } 192 }
192 193
193 void UpdateShortcutWorker::DidDownloadFavicon( 194 void UpdateShortcutWorker::DidDownloadFavicon(
194 int id, 195 int id,
196 int http_status_code,
195 const GURL& image_url, 197 const GURL& image_url,
196 int requested_size, 198 int requested_size,
197 const std::vector<SkBitmap>& bitmaps) { 199 const std::vector<SkBitmap>& bitmaps) {
198 std::vector<ui::ScaleFactor> scale_factors; 200 std::vector<ui::ScaleFactor> scale_factors;
199 scale_factors.push_back(ui::SCALE_FACTOR_100P); 201 scale_factors.push_back(ui::SCALE_FACTOR_100P);
200 202
201 size_t closest_index = 203 size_t closest_index =
202 FaviconUtil::SelectBestFaviconFromBitmaps(bitmaps, 204 FaviconUtil::SelectBestFaviconFromBitmaps(bitmaps,
203 scale_factors, 205 scale_factors,
204 requested_size); 206 requested_size);
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 } 475 }
474 476
475 // |info_list| may still be empty at this point, in which case LoadImage 477 // |info_list| may still be empty at this point, in which case LoadImage
476 // will call the OnImageLoaded callback with an empty image and exit 478 // will call the OnImageLoaded callback with an empty image and exit
477 // immediately. 479 // immediately.
478 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list, 480 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list,
479 base::Bind(&OnImageLoaded, shortcut_info, callback)); 481 base::Bind(&OnImageLoaded, shortcut_info, callback));
480 } 482 }
481 483
482 } // namespace web_app 484 } // namespace web_app
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/create_application_shortcut_view.cc ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698