Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 470 for (std::vector<content::WebContents*>::const_iterator | 470 for (std::vector<content::WebContents*>::const_iterator |
| 471 i = blocked_contents.begin(); i != blocked_contents.end(); ++i) { | 471 i = blocked_contents.begin(); i != blocked_contents.end(); ++i) { |
| 472 std::string title(UTF16ToUTF8((*i)->GetTitle())); | 472 std::string title(UTF16ToUTF8((*i)->GetTitle())); |
| 473 // The popup may not have committed a load yet, in which case it won't | 473 // The popup may not have committed a load yet, in which case it won't |
| 474 // have a URL or title. | 474 // have a URL or title. |
| 475 if (title.empty()) | 475 if (title.empty()) |
| 476 title = l10n_util::GetStringUTF8(IDS_TAB_LOADING_TITLE); | 476 title = l10n_util::GetStringUTF8(IDS_TAB_LOADING_TITLE); |
| 477 PopupItem popup_item; | 477 PopupItem popup_item; |
| 478 popup_item.title = title; | 478 popup_item.title = title; |
| 479 // TODO: Make this use gfx::Image. | 479 // TODO: Make this use gfx::Image. |
| 480 TabContents* tab_contents = TabContents::FromWebContents(*i); | 480 TabContents* tab_contents = TabContents::FromWebContents(*i); |
|
stevenjb
2012/10/01 17:56:51
nit: Move this above where it's needed (or elimina
Avi (use Gerrit)
2012/10/01 19:23:57
Done.
| |
| 481 popup_item.bitmap = | 481 const FaviconTabHelper* favicon_tab_helper = |
| 482 tab_contents->favicon_tab_helper()->GetFavicon().AsBitmap(); | 482 FaviconTabHelper::FromWebContents(*i); |
|
stevenjb
2012/10/01 17:56:51
nit: Don't really need a local here either.
Avi (use Gerrit)
2012/10/01 19:23:57
Done.
| |
| 483 popup_item.bitmap = favicon_tab_helper->GetFavicon().AsBitmap(); | |
| 483 popup_item.tab_contents = tab_contents; | 484 popup_item.tab_contents = tab_contents; |
| 484 add_popup(popup_item); | 485 add_popup(popup_item); |
| 485 } | 486 } |
| 486 } | 487 } |
| 487 | 488 |
| 488 void ContentSettingPopupBubbleModel::OnPopupClicked(int index) { | 489 void ContentSettingPopupBubbleModel::OnPopupClicked(int index) { |
| 489 if (tab_contents()) { | 490 if (tab_contents()) { |
| 490 BlockedContentTabHelper::FromWebContents(tab_contents()->web_contents())-> | 491 BlockedContentTabHelper::FromWebContents(tab_contents()->web_contents())-> |
| 491 LaunchForContents( | 492 LaunchForContents( |
| 492 bubble_content().popup_items[index].tab_contents->web_contents()); | 493 bubble_content().popup_items[index].tab_contents->web_contents()); |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 828 const content::NotificationDetails& details) { | 829 const content::NotificationDetails& details) { |
| 829 if (type == chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED) { | 830 if (type == chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED) { |
| 830 DCHECK_EQ(tab_contents_, content::Source<TabContents>(source).ptr()); | 831 DCHECK_EQ(tab_contents_, content::Source<TabContents>(source).ptr()); |
| 831 tab_contents_ = NULL; | 832 tab_contents_ = NULL; |
| 832 } else { | 833 } else { |
| 833 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); | 834 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); |
| 834 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); | 835 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); |
| 835 profile_ = NULL; | 836 profile_ = NULL; |
| 836 } | 837 } |
| 837 } | 838 } |
| OLD | NEW |