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/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/chromeos/login/users/user_manager.h" |
9 #include "chromeos/network/network_handler.h" | 10 #include "chromeos/network/network_handler.h" |
10 #include "chromeos/network/network_state.h" | 11 #include "chromeos/network/network_state.h" |
11 #include "chromeos/network/network_state_handler.h" | 12 #include "chromeos/network/network_state_handler.h" |
12 #include "chromeos/network/shill_property_util.h" | 13 #include "chromeos/network/shill_property_util.h" |
| 14 #include "google_apis/gaia/gaia_auth_util.h" |
13 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
14 #include "grit/theme_resources.h" | 16 #include "grit/theme_resources.h" |
15 #include "third_party/cros_system_api/dbus/service_constants.h" | 17 #include "third_party/cros_system_api/dbus/service_constants.h" |
16 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
17 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
18 #include "ui/gfx/image/image_skia.h" | 20 #include "ui/gfx/image/image_skia.h" |
19 #include "ui/gfx/screen.h" | 21 #include "ui/gfx/screen.h" |
20 | 22 |
21 namespace chromeos { | 23 namespace chromeos { |
22 | 24 |
(...skipping 12 matching lines...) Expand all Loading... |
35 // 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. |
36 static const int kBaseUserImageSize = 220; | 38 static const int kBaseUserImageSize = 220; |
37 float scale_factor = gfx::Display::GetForcedDeviceScaleFactor(); | 39 float scale_factor = gfx::Display::GetForcedDeviceScaleFactor(); |
38 if (scale_factor > 1.0f) | 40 if (scale_factor > 1.0f) |
39 return static_cast<int>(scale_factor * kBaseUserImageSize); | 41 return static_cast<int>(scale_factor * kBaseUserImageSize); |
40 return kBaseUserImageSize * gfx::ImageSkia::GetMaxSupportedScale(); | 42 return kBaseUserImageSize * gfx::ImageSkia::GetMaxSupportedScale(); |
41 } | 43 } |
42 | 44 |
43 namespace login { | 45 namespace login { |
44 | 46 |
| 47 std::string CanonicalizeUserID(const std::string& user_id) { |
| 48 if (user_id == UserManager::kGuestUserName) |
| 49 return user_id; |
| 50 return gaia::CanonicalizeEmail(user_id); |
| 51 } |
| 52 |
45 NetworkStateHelper::NetworkStateHelper() {} | 53 NetworkStateHelper::NetworkStateHelper() {} |
46 NetworkStateHelper::~NetworkStateHelper() {} | 54 NetworkStateHelper::~NetworkStateHelper() {} |
47 | 55 |
48 base::string16 NetworkStateHelper::GetCurrentNetworkName() const { | 56 base::string16 NetworkStateHelper::GetCurrentNetworkName() const { |
49 NetworkStateHandler* nsh = NetworkHandler::Get()->network_state_handler(); | 57 NetworkStateHandler* nsh = NetworkHandler::Get()->network_state_handler(); |
50 const NetworkState* network = | 58 const NetworkState* network = |
51 nsh->ConnectedNetworkByType(NetworkTypePattern::NonVirtual()); | 59 nsh->ConnectedNetworkByType(NetworkTypePattern::NonVirtual()); |
52 if (network) { | 60 if (network) { |
53 if (network->Matches(NetworkTypePattern::Ethernet())) | 61 if (network->Matches(NetworkTypePattern::Ethernet())) |
54 return l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET); | 62 return l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET); |
(...skipping 19 matching lines...) Expand all Loading... |
74 bool NetworkStateHelper::IsConnecting() const { | 82 bool NetworkStateHelper::IsConnecting() const { |
75 chromeos::NetworkStateHandler* nsh = | 83 chromeos::NetworkStateHandler* nsh = |
76 chromeos::NetworkHandler::Get()->network_state_handler(); | 84 chromeos::NetworkHandler::Get()->network_state_handler(); |
77 return nsh->ConnectingNetworkByType( | 85 return nsh->ConnectingNetworkByType( |
78 chromeos::NetworkTypePattern::Default()) != NULL; | 86 chromeos::NetworkTypePattern::Default()) != NULL; |
79 } | 87 } |
80 | 88 |
81 } // namespace login | 89 } // namespace login |
82 | 90 |
83 } // namespace chromeos | 91 } // namespace chromeos |
OLD | NEW |