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 "ash/shell.h" | 7 #include "ash/shell.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/users/user_manager.h" | 10 #include "chrome/browser/chromeos/login/users/user_manager.h" |
11 #include "chromeos/chromeos_switches.h" | 11 #include "chromeos/chromeos_switches.h" |
12 #include "chromeos/network/network_handler.h" | 12 #include "chromeos/network/network_handler.h" |
13 #include "chromeos/network/network_state.h" | 13 #include "chromeos/network/network_state.h" |
14 #include "chromeos/network/network_state_handler.h" | 14 #include "chromeos/network/network_state_handler.h" |
15 #include "google_apis/gaia/gaia_auth_util.h" | |
16 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
17 #include "grit/theme_resources.h" | 16 #include "grit/theme_resources.h" |
18 #include "third_party/cros_system_api/dbus/service_constants.h" | 17 #include "third_party/cros_system_api/dbus/service_constants.h" |
19 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
20 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
21 #include "ui/gfx/image/image_skia.h" | 20 #include "ui/gfx/image/image_skia.h" |
22 #include "ui/gfx/screen.h" | 21 #include "ui/gfx/screen.h" |
23 | 22 |
24 namespace chromeos { | 23 namespace chromeos { |
25 | 24 |
(...skipping 12 matching lines...) Expand all Loading... |
38 // 220px, used for the big preview on OOBE and Change Picture options page. | 37 // 220px, used for the big preview on OOBE and Change Picture options page. |
39 static const int kBaseUserImageSize = 220; | 38 static const int kBaseUserImageSize = 220; |
40 float scale_factor = gfx::Display::GetForcedDeviceScaleFactor(); | 39 float scale_factor = gfx::Display::GetForcedDeviceScaleFactor(); |
41 if (scale_factor > 1.0f) | 40 if (scale_factor > 1.0f) |
42 return static_cast<int>(scale_factor * kBaseUserImageSize); | 41 return static_cast<int>(scale_factor * kBaseUserImageSize); |
43 return kBaseUserImageSize * gfx::ImageSkia::GetMaxSupportedScale(); | 42 return kBaseUserImageSize * gfx::ImageSkia::GetMaxSupportedScale(); |
44 } | 43 } |
45 | 44 |
46 namespace login { | 45 namespace login { |
47 | 46 |
48 std::string CanonicalizeUserID(const std::string& user_id) { | |
49 if (user_id == UserManager::kGuestUserName) | |
50 return user_id; | |
51 return gaia::CanonicalizeEmail(user_id); | |
52 } | |
53 | |
54 bool LoginScrollIntoViewEnabled() { | 47 bool LoginScrollIntoViewEnabled() { |
55 return !CommandLine::ForCurrentProcess()->HasSwitch( | 48 return !CommandLine::ForCurrentProcess()->HasSwitch( |
56 chromeos::switches::kDisableLoginScrollIntoView); | 49 chromeos::switches::kDisableLoginScrollIntoView); |
57 } | 50 } |
58 | 51 |
59 NetworkStateHelper::NetworkStateHelper() {} | 52 NetworkStateHelper::NetworkStateHelper() {} |
60 NetworkStateHelper::~NetworkStateHelper() {} | 53 NetworkStateHelper::~NetworkStateHelper() {} |
61 | 54 |
62 base::string16 NetworkStateHelper::GetCurrentNetworkName() const { | 55 base::string16 NetworkStateHelper::GetCurrentNetworkName() const { |
63 NetworkStateHandler* nsh = NetworkHandler::Get()->network_state_handler(); | 56 NetworkStateHandler* nsh = NetworkHandler::Get()->network_state_handler(); |
(...skipping 24 matching lines...) Expand all Loading... |
88 bool NetworkStateHelper::IsConnecting() const { | 81 bool NetworkStateHelper::IsConnecting() const { |
89 chromeos::NetworkStateHandler* nsh = | 82 chromeos::NetworkStateHandler* nsh = |
90 chromeos::NetworkHandler::Get()->network_state_handler(); | 83 chromeos::NetworkHandler::Get()->network_state_handler(); |
91 return nsh->ConnectingNetworkByType( | 84 return nsh->ConnectingNetworkByType( |
92 chromeos::NetworkTypePattern::Default()) != NULL; | 85 chromeos::NetworkTypePattern::Default()) != NULL; |
93 } | 86 } |
94 | 87 |
95 } // namespace login | 88 } // namespace login |
96 | 89 |
97 } // namespace chromeos | 90 } // namespace chromeos |
OLD | NEW |