| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHROMEOS_LOGIN_SIGNIN_MERGE_SESSION_THROTTLING_UTILS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_MERGE_SESSION_THROTTLING_UTILS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_MERGE_SESSION_THROTTLING_UTILS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_MERGE_SESSION_THROTTLING_UTILS_H_ |
| 7 | 7 |
| 8 #include "base/atomic_ref_count.h" | 8 #include "base/atomic_ref_count.h" |
| 9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
| 10 | 10 |
| 11 class GURL; | 11 class GURL; |
| 12 class Profile; | 12 class Profile; |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 class WebContents; | 15 class WebContents; |
| 16 } | 16 } |
| 17 | 17 |
| 18 // A set of helper functions used by the MergeSessionNavigationThrottle and the | 18 // A set of helper functions used by the MergeSessionNavigationThrottle and the |
| 19 // MergeSessionResourceThrottle to determine if an interstitial page should be | 19 // MergeSessionResourceThrottle to determine if an interstitial page should be |
| 20 // shown for a request when the merge session process (cookie reconstruction | 20 // shown for a request when the merge session process (cookie reconstruction |
| 21 // from OAuth2 refresh token in ChromeOS login) is still in progress. | 21 // from OAuth2 refresh token in ChromeOS login) is still in progress. |
| 22 namespace merge_session_throttling_utils { | 22 namespace merge_session_throttling_utils { |
| 23 | 23 |
| 24 // Passed a boolean indicating whether or not it is OK to proceed with the | 24 // Passed a boolean indicating whether or not it is OK to proceed with the |
| 25 // page load. | 25 // page load. |
| 26 using CompletionCallback = base::Closure; | 26 using CompletionCallback = base::Closure; |
| 27 | 27 |
| 28 // Policy for when it is valid to attach a MergeSessionNavigationThrottle. |
| 29 // Namely, this will be false for unit tests, where the UserManager is not |
| 30 // initialized. |
| 31 bool ShouldAttachNavigationThrottle(); |
| 32 |
| 28 // Checks if session is already merged. This is safe to call on all threads. | 33 // Checks if session is already merged. This is safe to call on all threads. |
| 29 bool AreAllSessionMergedAlready(); | 34 bool AreAllSessionMergedAlready(); |
| 30 | 35 |
| 31 // Adds/removes |profile| to/from the blocking profiles set. This should be | 36 // Adds/removes |profile| to/from the blocking profiles set. This should be |
| 32 // called on the UI thread. | 37 // called on the UI thread. |
| 33 void BlockProfile(Profile* profile); | 38 void BlockProfile(Profile* profile); |
| 34 void UnblockProfile(Profile* profile); | 39 void UnblockProfile(Profile* profile); |
| 35 | 40 |
| 36 // Whether requests from |web_contents| or |profile| should currently be | 41 // Whether requests from |web_contents| or |profile| should currently be |
| 37 // delayed. This should be called on the UI thread. | 42 // delayed. This should be called on the UI thread. |
| 38 bool ShouldDelayRequestForProfile(Profile* profile); | 43 bool ShouldDelayRequestForProfile(Profile* profile); |
| 39 bool ShouldDelayRequestForWebContents(content::WebContents* web_contents); | 44 bool ShouldDelayRequestForWebContents(content::WebContents* web_contents); |
| 40 | 45 |
| 41 // True if the load of |url| should be delayed. The function is safe to be | 46 // True if the load of |url| should be delayed. The function is safe to be |
| 42 // called on any thread. | 47 // called on any thread. |
| 43 bool ShouldDelayUrl(const GURL& url); | 48 bool ShouldDelayUrl(const GURL& url); |
| 44 | 49 |
| 45 } // namespace merge_session_throttling_utils | 50 } // namespace merge_session_throttling_utils |
| 46 | 51 |
| 47 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_MERGE_SESSION_THROTTLING_UTILS_H
_ | 52 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_MERGE_SESSION_THROTTLING_UTILS_H
_ |
| OLD | NEW |