| 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/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/chromeos/login/startup_utils.h" | |
| 13 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 12 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 14 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 13 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
| 15 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 14 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 16 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 17 #include "chromeos/chromeos_switches.h" | 16 #include "chromeos/chromeos_switches.h" |
| 18 #include "chromeos/network/managed_network_configuration_handler.h" | 17 #include "chromeos/network/managed_network_configuration_handler.h" |
| 19 #include "chromeos/network/network_connection_handler.h" | 18 #include "chromeos/network/network_connection_handler.h" |
| 20 #include "chromeos/network/network_handler.h" | 19 #include "chromeos/network/network_handler.h" |
| 21 #include "chromeos/network/network_state.h" | 20 #include "chromeos/network/network_state.h" |
| 22 #include "chromeos/network/network_state_handler.h" | 21 #include "chromeos/network/network_state_handler.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 content::WebContents* embedder = GetLoginWebContents(); | 223 content::WebContents* embedder = GetLoginWebContents(); |
| 225 if (!embedder) | 224 if (!embedder) |
| 226 return nullptr; | 225 return nullptr; |
| 227 | 226 |
| 228 // Note the partition name must match the sign-in webview used. For now, | 227 // Note the partition name must match the sign-in webview used. For now, |
| 229 // this is the default unnamed, shared, in-memory partition. | 228 // this is the default unnamed, shared, in-memory partition. |
| 230 return GetPartition(embedder, std::string()); | 229 return GetPartition(embedder, std::string()); |
| 231 } | 230 } |
| 232 | 231 |
| 233 net::URLRequestContextGetter* GetSigninContext() { | 232 net::URLRequestContextGetter* GetSigninContext() { |
| 234 if (StartupUtils::IsWebviewSigninEnabled()) { | 233 content::StoragePartition* signin_partition = GetSigninPartition(); |
| 235 content::StoragePartition* signin_partition = GetSigninPartition(); | |
| 236 | 234 |
| 237 // Special case for unit tests. There's no LoginDisplayHost thus no | 235 // Special case for unit tests. There's no LoginDisplayHost thus no |
| 238 // webview instance. TODO(nkostylev): Investigate if there's a better | 236 // webview instance. See http://crbug.com/477402 |
| 239 // place to address this like dependency injection. http://crbug.com/477402 | 237 if (!signin_partition && !LoginDisplayHost::default_host()) |
| 240 if (!signin_partition && !LoginDisplayHost::default_host()) | 238 return ProfileHelper::GetSigninProfile()->GetRequestContext(); |
| 241 return ProfileHelper::GetSigninProfile()->GetRequestContext(); | |
| 242 | 239 |
| 243 if (!signin_partition) | 240 if (!signin_partition) |
| 244 return nullptr; | 241 return nullptr; |
| 245 | 242 |
| 246 return signin_partition->GetURLRequestContext(); | 243 return signin_partition->GetURLRequestContext(); |
| 247 } | |
| 248 | |
| 249 return ProfileHelper::GetSigninProfile()->GetRequestContext(); | |
| 250 } | 244 } |
| 251 | 245 |
| 252 } // namespace login | 246 } // namespace login |
| 253 | 247 |
| 254 } // namespace chromeos | 248 } // namespace chromeos |
| OLD | NEW |