OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <sys/stat.h> | 7 #include <sys/stat.h> |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 | 10 |
11 #include "app/x11_util.h" | |
12 #include "app/x11_util_internal.h" | |
13 #include "base/command_line.h" | 11 #include "base/command_line.h" |
14 #include "base/debug/debugger.h" | 12 #include "base/debug/debugger.h" |
15 #include "chrome/browser/browser_list.h" | 13 #include "chrome/browser/browser_list.h" |
16 #include "chrome/browser/browser_main_gtk.h" | 14 #include "chrome/browser/browser_main_gtk.h" |
17 #include "chrome/browser/browser_main_win.h" | 15 #include "chrome/browser/browser_main_win.h" |
18 #include "chrome/browser/metrics/metrics_service.h" | 16 #include "chrome/browser/metrics/metrics_service.h" |
19 #include "chrome/browser/renderer_host/render_sandbox_host_linux.h" | 17 #include "chrome/browser/renderer_host/render_sandbox_host_linux.h" |
20 #include "chrome/browser/zygote_host_linux.h" | 18 #include "chrome/browser/zygote_host_linux.h" |
21 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/common/result_codes.h" | 20 #include "chrome/common/result_codes.h" |
| 21 #include "ui/base/x/x11_util.h" |
| 22 #include "ui/base/x/x11_util_internal.h" |
23 | 23 |
24 #if defined(USE_NSS) | 24 #if defined(USE_NSS) |
25 #include "base/nss_util.h" | 25 #include "base/nss_util.h" |
26 #endif | 26 #endif |
27 | 27 |
28 #if defined(USE_LINUX_BREAKPAD) | 28 #if defined(USE_LINUX_BREAKPAD) |
29 #include "chrome/app/breakpad_linux.h" | 29 #include "chrome/app/breakpad_linux.h" |
30 #endif | 30 #endif |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 // Indicates that we're currently responding to an IO error (by shutting down). | 34 // Indicates that we're currently responding to an IO error (by shutting down). |
35 bool g_in_x11_io_error_handler = false; | 35 bool g_in_x11_io_error_handler = false; |
36 | 36 |
37 int BrowserX11ErrorHandler(Display* d, XErrorEvent* error) { | 37 int BrowserX11ErrorHandler(Display* d, XErrorEvent* error) { |
38 if (!g_in_x11_io_error_handler) | 38 if (!g_in_x11_io_error_handler) |
39 LOG(ERROR) << x11_util::GetErrorEventDescription(d, error); | 39 LOG(ERROR) << ui::GetErrorEventDescription(d, error); |
40 return 0; | 40 return 0; |
41 } | 41 } |
42 | 42 |
43 int BrowserX11IOErrorHandler(Display* d) { | 43 int BrowserX11IOErrorHandler(Display* d) { |
44 // If there's an IO error it likely means the X server has gone away | 44 // If there's an IO error it likely means the X server has gone away |
45 if (!g_in_x11_io_error_handler) { | 45 if (!g_in_x11_io_error_handler) { |
46 g_in_x11_io_error_handler = true; | 46 g_in_x11_io_error_handler = true; |
47 LOG(ERROR) << "X IO Error detected"; | 47 LOG(ERROR) << "X IO Error detected"; |
48 BrowserList::SessionEnding(); | 48 BrowserList::SessionEnding(); |
49 } | 49 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 bool CheckMachineLevelInstall() { | 121 bool CheckMachineLevelInstall() { |
122 return false; | 122 return false; |
123 } | 123 } |
124 | 124 |
125 void PrepareRestartOnCrashEnviroment(const CommandLine &parsed_command_line) { | 125 void PrepareRestartOnCrashEnviroment(const CommandLine &parsed_command_line) { |
126 } | 126 } |
127 | 127 |
128 void SetBrowserX11ErrorHandlers() { | 128 void SetBrowserX11ErrorHandlers() { |
129 // Set up error handlers to make sure profile gets written if X server | 129 // Set up error handlers to make sure profile gets written if X server |
130 // goes away. | 130 // goes away. |
131 x11_util::SetX11ErrorHandlers( | 131 ui::SetX11ErrorHandlers(BrowserX11ErrorHandler, BrowserX11IOErrorHandler); |
132 BrowserX11ErrorHandler, | |
133 BrowserX11IOErrorHandler); | |
134 } | 132 } |
135 | 133 |
136 #if !defined(OS_CHROMEOS) | 134 #if !defined(OS_CHROMEOS) |
137 // static | 135 // static |
138 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts( | 136 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts( |
139 const MainFunctionParams& parameters) { | 137 const MainFunctionParams& parameters) { |
140 return new BrowserMainPartsGtk(parameters); | 138 return new BrowserMainPartsGtk(parameters); |
141 } | 139 } |
142 #endif | 140 #endif |
OLD | NEW |