| OLD | NEW |
| 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 Loading... |
| 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(content::WebUI* web_ui, | 68 void SetInitializedModalHeight(Browser* browser, |
| 69 content::WebUI* web_ui, |
| 69 const base::ListValue* args) { | 70 const base::ListValue* args) { |
| 70 #if defined(OS_CHROMEOS) | 71 #if defined(OS_CHROMEOS) |
| 71 NOTREACHED(); | 72 NOTREACHED(); |
| 72 #else | 73 #else |
| 74 if (!browser) |
| 75 return; |
| 76 |
| 73 double height; | 77 double height; |
| 74 const bool success = args->GetDouble(0, &height); | 78 const bool success = args->GetDouble(0, &height); |
| 75 DCHECK(success); | 79 DCHECK(success); |
| 76 | 80 browser->signin_view_controller()->SetModalSigninHeight( |
| 77 Browser* browser = GetDesktopBrowser(web_ui); | 81 static_cast<int>(height)); |
| 78 if (browser) { | |
| 79 browser->signin_view_controller()->SetModalSigninHeight( | |
| 80 static_cast<int>(height)); | |
| 81 } | |
| 82 #endif | 82 #endif |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool IsForceSigninEnabled() { | 85 bool IsForceSigninEnabled() { |
| 86 PrefService* prefs = g_browser_process->local_state(); | 86 PrefService* prefs = g_browser_process->local_state(); |
| 87 return prefs->GetBoolean(prefs::kForceBrowserSignin); | 87 return prefs->GetBoolean(prefs::kForceBrowserSignin); |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace signin | 90 } // namespace signin |
| OLD | NEW |