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/views/chrome_views_delegate.h" | 5 #include "chrome/browser/ui/views/chrome_views_delegate.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
29 #include <dwmapi.h> | 29 #include <dwmapi.h> |
30 #include <shellapi.h> | 30 #include <shellapi.h> |
31 #include "base/profiler/scoped_tracker.h" | 31 #include "base/profiler/scoped_tracker.h" |
32 #include "base/task_runner_util.h" | 32 #include "base/task_runner_util.h" |
33 #include "base/win/windows_version.h" | 33 #include "base/win/windows_version.h" |
34 #include "chrome/browser/app_icon_win.h" | 34 #include "chrome/browser/app_icon_win.h" |
35 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
36 #include "ui/base/win/shell.h" | 36 #include "ui/base/win/shell.h" |
| 37 #include "ui/native_theme/native_theme_win_dark.h" |
37 #endif | 38 #endif |
38 | 39 |
39 #if defined(USE_AURA) | 40 #if defined(USE_AURA) |
40 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" | 41 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" |
41 #include "ui/aura/window.h" | 42 #include "ui/aura/window.h" |
42 #include "ui/aura/window_event_dispatcher.h" | 43 #include "ui/aura/window_event_dispatcher.h" |
43 #endif | 44 #endif |
44 | 45 |
| 46 #if defined(OS_WIN) || defined(OS_CHROMEOS) |
| 47 #include "ui/wm/core/transient_window_manager.h" |
| 48 #endif |
| 49 |
| 50 #if defined(OS_CHROMEOS) |
| 51 #include "ui/native_theme/native_theme_aura_dark.h" |
| 52 #endif |
| 53 |
45 #if defined(USE_AURA) && !defined(OS_CHROMEOS) | 54 #if defined(USE_AURA) && !defined(OS_CHROMEOS) |
46 #include "chrome/browser/ui/host_desktop.h" | 55 #include "chrome/browser/ui/host_desktop.h" |
47 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 56 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
48 #include "ui/views/widget/native_widget_aura.h" | 57 #include "ui/views/widget/native_widget_aura.h" |
49 #endif | 58 #endif |
50 | 59 |
51 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 60 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
52 #include "ui/views/linux_ui/linux_ui.h" | 61 #include "ui/views/linux_ui/linux_ui.h" |
53 #endif | 62 #endif |
54 | 63 |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 base::AutoReset<bool> in_callback_setter(&in_autohide_edges_callback_, true); | 474 base::AutoReset<bool> in_callback_setter(&in_autohide_edges_callback_, true); |
466 callback.Run(); | 475 callback.Run(); |
467 } | 476 } |
468 #endif | 477 #endif |
469 | 478 |
470 scoped_refptr<base::TaskRunner> | 479 scoped_refptr<base::TaskRunner> |
471 ChromeViewsDelegate::GetBlockingPoolTaskRunner() { | 480 ChromeViewsDelegate::GetBlockingPoolTaskRunner() { |
472 return content::BrowserThread::GetBlockingPool(); | 481 return content::BrowserThread::GetBlockingPool(); |
473 } | 482 } |
474 | 483 |
| 484 ui::NativeTheme* ChromeViewsDelegate::GetNativeThemeOverride( |
| 485 const views::Widget* widget) { |
| 486 #if defined(OS_CHROMEOS) || defined(OS_WIN) |
| 487 aura::Window* window = widget->GetNativeWindow(); |
| 488 for (aura::Window* parent = window; parent; |
| 489 parent = wm::TransientWindowManager::Get(parent)->transient_parent()) { |
| 490 window = parent; |
| 491 } |
| 492 |
| 493 views::Widget* parent_widget = |
| 494 views::Widget::GetWidgetForNativeWindow(window); |
| 495 Profile* profile = GetProfileForWindow(parent_widget); |
| 496 if (profile && profile->IsOffTheRecord()) |
| 497 #if defined(OS_WIN) |
| 498 return ui::NativeThemeWinDark::instance(); |
| 499 #else |
| 500 return ui::NativeThemeAuraDark::instance(); |
| 501 #endif |
| 502 #endif |
| 503 return nullptr; |
| 504 } |
| 505 |
475 #if !defined(USE_AURA) && !defined(USE_CHROMEOS) | 506 #if !defined(USE_AURA) && !defined(USE_CHROMEOS) |
476 views::Widget::InitParams::WindowOpacity | 507 views::Widget::InitParams::WindowOpacity |
477 ChromeViewsDelegate::GetOpacityForInitParams( | 508 ChromeViewsDelegate::GetOpacityForInitParams( |
478 const views::Widget::InitParams& params) { | 509 const views::Widget::InitParams& params) { |
479 return views::Widget::InitParams::OPAQUE_WINDOW; | 510 return views::Widget::InitParams::OPAQUE_WINDOW; |
480 } | 511 } |
481 #endif | 512 #endif |
OLD | NEW |