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 content::StoragePartition* signin_partition = GetSigninPartition(); | 157 return GetSigninPartition()->GetURLRequestContext(); |
158 | |
159 // Special case for unit tests. There's no LoginDisplayHost thus no | |
160 // webview instance. TODO(nkostylev): Investigate if there's a better | |
161 // place to address this like dependency injection. http://crbug.com/477402 | |
162 if (!signin_partition && !LoginDisplayHostImpl::default_host()) | |
163 return ProfileHelper::GetSigninProfile()->GetRequestContext(); | |
164 | |
165 if (!signin_partition) | |
166 return nullptr; | |
167 | |
168 return signin_partition->GetURLRequestContext(); | |
169 } | |
170 | 158 |
171 return ProfileHelper::GetSigninProfile()->GetRequestContext(); | 159 return ProfileHelper::GetSigninProfile()->GetRequestContext(); |
172 } | 160 } |
173 | 161 |
174 } // namespace login | 162 } // namespace login |
175 | 163 |
176 } // namespace chromeos | 164 } // namespace chromeos |
OLD | NEW |