| 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 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" | 7 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" |
| 8 #include "chrome/browser/ui/views/chrome_views_delegate.h" | 8 #include "chrome/browser/ui/views/chrome_views_delegate.h" |
| 9 #include "components/constrained_window/constrained_window_views.h" | 9 #include "components/constrained_window/constrained_window_views.h" |
| 10 | 10 |
| 11 #if defined(USE_AURA) | 11 #if defined(USE_AURA) |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 14 #include "content/public/common/service_manager_connection.h" | 14 #include "content/public/common/service_manager_connection.h" |
| 15 #include "services/service_manager/public/cpp/connector.h" | 15 #include "services/service_manager/public/cpp/connector.h" |
| 16 #include "services/service_manager/runner/common/client_util.h" | 16 #include "services/service_manager/runner/common/client_util.h" |
| 17 #include "services/ui/public/cpp/gpu_service.h" | 17 #include "services/ui/public/cpp/gpu_service.h" |
| 18 #include "services/ui/public/cpp/input_devices/input_device_client.h" | 18 #include "services/ui/public/cpp/input_devices/input_device_client.h" |
| 19 #include "services/ui/public/interfaces/constants.mojom.h" | 19 #include "services/ui/public/interfaces/constants.mojom.h" |
| 20 #include "services/ui/public/interfaces/input_devices/input_device_server.mojom.
h" | 20 #include "services/ui/public/interfaces/input_devices/input_device_server.mojom.
h" |
| 21 #include "ui/display/screen.h" | 21 #include "ui/display/screen.h" |
| 22 #include "ui/views/mus/window_manager_connection.h" | 22 #include "ui/views/mus/window_manager_connection.h" |
| 23 #include "ui/views/widget/desktop_aura/desktop_screen.h" | 23 #include "ui/views/widget/desktop_aura/desktop_screen.h" |
| 24 #include "ui/wm/core/wm_state.h" | 24 #include "ui/wm/core/wm_state.h" |
| 25 #endif // defined(USE_AURA) | 25 #endif // defined(USE_AURA) |
| 26 | 26 |
| 27 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 27 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 28 #include "base/command_line.h" | 28 #include "base/command_line.h" |
| 29 #include "chrome/browser/ui/simple_message_box.h" | 29 #include "chrome/browser/ui/simple_message_box.h" |
| 30 #include "chrome/common/chrome_switches.h" | |
| 31 #include "chrome/grit/chromium_strings.h" | 30 #include "chrome/grit/chromium_strings.h" |
| 32 #include "chrome/grit/generated_resources.h" | 31 #include "chrome/grit/generated_resources.h" |
| 32 #include "content/public/common/content_switches.h" |
| 33 #include "ui/base/l10n/l10n_util.h" | 33 #include "ui/base/l10n/l10n_util.h" |
| 34 #endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) | 34 #endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 35 | 35 |
| 36 ChromeBrowserMainExtraPartsViews::ChromeBrowserMainExtraPartsViews() { | 36 ChromeBrowserMainExtraPartsViews::ChromeBrowserMainExtraPartsViews() { |
| 37 } | 37 } |
| 38 | 38 |
| 39 ChromeBrowserMainExtraPartsViews::~ChromeBrowserMainExtraPartsViews() { | 39 ChromeBrowserMainExtraPartsViews::~ChromeBrowserMainExtraPartsViews() { |
| 40 constrained_window::SetConstrainedWindowViewsClient(nullptr); | 40 constrained_window::SetConstrainedWindowViewsClient(nullptr); |
| 41 } | 41 } |
| 42 | 42 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 59 if (!display::Screen::GetScreen()) | 59 if (!display::Screen::GetScreen()) |
| 60 display::Screen::SetScreenInstance(views::CreateDesktopScreen()); | 60 display::Screen::SetScreenInstance(views::CreateDesktopScreen()); |
| 61 #endif | 61 #endif |
| 62 } | 62 } |
| 63 | 63 |
| 64 void ChromeBrowserMainExtraPartsViews::PreProfileInit() { | 64 void ChromeBrowserMainExtraPartsViews::PreProfileInit() { |
| 65 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 65 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 66 // On the Linux desktop, we want to prevent the user from logging in as root, | 66 // On the Linux desktop, we want to prevent the user from logging in as root, |
| 67 // so that we don't destroy the profile. Now that we have some minimal ui | 67 // so that we don't destroy the profile. Now that we have some minimal ui |
| 68 // initialized, check to see if we're running as root and bail if we are. | 68 // initialized, check to see if we're running as root and bail if we are. |
| 69 if (getuid() != 0) | 69 if (geteuid() != 0) |
| 70 return; | 70 return; |
| 71 | 71 |
| 72 const base::CommandLine& command_line = | 72 const base::CommandLine& command_line = |
| 73 *base::CommandLine::ForCurrentProcess(); | 73 *base::CommandLine::ForCurrentProcess(); |
| 74 if (command_line.HasSwitch(switches::kUserDataDir)) | 74 if (command_line.HasSwitch(switches::kNoSandbox)) |
| 75 return; | 75 return; |
| 76 | 76 |
| 77 base::string16 title = l10n_util::GetStringFUTF16( | 77 base::string16 title = l10n_util::GetStringFUTF16( |
| 78 IDS_REFUSE_TO_RUN_AS_ROOT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 78 IDS_REFUSE_TO_RUN_AS_ROOT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 79 base::string16 message = l10n_util::GetStringFUTF16( | 79 base::string16 message = l10n_util::GetStringFUTF16( |
| 80 IDS_REFUSE_TO_RUN_AS_ROOT_2, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 80 IDS_REFUSE_TO_RUN_AS_ROOT_2, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 81 | 81 |
| 82 chrome::ShowWarningMessageBox(NULL, title, message); | 82 chrome::ShowWarningMessageBox(NULL, title, message); |
| 83 | 83 |
| 84 // Avoids gpu_process_transport_factory.cc(153)] Check failed: | 84 // Avoids gpu_process_transport_factory.cc(153)] Check failed: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 106 &server); | 106 &server); |
| 107 input_device_client_->Connect(std::move(server)); | 107 input_device_client_->Connect(std::move(server)); |
| 108 | 108 |
| 109 window_manager_connection_ = views::WindowManagerConnection::Create( | 109 window_manager_connection_ = views::WindowManagerConnection::Create( |
| 110 connection->GetConnector(), connection->GetIdentity(), | 110 connection->GetConnector(), connection->GetIdentity(), |
| 111 content::BrowserThread::GetTaskRunnerForThread( | 111 content::BrowserThread::GetTaskRunnerForThread( |
| 112 content::BrowserThread::IO)); | 112 content::BrowserThread::IO)); |
| 113 } | 113 } |
| 114 #endif // defined(USE_AURA) | 114 #endif // defined(USE_AURA) |
| 115 } | 115 } |
| OLD | NEW |