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

Side by Side Diff: chrome/browser/media/media_stream_devices_controller.cc

Issue 440423003: Clean content_settings_pattern_parser.* from unnecessary dependencies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
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/media/media_stream_devices_controller.h" 5 #include "chrome/browser/media/media_stream_devices_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/content_settings/content_settings_provider.h" 13 #include "chrome/browser/content_settings/content_settings_provider.h"
14 #include "chrome/browser/content_settings/host_content_settings_map.h" 14 #include "chrome/browser/content_settings/host_content_settings_map.h"
15 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 15 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
16 #include "chrome/browser/media/media_capture_devices_dispatcher.h" 16 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
17 #include "chrome/browser/media/media_stream_capture_indicator.h" 17 #include "chrome/browser/media/media_stream_capture_indicator.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
20 #include "chrome/common/chrome_content_settings_client.h"
20 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/content_settings.h" 22 #include "chrome/common/content_settings.h"
22 #include "chrome/common/content_settings_pattern.h" 23 #include "chrome/common/content_settings_pattern.h"
23 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
24 #include "components/pref_registry/pref_registry_syncable.h" 25 #include "components/pref_registry/pref_registry_syncable.h"
25 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/render_widget_host_view.h" 27 #include "content/public/browser/render_widget_host_view.h"
27 #include "content/public/common/media_stream_request.h" 28 #include "content/public/common/media_stream_request.h"
28 #include "extensions/common/constants.h" 29 #include "extensions/common/constants.h"
29 #include "grit/generated_resources.h" 30 #include "grit/generated_resources.h"
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 PrefService* prefs = profile_->GetPrefs(); 468 PrefService* prefs = profile_->GetPrefs();
468 469
469 // TODO(tommi): Remove the kiosk mode check when the whitelist below 470 // TODO(tommi): Remove the kiosk mode check when the whitelist below
470 // is visible in the media exceptions UI. 471 // is visible in the media exceptions UI.
471 // See discussion here: https://codereview.chromium.org/15738004/ 472 // See discussion here: https://codereview.chromium.org/15738004/
472 if (IsInKioskMode()) { 473 if (IsInKioskMode()) {
473 const base::ListValue* list = prefs->GetList(whitelist_policy_name); 474 const base::ListValue* list = prefs->GetList(whitelist_policy_name);
474 std::string value; 475 std::string value;
475 for (size_t i = 0; i < list->GetSize(); ++i) { 476 for (size_t i = 0; i < list->GetSize(); ++i) {
476 if (list->GetString(i, &value)) { 477 if (list->GetString(i, &value)) {
478 content_settings::ChromeContentSettingsClient client;
477 ContentSettingsPattern pattern = 479 ContentSettingsPattern pattern =
478 ContentSettingsPattern::FromString(value); 480 ContentSettingsPattern::FromString(&client, value);
479 if (pattern == ContentSettingsPattern::Wildcard()) { 481 if (pattern == ContentSettingsPattern::Wildcard()) {
480 DLOG(WARNING) << "Ignoring wildcard URL pattern: " << value; 482 DLOG(WARNING) << "Ignoring wildcard URL pattern: " << value;
481 continue; 483 continue;
482 } 484 }
483 DLOG_IF(ERROR, !pattern.IsValid()) << "Invalid URL pattern: " << value; 485 DLOG_IF(ERROR, !pattern.IsValid()) << "Invalid URL pattern: " << value;
484 if (pattern.IsValid() && pattern.Matches(request_.security_origin)) 486 if (pattern.IsValid() && pattern.Matches(request_.security_origin))
485 return ALWAYS_ALLOW; 487 return ALWAYS_ALLOW;
486 } 488 }
487 } 489 }
488 } 490 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 } 678 }
677 679
678 bool MediaStreamDevicesController::IsCaptureDeviceRequestAllowed() const { 680 bool MediaStreamDevicesController::IsCaptureDeviceRequestAllowed() const {
679 #if defined(OS_ANDROID) 681 #if defined(OS_ANDROID)
680 // Don't approve device requests if the tab was hidden. 682 // Don't approve device requests if the tab was hidden.
681 // TODO(qinmin): Add a test for this. http://crbug.com/396869. 683 // TODO(qinmin): Add a test for this. http://crbug.com/396869.
682 return web_contents_->GetRenderWidgetHostView()->IsShowing(); 684 return web_contents_->GetRenderWidgetHostView()->IsShowing();
683 #endif 685 #endif
684 return true; 686 return true;
685 } 687 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698