Chromium Code Reviews| Index: chrome/browser/custom_home_pages_table_model.cc |
| diff --git a/chrome/browser/custom_home_pages_table_model.cc b/chrome/browser/custom_home_pages_table_model.cc |
| index 4cd0a2f2ca615ae7abc570fd0dd402d6fbd19b57..ba19650b49e1061ff233105280d249d2b78b9edb 100644 |
| --- a/chrome/browser/custom_home_pages_table_model.cc |
| +++ b/chrome/browser/custom_home_pages_table_model.cc |
| @@ -23,6 +23,34 @@ |
| #include "ui/base/models/table_model_observer.h" |
| #include "ui/gfx/codec/png_codec.h" |
| +namespace { |
| + |
| +// Checks whether the given URL should count as one of the "current" pages. |
| +// Returns true for all pages except dev tools and settings. |
| +bool ShouldAddPage(const GURL& url) { |
| + if (url.is_empty()) |
| + return false; |
| + |
| + if (url.SchemeIs(chrome::kChromeDevToolsScheme)) |
| + return false; |
| + |
| + if (url.SchemeIs(chrome::kChromeUIScheme)) { |
| + if (url.host() == chrome::kChromeUISettingsHost) |
| + return false; |
| + |
| + // For a settings page, the path will start with "/settings" not "settings" |
| + // so find() will return 1, not 0. |
| + if (url.host() == chrome::kChromeUIUberHost && |
| + url.path().find(chrome::kChromeUISettingsHost) == 1) { |
|
Evan Stade
2012/03/12 20:14:11
This also catches chrome://chrome/settings-foo
I
|
| + return false; |
| + } |
| + } |
| + |
| + return true; |
| +} |
| + |
| +} // namespace |
| + |
| struct CustomHomePagesTableModel::Entry { |
| Entry() : title_handle(0) {} |
| @@ -154,12 +182,7 @@ void CustomHomePagesTableModel::SetToCurrentlyOpenPages() { |
| for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) { |
| const GURL url = browser->GetWebContentsAt(tab_index)->GetURL(); |
| - // TODO(tbreisacher) remove kChromeUISettingsHost once options is deleted |
| - // and replaced by options2 |
| - if (!url.is_empty() && |
| - !(url.SchemeIs(chrome::kChromeUIScheme) && |
| - (url.host() == chrome::kChromeUISettingsHost || |
| - url.host() == chrome::kChromeUIUberHost))) { |
| + if (ShouldAddPage(url)) { |
|
Evan Stade
2012/03/12 20:14:11
no curlies
|
| Add(add_index++, url); |
| } |
| } |