| Index: chrome/browser/chromeos/certificate_provider/certificate_provider_service.h
|
| diff --git a/chrome/browser/chromeos/certificate_provider/certificate_provider_service.h b/chrome/browser/chromeos/certificate_provider/certificate_provider_service.h
|
| index dada1f2250e74172a72f935196dadba9d9a347ee..6ba0d9e37e8b3d94dd48db4eb1b1bc8bd57bfd72 100644
|
| --- a/chrome/browser/chromeos/certificate_provider/certificate_provider_service.h
|
| +++ b/chrome/browser/chromeos/certificate_provider/certificate_provider_service.h
|
| @@ -21,6 +21,7 @@
|
| #include "chrome/browser/chromeos/certificate_provider/certificate_requests.h"
|
| #include "chrome/browser/chromeos/certificate_provider/sign_requests.h"
|
| #include "chrome/browser/chromeos/certificate_provider/thread_safe_certificate_map.h"
|
| +#include "chrome/browser/chromeos/options/request_pin_view.h"
|
| #include "components/keyed_service/core/keyed_service.h"
|
| #include "net/cert/x509_certificate.h"
|
| #include "net/ssl/ssl_private_key.h"
|
| @@ -150,6 +151,36 @@ class CertificateProviderService : public KeyedService {
|
| // corresponding notification of the ExtensionRegistry is triggered.
|
| void OnExtensionUnloaded(const std::string& extension_id);
|
|
|
| + // The user provided input to dialog. |closed| tells whether the dialog was
|
| + // closed by the user without providing any input.
|
| + void OnPinDialogInput(const std::string& extension_id, const bool closed);
|
| +
|
| + // This callback function is called by the view when user closes the PIN
|
| + // dialog while the last input is still processing at extension side. |value|
|
| + // is not used, but checked that it's empty.
|
| + void OnFlowInterrupted(const base::string16& value);
|
| +
|
| + // Returns whether the last PIN dialog from this extension was closed by the
|
| + // user.
|
| + bool LastPinDialogClosed(const std::string& extension_id);
|
| +
|
| + // Creates a new RequestPinView object and displays it in a dialog or reuses
|
| + // the old dialog if active one exists just updating the parameters. Returns
|
| + // if the dialog is displayed and extension owns it.
|
| + bool ShowPinDialog(const std::string& extension_id,
|
| + const std::string& extension_name,
|
| + const std::string& dialog_type,
|
| + const base::string16& error_message,
|
| + const bool accept_input,
|
| + const RequestPinView::UserInputCallback& callback);
|
| +
|
| + // The active dialog is closed if the |extension_id| matches the
|
| + // |active_dialog_extension_id_|. Returns whether the dialog was closed.
|
| + bool CloseDialog(const std::string& extension_id);
|
| +
|
| + RequestPinView* active_view_for_testing() { return active_pin_dialog_; }
|
| + views::Widget* active_window_for_testing() { return active_window_; }
|
| +
|
| private:
|
| class CertKeyProviderImpl;
|
| class CertificateProviderImpl;
|
| @@ -197,6 +228,15 @@ class CertificateProviderService : public KeyedService {
|
| // Contains all pending certificate requests.
|
| certificate_provider::CertificateRequests certificate_requests_;
|
|
|
| + // State about last response from user to the ShowPinDialog extension.
|
| + std::map<std::string, bool> last_rejected_;
|
| +
|
| + // There can be only one active dialog to request PIN from this extension.
|
| + // Keeps the ownership.
|
| + chromeos::RequestPinView* active_pin_dialog_ = nullptr;
|
| + std::string active_dialog_extension_id_;
|
| + views::Widget* active_window_ = nullptr;
|
| +
|
| // Contains all certificates that the extensions returned during the lifetime
|
| // of this service. Each certificate is associated with the extension that
|
| // reported the certificate in response to the most recent certificate
|
|
|