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

Side by Side Diff: chrome/browser/ui/views/hung_renderer_view.cc

Issue 6814029: Revert 80519 - Move favicon from TabContents to TabContentsWrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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/ui/browser_dialogs.h" 5 #include "chrome/browser/ui/browser_dialogs.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/favicon_tab_helper.h"
10 #include "chrome/browser/ui/browser_list.h" 9 #include "chrome/browser/ui/browser_list.h"
11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
12 #include "chrome/common/chrome_constants.h" 11 #include "chrome/common/chrome_constants.h"
13 #include "chrome/common/logging_chrome.h" 12 #include "chrome/common/logging_chrome.h"
14 #include "content/browser/renderer_host/render_process_host.h" 13 #include "content/browser/renderer_host/render_process_host.h"
15 #include "content/browser/renderer_host/render_view_host.h" 14 #include "content/browser/renderer_host/render_view_host.h"
16 #include "content/browser/tab_contents/tab_contents.h" 15 #include "content/browser/tab_contents/tab_contents.h"
17 #include "content/common/result_codes.h" 16 #include "content/common/result_codes.h"
18 #include "grit/chromium_strings.h" 17 #include "grit/chromium_strings.h"
19 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
(...skipping 29 matching lines...) Expand all
49 void InitForTabContents(TabContents* hung_contents); 48 void InitForTabContents(TabContents* hung_contents);
50 49
51 // Overridden from views::GroupTableModel: 50 // Overridden from views::GroupTableModel:
52 virtual int RowCount(); 51 virtual int RowCount();
53 virtual string16 GetText(int row, int column_id); 52 virtual string16 GetText(int row, int column_id);
54 virtual SkBitmap GetIcon(int row); 53 virtual SkBitmap GetIcon(int row);
55 virtual void SetObserver(ui::TableModelObserver* observer); 54 virtual void SetObserver(ui::TableModelObserver* observer);
56 virtual void GetGroupRangeForItem(int item, views::GroupRange* range); 55 virtual void GetGroupRangeForItem(int item, views::GroupRange* range);
57 56
58 private: 57 private:
59 typedef std::vector<TabContentsWrapper*> TabContentsVector; 58 typedef std::vector<TabContents*> TabContentsVector;
60 TabContentsVector tab_contentses_; 59 TabContentsVector tab_contentses_;
61 60
62 ui::TableModelObserver* observer_; 61 ui::TableModelObserver* observer_;
63 62
64 DISALLOW_COPY_AND_ASSIGN(HungPagesTableModel); 63 DISALLOW_COPY_AND_ASSIGN(HungPagesTableModel);
65 }; 64 };
66 65
67 /////////////////////////////////////////////////////////////////////////////// 66 ///////////////////////////////////////////////////////////////////////////////
68 // HungPagesTableModel, public: 67 // HungPagesTableModel, public:
69 68
70 HungPagesTableModel::HungPagesTableModel() : observer_(NULL) { 69 HungPagesTableModel::HungPagesTableModel() : observer_(NULL) {
71 } 70 }
72 71
73 HungPagesTableModel::~HungPagesTableModel() { 72 HungPagesTableModel::~HungPagesTableModel() {
74 } 73 }
75 74
76 void HungPagesTableModel::InitForTabContents(TabContents* hung_contents) { 75 void HungPagesTableModel::InitForTabContents(TabContents* hung_contents) {
77 tab_contentses_.clear(); 76 tab_contentses_.clear();
78 for (TabContentsIterator it; !it.done(); ++it) { 77 for (TabContentsIterator it; !it.done(); ++it) {
79 if (it->tab_contents()->GetRenderProcessHost() == 78 if (it->tab_contents()->GetRenderProcessHost() ==
80 hung_contents->GetRenderProcessHost()) 79 hung_contents->GetRenderProcessHost())
81 tab_contentses_.push_back(*it); 80 tab_contentses_.push_back((*it)->tab_contents());
82 } 81 }
83 // The world is different. 82 // The world is different.
84 if (observer_) 83 if (observer_)
85 observer_->OnModelChanged(); 84 observer_->OnModelChanged();
86 } 85 }
87 86
88 /////////////////////////////////////////////////////////////////////////////// 87 ///////////////////////////////////////////////////////////////////////////////
89 // HungPagesTableModel, views::GroupTableModel implementation: 88 // HungPagesTableModel, views::GroupTableModel implementation:
90 89
91 int HungPagesTableModel::RowCount() { 90 int HungPagesTableModel::RowCount() {
92 return static_cast<int>(tab_contentses_.size()); 91 return static_cast<int>(tab_contentses_.size());
93 } 92 }
94 93
95 string16 HungPagesTableModel::GetText(int row, int column_id) { 94 string16 HungPagesTableModel::GetText(int row, int column_id) {
96 DCHECK(row >= 0 && row < RowCount()); 95 DCHECK(row >= 0 && row < RowCount());
97 string16 title = tab_contentses_[row]->tab_contents()->GetTitle(); 96 string16 title = tab_contentses_[row]->GetTitle();
98 if (title.empty()) 97 if (title.empty())
99 title = TabContentsWrapper::GetDefaultTitle(); 98 title = TabContentsWrapper::GetDefaultTitle();
100 // TODO(xji): Consider adding a special case if the title text is a URL, 99 // TODO(xji): Consider adding a special case if the title text is a URL,
101 // since those should always have LTR directionality. Please refer to 100 // since those should always have LTR directionality. Please refer to
102 // http://crbug.com/6726 for more information. 101 // http://crbug.com/6726 for more information.
103 base::i18n::AdjustStringForLocaleDirection(&title); 102 base::i18n::AdjustStringForLocaleDirection(&title);
104 return title; 103 return title;
105 } 104 }
106 105
107 SkBitmap HungPagesTableModel::GetIcon(int row) { 106 SkBitmap HungPagesTableModel::GetIcon(int row) {
108 DCHECK(row >= 0 && row < RowCount()); 107 DCHECK(row >= 0 && row < RowCount());
109 return tab_contentses_.at(row)->favicon_tab_helper()->GetFavicon(); 108 return tab_contentses_.at(row)->GetFavicon();
110 } 109 }
111 110
112 void HungPagesTableModel::SetObserver(ui::TableModelObserver* observer) { 111 void HungPagesTableModel::SetObserver(ui::TableModelObserver* observer) {
113 observer_ = observer; 112 observer_ = observer;
114 } 113 }
115 114
116 void HungPagesTableModel::GetGroupRangeForItem(int item, 115 void HungPagesTableModel::GetGroupRangeForItem(int item,
117 views::GroupRange* range) { 116 views::GroupRange* range) {
118 DCHECK(range); 117 DCHECK(range);
119 range->start = 0; 118 range->start = 0;
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 g_instance->ShowForTabContents(contents); 457 g_instance->ShowForTabContents(contents);
459 } 458 }
460 } 459 }
461 460
462 void HideHungRendererDialog(TabContents* contents) { 461 void HideHungRendererDialog(TabContents* contents) {
463 if (!logging::DialogsAreSuppressed() && g_instance) 462 if (!logging::DialogsAreSuppressed() && g_instance)
464 g_instance->EndForTabContents(contents); 463 g_instance->EndForTabContents(contents);
465 } 464 }
466 465
467 } // namespace browser 466 } // namespace browser
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/create_application_shortcut_view.cc ('k') | chrome/browser/ui/views/location_bar/location_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698