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/webui/options/certificate_manager_handler.h

Issue 7259019: Move base/values.h into the base namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_WEBUI_OPTIONS_CERTIFICATE_MANAGER_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CERTIFICATE_MANAGER_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CERTIFICATE_MANAGER_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CERTIFICATE_MANAGER_HANDLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/certificate_manager_model.h" 12 #include "chrome/browser/certificate_manager_model.h"
13 #include "chrome/browser/ui/shell_dialogs.h" 13 #include "chrome/browser/ui/shell_dialogs.h"
14 #include "chrome/browser/ui/webui/options/options_ui.h" 14 #include "chrome/browser/ui/webui/options/options_ui.h"
15 #include "content/browser/cancelable_request.h" 15 #include "content/browser/cancelable_request.h"
16 #include "net/base/cert_database.h" 16 #include "net/base/cert_database.h"
17 #include "ui/gfx/native_widget_types.h" 17 #include "ui/gfx/native_widget_types.h"
18 18
19 class FileAccessProvider; 19 class FileAccessProvider;
20 20
21 class CertificateManagerHandler : public OptionsPageUIHandler, 21 class CertificateManagerHandler : public OptionsPageUIHandler,
22 public CertificateManagerModel::Observer, 22 public CertificateManagerModel::Observer,
23 public SelectFileDialog::Listener { 23 public SelectFileDialog::Listener {
24 public: 24 public:
25 CertificateManagerHandler(); 25 CertificateManagerHandler();
26 virtual ~CertificateManagerHandler(); 26 virtual ~CertificateManagerHandler();
27 27
28 // OptionsPageUIHandler implementation. 28 // OptionsPageUIHandler implementation.
29 virtual void GetLocalizedValues(DictionaryValue* localized_strings); 29 virtual void GetLocalizedValues(base::DictionaryValue* localized_strings);
30 virtual void RegisterMessages(); 30 virtual void RegisterMessages();
31 31
32 // CertificateManagerModel::Observer implementation. 32 // CertificateManagerModel::Observer implementation.
33 virtual void CertificatesRefreshed(); 33 virtual void CertificatesRefreshed();
34 34
35 // SelectFileDialog::Listener implementation. 35 // SelectFileDialog::Listener implementation.
36 virtual void FileSelected(const FilePath& path, int index, void* params); 36 virtual void FileSelected(const FilePath& path, int index, void* params);
37 virtual void FileSelectionCanceled(void* params); 37 virtual void FileSelectionCanceled(void* params);
38 38
39 private: 39 private:
40 // View certificate. 40 // View certificate.
41 void View(const ListValue* args); 41 void View(const base::ListValue* args);
42 42
43 // Edit server certificate trust values. 43 // Edit server certificate trust values.
44 void EditServer(const ListValue* args); 44 void EditServer(const base::ListValue* args);
45 45
46 // Edit certificate authority trust values. The sequence goes like: 46 // Edit certificate authority trust values. The sequence goes like:
47 // 1. user clicks edit button -> CertificateEditCaTrustOverlay.show -> 47 // 1. user clicks edit button -> CertificateEditCaTrustOverlay.show ->
48 // GetCATrust -> CertificateEditCaTrustOverlay.populateTrust 48 // GetCATrust -> CertificateEditCaTrustOverlay.populateTrust
49 // 2. user clicks ok -> EditCATrust -> CertificateEditCaTrustOverlay.dismiss 49 // 2. user clicks ok -> EditCATrust -> CertificateEditCaTrustOverlay.dismiss
50 void GetCATrust(const ListValue* args); 50 void GetCATrust(const base::ListValue* args);
51 void EditCATrust(const ListValue* args); 51 void EditCATrust(const base::ListValue* args);
52 52
53 // Cleanup state stored during import or export process. 53 // Cleanup state stored during import or export process.
54 void CancelImportExportProcess(const ListValue* args); 54 void CancelImportExportProcess(const base::ListValue* args);
55 void ImportExportCleanup(); 55 void ImportExportCleanup();
56 56
57 // Export to PKCS #12 file. The sequence goes like: 57 // Export to PKCS #12 file. The sequence goes like:
58 // 1a. user click on export button -> ExportPersonal -> launches file 58 // 1a. user click on export button -> ExportPersonal -> launches file
59 // selector 59 // selector
60 // 1b. user click on export all button -> ExportAllPersonal -> launches file 60 // 1b. user click on export all button -> ExportAllPersonal -> launches file
61 // selector 61 // selector
62 // 2. user selects file -> ExportPersonalFileSelected -> launches password 62 // 2. user selects file -> ExportPersonalFileSelected -> launches password
63 // dialog 63 // dialog
64 // 3. user enters password -> ExportPersonalPasswordSelected -> unlock slots 64 // 3. user enters password -> ExportPersonalPasswordSelected -> unlock slots
65 // 4. slots unlocked -> ExportPersonalSlotsUnlocked -> exports to memory 65 // 4. slots unlocked -> ExportPersonalSlotsUnlocked -> exports to memory
66 // buffer -> starts async write operation 66 // buffer -> starts async write operation
67 // 5. write finishes (or fails) -> ExportPersonalFileWritten 67 // 5. write finishes (or fails) -> ExportPersonalFileWritten
68 void ExportPersonal(const ListValue* args); 68 void ExportPersonal(const base::ListValue* args);
69 void ExportAllPersonal(const ListValue* args); 69 void ExportAllPersonal(const base::ListValue* args);
70 void ExportPersonalFileSelected(const FilePath& path); 70 void ExportPersonalFileSelected(const FilePath& path);
71 void ExportPersonalPasswordSelected(const ListValue* args); 71 void ExportPersonalPasswordSelected(const base::ListValue* args);
72 void ExportPersonalSlotsUnlocked(); 72 void ExportPersonalSlotsUnlocked();
73 void ExportPersonalFileWritten(int write_errno, int bytes_written); 73 void ExportPersonalFileWritten(int write_errno, int bytes_written);
74 74
75 // Import from PKCS #12 file. The sequence goes like: 75 // Import from PKCS #12 file. The sequence goes like:
76 // 1. user click on import button -> StartImportPersonal -> launches file 76 // 1. user click on import button -> StartImportPersonal -> launches file
77 // selector 77 // selector
78 // 2. user selects file -> ImportPersonalFileSelected -> launches password 78 // 2. user selects file -> ImportPersonalFileSelected -> launches password
79 // dialog 79 // dialog
80 // 3. user enters password -> ImportPersonalPasswordSelected -> starts async 80 // 3. user enters password -> ImportPersonalPasswordSelected -> starts async
81 // read operation 81 // read operation
82 // 4. read operation completes -> ImportPersonalFileRead -> unlock slot 82 // 4. read operation completes -> ImportPersonalFileRead -> unlock slot
83 // 5. slot unlocked -> ImportPersonalSlotUnlocked attempts to 83 // 5. slot unlocked -> ImportPersonalSlotUnlocked attempts to
84 // import with previously entered password 84 // import with previously entered password
85 // 6a. if import succeeds -> ImportExportCleanup 85 // 6a. if import succeeds -> ImportExportCleanup
86 // 6b. if import fails -> show error, ImportExportCleanup 86 // 6b. if import fails -> show error, ImportExportCleanup
87 // TODO(mattm): allow retrying with different password 87 // TODO(mattm): allow retrying with different password
88 void StartImportPersonal(const ListValue* args); 88 void StartImportPersonal(const base::ListValue* args);
89 void ImportPersonalFileSelected(const FilePath& path); 89 void ImportPersonalFileSelected(const FilePath& path);
90 void ImportPersonalPasswordSelected(const ListValue* args); 90 void ImportPersonalPasswordSelected(const base::ListValue* args);
91 void ImportPersonalFileRead(int read_errno, std::string data); 91 void ImportPersonalFileRead(int read_errno, std::string data);
92 void ImportPersonalSlotUnlocked(); 92 void ImportPersonalSlotUnlocked();
93 93
94 // Import Server certificates from file. Sequence goes like: 94 // Import Server certificates from file. Sequence goes like:
95 // 1. user clicks on import button -> ImportServer -> launches file selector 95 // 1. user clicks on import button -> ImportServer -> launches file selector
96 // 2. user selects file -> ImportServerFileSelected -> starts async read 96 // 2. user selects file -> ImportServerFileSelected -> starts async read
97 // 3. read completes -> ImportServerFileRead -> parse certs -> attempt import 97 // 3. read completes -> ImportServerFileRead -> parse certs -> attempt import
98 // 4a. if import succeeds -> ImportExportCleanup 98 // 4a. if import succeeds -> ImportExportCleanup
99 // 4b. if import fails -> show error, ImportExportCleanup 99 // 4b. if import fails -> show error, ImportExportCleanup
100 void ImportServer(const ListValue* args); 100 void ImportServer(const base::ListValue* args);
101 void ImportServerFileSelected(const FilePath& path); 101 void ImportServerFileSelected(const FilePath& path);
102 void ImportServerFileRead(int read_errno, std::string data); 102 void ImportServerFileRead(int read_errno, std::string data);
103 103
104 // Import Certificate Authorities from file. Sequence goes like: 104 // Import Certificate Authorities from file. Sequence goes like:
105 // 1. user clicks on import button -> ImportCA -> launches file selector 105 // 1. user clicks on import button -> ImportCA -> launches file selector
106 // 2. user selects file -> ImportCAFileSelected -> starts async read 106 // 2. user selects file -> ImportCAFileSelected -> starts async read
107 // 3. read completes -> ImportCAFileRead -> parse certs -> 107 // 3. read completes -> ImportCAFileRead -> parse certs ->
108 // CertificateEditCaTrustOverlay.showImport 108 // CertificateEditCaTrustOverlay.showImport
109 // 4. user clicks ok -> ImportCATrustSelected -> attempt import 109 // 4. user clicks ok -> ImportCATrustSelected -> attempt import
110 // 5a. if import succeeds -> ImportExportCleanup 110 // 5a. if import succeeds -> ImportExportCleanup
111 // 5b. if import fails -> show error, ImportExportCleanup 111 // 5b. if import fails -> show error, ImportExportCleanup
112 void ImportCA(const ListValue* args); 112 void ImportCA(const base::ListValue* args);
113 void ImportCAFileSelected(const FilePath& path); 113 void ImportCAFileSelected(const FilePath& path);
114 void ImportCAFileRead(int read_errno, std::string data); 114 void ImportCAFileRead(int read_errno, std::string data);
115 void ImportCATrustSelected(const ListValue* args); 115 void ImportCATrustSelected(const base::ListValue* args);
116 116
117 // Export a certificate. 117 // Export a certificate.
118 void Export(const ListValue* args); 118 void Export(const base::ListValue* args);
119 119
120 // Delete certificate and private key (if any). 120 // Delete certificate and private key (if any).
121 void Delete(const ListValue* args); 121 void Delete(const base::ListValue* args);
122 122
123 // Populate the trees in all the tabs. 123 // Populate the trees in all the tabs.
124 void Populate(const ListValue* args); 124 void Populate(const base::ListValue* args);
125 125
126 // Populate the given tab's tree. 126 // Populate the given tab's tree.
127 void PopulateTree(const std::string& tab_name, net::CertType type); 127 void PopulateTree(const std::string& tab_name, net::CertType type);
128 128
129 // Display a WebUI error message box. 129 // Display a WebUI error message box.
130 void ShowError(const std::string& title, const std::string& error) const; 130 void ShowError(const std::string& title, const std::string& error) const;
131 131
132 // Display a WebUI error message box for import failures. 132 // Display a WebUI error message box for import failures.
133 // Depends on |selected_cert_list_| being set to the imports that we 133 // Depends on |selected_cert_list_| being set to the imports that we
134 // attempted to import. 134 // attempted to import.
135 void ShowImportErrors( 135 void ShowImportErrors(
136 const std::string& title, 136 const std::string& title,
137 const net::CertDatabase::ImportCertFailureList& not_imported) const; 137 const net::CertDatabase::ImportCertFailureList& not_imported) const;
138 138
139 #if defined(OS_CHROMEOS) 139 #if defined(OS_CHROMEOS)
140 // Check whether Tpm token is ready and notifiy JS side. 140 // Check whether Tpm token is ready and notifiy JS side.
141 void CheckTpmTokenReady(const ListValue* args); 141 void CheckTpmTokenReady(const base::ListValue* args);
142 #endif 142 #endif
143 143
144 gfx::NativeWindow GetParentWindow() const; 144 gfx::NativeWindow GetParentWindow() const;
145 145
146 // The Certificates Manager model 146 // The Certificates Manager model
147 scoped_ptr<CertificateManagerModel> certificate_manager_model_; 147 scoped_ptr<CertificateManagerModel> certificate_manager_model_;
148 148
149 // For multi-step import or export processes, we need to store the path, 149 // For multi-step import or export processes, we need to store the path,
150 // password, etc the user chose while we wait for them to enter a password, 150 // password, etc the user chose while we wait for them to enter a password,
151 // wait for file to be read, etc. 151 // wait for file to be read, etc.
152 FilePath file_path_; 152 FilePath file_path_;
153 string16 password_; 153 string16 password_;
154 bool use_hardware_backed_; 154 bool use_hardware_backed_;
155 std::string file_data_; 155 std::string file_data_;
156 net::CertificateList selected_cert_list_; 156 net::CertificateList selected_cert_list_;
157 scoped_refptr<SelectFileDialog> select_file_dialog_; 157 scoped_refptr<SelectFileDialog> select_file_dialog_;
158 scoped_refptr<net::CryptoModule> module_; 158 scoped_refptr<net::CryptoModule> module_;
159 159
160 // Used in reading and writing certificate files. 160 // Used in reading and writing certificate files.
161 CancelableRequestConsumer consumer_; 161 CancelableRequestConsumer consumer_;
162 scoped_refptr<FileAccessProvider> file_access_provider_; 162 scoped_refptr<FileAccessProvider> file_access_provider_;
163 163
164 DISALLOW_COPY_AND_ASSIGN(CertificateManagerHandler); 164 DISALLOW_COPY_AND_ASSIGN(CertificateManagerHandler);
165 }; 165 };
166 166
167 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CERTIFICATE_MANAGER_HANDLER_H_ 167 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CERTIFICATE_MANAGER_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698