Index: ui/views/cocoa/bridged_native_widget.h |
diff --git a/ui/views/cocoa/bridged_native_widget.h b/ui/views/cocoa/bridged_native_widget.h |
index 64cf81d71129b0974eccf1e128be71d3f9d4fcd9..a047e83e86a807a04151c821959563b8e495486b 100644 |
--- a/ui/views/cocoa/bridged_native_widget.h |
+++ b/ui/views/cocoa/bridged_native_widget.h |
@@ -9,11 +9,14 @@ |
#import "base/mac/scoped_nsobject.h" |
#include "base/memory/scoped_ptr.h" |
+#include "ui/compositor/layer_owner.h" |
#import "ui/views/focus/focus_manager.h" |
#include "ui/views/ime/input_method_delegate.h" |
#include "ui/views/views_export.h" |
#include "ui/views/widget/widget.h" |
+#import "content/browser/compositor/browser_compositor_view_mac.h" |
+ |
@class BridgedContentView; |
@class ViewsNSWindowDelegate; |
@@ -30,8 +33,12 @@ class View; |
// A bridge to an NSWindow managed by an instance of NativeWidgetMac or |
// DesktopNativeWidgetMac. Serves as a helper class to bridge requests from the |
// NativeWidgetMac to the Cocoa window. Behaves a bit like an aura::Window. |
-class VIEWS_EXPORT BridgedNativeWidget : public internal::InputMethodDelegate, |
- public FocusChangeListener { |
+class VIEWS_EXPORT BridgedNativeWidget |
+ : public ui::LayerDelegate, |
+ public ui::LayerOwner, |
+ public internal::InputMethodDelegate, |
+ public FocusChangeListener, |
+ public content::BrowserCompositorViewMacClient { |
public: |
// Creates one side of the bridge. |parent| must not be NULL. |
explicit BridgedNativeWidget(NativeWidgetMac* parent); |
@@ -45,6 +52,9 @@ class VIEWS_EXPORT BridgedNativeWidget : public internal::InputMethodDelegate, |
// This does NOT take ownership of |focus_manager|. |
void SetFocusManager(FocusManager* focus_manager); |
+ // Changes the bounds of the window and the hosted layer if present. |
+ void SetBounds(const gfx::Rect& new_bounds); |
+ |
// Set or clears the views::View bridged by the content view. This does NOT |
// take ownership of |view|. |
void SetRootView(views::View* view); |
@@ -56,6 +66,8 @@ class VIEWS_EXPORT BridgedNativeWidget : public internal::InputMethodDelegate, |
InputMethod* CreateInputMethod(); |
ui::InputMethod* GetHostInputMethod(); |
+ ui::Layer* GetOrCreateLayer(); |
+ |
NativeWidgetMac* native_widget_mac() { return native_widget_mac_; } |
BridgedContentView* ns_view() { return bridged_view_; } |
NSWindow* ns_window() { return window_; } |
@@ -63,10 +75,32 @@ class VIEWS_EXPORT BridgedNativeWidget : public internal::InputMethodDelegate, |
// Overridden from internal::InputMethodDelegate: |
virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) OVERRIDE; |
+ // Overridden from content::BrowserCompositorViewMacClient: |
+ virtual void BrowserCompositorViewFrameSwapped( |
+ const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE; |
+ virtual NSView* BrowserCompositorSuperview() OVERRIDE; |
+ virtual ui::Layer* BrowserCompositorRootLayer() OVERRIDE; |
+ |
private: |
// Closes all child windows. BridgedNativeWidget children will be destroyed. |
void RemoveOrDestroyChildren(); |
+ // Size the layer, taking into account display scale factor. |
+ void SetLayerSize(const gfx::Size& size_in_dip); |
+ |
+ void OnWindowBoundsChanged(); |
+ |
+ // Overridden from ui::LayerDelegate: |
+ virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; |
+ virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
+ virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE; |
+ |
+ // Overridden from FocusChangeListener: |
+ virtual void OnWillChangeFocus(View* focused_before, |
+ View* focused_now) OVERRIDE; |
+ virtual void OnDidChangeFocus(View* focused_before, |
+ View* focused_now) OVERRIDE; |
+ |
views::NativeWidgetMac* native_widget_mac_; // Weak. Owns this. |
base::scoped_nsobject<NSWindow> window_; |
base::scoped_nsobject<ViewsNSWindowDelegate> window_delegate_; |
@@ -74,11 +108,8 @@ class VIEWS_EXPORT BridgedNativeWidget : public internal::InputMethodDelegate, |
scoped_ptr<ui::InputMethod> input_method_; |
FocusManager* focus_manager_; // Weak. Owned by our Widget. |
- // Overridden from FocusChangeListener: |
- virtual void OnWillChangeFocus(View* focused_before, |
- View* focused_now) OVERRIDE; |
- virtual void OnDidChangeFocus(View* focused_before, |
- View* focused_now) OVERRIDE; |
+ scoped_ptr<content::BrowserCompositorViewMac> compositor_view_; |
+ content::BrowserCompositorViewPlaceholderMac recycling_keepalive_; |
DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); |
}; |