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

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

Issue 11777009: Remove redundant |errored| member from IconHostMsg_DidDownloadFavicon (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 const content::NotificationSource& source, 58 const content::NotificationSource& source,
59 const content::NotificationDetails& details); 59 const content::NotificationDetails& details);
60 60
61 // Downloads icon via the FaviconTabHelper. 61 // Downloads icon via the FaviconTabHelper.
62 void DownloadIcon(); 62 void DownloadIcon();
63 63
64 // Favicon download callback. 64 // Favicon download callback.
65 void DidDownloadFavicon( 65 void DidDownloadFavicon(
66 int id, 66 int id,
67 const GURL& image_url, 67 const GURL& image_url,
68 bool errored,
69 int requested_size, 68 int requested_size,
70 const std::vector<SkBitmap>& bitmaps); 69 const std::vector<SkBitmap>& bitmaps);
71 70
72 // Checks if shortcuts exists on desktop, start menu and quick launch. 71 // Checks if shortcuts exists on desktop, start menu and quick launch.
73 void CheckExistingShortcuts(); 72 void CheckExistingShortcuts();
74 73
75 // Update shortcut files and icons. 74 // Update shortcut files and icons.
76 void UpdateShortcuts(); 75 void UpdateShortcuts();
77 void UpdateShortcutsOnFileThread(); 76 void UpdateShortcutsOnFileThread();
78 77
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 std::max(unprocessed_icons_.back().width, 160 std::max(unprocessed_icons_.back().width,
162 unprocessed_icons_.back().height), 161 unprocessed_icons_.back().height),
163 base::Bind(&UpdateShortcutWorker::DidDownloadFavicon, 162 base::Bind(&UpdateShortcutWorker::DidDownloadFavicon,
164 base::Unretained(this))); 163 base::Unretained(this)));
165 unprocessed_icons_.pop_back(); 164 unprocessed_icons_.pop_back();
166 } 165 }
167 166
168 void UpdateShortcutWorker::DidDownloadFavicon( 167 void UpdateShortcutWorker::DidDownloadFavicon(
169 int id, 168 int id,
170 const GURL& image_url, 169 const GURL& image_url,
171 bool errored,
172 int requested_size, 170 int requested_size,
173 const std::vector<SkBitmap>& bitmaps) { 171 const std::vector<SkBitmap>& bitmaps) {
174 std::vector<ui::ScaleFactor> scale_factors; 172 std::vector<ui::ScaleFactor> scale_factors;
175 scale_factors.push_back(ui::SCALE_FACTOR_100P); 173 scale_factors.push_back(ui::SCALE_FACTOR_100P);
176 174
177 size_t closest_index = 175 size_t closest_index =
178 FaviconUtil::SelectBestFaviconFromBitmaps(bitmaps, 176 FaviconUtil::SelectBestFaviconFromBitmaps(bitmaps,
179 scale_factors, 177 scale_factors,
180 requested_size); 178 requested_size);
181 179
182 if (!errored && !bitmaps.empty() && !bitmaps[closest_index].isNull()) { 180 if (!bitmaps.empty() && !bitmaps[closest_index].isNull()) {
183 // Update icon with download image and update shortcut. 181 // Update icon with download image and update shortcut.
184 shortcut_info_.favicon = gfx::Image(bitmaps[closest_index]); 182 shortcut_info_.favicon = gfx::Image(bitmaps[closest_index]);
185 extensions::TabHelper* extensions_tab_helper = 183 extensions::TabHelper* extensions_tab_helper =
186 extensions::TabHelper::FromWebContents(web_contents_); 184 extensions::TabHelper::FromWebContents(web_contents_);
187 extensions_tab_helper->SetAppIcon(bitmaps[closest_index]); 185 extensions_tab_helper->SetAppIcon(bitmaps[closest_index]);
188 UpdateShortcuts(); 186 UpdateShortcuts();
189 } else { 187 } else {
190 // Try the next icon otherwise. 188 // Try the next icon otherwise.
191 DownloadIcon(); 189 DownloadIcon();
192 } 190 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 shortcut_info->extension_id = app.id(); 352 shortcut_info->extension_id = app.id();
355 shortcut_info->is_platform_app = app.is_platform_app(); 353 shortcut_info->is_platform_app = app.is_platform_app();
356 shortcut_info->url = GURL(app.launch_web_url()); 354 shortcut_info->url = GURL(app.launch_web_url());
357 shortcut_info->title = UTF8ToUTF16(app.name()); 355 shortcut_info->title = UTF8ToUTF16(app.name());
358 shortcut_info->description = UTF8ToUTF16(app.description()); 356 shortcut_info->description = UTF8ToUTF16(app.description());
359 shortcut_info->extension_path = app.path(); 357 shortcut_info->extension_path = app.path();
360 shortcut_info->profile_path = profile->GetPath(); 358 shortcut_info->profile_path = profile->GetPath();
361 } 359 }
362 360
363 } // namespace web_app 361 } // 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