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

Side by Side Diff: chromeos/cryptohome/homedir_methods.cc

Issue 2748743004: cryptohome: Add dbus method and signal name for encryption migration. (Closed)
Patch Set: Roll DEPS Created 3 years, 9 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
« no previous file with comments | « chromeos/cryptohome/homedir_methods.h ('k') | chromeos/cryptohome/mock_homedir_methods.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/cryptohome/homedir_methods.h" 5 #include "chromeos/cryptohome/homedir_methods.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } 291 }
292 292
293 void GetAccountDiskUsage( 293 void GetAccountDiskUsage(
294 const Identification& id, 294 const Identification& id,
295 const GetAccountDiskUsageCallback& callback) override { 295 const GetAccountDiskUsageCallback& callback) override {
296 DBusThreadManager::Get()->GetCryptohomeClient()->GetAccountDiskUsage( 296 DBusThreadManager::Get()->GetCryptohomeClient()->GetAccountDiskUsage(
297 id, base::Bind(&HomedirMethodsImpl::OnGetAccountDiskUsageCallback, 297 id, base::Bind(&HomedirMethodsImpl::OnGetAccountDiskUsageCallback,
298 weak_ptr_factory_.GetWeakPtr(), callback)); 298 weak_ptr_factory_.GetWeakPtr(), callback));
299 } 299 }
300 300
301 void MigrateToDircrypto(const Identification& id,
302 const Authorization& auth,
303 const DBusResultCallback& callback) override {
304 cryptohome::AuthorizationRequest auth_proto;
305 FillAuthorizationProtobuf(auth, &auth_proto);
306
307 DBusThreadManager::Get()->GetCryptohomeClient()->MigrateToDircrypto(
308 id, auth_proto,
309 base::Bind(&HomedirMethodsImpl::OnDBusResultCallback,
310 weak_ptr_factory_.GetWeakPtr(), callback));
311 }
312
301 private: 313 private:
302 void OnGetKeyDataExCallback(const GetKeyDataCallback& callback, 314 void OnGetKeyDataExCallback(const GetKeyDataCallback& callback,
303 chromeos::DBusMethodCallStatus call_status, 315 chromeos::DBusMethodCallStatus call_status,
304 bool result, 316 bool result,
305 const BaseReply& reply) { 317 const BaseReply& reply) {
306 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) { 318 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) {
307 callback.Run(false, MOUNT_ERROR_FATAL, std::vector<KeyDefinition>()); 319 callback.Run(false, MOUNT_ERROR_FATAL, std::vector<KeyDefinition>());
308 return; 320 return;
309 } 321 }
310 if (reply.has_error()) { 322 if (reply.has_error()) {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 } 464 }
453 if (reply.has_error()) { 465 if (reply.has_error()) {
454 if (reply.error() != CRYPTOHOME_ERROR_NOT_SET) { 466 if (reply.error() != CRYPTOHOME_ERROR_NOT_SET) {
455 callback.Run(false, MapError(reply.error())); 467 callback.Run(false, MapError(reply.error()));
456 return; 468 return;
457 } 469 }
458 } 470 }
459 callback.Run(true, MOUNT_ERROR_NONE); 471 callback.Run(true, MOUNT_ERROR_NONE);
460 } 472 }
461 473
474 void OnDBusResultCallback(const DBusResultCallback& callback,
475 chromeos::DBusMethodCallStatus call_status) {
476 callback.Run(call_status == chromeos::DBUS_METHOD_CALL_SUCCESS);
477 }
478
462 base::WeakPtrFactory<HomedirMethodsImpl> weak_ptr_factory_; 479 base::WeakPtrFactory<HomedirMethodsImpl> weak_ptr_factory_;
463 480
464 DISALLOW_COPY_AND_ASSIGN(HomedirMethodsImpl); 481 DISALLOW_COPY_AND_ASSIGN(HomedirMethodsImpl);
465 }; 482 };
466 483
467 } // namespace 484 } // namespace
468 485
469 // static 486 // static
470 void HomedirMethods::Initialize() { 487 void HomedirMethods::Initialize() {
471 if (g_homedir_methods) { 488 if (g_homedir_methods) {
(...skipping 22 matching lines...) Expand all
494 } 511 }
495 delete g_homedir_methods; 512 delete g_homedir_methods;
496 g_homedir_methods = NULL; 513 g_homedir_methods = NULL;
497 VLOG(1) << "HomedirMethods Shutdown completed"; 514 VLOG(1) << "HomedirMethods Shutdown completed";
498 } 515 }
499 516
500 // static 517 // static
501 HomedirMethods* HomedirMethods::GetInstance() { return g_homedir_methods; } 518 HomedirMethods* HomedirMethods::GetInstance() { return g_homedir_methods; }
502 519
503 } // namespace cryptohome 520 } // namespace cryptohome
OLDNEW
« no previous file with comments | « chromeos/cryptohome/homedir_methods.h ('k') | chromeos/cryptohome/mock_homedir_methods.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698