OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // Checks whether the given URL should count as one of the "current" pages. | 31 // Checks whether the given URL should count as one of the "current" pages. |
32 // Returns true for all pages except dev tools and settings. | 32 // Returns true for all pages except dev tools and settings. |
33 bool ShouldAddPage(const GURL& url) { | 33 bool ShouldAddPage(const GURL& url) { |
34 if (url.is_empty()) | 34 if (url.is_empty()) |
35 return false; | 35 return false; |
36 | 36 |
37 if (url.SchemeIs(chrome::kChromeDevToolsScheme)) | 37 if (url.SchemeIs(chrome::kChromeDevToolsScheme)) |
38 return false; | 38 return false; |
39 | 39 |
40 if (url.SchemeIs(chrome::kChromeUIScheme)) { | 40 if (url.SchemeIs(content::kChromeUIScheme)) { |
41 if (url.host() == chrome::kChromeUISettingsHost) | 41 if (url.host() == chrome::kChromeUISettingsHost) |
42 return false; | 42 return false; |
43 | 43 |
44 // For a settings page, the path will start with "/settings" not "settings" | 44 // For a settings page, the path will start with "/settings" not "settings" |
45 // so find() will return 1, not 0. | 45 // so find() will return 1, not 0. |
46 if (url.host() == chrome::kChromeUIUberHost && | 46 if (url.host() == chrome::kChromeUIUberHost && |
47 url.path().find(chrome::kChromeUISettingsHost) == 1) { | 47 url.path().find(chrome::kChromeUISettingsHost) == 1) { |
48 return false; | 48 return false; |
49 } | 49 } |
50 } | 50 } |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 return NULL; | 264 return NULL; |
265 } | 265 } |
266 | 266 |
267 base::string16 CustomHomePagesTableModel::FormattedURL(int row) const { | 267 base::string16 CustomHomePagesTableModel::FormattedURL(int row) const { |
268 std::string languages = | 268 std::string languages = |
269 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); | 269 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); |
270 base::string16 url = net::FormatUrl(entries_[row].url, languages); | 270 base::string16 url = net::FormatUrl(entries_[row].url, languages); |
271 url = base::i18n::GetDisplayStringInLTRDirectionality(url); | 271 url = base::i18n::GetDisplayStringInLTRDirectionality(url); |
272 return url; | 272 return url; |
273 } | 273 } |
OLD | NEW |