| 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/chrome_speech_recognition_manager_delegate.h" | 5 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 // This happens for extensions. Manifest should be checked for permission. | 494 // This happens for extensions. Manifest should be checked for permission. |
| 495 allowed = true; | 495 allowed = true; |
| 496 ask_permission = false; | 496 ask_permission = false; |
| 497 } | 497 } |
| 498 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 498 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 499 base::Bind(callback, ask_permission, allowed)); | 499 base::Bind(callback, ask_permission, allowed)); |
| 500 return; | 500 return; |
| 501 } | 501 } |
| 502 | 502 |
| 503 WebContents* web_contents = WebContents::FromRenderViewHost(render_view_host); | 503 WebContents* web_contents = WebContents::FromRenderViewHost(render_view_host); |
| 504 chrome::ViewType view_type = chrome::GetViewType(web_contents); | 504 extensions::ViewType view_type = chrome::GetViewType(web_contents); |
| 505 | 505 |
| 506 // TODO(kalman): Also enable speech bubble for extension popups | 506 // TODO(kalman): Also enable speech bubble for extension popups |
| 507 // (VIEW_TYPE_EXTENSION_POPUP) once popup-like control UI works properly in | 507 // (VIEW_TYPE_EXTENSION_POPUP) once popup-like control UI works properly in |
| 508 // extensions: http://crbug.com/163851. | 508 // extensions: http://crbug.com/163851. |
| 509 // Right now the extension popup closes and dismisses immediately on user | 509 // Right now the extension popup closes and dismisses immediately on user |
| 510 // click. | 510 // click. |
| 511 if (view_type == chrome::VIEW_TYPE_TAB_CONTENTS || | 511 if (view_type == extensions::VIEW_TYPE_TAB_CONTENTS || |
| 512 view_type == chrome::VIEW_TYPE_APP_SHELL) { | 512 view_type == extensions::VIEW_TYPE_APP_SHELL) { |
| 513 // If it is a tab, we can show the speech input bubble or ask for | 513 // If it is a tab, we can show the speech input bubble or ask for |
| 514 // permission. | 514 // permission. |
| 515 | 515 |
| 516 allowed = true; | 516 allowed = true; |
| 517 if (js_api) | 517 if (js_api) |
| 518 ask_permission = true; | 518 ask_permission = true; |
| 519 } | 519 } |
| 520 | 520 |
| 521 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 521 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 522 base::Bind(callback, ask_permission, allowed)); | 522 base::Bind(callback, ask_permission, allowed)); |
| 523 } | 523 } |
| 524 | 524 |
| 525 SpeechRecognitionBubbleController* | 525 SpeechRecognitionBubbleController* |
| 526 ChromeSpeechRecognitionManagerDelegate::GetBubbleController() { | 526 ChromeSpeechRecognitionManagerDelegate::GetBubbleController() { |
| 527 if (!bubble_controller_.get()) | 527 if (!bubble_controller_.get()) |
| 528 bubble_controller_ = new SpeechRecognitionBubbleController(this); | 528 bubble_controller_ = new SpeechRecognitionBubbleController(this); |
| 529 return bubble_controller_.get(); | 529 return bubble_controller_.get(); |
| 530 } | 530 } |
| 531 | 531 |
| 532 } // namespace speech | 532 } // namespace speech |
| OLD | NEW |