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