| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/extensions/api/preference/chrome_direct_setting_api.h" | 5 #include "chrome/browser/extensions/api/preference/chrome_direct_setting_api.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 registrar->Add(pref_key, callback); | 69 registrar->Add(pref_key, callback); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 base::hash_set<std::string> whitelist_; | 74 base::hash_set<std::string> whitelist_; |
| 75 | 75 |
| 76 DISALLOW_COPY_AND_ASSIGN(PreferenceWhitelist); | 76 DISALLOW_COPY_AND_ASSIGN(PreferenceWhitelist); |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 base::LazyInstance<PreferenceWhitelist> preference_whitelist = | 79 base::LazyInstance<PreferenceWhitelist>::DestructorAtExit preference_whitelist = |
| 80 LAZY_INSTANCE_INITIALIZER; | 80 LAZY_INSTANCE_INITIALIZER; |
| 81 | 81 |
| 82 static base::LazyInstance< | 82 static base::LazyInstance< |
| 83 BrowserContextKeyedAPIFactory<ChromeDirectSettingAPI> > g_factory = | 83 BrowserContextKeyedAPIFactory<ChromeDirectSettingAPI>>::DestructorAtExit |
| 84 LAZY_INSTANCE_INITIALIZER; | 84 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 85 | 85 |
| 86 ChromeDirectSettingAPI::ChromeDirectSettingAPI(content::BrowserContext* context) | 86 ChromeDirectSettingAPI::ChromeDirectSettingAPI(content::BrowserContext* context) |
| 87 : profile_(Profile::FromBrowserContext(context)) { | 87 : profile_(Profile::FromBrowserContext(context)) { |
| 88 preference_whitelist.Get().RegisterEventListeners(profile_, this); | 88 preference_whitelist.Get().RegisterEventListeners(profile_, this); |
| 89 } | 89 } |
| 90 | 90 |
| 91 ChromeDirectSettingAPI::~ChromeDirectSettingAPI() {} | 91 ChromeDirectSettingAPI::~ChromeDirectSettingAPI() {} |
| 92 | 92 |
| 93 // KeyedService implementation. | 93 // KeyedService implementation. |
| 94 void ChromeDirectSettingAPI::Shutdown() {} | 94 void ChromeDirectSettingAPI::Shutdown() {} |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 std::unique_ptr<Event> event( | 160 std::unique_ptr<Event> event( |
| 161 new Event(histogram_value, event_name, std::move(args_copy))); | 161 new Event(histogram_value, event_name, std::move(args_copy))); |
| 162 router->DispatchEventToExtension(extension_id, std::move(event)); | 162 router->DispatchEventToExtension(extension_id, std::move(event)); |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace chromedirectsetting | 168 } // namespace chromedirectsetting |
| 169 } // namespace extensions | 169 } // namespace extensions |
| OLD | NEW |