1cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved. 2cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// found in the LICENSE file. 4cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 5cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#ifndef UI_VIEWS_WIDGET_NATIVE_WIDGET_MAC_H_ 6cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#define UI_VIEWS_WIDGET_NATIVE_WIDGET_MAC_H_ 7cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 8cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "ui/gfx/native_widget_types.h" 9cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "ui/views/widget/native_widget_private.h" 10cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 11cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)namespace views { 12116680a4aac90f2aa7413d9095a592090648e557Ben Murdochnamespace test { 13116680a4aac90f2aa7413d9095a592090648e557Ben Murdochclass MockNativeWidgetMac; 14116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch} 15cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 16f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)class BridgedNativeWidget; 17f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 18cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class VIEWS_EXPORT NativeWidgetMac : public internal::NativeWidgetPrivate { 19cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) public: 20cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) NativeWidgetMac(internal::NativeWidgetDelegate* delegate); 21cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual ~NativeWidgetMac(); 22cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 23116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // Deletes |bridge_| and informs |delegate_| that the native widget is 24116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // destroyed. 25116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch void OnWindowWillClose(); 26116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 27cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // internal::NativeWidgetPrivate: 28cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; 29cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; 30cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool ShouldUseNativeFrame() const OVERRIDE; 31cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool ShouldWindowContentsBeTransparent() const OVERRIDE; 32cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void FrameTypeChanged() OVERRIDE; 33cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual Widget* GetWidget() OVERRIDE; 34cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual const Widget* GetWidget() const OVERRIDE; 35cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual gfx::NativeView GetNativeView() const OVERRIDE; 36cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; 37cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual Widget* GetTopLevelWidget() OVERRIDE; 38cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual const ui::Compositor* GetCompositor() const OVERRIDE; 39cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual ui::Compositor* GetCompositor() OVERRIDE; 40cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual ui::Layer* GetLayer() OVERRIDE; 41cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void ReorderNativeViews() OVERRIDE; 42cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void ViewRemoved(View* view) OVERRIDE; 43cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE; 44cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void* GetNativeWindowProperty(const char* name) const OVERRIDE; 45cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual TooltipManager* GetTooltipManager() const OVERRIDE; 46cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetCapture() OVERRIDE; 47cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void ReleaseCapture() OVERRIDE; 48cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool HasCapture() const OVERRIDE; 49cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual InputMethod* CreateInputMethod() OVERRIDE; 50f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual internal::InputMethodDelegate* GetInputMethodDelegate() OVERRIDE; 51cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual ui::InputMethod* GetHostInputMethod() OVERRIDE; 52cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void CenterWindow(const gfx::Size& size) OVERRIDE; 53cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void GetWindowPlacement( 54cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) gfx::Rect* bounds, 55cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) ui::WindowShowState* maximized) const OVERRIDE; 56cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool SetWindowTitle(const base::string16& title) OVERRIDE; 57cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetWindowIcons(const gfx::ImageSkia& window_icon, 58cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const gfx::ImageSkia& app_icon) OVERRIDE; 59cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void InitModalType(ui::ModalType modal_type) OVERRIDE; 60cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual gfx::Rect GetWindowBoundsInScreen() const OVERRIDE; 61cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual gfx::Rect GetClientAreaBoundsInScreen() const OVERRIDE; 62cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual gfx::Rect GetRestoredBounds() const OVERRIDE; 63cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 64cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetSize(const gfx::Size& size) OVERRIDE; 65cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void StackAbove(gfx::NativeView native_view) OVERRIDE; 66cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void StackAtTop() OVERRIDE; 67cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void StackBelow(gfx::NativeView native_view) OVERRIDE; 68cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetShape(gfx::NativeRegion shape) OVERRIDE; 69cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Close() OVERRIDE; 70cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void CloseNow() OVERRIDE; 71cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Show() OVERRIDE; 72cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Hide() OVERRIDE; 73cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void ShowMaximizedWithBounds( 74cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const gfx::Rect& restored_bounds) OVERRIDE; 75cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void ShowWithWindowState(ui::WindowShowState state) OVERRIDE; 76cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool IsVisible() const OVERRIDE; 77cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Activate() OVERRIDE; 78cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Deactivate() OVERRIDE; 79cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool IsActive() const OVERRIDE; 80cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; 81cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool IsAlwaysOnTop() const OVERRIDE; 82cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetVisibleOnAllWorkspaces(bool always_visible) OVERRIDE; 83cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Maximize() OVERRIDE; 84cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Minimize() OVERRIDE; 85cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool IsMaximized() const OVERRIDE; 86cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool IsMinimized() const OVERRIDE; 87cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Restore() OVERRIDE; 88cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetFullscreen(bool fullscreen) OVERRIDE; 89cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool IsFullscreen() const OVERRIDE; 90cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetOpacity(unsigned char opacity) OVERRIDE; 91cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; 92cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void FlashFrame(bool flash_frame) OVERRIDE; 93cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void RunShellDrag(View* view, 94cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const ui::OSExchangeData& data, 95cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const gfx::Point& location, 96cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) int operation, 97cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) ui::DragDropTypes::DragEventSource source) OVERRIDE; 98cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE; 99cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; 100cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool IsMouseEventsEnabled() const OVERRIDE; 101cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void ClearNativeFocus() OVERRIDE; 102cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual gfx::Rect GetWorkAreaBoundsInScreen() const OVERRIDE; 103cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual Widget::MoveLoopResult RunMoveLoop( 104cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const gfx::Vector2d& drag_offset, 105cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) Widget::MoveLoopSource source, 106cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) Widget::MoveLoopEscapeBehavior escape_behavior) OVERRIDE; 107cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void EndMoveLoop() OVERRIDE; 108cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE; 109cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual ui::NativeTheme* GetNativeTheme() const OVERRIDE; 1105f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) virtual void OnRootViewLayout() OVERRIDE; 111116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch virtual bool IsTranslucentWindowOpacitySupported() const OVERRIDE; 1121320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci virtual void OnSizeConstraintsChanged() OVERRIDE; 113cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void RepostNativeEvent(gfx::NativeEvent native_event) OVERRIDE; 114cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 115116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch protected: 116116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch internal::NativeWidgetDelegate* delegate() { return delegate_; } 117116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 118cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) private: 119116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch friend class test::MockNativeWidgetMac; 120116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 121cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) internal::NativeWidgetDelegate* delegate_; 122f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) scoped_ptr<BridgedNativeWidget> bridge_; 123cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 124116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch Widget::InitParams::Ownership ownership_; 125116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 126cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(NativeWidgetMac); 127cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}; 128cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 129cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)} // namespace views 130cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 131cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_MAC_H_ 132