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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_VIEWS_H_
6 #define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_VIEWS_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "content/public/browser/web_contents_view_delegate.h"
13 class RenderViewContextMenuViews;
17 class WebDragDestDelegate;
25 // A chrome specific class that extends WebContentsViewWin with features like
26 // focus management, which live in chrome.
27 class ChromeWebContentsViewDelegateViews
28 : public content::WebContentsViewDelegate {
30 explicit ChromeWebContentsViewDelegateViews(
31 content::WebContents* web_contents);
32 virtual ~ChromeWebContentsViewDelegateViews();
34 // Overridden from WebContentsViewDelegate:
35 virtual content::WebDragDestDelegate* GetDragDestDelegate() OVERRIDE;
36 virtual void StoreFocus() OVERRIDE;
37 virtual void RestoreFocus() OVERRIDE;
38 virtual bool Focus() OVERRIDE;
39 virtual void TakeFocus(bool reverse) OVERRIDE;
40 virtual void ShowContextMenu(
41 const content::ContextMenuParams& params) OVERRIDE;
42 virtual void SizeChanged(const gfx::Size& size) OVERRIDE;
45 views::Widget* GetTopLevelWidget();
46 views::FocusManager* GetFocusManager();
47 void SetInitialFocus();
49 // The id used in the ViewStorage to store the last focused view.
50 int last_focused_view_storage_id_;
52 // The context menu is reset every time we show it, but we keep a pointer to
53 // between uses so that it won't go out of scope before we're done with it.
54 scoped_ptr<RenderViewContextMenuViews> context_menu_;
56 // The chrome specific delegate that receives events from WebDragDest.
57 scoped_ptr<content::WebDragDestDelegate> bookmark_handler_;
59 content::WebContents* web_contents_;
61 DISALLOW_COPY_AND_ASSIGN(ChromeWebContentsViewDelegateViews);
64 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_VIEWS_H_