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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 chrome::HostDesktopType desktop_type_; | 164 chrome::HostDesktopType desktop_type_; |
165 OneClickSigninSyncStarter::StartSyncMode start_mode_; | 165 OneClickSigninSyncStarter::StartSyncMode start_mode_; |
166 scoped_ptr<SigninOAuthHelper> signin_oauth_helper_; | 166 scoped_ptr<SigninOAuthHelper> signin_oauth_helper_; |
167 base::WeakPtrFactory<SyncStarterWrapper> weak_pointer_factory_; | 167 base::WeakPtrFactory<SyncStarterWrapper> weak_pointer_factory_; |
168 | 168 |
169 DISALLOW_COPY_AND_ASSIGN(SyncStarterWrapper); | 169 DISALLOW_COPY_AND_ASSIGN(SyncStarterWrapper); |
170 }; | 170 }; |
171 | 171 |
172 static void LogHistogramValue(signin::Source source, int action); | 172 static void LogHistogramValue(signin::Source source, int action); |
173 | 173 |
174 static void CreateForWebContentsWithPasswordManager( | |
175 content::WebContents* contents, | |
176 password_manager::PasswordManager* password_manager); | |
177 | |
178 // Returns true if the one-click signin feature can be offered at this time. | 174 // Returns true if the one-click signin feature can be offered at this time. |
179 // If |email| is not empty, then the profile is checked to see if it's | 175 // If |email| is not empty, then the profile is checked to see if it's |
180 // already connected to a google account or if the user has already rejected | 176 // already connected to a google account or if the user has already rejected |
181 // one-click sign-in with this email, in which cases a one click signin | 177 // one-click sign-in with this email, in which cases a one click signin |
182 // should not be offered. | 178 // should not be offered. |
183 // | 179 // |
184 // If |can_offer_for| is |CAN_OFFER_FOR_INTERSTITAL_ONLY|, then only do the | 180 // If |can_offer_for| is |CAN_OFFER_FOR_INTERSTITAL_ONLY|, then only do the |
185 // checks that would affect the interstitial page. Otherwise, do the checks | 181 // checks that would affect the interstitial page. Otherwise, do the checks |
186 // that would affect the interstitial and the explicit sign ins. | 182 // that would affect the interstitial and the explicit sign ins. |
187 // | 183 // |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | 271 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, |
276 CanOfferOnIOThreadNoSigninCookies); | 272 CanOfferOnIOThreadNoSigninCookies); |
277 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | 273 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, |
278 CanOfferOnIOThreadDisabledByPolicy); | 274 CanOfferOnIOThreadDisabledByPolicy); |
279 | 275 |
280 // Maximum number of navigations away from the set of valid Gaia URLs before | 276 // Maximum number of navigations away from the set of valid Gaia URLs before |
281 // clearing the internal state of the helper. This is necessary to support | 277 // clearing the internal state of the helper. This is necessary to support |
282 // SAML-based accounts, but causes bug crbug.com/181163. | 278 // SAML-based accounts, but causes bug crbug.com/181163. |
283 static const int kMaxNavigationsSince; | 279 static const int kMaxNavigationsSince; |
284 | 280 |
285 OneClickSigninHelper(content::WebContents* web_contents, | 281 explicit OneClickSigninHelper(content::WebContents* web_contents); |
286 password_manager::PasswordManager* password_manager); | |
287 | 282 |
288 ~OneClickSigninHelper() override; | 283 ~OneClickSigninHelper() override; |
289 | 284 |
290 // Returns true if the one-click signin feature can be offered at this time. | 285 // Returns true if the one-click signin feature can be offered at this time. |
291 // It can be offered if the io_data is not in an incognito window and if the | 286 // It can be offered if the io_data is not in an incognito window and if the |
292 // origin of |url| is a valid Gaia sign in origin. This function is meant | 287 // origin of |url| is a valid Gaia sign in origin. This function is meant |
293 // to called only from the IO thread. | 288 // to called only from the IO thread. |
294 static Offer CanOfferOnIOThreadImpl(const GURL& url, | 289 static Offer CanOfferOnIOThreadImpl(const GURL& url, |
295 base::SupportsUserData* request, | 290 base::SupportsUserData* request, |
296 ProfileIOData* io_data); | 291 ProfileIOData* io_data); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 | 377 |
383 // Allows unittest to avoid starting sync for real. | 378 // Allows unittest to avoid starting sync for real. |
384 bool do_not_start_sync_for_testing_; | 379 bool do_not_start_sync_for_testing_; |
385 | 380 |
386 base::WeakPtrFactory<OneClickSigninHelper> weak_pointer_factory_; | 381 base::WeakPtrFactory<OneClickSigninHelper> weak_pointer_factory_; |
387 | 382 |
388 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); | 383 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); |
389 }; | 384 }; |
390 | 385 |
391 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ | 386 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ |
OLD | NEW |