| OLD | NEW |
| 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/speech_recognition_bubble_controller.h" | 5 #include "chrome/browser/speech/speech_recognition_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/tab_contents/tab_util.h" | 8 #include "chrome/browser/tab_contents/tab_util.h" |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "content/public/browser/notification_registrar.h" | 10 #include "content/public/browser/notification_registrar.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 // In the case of a tab closed or crashed, the bubble can have been destroyed | 162 // In the case of a tab closed or crashed, the bubble can have been destroyed |
| 163 // earlier on the UI thread, while other tasks were being enqueued from the IO | 163 // earlier on the UI thread, while other tasks were being enqueued from the IO |
| 164 // to the UI thread. Simply return in such cases. | 164 // to the UI thread. Simply return in such cases. |
| 165 if (request.type != REQUEST_CREATE && !bubble_.get()) | 165 if (request.type != REQUEST_CREATE && !bubble_.get()) |
| 166 return; | 166 return; |
| 167 | 167 |
| 168 switch (request.type) { | 168 switch (request.type) { |
| 169 case REQUEST_CREATE: | 169 case REQUEST_CREATE: |
| 170 bubble_.reset(SpeechRecognitionBubble::Create( | 170 bubble_.reset(SpeechRecognitionBubble::Create( |
| 171 tab_util::GetWebContentsByID(request.render_process_id, | 171 request.render_process_id, request.render_view_id, |
| 172 request.render_view_id), | |
| 173 this, request.element_rect)); | 172 this, request.element_rect)); |
| 174 | 173 |
| 175 if (!bubble_.get()) { | 174 if (!bubble_.get()) { |
| 176 // Could be null if tab or display rect were invalid. | 175 // Could be null if tab or display rect were invalid. |
| 177 // Simulate the cancel button being clicked to inform the delegate. | 176 // Simulate the cancel button being clicked to inform the delegate. |
| 178 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 177 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 179 base::Bind( | 178 base::Bind( |
| 180 &SpeechRecognitionBubbleController::InvokeDelegateButtonClicked, | 179 &SpeechRecognitionBubbleController::InvokeDelegateButtonClicked, |
| 181 this, SpeechRecognitionBubble::BUTTON_CANCEL)); | 180 this, SpeechRecognitionBubble::BUTTON_CANCEL)); |
| 182 return; | 181 return; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 210 volume(0.0F), | 209 volume(0.0F), |
| 211 noise_volume(0.0F), | 210 noise_volume(0.0F), |
| 212 render_process_id(0), | 211 render_process_id(0), |
| 213 render_view_id(0) { | 212 render_view_id(0) { |
| 214 } | 213 } |
| 215 | 214 |
| 216 SpeechRecognitionBubbleController::UIRequest::~UIRequest() { | 215 SpeechRecognitionBubbleController::UIRequest::~UIRequest() { |
| 217 } | 216 } |
| 218 | 217 |
| 219 } // namespace speech | 218 } // namespace speech |
| OLD | NEW |