| 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" |
| 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/ui/views/frame/browser_view.h" |
| 26 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 27 #include "ui/aura/window.h" | 28 #include "ui/aura/window.h" |
| 28 #include "ui/base/ime/input_method_initializer.h" | 29 #include "ui/base/ime/input_method_initializer.h" |
| 29 #include "ui/native_theme/native_theme_aura.h" | 30 #include "ui/native_theme/native_theme_aura.h" |
| 30 #include "ui/native_theme/native_theme_dark_aura.h" | 31 #include "ui/native_theme/native_theme_dark_aura.h" |
| 31 #include "ui/views/linux_ui/linux_ui.h" | 32 #include "ui/views/linux_ui/linux_ui.h" |
| 32 #endif | 33 #endif |
| 33 | 34 |
| 34 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 35 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
| 35 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" | 36 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" |
| 36 #endif | 37 #endif |
| 37 | 38 |
| 38 #if defined(USE_ASH) | 39 #if defined(USE_ASH) |
| 39 #include "chrome/browser/ui/ash/ash_util.h" | 40 #include "chrome/browser/ui/ash/ash_util.h" |
| 40 #endif // defined(USE_ASH) | 41 #endif // defined(USE_ASH) |
| 41 | 42 |
| 42 #if !defined(OS_CHROMEOS) | 43 #if !defined(OS_CHROMEOS) |
| 43 #include "ui/views/widget/desktop_aura/desktop_screen.h" | 44 #include "ui/views/widget/desktop_aura/desktop_screen.h" |
| 44 #endif | 45 #endif |
| 45 | 46 |
| 46 namespace { | 47 namespace { |
| 47 | 48 |
| 48 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 49 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
| 49 ui::NativeTheme* GetNativeThemeForWindow(aura::Window* window) { | 50 ui::NativeTheme* GetNativeThemeForWindow(aura::Window* window) { |
| 50 if (!window) | 51 if (!window) |
| 51 return nullptr; | 52 return nullptr; |
| 52 | 53 |
| 53 Profile* profile = nullptr; | 54 Profile* profile = nullptr; |
| 55 // Window types not listed here (such as tooltips) will never use Chrome |
| 56 // theming. |
| 54 if (window->type() == ui::wm::WINDOW_TYPE_NORMAL || | 57 if (window->type() == ui::wm::WINDOW_TYPE_NORMAL || |
| 55 window->type() == ui::wm::WINDOW_TYPE_POPUP || | 58 window->type() == ui::wm::WINDOW_TYPE_POPUP || |
| 56 window->type() == ui::wm::WINDOW_TYPE_CONTROL) { | 59 window->type() == ui::wm::WINDOW_TYPE_CONTROL) { |
| 57 profile = reinterpret_cast<Profile*>( | 60 profile = reinterpret_cast<Profile*>( |
| 58 window->GetNativeWindowProperty(Profile::kProfileKey)); | 61 window->GetNativeWindowProperty(Profile::kProfileKey)); |
| 59 } | 62 } |
| 60 | 63 |
| 61 if (profile && !profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme)) { | 64 if (profile && !profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme)) { |
| 62 return profile->IsOffTheRecord() ? ui::NativeThemeDarkAura::instance() | 65 // Only toplevel browser windows and CONTROL type windows (such as the find |
| 63 : ui::NativeThemeAura::instance(); | 66 // in page bar) should use special theming for off the record mode. |
| 67 // WINDOW_TYPE_NORMAL is not enough to distinguish browser windows because |
| 68 // it also encompasses dialogs. |
| 69 bool eligible_for_otr = window->type() == ui::wm::WINDOW_TYPE_CONTROL || |
| 70 BrowserView::GetBrowserViewForNativeWindow(window); |
| 71 if (eligible_for_otr && profile->IsOffTheRecord()) |
| 72 return ui::NativeThemeDarkAura::instance(); |
| 73 |
| 74 return ui::NativeThemeAura::instance(); |
| 64 } | 75 } |
| 65 | 76 |
| 66 return nullptr; | 77 return nullptr; |
| 67 } | 78 } |
| 68 #endif | 79 #endif |
| 69 | 80 |
| 70 #if !defined(OS_CHROMEOS) && defined(USE_ASH) | 81 #if !defined(OS_CHROMEOS) && defined(USE_ASH) |
| 71 // Returns the desktop this process was initially launched in. | 82 // Returns the desktop this process was initially launched in. |
| 72 chrome::HostDesktopType GetInitialDesktop() { | 83 chrome::HostDesktopType GetInitialDesktop() { |
| 73 #if defined(OS_WIN) && defined(USE_ASH) | 84 #if defined(OS_WIN) && defined(USE_ASH) |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 chrome::MESSAGE_BOX_TYPE_WARNING); | 191 chrome::MESSAGE_BOX_TYPE_WARNING); |
| 181 | 192 |
| 182 // Avoids gpu_process_transport_factory.cc(153)] Check failed: | 193 // Avoids gpu_process_transport_factory.cc(153)] Check failed: |
| 183 // per_compositor_data_.empty() when quit is chosen. | 194 // per_compositor_data_.empty() when quit is chosen. |
| 184 base::RunLoop().RunUntilIdle(); | 195 base::RunLoop().RunUntilIdle(); |
| 185 | 196 |
| 186 exit(EXIT_FAILURE); | 197 exit(EXIT_FAILURE); |
| 187 } | 198 } |
| 188 } | 199 } |
| 189 #endif | 200 #endif |
| OLD | NEW |