| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 gtk2_ui->SetNativeThemeOverride(base::Bind(&GetNativeThemeForWindow)); | 83 gtk2_ui->SetNativeThemeOverride(base::Bind(&GetNativeThemeForWindow)); |
| 84 views::LinuxUI::SetInstance(gtk2_ui); | 84 views::LinuxUI::SetInstance(gtk2_ui); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void ChromeBrowserMainExtraPartsViewsLinux::ToolkitInitialized() { | 87 void ChromeBrowserMainExtraPartsViewsLinux::ToolkitInitialized() { |
| 88 ChromeBrowserMainExtraPartsViews::ToolkitInitialized(); | 88 ChromeBrowserMainExtraPartsViews::ToolkitInitialized(); |
| 89 views::LinuxUI::instance()->Initialize(); | 89 views::LinuxUI::instance()->Initialize(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void ChromeBrowserMainExtraPartsViewsLinux::PreCreateThreads() { | 92 void ChromeBrowserMainExtraPartsViewsLinux::PreCreateThreads() { |
| 93 // Update the device scale factor before initializing views |
| 94 // because its display::Screen instance depends on it. |
| 95 views::LinuxUI::instance()->UpdateDeviceScaleFactor(); |
| 93 ChromeBrowserMainExtraPartsViews::PreCreateThreads(); | 96 ChromeBrowserMainExtraPartsViews::PreCreateThreads(); |
| 94 views::LinuxUI::instance()->UpdateDeviceScaleFactor( | |
| 95 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); | |
| 96 | |
| 97 views::X11DesktopHandler::get()->AddObserver(this); | 97 views::X11DesktopHandler::get()->AddObserver(this); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void ChromeBrowserMainExtraPartsViewsLinux::PreProfileInit() { | 100 void ChromeBrowserMainExtraPartsViewsLinux::PreProfileInit() { |
| 101 ChromeBrowserMainExtraPartsViews::PreProfileInit(); | 101 ChromeBrowserMainExtraPartsViews::PreProfileInit(); |
| 102 // On the Linux desktop, we want to prevent the user from logging in as root, | 102 // On the Linux desktop, we want to prevent the user from logging in as root, |
| 103 // so that we don't destroy the profile. Now that we have some minimal ui | 103 // so that we don't destroy the profile. Now that we have some minimal ui |
| 104 // initialized, check to see if we're running as root and bail if we are. | 104 // initialized, check to see if we're running as root and bail if we are. |
| 105 if (getuid() != 0) | 105 if (getuid() != 0) |
| 106 return; | 106 return; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 121 // per_compositor_data_.empty() when quit is chosen. | 121 // per_compositor_data_.empty() when quit is chosen. |
| 122 base::RunLoop().RunUntilIdle(); | 122 base::RunLoop().RunUntilIdle(); |
| 123 | 123 |
| 124 exit(EXIT_FAILURE); | 124 exit(EXIT_FAILURE); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void ChromeBrowserMainExtraPartsViewsLinux::OnWorkspaceChanged( | 127 void ChromeBrowserMainExtraPartsViewsLinux::OnWorkspaceChanged( |
| 128 const std::string& new_workspace) { | 128 const std::string& new_workspace) { |
| 129 BrowserList::MoveBrowsersInWorkspaceToFront(new_workspace); | 129 BrowserList::MoveBrowsersInWorkspaceToFront(new_workspace); |
| 130 } | 130 } |
| OLD | NEW |