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

Side by Side Diff: src/platform/cryptohome/service.h

Issue 2051003: Initial patch from Will. (Closed) Base URL: ssh://git@chromiumos-git/chromiumos
Patch Set: Address style nits. Created 10 years, 7 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
OLDNEW
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS 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 #ifndef CRYPTOHOME_SERVICE_H_ 4 #ifndef CRYPTOHOME_SERVICE_H_
5 #define CRYPTOHOME_SERVICE_H_ 5 #define CRYPTOHOME_SERVICE_H_
6 6
7 #include <dbus/dbus-glib.h> 7 #include <dbus/dbus-glib.h>
8 #include <glib-object.h> 8 #include <glib-object.h>
9 9
10 #include <base/logging.h> 10 #include <base/logging.h>
11 #include <chromeos/dbus/abstract_dbus_service.h> 11 #include <chromeos/dbus/abstract_dbus_service.h>
12 #include <chromeos/dbus/dbus.h> 12 #include <chromeos/dbus/dbus.h>
13 #include <chromeos/dbus/service_constants.h> 13 #include <chromeos/dbus/service_constants.h>
14 #include <chromeos/glib/object.h> 14 #include <chromeos/glib/object.h>
15 15
16 #include "cryptohome/authenticator.h" 16 #include "cryptohome/mount.h"
17 17
18 namespace cryptohome { 18 namespace cryptohome {
19 namespace gobject { 19 namespace gobject {
20 struct Cryptohome; 20 struct Cryptohome;
21 } // namespace gobject 21 } // namespace gobject
22 22
23 // Service 23 // Service
24 // Provides a wrapper for exporting CryptohomeInterface to 24 // Provides a wrapper for exporting CryptohomeInterface to
25 // D-Bus and entering the glib run loop. 25 // D-Bus and entering the glib run loop.
26 // 26 //
(...skipping 16 matching lines...) Expand all
43 // proper service information. 43 // proper service information.
44 virtual const char *service_name() const 44 virtual const char *service_name() const
45 { return kCryptohomeServiceName; } 45 { return kCryptohomeServiceName; }
46 virtual const char *service_path() const 46 virtual const char *service_path() const
47 { return kCryptohomeServicePath; } 47 { return kCryptohomeServicePath; }
48 virtual const char *service_interface() const 48 virtual const char *service_interface() const
49 { return kCryptohomeInterface; } 49 { return kCryptohomeInterface; }
50 virtual GObject* service_object() const { 50 virtual GObject* service_object() const {
51 return G_OBJECT(cryptohome_); 51 return G_OBJECT(cryptohome_);
52 } 52 }
53 // Command-related accesors 53 virtual void set_mount(Mount* mount)
54 virtual const char *mount_command() const 54 { mount_ = mount; }
55 { return mount_command_; }
56 virtual void set_mount_command(const char *cmd) { mount_command_ = cmd; }
57 virtual const char *unmount_command() const
58 { return unmount_command_; }
59 virtual void set_unmount_command(const char *cmd) { unmount_command_ = cmd; }
60 virtual const char *is_mounted_command() const
61 { return is_mounted_command_; }
62 virtual void set_is_mounted_command(const char *cmd)
63 { is_mounted_command_ = cmd; }
64 virtual void set_authenticator(Authenticator *auth) { auth_.reset(auth); }
65
66 static const char *kDefaultMountCommand;
67 static const char *kDefaultUnmountCommand;
68 static const char *kDefaultIsMountedCommand;
69 55
70 // Service implementation functions as wrapped in interface.cc 56 // Service implementation functions as wrapped in interface.cc
71 // and defined in cryptohome.xml. 57 // and defined in cryptohome.xml.
72 virtual gboolean CheckKey(gchar *user, 58 virtual gboolean CheckKey(gchar *user,
73 gchar *key, 59 gchar *key,
74 gboolean *OUT_success, 60 gboolean *OUT_success,
75 GError **error); 61 GError **error);
62 virtual gboolean MigrateKey(gchar *user,
63 gchar *from_key,
64 gchar *to_key,
65 gboolean *OUT_success,
66 GError **error);
67 virtual gboolean Remove(gchar *user,
68 gboolean *OUT_success,
69 GError **error);
70 virtual gboolean GetSystemSalt(GArray **OUT_salt, GError **error);
76 virtual gboolean IsMounted(gboolean *OUT_is_mounted, GError **error); 71 virtual gboolean IsMounted(gboolean *OUT_is_mounted, GError **error);
77 virtual gboolean Mount(gchar *user, 72 virtual gboolean Mount(gchar *user,
78 gchar *key, 73 gchar *key,
79 gboolean *OUT_done, 74 gboolean *OUT_done,
80 GError **error); 75 GError **error);
81 virtual gboolean Unmount(gboolean *OUT_done, GError **error); 76 virtual gboolean Unmount(gboolean *OUT_done, GError **error);
82 77
83 protected: 78 protected:
84 virtual GMainLoop *main_loop() { return loop_; } 79 virtual GMainLoop *main_loop() { return loop_; }
85 80
86 private: 81 private:
87 GMainLoop *loop_; 82 GMainLoop *loop_;
88 scoped_ptr<Authenticator> auth_;
89 // Can't use scoped_ptr for cryptohome_ because memory is allocated by glib. 83 // Can't use scoped_ptr for cryptohome_ because memory is allocated by glib.
90 gobject::Cryptohome *cryptohome_; 84 gobject::Cryptohome *cryptohome_;
91 const char *mount_command_; 85 chromeos::Blob system_salt_;
92 const char *unmount_command_; 86 cryptohome::Mount* mount_;
93 const char *is_mounted_command_;
94 DISALLOW_COPY_AND_ASSIGN(Service); 87 DISALLOW_COPY_AND_ASSIGN(Service);
95 }; 88 };
96 89
97 } // cryptohome 90 } // cryptohome
98 #endif // CRYPTOHOME_SERVICE_H_ 91 #endif // CRYPTOHOME_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698