| 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 "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 // Argument to CanOffer(). | 68 // Argument to CanOffer(). |
| 69 enum CanOfferFor { | 69 enum CanOfferFor { |
| 70 CAN_OFFER_FOR_ALL, | 70 CAN_OFFER_FOR_ALL, |
| 71 CAN_OFFER_FOR_INTERSTITAL_ONLY | 71 CAN_OFFER_FOR_INTERSTITAL_ONLY |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 virtual ~OneClickSigninHelper(); | 74 virtual ~OneClickSigninHelper(); |
| 75 | 75 |
| 76 // Called only by tests to associate information with a given request. | |
| 77 static void AssociateWithRequestForTesting(base::SupportsUserData* request, | |
| 78 const std::string& email); | |
| 79 | |
| 80 // Returns true if the one-click signin feature can be offered at this time. | 76 // Returns true if the one-click signin feature can be offered at this time. |
| 81 // If |email| is not empty, then the profile is checked to see if it's | 77 // If |email| is not empty, then the profile is checked to see if it's |
| 82 // already connected to a google account or if the user has already rejected | 78 // already connected to a google account or if the user has already rejected |
| 83 // one-click sign-in with this email, in which cases a one click signin | 79 // one-click sign-in with this email, in which cases a one click signin |
| 84 // should not be offered. | 80 // should not be offered. |
| 85 // | 81 // |
| 86 // If |can_offer_for| is |CAN_OFFER_FOR_INTERSTITAL_ONLY|, then only do the | 82 // If |can_offer_for| is |CAN_OFFER_FOR_INTERSTITAL_ONLY|, then only do the |
| 87 // checks that would affect the interstitial page. Otherwise, do the checks | 83 // checks that would affect the interstitial page. Otherwise, do the checks |
| 88 // that would affect the interstitial and the explicit sign ins. | 84 // that would affect the interstitial and the explicit sign ins. |
| 89 // | 85 // |
| (...skipping 13 matching lines...) Expand all Loading... |
| 103 static Offer CanOfferOnIOThread(net::URLRequest* request, | 99 static Offer CanOfferOnIOThread(net::URLRequest* request, |
| 104 ProfileIOData* io_data); | 100 ProfileIOData* io_data); |
| 105 | 101 |
| 106 // Initialize a finch experiment for the infobar. | 102 // Initialize a finch experiment for the infobar. |
| 107 static void InitializeFieldTrial(); | 103 static void InitializeFieldTrial(); |
| 108 | 104 |
| 109 // Looks for the Google-Accounts-SignIn response header, and if found, | 105 // Looks for the Google-Accounts-SignIn response header, and if found, |
| 110 // tries to display an infobar in the tab contents identified by the | 106 // tries to display an infobar in the tab contents identified by the |
| 111 // child/route id. | 107 // child/route id. |
| 112 static void ShowInfoBarIfPossible(net::URLRequest* request, | 108 static void ShowInfoBarIfPossible(net::URLRequest* request, |
| 109 ProfileIOData* io_data, |
| 113 int child_id, | 110 int child_id, |
| 114 int route_id); | 111 int route_id); |
| 115 | 112 |
| 116 private: | 113 private: |
| 117 explicit OneClickSigninHelper(content::WebContents* web_contents); | 114 explicit OneClickSigninHelper(content::WebContents* web_contents); |
| 118 friend class content::WebContentsUserData<OneClickSigninHelper>; | 115 friend class content::WebContentsUserData<OneClickSigninHelper>; |
| 119 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperTest, | 116 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperTest, |
| 120 ShowInfoBarUIThreadIncognito); | 117 ShowInfoBarUIThreadIncognito); |
| 121 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, CanOfferOnIOThread); | 118 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, CanOfferOnIOThread); |
| 122 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | 119 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 SyncPromoUI::Source source_; | 194 SyncPromoUI::Source source_; |
| 198 GURL continue_url_; | 195 GURL continue_url_; |
| 199 std::string error_message_; | 196 std::string error_message_; |
| 200 | 197 |
| 201 scoped_ptr<SigninTracker> signin_tracker_; | 198 scoped_ptr<SigninTracker> signin_tracker_; |
| 202 | 199 |
| 203 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); | 200 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); |
| 204 }; | 201 }; |
| 205 | 202 |
| 206 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ | 203 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ |
| OLD | NEW |