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

Side by Side Diff: webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc

Issue 8588068: GTK: Create the start of a compatibility header wrapping deprecated methods. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to ToT and remove views/ cleanups. Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/plugins/npapi/webplugin_delegate_impl.h" 5 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include <gtk/gtk.h> 10 #include <gtk/gtk.h>
11 #include <gdk/gdkx.h> 11 #include <gdk/gdkx.h>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/file_util.h" 14 #include "base/file_util.h"
15 #include "base/message_loop.h" 15 #include "base/message_loop.h"
16 #include "base/process_util.h" 16 #include "base/process_util.h"
17 #include "base/metrics/stats_counters.h" 17 #include "base/metrics/stats_counters.h"
18 #include "base/string_util.h" 18 #include "base/string_util.h"
19 #include "skia/ext/platform_canvas.h" 19 #include "skia/ext/platform_canvas.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
22 #include "ui/base/gtk/gtk_compat.h"
22 #include "ui/gfx/blit.h" 23 #include "ui/gfx/blit.h"
23 #include "webkit/plugins/npapi/gtk_plugin_container.h" 24 #include "webkit/plugins/npapi/gtk_plugin_container.h"
24 #include "webkit/plugins/npapi/plugin_constants_win.h" 25 #include "webkit/plugins/npapi/plugin_constants_win.h"
25 #include "webkit/plugins/npapi/plugin_instance.h" 26 #include "webkit/plugins/npapi/plugin_instance.h"
26 #include "webkit/plugins/npapi/plugin_lib.h" 27 #include "webkit/plugins/npapi/plugin_lib.h"
27 #include "webkit/plugins/npapi/plugin_list.h" 28 #include "webkit/plugins/npapi/plugin_list.h"
28 #include "webkit/plugins/npapi/plugin_stream_url.h" 29 #include "webkit/plugins/npapi/plugin_stream_url.h"
29 #include "webkit/plugins/npapi/webplugin.h" 30 #include "webkit/plugins/npapi/webplugin.h"
30 31
31 #include "third_party/npapi/bindings/npapi_x11.h" 32 #include "third_party/npapi/bindings/npapi_x11.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 return; 236 return;
236 237
237 clip_rect_ = clip_rect; 238 clip_rect_ = clip_rect;
238 window_rect_ = window_rect; 239 window_rect_ = window_rect;
239 WindowlessSetWindow(); 240 WindowlessSetWindow();
240 } 241 }
241 242
242 void WebPluginDelegateImpl::EnsurePixmapAtLeastSize(int width, int height) { 243 void WebPluginDelegateImpl::EnsurePixmapAtLeastSize(int width, int height) {
243 if (pixmap_) { 244 if (pixmap_) {
244 gint cur_width, cur_height; 245 gint cur_width, cur_height;
245 gdk_drawable_get_size(pixmap_, &cur_width, &cur_height); 246 gdk_pixmap_get_size(pixmap_, &cur_width, &cur_height);
246 if (cur_width >= width && cur_height >= height) 247 if (cur_width >= width && cur_height >= height)
247 return; // We are already the appropriate size. 248 return; // We are already the appropriate size.
248 249
249 // Otherwise, we need to recreate ourselves. 250 // Otherwise, we need to recreate ourselves.
250 g_object_unref(pixmap_); 251 g_object_unref(pixmap_);
251 pixmap_ = NULL; 252 pixmap_ = NULL;
252 } 253 }
253 254
254 // |sys_visual| is owned by gdk; we shouldn't free it. 255 // |sys_visual| is owned by gdk; we shouldn't free it.
255 GdkVisual* sys_visual = gdk_visual_get_system(); 256 GdkVisual* sys_visual = gdk_visual_get_system();
256 pixmap_ = gdk_pixmap_new(NULL, // use width/height/depth params 257 pixmap_ = gdk_pixmap_new(NULL, // use width/height/depth params
257 std::max(1, width), std::max(1, height), 258 std::max(1, width), std::max(1, height),
258 sys_visual->depth); 259 sys_visual->depth);
260 // TODO(erg): Replace this with GdkVisual when we move to GTK3.
259 GdkColormap* colormap = gdk_colormap_new(gdk_visual_get_system(), 261 GdkColormap* colormap = gdk_colormap_new(gdk_visual_get_system(),
260 FALSE); 262 FALSE);
261 gdk_drawable_set_colormap(GDK_DRAWABLE(pixmap_), colormap); 263 gdk_drawable_set_colormap(pixmap_, colormap);
262 // The GdkDrawable now owns the GdkColormap. 264 // The GdkDrawable now owns the GdkColormap.
263 g_object_unref(colormap); 265 g_object_unref(colormap);
264 } 266 }
265 267
266 #ifdef DEBUG_RECTANGLES 268 #ifdef DEBUG_RECTANGLES
267 namespace { 269 namespace {
268 270
269 // Draw a rectangle on a Cairo context. 271 // Draw a rectangle on a Cairo context.
270 // Useful for debugging various rectangles involved in drawing plugins. 272 // Useful for debugging various rectangles involved in drawing plugins.
271 void DrawDebugRectangle(cairo_t* cairo, 273 void DrawDebugRectangle(cairo_t* cairo,
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 // as someone might be setting the cursor in the main process as well. 758 // as someone might be setting the cursor in the main process as well.
757 *cursor = current_windowless_cursor_; 759 *cursor = current_windowless_cursor_;
758 } 760 }
759 #endif 761 #endif
760 762
761 return ret; 763 return ret;
762 } 764 }
763 765
764 } // namespace npapi 766 } // namespace npapi
765 } // namespace webkit 767 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/gtk_plugin_container_manager.cc ('k') | webkit/tools/test_shell/test_shell_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698