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

Side by Side Diff: chrome/browser/ui/webui/signin/signin_supervised_user_import_handler.h

Issue 1826903002: updated UI, default profile name, check for existing supervised user before create (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 8 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
OLDNEW
(Empty)
1 // Copyright 2016 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_SIGNIN_SIGNIN_SUPERVISED_USER_IMPORT_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_SUPERVISED_USER_IMPORT_HANDLER_H_
7
8 #include <string>
9
10 #include "base/callback_list.h"
11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/scoped_observer.h"
14 #include "base/strings/string16.h"
15 #include "chrome/browser/profiles/profile.h"
16 #include "content/public/browser/web_ui_message_handler.h"
17
18 namespace base {
19 class DictionaryValue;
20 class ListValue;
21 }
22
23 // Handler for the 'import existing supervised user' dialog.
24 class SigninSupervisedUserImportHandler : public content::WebUIMessageHandler {
25 public:
26 SigninSupervisedUserImportHandler();
27 ~SigninSupervisedUserImportHandler() override;
28
29 // WebUIMessageHandler implementation.
30 void RegisterMessages() override;
31
32 private:
33 // Assigns a new |webui_callback_id_|. Ensures that previous in-flight request
34 // has been fulfilled.
35 void AssignWebUICallbackId(const base::ListValue* args);
36
37 // Callback for the "getExistingSupervisedUsers" message.
38 // Checks the sign-in status of the custodian and accordingly
39 // sends an update to the WebUI.
40 void GetExistingSupervisedUsers(const base::ListValue* args);
41
42 void LoadCustodianProfileCallback(Profile* custodian_profile,
43 Profile::CreateStatus status);
44
45 // Reject the WebUI callback with an error message.
46 void RejectCallback(const base::string16& error);
47
48 base::string16 GetLocalErorrMessage() const;
49
50 base::string16 GetAuthErorrMessage() const;
51
52 // Sends an array of supervised users to WebUI. Each entry is of the form:
53 // supervisedProfile = {
54 // id: "Supervised User ID",
55 // name: "Supervised User Name",
56 // iconURL: "chrome://path/to/icon/image",
57 // onCurrentDevice: true or false,
58 // }
59 // The array holds all existing supervised users attached to the
60 // custodian's profile which initiated the request.
61 void SendExistingSupervisedUsers(Profile* profile,
62 const base::DictionaryValue* dict);
63
64 bool IsAccountConnected(Profile* profile) const;
65 bool HasAuthError(Profile* profile) const;
66
67 // The WebUI callback ID of the last in-flight async request. There is always
68 // only one in-flight such request.
69 std::string webui_callback_id_;
70
71 base::WeakPtrFactory<SigninSupervisedUserImportHandler> weak_ptr_factory_;
72
73 DISALLOW_COPY_AND_ASSIGN(SigninSupervisedUserImportHandler);
74 };
75
76 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_SUPERVISED_USER_IMPORT_HANDLER_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698