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" | 12 #include "chrome/browser/chromeos/login/startup_utils.h" |
13 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 13 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
14 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 14 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
15 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 15 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
16 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
17 #include "chromeos/chromeos_switches.h" | 17 #include "chromeos/chromeos_switches.h" |
18 #include "chromeos/network/managed_network_configuration_handler.h" | 18 #include "chromeos/network/managed_network_configuration_handler.h" |
19 #include "chromeos/network/network_connection_handler.h" | 19 #include "chromeos/network/network_connection_handler.h" |
20 #include "chromeos/network/network_handler.h" | 20 #include "chromeos/network/network_handler.h" |
21 #include "chromeos/network/network_state.h" | 21 #include "chromeos/network/network_state.h" |
22 #include "chromeos/network/network_state_handler.h" | 22 #include "chromeos/network/network_state_handler.h" |
23 #include "chromeos/network/network_util.h" | 23 #include "chromeos/network/network_util.h" |
24 #include "components/guest_view/browser/guest_view_manager.h" | 24 #include "components/guest_view/browser/guest_view_manager.h" |
25 #include "content/public/browser/storage_partition.h" | 25 #include "content/public/browser/storage_partition.h" |
26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
27 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | 27 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
28 #include "third_party/cros_system_api/dbus/service_constants.h" | 28 #include "third_party/cros_system_api/dbus/service_constants.h" |
29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
30 #include "ui/gfx/image/image_skia.h" | 30 #include "ui/gfx/image/image_skia.h" |
31 #include "ui/gfx/screen.h" | 31 #include "ui/gfx/screen.h" |
32 | 32 |
33 namespace chromeos { | 33 namespace chromeos { |
34 | 34 |
35 namespace { | 35 namespace { |
36 | 36 |
37 // Gets the WebContents instance of current login display. If there is none, | 37 // Gets the WebContents instance of current login display. If there is none, |
38 // returns nullptr. | 38 // returns nullptr. |
39 content::WebContents* GetLoginWebContents() { | 39 content::WebContents* GetLoginWebContents() { |
40 LoginDisplayHost* host = LoginDisplayHostImpl::default_host(); | 40 LoginDisplayHost* host = LoginDisplayHost::default_host(); |
41 if (!host || !host->GetWebUILoginView()) | 41 if (!host || !host->GetWebUILoginView()) |
42 return nullptr; | 42 return nullptr; |
43 | 43 |
44 return host->GetWebUILoginView()->GetWebContents(); | 44 return host->GetWebUILoginView()->GetWebContents(); |
45 } | 45 } |
46 | 46 |
47 // Callback used by GetPartition below to return the first guest contents with a | 47 // Callback used by GetPartition below to return the first guest contents with a |
48 // matching partition name. | 48 // matching partition name. |
49 bool FindGuestByPartitionName(const std::string& partition_name, | 49 bool FindGuestByPartitionName(const std::string& partition_name, |
50 content::WebContents** out_guest_contents, | 50 content::WebContents** out_guest_contents, |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 return GetPartition(embedder, std::string()); | 228 return GetPartition(embedder, std::string()); |
229 } | 229 } |
230 | 230 |
231 net::URLRequestContextGetter* GetSigninContext() { | 231 net::URLRequestContextGetter* GetSigninContext() { |
232 if (StartupUtils::IsWebviewSigninEnabled()) { | 232 if (StartupUtils::IsWebviewSigninEnabled()) { |
233 content::StoragePartition* signin_partition = GetSigninPartition(); | 233 content::StoragePartition* signin_partition = GetSigninPartition(); |
234 | 234 |
235 // Special case for unit tests. There's no LoginDisplayHost thus no | 235 // Special case for unit tests. There's no LoginDisplayHost thus no |
236 // webview instance. TODO(nkostylev): Investigate if there's a better | 236 // webview instance. TODO(nkostylev): Investigate if there's a better |
237 // place to address this like dependency injection. http://crbug.com/477402 | 237 // place to address this like dependency injection. http://crbug.com/477402 |
238 if (!signin_partition && !LoginDisplayHostImpl::default_host()) | 238 if (!signin_partition && !LoginDisplayHost::default_host()) |
239 return ProfileHelper::GetSigninProfile()->GetRequestContext(); | 239 return ProfileHelper::GetSigninProfile()->GetRequestContext(); |
240 | 240 |
241 if (!signin_partition) | 241 if (!signin_partition) |
242 return nullptr; | 242 return nullptr; |
243 | 243 |
244 return signin_partition->GetURLRequestContext(); | 244 return signin_partition->GetURLRequestContext(); |
245 } | 245 } |
246 | 246 |
247 return ProfileHelper::GetSigninProfile()->GetRequestContext(); | 247 return ProfileHelper::GetSigninProfile()->GetRequestContext(); |
248 } | 248 } |
249 | 249 |
250 } // namespace login | 250 } // namespace login |
251 | 251 |
252 } // namespace chromeos | 252 } // namespace chromeos |
OLD | NEW |