OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/login/helper.h" | 5 #include "chrome/browser/chromeos/login/helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/chromeos/login/startup_utils.h" | 10 #include "chrome/browser/chromeos/login/startup_utils.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 content::WebContents* embedder = GetLoginWebContents(); | 146 content::WebContents* embedder = GetLoginWebContents(); |
147 if (!embedder) | 147 if (!embedder) |
148 return nullptr; | 148 return nullptr; |
149 | 149 |
150 // Note the partition name must match the sign-in webview used. For now, | 150 // Note the partition name must match the sign-in webview used. For now, |
151 // this is the default unnamed, shared, in-memory partition. | 151 // this is the default unnamed, shared, in-memory partition. |
152 return GetPartition(embedder, std::string()); | 152 return GetPartition(embedder, std::string()); |
153 } | 153 } |
154 | 154 |
155 net::URLRequestContextGetter* GetSigninContext() { | 155 net::URLRequestContextGetter* GetSigninContext() { |
156 if (StartupUtils::IsWebviewSigninEnabled()) | 156 if (StartupUtils::IsWebviewSigninEnabled()) { |
157 return GetSigninPartition()->GetURLRequestContext(); | 157 content::StoragePartition* signin_partition = GetSigninPartition(); |
158 | |
159 // Special case for unit tests. There's no LoginDisplayHost thus no | |
160 // webview instance. | |
161 if (!signin_partition && !LoginDisplayHostImpl::default_host()) | |
dzhioev (left Google)
2015/04/15 17:36:24
Please try to return nullptr in this case. Or at l
Nikita (slow)
2015/04/15 18:35:42
Returning nullptr here wouldn't work as UserCloudP
| |
162 return ProfileHelper::GetSigninProfile()->GetRequestContext(); | |
163 | |
164 if (!signin_partition) | |
165 return nullptr; | |
166 | |
167 return signin_partition->GetURLRequestContext(); | |
168 } | |
158 | 169 |
159 return ProfileHelper::GetSigninProfile()->GetRequestContext(); | 170 return ProfileHelper::GetSigninProfile()->GetRequestContext(); |
160 } | 171 } |
161 | 172 |
162 } // namespace login | 173 } // namespace login |
163 | 174 |
164 } // namespace chromeos | 175 } // namespace chromeos |
OLD | NEW |