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 // This file contains helper functions used by Chromium OS login. | 5 // This file contains helper functions used by Chromium OS login. |
6 | 6 |
7 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ | 7 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ |
8 #define CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ | 8 #define CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ |
9 | 9 |
| 10 #include <string> |
| 11 |
10 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
11 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
12 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
13 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
14 | 16 |
15 class GURL; | 17 class GURL; |
16 | 18 |
17 namespace gfx { | 19 namespace gfx { |
18 class Rect; | 20 class Rect; |
19 class Size; | 21 class Size; |
(...skipping 10 matching lines...) Expand all Loading... |
30 int GetCurrentUserImageSize(); | 32 int GetCurrentUserImageSize(); |
31 | 33 |
32 // Define the constants in |login| namespace to avoid potential | 34 // Define the constants in |login| namespace to avoid potential |
33 // conflict with other chromeos components. | 35 // conflict with other chromeos components. |
34 namespace login { | 36 namespace login { |
35 | 37 |
36 // Maximum size of user image, in which it should be saved to be properly | 38 // Maximum size of user image, in which it should be saved to be properly |
37 // displayed under all possible DPI values. | 39 // displayed under all possible DPI values. |
38 const int kMaxUserImageSize = 512; | 40 const int kMaxUserImageSize = 512; |
39 | 41 |
| 42 // Canonicalizes a GAIA user ID, accounting for the legacy guest mode user ID |
| 43 // which does trips up gaia::CanonicalizeEmail() because it does not contain an |
| 44 // @ symbol. |
| 45 std::string CanonicalizeUserID(const std::string& user_id); |
| 46 |
40 // A helper class for easily mocking out Network*Handler calls for tests. | 47 // A helper class for easily mocking out Network*Handler calls for tests. |
41 class NetworkStateHelper { | 48 class NetworkStateHelper { |
42 public: | 49 public: |
43 NetworkStateHelper(); | 50 NetworkStateHelper(); |
44 virtual ~NetworkStateHelper(); | 51 virtual ~NetworkStateHelper(); |
45 | 52 |
46 // Returns name of the currently connected network. | 53 // Returns name of the currently connected network. |
47 // If there are no connected networks, returns name of the network | 54 // If there are no connected networks, returns name of the network |
48 // that is in the "connecting" state. Otherwise empty string is returned. | 55 // that is in the "connecting" state. Otherwise empty string is returned. |
49 // If there are multiple connected networks, network priority: | 56 // If there are multiple connected networks, network priority: |
50 // Ethernet > WiFi > Cellular. Same for connecting network. | 57 // Ethernet > WiFi > Cellular. Same for connecting network. |
51 virtual base::string16 GetCurrentNetworkName() const; | 58 virtual base::string16 GetCurrentNetworkName() const; |
52 | 59 |
53 // Returns true if the default network is in connected state. | 60 // Returns true if the default network is in connected state. |
54 virtual bool IsConnected() const; | 61 virtual bool IsConnected() const; |
55 | 62 |
56 // Returns true if the default network is in connecting state. | 63 // Returns true if the default network is in connecting state. |
57 virtual bool IsConnecting() const; | 64 virtual bool IsConnecting() const; |
58 | 65 |
59 private: | 66 private: |
60 DISALLOW_COPY_AND_ASSIGN(NetworkStateHelper); | 67 DISALLOW_COPY_AND_ASSIGN(NetworkStateHelper); |
61 }; | 68 }; |
62 | 69 |
63 } // namespace login | 70 } // namespace login |
64 | 71 |
65 } // namespace chromeos | 72 } // namespace chromeos |
66 | 73 |
67 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ | 74 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ |
OLD | NEW |