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_DELEGATE_GTK_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_GTK_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_GTK_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 | 22 |
23 // A chrome/ specific class that extends TabContentsViewGtk with features like | 23 // A chrome/ specific class that extends TabContentsViewGtk with features like |
24 // constrained windows, which live in chrome/. | 24 // constrained windows, which live in chrome/. |
25 class ChromeWebContentsViewDelegateGtk | 25 class ChromeWebContentsViewDelegateGtk |
26 : public content::WebContentsViewDelegate { | 26 : public content::WebContentsViewDelegate { |
27 public: | 27 public: |
28 explicit ChromeWebContentsViewDelegateGtk(content::WebContents* web_contents); | 28 explicit ChromeWebContentsViewDelegateGtk(content::WebContents* web_contents); |
29 virtual ~ChromeWebContentsViewDelegateGtk(); | 29 virtual ~ChromeWebContentsViewDelegateGtk(); |
30 | 30 |
| 31 static ChromeWebContentsViewDelegateGtk* GetFor( |
| 32 content::WebContents* web_contents); |
| 33 |
| 34 GtkWidget* expanded_container() { return expanded_container_; } |
| 35 ui::FocusStoreGtk* focus_store() { return focus_store_; } |
| 36 |
31 // Unlike Windows, ConstrainedWindows need to collaborate with the | 37 // Unlike Windows, ConstrainedWindows need to collaborate with the |
32 // TabContentsViewGtk to position the dialogs. | 38 // TabContentsViewGtk to position the dialogs. |
33 void AttachConstrainedWindow(ConstrainedWindowGtk* constrained_window); | 39 void AttachConstrainedWindow(ConstrainedWindowGtk* constrained_window); |
34 void RemoveConstrainedWindow(ConstrainedWindowGtk* constrained_window); | 40 void RemoveConstrainedWindow(ConstrainedWindowGtk* constrained_window); |
35 | 41 |
36 // Overridden from WebContentsViewDelegate: | 42 // Overridden from WebContentsViewDelegate: |
37 virtual void ShowContextMenu( | 43 virtual void ShowContextMenu( |
38 const content::ContextMenuParams& params) OVERRIDE; | 44 const content::ContextMenuParams& params) OVERRIDE; |
39 virtual content::WebDragDestDelegate* GetDragDestDelegate() OVERRIDE; | 45 virtual content::WebDragDestDelegate* GetDragDestDelegate() OVERRIDE; |
40 virtual void Initialize(GtkWidget* expanded_container) OVERRIDE; | 46 virtual void Initialize(GtkWidget* expanded_container, |
| 47 ui::FocusStoreGtk* focus_store) OVERRIDE; |
41 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 48 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
42 virtual void Focus() OVERRIDE; | 49 virtual void Focus() OVERRIDE; |
43 virtual gboolean OnNativeViewFocusEvent(GtkWidget* widget, | 50 virtual gboolean OnNativeViewFocusEvent(GtkWidget* widget, |
44 GtkDirectionType type, | 51 GtkDirectionType type, |
45 gboolean* return_value) OVERRIDE; | 52 gboolean* return_value) OVERRIDE; |
46 | 53 |
47 private: | 54 private: |
48 // Sets the location of the constrained windows. | 55 // Sets the location of the constrained windows. |
49 CHROMEGTK_CALLBACK_1(ChromeWebContentsViewDelegateGtk, void, | 56 CHROMEGTK_CALLBACK_1(ChromeWebContentsViewDelegateGtk, void, |
50 OnSetFloatingPosition, | 57 OnSetFloatingPosition, |
51 GtkAllocation*); | 58 GtkAllocation*); |
52 | 59 |
53 // Contains |expanded_| as its GtkBin member. | 60 // Contains |expanded_| as its GtkBin member. |
54 ui::OwnedWidgetGtk floating_; | 61 ui::OwnedWidgetGtk floating_; |
55 | 62 |
56 // The UI for the constrained dialog currently displayed. This is owned by | 63 // The UI for the constrained dialog currently displayed. This is owned by |
57 // TabContents, not the view. | 64 // TabContents, not the view. |
58 ConstrainedWindowGtk* constrained_window_; | 65 ConstrainedWindowGtk* constrained_window_; |
59 | 66 |
60 // The context menu is reset every time we show it, but we keep a pointer to | 67 // The context menu is reset every time we show it, but we keep a pointer to |
61 // between uses so that it won't go out of scope before we're done with it. | 68 // between uses so that it won't go out of scope before we're done with it. |
62 scoped_ptr<RenderViewContextMenuGtk> context_menu_; | 69 scoped_ptr<RenderViewContextMenuGtk> context_menu_; |
63 | 70 |
64 // The chrome specific delegate that receives events from WebDragDestGtk. | 71 // The chrome specific delegate that receives events from WebDragDestGtk. |
65 scoped_ptr<WebDragBookmarkHandlerGtk> bookmark_handler_gtk_; | 72 scoped_ptr<WebDragBookmarkHandlerGtk> bookmark_handler_gtk_; |
66 | 73 |
67 content::WebContents* web_contents_; | 74 content::WebContents* web_contents_; |
| 75 |
| 76 GtkWidget* expanded_container_; |
| 77 ui::FocusStoreGtk* focus_store_; |
68 }; | 78 }; |
69 | 79 |
70 #endif // CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_GTK_H_ | 80 #endif // CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_GTK_H_ |
OLD | NEW |