| Index: chrome/browser/permissions/chooser_context.cc
|
| diff --git a/chrome/browser/permissions/chooser_context.cc b/chrome/browser/permissions/chooser_context.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8bf8f2c2ec54d7e3f67b9254693622c15eaaf894
|
| --- /dev/null
|
| +++ b/chrome/browser/permissions/chooser_context.cc
|
| @@ -0,0 +1,41 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/permissions/chooser_context.h"
|
| +
|
| +#include "chrome/browser/bluetooth/bluetooth_permission_context.h"
|
| +#include "chrome/browser/bluetooth/bluetooth_permission_context_factory.h"
|
| +#include "chrome/browser/permissions/chooser_context_base.h"
|
| +#include "content/public/browser/permission_type.h"
|
| +
|
| +using content::PermissionType;
|
| +
|
| +// static
|
| +ChooserContextBase* ChooserContext::Get(Profile* profile,
|
| + PermissionType permission_type) {
|
| + // NOTE: the factories used in this method have to stay in sync with
|
| + // ::GetFactories() below.
|
| + switch (permission_type) {
|
| + case PermissionType::BLUETOOTH:
|
| + return BluetoothPermissionContextFactory::GetForProfile(profile);
|
| + default:
|
| + NOTREACHED() << "No ChooserContext associated with "
|
| + << static_cast<int>(permission_type);
|
| + break;
|
| + }
|
| +
|
| + return nullptr;
|
| +}
|
| +
|
| +// static
|
| +const std::list<KeyedServiceBaseFactory*>& ChooserContext::GetFactories() {
|
| + // NOTE: this list has to stay in sync with the factories used by ::Get().
|
| + CR_DEFINE_STATIC_LOCAL(std::list<KeyedServiceBaseFactory*>, factories, ());
|
| +
|
| + if (factories.empty()) {
|
| + factories.push_back(BluetoothPermissionContextFactory::GetInstance());
|
| + }
|
| +
|
| + return factories;
|
| +}
|
|
|