| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 views::LinuxUI::SetInstance(gtk2_ui); | 76 views::LinuxUI::SetInstance(gtk2_ui); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void ChromeBrowserMainExtraPartsViewsLinux::ToolkitInitialized() { | 79 void ChromeBrowserMainExtraPartsViewsLinux::ToolkitInitialized() { |
| 80 ChromeBrowserMainExtraPartsViews::ToolkitInitialized(); | 80 ChromeBrowserMainExtraPartsViews::ToolkitInitialized(); |
| 81 views::LinuxUI::instance()->Initialize(); | 81 views::LinuxUI::instance()->Initialize(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void ChromeBrowserMainExtraPartsViewsLinux::PreCreateThreads() { | 84 void ChromeBrowserMainExtraPartsViewsLinux::PreCreateThreads() { |
| 85 ChromeBrowserMainExtraPartsViews::PreCreateThreads(); | 85 ChromeBrowserMainExtraPartsViews::PreCreateThreads(); |
| 86 // TODO(varkha): The next call should not be necessary once Material Design is | |
| 87 // on unconditionally. | |
| 88 views::LinuxUI::instance()->MaterialDesignControllerReady(); | |
| 89 views::LinuxUI::instance()->UpdateDeviceScaleFactor( | 86 views::LinuxUI::instance()->UpdateDeviceScaleFactor( |
| 90 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); | 87 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); |
| 91 } | 88 } |
| 92 | 89 |
| 93 void ChromeBrowserMainExtraPartsViewsLinux::PreProfileInit() { | 90 void ChromeBrowserMainExtraPartsViewsLinux::PreProfileInit() { |
| 94 // On the Linux desktop, we want to prevent the user from logging in as root, | 91 // On the Linux desktop, we want to prevent the user from logging in as root, |
| 95 // so that we don't destroy the profile. Now that we have some minimal ui | 92 // so that we don't destroy the profile. Now that we have some minimal ui |
| 96 // initialized, check to see if we're running as root and bail if we are. | 93 // initialized, check to see if we're running as root and bail if we are. |
| 97 if (getuid() != 0) | 94 if (getuid() != 0) |
| 98 return; | 95 return; |
| 99 | 96 |
| 100 const base::CommandLine& command_line = | 97 const base::CommandLine& command_line = |
| 101 *base::CommandLine::ForCurrentProcess(); | 98 *base::CommandLine::ForCurrentProcess(); |
| 102 if (command_line.HasSwitch(switches::kUserDataDir)) | 99 if (command_line.HasSwitch(switches::kUserDataDir)) |
| 103 return; | 100 return; |
| 104 | 101 |
| 105 base::string16 title = l10n_util::GetStringFUTF16( | 102 base::string16 title = l10n_util::GetStringFUTF16( |
| 106 IDS_REFUSE_TO_RUN_AS_ROOT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 103 IDS_REFUSE_TO_RUN_AS_ROOT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 107 base::string16 message = l10n_util::GetStringFUTF16( | 104 base::string16 message = l10n_util::GetStringFUTF16( |
| 108 IDS_REFUSE_TO_RUN_AS_ROOT_2, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 105 IDS_REFUSE_TO_RUN_AS_ROOT_2, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 109 | 106 |
| 110 chrome::ShowWarningMessageBox(NULL, title, message); | 107 chrome::ShowWarningMessageBox(NULL, title, message); |
| 111 | 108 |
| 112 // Avoids gpu_process_transport_factory.cc(153)] Check failed: | 109 // Avoids gpu_process_transport_factory.cc(153)] Check failed: |
| 113 // per_compositor_data_.empty() when quit is chosen. | 110 // per_compositor_data_.empty() when quit is chosen. |
| 114 base::RunLoop().RunUntilIdle(); | 111 base::RunLoop().RunUntilIdle(); |
| 115 | 112 |
| 116 exit(EXIT_FAILURE); | 113 exit(EXIT_FAILURE); |
| 117 } | 114 } |
| OLD | NEW |