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_LOADER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_LOADER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_LOADER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_LOADER_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
9 #include "base/macros.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" | |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 class DictionaryValue; | 15 class DictionaryValue; |
15 } | 16 } |
16 | 17 |
17 namespace extensions { | 18 namespace extensions { |
18 class ExternalProviderImpl; | 19 class ExternalProviderImpl; |
19 | 20 |
20 // Base class for gathering a list of external extensions. Subclasses | 21 // Base class for gathering a list of external extensions. Subclasses |
21 // implement loading from registry, JSON file, policy. | 22 // implement loading from registry, JSON file, policy. |
(...skipping 30 matching lines...) Expand all Loading... |
52 // are not allowed. | 53 // are not allowed. |
53 virtual const base::FilePath GetBaseCrxFilePath(); | 54 virtual const base::FilePath GetBaseCrxFilePath(); |
54 | 55 |
55 protected: | 56 protected: |
56 virtual ~ExternalLoader(); | 57 virtual ~ExternalLoader(); |
57 | 58 |
58 // Notifies the provider that the list of extensions has been loaded. | 59 // Notifies the provider that the list of extensions has been loaded. |
59 virtual void LoadFinished(); | 60 virtual void LoadFinished(); |
60 | 61 |
61 // Notifies the provider that the list of extensions has been updated. | 62 // Notifies the provider that the list of extensions has been updated. |
62 virtual void OnUpdated(scoped_ptr<base::DictionaryValue> updated_prefs); | 63 virtual void OnUpdated(std::unique_ptr<base::DictionaryValue> updated_prefs); |
63 | 64 |
64 // Used for passing the list of extensions from the method that loads them | 65 // Used for passing the list of extensions from the method that loads them |
65 // to |LoadFinished|. To ensure thread safety, the rules are the following: | 66 // to |LoadFinished|. To ensure thread safety, the rules are the following: |
66 // if this value is written on another thread than the UI, then it should | 67 // if this value is written on another thread than the UI, then it should |
67 // only be written in a task that was posted from |StartLoading|. After that, | 68 // only be written in a task that was posted from |StartLoading|. After that, |
68 // this task should invoke |LoadFinished| with a PostTask. This scheme of | 69 // this task should invoke |LoadFinished| with a PostTask. This scheme of |
69 // posting tasks will avoid concurrent access and imply the necessary memory | 70 // posting tasks will avoid concurrent access and imply the necessary memory |
70 // barriers. | 71 // barriers. |
71 scoped_ptr<base::DictionaryValue> prefs_; | 72 std::unique_ptr<base::DictionaryValue> prefs_; |
72 | 73 |
73 private: | 74 private: |
74 friend class base::RefCountedThreadSafe<ExternalLoader>; | 75 friend class base::RefCountedThreadSafe<ExternalLoader>; |
75 | 76 |
76 ExternalProviderImpl* owner_; // weak | 77 ExternalProviderImpl* owner_; // weak |
77 | 78 |
78 DISALLOW_COPY_AND_ASSIGN(ExternalLoader); | 79 DISALLOW_COPY_AND_ASSIGN(ExternalLoader); |
79 }; | 80 }; |
80 | 81 |
81 } // namespace extensions | 82 } // namespace extensions |
82 | 83 |
83 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_LOADER_H_ | 84 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_LOADER_H_ |
OLD | NEW |