Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Unified Diff: chrome/browser/custom_home_pages_table_model.cc

Issue 9663044: Don't add devtools to list of startup pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: .find() fix Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698