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

Side by Side Diff: chrome/browser/chromeos/dbus/dbus_thread_manager.h

Issue 8289021: chromeos: Change all clients of LoginLibrary to use SessionManagerClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: renamed Created 9 years, 2 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ 6 #define CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 11
12 namespace base { 12 namespace base {
13 class Thread; 13 class Thread;
14 }; 14 };
15 15
16 namespace dbus { 16 namespace dbus {
17 class Bus; 17 class Bus;
18 }; 18 };
19 19
20 namespace chromeos { 20 namespace chromeos {
21 21
22 class CrosDBusService; 22 class CrosDBusService;
23 class PowerManagerClient; 23 class PowerManagerClient;
24 class SessionManagerClient;
24 class SensorsSource; 25 class SensorsSource;
25 26
26 // DBusThreadManager manages the D-Bus thread, the thread dedicated to 27 // DBusThreadManager manages the D-Bus thread, the thread dedicated to
27 // handling asynchronous D-Bus operations. 28 // handling asynchronous D-Bus operations.
28 // 29 //
29 // This class also manages D-Bus connections and D-Bus clients, which 30 // This class also manages D-Bus connections and D-Bus clients, which
30 // depend on the D-Bus thread to ensure the right order of shutdowns for 31 // depend on the D-Bus thread to ensure the right order of shutdowns for
31 // the D-Bus thread, the D-Bus connections, and the D-Bus clients. 32 // the D-Bus thread, the D-Bus connections, and the D-Bus clients.
32 // 33 //
33 // CALLBACKS IN D-BUS CLIENTS: 34 // CALLBACKS IN D-BUS CLIENTS:
(...skipping 14 matching lines...) Expand all
48 // making it a Singleton, to ensure clean startup and shutdown. 49 // making it a Singleton, to ensure clean startup and shutdown.
49 static void Initialize(); 50 static void Initialize();
50 51
51 // Destroys the global instance. 52 // Destroys the global instance.
52 static void Shutdown(); 53 static void Shutdown();
53 54
54 // Gets the global instance. Initialize() must be called first. 55 // Gets the global instance. Initialize() must be called first.
55 static DBusThreadManager* Get(); 56 static DBusThreadManager* Get();
56 57
57 // Returns the power manager client, owned by DBusThreadManager. 58 // Returns the power manager client, owned by DBusThreadManager.
58 // Do not cache this pointer and use it after DBusThreadManager is shut 59 // See also comments at session_manager_client().
59 // down.
60 PowerManagerClient* power_manager_client() { 60 PowerManagerClient* power_manager_client() {
61 return power_manager_client_.get(); 61 return power_manager_client_.get();
62 } 62 }
63 63
64 // Returns the session manager client, owned by DBusThreadManager.
65 // Do not cache this pointer and use it after DBusThreadManager is shut
66 // down.
67 SessionManagerClient* session_manager_client() {
68 return session_manager_client_.get();
69 }
70
71 // Sets the session manager client. Takes the ownership.
72 // The function is exported for testing.
73 void set_session_manager_client_for_testing(
74 SessionManagerClient* session_manager_client);
75
64 private: 76 private:
65 DBusThreadManager(); 77 DBusThreadManager();
66 virtual ~DBusThreadManager(); 78 virtual ~DBusThreadManager();
67 79
68 scoped_ptr<base::Thread> dbus_thread_; 80 scoped_ptr<base::Thread> dbus_thread_;
69 scoped_refptr<dbus::Bus> system_bus_; 81 scoped_refptr<dbus::Bus> system_bus_;
70 CrosDBusService* cros_dbus_service_; 82 CrosDBusService* cros_dbus_service_;
71 scoped_ptr<SensorsSource> sensors_source_; 83 scoped_ptr<SensorsSource> sensors_source_;
72 scoped_ptr<PowerManagerClient> power_manager_client_; 84 scoped_ptr<PowerManagerClient> power_manager_client_;
85 scoped_ptr<SessionManagerClient> session_manager_client_;
73 86
74 DISALLOW_COPY_AND_ASSIGN(DBusThreadManager); 87 DISALLOW_COPY_AND_ASSIGN(DBusThreadManager);
75 }; 88 };
76 89
77 } // namespace chromeos 90 } // namespace chromeos
78 91
79 #endif // CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ 92 #endif // CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/chrome_browser_main_chromeos.cc ('k') | chrome/browser/chromeos/dbus/dbus_thread_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698