Rename BrowserActionView to ToolbarActionView
[chromium-blink-merge.git] / chrome / browser / browser_process_platform_part_chromeos.cc
blobda30ee0e28aa04228611ec1b318df1dda5267f29
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/command_line.h"
8 #include "base/logging.h"
9 #include "base/time/default_tick_clock.h"
10 #include "base/time/tick_clock.h"
11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/chromeos/login/session/chrome_session_manager.h"
13 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h"
14 #include "chrome/browser/chromeos/memory/oom_priority_manager.h"
15 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
16 #include "chrome/browser/chromeos/profiles/profile_helper.h"
17 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h"
18 #include "chrome/browser/profiles/profile.h"
19 #include "components/session_manager/core/session_manager.h"
21 BrowserProcessPlatformPart::BrowserProcessPlatformPart()
22 : created_profile_helper_(false) {
25 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() {
28 void BrowserProcessPlatformPart::InitializeAutomaticRebootManager() {
29 DCHECK(!automatic_reboot_manager_);
31 automatic_reboot_manager_.reset(new chromeos::system::AutomaticRebootManager(
32 scoped_ptr<base::TickClock>(new base::DefaultTickClock)));
35 void BrowserProcessPlatformPart::ShutdownAutomaticRebootManager() {
36 automatic_reboot_manager_.reset();
39 void BrowserProcessPlatformPart::InitializeChromeUserManager() {
40 DCHECK(!chrome_user_manager_);
41 chrome_user_manager_ =
42 chromeos::ChromeUserManagerImpl::CreateChromeUserManager();
43 chrome_user_manager_->Initialize();
46 void BrowserProcessPlatformPart::DestroyChromeUserManager() {
47 chrome_user_manager_->Destroy();
48 chrome_user_manager_.reset();
51 void BrowserProcessPlatformPart::InitializeSessionManager(
52 const base::CommandLine& parsed_command_line,
53 Profile* profile,
54 bool is_running_test) {
55 DCHECK(!session_manager_);
56 session_manager_ = chromeos::ChromeSessionManager::CreateSessionManager(
57 parsed_command_line, profile, is_running_test);
60 void BrowserProcessPlatformPart::ShutdownSessionManager() {
61 session_manager_.reset();
64 session_manager::SessionManager* BrowserProcessPlatformPart::SessionManager() {
65 DCHECK(CalledOnValidThread());
66 return session_manager_.get();
69 chromeos::OomPriorityManager*
70 BrowserProcessPlatformPart::oom_priority_manager() {
71 DCHECK(CalledOnValidThread());
72 if (!oom_priority_manager_.get())
73 oom_priority_manager_.reset(new chromeos::OomPriorityManager());
74 return oom_priority_manager_.get();
77 chromeos::ProfileHelper* BrowserProcessPlatformPart::profile_helper() {
78 DCHECK(CalledOnValidThread());
79 if (!created_profile_helper_)
80 CreateProfileHelper();
81 return profile_helper_.get();
84 policy::BrowserPolicyConnectorChromeOS*
85 BrowserProcessPlatformPart::browser_policy_connector_chromeos() {
86 return static_cast<policy::BrowserPolicyConnectorChromeOS*>(
87 g_browser_process->browser_policy_connector());
90 void BrowserProcessPlatformPart::StartTearDown() {
91 profile_helper_.reset();
94 scoped_ptr<policy::BrowserPolicyConnector>
95 BrowserProcessPlatformPart::CreateBrowserPolicyConnector() {
96 return scoped_ptr<policy::BrowserPolicyConnector>(
97 new policy::BrowserPolicyConnectorChromeOS());
100 void BrowserProcessPlatformPart::CreateProfileHelper() {
101 DCHECK(!created_profile_helper_ && profile_helper_.get() == NULL);
102 created_profile_helper_ = true;
103 profile_helper_.reset(new chromeos::ProfileHelper());