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 #include "content/browser/tab_contents/tab_contents_view_gtk.h" | 5 #include "content/browser/tab_contents/tab_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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 gtk_widget_set_name(expanded_.get(), "chrome-tab-contents-view"); | 87 gtk_widget_set_name(expanded_.get(), "chrome-tab-contents-view"); |
88 g_signal_connect(expanded_.get(), "size-allocate", | 88 g_signal_connect(expanded_.get(), "size-allocate", |
89 G_CALLBACK(OnSizeAllocateThunk), this); | 89 G_CALLBACK(OnSizeAllocateThunk), this); |
90 g_signal_connect(expanded_.get(), "child-size-request", | 90 g_signal_connect(expanded_.get(), "child-size-request", |
91 G_CALLBACK(OnChildSizeRequestThunk), this); | 91 G_CALLBACK(OnChildSizeRequestThunk), this); |
92 | 92 |
93 gtk_widget_show(expanded_.get()); | 93 gtk_widget_show(expanded_.get()); |
94 drag_source_.reset(new content::WebDragSourceGtk(web_contents)); | 94 drag_source_.reset(new content::WebDragSourceGtk(web_contents)); |
95 | 95 |
96 if (delegate_.get()) | 96 if (delegate_.get()) |
97 delegate_->Initialize(expanded_.get()); | 97 delegate_->Initialize(expanded_.get(), &focus_store_); |
98 } | 98 } |
99 | 99 |
100 TabContentsViewGtk::~TabContentsViewGtk() { | 100 TabContentsViewGtk::~TabContentsViewGtk() { |
101 expanded_.Destroy(); | 101 expanded_.Destroy(); |
102 } | 102 } |
103 | 103 |
104 void TabContentsViewGtk::CreateView(const gfx::Size& initial_size) { | 104 void TabContentsViewGtk::CreateView(const gfx::Size& initial_size) { |
105 requested_size_ = initial_size; | 105 requested_size_ = initial_size; |
106 } | 106 } |
107 | 107 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 GdkWindow* window = gtk_widget_get_window(GetNativeView()); | 250 GdkWindow* window = gtk_widget_get_window(GetNativeView()); |
251 if (!window) { | 251 if (!window) { |
252 out->SetRect(0, 0, requested_size_.width(), requested_size_.height()); | 252 out->SetRect(0, 0, requested_size_.width(), requested_size_.height()); |
253 return; | 253 return; |
254 } | 254 } |
255 int x = 0, y = 0, w, h; | 255 int x = 0, y = 0, w, h; |
256 gdk_window_get_geometry(window, &x, &y, &w, &h, NULL); | 256 gdk_window_get_geometry(window, &x, &y, &w, &h, NULL); |
257 out->SetRect(x, y, w, h); | 257 out->SetRect(x, y, w, h); |
258 } | 258 } |
259 | 259 |
260 void TabContentsViewGtk::SetFocusedWidget(GtkWidget* widget) { | |
261 focus_store_.SetWidget(widget); | |
262 } | |
263 | |
264 WebContents* TabContentsViewGtk::web_contents() { | 260 WebContents* TabContentsViewGtk::web_contents() { |
265 return tab_contents_; | 261 return tab_contents_; |
266 } | 262 } |
267 | 263 |
268 void TabContentsViewGtk::UpdateDragCursor(WebDragOperation operation) { | 264 void TabContentsViewGtk::UpdateDragCursor(WebDragOperation operation) { |
269 drag_dest_->UpdateDragStatus(operation); | 265 drag_dest_->UpdateDragStatus(operation); |
270 } | 266 } |
271 | 267 |
272 void TabContentsViewGtk::GotFocus() { | 268 void TabContentsViewGtk::GotFocus() { |
273 // This is only used in the views FocusManager stuff but it bleeds through | 269 // This is only used in the views FocusManager stuff but it bleeds through |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 // We manually tell our RWHV to resize the renderer content. This avoids | 421 // We manually tell our RWHV to resize the renderer content. This avoids |
426 // spurious resizes from GTK+. | 422 // spurious resizes from GTK+. |
427 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); | 423 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); |
428 if (rwhv) | 424 if (rwhv) |
429 rwhv->SetSize(size); | 425 rwhv->SetSize(size); |
430 if (tab_contents_->GetInterstitialPage()) | 426 if (tab_contents_->GetInterstitialPage()) |
431 tab_contents_->GetInterstitialPage()->SetSize(size); | 427 tab_contents_->GetInterstitialPage()->SetSize(size); |
432 } | 428 } |
433 | 429 |
434 } // namespace content | 430 } // namespace content |
OLD | NEW |