| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/chrome_browser_main_posix.h" | 5 #include "chrome/browser/chrome_browser_main_posix.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <limits.h> | 8 #include <limits.h> |
| 9 #include <pthread.h> | 9 #include <pthread.h> |
| 10 #include <signal.h> | 10 #include <signal.h> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
| 22 #include "chrome/browser/lifetime/application_lifetime.h" | 22 #include "chrome/browser/lifetime/application_lifetime.h" |
| 23 #include "chrome/browser/sessions/session_restore.h" | 23 #include "chrome/browser/sessions/session_restore.h" |
| 24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
| 25 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
| 26 #include "content/public/browser/notification_observer.h" | 26 #include "content/public/browser/notification_observer.h" |
| 27 #include "content/public/browser/notification_registrar.h" | 27 #include "content/public/browser/notification_registrar.h" |
| 28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
| 29 | 29 |
| 30 #if defined(TOOLKIT_GTK) | 30 #if defined(TOOLKIT_GTK) |
| 31 #include "chrome/browser/ui/gtk/chrome_browser_main_extra_parts_gtk.h" |
| 32 |
| 33 #if defined(ENABLE_PRINTING) |
| 31 #include "chrome/browser/printing/print_dialog_gtk.h" | 34 #include "chrome/browser/printing/print_dialog_gtk.h" |
| 32 #include "chrome/browser/ui/gtk/chrome_browser_main_extra_parts_gtk.h" | 35 #endif // defined(ENABLE_PRINTING) |
| 33 #endif | 36 #endif // defined(TOOLKIT_GTK) |
| 34 | 37 |
| 35 using content::BrowserThread; | 38 using content::BrowserThread; |
| 36 | 39 |
| 37 namespace { | 40 namespace { |
| 38 | 41 |
| 39 // See comment in |PreEarlyInitialization()|, where sigaction is called. | 42 // See comment in |PreEarlyInitialization()|, where sigaction is called. |
| 40 void SIGCHLDHandler(int signal) { | 43 void SIGCHLDHandler(int signal) { |
| 41 } | 44 } |
| 42 | 45 |
| 43 // The OSX fork() implementation can crash in the child process before | 46 // The OSX fork() implementation can crash in the child process before |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 CHECK(sigaction(SIGTERM, &action, NULL) == 0); | 344 CHECK(sigaction(SIGTERM, &action, NULL) == 0); |
| 342 // Also handle SIGINT - when the user terminates the browser via Ctrl+C. If | 345 // Also handle SIGINT - when the user terminates the browser via Ctrl+C. If |
| 343 // the browser process is being debugged, GDB will catch the SIGINT first. | 346 // the browser process is being debugged, GDB will catch the SIGINT first. |
| 344 action.sa_handler = SIGINTHandler; | 347 action.sa_handler = SIGINTHandler; |
| 345 CHECK(sigaction(SIGINT, &action, NULL) == 0); | 348 CHECK(sigaction(SIGINT, &action, NULL) == 0); |
| 346 // And SIGHUP, for when the terminal disappears. On shutdown, many Linux | 349 // And SIGHUP, for when the terminal disappears. On shutdown, many Linux |
| 347 // distros send SIGHUP, SIGTERM, and then SIGKILL. | 350 // distros send SIGHUP, SIGTERM, and then SIGKILL. |
| 348 action.sa_handler = SIGHUPHandler; | 351 action.sa_handler = SIGHUPHandler; |
| 349 CHECK(sigaction(SIGHUP, &action, NULL) == 0); | 352 CHECK(sigaction(SIGHUP, &action, NULL) == 0); |
| 350 | 353 |
| 351 #if defined(TOOLKIT_GTK) | 354 #if defined(TOOLKIT_GTK) && defined(ENABLE_PRINTING) |
| 352 printing::PrintingContextGtk::SetCreatePrintDialogFunction( | 355 printing::PrintingContextGtk::SetCreatePrintDialogFunction( |
| 353 &PrintDialogGtk::CreatePrintDialog); | 356 &PrintDialogGtk::CreatePrintDialog); |
| 354 #endif | 357 #endif |
| 355 } | 358 } |
| 356 | 359 |
| 357 void ChromeBrowserMainPartsPosix::ShowMissingLocaleMessageBox() { | 360 void ChromeBrowserMainPartsPosix::ShowMissingLocaleMessageBox() { |
| 358 #if defined(OS_CHROMEOS) | 361 #if defined(OS_CHROMEOS) |
| 359 NOTREACHED(); // Should not ever happen on ChromeOS. | 362 NOTREACHED(); // Should not ever happen on ChromeOS. |
| 360 #elif defined(OS_MACOSX) | 363 #elif defined(OS_MACOSX) |
| 361 // Not called on Mac because we load the locale files differently. | 364 // Not called on Mac because we load the locale files differently. |
| 362 NOTREACHED(); | 365 NOTREACHED(); |
| 363 #elif defined(TOOLKIT_GTK) | 366 #elif defined(TOOLKIT_GTK) |
| 364 ChromeBrowserMainExtraPartsGtk::ShowMessageBox( | 367 ChromeBrowserMainExtraPartsGtk::ShowMessageBox( |
| 365 chrome_browser::kMissingLocaleDataMessage); | 368 chrome_browser::kMissingLocaleDataMessage); |
| 366 #elif defined(USE_AURA) | 369 #elif defined(USE_AURA) |
| 367 // TODO(port): We may want a views based message dialog here eventually, but | 370 // TODO(port): We may want a views based message dialog here eventually, but |
| 368 // for now, crash. | 371 // for now, crash. |
| 369 NOTREACHED(); | 372 NOTREACHED(); |
| 370 #else | 373 #else |
| 371 #error "Need MessageBox implementation." | 374 #error "Need MessageBox implementation." |
| 372 #endif | 375 #endif |
| 373 } | 376 } |
| OLD | NEW |