| 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 ui::NativeTheme* GetNativeThemeForWindow(aura::Window* window) { | 33 ui::NativeTheme* GetNativeThemeForWindow(aura::Window* window) { |
| 34 if (!window) | 34 if (!window) |
| 35 return nullptr; | 35 return nullptr; |
| 36 | 36 |
| 37 Profile* profile = GetThemeProfileForWindow(window); | 37 Profile* profile = GetThemeProfileForWindow(window); |
| 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->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme)) | 42 if (!profile || (!profile->IsSupervised() && |
| 43 profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme))) { |
| 43 return nullptr; | 44 return nullptr; |
| 45 } |
| 44 | 46 |
| 45 // Use a dark theme for incognito browser windows that aren't | 47 // Use a dark theme for incognito browser windows that aren't |
| 46 // custom-themed. Otherwise, normal Aura theme. | 48 // custom-themed. Otherwise, normal Aura theme. |
| 47 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE && | 49 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE && |
| 48 ThemeServiceFactory::GetForProfile(profile)->UsingDefaultTheme() && | 50 ThemeServiceFactory::GetForProfile(profile)->UsingDefaultTheme() && |
| 49 BrowserView::GetBrowserViewForNativeWindow(window)) { | 51 BrowserView::GetBrowserViewForNativeWindow(window)) { |
| 50 return ui::NativeThemeDarkAura::instance(); | 52 return ui::NativeThemeDarkAura::instance(); |
| 51 } | 53 } |
| 52 | 54 |
| 53 return ui::NativeTheme::GetInstanceForNativeUi(); | 55 return ui::NativeTheme::GetInstanceForNativeUi(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 80 // because its display::Screen instance depends on it. | 82 // because its display::Screen instance depends on it. |
| 81 views::LinuxUI::instance()->UpdateDeviceScaleFactor(); | 83 views::LinuxUI::instance()->UpdateDeviceScaleFactor(); |
| 82 ChromeBrowserMainExtraPartsViews::PreCreateThreads(); | 84 ChromeBrowserMainExtraPartsViews::PreCreateThreads(); |
| 83 views::X11DesktopHandler::get()->AddObserver(this); | 85 views::X11DesktopHandler::get()->AddObserver(this); |
| 84 } | 86 } |
| 85 | 87 |
| 86 void ChromeBrowserMainExtraPartsViewsLinux::OnWorkspaceChanged( | 88 void ChromeBrowserMainExtraPartsViewsLinux::OnWorkspaceChanged( |
| 87 const std::string& new_workspace) { | 89 const std::string& new_workspace) { |
| 88 BrowserList::MoveBrowsersInWorkspaceToFront(new_workspace); | 90 BrowserList::MoveBrowsersInWorkspaceToFront(new_workspace); |
| 89 } | 91 } |
| OLD | NEW |