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 "chrome/browser/browser.h" | 11 #include "chrome/browser/browser.h" |
12 #include "chrome/browser/browser_list.h" | 12 #include "chrome/browser/browser_list.h" |
13 #include "chrome/browser/pref_service.h" | 13 #include "chrome/browser/pref_service.h" |
14 #include "chrome/browser/profile.h" | 14 #include "chrome/browser/profile.h" |
15 #include "chrome/browser/tab_contents/tab_contents.h" | 15 #include "chrome/browser/tab_contents/tab_contents.h" |
16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 17 #include "chrome/common/url_constants.h" |
17 #include "gfx/codec/png_codec.h" | 18 #include "gfx/codec/png_codec.h" |
18 #include "grit/app_resources.h" | 19 #include "grit/app_resources.h" |
19 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
20 #include "net/base/net_util.h" | 21 #include "net/base/net_util.h" |
21 | 22 |
22 CustomHomePagesTableModel::CustomHomePagesTableModel(Profile* profile) | 23 CustomHomePagesTableModel::CustomHomePagesTableModel(Profile* profile) |
23 : default_favicon_(NULL), | 24 : default_favicon_(NULL), |
24 profile_(profile), | 25 profile_(profile), |
25 observer_(NULL) { | 26 observer_(NULL) { |
26 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 27 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // And add all tabs for all open browsers with our profile. | 77 // And add all tabs for all open browsers with our profile. |
77 int add_index = 0; | 78 int add_index = 0; |
78 for (BrowserList::const_iterator browser_i = BrowserList::begin(); | 79 for (BrowserList::const_iterator browser_i = BrowserList::begin(); |
79 browser_i != BrowserList::end(); ++browser_i) { | 80 browser_i != BrowserList::end(); ++browser_i) { |
80 Browser* browser = *browser_i; | 81 Browser* browser = *browser_i; |
81 if (browser->profile() != profile_) | 82 if (browser->profile() != profile_) |
82 continue; // Skip incognito browsers. | 83 continue; // Skip incognito browsers. |
83 | 84 |
84 for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) { | 85 for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) { |
85 const GURL url = browser->GetTabContentsAt(tab_index)->GetURL(); | 86 const GURL url = browser->GetTabContentsAt(tab_index)->GetURL(); |
86 if (!url.is_empty()) | 87 if (!url.is_empty() && |
| 88 !(url.SchemeIs(chrome::kChromeUIScheme) && |
| 89 url.host() == chrome::kChromeUIOptionsHost)) |
87 Add(add_index++, url); | 90 Add(add_index++, url); |
88 } | 91 } |
89 } | 92 } |
90 } | 93 } |
91 | 94 |
92 std::vector<GURL> CustomHomePagesTableModel::GetURLs() { | 95 std::vector<GURL> CustomHomePagesTableModel::GetURLs() { |
93 std::vector<GURL> urls(entries_.size()); | 96 std::vector<GURL> urls(entries_.size()); |
94 for (size_t i = 0; i < entries_.size(); ++i) | 97 for (size_t i = 0; i < entries_.size(); ++i) |
95 urls[i] = entries_[i].url; | 98 urls[i] = entries_[i].url; |
96 return urls; | 99 return urls; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 return NULL; | 205 return NULL; |
203 } | 206 } |
204 | 207 |
205 std::wstring CustomHomePagesTableModel::FormattedURL(int row) const { | 208 std::wstring CustomHomePagesTableModel::FormattedURL(int row) const { |
206 std::wstring languages = | 209 std::wstring languages = |
207 UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); | 210 UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); |
208 std::wstring url(net::FormatUrl(entries_[row].url, languages)); | 211 std::wstring url(net::FormatUrl(entries_[row].url, languages)); |
209 base::i18n::GetDisplayStringInLTRDirectionality(&url); | 212 base::i18n::GetDisplayStringInLTRDirectionality(&url); |
210 return url; | 213 return url; |
211 } | 214 } |
OLD | NEW |