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

Side by Side Diff: chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc

Issue 671783002: Reverting instrumentations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/containers/hash_tables.h" 8 #include "base/containers/hash_tables.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/prefs/pref_change_registrar.h" 10 #include "base/prefs/pref_change_registrar.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/profiler/scoped_profile.h"
13 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
14 #include "chrome/browser/extensions/api/preference/preference_api_constants.h" 13 #include "chrome/browser/extensions/api/preference/preference_api_constants.h"
15 #include "chrome/browser/extensions/extension_service.h" 14 #include "chrome/browser/extensions/extension_service.h"
16 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
17 #include "extensions/browser/extension_system.h" 16 #include "extensions/browser/extension_system.h"
18 17
19 namespace extensions { 18 namespace extensions {
20 namespace chromedirectsetting { 19 namespace chromedirectsetting {
21 20
22 const char kOnPrefChangeFormat[] = 21 const char kOnPrefChangeFormat[] =
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 void ChromeDirectSettingAPI::Shutdown() {} 86 void ChromeDirectSettingAPI::Shutdown() {}
88 87
89 // BrowserContextKeyedAPI implementation. 88 // BrowserContextKeyedAPI implementation.
90 BrowserContextKeyedAPIFactory<ChromeDirectSettingAPI>* 89 BrowserContextKeyedAPIFactory<ChromeDirectSettingAPI>*
91 ChromeDirectSettingAPI::GetFactoryInstance() { 90 ChromeDirectSettingAPI::GetFactoryInstance() {
92 return g_factory.Pointer(); 91 return g_factory.Pointer();
93 } 92 }
94 93
95 // EventRouter::Observer implementation. 94 // EventRouter::Observer implementation.
96 void ChromeDirectSettingAPI::OnListenerAdded(const EventListenerInfo& details) { 95 void ChromeDirectSettingAPI::OnListenerAdded(const EventListenerInfo& details) {
97 // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed.
98 tracked_objects::ScopedProfile tracking_profile(
99 FROM_HERE_WITH_EXPLICIT_FUNCTION(
100 "ChromeDirectSettingAPI::OnListenerAdded"));
101
102 EventRouter::Get(profile_)->UnregisterObserver(this); 96 EventRouter::Get(profile_)->UnregisterObserver(this);
103 registrar_.Init(profile_->GetPrefs()); 97 registrar_.Init(profile_->GetPrefs());
104 preference_whitelist.Get().RegisterPropertyListeners( 98 preference_whitelist.Get().RegisterPropertyListeners(
105 profile_, 99 profile_,
106 &registrar_, 100 &registrar_,
107 base::Bind(&ChromeDirectSettingAPI::OnPrefChanged, 101 base::Bind(&ChromeDirectSettingAPI::OnPrefChanged,
108 base::Unretained(this), 102 base::Unretained(this),
109 registrar_.prefs())); 103 registrar_.prefs()));
110 } 104 }
111 105
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 scoped_ptr<base::ListValue> args_copy(args.DeepCopy()); 143 scoped_ptr<base::ListValue> args_copy(args.DeepCopy());
150 scoped_ptr<Event> event(new Event(event_name, args_copy.Pass())); 144 scoped_ptr<Event> event(new Event(event_name, args_copy.Pass()));
151 router->DispatchEventToExtension(extension_id, event.Pass()); 145 router->DispatchEventToExtension(extension_id, event.Pass());
152 } 146 }
153 } 147 }
154 } 148 }
155 } 149 }
156 150
157 } // namespace chromedirectsetting 151 } // namespace chromedirectsetting
158 } // namespace extensions 152 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698