OLD | NEW |
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" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 Profile* profile = nullptr; | 55 Profile* profile = nullptr; |
56 // Window types not listed here (such as tooltips) will never use Chrome | 56 // Window types not listed here (such as tooltips) will never use Chrome |
57 // theming. | 57 // theming. |
58 if (window->type() == ui::wm::WINDOW_TYPE_NORMAL || | 58 if (window->type() == ui::wm::WINDOW_TYPE_NORMAL || |
59 window->type() == ui::wm::WINDOW_TYPE_POPUP) { | 59 window->type() == ui::wm::WINDOW_TYPE_POPUP) { |
60 profile = reinterpret_cast<Profile*>( | 60 profile = reinterpret_cast<Profile*>( |
61 window->GetNativeWindowProperty(Profile::kProfileKey)); | 61 window->GetNativeWindowProperty(Profile::kProfileKey)); |
62 } | 62 } |
63 | 63 |
64 if (profile) { | 64 // If using the system (GTK) theme, don't use an Aura NativeTheme at all. |
65 ThemeService* ts = ThemeServiceFactory::GetForProfile(profile); | 65 // NB: ThemeService::UsingSystemTheme() might lag behind this pref. See |
66 // If using the system (GTK) theme, don't use an Aura NativeTheme at all. | 66 // http://crbug.com/585522 |
67 if (!ts->UsingSystemTheme()) { | 67 if (!profile || profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme)) |
68 // Use a dark theme for incognito browser windows that aren't | 68 return nullptr; |
69 // custom-themed. Otherwise, normal Aura theme. | |
70 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE && | |
71 ts->UsingDefaultTheme() && | |
72 BrowserView::GetBrowserViewForNativeWindow(window)) { | |
73 return ui::NativeThemeDarkAura::instance(); | |
74 } | |
75 | 69 |
76 return ui::NativeThemeAura::instance(); | 70 // Use a dark theme for incognito browser windows that aren't |
77 } | 71 // custom-themed. Otherwise, normal Aura theme. |
| 72 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE && |
| 73 ThemeServiceFactory::GetForProfile(profile)->UsingDefaultTheme() && |
| 74 BrowserView::GetBrowserViewForNativeWindow(window)) { |
| 75 return ui::NativeThemeDarkAura::instance(); |
78 } | 76 } |
79 | 77 |
80 return nullptr; | 78 return ui::NativeThemeAura::instance(); |
81 } | 79 } |
82 #endif | 80 #endif |
83 | 81 |
84 } // namespace | 82 } // namespace |
85 | 83 |
86 ChromeBrowserMainExtraPartsAura::ChromeBrowserMainExtraPartsAura() { | 84 ChromeBrowserMainExtraPartsAura::ChromeBrowserMainExtraPartsAura() { |
87 } | 85 } |
88 | 86 |
89 ChromeBrowserMainExtraPartsAura::~ChromeBrowserMainExtraPartsAura() { | 87 ChromeBrowserMainExtraPartsAura::~ChromeBrowserMainExtraPartsAura() { |
90 } | 88 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 chrome::MESSAGE_BOX_TYPE_WARNING); | 154 chrome::MESSAGE_BOX_TYPE_WARNING); |
157 | 155 |
158 // Avoids gpu_process_transport_factory.cc(153)] Check failed: | 156 // Avoids gpu_process_transport_factory.cc(153)] Check failed: |
159 // per_compositor_data_.empty() when quit is chosen. | 157 // per_compositor_data_.empty() when quit is chosen. |
160 base::RunLoop().RunUntilIdle(); | 158 base::RunLoop().RunUntilIdle(); |
161 | 159 |
162 exit(EXIT_FAILURE); | 160 exit(EXIT_FAILURE); |
163 } | 161 } |
164 } | 162 } |
165 #endif | 163 #endif |
OLD | NEW |