Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(633)

Side by Side Diff: chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.cc

Issue 2462423002: Condition the use of ChromeBrowserMainExtraPartsViewsLinux to !use_ozone (Closed)
Patch Set: same as patchset 6, w/ grouped includes Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
8 #include "base/run_loop.h" 7 #include "base/run_loop.h"
9 #include "chrome/browser/chrome_browser_main.h" 8 #include "chrome/browser/chrome_browser_main.h"
10 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/themes/theme_service.h" 10 #include "chrome/browser/themes/theme_service.h"
12 #include "chrome/browser/themes/theme_service_factory.h" 11 #include "chrome/browser/themes/theme_service_factory.h"
13 #include "chrome/browser/ui/browser_list.h" 12 #include "chrome/browser/ui/browser_list.h"
14 #include "chrome/browser/ui/libgtkui/gtk_ui.h" 13 #include "chrome/browser/ui/libgtkui/gtk_ui.h"
15 #include "chrome/browser/ui/simple_message_box.h"
16 #include "chrome/browser/ui/views/frame/browser_view.h" 14 #include "chrome/browser/ui/views/frame/browser_view.h"
17 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
19 #include "chrome/grit/chromium_strings.h"
20 #include "chrome/grit/generated_resources.h"
21 #include "components/prefs/pref_service.h" 16 #include "components/prefs/pref_service.h"
22 #include "ui/aura/env.h" 17 #include "ui/aura/env.h"
23 #include "ui/aura/window.h" 18 #include "ui/aura/window.h"
24 #include "ui/base/ime/input_method_initializer.h" 19 #include "ui/base/ime/input_method_initializer.h"
25 #include "ui/base/l10n/l10n_util.h"
26 #include "ui/base/ui_base_switches.h" 20 #include "ui/base/ui_base_switches.h"
27 #include "ui/display/display.h" 21 #include "ui/display/display.h"
28 #include "ui/display/screen.h" 22 #include "ui/display/screen.h"
29 #include "ui/native_theme/native_theme_aura.h" 23 #include "ui/native_theme/native_theme_aura.h"
30 #include "ui/native_theme/native_theme_dark_aura.h" 24 #include "ui/native_theme/native_theme_dark_aura.h"
31 #include "ui/views/linux_ui/linux_ui.h" 25 #include "ui/views/linux_ui/linux_ui.h"
32 #include "ui/views/widget/desktop_aura/desktop_screen.h" 26 #include "ui/views/widget/desktop_aura/desktop_screen.h"
33 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" 27 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h"
34 #include "ui/views/widget/native_widget_aura.h" 28 #include "ui/views/widget/native_widget_aura.h"
35 29
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 84 }
91 85
92 void ChromeBrowserMainExtraPartsViewsLinux::PreCreateThreads() { 86 void ChromeBrowserMainExtraPartsViewsLinux::PreCreateThreads() {
93 ChromeBrowserMainExtraPartsViews::PreCreateThreads(); 87 ChromeBrowserMainExtraPartsViews::PreCreateThreads();
94 views::LinuxUI::instance()->UpdateDeviceScaleFactor( 88 views::LinuxUI::instance()->UpdateDeviceScaleFactor(
95 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 89 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
96 90
97 views::X11DesktopHandler::get()->AddObserver(this); 91 views::X11DesktopHandler::get()->AddObserver(this);
98 } 92 }
99 93
100 void ChromeBrowserMainExtraPartsViewsLinux::PreProfileInit() {
101 ChromeBrowserMainExtraPartsViews::PreProfileInit();
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
104 // initialized, check to see if we're running as root and bail if we are.
105 if (getuid() != 0)
106 return;
107
108 const base::CommandLine& command_line =
109 *base::CommandLine::ForCurrentProcess();
110 if (command_line.HasSwitch(switches::kUserDataDir))
111 return;
112
113 base::string16 title = l10n_util::GetStringFUTF16(
114 IDS_REFUSE_TO_RUN_AS_ROOT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
115 base::string16 message = l10n_util::GetStringFUTF16(
116 IDS_REFUSE_TO_RUN_AS_ROOT_2, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
117
118 chrome::ShowWarningMessageBox(NULL, title, message);
119
120 // Avoids gpu_process_transport_factory.cc(153)] Check failed:
121 // per_compositor_data_.empty() when quit is chosen.
122 base::RunLoop().RunUntilIdle();
123
124 exit(EXIT_FAILURE);
125 }
126
127 void ChromeBrowserMainExtraPartsViewsLinux::OnWorkspaceChanged( 94 void ChromeBrowserMainExtraPartsViewsLinux::OnWorkspaceChanged(
128 const std::string& new_workspace) { 95 const std::string& new_workspace) {
129 BrowserList::MoveBrowsersInWorkspaceToFront(new_workspace); 96 BrowserList::MoveBrowsersInWorkspaceToFront(new_workspace);
130 } 97 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698