| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chromeos/dbus/permission_broker_client.h" | 5 #include "chromeos/dbus/permission_broker_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "dbus/bus.h" | 10 #include "dbus/bus.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 dbus::ObjectProxy* proxy_; | 80 dbus::ObjectProxy* proxy_; |
| 81 | 81 |
| 82 // Note: This should remain the last member so that it will be destroyed | 82 // Note: This should remain the last member so that it will be destroyed |
| 83 // first, invalidating its weak pointers, before the other members are | 83 // first, invalidating its weak pointers, before the other members are |
| 84 // destroyed. | 84 // destroyed. |
| 85 base::WeakPtrFactory<PermissionBrokerClientImpl> weak_ptr_factory_; | 85 base::WeakPtrFactory<PermissionBrokerClientImpl> weak_ptr_factory_; |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(PermissionBrokerClientImpl); | 87 DISALLOW_COPY_AND_ASSIGN(PermissionBrokerClientImpl); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 class PermissionBrokerClientStubImpl : public PermissionBrokerClient { | |
| 91 public: | |
| 92 PermissionBrokerClientStubImpl() {} | |
| 93 virtual ~PermissionBrokerClientStubImpl() {} | |
| 94 | |
| 95 virtual void Init(dbus::Bus* bus) OVERRIDE {} | |
| 96 virtual void RequestPathAccess(const std::string& path, | |
| 97 int interface_id, | |
| 98 const ResultCallback& callback) OVERRIDE { | |
| 99 callback.Run(false); | |
| 100 } | |
| 101 | |
| 102 virtual void RequestUsbAccess(const uint16_t vendor_id, | |
| 103 const uint16_t product_id, | |
| 104 int interface_id, | |
| 105 const ResultCallback& callback) OVERRIDE { | |
| 106 callback.Run(false); | |
| 107 } | |
| 108 | |
| 109 private: | |
| 110 DISALLOW_COPY_AND_ASSIGN(PermissionBrokerClientStubImpl); | |
| 111 }; | |
| 112 | |
| 113 PermissionBrokerClient::PermissionBrokerClient() {} | 90 PermissionBrokerClient::PermissionBrokerClient() {} |
| 114 | 91 |
| 115 PermissionBrokerClient::~PermissionBrokerClient() {} | 92 PermissionBrokerClient::~PermissionBrokerClient() {} |
| 116 | 93 |
| 117 PermissionBrokerClient* PermissionBrokerClient::Create( | 94 PermissionBrokerClient* PermissionBrokerClient::Create() { |
| 118 DBusClientImplementationType type) { | 95 return new PermissionBrokerClientImpl(); |
| 119 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | |
| 120 return new PermissionBrokerClientImpl(); | |
| 121 return new PermissionBrokerClientStubImpl(); | |
| 122 } | 96 } |
| 123 | 97 |
| 124 } // namespace chromeos | 98 } // namespace chromeos |
| OLD | NEW |