| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef UI_VIEWS_CONTROLS_NATIVE_NATIVE_VIEW_HOST_H_ | 5 #ifndef UI_VIEWS_CONTROLS_NATIVE_NATIVE_VIEW_HOST_H_ |
| 6 #define UI_VIEWS_CONTROLS_NATIVE_NATIVE_VIEW_HOST_H_ | 6 #define UI_VIEWS_CONTROLS_NATIVE_NATIVE_VIEW_HOST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 void Attach(gfx::NativeView native_view); | 43 void Attach(gfx::NativeView native_view); |
| 44 | 44 |
| 45 // Detach the attached native view. Its bounds and visibility will no | 45 // Detach the attached native view. Its bounds and visibility will no |
| 46 // longer be manipulated by this View. The native view may be destroyed and | 46 // longer be manipulated by this View. The native view may be destroyed and |
| 47 // detached before calling this function, and this has no effect in that case. | 47 // detached before calling this function, and this has no effect in that case. |
| 48 void Detach(); | 48 void Detach(); |
| 49 | 49 |
| 50 // Sets a preferred size for the native view attached to this View. | 50 // Sets a preferred size for the native view attached to this View. |
| 51 void SetPreferredSize(const gfx::Size& size); | 51 void SetPreferredSize(const gfx::Size& size); |
| 52 | 52 |
| 53 // Sets a rendering size for the NativeView that may or may not match the size |
| 54 // of this View. If the size does not match, scaling will occur. Pass an empty |
| 55 // size to revert to the default behavior, where the NatieView's rendering |
| 56 // size equals this View's size. |
| 57 void SetRenderingSize(const gfx::Size& size); |
| 58 |
| 53 // Fast resizing will move the native view and clip its visible region, this | 59 // Fast resizing will move the native view and clip its visible region, this |
| 54 // will result in white areas and will not resize the content (so scrollbars | 60 // will result in white areas and will not resize the content (so scrollbars |
| 55 // will be all wrong and content will flow offscreen). Only use this | 61 // will be all wrong and content will flow offscreen). Only use this |
| 56 // when you're doing extremely quick, high-framerate vertical resizes | 62 // when you're doing extremely quick, high-framerate vertical resizes |
| 57 // and don't care about accuracy. Make sure you do a real resize at the | 63 // and don't care about accuracy. Make sure you do a real resize at the |
| 58 // end. USE WITH CAUTION. | 64 // end. USE WITH CAUTION. |
| 59 void set_fast_resize(bool fast_resize) { fast_resize_ = fast_resize; } | 65 void set_fast_resize(bool fast_resize) { fast_resize_ = fast_resize; } |
| 60 bool fast_resize() const { return fast_resize_; } | 66 bool fast_resize() const { return fast_resize_; } |
| 61 | 67 |
| 62 // Sets the color to paint the background during a resize that involves a | 68 // Sets the color to paint the background during a resize that involves a |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // The attached native view. There is exactly one native_view_ attached. | 112 // The attached native view. There is exactly one native_view_ attached. |
| 107 gfx::NativeView native_view_; | 113 gfx::NativeView native_view_; |
| 108 | 114 |
| 109 // A platform-specific wrapper that does the OS-level manipulation of the | 115 // A platform-specific wrapper that does the OS-level manipulation of the |
| 110 // attached gfx::NativeView. | 116 // attached gfx::NativeView. |
| 111 std::unique_ptr<NativeViewHostWrapper> native_wrapper_; | 117 std::unique_ptr<NativeViewHostWrapper> native_wrapper_; |
| 112 | 118 |
| 113 // The preferred size of this View | 119 // The preferred size of this View |
| 114 gfx::Size preferred_size_; | 120 gfx::Size preferred_size_; |
| 115 | 121 |
| 122 // The rendering size of the NativeView, or an empty size if no scaling of the |
| 123 // NativeView should occur. |
| 124 gfx::Size rendering_size_; |
| 125 |
| 116 // True if the native view is being resized using the fast method described | 126 // True if the native view is being resized using the fast method described |
| 117 // in the setter/accessor above. | 127 // in the setter/accessor above. |
| 118 bool fast_resize_; | 128 bool fast_resize_; |
| 119 | 129 |
| 120 // Value of |fast_resize_| during the last call to Layout. | 130 // Value of |fast_resize_| during the last call to Layout. |
| 121 bool fast_resize_at_last_layout_; | 131 bool fast_resize_at_last_layout_; |
| 122 | 132 |
| 123 // Color to paint in the background while resizing. | 133 // Color to paint in the background while resizing. |
| 124 SkColor resize_background_color_; | 134 SkColor resize_background_color_; |
| 125 | 135 |
| 126 DISALLOW_COPY_AND_ASSIGN(NativeViewHost); | 136 DISALLOW_COPY_AND_ASSIGN(NativeViewHost); |
| 127 }; | 137 }; |
| 128 | 138 |
| 129 } // namespace views | 139 } // namespace views |
| 130 | 140 |
| 131 #endif // UI_VIEWS_CONTROLS_NATIVE_NATIVE_VIEW_HOST_H_ | 141 #endif // UI_VIEWS_CONTROLS_NATIVE_NATIVE_VIEW_HOST_H_ |
| OLD | NEW |