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

Unified Diff: chrome/common/extensions/api/bluetooth/bluetooth_manifest_handler.cc

Issue 145663004: Replace "bluetooth" permission with manifest property. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused function. Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/api/bluetooth/bluetooth_manifest_handler.cc
diff --git a/chrome/common/extensions/api/bluetooth/bluetooth_manifest_handler.cc b/chrome/common/extensions/api/bluetooth/bluetooth_manifest_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1665600b547b72289e34953046df18681f5d5ef7
--- /dev/null
+++ b/chrome/common/extensions/api/bluetooth/bluetooth_manifest_handler.cc
@@ -0,0 +1,47 @@
+// Copyright 2013 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/common/extensions/api/bluetooth/bluetooth_manifest_handler.h"
+
+#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.h"
+#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_permission.h"
+#include "extensions/common/extension.h"
+#include "extensions/common/manifest_constants.h"
+
+namespace extensions {
+
+BluetoothManifestHandler::BluetoothManifestHandler() {}
+
+BluetoothManifestHandler::~BluetoothManifestHandler() {}
+
+bool BluetoothManifestHandler::Parse(Extension* extension,
+ base::string16* error) {
+ const base::Value* bluetooth = NULL;
+ CHECK(extension->manifest()->Get(manifest_keys::kBluetooth, &bluetooth));
+ scoped_ptr<BluetoothManifestData> data =
+ BluetoothManifestData::FromValue(*bluetooth, error);
+ if (!data)
+ return false;
+
+ extension->SetManifestData(manifest_keys::kBluetooth, data.release());
+ return true;
+}
+
+ManifestPermission* BluetoothManifestHandler::CreatePermission() {
+ return new BluetoothManifestPermission();
+}
+
+ManifestPermission* BluetoothManifestHandler::CreateInitialRequiredPermission(
+ const Extension* extension) {
+ BluetoothManifestData* data = BluetoothManifestData::Get(extension);
+ if (data)
+ return data->permission()->Clone();
+ return NULL;
+}
+
+const std::vector<std::string> BluetoothManifestHandler::Keys() const {
+ return SingleKey(manifest_keys::kBluetooth);
+}
+
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698