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> | 10 #include <string> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
15 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
16 | 16 |
17 class GURL; | 17 class GURL; |
18 | 18 |
19 namespace gfx { | 19 namespace gfx { |
20 class Rect; | 20 class Rect; |
21 class Size; | 21 class Size; |
22 } // namespace gfx | 22 } // namespace gfx |
23 | 23 |
| 24 namespace content { |
| 25 class StoragePartition; |
| 26 } |
| 27 |
| 28 namespace net { |
| 29 class URLRequestContextGetter; |
| 30 } |
| 31 |
24 namespace chromeos { | 32 namespace chromeos { |
25 | 33 |
26 // Returns bounds of the screen to use for login wizard. | 34 // Returns bounds of the screen to use for login wizard. |
27 // The rect is centered within the default monitor and sized accordingly if | 35 // The rect is centered within the default monitor and sized accordingly if |
28 // |size| is not empty. Otherwise the whole monitor is occupied. | 36 // |size| is not empty. Otherwise the whole monitor is occupied. |
29 gfx::Rect CalculateScreenBounds(const gfx::Size& size); | 37 gfx::Rect CalculateScreenBounds(const gfx::Size& size); |
30 | 38 |
31 // Returns the size of user image required for proper display under current DPI. | 39 // Returns the size of user image required for proper display under current DPI. |
32 int GetCurrentUserImageSize(); | 40 int GetCurrentUserImageSize(); |
33 | 41 |
(...skipping 25 matching lines...) Expand all Loading... |
59 // Returns true if the default network is in connected state. | 67 // Returns true if the default network is in connected state. |
60 virtual bool IsConnected() const; | 68 virtual bool IsConnected() const; |
61 | 69 |
62 // Returns true if the default network is in connecting state. | 70 // Returns true if the default network is in connecting state. |
63 virtual bool IsConnecting() const; | 71 virtual bool IsConnecting() const; |
64 | 72 |
65 private: | 73 private: |
66 DISALLOW_COPY_AND_ASSIGN(NetworkStateHelper); | 74 DISALLOW_COPY_AND_ASSIGN(NetworkStateHelper); |
67 }; | 75 }; |
68 | 76 |
| 77 // |
| 78 // Webview based login helpers. |
| 79 // |
| 80 |
| 81 // Returns the storage partition for the sign-in webview. Note the function gets |
| 82 // the partition via the sign-in WebContents thus returns nullptr if the sign-in |
| 83 // webui is torn down. |
| 84 content::StoragePartition* GetSigninPartition(); |
| 85 |
| 86 // Returns the request context that contains sign-in cookies. For old iframe |
| 87 // based flow, the context of the sign-in profile is returned. For webview based |
| 88 // flow, the context of the sign-in webview storage partition is returned. |
| 89 net::URLRequestContextGetter* GetSigninContext(); |
| 90 |
69 } // namespace login | 91 } // namespace login |
70 | 92 |
71 } // namespace chromeos | 93 } // namespace chromeos |
72 | 94 |
73 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ | 95 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ |
OLD | NEW |