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

Unified Diff: chrome/browser/ui/settings_window_manager.cc

Issue 595213005: Eliminate chrome::IsTrustedWindowWithScheme (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback Created 6 years, 3 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/ui/settings_window_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/settings_window_manager.cc
diff --git a/chrome/browser/ui/settings_window_manager.cc b/chrome/browser/ui/settings_window_manager.cc
index c60d5aed54553007f0d27ccf234972e00a87785d..f6a1754e565923713c1178102845ffdb65ff7266 100644
--- a/chrome/browser/ui/settings_window_manager.cc
+++ b/chrome/browser/ui/settings_window_manager.cc
@@ -54,17 +54,21 @@ void SettingsWindowManager::ShowChromePageForProfile(Profile* profile,
}
// No existing browser window, create one.
- NavigateParams params(profile, gurl, ui::PAGE_TRANSITION_AUTO_BOOKMARK);
- params.disposition = NEW_POPUP;
- params.trusted_source = true;
- params.window_action = NavigateParams::SHOW_WINDOW;
- params.user_gesture = true;
- params.path_behavior = NavigateParams::IGNORE_AND_NAVIGATE;
- chrome::Navigate(&params);
- settings_session_map_[profile] = params.browser->session_id().id();
+ navigate_params_.reset(
+ new NavigateParams(profile, gurl, ui::PAGE_TRANSITION_AUTO_BOOKMARK));
+ navigate_params_->disposition = NEW_POPUP;
+ navigate_params_->trusted_source = true;
+ navigate_params_->window_action = NavigateParams::SHOW_WINDOW;
+ navigate_params_->user_gesture = true;
+ navigate_params_->path_behavior = NavigateParams::IGNORE_AND_NAVIGATE;
+ chrome::Navigate(navigate_params_.get());
+ settings_session_map_[profile] = navigate_params_->browser->session_id().id();
+ // Once we set settings_session_map_, reset |navigate_params_| so that we do
+ // not hold on to a structure with stale pointers.
+ navigate_params_.reset();
FOR_EACH_OBSERVER(SettingsWindowManagerObserver,
- observers_, OnNewSettingsWindow(params.browser));
+ observers_, OnNewSettingsWindow(navigate_params_->browser));
}
Browser* SettingsWindowManager::FindBrowserForProfile(Profile* profile) {
@@ -75,6 +79,10 @@ Browser* SettingsWindowManager::FindBrowserForProfile(Profile* profile) {
}
bool SettingsWindowManager::IsSettingsBrowser(Browser* browser) const {
+ // This may get called from chrome::Navigate, so first test to see if this
+ // is the browser we are crrently navigating to.
+ if (navigate_params_ && navigate_params_->browser == browser)
sky 2014/09/25 23:36:52 Dependencies like this are fragile and result in N
+ return true;
ProfileSessionMap::const_iterator iter =
settings_session_map_.find(browser->profile());
return (iter != settings_session_map_.end() &&
« no previous file with comments | « chrome/browser/ui/settings_window_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698