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

Side by Side Diff: chrome/browser/permissions/permission_manager.cc

Issue 1382783002: Store USB device permissions in website settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Convert WebUSBPermissionStore to a PermissionContext. Created 5 years, 2 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
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/permissions/permission_manager.h" 5 #include "chrome/browser/permissions/permission_manager.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
9 #include "chrome/browser/permissions/permission_context.h" 9 #include "chrome/browser/permissions/permission_context.h"
10 #include "chrome/browser/permissions/permission_context_base.h" 10 #include "chrome/browser/permissions/permission_context_base.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #endif 66 #endif
67 case PermissionType::DURABLE_STORAGE: 67 case PermissionType::DURABLE_STORAGE:
68 return CONTENT_SETTINGS_TYPE_DURABLE_STORAGE; 68 return CONTENT_SETTINGS_TYPE_DURABLE_STORAGE;
69 case PermissionType::MIDI: 69 case PermissionType::MIDI:
70 // This will hit the NOTREACHED below. 70 // This will hit the NOTREACHED below.
71 break; 71 break;
72 case PermissionType::AUDIO_CAPTURE: 72 case PermissionType::AUDIO_CAPTURE:
73 return CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC; 73 return CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC;
74 case PermissionType::VIDEO_CAPTURE: 74 case PermissionType::VIDEO_CAPTURE:
75 return CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA; 75 return CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA;
76 case PermissionType::USB:
77 return CONTENT_SETTINGS_TYPE_USB;
76 case PermissionType::NUM: 78 case PermissionType::NUM:
77 // This will hit the NOTREACHED below. 79 // This will hit the NOTREACHED below.
78 break; 80 break;
79 } 81 }
80 82
81 NOTREACHED() << "Unknown content setting for permission " 83 NOTREACHED() << "Unknown content setting for permission "
82 << static_cast<int>(permission); 84 << static_cast<int>(permission);
83 return CONTENT_SETTINGS_TYPE_DEFAULT; 85 return CONTENT_SETTINGS_TYPE_DEFAULT;
84 } 86 }
85 87
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 // Add the callback to |callbacks| which will be run after the loop to 346 // Add the callback to |callbacks| which will be run after the loop to
345 // prevent re-entrance issues. 347 // prevent re-entrance issues.
346 callbacks.push_back( 348 callbacks.push_back(
347 base::Bind(subscription->callback, 349 base::Bind(subscription->callback,
348 ContentSettingToPermissionStatus(new_value))); 350 ContentSettingToPermissionStatus(new_value)));
349 } 351 }
350 352
351 for (const auto& callback : callbacks) 353 for (const auto& callback : callbacks)
352 callback.Run(); 354 callback.Run();
353 } 355 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698