| Index: chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
|
| diff --git a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
|
| index 9254a33451003ac35648389e9c1c461be9cd56c0..2aa68233ec3410ddea1f167ef71c782f23ae0854 100644
|
| --- a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
|
| +++ b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
|
| @@ -23,6 +23,15 @@
|
| #include "ui/wm/core/wm_state.h"
|
| #endif // defined(USE_AURA)
|
|
|
| +#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
|
| +#include "base/command_line.h"
|
| +#include "chrome/browser/ui/simple_message_box.h"
|
| +#include "chrome/common/chrome_switches.h"
|
| +#include "chrome/grit/chromium_strings.h"
|
| +#include "chrome/grit/generated_resources.h"
|
| +#include "ui/base/l10n/l10n_util.h"
|
| +#endif // defined(OS_LINUX) && !defined(OS_CHROMEOS)
|
| +
|
| ChromeBrowserMainExtraPartsViews::ChromeBrowserMainExtraPartsViews() {
|
| }
|
|
|
| @@ -51,6 +60,34 @@ void ChromeBrowserMainExtraPartsViews::PreCreateThreads() {
|
| #endif
|
| }
|
|
|
| +void ChromeBrowserMainExtraPartsViews::PreProfileInit() {
|
| +#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
|
| + // On the Linux desktop, we want to prevent the user from logging in as root,
|
| + // so that we don't destroy the profile. Now that we have some minimal ui
|
| + // initialized, check to see if we're running as root and bail if we are.
|
| + if (getuid() != 0)
|
| + return;
|
| +
|
| + const base::CommandLine& command_line =
|
| + *base::CommandLine::ForCurrentProcess();
|
| + if (command_line.HasSwitch(switches::kUserDataDir))
|
| + return;
|
| +
|
| + base::string16 title = l10n_util::GetStringFUTF16(
|
| + IDS_REFUSE_TO_RUN_AS_ROOT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
|
| + base::string16 message = l10n_util::GetStringFUTF16(
|
| + IDS_REFUSE_TO_RUN_AS_ROOT_2, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
|
| +
|
| + chrome::ShowWarningMessageBox(NULL, title, message);
|
| +
|
| + // Avoids gpu_process_transport_factory.cc(153)] Check failed:
|
| + // per_compositor_data_.empty() when quit is chosen.
|
| + base::RunLoop().RunUntilIdle();
|
| +
|
| + exit(EXIT_FAILURE);
|
| +#endif
|
| +}
|
| +
|
| void ChromeBrowserMainExtraPartsViews::ServiceManagerConnectionStarted(
|
| content::ServiceManagerConnection* connection) {
|
| DCHECK(connection);
|
|
|