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

Side by Side Diff: chrome/browser/extensions/external_pref_loader.h

Issue 957753002: Install default apps if sync is disabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't use debug defines. Created 5 years, 10 months 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_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 <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/scoped_observer.h" 12 #include "base/scoped_observer.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/extensions/external_loader.h" 14 #include "chrome/browser/extensions/external_loader.h"
15 #include "chrome/browser/prefs/pref_service_syncable_observer.h" 15 #include "chrome/browser/prefs/pref_service_syncable_observer.h"
16 #include "chrome/browser/sync/profile_sync_service.h"
17 #include "chrome/browser/sync/profile_sync_service_observer.h"
16 18
17 class PrefServiceSyncable; 19 class PrefServiceSyncable;
18 class Profile; 20 class Profile;
19 21
20 namespace extensions { 22 namespace extensions {
21 23
22 // A specialization of the ExternalLoader that uses a json file to 24 // A specialization of the ExternalLoader that uses a json file to
23 // look up which external extensions are registered. 25 // look up which external extensions are registered.
24 // Instances of this class are expected to be created and destroyed on the UI 26 // Instances of this class are expected to be created and destroyed on the UI
25 // thread and they are expecting public method calls from the UI thread. 27 // thread and they are expecting public method calls from the UI thread.
26 class ExternalPrefLoader : public ExternalLoader, 28 class ExternalPrefLoader : public ExternalLoader,
27 public PrefServiceSyncableObserver { 29 public PrefServiceSyncableObserver,
30 public ProfileSyncServiceObserver {
28 public: 31 public:
29 enum Options { 32 enum Options {
30 NONE = 0, 33 NONE = 0,
31 34
32 // Ensure that only root can force an external install by checking 35 // Ensure that only root can force an external install by checking
33 // that all components of the path to external extensions files are 36 // that all components of the path to external extensions files are
34 // owned by root and not writable by any non-root user. 37 // owned by root and not writable by any non-root user.
35 ENSURE_PATH_CONTROLLED_BY_ADMIN = 1 << 0, 38 ENSURE_PATH_CONTROLLED_BY_ADMIN = 1 << 0,
36 39
37 // Delay external preference load. It delays default apps installation 40 // Delay external preference load. It delays default apps installation
(...skipping 22 matching lines...) Expand all
60 const int base_path_id_; 63 const int base_path_id_;
61 64
62 const Options options_; 65 const Options options_;
63 66
64 private: 67 private:
65 friend class base::RefCountedThreadSafe<ExternalLoader>; 68 friend class base::RefCountedThreadSafe<ExternalLoader>;
66 69
67 // PrefServiceSyncableObserver: 70 // PrefServiceSyncableObserver:
68 void OnIsSyncingChanged() override; 71 void OnIsSyncingChanged() override;
69 72
73 // ProfileSyncServiceObserver
74 void OnStateChanged() override;
75
70 // If priority sync ready posts LoadOnFileThread and return true. 76 // If priority sync ready posts LoadOnFileThread and return true.
71 bool PostLoadIfPrioritySyncReady(); 77 bool PostLoadIfPrioritySyncReady();
72 78
79 // Post LoadOnFileThread and stop observing for sync service states.
80 void PostLoadAndRemoveObservers();
81
73 // Actually searches for and loads candidate standalone extension preference 82 // Actually searches for and loads candidate standalone extension preference
74 // files in the path corresponding to |base_path_id|. 83 // files in the path corresponding to |base_path_id|.
75 // Must be called on the file thread. 84 // Must be called on the file thread.
76 void LoadOnFileThread(); 85 void LoadOnFileThread();
77 86
78 // Extracts the information contained in an external_extension.json file 87 // Extracts the information contained in an external_extension.json file
79 // regarding which extensions to install. |prefs| will be modified to 88 // regarding which extensions to install. |prefs| will be modified to
80 // receive the extracted extension information. 89 // receive the extracted extension information.
81 // Must be called from the File thread. 90 // Must be called from the File thread.
82 void ReadExternalExtensionPrefFile(base::DictionaryValue* prefs); 91 void ReadExternalExtensionPrefFile(base::DictionaryValue* prefs);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 131
123 base::FilePath fake_base_path_; 132 base::FilePath fake_base_path_;
124 scoped_ptr<base::DictionaryValue> testing_prefs_; 133 scoped_ptr<base::DictionaryValue> testing_prefs_;
125 134
126 DISALLOW_COPY_AND_ASSIGN(ExternalTestingLoader); 135 DISALLOW_COPY_AND_ASSIGN(ExternalTestingLoader);
127 }; 136 };
128 137
129 } // namespace extensions 138 } // namespace extensions
130 139
131 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_LOADER_H_ 140 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_LOADER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/external_pref_loader.cc » ('j') | chrome/browser/extensions/external_pref_loader.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698