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

Unified Diff: chrome/browser/ui/views/crypto_module_password_dialog_view.h

Issue 8115020: add crypto module password dialog view and test. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/crypto_module_password_dialog_view.h
diff --git a/chrome/browser/ui/views/crypto_module_password_dialog_view.h b/chrome/browser/ui/views/crypto_module_password_dialog_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..ec8c83a23ed7617171bc34e6b55cd4def081cbc1
--- /dev/null
+++ b/chrome/browser/ui/views/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_VIEWS_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_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 "ui/views/controls/textfield/textfield_controller.h"
+#include "ui/views/window/dialog_delegate.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();
+ string16 GetDialogButtonLabel(
+ ui::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_ALL_PREFIXES(CryptoModulePasswordDialogViewTest, TestAccept);
+
+ DISALLOW_COPY_AND_ASSIGN(CryptoModulePasswordDialogView);
+};
+
+} // namespace browser
+
+#endif // CHROME_BROWSER_UI_VIEWS_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_

Powered by Google App Engine
This is Rietveld 408576698