| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_TAB_CONTENTS_VIEW_GTK_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "base/task.h" |
| 13 #include "chrome/browser/gtk/focus_store_gtk.h" | 14 #include "chrome/browser/gtk/focus_store_gtk.h" |
| 14 #include "chrome/browser/tab_contents/tab_contents_view.h" | 15 #include "chrome/browser/tab_contents/tab_contents_view.h" |
| 15 #include "chrome/common/notification_observer.h" | 16 #include "chrome/common/notification_observer.h" |
| 16 #include "chrome/common/notification_registrar.h" | 17 #include "chrome/common/notification_registrar.h" |
| 17 #include "chrome/common/owned_widget_gtk.h" | 18 #include "chrome/common/owned_widget_gtk.h" |
| 18 | 19 |
| 19 class BlockedPopupContainerViewGtk; | 20 class BlockedPopupContainerViewGtk; |
| 20 class ConstrainedWindowGtk; | 21 class ConstrainedWindowGtk; |
| 21 class RenderViewContextMenuGtk; | 22 class RenderViewContextMenuGtk; |
| 22 class SadTabGtk; | 23 class SadTabGtk; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 virtual void StoreFocus(); | 61 virtual void StoreFocus(); |
| 61 virtual void RestoreFocus(); | 62 virtual void RestoreFocus(); |
| 62 | 63 |
| 63 // Backend implementation of RenderViewHostDelegate::View. | 64 // Backend implementation of RenderViewHostDelegate::View. |
| 64 virtual void ShowContextMenu(const ContextMenuParams& params); | 65 virtual void ShowContextMenu(const ContextMenuParams& params); |
| 65 virtual void StartDragging(const WebDropData& drop_data); | 66 virtual void StartDragging(const WebDropData& drop_data); |
| 66 virtual void UpdateDragCursor(bool is_drop_target); | 67 virtual void UpdateDragCursor(bool is_drop_target); |
| 67 virtual void GotFocus(); | 68 virtual void GotFocus(); |
| 68 virtual void TakeFocus(bool reverse); | 69 virtual void TakeFocus(bool reverse); |
| 69 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 70 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
| 71 virtual void HandleMouseButtonEvent(const WebKit::WebMouseEvent* event); |
| 70 | 72 |
| 71 // NotificationObserver implementation --------------------------------------- | 73 // NotificationObserver implementation --------------------------------------- |
| 72 | 74 |
| 73 virtual void Observe(NotificationType type, | 75 virtual void Observe(NotificationType type, |
| 74 const NotificationSource& source, | 76 const NotificationSource& source, |
| 75 const NotificationDetails& details); | 77 const NotificationDetails& details); |
| 76 | 78 |
| 79 // A callback for when we get the contents of the clipboard. |
| 80 void ClipboardContentsReceived(const gchar* utf8_string); |
| 81 |
| 82 class ClipboardRequestCallback { |
| 83 public: |
| 84 ClipboardRequestCallback(TabContentsViewGtk* tab_contents); |
| 85 void Cancel(); |
| 86 void Callback(const gchar* utf8_string); |
| 87 |
| 88 private: |
| 89 TabContentsViewGtk* tab_contents_view_; |
| 90 }; |
| 91 |
| 77 private: | 92 private: |
| 78 // Insert the given widget into the content area. Should only be used for | 93 // Insert the given widget into the content area. Should only be used for |
| 79 // web pages and the like (including interstitials and sad tab). Note that | 94 // web pages and the like (including interstitials and sad tab). Note that |
| 80 // this will be perfectly happy to insert overlapping render views, so care | 95 // this will be perfectly happy to insert overlapping render views, so care |
| 81 // should be taken that the correct one is hidden/shown. | 96 // should be taken that the correct one is hidden/shown. |
| 82 void InsertIntoContentArea(GtkWidget* widget); | 97 void InsertIntoContentArea(GtkWidget* widget); |
| 83 | 98 |
| 84 // We keep track of the timestamp of the latest mousedown event. | 99 // We keep track of the timestamp of the latest mousedown event. |
| 85 static gboolean OnMouseDown(GtkWidget* widget, | 100 static gboolean OnMouseDown(GtkWidget* widget, |
| 86 GdkEventButton* event, TabContentsViewGtk* view); | 101 GdkEventButton* event, TabContentsViewGtk* view); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 FocusStoreGtk focus_store_; | 133 FocusStoreGtk focus_store_; |
| 119 | 134 |
| 120 // Our UI for controlling popups (or NULL if no popup windows have been | 135 // Our UI for controlling popups (or NULL if no popup windows have been |
| 121 // opened). |popup_view_| is owned by the TabContents, not the view. | 136 // opened). |popup_view_| is owned by the TabContents, not the view. |
| 122 BlockedPopupContainerViewGtk* popup_view_; | 137 BlockedPopupContainerViewGtk* popup_view_; |
| 123 | 138 |
| 124 // Each individual UI for constrained dialogs currently displayed. The | 139 // Each individual UI for constrained dialogs currently displayed. The |
| 125 // objects in this vector are owned by the TabContents, not the view. | 140 // objects in this vector are owned by the TabContents, not the view. |
| 126 std::vector<ConstrainedWindowGtk*> constrained_windows_; | 141 std::vector<ConstrainedWindowGtk*> constrained_windows_; |
| 127 | 142 |
| 143 // On middle-click to navigate, we asynchonously request the clipboard |
| 144 // contents and use the following object to handle the case where this |
| 145 // TabContentsViewGtk has been deleted in the mean time. |
| 146 ClipboardRequestCallback* outstanding_clipboard_contents_request_; |
| 147 |
| 128 DISALLOW_COPY_AND_ASSIGN(TabContentsViewGtk); | 148 DISALLOW_COPY_AND_ASSIGN(TabContentsViewGtk); |
| 129 }; | 149 }; |
| 130 | 150 |
| 131 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ | 151 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ |
| OLD | NEW |