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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 0bbcb84135bdfc9945bad72d45e52f4858ea13f8..e5ddf7d5c6b624097930e43034f67f08cf8b6a77 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -1049,8 +1049,9 @@ void LocationBarView::OnSetFocus() {
}
SkBitmap LocationBarView::GetFavicon() const {
- return delegate_->GetTabContents()->favicon_tab_helper()->
- GetFavicon().AsBitmap();
+ const gfx::Image& icon = delegate_->GetTabContents()->
+ favicon_tab_helper()->GetFavicon();
+ return icon.IsEmpty() ? SkBitmap() : *icon.ToSkBitmap();
}
string16 LocationBarView::GetTitle() const {
@@ -1277,8 +1278,9 @@ void LocationBarView::WriteDragDataForView(views::View* sender,
TabContents* tab_contents = GetTabContents();
DCHECK(tab_contents);
+ const gfx::Image& icon = tab_contents->favicon_tab_helper()->GetFavicon();
gfx::ImageSkia favicon =
- tab_contents->favicon_tab_helper()->GetFavicon().AsImageSkia();
+ icon.IsEmpty() ? gfx::ImageSkia() : *icon.ToImageSkia();
button_drag_utils::SetURLAndDragImage(
tab_contents->web_contents()->GetURL(),
tab_contents->web_contents()->GetTitle(),
« no previous file with comments | « chrome/browser/ui/views/hung_renderer_view.cc ('k') | chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698