| 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 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // Per-tab one-click signin helper. When a user signs in to a Google service | 21 // 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 | 22 // 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 | 23 // 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 | 24 // begins with an infobar and is followed with a confirmation dialog explaining |
| 25 // more about what this means. | 25 // more about what this means. |
| 26 class OneClickSigninHelper : public content::WebContentsObserver { | 26 class OneClickSigninHelper : public content::WebContentsObserver { |
| 27 public: | 27 public: |
| 28 // Returns true if the one-click signin feature can be offered at this time. | 28 // 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 | 29 // 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 | 30 // |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 | 31 // already connected to a google account or if the user has already rejected |
| 32 // one-click sign-in with this email, in which cases a one click signin |
| 32 // should not be offered. | 33 // should not be offered. |
| 33 static bool CanOffer(content::WebContents* web_contents, | 34 static bool CanOffer(content::WebContents* web_contents, |
| 35 const std::string& email, |
| 34 bool check_connected); | 36 bool check_connected); |
| 35 | 37 |
| 36 // Looks for the Google-Accounts-SignIn response header, and if found, | 38 // Looks for the Google-Accounts-SignIn response header, and if found, |
| 37 // tries to display an infobar in the tab contents identified by the | 39 // tries to display an infobar in the tab contents identified by the |
| 38 // child/route id. | 40 // child/route id. |
| 39 static void ShowInfoBarIfPossible(net::URLRequest* request, | 41 static void ShowInfoBarIfPossible(net::URLRequest* request, |
| 40 int child_id, | 42 int child_id, |
| 41 int route_id); | 43 int route_id); |
| 42 | 44 |
| 43 explicit OneClickSigninHelper(content::WebContents* web_contents); | 45 explicit OneClickSigninHelper(content::WebContents* web_contents); |
| (...skipping 21 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 |