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

Side by Side Diff: extensions/common/api/bluetooth/bluetooth_manifest_permission.cc

Issue 1226353004: Generate all extension schema namespaces as "api" and instead vary the generated bundle names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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
« no previous file with comments | « extensions/common/api/BUILD.gn ('k') | extensions/common/api/cast_channel/authority_keys.proto » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/common/api/bluetooth/bluetooth_manifest_permission.h" 5 #include "extensions/common/api/bluetooth/bluetooth_manifest_permission.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 BluetoothManifestPermission::BluetoothManifestPermission() 60 BluetoothManifestPermission::BluetoothManifestPermission()
61 : socket_(false), low_energy_(false), peripheral_(false) { 61 : socket_(false), low_energy_(false), peripheral_(false) {
62 } 62 }
63 63
64 BluetoothManifestPermission::~BluetoothManifestPermission() {} 64 BluetoothManifestPermission::~BluetoothManifestPermission() {}
65 65
66 // static 66 // static
67 scoped_ptr<BluetoothManifestPermission> BluetoothManifestPermission::FromValue( 67 scoped_ptr<BluetoothManifestPermission> BluetoothManifestPermission::FromValue(
68 const base::Value& value, 68 const base::Value& value,
69 base::string16* error) { 69 base::string16* error) {
70 scoped_ptr<core_api::extensions_manifest_types::Bluetooth> bluetooth = 70 scoped_ptr<api::extensions_manifest_types::Bluetooth> bluetooth =
71 core_api::extensions_manifest_types::Bluetooth::FromValue(value, error); 71 api::extensions_manifest_types::Bluetooth::FromValue(value, error);
72 if (!bluetooth) 72 if (!bluetooth)
73 return scoped_ptr<BluetoothManifestPermission>(); 73 return scoped_ptr<BluetoothManifestPermission>();
74 74
75 scoped_ptr<BluetoothManifestPermission> result( 75 scoped_ptr<BluetoothManifestPermission> result(
76 new BluetoothManifestPermission()); 76 new BluetoothManifestPermission());
77 if (bluetooth->uuids) { 77 if (bluetooth->uuids) {
78 if (!ParseUuidArray(result.get(), bluetooth->uuids, error)) { 78 if (!ParseUuidArray(result.get(), bluetooth->uuids, error)) {
79 return scoped_ptr<BluetoothManifestPermission>(); 79 return scoped_ptr<BluetoothManifestPermission>();
80 } 80 }
81 } 81 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 BluetoothManifestPermission::FromValue(*value, &error)); 171 BluetoothManifestPermission::FromValue(*value, &error));
172 172
173 if (!manifest_permission) 173 if (!manifest_permission)
174 return false; 174 return false;
175 175
176 uuids_ = manifest_permission->uuids_; 176 uuids_ = manifest_permission->uuids_;
177 return true; 177 return true;
178 } 178 }
179 179
180 scoped_ptr<base::Value> BluetoothManifestPermission::ToValue() const { 180 scoped_ptr<base::Value> BluetoothManifestPermission::ToValue() const {
181 core_api::extensions_manifest_types::Bluetooth bluetooth; 181 api::extensions_manifest_types::Bluetooth bluetooth;
182 bluetooth.uuids.reset(new std::vector<std::string>(uuids_.begin(), 182 bluetooth.uuids.reset(new std::vector<std::string>(uuids_.begin(),
183 uuids_.end())); 183 uuids_.end()));
184 return bluetooth.ToValue().Pass(); 184 return bluetooth.ToValue().Pass();
185 } 185 }
186 186
187 ManifestPermission* BluetoothManifestPermission::Diff( 187 ManifestPermission* BluetoothManifestPermission::Diff(
188 const ManifestPermission* rhs) const { 188 const ManifestPermission* rhs) const {
189 const BluetoothManifestPermission* other = 189 const BluetoothManifestPermission* other =
190 static_cast<const BluetoothManifestPermission*>(rhs); 190 static_cast<const BluetoothManifestPermission*>(rhs);
191 191
(...skipping 26 matching lines...) Expand all
218 result->uuids_ = base::STLSetIntersection<BluetoothUuidSet>( 218 result->uuids_ = base::STLSetIntersection<BluetoothUuidSet>(
219 uuids_, other->uuids_); 219 uuids_, other->uuids_);
220 return result.release(); 220 return result.release();
221 } 221 }
222 222
223 void BluetoothManifestPermission::AddPermission(const std::string& uuid) { 223 void BluetoothManifestPermission::AddPermission(const std::string& uuid) {
224 uuids_.insert(uuid); 224 uuids_.insert(uuid);
225 } 225 }
226 226
227 } // namespace extensions 227 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/api/BUILD.gn ('k') | extensions/common/api/cast_channel/authority_keys.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698