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/image_burner_client.h" | 5 #include "chrome/browser/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 "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" | |
13 #include "dbus/object_proxy.h" | 12 #include "dbus/object_proxy.h" |
14 #include "third_party/cros_system_api/dbus/service_constants.h" | 13 #include "third_party/cros_system_api/dbus/service_constants.h" |
15 | 14 |
16 namespace chromeos { | 15 namespace chromeos { |
17 | 16 |
18 namespace { | 17 namespace { |
19 | 18 |
20 // The ImageBurnerClient implementation. | 19 // The ImageBurnerClient implementation. |
21 class ImageBurnerClientImpl : public ImageBurnerClient { | 20 class ImageBurnerClientImpl : public ImageBurnerClient { |
22 public: | 21 public: |
23 explicit ImageBurnerClientImpl(dbus::Bus* bus) | 22 explicit ImageBurnerClientImpl(dbus::Bus* bus) |
24 : proxy_(NULL), | 23 : proxy_(NULL), |
25 weak_ptr_factory_(this) { | 24 weak_ptr_factory_(this) { |
26 proxy_ = bus->GetObjectProxy( | 25 proxy_ = bus->GetObjectProxy(imageburn::kImageBurnServiceName, |
27 imageburn::kImageBurnServiceName, | 26 imageburn::kImageBurnServicePath); |
28 dbus::ObjectPath(imageburn::kImageBurnServicePath)); | |
29 proxy_->ConnectToSignal( | 27 proxy_->ConnectToSignal( |
30 imageburn::kImageBurnServiceInterface, | 28 imageburn::kImageBurnServiceInterface, |
31 imageburn::kSignalBurnFinishedName, | 29 imageburn::kSignalBurnFinishedName, |
32 base::Bind(&ImageBurnerClientImpl::OnBurnFinished, | 30 base::Bind(&ImageBurnerClientImpl::OnBurnFinished, |
33 weak_ptr_factory_.GetWeakPtr()), | 31 weak_ptr_factory_.GetWeakPtr()), |
34 base::Bind(&ImageBurnerClientImpl::OnSignalConnected, | 32 base::Bind(&ImageBurnerClientImpl::OnSignalConnected, |
35 weak_ptr_factory_.GetWeakPtr())); | 33 weak_ptr_factory_.GetWeakPtr())); |
36 proxy_->ConnectToSignal( | 34 proxy_->ConnectToSignal( |
37 imageburn::kImageBurnServiceInterface, | 35 imageburn::kImageBurnServiceInterface, |
38 imageburn::kSignalBurnUpdateName, | 36 imageburn::kSignalBurnUpdateName, |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // static | 156 // static |
159 ImageBurnerClient* ImageBurnerClient::Create(dbus::Bus* bus) { | 157 ImageBurnerClient* ImageBurnerClient::Create(dbus::Bus* bus) { |
160 if (system::runtime_environment::IsRunningOnChromeOS()) { | 158 if (system::runtime_environment::IsRunningOnChromeOS()) { |
161 return new ImageBurnerClientImpl(bus); | 159 return new ImageBurnerClientImpl(bus); |
162 } else { | 160 } else { |
163 return new ImageBurnerClientStubImpl(); | 161 return new ImageBurnerClientStubImpl(); |
164 } | 162 } |
165 } | 163 } |
166 | 164 |
167 } // chromeos | 165 } // chromeos |
OLD | NEW |