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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_NATIVE_BROWSER_FRAME_H_ 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_NATIVE_BROWSER_FRAME_H_ 7 8 #include "content/public/browser/keyboard_event_processing_result.h" 9 #include "ui/base/ui_base_types.h" 10 #include "ui/gfx/geometry/rect.h" 11 #include "ui/views/widget/widget.h" 12 13 class BrowserFrame; 14 enum class TabDragKind; 15 16 namespace content { 17 struct NativeWebKeyboardEvent; 18 } 19 20 class NativeBrowserFrame { 21 public: ~NativeBrowserFrame()22 virtual ~NativeBrowserFrame() {} 23 24 // Returns the platform specific InitParams for initializing our widget. 25 virtual views::Widget::InitParams GetWidgetParams() = 0; 26 27 // Returns |true| if we should use the custom frame. 28 virtual bool UseCustomFrame() const = 0; 29 30 // Returns true if the OS takes care of showing the system menu. Returning 31 // false means BrowserFrame handles showing the system menu. 32 virtual bool UsesNativeSystemMenu() const = 0; 33 34 // Returns true when the window placement should be stored. 35 virtual bool ShouldSaveWindowPlacement() const = 0; 36 37 // Retrieves the window placement (show state and bounds) for restoring. 38 virtual void GetWindowPlacement(gfx::Rect* bounds, 39 ui::WindowShowState* show_state) const = 0; 40 41 // Returns HANDLED if the |event| was handled by the platform implementation 42 // before sending it to the renderer. E.g., it may be swallowed by a native 43 // menu bar. Returns NOT_HANDLED_IS_SHORTCUT if the event was not handled, but 44 // would be handled as a shortcut if the renderer chooses not to handle it. 45 // Otherwise returns NOT_HANDLED. 46 virtual content::KeyboardEventProcessingResult PreHandleKeyboardEvent( 47 const content::NativeWebKeyboardEvent& event) = 0; 48 49 // Returns true if the |event| was handled by the platform implementation. 50 virtual bool HandleKeyboardEvent( 51 const content::NativeWebKeyboardEvent& event) = 0; 52 53 // Called when the tab drag kind for this frame changes. TabDraggingKindChanged(TabDragKind tab_drag_kind)54 virtual void TabDraggingKindChanged(TabDragKind tab_drag_kind) {} 55 56 protected: 57 friend class BrowserFrame; 58 59 // BrowserFrame pass-thrus --------------------------------------------------- 60 // See browser_frame.h for documentation: 61 virtual int GetMinimizeButtonOffset() const = 0; 62 }; 63 64 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_NATIVE_BROWSER_FRAME_H_ 65