Home | History | Annotate | Download | only in login
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_PROFILE_AUTH_DATA_H_
      6 #define CHROME_BROWSER_CHROMEOS_LOGIN_PROFILE_AUTH_DATA_H_
      7 
      8 #include "base/callback_forward.h"
      9 #include "base/macros.h"
     10 
     11 namespace content {
     12 class BrowserContext;
     13 }
     14 
     15 namespace chromeos {
     16 
     17 // Helper class that transfers authentication-related data from a BrowserContext
     18 // used for authentication to the user's actual BrowserContext.
     19 class ProfileAuthData {
     20  public:
     21   // Transfers authentication-related data from |from_context| to |to_context|
     22   // and invokes |completion_callback| on the UI thread when the operation has
     23   // completed. The following data is transferred:
     24   // * The proxy authentication state.
     25   // * All authentication cookies and channel IDs, if
     26   //   |transfer_auth_cookies_and_channel_ids_on_first_login| is true and
     27   //   |to_context|'s cookie jar is empty. If the cookie jar is not empty, the
     28   //   authentication states in |from_context| and |to_context| should be merged
     29   //   using /MergeSession instead.
     30   // * The authentication cookies set by a SAML IdP, if
     31   //   |transfer_saml_auth_cookies_on_subsequent_login| is true and
     32   //   |to_context|'s cookie jar is not empty.
     33   static void Transfer(
     34       content::BrowserContext* from_context,
     35       content::BrowserContext* to_context,
     36       bool transfer_auth_cookies_and_channel_ids_on_first_login,
     37       bool transfer_saml_auth_cookies_on_subsequent_login,
     38       const base::Closure& completion_callback);
     39 
     40  private:
     41   DISALLOW_IMPLICIT_CONSTRUCTORS(ProfileAuthData);
     42 };
     43 
     44 }  // namespace chromeos
     45 
     46 #endif  // CHROME_BROWSER_CHROMEOS_LOGIN_PROFILE_AUTH_DATA_H_
     47