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

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

Issue 2697513008: Linux Aura: Use Aura theme on all windows when 'Use Classic theme' is used (Closed)
Patch Set: No namespace Created 3 years, 10 months 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/BUILD.gn ('k') | chrome/browser/ui/views/chrome_views_delegate.cc » ('j') | 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/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 = nullptr; 37 Profile* profile = GetThemeProfileForWindow(window);
37 // Window types not listed here (such as tooltips) will never use Chrome
38 // theming.
39 if (window->type() == ui::wm::WINDOW_TYPE_NORMAL ||
40 window->type() == ui::wm::WINDOW_TYPE_POPUP) {
41 profile = reinterpret_cast<Profile*>(
42 window->GetNativeWindowProperty(Profile::kProfileKey));
43 }
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
51 // Use a dark theme for incognito browser windows that aren't 45 // Use a dark theme for incognito browser windows that aren't
52 // custom-themed. Otherwise, normal Aura theme. 46 // custom-themed. Otherwise, normal Aura theme.
53 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE && 47 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE &&
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/views/chrome_views_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698