| 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_IMPORTER_EXTERNAL_PROCESS_IMPORTER_HOST_H_ | 5 #ifndef CHROME_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_HOST_H_ |
| 6 #define CHROME_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_HOST_H_ | 6 #define CHROME_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_HOST_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include <stdint.h> |
| 9 |
| 9 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 13 #include "chrome/browser/importer/importer_progress_observer.h" | 15 #include "chrome/browser/importer/importer_progress_observer.h" |
| 14 #include "chrome/browser/importer/profile_writer.h" | 16 #include "chrome/browser/importer/profile_writer.h" |
| 15 #include "chrome/common/importer/importer_data_types.h" | 17 #include "chrome/common/importer/importer_data_types.h" |
| 16 #include "components/bookmarks/browser/base_bookmark_model_observer.h" | 18 #include "components/bookmarks/browser/base_bookmark_model_observer.h" |
| 17 #include "components/search_engines/template_url_service.h" | 19 #include "components/search_engines/template_url_service.h" |
| 18 #include "ui/gfx/native_widget_types.h" | 20 #include "ui/gfx/native_widget_types.h" |
| 19 | 21 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 37 | 39 |
| 38 // Starts the process of importing the settings and data depending on what the | 40 // Starts the process of importing the settings and data depending on what the |
| 39 // user selected. | 41 // user selected. |
| 40 // |source_profile| - importer profile to import. | 42 // |source_profile| - importer profile to import. |
| 41 // |target_profile| - profile to import into. | 43 // |target_profile| - profile to import into. |
| 42 // |items| - specifies which data to import (bitmask of importer::ImportItem). | 44 // |items| - specifies which data to import (bitmask of importer::ImportItem). |
| 43 // |writer| - called to actually write data back to the profile. | 45 // |writer| - called to actually write data back to the profile. |
| 44 virtual void StartImportSettings( | 46 virtual void StartImportSettings( |
| 45 const importer::SourceProfile& source_profile, | 47 const importer::SourceProfile& source_profile, |
| 46 Profile* target_profile, | 48 Profile* target_profile, |
| 47 uint16 items, | 49 uint16_t items, |
| 48 ProfileWriter* writer); | 50 ProfileWriter* writer); |
| 49 | 51 |
| 50 // When in headless mode, the importer will not show any warning dialog if | 52 // When in headless mode, the importer will not show any warning dialog if |
| 51 // a user action is required (e.g., Firefox profile is locked and user should | 53 // a user action is required (e.g., Firefox profile is locked and user should |
| 52 // close Firefox to continue) and the outcome is as if the user had canceled | 54 // close Firefox to continue) and the outcome is as if the user had canceled |
| 53 // the import operation. | 55 // the import operation. |
| 54 void set_headless() { headless_ = true; } | 56 void set_headless() { headless_ = true; } |
| 55 bool is_headless() const { return headless_; } | 57 bool is_headless() const { return headless_; } |
| 56 | 58 |
| 57 void set_parent_window(gfx::NativeWindow parent_window) { | 59 void set_parent_window(gfx::NativeWindow parent_window) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // Make sure that Firefox isn't running, if import browser is Firefox. Show | 104 // Make sure that Firefox isn't running, if import browser is Firefox. Show |
| 103 // to the user a dialog that notifies that is necessary to close Firefox | 105 // to the user a dialog that notifies that is necessary to close Firefox |
| 104 // prior to continue. | 106 // prior to continue. |
| 105 // |source_profile| - importer profile to import. | 107 // |source_profile| - importer profile to import. |
| 106 // Returns false iff import should be aborted. | 108 // Returns false iff import should be aborted. |
| 107 bool CheckForFirefoxLock(const importer::SourceProfile& source_profile); | 109 bool CheckForFirefoxLock(const importer::SourceProfile& source_profile); |
| 108 | 110 |
| 109 // Make sure BookmarkModel and TemplateURLService are loaded before import | 111 // Make sure BookmarkModel and TemplateURLService are loaded before import |
| 110 // process starts, if bookmarks and/or search engines are among the items | 112 // process starts, if bookmarks and/or search engines are among the items |
| 111 // which are to be imported. | 113 // which are to be imported. |
| 112 void CheckForLoadedModels(uint16 items); | 114 void CheckForLoadedModels(uint16_t items); |
| 113 | 115 |
| 114 // True if UI is not to be shown. | 116 // True if UI is not to be shown. |
| 115 bool headless_; | 117 bool headless_; |
| 116 | 118 |
| 117 // Parent window that we pass to the import lock dialog (i.e, the Firefox | 119 // Parent window that we pass to the import lock dialog (i.e, the Firefox |
| 118 // warning dialog). | 120 // warning dialog). |
| 119 gfx::NativeWindow parent_window_; | 121 gfx::NativeWindow parent_window_; |
| 120 | 122 |
| 121 // The observer that we need to notify about changes in the import process. | 123 // The observer that we need to notify about changes in the import process. |
| 122 importer::ImporterProgressObserver* observer_; | 124 importer::ImporterProgressObserver* observer_; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 143 // Writes data from the importer back to the profile. | 145 // Writes data from the importer back to the profile. |
| 144 scoped_refptr<ProfileWriter> writer_; | 146 scoped_refptr<ProfileWriter> writer_; |
| 145 | 147 |
| 146 // Used to pass notifications from the browser side to the external process. | 148 // Used to pass notifications from the browser side to the external process. |
| 147 ExternalProcessImporterClient* client_; | 149 ExternalProcessImporterClient* client_; |
| 148 | 150 |
| 149 // Information about a profile needed for importing. | 151 // Information about a profile needed for importing. |
| 150 importer::SourceProfile source_profile_; | 152 importer::SourceProfile source_profile_; |
| 151 | 153 |
| 152 // Bitmask of items to be imported (see importer::ImportItem enum). | 154 // Bitmask of items to be imported (see importer::ImportItem enum). |
| 153 uint16 items_; | 155 uint16_t items_; |
| 154 | 156 |
| 155 // True if the import process has been cancelled. | 157 // True if the import process has been cancelled. |
| 156 bool cancelled_; | 158 bool cancelled_; |
| 157 | 159 |
| 158 // Vends weak pointers for the importer to call us back. | 160 // Vends weak pointers for the importer to call us back. |
| 159 base::WeakPtrFactory<ExternalProcessImporterHost> weak_ptr_factory_; | 161 base::WeakPtrFactory<ExternalProcessImporterHost> weak_ptr_factory_; |
| 160 | 162 |
| 161 DISALLOW_COPY_AND_ASSIGN(ExternalProcessImporterHost); | 163 DISALLOW_COPY_AND_ASSIGN(ExternalProcessImporterHost); |
| 162 }; | 164 }; |
| 163 | 165 |
| 164 #endif // CHROME_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_HOST_H_ | 166 #endif // CHROME_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_HOST_H_ |
| OLD | NEW |