| 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::Closure CompletionCallback; | |
| 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 private: | |
| 55 friend class TestMergeSessionLoadPage; | |
| 56 | |
| 57 // InterstitialPageDelegate implementation. | |
| 58 virtual std::string GetHTMLContents() OVERRIDE; | |
| 59 virtual void CommandReceived(const std::string& command) OVERRIDE; | |
| 60 virtual void OverrideRendererPrefs( | |
| 61 content::RendererPreferences* prefs) OVERRIDE; | |
| 62 virtual void OnProceed() OVERRIDE; | |
| 63 virtual void OnDontProceed() OVERRIDE; | |
| 64 | |
| 65 // UserManager::Observer overrides. | |
| 66 virtual void MergeSessionStateChanged( | |
| 67 UserManager::MergeSessionState state) OVERRIDE; | |
| 68 virtual void LocalStateChanged(UserManager* user_manager) OVERRIDE {} | |
| 69 | |
| 70 void NotifyBlockingPageComplete(); | |
| 71 | |
| 72 CompletionCallback callback_; | |
| 73 | |
| 74 // True if the proceed is chosen. | |
| 75 bool proceeded_; | |
| 76 | |
| 77 content::WebContents* web_contents_; | |
| 78 GURL url_; | |
| 79 content::InterstitialPage* interstitial_page_; // Owns us. | |
| 80 | |
| 81 DISALLOW_COPY_AND_ASSIGN(MergeSessionLoadPage); | |
| 82 }; | |
| 83 | |
| 84 } // namespace chromeos | |
| 85 | |
| 86 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MERGE_SESSION_LOAD_PAGE_H_ | |
| OLD | NEW |