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/user_manager.h" | |
13 #include "content/public/browser/interstitial_page_delegate.h" | |
14 #include "googleurl/src/gurl.h" | |
15 | |
16 namespace base { | |
17 class DictionaryValue; | |
18 } | |
19 | |
20 namespace content { | |
21 class InterstitialPage; | |
22 class WebContents; | |
23 } | |
24 | |
25 namespace extensions { | |
26 class Extension; | |
27 } | |
28 | |
29 namespace chromeos { | |
30 | |
31 // MergeSessionLoadPage class shows the interstitial page that is shown | |
32 // while we are trying to restore session containing tabs with Google properties | |
33 // during the process of exchanging OAuth2 refresh token for user cookies. | |
34 // It deletes itself when the interstitial page is closed. | |
35 class MergeSessionLoadPage | |
36 : public content::InterstitialPageDelegate, | |
37 public UserManager::Observer { | |
38 public: | |
39 // Passed a boolean indicating whether or not it is OK to proceed with the | |
40 // page load. | |
41 typedef base::Callback<void(bool /*proceed*/)> CompletionCallback; | |
oshima
2013/02/15 22:40:52
optional nit: it'd be more readable wit enum rathe
zel
2013/02/15 23:16:58
don't need bool either... removed
| |
42 | |
43 // Create a merge session load delay page for the |web_contents|. | |
44 // The |callback| will be run on the IO thread. | |
45 MergeSessionLoadPage(content::WebContents* web_contents, | |
46 const GURL& url, | |
47 const CompletionCallback& callback); | |
48 | |
49 void Show(); | |
50 | |
51 protected: | |
52 virtual ~MergeSessionLoadPage(); | |
53 | |
54 // Overridden by tests. | |
55 virtual void NotifyBlockingPageComplete(bool proceed) OVERRIDE; | |
xiyuan
2013/02/15 23:43:07
Test seems no longer uses it.
zel
2013/02/15 23:51:05
Done.
| |
56 | |
57 private: | |
58 friend class TestMergeSessionLoadPage; | |
59 | |
60 // InterstitialPageDelegate implementation. | |
61 virtual std::string GetHTMLContents() OVERRIDE; | |
62 virtual void CommandReceived(const std::string& command) OVERRIDE; | |
63 virtual void OverrideRendererPrefs( | |
64 content::RendererPreferences* prefs) OVERRIDE; | |
65 virtual void OnProceed() OVERRIDE; | |
66 virtual void OnDontProceed() OVERRIDE; | |
67 | |
68 // UserManager::Observer overrides. | |
69 virtual void MergeSessionStateChanged( | |
70 UserManager::MergeSessionState state) OVERRIDE; | |
71 virtual void LocalStateChanged(UserManager* user_manager) OVERRIDE {} | |
72 | |
73 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 |