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

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

Issue 1411653004: Remove last usage functions from HostContentSettingsMap Base URL: https://chromium.googlesource.com/chromium/src.git@simplify-host-content-settings
Patch Set: Created 5 years, 1 month 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
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/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 profile_, audio_allowed, video_allowed, &devices); 324 profile_, audio_allowed, video_allowed, &devices);
325 break; 325 break;
326 } 326 }
327 case content::MEDIA_ENUMERATE_DEVICES: { 327 case content::MEDIA_ENUMERATE_DEVICES: {
328 // Do nothing. 328 // Do nothing.
329 NOTREACHED(); 329 NOTREACHED();
330 break; 330 break;
331 } 331 }
332 } // switch 332 } // switch
333 333
334 if (audio_allowed) {
335 HostContentSettingsMapFactory::GetForProfile(profile_)
336 ->UpdateLastUsageByPattern(
337 ContentSettingsPattern::FromURLNoWildcard(request_.security_origin),
338 ContentSettingsPattern::Wildcard(),
339 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC);
340 }
341 if (video_allowed) {
342 HostContentSettingsMapFactory::GetForProfile(profile_)
343 ->UpdateLastUsageByPattern(
344 ContentSettingsPattern::FromURLNoWildcard(request_.security_origin),
345 ContentSettingsPattern::Wildcard(),
346 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA);
347 }
348
349 return devices; 334 return devices;
350 } 335 }
351 336
352 void MediaStreamDevicesController::RunCallback( 337 void MediaStreamDevicesController::RunCallback(
353 ContentSetting audio_setting, 338 ContentSetting audio_setting,
354 ContentSetting video_setting, 339 ContentSetting video_setting,
355 content::MediaStreamRequestResult denial_reason) { 340 content::MediaStreamRequestResult denial_reason) {
356 CHECK(!callback_.is_null()); 341 CHECK(!callback_.is_null());
357 342
358 if (persist_permission_changes_) { 343 if (persist_permission_changes_) {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 if (android_permission_blocked) 519 if (android_permission_blocked)
535 return false; 520 return false;
536 521
537 // Don't approve device requests if the tab was hidden. 522 // Don't approve device requests if the tab was hidden.
538 // TODO(qinmin): Add a test for this. http://crbug.com/396869. 523 // TODO(qinmin): Add a test for this. http://crbug.com/396869.
539 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? 524 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video?
540 return web_contents_->GetRenderWidgetHostView()->IsShowing(); 525 return web_contents_->GetRenderWidgetHostView()->IsShowing();
541 #endif 526 #endif
542 return true; 527 return true;
543 } 528 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698