| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 ProfileIOData* io_data); | 116 ProfileIOData* io_data); |
| 117 | 117 |
| 118 // Looks for the Google-Accounts-SignIn response header, and if found, | 118 // Looks for the Google-Accounts-SignIn response header, and if found, |
| 119 // tries to display an infobar in the tab contents identified by the | 119 // tries to display an infobar in the tab contents identified by the |
| 120 // child/route id. | 120 // child/route id. |
| 121 static void ShowInfoBarIfPossible(net::URLRequest* request, | 121 static void ShowInfoBarIfPossible(net::URLRequest* request, |
| 122 ProfileIOData* io_data, | 122 ProfileIOData* io_data, |
| 123 int child_id, | 123 int child_id, |
| 124 int route_id); | 124 int route_id); |
| 125 | 125 |
| 126 // Handles cross account sign in error. If the supplied |email| does not match |
| 127 // the last signed in email of the current profile, then Chrome will show a |
| 128 // confirmation dialog before starting sync. It returns true if there is a |
| 129 // cross ccount error, and false otherwise. |
| 130 static bool HandleCrossAccountError( |
| 131 content::WebContents* contents, |
| 132 const std::string& session_index, |
| 133 const std::string& email, |
| 134 const std::string& password, |
| 135 const std::string& oauth_code, |
| 136 OneClickSigninHelper::AutoAccept auto_accept, |
| 137 signin::Source source, |
| 138 OneClickSigninSyncStarter::StartSyncMode start_mode, |
| 139 OneClickSigninSyncStarter::Callback sync_callback); |
| 140 |
| 126 // If the |source| is not settings page/webstore, redirects to | 141 // If the |source| is not settings page/webstore, redirects to |
| 127 // the NTP/Apps page. | 142 // the NTP/Apps page. |
| 128 static void RedirectToNtpOrAppsPageIfNecessary( | 143 static void RedirectToNtpOrAppsPageIfNecessary( |
| 129 content::WebContents* contents, signin::Source source); | 144 content::WebContents* contents, signin::Source source); |
| 130 | 145 |
| 131 static void ShowSigninErrorBubble(Browser* browser, const std::string& error); | 146 static void ShowSigninErrorBubble(Browser* browser, const std::string& error); |
| 132 | 147 |
| 133 // Remove the item currently at the top of the history list if it's | 148 // Remove the item currently at the top of the history list if it's |
| 134 // the Gaia redirect URL. Due to limitations of the NavigationController | 149 // the Gaia redirect URL. Due to limitations of the NavigationController |
| 135 // this cannot be done until a new page becomes "current". | 150 // this cannot be done until a new page becomes "current". |
| (...skipping 18 matching lines...) Expand all Loading... |
| 154 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperTest, | 169 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperTest, |
| 155 RemoveObserverFromProfileSyncService); | 170 RemoveObserverFromProfileSyncService); |
| 156 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, CanOfferOnIOThread); | 171 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, CanOfferOnIOThread); |
| 157 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | 172 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, |
| 158 CanOfferOnIOThreadIncognito); | 173 CanOfferOnIOThreadIncognito); |
| 159 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | 174 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, |
| 160 CanOfferOnIOThreadNoIOData); | 175 CanOfferOnIOThreadNoIOData); |
| 161 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | 176 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, |
| 162 CanOfferOnIOThreadBadURL); | 177 CanOfferOnIOThreadBadURL); |
| 163 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | 178 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, |
| 164 CanOfferOnIOThreadReferrer); | |
| 165 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | |
| 166 CanOfferOnIOThreadDisabled); | 179 CanOfferOnIOThreadDisabled); |
| 167 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | 180 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, |
| 168 CanOfferOnIOThreadSignedIn); | 181 CanOfferOnIOThreadSignedIn); |
| 169 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | 182 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, |
| 170 CanOfferOnIOThreadEmailNotAllowed); | 183 CanOfferOnIOThreadEmailNotAllowed); |
| 171 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | 184 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, |
| 172 CanOfferOnIOThreadEmailAlreadyUsed); | 185 CanOfferOnIOThreadEmailAlreadyUsed); |
| 173 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | 186 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, |
| 174 CreateTestProfileIOData); | 187 CreateTestProfileIOData); |
| 175 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | 188 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 187 OneClickSigninHelper(content::WebContents* web_contents, | 200 OneClickSigninHelper(content::WebContents* web_contents, |
| 188 PasswordManager* password_manager); | 201 PasswordManager* password_manager); |
| 189 | 202 |
| 190 virtual ~OneClickSigninHelper(); | 203 virtual ~OneClickSigninHelper(); |
| 191 | 204 |
| 192 // Returns true if the one-click signin feature can be offered at this time. | 205 // Returns true if the one-click signin feature can be offered at this time. |
| 193 // It can be offered if the io_data is not in an incognito window and if the | 206 // It can be offered if the io_data is not in an incognito window and if the |
| 194 // origin of |url| is a valid Gaia sign in origin. This function is meant | 207 // origin of |url| is a valid Gaia sign in origin. This function is meant |
| 195 // to called only from the IO thread. | 208 // to called only from the IO thread. |
| 196 static Offer CanOfferOnIOThreadImpl(const GURL& url, | 209 static Offer CanOfferOnIOThreadImpl(const GURL& url, |
| 197 const std::string& referrer, | |
| 198 base::SupportsUserData* request, | 210 base::SupportsUserData* request, |
| 199 ProfileIOData* io_data); | 211 ProfileIOData* io_data); |
| 200 | 212 |
| 201 // The portion of ShowInfoBarIfPossible() that needs to run on the UI thread. | 213 // The portion of ShowInfoBarIfPossible() that needs to run on the UI thread. |
| 202 // |session_index| and |email| are extracted from the Google-Accounts-SignIn | 214 // |session_index| and |email| are extracted from the Google-Accounts-SignIn |
| 203 // header. |auto_accept| is extracted from the Google-Chrome-SignIn header. | 215 // header. |auto_accept| is extracted from the Google-Chrome-SignIn header. |
| 204 // |source| is used to determine which of the explicit sign in mechanism is | 216 // |source| is used to determine which of the explicit sign in mechanism is |
| 205 // being used. | 217 // being used. |
| 206 // | 218 // |
| 207 // |continue_url| is where Gaia will continue to when the sign in process is | 219 // |continue_url| is where Gaia will continue to when the sign in process is |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 302 |
| 291 // Allows unittest to avoid starting sync for real. | 303 // Allows unittest to avoid starting sync for real. |
| 292 bool do_not_start_sync_for_testing_; | 304 bool do_not_start_sync_for_testing_; |
| 293 | 305 |
| 294 base::WeakPtrFactory<OneClickSigninHelper> weak_pointer_factory_; | 306 base::WeakPtrFactory<OneClickSigninHelper> weak_pointer_factory_; |
| 295 | 307 |
| 296 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); | 308 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); |
| 297 }; | 309 }; |
| 298 | 310 |
| 299 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ | 311 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ |
| OLD | NEW |