| 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_IMPORTER_LIST_H_ | 5 #ifndef CHROME_BROWSER_IMPORTER_IMPORTER_LIST_H_ |
| 6 #define CHROME_BROWSER_IMPORTER_IMPORTER_LIST_H_ | 6 #define CHROME_BROWSER_IMPORTER_IMPORTER_LIST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 #include "base/memory/scoped_vector.h" | |
| 14 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 15 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 16 | 15 #include "chrome/common/importer/importer_data_types.h" |
| 17 namespace importer { | |
| 18 struct SourceProfile; | |
| 19 } | |
| 20 | 16 |
| 21 // ImporterList detects installed browsers and profiles via | 17 // ImporterList detects installed browsers and profiles via |
| 22 // DetectSourceProfilesWorker(). ImporterList lives on the UI thread. | 18 // DetectSourceProfilesWorker(). ImporterList lives on the UI thread. |
| 23 class ImporterList { | 19 class ImporterList { |
| 24 public: | 20 public: |
| 25 ImporterList(); | 21 ImporterList(); |
| 26 ~ImporterList(); | 22 ~ImporterList(); |
| 27 | 23 |
| 28 // Detects the installed browsers and their associated profiles, then stores | 24 // Detects the installed browsers and their associated profiles, then stores |
| 29 // their information in a list to be accessed via count() and | 25 // their information in a list to be accessed via count() and |
| (...skipping 10 matching lines...) Expand all Loading... |
| 40 | 36 |
| 41 // Returns the number of different source profiles you can import from. | 37 // Returns the number of different source profiles you can import from. |
| 42 size_t count() const { return source_profiles_.size(); } | 38 size_t count() const { return source_profiles_.size(); } |
| 43 | 39 |
| 44 // Returns the SourceProfile at |index|. The profiles are ordered such that | 40 // Returns the SourceProfile at |index|. The profiles are ordered such that |
| 45 // the profile at index 0 is the likely default browser. The SourceProfile | 41 // the profile at index 0 is the likely default browser. The SourceProfile |
| 46 // should be passed to ImporterHost::StartImportSettings(). | 42 // should be passed to ImporterHost::StartImportSettings(). |
| 47 const importer::SourceProfile& GetSourceProfileAt(size_t index) const; | 43 const importer::SourceProfile& GetSourceProfileAt(size_t index) const; |
| 48 | 44 |
| 49 private: | 45 private: |
| 50 // Called when the source profiles are loaded. Takes ownership of the | 46 // Called when the source profiles are loaded. Copies the loaded profiles |
| 51 // loaded profiles in |profiles| and calls |profiles_loaded_callback|. | 47 // in |profiles| and calls |profiles_loaded_callback|. |
| 52 void SourceProfilesLoaded( | 48 void SourceProfilesLoaded( |
| 53 const base::Closure& profiles_loaded_callback, | 49 const base::Closure& profiles_loaded_callback, |
| 54 const std::vector<importer::SourceProfile*>& profiles); | 50 const std::vector<importer::SourceProfile>& profiles); |
| 55 | 51 |
| 56 // The list of profiles with the default one first. | 52 // The list of profiles with the default one first. |
| 57 ScopedVector<importer::SourceProfile> source_profiles_; | 53 std::vector<importer::SourceProfile> source_profiles_; |
| 58 | 54 |
| 59 base::WeakPtrFactory<ImporterList> weak_ptr_factory_; | 55 base::WeakPtrFactory<ImporterList> weak_ptr_factory_; |
| 60 | 56 |
| 61 DISALLOW_COPY_AND_ASSIGN(ImporterList); | 57 DISALLOW_COPY_AND_ASSIGN(ImporterList); |
| 62 }; | 58 }; |
| 63 | 59 |
| 64 #endif // CHROME_BROWSER_IMPORTER_IMPORTER_LIST_H_ | 60 #endif // CHROME_BROWSER_IMPORTER_IMPORTER_LIST_H_ |
| OLD | NEW |