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

Side by Side Diff: chrome/browser/ui/content_settings/content_setting_bubble_model.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/content_settings/content_setting_bubble_model.h" 5 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/content_settings/content_settings_utils.h" 8 #include "chrome/browser/content_settings/content_settings_utils.h"
9 #include "chrome/browser/content_settings/cookie_settings.h" 9 #include "chrome/browser/content_settings/cookie_settings.h"
10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 for (std::vector<TabContents*>::const_iterator 462 for (std::vector<TabContents*>::const_iterator
463 i = blocked_contents.begin(); i != blocked_contents.end(); ++i) { 463 i = blocked_contents.begin(); i != blocked_contents.end(); ++i) {
464 std::string title(UTF16ToUTF8((*i)->web_contents()->GetTitle())); 464 std::string title(UTF16ToUTF8((*i)->web_contents()->GetTitle()));
465 // The popup may not have committed a load yet, in which case it won't 465 // The popup may not have committed a load yet, in which case it won't
466 // have a URL or title. 466 // have a URL or title.
467 if (title.empty()) 467 if (title.empty())
468 title = l10n_util::GetStringUTF8(IDS_TAB_LOADING_TITLE); 468 title = l10n_util::GetStringUTF8(IDS_TAB_LOADING_TITLE);
469 PopupItem popup_item; 469 PopupItem popup_item;
470 popup_item.title = title; 470 popup_item.title = title;
471 // TODO: Make this use gfx::Image. 471 // TODO: Make this use gfx::Image.
472 popup_item.bitmap = (*i)->favicon_tab_helper()->GetFavicon().AsBitmap(); 472 const gfx::Image& icon = (*i)->favicon_tab_helper()->GetFavicon();
473 popup_item.bitmap = icon.IsEmpty() ? SkBitmap() : *icon.ToSkBitmap();
473 popup_item.tab_contents = (*i); 474 popup_item.tab_contents = (*i);
474 add_popup(popup_item); 475 add_popup(popup_item);
475 } 476 }
476 } 477 }
477 478
478 void ContentSettingPopupBubbleModel::OnPopupClicked(int index) { 479 void ContentSettingPopupBubbleModel::OnPopupClicked(int index) {
479 if (tab_contents()) { 480 if (tab_contents()) {
480 tab_contents()->blocked_content_tab_helper()-> 481 tab_contents()->blocked_content_tab_helper()->
481 LaunchForContents(bubble_content().popup_items[index].tab_contents); 482 LaunchForContents(bubble_content().popup_items[index].tab_contents);
482 } 483 }
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 const content::NotificationDetails& details) { 815 const content::NotificationDetails& details) {
815 if (type == chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED) { 816 if (type == chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED) {
816 DCHECK_EQ(tab_contents_, content::Source<TabContents>(source).ptr()); 817 DCHECK_EQ(tab_contents_, content::Source<TabContents>(source).ptr());
817 tab_contents_ = NULL; 818 tab_contents_ = NULL;
818 } else { 819 } else {
819 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); 820 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type);
820 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); 821 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr());
821 profile_ = NULL; 822 profile_ = NULL;
822 } 823 }
823 } 824 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.mm ('k') | chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698