OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_WIN_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_WIN_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_WIN_DELEGATE_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "content/public/browser/web_contents_view_win_delegate.h" | 12 #include "content/public/browser/web_contents_view_delegate.h" |
13 | 13 |
14 class ConstrainedWindowViews; | 14 class ConstrainedWindowViews; |
15 class RenderViewContextMenuViews; | 15 class RenderViewContextMenuViews; |
16 class WebDragBookmarkHandlerWin; | 16 class WebDragBookmarkHandlerWin; |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 class WebContents; | 19 class WebContents; |
20 } | 20 } |
21 | 21 |
22 namespace views { | 22 namespace views { |
23 class FocusManager; | 23 class FocusManager; |
24 class Widget; | 24 class Widget; |
25 } | 25 } |
26 | 26 |
27 // A chrome specific class that extends TabContentsViewWin with features like | 27 // A chrome specific class that extends TabContentsViewWin with features like |
28 // constrained windows, which live in chrome. | 28 // constrained windows, which live in chrome. |
29 class ChromeWebContentsViewWinDelegate | 29 class ChromeWebContentsViewDelegateWin |
30 : public content::WebContentsViewWinDelegate { | 30 : public content::WebContentsViewDelegate { |
31 public: | 31 public: |
32 explicit ChromeWebContentsViewWinDelegate(content::WebContents* web_contents); | 32 explicit ChromeWebContentsViewDelegateWin(content::WebContents* web_contents); |
33 virtual ~ChromeWebContentsViewWinDelegate(); | 33 virtual ~ChromeWebContentsViewDelegateWin(); |
34 | 34 |
35 // Overridden from WebContentsViewWinDelegate: | 35 // Overridden from WebContentsViewDelegate: |
36 virtual content::WebDragDestDelegate* GetDragDestDelegate() OVERRIDE; | 36 virtual content::WebDragDestDelegate* GetDragDestDelegate() OVERRIDE; |
37 virtual void StoreFocus() OVERRIDE; | 37 virtual void StoreFocus() OVERRIDE; |
38 virtual void RestoreFocus() OVERRIDE; | 38 virtual void RestoreFocus() OVERRIDE; |
39 virtual bool Focus() OVERRIDE; | 39 virtual bool Focus() OVERRIDE; |
40 virtual void TakeFocus(bool reverse) OVERRIDE; | 40 virtual void TakeFocus(bool reverse) OVERRIDE; |
41 virtual void ShowContextMenu( | 41 virtual void ShowContextMenu( |
42 const content::ContextMenuParams& params) OVERRIDE; | 42 const content::ContextMenuParams& params) OVERRIDE; |
43 virtual void SizeChanged(const gfx::Size& size) OVERRIDE; | 43 virtual void SizeChanged(const gfx::Size& size) OVERRIDE; |
44 | 44 |
45 private: | 45 private: |
46 views::Widget* GetTopLevelWidget(); | 46 views::Widget* GetTopLevelWidget(); |
47 views::FocusManager* GetFocusManager(); | 47 views::FocusManager* GetFocusManager(); |
48 void SetInitialFocus(); | 48 void SetInitialFocus(); |
49 | 49 |
50 // The id used in the ViewStorage to store the last focused view. | 50 // The id used in the ViewStorage to store the last focused view. |
51 int last_focused_view_storage_id_; | 51 int last_focused_view_storage_id_; |
52 | 52 |
53 // The context menu is reset every time we show it, but we keep a pointer to | 53 // The context menu is reset every time we show it, but we keep a pointer to |
54 // between uses so that it won't go out of scope before we're done with it. | 54 // between uses so that it won't go out of scope before we're done with it. |
55 scoped_ptr<RenderViewContextMenuViews> context_menu_; | 55 scoped_ptr<RenderViewContextMenuViews> context_menu_; |
56 | 56 |
57 // The chrome specific delegate that receives events from WebDragDest. | 57 // The chrome specific delegate that receives events from WebDragDest. |
58 scoped_ptr<WebDragBookmarkHandlerWin> bookmark_handler_; | 58 scoped_ptr<WebDragBookmarkHandlerWin> bookmark_handler_; |
59 | 59 |
60 content::WebContents* web_contents_; | 60 content::WebContents* web_contents_; |
61 | 61 |
62 DISALLOW_COPY_AND_ASSIGN(ChromeWebContentsViewWinDelegate); | 62 DISALLOW_COPY_AND_ASSIGN(ChromeWebContentsViewDelegateWin); |
63 }; | 63 }; |
64 | 64 |
65 #endif // CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_WIN_DELEGATE_H_ | 65 #endif // CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_WIN_H_ |
OLD | NEW |