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

Side by Side Diff: chrome/browser/media/webrtc/media_permission.cc

Issue 2787283002: Chrome OS: Fix taking user pictures to be used as user POD images. (Closed)
Patch Set: Created 3 years, 8 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 | « chrome/browser/chromeos/login/ui/webui_login_view.cc ('k') | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/webrtc/media_permission.h" 5 #include "chrome/browser/media/webrtc/media_permission.h"
6 6
7 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" 7 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
8 #include "chrome/browser/media/webrtc/media_stream_device_permissions.h" 8 #include "chrome/browser/media/webrtc/media_stream_device_permissions.h"
9 #include "chrome/browser/permissions/permission_context_base.h" 9 #include "chrome/browser/permissions/permission_context_base.h"
10 #include "chrome/browser/permissions/permission_manager.h" 10 #include "chrome/browser/permissions/permission_manager.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/pref_names.h" 12 #include "chrome/common/pref_names.h"
13 #include "chrome/common/url_constants.h"
13 #include "content/public/browser/permission_manager.h" 14 #include "content/public/browser/permission_manager.h"
14 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
15 #include "content/public/common/url_constants.h" 16 #include "content/public/common/url_constants.h"
16 #include "extensions/common/constants.h" 17 #include "extensions/common/constants.h"
17 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat us.mojom.h" 18 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat us.mojom.h"
18 19
19 #if defined(OS_CHROMEOS) 20 #if defined(OS_CHROMEOS)
20 #include "chrome/browser/chromeos/login/ui/login_display_host.h" 21 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
21 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" 22 #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
22 #include "chrome/browser/chromeos/settings/cros_settings.h" 23 #include "chrome/browser/chromeos/settings/cros_settings.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 chromeos::WebUILoginView* webui_login_view = 63 chromeos::WebUILoginView* webui_login_view =
63 login_display_host ? login_display_host->GetWebUILoginView() : nullptr; 64 login_display_host ? login_display_host->GetWebUILoginView() : nullptr;
64 content::WebContents* login_web_contents = 65 content::WebContents* login_web_contents =
65 webui_login_view ? webui_login_view->GetWebContents() : nullptr; 66 webui_login_view ? webui_login_view->GetWebContents() : nullptr;
66 if (web_contents_ == login_web_contents) { 67 if (web_contents_ == login_web_contents) {
67 if (content_type_ == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) { 68 if (content_type_ == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) {
68 *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED; 69 *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED;
69 return CONTENT_SETTING_BLOCK; 70 return CONTENT_SETTING_BLOCK;
70 } 71 }
71 72
73 // When creating new user (including supervised user), we must
74 // be able to use photo for user image.
75 if (requesting_origin_.spec() == chrome::kChromeUIOobeURL) {
76 return CONTENT_SETTING_ALLOW;
77 }
78
72 const chromeos::CrosSettings* const settings = 79 const chromeos::CrosSettings* const settings =
73 chromeos::CrosSettings::Get(); 80 chromeos::CrosSettings::Get();
74 if (!settings) { 81 if (!settings) {
75 *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED; 82 *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED;
76 return CONTENT_SETTING_BLOCK; 83 return CONTENT_SETTING_BLOCK;
77 } 84 }
78 85
79 const base::Value* const raw_list_value = 86 const base::Value* const raw_list_value =
80 settings->GetPref(chromeos::kLoginVideoCaptureAllowedUrls); 87 settings->GetPref(chromeos::kLoginVideoCaptureAllowedUrls);
81 if (!raw_list_value) { 88 if (!raw_list_value) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 return false; 157 return false;
151 158
152 // Note: we check device_id before dereferencing devices. If the requested 159 // Note: we check device_id before dereferencing devices. If the requested
153 // device id is non-empty, then the corresponding device list must not be 160 // device id is non-empty, then the corresponding device list must not be
154 // NULL. 161 // NULL.
155 if (!device_id.empty() && !devices->FindById(device_id)) 162 if (!device_id.empty() && !devices->FindById(device_id))
156 return false; 163 return false;
157 164
158 return true; 165 return true;
159 } 166 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/ui/webui_login_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698