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

Side by Side Diff: chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc

Issue 1637203002: [MD] Don't use new OTR native-theming when using a custom browser theme. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move lifetime comment Created 4 years, 11 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 | « no previous file | chrome/browser/ui/views/dropdown_bar_host.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/aura/chrome_browser_main_extra_parts_aura.h" 5 #include "chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/chrome_browser_main.h" 10 #include "chrome/browser/chrome_browser_main.h"
11 #include "chrome/browser/ui/aura/active_desktop_monitor.h" 11 #include "chrome/browser/ui/aura/active_desktop_monitor.h"
12 #include "chrome/browser/ui/host_desktop.h" 12 #include "chrome/browser/ui/host_desktop.h"
13 #include "chrome/browser/ui/simple_message_box.h" 13 #include "chrome/browser/ui/simple_message_box.h"
14 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
15 #include "chrome/grit/chromium_strings.h" 15 #include "chrome/grit/chromium_strings.h"
16 #include "chrome/grit/generated_resources.h" 16 #include "chrome/grit/generated_resources.h"
17 #include "ui/aura/env.h" 17 #include "ui/aura/env.h"
18 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/ui_base_switches.h" 19 #include "ui/base/ui_base_switches.h"
20 #include "ui/gfx/screen.h" 20 #include "ui/gfx/screen.h"
21 #include "ui/views/widget/native_widget_aura.h" 21 #include "ui/views/widget/native_widget_aura.h"
22 22
23 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 23 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
24 #include "base/prefs/pref_service.h" 24 #include "base/prefs/pref_service.h"
25 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/themes/theme_service.h"
27 #include "chrome/browser/themes/theme_service_factory.h"
26 #include "chrome/browser/ui/views/frame/browser_view.h" 28 #include "chrome/browser/ui/views/frame/browser_view.h"
27 #include "chrome/common/pref_names.h" 29 #include "chrome/common/pref_names.h"
28 #include "ui/aura/window.h" 30 #include "ui/aura/window.h"
29 #include "ui/base/ime/input_method_initializer.h" 31 #include "ui/base/ime/input_method_initializer.h"
30 #include "ui/native_theme/native_theme_aura.h" 32 #include "ui/native_theme/native_theme_aura.h"
31 #include "ui/native_theme/native_theme_dark_aura.h" 33 #include "ui/native_theme/native_theme_dark_aura.h"
32 #include "ui/views/linux_ui/linux_ui.h" 34 #include "ui/views/linux_ui/linux_ui.h"
33 #endif 35 #endif
34 36
35 #if defined(USE_X11) && !defined(OS_CHROMEOS) 37 #if defined(USE_X11) && !defined(OS_CHROMEOS)
(...skipping 12 matching lines...) Expand all
48 50
49 #if defined(USE_X11) && !defined(OS_CHROMEOS) 51 #if defined(USE_X11) && !defined(OS_CHROMEOS)
50 ui::NativeTheme* GetNativeThemeForWindow(aura::Window* window) { 52 ui::NativeTheme* GetNativeThemeForWindow(aura::Window* window) {
51 if (!window) 53 if (!window)
52 return nullptr; 54 return nullptr;
53 55
54 Profile* profile = nullptr; 56 Profile* profile = nullptr;
55 // Window types not listed here (such as tooltips) will never use Chrome 57 // Window types not listed here (such as tooltips) will never use Chrome
56 // theming. 58 // theming.
57 if (window->type() == ui::wm::WINDOW_TYPE_NORMAL || 59 if (window->type() == ui::wm::WINDOW_TYPE_NORMAL ||
58 window->type() == ui::wm::WINDOW_TYPE_POPUP || 60 window->type() == ui::wm::WINDOW_TYPE_POPUP) {
59 window->type() == ui::wm::WINDOW_TYPE_CONTROL) {
60 profile = reinterpret_cast<Profile*>( 61 profile = reinterpret_cast<Profile*>(
61 window->GetNativeWindowProperty(Profile::kProfileKey)); 62 window->GetNativeWindowProperty(Profile::kProfileKey));
62 } 63 }
63 64
64 if (profile && !profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme)) { 65 if (profile) {
65 // Only toplevel browser windows and CONTROL type windows (such as the find 66 ThemeService* ts = ThemeServiceFactory::GetForProfile(profile);
66 // in page bar) should use special theming for off the record mode. 67 // If using the system (GTK) theme, don't use an Aura NativeTheme at all.
67 // WINDOW_TYPE_NORMAL is not enough to distinguish browser windows because 68 if (!ts->UsingSystemTheme()) {
68 // it also encompasses dialogs. 69 // Use a dark theme for incognito browser windows that aren't
69 bool eligible_for_otr = window->type() == ui::wm::WINDOW_TYPE_CONTROL || 70 // custom-themed. Otherwise, normal Aura theme.
70 BrowserView::GetBrowserViewForNativeWindow(window); 71 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE &&
71 if (eligible_for_otr && 72 ts->UsingDefaultTheme() &&
72 profile->GetProfileType() == Profile::INCOGNITO_PROFILE) { 73 BrowserView::GetBrowserViewForNativeWindow(window)) {
73 return ui::NativeThemeDarkAura::instance(); 74 return ui::NativeThemeDarkAura::instance();
75 }
76
77 return ui::NativeThemeAura::instance();
74 } 78 }
75
76 return ui::NativeThemeAura::instance();
77 } 79 }
78 80
79 return nullptr; 81 return nullptr;
80 } 82 }
81 #endif 83 #endif
82 84
83 #if !defined(OS_CHROMEOS) && defined(USE_ASH) 85 #if !defined(OS_CHROMEOS) && defined(USE_ASH)
84 // Returns the desktop this process was initially launched in. 86 // Returns the desktop this process was initially launched in.
85 chrome::HostDesktopType GetInitialDesktop() { 87 chrome::HostDesktopType GetInitialDesktop() {
86 #if defined(OS_WIN) && defined(USE_ASH) 88 #if defined(OS_WIN) && defined(USE_ASH)
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 chrome::MESSAGE_BOX_TYPE_WARNING); 195 chrome::MESSAGE_BOX_TYPE_WARNING);
194 196
195 // Avoids gpu_process_transport_factory.cc(153)] Check failed: 197 // Avoids gpu_process_transport_factory.cc(153)] Check failed:
196 // per_compositor_data_.empty() when quit is chosen. 198 // per_compositor_data_.empty() when quit is chosen.
197 base::RunLoop().RunUntilIdle(); 199 base::RunLoop().RunUntilIdle();
198 200
199 exit(EXIT_FAILURE); 201 exit(EXIT_FAILURE);
200 } 202 }
201 } 203 }
202 #endif 204 #endif
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/dropdown_bar_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698