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

Side by Side Diff: chrome/browser/ui/webui/signin/signin_utils.cc

Issue 2787453002: Revert of Use the same browser instance in the sync confirmation dialog. (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/signin/signin_utils.h" 5 #include "chrome/browser/ui/webui/signin/signin_utils.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 59
60 Browser* GetDesktopBrowser(content::WebUI* web_ui) { 60 Browser* GetDesktopBrowser(content::WebUI* web_ui) {
61 Browser* browser = 61 Browser* browser =
62 chrome::FindBrowserWithWebContents(web_ui->GetWebContents()); 62 chrome::FindBrowserWithWebContents(web_ui->GetWebContents());
63 if (!browser) 63 if (!browser)
64 browser = chrome::FindLastActiveWithProfile(Profile::FromWebUI(web_ui)); 64 browser = chrome::FindLastActiveWithProfile(Profile::FromWebUI(web_ui));
65 return browser; 65 return browser;
66 } 66 }
67 67
68 void SetInitializedModalHeight(Browser* browser, 68 void SetInitializedModalHeight(content::WebUI* web_ui,
69 content::WebUI* web_ui,
70 const base::ListValue* args) { 69 const base::ListValue* args) {
71 if (!browser)
72 return;
73
74 double height; 70 double height;
75 const bool success = args->GetDouble(0, &height); 71 const bool success = args->GetDouble(0, &height);
76 DCHECK(success); 72 DCHECK(success);
77 browser->signin_view_controller()->SetModalSigninHeight( 73
78 static_cast<int>(height)); 74 Browser* browser = GetDesktopBrowser(web_ui);
75 if (browser) {
76 browser->signin_view_controller()->SetModalSigninHeight(
77 static_cast<int>(height));
78 }
79 } 79 }
80 80
81 bool IsForceSigninEnabled() { 81 bool IsForceSigninEnabled() {
82 PrefService* prefs = g_browser_process->local_state(); 82 PrefService* prefs = g_browser_process->local_state();
83 return prefs->GetBoolean(prefs::kForceBrowserSignin); 83 return prefs->GetBoolean(prefs::kForceBrowserSignin);
84 } 84 }
85 85
86 } // namespace signin 86 } // namespace signin
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/signin/signin_utils.h ('k') | chrome/browser/ui/webui/signin/sync_confirmation_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698