Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(390)

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/enterprise_oauth_enrollment_screen_handler.h

Issue 7562008: Add new version of enrollment screen supporting OAuth. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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_UI_WEBUI_CHROMEOS_LOGIN_ENTERPRISE_OAUTH_ENROLLMENT_SCREE N_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENTERPRISE_OAUTH_ENROLLMENT_SCREE N_HANDLER_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/basictypes.h"
12 #include "base/scoped_ptr.h"
13 #include "base/values.h"
14 #include "chrome/browser/chromeos/login/enterprise_enrollment_screen_actor.h"
15 #include "chrome/browser/net/gaia/gaia_oauth_consumer.h"
16 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
17 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
18
19 class GaiaOAuthFetcher;
20
21 namespace chromeos {
22
23 // WebUIMessageHandler implementation which handles events occurring on the
24 // page, such as the user pressing the signin button.
25 class EnterpriseOAuthEnrollmentScreenHandler
26 : public BaseScreenHandler,
27 public EnterpriseEnrollmentScreenActor,
28 public GaiaOAuthConsumer {
29 public:
30 EnterpriseOAuthEnrollmentScreenHandler();
31 virtual ~EnterpriseOAuthEnrollmentScreenHandler();
32
33 // Implements WebUIMessageHandler:
34 virtual void RegisterMessages() OVERRIDE;
35
36 // Implements EnterpriseEnrollmentScreenActor:
37 virtual void SetController(Controller* controller);
38 virtual void PrepareToShow() OVERRIDE;
39 virtual void Show() OVERRIDE;
40 virtual void Hide() OVERRIDE;
41 virtual void SetEditableUser(bool editable) OVERRIDE;
42 virtual void ShowConfirmationScreen() OVERRIDE;
43 virtual void ShowAuthError(const GoogleServiceAuthError& error) OVERRIDE;
44 virtual void ShowAccountError() OVERRIDE;
45 virtual void ShowFatalAuthError() OVERRIDE;
46 virtual void ShowFatalEnrollmentError() OVERRIDE;
47 virtual void ShowNetworkEnrollmentError() OVERRIDE;
48
49 // Implements BaseScreenHandler:
50 virtual void GetLocalizedStrings(
51 base::DictionaryValue* localized_strings) OVERRIDE;
52
53 // Implements GaiaOAuthConsumer:
54 virtual void OnGetOAuthTokenSuccess(const std::string& oauth_token) OVERRIDE;
55 virtual void OnGetOAuthTokenFailure() OVERRIDE;
56 virtual void OnOAuthGetAccessTokenSuccess(
57 const std::string& token,
58 const std::string& secret) OVERRIDE;
59 virtual void OnOAuthGetAccessTokenFailure(
60 const GoogleServiceAuthError& error) OVERRIDE;
61 virtual void OnOAuthWrapBridgeSuccess(
whywhat 2011/08/04 10:47:52 This method now has service_name parameter. Please
Mattias Nissler (ping if slow) 2011/08/04 14:38:44 Done.
62 const std::string& token,
63 const std::string& expires_in) OVERRIDE;
64 virtual void OnOAuthWrapBridgeFailure(
65 const GoogleServiceAuthError& error) OVERRIDE;
66 virtual void OnUserInfoSuccess(const std::string& email) OVERRIDE;
67 virtual void OnUserInfoFailure(const GoogleServiceAuthError& error) OVERRIDE;
68
69 protected:
70 // Implements BaseScreenHandler:
71 virtual void Initialize() OVERRIDE;
72
73 // Keeps the controller for this actor.
74 Controller* controller_;
75
76 private:
77 // Handlers for WebUI messages.
78 void HandleClose(const base::ListValue* args);
79 void HandleCompleteLogin(const base::ListValue* args);
80 void HandleRetry(const base::ListValue* args);
81
82 // Shows a given enrollment step.
83 void ShowStep(const char* step);
84
85 // Display the given i18n string as error message.
86 void ShowError(int message_id, bool retry);
87
88 // Resets the authentication machinery and clears cookies, so other screens
89 // (like the actual login screen) find a clean slate and don't pick up our
90 // auth state.
91 void ResetAuth();
92
93 bool editable_user_;
94 bool show_on_init_;
95
96 // Username of the user signing in.
97 std::string user_;
98
99 // This intentionally lives here and not in the controller, since it needs to
100 // execute requests in the context of the profile that displays the webui.
101 scoped_ptr<GaiaOAuthFetcher> oauth_fetcher_;
102
103 DISALLOW_COPY_AND_ASSIGN(EnterpriseOAuthEnrollmentScreenHandler);
104 };
105
106 } // namespace chromeos
107
108 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENTERPRISE_OAUTH_ENROLLMENT_SC REEN_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698