Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc

Issue 1023623002: Remove code whitelisting chrome://app-list/ for speech recognition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698