| 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_EXTENSIONS_EXTERNAL_PREF_LOADER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_LOADER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_LOADER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_LOADER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace extensions { | 26 namespace extensions { |
| 27 | 27 |
| 28 // A specialization of the ExternalLoader that uses a json file to | 28 // A specialization of the ExternalLoader that uses a json file to |
| 29 // look up which external extensions are registered. | 29 // look up which external extensions are registered. |
| 30 // Instances of this class are expected to be created and destroyed on the UI | 30 // Instances of this class are expected to be created and destroyed on the UI |
| 31 // thread and they are expecting public method calls from the UI thread. | 31 // thread and they are expecting public method calls from the UI thread. |
| 32 class ExternalPrefLoader : public ExternalLoader, | 32 class ExternalPrefLoader : public ExternalLoader, |
| 33 public syncable_prefs::PrefServiceSyncableObserver, | 33 public syncable_prefs::PrefServiceSyncableObserver, |
| 34 public sync_driver::SyncServiceObserver { | 34 public syncer::SyncServiceObserver { |
| 35 public: | 35 public: |
| 36 enum Options { | 36 enum Options { |
| 37 NONE = 0, | 37 NONE = 0, |
| 38 | 38 |
| 39 // Ensure that only root can force an external install by checking | 39 // Ensure that only root can force an external install by checking |
| 40 // that all components of the path to external extensions files are | 40 // that all components of the path to external extensions files are |
| 41 // owned by root and not writable by any non-root user. | 41 // owned by root and not writable by any non-root user. |
| 42 ENSURE_PATH_CONTROLLED_BY_ADMIN = 1 << 0, | 42 ENSURE_PATH_CONTROLLED_BY_ADMIN = 1 << 0, |
| 43 | 43 |
| 44 // Delay external preference load. It delays default apps installation | 44 // Delay external preference load. It delays default apps installation |
| (...skipping 22 matching lines...) Expand all Loading... |
| 67 const int base_path_id_; | 67 const int base_path_id_; |
| 68 | 68 |
| 69 const Options options_; | 69 const Options options_; |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 friend class base::RefCountedThreadSafe<ExternalLoader>; | 72 friend class base::RefCountedThreadSafe<ExternalLoader>; |
| 73 | 73 |
| 74 // syncable_prefs::PrefServiceSyncableObserver: | 74 // syncable_prefs::PrefServiceSyncableObserver: |
| 75 void OnIsSyncingChanged() override; | 75 void OnIsSyncingChanged() override; |
| 76 | 76 |
| 77 // sync_driver::SyncServiceObserver | 77 // syncer::SyncServiceObserver |
| 78 void OnStateChanged() override; | 78 void OnStateChanged() override; |
| 79 | 79 |
| 80 // If priority sync ready posts LoadOnFileThread and return true. | 80 // If priority sync ready posts LoadOnFileThread and return true. |
| 81 bool PostLoadIfPrioritySyncReady(); | 81 bool PostLoadIfPrioritySyncReady(); |
| 82 | 82 |
| 83 // Post LoadOnFileThread and stop observing for sync service states. | 83 // Post LoadOnFileThread and stop observing for sync service states. |
| 84 void PostLoadAndRemoveObservers(); | 84 void PostLoadAndRemoveObservers(); |
| 85 | 85 |
| 86 // Actually searches for and loads candidate standalone extension preference | 86 // Actually searches for and loads candidate standalone extension preference |
| 87 // files in the path corresponding to |base_path_id|. | 87 // files in the path corresponding to |base_path_id|. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 base::FilePath fake_base_path_; | 137 base::FilePath fake_base_path_; |
| 138 std::unique_ptr<base::DictionaryValue> testing_prefs_; | 138 std::unique_ptr<base::DictionaryValue> testing_prefs_; |
| 139 | 139 |
| 140 DISALLOW_COPY_AND_ASSIGN(ExternalTestingLoader); | 140 DISALLOW_COPY_AND_ASSIGN(ExternalTestingLoader); |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 } // namespace extensions | 143 } // namespace extensions |
| 144 | 144 |
| 145 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_LOADER_H_ | 145 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_LOADER_H_ |
| OLD | NEW |