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

Side by Side Diff: chrome/browser/ui/gtk/hung_renderer_dialog_gtk.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/ui/browser_dialogs.h" 5 #include "chrome/browser/ui/browser_dialogs.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 gtk_list_store_clear(model_); 184 gtk_list_store_clear(model_);
185 185
186 GtkTreeIter tree_iter; 186 GtkTreeIter tree_iter;
187 for (TabContentsIterator it; !it.done(); ++it) { 187 for (TabContentsIterator it; !it.done(); ++it) {
188 if (it->web_contents()->GetRenderProcessHost() == 188 if (it->web_contents()->GetRenderProcessHost() ==
189 hung_contents->GetRenderProcessHost()) { 189 hung_contents->GetRenderProcessHost()) {
190 gtk_list_store_append(model_, &tree_iter); 190 gtk_list_store_append(model_, &tree_iter);
191 std::string title = UTF16ToUTF8(it->web_contents()->GetTitle()); 191 std::string title = UTF16ToUTF8(it->web_contents()->GetTitle());
192 if (title.empty()) 192 if (title.empty())
193 title = UTF16ToUTF8(CoreTabHelper::GetDefaultTitle()); 193 title = UTF16ToUTF8(CoreTabHelper::GetDefaultTitle());
194 SkBitmap favicon = it->favicon_tab_helper()->GetFavicon().AsBitmap(); 194 const gfx::Image& icon = it->favicon_tab_helper()->GetFavicon();
195 SkBitmap favicon = icon.IsEmpty() ? SkBitmap() : *icon.ToSkBitmap();
195 196
196 GdkPixbuf* pixbuf = NULL; 197 GdkPixbuf* pixbuf = NULL;
197 if (favicon.width() > 0) 198 if (favicon.width() > 0)
198 pixbuf = gfx::GdkPixbufFromSkBitmap(favicon); 199 pixbuf = gfx::GdkPixbufFromSkBitmap(favicon);
199 gtk_list_store_set(model_, &tree_iter, 200 gtk_list_store_set(model_, &tree_iter,
200 COL_FAVICON, pixbuf, 201 COL_FAVICON, pixbuf,
201 COL_TITLE, title.c_str(), 202 COL_TITLE, title.c_str(),
202 -1); 203 -1);
203 if (pixbuf) 204 if (pixbuf)
204 g_object_unref(pixbuf); 205 g_object_unref(pixbuf);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 g_instance->ShowForWebContents(contents); 262 g_instance->ShowForWebContents(contents);
262 } 263 }
263 } 264 }
264 265
265 void HideHungRendererDialog(WebContents* contents) { 266 void HideHungRendererDialog(WebContents* contents) {
266 if (!logging::DialogsAreSuppressed() && g_instance) 267 if (!logging::DialogsAreSuppressed() && g_instance)
267 g_instance->EndForWebContents(contents); 268 g_instance->EndForWebContents(contents);
268 } 269 }
269 270
270 } // namespace chrome 271 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/content_settings/content_setting_bubble_model.cc ('k') | chrome/browser/ui/gtk/location_bar_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698