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/image_burner_client.h" | 5 #include "chromeos/dbus/image_burner_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "chromeos/dbus/fake_image_burner_client.h" |
9 #include "dbus/bus.h" | 10 #include "dbus/bus.h" |
10 #include "dbus/message.h" | 11 #include "dbus/message.h" |
11 #include "dbus/object_path.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 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 BurnFinishedHandler burn_finished_handler_; | 126 BurnFinishedHandler burn_finished_handler_; |
126 BurnProgressUpdateHandler burn_progress_update_handler_; | 127 BurnProgressUpdateHandler burn_progress_update_handler_; |
127 | 128 |
128 // Note: This should remain the last member so it'll be destroyed and | 129 // Note: This should remain the last member so it'll be destroyed and |
129 // invalidate its weak pointers before any other members are destroyed. | 130 // invalidate its weak pointers before any other members are destroyed. |
130 base::WeakPtrFactory<ImageBurnerClientImpl> weak_ptr_factory_; | 131 base::WeakPtrFactory<ImageBurnerClientImpl> weak_ptr_factory_; |
131 | 132 |
132 DISALLOW_COPY_AND_ASSIGN(ImageBurnerClientImpl); | 133 DISALLOW_COPY_AND_ASSIGN(ImageBurnerClientImpl); |
133 }; | 134 }; |
134 | 135 |
135 // A stub implementaion of ImageBurnerClient. | |
136 class ImageBurnerClientStubImpl : public ImageBurnerClient { | |
137 public: | |
138 ImageBurnerClientStubImpl() {} | |
139 virtual ~ImageBurnerClientStubImpl() {} | |
140 virtual void BurnImage(const std::string& from_path, | |
141 const std::string& to_path, | |
142 const ErrorCallback& error_callback) OVERRIDE {} | |
143 virtual void SetEventHandlers( | |
144 const BurnFinishedHandler& burn_finished_handler, | |
145 const BurnProgressUpdateHandler& burn_progress_update_handler) OVERRIDE {} | |
146 virtual void ResetEventHandlers() OVERRIDE {} | |
147 | |
148 private: | |
149 DISALLOW_COPY_AND_ASSIGN(ImageBurnerClientStubImpl); | |
150 }; | |
151 | |
152 } // namespace | 136 } // namespace |
153 | 137 |
154 ImageBurnerClient::ImageBurnerClient() { | 138 ImageBurnerClient::ImageBurnerClient() { |
155 } | 139 } |
156 | 140 |
157 ImageBurnerClient::~ImageBurnerClient() { | 141 ImageBurnerClient::~ImageBurnerClient() { |
158 } | 142 } |
159 | 143 |
160 // static | 144 // static |
161 ImageBurnerClient* ImageBurnerClient::Create(DBusClientImplementationType type, | 145 ImageBurnerClient* ImageBurnerClient::Create(DBusClientImplementationType type, |
162 dbus::Bus* bus) { | 146 dbus::Bus* bus) { |
163 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 147 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
164 return new ImageBurnerClientImpl(bus); | 148 return new ImageBurnerClientImpl(bus); |
165 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 149 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
166 return new ImageBurnerClientStubImpl(); | 150 return new FakeImageBurnerClient(); |
167 } | 151 } |
168 | 152 |
169 } // namespace chromeos | 153 } // namespace chromeos |
OLD | NEW |