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

Side by Side Diff: chrome/common/extensions/permissions/bluetooth_permission.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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/common/extensions/permissions/bluetooth_permission.h"
6
7 #include <string>
8
9 #include "base/logging.h"
10 #include "base/strings/string16.h"
11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/common/extensions/permissions/bluetooth_permission_data.h"
14 #include "extensions/common/permissions/permissions_info.h"
15 #include "grit/generated_resources.h"
16 #include "ui/base/l10n/l10n_util.h"
17
18 namespace extensions {
19
20 BluetoothPermission::BluetoothPermission(const APIPermissionInfo* info)
21 : SetDisjunctionPermission<BluetoothPermissionData,
22 BluetoothPermission>(info) {
23 }
24
25 BluetoothPermission::~BluetoothPermission() {
26 }
27
28 bool BluetoothPermission::FromValue(const base::Value* value,
29 std::string* error) {
30 // Value may be omitted to gain access to non-profile functions.
31 if (!value)
32 return true;
33
34 // Value may be an empty list for the same reason.
35 const base::ListValue* list = NULL;
36 if (value->GetAsList(&list) && list->GetSize() == 0)
37 return true;
38
39 if (!SetDisjunctionPermission<BluetoothPermissionData,
40 BluetoothPermission>::FromValue(value, error)) {
41 return false;
42 }
43
44 return true;
45 }
46
47 PermissionMessages BluetoothPermission::GetMessages() const {
48 DCHECK(HasMessages());
49 PermissionMessages result;
50
51 result.push_back(PermissionMessage(
52 PermissionMessage::kBluetooth,
53 l10n_util::GetStringUTF16(
54 IDS_EXTENSION_PROMPT_WARNING_BLUETOOTH)));
55
56 if (!data_set_.empty()) {
57 result.push_back(PermissionMessage(
58 PermissionMessage::kBluetoothDevices,
59 l10n_util::GetStringUTF16(
60 IDS_EXTENSION_PROMPT_WARNING_BLUETOOTH_DEVICES)));
61 }
62
63 return result;
64 }
65
66 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698