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

Side by Side Diff: chrome/browser/content_setting_bubble_model.cc

Issue 6735042: Move favicon from TabContents to TabContentsWrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/content_setting_bubble_model.h" 5 #include "chrome/browser/content_setting_bubble_model.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/blocked_content_container.h" 9 #include "chrome/browser/blocked_content_container.h"
10 #include "chrome/browser/content_settings/host_content_settings_map.h" 10 #include "chrome/browser/content_settings/host_content_settings_map.h"
11 #include "chrome/browser/favicon_tab_helper.h"
11 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" 12 #include "chrome/browser/geolocation/geolocation_content_settings_map.h"
12 #include "chrome/browser/metrics/user_metrics.h" 13 #include "chrome/browser/metrics/user_metrics.h"
13 #include "chrome/browser/prefs/pref_service.h" 14 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/tab_contents/tab_specific_content_settings.h" 16 #include "chrome/browser/tab_contents/tab_specific_content_settings.h"
16 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" 17 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
17 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
18 #include "content/browser/renderer_host/render_view_host.h" 20 #include "content/browser/renderer_host/render_view_host.h"
19 #include "content/browser/tab_contents/tab_contents.h" 21 #include "content/browser/tab_contents/tab_contents.h"
20 #include "content/browser/tab_contents/tab_contents_delegate.h" 22 #include "content/browser/tab_contents/tab_contents_delegate.h"
21 #include "content/common/notification_service.h" 23 #include "content/common/notification_service.h"
22 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
23 #include "net/base/net_util.h" 25 #include "net/base/net_util.h"
24 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
25 27
26 class ContentSettingTitleAndLinkModel : public ContentSettingBubbleModel { 28 class ContentSettingTitleAndLinkModel : public ContentSettingBubbleModel {
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 private: 379 private:
378 void SetPopups() { 380 void SetPopups() {
379 // check for crbug.com/53176 381 // check for crbug.com/53176
380 if (!tab_contents()->blocked_content_container()) 382 if (!tab_contents()->blocked_content_container())
381 return; 383 return;
382 std::vector<TabContents*> blocked_contents; 384 std::vector<TabContents*> blocked_contents;
383 tab_contents()->blocked_content_container()->GetBlockedContents( 385 tab_contents()->blocked_content_container()->GetBlockedContents(
384 &blocked_contents); 386 &blocked_contents);
385 for (std::vector<TabContents*>::const_iterator 387 for (std::vector<TabContents*>::const_iterator
386 i(blocked_contents.begin()); i != blocked_contents.end(); ++i) { 388 i(blocked_contents.begin()); i != blocked_contents.end(); ++i) {
389 // TODO(avi): move blocked contents from TC to TCW; remove this.
390 TabContentsWrapper* wrapper =
391 TabContentsWrapper::GetCurrentWrapperForContents(*i);
387 std::string title(UTF16ToUTF8((*i)->GetTitle())); 392 std::string title(UTF16ToUTF8((*i)->GetTitle()));
388 // The popup may not have committed a load yet, in which case it won't 393 // The popup may not have committed a load yet, in which case it won't
389 // have a URL or title. 394 // have a URL or title.
390 if (title.empty()) 395 if (title.empty())
391 title = l10n_util::GetStringUTF8(IDS_TAB_LOADING_TITLE); 396 title = l10n_util::GetStringUTF8(IDS_TAB_LOADING_TITLE);
392 PopupItem popup_item; 397 PopupItem popup_item;
393 popup_item.title = title; 398 popup_item.title = title;
394 popup_item.bitmap = (*i)->GetFavicon(); 399 popup_item.bitmap = wrapper->favicon_tab_helper()->GetFavicon();
395 popup_item.tab_contents = (*i); 400 popup_item.tab_contents = (*i);
396 add_popup(popup_item); 401 add_popup(popup_item);
397 } 402 }
398 } 403 }
399 404
400 virtual void OnPopupClicked(int index) { 405 virtual void OnPopupClicked(int index) {
401 if (tab_contents() && tab_contents()->blocked_content_container()) { 406 if (tab_contents() && tab_contents()->blocked_content_container()) {
402 tab_contents()->blocked_content_container()->LaunchForContents( 407 tab_contents()->blocked_content_container()->LaunchForContents(
403 bubble_content().popup_items[index].tab_contents); 408 bubble_content().popup_items[index].tab_contents);
404 } 409 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 bubble_content_.resource_identifiers.insert(resource_identifier); 539 bubble_content_.resource_identifiers.insert(resource_identifier);
535 } 540 }
536 541
537 void ContentSettingBubbleModel::Observe(NotificationType type, 542 void ContentSettingBubbleModel::Observe(NotificationType type,
538 const NotificationSource& source, 543 const NotificationSource& source,
539 const NotificationDetails& details) { 544 const NotificationDetails& details) {
540 DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED); 545 DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED);
541 DCHECK(source == Source<TabContents>(tab_contents_)); 546 DCHECK(source == Source<TabContents>(tab_contents_));
542 tab_contents_ = NULL; 547 tab_contents_ = NULL;
543 } 548 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/wm_overview_controller.cc ('k') | chrome/browser/extensions/extension_tabs_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698