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

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: Created 4 years, 9 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 {
tommycli 2016/03/24 19:28:51 This should also have a unit test. It should be ad
Moe 2016/03/24 22:07:57 Will work on tests for this and signin_create_prof
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 LoadSupervisorProfileCallback(Profile* supervisor_profile,
43 Profile::CreateStatus status);
44
45 base::string16 GetAuthErorrMessage() const;
46
47 // Sends an array of supervised users to WebUI. Each entry is of the form:
48 // supervisedProfile = {
49 // id: "Supervised User ID",
50 // name: "Supervised User Name",
51 // iconURL: "chrome://path/to/icon/image",
52 // onCurrentDevice: true or false,
53 // }
54 // The array holds all existing supervised users attached to the
55 // custodian's profile which initiated the request.
56 void SendExistingSupervisedUsers(Profile* profile,
57 const base::DictionaryValue* dict);
58
59 bool IsAccountConnected(Profile* profile) const;
60 bool HasAuthError(Profile* profile) const;
61
62 // The WebUI callback ID of the last in-flight async request. There is always
63 // only one in-flight such request.
64 std::string webui_callback_id_;
65
66 base::WeakPtrFactory<SigninSupervisedUserImportHandler> weak_ptr_factory_;
67
68 DISALLOW_COPY_AND_ASSIGN(SigninSupervisedUserImportHandler);
69 };
70
71 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_SUPERVISED_USER_IMPORT_HANDLER_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698