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

Side by Side Diff: chrome/browser/favicon/favicon_tab_helper.cc

Issue 10837215: exhibit 1: explicit null checks Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 4 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/favicon/favicon_tab_helper.h" 5 #include "chrome/browser/favicon/favicon_tab_helper.h"
6 6
7 #include "chrome/browser/favicon/favicon_handler.h" 7 #include "chrome/browser/favicon/favicon_handler.h"
8 #include "chrome/browser/favicon/favicon_util.h" 8 #include "chrome/browser/favicon/favicon_util.h"
9 #include "chrome/browser/favicon/select_favicon_frames.h" 9 #include "chrome/browser/favicon/select_favicon_frames.h"
10 #include "chrome/browser/history/history.h" 10 #include "chrome/browser/history/history.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 if (!service) 109 if (!service)
110 return; 110 return;
111 const FaviconStatus& favicon(entry->GetFavicon()); 111 const FaviconStatus& favicon(entry->GetFavicon());
112 if (!favicon.valid || favicon.url.is_empty() || 112 if (!favicon.valid || favicon.url.is_empty() ||
113 favicon.image.IsEmpty()) { 113 favicon.image.IsEmpty()) {
114 return; 114 return;
115 } 115 }
116 std::vector<unsigned char> image_data; 116 std::vector<unsigned char> image_data;
117 // TODO: Save all representations. 117 // TODO: Save all representations.
118 gfx::PNGCodec::EncodeBGRASkBitmap( 118 gfx::PNGCodec::EncodeBGRASkBitmap(
119 favicon.image.AsBitmap(), false, &image_data); 119 *favicon.image.ToSkBitmap(), false, &image_data);
120 service->SetFavicon( 120 service->SetFavicon(
121 entry->GetURL(), favicon.url, image_data, history::FAVICON); 121 entry->GetURL(), favicon.url, image_data, history::FAVICON);
122 } 122 }
123 123
124 int FaviconTabHelper::DownloadImage(const GURL& image_url, 124 int FaviconTabHelper::DownloadImage(const GURL& image_url,
125 int image_size, 125 int image_size,
126 history::IconType icon_type, 126 history::IconType icon_type,
127 const ImageDownloadCallback& callback) { 127 const ImageDownloadCallback& callback) {
128 if (icon_type == history::FAVICON) 128 if (icon_type == history::FAVICON)
129 return favicon_handler_->DownloadImage(image_url, image_size, icon_type, 129 return favicon_handler_->DownloadImage(image_url, image_size, icon_type,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 scale_factors = ui::GetSupportedScaleFactors(); 202 scale_factors = ui::GetSupportedScaleFactors();
203 #else 203 #else
204 scale_factors.push_back(ui::SCALE_FACTOR_100P); // TODO: Aura? 204 scale_factors.push_back(ui::SCALE_FACTOR_100P); // TODO: Aura?
205 #endif 205 #endif
206 gfx::Image favicon( 206 gfx::Image favicon(
207 SelectFaviconFrames(bitmaps, scale_factors, requested_size)); 207 SelectFaviconFrames(bitmaps, scale_factors, requested_size));
208 favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); 208 favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon);
209 if (touch_icon_handler_.get()) 209 if (touch_icon_handler_.get())
210 touch_icon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); 210 touch_icon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon);
211 } 211 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/extension_action/extension_actions_api.cc ('k') | chrome/browser/instant/instant_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698