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

Side by Side Diff: chromeos/dbus/image_burner_client.cc

Issue 10024054: chromeos: Convert D-Bus client classes' callback arguments to const reference (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chromeos/dbus/image_burner_client.h ('k') | chromeos/dbus/mock_cashew_client.h » ('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 (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 "dbus/bus.h" 9 #include "dbus/bus.h"
10 #include "dbus/message.h" 10 #include "dbus/message.h"
(...skipping 27 matching lines...) Expand all
38 base::Bind(&ImageBurnerClientImpl::OnBurnProgressUpdate, 38 base::Bind(&ImageBurnerClientImpl::OnBurnProgressUpdate,
39 weak_ptr_factory_.GetWeakPtr()), 39 weak_ptr_factory_.GetWeakPtr()),
40 base::Bind(&ImageBurnerClientImpl::OnSignalConnected, 40 base::Bind(&ImageBurnerClientImpl::OnSignalConnected,
41 weak_ptr_factory_.GetWeakPtr())); 41 weak_ptr_factory_.GetWeakPtr()));
42 } 42 }
43 virtual ~ImageBurnerClientImpl() {} 43 virtual ~ImageBurnerClientImpl() {}
44 44
45 // ImageBurnerClient override. 45 // ImageBurnerClient override.
46 virtual void BurnImage(const std::string& from_path, 46 virtual void BurnImage(const std::string& from_path,
47 const std::string& to_path, 47 const std::string& to_path,
48 ErrorCallback error_callback) OVERRIDE { 48 const ErrorCallback& error_callback) OVERRIDE {
49 dbus::MethodCall method_call(imageburn::kImageBurnServiceInterface, 49 dbus::MethodCall method_call(imageburn::kImageBurnServiceInterface,
50 imageburn::kBurnImage); 50 imageburn::kBurnImage);
51 dbus::MessageWriter writer(&method_call); 51 dbus::MessageWriter writer(&method_call);
52 writer.AppendString(from_path); 52 writer.AppendString(from_path);
53 writer.AppendString(to_path); 53 writer.AppendString(to_path);
54 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 54 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
55 base::Bind(&ImageBurnerClientImpl::OnBurnImage, 55 base::Bind(&ImageBurnerClientImpl::OnBurnImage,
56 weak_ptr_factory_.GetWeakPtr(), 56 weak_ptr_factory_.GetWeakPtr(),
57 error_callback)); 57 error_callback));
58 } 58 }
59 59
60 // ImageBurnerClient override. 60 // ImageBurnerClient override.
61 virtual void SetEventHandlers( 61 virtual void SetEventHandlers(
62 BurnFinishedHandler burn_finished_handler, 62 const BurnFinishedHandler& burn_finished_handler,
63 BurnProgressUpdateHandler burn_progress_update_handler) OVERRIDE { 63 const BurnProgressUpdateHandler& burn_progress_update_handler) OVERRIDE {
64 burn_finished_handler_ = burn_finished_handler; 64 burn_finished_handler_ = burn_finished_handler;
65 burn_progress_update_handler_ = burn_progress_update_handler; 65 burn_progress_update_handler_ = burn_progress_update_handler;
66 } 66 }
67 67
68 // ImageBurnerClient override. 68 // ImageBurnerClient override.
69 virtual void ResetEventHandlers() OVERRIDE { 69 virtual void ResetEventHandlers() OVERRIDE {
70 burn_finished_handler_.Reset(); 70 burn_finished_handler_.Reset();
71 burn_progress_update_handler_.Reset(); 71 burn_progress_update_handler_.Reset();
72 } 72 }
73 73
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 DISALLOW_COPY_AND_ASSIGN(ImageBurnerClientImpl); 129 DISALLOW_COPY_AND_ASSIGN(ImageBurnerClientImpl);
130 }; 130 };
131 131
132 // A stub implementaion of ImageBurnerClient. 132 // A stub implementaion of ImageBurnerClient.
133 class ImageBurnerClientStubImpl : public ImageBurnerClient { 133 class ImageBurnerClientStubImpl : public ImageBurnerClient {
134 public: 134 public:
135 ImageBurnerClientStubImpl() {} 135 ImageBurnerClientStubImpl() {}
136 virtual ~ImageBurnerClientStubImpl() {} 136 virtual ~ImageBurnerClientStubImpl() {}
137 virtual void BurnImage(const std::string& from_path, 137 virtual void BurnImage(const std::string& from_path,
138 const std::string& to_path, 138 const std::string& to_path,
139 ErrorCallback error_callback) OVERRIDE {} 139 const ErrorCallback& error_callback) OVERRIDE {}
140 virtual void SetEventHandlers( 140 virtual void SetEventHandlers(
141 BurnFinishedHandler burn_finished_handler, 141 const BurnFinishedHandler& burn_finished_handler,
142 BurnProgressUpdateHandler burn_progress_update_handler) OVERRIDE {} 142 const BurnProgressUpdateHandler& burn_progress_update_handler) OVERRIDE {}
143 virtual void ResetEventHandlers() OVERRIDE {} 143 virtual void ResetEventHandlers() OVERRIDE {}
144 144
145 private: 145 private:
146 DISALLOW_COPY_AND_ASSIGN(ImageBurnerClientStubImpl); 146 DISALLOW_COPY_AND_ASSIGN(ImageBurnerClientStubImpl);
147 }; 147 };
148 148
149 } // namespace 149 } // namespace
150 150
151 ImageBurnerClient::ImageBurnerClient() { 151 ImageBurnerClient::ImageBurnerClient() {
152 } 152 }
153 153
154 ImageBurnerClient::~ImageBurnerClient() { 154 ImageBurnerClient::~ImageBurnerClient() {
155 } 155 }
156 156
157 // static 157 // static
158 ImageBurnerClient* ImageBurnerClient::Create(DBusClientImplementationType type, 158 ImageBurnerClient* ImageBurnerClient::Create(DBusClientImplementationType type,
159 dbus::Bus* bus) { 159 dbus::Bus* bus) {
160 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) 160 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION)
161 return new ImageBurnerClientImpl(bus); 161 return new ImageBurnerClientImpl(bus);
162 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); 162 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type);
163 return new ImageBurnerClientStubImpl(); 163 return new ImageBurnerClientStubImpl();
164 } 164 }
165 165
166 } // chromeos 166 } // chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/image_burner_client.h ('k') | chromeos/dbus/mock_cashew_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698