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

Side by Side Diff: chrome/utility/profile_import_handler.h

Issue 2470283002: Convert profile import IPCs to Mojo (Closed)
Patch Set: Use correct int types Created 4 years, 1 month 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
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_UTILITY_PROFILE_IMPORT_HANDLER_H_ 5 #ifndef CHROME_UTILITY_PROFILE_IMPORT_HANDLER_H_
6 #define CHROME_UTILITY_PROFILE_IMPORT_HANDLER_H_ 6 #define CHROME_UTILITY_PROFILE_IMPORT_HANDLER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "chrome/common/importer/profile_import.mojom.h"
14 #include "chrome/utility/utility_message_handler.h" 15 #include "chrome/utility/utility_message_handler.h"
16 #include "mojo/public/cpp/bindings/interface_request.h"
15 17
16 class ExternalProcessImporterBridge; 18 class ExternalProcessImporterBridge;
17 class Importer; 19 class Importer;
18 20
19 namespace base { 21 namespace base {
20 class DictionaryValue; 22 class DictionaryValue;
21 class Thread; 23 class Thread;
22 } 24 }
23 25
24 namespace importer { 26 namespace importer {
25 struct SourceProfile; 27 struct SourceProfile;
26 } 28 }
27 29
28 // Dispatches IPCs for out of process profile import. 30 // Dispatches IPCs for out of process profile import.
29 class ProfileImportHandler : public UtilityMessageHandler { 31 class ProfileImportHandler : public chrome::mojom::ProfileImport {
30 public: 32 public:
31 ProfileImportHandler(); 33 ProfileImportHandler();
32 ~ProfileImportHandler() override; 34 ~ProfileImportHandler() override;
33 35
34 // IPC::Listener: 36 static void Create(
35 bool OnMessageReceived(const IPC::Message& message) override; 37 mojo::InterfaceRequest<chrome::mojom::ProfileImport> request);
36 38
37 private: 39 private:
38 void OnImportStart(const importer::SourceProfile& source_profile, 40 // chrome::mojom::ProfileImport:
39 uint16_t items, 41 void StartImport(const importer::SourceProfile& source_profile,
40 const base::DictionaryValue& localized_strings); 42 uint16_t items,
41 void OnImportCancel(); 43 const base::DictionaryValue& localized_strings,
42 void OnImportItemFinished(uint16_t item); 44 chrome::mojom::ProfileImportObserverPtr observer) override;
45 void CancelImport() override;
46 void ReportImportItemFinished(importer::ImportItem item) override;
43 47
44 // The following are used with out of process profile import: 48 // The following are used with out of process profile import:
45 void ImporterCleanup(); 49 void ImporterCleanup();
46 50
47 // Thread that importer runs on, while ProfileImportThread handles messages 51 // Thread that importer runs on, while ProfileImportThread handles messages
48 // from the browser process. 52 // from the browser process.
49 std::unique_ptr<base::Thread> import_thread_; 53 std::unique_ptr<base::Thread> import_thread_;
50 54
51 // Bridge object is passed to importer, so that it can send IPC calls 55 // Bridge object is passed to importer, so that it can send IPC calls
52 // directly back to the ProfileImportProcessHost. 56 // directly back to the ProfileImportProcessHost.
53 scoped_refptr<ExternalProcessImporterBridge> bridge_; 57 scoped_refptr<ExternalProcessImporterBridge> bridge_;
54 58
55 // A bitmask of importer::ImportItem. 59 // A bitmask of importer::ImportItem.
56 uint16_t items_to_import_; 60 uint16_t items_to_import_;
57 61
58 // Importer of the appropriate type (Firefox, Safari, IE, etc.) 62 // Importer of the appropriate type (Firefox, Safari, IE, etc.)
59 scoped_refptr<Importer> importer_; 63 scoped_refptr<Importer> importer_;
64
65 chrome::mojom::ProfileImportObserverPtr observer_;
60 }; 66 };
sky 2016/11/14 23:12:18 DISALLOW...
tibell 2016/11/29 05:06:28 Done.
61 67
62 #endif // CHROME_UTILITY_PROFILE_IMPORT_HANDLER_H_ 68 #endif // CHROME_UTILITY_PROFILE_IMPORT_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698