1 // Copyright 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.
5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_GAIA_SCREEN_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_GAIA_SCREEN_HANDLER_H_
8 #include "base/basictypes.h"
9 #include "base/command_line.h"
10 #include "base/memory/ref_counted.h"
11 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
12 #include "net/base/net_errors.h"
16 class SigninScreenHandler
;
18 // A class that's used to specify the way how Gaia should be loaded.
22 // Forces Gaia to reload.
25 // Whether local verison of Gaia is used.
28 // True if password was changed for the current user.
29 bool password_changed
;
31 // True if user pods can be displyed.
34 // Whether Gaia should be loaded in offline mode.
37 // True if user list is non-empty.
40 // Email of current user.
44 // A class that handles WebUI hooks in Gaia screen.
45 class GaiaScreenHandler
: public BaseScreenHandler
{
48 FRAME_STATE_UNKNOWN
= 0,
54 explicit GaiaScreenHandler(
55 const scoped_refptr
<NetworkStateInformer
>& network_state_informer
);
56 virtual ~GaiaScreenHandler();
58 void LoadGaia(const GaiaContext
& context
);
59 void UpdateGaia(const GaiaContext
& context
);
62 FrameState
frame_state() const { return frame_state_
; }
63 net::Error
frame_error() const { return frame_error_
; }
66 // TODO (ygorshenin@): remove this dependency.
67 friend class SigninScreenHandler
;
69 // BaseScreenHandler implementation:
70 virtual void DeclareLocalizedValues(LocalizedValuesBuilder
* builder
) OVERRIDE
;
71 virtual void Initialize() OVERRIDE
;
73 // WebUIMessageHandler implementation:
74 virtual void RegisterMessages() OVERRIDE
;
76 // WebUI message handlers.
77 void HandleFrameLoadingCompleted(int status
);
79 // TODO (ygorshenin@): GaiaScreenHandler should implement
80 // NetworkStateInformer::Observer.
81 void UpdateState(ErrorScreenActor::ErrorReason reason
);
83 // TODO (ygorshenin@): remove this dependency.
84 void SetSigninScreenHandler(SigninScreenHandler
* handler
);
86 // Current state of Gaia frame.
87 FrameState frame_state_
;
89 // Latest Gaia frame error.
90 net::Error frame_error_
;
92 // Network state informer used to keep signin screen up.
93 scoped_refptr
<NetworkStateInformer
> network_state_informer_
;
95 // Non-owning ptr to SigninScreenHandler instance. Should not be used
97 // TODO (ygorshenin@): GaiaScreenHandler shouldn't communicate with
98 // signin_screen_handler directly.
99 SigninScreenHandler
* signin_screen_handler_
;
101 DISALLOW_COPY_AND_ASSIGN(GaiaScreenHandler
);
104 } // namespace chromeos
106 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_GAIA_SCREEN_HANDLER_H_