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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
6 | 6 |
7 #include "ui/views/view.h" | 7 #include "ui/views/view.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "ui/views/focus/view_storage.h" | 46 #include "ui/views/focus/view_storage.h" |
47 #include "ui/views/layout/layout_manager.h" | 47 #include "ui/views/layout/layout_manager.h" |
48 #include "ui/views/views_delegate.h" | 48 #include "ui/views/views_delegate.h" |
49 #include "ui/views/widget/native_widget_private.h" | 49 #include "ui/views/widget/native_widget_private.h" |
50 #include "ui/views/widget/root_view.h" | 50 #include "ui/views/widget/root_view.h" |
51 #include "ui/views/widget/tooltip_manager.h" | 51 #include "ui/views/widget/tooltip_manager.h" |
52 #include "ui/views/widget/widget.h" | 52 #include "ui/views/widget/widget.h" |
53 | 53 |
54 #if defined(OS_WIN) | 54 #if defined(OS_WIN) |
55 #include "base/win/scoped_gdi_object.h" | 55 #include "base/win/scoped_gdi_object.h" |
| 56 #include "ui/native_theme/native_theme_win.h" |
56 #endif | 57 #endif |
57 | 58 |
58 namespace views { | 59 namespace views { |
59 | 60 |
60 namespace { | 61 namespace { |
61 | 62 |
62 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
63 const bool kContextMenuOnMousePress = false; | 64 const bool kContextMenuOnMousePress = false; |
64 #else | 65 #else |
65 const bool kContextMenuOnMousePress = true; | 66 const bool kContextMenuOnMousePress = true; |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 } | 824 } |
824 | 825 |
825 void View::set_background(Background* b) { | 826 void View::set_background(Background* b) { |
826 background_.reset(b); | 827 background_.reset(b); |
827 } | 828 } |
828 | 829 |
829 void View::SetBorder(scoped_ptr<Border> b) { border_ = b.Pass(); } | 830 void View::SetBorder(scoped_ptr<Border> b) { border_ = b.Pass(); } |
830 | 831 |
831 ui::ThemeProvider* View::GetThemeProvider() const { | 832 ui::ThemeProvider* View::GetThemeProvider() const { |
832 const Widget* widget = GetWidget(); | 833 const Widget* widget = GetWidget(); |
833 return widget ? widget->GetThemeProvider() : NULL; | 834 return widget ? widget->GetThemeProvider() : nullptr; |
834 } | 835 } |
835 | 836 |
836 const ui::NativeTheme* View::GetNativeTheme() const { | 837 const ui::NativeTheme* View::GetNativeTheme() const { |
| 838 // On Windows, ui::NativeTheme::GetInstanceForWeb() returns NativeThemeWinAura |
| 839 // because that's what the renderer wants, but Views should default to |
| 840 // NativeThemeWin. TODO(estade): clean this up, see http://crbug.com/558029 |
| 841 #if defined(OS_WIN) |
| 842 const ui::NativeTheme* default_theme = ui::NativeThemeWin::instance(); |
| 843 #else |
| 844 const ui::NativeTheme* default_theme = ui::NativeTheme::GetInstanceForWeb(); |
| 845 #endif |
837 const Widget* widget = GetWidget(); | 846 const Widget* widget = GetWidget(); |
838 return widget ? widget->GetNativeTheme() : ui::NativeTheme::instance(); | 847 return widget ? widget->GetNativeTheme() : default_theme; |
839 } | 848 } |
840 | 849 |
841 // RTL painting ---------------------------------------------------------------- | 850 // RTL painting ---------------------------------------------------------------- |
842 | 851 |
843 void View::EnableCanvasFlippingForRTLUI(bool enable) { | 852 void View::EnableCanvasFlippingForRTLUI(bool enable) { |
844 flip_canvas_on_paint_for_rtl_ui_ = enable; | 853 flip_canvas_on_paint_for_rtl_ui_ = enable; |
845 } | 854 } |
846 | 855 |
847 // Input ----------------------------------------------------------------------- | 856 // Input ----------------------------------------------------------------------- |
848 | 857 |
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2354 // Message the RootView to do the drag and drop. That way if we're removed | 2363 // Message the RootView to do the drag and drop. That way if we're removed |
2355 // the RootView can detect it and avoid calling us back. | 2364 // the RootView can detect it and avoid calling us back. |
2356 gfx::Point widget_location(event.location()); | 2365 gfx::Point widget_location(event.location()); |
2357 ConvertPointToWidget(this, &widget_location); | 2366 ConvertPointToWidget(this, &widget_location); |
2358 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2367 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
2359 // WARNING: we may have been deleted. | 2368 // WARNING: we may have been deleted. |
2360 return true; | 2369 return true; |
2361 } | 2370 } |
2362 | 2371 |
2363 } // namespace views | 2372 } // namespace views |
OLD | NEW |