OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013 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_MERGE_SESSION_LOAD_PAGE_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MERGE_SESSION_LOAD_PAGE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/callback.h" | |
11 #include "base/compiler_specific.h" | |
12 #include "chrome/browser/chromeos/login/merge_session_throttle.h" | |
13 #include "chrome/browser/chromeos/login/oauth2_login_manager.h" | |
14 #include "content/public/browser/interstitial_page_delegate.h" | |
15 #include "url/gurl.h" | |
16 | |
17 namespace base { | |
18 class DictionaryValue; | |
19 } | |
20 | |
21 namespace content { | |
22 class InterstitialPage; | |
23 class WebContents; | |
24 } | |
25 | |
26 namespace extensions { | |
27 class Extension; | |
28 } | |
29 | |
30 namespace chromeos { | |
31 | |
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 { | |
39 public: | |
40 // Create a merge session load delay page for the |web_contents|. | |
41 // The |callback| will be run on the IO thread. | |
42 MergeSessionLoadPage( | |
43 content::WebContents* web_contents, | |
44 const GURL& url, | |
45 const MergeSessionThrottle::CompletionCallback& callback); | |
46 | |
47 void Show(); | |
48 | |
49 protected: | |
50 virtual ~MergeSessionLoadPage(); | |
51 | |
52 private: | |
53 friend class TestMergeSessionLoadPage; | |
54 | |
55 // InterstitialPageDelegate implementation. | |
56 virtual std::string GetHTMLContents() OVERRIDE; | |
57 virtual void CommandReceived(const std::string& command) OVERRIDE; | |
58 virtual void OverrideRendererPrefs( | |
59 content::RendererPreferences* prefs) OVERRIDE; | |
60 virtual void OnProceed() OVERRIDE; | |
61 virtual void OnDontProceed() OVERRIDE; | |
62 | |
63 // OAuth2LoginManager::Observer overrides. | |
64 virtual void OnSessionRestoreStateChanged( | |
65 Profile* user_profile, | |
66 OAuth2LoginManager::SessionRestoreState state) OVERRIDE; | |
67 | |
68 void NotifyBlockingPageComplete(); | |
69 | |
70 // Helper function to get OAuth2LoginManager out of |web_contents_|. | |
71 OAuth2LoginManager* GetOAuth2LoginManager(); | |
72 | |
73 MergeSessionThrottle::CompletionCallback callback_; | |
74 | |
75 // True if the proceed is chosen. | |
76 bool proceeded_; | |
77 | |
78 content::WebContents* web_contents_; | |
79 GURL url_; | |
80 content::InterstitialPage* interstitial_page_; // Owns us. | |
81 | |
82 DISALLOW_COPY_AND_ASSIGN(MergeSessionLoadPage); | |
83 }; | |
84 | |
85 } // namespace chromeos | |
86 | |
87 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MERGE_SESSION_LOAD_PAGE_H_ | |
OLD | NEW |