| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DOM_UI_OPTIONS_CERTIFICATE_MANAGER_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_OPTIONS_CERTIFICATE_MANAGER_HANDLER_H_ |
| 6 #define CHROME_BROWSER_DOM_UI_OPTIONS_CERTIFICATE_MANAGER_HANDLER_H_ | 6 #define CHROME_BROWSER_DOM_UI_OPTIONS_CERTIFICATE_MANAGER_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> |
| 10 |
| 9 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 10 #include "chrome/browser/cancelable_request.h" | 12 #include "chrome/browser/cancelable_request.h" |
| 11 #include "chrome/browser/certificate_manager_model.h" | 13 #include "chrome/browser/certificate_manager_model.h" |
| 12 #include "chrome/browser/dom_ui/options/options_ui.h" | 14 #include "chrome/browser/dom_ui/options/options_ui.h" |
| 13 #include "chrome/browser/shell_dialogs.h" | 15 #include "chrome/browser/shell_dialogs.h" |
| 14 #include "gfx/native_widget_types.h" | 16 #include "gfx/native_widget_types.h" |
| 15 #include "net/base/cert_database.h" | 17 #include "net/base/cert_database.h" |
| 16 | 18 |
| 17 class FileAccessProvider; | 19 class FileAccessProvider; |
| 18 | 20 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 void CancelImportExportProcess(const ListValue* args); | 54 void CancelImportExportProcess(const ListValue* args); |
| 53 void ImportExportCleanup(); | 55 void ImportExportCleanup(); |
| 54 | 56 |
| 55 // Export to PKCS #12 file. The sequence goes like: | 57 // Export to PKCS #12 file. The sequence goes like: |
| 56 // 1a. user click on export button -> ExportPersonal -> launches file | 58 // 1a. user click on export button -> ExportPersonal -> launches file |
| 57 // selector | 59 // selector |
| 58 // 1b. user click on export all button -> ExportAllPersonal -> launches file | 60 // 1b. user click on export all button -> ExportAllPersonal -> launches file |
| 59 // selector | 61 // selector |
| 60 // 2. user selects file -> ExportPersonalFileSelected -> launches password | 62 // 2. user selects file -> ExportPersonalFileSelected -> launches password |
| 61 // dialog | 63 // dialog |
| 62 // 3. user enters password -> ExportPersonalPasswordSelected -> exports to | 64 // 3. user enters password -> ExportPersonalPasswordSelected -> unlock slots |
| 63 // memory buffer -> starts async write operation | 65 // 4. slots unlocked -> ExportPersonalSlotsUnlocked -> exports to memory |
| 64 // 4. write finishes (or fails) -> ExportPersonalFileWritten | 66 // buffer -> starts async write operation |
| 67 // 5. write finishes (or fails) -> ExportPersonalFileWritten |
| 65 void ExportPersonal(const ListValue* args); | 68 void ExportPersonal(const ListValue* args); |
| 66 void ExportAllPersonal(const ListValue* args); | 69 void ExportAllPersonal(const ListValue* args); |
| 67 void ExportPersonalFileSelected(const FilePath& path); | 70 void ExportPersonalFileSelected(const FilePath& path); |
| 68 void ExportPersonalPasswordSelected(const ListValue* args); | 71 void ExportPersonalPasswordSelected(const ListValue* args); |
| 72 void ExportPersonalSlotsUnlocked(); |
| 69 void ExportPersonalFileWritten(int write_errno, int bytes_written); | 73 void ExportPersonalFileWritten(int write_errno, int bytes_written); |
| 70 | 74 |
| 71 // Import from PKCS #12 file. The sequence goes like: | 75 // Import from PKCS #12 file. The sequence goes like: |
| 72 // 1. user click on import button -> StartImportPersonal -> launches file | 76 // 1. user click on import button -> StartImportPersonal -> launches file |
| 73 // selector | 77 // selector |
| 74 // 2. user selects file -> ImportPersonalFileSelected -> launches password | 78 // 2. user selects file -> ImportPersonalFileSelected -> launches password |
| 75 // dialog | 79 // dialog |
| 76 // 3. user enters password -> ImportPersonalPasswordSelected -> starts async | 80 // 3. user enters password -> ImportPersonalPasswordSelected -> starts async |
| 77 // read operation | 81 // read operation |
| 78 // 4. read operation completes -> ImportPersonalFileRead -> attempts to | 82 // 4. read operation completes -> ImportPersonalFileRead -> unlock slot |
| 83 // 5. slot unlocked -> ImportPersonalSlotUnlocked attempts to |
| 79 // import with previously entered password | 84 // import with previously entered password |
| 80 // 5a. if import succeeds -> ImportExportCleanup | 85 // 6a. if import succeeds -> ImportExportCleanup |
| 81 // 5b. if import fails -> show error, ImportExportCleanup | 86 // 6b. if import fails -> show error, ImportExportCleanup |
| 82 // TODO(mattm): allow retrying with different password | 87 // TODO(mattm): allow retrying with different password |
| 83 void StartImportPersonal(const ListValue* args); | 88 void StartImportPersonal(const ListValue* args); |
| 84 void ImportPersonalFileSelected(const FilePath& path); | 89 void ImportPersonalFileSelected(const FilePath& path); |
| 85 void ImportPersonalPasswordSelected(const ListValue* args); | 90 void ImportPersonalPasswordSelected(const ListValue* args); |
| 86 void ImportPersonalFileRead(int read_errno, std::string data); | 91 void ImportPersonalFileRead(int read_errno, std::string data); |
| 92 void ImportPersonalSlotUnlocked(); |
| 87 | 93 |
| 88 // Import Server certificates from file. Sequence goes like: | 94 // Import Server certificates from file. Sequence goes like: |
| 89 // 1. user clicks on import button -> ImportServer -> launches file selector | 95 // 1. user clicks on import button -> ImportServer -> launches file selector |
| 90 // 2. user selects file -> ImportServerFileSelected -> starts async read | 96 // 2. user selects file -> ImportServerFileSelected -> starts async read |
| 91 // 3. read completes -> ImportServerFileRead -> parse certs -> attempt import | 97 // 3. read completes -> ImportServerFileRead -> parse certs -> attempt import |
| 92 // 4a. if import succeeds -> ImportExportCleanup | 98 // 4a. if import succeeds -> ImportExportCleanup |
| 93 // 4b. if import fails -> show error, ImportExportCleanup | 99 // 4b. if import fails -> show error, ImportExportCleanup |
| 94 void ImportServer(const ListValue* args); | 100 void ImportServer(const ListValue* args); |
| 95 void ImportServerFileSelected(const FilePath& path); | 101 void ImportServerFileSelected(const FilePath& path); |
| 96 void ImportServerFileRead(int read_errno, std::string data); | 102 void ImportServerFileRead(int read_errno, std::string data); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 gfx::NativeWindow GetParentWindow() const; | 139 gfx::NativeWindow GetParentWindow() const; |
| 134 | 140 |
| 135 // The Certificates Manager model | 141 // The Certificates Manager model |
| 136 scoped_ptr<CertificateManagerModel> certificate_manager_model_; | 142 scoped_ptr<CertificateManagerModel> certificate_manager_model_; |
| 137 | 143 |
| 138 // For multi-step import or export processes, we need to store the path, | 144 // For multi-step import or export processes, we need to store the path, |
| 139 // password, etc the user chose while we wait for them to enter a password, | 145 // password, etc the user chose while we wait for them to enter a password, |
| 140 // wait for file to be read, etc. | 146 // wait for file to be read, etc. |
| 141 FilePath file_path_; | 147 FilePath file_path_; |
| 142 string16 password_; | 148 string16 password_; |
| 149 std::string file_data_; |
| 143 net::CertificateList selected_cert_list_; | 150 net::CertificateList selected_cert_list_; |
| 144 scoped_refptr<SelectFileDialog> select_file_dialog_; | 151 scoped_refptr<SelectFileDialog> select_file_dialog_; |
| 152 scoped_refptr<net::CryptoModule> module_; |
| 145 | 153 |
| 146 // Used in reading and writing certificate files. | 154 // Used in reading and writing certificate files. |
| 147 CancelableRequestConsumer consumer_; | 155 CancelableRequestConsumer consumer_; |
| 148 scoped_refptr<FileAccessProvider> file_access_provider_; | 156 scoped_refptr<FileAccessProvider> file_access_provider_; |
| 149 | 157 |
| 150 DISALLOW_COPY_AND_ASSIGN(CertificateManagerHandler); | 158 DISALLOW_COPY_AND_ASSIGN(CertificateManagerHandler); |
| 151 }; | 159 }; |
| 152 | 160 |
| 153 #endif // CHROME_BROWSER_DOM_UI_OPTIONS_CERTIFICATE_MANAGER_HANDLER_H_ | 161 #endif // CHROME_BROWSER_DOM_UI_OPTIONS_CERTIFICATE_MANAGER_HANDLER_H_ |
| OLD | NEW |