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

Unified Diff: chrome/browser/custom_home_pages_table_model.cc

Issue 1427563002: Disclude Settings window and settings-frame from startup pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use helper function Created 5 years, 2 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 | « chrome/browser/custom_home_pages_table_model.h ('k') | 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 8b25d0a86f6f8dd84f1022963eb555fde30b29a0..75456dd219415a798318eaec1a044456f686de9e 100644
--- a/chrome/browser/custom_home_pages_table_model.cc
+++ b/chrome/browser/custom_home_pages_table_model.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_iterator.h"
#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/settings_window_manager.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -38,8 +39,10 @@ bool ShouldAddPage(const GURL& url) {
return false;
if (url.SchemeIs(content::kChromeUIScheme)) {
- if (url.host() == chrome::kChromeUISettingsHost)
+ if (url.host() == chrome::kChromeUISettingsHost ||
+ url.host() == chrome::kChromeUISettingsFrameHost) {
return false;
+ }
// For a settings page, the path will start with "/settings" not "settings"
// so find() will return 1, not 0.
@@ -181,12 +184,12 @@ void CustomHomePagesTableModel::SetToCurrentlyOpenPages() {
while (RowCount())
RemoveWithoutNotification(0);
- // And add all tabs for all open browsers with our profile.
+ // Add tabs from appropriate browser windows.
int add_index = 0;
for (chrome::BrowserIterator it; !it.done(); it.Next()) {
Browser* browser = *it;
- if (browser->profile() != profile_)
- continue; // Skip incognito browsers.
+ if (!ShouldIncludeBrowser(browser))
+ continue;
for (int tab_index = 0;
tab_index < browser->tab_strip_model()->count();
@@ -227,6 +230,18 @@ void CustomHomePagesTableModel::SetObserver(ui::TableModelObserver* observer) {
observer_ = observer;
}
+bool CustomHomePagesTableModel::ShouldIncludeBrowser(Browser* browser) {
+ // Do not include incognito browsers.
+ if (browser->profile() != profile_)
+ return false;
+ // Do not include the Settings window.
+ if (chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser(
+ browser)) {
+ return false;
+ }
+ return true;
+}
+
void CustomHomePagesTableModel::LoadTitle(Entry* entry) {
history::HistoryService* history_service =
HistoryServiceFactory::GetForProfile(profile_,
« no previous file with comments | « chrome/browser/custom_home_pages_table_model.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698