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

Side by Side Diff: chrome/browser/ui/views/crypto_module_password_dialog_view.h

Issue 9956157: views: Make everything in crypto module password dialog private except the ctor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: peter view Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/views/crypto_module_password_dialog_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_VIEWS_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector>
11 10
12 #include "base/callback.h" 11 #include "base/basictypes.h"
13 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
14 #include "chrome/browser/ui/crypto_module_password_dialog.h" 13 #include "chrome/browser/ui/crypto_module_password_dialog.h"
15 #include "ui/views/controls/textfield/textfield_controller.h" 14 #include "ui/views/controls/textfield/textfield_controller.h"
16 #include "ui/views/window/dialog_delegate.h" 15 #include "ui/views/window/dialog_delegate.h"
17 16
18 namespace views { 17 namespace views {
18 class Label;
19 class Textfield; 19 class Textfield;
20 class Label;
21 } 20 }
22 21
23 namespace browser { 22 namespace browser {
24 23
25 // CryptoModulePasswordDialogView
26 // Dialog view for crypto module password interaction.
27 /////////////////////////////////////////////////////////////////////////
28 class CryptoModulePasswordDialogView : public views::DialogDelegateView, 24 class CryptoModulePasswordDialogView : public views::DialogDelegateView,
29 public views::TextfieldController { 25 public views::TextfieldController {
30 public: 26 public:
31 CryptoModulePasswordDialogView( 27 CryptoModulePasswordDialogView(const std::string& slot_name,
32 const std::string& slot_name, 28 CryptoModulePasswordReason reason,
33 browser::CryptoModulePasswordReason reason, 29 const std::string& server,
34 const std::string& server, 30 const CryptoModulePasswordCallback& callback);
35 const base::Callback<void(const char*)>& callback);
36 31
37 virtual ~CryptoModulePasswordDialogView(); 32 virtual ~CryptoModulePasswordDialogView();
38 33
39 // views::DialogDelegate: 34 private:
40 virtual bool Accept() OVERRIDE; 35 FRIEND_TEST_ALL_PREFIXES(CryptoModulePasswordDialogViewTest, TestAccept);
41 virtual bool Cancel() OVERRIDE;
42 virtual string16 GetDialogButtonLabel(
43 ui::DialogButton button) const OVERRIDE;
44
45 36
46 // views::WidgetDelegate: 37 // views::WidgetDelegate:
47 virtual views::View* GetInitiallyFocusedView() OVERRIDE; 38 virtual views::View* GetInitiallyFocusedView() OVERRIDE;
48 virtual ui::ModalType GetModalType() const OVERRIDE; 39 virtual ui::ModalType GetModalType() const OVERRIDE;
40 virtual string16 GetWindowTitle() const OVERRIDE;
49 virtual views::View* GetContentsView() OVERRIDE; 41 virtual views::View* GetContentsView() OVERRIDE;
50 42
51 // views::View: 43 // views::DialogDelegate:
52 virtual string16 GetWindowTitle() const OVERRIDE; 44 virtual string16 GetDialogButtonLabel(
45 ui::DialogButton button) const OVERRIDE;
46 virtual bool Cancel() OVERRIDE;
47 virtual bool Accept() OVERRIDE;
53 48
54 // views::TextfieldController: 49 // views::TextfieldController:
50 virtual void ContentsChanged(views::Textfield* sender,
51 const string16& new_contents) OVERRIDE;
55 virtual bool HandleKeyEvent(views::Textfield* sender, 52 virtual bool HandleKeyEvent(views::Textfield* sender,
56 const views::KeyEvent& keystroke) OVERRIDE; 53 const views::KeyEvent& keystroke) OVERRIDE;
57 virtual void ContentsChanged(views::Textfield* sender,
58 const string16& new_contents) OVERRIDE;
59 54
60 private:
61 // Initialize views and layout. 55 // Initialize views and layout.
62 void Init(const std::string& server, 56 void Init(const std::string& server,
63 const std::string& slot_name, 57 const std::string& slot_name,
64 browser::CryptoModulePasswordReason reason); 58 browser::CryptoModulePasswordReason reason);
65 59
66 views::Label* title_label_; 60 views::Label* title_label_;
67 views::Label* reason_label_; 61 views::Label* reason_label_;
68 views::Label* password_label_; 62 views::Label* password_label_;
69 views::Textfield* password_entry_; 63 views::Textfield* password_entry_;
70 64
71 const base::Callback<void(const char*)> callback_; 65 const CryptoModulePasswordCallback callback_;
72 FRIEND_TEST_ALL_PREFIXES(CryptoModulePasswordDialogViewTest, TestAccept);
73 66
74 DISALLOW_COPY_AND_ASSIGN(CryptoModulePasswordDialogView); 67 DISALLOW_COPY_AND_ASSIGN(CryptoModulePasswordDialogView);
75 }; 68 };
76 69
77 } // namespace browser 70 } // namespace browser
78 71
79 #endif // CHROME_BROWSER_UI_VIEWS_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_ 72 #endif // CHROME_BROWSER_UI_VIEWS_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/crypto_module_password_dialog_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698