| Index: chrome/browser/ui/crypto_module_password_dialog_view.h
|
| diff --git a/chrome/browser/ui/crypto_module_password_dialog_view.h b/chrome/browser/ui/crypto_module_password_dialog_view.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d1c19dd7e388b41317c6701fe9f2cef3ad17dd15
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/crypto_module_password_dialog_view.h
|
| @@ -0,0 +1,79 @@
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_UI_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_
|
| +#define CHROME_BROWSER_UI_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_
|
| +#pragma once
|
| +
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +#include "base/callback.h"
|
| +#include "base/gtest_prod_util.h"
|
| +#include "chrome/browser/ui/crypto_module_password_dialog.h"
|
| +#include "views/window/dialog_delegate.h"
|
| +#include "views/controls/textfield/textfield_controller.h"
|
| +
|
| +namespace views {
|
| +class Textfield;
|
| +class Label;
|
| +}
|
| +
|
| +namespace browser {
|
| +
|
| +// CryptoModulePasswordDialogView
|
| +// Dialog view for crypto module password interaction.
|
| +/////////////////////////////////////////////////////////////////////////
|
| +class CryptoModulePasswordDialogView : public views::DialogDelegateView,
|
| + public views::TextfieldController {
|
| + public:
|
| + CryptoModulePasswordDialogView(
|
| + const std::string& slot_name,
|
| + browser::CryptoModulePasswordReason reason,
|
| + const std::string& server,
|
| + const base::Callback<void(const char*)>& callback);
|
| +
|
| + virtual ~CryptoModulePasswordDialogView() {}
|
| +
|
| + // views::DialogDelegate:
|
| + virtual bool Accept();
|
| + virtual bool Cancel();
|
| + std::wstring GetDialogButtonLabel(
|
| + ui::MessageBoxFlags::DialogButton button) const;
|
| +
|
| +
|
| + // views::WidgetDelegate:
|
| + virtual views::View* GetInitiallyFocusedView();
|
| + virtual bool IsModal() const;
|
| + virtual views::View* GetContentsView();
|
| +
|
| + // views::View:
|
| + virtual string16 GetWindowTitle() const;
|
| +
|
| + // views::TextfieldController:
|
| + virtual bool HandleKeyEvent(views::Textfield* sender,
|
| + const views::KeyEvent& keystroke);
|
| + virtual void ContentsChanged(views::Textfield* sender,
|
| + const string16& new_contents) {}
|
| +
|
| + private:
|
| + // Initialize views and layout.
|
| + void Init(const std::string& server,
|
| + const std::string& slot_name,
|
| + browser::CryptoModulePasswordReason reason);
|
| +
|
| + views::Label* title_label_;
|
| + views::Label* reason_label_;
|
| + views::Label* password_label_;
|
| + views::Textfield* password_entry_;
|
| +
|
| + const base::Callback<void(const char*)>& callback_;
|
| + FRIEND_TEST(CryptoModulePasswordDialogViewTest, TestAccept);
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(CryptoModulePasswordDialogView);
|
| +};
|
| +
|
| +} // namespace browser
|
| +
|
| +#endif // CHROME_BROWSER_UI_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_
|
|
|