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.
5 #include "chrome/browser/browser_process_platform_part_chromeos.h"
7 #include "base/logging.h"
8 #include "base/time/default_tick_clock.h"
9 #include "base/time/tick_clock.h"
10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/chromeos/memory/oom_priority_manager.h"
12 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
13 #include "chrome/browser/chromeos/profiles/profile_helper.h"
14 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h"
16 BrowserProcessPlatformPart::BrowserProcessPlatformPart()
17 : created_profile_helper_(false) {
20 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() {
23 void BrowserProcessPlatformPart::InitializeAutomaticRebootManager() {
24 DCHECK(!automatic_reboot_manager_
);
26 automatic_reboot_manager_
.reset(new chromeos::system::AutomaticRebootManager(
27 scoped_ptr
<base::TickClock
>(new base::DefaultTickClock
)));
30 void BrowserProcessPlatformPart::ShutdownAutomaticRebootManager() {
31 automatic_reboot_manager_
.reset();
34 chromeos::OomPriorityManager
*
35 BrowserProcessPlatformPart::oom_priority_manager() {
36 DCHECK(CalledOnValidThread());
37 if (!oom_priority_manager_
.get())
38 oom_priority_manager_
.reset(new chromeos::OomPriorityManager());
39 return oom_priority_manager_
.get();
42 chromeos::ProfileHelper
* BrowserProcessPlatformPart::profile_helper() {
43 DCHECK(CalledOnValidThread());
44 if (!created_profile_helper_
)
45 CreateProfileHelper();
46 return profile_helper_
.get();
49 policy::BrowserPolicyConnectorChromeOS
*
50 BrowserProcessPlatformPart::browser_policy_connector_chromeos() {
51 return static_cast<policy::BrowserPolicyConnectorChromeOS
*>(
52 g_browser_process
->browser_policy_connector());
55 void BrowserProcessPlatformPart::StartTearDown() {
56 profile_helper_
.reset();
59 scoped_ptr
<policy::BrowserPolicyConnector
>
60 BrowserProcessPlatformPart::CreateBrowserPolicyConnector() {
61 return scoped_ptr
<policy::BrowserPolicyConnector
>(
62 new policy::BrowserPolicyConnectorChromeOS());
65 void BrowserProcessPlatformPart::CreateProfileHelper() {
66 DCHECK(!created_profile_helper_
&& profile_helper_
.get() == NULL
);
67 created_profile_helper_
= true;
68 profile_helper_
.reset(new chromeos::ProfileHelper());