| 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 | 409 |
| 410 if (!render_view_host) { | 410 if (!render_view_host) { |
| 411 // This happens for extensions. Manifest should be checked for permission. | 411 // This happens for extensions. Manifest should be checked for permission. |
| 412 allowed = true; | 412 allowed = true; |
| 413 check_permission = false; | 413 check_permission = false; |
| 414 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 414 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 415 base::Bind(callback, check_permission, allowed)); | 415 base::Bind(callback, check_permission, allowed)); |
| 416 return; | 416 return; |
| 417 } | 417 } |
| 418 | 418 |
| 419 #if defined(ENABLE_EXTENSIONS) |
| 419 WebContents* web_contents = WebContents::FromRenderViewHost(render_view_host); | 420 WebContents* web_contents = WebContents::FromRenderViewHost(render_view_host); |
| 420 | |
| 421 // chrome://app-list/ uses speech recognition. | |
| 422 if (web_contents->GetCommittedWebUI() && | |
| 423 web_contents->GetLastCommittedURL().spec() == | |
| 424 chrome::kChromeUIAppListStartPageURL) { | |
| 425 allowed = true; | |
| 426 check_permission = false; | |
| 427 } | |
| 428 | |
| 429 #if defined(ENABLE_EXTENSIONS) | |
| 430 extensions::ViewType view_type = extensions::GetViewType(web_contents); | 421 extensions::ViewType view_type = extensions::GetViewType(web_contents); |
| 431 | 422 |
| 432 if (view_type == extensions::VIEW_TYPE_TAB_CONTENTS || | 423 if (view_type == extensions::VIEW_TYPE_TAB_CONTENTS || |
| 433 view_type == extensions::VIEW_TYPE_APP_WINDOW || | 424 view_type == extensions::VIEW_TYPE_APP_WINDOW || |
| 434 view_type == extensions::VIEW_TYPE_LAUNCHER_PAGE || | 425 view_type == extensions::VIEW_TYPE_LAUNCHER_PAGE || |
| 435 view_type == extensions::VIEW_TYPE_VIRTUAL_KEYBOARD || | 426 view_type == extensions::VIEW_TYPE_VIRTUAL_KEYBOARD || |
| 436 view_type == extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { | 427 view_type == extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { |
| 437 // If it is a tab, we can check for permission. For apps, this means | 428 // If it is a tab, we can check for permission. For apps, this means |
| 438 // manifest would be checked for permission. | 429 // manifest would be checked for permission. |
| 439 allowed = true; | 430 allowed = true; |
| 440 check_permission = true; | 431 check_permission = true; |
| 441 } | 432 } |
| 442 #else | 433 #else |
| 443 // Otherwise this should be a regular tab contents. | 434 // Otherwise this should be a regular tab contents. |
| 444 allowed = true; | 435 allowed = true; |
| 445 check_permission = true; | 436 check_permission = true; |
| 446 #endif | 437 #endif |
| 447 | 438 |
| 448 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 439 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 449 base::Bind(callback, check_permission, allowed)); | 440 base::Bind(callback, check_permission, allowed)); |
| 450 } | 441 } |
| 451 | 442 |
| 452 } // namespace speech | 443 } // namespace speech |
| OLD | NEW |