| 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 12 matching lines...) Expand all Loading... |
| 23 #include "content/public/browser/web_contents_delegate.h" | 23 #include "content/public/browser/web_contents_delegate.h" |
| 24 #include "content/public/browser/web_contents_view_gtk_delegate.h" | 24 #include "content/public/browser/web_contents_view_gtk_delegate.h" |
| 25 #include "ui/base/gtk/gtk_expanded_container.h" | 25 #include "ui/base/gtk/gtk_expanded_container.h" |
| 26 #include "ui/gfx/point.h" | 26 #include "ui/gfx/point.h" |
| 27 #include "ui/gfx/rect.h" | 27 #include "ui/gfx/rect.h" |
| 28 #include "ui/gfx/size.h" | 28 #include "ui/gfx/size.h" |
| 29 #include "webkit/glue/webdropdata.h" | 29 #include "webkit/glue/webdropdata.h" |
| 30 | 30 |
| 31 using WebKit::WebDragOperation; | 31 using WebKit::WebDragOperation; |
| 32 using WebKit::WebDragOperationsMask; | 32 using WebKit::WebDragOperationsMask; |
| 33 using content::RenderWidgetHost; |
| 33 using content::WebContents; | 34 using content::WebContents; |
| 34 | 35 |
| 35 namespace { | 36 namespace { |
| 36 | 37 |
| 37 // Called when the mouse leaves the widget. We notify our delegate. | 38 // Called when the mouse leaves the widget. We notify our delegate. |
| 38 gboolean OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event, | 39 gboolean OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event, |
| 39 TabContents* tab_contents) { | 40 TabContents* tab_contents) { |
| 40 if (tab_contents->GetDelegate()) | 41 if (tab_contents->GetDelegate()) |
| 41 tab_contents->GetDelegate()->ContentsMouseEvent( | 42 tab_contents->GetDelegate()->ContentsMouseEvent( |
| 42 tab_contents, gfx::Point(event->x_root, event->y_root), false); | 43 tab_contents, gfx::Point(event->x_root, event->y_root), false); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 void TabContentsViewGtk::SizeContents(const gfx::Size& size) { | 196 void TabContentsViewGtk::SizeContents(const gfx::Size& size) { |
| 196 // We don't need to manually set the size of of widgets in GTK+, but we do | 197 // We don't need to manually set the size of of widgets in GTK+, but we do |
| 197 // need to pass the sizing information on to the RWHV which will pass the | 198 // need to pass the sizing information on to the RWHV which will pass the |
| 198 // sizing information on to the renderer. | 199 // sizing information on to the renderer. |
| 199 requested_size_ = size; | 200 requested_size_ = size; |
| 200 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); | 201 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); |
| 201 if (rwhv) | 202 if (rwhv) |
| 202 rwhv->SetSize(size); | 203 rwhv->SetSize(size); |
| 203 } | 204 } |
| 204 | 205 |
| 205 void TabContentsViewGtk::RenderViewCreated(RenderViewHost* host) { | 206 void TabContentsViewGtk::RenderViewCreated(content::RenderViewHost* host) { |
| 206 } | 207 } |
| 207 | 208 |
| 208 void TabContentsViewGtk::Focus() { | 209 void TabContentsViewGtk::Focus() { |
| 209 if (tab_contents_->ShowingInterstitialPage()) { | 210 if (tab_contents_->ShowingInterstitialPage()) { |
| 210 tab_contents_->GetInterstitialPage()->Focus(); | 211 tab_contents_->GetInterstitialPage()->Focus(); |
| 211 } else if (delegate_.get()) { | 212 } else if (delegate_.get()) { |
| 212 delegate_->Focus(); | 213 delegate_->Focus(); |
| 213 } | 214 } |
| 214 } | 215 } |
| 215 | 216 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 // We manually tell our RWHV to resize the renderer content. This avoids | 430 // We manually tell our RWHV to resize the renderer content. This avoids |
| 430 // spurious resizes from GTK+. | 431 // spurious resizes from GTK+. |
| 431 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); | 432 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); |
| 432 if (rwhv) | 433 if (rwhv) |
| 433 rwhv->SetSize(size); | 434 rwhv->SetSize(size); |
| 434 if (tab_contents_->GetInterstitialPage()) | 435 if (tab_contents_->GetInterstitialPage()) |
| 435 tab_contents_->GetInterstitialPage()->SetSize(size); | 436 tab_contents_->GetInterstitialPage()->SetSize(size); |
| 436 } | 437 } |
| 437 | 438 |
| 438 } // namespace content | 439 } // namespace content |
| OLD | NEW |