| 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.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/display/screen.h" |
| 30 #include "ui/gfx/image/image_skia.h" | 31 #include "ui/gfx/image/image_skia.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 = LoginDisplayHost::default_host(); | 40 LoginDisplayHost* host = LoginDisplayHost::default_host(); |
| 41 if (!host || !host->GetWebUILoginView()) | 41 if (!host || !host->GetWebUILoginView()) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 return guest_contents ? content::BrowserContext::GetStoragePartition( | 81 return guest_contents ? content::BrowserContext::GetStoragePartition( |
| 82 guest_contents->GetBrowserContext(), | 82 guest_contents->GetBrowserContext(), |
| 83 guest_contents->GetSiteInstance()) | 83 guest_contents->GetSiteInstance()) |
| 84 : nullptr; | 84 : nullptr; |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace | 87 } // namespace |
| 88 | 88 |
| 89 gfx::Rect CalculateScreenBounds(const gfx::Size& size) { | 89 gfx::Rect CalculateScreenBounds(const gfx::Size& size) { |
| 90 gfx::Rect bounds = gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds(); | 90 gfx::Rect bounds = display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); |
| 91 if (!size.IsEmpty()) { | 91 if (!size.IsEmpty()) { |
| 92 int horizontal_diff = bounds.width() - size.width(); | 92 int horizontal_diff = bounds.width() - size.width(); |
| 93 int vertical_diff = bounds.height() - size.height(); | 93 int vertical_diff = bounds.height() - size.height(); |
| 94 bounds.Inset(horizontal_diff / 2, vertical_diff / 2); | 94 bounds.Inset(horizontal_diff / 2, vertical_diff / 2); |
| 95 } | 95 } |
| 96 return bounds; | 96 return bounds; |
| 97 } | 97 } |
| 98 | 98 |
| 99 int GetCurrentUserImageSize() { | 99 int GetCurrentUserImageSize() { |
| 100 // The biggest size that the profile picture is displayed at is currently | 100 // The biggest size that the profile picture is displayed at is currently |
| 101 // 220px, used for the big preview on OOBE and Change Picture options page. | 101 // 220px, used for the big preview on OOBE and Change Picture options page. |
| 102 static const int kBaseUserImageSize = 220; | 102 static const int kBaseUserImageSize = 220; |
| 103 float scale_factor = gfx::Display::GetForcedDeviceScaleFactor(); | 103 float scale_factor = display::Display::GetForcedDeviceScaleFactor(); |
| 104 if (scale_factor > 1.0f) | 104 if (scale_factor > 1.0f) |
| 105 return static_cast<int>(scale_factor * kBaseUserImageSize); | 105 return static_cast<int>(scale_factor * kBaseUserImageSize); |
| 106 return kBaseUserImageSize * gfx::ImageSkia::GetMaxSupportedScale(); | 106 return kBaseUserImageSize * gfx::ImageSkia::GetMaxSupportedScale(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 namespace login { | 109 namespace login { |
| 110 | 110 |
| 111 NetworkStateHelper::NetworkStateHelper() {} | 111 NetworkStateHelper::NetworkStateHelper() {} |
| 112 NetworkStateHelper::~NetworkStateHelper() {} | 112 NetworkStateHelper::~NetworkStateHelper() {} |
| 113 | 113 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 return signin_partition->GetURLRequestContext(); | 245 return signin_partition->GetURLRequestContext(); |
| 246 } | 246 } |
| 247 | 247 |
| 248 return ProfileHelper::GetSigninProfile()->GetRequestContext(); | 248 return ProfileHelper::GetSigninProfile()->GetRequestContext(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 } // namespace login | 251 } // namespace login |
| 252 | 252 |
| 253 } // namespace chromeos | 253 } // namespace chromeos |
| OLD | NEW |