| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "ui/native_theme/native_theme_aura.h" | 23 #include "ui/native_theme/native_theme_aura.h" |
| 24 #include "ui/native_theme/native_theme_dark_aura.h" | 24 #include "ui/native_theme/native_theme_dark_aura.h" |
| 25 #include "ui/views/linux_ui/linux_ui.h" | 25 #include "ui/views/linux_ui/linux_ui.h" |
| 26 #include "ui/views/widget/desktop_aura/desktop_screen.h" | 26 #include "ui/views/widget/desktop_aura/desktop_screen.h" |
| 27 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" | 27 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" |
| 28 #include "ui/views/widget/native_widget_aura.h" | 28 #include "ui/views/widget/native_widget_aura.h" |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 ui::NativeTheme* GetNativeThemeForWindow(aura::Window* window) { | 32 ui::NativeTheme* GetNativeThemeForWindow(aura::Window* window) { |
| 33 if (!window) | |
| 34 return nullptr; | |
| 35 | |
| 36 Profile* profile = nullptr; | 33 Profile* profile = nullptr; |
| 37 // Window types not listed here (such as tooltips) will never use Chrome | 34 if (window) { |
| 38 // theming. | |
| 39 if (window->type() == ui::wm::WINDOW_TYPE_NORMAL || | |
| 40 window->type() == ui::wm::WINDOW_TYPE_POPUP) { | |
| 41 profile = reinterpret_cast<Profile*>( | 35 profile = reinterpret_cast<Profile*>( |
| 42 window->GetNativeWindowProperty(Profile::kProfileKey)); | 36 window->GetNativeWindowProperty(Profile::kProfileKey)); |
| 43 } | 37 } |
| 44 | 38 |
| 45 // 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. |
| 46 // NB: ThemeService::UsingSystemTheme() might lag behind this pref. See | 40 // NB: ThemeService::UsingSystemTheme() might lag behind this pref. See |
| 47 // http://crbug.com/585522 | 41 // http://crbug.com/585522 |
| 48 if (!profile || profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme)) | 42 if (!profile || profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme)) |
| 49 return nullptr; | 43 return nullptr; |
| 50 | 44 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // because its display::Screen instance depends on it. | 80 // because its display::Screen instance depends on it. |
| 87 views::LinuxUI::instance()->UpdateDeviceScaleFactor(); | 81 views::LinuxUI::instance()->UpdateDeviceScaleFactor(); |
| 88 ChromeBrowserMainExtraPartsViews::PreCreateThreads(); | 82 ChromeBrowserMainExtraPartsViews::PreCreateThreads(); |
| 89 views::X11DesktopHandler::get()->AddObserver(this); | 83 views::X11DesktopHandler::get()->AddObserver(this); |
| 90 } | 84 } |
| 91 | 85 |
| 92 void ChromeBrowserMainExtraPartsViewsLinux::OnWorkspaceChanged( | 86 void ChromeBrowserMainExtraPartsViewsLinux::OnWorkspaceChanged( |
| 93 const std::string& new_workspace) { | 87 const std::string& new_workspace) { |
| 94 BrowserList::MoveBrowsersInWorkspaceToFront(new_workspace); | 88 BrowserList::MoveBrowsersInWorkspaceToFront(new_workspace); |
| 95 } | 89 } |
| OLD | NEW |