OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/speech/tts_message_filter.h" | 5 #include "chrome/browser/speech/tts_message_filter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/speech/tts_controller.h" | 10 #include "chrome/browser/speech/tts_controller.h" |
11 #include "chrome/browser/speech/tts_message_filter.h" | 11 #include "chrome/browser/speech/tts_message_filter.h" |
12 #include "content/public/browser/browser_context.h" | 12 #include "content/public/browser/browser_context.h" |
13 #include "content/public/browser/render_process_host.h" | 13 #include "content/public/browser/render_process_host.h" |
14 | 14 |
15 using content::BrowserThread; | 15 using content::BrowserThread; |
16 | 16 |
17 TtsMessageFilter::TtsMessageFilter(int render_process_id, Profile* profile) | 17 TtsMessageFilter::TtsMessageFilter(int render_process_id, Profile* profile) |
18 : BrowserMessageFilter(TtsMsgStart), | 18 : render_process_id_(render_process_id), |
19 render_process_id_(render_process_id), | |
20 profile_(profile) { | 19 profile_(profile) { |
21 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 20 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
22 TtsController::GetInstance()->AddVoicesChangedDelegate(this); | 21 TtsController::GetInstance()->AddVoicesChangedDelegate(this); |
23 } | 22 } |
24 | 23 |
25 void TtsMessageFilter::OverrideThreadForMessage( | 24 void TtsMessageFilter::OverrideThreadForMessage( |
26 const IPC::Message& message, BrowserThread::ID* thread) { | 25 const IPC::Message& message, BrowserThread::ID* thread) { |
27 switch (message.type()) { | 26 switch (message.type()) { |
28 case TtsHostMsg_InitializeVoiceList::ID: | 27 case TtsHostMsg_InitializeVoiceList::ID: |
29 case TtsHostMsg_Speak::ID: | 28 case TtsHostMsg_Speak::ID: |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 OnInitializeVoiceList(); | 153 OnInitializeVoiceList(); |
155 } | 154 } |
156 | 155 |
157 void TtsMessageFilter::OnChannelClosingInUIThread() { | 156 void TtsMessageFilter::OnChannelClosingInUIThread() { |
158 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 157 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
159 TtsController::GetInstance()->RemoveVoicesChangedDelegate(this); | 158 TtsController::GetInstance()->RemoveVoicesChangedDelegate(this); |
160 } | 159 } |
161 | 160 |
162 TtsMessageFilter::~TtsMessageFilter() { | 161 TtsMessageFilter::~TtsMessageFilter() { |
163 } | 162 } |
OLD | NEW |