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/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "chrome/browser/chrome_browser_main.h" | 8 #include "chrome/browser/chrome_browser_main.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
11 #include "chrome/browser/themes/theme_service_factory.h" | 11 #include "chrome/browser/themes/theme_service_factory.h" |
12 #include "chrome/browser/ui/browser_list.h" | 12 #include "chrome/browser/ui/browser_list.h" |
13 #include "chrome/browser/ui/libgtkui/gtk_ui.h" | 13 #include "chrome/browser/ui/libgtkui/gtk_ui.h" |
14 #include "chrome/browser/ui/views/frame/browser_view.h" | 14 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 15 #include "chrome/browser/ui/views/theme_profile_key.h" |
15 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
16 #include "components/prefs/pref_service.h" | 17 #include "components/prefs/pref_service.h" |
17 #include "ui/aura/env.h" | 18 #include "ui/aura/env.h" |
18 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
19 #include "ui/base/ime/input_method_initializer.h" | 20 #include "ui/base/ime/input_method_initializer.h" |
20 #include "ui/base/ui_base_switches.h" | 21 #include "ui/base/ui_base_switches.h" |
21 #include "ui/display/display.h" | 22 #include "ui/display/display.h" |
22 #include "ui/display/screen.h" | 23 #include "ui/display/screen.h" |
23 #include "ui/native_theme/native_theme_aura.h" | 24 #include "ui/native_theme/native_theme_aura.h" |
24 #include "ui/native_theme/native_theme_dark_aura.h" | 25 #include "ui/native_theme/native_theme_dark_aura.h" |
25 #include "ui/views/linux_ui/linux_ui.h" | 26 #include "ui/views/linux_ui/linux_ui.h" |
26 #include "ui/views/widget/desktop_aura/desktop_screen.h" | 27 #include "ui/views/widget/desktop_aura/desktop_screen.h" |
27 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" | 28 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" |
28 #include "ui/views/widget/native_widget_aura.h" | 29 #include "ui/views/widget/native_widget_aura.h" |
29 | 30 |
30 namespace { | 31 namespace { |
31 | 32 |
32 ui::NativeTheme* GetNativeThemeForWindow(aura::Window* window) { | 33 ui::NativeTheme* GetNativeThemeForWindow(aura::Window* window) { |
33 if (!window) | 34 if (!window) |
34 return nullptr; | 35 return nullptr; |
35 | 36 |
36 Profile* profile = reinterpret_cast<Profile*>( | 37 Profile* profile = GetThemeProfileForWindow(window); |
37 window->GetNativeWindowProperty(Profile::kProfileKey)); | |
38 | 38 |
39 // If using the system (GTK) theme, don't use an Aura NativeTheme at all. | 39 // If using the system (GTK) theme, don't use an Aura NativeTheme at all. |
40 // NB: ThemeService::UsingSystemTheme() might lag behind this pref. See | 40 // NB: ThemeService::UsingSystemTheme() might lag behind this pref. See |
41 // http://crbug.com/585522 | 41 // http://crbug.com/585522 |
42 if (!profile || (!profile->IsSupervised() && | 42 if (!profile || (!profile->IsSupervised() && |
43 profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme))) { | 43 profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme))) { |
44 return nullptr; | 44 return nullptr; |
45 } | 45 } |
46 | 46 |
47 // Use a dark theme for incognito browser windows that aren't | 47 // Use a dark theme for incognito browser windows that aren't |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // because its display::Screen instance depends on it. | 83 // because its display::Screen instance depends on it. |
84 views::LinuxUI::instance()->UpdateDeviceScaleFactor(); | 84 views::LinuxUI::instance()->UpdateDeviceScaleFactor(); |
85 ChromeBrowserMainExtraPartsViews::PreCreateThreads(); | 85 ChromeBrowserMainExtraPartsViews::PreCreateThreads(); |
86 views::X11DesktopHandler::get()->AddObserver(this); | 86 views::X11DesktopHandler::get()->AddObserver(this); |
87 } | 87 } |
88 | 88 |
89 void ChromeBrowserMainExtraPartsViewsLinux::OnWorkspaceChanged( | 89 void ChromeBrowserMainExtraPartsViewsLinux::OnWorkspaceChanged( |
90 const std::string& new_workspace) { | 90 const std::string& new_workspace) { |
91 BrowserList::MoveBrowsersInWorkspaceToFront(new_workspace); | 91 BrowserList::MoveBrowsersInWorkspaceToFront(new_workspace); |
92 } | 92 } |
OLD | NEW |