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 #include "chrome/browser/tab_contents/web_contents_view_gtk.h" | 5 #include "chrome/browser/tab_contents/web_contents_view_gtk.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 gfx::NativeView WebContentsViewGtk::GetContentNativeView() const { | 108 gfx::NativeView WebContentsViewGtk::GetContentNativeView() const { |
109 return content_view_; | 109 return content_view_; |
110 } | 110 } |
111 | 111 |
112 gfx::NativeWindow WebContentsViewGtk::GetTopLevelNativeWindow() const { | 112 gfx::NativeWindow WebContentsViewGtk::GetTopLevelNativeWindow() const { |
113 return GTK_WINDOW(gtk_widget_get_toplevel(vbox_.get())); | 113 return GTK_WINDOW(gtk_widget_get_toplevel(vbox_.get())); |
114 } | 114 } |
115 | 115 |
116 void WebContentsViewGtk::GetContainerBounds(gfx::Rect* out) const { | 116 void WebContentsViewGtk::GetContainerBounds(gfx::Rect* out) const { |
117 NOTIMPLEMENTED(); | 117 // This is used for positioning the download shelf arrow animation, |
| 118 // as well as sizing some other widgets in Windows. In GTK the size is |
| 119 // managed for us, so it appears to be only used for the download shelf |
| 120 // animation. |
| 121 out->SetRect(vbox_.get()->allocation.x, vbox_.get()->allocation.y, |
| 122 vbox_.get()->allocation.width, vbox_.get()->allocation.height); |
118 } | 123 } |
119 | 124 |
120 void WebContentsViewGtk::OnContentsDestroy() { | 125 void WebContentsViewGtk::OnContentsDestroy() { |
121 // TODO(estade): Windows uses this function cancel pending drag-n-drop drags. | 126 // TODO(estade): Windows uses this function cancel pending drag-n-drop drags. |
122 // We don't have drags yet, so do nothing for now. | 127 // We don't have drags yet, so do nothing for now. |
123 } | 128 } |
124 | 129 |
125 void WebContentsViewGtk::SetPageTitle(const std::wstring& title) { | 130 void WebContentsViewGtk::SetPageTitle(const std::wstring& title) { |
126 NOTIMPLEMENTED(); | 131 // Set the window name to include the page title so it's easier to spot |
| 132 // when debugging (e.g. via xwininfo -tree). |
| 133 if (content_view_) |
| 134 gdk_window_set_title(content_view_->window, WideToASCII(title).c_str()); |
127 } | 135 } |
128 | 136 |
129 void WebContentsViewGtk::Invalidate() { | 137 void WebContentsViewGtk::Invalidate() { |
130 NOTIMPLEMENTED(); | 138 NOTIMPLEMENTED(); |
131 } | 139 } |
132 | 140 |
133 void WebContentsViewGtk::SizeContents(const gfx::Size& size) { | 141 void WebContentsViewGtk::SizeContents(const gfx::Size& size) { |
134 NOTIMPLEMENTED(); | 142 NOTIMPLEMENTED(); |
135 } | 143 } |
136 | 144 |
(...skipping 24 matching lines...) Expand all Loading... |
161 } | 169 } |
162 | 170 |
163 void WebContentsViewGtk::StoreFocus() { | 171 void WebContentsViewGtk::StoreFocus() { |
164 NOTIMPLEMENTED(); | 172 NOTIMPLEMENTED(); |
165 } | 173 } |
166 | 174 |
167 void WebContentsViewGtk::RestoreFocus() { | 175 void WebContentsViewGtk::RestoreFocus() { |
168 // TODO(estade): implement this function. | 176 // TODO(estade): implement this function. |
169 // For now just assume we are viewing the tab for the first time. | 177 // For now just assume we are viewing the tab for the first time. |
170 SetInitialFocus(); | 178 SetInitialFocus(); |
171 NOTIMPLEMENTED(); | 179 NOTIMPLEMENTED() << " -- need to restore the focus position on this page."; |
172 } | 180 } |
173 | 181 |
174 void WebContentsViewGtk::UpdateDragCursor(bool is_drop_target) { | 182 void WebContentsViewGtk::UpdateDragCursor(bool is_drop_target) { |
175 NOTIMPLEMENTED(); | 183 NOTIMPLEMENTED(); |
176 } | 184 } |
177 | 185 |
178 // This is called when we the renderer asks us to take focus back (i.e., it has | 186 // This is called when we the renderer asks us to take focus back (i.e., it has |
179 // iterated past the last focusable element on the page). | 187 // iterated past the last focusable element on the page). |
180 void WebContentsViewGtk::TakeFocus(bool reverse) { | 188 void WebContentsViewGtk::TakeFocus(bool reverse) { |
181 web_contents_->delegate()->SetFocusToLocationBar(); | 189 web_contents_->delegate()->SetFocusToLocationBar(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 251 |
244 RenderWidgetHost* widget_host = widget_host_view->GetRenderWidgetHost(); | 252 RenderWidgetHost* widget_host = widget_host_view->GetRenderWidgetHost(); |
245 if (!widget_host->process()->channel()) { | 253 if (!widget_host->process()->channel()) { |
246 // The view has gone away or the renderer crashed. Nothing to do. | 254 // The view has gone away or the renderer crashed. Nothing to do. |
247 return; | 255 return; |
248 } | 256 } |
249 | 257 |
250 widget_host_view_gtk->InitAsPopup( | 258 widget_host_view_gtk->InitAsPopup( |
251 web_contents_->render_widget_host_view(), initial_pos); | 259 web_contents_->render_widget_host_view(), initial_pos); |
252 } | 260 } |
OLD | NEW |