OLD | NEW |
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_WEBUI_OPTIONS_IMPORT_DATA_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_IMPORT_DATA_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_IMPORT_DATA_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_IMPORT_DATA_HANDLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "chrome/browser/importer/importer_list_observer.h" | 11 #include "chrome/browser/importer/importer_list_observer.h" |
12 #include "chrome/browser/importer/importer_progress_observer.h" | 12 #include "chrome/browser/importer/importer_progress_observer.h" |
13 #include "chrome/browser/ui/webui/options/options_ui.h" | 13 #include "chrome/browser/ui/webui/options/options_ui.h" |
14 #include "chrome/common/importer/importer_data_types.h" | 14 #include "chrome/common/importer/importer_data_types.h" |
15 #include "ui/shell_dialogs/select_file_dialog.h" | |
16 | 15 |
17 class ExternalProcessImporterHost; | 16 class ExternalProcessImporterHost; |
18 class ImporterList; | 17 class ImporterList; |
19 | 18 |
20 namespace options { | 19 namespace options { |
21 | 20 |
22 // Chrome personal stuff import data overlay UI handler. | 21 // Chrome personal stuff import data overlay UI handler. |
23 class ImportDataHandler : public OptionsPageUIHandler, | 22 class ImportDataHandler : public OptionsPageUIHandler, |
24 public importer::ImporterListObserver, | 23 public importer::ImporterListObserver, |
25 public importer::ImporterProgressObserver, | 24 public importer::ImporterProgressObserver { |
26 public ui::SelectFileDialog::Listener { | |
27 public: | 25 public: |
28 ImportDataHandler(); | 26 ImportDataHandler(); |
29 virtual ~ImportDataHandler(); | 27 virtual ~ImportDataHandler(); |
30 | 28 |
31 // OptionsPageUIHandler: | 29 // OptionsPageUIHandler: |
32 virtual void GetLocalizedValues( | 30 virtual void GetLocalizedValues( |
33 base::DictionaryValue* localized_strings) OVERRIDE; | 31 base::DictionaryValue* localized_strings) OVERRIDE; |
34 virtual void InitializeHandler() OVERRIDE; | 32 virtual void InitializeHandler() OVERRIDE; |
35 virtual void InitializePage() OVERRIDE; | 33 virtual void InitializePage() OVERRIDE; |
36 | 34 |
37 // content::WebUIMessageHandler: | 35 // WebUIMessageHandler: |
38 virtual void RegisterMessages() OVERRIDE; | 36 virtual void RegisterMessages() OVERRIDE; |
39 | 37 |
40 private: | 38 private: |
41 void ImportData(const base::ListValue* args); | 39 void ImportData(const base::ListValue* args); |
42 | 40 |
43 // importer::ImporterListObserver: | 41 // importer::ImporterListObserver: |
44 virtual void OnSourceProfilesLoaded() OVERRIDE; | 42 virtual void OnSourceProfilesLoaded() OVERRIDE; |
45 | 43 |
46 // importer::ImporterProgressObserver: | 44 // importer::ImporterProgressObserver: |
47 virtual void ImportStarted() OVERRIDE; | 45 virtual void ImportStarted() OVERRIDE; |
48 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE; | 46 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE; |
49 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE; | 47 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE; |
50 virtual void ImportEnded() OVERRIDE; | 48 virtual void ImportEnded() OVERRIDE; |
51 | 49 |
52 // ui::SelectFileDialog::Listener: | |
53 virtual void FileSelected(const base::FilePath& path, | |
54 int index, | |
55 void* params) OVERRIDE; | |
56 | |
57 // Opens a file selection dialog to choose the bookmarks HTML file. | |
58 void HandleChooseBookmarksFile(const base::ListValue* args); | |
59 | |
60 scoped_refptr<ImporterList> importer_list_; | 50 scoped_refptr<ImporterList> importer_list_; |
61 | 51 |
62 // If non-null it means importing is in progress. ImporterHost takes care | 52 // If non-null it means importing is in progress. ImporterHost takes care |
63 // of deleting itself when import is complete. | 53 // of deleting itself when import is complete. |
64 ExternalProcessImporterHost* importer_host_; // weak | 54 ExternalProcessImporterHost* importer_host_; // weak |
65 | 55 |
66 bool import_did_succeed_; | 56 bool import_did_succeed_; |
67 | 57 |
68 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; | |
69 | |
70 DISALLOW_COPY_AND_ASSIGN(ImportDataHandler); | 58 DISALLOW_COPY_AND_ASSIGN(ImportDataHandler); |
71 }; | 59 }; |
72 | 60 |
73 } // namespace options | 61 } // namespace options |
74 | 62 |
75 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_IMPORT_DATA_HANDLER_H_ | 63 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_IMPORT_DATA_HANDLER_H_ |
OLD | NEW |