| OLD | NEW |
| 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/permissions/permission_manager.h" | 5 #include "chrome/browser/permissions/permission_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/storage/durable_storage_permission_context.h" | 24 #include "chrome/browser/storage/durable_storage_permission_context.h" |
| 25 #include "chrome/browser/tab_contents/tab_util.h" | 25 #include "chrome/browser/tab_contents/tab_util.h" |
| 26 #include "chrome/common/features.h" | 26 #include "chrome/common/features.h" |
| 27 #include "components/content_settings/core/browser/host_content_settings_map.h" | 27 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
| 29 #include "content/public/browser/permission_type.h" | 29 #include "content/public/browser/permission_type.h" |
| 30 #include "content/public/browser/render_frame_host.h" | 30 #include "content/public/browser/render_frame_host.h" |
| 31 #include "content/public/browser/render_process_host.h" | 31 #include "content/public/browser/render_process_host.h" |
| 32 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
| 33 #include "ppapi/features/features.h" |
| 33 | 34 |
| 34 #if defined(ENABLE_PLUGINS) | 35 #if BUILDFLAG(ENABLE_PLUGINS) |
| 35 #include "chrome/browser/plugins/flash_permission_context.h" | 36 #include "chrome/browser/plugins/flash_permission_context.h" |
| 36 #endif | 37 #endif |
| 37 | 38 |
| 38 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 39 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 39 #include "chrome/browser/media/protected_media_identifier_permission_context.h" | 40 #include "chrome/browser/media/protected_media_identifier_permission_context.h" |
| 40 #endif | 41 #endif |
| 41 | 42 |
| 42 #if BUILDFLAG(ANDROID_JAVA_UI) | 43 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 43 #include "chrome/browser/geolocation/geolocation_permission_context_android.h" | 44 #include "chrome/browser/geolocation/geolocation_permission_context_android.h" |
| 44 #else | 45 #else |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 permission_contexts_[PermissionType::AUDIO_CAPTURE] = | 251 permission_contexts_[PermissionType::AUDIO_CAPTURE] = |
| 251 base::MakeUnique<MediaStreamDevicePermissionContext>( | 252 base::MakeUnique<MediaStreamDevicePermissionContext>( |
| 252 profile, content::PermissionType::AUDIO_CAPTURE, | 253 profile, content::PermissionType::AUDIO_CAPTURE, |
| 253 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); | 254 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
| 254 permission_contexts_[PermissionType::VIDEO_CAPTURE] = | 255 permission_contexts_[PermissionType::VIDEO_CAPTURE] = |
| 255 base::MakeUnique<MediaStreamDevicePermissionContext>( | 256 base::MakeUnique<MediaStreamDevicePermissionContext>( |
| 256 profile, content::PermissionType::VIDEO_CAPTURE, | 257 profile, content::PermissionType::VIDEO_CAPTURE, |
| 257 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); | 258 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
| 258 permission_contexts_[PermissionType::BACKGROUND_SYNC] = | 259 permission_contexts_[PermissionType::BACKGROUND_SYNC] = |
| 259 base::MakeUnique<BackgroundSyncPermissionContext>(profile); | 260 base::MakeUnique<BackgroundSyncPermissionContext>(profile); |
| 260 #if defined(ENABLE_PLUGINS) | 261 #if BUILDFLAG(ENABLE_PLUGINS) |
| 261 permission_contexts_[PermissionType::FLASH] = | 262 permission_contexts_[PermissionType::FLASH] = |
| 262 base::MakeUnique<FlashPermissionContext>(profile); | 263 base::MakeUnique<FlashPermissionContext>(profile); |
| 263 #endif | 264 #endif |
| 264 } | 265 } |
| 265 | 266 |
| 266 PermissionManager::~PermissionManager() { | 267 PermissionManager::~PermissionManager() { |
| 267 if (!subscriptions_.IsEmpty()) | 268 if (!subscriptions_.IsEmpty()) |
| 268 HostContentSettingsMapFactory::GetForProfile(profile_) | 269 HostContentSettingsMapFactory::GetForProfile(profile_) |
| 269 ->RemoveObserver(this); | 270 ->RemoveObserver(this); |
| 270 } | 271 } |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 // Add the callback to |callbacks| which will be run after the loop to | 495 // Add the callback to |callbacks| which will be run after the loop to |
| 495 // prevent re-entrance issues. | 496 // prevent re-entrance issues. |
| 496 callbacks.push_back( | 497 callbacks.push_back( |
| 497 base::Bind(subscription->callback, | 498 base::Bind(subscription->callback, |
| 498 ContentSettingToPermissionStatus(new_value))); | 499 ContentSettingToPermissionStatus(new_value))); |
| 499 } | 500 } |
| 500 | 501 |
| 501 for (const auto& callback : callbacks) | 502 for (const auto& callback : callbacks) |
| 502 callback.Run(); | 503 callback.Run(); |
| 503 } | 504 } |
| OLD | NEW |