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 "chrome/browser/chromeos/dbus/cros_disks_client.h" | 5 #include "chrome/browser/chromeos/dbus/cros_disks_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "chrome/browser/chromeos/system/runtime_environment.h" | 9 #include "chrome/browser/chromeos/system/runtime_environment.h" |
10 #include "dbus/bus.h" | 10 #include "dbus/bus.h" |
11 #include "dbus/message.h" | 11 #include "dbus/message.h" |
| 12 #include "dbus/object_path.h" |
12 #include "dbus/object_proxy.h" | 13 #include "dbus/object_proxy.h" |
13 #include "third_party/cros_system_api/dbus/service_constants.h" | 14 #include "third_party/cros_system_api/dbus/service_constants.h" |
14 | 15 |
15 namespace chromeos { | 16 namespace chromeos { |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 const char* kDefaultMountOptions[] = { | 20 const char* kDefaultMountOptions[] = { |
20 "rw", | 21 "rw", |
21 "nodev", | 22 "nodev", |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 std::vector<std::string>* value) { | 99 std::vector<std::string>* value) { |
99 if (!reader) | 100 if (!reader) |
100 return false; | 101 return false; |
101 return reader->PopArrayOfStrings(value); | 102 return reader->PopArrayOfStrings(value); |
102 } | 103 } |
103 | 104 |
104 // The CrosDisksClient implementation. | 105 // The CrosDisksClient implementation. |
105 class CrosDisksClientImpl : public CrosDisksClient { | 106 class CrosDisksClientImpl : public CrosDisksClient { |
106 public: | 107 public: |
107 explicit CrosDisksClientImpl(dbus::Bus* bus) | 108 explicit CrosDisksClientImpl(dbus::Bus* bus) |
108 : proxy_(bus->GetObjectProxy(cros_disks::kCrosDisksServiceName, | 109 : proxy_(bus->GetObjectProxy( |
109 cros_disks::kCrosDisksServicePath)), | 110 cros_disks::kCrosDisksServiceName, |
| 111 dbus::ObjectPath(cros_disks::kCrosDisksServicePath))), |
110 weak_ptr_factory_(this) { | 112 weak_ptr_factory_(this) { |
111 } | 113 } |
112 | 114 |
113 // CrosDisksClient override. | 115 // CrosDisksClient override. |
114 virtual void Mount(const std::string& source_path, | 116 virtual void Mount(const std::string& source_path, |
115 MountType type, | 117 MountType type, |
116 MountCallback callback, | 118 MountCallback callback, |
117 ErrorCallback error_callback) OVERRIDE { | 119 ErrorCallback error_callback) OVERRIDE { |
118 dbus::MethodCall method_call(cros_disks::kCrosDisksInterface, | 120 dbus::MethodCall method_call(cros_disks::kCrosDisksInterface, |
119 cros_disks::kMount); | 121 cros_disks::kMount); |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 | 557 |
556 // static | 558 // static |
557 CrosDisksClient* CrosDisksClient::Create(dbus::Bus* bus) { | 559 CrosDisksClient* CrosDisksClient::Create(dbus::Bus* bus) { |
558 if (system::runtime_environment::IsRunningOnChromeOS()) | 560 if (system::runtime_environment::IsRunningOnChromeOS()) |
559 return new CrosDisksClientImpl(bus); | 561 return new CrosDisksClientImpl(bus); |
560 else | 562 else |
561 return new CrosDisksClientStubImpl(); | 563 return new CrosDisksClientStubImpl(); |
562 } | 564 } |
563 | 565 |
564 } // namespace chromeos | 566 } // namespace chromeos |
OLD | NEW |