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 #ifndef CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ |
6 #define CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ | 6 #define CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 class WebContents; | 13 class WebContents; |
14 } | 14 } |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 class URLRequest; | 17 class URLRequest; |
18 } | 18 } |
19 | 19 |
20 // Per-tab one-click signin helper. When a user signs in to a Google service | 20 // Per-tab one-click signin helper. When a user signs in to a Google service |
21 // and the profile is not yet connected to a Google account, will start the | 21 // and the profile is not yet connected to a Google account, will start the |
22 // process of helping the user connect his profile with one click. The process | 22 // process of helping the user connect his profile with one click. The process |
23 // begins with an infobar and is followed with a confirmation dialog explaining | 23 // begins with an infobar and is followed with a confirmation dialog explaining |
24 // more about what this means. | 24 // more about what this means. |
25 class OneClickSigninHelper : public content::WebContentsObserver { | 25 class OneClickSigninHelper : public content::WebContentsObserver { |
26 public: | 26 public: |
27 // Returns true if the one-click signin feature can be offered at this time. | 27 // Returns true if the one-click signin feature can be offered at this time. |
28 // It can be offered if the contents is not in an incognito window. If | 28 // It can be offered if the contents is not in an incognito window. If |
29 // |check_connected| is true, then the profile is checked to see if it's | 29 // |check_connected| is true, then the profile is checked to see if it's |
30 // already connected to a google account, in which case a one click signin | 30 // already connected to a google account or if the user has already rejected |
| 31 // one-click sign-in with this email, in which cases a one click signin |
31 // should not be offered. | 32 // should not be offered. |
32 static bool CanOffer(content::WebContents* web_contents, | 33 static bool CanOffer(content::WebContents* web_contents, |
| 34 const std::string& email, |
33 bool check_connected); | 35 bool check_connected); |
34 | 36 |
35 // Looks for the Google-Accounts-SignIn response header, and if found, | 37 // Looks for the Google-Accounts-SignIn response header, and if found, |
36 // tries to display an infobar in the tab contents identified by the | 38 // tries to display an infobar in the tab contents identified by the |
37 // child/route id. | 39 // child/route id. |
38 static void ShowInfoBarIfPossible(net::URLRequest* request, | 40 static void ShowInfoBarIfPossible(net::URLRequest* request, |
39 int child_id, | 41 int child_id, |
40 int route_id); | 42 int route_id); |
41 | 43 |
42 explicit OneClickSigninHelper(content::WebContents* web_contents); | 44 explicit OneClickSigninHelper(content::WebContents* web_contents); |
(...skipping 22 matching lines...) Expand all Loading... |
65 | 67 |
66 // Information about the account that has just logged in. | 68 // Information about the account that has just logged in. |
67 std::string session_index_; | 69 std::string session_index_; |
68 std::string email_; | 70 std::string email_; |
69 std::string password_; | 71 std::string password_; |
70 | 72 |
71 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); | 73 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); |
72 }; | 74 }; |
73 | 75 |
74 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ | 76 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ |
OLD | NEW |