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

Side by Side Diff: chrome/browser/extensions/api/hotword_private/hotword_private_api.cc

Issue 1201063002: Set up the infrastructure for Extension event metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaaaaase Created 5 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/hotword_private/hotword_private_api.h" 5 #include "chrome/browser/extensions/api/hotword_private/hotword_private_api.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 void HotwordPrivateEventService::SignalEvent(const std::string& event_name) { 114 void HotwordPrivateEventService::SignalEvent(const std::string& event_name) {
115 SignalEvent(event_name, make_scoped_ptr(new base::ListValue())); 115 SignalEvent(event_name, make_scoped_ptr(new base::ListValue()));
116 } 116 }
117 117
118 void HotwordPrivateEventService::SignalEvent(const std::string& event_name, 118 void HotwordPrivateEventService::SignalEvent(const std::string& event_name,
119 scoped_ptr<base::ListValue> args) { 119 scoped_ptr<base::ListValue> args) {
120 EventRouter* router = EventRouter::Get(profile_); 120 EventRouter* router = EventRouter::Get(profile_);
121 if (!router || !router->HasEventListener(event_name)) 121 if (!router || !router->HasEventListener(event_name))
122 return; 122 return;
123 123
124 scoped_ptr<Event> event(new Event(event_name, args.Pass())); 124 scoped_ptr<Event> event(new Event(events::UNKNOWN, event_name, args.Pass()));
125 router->BroadcastEvent(event.Pass()); 125 router->BroadcastEvent(event.Pass());
126 } 126 }
127 127
128 bool HotwordPrivateSetEnabledFunction::RunSync() { 128 bool HotwordPrivateSetEnabledFunction::RunSync() {
129 scoped_ptr<api::hotword_private::SetEnabled::Params> params( 129 scoped_ptr<api::hotword_private::SetEnabled::Params> params(
130 api::hotword_private::SetEnabled::Params::Create(*args_)); 130 api::hotword_private::SetEnabled::Params::Create(*args_));
131 EXTENSION_FUNCTION_VALIDATE(params.get()); 131 EXTENSION_FUNCTION_VALIDATE(params.get());
132 132
133 PrefService* prefs = GetProfile()->GetPrefs(); 133 PrefService* prefs = GetProfile()->GetPrefs();
134 prefs->SetBoolean(prefs::kHotwordSearchEnabled, params->state); 134 prefs->SetBoolean(prefs::kHotwordSearchEnabled, params->state);
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 HotwordService* hotword_service = 483 HotwordService* hotword_service =
484 HotwordServiceFactory::GetForProfile(GetProfile()); 484 HotwordServiceFactory::GetForProfile(GetProfile());
485 if (!hotword_service) 485 if (!hotword_service)
486 return false; 486 return false;
487 487
488 hotword_service->SpeakerModelExistsComplete(params->exists); 488 hotword_service->SpeakerModelExistsComplete(params->exists);
489 return true; 489 return true;
490 } 490 }
491 491
492 } // namespace extensions 492 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/history/history_api.cc ('k') | chrome/browser/extensions/api/identity/identity_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698