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 |
(...skipping 11 matching lines...) Expand all Loading... |
22 class ImporterList : public base::RefCountedThreadSafe<ImporterList> { | 22 class ImporterList : public base::RefCountedThreadSafe<ImporterList> { |
23 public: | 23 public: |
24 ImporterList(); | 24 ImporterList(); |
25 | 25 |
26 // Detects the installed browsers and their associated profiles, then stores | 26 // Detects the installed browsers and their associated profiles, then stores |
27 // their information in a list. It returns the list of description of all | 27 // their information in a list. It returns the list of description of all |
28 // profiles. Calls into DetectSourceProfilesWorker() on the FILE thread to do | 28 // profiles. Calls into DetectSourceProfilesWorker() on the FILE thread to do |
29 // the real work of detecting source profiles. |observer| must be non-NULL. | 29 // the real work of detecting source profiles. |observer| must be non-NULL. |
30 // |locale|: As in DetectSourceProfilesWorker(). | 30 // |locale|: As in DetectSourceProfilesWorker(). |
31 void DetectSourceProfiles(const std::string& locale, | 31 void DetectSourceProfiles(const std::string& locale, |
| 32 bool include_interactive_profiles, |
32 importer::ImporterListObserver* observer); | 33 importer::ImporterListObserver* observer); |
33 | 34 |
34 // Sets the observer of this object. When the current observer is destroyed, | 35 // Sets the observer of this object. When the current observer is destroyed, |
35 // this method should be called with a NULL |observer| so it is not notified | 36 // this method should be called with a NULL |observer| so it is not notified |
36 // after destruction. | 37 // after destruction. |
37 void set_observer(importer::ImporterListObserver* observer) { | 38 void set_observer(importer::ImporterListObserver* observer) { |
38 observer_ = observer; | 39 observer_ = observer; |
39 } | 40 } |
40 | 41 |
41 // DEPRECATED: This method is synchronous and performs file operations which | 42 // DEPRECATED: This method is synchronous and performs file operations which |
42 // may end up blocking the current thread, which is usually the UI thread. | 43 // may end up blocking the current thread, which is usually the UI thread. |
43 // |locale|: As in DetectSourceProfilesWorker(). | 44 // |locale|: As in DetectSourceProfilesWorker(). |
44 void DetectSourceProfilesHack(const std::string& locale); | 45 void DetectSourceProfilesHack(const std::string& locale, |
| 46 bool include_interactive_profiles); |
45 | 47 |
46 // Returns the number of different source profiles you can import from. | 48 // Returns the number of different source profiles you can import from. |
47 size_t count() const { return source_profiles_.size(); } | 49 size_t count() const { return source_profiles_.size(); } |
48 | 50 |
49 // Returns the SourceProfile at |index|. The profiles are ordered such that | 51 // Returns the SourceProfile at |index|. The profiles are ordered such that |
50 // the profile at index 0 is the likely default browser. The SourceProfile | 52 // the profile at index 0 is the likely default browser. The SourceProfile |
51 // should be passed to ImporterHost::StartImportSettings(). | 53 // should be passed to ImporterHost::StartImportSettings(). |
52 const importer::SourceProfile& GetSourceProfileAt(size_t index) const; | 54 const importer::SourceProfile& GetSourceProfileAt(size_t index) const; |
53 | 55 |
54 // Returns the SourceProfile for the given |importer_type|. | 56 // Returns the SourceProfile for the given |importer_type|. |
55 const importer::SourceProfile& GetSourceProfileForImporterType( | 57 const importer::SourceProfile& GetSourceProfileForImporterType( |
56 int importer_type) const; | 58 int importer_type) const; |
57 | 59 |
58 // Tells interested callers if class is done loading source profiles. | 60 // Tells interested callers if class is done loading source profiles. |
59 bool source_profiles_loaded() const { return source_profiles_loaded_; } | 61 bool source_profiles_loaded() const { return source_profiles_loaded_; } |
60 | 62 |
61 private: | 63 private: |
62 friend class base::RefCountedThreadSafe<ImporterList>; | 64 friend class base::RefCountedThreadSafe<ImporterList>; |
63 | 65 |
64 ~ImporterList(); | 66 ~ImporterList(); |
65 | 67 |
66 // The worker method for DetectSourceProfiles(). Must be called on the FILE | 68 // The worker method for DetectSourceProfiles(). Must be called on the FILE |
67 // thread. |locale|:The application locale (it must be taken as an argument | 69 // thread. |locale|:The application locale (it must be taken as an argument |
68 // since this code runs on the FILE thread where GetApplicationLocale() isn't | 70 // since this code runs on the FILE thread where GetApplicationLocale() isn't |
69 // available). | 71 // available). |
70 void DetectSourceProfilesWorker(const std::string& locale); | 72 void DetectSourceProfilesWorker(const std::string& locale, |
| 73 bool include_interactive_profiles); |
71 | 74 |
72 // Called by DetectSourceProfilesWorker() on the source thread. This method | 75 // Called by DetectSourceProfilesWorker() on the source thread. This method |
73 // notifies |observer_| that the source profiles are loaded. |profiles| is | 76 // notifies |observer_| that the source profiles are loaded. |profiles| is |
74 // the vector of loaded profiles. | 77 // the vector of loaded profiles. |
75 void SourceProfilesLoaded( | 78 void SourceProfilesLoaded( |
76 const std::vector<importer::SourceProfile*>& profiles); | 79 const std::vector<importer::SourceProfile*>& profiles); |
77 | 80 |
78 // The list of profiles with the default one first. | 81 // The list of profiles with the default one first. |
79 ScopedVector<importer::SourceProfile> source_profiles_; | 82 ScopedVector<importer::SourceProfile> source_profiles_; |
80 | 83 |
(...skipping 12 matching lines...) Expand all Loading... |
93 // TODO(jhawkins): Remove once DetectSourceProfilesHack() is removed. | 96 // TODO(jhawkins): Remove once DetectSourceProfilesHack() is removed. |
94 bool is_observed_; | 97 bool is_observed_; |
95 | 98 |
96 // True if source profiles are loaded. | 99 // True if source profiles are loaded. |
97 bool source_profiles_loaded_; | 100 bool source_profiles_loaded_; |
98 | 101 |
99 DISALLOW_COPY_AND_ASSIGN(ImporterList); | 102 DISALLOW_COPY_AND_ASSIGN(ImporterList); |
100 }; | 103 }; |
101 | 104 |
102 #endif // CHROME_BROWSER_IMPORTER_IMPORTER_LIST_H_ | 105 #endif // CHROME_BROWSER_IMPORTER_IMPORTER_LIST_H_ |
OLD | NEW |