Chromium Code Reviews| 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/ui/views/chrome_browser_main_extra_parts_views.h" | 5 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h" |
| 6 | 6 |
| 7 #if defined(OS_LINUX) | |
|
Tom (Use chromium acct)
2017/02/19 19:16:06
Move ifdef'ed includes to the bottom
Kevin Cernekee
2017/02/19 19:33:46
Done.
| |
| 8 #include <sys/stat.h> | |
| 9 #include <sys/types.h> | |
| 10 #include <unistd.h> | |
| 11 #endif | |
| 12 | |
| 13 #include <utility> | |
| 14 | |
| 7 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" | 16 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" |
| 9 #include "chrome/browser/ui/views/chrome_views_delegate.h" | 17 #include "chrome/browser/ui/views/chrome_views_delegate.h" |
| 10 #include "chrome/browser/ui/views/ime_driver/ime_driver_mus.h" | 18 #include "chrome/browser/ui/views/ime_driver/ime_driver_mus.h" |
| 11 #include "components/constrained_window/constrained_window_views.h" | 19 #include "components/constrained_window/constrained_window_views.h" |
| 12 | 20 |
| 13 #if defined(USE_AURA) | 21 #if defined(USE_AURA) |
| 14 #include "base/run_loop.h" | 22 #include "base/run_loop.h" |
| 15 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/common/service_manager_connection.h" | 24 #include "content/public/common/service_manager_connection.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 IMEDriver::Register(); | 78 IMEDriver::Register(); |
| 71 #endif | 79 #endif |
| 72 | 80 |
| 73 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 81 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 74 // On the Linux desktop, we want to prevent the user from logging in as root, | 82 // On the Linux desktop, we want to prevent the user from logging in as root, |
| 75 // so that we don't destroy the profile. Now that we have some minimal ui | 83 // so that we don't destroy the profile. Now that we have some minimal ui |
| 76 // initialized, check to see if we're running as root and bail if we are. | 84 // initialized, check to see if we're running as root and bail if we are. |
| 77 if (geteuid() != 0) | 85 if (geteuid() != 0) |
| 78 return; | 86 return; |
| 79 | 87 |
| 88 // Allow running inside an unprivileged user namespace. In that case, / | |
|
Tom (Use chromium acct)
2017/02/19 19:16:06
remove / ?
Kevin Cernekee
2017/02/19 19:33:46
I changed it to "the root directory" to make the c
| |
| 89 // will be owned by an unmapped UID and GID. | |
| 90 struct stat st; | |
| 91 if (stat("/", &st) == 0 && st.st_uid != 0) | |
| 92 return; | |
| 93 | |
| 80 const base::CommandLine& command_line = | 94 const base::CommandLine& command_line = |
| 81 *base::CommandLine::ForCurrentProcess(); | 95 *base::CommandLine::ForCurrentProcess(); |
| 82 if (command_line.HasSwitch(switches::kNoSandbox)) | 96 if (command_line.HasSwitch(switches::kNoSandbox)) |
| 83 return; | 97 return; |
| 84 | 98 |
| 85 base::string16 title = l10n_util::GetStringFUTF16( | 99 base::string16 title = l10n_util::GetStringFUTF16( |
| 86 IDS_REFUSE_TO_RUN_AS_ROOT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 100 IDS_REFUSE_TO_RUN_AS_ROOT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 87 base::string16 message = l10n_util::GetStringFUTF16( | 101 base::string16 message = l10n_util::GetStringFUTF16( |
| 88 IDS_REFUSE_TO_RUN_AS_ROOT_2, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 102 IDS_REFUSE_TO_RUN_AS_ROOT_2, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 89 | 103 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 110 // WMState is owned as a member, so don't have MusClient create it. | 124 // WMState is owned as a member, so don't have MusClient create it. |
| 111 const bool create_wm_state = false; | 125 const bool create_wm_state = false; |
| 112 mus_client_ = base::MakeUnique<views::MusClient>( | 126 mus_client_ = base::MakeUnique<views::MusClient>( |
| 113 connection->GetConnector(), service_manager::Identity(), | 127 connection->GetConnector(), service_manager::Identity(), |
| 114 content::BrowserThread::GetTaskRunnerForThread( | 128 content::BrowserThread::GetTaskRunnerForThread( |
| 115 content::BrowserThread::IO), | 129 content::BrowserThread::IO), |
| 116 create_wm_state); | 130 create_wm_state); |
| 117 } | 131 } |
| 118 #endif // defined(USE_AURA) | 132 #endif // defined(USE_AURA) |
| 119 } | 133 } |
| OLD | NEW |