Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: content/browser/web_contents/web_contents_view_gtk.cc

Issue 18281002: Move WebDropData to content::DropData and split off conversion function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Mac build error. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/web_contents/web_contents_view_gtk.h" 5 #include "content/browser/web_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
11 #include <algorithm> 11 #include <algorithm>
12 12
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "content/browser/renderer_host/render_view_host_factory.h" 16 #include "content/browser/renderer_host/render_view_host_factory.h"
17 #include "content/browser/renderer_host/render_view_host_impl.h" 17 #include "content/browser/renderer_host/render_view_host_impl.h"
18 #include "content/browser/renderer_host/render_widget_host_view_gtk.h" 18 #include "content/browser/renderer_host/render_widget_host_view_gtk.h"
19 #include "content/browser/web_contents/interstitial_page_impl.h" 19 #include "content/browser/web_contents/interstitial_page_impl.h"
20 #include "content/browser/web_contents/web_contents_impl.h" 20 #include "content/browser/web_contents/web_contents_impl.h"
21 #include "content/browser/web_contents/web_drag_dest_gtk.h" 21 #include "content/browser/web_contents/web_drag_dest_gtk.h"
22 #include "content/browser/web_contents/web_drag_source_gtk.h" 22 #include "content/browser/web_contents/web_drag_source_gtk.h"
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_delegate.h" 24 #include "content/public/browser/web_contents_view_delegate.h"
25 #include "content/public/common/drop_data.h"
25 #include "ui/base/gtk/gtk_expanded_container.h" 26 #include "ui/base/gtk/gtk_expanded_container.h"
26 #include "ui/gfx/image/image_skia.h" 27 #include "ui/gfx/image/image_skia.h"
27 #include "ui/gfx/point.h" 28 #include "ui/gfx/point.h"
28 #include "ui/gfx/rect.h" 29 #include "ui/gfx/rect.h"
29 #include "ui/gfx/size.h" 30 #include "ui/gfx/size.h"
30 #include "webkit/common/webdropdata.h"
31 31
32 using WebKit::WebDragOperation; 32 using WebKit::WebDragOperation;
33 using WebKit::WebDragOperationsMask; 33 using WebKit::WebDragOperationsMask;
34 34
35 namespace content { 35 namespace content {
36 namespace { 36 namespace {
37 37
38 // Called when the mouse leaves the widget. We notify our delegate. 38 // Called when the mouse leaves the widget. We notify our delegate.
39 gboolean OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event, 39 gboolean OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event,
40 WebContentsImpl* web_contents) { 40 WebContentsImpl* web_contents) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 focus_store_.Store(GetNativeView()); 167 focus_store_.Store(GetNativeView());
168 } 168 }
169 169
170 void WebContentsViewGtk::RestoreFocus() { 170 void WebContentsViewGtk::RestoreFocus() {
171 if (focus_store_.widget()) 171 if (focus_store_.widget())
172 gtk_widget_grab_focus(focus_store_.widget()); 172 gtk_widget_grab_focus(focus_store_.widget());
173 else 173 else
174 SetInitialFocus(); 174 SetInitialFocus();
175 } 175 }
176 176
177 WebDropData* WebContentsViewGtk::GetDropData() const { 177 DropData* WebContentsViewGtk::GetDropData() const {
178 return drag_dest_->current_drop_data(); 178 return drag_dest_->current_drop_data();
179 } 179 }
180 180
181 gfx::Rect WebContentsViewGtk::GetViewBounds() const { 181 gfx::Rect WebContentsViewGtk::GetViewBounds() const {
182 gfx::Rect rect; 182 gfx::Rect rect;
183 GdkWindow* window = gtk_widget_get_window(GetNativeView()); 183 GdkWindow* window = gtk_widget_get_window(GetNativeView());
184 if (!window) { 184 if (!window) {
185 rect.SetRect(0, 0, requested_size_.width(), requested_size_.height()); 185 rect.SetRect(0, 0, requested_size_.width(), requested_size_.height());
186 return rect; 186 return rect;
187 } 187 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 int selected_item, 362 int selected_item,
363 const std::vector<WebMenuItem>& items, 363 const std::vector<WebMenuItem>& items,
364 bool right_aligned, 364 bool right_aligned,
365 bool allow_multiple_selection) { 365 bool allow_multiple_selection) {
366 // External popup menus are only used on Mac and Android. 366 // External popup menus are only used on Mac and Android.
367 NOTIMPLEMENTED(); 367 NOTIMPLEMENTED();
368 } 368 }
369 369
370 // Render view DnD ------------------------------------------------------------- 370 // Render view DnD -------------------------------------------------------------
371 371
372 void WebContentsViewGtk::StartDragging(const WebDropData& drop_data, 372 void WebContentsViewGtk::StartDragging(const DropData& drop_data,
373 WebDragOperationsMask ops, 373 WebDragOperationsMask ops,
374 const gfx::ImageSkia& image, 374 const gfx::ImageSkia& image,
375 const gfx::Vector2d& image_offset, 375 const gfx::Vector2d& image_offset,
376 const DragEventSourceInfo& event_info) { 376 const DragEventSourceInfo& event_info) {
377 DCHECK(GetContentNativeView()); 377 DCHECK(GetContentNativeView());
378 378
379 RenderWidgetHostViewGtk* view_gtk = static_cast<RenderWidgetHostViewGtk*>( 379 RenderWidgetHostViewGtk* view_gtk = static_cast<RenderWidgetHostViewGtk*>(
380 web_contents_->GetRenderWidgetHostView()); 380 web_contents_->GetRenderWidgetHostView());
381 if (!view_gtk || !view_gtk->GetLastMouseDown() || 381 if (!view_gtk || !view_gtk->GetLastMouseDown() ||
382 !drag_source_->StartDragging(drop_data, ops, view_gtk->GetLastMouseDown(), 382 !drag_source_->StartDragging(drop_data, ops, view_gtk->GetLastMouseDown(),
(...skipping 26 matching lines...) Expand all
409 // We manually tell our RWHV to resize the renderer content. This avoids 409 // We manually tell our RWHV to resize the renderer content. This avoids
410 // spurious resizes from GTK+. 410 // spurious resizes from GTK+.
411 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); 411 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
412 if (rwhv) 412 if (rwhv)
413 rwhv->SetSize(size); 413 rwhv->SetSize(size);
414 if (web_contents_->GetInterstitialPage()) 414 if (web_contents_->GetInterstitialPage())
415 web_contents_->GetInterstitialPage()->SetSize(size); 415 web_contents_->GetInterstitialPage()->SetSize(size);
416 } 416 }
417 417
418 } // namespace content 418 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_gtk.h ('k') | content/browser/web_contents/web_contents_view_guest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698