OLD | NEW |
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 #include "chrome/browser/browser_main_gtk.h" | 5 #include "chrome/browser/browser_main_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include <unistd.h> | 10 #include <unistd.h> |
11 | 11 |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/debug/debugger.h" | 13 #include "base/debug/debugger.h" |
14 #include "chrome/browser/browser_main_win.h" | 14 #include "chrome/browser/browser_main_win.h" |
15 #include "chrome/browser/metrics/metrics_service.h" | 15 #include "chrome/browser/metrics/metrics_service.h" |
16 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "content/browser/renderer_host/render_sandbox_host_linux.h" | 18 #include "content/browser/renderer_host/render_sandbox_host_linux.h" |
19 #include "content/browser/zygote_host_linux.h" | 19 #include "content/browser/zygote_host_linux.h" |
20 #include "content/common/result_codes.h" | 20 #include "content/common/result_codes.h" |
21 #include "grit/chromium_strings.h" | 21 #include "grit/chromium_strings.h" |
22 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
24 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
25 #include "ui/base/x/x11_util.h" | 25 #include "ui/base/x/x11_util.h" |
26 #include "ui/base/x/x11_util_internal.h" | 26 #include "ui/base/x/x11_util_internal.h" |
27 #include "ui/gfx/gtk_util.h" | 27 #include "ui/gfx/gtk_util.h" |
28 | 28 |
29 #if defined(USE_NSS) | 29 #if defined(USE_NSS) |
30 #include "base/nss_util.h" | 30 #include "crypto/nss_util.h" |
31 #endif | 31 #endif |
32 | 32 |
33 #if defined(USE_LINUX_BREAKPAD) | 33 #if defined(USE_LINUX_BREAKPAD) |
34 #include "chrome/app/breakpad_linux.h" | 34 #include "chrome/app/breakpad_linux.h" |
35 #endif | 35 #endif |
36 | 36 |
37 namespace { | 37 namespace { |
38 | 38 |
39 // Indicates that we're currently responding to an IO error (by shutting down). | 39 // Indicates that we're currently responding to an IO error (by shutting down). |
40 bool g_in_x11_io_error_handler = false; | 40 bool g_in_x11_io_error_handler = false; |
(...skipping 21 matching lines...) Expand all Loading... |
62 | 62 |
63 void BrowserMainPartsGtk::PreEarlyInitialization() { | 63 void BrowserMainPartsGtk::PreEarlyInitialization() { |
64 DetectRunningAsRoot(); | 64 DetectRunningAsRoot(); |
65 | 65 |
66 BrowserMainPartsPosix::PreEarlyInitialization(); | 66 BrowserMainPartsPosix::PreEarlyInitialization(); |
67 | 67 |
68 SetupSandbox(); | 68 SetupSandbox(); |
69 | 69 |
70 #if defined(USE_NSS) | 70 #if defined(USE_NSS) |
71 // We want to be sure to init NSPR on the main thread. | 71 // We want to be sure to init NSPR on the main thread. |
72 base::EnsureNSPRInit(); | 72 crypto::EnsureNSPRInit(); |
73 #endif | 73 #endif |
74 } | 74 } |
75 | 75 |
76 void BrowserMainPartsGtk::DetectRunningAsRoot() { | 76 void BrowserMainPartsGtk::DetectRunningAsRoot() { |
77 if (geteuid() == 0) { | 77 if (geteuid() == 0) { |
78 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 78 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
79 if (!parsed_command_line().HasSwitch(switches::kUserDataDir)) | 79 if (!parsed_command_line().HasSwitch(switches::kUserDataDir)) |
80 return; | 80 return; |
81 | 81 |
82 gfx::GtkInitFromCommandLine(command_line); | 82 gfx::GtkInitFromCommandLine(command_line); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 ui::SetX11ErrorHandlers(BrowserX11ErrorHandler, BrowserX11IOErrorHandler); | 181 ui::SetX11ErrorHandlers(BrowserX11ErrorHandler, BrowserX11IOErrorHandler); |
182 } | 182 } |
183 | 183 |
184 #if !defined(OS_CHROMEOS) | 184 #if !defined(OS_CHROMEOS) |
185 // static | 185 // static |
186 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts( | 186 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts( |
187 const MainFunctionParams& parameters) { | 187 const MainFunctionParams& parameters) { |
188 return new BrowserMainPartsGtk(parameters); | 188 return new BrowserMainPartsGtk(parameters); |
189 } | 189 } |
190 #endif | 190 #endif |
OLD | NEW |