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 28 matching lines...) Expand all Loading... |
325 // TestingProfile provides. | 320 // TestingProfile provides. |
326 void SetDoNotClearPendingEmailForTesting(); | 321 void SetDoNotClearPendingEmailForTesting(); |
327 | 322 |
328 // In unit tests, disable starting the actual sync. | 323 // In unit tests, disable starting the actual sync. |
329 void set_do_not_start_sync_for_testing(); | 324 void set_do_not_start_sync_for_testing(); |
330 | 325 |
331 // Called when password has been submitted. | 326 // Called when password has been submitted. |
332 void PasswordSubmitted(const autofill::PasswordForm& form); | 327 void PasswordSubmitted(const autofill::PasswordForm& form); |
333 | 328 |
334 // content::WebContentsObserver overrides. | 329 // content::WebContentsObserver overrides. |
| 330 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; |
335 void DidStartNavigationToPendingEntry( | 331 void DidStartNavigationToPendingEntry( |
336 const GURL& url, | 332 const GURL& url, |
337 content::NavigationController::ReloadType reload_type) override; | 333 content::NavigationController::ReloadType reload_type) override; |
338 void DidNavigateMainFrame( | 334 void DidNavigateMainFrame( |
339 const content::LoadCommittedDetails& details, | 335 const content::LoadCommittedDetails& details, |
340 const content::FrameNavigateParams& params) override; | 336 const content::FrameNavigateParams& params) override; |
341 void DidStopLoading(content::RenderViewHost* render_view_host) override; | 337 void DidStopLoading(content::RenderViewHost* render_view_host) override; |
342 | 338 |
343 OneClickSigninSyncStarter::Callback CreateSyncStarterCallback(); | 339 OneClickSigninSyncStarter::Callback CreateSyncStarterCallback(); |
344 | 340 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 | 378 |
383 // Allows unittest to avoid starting sync for real. | 379 // Allows unittest to avoid starting sync for real. |
384 bool do_not_start_sync_for_testing_; | 380 bool do_not_start_sync_for_testing_; |
385 | 381 |
386 base::WeakPtrFactory<OneClickSigninHelper> weak_pointer_factory_; | 382 base::WeakPtrFactory<OneClickSigninHelper> weak_pointer_factory_; |
387 | 383 |
388 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); | 384 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); |
389 }; | 385 }; |
390 | 386 |
391 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ | 387 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ |
OLD | NEW |