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

Side by Side Diff: chrome/browser/chromeos/options/request_pin_view.h

Issue 2094333002: Implementation for chrome.certificateProvider.requestPin/stopPinRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small fix Created 4 years, 5 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 (c) 2016 The Chromium Authors. All rights reserved.
emaxx 2016/07/08 02:00:15 The location under the options/ directory doesn't
igorcov 2016/07/08 11:40:53 Moved to ui folder.
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_OPTIONS_REQUEST_PIN_VIEW_H_
6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_REQUEST_PIN_VIEW_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/compiler_specific.h"
12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/strings/string16.h"
15 #include "ui/views/controls/textfield/textfield_controller.h"
16 #include "ui/views/view.h"
17 #include "ui/views/window/dialog_delegate.h"
18
19 namespace views {
20 class Label;
21 }
22
23 namespace chromeos {
24
25 class PassphraseTextfield;
26
27 // A dialog box for requesting PIN code.
28 class RequestPinView : public views::DialogDelegateView,
29 public views::TextfieldController {
30 public:
31 using UserInputCallback = base::Callback<void(const base::string16&)>;
emaxx 2016/07/08 02:00:15 nit: include "base/callback.h"
emaxx 2016/07/08 02:00:15 The name is not exactly correct, as the same callb
igorcov 2016/07/08 11:40:54 Done.
igorcov 2016/07/11 15:04:06 Done.
32 explicit RequestPinView(const std::string& extension_name,
emaxx 2016/07/08 02:00:15 nit: "explicit" is not necessary
igorcov 2016/07/08 11:40:53 Done.
33 const std::string& dialog_type,
34 const base::string16& error_message,
35 const bool accept_input,
emaxx 2016/07/08 02:00:15 nit: const-ness is not usually used with arguments
igorcov 2016/07/08 11:40:54 Done
36 const UserInputCallback& callback);
37 ~RequestPinView() override;
38
39 // views::TextfieldController
40 void ContentsChanged(views::Textfield* sender,
41 const base::string16& new_contents) override;
42
43 // views::DialogDelegateView
44 bool Cancel() override;
45 bool Accept() override;
46 base::string16 GetWindowTitle() const override;
47 ui::ModalType GetModalType() const override;
48 views::View* GetInitiallyFocusedView() override;
49 bool IsDialogButtonEnabled(ui::DialogButton button) const override;
50
51 void SetExtensionName(const std::string& extension_name);
emaxx 2016/07/08 02:00:15 Maybe merge all these methods into a single method
igorcov 2016/07/11 15:04:06 Done.
52 void SetDialogType(const std::string& dialog_type);
53 void SetErrorMessage(const base::string16& error_message);
54 void SetAcceptInput(const bool accept_input);
55 void SetCallback(const UserInputCallback& callback);
56
57 views::Textfield* textfield_for_testing() { return passphrase_textfield_; }
58 views::Label* error_label_for_testing() { return error_label_; }
59
60 private:
61 // This will initialize the view.
62 void Init();
63
64 UserInputCallback callback_;
65 base::string16 window_title_;
66 views::Textfield* passphrase_textfield_;
emaxx 2016/07/08 02:00:14 This name is a bit misleading: there is no passphr
igorcov 2016/07/11 15:04:06 Done.
67 views::Label* header_label_;
68 views::Label* dialog_type_label_;
emaxx 2016/07/08 02:00:15 "Dialog type" is a bit vague definition; I think i
igorcov 2016/07/11 15:04:06 Done.
69 views::Label* error_label_;
70 bool accept_input_;
emaxx 2016/07/08 02:00:14 Have I understood it correctly that when waiting_f
igorcov 2016/07/11 15:04:06 Done.
71 // Flag to know when Chrome submited input to extension and is waiting for new
emaxx 2016/07/08 02:00:15 Better to rephrase this comment: first, "Chrome" g
72 // request from it.
73 bool waiting_for_request_;
emaxx 2016/07/08 02:00:15 I'm also thinking about what could be a more telli
igorcov 2016/07/11 15:04:06 Done.
74
75 base::WeakPtrFactory<RequestPinView> weak_ptr_factory_;
76
77 DISALLOW_COPY_AND_ASSIGN(RequestPinView);
78 };
79
80 } // namespace chromeos
81
82 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_REQUEST_PIN_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698