| 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 "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "third_party/skia/include/core/SkColor.h" | 12 #include "third_party/skia/include/core/SkColor.h" |
| 13 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 class Rect; | 18 class Rect; |
| 19 class Size; | 19 class Size; |
| 20 } // namespace gfx | 20 } // namespace gfx |
| 21 | 21 |
| 22 namespace chromeos { | 22 namespace chromeos { |
| 23 | 23 |
| 24 // Returns bounds of the screen to use for login wizard. | 24 // Returns bounds of the screen to use for login wizard. |
| 25 // The rect is centered within the default monitor and sized accordingly if | 25 // The rect is centered within the default monitor and sized accordingly if |
| 26 // |size| is not empty. Otherwise the whole monitor is occupied. | 26 // |size| is not empty. Otherwise the whole monitor is occupied. |
| 27 gfx::Rect CalculateScreenBounds(const gfx::Size& size); | 27 gfx::Rect CalculateScreenBounds(const gfx::Size& size); |
| 28 | 28 |
| 29 // Returns name of the currently connected network. | |
| 30 // If there are no connected networks, returns name of the network | |
| 31 // that is in the "connecting" state. Otherwise empty string is returned. | |
| 32 // If there are multiple connected networks, network priority: | |
| 33 // Ethernet > WiFi > Cellular. Same for connecting network. | |
| 34 string16 GetCurrentNetworkName(); | |
| 35 | |
| 36 // Returns the size of user image required for proper display under current DPI. | 29 // Returns the size of user image required for proper display under current DPI. |
| 37 int GetCurrentUserImageSize(); | 30 int GetCurrentUserImageSize(); |
| 38 | 31 |
| 39 // Define the constants in |login| namespace to avoid potential | 32 // Define the constants in |login| namespace to avoid potential |
| 40 // conflict with other chromeos components. | 33 // conflict with other chromeos components. |
| 41 namespace login { | 34 namespace login { |
| 42 | 35 |
| 43 // Maximum size of user image, in which it should be saved to be properly | 36 // Maximum size of user image, in which it should be saved to be properly |
| 44 // displayed under all possible DPI values. | 37 // displayed under all possible DPI values. |
| 45 const int kMaxUserImageSize = 512; | 38 const int kMaxUserImageSize = 512; |
| 46 | 39 |
| 40 // A helper class for easily mocking out Network*Handler calls for tests. |
| 41 class NetworkStateHelper { |
| 42 public: |
| 43 NetworkStateHelper(); |
| 44 virtual ~NetworkStateHelper(); |
| 45 |
| 46 // Returns name of the currently connected network. |
| 47 // If there are no connected networks, returns name of the network |
| 48 // that is in the "connecting" state. Otherwise empty string is returned. |
| 49 // If there are multiple connected networks, network priority: |
| 50 // Ethernet > WiFi > Cellular. Same for connecting network. |
| 51 virtual string16 GetCurrentNetworkName() const; |
| 52 |
| 53 // Returns true if the default network is in connected state. |
| 54 virtual bool IsConnected() const; |
| 55 |
| 56 // Returns true if the default network is in connecting state. |
| 57 virtual bool IsConnecting() const; |
| 58 |
| 59 private: |
| 60 DISALLOW_COPY_AND_ASSIGN(NetworkStateHelper); |
| 61 }; |
| 62 |
| 47 } // namespace login | 63 } // namespace login |
| 48 | 64 |
| 49 } // namespace chromeos | 65 } // namespace chromeos |
| 50 | 66 |
| 51 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ | 67 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ |
| OLD | NEW |