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

Side by Side Diff: chrome/browser/speech/extension_api/tts_extension_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 (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 #include "chrome/browser/speech/extension_api/tts_extension_api.h" 5 #include "chrome/browser/speech/extension_api/tts_extension_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/values.h" 10 #include "base/values.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 details->SetString(constants::kEventTypeKey, event_type_string); 128 details->SetString(constants::kEventTypeKey, event_type_string);
129 if (event_type == TTS_EVENT_ERROR) { 129 if (event_type == TTS_EVENT_ERROR) {
130 details->SetString(constants::kErrorMessageKey, error_message); 130 details->SetString(constants::kErrorMessageKey, error_message);
131 } 131 }
132 details->SetInteger(constants::kSrcIdKey, utterance->src_id()); 132 details->SetInteger(constants::kSrcIdKey, utterance->src_id());
133 details->SetBoolean(constants::kIsFinalEventKey, utterance->finished()); 133 details->SetBoolean(constants::kIsFinalEventKey, utterance->finished());
134 134
135 scoped_ptr<base::ListValue> arguments(new base::ListValue()); 135 scoped_ptr<base::ListValue> arguments(new base::ListValue());
136 arguments->Set(0, details.release()); 136 arguments->Set(0, details.release());
137 137
138 scoped_ptr<extensions::Event> event( 138 scoped_ptr<extensions::Event> event(new extensions::Event(
139 new extensions::Event(events::kOnEvent, arguments.Pass())); 139 ::extensions::events::UNKNOWN, ::events::kOnEvent, arguments.Pass()));
140 event->restrict_to_browser_context = utterance->browser_context(); 140 event->restrict_to_browser_context = utterance->browser_context();
141 event->event_url = utterance->src_url(); 141 event->event_url = utterance->src_url();
142 extensions::EventRouter::Get(utterance->browser_context()) 142 extensions::EventRouter::Get(utterance->browser_context())
143 ->DispatchEventToExtension(src_extension_id_, event.Pass()); 143 ->DispatchEventToExtension(src_extension_id_, event.Pass());
144 144
145 if (utterance->finished()) 145 if (utterance->finished())
146 delete this; 146 delete this;
147 } 147 }
148 148
149 bool TtsSpeakFunction::RunAsync() { 149 bool TtsSpeakFunction::RunAsync() {
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 363 }
364 364
365 static base::LazyInstance<BrowserContextKeyedAPIFactory<TtsAPI> > g_factory = 365 static base::LazyInstance<BrowserContextKeyedAPIFactory<TtsAPI> > g_factory =
366 LAZY_INSTANCE_INITIALIZER; 366 LAZY_INSTANCE_INITIALIZER;
367 367
368 BrowserContextKeyedAPIFactory<TtsAPI>* TtsAPI::GetFactoryInstance() { 368 BrowserContextKeyedAPIFactory<TtsAPI>* TtsAPI::GetFactoryInstance() {
369 return g_factory.Pointer(); 369 return g_factory.Pointer();
370 } 370 }
371 371
372 } // namespace extensions 372 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698