Upstream version 5.34.92.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / chrome_browser_main_linux.cc
1 // Copyright (c) 2012 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 #include "chrome/browser/chrome_browser_main_linux.h"
6
7 #include <stdlib.h>
8
9 #include "base/command_line.h"
10 #include "base/linux_util.h"
11 #include "base/prefs/pref_service.h"
12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/metrics/metrics_service.h"
14 #include "chrome/common/chrome_switches.h"
15 #include "chrome/common/env_vars.h"
16 #include "chrome/common/pref_names.h"
17 #include "components/breakpad/app/breakpad_linux.h"
18
19 #if !defined(OS_CHROMEOS)
20 #include "chrome/browser/storage_monitor/storage_monitor_linux.h"
21 #include "chrome/browser/sxs_linux.h"
22 #include "content/public/browser/browser_thread.h"
23 #endif
24
25 namespace {
26
27 #if !defined(OS_CHROMEOS)
28 void GetLinuxDistroCallback() {
29   base::GetLinuxDistro();  // Initialize base::linux_distro if needed.
30 }
31 #endif
32
33 }  // namespace
34
35 ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux(
36     const content::MainFunctionParams& parameters)
37     : ChromeBrowserMainPartsPosix(parameters) {
38 }
39
40 ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() {
41 }
42
43 void ChromeBrowserMainPartsLinux::PreProfileInit() {
44 #if !defined(OS_CHROMEOS)
45   // Needs to be called after we have chrome::DIR_USER_DATA and
46   // g_browser_process.  This happens in PreCreateThreads.
47   content::BrowserThread::PostTask(content::BrowserThread::FILE,
48                                    FROM_HERE,
49                                    base::Bind(&GetLinuxDistroCallback));
50
51   content::BrowserThread::PostTask(
52       content::BrowserThread::FILE,
53       FROM_HERE,
54       base::Bind(&sxs_linux::AddChannelMarkToUserDataDir));
55 #endif
56
57   ChromeBrowserMainPartsPosix::PreProfileInit();
58 }
59
60 void ChromeBrowserMainPartsLinux::PostProfileInit() {
61   ChromeBrowserMainPartsPosix::PostProfileInit();
62
63   g_browser_process->metrics_service()->RecordBreakpadRegistration(
64       breakpad::IsCrashReporterEnabled());
65 }