Home | History | Annotate | Download | only in login
      1 // Copyright (c) 2011 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_ACCOUNT_SCREEN_H_
      6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ACCOUNT_SCREEN_H_
      7 #pragma once
      8 
      9 #include <string>
     10 
     11 #include "base/memory/scoped_ptr.h"
     12 #include "chrome/browser/chromeos/login/account_creation_view.h"
     13 #include "chrome/browser/chromeos/login/screen_observer.h"
     14 #include "chrome/browser/chromeos/login/view_screen.h"
     15 #include "chrome/browser/chromeos/login/web_page_screen.h"
     16 #include "chrome/browser/chromeos/login/web_page_view.h"
     17 #include "content/browser/tab_contents/tab_contents_delegate.h"
     18 
     19 class GURL;
     20 class WizardScreenDelegate;
     21 
     22 namespace chromeos {
     23 
     24 // AccountScreen is shown when user is creating new Google Account.
     25 class AccountScreen : public ViewScreen<AccountCreationView>,
     26                       public WebPageScreen,
     27                       public WebPageDelegate,
     28                       public AccountCreationViewDelegate {
     29  public:
     30   explicit AccountScreen(WizardScreenDelegate* delegate);
     31   virtual ~AccountScreen();
     32 
     33   // WebPageDelegate implementation:
     34   virtual void OnPageLoaded();
     35   virtual void OnPageLoadFailed(const std::string& url);
     36 
     37   // AccountCreationViewDelegate implementation:
     38   virtual void OnUserCreated(const std::string& username,
     39                              const std::string& password);
     40 
     41   // Sets the url for account creation. Used in tests.
     42   static void set_new_account_page_url(const GURL& url);
     43   // Sets the flag forcing to check for HTTPS. Used in tests.
     44   static void set_check_for_https(bool check) { check_for_https_ = check; }
     45 
     46  private:
     47   // ViewScreen implementation:
     48   virtual void CreateView();
     49   virtual void Refresh();
     50   virtual AccountCreationView* AllocateView();
     51 
     52   // TabContentsDelegate implementation:
     53   virtual void NavigationStateChanged(const TabContents* source,
     54                                       unsigned changed_flags);
     55   virtual void LoadingStateChanged(TabContents* source);
     56   virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event);
     57 
     58   // WebPageScreen implementation:
     59   virtual void CloseScreen(ScreenObserver::ExitCodes code);
     60 
     61   // Url of account creation page. Overriden by tests.
     62   static scoped_ptr<GURL> new_account_page_url_;
     63   // Indicates if we should check for HTTPS scheme. Overriden by tests.
     64   static bool check_for_https_;
     65 
     66   DISALLOW_COPY_AND_ASSIGN(AccountScreen);
     67 };
     68 
     69 }  // namespace chromeos
     70 
     71 #endif  // CHROME_BROWSER_CHROMEOS_LOGIN_ACCOUNT_SCREEN_H_
     72