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

Side by Side Diff: chrome/browser/ui/webui/options/import_data_handler.h

Issue 22560003: Reland "Add option to import from bookmarks html file to ..."" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: does this fix first run browser_tests for bots? Created 7 years, 4 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) 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"
15 16
16 class ExternalProcessImporterHost; 17 class ExternalProcessImporterHost;
17 class ImporterList; 18 class ImporterList;
18 19
19 namespace options { 20 namespace options {
20 21
21 // Chrome personal stuff import data overlay UI handler. 22 // Chrome personal stuff import data overlay UI handler.
22 class ImportDataHandler : public OptionsPageUIHandler, 23 class ImportDataHandler : public OptionsPageUIHandler,
23 public importer::ImporterListObserver, 24 public importer::ImporterListObserver,
24 public importer::ImporterProgressObserver { 25 public importer::ImporterProgressObserver,
26 public ui::SelectFileDialog::Listener {
25 public: 27 public:
26 ImportDataHandler(); 28 ImportDataHandler();
27 virtual ~ImportDataHandler(); 29 virtual ~ImportDataHandler();
28 30
29 // OptionsPageUIHandler: 31 // OptionsPageUIHandler:
30 virtual void GetLocalizedValues( 32 virtual void GetLocalizedValues(
31 base::DictionaryValue* localized_strings) OVERRIDE; 33 base::DictionaryValue* localized_strings) OVERRIDE;
32 virtual void InitializeHandler() OVERRIDE; 34 virtual void InitializeHandler() OVERRIDE;
33 virtual void InitializePage() OVERRIDE; 35 virtual void InitializePage() OVERRIDE;
34 36
35 // WebUIMessageHandler: 37 // content::WebUIMessageHandler:
36 virtual void RegisterMessages() OVERRIDE; 38 virtual void RegisterMessages() OVERRIDE;
37 39
38 private: 40 private:
39 void ImportData(const base::ListValue* args); 41 void ImportData(const base::ListValue* args);
40 42
41 // importer::ImporterListObserver: 43 // importer::ImporterListObserver:
42 virtual void OnSourceProfilesLoaded() OVERRIDE; 44 virtual void OnSourceProfilesLoaded() OVERRIDE;
43 45
44 // importer::ImporterProgressObserver: 46 // importer::ImporterProgressObserver:
45 virtual void ImportStarted() OVERRIDE; 47 virtual void ImportStarted() OVERRIDE;
46 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE; 48 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE;
47 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE; 49 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE;
48 virtual void ImportEnded() OVERRIDE; 50 virtual void ImportEnded() OVERRIDE;
49 51
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
50 scoped_refptr<ImporterList> importer_list_; 60 scoped_refptr<ImporterList> importer_list_;
51 61
52 // If non-null it means importing is in progress. ImporterHost takes care 62 // If non-null it means importing is in progress. ImporterHost takes care
53 // of deleting itself when import is complete. 63 // of deleting itself when import is complete.
54 ExternalProcessImporterHost* importer_host_; // weak 64 ExternalProcessImporterHost* importer_host_; // weak
55 65
56 bool import_did_succeed_; 66 bool import_did_succeed_;
57 67
68 scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
69
58 DISALLOW_COPY_AND_ASSIGN(ImportDataHandler); 70 DISALLOW_COPY_AND_ASSIGN(ImportDataHandler);
59 }; 71 };
60 72
61 } // namespace options 73 } // namespace options
62 74
63 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_IMPORT_DATA_HANDLER_H_ 75 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_IMPORT_DATA_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698