| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/hung_renderer_dialog.h" | 5 #include "chrome/browser/hung_renderer_dialog.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 class HungPagesTableModel : public views::GroupTableModel { | 42 class HungPagesTableModel : public views::GroupTableModel { |
| 43 public: | 43 public: |
| 44 HungPagesTableModel(); | 44 HungPagesTableModel(); |
| 45 virtual ~HungPagesTableModel(); | 45 virtual ~HungPagesTableModel(); |
| 46 | 46 |
| 47 void InitForTabContents(TabContents* hung_contents); | 47 void InitForTabContents(TabContents* hung_contents); |
| 48 | 48 |
| 49 // Overridden from views::GroupTableModel: | 49 // Overridden from views::GroupTableModel: |
| 50 virtual int RowCount(); | 50 virtual int RowCount(); |
| 51 virtual std::wstring GetText(int row, int column_id); | 51 virtual string16 GetText(int row, int column_id); |
| 52 virtual SkBitmap GetIcon(int row); | 52 virtual SkBitmap GetIcon(int row); |
| 53 virtual void SetObserver(TableModelObserver* observer); | 53 virtual void SetObserver(TableModelObserver* observer); |
| 54 virtual void GetGroupRangeForItem(int item, views::GroupRange* range); | 54 virtual void GetGroupRangeForItem(int item, views::GroupRange* range); |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 typedef std::vector<TabContents*> TabContentsVector; | 57 typedef std::vector<TabContents*> TabContentsVector; |
| 58 TabContentsVector tab_contentses_; | 58 TabContentsVector tab_contentses_; |
| 59 | 59 |
| 60 TableModelObserver* observer_; | 60 TableModelObserver* observer_; |
| 61 | 61 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 82 observer_->OnModelChanged(); | 82 observer_->OnModelChanged(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 /////////////////////////////////////////////////////////////////////////////// | 85 /////////////////////////////////////////////////////////////////////////////// |
| 86 // HungPagesTableModel, views::GroupTableModel implementation: | 86 // HungPagesTableModel, views::GroupTableModel implementation: |
| 87 | 87 |
| 88 int HungPagesTableModel::RowCount() { | 88 int HungPagesTableModel::RowCount() { |
| 89 return static_cast<int>(tab_contentses_.size()); | 89 return static_cast<int>(tab_contentses_.size()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 std::wstring HungPagesTableModel::GetText(int row, int column_id) { | 92 string16 HungPagesTableModel::GetText(int row, int column_id) { |
| 93 DCHECK(row >= 0 && row < RowCount()); | 93 DCHECK(row >= 0 && row < RowCount()); |
| 94 std::wstring title = UTF16ToWideHack(tab_contentses_[row]->GetTitle()); | 94 string16 title = tab_contentses_[row]->GetTitle(); |
| 95 if (title.empty()) | 95 if (title.empty()) |
| 96 title = UTF16ToWideHack(TabContents::GetDefaultTitle()); | 96 title = TabContents::GetDefaultTitle(); |
| 97 // TODO(xji): Consider adding a special case if the title text is a URL, | 97 // TODO(xji): Consider adding a special case if the title text is a URL, |
| 98 // since those should always have LTR directionality. Please refer to | 98 // since those should always have LTR directionality. Please refer to |
| 99 // http://crbug.com/6726 for more information. | 99 // http://crbug.com/6726 for more information. |
| 100 base::i18n::AdjustStringForLocaleDirection(&title); | 100 base::i18n::AdjustStringForLocaleDirection(&title); |
| 101 return title; | 101 return title; |
| 102 } | 102 } |
| 103 | 103 |
| 104 SkBitmap HungPagesTableModel::GetIcon(int row) { | 104 SkBitmap HungPagesTableModel::GetIcon(int row) { |
| 105 DCHECK(row >= 0 && row < RowCount()); | 105 DCHECK(row >= 0 && row < RowCount()); |
| 106 return tab_contentses_.at(row)->GetFavIcon(); | 106 return tab_contentses_.at(row)->GetFavIcon(); |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 } | 455 } |
| 456 | 456 |
| 457 // static | 457 // static |
| 458 void HideForTabContents(TabContents* contents) { | 458 void HideForTabContents(TabContents* contents) { |
| 459 if (!logging::DialogsAreSuppressed() && g_instance) | 459 if (!logging::DialogsAreSuppressed() && g_instance) |
| 460 g_instance->EndForTabContents(contents); | 460 g_instance->EndForTabContents(contents); |
| 461 } | 461 } |
| 462 | 462 |
| 463 } // namespace hung_renderer_dialog | 463 } // namespace hung_renderer_dialog |
| 464 | 464 |
| OLD | NEW |