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

Unified Diff: chrome/browser/ui/webui/welcome_handler.cc

Issue 2431543003: WelcomeHandler sometimes has browser_ null in ctor (Closed)
Patch Set: Change to GetBrowser()->ShowModalSigninWindow Created 4 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/ui/webui/welcome_handler.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/webui/welcome_handler.cc
diff --git a/chrome/browser/ui/webui/welcome_handler.cc b/chrome/browser/ui/webui/welcome_handler.cc
index f23d092abea7153cdd0a8f17eaad2eb1b8817692..c6b91f6d312a5e533471516f7d3630e9bfd65035 100644
--- a/chrome/browser/ui/webui/welcome_handler.cc
+++ b/chrome/browser/ui/webui/welcome_handler.cc
@@ -18,7 +18,6 @@
WelcomeHandler::WelcomeHandler(content::WebUI* web_ui)
: profile_(Profile::FromWebUI(web_ui)),
- browser_(chrome::FindBrowserWithWebContents(web_ui->GetWebContents())),
oauth2_token_service_(
ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)),
result_(WelcomeResult::DEFAULT) {
@@ -46,7 +45,7 @@ void WelcomeHandler::HandleActivateSignIn(const base::ListValue* args) {
// them away to the NTP instead.
GoToNewTabPage();
} else {
- browser_->ShowModalSigninWindow(
+ GetBrowser()->ShowModalSigninWindow(
profiles::BubbleViewMode::BUBBLE_VIEW_MODE_GAIA_SIGNIN,
signin_metrics::AccessPoint::ACCESS_POINT_START_PAGE);
}
@@ -69,7 +68,16 @@ void WelcomeHandler::RegisterMessages() {
}
void WelcomeHandler::GoToNewTabPage() {
- chrome::NavigateParams params(browser_, GURL(chrome::kChromeUINewTabURL),
+ chrome::NavigateParams params(GetBrowser(), GURL(chrome::kChromeUINewTabURL),
ui::PageTransition::PAGE_TRANSITION_LINK);
chrome::Navigate(&params);
}
+
+Browser* WelcomeHandler::GetBrowser() {
+ DCHECK(web_ui());
+ content::WebContents* contents = web_ui()->GetWebContents();
+ DCHECK(contents);
+ Browser* browser = chrome::FindBrowserWithWebContents(contents);
+ DCHECK(browser);
+ return browser;
+}
« no previous file with comments | « chrome/browser/ui/webui/welcome_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698