1 From 7cf44677ae5acc86899ae3bae1fef8621bc8063f Mon Sep 17 00:00:00 2001
2 From: Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com>
3 Date: Thu, 27 Jun 2013 18:36:26 +0300
4 Subject: [PATCH 03/33] Compiles without GTK.
6 We exclude all gtk symbols and replace them with the corresponding EFL ones
7 Make shell use gfx::NativeWindow
9 Now that gfx::NativeWindow is set to Evas_Object*, we should just use window_.
10 and remove Evas_Object* main_window_
12 build/build_config.h | 2 +-
13 build/common.gypi | 2 +-
14 content/browser/browser_main_loop.cc | 2 +-
15 content/browser/gpu/gpu_process_host_ui_shim.cc | 6 +-
16 content/browser/gpu/gpu_process_host_ui_shim.h | 2 +-
17 .../renderer_host/native_web_keyboard_event_efl.cc | 28 +++
18 .../renderer_host/render_process_host_impl.cc | 2 +-
19 .../renderer_host/render_widget_host_view_efl.cc | 135 +------------
20 .../renderer_host/render_widget_host_view_efl.h | 22 +--
21 content/browser/renderer_host/window_utils_efl.cc | 6 +-
22 .../browser/web_contents/web_contents_view_efl.cc | 73 +------
23 content/content_browser.gypi | 2 +
24 content/shell/shell.h | 4 -
25 content/shell/shell_efl.cc | 18 +-
26 content/shell/shell_web_contents_view_delegate.h | 2 +-
27 .../shell/shell_web_contents_view_delegate_efl.cc | 20 --
28 printing/printing.gyp | 5 +
29 printing/printing_context_efl.cc | 20 ++
30 ui/base/clipboard/clipboard.h | 1 +
31 ui/base/clipboard/clipboard_efl.cc | 219 +++++++++++++++++++++
32 ui/base/resource/resource_bundle_efl.cc | 64 ++++++
33 ui/gfx/native_widget_types.h | 13 ++
34 ui/native_theme/native_theme.gyp | 1 +
35 ui/native_theme/native_theme_efl.cc | 101 ++++++++++
36 ui/snapshot/snapshot.gyp | 1 +
37 ui/snapshot/snapshot_efl.cc | 27 +++
38 ui/surface/transport_dib.h | 8 +-
39 ui/surface/transport_dib_posix.cc | 2 +-
40 ui/surface/transport_dib_sysvipc.cc | 2 +-
42 webkit/glue/webcursor_efl.cc | 35 ++++
43 webkit/glue/webkit_glue.gypi | 2 +
44 .../plugins/npapi/webplugin_delegate_impl_efl.cc | 85 ++++++++
45 33 files changed, 656 insertions(+), 273 deletions(-)
46 create mode 100644 content/browser/renderer_host/native_web_keyboard_event_efl.cc
47 create mode 100644 printing/printing_context_efl.cc
48 create mode 100644 ui/base/clipboard/clipboard_efl.cc
49 create mode 100644 ui/base/resource/resource_bundle_efl.cc
50 create mode 100644 ui/native_theme/native_theme_efl.cc
51 create mode 100644 ui/snapshot/snapshot_efl.cc
52 create mode 100644 webkit/glue/webcursor_efl.cc
53 create mode 100644 webkit/plugins/npapi/webplugin_delegate_impl_efl.cc
55 diff --git a/build/build_config.h b/build/build_config.h
56 index dd7443e..040ec88 100644
57 --- a/build/build_config.h
58 +++ b/build/build_config.h
61 // Use TOOLKIT_GTK on linux if TOOLKIT_VIEWS isn't defined.
62 #if !defined(TOOLKIT_VIEWS) && defined(USE_X11)
64 +// #define TOOLKIT_GTK // Mikhail FIXME : find a proper way here!
68 diff --git a/build/common.gypi b/build/common.gypi
69 index 9753413..a769a1f 100644
70 --- a/build/common.gypi
71 +++ b/build/common.gypi
73 # Set toolkit_uses_gtk for the Chromium browser on Linux.
74 ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_aura==0 and use_ozone==0', {
75 'toolkit_uses_efl%': 1,
76 - 'toolkit_uses_gtk%': 1,
77 + 'toolkit_uses_gtk%': 0,
79 'toolkit_uses_efl%': 0,
80 'toolkit_uses_gtk%': 0,
81 diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
82 index 37cdf9c..7f88b44 100644
83 --- a/content/browser/browser_main_loop.cc
84 +++ b/content/browser/browser_main_loop.cc
85 @@ -835,7 +835,7 @@ void BrowserMainLoop::InitializeToolkit() {
89 -#if !defined(USE_AURA)
90 +#if !defined(USE_AURA) && !defined(TOOLKIT_EFL)
91 gfx::GtkInitFromCommandLine(parsed_command_line_);
94 diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc
95 index a243115..0bf8df0 100644
96 --- a/content/browser/gpu/gpu_process_host_ui_shim.cc
97 +++ b/content/browser/gpu/gpu_process_host_ui_shim.cc
98 @@ -211,7 +211,7 @@ bool GpuProcessHostUIShim::OnControlMessageReceived(
99 OnUpdateVSyncParameters)
100 IPC_MESSAGE_HANDLER(GpuHostMsg_FrameDrawn, OnFrameDrawn)
102 -#if defined(TOOLKIT_GTK) || defined(OS_WIN)
103 +#if defined(TOOLKIT_GTK) || defined(TOOLKIT_EFL) || defined(OS_WIN)
104 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView)
107 @@ -256,7 +256,7 @@ void GpuProcessHostUIShim::OnGraphicsInfoCollected(const GPUInfo& gpu_info) {
108 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info);
111 -#if defined(TOOLKIT_GTK) || defined(OS_WIN)
112 +#if defined(TOOLKIT_GTK) || defined(TOOLKIT_EFL) || defined(OS_WIN)
114 void GpuProcessHostUIShim::OnResizeView(int32 surface_id,
116 @@ -286,6 +286,8 @@ void GpuProcessHostUIShim::OnResizeView(int32 surface_id,
117 gdk_window_resize(window, size.width(), size.height());
118 XSync(display, False);
120 +#elif defined(TOOLKIT_EFL)
121 + (void)surface; // FIXME : Resize the window?
122 #elif defined(OS_WIN)
123 // Ensure window does not have zero area because D3D cannot create a zero
125 diff --git a/content/browser/gpu/gpu_process_host_ui_shim.h b/content/browser/gpu/gpu_process_host_ui_shim.h
126 index 243cfd17..79468cf 100644
127 --- a/content/browser/gpu/gpu_process_host_ui_shim.h
128 +++ b/content/browser/gpu/gpu_process_host_ui_shim.h
129 @@ -87,7 +87,7 @@ class GpuProcessHostUIShim : public IPC::Listener,
131 void OnLogMessage(int level, const std::string& header,
132 const std::string& message);
133 -#if defined(TOOLKIT_GTK) || defined(OS_WIN)
134 +#if defined(TOOLKIT_GTK) || defined(TOOLKIT_EFL) || defined(OS_WIN)
135 void OnResizeView(int32 surface_id,
138 diff --git a/content/browser/renderer_host/native_web_keyboard_event_efl.cc b/content/browser/renderer_host/native_web_keyboard_event_efl.cc
140 index 0000000..78b258a
142 +++ b/content/browser/renderer_host/native_web_keyboard_event_efl.cc
144 +// Copyright (c) 2013 Intel Corporation. All rights reserved.
145 +// Use of this source code is governed by a BSD-style license that can be
146 +// found in the LICENSE file.
148 +#include "content/public/browser/native_web_keyboard_event.h"
150 +#include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.h"
154 +NativeWebKeyboardEvent::NativeWebKeyboardEvent() {
157 +NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event) {
160 +NativeWebKeyboardEvent::NativeWebKeyboardEvent(const NativeWebKeyboardEvent&) {
163 +NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=(
164 + const NativeWebKeyboardEvent& other) {
168 +NativeWebKeyboardEvent::~NativeWebKeyboardEvent() {
171 +} // namespace content
172 diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
173 index a3b6db6..6db7eaf 100644
174 --- a/content/browser/renderer_host/render_process_host_impl.cc
175 +++ b/content/browser/renderer_host/render_process_host_impl.cc
176 @@ -1032,7 +1032,7 @@ TransportDIB* RenderProcessHostImpl::MapTransportDIB(
177 STANDARD_RIGHTS_REQUIRED | FILE_MAP_READ | FILE_MAP_WRITE,
179 return TransportDIB::Map(section);
180 -#elif defined(TOOLKIT_GTK) || (defined(OS_LINUX) && defined(USE_AURA))
181 +#elif defined(TOOLKIT_GTK) || defined(TOOLKIT_EFL) || (defined(OS_LINUX) && defined(USE_AURA))
182 return TransportDIB::Map(dib_id.shmkey);
183 #elif defined(OS_ANDROID)
184 return TransportDIB::Map(dib_id);
185 diff --git a/content/browser/renderer_host/render_widget_host_view_efl.cc b/content/browser/renderer_host/render_widget_host_view_efl.cc
186 index 86fe664..9118002 100644
187 --- a/content/browser/renderer_host/render_widget_host_view_efl.cc
188 +++ b/content/browser/renderer_host/render_widget_host_view_efl.cc
190 #include "base/strings/utf_offset_string_conversions.h"
191 #include "base/time.h"
192 #include "base/utf_string_conversions.h"
193 -#include "content/browser/accessibility/browser_accessibility_gtk.h"
194 -#include "content/browser/accessibility/browser_accessibility_manager_gtk.h"
195 -#include "content/browser/renderer_host/backing_store_gtk.h"
196 #include "content/browser/renderer_host/render_view_host_delegate.h"
197 #include "content/browser/renderer_host/render_view_host_impl.h"
198 #include "content/browser/renderer_host/window_utils_efl.h"
200 #include "skia/ext/platform_canvas.h"
201 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
202 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
203 -#include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.h"
204 #include "third_party/WebKit/Source/WebKit/chromium/public/x11/WebScreenInfoFactory.h"
205 #include "ui/base/clipboard/scoped_clipboard_writer.h"
206 -#include "ui/base/gtk/gtk_compat.h"
207 #include "ui/base/text/text_elider.h"
208 #include "ui/base/x/active_window_watcher_x.h"
209 #include "ui/base/x/x11_util.h"
210 #include "ui/gfx/preserve_window_efl.h"
211 -#include "webkit/glue/webcursor_gtk_data.h"
212 #include "webkit/plugins/npapi/webplugin.h"
214 -using WebKit::WebInputEventFactory;
215 using WebKit::WebMouseWheelEvent;
216 using WebKit::WebScreenInfo;
222 // Paint rects on Linux are bounded by the maximum size of a shared memory
223 // region. By default that's 32MB, but many distros increase it significantly
225 @@ -75,31 +68,6 @@ const int kMaxWindowHeight = 10000;
226 // scroll size for linux.
227 const float kDefaultScrollPixelsPerTick = 160.0f / 3.0f;
229 -const GdkColor kBGColor =
231 - { 0, 0xff * 257, 0xff * 257, 0xff * 257 };
233 - { 0, 0x00 * 257, 0xff * 257, 0x00 * 257 };
236 -// Returns the spinning cursor used for loading state.
237 -GdkCursor* GetMozSpinningCursor() {
238 - static GdkCursor* moz_spinning_cursor = NULL;
239 - if (!moz_spinning_cursor) {
240 - const GdkColor fg = { 0, 0, 0, 0 };
241 - const GdkColor bg = { 65535, 65535, 65535, 65535 };
242 - GdkPixmap* source = gdk_bitmap_create_from_data(
243 - NULL, reinterpret_cast<const gchar*>(moz_spinning_bits), 32, 32);
244 - GdkPixmap* mask = gdk_bitmap_create_from_data(
245 - NULL, reinterpret_cast<const gchar*>(moz_spinning_mask_bits), 32, 32);
246 - moz_spinning_cursor =
247 - gdk_cursor_new_from_pixmap(source, mask, &fg, &bg, 2, 2);
248 - g_object_unref(source);
249 - g_object_unref(mask);
251 - return moz_spinning_cursor;
254 bool MovedToPoint(const WebKit::WebMouseEvent& mouse_event,
255 const gfx::Point& center) {
256 return mouse_event.globalX == center.x() &&
257 @@ -295,9 +263,6 @@ bool RenderWidgetHostViewEfl::HasFocus() const {
261 -void RenderWidgetHostViewEfl::ActiveWindowChanged(GdkWindow* window) {
264 bool RenderWidgetHostViewEfl::Send(IPC::Message* message) {
265 return host_->Send(message);
267 @@ -321,23 +286,12 @@ gfx::Rect RenderWidgetHostViewEfl::GetViewBounds() const {
270 void RenderWidgetHostViewEfl::UpdateCursor(const WebCursor& cursor) {
271 - // Optimize the common case, where the cursor hasn't changed.
272 - // However, we can switch between different pixmaps, so only on the
273 - // non-pixmap branch.
274 - if (current_cursor_.GetCursorType() != GDK_CURSOR_IS_PIXMAP &&
275 - current_cursor_.GetCursorType() == cursor.GetCursorType()) {
279 current_cursor_ = cursor;
283 void RenderWidgetHostViewEfl::SetIsLoading(bool is_loading) {
284 - is_loading_ = is_loading;
285 - // Only call ShowCurrentCursor() when it will actually change the cursor.
286 - if (current_cursor_.GetCursorType() == GDK_LAST_CURSOR)
287 - ShowCurrentCursor();
291 void RenderWidgetHostViewEfl::TextInputStateChanged(
292 @@ -389,20 +343,7 @@ void RenderWidgetHostViewEfl::RenderViewGone(base::TerminationStatus status,
295 void RenderWidgetHostViewEfl::Destroy() {
296 - if (compositing_surface_ != gfx::kNullPluginWindow) {
299 - // Undo the X grab.
302 - if (preserve_window_->SmartObject()) {
303 - // If this is a popup or fullscreen widget, then we need to destroy the
304 - // window that we created to hold it.
305 - if (IsPopup() || is_fullscreen_) {
306 - ui::ActiveWindowWatcherX::RemoveObserver(this);
308 - // See http://crbug.com/11847 for details.
310 + // FIXME: Check what should be deleted.
311 // The RenderWidgetHost's destruction led here, so don't call it.
314 @@ -410,7 +351,6 @@ void RenderWidgetHostViewEfl::Destroy() {
317 void RenderWidgetHostViewEfl::SetTooltipText(const string16& tooltip_text) {
318 - // I filed https://bugzilla.gnome.org/show_bug.cgi?id=604641 upstream.
321 void RenderWidgetHostViewEfl::SelectionChanged(const string16& text,
322 @@ -445,10 +385,6 @@ void RenderWidgetHostViewEfl::SelectionBoundsChanged(
323 void RenderWidgetHostViewEfl::ScrollOffsetChanged() {
326 -GdkEventButton* RenderWidgetHostViewEfl::GetLastMouseDown() {
330 gfx::NativeView RenderWidgetHostViewEfl::BuildInputMethodsGtkMenu() {
333 @@ -464,10 +400,6 @@ bool RenderWidgetHostViewEfl::IsPopup() const {
334 void RenderWidgetHostViewEfl::DoSharedInit(Evas_Object* parent) {
337 -void RenderWidgetHostViewEfl::DoPopupOrFullscreenInit(GtkWindow* window,
338 - const gfx::Rect& bounds) {
341 BackingStore* RenderWidgetHostViewEfl::AllocBackingStore(
342 const gfx::Size& /*size*/) {
343 return 0; // We're using accelerated path.
344 @@ -531,59 +463,6 @@ void RenderWidgetHostViewEfl::SetBackground(const SkBitmap& background) {
345 Send(new ViewMsg_SetBackground(host_->GetRoutingID(), background));
348 -void RenderWidgetHostViewEfl::ModifyEventForEdgeDragging(
349 - GtkWidget* widget, GdkEventMotion* event) {
350 - // If the widget is aligned with an edge of the monitor its on and the user
351 - // attempts to drag past that edge we track the number of times it has
352 - // occurred, so that we can force the widget to scroll when it otherwise
353 - // would be unable to, by modifying the (x,y) position in the drag
354 - // event that we forward on to webkit. If we get a move that's no longer a
355 - // drag or a drag indicating the user is no longer at that edge we stop
356 - // altering the drag events.
357 - int new_dragged_at_horizontal_edge = 0;
358 - int new_dragged_at_vertical_edge = 0;
359 - // Used for checking the edges of the monitor. We cache the values to save
360 - // roundtrips to the X server.
361 - CR_DEFINE_STATIC_LOCAL(gfx::Size, drag_monitor_size, ());
362 - if (event->state & GDK_BUTTON1_MASK) {
363 - if (drag_monitor_size.IsEmpty()) {
364 - // We can safely cache the monitor size for the duration of a drag.
365 - GdkScreen* screen = gtk_widget_get_screen(widget);
367 - gdk_screen_get_monitor_at_point(screen, event->x_root, event->y_root);
368 - GdkRectangle geometry;
369 - gdk_screen_get_monitor_geometry(screen, monitor, &geometry);
370 - drag_monitor_size.SetSize(geometry.width, geometry.height);
372 - GtkAllocation allocation;
373 - gtk_widget_get_allocation(widget, &allocation);
374 - // Check X and Y independently, as the user could be dragging into a corner.
375 - if (event->x == 0 && event->x_root == 0) {
376 - new_dragged_at_horizontal_edge = dragged_at_horizontal_edge_ - 1;
377 - } else if (allocation.width - 1 == static_cast<gint>(event->x) &&
378 - drag_monitor_size.width() - 1 == static_cast<gint>(event->x_root)) {
379 - new_dragged_at_horizontal_edge = dragged_at_horizontal_edge_ + 1;
382 - if (event->y == 0 && event->y_root == 0) {
383 - new_dragged_at_vertical_edge = dragged_at_vertical_edge_ - 1;
384 - } else if (allocation.height - 1 == static_cast<gint>(event->y) &&
385 - drag_monitor_size.height() - 1 == static_cast<gint>(event->y_root)) {
386 - new_dragged_at_vertical_edge = dragged_at_vertical_edge_ + 1;
389 - event->x_root += new_dragged_at_horizontal_edge;
390 - event->x += new_dragged_at_horizontal_edge;
391 - event->y_root += new_dragged_at_vertical_edge;
392 - event->y += new_dragged_at_vertical_edge;
394 - // Clear whenever we get a non-drag mouse move.
395 - drag_monitor_size.SetSize(0, 0);
397 - dragged_at_horizontal_edge_ = new_dragged_at_horizontal_edge;
398 - dragged_at_vertical_edge_ = new_dragged_at_vertical_edge;
401 void RenderWidgetHostViewEfl::Paint(const gfx::Rect& /*damage_rect*/) {
402 // If the GPU process is rendering directly into the View,
403 // call the compositor directly.
404 @@ -609,7 +488,7 @@ void RenderWidgetHostViewEfl::GetScreenInfo(WebScreenInfo* results) {
407 gfx::Rect RenderWidgetHostViewEfl::GetBoundsInRootWindow() {
408 - return GetViewBounds();
409 + return GetViewBounds();
412 gfx::GLSurfaceHandle RenderWidgetHostViewEfl::GetCompositingSurface() {
413 @@ -759,11 +638,7 @@ void RenderWidgetHostViewEfl::FatalAccessibilityTreeError() {
416 void RenderWidgetHostViewEfl::OnAccessibilityNotifications(
417 - const std::vector<AccessibilityHostMsg_NotificationParams>& params) {
420 -AtkObject* RenderWidgetHostViewEfl::GetAccessible() {
422 + const std::vector<AccessibilityHostMsg_NotificationParams>& /*params*/) {
425 void RenderWidgetHostViewEfl::OnCreatePluginContainer(
426 diff --git a/content/browser/renderer_host/render_widget_host_view_efl.h b/content/browser/renderer_host/render_widget_host_view_efl.h
427 index 2aba48f..617bce9 100644
428 --- a/content/browser/renderer_host/render_widget_host_view_efl.h
429 +++ b/content/browser/renderer_host/render_widget_host_view_efl.h
431 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_EFL_H_
434 -#include <gdk/gdk.h>
439 #include "ipc/ipc_sender.h"
440 #include "ui/base/animation/animation_delegate.h"
441 #include "ui/base/animation/slide_animation.h"
442 -#include "ui/base/x/active_window_watcher_x_observer.h"
443 +//#include "ui/base/x/active_window_watcher_x_observer.h"
444 #include "ui/gfx/native_widget_types.h"
445 #include "ui/gfx/point.h"
446 #include "ui/gfx/preserve_window_delegate_efl.h"
447 #include "ui/gfx/rect.h"
448 #include "webkit/glue/webcursor.h"
449 -#include "webkit/plugins/npapi/gtk_plugin_container_manager.h"
451 -typedef struct _GtkClipboard GtkClipboard;
452 -typedef struct _GtkSelectionData GtkSelectionData;
453 +//#include "webkit/plugins/npapi/gtk_plugin_container_manager.h"
456 class PreserveWindow;
457 @@ -46,7 +42,6 @@ class CONTENT_EXPORT RenderWidgetHostViewEfl
458 : public gfx::PreserveWindowDelegate,
459 public RenderWidgetHostViewBase,
460 public BrowserAccessibilityDelegate,
461 - public ui::ActiveWindowWatcherXObserver,
464 virtual ~RenderWidgetHostViewEfl();
465 @@ -82,7 +77,6 @@ class CONTENT_EXPORT RenderWidgetHostViewEfl
466 virtual void Hide() OVERRIDE;
467 virtual bool IsShowing() OVERRIDE;
468 virtual gfx::Rect GetViewBounds() const OVERRIDE;
469 - virtual GdkEventButton* GetLastMouseDown() OVERRIDE;
470 virtual gfx::NativeView BuildInputMethodsGtkMenu() OVERRIDE;
471 virtual void SetBackground(const SkBitmap& background) OVERRIDE;
473 @@ -154,14 +148,9 @@ class CONTENT_EXPORT RenderWidgetHostViewEfl
474 const std::vector<AccessibilityHostMsg_NotificationParams>& params)
477 - // ActiveWindowWatcherXObserver implementation.
478 - virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE;
480 // IPC::Sender implementation:
481 virtual bool Send(IPC::Message* message) OVERRIDE;
483 - void ModifyEventForEdgeDragging(GtkWidget* widget, GdkEventMotion* event);
485 void ModifyEventMovementAndCoords(WebKit::WebMouseEvent* event);
487 void Paint(const gfx::Rect&);
488 @@ -182,9 +171,6 @@ class CONTENT_EXPORT RenderWidgetHostViewEfl
489 virtual gfx::Point GetLastTouchEventLocation() const OVERRIDE;
490 virtual void FatalAccessibilityTreeError() OVERRIDE;
492 - // Get the root of the AtkObject* tree for accessibility.
493 - AtkObject* GetAccessible();
496 friend class RenderWidgetHostView;
498 @@ -203,10 +189,6 @@ class CONTENT_EXPORT RenderWidgetHostViewEfl
499 // Do initialization needed by all InitAs*() methods.
500 void DoSharedInit(Evas_Object* parent);
502 - // Do initialization needed just by InitAsPopup() and InitAsFullscreen().
503 - // We move and resize |window| to |bounds| and show it and its contents.
504 - void DoPopupOrFullscreenInit(GtkWindow* window, const gfx::Rect& bounds);
506 // Update the display cursor for the render view.
507 void ShowCurrentCursor();
509 diff --git a/content/browser/renderer_host/window_utils_efl.cc b/content/browser/renderer_host/window_utils_efl.cc
510 index 1c6c511..2834d59 100644
511 --- a/content/browser/renderer_host/window_utils_efl.cc
512 +++ b/content/browser/renderer_host/window_utils_efl.cc
513 @@ -16,8 +16,7 @@ namespace {
514 // Length of an inch in CSS's 1px unit.
515 const int kPixelsPerInch = 96;
517 -int depthPerComponent(int depth)
519 +int depthPerComponent(int depth) {
523 @@ -32,8 +31,7 @@ int depthPerComponent(int depth)
527 -void GetScreenInfoEfl(WebKit::WebScreenInfo* results)
529 +void GetScreenInfoEfl(WebKit::WebScreenInfo* results) {
530 Ecore_X_Display* display = ecore_x_display_get();
531 Ecore_X_Screen* screen = ecore_x_default_screen_get();
533 diff --git a/content/browser/web_contents/web_contents_view_efl.cc b/content/browser/web_contents/web_contents_view_efl.cc
534 index 1e2edb8..ccdfbf3 100644
535 --- a/content/browser/web_contents/web_contents_view_efl.cc
536 +++ b/content/browser/web_contents/web_contents_view_efl.cc
539 #include "content/browser/web_contents/web_contents_view_efl.h"
541 -#include <gdk/gdk.h>
542 -#include <gdk/gdkkeysyms.h>
543 -#include <gtk/gtk.h>
547 #include "base/string_util.h"
549 #include "build/build_config.h"
550 #include "content/browser/renderer_host/render_view_host_factory.h"
551 #include "content/browser/renderer_host/render_view_host_impl.h"
552 -#include "content/browser/renderer_host/render_widget_host_view_gtk.h"
553 +#include "content/browser/renderer_host/render_widget_host_view_efl.h"
554 #include "content/browser/web_contents/interstitial_page_impl.h"
555 #include "content/browser/web_contents/web_contents_impl.h"
556 -#include "content/browser/web_contents/web_drag_dest_gtk.h"
557 -#include "content/browser/web_contents/web_drag_source_gtk.h"
558 #include "content/public/browser/web_contents_delegate.h"
559 #include "content/public/browser/web_contents_view_delegate.h"
560 -#include "ui/base/gtk/gtk_expanded_container.h"
561 #include "ui/gfx/image/image_skia.h"
562 #include "ui/gfx/point.h"
563 #include "ui/gfx/rect.h"
564 @@ -33,48 +26,6 @@ using WebKit::WebDragOperation;
565 using WebKit::WebDragOperationsMask;
570 -// Called when the mouse leaves the widget. We notify our delegate.
571 -gboolean OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event,
572 - WebContentsImpl* web_contents) {
573 - if (web_contents->GetDelegate())
574 - web_contents->GetDelegate()->ContentsMouseEvent(
575 - web_contents, gfx::Point(event->x_root, event->y_root), false);
579 -// Called when the mouse moves within the widget. We notify our delegate.
580 -gboolean OnMouseMove(GtkWidget* widget, GdkEventMotion* event,
581 - WebContentsImpl* web_contents) {
582 - if (web_contents->GetDelegate())
583 - web_contents->GetDelegate()->ContentsMouseEvent(
584 - web_contents, gfx::Point(event->x_root, event->y_root), true);
588 -// See tab_contents_view_views.cc for discussion of mouse scroll zooming.
589 -gboolean OnMouseScroll(GtkWidget* widget, GdkEventScroll* event,
590 - WebContentsImpl* web_contents) {
591 - if ((event->state & gtk_accelerator_get_default_mod_mask()) !=
592 - GDK_CONTROL_MASK) {
596 - WebContentsDelegate* delegate = web_contents->GetDelegate();
600 - if (!(event->direction == GDK_SCROLL_DOWN ||
601 - event->direction == GDK_SCROLL_UP)) {
605 - delegate->ContentsZoomChange(event->direction == GDK_SCROLL_UP);
611 WebContentsViewPort* CreateWebContentsView(
612 WebContentsImpl* web_contents,
613 @@ -119,11 +70,7 @@ void WebContentsViewEfl::OnTabCrashed(base::TerminationStatus status,
616 void WebContentsViewEfl::Focus() {
617 - if (web_contents_->ShowingInterstitialPage()) {
618 - web_contents_->GetInterstitialPage()->Focus();
619 - } else if (delegate_) {
620 - delegate_->Focus();
625 void WebContentsViewEfl::SetInitialFocus() {
626 @@ -146,14 +93,6 @@ WebDropData* WebContentsViewEfl::GetDropData() const {
628 gfx::Rect WebContentsViewEfl::GetViewBounds() const {
630 - GdkWindow* window = gtk_widget_get_window(GetNativeView());
632 - rect.SetRect(0, 0, requested_size_.width(), requested_size_.height());
635 - int x = 0, y = 0, w, h;
636 - gdk_window_get_geometry(window, &x, &y, &w, &h, NULL);
637 - rect.SetRect(x, y, w, h);
641 @@ -219,13 +158,7 @@ void WebContentsViewEfl::GotFocus() {
642 // This is called when the renderer asks us to take focus back (i.e., it has
643 // iterated past the last focusable element on the page).
644 void WebContentsViewEfl::TakeFocus(bool reverse) {
645 - if (!web_contents_->GetDelegate())
647 - if (!web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse) &&
648 - GetTopLevelNativeWindow()) {
649 - gtk_widget_child_focus(GTK_WIDGET(GetTopLevelNativeWindow()),
650 - reverse ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD);
652 + /* TODO: Assign Focus to EFL evas_object */
655 void WebContentsViewEfl::UpdateDragDest(RenderViewHost* host) {
656 diff --git a/content/content_browser.gypi b/content/content_browser.gypi
657 index 3d881a2..1484aaa 100644
658 --- a/content/content_browser.gypi
659 +++ b/content/content_browser.gypi
661 'browser/renderer_host/native_web_keyboard_event_android.cc',
662 'browser/renderer_host/native_web_keyboard_event_aura.cc',
663 'browser/renderer_host/native_web_keyboard_event.cc',
664 + 'browser/renderer_host/native_web_keyboard_event_efl.cc',
665 'browser/renderer_host/native_web_keyboard_event_gtk.cc',
666 'browser/renderer_host/native_web_keyboard_event_mac.mm',
667 'browser/renderer_host/native_web_keyboard_event_win.cc',
668 @@ -1172,6 +1173,7 @@
669 ['toolkit_uses_efl == 1', {
671 '../build/linux/system.gyp:efl',
672 + '../dbus/dbus.gyp:dbus',
675 ['exclude', 'browser/web_contents/web_contents_view_gtk.cc'],
676 diff --git a/content/shell/shell.h b/content/shell/shell.h
677 index 0d772eb..e58bb42 100644
678 --- a/content/shell/shell.h
679 +++ b/content/shell/shell.h
680 @@ -233,10 +233,6 @@ class Shell : public WebContentsDelegate,
681 WNDPROC default_edit_wnd_proc_;
682 static HINSTANCE instance_handle_;
683 #elif defined(TOOLKIT_EFL)
684 - // TODO(rakuco): Once gfx::NativeWindow is set to Evas_Object*, we
685 - // can just use window_.
686 - Evas_Object* main_window_;
690 #elif defined(TOOLKIT_GTK)
691 diff --git a/content/shell/shell_efl.cc b/content/shell/shell_efl.cc
692 index 3078d63..557424e 100644
693 --- a/content/shell/shell_efl.cc
694 +++ b/content/shell/shell_efl.cc
695 @@ -52,22 +52,22 @@ void Shell::PlatformCreateWindow(int width, int height) {
699 - main_window_ = elm_win_util_standard_add("Content Shell", "Content Shell");
700 - elm_win_autodel_set(main_window_, true);
701 - evas_object_resize(main_window_, width, height);
702 - evas_object_event_callback_add(main_window_, EVAS_CALLBACK_DEL,
703 + window_ = elm_win_util_standard_add("Content Shell", "Content Shell");
704 + elm_win_autodel_set(window_, true);
705 + evas_object_resize(window_, width, height);
706 + evas_object_event_callback_add(window_, EVAS_CALLBACK_DEL,
707 OnMainWindowDel, this);
708 - evas_object_show(main_window_);
709 + evas_object_show(window_);
712 void Shell::PlatformSetContents() {
716 - Evas_Object* view_box = elm_box_add(main_window_);
717 + Evas_Object* view_box = elm_box_add(window_);
718 evas_object_size_hint_weight_set(view_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
720 - elm_win_resize_object_add(main_window_, view_box);
721 + elm_win_resize_object_add(window_, view_box);
723 WebContentsView* content_view = web_contents_->GetView();
724 static_cast<WebContentsViewEfl*>(content_view)->SetViewContainerBox(view_box);
725 @@ -76,6 +76,8 @@ void Shell::PlatformSetContents() {
726 void Shell::SizeTo(int width, int height) {
727 content_width_ = width;
728 content_height_ = height;
729 + if (web_contents_) {
733 void Shell::PlatformResizeSubViews() {
734 @@ -94,7 +96,7 @@ void Shell::PlatformSetTitle(const string16& title) {
737 std::string title_utf8 = UTF16ToUTF8(title);
738 - elm_win_title_set(main_window_, title_utf8.c_str());
739 + elm_win_title_set(window_, title_utf8.c_str());
742 void Shell::OnMainWindowDel(void* data, Evas* evas, Evas_Object* object,
743 diff --git a/content/shell/shell_web_contents_view_delegate.h b/content/shell/shell_web_contents_view_delegate.h
744 index db6a785..283f37f 100644
745 --- a/content/shell/shell_web_contents_view_delegate.h
746 +++ b/content/shell/shell_web_contents_view_delegate.h
747 @@ -53,7 +53,7 @@ class ShellWebContentsViewDelegate : public WebContentsViewDelegate {
748 WebContents* web_contents_;
749 ContextMenuParams params_;
751 -#if defined(TOOLKIT_GTK) && !defined(TOOLKIT_EFL)
752 +#if defined(TOOLKIT_GTK)
753 ui::OwnedWidgetGtk floating_;
754 GtkWidget* expanded_container_;
756 diff --git a/content/shell/shell_web_contents_view_delegate_efl.cc b/content/shell/shell_web_contents_view_delegate_efl.cc
757 index 9e10940..18498f3 100644
758 --- a/content/shell/shell_web_contents_view_delegate_efl.cc
759 +++ b/content/shell/shell_web_contents_view_delegate_efl.cc
761 #include "content/shell/shell_switches.h"
762 #include "content/shell/shell_web_contents_view_delegate_creator.h"
763 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
764 -#include "ui/base/gtk/focus_store_gtk.h"
765 -#include "ui/base/gtk/gtk_floating_container.h"
767 using WebKit::WebContextMenuData;
769 @@ -50,22 +48,4 @@ WebDragDestDelegate* ShellWebContentsViewDelegate::GetDragDestDelegate() {
773 -void ShellWebContentsViewDelegate::Initialize(GtkWidget* expanded_container,
774 - ui::FocusStoreGtk* focus_store) {
777 -gfx::NativeView ShellWebContentsViewDelegate::GetNativeView() const {
781 -void ShellWebContentsViewDelegate::Focus() {
784 -gboolean ShellWebContentsViewDelegate::OnNativeViewFocusEvent(
786 - GtkDirectionType type,
787 - gboolean* return_value) {
791 } // namespace content
792 diff --git a/printing/printing.gyp b/printing/printing.gyp
793 index be4d883..4dccbd2 100644
794 --- a/printing/printing.gyp
795 +++ b/printing/printing.gyp
797 'printing_context_gtk.h',
800 + ['toolkit_uses_efl==1 and chromeos==0', {
802 + 'printing_context_efl.cc',
808 diff --git a/printing/printing_context_efl.cc b/printing/printing_context_efl.cc
810 index 0000000..ec2b364
812 +++ b/printing/printing_context_efl.cc
814 +// Copyright (c) 2013 Intel Corporation. All rights reserved.
815 +// Use of this source code is governed by a BSD-style license that can be
816 +// found in the LICENSE file.
818 +#include "base/logging.h"
819 +#include "base/values.h"
820 +#include "printing/metafile.h"
821 +#include "printing/print_dialog_gtk_interface.h"
822 +#include "printing/print_job_constants.h"
823 +#include "printing/units.h"
825 +namespace printing {
828 +PrintingContext* PrintingContext::Create(const std::string& app_locale) {
832 +} // namespace printing
834 diff --git a/ui/base/clipboard/clipboard.h b/ui/base/clipboard/clipboard.h
835 index ae6d708..29dd5b8 100644
836 --- a/ui/base/clipboard/clipboard.h
837 +++ b/ui/base/clipboard/clipboard.h
838 @@ -113,6 +113,7 @@ class UI_EXPORT Clipboard : NON_EXPORTED_BASE(public base::ThreadChecker) {
839 explicit FormatType(const GdkAtom& native_format);
840 const GdkAtom& ToGdkAtom() const { return data_; }
842 +#elif defined(TOOLKIT_EFL) // Mikhail FIXME: Implementation is required.
843 #elif defined(OS_ANDROID)
844 explicit FormatType(const std::string& native_format);
845 const std::string& data() const { return data_; }
846 diff --git a/ui/base/clipboard/clipboard_efl.cc b/ui/base/clipboard/clipboard_efl.cc
848 index 0000000..25a2e7c
850 +++ b/ui/base/clipboard/clipboard_efl.cc
852 +// Copyright (c) 2013 Intel Corporation. All rights reserved.
853 +// Use of this source code is governed by a BSD-style license that can be
854 +// found in the LICENSE file.
856 +#include "ui/base/clipboard/clipboard.h"
858 +#include <X11/extensions/Xfixes.h>
859 +#include <X11/Xatom.h>
865 +#include "base/basictypes.h"
866 +#include "base/files/file_path.h"
867 +#include "base/logging.h"
868 +#include "base/memory/singleton.h"
869 +#include "base/utf_string_conversions.h"
870 +#include "third_party/skia/include/core/SkBitmap.h"
871 +#include "ui/base/clipboard/custom_data_helper.h"
872 +#include "ui/base/x/x11_util.h"
873 +#include "ui/gfx/canvas.h"
874 +#include "ui/gfx/size.h"
880 +const char kSourceTagType[] = "org.chromium.source-tag";
881 +const char kMimeTypeBitmap[] = "image/bmp";
882 +const char kMimeTypeMozillaURL[] = "text/x-moz-url";
883 +const char kMimeTypePepperCustomData[] = "chromium/x-pepper-custom-data";
884 +const char kMimeTypeWebkitSmartPaste[] = "chromium/x-webkit-paste";
887 +Clipboard::FormatType::FormatType() {
890 +Clipboard::FormatType::~FormatType() {
893 +std::string Clipboard::FormatType::Serialize() const {
897 +Clipboard::FormatType Clipboard::FormatType::Deserialize(
898 + const std::string&) {
899 + static FormatType type;
903 +Clipboard::Clipboard() {
906 +Clipboard::~Clipboard() {
910 +void Clipboard::WriteObjectsImpl(Buffer buffer,
911 + const ObjectMap& objects,
915 +void Clipboard::WriteText(const char* text_data, size_t text_len) {
918 +void Clipboard::WriteHTML(const char* markup_data,
920 + const char* url_data,
924 +void Clipboard::WriteRTF(const char* rtf_data, size_t data_len) {
927 +// Write an extra flavor that signifies WebKit was the last to modify the
928 +// pasteboard. This flavor has no data.
929 +void Clipboard::WriteWebSmartPaste() {
932 +void Clipboard::WriteBitmap(const char* pixel_data, const char* size_data) {
935 +void Clipboard::WriteBookmark(const char* title_data, size_t title_len,
936 + const char* url_data, size_t url_len) {
939 +void Clipboard::WriteData(const FormatType& format,
940 + const char* data_data,
944 +void Clipboard::WriteSourceTag(SourceTag tag) {
947 +// We do not use gtk_clipboard_wait_is_target_available because of
948 +// a bug with the gtk clipboard. It caches the available targets
949 +// and does not always refresh the cache when it is appropriate.
950 +bool Clipboard::IsFormatAvailable(const Clipboard::FormatType& format,
951 + Clipboard::Buffer buffer) const {
955 +void Clipboard::Clear(Clipboard::Buffer buffer) {
958 +void Clipboard::ReadAvailableTypes(Clipboard::Buffer buffer,
959 + std::vector<string16>* types,
960 + bool* contains_filenames) const {
964 +void Clipboard::ReadText(Clipboard::Buffer buffer, string16* result) const {
967 +void Clipboard::ReadAsciiText(Clipboard::Buffer buffer,
968 + std::string* result) const {
971 +// TODO(estade): handle different charsets.
972 +// TODO(port): set *src_url.
973 +void Clipboard::ReadHTML(Clipboard::Buffer buffer, string16* markup,
974 + std::string* src_url, uint32* fragment_start,
975 + uint32* fragment_end) const {
978 +void Clipboard::ReadRTF(Buffer buffer, std::string* result) const {
981 +SkBitmap Clipboard::ReadImage(Buffer buffer) const {
985 +void Clipboard::ReadCustomData(Buffer buffer,
986 + const string16& type,
987 + string16* result) const {
990 +void Clipboard::ReadBookmark(string16* title, std::string* url) const {
991 + // TODO(estade): implement this.
995 +void Clipboard::ReadData(const FormatType& format, std::string* result) const {
998 +SourceTag Clipboard::ReadSourceTag(Buffer buffer) const {
999 + std::string result;
1000 + return Binary2SourceTag(result);
1003 +uint64 Clipboard::GetSequenceNumber(Buffer buffer) {
1008 +Clipboard::FormatType Clipboard::GetFormatType(
1009 + const std::string& format_string) {
1010 + static FormatType type;
1015 +const Clipboard::FormatType& Clipboard::GetPlainTextFormatType() {
1016 + static FormatType type;
1021 +const Clipboard::FormatType& Clipboard::GetPlainTextWFormatType() {
1022 + return GetPlainTextFormatType();
1026 +const Clipboard::FormatType& Clipboard::GetUrlFormatType() {
1027 + return GetPlainTextFormatType();
1031 +const Clipboard::FormatType& Clipboard::GetUrlWFormatType() {
1032 + return GetPlainTextWFormatType();
1036 +const Clipboard::FormatType& Clipboard::GetHtmlFormatType() {
1037 + return GetPlainTextWFormatType();
1041 +const Clipboard::FormatType& Clipboard::GetRtfFormatType() {
1042 + return GetPlainTextWFormatType();
1046 +const Clipboard::FormatType& Clipboard::GetBitmapFormatType() {
1047 + return GetPlainTextWFormatType();
1051 +const Clipboard::FormatType& Clipboard::GetWebKitSmartPasteFormatType() {
1052 + return GetPlainTextWFormatType();
1056 +const Clipboard::FormatType& Clipboard::GetWebCustomDataFormatType() {
1057 + return GetPlainTextWFormatType();
1061 +const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() {
1062 + return GetPlainTextWFormatType();
1066 +const Clipboard::FormatType& Clipboard::GetSourceTagFormatType() {
1067 + return GetPlainTextWFormatType();
1071 diff --git a/ui/base/resource/resource_bundle_efl.cc b/ui/base/resource/resource_bundle_efl.cc
1072 new file mode 100644
1073 index 0000000..915cf93
1075 +++ b/ui/base/resource/resource_bundle_efl.cc
1077 +// Copyright (c) 2013 Intel Corporation. All rights reserved.
1078 +// Use of this source code is governed by a BSD-style license that can be
1079 +// found in the LICENSE file.
1081 +#include "ui/base/resource/resource_bundle.h"
1083 +#include "base/i18n/rtl.h"
1084 +#include "base/logging.h"
1085 +#include "base/memory/ref_counted_memory.h"
1086 +#include "base/path_service.h"
1087 +#include "base/synchronization/lock.h"
1088 +#include "third_party/skia/include/core/SkBitmap.h"
1089 +#include "ui/base/layout.h"
1090 +#include "ui/base/resource/resource_handle.h"
1091 +#include "ui/base/ui_base_paths.h"
1097 +base::FilePath GetResourcesPakFilePath(const std::string& pak_name) {
1098 + base::FilePath path;
1099 + if (PathService::Get(base::DIR_MODULE, &path))
1100 + return path.AppendASCII(pak_name.c_str());
1102 + // Return just the name of the pack file.
1103 + return base::FilePath(pak_name.c_str());
1108 +void ResourceBundle::LoadCommonResources() {
1109 + AddDataPackFromPath(GetResourcesPakFilePath("chrome.pak"),
1110 + SCALE_FACTOR_NONE);
1111 + AddDataPackFromPath(GetResourcesPakFilePath(
1112 + "chrome_100_percent.pak"),
1113 + SCALE_FACTOR_100P);
1116 +gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) {
1117 + // Use the negative |resource_id| for the key for BIDI-aware images.
1118 + int key = rtl == RTL_ENABLED ? -resource_id : resource_id;
1120 + // Check to see if the image is already in the cache.
1122 + base::AutoLock lock_scope(*images_and_fonts_lock_);
1123 + if (images_.count(key))
1124 + return images_[key];
1129 + image = delegate_->GetNativeImageNamed(resource_id, rtl);
1130 + base::AutoLock lock_scope(*images_and_fonts_lock_);
1132 + // Another thread raced the load and has already cached the image.
1133 + if (images_.count(key))
1134 + return images_[key];
1136 + images_[key] = image;
1137 + return images_[key];
1141 diff --git a/ui/gfx/native_widget_types.h b/ui/gfx/native_widget_types.h
1142 index 720e347..8916610 100644
1143 --- a/ui/gfx/native_widget_types.h
1144 +++ b/ui/gfx/native_widget_types.h
1145 @@ -106,6 +106,8 @@ typedef struct _GdkPixbuf GdkPixbuf;
1146 typedef struct _GdkRegion GdkRegion;
1147 typedef struct _GtkWidget GtkWidget;
1148 typedef struct _GtkWindow GtkWindow;
1149 +#elif defined(TOOLKIT_EFL)
1150 +typedef struct _Evas_Object Evas_Object;
1151 #elif defined(OS_ANDROID)
1152 struct ANativeWindow;
1154 @@ -145,6 +147,12 @@ typedef GtkWidget* NativeView;
1155 typedef GtkWindow* NativeWindow;
1156 typedef GdkRegion* NativeRegion;
1157 typedef GdkEvent* NativeEvent;
1158 +#elif defined(TOOLKIT_EFL) // FIXME: Check the types here.
1159 +typedef void* NativeCursor;
1160 +typedef Evas_Object* NativeView;
1161 +typedef void* NativeRegion;
1162 +typedef Evas_Object* NativeWindow;
1163 +typedef void* NativeEvent;
1164 #elif defined(OS_ANDROID)
1165 typedef void* NativeCursor;
1166 typedef ui::ViewAndroid* NativeView;
1167 @@ -172,6 +180,11 @@ typedef PangoFontDescription* NativeFont;
1168 typedef GtkWidget* NativeEditView;
1169 typedef cairo_t* NativeDrawingContext;
1170 typedef void* NativeViewAccessible;
1171 +#elif defined(TOOLKIT_EFL)
1172 +typedef PangoFontDescription* NativeFont;
1173 +typedef Evas_Object* NativeEditView;
1174 +typedef cairo_t* NativeDrawingContext;
1175 +typedef void* NativeViewAccessible;
1176 #elif defined(USE_AURA)
1177 typedef PangoFontDescription* NativeFont;
1178 typedef void* NativeEditView;
1179 diff --git a/ui/native_theme/native_theme.gyp b/ui/native_theme/native_theme.gyp
1180 index 70d27a3..df3e183 100644
1181 --- a/ui/native_theme/native_theme.gyp
1182 +++ b/ui/native_theme/native_theme.gyp
1184 'native_theme_aura.h',
1185 'native_theme_base.cc',
1186 'native_theme_base.h',
1187 + 'native_theme_efl.cc',
1188 'native_theme_gtk.cc',
1189 'native_theme_gtk.h',
1190 'native_theme_mac.h',
1191 diff --git a/ui/native_theme/native_theme_efl.cc b/ui/native_theme/native_theme_efl.cc
1192 new file mode 100644
1193 index 0000000..ba884d6
1195 +++ b/ui/native_theme/native_theme_efl.cc
1197 +// Copyright (c) 2013 Intel Corporation. All rights reserved.
1198 +// Use of this source code is governed by a BSD-style license that can be
1199 +// found in the LICENSE file.
1201 +#include "base/basictypes.h"
1202 +#include "base/logging.h"
1204 +#include "ui/native_theme/native_theme.h"
1205 +#include "ui/native_theme/native_theme_base.h"
1210 +const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128);
1212 +// Theme colors returned by GetSystemColor().
1214 +// FocusableBorder:
1215 +const SkColor kFocusedBorderColor = SkColorSetRGB(0x4D, 0x90, 0xFE);
1216 +const SkColor kUnfocusedBorderColor = SkColorSetRGB(0xD9, 0xD9, 0xD9);
1219 +const SkColor kFocusedMenuItemBackgroundColor = SkColorSetARGB(13, 0, 0, 0);
1220 +const SkColor kHoverMenuItemBackgroundColor = SkColorSetRGB(204, 204, 204);
1223 +const SkColor kEnabledMenuButtonBorderColor = SkColorSetARGB(36, 0, 0, 0);
1224 +const SkColor kFocusedMenuButtonBorderColor = SkColorSetARGB(72, 0, 0, 0);
1225 +const SkColor kHoverMenuButtonBorderColor = SkColorSetARGB(72, 0, 0, 0);
1228 +const SkColor kTextButtonBackgroundColor = SkColorSetRGB(0xde, 0xde, 0xde);
1229 +const SkColor kTextButtonEnabledColor = SkColorSetRGB(6, 45, 117);
1230 +const SkColor kTextButtonDisabledColor = SkColorSetRGB(161, 161, 146);
1231 +const SkColor kTextButtonHighlightColor = SkColorSetARGB(200, 255, 255, 255);
1232 +const SkColor kTextButtonHoverColor = kTextButtonEnabledColor;
1238 +// EFL implementation of native theme support.
1239 +class NativeThemeEfl : public NativeThemeBase {
1241 + NativeThemeEfl() { }
1242 + virtual SkColor GetSystemColor(ColorId /*color_id*/) const OVERRIDE;
1245 + virtual ~NativeThemeEfl() { }
1247 + DISALLOW_COPY_AND_ASSIGN(NativeThemeEfl);
1250 +SkColor NativeThemeEfl::GetSystemColor(ColorId color_id) const {
1251 + switch (color_id) {
1252 + case kColorId_DialogBackground:
1253 + return SkColorSetRGB(0xFF, 0xFF, 0xFF);
1254 + // FocusableBorder:
1255 + case kColorId_FocusedBorderColor:
1256 + return kFocusedBorderColor;
1257 + case kColorId_UnfocusedBorderColor:
1258 + return kUnfocusedBorderColor;
1261 + case kColorId_FocusedMenuItemBackgroundColor:
1262 + return kFocusedMenuItemBackgroundColor;
1263 + case kColorId_HoverMenuItemBackgroundColor:
1264 + return kHoverMenuItemBackgroundColor;
1265 + case kColorId_EnabledMenuButtonBorderColor:
1266 + return kEnabledMenuButtonBorderColor;
1267 + case kColorId_FocusedMenuButtonBorderColor:
1268 + return kFocusedMenuButtonBorderColor;
1269 + case kColorId_HoverMenuButtonBorderColor:
1270 + return kHoverMenuButtonBorderColor;
1273 + case kColorId_TextButtonBackgroundColor:
1274 + return kTextButtonBackgroundColor;
1275 + case kColorId_TextButtonEnabledColor:
1276 + return kTextButtonEnabledColor;
1277 + case kColorId_TextButtonDisabledColor:
1278 + return kTextButtonDisabledColor;
1279 + case kColorId_TextButtonHighlightColor:
1280 + return kTextButtonHighlightColor;
1281 + case kColorId_TextButtonHoverColor:
1282 + return kTextButtonHoverColor;
1285 + NOTREACHED() << "Invalid color_id: " << color_id;
1288 + return kInvalidColorIdColor;
1292 +NativeTheme* NativeTheme::instance() {
1293 + static NativeTheme* theme = new NativeThemeEfl();
1298 diff --git a/ui/snapshot/snapshot.gyp b/ui/snapshot/snapshot.gyp
1299 index cf93fa9..5b41f96 100644
1300 --- a/ui/snapshot/snapshot.gyp
1301 +++ b/ui/snapshot/snapshot.gyp
1304 'snapshot_android.cc',
1306 + 'snapshot_efl.cc',
1307 'snapshot_export.h',
1310 diff --git a/ui/snapshot/snapshot_efl.cc b/ui/snapshot/snapshot_efl.cc
1311 new file mode 100644
1312 index 0000000..d1db897
1314 +++ b/ui/snapshot/snapshot_efl.cc
1316 +// Copyright (c) 2013 Intel Corporation. All rights reserved.
1317 +// Use of this source code is governed by a BSD-style license that can be
1318 +// found in the LICENSE file.
1320 +#include "ui/snapshot/snapshot.h"
1322 +#include "base/logging.h"
1323 +#include "ui/base/x/x11_util.h"
1324 +#include "ui/gfx/rect.h"
1328 +bool GrabViewSnapshot(gfx::NativeView view,
1329 + std::vector<unsigned char>* png_representation,
1330 + const gfx::Rect& snapshot_bounds) {
1331 + // TODO implement EFL snapshot
1335 +bool GrabWindowSnapshot(gfx::NativeWindow window,
1336 + std::vector<unsigned char>* png_representation,
1337 + const gfx::Rect& snapshot_bounds) {
1338 + // TODO implement EFL snapshot
1343 diff --git a/ui/surface/transport_dib.h b/ui/surface/transport_dib.h
1344 index 535567a..391dbc9 100644
1345 --- a/ui/surface/transport_dib.h
1346 +++ b/ui/surface/transport_dib.h
1350 #include <windows.h>
1351 -#elif defined(TOOLKIT_GTK) || \
1352 +#elif defined(TOOLKIT_GTK) || defined(TOOLKIT_EFL) || \
1353 (defined(OS_LINUX) && defined(USE_AURA) && defined(USE_X11))
1354 #include "ui/base/x/x11_util.h"
1356 @@ -81,7 +81,7 @@ class SURFACE_EXPORT TransportDIB {
1357 static int fake_handle = 10;
1358 return reinterpret_cast<Handle>(fake_handle++);
1360 -#elif defined(TOOLKIT_GTK) || \
1361 +#elif defined(TOOLKIT_GTK) || defined(TOOLKIT_EFL) || \
1362 (defined(OS_LINUX) && defined(USE_AURA) && defined(USE_X11))
1363 typedef int Handle; // These two ints are SysV IPC shared memory keys
1365 @@ -188,7 +188,7 @@ class SURFACE_EXPORT TransportDIB {
1366 // wire to give this transport DIB to another process.
1367 Handle handle() const;
1369 -#if defined(TOOLKIT_GTK) || \
1370 +#if defined(TOOLKIT_GTK) || defined(TOOLKIT_EFL) || \
1371 (defined(OS_LINUX) && defined(USE_AURA) && defined(USE_X11))
1372 // Map the shared memory into the X server and return an id for the shared
1374 @@ -210,7 +210,7 @@ class SURFACE_EXPORT TransportDIB {
1375 // Verifies that the dib can hold a canvas of the requested dimensions.
1376 bool VerifyCanvasSize(int w, int h);
1378 -#if defined(TOOLKIT_GTK) || \
1379 +#if defined(TOOLKIT_GTK) || defined(TOOLKIT_EFL) || \
1380 (defined(OS_LINUX) && defined(USE_AURA) && defined(USE_X11))
1381 Id key_; // SysV shared memory id
1382 void* address_; // mapped address
1383 diff --git a/ui/surface/transport_dib_posix.cc b/ui/surface/transport_dib_posix.cc
1384 index fcb935d..4f10f97 100644
1385 --- a/ui/surface/transport_dib_posix.cc
1386 +++ b/ui/surface/transport_dib_posix.cc
1389 // Desktop GTK Linux builds use the old-style SYSV SHM based DIBs.
1390 // Linux Aura and Chrome OS do too. This will change very soon.
1391 -#if !defined(TOOLKIT_GTK) && !(defined(OS_LINUX) && defined(USE_AURA))
1392 +#if !defined(TOOLKIT_GTK) && !defined(TOOLKIT_EFL) && !(defined(OS_LINUX) && defined(USE_AURA))
1394 #include <sys/stat.h>
1396 diff --git a/ui/surface/transport_dib_sysvipc.cc b/ui/surface/transport_dib_sysvipc.cc
1397 index a15ca41..3c516a7 100644
1398 --- a/ui/surface/transport_dib_sysvipc.cc
1399 +++ b/ui/surface/transport_dib_sysvipc.cc
1402 // Desktop GTK Linux builds use the old-style SYSV SHM based DIBs.
1403 // Linux Aura and Chrome OS do too. This will change very soon.
1404 -#if defined(TOOLKIT_GTK) || (defined(OS_LINUX) && defined(USE_AURA))
1405 +#if defined(TOOLKIT_GTK) || defined(TOOLKIT_EFL) || (defined(OS_LINUX) && defined(USE_AURA))
1409 diff --git a/ui/ui.gyp b/ui/ui.gyp
1410 index a7c9cbf..e6c240e 100644
1413 @@ -707,9 +707,20 @@
1415 'gfx/screen_efl.cc',
1418 - 'gfx/screen_gtk.cc',
1421 + ['exclude', 'gfx/gtk_'],
1422 + ['exclude', 'gfx/gtk_util.cc'],
1423 + ['exclude', 'gfx/gtk_util.h'],
1424 + ['exclude', 'gfx/screen_gtk.cc'],
1425 + ['exclude', 'base/work_area_watcher_observer.h'],
1426 + ['exclude', 'base/x/active_window_watcher_x.cc'],
1427 + ['exclude', 'base/x/active_window_watcher_x.h'],
1428 + ['exclude', 'base/x/active_window_watcher_x_observer.h'],
1429 + ['exclude', 'base/x/root_window_property_watcher_x.cc'],
1430 + ['exclude', 'base/x/root_window_property_watcher_x.h'],
1431 + ['exclude', 'base/x/work_area_watcher_x.cc'],
1432 + ['exclude', 'base/x/work_area_watcher_x.h'],
1435 ['chromeos==1 or (use_aura==1 and OS=="linux" and use_x11==0)', {
1437 diff --git a/webkit/glue/webcursor_efl.cc b/webkit/glue/webcursor_efl.cc
1438 new file mode 100644
1439 index 0000000..7fcbcd2
1441 +++ b/webkit/glue/webcursor_efl.cc
1443 +// Copyright (c) 2013 Intel Corporation. All rights reserved.
1444 +// Use of this source code is governed by a BSD-style license that can be
1445 +// found in the LICENSE file.
1447 +#include "webkit/glue/webcursor.h"
1449 +#include "base/logging.h"
1450 +#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
1452 +using WebKit::WebCursorInfo;
1454 +gfx::NativeCursor WebCursor::GetNativeCursor() {
1458 +void WebCursor::InitPlatformData() {
1461 +bool WebCursor::SerializePlatformData(Pickle* pickle) const {
1465 +bool WebCursor::DeserializePlatformData(PickleIterator* iter) {
1469 +bool WebCursor::IsPlatformDataEqual(const WebCursor& other) const {
1473 +void WebCursor::CleanupPlatformData() {
1476 +void WebCursor::CopyPlatformData(const WebCursor& other) {
1478 diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
1479 index 93ec07c..f9d0f4a 100644
1480 --- a/webkit/glue/webkit_glue.gypi
1481 +++ b/webkit/glue/webkit_glue.gypi
1483 '../plugins/npapi/webplugin_delegate_impl.h',
1484 '../plugins/npapi/webplugin_delegate_impl_android.cc',
1485 '../plugins/npapi/webplugin_delegate_impl_aura.cc',
1486 + '../plugins/npapi/webplugin_delegate_impl_efl.cc',
1487 '../plugins/npapi/webplugin_delegate_impl_gtk.cc',
1488 '../plugins/npapi/webplugin_delegate_impl_mac.mm',
1489 '../plugins/npapi/webplugin_delegate_impl_win.cc',
1491 'webcursor_aura.cc',
1492 'webcursor_aurawin.cc',
1493 'webcursor_aurax11.cc',
1494 + 'webcursor_efl.cc',
1495 'webcursor_null.cc',
1497 'webcursor_gtk_data.h',
1498 diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_efl.cc b/webkit/plugins/npapi/webplugin_delegate_impl_efl.cc
1499 new file mode 100644
1500 index 0000000..1349abc
1502 +++ b/webkit/plugins/npapi/webplugin_delegate_impl_efl.cc
1504 +// Copyright (c) 2013 Intel Corporation. All rights reserved.
1505 +// Use of this source code is governed by a BSD-style license that can be
1506 +// found in the LICENSE file.
1508 +#include "webkit/plugins/npapi/webplugin_delegate_impl.h"
1513 +#include "base/metrics/stats_counters.h"
1514 +#include "skia/ext/platform_canvas.h"
1515 +#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
1516 +#include "ui/gfx/blit.h"
1517 +#include "webkit/plugins/npapi/plugin_instance.h"
1518 +#include "webkit/plugins/npapi/webplugin.h"
1519 +#include "webkit/plugins/plugin_constants.h"
1521 +#include "third_party/npapi/bindings/npapi_x11.h"
1523 +using WebKit::WebCursorInfo;
1524 +using WebKit::WebKeyboardEvent;
1525 +using WebKit::WebInputEvent;
1526 +using WebKit::WebMouseEvent;
1531 +WebPluginDelegateImpl::WebPluginDelegateImpl(
1532 + PluginInstance* instance) {
1535 +WebPluginDelegateImpl::~WebPluginDelegateImpl() {
1538 +bool WebPluginDelegateImpl::PlatformInitialize() {
1542 +void WebPluginDelegateImpl::PlatformDestroyInstance() {
1543 + // Nothing to do here.
1546 +void WebPluginDelegateImpl::Paint(WebKit::WebCanvas* canvas,
1547 + const gfx::Rect& rect) {
1550 +bool WebPluginDelegateImpl::WindowedCreatePlugin() {
1554 +void WebPluginDelegateImpl::WindowedDestroyWindow() {
1557 +bool WebPluginDelegateImpl::WindowedReposition(
1558 + const gfx::Rect& window_rect,
1559 + const gfx::Rect& clip_rect) {
1563 +void WebPluginDelegateImpl::WindowedSetWindow() {
1566 +void WebPluginDelegateImpl::WindowlessUpdateGeometry(
1567 + const gfx::Rect& window_rect,
1568 + const gfx::Rect& clip_rect) {
1571 +void WebPluginDelegateImpl::WindowlessPaint(cairo_t* context,
1572 + const gfx::Rect& damage_rect) {
1575 +void WebPluginDelegateImpl::WindowlessSetWindow() {
1578 +bool WebPluginDelegateImpl::PlatformSetPluginHasFocus(bool focused) {
1582 +bool WebPluginDelegateImpl::PlatformHandleInputEvent(
1583 + const WebInputEvent& event, WebCursorInfo* cursor_info) {
1587 +} // namespace npapi
1588 +} // namespace webkit