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/custom_home_pages_table_model.h" | 5 #include "chrome/browser/custom_home_pages_table_model.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 "app/table_model_observer.h" | 9 #include "app/table_model_observer.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| 11 #include "base/string_util.h" |
11 #include "chrome/browser/browser.h" | 12 #include "chrome/browser/browser.h" |
12 #include "chrome/browser/browser_list.h" | 13 #include "chrome/browser/browser_list.h" |
13 #include "chrome/browser/pref_service.h" | 14 #include "chrome/browser/pref_service.h" |
14 #include "chrome/browser/profile.h" | 15 #include "chrome/browser/profile.h" |
15 #include "chrome/browser/tab_contents/tab_contents.h" | 16 #include "chrome/browser/tab_contents/tab_contents.h" |
16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 18 #include "chrome/common/url_constants.h" |
17 #include "gfx/codec/png_codec.h" | 19 #include "gfx/codec/png_codec.h" |
18 #include "grit/app_resources.h" | 20 #include "grit/app_resources.h" |
19 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
20 #include "net/base/net_util.h" | 22 #include "net/base/net_util.h" |
21 | 23 |
22 // static | 24 // static |
23 SkBitmap CustomHomePagesTableModel::default_favicon_; | 25 SkBitmap CustomHomePagesTableModel::default_favicon_; |
24 | 26 |
25 CustomHomePagesTableModel::CustomHomePagesTableModel(Profile* profile) | 27 CustomHomePagesTableModel::CustomHomePagesTableModel(Profile* profile) |
26 : profile_(profile), | 28 : profile_(profile), |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // And add all tabs for all open browsers with our profile. | 79 // And add all tabs for all open browsers with our profile. |
78 int add_index = 0; | 80 int add_index = 0; |
79 for (BrowserList::const_iterator browser_i = BrowserList::begin(); | 81 for (BrowserList::const_iterator browser_i = BrowserList::begin(); |
80 browser_i != BrowserList::end(); ++browser_i) { | 82 browser_i != BrowserList::end(); ++browser_i) { |
81 Browser* browser = *browser_i; | 83 Browser* browser = *browser_i; |
82 if (browser->profile() != profile_) | 84 if (browser->profile() != profile_) |
83 continue; // Skip incognito browsers. | 85 continue; // Skip incognito browsers. |
84 | 86 |
85 for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) { | 87 for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) { |
86 const GURL url = browser->GetTabContentsAt(tab_index)->GetURL(); | 88 const GURL url = browser->GetTabContentsAt(tab_index)->GetURL(); |
87 if (!url.is_empty()) | 89 if (!url.is_empty() && |
| 90 !(url.SchemeIs(chrome::kChromeUIScheme) && |
| 91 url.host() == chrome::kChromeUIOptionsHost)) |
88 Add(add_index++, url); | 92 Add(add_index++, url); |
89 } | 93 } |
90 } | 94 } |
91 } | 95 } |
92 | 96 |
93 std::vector<GURL> CustomHomePagesTableModel::GetURLs() { | 97 std::vector<GURL> CustomHomePagesTableModel::GetURLs() { |
94 std::vector<GURL> urls(entries_.size()); | 98 std::vector<GURL> urls(entries_.size()); |
95 for (size_t i = 0; i < entries_.size(); ++i) | 99 for (size_t i = 0; i < entries_.size(); ++i) |
96 urls[i] = entries_[i].url; | 100 urls[i] = entries_[i].url; |
97 return urls; | 101 return urls; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 return NULL; | 216 return NULL; |
213 } | 217 } |
214 | 218 |
215 std::wstring CustomHomePagesTableModel::FormattedURL(int row) const { | 219 std::wstring CustomHomePagesTableModel::FormattedURL(int row) const { |
216 std::wstring languages = | 220 std::wstring languages = |
217 UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); | 221 UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); |
218 std::wstring url(net::FormatUrl(entries_[row].url, languages)); | 222 std::wstring url(net::FormatUrl(entries_[row].url, languages)); |
219 base::i18n::GetDisplayStringInLTRDirectionality(&url); | 223 base::i18n::GetDisplayStringInLTRDirectionality(&url); |
220 return url; | 224 return url; |
221 } | 225 } |
OLD | NEW |