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 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_VIEW_WIN_H_ 6#define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_VIEW_WIN_H_ 7#pragma once 8 9#include "chrome/browser/ui/views/tab_contents/native_tab_contents_view.h" 10#include "views/widget/widget_win.h" 11 12class WebDropTarget; 13class TabContents; 14class TabContentsDragWin; 15 16class NativeTabContentsViewWin : public views::WidgetWin, 17 public NativeTabContentsView { 18 public: 19 explicit NativeTabContentsViewWin( 20 internal::NativeTabContentsViewDelegate* delegate); 21 virtual ~NativeTabContentsViewWin(); 22 23 WebDropTarget* drop_target() const { return drop_target_.get(); } 24 25 TabContents* GetTabContents() const; 26 27 void EndDragging(); 28 29 private: 30 // Overridden from NativeTabContentsView: 31 virtual void InitNativeTabContentsView() OVERRIDE; 32 virtual void Unparent() OVERRIDE; 33 virtual RenderWidgetHostView* CreateRenderWidgetHostView( 34 RenderWidgetHost* render_widget_host) OVERRIDE; 35 virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE; 36 virtual void SetPageTitle(const std::wstring& title) OVERRIDE; 37 virtual void StartDragging(const WebDropData& drop_data, 38 WebKit::WebDragOperationsMask ops, 39 const SkBitmap& image, 40 const gfx::Point& image_offset) OVERRIDE; 41 virtual void CancelDrag() OVERRIDE; 42 virtual bool IsDoingDrag() const OVERRIDE; 43 virtual void SetDragCursor(WebKit::WebDragOperation operation) OVERRIDE; 44 virtual views::NativeWidget* AsNativeWidget() OVERRIDE; 45 46 // Overridden from views::WidgetWin: 47 virtual void OnDestroy() OVERRIDE; 48 virtual void OnHScroll(int scroll_type, 49 short position, 50 HWND scrollbar) OVERRIDE; 51 virtual LRESULT OnMouseRange(UINT msg, 52 WPARAM w_param, 53 LPARAM l_param) OVERRIDE; 54 virtual LRESULT OnReflectedMessage(UINT msg, 55 WPARAM w_param, 56 LPARAM l_param) OVERRIDE; 57 virtual void OnVScroll(int scroll_type, 58 short position, 59 HWND scrollbar) OVERRIDE; 60 virtual void OnWindowPosChanged(WINDOWPOS* window_pos) OVERRIDE; 61 virtual void OnSize(UINT param, const WTL::CSize& size) OVERRIDE; 62 virtual LRESULT OnNCCalcSize(BOOL w_param, LPARAM l_param) OVERRIDE; 63 virtual void OnNCPaint(HRGN rgn) OVERRIDE; 64 virtual views::FocusManager* GetFocusManager() OVERRIDE; 65 66 // Backend for all scroll messages, the |message| parameter indicates which 67 // one it is. 68 void ScrollCommon(UINT message, int scroll_type, short position, 69 HWND scrollbar); 70 bool ScrollZoom(int scroll_type); 71 72 internal::NativeTabContentsViewDelegate* delegate_; 73 74 // A drop target object that handles drags over this TabContents. 75 scoped_refptr<WebDropTarget> drop_target_; 76 77 // Used to handle the drag-and-drop. 78 scoped_refptr<TabContentsDragWin> drag_handler_; 79 80 // The FocusManager associated with this tab. Stored as it is not directly 81 // accessible when un-parented. 82 views::FocusManager* focus_manager_; 83 84 DISALLOW_COPY_AND_ASSIGN(NativeTabContentsViewWin); 85}; 86 87#endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_VIEW_WIN_H_ 88