15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_CRYPTO_MODULE_PASSWORD_DIALOG_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_UI_CRYPTO_MODULE_PASSWORD_DIALOG_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string>
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/callback.h"
11f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "ui/gfx/native_widget_types.h"
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace chrome {
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// An enum to describe the reason for the password request.
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)enum CryptoModulePasswordReason {
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  kCryptoModulePasswordKeygen,
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  kCryptoModulePasswordCertEnrollment,
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  kCryptoModulePasswordClientAuth,
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  kCryptoModulePasswordListCerts,
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  kCryptoModulePasswordCertImport,
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  kCryptoModulePasswordCertExport,
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)typedef base::Callback<void(const std::string&)> CryptoModulePasswordCallback;
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Display a dialog, prompting the user to authenticate to unlock
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// |module|. |reason| describes the purpose of the authentication and
295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// affects the message displayed in the dialog. |hostname| is the hostname
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// of the server which requested the access.
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void ShowCryptoModulePasswordDialog(
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    const std::string& module_name,
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    bool retry,
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    CryptoModulePasswordReason reason,
355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    const std::string& hostname,
36f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    gfx::NativeWindow parent,
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    const CryptoModulePasswordCallback& callback);
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace chrome
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_BROWSER_UI_CRYPTO_MODULE_PASSWORD_DIALOG_H_
42