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_posix.h" | 5 #include "chrome/browser/browser_main_posix.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <limits.h> | 8 #include <limits.h> |
9 #include <signal.h> | 9 #include <signal.h> |
10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
11 #include <unistd.h> | 11 #include <unistd.h> |
12 | 12 |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/eintr_wrapper.h" | 16 #include "base/eintr_wrapper.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
19 #include "chrome/browser/defaults.h" | |
20 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
21 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
22 #include "content/browser/browser_thread.h" | 21 #include "content/browser/browser_thread.h" |
23 | 22 |
24 #if defined(TOOLKIT_USES_GTK) && !defined(OS_CHROMEOS) | 23 #if defined(TOOLKIT_USES_GTK) && !defined(OS_CHROMEOS) |
25 #include "chrome/browser/printing/print_dialog_gtk.h" | 24 #include "chrome/browser/printing/print_dialog_gtk.h" |
26 #endif | 25 #endif |
27 | 26 |
28 namespace { | 27 namespace { |
29 | 28 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 225 } |
227 #if defined(OS_MACOSX) | 226 #if defined(OS_MACOSX) |
228 // We use quite a few file descriptors for our IPC, and the default limit on | 227 // We use quite a few file descriptors for our IPC, and the default limit on |
229 // the Mac is low (256), so bump it up if there is no explicit override. | 228 // the Mac is low (256), so bump it up if there is no explicit override. |
230 if (fd_limit == 0) { | 229 if (fd_limit == 0) { |
231 fd_limit = 1024; | 230 fd_limit = 1024; |
232 } | 231 } |
233 #endif // OS_MACOSX | 232 #endif // OS_MACOSX |
234 if (fd_limit > 0) | 233 if (fd_limit > 0) |
235 SetFileDescriptorLimit(fd_limit); | 234 SetFileDescriptorLimit(fd_limit); |
236 | |
237 #if defined(OS_CHROMEOS) | |
238 if (parsed_command_line().HasSwitch(switches::kGuestSession)) { | |
239 // Disable sync and extensions if we're in "browse without sign-in" mode. | |
240 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess(); | |
241 singleton_command_line->AppendSwitch(switches::kDisableSync); | |
242 singleton_command_line->AppendSwitch(switches::kDisableExtensions); | |
243 browser_defaults::bookmarks_enabled = false; | |
244 } | |
245 #endif | |
246 } | 235 } |
247 | 236 |
248 void BrowserMainPartsPosix::PostMainMessageLoopStart() { | 237 void BrowserMainPartsPosix::PostMainMessageLoopStart() { |
249 int pipefd[2]; | 238 int pipefd[2]; |
250 int ret = pipe(pipefd); | 239 int ret = pipe(pipefd); |
251 if (ret < 0) { | 240 if (ret < 0) { |
252 PLOG(DFATAL) << "Failed to create pipe"; | 241 PLOG(DFATAL) << "Failed to create pipe"; |
253 } else { | 242 } else { |
254 g_shutdown_pipe_read_fd = pipefd[0]; | 243 g_shutdown_pipe_read_fd = pipefd[0]; |
255 g_shutdown_pipe_write_fd = pipefd[1]; | 244 g_shutdown_pipe_write_fd = pipefd[1]; |
256 const size_t kShutdownDetectorThreadStackSize = 4096; | 245 const size_t kShutdownDetectorThreadStackSize = 4096; |
257 // TODO(viettrungluu,willchan): crbug.com/29675 - This currently leaks, so | 246 // TODO(viettrungluu,willchan): crbug.com/29675 - This currently leaks, so |
258 // if you change this, you'll probably need to change the suppression. | 247 // if you change this, you'll probably need to change the suppression. |
259 if (!base::PlatformThread::CreateNonJoinable( | 248 if (!base::PlatformThread::CreateNonJoinable( |
260 kShutdownDetectorThreadStackSize, | 249 kShutdownDetectorThreadStackSize, |
261 new ShutdownDetector(g_shutdown_pipe_read_fd))) { | 250 new ShutdownDetector(g_shutdown_pipe_read_fd))) { |
262 LOG(DFATAL) << "Failed to create shutdown detector task."; | 251 LOG(DFATAL) << "Failed to create shutdown detector task."; |
263 } | 252 } |
264 } | 253 } |
265 | 254 |
266 #if defined(TOOLKIT_USES_GTK) && !defined(OS_CHROMEOS) | 255 #if defined(TOOLKIT_USES_GTK) && !defined(OS_CHROMEOS) |
267 printing::PrintingContextCairo::SetCreatePrintDialogFunction( | 256 printing::PrintingContextCairo::SetCreatePrintDialogFunction( |
268 &PrintDialogGtk::CreatePrintDialog); | 257 &PrintDialogGtk::CreatePrintDialog); |
269 #endif | 258 #endif |
270 } | 259 } |
OLD | NEW |