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

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

Issue 1236493004: Final batch adding real histogram values for extension events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments, rebase, dcheck, etc Created 5 years, 5 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"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue); 138 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue);
139 result->Set(preference_api_constants::kValue, value->DeepCopy()); 139 result->Set(preference_api_constants::kValue, value->DeepCopy());
140 base::ListValue args; 140 base::ListValue args;
141 args.Append(result.release()); 141 args.Append(result.release());
142 142
143 for (const scoped_refptr<const extensions::Extension>& extension : 143 for (const scoped_refptr<const extensions::Extension>& extension :
144 ExtensionRegistry::Get(profile_)->enabled_extensions()) { 144 ExtensionRegistry::Get(profile_)->enabled_extensions()) {
145 const std::string& extension_id = extension->id(); 145 const std::string& extension_id = extension->id();
146 if (router->ExtensionHasEventListener(extension_id, event_name)) { 146 if (router->ExtensionHasEventListener(extension_id, event_name)) {
147 scoped_ptr<base::ListValue> args_copy(args.DeepCopy()); 147 scoped_ptr<base::ListValue> args_copy(args.DeepCopy());
148 // TODO(kalman): Have a histogram value for each pref type.
149 // This isn't so important for the current use case of these
150 // histograms, which is to track which event types are waking up event
151 // pages, or which are delivered to persistent background pages. Simply
152 // "a setting changed" is enough detail for that. However if we try to
153 // use these histograms for any fine-grained logic (like removing the
154 // string event name altogether), or if we discover this event is
155 // firing a lot and want to understand that better, then this will need
156 // to change.
157 events::HistogramValue histogram_value =
158 events::TYPES_PRIVATE_CHROME_DIRECT_SETTING_ON_CHANGE;
148 scoped_ptr<Event> event( 159 scoped_ptr<Event> event(
149 new Event(events::UNKNOWN, event_name, args_copy.Pass())); 160 new Event(histogram_value, event_name, args_copy.Pass()));
150 router->DispatchEventToExtension(extension_id, event.Pass()); 161 router->DispatchEventToExtension(extension_id, event.Pass());
151 } 162 }
152 } 163 }
153 } 164 }
154 } 165 }
155 166
156 } // namespace chromedirectsetting 167 } // namespace chromedirectsetting
157 } // namespace extensions 168 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698