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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_MERGE_SESSION_LOAD_PAGE_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_MERGE_SESSION_LOAD_PAGE_H_
10 #include "base/callback.h"
11 #include "base/compiler_specific.h"
12 #include "chrome/browser/chromeos/login/signin/merge_session_throttle.h"
13 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h"
14 #include "content/public/browser/interstitial_page_delegate.h"
18 class DictionaryValue
;
22 class InterstitialPage
;
26 namespace extensions
{
32 // MergeSessionLoadPage class shows the interstitial page that is shown
33 // while we are trying to restore session containing tabs with Google properties
34 // during the process of exchanging OAuth2 refresh token for user cookies.
35 // It deletes itself when the interstitial page is closed.
36 class MergeSessionLoadPage
37 : public content::InterstitialPageDelegate
,
38 public OAuth2LoginManager::Observer
{
40 // Create a merge session load delay page for the |web_contents|.
41 // The |callback| will be run on the IO thread.
43 content::WebContents
* web_contents
,
45 const MergeSessionThrottle::CompletionCallback
& callback
);
50 ~MergeSessionLoadPage() override
;
53 friend class TestMergeSessionLoadPage
;
55 // InterstitialPageDelegate implementation.
56 std::string
GetHTMLContents() override
;
57 void CommandReceived(const std::string
& command
) override
;
58 void OverrideRendererPrefs(content::RendererPreferences
* prefs
) override
;
59 void OnProceed() override
;
60 void OnDontProceed() override
;
62 // OAuth2LoginManager::Observer overrides.
63 void OnSessionRestoreStateChanged(
64 Profile
* user_profile
,
65 OAuth2LoginManager::SessionRestoreState state
) override
;
67 void NotifyBlockingPageComplete();
69 // Helper function to get OAuth2LoginManager out of |web_contents_|.
70 OAuth2LoginManager
* GetOAuth2LoginManager();
72 MergeSessionThrottle::CompletionCallback callback_
;
74 // True if the proceed is chosen.
77 content::WebContents
* web_contents_
;
79 content::InterstitialPage
* interstitial_page_
; // Owns us.
81 DISALLOW_COPY_AND_ASSIGN(MergeSessionLoadPage
);
84 } // namespace chromeos
86 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_MERGE_SESSION_LOAD_PAGE_H_