| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 return Profile::FromBrowserContext(rph->GetBrowserContext())->GetPrefs()-> | 393 return Profile::FromBrowserContext(rph->GetBrowserContext())->GetPrefs()-> |
| 394 GetBoolean(prefs::kSpeechRecognitionFilterProfanities); | 394 GetBoolean(prefs::kSpeechRecognitionFilterProfanities); |
| 395 } | 395 } |
| 396 | 396 |
| 397 // static. | 397 // static. |
| 398 void ChromeSpeechRecognitionManagerDelegate::CheckRenderViewType( | 398 void ChromeSpeechRecognitionManagerDelegate::CheckRenderViewType( |
| 399 base::Callback<void(bool ask_user, bool is_allowed)> callback, | 399 base::Callback<void(bool ask_user, bool is_allowed)> callback, |
| 400 int render_process_id, | 400 int render_process_id, |
| 401 int render_view_id) { | 401 int render_view_id) { |
| 402 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 402 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 403 const content::RenderViewHost* render_view_host = | 403 content::RenderViewHost* render_view_host = |
| 404 content::RenderViewHost::FromID(render_process_id, render_view_id); | 404 content::RenderViewHost::FromID(render_process_id, render_view_id); |
| 405 | 405 |
| 406 bool allowed = false; | 406 bool allowed = false; |
| 407 bool check_permission = false; | 407 bool check_permission = false; |
| 408 | 408 |
| 409 if (!render_view_host) { | 409 if (!render_view_host) { |
| 410 // This happens for extensions. Manifest should be checked for permission. | 410 // This happens for extensions. Manifest should be checked for permission. |
| 411 allowed = true; | 411 allowed = true; |
| 412 check_permission = false; | 412 check_permission = false; |
| 413 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 413 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 433 // Otherwise this should be a regular tab contents. | 433 // Otherwise this should be a regular tab contents. |
| 434 allowed = true; | 434 allowed = true; |
| 435 check_permission = true; | 435 check_permission = true; |
| 436 #endif | 436 #endif |
| 437 | 437 |
| 438 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 438 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 439 base::Bind(callback, check_permission, allowed)); | 439 base::Bind(callback, check_permission, allowed)); |
| 440 } | 440 } |
| 441 | 441 |
| 442 } // namespace speech | 442 } // namespace speech |
| OLD | NEW |