OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_linux.h" | 5 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chrome/browser/chrome_browser_main.h" | 9 #include "chrome/browser/chrome_browser_main.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 void ChromeBrowserMainExtraPartsViewsLinux::PreCreateThreads() { | 85 void ChromeBrowserMainExtraPartsViewsLinux::PreCreateThreads() { |
86 ChromeBrowserMainExtraPartsViews::PreCreateThreads(); | 86 ChromeBrowserMainExtraPartsViews::PreCreateThreads(); |
87 // TODO(varkha): The next call should not be necessary once Material Design is | 87 // TODO(varkha): The next call should not be necessary once Material Design is |
88 // on unconditionally. | 88 // on unconditionally. |
89 views::LinuxUI::instance()->MaterialDesignControllerReady(); | 89 views::LinuxUI::instance()->MaterialDesignControllerReady(); |
90 views::LinuxUI::instance()->UpdateDeviceScaleFactor( | 90 views::LinuxUI::instance()->UpdateDeviceScaleFactor( |
91 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); | 91 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); |
92 } | 92 } |
93 | 93 |
94 void ChromeBrowserMainExtraPartsViewsLinux::PreProfileInit() { | 94 void ChromeBrowserMainExtraPartsViewsLinux::PreProfileInit() { |
| 95 ChromeBrowserMainExtraPartsViews::PreProfileInit(); |
95 // On the Linux desktop, we want to prevent the user from logging in as root, | 96 // On the Linux desktop, we want to prevent the user from logging in as root, |
96 // so that we don't destroy the profile. Now that we have some minimal ui | 97 // so that we don't destroy the profile. Now that we have some minimal ui |
97 // initialized, check to see if we're running as root and bail if we are. | 98 // initialized, check to see if we're running as root and bail if we are. |
98 if (getuid() != 0) | 99 if (getuid() != 0) |
99 return; | 100 return; |
100 | 101 |
101 const base::CommandLine& command_line = | 102 const base::CommandLine& command_line = |
102 *base::CommandLine::ForCurrentProcess(); | 103 *base::CommandLine::ForCurrentProcess(); |
103 if (command_line.HasSwitch(switches::kUserDataDir)) | 104 if (command_line.HasSwitch(switches::kUserDataDir)) |
104 return; | 105 return; |
105 | 106 |
106 base::string16 title = l10n_util::GetStringFUTF16( | 107 base::string16 title = l10n_util::GetStringFUTF16( |
107 IDS_REFUSE_TO_RUN_AS_ROOT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 108 IDS_REFUSE_TO_RUN_AS_ROOT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
108 base::string16 message = l10n_util::GetStringFUTF16( | 109 base::string16 message = l10n_util::GetStringFUTF16( |
109 IDS_REFUSE_TO_RUN_AS_ROOT_2, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 110 IDS_REFUSE_TO_RUN_AS_ROOT_2, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
110 | 111 |
111 chrome::ShowWarningMessageBox(NULL, title, message); | 112 chrome::ShowWarningMessageBox(NULL, title, message); |
112 | 113 |
113 // Avoids gpu_process_transport_factory.cc(153)] Check failed: | 114 // Avoids gpu_process_transport_factory.cc(153)] Check failed: |
114 // per_compositor_data_.empty() when quit is chosen. | 115 // per_compositor_data_.empty() when quit is chosen. |
115 base::RunLoop().RunUntilIdle(); | 116 base::RunLoop().RunUntilIdle(); |
116 | 117 |
117 exit(EXIT_FAILURE); | 118 exit(EXIT_FAILURE); |
118 } | 119 } |
OLD | NEW |