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

Side by Side Diff: chrome/browser/speech/extension_api/tts_extension_api.cc

Issue 448033002: Eliminate the dependency of Profile from TtsMessageFilter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed compilation error on ChromeOS Created 6 years, 4 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/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 details->SetString(constants::kErrorMessageKey, error_message); 120 details->SetString(constants::kErrorMessageKey, error_message);
121 } 121 }
122 details->SetInteger(constants::kSrcIdKey, utterance->src_id()); 122 details->SetInteger(constants::kSrcIdKey, utterance->src_id());
123 details->SetBoolean(constants::kIsFinalEventKey, utterance->finished()); 123 details->SetBoolean(constants::kIsFinalEventKey, utterance->finished());
124 124
125 scoped_ptr<base::ListValue> arguments(new base::ListValue()); 125 scoped_ptr<base::ListValue> arguments(new base::ListValue());
126 arguments->Set(0, details.release()); 126 arguments->Set(0, details.release());
127 127
128 scoped_ptr<extensions::Event> event( 128 scoped_ptr<extensions::Event> event(
129 new extensions::Event(events::kOnEvent, arguments.Pass())); 129 new extensions::Event(events::kOnEvent, arguments.Pass()));
130 event->restrict_to_browser_context = utterance->profile(); 130 event->restrict_to_browser_context = utterance->browser_context();
131 event->event_url = utterance->src_url(); 131 event->event_url = utterance->src_url();
132 extensions::EventRouter::Get(utterance->profile()) 132 extensions::EventRouter::Get(utterance->browser_context())
133 ->DispatchEventToExtension(utterance->src_extension_id(), event.Pass()); 133 ->DispatchEventToExtension(utterance->src_extension_id(), event.Pass());
134 134
135 if (utterance->finished()) 135 if (utterance->finished())
136 delete this; 136 delete this;
137 } 137 }
138 138
139 bool TtsSpeakFunction::RunAsync() { 139 bool TtsSpeakFunction::RunAsync() {
140 std::string text; 140 std::string text;
141 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &text)); 141 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &text));
142 if (text.size() > 32768) { 142 if (text.size() > 32768) {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 } 360 }
361 361
362 static base::LazyInstance<BrowserContextKeyedAPIFactory<TtsAPI> > g_factory = 362 static base::LazyInstance<BrowserContextKeyedAPIFactory<TtsAPI> > g_factory =
363 LAZY_INSTANCE_INITIALIZER; 363 LAZY_INSTANCE_INITIALIZER;
364 364
365 BrowserContextKeyedAPIFactory<TtsAPI>* TtsAPI::GetFactoryInstance() { 365 BrowserContextKeyedAPIFactory<TtsAPI>* TtsAPI::GetFactoryInstance() {
366 return g_factory.Pointer(); 366 return g_factory.Pointer();
367 } 367 }
368 368
369 } // namespace extensions 369 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/speech/extension_api/tts_engine_extension_api.cc ('k') | chrome/browser/speech/tts_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698