1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_CHROMEOS_H_ 6 #define CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_CHROMEOS_H_ 7 8 #include "base/compiler_specific.h" 9 #include "base/memory/scoped_ptr.h" 10 #include "base/threading/non_thread_safe.h" 11 #include "chrome/browser/browser_process_platform_part_base.h" 12 13 namespace base { 14 class CommandLine; 15 } 16 17 namespace chromeos { 18 class ChromeUserManager; 19 class OomPriorityManager; 20 class ProfileHelper; 21 } 22 23 namespace chromeos { 24 namespace system { 25 class AutomaticRebootManager; 26 } 27 } 28 29 namespace policy { 30 class BrowserPolicyConnector; 31 class BrowserPolicyConnectorChromeOS; 32 } 33 34 namespace session_manager { 35 class SessionManager; 36 } 37 38 class Profile; 39 40 class BrowserProcessPlatformPart : public BrowserProcessPlatformPartBase, 41 public base::NonThreadSafe { 42 public: 43 BrowserProcessPlatformPart(); 44 virtual ~BrowserProcessPlatformPart(); 45 46 void InitializeAutomaticRebootManager(); 47 void ShutdownAutomaticRebootManager(); 48 49 void InitializeChromeUserManager(); 50 void DestroyChromeUserManager(); 51 52 void InitializeSessionManager(const base::CommandLine& parsed_command_line, 53 Profile* profile, 54 bool is_running_test); 55 void ShutdownSessionManager(); 56 57 // Returns the SessionManager instance that is used to initialize and 58 // start user sessions as well as responsible on launching pre-session UI like 59 // out-of-box or login. 60 virtual session_manager::SessionManager* SessionManager(); 61 62 // Returns the out-of-memory priority manager. 63 // Virtual for testing (see TestingBrowserProcessPlatformPart). 64 virtual chromeos::OomPriorityManager* oom_priority_manager(); 65 66 // Returns the ProfileHelper instance that is used to identify 67 // users and their profiles in Chrome OS multi user session. 68 chromeos::ProfileHelper* profile_helper(); 69 automatic_reboot_manager()70 chromeos::system::AutomaticRebootManager* automatic_reboot_manager() { 71 return automatic_reboot_manager_.get(); 72 } 73 74 policy::BrowserPolicyConnectorChromeOS* browser_policy_connector_chromeos(); 75 user_manager()76 chromeos::ChromeUserManager* user_manager() { 77 return chrome_user_manager_.get(); 78 } 79 80 // Overridden from BrowserProcessPlatformPartBase: 81 virtual void StartTearDown() OVERRIDE; 82 83 virtual scoped_ptr<policy::BrowserPolicyConnector> 84 CreateBrowserPolicyConnector() OVERRIDE; 85 86 private: 87 void CreateProfileHelper(); 88 89 scoped_ptr<session_manager::SessionManager> session_manager_; 90 91 bool created_profile_helper_; 92 scoped_ptr<chromeos::ProfileHelper> profile_helper_; 93 94 scoped_ptr<chromeos::OomPriorityManager> oom_priority_manager_; 95 96 scoped_ptr<chromeos::system::AutomaticRebootManager> 97 automatic_reboot_manager_; 98 99 scoped_ptr<chromeos::ChromeUserManager> chrome_user_manager_; 100 101 DISALLOW_COPY_AND_ASSIGN(BrowserProcessPlatformPart); 102 }; 103 104 #endif // CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_CHROMEOS_H_ 105