--- /dev/null
+# Copyright (c) 2015 Samsung Electronics. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'target_conditions': [
+ ['<(use_efl)==0', {
+ 'source/': [
+ [ 'exclude', '_efl\.(h|cc)$' ],
+ ],
+ }],
+ ]
+}
--- /dev/null
+# Copyright (c) 2015 Samsung Electronics. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables': {
+ 'pkg-config': 'pkg-config',
+ },
+ 'targets': [
+ {
+ 'target_name': 'evas',
+ 'type': 'none',
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags evas)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other evas)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l evas)',
+ ],
+ },
+ }, # evas
+ {
+ 'target_name': 'ecore',
+ 'type': 'none',
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags ecore)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other ecore)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l ecore)',
+ ],
+ },
+ }, # ecore
+ {
+ 'target_name': 'ecore-x',
+ 'type': 'none',
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags ecore-x)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other ecore-x)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l ecore-x)',
+ ],
+ },
+ }, # ecore-x
+ {
+ 'target_name': 'ecore-evas',
+ 'type': 'none',
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags ecore-evas)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other ecore-evas)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l ecore-evas)',
+ ],
+ },
+ }, # ecore-evas
+ {
+ 'target_name': 'ecore-input',
+ 'type': 'none',
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags ecore-input)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other ecore-input)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l ecore-input)',
+ ],
+ },
+ }, # ecore-input
+ {
+ 'target_name': 'elementary',
+ 'type': 'none',
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags elementary)',
+ # Fix: elm_prefs_common.h:27:9: warning: empty struct has size 0 in C, size 1 in C++
+ '-Wno-extern-c-compat',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other elementary)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l elementary)',
+ ],
+ },
+ }, # elementary
+ {
+ 'target_name': 'efl-assist',
+ 'type': 'none',
+ 'conditions': [
+ ['building_for_tizen_mobile==1', {
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags efl-assist)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other efl-assist)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l efl-assist)',
+ ],
+ },
+ }],
+ ],
+ }, # efl-assist
+ {
+ 'target_name': 'capi-appfw-application',
+ 'type': 'none',
+ 'conditions': [
+ ['building_for_tizen==1', {
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags capi-appfw-application)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other capi-appfw-application)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l capi-appfw-application)',
+ ],
+ },
+ }],
+ ],
+ }, # capi-appfw-application
+ {
+ 'target_name': 'libdri2',
+ 'type': 'none',
+ 'conditions': [
+ ['building_for_tizen==1', {
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags libdri2)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other libdri2)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l libdri2)',
+ ],
+ },
+ }],
+ ],
+ }, # libdri2
+ {
+ 'target_name': 'libdrm',
+ 'type': 'none',
+ 'conditions': [
+ ['building_for_tizen==1', {
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags libdrm)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other libdrm)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l libdrm)',
+ ],
+ },
+ }],
+ ],
+ }, # libdri2
+ {
+ 'target_name': 'libtbm',
+ 'type': 'none',
+ 'conditions': [
+ ['building_for_tizen==1', {
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags libtbm)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other libtbm)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l libtbm)',
+ ],
+ },
+ }],
+ ],
+ }, # libtbm
+ ],
+}
--- /dev/null
+# Copyright (c) 2015 Samsung Electronics. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables': {
+ 'external_base_deps': [
+ '<(DEPTH)/tizen_src/build/system.gyp:ecore',
+ ],
+ },
+ 'target_defaults': {
+ 'target_conditions': [
+ ['_target_name=="base"', {
+ 'sources': [
+ 'message_loop/message_pump_ecore.cc',
+ 'message_loop/message_pump_ecore.h',
+ ],
+ }],
+ ],
+ }
+}
+
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "message_pump_efl.h"
+#include "base/message_loop/message_pump_ecore.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
namespace {
void PipeCallback(void *data, void*, unsigned int) {
- static_cast<MessagePumpEfl*>(data)->HandleScheduledWork();
+ static_cast<MessagePumpEcore*>(data)->HandleScheduledWork();
}
}
-struct MessagePumpEfl::RunState {
+struct MessagePumpEcore::RunState {
Delegate* delegate;
bool should_quit;
int run_depth;
};
-MessagePumpEfl::MessagePumpEfl()
+MessagePumpEcore::MessagePumpEcore()
: state_(NULL)
, pipe_(ecore_pipe_add(&PipeCallback, this))
, work_scheduled_(false) {
}
-MessagePumpEfl::~MessagePumpEfl() {
+MessagePumpEcore::~MessagePumpEcore() {
ecore_pipe_del(pipe_);
pipe_ = NULL;
}
-void MessagePumpEfl::Run(Delegate* delegate) {
+void MessagePumpEcore::Run(Delegate* delegate) {
RunState state;
state.delegate = delegate;
state.should_quit = false;
state_ = previous_state;
}
-void MessagePumpEfl::Quit() {
+void MessagePumpEcore::Quit() {
if (state_) {
state_->should_quit = true;
} else {
}
}
-void MessagePumpEfl::ScheduleWork() {
+void MessagePumpEcore::ScheduleWork() {
{
base::AutoLock locker(schedule_work_lock_);
if (work_scheduled_)
}
}
-void MessagePumpEfl::ScheduleDelayedWork(const TimeTicks& delayed_work_time) {
+void MessagePumpEcore::ScheduleDelayedWork(const TimeTicks& delayed_work_time) {
delayed_work_time_ = delayed_work_time;
ScheduleWork();
}
-void MessagePumpEfl::HandleScheduledWork() {
+void MessagePumpEcore::HandleScheduledWork() {
{
base::AutoLock locker(schedule_work_lock_);
DCHECK(work_scheduled_);
class TimeTicks;
-class BASE_EXPORT MessagePumpEfl : public MessagePump {
+class BASE_EXPORT MessagePumpEcore : public MessagePump {
public:
- MessagePumpEfl();
- virtual ~MessagePumpEfl();
+ MessagePumpEcore();
+ ~MessagePumpEcore() override;
- virtual void Run(Delegate* delegate) override;
- virtual void Quit() override;
- virtual void ScheduleWork() override;
- virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override;
+ void Run(Delegate* delegate) override;
+ void Quit() override;
+ void ScheduleWork() override;
+ void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override;
void HandleScheduledWork();
--- /dev/null
+# Copyright (c) 2015 Samsung Electronics. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'includes': [
+ 'base/base_efl.gypi',
+ 'content/content_efl.gypi',
+ 'ui/ui_efl.gypi',
+ 'gpu/gpu_efl.gypi',
+ 'third_party/WebKit/Source/core/core_efl.gypi',
+ ],
+}
--- /dev/null
+# Copyright (c) 2015 Samsung Electronics. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables': {
+ 'chromium_code': 1,
+ },
+ 'includes': [
+ 'js_dialogs_efl.gypi',
+ ],
+}
--- /dev/null
+# Copyright (c) 2015 Samsung Electronics. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'js_dialogs_efl',
+ 'type': 'static_library',
+ 'dependencies': [
+ '<(DEPTH)/base/base.gyp:base',
+ '<(DEPTH)/skia/skia.gyp:skia',
+ '<(DEPTH)/tizen_src/build/system.gyp:elementary',
+ '<(DEPTH)/tizen_src/build/system.gyp:efl-assist',
+ ],
+ 'include_dirs': [
+ '..',
+ ],
+ 'sources': [
+ 'js_dialogs_efl/javascript_dialog_manager_efl.cc',
+ 'js_dialogs_efl/javascript_dialog_manager_efl.h',
+ 'js_dialogs_efl/javascript_modal_dialog_efl.cc',
+ 'js_dialogs_efl/javascript_modal_dialog_efl.h',
+ ],
+ }
+ ],
+}
--- /dev/null
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/js_dialogs_efl/javascript_dialog_manager_efl.h"
+
+#include "base/strings/utf_string_conversions.h"
+#include "components/js_dialogs_efl/javascript_modal_dialog_efl.h"
+#include "content/public/browser/browser_thread.h"
+
+using content::BrowserThread;
+
+namespace content {
+
+JavaScriptDialogManagerEfl::JavaScriptDialogManagerEfl() {
+}
+
+JavaScriptDialogManagerEfl::~JavaScriptDialogManagerEfl() {
+}
+
+void JavaScriptDialogManagerEfl::RunJavaScriptDialog(
+ content::WebContents* web_contents,
+ const GURL& origin_url,
+ const std::string& accept_lang,
+ content::JavaScriptMessageType type,
+ const base::string16& message_text,
+ const base::string16& default_prompt_text,
+ const DialogClosedCallback& callback,
+ bool* did_suppress_message) {
+
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(web_contents);
+
+ JavaScriptModalDialogEfl::Type efl_type;
+
+ switch (type) {
+ case JAVASCRIPT_MESSAGE_TYPE_ALERT:
+ efl_type = JavaScriptModalDialogEfl::ALERT;
+ break;
+ case JAVASCRIPT_MESSAGE_TYPE_CONFIRM:
+ efl_type = JavaScriptModalDialogEfl::CONFIRM;
+ break;
+ case JAVASCRIPT_MESSAGE_TYPE_PROMPT:
+ efl_type = JavaScriptModalDialogEfl::PROMPT;
+ break;
+ default:
+ NOTREACHED();
+ }
+
+ CancelActiveAndPendingDialogs(web_contents);
+ open_dialogs_[web_contents] = new JavaScriptModalDialogEfl(web_contents,
+ efl_type, message_text, default_prompt_text, callback);
+ *did_suppress_message = false;
+}
+
+void JavaScriptDialogManagerEfl::RunBeforeUnloadDialog(
+ content::WebContents* web_contents,
+ const base::string16& message_text,
+ bool is_reload,
+ const DialogClosedCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ CancelActiveAndPendingDialogs(web_contents);
+ open_dialogs_[web_contents] = new JavaScriptModalDialogEfl(web_contents,
+ JavaScriptModalDialogEfl::NAVIGATION,
+ base::UTF8ToUTF16(
+ std::string(dgettext("WebKit", "IDS_WEBVIEW_BEFOREUNLOAD_MESSAGE"))),
+ message_text, callback);
+}
+
+bool JavaScriptDialogManagerEfl::HandleJavaScriptDialog(
+ content::WebContents* web_contents,
+ bool accept,
+ const base::string16* prompt_override) {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+void JavaScriptDialogManagerEfl::CancelActiveAndPendingDialogs(
+ content::WebContents* web_contents) {
+ if (open_dialogs_.find(web_contents) != open_dialogs_.end()) {
+ open_dialogs_[web_contents]->Close();
+ delete open_dialogs_[web_contents];
+ }
+}
+
+void JavaScriptDialogManagerEfl::WebContentsDestroyed(
+ content::WebContents* web_contents) {
+ CancelActiveAndPendingDialogs(web_contents);
+}
+
+} // namespace content
--- /dev/null
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef JAVASCRIPT_DIALOG_MANAGER_EFL_H_
+#define JAVASCRIPT_DIALOG_MANAGER_EFL_H_
+
+#include <string>
+#include <map>
+#include <Evas.h>
+
+#include "base/strings/string16.h"
+#include "content/public/browser/javascript_dialog_manager.h"
+#include "content/public/common/javascript_message_type.h"
+#include "url/gurl.h"
+
+namespace content{
+
+class WebContents;
+class JavaScriptModalDialogEfl;
+
+class JavaScriptDialogManagerEfl: public JavaScriptDialogManager {
+ public:
+ JavaScriptDialogManagerEfl();
+ ~JavaScriptDialogManagerEfl() override;
+
+ void RunJavaScriptDialog(
+ content::WebContents* web_contents,
+ const GURL& origin_url,
+ const std::string& accept_lang,
+ content::JavaScriptMessageType type,
+ const base::string16& message_text,
+ const base::string16& default_prompt_text,
+ const DialogClosedCallback& callback,
+ bool* did_suppress_message) override;
+ void RunBeforeUnloadDialog(
+ content::WebContents* web_contents,
+ const base::string16& message_text,
+ bool is_reload,
+ const DialogClosedCallback& callback) override;
+ bool HandleJavaScriptDialog(
+ content::WebContents* web_contents,
+ bool accept,
+ const base::string16* prompt_override) override;
+ void CancelActiveAndPendingDialogs(
+ content::WebContents* web_contents) override;
+ void WebContentsDestroyed(
+ content::WebContents* web_contents) override;
+
+ private:
+ std::map<WebContents*, JavaScriptModalDialogEfl*> open_dialogs_;
+
+ DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogManagerEfl);
+};
+
+} // namespace content
+
+#endif /* JAVASCRIPT_DIALOG_MANAGER_EFL_H_ */
--- /dev/null
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "javascript_modal_dialog_efl.h"
+
+#include "base/files/file_path.h"
+#include "base/path_service.h"
+#include "base/strings/utf_string_conversions.h"
+#include "content/public/browser/web_contents.h"
+
+#ifdef OS_TIZEN_MOBILE
+#include <efl_assist.h>
+#endif
+
+namespace content {
+
+namespace {
+static void PromptEntryChanged(void* data, Ecore_IMF_Context*, int value) {
+ if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
+ Evas_Object* entry = static_cast<Evas_Object*>(data);
+ if( entry)
+ elm_object_focus_set(entry, EINA_FALSE);
+ }
+}
+
+static void PromptEnterKeyDownCallback(void*, Evas_Object* obj, void*) {
+ elm_entry_input_panel_hide(obj);
+}
+}
+
+JavaScriptModalDialogEfl::JavaScriptModalDialogEfl(
+ content::WebContents* web_contents,
+ Type type,
+ const base::string16& message_text,
+ const base::string16& default_prompt_text,
+ const content::JavaScriptDialogManager::DialogClosedCallback& callback)
+ : popup_(NULL)
+ , callback_(callback)
+ , prompt_entry_(NULL)
+ , imf_context_(NULL) {
+
+ Evas_Object *parent_view = static_cast<Evas_Object *>(
+ web_contents->GetNativeView());
+ popup_ = elm_popup_add(parent_view);
+ elm_popup_orient_set(popup_, ELM_POPUP_ORIENT_CENTER);
+ elm_popup_align_set(popup_, 0.5f, 0.5f);
+ evas_object_event_callback_add(parent_view, EVAS_CALLBACK_RESIZE,
+ &ParentViewResized, this);
+
+ InitContent(type, message_text, default_prompt_text);
+ InitButtons(type);
+
+#if defined(OS_TIZEN_MOBILE)
+ ea_object_event_callback_add(popup_, EA_CALLBACK_BACK,
+ &OnCancelButtonPressed, this);
+#endif
+
+ evas_object_show(popup_);
+}
+
+JavaScriptModalDialogEfl::~JavaScriptModalDialogEfl() {
+ Close();
+}
+
+void JavaScriptModalDialogEfl::SetLabelText(const base::string16& txt) {
+ std::string txt2;
+ base::ReplaceChars(UTF16ToUTF8(txt).c_str(), "\n", "</br>", &txt2);
+
+ Evas_Object* label = elm_label_add(popup_);
+ elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
+ elm_object_text_set(label, txt2.c_str());
+ elm_object_part_content_set(popup_, "default", label);
+ evas_object_show(label);
+}
+
+void JavaScriptModalDialogEfl::InitContent(Type type, const base::string16& message,
+ const base::string16& content) {
+
+ if (type == PROMPT) {
+ DCHECK(message.length());
+ elm_object_part_text_set(popup_, "title,text", UTF16ToUTF8(message).c_str());
+ prompt_entry_ = elm_entry_add(popup_);
+ elm_entry_editable_set(prompt_entry_, EINA_TRUE);
+ elm_entry_single_line_set(prompt_entry_, EINA_TRUE);
+ elm_entry_scrollable_set(prompt_entry_, EINA_TRUE);
+ evas_object_size_hint_weight_set(prompt_entry_, EVAS_HINT_EXPAND, 0.0f);
+ evas_object_size_hint_align_set(prompt_entry_, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_entry_input_panel_return_key_type_set(prompt_entry_,
+ ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
+ elm_object_text_set(prompt_entry_,
+ UTF16ToUTF8(content).c_str());
+ elm_entry_cursor_end_set(prompt_entry_);
+ evas_object_smart_callback_add(prompt_entry_, "activated",
+ &PromptEnterKeyDownCallback, this);
+
+ imf_context_ = static_cast<Ecore_IMF_Context*>(
+ elm_entry_imf_context_get(prompt_entry_));
+ // Can be NULL in case of platforms without SW keyboard (desktop).
+ if (imf_context_) {
+ ecore_imf_context_input_panel_event_callback_add(imf_context_,
+ ECORE_IMF_INPUT_PANEL_STATE_EVENT, &PromptEntryChanged,
+ prompt_entry_);
+ }
+
+ elm_object_part_content_set(popup_, "default", prompt_entry_);
+ } else if (type == NAVIGATION) {
+ if (message.length())
+ elm_object_part_text_set(popup_, "title,text", UTF16ToUTF8(message).c_str());
+ if (content.length())
+ SetLabelText(content);
+ } else {
+ DCHECK(message.length());
+ SetLabelText(message);
+ }
+}
+
+void JavaScriptModalDialogEfl::InitButtons(Type type) {
+ DCHECK(popup_);
+ switch (type) {
+ case ALERT:
+ AddButton(popup_, "OK", "button1", &OnOkButtonPressed);
+ break;
+ case CONFIRM:
+ AddButton(popup_, "Cancel", "button1", &OnCancelButtonPressed);
+ AddButton(popup_, "OK", "button2", &OnOkButtonPressed);
+ break;
+ case PROMPT:
+ AddButton(popup_, "Cancel", "button1", &OnCancelButtonPressed);
+ AddButton(popup_, "OK", "button2", &OnOkButtonPressed);
+ break;
+ case NAVIGATION:
+ AddButton(popup_, "Leave", "button1", &OnOkButtonPressed);
+ AddButton(popup_, "Stay", "button2", &OnCancelButtonPressed);
+ break;
+ default:
+ NOTREACHED();
+ }
+}
+
+Evas_Object* JavaScriptModalDialogEfl::AddButton(Evas_Object* parent,
+ const char *label, const char *elm_part, Evas_Smart_Cb cb) {
+ Evas_Object *btn = elm_button_add(parent);
+ elm_object_style_set(btn, "popup");
+ elm_object_text_set(btn, label);
+ elm_object_part_content_set(parent, elm_part, btn);
+ evas_object_smart_callback_add(btn, "clicked", cb, this);
+ return btn;
+}
+
+
+void JavaScriptModalDialogEfl::OnOkButtonPressed(
+ void* data, Evas_Object* obj, void* event_info) {
+ JavaScriptModalDialogEfl *thiz = static_cast<JavaScriptModalDialogEfl*>(data);
+
+ std::string prompt_data;
+ if (thiz->prompt_entry_)
+ prompt_data = elm_entry_entry_get(thiz->prompt_entry_);
+ thiz->Close(true, prompt_data);
+}
+
+void JavaScriptModalDialogEfl::OnCancelButtonPressed(
+ void* data, Evas_Object* obj, void* event_info) {
+ JavaScriptModalDialogEfl *thiz = static_cast<JavaScriptModalDialogEfl*>(data);
+ thiz->Close(false);
+}
+
+void JavaScriptModalDialogEfl::ParentViewResized(
+ void *data, Evas *, Evas_Object *obj, void *info) {
+ JavaScriptModalDialogEfl *thiz = static_cast<JavaScriptModalDialogEfl*>(data);
+ int x, y, w, h;
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+ evas_object_geometry_set(thiz->popup_, x, y, w, h);
+}
+
+void JavaScriptModalDialogEfl::Close(bool accept, std::string reply) {
+ if (popup_) {
+ callback_.Run(accept, base::UTF8ToUTF16(reply));
+ evas_object_del(popup_);
+ popup_ = NULL;
+ prompt_entry_ = NULL;
+ imf_context_ = NULL;
+ }
+}
+
+} // namespace content
--- /dev/null
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef JAVA_SCRIPT_MODAL_DIALOG_EFL_H_
+#define JAVA_SCRIPT_MODAL_DIALOG_EFL_H_
+
+#include <string>
+#include <Elementary.h>
+
+#include "base/strings/string16.h"
+#include "base/strings/string_util.h"
+#include "content/public/browser/javascript_dialog_manager.h"
+#include "url/gurl.h"
+
+namespace content {
+
+class JavaScriptModalDialogEfl {
+ public:
+ enum Type {
+ ALERT,
+ CONFIRM,
+ NAVIGATION,
+ PROMPT
+ };
+
+ JavaScriptModalDialogEfl(
+ content::WebContents* web_contents,
+ Type type,
+ const base::string16& message_text,
+ const base::string16& default_prompt_text,
+ const content::JavaScriptDialogManager::DialogClosedCallback&);
+ ~JavaScriptModalDialogEfl();
+
+ void Close(bool accept = false, std::string reply = std::string());
+
+ private:
+ void InitContent(Type, const base::string16& message,
+ const base::string16& content);
+ void InitButtons(Type);
+
+ void SetLabelText(const base::string16& txt);
+ Evas_Object* AddButton(Evas_Object* parent, const char *label,
+ const char *elm_part, Evas_Smart_Cb);
+
+ static void OnOkButtonPressed(void*, Evas_Object*, void*);
+ static void OnCancelButtonPressed(void*, Evas_Object*, void*);
+
+ static void ParentViewResized(void *, Evas *, Evas_Object *, void *);
+
+ Evas_Object* popup_;
+ JavaScriptDialogManager::DialogClosedCallback callback_;
+ Evas_Object* prompt_entry_;
+ Ecore_IMF_Context* imf_context_;
+};
+
+} // namespace content
+
+#endif /* JAVA_SCRIPT_MODAL_DIALOG_EFL_H_ */
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "browser/disambiguation_popup_efl.h"
+#include "content/browser/renderer_host/disambiguation_popup_efl.h"
+
+#include <Elementary.h>
#include "base/path_service.h"
#include "base/files/file_path.h"
-#include "browser/renderer_host/render_widget_host_view_efl.h"
+#include "content/browser/renderer_host/render_widget_host_view_efl.h"
+#include "content/common/paths_efl.h"
#include "ui/events/event.h"
#include "ui/gfx/screen.h"
-#include "paths_efl.h"
-
-#include <Elementary.h>
-#if defined(OS_TIZEN_MOBILE)
+#if 0 //defined(OS_TIZEN_MOBILE)
#include <dlfcn.h>
#include <efl_assist.h>
extern void* EflAssistHandle;
content_image_ = evas_object_image_add(evas_object_evas_get(parent_view_));
elm_object_content_set(popup_, content_image_);
-#if defined(OS_TIZEN_MOBILE)
+#warning "Add proper support for EFL Assist"
+#if 0 //defined(OS_TIZEN_MOBILE)
if (EflAssistHandle) {
typedef void (*cb_type)(Evas_Object*, Ea_Callback_Type, Ea_Event_Cb func, void*);
cb_type cb = (cb_type)dlsym(EflAssistHandle, "ea_object_event_callback_add");
int image_cord_x = event->canvas.x - image_x;
int image_cord_y = event->canvas.y - image_y;
- // we have image cords, now we need to translate them to target_rect_
+ // We have image cords, now we need to translate them to target_rect_.
float ratio = static_cast<float>(width_) / target_rect_.width();
int target_rect_x = target_rect_.x() + (image_cord_x / ratio);
event->canvas.x = target_rect_x + (parent_view_x * device_scale_factor);
event->canvas.y = target_rect_y + (parent_view_y * device_scale_factor);
- rwhv_->HandleEvasEvent(event);
+#warning "[TODO] Add proper interface for this to RWHV"
+ //rwhv_->HandleEvasEvent(event);
}
void DisambiguationPopupEfl::Dismissed(void* data, Evas_Object*, void*) {
#ifndef DISAMBIGUATION_POPUP_EFL_H
#define DISAMBIGUATION_POPUP_EFL_H
-#include "ui/gfx/point.h"
-#include "ui/gfx/rect.h"
-
#include <Evas.h>
+#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/geometry/rect.h"
+
class SkBitmap;
namespace content {
RenderWidgetHostViewEfl* rwhv_;
Evas_Object* parent_view_;
- // Image displayed on popup
Evas_Object* content_image_;
Evas_Object* popup_;
--- /dev/null
+// Copyright 2014-2015 Samsung Electronics. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/renderer_host/render_widget_host_view_efl.h"
+
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Ecore_Input.h>
+#include <Ecore_X.h>
+#include <Elementary.h>
+
+#include "base/auto_reset.h"
+#include "base/basictypes.h"
+#include "base/bind.h"
+#include "base/command_line.h"
+#include "base/callback_helpers.h"
+#include "base/command_line.h"
+#include "base/debug/trace_event.h"
+#include "base/message_loop/message_loop.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/logging.h"
+#include "base/strings/utf_string_conversions.h"
+#include "content/browser/gpu/browser_gpu_channel_host_factory.h"
+#include "content/browser/gpu/compositor_util.h"
+#include "content/browser/renderer_host/render_widget_host_impl.h"
+#include "content/browser/renderer_host/ui_events_helper.h"
+#include "content/browser/renderer_host/event_with_latency_info.h"
+#include "content/browser/renderer_host/disambiguation_popup_efl.h"
+#include "content/browser/renderer_host/web_event_factory_efl.h"
+#include "content/browser/renderer_host/render_widget_host_impl.h"
+#include "content/browser/renderer_host/input/web_input_event_util.h"
+#include "content/browser/renderer_host/dip_util.h"
+#include "content/browser/gpu/gpu_process_host.h"
+#include "content/common/gpu/client/gl_helper.h"
+#include "content/common/input/did_overscroll_params.h"
+#include "content/common/input_messages.h"
+#include "content/common/gpu/gpu_messages.h"
+#include "content/common/cursors/webcursor_efl.h"
+#include "content/public/browser/render_widget_host_view_frame_subscriber.h"
+#include "content/public/browser/screen_orientation_dispatcher_host.h"
+#include "content/public/common/content_switches.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_process_host.h"
+#include "gpu/command_buffer/service/mailbox_manager.h"
+#include "media/base/video_util.h"
+#include "skia/ext/image_operations.h"
+#include "third_party/WebKit/public/web/WebInputEvent.h"
+#include "third_party/WebKit/public/platform/WebScreenInfo.h"
+#include "third_party/WebKit/public/web/WebTouchPoint.h"
+#include "ui/base/layout.h"
+#include "ui/gfx/display.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/screen.h"
+#include "ui/events/event_utils.h"
+#include "ui/gl/gl_shared_context_efl.h"
+#include "ui/base/clipboard/clipboard_helper_efl.h"
+#include "ui/events/event_switches.h"
+
+#define EFL_MAX_WIDTH 10000
+#define EFL_MAX_HEIGHT 10000 // borrowed from GTK+ port
+
+#define MAX_SURFACE_WIDTH_EGL 4096 //max supported Framebuffer width
+#define MAX_SURFACE_HEIGHT_EGL 4096 //max supported Framebuffer height
+
+namespace content {
+
+void RenderWidgetHostViewBase::GetDefaultScreenInfo(
+ blink::WebScreenInfo* results) {
+ const gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
+
+ results->rect = display.bounds();
+ results->availableRect = display.work_area();
+ results->deviceScaleFactor = display.device_scale_factor();
+ results->orientationAngle = display.RotationAsDegree();
+#if defined(OS_TIZEN_MOBILE)
+ results->orientationType =
+ RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
+#else
+ results->orientationType =
+ RenderWidgetHostViewBase::GetOrientationTypeForDesktop(display);
+#endif
+
+ // TODO(derat|oshima): Don't hardcode this. Get this from display object.
+ results->depth = 24;
+ results->depthPerComponent = 8;
+}
+
+RenderWidgetHostViewEfl::RenderWidgetHostViewEfl(RenderWidgetHost* widget)
+ : host_(RenderWidgetHostImpl::From(widget)),
+ evas_(NULL),
+ parent_view_(NULL),
+ content_image_(NULL),
+ content_image_elm_host_(NULL),
+ evas_gl_initialized_(false),
+ device_scale_factor_(1.0f),
+ magnifier_(false),
+ is_loading_(false),
+ gesture_recognizer_(ui::GestureRecognizer::Create()),
+ current_orientation_(0),
+ evas_gl_(NULL),
+ evas_gl_api_(NULL),
+ evas_gl_context_(NULL),
+ evas_gl_surface_(NULL),
+ evas_gl_config_(NULL),
+ egl_image_(NULL),
+ current_pixmap_id_(0),
+ next_pixmap_id_(0),
+ texture_id_(0),
+ surface_id_(0),
+ is_modifier_key_(false),
+#if defined(OS_TIZEN)
+ touch_events_enabled_(true),
+#else
+ touch_events_enabled_(false),
+#endif
+ should_restore_selection_menu_(false),
+ selection_acked_on_tap_(false),
+ was_scrolled_(false) {
+
+ device_scale_factor_ = gfx::Screen::GetNativeScreen()->
+ GetPrimaryDisplay().device_scale_factor();
+
+ base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
+ if (cmdline->HasSwitch(switches::kTouchEvents)) {
+ touch_events_enabled_ = cmdline->
+ GetSwitchValueASCII(switches::kTouchEvents) ==
+ switches::kTouchEventsEnabled;
+ }
+
+ host_->SetView(this);
+
+ static bool scale_factor_initialized = false;
+ if (!scale_factor_initialized) {
+ std::vector<ui::ScaleFactor> supported_scale_factors;
+ supported_scale_factors.push_back(ui::SCALE_FACTOR_100P);
+ supported_scale_factors.push_back(ui::SCALE_FACTOR_200P);
+ ui::SetSupportedScaleFactors(supported_scale_factors);
+ scale_factor_initialized = true;
+ }
+
+ gesture_recognizer_->AddGestureEventHelper(this);
+}
+
+void RenderWidgetHostViewEfl::Init(Evas_Object* parent_view) {
+ DCHECK(parent_view);
+ parent_view_ = parent_view;
+ evas_ = evas_object_evas_get(parent_view);
+
+ content_image_elm_host_ = elm_bg_add(parent_view);
+ elm_object_focus_allow_set(content_image_elm_host_, EINA_TRUE);
+
+ content_image_ = evas_object_image_filled_add(evas_);
+ elm_object_part_content_set(content_image_elm_host_,
+ "overlay", content_image_);
+
+ int x, y, width = 0, height = 0;
+ evas_object_geometry_get(parent_view, &x, &y, &width, &height);
+ if (width == 0 || height == 0)
+ width = height = 1;
+ evas_object_geometry_set(content_image_elm_host_, x, y, width, height);
+
+
+ evas_object_event_callback_add(parent_view_, EVAS_CALLBACK_RESIZE,
+ OnParentViewResize, this);
+ evas_object_event_callback_add(content_image_, EVAS_CALLBACK_RESIZE,
+ OnContentImageResize, this);
+ evas_object_event_callback_add(content_image_, EVAS_CALLBACK_FOCUS_IN,
+ OnFocusIn, this);
+ evas_object_event_callback_add(content_image_, EVAS_CALLBACK_FOCUS_OUT,
+ OnFocusOut, this);
+ evas_object_smart_callback_add(content_image_elm_host_,
+ "focused", OnHostFocusIn, this);
+ evas_object_smart_callback_add(content_image_elm_host_,
+ "unfocused", OnHostFocusOut, this);
+
+ evas_object_event_callback_add(content_image_, EVAS_CALLBACK_MOUSE_DOWN,
+ OnPointerDown, this);
+ evas_object_event_callback_add(content_image_, EVAS_CALLBACK_MOUSE_UP,
+ OnPointerUp, this);
+ evas_object_event_callback_add(content_image_, EVAS_CALLBACK_MOUSE_MOVE,
+ OnPointerMove, this);
+ evas_object_event_callback_add(content_image_, EVAS_CALLBACK_MOUSE_WHEEL,
+ OnMouseWheel, this);
+ evas_object_event_callback_add(content_image_, EVAS_CALLBACK_KEY_DOWN,
+ OnKeyDown, this);
+ evas_object_event_callback_add(content_image_, EVAS_CALLBACK_KEY_UP,
+ OnKeyUp, this);
+
+#if 0
+ // IMContext calls evas() getter on 'this' so it needs to be
+ // initialized after evas_ is valid
+ im_context_ = IMContextEfl::Create(this);
+#endif
+
+ Init_EvasGL(width, height);
+
+#if defined(OS_TIZEN_MOBILE)
+ disambiguation_popup_.reset(new DisambiguationPopupEfl(content_image_, this));
+#endif
+}
+
+RenderWidgetHostViewEfl::~RenderWidgetHostViewEfl() {
+#if 0
+ if (im_context_)
+ delete im_context_;
+#endif
+ evas_object_event_callback_del(parent_view_, EVAS_CALLBACK_RESIZE,
+ OnParentViewResize);
+ evas_object_event_callback_del(content_image_, EVAS_CALLBACK_RESIZE,
+ OnContentImageResize);
+ evas_object_event_callback_del(content_image_, EVAS_CALLBACK_FOCUS_IN,
+ OnFocusIn);
+ evas_object_event_callback_del(content_image_, EVAS_CALLBACK_FOCUS_OUT,
+ OnFocusOut);
+ evas_object_smart_callback_del(content_image_elm_host_,
+ "focused", OnHostFocusIn);
+ evas_object_smart_callback_del(content_image_elm_host_,
+ "unfocused", OnHostFocusOut);
+
+ evas_object_event_callback_del(content_image_, EVAS_CALLBACK_MOUSE_DOWN,
+ OnPointerDown);
+ evas_object_event_callback_del(content_image_, EVAS_CALLBACK_MOUSE_UP,
+ OnPointerUp);
+ evas_object_event_callback_del(content_image_, EVAS_CALLBACK_MOUSE_MOVE,
+ OnPointerMove);
+ evas_object_event_callback_del(content_image_, EVAS_CALLBACK_MOUSE_WHEEL,
+ OnMouseWheel);
+ evas_object_event_callback_del(content_image_, EVAS_CALLBACK_KEY_DOWN,
+ OnKeyDown);
+ evas_object_event_callback_del(content_image_, EVAS_CALLBACK_KEY_UP,
+ OnKeyUp);
+
+ if (content_image_) {
+ evas_object_del(content_image_);
+ content_image_ = NULL;
+ }
+}
+
+gfx::Point RenderWidgetHostViewEfl::ConvertPointInViewPix(gfx::Point point) {
+ return gfx::ToFlooredPoint(gfx::ScalePoint(point, device_scale_factor_));
+}
+
+gfx::Rect RenderWidgetHostViewEfl::GetViewBoundsInPix() const {
+ int x, y, w, h;
+ evas_object_geometry_get(content_image_, &x, &y, &w, &h);
+ return gfx::Rect(x, y, w, h);
+}
+
+static const char kVertexShaderSourceSimple[] =
+ "attribute vec4 a_position; \n"
+ "attribute vec2 a_texCoord; \n"
+ "varying vec2 v_texCoord; \n"
+ "void main() { \n"
+ " gl_Position = a_position; \n"
+ " v_texCoord = a_texCoord; \n"
+ "} \n";
+
+static const char kFragmentShaderSourceSimple[] =
+ "precision mediump float; \n"
+ "varying vec2 v_texCoord; \n"
+ "uniform sampler2D s_texture; \n"
+ "void main() { \n"
+ " gl_FragColor = texture2D( s_texture, v_texCoord );\n"
+ "} \n";
+
+#if defined(NDEBUG)
+#define GL_CHECK_HELPER(code, msg) \
+ ((code), false)
+#else
+static GLenum g_gl_err;
+#define GL_CHECK_HELPER(code, msg) \
+ (((void)(code), ((g_gl_err = evas_gl_api_->glGetError()) == GL_NO_ERROR)) ? false : \
+ ((LOG(ERROR) << "GL Error: " << g_gl_err << " " << msg), true))
+#endif
+
+#define GL_CHECK(code) GL_CHECK_HELPER(code, "")
+#define GL_CHECK_STATUS(msg) GL_CHECK_HELPER(1, msg)
+
+static void GLCheckProgramHelper(Evas_GL_API* api, GLuint program,
+ const char* file, int line) {
+ GLint status;
+ api->glGetProgramiv(program, GL_LINK_STATUS, &status);
+ if (!status) {
+ const GLsizei buf_length = 2048;
+ scoped_ptr<GLchar[]> log(new GLchar[buf_length]);
+ GLsizei length = 0;
+ api->glGetProgramInfoLog(program, buf_length, &length, log.get());
+ LOG(ERROR) << "GL program link failed in: " << file << ":" << line
+ << ": " << log.get();
+ }
+}
+
+#define GLCheckProgram(api, program) \
+ GLCheckProgramHelper(api, program, __FILE__, __LINE__)
+
+static void GLCheckShaderHelper(
+ Evas_GL_API* api, GLuint shader, const char* file, int line) {
+ GLint status;
+ api->glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
+ if (!status) {
+ const GLsizei buf_length = 2048;
+ scoped_ptr<GLchar[]> log(new GLchar[buf_length]);
+ GLsizei length = 0;
+ api->glGetShaderInfoLog(shader, buf_length, &length, log.get());
+ LOG(ERROR) << "GL shader compile failed in " << file << ":" << line
+ << ": " << log.get();
+ }
+}
+
+#define GLCheckShader(api, shader) \
+ GLCheckShaderHelper((api), (shader), __FILE__, __LINE__)
+
+void RenderWidgetHostViewEfl::initializeProgram() {
+ evas_gl_make_current(evas_gl_, evas_gl_surface_, evas_gl_context_);
+
+ GL_CHECK_STATUS("GL Error before program initialization");
+
+ const char* vertexShaderSourceProgram = kVertexShaderSourceSimple;
+ const char* fragmentShaderSourceProgram = kFragmentShaderSourceSimple;
+ GLuint vertexShader = evas_gl_api_->glCreateShader(GL_VERTEX_SHADER);
+ GL_CHECK_STATUS("vertex shader");
+ GLuint fragmentShader = evas_gl_api_->glCreateShader(GL_FRAGMENT_SHADER);
+ GL_CHECK_STATUS("fragment shader");
+
+ const GLfloat vertex_attributes[] = {
+ -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,
+ -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,
+ 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,
+ 1.0f, -1.0f, 0.0f, 1.0f, 0.0f};
+
+ GL_CHECK(evas_gl_api_->glGenBuffers(1, &vertex_buffer_obj_));
+ GL_CHECK(evas_gl_api_->glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer_obj_));
+ GL_CHECK(evas_gl_api_->glBufferData(GL_ARRAY_BUFFER,
+ sizeof(vertex_attributes),
+ vertex_attributes, GL_STATIC_DRAW));
+
+ const GLfloat vertex_attributes_270[] = {
+ -1.0f, -1.0f, 0.0f, 1.0f, 0.0f,
+ -1.0f, 1.0f, 0.0f, 0.0f, 0.0f,
+ 1.0f, 1.0f, 0.0f, 0.0f, 1.0f,
+ 1.0f, -1.0f, 0.0f, 1.0f, 1.0f};
+
+ GL_CHECK(evas_gl_api_->glGenBuffers(1, &vertex_buffer_obj_270_));
+ GL_CHECK(evas_gl_api_->glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer_obj_270_));
+ GL_CHECK(evas_gl_api_->glBufferData(GL_ARRAY_BUFFER,
+ sizeof(vertex_attributes_270),
+ vertex_attributes_270, GL_STATIC_DRAW));
+
+ const GLfloat vertex_attributes_90[] = {
+ -1.0f, -1.0f, 0.0f, 0.0f, 1.0f,
+ -1.0f, 1.0f, 0.0f, 1.0f, 1.0f,
+ 1.0f, 1.0f, 0.0f, 1.0f, 0.0f,
+ 1.0f, -1.0f, 0.0f, 0.0f, 0.0f};
+
+ GL_CHECK(evas_gl_api_->glGenBuffers(1, &vertex_buffer_obj_90_));
+ GL_CHECK(evas_gl_api_->glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer_obj_90_));
+ GL_CHECK(evas_gl_api_->glBufferData(GL_ARRAY_BUFFER,
+ sizeof(vertex_attributes_90),
+ vertex_attributes_90, GL_STATIC_DRAW));
+
+ const GLushort index_attributes[] = {0, 1, 2, 0, 2, 3};
+ GL_CHECK(evas_gl_api_->glGenBuffers(1, &index_buffer_obj_));
+ GL_CHECK(
+ evas_gl_api_->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer_obj_));
+ GL_CHECK(evas_gl_api_->glBufferData(GL_ELEMENT_ARRAY_BUFFER,
+ sizeof(index_attributes),
+ index_attributes, GL_STATIC_DRAW));
+
+ GL_CHECK(evas_gl_api_->glShaderSource(vertexShader, 1, &vertexShaderSourceProgram, 0));
+ GL_CHECK(evas_gl_api_->glShaderSource(fragmentShader, 1, &fragmentShaderSourceProgram, 0));
+ GL_CHECK(program_id_ = evas_gl_api_->glCreateProgram());
+ GL_CHECK(evas_gl_api_->glCompileShader(vertexShader));
+ GLCheckShader(evas_gl_api_, vertexShader);
+ GL_CHECK(evas_gl_api_->glCompileShader(fragmentShader));
+ GLCheckShader(evas_gl_api_, fragmentShader);
+ GL_CHECK(evas_gl_api_->glAttachShader(program_id_, vertexShader));
+ GL_CHECK(evas_gl_api_->glAttachShader(program_id_, fragmentShader));
+ GL_CHECK(evas_gl_api_->glLinkProgram(program_id_));
+ GLCheckProgram(evas_gl_api_, program_id_);
+
+ GL_CHECK(position_attrib_ = evas_gl_api_->glGetAttribLocation(program_id_, "a_position"));
+ GL_CHECK(texcoord_attrib_ = evas_gl_api_->glGetAttribLocation(program_id_, "a_texCoord"));
+ GL_CHECK(source_texture_location_ = evas_gl_api_->glGetUniformLocation (program_id_, "s_texture" ));
+}
+
+void RenderWidgetHostViewEfl::PaintTextureToSurface(GLuint texture_id) {
+ Evas_GL_API* gl_api = evasGlApi();
+ DCHECK(gl_api);
+
+ evas_gl_make_current(evas_gl_, evas_gl_surface_, evas_gl_context_);
+
+ GL_CHECK_STATUS("GL error before texture paint.");
+
+ gfx::Rect bounds = GetViewBoundsInPix();
+ GL_CHECK(gl_api->glViewport(0, 0, bounds.width(), bounds.height()));
+ GL_CHECK(gl_api->glClearColor(1.0, 1.0, 1.0, 1.0));
+ GL_CHECK(gl_api->glClear(GL_COLOR_BUFFER_BIT));
+ GL_CHECK(gl_api->glUseProgram(program_id_));
+
+ current_orientation_ = ecore_evas_rotation_get(ecore_evas_ecore_evas_get(evas_));
+
+ switch (current_orientation_) {
+ case 270:
+ GL_CHECK(gl_api->glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer_obj_270_));
+ break;
+ case 90:
+ GL_CHECK(gl_api->glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer_obj_90_));
+ break;
+ default:
+ GL_CHECK(gl_api->glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer_obj_));
+ } // switch(current_orientation_)
+
+ GL_CHECK(gl_api->glEnableVertexAttribArray(position_attrib_));
+ // Below 5 * sizeof(GLfloat) value specifies the size of a vertex
+ // attribute (x, y, z, u, v).
+ GL_CHECK(gl_api->glVertexAttribPointer(position_attrib_, 3, GL_FLOAT,
+ GL_FALSE, 5 * sizeof(GLfloat), NULL));
+ GL_CHECK(gl_api->glEnableVertexAttribArray(texcoord_attrib_));
+ // Below 3 * sizeof(GLfloat) value specifies the location of texture
+ // coordinate in the vertex.
+ GL_CHECK(gl_api->glVertexAttribPointer(texcoord_attrib_, 2, GL_FLOAT,
+ GL_FALSE, 5 * sizeof(GLfloat),
+ (void*)(3 * sizeof(GLfloat))));
+ GL_CHECK(gl_api->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer_obj_));
+
+ GL_CHECK(gl_api->glActiveTexture(GL_TEXTURE0));
+ GL_CHECK(gl_api->glBindTexture(GL_TEXTURE_2D, texture_id));
+ GL_CHECK(gl_api->glUniform1i(source_texture_location_, 0));
+ GL_CHECK(gl_api->glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, NULL));
+
+ GL_CHECK(gl_api->glBindTexture(GL_TEXTURE_2D, 0));
+ evas_gl_make_current(evas_gl_, 0, 0);
+}
+
+void RenderWidgetHostViewEfl::EvasObjectImagePixelsGetCallback(void* data, Evas_Object* obj) {
+ RenderWidgetHostViewEfl* rwhv_efl = reinterpret_cast<RenderWidgetHostViewEfl*>(data);
+ if (rwhv_efl->texture_id_)
+ rwhv_efl->PaintTextureToSurface(rwhv_efl->texture_id_);
+}
+
+void RenderWidgetHostViewEfl::Init_EvasGL(int width, int height) {
+ CHECK(width > 0 && height > 0);
+
+ setenv("EVAS_GL_DIRECT_OVERRIDE", "1", 1);
+ setenv("EVAS_GL_DIRECT_MEM_OPT", "1",1);
+
+ evas_gl_config_ = evas_gl_config_new();
+ evas_gl_config_->options_bits = EVAS_GL_OPTIONS_DIRECT;
+ evas_gl_config_->color_format = EVAS_GL_RGBA_8888;
+ evas_gl_config_->depth_bits = EVAS_GL_DEPTH_BIT_24;
+ evas_gl_config_->stencil_bits = EVAS_GL_STENCIL_BIT_8;
+
+ evas_gl_ = evas_gl_new(evas_);
+ evas_gl_api_ = evas_gl_api_get(evas_gl_);
+ evas_gl_context_ = evas_gl_context_create(
+ evas_gl_, GLSharedContextEfl::GetEvasGLContext());
+ if (!evas_gl_context_)
+ LOG(FATAL) << "Failed to create evas gl context";
+
+ if (width > MAX_SURFACE_WIDTH_EGL)
+ width = MAX_SURFACE_WIDTH_EGL;
+
+ if (height > MAX_SURFACE_HEIGHT_EGL)
+ height = MAX_SURFACE_HEIGHT_EGL;
+
+ evas_gl_surface_ = evas_gl_surface_create(evas_gl_, evas_gl_config_, width, height);
+ if (!evas_gl_surface_)
+ LOG(FATAL) << "Failed to create evas gl surface";
+
+ Evas_Native_Surface nativeSurface;
+ if (evas_gl_native_surface_get(evas_gl_, evas_gl_surface_, &nativeSurface)) {
+ evas_object_image_native_surface_set(content_image_, &nativeSurface);
+ evas_object_image_pixels_get_callback_set(content_image_, EvasObjectImagePixelsGetCallback, this);
+ } else {
+ LOG(FATAL) << "Failed to get natvie surface";
+ }
+
+ initializeProgram();
+
+ evas_gl_initialized_ = true;
+}
+
+bool RenderWidgetHostViewEfl::OnMessageReceived(const IPC::Message& message) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewEfl, message)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, OnTextInputStateChanged)
+#if 0 //defined(OS_TIZEN)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_SnapshotDataReceived, OnSnapshot)
+#endif
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
+
+bool RenderWidgetHostViewEfl::Send(IPC::Message* message) {
+ return host_->Send(message);
+}
+
+void RenderWidgetHostViewEfl::InitAsChild(gfx::NativeView parent_view) {
+ NOTIMPLEMENTED();
+}
+
+void RenderWidgetHostViewEfl::InitAsPopup(RenderWidgetHostView*, const gfx::Rect&) {
+ NOTIMPLEMENTED();
+}
+
+void RenderWidgetHostViewEfl::InitAsFullscreen(RenderWidgetHostView*) {
+ NOTIMPLEMENTED();
+}
+
+RenderWidgetHost* RenderWidgetHostViewEfl::GetRenderWidgetHost() const {
+ return host_;
+}
+
+Ecore_X_Window RenderWidgetHostViewEfl::GetEcoreXWindow() const {
+ Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_);
+ return ecore_evas_gl_x11_window_get(ee);
+}
+
+void RenderWidgetHostViewEfl::SetSize(const gfx::Size& size) {
+ // This is a hack. See WebContentsView::SizeContents
+ int width = std::min(size.width(), EFL_MAX_WIDTH);
+ int height = std::min(size.height(), EFL_MAX_HEIGHT);
+ if (popup_type_ != blink::WebPopupTypeNone) {
+ // We're a popup, honor the size request.
+ ecore_x_window_resize(GetEcoreXWindow(), width, height);
+ }
+
+ // Update the size of the RWH.
+ //if (requested_size_.width() != width ||
+ // requested_size_.height() != height) {
+ // Disabled for now, will enable it while implementing InitAsPopUp (P1) API
+ //equested_size_ = gfx::Size(width, height);
+ host_->SendScreenRects();
+ host_->WasResized();
+ //}
+}
+
+void RenderWidgetHostViewEfl::SetBounds(const gfx::Rect& rect) {
+ // FIXME: ditto.
+ NOTIMPLEMENTED();
+}
+
+gfx::Vector2dF RenderWidgetHostViewEfl::GetLastScrollOffset() const {
+ // FIXME: Aura RWHV sets last_scroll_offset_ in OnSwapCompositorFrame()
+ // Other ways to get scroll offset are already removed.
+ // We need to switch to the ui::Compositor ASAP!
+ return last_scroll_offset_;
+}
+
+gfx::NativeView RenderWidgetHostViewEfl::GetNativeView() const {
+ return content_image_elm_host_;
+}
+
+void RenderWidgetHostViewEfl::OnSnapshot(const std::vector<unsigned char> pixData, int snapshotId, const gfx::Size& size) {
+ NOTIMPLEMENTED();
+#if 0
+ Evas_Object* image = evas_object_image_filled_add(evas_);
+ evas_object_image_size_set(image, size.width(), size.height());
+ evas_object_image_data_copy_set(image, const_cast<unsigned char*>(&pixData[0]));
+ web_view_->FindAndRunSnapshotCallback(image, snapshotId);
+#endif
+}
+
+gfx::NativeViewId RenderWidgetHostViewEfl::GetNativeViewId() const {
+ DCHECK(evas_gl_initialized_);
+ Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_);
+ return ecore_evas_window_get(ee);
+}
+
+gfx::NativeViewAccessible RenderWidgetHostViewEfl::GetNativeViewAccessible() {
+ NOTIMPLEMENTED();
+ return 0;
+}
+
+bool RenderWidgetHostViewEfl::IsSurfaceAvailableForCopy() const {
+ return false;
+}
+
+void RenderWidgetHostViewEfl::Show() {
+ evas_object_show(content_image_elm_host_);
+}
+
+void RenderWidgetHostViewEfl::Hide() {
+ evas_object_hide(content_image_elm_host_);
+}
+
+bool RenderWidgetHostViewEfl::IsShowing() {
+ return evas_object_visible_get(content_image_);
+}
+
+gfx::Rect RenderWidgetHostViewEfl::GetViewBounds() const {
+ return content::ConvertRectToDIP(device_scale_factor_, GetViewBoundsInPix());
+}
+
+bool RenderWidgetHostViewEfl::LockMouse() {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+void RenderWidgetHostViewEfl::UnlockMouse() {
+ NOTIMPLEMENTED();
+}
+
+void RenderWidgetHostViewEfl::WasShown() {
+ DCHECK(host_);
+ if (!host_->is_hidden())
+ return;
+ host_->WasShown(ui::LatencyInfo());
+}
+
+void RenderWidgetHostViewEfl::WasHidden() {
+ if (!host_ || host_->is_hidden())
+ return;
+ host_->WasHidden();
+}
+
+void RenderWidgetHostViewEfl::Focus() {
+ elm_object_focus_set(content_image_elm_host_, EINA_TRUE);
+ evas_object_focus_set(content_image_, EINA_TRUE);
+}
+
+void RenderWidgetHostViewEfl::Blur() {
+ elm_object_focus_set(content_image_elm_host_, EINA_FALSE);
+ evas_object_focus_set(content_image_, EINA_FALSE);
+}
+
+bool RenderWidgetHostViewEfl::HasFocus() const {
+ return evas_object_focus_get(content_image_);
+}
+
+void RenderWidgetHostViewEfl::MovePluginContainer(const WebPluginGeometry& move) {
+ Ecore_X_Window surface_window = 0;
+ PluginWindowToWidgetMap::const_iterator i = plugin_window_to_widget_map_.find(move.window);
+
+ if (i != plugin_window_to_widget_map_.end())
+ surface_window = i->second;
+
+ if (!surface_window)
+ return;
+
+ if (!move.visible) {
+ ecore_x_window_hide(surface_window);
+ return;
+ }
+
+ ecore_x_window_show(surface_window);
+
+ if (!move.rects_valid)
+ return;
+
+ ecore_x_window_move(surface_window, move.window_rect.x(), move.window_rect.y());
+ ecore_x_window_resize(surface_window, move.window_rect.width(), move.window_rect.height());
+}
+
+void RenderWidgetHostViewEfl::MovePluginWindows(
+ const std::vector<WebPluginGeometry>& moves) {
+ for (size_t i = 0; i < moves.size(); i++)
+ MovePluginContainer(moves[i]);
+}
+
+void RenderWidgetHostViewEfl::UpdateCursor(const WebCursor& webcursor) {
+ if (is_loading_) {
+ // Setting native Loading cursor
+ ecore_x_window_cursor_set(GetEcoreXWindow(), ecore_x_cursor_shape_get(ECORE_X_CURSOR_CLOCK));
+ } else {
+ WebCursor::CursorInfo cursor_info;
+ webcursor.GetCursorInfo(&cursor_info);
+
+ int cursor_type = GetCursorType(cursor_info.type);
+ ecore_x_window_cursor_set(GetEcoreXWindow(), ecore_x_cursor_shape_get(cursor_type));
+ }
+ // Need to check for cursor visibility
+ //ecore_x_window_cursor_show(GetEcoreXWindow(), true);
+
+}
+
+void RenderWidgetHostViewEfl::SetIsLoading(bool is_loading) {
+ is_loading_ = is_loading;
+ UpdateCursor(WebCursor());
+ if (disambiguation_popup_)
+ disambiguation_popup_->Dismiss();
+}
+
+void RenderWidgetHostViewEfl::TextInputTypeChanged(ui::TextInputType type,
+ ui::TextInputMode input_mode,
+ bool can_compose_inline,
+ int flags) {
+#if 0
+ if (GetSelectionController()) {
+ GetSelectionController()->SetSelectionEditable(
+ type != ui::TEXT_INPUT_TYPE_NONE);
+ }
+#endif
+}
+
+void RenderWidgetHostViewEfl::OnTextInputStateChanged(
+ const ViewHostMsg_TextInputState_Params& params) {
+#if 0
+ if (!params.show_ime_if_needed && !eweb_view()->GetSettings()->useKeyPadWithoutUserAction())
+ return;
+
+ if (im_context_) {
+ im_context_->UpdateInputMethodState(params.type, params.can_compose_inline,
+ params.show_ime_if_needed);
+
+ // The empty rect is not used as long as
+ // m_autoZoomFocusedNodeToLegibleScale in WebSettingsImpl
+ // is turned on
+ host_->ScrollFocusedEditableNodeIntoRect(gfx::Rect(0, 0, 0, 0));
+ }
+
+ if (GetSelectionController()) {
+ GetSelectionController()->SetSelectionEditable(
+ params.type != ui::TEXT_INPUT_TYPE_NONE);
+ }
+#endif
+}
+
+void RenderWidgetHostViewEfl::ImeCancelComposition() {
+#if 0
+ if (im_context_)
+ im_context_->CancelComposition();
+#endif
+}
+
+void RenderWidgetHostViewEfl::ImeCompositionRangeChanged(
+ const gfx::Range& range,
+ const std::vector<gfx::Rect>& character_bounds) {
+ NOTIMPLEMENTED();
+#if 0
+ if (web_view_) {
+ SelectionControllerEfl* controller = web_view_->GetSelectionController();
+ if (controller) {
+ controller->SetCaretSelectionStatus(false);
+ controller->HideHandleAndContextMenu();
+ }
+ }
+#endif
+}
+
+void RenderWidgetHostViewEfl::FocusedNodeChanged(bool is_editable_node) {
+#if 0
+ if (web_view_) {
+ SelectionControllerEfl* controller = web_view_->GetSelectionController();
+ if (controller) {
+ controller->SetCaretSelectionStatus(false);
+ controller->HideHandleAndContextMenu();
+ }
+ if (im_context_ && im_context_->IsShow() &&
+ ClipboardHelperEfl::GetInstance()->IsClipboardWindowOpened()) {
+ ClipboardHelperEfl::GetInstance()->CloseClipboardWindow();
+ }
+ }
+#endif
+}
+
+void RenderWidgetHostViewEfl::Destroy() {
+ delete this;
+}
+
+void RenderWidgetHostViewEfl::SetTooltipText(const base::string16& text) {
+}
+
+void RenderWidgetHostViewEfl::SelectionChanged(const base::string16& text,
+ size_t offset,
+ const gfx::Range& range) {
+ NOTIMPLEMENTED();
+#if 0
+ RenderWidgetHostViewBase::SelectionChanged(text, offset, range);
+
+ if (!web_view_)
+ return;
+
+ SelectionControllerEfl* controller = web_view_->GetSelectionController();
+ if (!controller)
+ return;
+
+ base::string16 selectedText;
+ if (!text.empty() && !range.is_empty())
+ selectedText = GetSelectedText();
+
+ controller->UpdateSelectionData(selectedText);
+#endif
+}
+
+void RenderWidgetHostViewEfl::SelectionBoundsChanged(
+ const ViewHostMsg_SelectionBounds_Params& params) {
+#if 0
+ ViewHostMsg_SelectionBounds_Params guest_params(params);
+ guest_params.anchor_rect = ConvertRectToPixel(device_scale_factor_, params.anchor_rect);
+ guest_params.focus_rect = ConvertRectToPixel(device_scale_factor_, params.focus_rect);
+
+ if (im_context_)
+ im_context_->UpdateCaretBounds(gfx::UnionRects(guest_params.anchor_rect, guest_params.focus_rect));
+
+ if (GetSelectionController()) {
+ GetSelectionController()->UpdateSelectionDataAndShow(
+ guest_params.anchor_rect,
+ guest_params.focus_rect,
+ guest_params.is_anchor_first,
+ false);
+ }
+#endif
+}
+
+void RenderWidgetHostViewEfl::DidStopFlinging() {
+#if 0
+#if defined(TIZEN_EDGE_EFFECT)
+ if (web_view_)
+ web_view_->edgeEffect()->hide();
+#endif
+
+ SelectionControllerEfl* controller = GetSelectionController();
+ if (!controller)
+ return;
+
+ // Unhide Selection UI when scrolling with fling gesture
+ if (controller->GetScrollStatus())
+ controller->SetScrollStatus(false);
+
+ controller->UpdateSelectionDataAndShow(
+ controller->GetLeftRect(),
+ controller->GetRightRect(),
+ false,
+ false);
+#endif
+}
+
+void RenderWidgetHostViewEfl::ShowDisambiguationPopup(const gfx::Rect& rect_pixels, const SkBitmap& zoomed_bitmap) {
+ if (disambiguation_popup_)
+ disambiguation_popup_->Show(rect_pixels, zoomed_bitmap);
+}
+
+bool RenderWidgetHostViewEfl::CanDispatchToConsumer(ui::GestureConsumer* consumer) {
+ return this == consumer;
+}
+
+void RenderWidgetHostViewEfl::DispatchCancelTouchEvent(ui::TouchEvent* event) {
+}
+
+void RenderWidgetHostViewEfl::DispatchGestureEvent(ui::GestureEvent* event) {
+ HandleGesture(event);
+}
+
+void RenderWidgetHostViewEfl::CopyFromCompositingSurface(
+ const gfx::Rect& src_subrect,
+ const gfx::Size& /* dst_size */,
+ const base::Callback<void(bool, const SkBitmap&)>&,
+ const SkColorType color_type) {
+ NOTIMPLEMENTED();
+}
+
+// CopyFromCompositingSurfaceToVideoFrame implementation borrowed from Aura port
+bool RenderWidgetHostViewEfl::CanSubscribeFrame() const {
+ return true;
+}
+
+void RenderWidgetHostViewEfl::BeginFrameSubscription(
+ scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) {
+ frame_subscriber_ = subscriber.Pass();
+}
+
+void RenderWidgetHostViewEfl::EndFrameSubscription() {
+ idle_frame_subscriber_textures_.clear();
+ frame_subscriber_.reset();
+}
+
+#ifdef TIZEN_EDGE_EFFECT
+void RenderWidgetHostViewEfl::DidOverscroll(const DidOverscrollParams& params) {
+ if (web_view_) {
+ const gfx::Vector2dF& accumulated_overscroll = params.accumulated_overscroll;
+ const gfx::Vector2dF& latest_overscroll_delta = params.latest_overscroll_delta;
+
+ if (latest_overscroll_delta.x() < 0 && (int)accumulated_overscroll.x() < 0)
+ web_view_->edgeEffect()->show("edge,left");
+ if (latest_overscroll_delta.x() > 0 && (int)accumulated_overscroll.x() > 0)
+ web_view_->edgeEffect()->show("edge,right");
+ if (latest_overscroll_delta.y() < 0 && (int)accumulated_overscroll.y() < 0)
+ web_view_->edgeEffect()->show("edge,top");
+ if (latest_overscroll_delta.y() > 0 && (int)accumulated_overscroll.y() > 0)
+ web_view_->edgeEffect()->show("edge,bottom");
+ }
+}
+#endif
+
+void RenderWidgetHostViewEfl::ReturnSubscriberTexture(
+ base::WeakPtr<RenderWidgetHostViewEfl> rwhvefl,
+ scoped_refptr<OwnedMailbox> subscriber_texture,
+ uint32 sync_point) {
+ if (!subscriber_texture.get())
+ return;
+ if (!rwhvefl)
+ return;
+ DCHECK_NE(
+ rwhvefl->active_frame_subscriber_textures_.count(subscriber_texture.get()),
+ 0u);
+
+ subscriber_texture->UpdateSyncPoint(sync_point);
+
+ rwhvefl->active_frame_subscriber_textures_.erase(subscriber_texture.get());
+ if (rwhvefl->frame_subscriber_ && subscriber_texture->texture_id())
+ rwhvefl->idle_frame_subscriber_textures_.push_back(subscriber_texture);
+}
+
+void RenderWidgetHostViewEfl::CopyFromCompositingSurfaceFinishedForVideo(
+ base::WeakPtr<RenderWidgetHostViewEfl> rwhvefl,
+ const base::Callback<void(bool)>& callback,
+ scoped_refptr<OwnedMailbox> subscriber_texture,
+ scoped_ptr<cc::SingleReleaseCallback> release_callback,
+ bool result) {
+ callback.Run(result);
+
+ GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper();
+ uint32 sync_point = gl_helper ? gl_helper->InsertSyncPoint() : 0;
+ if (release_callback) {
+ // A release callback means the texture came from the compositor, so there
+ // should be no |subscriber_texture|.
+ DCHECK(!subscriber_texture.get());
+ release_callback->Run(sync_point, false);
+ }
+ ReturnSubscriberTexture(rwhvefl, subscriber_texture, sync_point);
+}
+
+void RenderWidgetHostViewEfl::CopyFromCompositingSurfaceHasResultForVideo(
+ base::WeakPtr<RenderWidgetHostViewEfl> rwhvefl,
+ scoped_refptr<OwnedMailbox> subscriber_texture,
+ scoped_refptr<media::VideoFrame> video_frame,
+ const base::Callback<void(bool)>& callback,
+ scoped_ptr<cc::CopyOutputResult> result) {
+ base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false));
+ base::ScopedClosureRunner scoped_return_subscriber_texture(
+ base::Bind(&ReturnSubscriberTexture, rwhvefl, subscriber_texture, 0));
+
+ if (!rwhvefl)
+ return;
+ if (result->IsEmpty())
+ return;
+ if (result->size().IsEmpty())
+ return;
+
+ // Compute the dest size we want after the letterboxing resize. Make the
+ // coordinates and sizes even because we letterbox in YUV space
+ // (see CopyRGBToVideoFrame). They need to be even for the UV samples to
+ // line up correctly.
+ // The video frame's coded_size() and the result's size() are both physical
+ // pixels.
+ gfx::Rect region_in_frame =
+ media::ComputeLetterboxRegion(gfx::Rect(video_frame->coded_size()),
+ result->size());
+ region_in_frame = gfx::Rect(region_in_frame.x() & ~1,
+ region_in_frame.y() & ~1,
+ region_in_frame.width() & ~1,
+ region_in_frame.height() & ~1);
+ if (region_in_frame.IsEmpty())
+ return;
+
+ if (!result->HasTexture()) {
+ DCHECK(result->HasBitmap());
+ scoped_ptr<SkBitmap> bitmap = result->TakeBitmap();
+ // Scale the bitmap to the required size, if necessary.
+ SkBitmap scaled_bitmap;
+ if (result->size().width() != region_in_frame.width() ||
+ result->size().height() != region_in_frame.height()) {
+ skia::ImageOperations::ResizeMethod method =
+ skia::ImageOperations::RESIZE_GOOD;
+ scaled_bitmap = skia::ImageOperations::Resize(*bitmap.get(), method,
+ region_in_frame.width(),
+ region_in_frame.height());
+ } else {
+ scaled_bitmap = *bitmap.get();
+ }
+
+ {
+ SkAutoLockPixels scaled_bitmap_locker(scaled_bitmap);
+
+ media::CopyRGBToVideoFrame(
+ reinterpret_cast<uint8*>(scaled_bitmap.getPixels()),
+ scaled_bitmap.rowBytes(),
+ region_in_frame,
+ video_frame.get());
+ }
+ ignore_result(scoped_callback_runner.Release());
+ callback.Run(true);
+ return;
+ }
+
+ ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
+ GLHelper* gl_helper = factory->GetGLHelper();
+ if (!gl_helper)
+ return;
+ if (subscriber_texture.get() && !subscriber_texture->texture_id())
+ return;
+
+ cc::TextureMailbox texture_mailbox;
+ scoped_ptr<cc::SingleReleaseCallback> release_callback;
+ result->TakeTexture(&texture_mailbox, &release_callback);
+ DCHECK(texture_mailbox.IsTexture());
+ if (!texture_mailbox.IsTexture())
+ return;
+
+ gfx::Rect result_rect(result->size());
+
+ content::ReadbackYUVInterface* yuv_readback_pipeline =
+ rwhvefl->yuv_readback_pipeline_.get();
+ if (yuv_readback_pipeline == NULL ||
+ yuv_readback_pipeline->scaler()->SrcSize() != result_rect.size() ||
+ yuv_readback_pipeline->scaler()->SrcSubrect() != result_rect ||
+ yuv_readback_pipeline->scaler()->DstSize() != region_in_frame.size()) {
+ GLHelper::ScalerQuality quality = GLHelper::SCALER_QUALITY_FAST;
+ std::string quality_switch = switches::kTabCaptureDownscaleQuality;
+ // If we're scaling up, we can use the "best" quality.
+ if (result_rect.size().width() < region_in_frame.size().width() &&
+ result_rect.size().height() < region_in_frame.size().height())
+ quality_switch = switches::kTabCaptureUpscaleQuality;
+
+ std::string switch_value =
+ base::CommandLine::ForCurrentProcess()->
+ GetSwitchValueASCII(quality_switch);
+ if (switch_value == "fast")
+ quality = GLHelper::SCALER_QUALITY_FAST;
+ else if (switch_value == "good")
+ quality = GLHelper::SCALER_QUALITY_GOOD;
+ else if (switch_value == "best")
+ quality = GLHelper::SCALER_QUALITY_BEST;
+
+ rwhvefl->yuv_readback_pipeline_.reset(
+ gl_helper->CreateReadbackPipelineYUV(quality,
+ result_rect.size(),
+ result_rect,
+ video_frame->coded_size(),
+ region_in_frame,
+ true,
+ true));
+ yuv_readback_pipeline = rwhvefl->yuv_readback_pipeline_.get();
+ }
+
+ ignore_result(scoped_callback_runner.Release());
+ ignore_result(scoped_return_subscriber_texture.Release());
+ base::Callback<void(bool result)> finished_callback = base::Bind(
+ &RenderWidgetHostViewEfl::CopyFromCompositingSurfaceFinishedForVideo,
+ rwhvefl->AsWeakPtr(),
+ callback,
+ subscriber_texture,
+ base::Passed(&release_callback));
+ yuv_readback_pipeline->ReadbackYUV(
+ texture_mailbox.mailbox(),
+ texture_mailbox.sync_point(),
+ video_frame,
+ finished_callback);
+}
+
+// Efl port - Implementation done, will enable this function after getting video test site to verify
+void RenderWidgetHostViewEfl::CopyFromCompositingSurfaceToVideoFrame(
+ const gfx::Rect& src_subrect,
+ const scoped_refptr<media::VideoFrame>& target,
+ const base::Callback<void(bool)>& callback) {
+ NOTIMPLEMENTED();
+ callback.Run(false);
+}
+
+bool RenderWidgetHostViewEfl::CanCopyToVideoFrame() const {
+ return false;
+}
+
+void RenderWidgetHostViewEfl::AcceleratedSurfaceInitialized(int route_id) {
+ // FIXME: new API in M34. need proper implementation.
+ NOTIMPLEMENTED();
+}
+
+// Defined in gl_current_context_efl.cc because of conflicts of
+// texture_manager.h with efl GL API wrappers.
+
+extern GLuint GetTextureIdFromTexture(gpu::gles2::Texture* texture);
+
+bool RenderWidgetHostViewEfl::HasAcceleratedSurface(const gfx::Size&) {
+ return false;
+}
+
+void RenderWidgetHostViewEfl::GetScreenInfo(
+ blink::WebScreenInfo* results) {
+ RenderWidgetHostViewBase::GetDefaultScreenInfo(results);
+}
+
+gfx::Rect RenderWidgetHostViewEfl::GetBoundsInRootWindow() {
+ Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_);
+ int x, y, w, h;
+ ecore_evas_geometry_get(ee, &x, &y, &w, &h);
+ if (current_orientation_ == 90 || current_orientation_ == 270)
+ return content::ConvertRectToDIP(device_scale_factor_, gfx::Rect(x, y, h, w));
+
+ return content::ConvertRectToDIP(device_scale_factor_, gfx::Rect(x, y, w, h));
+}
+
+gfx::GLSurfaceHandle RenderWidgetHostViewEfl::GetCompositingSurface() {
+ return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::NULL_TRANSPORT);
+}
+
+void RenderWidgetHostViewEfl::ResizeCompositingSurface(const gfx::Size& size) {
+#if 0
+ if (web_view_)
+ web_view_->DidChangeContentsArea(size.width(), size.height());
+#endif
+}
+
+void RenderWidgetHostViewEfl::RenderProcessGone(base::TerminationStatus, int error_code) {
+ Destroy();
+}
+
+void RenderWidgetHostViewEfl::OnContentImageResize(
+ void* data, Evas*, Evas_Object*, void*) {
+ RenderWidgetHostViewEfl* thiz = static_cast<RenderWidgetHostViewEfl*>(data);
+ thiz->host_->WasResized();
+}
+
+void RenderWidgetHostViewEfl::OnParentViewResize(
+ void* data, Evas*, Evas_Object* obj, void*) {
+ RenderWidgetHostViewEfl* thiz = static_cast<RenderWidgetHostViewEfl*>(data);
+ int x, y, width, height;
+ evas_object_geometry_get(obj, &x, &y, &width, &height);
+ evas_object_geometry_set(thiz->content_image_elm_host_, x, y, width, height);
+ evas_object_image_size_set(thiz->content_image_, width, height);
+}
+
+void RenderWidgetHostViewEfl::OnFocusIn(
+ void* data, Evas*, Evas_Object*, void*) {
+ RenderWidgetHostViewEfl* thiz = static_cast<RenderWidgetHostViewEfl*>(data);
+ thiz->host_->SetActive(true);
+ thiz->host_->GotFocus();
+}
+
+void RenderWidgetHostViewEfl::OnFocusOut(
+ void* data, Evas*, Evas_Object*, void*) {
+ RenderWidgetHostViewEfl* thiz = static_cast<RenderWidgetHostViewEfl*>(data);
+ thiz->host_->SetActive(false);
+ thiz->host_->LostCapture();
+}
+
+void RenderWidgetHostViewEfl::OnHostFocusIn(
+ void* data, Evas_Object*, void*) {
+ RenderWidgetHostViewEfl* thiz = static_cast<RenderWidgetHostViewEfl*>(data);
+ thiz->Focus();
+}
+
+void RenderWidgetHostViewEfl::OnHostFocusOut(
+ void* data, Evas_Object*, void*) {
+ RenderWidgetHostViewEfl* thiz = static_cast<RenderWidgetHostViewEfl*>(data);
+ thiz->Blur();
+}
+
+void RenderWidgetHostViewEfl::OnPointerDown(
+ void* data, Evas* evas, Evas_Object* obj, void* event_info) {
+ RenderWidgetHostViewEfl* rwhv = static_cast<RenderWidgetHostViewEfl*>(data);
+
+ rwhv->Focus();
+
+ if (!rwhv->touch_events_enabled_) {
+ blink::WebMouseEvent event = MakeWebMouseEvent(
+ blink::WebInputEvent::MouseDown, obj,
+ static_cast<Evas_Event_Mouse_Down*>(event_info));
+ rwhv->host_->ForwardMouseEvent(event);
+ } else {
+ rwhv->ProcessTouchEvents();
+ }
+}
+
+void RenderWidgetHostViewEfl::OnPointerUp(
+ void* data, Evas* evas, Evas_Object* obj, void* event_info) {
+ RenderWidgetHostViewEfl* rwhv = static_cast<RenderWidgetHostViewEfl*>(data);
+
+ if (!rwhv->touch_events_enabled_) {
+ blink::WebMouseEvent event = MakeWebMouseEvent(
+ blink::WebInputEvent::MouseUp, obj,
+ static_cast<Evas_Event_Mouse_Up*>(event_info));
+ rwhv->host_->ForwardMouseEvent(event);
+ } else {
+ rwhv->ProcessTouchEvents();
+ }
+}
+
+void RenderWidgetHostViewEfl::OnPointerMove(
+ void* data, Evas* evas, Evas_Object* obj, void* event_info) {
+ RenderWidgetHostViewEfl* rwhv = static_cast<RenderWidgetHostViewEfl*>(data);
+
+ if (!rwhv->touch_events_enabled_) {
+ blink::WebMouseEvent event = MakeWebMouseEvent(obj,
+ static_cast<Evas_Event_Mouse_Move*>(event_info));
+ rwhv->host_->ForwardMouseEvent(event);
+ } else {
+ rwhv->ProcessTouchEvents();
+ }
+}
+
+void RenderWidgetHostViewEfl::OnKeyDown(
+ void* data, Evas* evas, Evas_Object* obj, void* event_info) {
+ RenderWidgetHostViewEfl* rwhv = static_cast<RenderWidgetHostViewEfl*>(data);
+ rwhv->host_->ForwardKeyboardEvent(MakeWebKeyboardEvent(
+ true, static_cast<Evas_Event_Key_Down*>(event_info)));
+}
+
+void RenderWidgetHostViewEfl::OnKeyUp(
+ void* data, Evas* evas, Evas_Object* obj, void* event_info) {
+ RenderWidgetHostViewEfl* rwhv = static_cast<RenderWidgetHostViewEfl*>(data);
+ rwhv->host_->ForwardKeyboardEvent(MakeWebKeyboardEvent(
+ false, static_cast<Evas_Event_Key_Up*>(event_info)));
+}
+
+void RenderWidgetHostViewEfl::OnMouseWheel(
+ void* data, Evas* evas, Evas_Object* obj, void* event_info) {
+ RenderWidgetHostViewEfl* rwhv = static_cast<RenderWidgetHostViewEfl*>(data);
+
+ if (!rwhv->touch_events_enabled_) {
+ blink::WebMouseWheelEvent event = MakeWebMouseEvent(
+ obj, static_cast<Evas_Event_Mouse_Wheel*>(event_info));
+ rwhv->host_->ForwardWheelEvent(event);
+ }
+}
+
+void RenderWidgetHostViewEfl::ProcessTouchEvents() {
+ // These constants are used to map multi touch's touch id(s).
+ // The poorly-written Tizen API document says:
+ // "0 for Mouse Event and device id for Multi Event."
+ // "The point which comes from Mouse Event has id 0 and"
+ // "The point which comes from Multi Event has id that is same as Multi Event's device id."
+ // This constant is to map touch id 0 to 0, or [0] -> [0]
+ static const int kMultiTouchIDMapPart0SingleIndex = 0;
+ // This constant is to map [13, 23] -> [1, 11]
+ static const int kMultiTouchIDMapPart1StartIndex = 13;
+ // This constant is to map [13, 23] -> [1, 11]
+ static const int kMultiTouchIDMapPart1EndIndex = 23;
+ // 13 - 1 = 12, 23 - 11 = 12
+ static const int kMultiTouchIDMapPart1DiffValue = 12;
+
+ unsigned count = evas_touch_point_list_count(evas_);
+ if (!count) {
+ return;
+ }
+
+ int id;
+ Evas_Coord_Point pt;
+ Evas_Touch_Point_State state;
+ for (unsigned i = 0; i < count; ++i) {
+ // evas_touch_point_list_nth_id_get returns [0] or [13, )
+ // Multi touch's touch id [[0], [13, 23]] should be mapped to [[0], [1, 11]]
+ // Internet Blame URL:
+ // https://groups.google.com/d/msg/mailing-enlightenment-devel/-R-ezCzpkTk/HJ0KBCdz6CgJ
+ id = evas_touch_point_list_nth_id_get(evas_, i);
+ DCHECK(id == kMultiTouchIDMapPart0SingleIndex ||
+ id >= kMultiTouchIDMapPart1StartIndex);
+
+ if (id >= kMultiTouchIDMapPart1StartIndex &&
+ id <= kMultiTouchIDMapPart1EndIndex) {
+ id -= kMultiTouchIDMapPart1DiffValue;
+ } else if (id > kMultiTouchIDMapPart1EndIndex) {
+ LOG(WARNING) << "evas_touch_point_list_nth_id_get() returned a value "
+ "greater than (" << kMultiTouchIDMapPart1EndIndex << ").";
+ }
+ evas_touch_point_list_nth_xy_get(evas_, i, &pt.x, &pt.y);
+ state = evas_touch_point_list_nth_state_get(evas_, i);
+
+ ui::TouchEvent touch_event = MakeTouchEvent(pt, state, id, content_image_);
+ HandleTouchEvent(&touch_event);
+ }
+
+#if 0 //defined(OS_TIZEN)
+ if (count >= 2) {
+ state = evas_touch_point_list_nth_state_get(evas_, 0);
+ if (state == EVAS_TOUCH_POINT_DOWN) {
+ wkext_motion_tilt_start(content_image_, &pt);
+ } else if (state == EVAS_TOUCH_POINT_UP) {
+ wkext_motion_tilt_stop();
+ }
+ }
+#endif
+}
+
+void RenderWidgetHostViewEfl::set_magnifier(bool status) {
+ magnifier_ = status;
+}
+
+void RenderWidgetHostViewEfl::FilterInputMotion(const blink::WebGestureEvent& gesture_event) {
+#if 0 //defined(OS_TIZEN)
+ if (gesture_event.type == blink::WebInputEvent::GesturePinchUpdate) {
+ Evas_Coord_Point position;
+
+ position.x = gesture_event.x;
+ position.y = gesture_event.y;
+ wkext_motion_tilt_position_update(&position);
+ }
+#endif
+}
+
+ui::LatencyInfo CreateLatencyInfo(const blink::WebInputEvent& event) {
+ ui::LatencyInfo latency_info;
+ // The latency number should only be added if the timestamp is valid.
+ if (event.timeStampSeconds) {
+ const int64 time_micros = static_cast<int64>(
+ event.timeStampSeconds * base::Time::kMicrosecondsPerSecond);
+ latency_info.AddLatencyNumberWithTimestamp(
+ ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
+ 0,
+ 0,
+ base::TimeTicks() + base::TimeDelta::FromMicroseconds(time_micros),
+ 1);
+ }
+ return latency_info;
+}
+
+void RenderWidgetHostViewEfl::SendGestureEvent(
+ blink::WebGestureEvent& event) {
+ HandleGesture(event);
+ FilterInputMotion(event);
+ if (magnifier_ && event.type == blink::WebInputEvent::GestureScrollUpdate)
+ return;
+ if (host_ && event.type != blink::WebInputEvent::Undefined)
+ host_->ForwardGestureEventWithLatencyInfo(event, CreateLatencyInfo(event));
+}
+
+void RenderWidgetHostViewEfl::HandleGestureBegin() {
+#if 0
+ selection_acked_on_tap_ = false;
+ was_scrolled_ = false;
+
+#ifdef TIZEN_EDGE_EFFECT
+ web_view_->edgeEffect()->enable();
+#endif
+ if (GetSelectionController()) {
+ should_restore_selection_menu_ =
+ GetSelectionController()->IsAnyHandleVisible();
+ }
+#endif
+}
+
+void RenderWidgetHostViewEfl::HandleGestureEnd() {
+#if 0
+ if (GetSelectionController()) {
+ if (GetSelectionController()->GetScrollStatus())
+ GetSelectionController()->SetScrollStatus(false);
+
+ if (should_restore_selection_menu_ && !was_scrolled_ &&
+ !selection_acked_on_tap_) {
+ should_restore_selection_menu_ = false;
+ GetSelectionController()->HideHandleAndContextMenu();
+ } else if (GetSelectionController()->GetSelectionStatus()) {
+ GetSelectionController()->UpdateSelectionDataAndShow(
+ GetSelectionController()->GetLeftRect(),
+ GetSelectionController()->GetRightRect(),
+ false /* unused */,
+ should_restore_selection_menu_);
+ }
+ }
+ // Edge effect should be disabled upon scroll end/fling start.
+ // Gesture end comes just after those events, so it's disabled here.
+#ifdef TIZEN_EDGE_EFFECT
+ web_view_->edgeEffect()->disable();
+#endif
+#endif
+}
+
+void RenderWidgetHostViewEfl::HandleGesture(
+ blink::WebGestureEvent& event) {
+#if 0
+ if (event.type == blink::WebInputEvent::GestureTap) {
+ eweb_view()->HandlePostponedGesture(event.x, event.y, ui::ET_GESTURE_TAP);
+ } else if (event.type == blink::WebInputEvent::GestureShowPress) {
+ eweb_view()->HandlePostponedGesture(
+ event.x, event.y, ui::ET_GESTURE_SHOW_PRESS);
+ } else if (event.type == blink::WebInputEvent::GestureLongPress) {
+ eweb_view()->HandlePostponedGesture(
+ event.x, event.y, ui::ET_GESTURE_LONG_PRESS);
+ }
+
+ if ((event.type == blink::WebInputEvent::GesturePinchBegin ||
+ event.type == blink::WebInputEvent::GesturePinchUpdate ||
+ event.type == blink::WebInputEvent::GesturePinchEnd) &&
+ (!pinch_zoom_enabled_ || eweb_view()->IsFullscreen())) {
+ return;
+ }
+
+ if (event.type == blink::WebInputEvent::GestureDoubleTap ||
+ event.type == blink::WebInputEvent::GesturePinchBegin) {
+ eweb_view()->SmartCallback<EWebViewCallbacks::ZoomStarted>().call();
+ }
+ if (event.type == blink::WebInputEvent::GestureDoubleTap ||
+ event.type == blink::WebInputEvent::GesturePinchEnd) {
+ eweb_view()->SmartCallback<EWebViewCallbacks::ZoomFinished>().call();
+ }
+
+ if (event.type == blink::WebInputEvent::GestureTap ||
+ event.type == blink::WebInputEvent::GestureTapCancel) {
+ float size = 32.0f; // Default value
+#if defined(OS_TIZEN_MOBILE)
+ size = elm_config_finger_size_get() / device_scale_factor_;
+#endif
+ event.data.tap.width = size;
+ event.data.tap.height = size;
+ }
+
+ if (event.type == blink::WebInputEvent::GestureTapDown) {
+ // Webkit does not stop a fling-scroll on tap-down. So explicitly send an
+ // event to stop any in-progress flings.
+ blink::WebGestureEvent fling_cancel = event;
+ fling_cancel.type = blink::WebInputEvent::GestureFlingCancel;
+ fling_cancel.sourceDevice = blink::WebGestureDeviceTouchscreen;
+ SendGestureEvent(fling_cancel);
+ } else if (event.type == blink::WebInputEvent::GestureTapCancel ||
+ event.type == blink::WebInputEvent::GestureTapUnconfirmed) {
+ selection_acked_on_tap_ = should_restore_selection_menu_;
+ } else if (event.type == blink::WebInputEvent::GestureScrollBegin) {
+ was_scrolled_ = true;
+ if (GetSelectionController())
+ GetSelectionController()->SetScrollStatus(true);
+ } else if (web_view_ && event.type == blink::WebInputEvent::GestureScrollUpdate) {
+#ifdef TIZEN_EDGE_EFFECT
+ if (event.data.scrollUpdate.deltaX < 0)
+ web_view_->edgeEffect()->hide("edge,left");
+ else if (event.data.scrollUpdate.deltaX > 0)
+ web_view_->edgeEffect()->hide("edge,right");
+ if (event.data.scrollUpdate.deltaY < 0)
+ web_view_->edgeEffect()->hide("edge,top");
+ else if (event.data.scrollUpdate.deltaY > 0)
+ web_view_->edgeEffect()->hide("edge,bottom");
+ } else if (web_view_ && event.type == blink::WebInputEvent::GesturePinchBegin) {
+ web_view_->edgeEffect()->disable();
+ } else if (web_view_ && event.type == blink::WebInputEvent::GesturePinchEnd) {
+ web_view_->edgeEffect()->enable();
+#endif
+ }
+#endif
+}
+
+void RenderWidgetHostViewEfl::HandleGesture(ui::GestureEvent* event) {
+ blink::WebGestureEvent gesture =
+ content::MakeWebGestureEventFromUIEvent(*event);
+ gesture.x = event->x();
+ gesture.y = event->y();
+
+ const gfx::Point root_point = event->root_location();
+ gesture.globalX = root_point.x();
+ gesture.globalY = root_point.y();
+
+ if (event->type() == ui::ET_GESTURE_BEGIN)
+ HandleGestureBegin();
+ else if (event->type() == ui::ET_GESTURE_END)
+ HandleGestureEnd();
+
+ SendGestureEvent(gesture);
+ event->SetHandled();
+}
+
+// Copied from render_widget_host_view_aura.cc
+void UpdateWebTouchEventAfterDispatch(blink::WebTouchEvent* event,
+ blink::WebTouchPoint* point) {
+ if (point->state != blink::WebTouchPoint::StateReleased
+ && point->state != blink::WebTouchPoint::StateCancelled)
+ return;
+ --event->touchesLength;
+ for (unsigned i = point - event->touches;
+ i < event->touchesLength;
+ ++i)
+ event->touches[i] = event->touches[i + 1];
+}
+
+void RenderWidgetHostViewEfl::HandleTouchEvent(ui::TouchEvent* event) {
+ if (!gesture_recognizer_->ProcessTouchEventPreDispatch(*event, this)) {
+ event->StopPropagation();
+ return;
+ }
+
+ // Update the touch event first.
+ blink::WebTouchPoint* point =
+ content::UpdateWebTouchEventFromUIEvent(*event, &touch_event_);
+ // Forward the touch event only if a touch point was updated, and there's a
+ // touch-event handler in the page, and no other touch-event is in the queue.
+ // It is important to always consume the event if there is a touch-event
+ // handler in the page, or some touch-event is already in the queue, even if
+ // no point has been updated, to make sure that this event does not get
+ // processed by the gesture recognizer before the events in the queue.
+ if (host_->ShouldForwardTouchEvent()) {
+ event->StopPropagation();
+ }
+
+ bool forwarded = false;
+ if (point) {
+ if (host_->ShouldForwardTouchEvent()) {
+ forwarded = true;
+ host_->ForwardTouchEventWithLatencyInfo(touch_event_, *event->latency());
+ }
+ UpdateWebTouchEventAfterDispatch(&touch_event_, point);
+ }
+
+ // If we forward it to the renderer than either blink handles it or we will
+ // have a second round with it in ProcessAckedTouchEvent.
+ if (forwarded)
+ return;
+
+ scoped_ptr<ui::GestureRecognizer::Gestures> gestures(
+ gesture_recognizer_->ProcessTouchEventPostDispatch(*event, ui::ER_UNHANDLED, this));
+ if (!gestures)
+ return;
+ for (size_t j = 0; j < gestures->size(); ++j) {
+ ui::GestureEvent* event = gestures->get().at(j);
+ HandleGesture(event);
+ }
+}
+
+void RenderWidgetHostViewEfl::ProcessAckedTouchEvent(
+ const TouchEventWithLatencyInfo& touch,
+ InputEventAckState ack_result) {
+ ScopedVector<ui::TouchEvent> events;
+ if (!MakeUITouchEventsFromWebTouchEvents(touch, &events, LOCAL_COORDINATES))
+ return;
+
+ ui::EventResult result = (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) ?
+ ui::ER_HANDLED : ui::ER_UNHANDLED;
+ for (ScopedVector<ui::TouchEvent>::const_iterator iter = events.begin(),
+ end = events.end(); iter != end; ++iter) {
+ scoped_ptr<ui::GestureRecognizer::Gestures> gestures(
+ gesture_recognizer_->ProcessTouchEventOnAsyncAck(**iter, result, this));
+ if (gestures) {
+ for (size_t j = 0; j < gestures->size(); ++j) {
+ ui::GestureEvent* event = gestures->get().at(j);
+ HandleGesture(event);
+ }
+ }
+ }
+}
+
+void RenderWidgetHostViewEfl::OnOrientationChangeEvent(int orientation) {
+ current_orientation_ = orientation;
+}
+
+#if 0
+SelectionControllerEfl* RenderWidgetHostViewEfl::GetSelectionController() {
+ if (web_view_)
+ return web_view_->GetSelectionController();
+ return NULL;
+}
+#endif
+
+void RenderWidgetHostViewEfl::SetComposition(const ui::CompositionText& composition_text) {
+ const std::vector<blink::WebCompositionUnderline>& underlines =
+ reinterpret_cast<const std::vector<blink::WebCompositionUnderline>&>(
+ composition_text.underlines);
+
+ host_->ImeSetComposition(
+ composition_text.text, underlines, composition_text.selection.start(),
+ composition_text.selection.end());
+}
+
+void RenderWidgetHostViewEfl::ConfirmComposition(base::string16& text) {
+ host_->ImeConfirmComposition(text, gfx::Range::InvalidRange(), false);
+}
+
+void RenderWidgetHostViewEfl::OnSwapCompositorFrame(
+ uint32 output_surface_id, scoped_ptr<cc::CompositorFrame> frame) {
+ cc::CompositorFrameAck ack;
+
+ // TODO(prashant.n): Delegated and software frames not supported. So with
+ // those frames black screen will appear.
+ if (frame->gl_frame_data) {
+ ack.gl_frame_data = frame->gl_frame_data.Pass();
+
+ if (evas_gl_initialized_) {
+ std::swap(ack.gl_frame_data->mailbox, pending_mailbox_);
+ gpu::gles2::MailboxManager* manager =
+ GLSharedContextEfl::GetMailboxManager();
+
+ gpu::gles2::Texture* texture =
+ manager->ConsumeTexture(pending_mailbox_);
+ if (texture != NULL) {
+ texture_id_ = GetTextureIdFromTexture(texture);
+ evas_object_image_pixels_dirty_set(content_image_, true);
+ } else {
+ LOG(ERROR) << "Frame produced without texture.";
+ }
+ }
+
+ ack.gl_frame_data->sync_point = 0;
+ } else if (frame->delegated_frame_data) {
+ LOG(ERROR) << "Delegated frame is not supported.";
+ cc::TransferableResource::ReturnResources(
+ frame->delegated_frame_data->resource_list,
+ &ack.resources);
+ } else if (frame->software_frame_data) {
+ LOG(ERROR) << "Software frame is not supported.";
+ ack.last_software_frame_id = frame->software_frame_data->id;
+ }
+
+ // TODO(prashant.n): Check if ack should be sent after frame is drawn.
+ host_->SendSwapCompositorFrameAck(host_->GetRoutingID(),
+ output_surface_id,
+ host_->GetProcess()->GetID(),
+ ack);
+}
+
+} // namespace content
--- /dev/null
+// Copyright 2014-2015 Samsung Electronics. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef RENDER_WIDGET_HOST_VIEW_EFL
+#define RENDER_WIDGET_HOST_VIEW_EFL
+
+#include <Evas.h>
+#include <Ecore_Evas.h>
+#include <Evas_GL.h>
+#include <Ecore_IMF_Evas.h>
+
+#include "base/basictypes.h"
+#include "base/format_macros.h"
+#include "content/browser/renderer_host/render_widget_host_view_base.h"
+#include "content/common/content_export.h"
+#include "cc/layers/delegated_frame_provider.h"
+#include "cc/layers/delegated_frame_resource_collection.h"
+#include "cc/output/compositor_frame.h"
+#include "cc/output/compositor_frame_ack.h"
+#include "cc/output/copy_output_request.h"
+#include "cc/output/copy_output_result.h"
+#include "cc/resources/single_release_callback.h"
+#include "cc/resources/texture_mailbox.h"
+#include "content/browser/accessibility/browser_accessibility_manager.h"
+#include "content/browser/compositor/image_transport_factory.h"
+#include "content/browser/compositor/owned_mailbox.h"
+#include "content/common/view_messages.h"
+#include "gpu/command_buffer/common/mailbox.h"
+#include "ui/base/ime/composition_text.h"
+#include "ui/base/ime/text_input_client.h"
+#include "ui/events/gestures/gesture_types.h"
+#include "ui/events/gestures/gesture_recognizer.h"
+#include "ui/events/gestures/motion_event_aura.h"
+#include "ipc/ipc_sender.h"
+
+#ifndef OS_TIZEN
+// On desktops using mesa as GLES2 implementation GLchar is not defined
+// Normally chromium uses it's own modified khronos headers from third_party/khronos,
+// unfortunately those headers won't be included by Evas_GL.h
+typedef char GLchar;
+#endif
+
+namespace ui {
+class GestureEvent;
+class TouchEvent;
+}
+
+namespace content {
+
+class DisambiguationPopupEfl;
+#if 0
+class IMContextEfl;
+#endif
+class RenderWidgetHostImpl;
+class RenderWidgetHostView;
+class ReadbackYUVInterface;
+
+// RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
+class RenderWidgetHostViewEfl
+ : public RenderWidgetHostViewBase,
+ public ui::GestureConsumer,
+ public ui::GestureEventHelper,
+ public base::SupportsWeakPtr<RenderWidgetHostViewEfl>,
+ public IPC::Sender {
+ public:
+ explicit RenderWidgetHostViewEfl(RenderWidgetHost*);
+
+ // RenderWidgetHostViewBase implementation.
+ void InitAsChild(gfx::NativeView) override;
+ void InitAsPopup(content::RenderWidgetHostView*, const gfx::Rect&) override;
+ void InitAsFullscreen(content::RenderWidgetHostView*) override;
+ RenderWidgetHost* GetRenderWidgetHost() const override;
+ void SetSize(const gfx::Size&) override;
+ void SetBounds(const gfx::Rect&) override;
+ gfx::Vector2dF GetLastScrollOffset() const override;
+ gfx::NativeView GetNativeView() const override;
+ gfx::NativeViewId GetNativeViewId() const override;
+ gfx::NativeViewAccessible GetNativeViewAccessible() override;
+ bool IsSurfaceAvailableForCopy() const override;
+ void Show() override;
+ void Hide() override;
+ bool IsShowing() override;
+ gfx::Rect GetViewBounds() const override;
+ bool LockMouse() override;
+ void UnlockMouse() override;
+ void WasShown() override;
+ void WasHidden() override;
+ void Focus() override;
+ void Blur() override;
+ bool HasFocus() const override;
+ void MovePluginContainer(const WebPluginGeometry&);
+ void MovePluginWindows(
+ const std::vector<WebPluginGeometry>&) override;
+ void UpdateCursor(const WebCursor&) override;
+ void SetIsLoading(bool) override;
+
+ void OnTextInputStateChanged(const ViewHostMsg_TextInputState_Params& params);
+
+ void TextInputTypeChanged(ui::TextInputType type,
+ ui::TextInputMode mode,
+ bool can_compose_inline,
+ int flags) override;
+
+ void ImeCancelComposition() override;
+ void ImeCompositionRangeChanged(const gfx::Range&, const std::vector<gfx::Rect>&) override;
+ void FocusedNodeChanged(bool is_editable_node) override;
+
+ void Destroy() override;
+ void SetTooltipText(const base::string16&) override;
+ void SelectionChanged(const base::string16&, size_t, const gfx::Range&) override;
+ void SelectionBoundsChanged(const ViewHostMsg_SelectionBounds_Params&) override;
+ void CopyFromCompositingSurface(
+ const gfx::Rect&,
+ const gfx::Size& /* dst_size */,
+ const base::Callback<void(bool, const SkBitmap&)>&,
+ const SkColorType) override;
+
+ void CopyFromCompositingSurfaceToVideoFrame(
+ const gfx::Rect&,
+ const scoped_refptr<media::VideoFrame>&,
+ const base::Callback<void(bool)>&) override;
+
+ bool CanCopyToVideoFrame() const override;
+ bool CanSubscribeFrame() const override;
+ void BeginFrameSubscription(
+ scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) override;
+ void EndFrameSubscription() override;
+
+#ifdef TIZEN_EDGE_EFFECT
+ void DidOverscroll(const DidOverscrollParams& params) override;
+#endif
+
+ void AcceleratedSurfaceInitialized(int) override;
+ bool HasAcceleratedSurface(const gfx::Size&) override;
+ void GetScreenInfo(blink::WebScreenInfo*) override;
+ gfx::Rect GetBoundsInRootWindow() override;
+ gfx::GLSurfaceHandle GetCompositingSurface() override;
+ void ResizeCompositingSurface(const gfx::Size&);
+ void RenderProcessGone(base::TerminationStatus, int) override;
+ bool OnMessageReceived(const IPC::Message&) override;
+
+ void OnFilteredMessageReceived(const IPC::Message&);
+
+ void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo&, InputEventAckState) override;
+ void DidStopFlinging() override;
+
+ void ShowDisambiguationPopup(const gfx::Rect& rect_pixels,
+ const SkBitmap& zoomed_bitmap) override;
+
+ void OnSwapCompositorFrame(
+ uint32 output_surface_id, scoped_ptr<cc::CompositorFrame> frame) override;
+
+ // ui::GestureEventHelper implementation.
+ bool CanDispatchToConsumer(ui::GestureConsumer* consumer) override;
+ void DispatchCancelTouchEvent(ui::TouchEvent* event) override;
+ void DispatchGestureEvent(ui::GestureEvent*) override;
+
+ // IPC::Sender implementation:
+ bool Send(IPC::Message*) override;
+
+ void FilterInputMotion(const blink::WebGestureEvent& gesture_event);
+
+ Evas* evas() const {
+ DCHECK(evas_);
+ return evas_;
+ }
+
+ void set_magnifier(bool status);
+
+ void Init(Evas_Object* view);
+ void Init_EvasGL(int width, int height);
+
+#if 0
+ IMContextEfl* im_context() const { return im_context_; }
+#endif
+
+ void HandleGestureBegin();
+ void HandleGestureEnd();
+ void HandleGesture(ui::GestureEvent*);
+ void HandleGesture(blink::WebGestureEvent&);
+ void HandleTouchEvent(ui::TouchEvent*);
+
+ Evas_GL_API* evasGlApi() { return evas_gl_api_; }
+ gfx::Point ConvertPointInViewPix(gfx::Point point);
+ gfx::Rect GetViewBoundsInPix() const;
+
+ void SetComposition(const ui::CompositionText& composition_text);
+ void ConfirmComposition(base::string16& text);
+ void SendGestureEvent(blink::WebGestureEvent& event);
+
+ protected:
+ friend class RenderWidgetHostView;
+
+ private:
+ ~RenderWidgetHostViewEfl() override;
+
+ static void OnContentImageResize(void* data, Evas*, Evas_Object*, void*);
+ static void OnParentViewResize(void* data, Evas*, Evas_Object*, void*);
+ static void OnFocusIn(void* data, Evas*, Evas_Object*, void*);
+ static void OnFocusOut(void* data, Evas*, Evas_Object*, void*);
+ static void OnHostFocusIn(void* data, Evas_Object*, void*);
+ static void OnHostFocusOut(void* data, Evas_Object*, void*);
+
+ static void OnPointerDown(void* data, Evas*, Evas_Object*, void*);
+ static void OnPointerUp(void* data, Evas*, Evas_Object*, void*);
+ static void OnPointerMove(void* data, Evas*, Evas_Object*, void*);
+ static void OnMouseWheel(void* data, Evas*, Evas_Object*, void*);
+ static void OnKeyDown(void*, Evas*, Evas_Object*, void*);
+ static void OnKeyUp(void*, Evas*, Evas_Object*, void*);
+ void ProcessTouchEvents();
+
+ void OnOrientationChangeEvent(int);
+ void OnSnapshot(const std::vector<unsigned char> pixData, int snapshotId, const gfx::Size& size);
+
+#if 0
+ SelectionControllerEfl* GetSelectionController();
+#endif
+
+ static void CopyFromCompositingSurfaceHasResultForVideo(
+ base::WeakPtr<RenderWidgetHostViewEfl> rwhvefl,
+ scoped_refptr<OwnedMailbox> subscriber_texture,
+ scoped_refptr<media::VideoFrame> video_frame,
+ const base::Callback<void(bool)>& callback,
+ scoped_ptr<cc::CopyOutputResult> result);
+ static void CopyFromCompositingSurfaceFinishedForVideo(
+ base::WeakPtr<RenderWidgetHostViewEfl> rwhvefl,
+ const base::Callback<void(bool)>& callback,
+ scoped_refptr<OwnedMailbox> subscriber_texture,
+ scoped_ptr<cc::SingleReleaseCallback> release_callback,
+ bool result);
+ static void ReturnSubscriberTexture(
+ base::WeakPtr<RenderWidgetHostViewEfl> rwhvefl,
+ scoped_refptr<OwnedMailbox> subscriber_texture,
+ uint32 sync_point);
+
+ static void EvasObjectImagePixelsGetCallback(void*, Evas_Object*);
+ void initializeProgram();
+
+ Ecore_X_Window GetEcoreXWindow() const;
+
+ void PaintTextureToSurface(GLuint texture_id);
+
+ RenderWidgetHostImpl* host_;
+#if 0
+ IMContextEfl* im_context_;
+#endif
+
+ Evas* evas_;
+ Evas_Object* parent_view_;
+ Evas_Object* content_image_;
+ Evas_Object* content_image_elm_host_;
+ bool evas_gl_initialized_;
+ float device_scale_factor_;
+
+ typedef std::map<gfx::PluginWindowHandle, Ecore_X_Window> PluginWindowToWidgetMap;
+ PluginWindowToWidgetMap plugin_window_to_widget_map_;
+
+ bool magnifier_;
+
+ // Whether we are currently loading.
+ bool is_loading_;
+
+ // YUV readback pipeline.
+ scoped_ptr<content::ReadbackYUVInterface>
+ yuv_readback_pipeline_;
+
+ // Subscriber that listens to frame presentation events.
+ scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_;
+ std::vector<scoped_refptr<OwnedMailbox> > idle_frame_subscriber_textures_;
+ std::set<OwnedMailbox*> active_frame_subscriber_textures_;
+
+ // The touch-event. Its touch-points are updated as necessary. A new
+ // touch-point is added from an ET_TOUCH_PRESSED event, and a touch-point is
+ // removed from the list on an ET_TOUCH_RELEASED event.
+ blink::WebTouchEvent touch_event_;
+
+ // Stores the current state of the active pointers targeting this
+ // object.
+ ui::MotionEventAura pointer_state_;
+
+ // The gesture recognizer for this view.
+ // In Aura GestureRecognizer is global. Should we follow that?
+ scoped_ptr<ui::GestureRecognizer> gesture_recognizer_;
+
+ scoped_ptr<DisambiguationPopupEfl> disambiguation_popup_;
+
+ int current_orientation_;
+
+ Evas_GL* evas_gl_;
+ Evas_GL_API* evas_gl_api_;
+ Evas_GL_Context* evas_gl_context_;
+ Evas_GL_Surface* evas_gl_surface_;
+ Evas_GL_Config* evas_gl_config_;
+
+ GLuint program_id_;
+ GLint source_texture_location_;
+ GLuint position_attrib_;
+ GLuint texcoord_attrib_;
+ void* egl_image_;
+ unsigned long current_pixmap_id_;
+ unsigned long next_pixmap_id_;
+ GLuint texture_id_;
+ int surface_id_;
+ bool is_modifier_key_;
+ GLuint vertex_buffer_obj_;
+ GLuint vertex_buffer_obj_270_;
+ GLuint vertex_buffer_obj_90_;
+ GLuint index_buffer_obj_;
+
+ bool touch_events_enabled_;
+
+ bool should_restore_selection_menu_;
+ bool selection_acked_on_tap_;
+ // Used only to indicate that user scrolled view
+ // after gesture GestureTapDown.
+ bool was_scrolled_;
+
+ // The last scroll offset of the view.
+ gfx::Vector2dF last_scroll_offset_;
+
+ gpu::Mailbox pending_mailbox_;
+
+ DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewEfl);
+};
+
+} // namespace content
+
+#endif
--- /dev/null
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/renderer_host/web_event_factory_efl.h"
+
+#include <Ecore.h>
+#include <Ecore_X.h>
+// TODO: Figure out how to avoid this includes.
+#include <X11/Xutil.h>
+#include <X11/keysym.h>
+
+#include "base/time/time.h"
+#include "base/strings/utf_string_conversions.h"
+#include "ui/events/keycodes/keyboard_codes.h"
+#include "ui/events/keycodes/keyboard_code_conversion_x.h"
+#include "ui/gfx/screen.h"
+
+using namespace blink;
+
+namespace content {
+
+namespace {
+
+static const float kDefaultScrollStep = 20;
+
+static void TranslateEvasCoordToWebKitCoord(Evas_Object *web_view, int& x, int& y) {
+ Evas_Coord tmpX, tmpY;
+ evas_object_geometry_get(web_view, &tmpX, &tmpY, 0, 0);
+ x -= tmpX;
+ y -= tmpY;
+}
+
+float GetDeviceScaleFactor() {
+ static float device_scale_factor = 0.0f;
+ if (!device_scale_factor) {
+ device_scale_factor = gfx::Screen::GetNativeScreen()->
+ GetPrimaryDisplay().device_scale_factor();
+ }
+ return device_scale_factor;
+}
+
+static ui::KeyboardCode KeyboardCodeFromEflKey(const char* key) {
+ return ui::KeyboardCodeFromXKeysym(XStringToKeysym(key));
+}
+
+static int WindowsKeyCodeFromEflKey(const char* key) {
+ int windows_key_code = KeyboardCodeFromEflKey(key);
+ if (windows_key_code == ui::VKEY_SHIFT ||
+ windows_key_code == ui::VKEY_CONTROL ||
+ windows_key_code == ui::VKEY_MENU) {
+ // To support DOM3 'location' attribute, we need to lookup an X KeySym and
+ // set ui::VKEY_[LR]XXX instead of ui::VKEY_XXX.
+ KeySym keysym = XStringToKeysym(key);
+ switch (keysym) {
+ case XK_Shift_L:
+ return ui::VKEY_LSHIFT;
+ case XK_Shift_R:
+ return ui::VKEY_RSHIFT;
+ case XK_Control_L:
+ return ui::VKEY_LCONTROL;
+ case XK_Control_R:
+ return ui::VKEY_RCONTROL;
+ case XK_Meta_L:
+ case XK_Alt_L:
+ return ui::VKEY_LMENU;
+ case XK_Meta_R:
+ case XK_Alt_R:
+ return ui::VKEY_RMENU;
+ }
+ }
+ return windows_key_code;
+}
+
+static int NativeKeyCodeFromEflKey(const char* key) {
+ return XKeysymToKeycode((Display*)ecore_x_display_get(), XStringToKeysym(key));
+}
+
+static int CharacterFromEflString(const char* string) {
+ if (string) {
+ base::string16 result;
+ base::UTF8ToUTF16(string, strlen(string), &result);
+ return result.length() == 1 ? result[0] : 0;
+ }
+
+ return 0;
+}
+
+// From
+// third_party/blink/Source/blink/chromium/src/gtk/WebInputEventFactory.cpp:
+static blink::WebUChar GetControlCharacter(int windows_key_code, bool shift) {
+ if (windows_key_code >= ui::VKEY_A &&
+ windows_key_code <= ui::VKEY_Z) {
+ // ctrl-A ~ ctrl-Z map to \x01 ~ \x1A
+ return windows_key_code - ui::VKEY_A + 1;
+ }
+ if (shift) {
+ // following graphics chars require shift key to input.
+ switch (windows_key_code) {
+ // ctrl-@ maps to \x00 (Null byte)
+ case ui::VKEY_2:
+ return 0;
+ // ctrl-^ maps to \x1E (Record separator, Information separator two)
+ case ui::VKEY_6:
+ return 0x1E;
+ // ctrl-_ maps to \x1F (Unit separator, Information separator one)
+ case ui::VKEY_OEM_MINUS:
+ return 0x1F;
+ // Returns 0 for all other keys to avoid inputting unexpected chars.
+ default:
+ break;
+ }
+ } else {
+ switch (windows_key_code) {
+ // ctrl-[ maps to \x1B (Escape)
+ case ui::VKEY_OEM_4:
+ return 0x1B;
+ // ctrl-\ maps to \x1C (File separator, Information separator four)
+ case ui::VKEY_OEM_5:
+ return 0x1C;
+ // ctrl-] maps to \x1D (Group separator, Information separator three)
+ case ui::VKEY_OEM_6:
+ return 0x1D;
+ // ctrl-Enter maps to \x0A (Line feed)
+ case ui::VKEY_RETURN:
+ return 0x0A;
+ // Returns 0 for all other keys to avoid inputting unexpected chars.
+ default:
+ break;
+ }
+ }
+ return 0;
+}
+
+enum {
+ LeftButton = 1,
+ MiddleButton = 2,
+ RightButton = 3
+};
+
+static WebMouseEvent::Button EvasToWebMouseButton(int button) {
+ if (button == LeftButton)
+ return WebMouseEvent::ButtonLeft;
+ if (button == MiddleButton)
+ return WebMouseEvent::ButtonMiddle;
+ if (button == RightButton)
+ return WebMouseEvent::ButtonRight;
+
+ return WebMouseEvent::ButtonNone;
+}
+
+static WebInputEvent::Modifiers EvasToWebModifiers(const Evas_Modifier* modifiers) {
+ unsigned result = 0;
+
+ if (evas_key_modifier_is_set(modifiers, "Shift"))
+ result |= WebInputEvent::ShiftKey;
+ if (evas_key_modifier_is_set(modifiers, "Control"))
+ result |= WebInputEvent::ControlKey;
+ if (evas_key_modifier_is_set(modifiers, "Alt"))
+ result |= WebInputEvent::AltKey;
+ if (evas_key_modifier_is_set(modifiers, "Meta"))
+ result |= WebInputEvent::MetaKey;
+
+ return static_cast<WebInputEvent::Modifiers>(result);
+}
+
+} // namespace
+
+template <class EVT>
+blink::WebMouseEvent MakeWebMouseEvent(WebInputEvent::Type type,
+ Evas_Object* view, const EVT* ev) {
+
+ WebMouseEvent event;
+ event.timeStampSeconds = (double)ev->timestamp / 1000;
+ event.button = EvasToWebMouseButton(ev->button);
+ event.modifiers = EvasToWebModifiers(ev->modifiers);
+
+ const float sf = GetDeviceScaleFactor();
+ event.windowX = ev->canvas.x / sf;
+ event.windowY = ev->canvas.y / sf;
+
+ TranslateEvasCoordToWebKitCoord(view, event.windowX, event.windowY);
+
+ event.x = event.windowX;
+ event.y = event.windowY;
+
+ Evas* evas = evas_object_evas_get(view);
+ event.globalX = evas_coord_world_x_to_screen(evas, ev->canvas.x) / sf;
+ event.globalY = evas_coord_world_y_to_screen(evas, ev->canvas.y) / sf;
+ event.type = type;
+
+ event.clickCount = 1;
+
+ return event;
+}
+
+template blink::WebMouseEvent MakeWebMouseEvent<Evas_Event_Mouse_Down>(
+ WebInputEvent::Type, Evas_Object*, const Evas_Event_Mouse_Down*);
+template blink::WebMouseEvent MakeWebMouseEvent<Evas_Event_Mouse_Up>(
+ WebInputEvent::Type, Evas_Object*, const Evas_Event_Mouse_Up*);
+
+blink::WebMouseEvent MakeWebMouseEvent(Evas_Object* view,
+ const Evas_Event_Mouse_Move* ev) {
+ WebMouseEvent event;
+ event.timeStampSeconds = (double)ev->timestamp / 1000;
+ event.modifiers = EvasToWebModifiers(ev->modifiers);
+
+ const float sf = GetDeviceScaleFactor();
+ event.windowX = ev->cur.canvas.x / sf;
+ event.windowY = ev->cur.canvas.y / sf;
+
+ TranslateEvasCoordToWebKitCoord(view, event.windowX, event.windowY);
+
+ event.x = event.windowX;
+ event.y = event.windowY;
+
+ Evas* evas = evas_object_evas_get(view);
+ event.globalX = evas_coord_world_x_to_screen(evas, ev->cur.canvas.x) / sf;
+ event.globalY = evas_coord_world_y_to_screen(evas, ev->cur.canvas.y) / sf;
+ event.type = WebInputEvent::MouseMove;
+
+ return event;
+}
+
+blink::WebMouseWheelEvent MakeWebMouseEvent(
+ Evas_Object* view, const Evas_Event_Mouse_Wheel* ev) {
+ WebMouseWheelEvent event;
+ event.timeStampSeconds = (double)ev->timestamp / 1000;
+ event.modifiers = EvasToWebModifiers(ev->modifiers);
+
+ const float sf = GetDeviceScaleFactor();
+ event.windowX = (ev->canvas.x) / sf;
+ event.windowY = (ev->canvas.y) / sf;
+
+ TranslateEvasCoordToWebKitCoord(view, event.windowX, event.windowY);
+
+ event.x = event.windowX;
+ event.y = event.windowY;
+
+ Evas* evas = evas_object_evas_get(view);
+ event.globalX = evas_coord_world_x_to_screen(evas, ev->canvas.x) / sf;
+ event.globalY = evas_coord_world_y_to_screen(evas, ev->canvas.y) / sf;
+ event.type = WebInputEvent::MouseWheel;
+
+ if (ev->direction) {
+ event.wheelTicksX = ev->z;
+ event.deltaX = ev->z * kDefaultScrollStep;
+ } else {
+ event.wheelTicksY = -(ev->z);
+ event.deltaY = -(ev->z * kDefaultScrollStep);
+ }
+
+ return event;
+}
+
+template <class EVT>
+NativeWebKeyboardEvent MakeWebKeyboardEvent(bool pressed, const EVT* evt) {
+
+ NativeWebKeyboardEvent event;
+ event.timeStampSeconds = (double)evt->timestamp / 1000;
+ event.modifiers = EvasToWebModifiers(evt->modifiers);
+ event.type = pressed ? WebInputEvent::KeyDown : WebInputEvent::KeyUp;
+
+ event.nativeKeyCode = NativeKeyCodeFromEflKey(evt->key);
+ event.windowsKeyCode = WindowsKeyCodeFromEflKey(evt->key);
+
+ if (event.windowsKeyCode == ui::VKEY_RETURN) {
+ event.unmodifiedText[0] = '\r';
+ } else {
+ event.unmodifiedText[0] = CharacterFromEflString(evt->string);
+ }
+
+ if (event.modifiers & blink::WebInputEvent::ControlKey) {
+ event.text[0] =
+ GetControlCharacter(event.windowsKeyCode,
+ event.modifiers & blink::WebInputEvent::ShiftKey);
+ } else {
+ event.text[0] = event.unmodifiedText[0];
+ }
+
+ event.setKeyIdentifierFromWindowsKeyCode();
+
+ return event;
+}
+
+template NativeWebKeyboardEvent MakeWebKeyboardEvent(
+ bool, const Evas_Event_Key_Down*);
+template NativeWebKeyboardEvent MakeWebKeyboardEvent(
+ bool, const Evas_Event_Key_Up*);
+
+static ui::EventType EvasTouchEventTypeToUI(Evas_Touch_Point_State evas_touch) {
+ switch(evas_touch) {
+ case EVAS_TOUCH_POINT_DOWN:
+ return ui::ET_TOUCH_PRESSED;
+ case EVAS_TOUCH_POINT_MOVE:
+ return ui::ET_TOUCH_MOVED;
+ case EVAS_TOUCH_POINT_UP:
+ return ui::ET_TOUCH_RELEASED;
+ case EVAS_TOUCH_POINT_CANCEL:
+ return ui::ET_TOUCH_CANCELLED;
+ case EVAS_TOUCH_POINT_STILL:
+ // Not handled by chromium, should not be passed here.
+ default:
+ NOTREACHED();
+ return ui::ET_UNKNOWN;
+ }
+}
+
+bool IsHardwareBackKey(const Evas_Event_Key_Down* event) {
+#if defined(OS_TIZEN)
+ return (strcmp(event->key, "XF86Stop") == 0);
+#endif
+ return (strcmp(event->key, "Escape") == 0);
+}
+
+ui::TouchEvent MakeTouchEvent(Evas_Coord_Point pt,
+ Evas_Touch_Point_State state, int id, Evas_Object* view) {
+ TranslateEvasCoordToWebKitCoord(view, pt.x, pt.y);
+ const float scale = GetDeviceScaleFactor();
+ return ui::TouchEvent(EvasTouchEventTypeToUI(state),
+ gfx::Point(pt.x / scale, pt.y / scale),
+ id, base::TimeDelta::FromMilliseconds(ecore_time_get() * 1000));
+}
+
+}
--- /dev/null
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEB_EVENT_FACTORY_EFL
+#define WEB_EVENT_FACTORY_EFL
+
+#include <Evas.h>
+
+#include "content/browser/renderer_host/render_widget_host_impl.h"
+#include "content/public/browser/native_web_keyboard_event.h"
+#include "third_party/WebKit/public/web/WebInputEvent.h"
+#include "ui/events/event.h"
+
+namespace content {
+
+// Mouse
+template <class EVT>
+blink::WebMouseEvent MakeWebMouseEvent(
+ blink::WebInputEvent::Type type, Evas_Object* view, const EVT*);
+blink::WebMouseEvent MakeWebMouseEvent(Evas_Object* view,
+ const Evas_Event_Mouse_Move* ev);
+blink::WebMouseWheelEvent MakeWebMouseEvent(Evas_Object*,
+ const Evas_Event_Mouse_Wheel* ev);
+
+// Keyboard
+template <class EVT>
+NativeWebKeyboardEvent MakeWebKeyboardEvent(bool pressed, const EVT*);
+bool IsHardwareBackKey(const Evas_Event_Key_Down* event);
+
+// Touch
+ui::TouchEvent MakeTouchEvent(Evas_Coord_Point pt,
+ Evas_Touch_Point_State state, int id, Evas_Object* view);
+
+} // namespace content
+
+#endif
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "browser/web_contents/web_contents_impl_efl.h"
+#include "content/browser/web_contents/web_contents_impl_efl.h"
-// This file re-implements internal content interface and it needs access
-// to all content APIs, even non public ones
-#define CONTENT_IMPLEMENTATION
#include "content/public/common/content_client.h"
-#undef CONTENT_IMPLEMENTATION
#include "content/common/view_messages.h"
#include "content/browser/browser_plugin/browser_plugin_guest.h"
#include "content/browser/dom_storage/dom_storage_context_wrapper.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/result_codes.h"
-//#include "content/port/browser/web_contents_view_port.h"
-#include "eweb_view.h"
// Majority of the code in this file was taken directly from
// WebContentsImpl::CreateNewWindow. Compared to the original, the function
create_params.initially_hidden = true;
WebContentsImplEfl* new_contents = NULL;
- // Added for EFL port, RWHV efl should use ContentImageObject as it's NativeView
- if (ewk_view) {
- create_params.context = static_cast<EWebView*>(
- ewk_view)->GetContentImageObject();
- }
- // End of EFL port specific code.
if (!is_guest) {
- if (!ewk_view) // Check added for EFL port
- create_params.context = view_->GetNativeView();
+ create_params.context = view_->GetNativeView();
create_params.initial_size = GetContainerBounds().size();
new_contents = static_cast<WebContentsImplEfl*>(
WebContents::Create(create_params));
session_storage_namespace);
new_contents->RenderViewCreated(new_contents->GetRenderViewHost());
+ // Added for EFL port
+ new_contents->SetEWebView(ewk_view);
+ // Added for EFL port
+
// Save the window for later if we're not suppressing the opener (since it
// will be shown immediately).
if (!params.opener_suppressed) {
#include "content/browser/web_contents/web_contents_impl.h"
-class EWebView;
+typedef void EWebView;
namespace content {
SessionStorageNamespace* session_storage_namespace) override;
EWebView* GetEWebView() const { return ewk_view_; };
+ void SetEWebView(EWebView* view) { ewk_view_ = view; };
private:
// Needed to access private WebContentsImplEfl constructor from
--- /dev/null
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/web_contents/web_contents_view_efl.h"
+
+#include <Elementary.h>
+
+#include "base/logging.h"
+#include "base/strings/utf_string_conversions.h"
+#include "content/browser/renderer_host/render_widget_host_view_efl.h"
+#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/public/browser/screen_orientation_dispatcher_host.h"
+#include "content/public/browser/web_contents_view_delegate.h"
+#include "content/public/browser/interstitial_page.h"
+#include "efl/window_factory.h"
+#include "ui/gl/gl_shared_context_efl.h"
+
+namespace content {
+
+WebContentsView* CreateWebContentsView(
+ WebContentsImpl* web_contents,
+ WebContentsViewDelegate* delegate,
+ RenderViewHostDelegateView** render_view_host_delegate_view) {
+ WebContentsViewEfl* view = new WebContentsViewEfl(web_contents, delegate);
+ *render_view_host_delegate_view = view;
+ return view;
+}
+
+WebContentsViewEfl::WebContentsViewEfl(WebContents* contents,
+ WebContentsViewDelegate* delegate)
+ : delegate_(delegate)
+ , native_view_(NULL)
+ , drag_dest_delegate_(NULL)
+ , orientation_(0)
+ , web_contents_(contents) {}
+
+WebContentsViewEfl::~WebContentsViewEfl() {
+}
+
+void WebContentsViewEfl::CreateView(const gfx::Size& initial_size,
+ gfx::NativeView context) {
+ Evas_Object* root_window = efl::WindowFactory::GetHostWindow(web_contents_);
+
+ native_view_ = elm_bg_add(root_window);
+ if (!initial_size.IsEmpty())
+ evas_object_resize(native_view_,
+ initial_size.width(), initial_size.height());
+ evas_object_show(native_view_);
+
+ GLSharedContextEfl::Initialize(root_window);
+
+ if (delegate_)
+ drag_dest_delegate_ = delegate_->GetDragDestDelegate();
+}
+
+RenderWidgetHostViewBase* WebContentsViewEfl::CreateViewForWidget(
+ RenderWidgetHost* render_widget_host, bool is_guest_view_hack) {
+
+ RenderWidgetHostViewEfl* view =
+ new RenderWidgetHostViewEfl(render_widget_host);
+ view->Init(native_view_);
+ view->Show();
+
+ SetOrientation(orientation_);
+
+ return view;
+}
+
+RenderWidgetHostViewBase* WebContentsViewEfl::CreateViewForPopupWidget(
+ RenderWidgetHost* render_widget_host) {
+ return new RenderWidgetHostViewEfl(render_widget_host);
+}
+
+void WebContentsViewEfl::SetPageTitle(const base::string16& title) {
+ DCHECK(native_view_);
+}
+
+void WebContentsViewEfl::UpdateDragDest(RenderViewHost* host) {
+ // Drag-and-drop is entirely managed by BrowserPluginGuest for guest
+ // processes in a largely platform independent way. WebDragDestEfl
+ // will result in spurious messages being sent to the guest process which
+ // will violate assumptions.
+ if (host->GetProcess() && host->GetProcess()->IsIsolatedGuest()) {
+ DCHECK(!drag_dest_);
+ return;
+ }
+
+ // If supporting RenderWidgetHostViewEfl::GetNativeView(), following lines
+ // will be enabled similar to GTK+ port
+ RenderWidgetHostViewEfl* view = static_cast<RenderWidgetHostViewEfl*>(
+ web_contents_->GetRenderWidgetHostView());
+
+ // If the host is already used by the drag_dest_, there's no point in deleting
+ // the old one to create an identical copy.
+
+ /*if (drag_dest_.get() && drag_dest_->widget() == content_view)
+ return;*/
+
+ // Clear the currently connected drag drop signals by deleting the old
+ // drag_dest_ before creating the new one.
+ drag_dest_.reset();
+ // Create the new drag_dest_.
+ drag_dest_.reset(new WebDragDestEfl(web_contents_, view));
+
+ if (delegate_)
+ drag_dest_->set_delegate(delegate_->GetDragDestDelegate());
+}
+
+void WebContentsViewEfl::RenderViewCreated(RenderViewHost* host) {
+ DCHECK(host->GetProcess());
+ DCHECK(web_contents_);
+}
+
+void WebContentsViewEfl::RenderViewSwappedIn(RenderViewHost* host) {
+ UpdateDragDest(host);
+}
+
+void WebContentsViewEfl::SetOverscrollControllerEnabled(bool enabled) {
+ NOTIMPLEMENTED();
+}
+
+gfx::NativeView WebContentsViewEfl::GetNativeView() const {
+ return native_view_;
+}
+
+gfx::NativeView WebContentsViewEfl::GetContentNativeView() const {
+ RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
+ return rwhv ? rwhv->GetNativeView() : NULL;
+}
+
+gfx::NativeWindow WebContentsViewEfl::GetTopLevelNativeWindow() const {
+ NOTIMPLEMENTED();
+ return 0;
+}
+
+void WebContentsViewEfl::GetContainerBounds(gfx::Rect* out) const {
+ RenderWidgetHostViewEfl* view = static_cast<RenderWidgetHostViewEfl*>(
+ web_contents_->GetRenderWidgetHostView());
+ if (view)
+ *out = view->GetBoundsInRootWindow();
+}
+
+void WebContentsViewEfl::SizeContents(const gfx::Size& size) {
+ RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
+ if (rwhv)
+ rwhv->SetSize(size);
+}
+
+void WebContentsViewEfl::Focus() {
+ if (web_contents_->GetInterstitialPage()) {
+ web_contents_->GetInterstitialPage()->Focus();
+ return;
+ }
+
+ if (delegate_.get() && delegate_->Focus())
+ return;
+
+ RenderWidgetHostView* rwhv =
+ web_contents_->GetFullscreenRenderWidgetHostView();
+ if (!rwhv)
+ rwhv = web_contents_->GetRenderWidgetHostView();
+ if (rwhv)
+ rwhv->Focus();
+}
+
+void WebContentsViewEfl::SetInitialFocus() {
+ NOTIMPLEMENTED();
+}
+
+void WebContentsViewEfl::StoreFocus() {
+ NOTIMPLEMENTED();
+}
+
+void WebContentsViewEfl::RestoreFocus() {
+ NOTIMPLEMENTED();
+}
+
+DropData* WebContentsViewEfl::GetDropData() const {
+ NOTIMPLEMENTED();
+ return 0;
+}
+
+gfx::Rect WebContentsViewEfl::GetViewBounds() const {
+ NOTIMPLEMENTED();
+ return gfx::Rect();
+}
+
+void WebContentsViewEfl::ShowContextMenu(RenderFrameHost* render_frame_host,
+ const ContextMenuParams& params) {
+ if (delegate_)
+ delegate_->ShowContextMenu(render_frame_host, params);
+}
+
+#if 0
+void WebContentsViewEfl::ShowPopupMenu(RenderFrameHost* render_frame_host,
+ const gfx::Rect& bounds,
+ int item_height,
+ double item_font_size,
+ int selected_item,
+ const std::vector<MenuItem>& items,
+ bool right_aligned,
+ bool allow_multiple_selection) {
+ WebContentsDelegateEfl* delegate =
+ static_cast<WebContentsDelegateEfl*>(web_contents_->GetDelegate());
+ if (delegate) {
+ delegate->ShowPopupMenu(render_frame_host,
+ bounds,
+ blink::TextDirection(right_aligned),
+ 0,
+ items,
+ 0,
+ selected_item,
+ allow_multiple_selection);
+ }
+}
+#endif
+
+void WebContentsViewEfl::SetOrientation(int orientation) {
+ RenderWidgetHostViewEfl* rwhv = static_cast<RenderWidgetHostViewEfl*>(
+ web_contents_->GetRenderWidgetHostView());
+
+ if (rwhv) {
+ RenderWidgetHost* rwh = rwhv->GetRenderWidgetHost();
+ blink::WebScreenInfo screen_info;
+ rwh->GetWebScreenInfo(&screen_info);
+ screen_info.orientationAngle = orientation;
+
+ ViewMsg_Resize_Params params;
+ params.screen_info = screen_info;
+
+ rwh->Send(new ViewMsg_Resize(rwh->GetRoutingID(), params));
+ rwhv->UpdateScreenInfo(rwhv->GetNativeView());
+
+ WebContentsImpl& contents_impl = static_cast<WebContentsImpl&>(*web_contents_);
+ contents_impl.screen_orientation_dispatcher_host()->OnOrientationChange();
+ }
+
+ orientation_ = orientation;
+}
+
+} // namespace content
--- /dev/null
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEB_CONTENTS_VIEW_EFL
+#define WEB_CONTENTS_VIEW_EFL
+
+#include <Evas.h>
+
+#include "content/browser/web_contents/web_drag_dest_efl.h"
+#include "content/browser/renderer_host/render_view_host_delegate_view.h"
+#include "content/browser/web_contents/web_contents_view.h"
+
+namespace content {
+
+class WebContents;
+class WebContentsViewDelegate;
+
+class WebContentsViewEfl
+ : public content::WebContentsView
+ , public content::RenderViewHostDelegateView {
+ public:
+ WebContentsViewEfl(WebContents* contents,
+ WebContentsViewDelegate* delegate = NULL);
+ ~WebContentsViewEfl() override;
+
+ // content::WebContentsView implementation.
+ void CreateView(const gfx::Size&, gfx::NativeView context) override;
+ RenderWidgetHostViewBase* CreateViewForWidget(
+ RenderWidgetHost* render_widget_host, bool is_guest_view_hack) override;
+ RenderWidgetHostViewBase* CreateViewForPopupWidget(
+ RenderWidgetHost* render_widget_host) override;
+ void SetPageTitle(const base::string16& title) override;
+ void RenderViewCreated(RenderViewHost* host) override;
+ void RenderViewSwappedIn(RenderViewHost* host) override;
+ void SetOverscrollControllerEnabled(bool enabled) override;
+ gfx::NativeView GetNativeView() const override;
+ gfx::NativeView GetContentNativeView() const override;
+ gfx::NativeWindow GetTopLevelNativeWindow() const override;
+ void GetContainerBounds(gfx::Rect* out) const override;
+ void SizeContents(const gfx::Size& size) override;
+ void Focus() override;
+ void SetInitialFocus() override;
+ void StoreFocus() override;
+ void RestoreFocus() override;
+ DropData* GetDropData() const override;
+ gfx::Rect GetViewBounds() const override;
+
+ // content::RenderViewHostDelegateView implementation.
+ void ShowContextMenu(RenderFrameHost* render_frame_host, const ContextMenuParams& params) override;
+#if 0
+ void ShowPopupMenu(RenderFrameHost* render_frame_host,
+ const gfx::Rect& bounds,
+ int item_height,
+ double item_font_size,
+ int selected_item,
+ const std::vector<MenuItem>& items,
+ bool right_aligned,
+ bool allow_multiple_selection) override;
+#endif
+ void UpdateDragDest(RenderViewHost* host);
+
+ void SetOrientation(int orientation);
+
+private:
+ // Our optional views wrapper.
+ scoped_ptr<WebContentsViewDelegate> delegate_;
+
+ Evas_Object* native_view_;
+
+ WebDragDestDelegate* drag_dest_delegate_;
+
+ // The helper object that handles drag destination related interactions with
+ // EFL.
+ scoped_ptr<WebDragDestEfl> drag_dest_;
+
+ int orientation_;
+
+ WebContents* web_contents_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebContentsViewEfl);
+};
+
+}
+
+#endif
--- /dev/null
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/web_contents/web_drag_dest_efl.h"
+
+#include <string>
+
+#include "base/bind.h"
+#include "base/files/file_path.h"
+#include "base/message_loop/message_loop.h"
+#include "base/strings/utf_string_conversions.h"
+#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/public/browser/web_contents_delegate.h"
+#include "content/public/browser/web_drag_dest_delegate.h"
+#include "content/browser/renderer_host/render_widget_host_view_efl.h"
+#include "content/public/common/url_constants.h"
+#include "net/base/net_util.h"
+#include "third_party/WebKit/public/web/WebInputEvent.h"
+#include "ui/base/clipboard/custom_data_helper.h"
+
+
+using blink::WebDragOperation;
+using blink::WebDragOperationNone;
+using blink::WebDragOperationCopy;
+
+namespace content {
+
+#ifdef OS_TIZEN_TV
+static void drag_state_enter_cb(void *data, Evas_Object *obj) {
+ WebDragDestEfl *webdragdestefl = (WebDragDestEfl *)data;
+
+ webdragdestefl->drop_data_.reset(new DropData);
+
+ if (webdragdestefl->delegate())
+ webdragdestefl->delegate()->DragInitialize(webdragdestefl->web_contents());
+}
+
+static void drag_state_leave_cb(void *data, Evas_Object *obj) {
+ WebDragDestEfl *webdragdestefl = (WebDragDestEfl *)data;
+
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&WebDragDestEfl::DragLeave, webdragdestefl->method_factory_.GetWeakPtr()));
+}
+
+static void drag_Pos(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y, Elm_Xdnd_Action action) {
+ WebDragDestEfl *webdragdestefl = (WebDragDestEfl *)data;
+
+ gfx::Rect rect = webdragdestefl->render_widget_host_view()->GetBoundsInRootWindow();
+ gfx::Point point = gfx::Point(rect.x(), rect.y());
+
+ webdragdestefl->GetRenderViewHost()->DragTargetDragOver(
+ point,
+ point,
+ WebDragOperationCopy,
+ blink::WebInputEvent::ControlKey);
+
+ if (webdragdestefl->delegate())
+ webdragdestefl->delegate()->OnDragOver();
+}
+
+static Eina_Bool drag_drop_cb(void *data, Evas_Object *obj, Elm_Selection_Data *drop) {
+ WebDragDestEfl *webdragdestefl = (WebDragDestEfl *)data;
+ webdragdestefl->drop_data_->text = base::NullableString16(
+ base::UTF8ToUTF16(std::string(reinterpret_cast<const char*>(drop->data))),
+ false);
+
+ gfx::Rect rect = webdragdestefl->render_widget_host_view()->GetBoundsInRootWindow();
+ gfx::Point point = gfx::Point(rect.x(), rect.y());
+
+ webdragdestefl->GetRenderViewHost()->DragTargetDragEnter(
+ *webdragdestefl->drop_data_.get(),
+ point,
+ point,
+ WebDragOperationCopy,
+ blink::WebInputEvent::ControlKey);
+
+ if (webdragdestefl->delegate())
+ webdragdestefl->delegate()->OnDragEnter();
+
+ // Efl port need to check this, GTK+ port has drag data received & drag drop two callbacks
+ webdragdestefl->method_factory_.InvalidateWeakPtrs();
+
+ webdragdestefl->GetRenderViewHost()->
+ DragTargetDrop(point, point, blink::WebInputEvent::ControlKey);
+
+ if (webdragdestefl->delegate())
+ webdragdestefl->delegate()->OnDrop();
+
+ return EINA_TRUE;
+}
+#endif // OS_TIZEN_TV
+
+WebDragDestEfl::WebDragDestEfl(WebContents* web_contents, RenderWidgetHostViewEfl *rwhvefl)
+ : method_factory_(this),
+ rwhvefl_(rwhvefl),
+ web_contents_(web_contents) {
+#ifdef OS_TIZEN_TV
+ Evas_Object* view = static_cast<Evas_Object*>(web_contents_->GetNativeView());
+ elm_drop_target_add(view, ELM_SEL_FORMAT_TEXT,
+ drag_state_enter_cb, this,
+ drag_state_leave_cb, this,
+ drag_Pos, this,
+ drag_drop_cb, this);
+#endif
+}
+
+WebDragDestEfl::~WebDragDestEfl() {
+#if defined(OS_TIZEN_TV)
+ Evas_Object* view = static_cast<Evas_Object*>(web_contents_->GetNativeView());
+#if defined(TIZEN_V_3_0)
+ elm_drop_target_del(
+ view, ELM_SEL_FORMAT_TEXT,
+ drag_state_enter_cb, this,
+ drag_state_leave_cb, this,
+ drag_Pos, this,
+ drag_drop_cb, this);
+#else
+ elm_drop_target_del(view);
+#endif // TIZEN_V_3_0
+#endif // OS_TIZEN_TV
+}
+
+void WebDragDestEfl::DragLeave() {
+ GetRenderViewHost()->DragTargetDragLeave();
+ if (delegate())
+ delegate()->OnDragLeave();
+
+ drop_data_.reset();
+}
+
+RenderViewHostImpl* WebDragDestEfl::GetRenderViewHost() const {
+ return static_cast<RenderViewHostImpl*>(web_contents_->GetRenderViewHost());
+}
+
+} // namespace content
--- /dev/null
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_DEST_EFL_H_
+#define CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_DEST_EFL_H_
+
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Ecore_Input.h>
+#include <Ecore_X.h>
+#include <Elementary.h>
+
+#include "base/gtest_prod_util.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "content/browser/renderer_host/render_view_host_impl.h"
+#include "content/common/content_export.h"
+#include "content/public/common/drop_data.h"
+#include "third_party/WebKit/public/web/WebDragOperation.h"
+
+namespace content {
+
+class RenderViewHostImpl;
+class WebContents;
+class WebDragDestDelegate;
+class RenderWidgetHostViewEfl;
+
+class CONTENT_EXPORT WebDragDestEfl {
+ public:
+ WebDragDestEfl(WebContents* web_contents, RenderWidgetHostViewEfl* rwhvefl);
+ ~WebDragDestEfl();
+
+ // Informs the renderer when a system drag has left the render view.
+ // See OnDragLeave().
+ void DragLeave();
+
+ WebDragDestDelegate* delegate() const { return delegate_; }
+ void set_delegate(WebDragDestDelegate* delegate) { delegate_ = delegate; }
+
+ RenderViewHostImpl* GetRenderViewHost() const;
+
+ RenderWidgetHostViewEfl* render_widget_host_view() { return rwhvefl_; }
+
+ WebContents* web_contents() { return web_contents_; }
+
+ // EFL port - public variables for now, need to add get methods to make private,
+ // faced build errors with scoped_ptr, base::WeakPtrFactory methods.
+
+ // The data for the current drag, or NULL if |context_| is NULL.
+ scoped_ptr<DropData> drop_data_;
+
+ base::WeakPtrFactory<WebDragDestEfl> method_factory_;
+
+ private:
+ // A delegate that can receive drag information about drag events.
+ WebDragDestDelegate* delegate_;
+
+ // The render view.
+ RenderWidgetHostViewEfl *rwhvefl_;
+
+ WebContents* web_contents_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebDragDestEfl);
+};
+} // namespace content
+
+#endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_DEST_EFL_H_
-#include "common/webcursor_efl.h"
+// Copyright (c) 2014-2015 Samsung Electronics. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+#include "content/common/cursors/webcursor_efl.h"
+
+#include "ecore_x_wrapper.h"
#include "base/logging.h"
#include "content/common/cursors/webcursor.h"
#include "third_party/WebKit/public/platform/WebCursorInfo.h"
-#include "ecore_x_wrapper.h"
-
using namespace blink;
namespace content {
int GetCursorType(int type) {
switch (type) {
case WebCursorInfo::TypePointer:
- return ECORE_X_CURSOR_XTERM;
+ return ECORE_X_CURSOR_ARROW;
case WebCursorInfo::TypeCross:
return ECORE_X_CURSOR_CROSS;
case WebCursorInfo::TypeHand:
namespace content {
namespace {
-class GpuMemoryBufferFactoryImpl : public GpuMemoryBufferFactory ,
- public gpu::ImageFactory {
+class GpuMemoryBufferFactoryImpl:
+ public GpuMemoryBufferFactory ,
+ public gpu::ImageFactory {
public:
// Overridden from GpuMemoryBufferFactory:
virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer(
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "paths_efl.h"
+#include "content/common/paths_efl.h"
#include <cstdlib>
#endif
namespace {
+#if defined(OS_TIZEN)
const base::FilePath::CharType kDataPath[] = FILE_PATH_LITERAL(DATA_DIR);
const base::FilePath::CharType kExePath[] = FILE_PATH_LITERAL(EXE_DIR);
const base::FilePath::CharType kLocalePath[] = FILE_PATH_LITERAL(LOCALE_DIR);
-#if defined(OS_TIZEN)
const base::FilePath::CharType kEdjeThemesDir[] = FILE_PATH_LITERAL("themes");
const base::FilePath::CharType kApplicationDataDir[] = FILE_PATH_LITERAL("data");
const base::FilePath::CharType kApplicationCacheDir[] = FILE_PATH_LITERAL("cache");
-const base::FilePath::CharType kDownloadsDir[] = FILE_PATH_LITERAL("/opt/usr/media/Downloads/");
-const base::FilePath::CharType kImagesDir[] = FILE_PATH_LITERAL("/opt/usr/media/Images/");
#else
const base::FilePath::CharType kEdjeThemesDir[] = FILE_PATH_LITERAL("resources");
-const base::FilePath::CharType kLocaleDir[] = FILE_PATH_LITERAL("locale");
-const base::FilePath::CharType kDownloadsDir[] = FILE_PATH_LITERAL("/tmp/");
-const base::FilePath::CharType kImagesDir[] = FILE_PATH_LITERAL("/tmp/");
#endif
const base::FilePath::CharType kApplicationName[] = FILE_PATH_LITERAL("chromium-efl");
const base::FilePath::CharType kApplicationDataBaseDir[] = FILE_PATH_LITERAL("db");
*result = base::FilePath(kDataPath).Append(kEdjeThemesDir);
return true;
#else
- case DIR_LOCALE:
- PathService::Get(base::DIR_MODULE, result);
- *result = result->Append(kLocaleDir);
- return true;
case EDJE_RESOURCE_DIR:
PathService::Get(base::DIR_MODULE, result);
*result = result->Append(kEdjeThemesDir);
return true;
#endif
- case DIR_DOWNLOADS:
- *result = base::FilePath(kDownloadsDir);
- return true;
- case DIR_DOWNLOAD_IMAGE:
- *result = base::FilePath(kImagesDir);
- return true;
case DIR_USER_DATA:
GetDirUserData(cur);
break;
WEB_DATABASE_DIR,
DIR_USER_DATA,
DIR_DATA_PATH,
- DIR_DOWNLOADS,
- DIR_DOWNLOAD_IMAGE,
DIR_LOCALE,
PATH_END
};
--- /dev/null
+# Copyright (c) 2015 Samsung Electronics. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables': {
+ 'external_content_common_deps': [
+ '<(DEPTH)/tizen_src/build/system.gyp:ecore-x',
+ '<(DEPTH)/tizen_src/build/system.gyp:capi-appfw-application',
+ ],
+ 'external_content_browser_deps': [
+ '<(DEPTH)/tizen_src/build/system.gyp:ecore',
+ '<(DEPTH)/tizen_src/build/system.gyp:ecore-x',
+ '<(DEPTH)/tizen_src/build/system.gyp:ecore-evas',
+ '<(DEPTH)/tizen_src/build/system.gyp:elementary',
+ '<(DEPTH)/tizen_src/build/system.gyp:efl-assist',
+ '<(DEPTH)/tizen_src/chromium_impl/efl/efl.gyp:window-factory',
+ ],
+ 'external_content_gpu_deps': [
+ '<(DEPTH)/tizen_src/build/system.gyp:evas',
+ ],
+ 'external_content_shell_deps': [
+ '<(DEPTH)/tizen_src/build/system.gyp:evas',
+ '<(DEPTH)/tizen_src/build/system.gyp:ecore-evas',
+ '<(DEPTH)/tizen_src/build/system.gyp:ecore-x',
+ '<(DEPTH)/tizen_src/build/system.gyp:elementary',
+ '<(DEPTH)/tizen_src/chromium_impl/efl/efl.gyp:efl-init',
+ '<(DEPTH)/tizen_src/chromium_impl/components/components.gyp:js_dialogs_efl',
+ ],
+ 'external_native_theme_deps': [
+ '<(DEPTH)/tizen_src/chromium_impl/ui/ui_targets_efl.gyp:ui_native_theme_inject',
+ ],
+ },
+ 'target_defaults': {
+ 'target_conditions': [
+
+ ['_target_name=="content_common"', {
+ 'defines': [
+ 'DATA_DIR="<(data_dir)"',
+ 'EXE_DIR="<(exe_dir)"',
+ 'EDJE_DIR="<(edje_dir)"',
+ 'LOCALE_DIR="<(locale_dir)"',
+ ],
+ 'sources': [
+ 'common/paths_efl.h',
+ 'common/paths_efl.cc',
+ 'common/cursors/webcursor_efl.cc',
+ 'common/cursors/webcursor_efl.h',
+ ],
+ 'conditions': [
+ ['building_for_tizen==1', {
+ 'sources': [
+ 'common/gpu/client/gpu_memory_buffer_impl_efl.cc',
+ 'common/gpu/client/gpu_memory_buffer_impl_efl_pixmap.cc',
+ 'common/gpu/client/gpu_memory_buffer_impl_efl_pixmap.h',
+ 'common/gpu/gpu_memory_buffer_factory_efl.cc',
+ 'common/gpu/gpu_memory_buffer_factory_efl_pixmap.cc',
+ 'common/gpu/gpu_memory_buffer_factory_efl_pixmap.h',
+ ],
+ 'sources/': [
+ [ 'exclude', 'common/gpu/client/gpu_memory_buffer_impl_linux.cc$' ],
+ [ 'exclude', 'common/gpu/gpu_memory_buffer_factory_linux.cc' ],
+ ]
+ }],
+ ],
+ }],
+
+ ['_target_name=="content_browser"', {
+ 'sources': [
+ 'browser/web_contents/web_contents_view_efl.h',
+ 'browser/web_contents/web_contents_view_efl.cc',
+ 'browser/web_contents/web_contents_impl_efl.h',
+ 'browser/web_contents/web_contents_impl_efl.cc',
+ 'browser/web_contents/web_drag_dest_efl.h',
+ 'browser/web_contents/web_drag_dest_efl.cc',
+ 'browser/renderer_host/disambiguation_popup_efl.h',
+ 'browser/renderer_host/disambiguation_popup_efl.cc',
+ 'browser/renderer_host/native_web_keyboard_event_efl.cc',
+ 'browser/renderer_host/render_widget_host_view_efl.h',
+ 'browser/renderer_host/render_widget_host_view_efl.cc',
+ 'browser/renderer_host/web_event_factory_efl.h',
+ 'browser/renderer_host/web_event_factory_efl.cc',
+ ],
+ }],
+
+ ['_target_name=="content_renderer"', {
+ 'sources': [
+ '<(DEPTH)/content/renderer/external_popup_menu.cc',
+ '<(DEPTH)/content/renderer/external_popup_menu.h',
+ ],
+ }],
+
+ ['_target_name=="content_gpu"', {
+ 'sources': [
+ 'gpu/gpu_thread_override_efl.cc',
+ 'gpu/gpu_thread_override_efl.h',
+ ],
+ }],
+
+ ['_target_name=="content_shell_lib"', {
+ 'sources': [
+ 'shell/browser/shell_efl.cc',
+ 'shell/browser/shell_web_contents_view_delegate_efl.cc',
+ ],
+ 'defines': [
+ 'SHELL_USE_CUSTOM_JS_DIALOG_MANAGER',
+ ],
+ }],
+
+ ['_target_name=="content_shell"', {
+ 'sources': [
+ 'shell/browser/shell_main_efl.cc',
+ ],
+ 'sources/': [
+ [ 'exclude', 'shell/app/shell_main.cc$' ],
+ ],
+ }],
+ ],
+ }
+}
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "gpu/gpu_thread_override_efl.h"
+#include "content/gpu/gpu_thread_override_efl.h"
#include "content/common/gpu/gpu_messages.h"
#include "content/gpu/gpu_process.h"
-#include "gl/gl_shared_context_efl.h"
+#include "ui/gl/gl_shared_context_efl.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_message_macros.h"
explicit GpuChildThreadEfl(const std::string& channel_id)
: GpuChildThread(channel_id) { }
- virtual bool OnControlMessageReceived(const IPC::Message& msg) override {
+ bool OnControlMessageReceived(const IPC::Message& msg) override {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(GpuChildThreadEfl, msg)
IPC_MESSAGE_HANDLER(GpuMsg_Initialize, OnInitialize)
explicit InProcessGpuThreadEfl(const std::string& channel_id)
: InProcessGpuThread(channel_id) { }
- virtual void Init() override {
+ void Init() override {
gpu_process_ = new content::GpuProcess();
// The process object takes ownership of the thread object, so do not
// save and delete the pointer.
--- /dev/null
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/shell/browser/shell.h"
+
+#include <Evas.h>
+#include <Ecore_Evas.h>
+#include <Elementary.h>
+
+#include "base/command_line.h"
+#include "base/strings/utf_string_conversions.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/common/content_switches.h"
+#include "content/public/browser/render_view_host.h"
+#include "content/shell/common/shell_switches.h"
+#include "content/shell/browser/layout_test/layout_test_javascript_dialog_manager.h"
+#include "efl/window_factory.h"
+#include "components/js_dialogs_efl/javascript_dialog_manager_efl.h"
+#include "ui/gl/gl_switches.h"
+#include "cc/base/switches.h"
+
+namespace content {
+
+class Shell::Impl {
+ public:
+ Impl(Shell* shell, Evas_Object* window)
+ : url_bar_(NULL)
+ , refresh_btn_(NULL)
+ , stop_btn_(NULL)
+ , back_btn_(NULL)
+ , forward_btn_(NULL)
+ , shell_(shell) {
+
+ Evas_Object *box = elm_box_add(window);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(window, box);
+ evas_object_show(box);
+
+ if (!base::CommandLine::ForCurrentProcess()->
+ HasSwitch(switches::kDumpRenderTree))
+ CreateURLBar(box);
+
+ Evas_Object* view = static_cast<Evas_Object*>(
+ shell->web_contents()->GetNativeView());
+ evas_object_size_hint_align_set(view, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(view, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(box, view);
+ }
+
+ void CreateURLBar(Evas_Object* box) {
+ Evas_Object* wrapper = elm_box_add(box);
+ elm_box_horizontal_set(wrapper, EINA_TRUE);
+ evas_object_size_hint_align_set(wrapper, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(wrapper, EVAS_HINT_EXPAND, 0.0f);
+ evas_object_show(wrapper);
+
+ Evas_Object *button_box = elm_box_add(wrapper);
+ elm_box_horizontal_set(button_box, EINA_TRUE);
+
+ Evas_Object* new_window_button = AddButton(button_box, "file", OnNewWindow);
+ back_btn_ = AddButton(button_box, "arrow_left", OnBack);
+ forward_btn_ = AddButton(button_box, "arrow_right", OnForward);
+ refresh_btn_ = AddButton(button_box, "refresh", OnRefresh);
+ stop_btn_ = AddButton(button_box, "close", OnStop);
+
+#if !defined(OS_TIZEN)
+ elm_object_text_set(new_window_button, "New Window");
+ elm_object_text_set(back_btn_, "Back");
+ elm_object_text_set(forward_btn_, "Forward");
+ elm_object_text_set(refresh_btn_, "Refresh");
+ elm_object_text_set(stop_btn_, "Stop");
+#else
+ (void)new_window_button;
+#endif
+
+ evas_object_show(button_box);
+ elm_box_pack_start(wrapper, button_box);
+
+ url_bar_ = elm_entry_add(wrapper);
+ elm_entry_single_line_set(url_bar_, EINA_TRUE);
+ elm_entry_scrollable_set(url_bar_, EINA_TRUE);
+ evas_object_size_hint_align_set(url_bar_, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(url_bar_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_entry_input_panel_layout_set(url_bar_, ELM_INPUT_PANEL_LAYOUT_URL);
+ evas_object_size_hint_weight_set(url_bar_, EVAS_HINT_EXPAND, 0.0f);
+ evas_object_size_hint_align_set(url_bar_, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(url_bar_, "activated", OnURLEntered, this);
+ elm_box_pack_end(wrapper, url_bar_);
+ evas_object_show(url_bar_);
+
+ elm_box_pack_end(box, wrapper);
+ }
+
+ Evas_Object* AddButton(Evas_Object* parent_box,
+ const char* icon_name, Evas_Smart_Cb cb) {
+ Evas_Object* btn = elm_button_add(parent_box);
+ Evas_Object* icon = elm_icon_add(parent_box);
+ elm_icon_standard_set(icon, icon_name);
+ elm_object_part_content_set(btn, "icon", icon);
+ evas_object_smart_callback_add(btn, "clicked", cb, this);
+ elm_box_pack_end(parent_box, btn);
+ evas_object_show(btn);
+ return btn;
+ }
+
+ void SetAddressBarURL(const char* url) {
+ if (url_bar_)
+ elm_object_text_set(url_bar_, url);
+ }
+
+ void ToggleControl(UIControl control, bool is_enabled) {
+ if (control == BACK_BUTTON && back_btn_) {
+ elm_object_disabled_set(back_btn_, !is_enabled);
+ } else if (control == FORWARD_BUTTON && forward_btn_) {
+ elm_object_disabled_set(forward_btn_, !is_enabled);
+ } else if (control == STOP_BUTTON && stop_btn_) {
+ elm_object_disabled_set(stop_btn_, !is_enabled);
+ }
+ }
+
+ private:
+ static void OnBack(void* data, Evas_Object*, void*) {
+ static_cast<Shell::Impl*>(data)->shell_->GoBackOrForward(-1);
+ }
+
+ static void OnNewWindow(void* data, Evas_Object*, void*) {
+ Shell* shell = static_cast<Shell::Impl*>(data)->shell_;
+ Shell::CreateNewWindow(shell->web_contents()->GetBrowserContext(),
+ GURL("https://www.google.com"),
+ NULL,
+ MSG_ROUTING_NONE,
+ gfx::Size(kDefaultTestWindowWidthDip,
+ kDefaultTestWindowHeightDip));
+ }
+
+ static void OnForward(void* data, Evas_Object*, void*) {
+ static_cast<Shell::Impl*>(data)->shell_->GoBackOrForward(1);
+ }
+
+ static void OnRefresh(void* data, Evas_Object*, void*) {
+ static_cast<Shell::Impl*>(data)->shell_->Reload();
+ }
+
+ static void OnStop(void* data, Evas_Object*, void*) {
+ static_cast<Shell::Impl*>(data)->shell_->Stop();
+ }
+
+ static void OnURLEntered(void *data, Evas_Object *obj, void*) {
+ GURL url(elm_object_text_get(obj));
+ if (!url.has_scheme()) {
+ url = GURL(std::string("http://") + std::string(elm_object_text_get(obj)));
+ elm_object_text_set(obj, url.spec().c_str());
+ }
+ static_cast<Shell::Impl*>(data)->shell_->LoadURL(url);
+ }
+
+ Evas_Object* url_bar_;
+ Evas_Object* refresh_btn_;
+ Evas_Object* stop_btn_;
+ Evas_Object* back_btn_;
+ Evas_Object* forward_btn_;
+
+ Shell* shell_;
+};
+
+namespace {
+void OnShellWindowDelRequest(void* data, Evas_Object*, void*) {
+ Shell* shell = static_cast<Shell*>(data);
+ shell->Close();
+}
+}
+
+// static
+void Shell::PlatformInitialize(const gfx::Size& default_window_size) {
+ elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
+ elm_config_preferred_engine_set("opengl_x11");
+ LOG(INFO) << "EFL Shell platform initialized";
+}
+
+void Shell::PlatformExit() {
+ LOG(INFO) << "EFL Shell platform exit";
+}
+
+void Shell::PlatformCleanUp() {
+}
+
+void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) {
+ impl_->ToggleControl(control, is_enabled);
+}
+
+void Shell::PlatformSetAddressBarURL(const GURL& url) {
+ impl_->SetAddressBarURL(url.spec().c_str());
+}
+
+void Shell::PlatformSetIsLoading(bool loading) {
+}
+
+void Shell::PlatformCreateWindow(int width, int height) {
+}
+
+void Shell::PlatformSetContents() {
+ Evas_Object* win = efl::WindowFactory::GetHostWindow(web_contents_.get());
+ evas_object_smart_callback_add(win, "delete,request",
+ OnShellWindowDelRequest, this);
+ evas_object_resize(win, kDefaultTestWindowWidthDip,
+ kDefaultTestWindowHeightDip);
+ evas_object_show(win);
+ window_ = win;
+ impl_ = new Impl(this, static_cast<Evas_Object*>(window_));
+}
+
+void Shell::PlatformResizeSubViews() {
+}
+
+void Shell::Close() {
+ LOG(INFO) << "Closing Content Shell EFL";
+ delete impl_;
+ delete this;
+}
+
+void Shell::PlatformSetTitle(const base::string16& title) {
+ elm_win_title_set(static_cast<Evas_Object*>(window_), UTF16ToUTF8(title).c_str());
+}
+
+bool Shell::PlatformHandleContextMenu(
+ const content::ContextMenuParams& params) {
+ return false;
+}
+
+JavaScriptDialogManager* Shell::GetJavaScriptDialogManager() {
+ if (!dialog_manager_) {
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ if (command_line.HasSwitch(switches::kDumpRenderTree)) {
+ dialog_manager_.reset(new LayoutTestJavaScriptDialogManager);
+ } else {
+ dialog_manager_.reset(new JavaScriptDialogManagerEfl);
+ }
+ }
+ return dialog_manager_.get();
+}
+
+} // namespace content
--- /dev/null
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/public/app/content_main.h"
+
+#include "content/shell/app/shell_main_delegate.h"
+#include "efl/init.h"
+
+int main(int argc, const char* argv[]) {
+ if (efl::Initialize(argc, argv))
+ return 1;
+
+ content::ShellMainDelegate delegate;
+
+ content::ContentMainParams prams(&delegate);
+ prams.argc = argc;
+ prams.argv = argv;
+ return content::ContentMain(prams);
+}
--- /dev/null
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/shell/browser/shell_web_contents_view_delegate.h"
+
+#include <Evas.h>
+#include <Elementary.h>
+
+#include "base/command_line.h"
+#include "content/shell/browser/shell.h"
+#include "content/shell/browser/shell_browser_context.h"
+#include "content/shell/browser/shell_content_browser_client.h"
+#include "content/shell/browser/shell_devtools_frontend.h"
+#include "content/shell/common/shell_switches.h"
+#include "third_party/WebKit/public/web/WebContextMenuData.h"
+
+using blink::WebContextMenuData;
+
+namespace content {
+
+namespace {
+
+static Evas_Object* g_context_menu = NULL;
+
+void OpenInNewWindow(void* data, Evas_Object*, void*) {
+ const ContextMenuParams* params =
+ static_cast<const ContextMenuParams*>(data);
+ ShellBrowserContext* browser_context =
+ ShellContentBrowserClient::Get()->browser_context();
+ Shell::CreateNewWindow(browser_context,
+ params->link_url,
+ NULL,
+ MSG_ROUTING_NONE,
+ gfx::Size());
+}
+
+void Cut(void* data, Evas_Object*, void*) {
+ WebContents* wc = static_cast<WebContents*>(data);
+ wc->Cut();
+}
+
+void Copy(void* data, Evas_Object*, void*) {
+ WebContents* wc = static_cast<WebContents*>(data);
+ wc->Copy();
+}
+
+void Paste(void* data, Evas_Object*, void*) {
+ WebContents* wc = static_cast<WebContents*>(data);
+ wc->Paste();
+}
+
+void Delete(void* data, Evas_Object*, void*) {
+ WebContents* wc = static_cast<WebContents*>(data);
+ wc->Delete();
+}
+
+void Forward(void* data, Evas_Object*, void*) {
+ WebContents* wc = static_cast<WebContents*>(data);
+ wc->GetController().GoToOffset(1);
+ wc->Focus();
+}
+
+void Back(void* data, Evas_Object*, void*) {
+ WebContents* wc = static_cast<WebContents*>(data);
+ wc->GetController().GoToOffset(-1);
+ wc->Focus();
+}
+
+void Reload(void* data, Evas_Object*, void*) {
+ WebContents* wc = static_cast<WebContents*>(data);
+ wc->GetController().Reload(false);
+ wc->Focus();
+}
+
+}
+
+WebContentsViewDelegate* CreateShellWebContentsViewDelegate(
+ WebContents* web_contents) {
+ return new ShellWebContentsViewDelegate(web_contents);
+}
+
+ShellWebContentsViewDelegate::ShellWebContentsViewDelegate(
+ WebContents* web_contents)
+ : web_contents_(web_contents) {
+}
+
+ShellWebContentsViewDelegate::~ShellWebContentsViewDelegate() {
+}
+
+void ShellWebContentsViewDelegate::ShowContextMenu(
+ RenderFrameHost* render_frame_host,
+ const ContextMenuParams& params) {
+ if (base::CommandLine::ForCurrentProcess()->
+ HasSwitch(switches::kDumpRenderTree))
+ return;
+
+ if (g_context_menu) {
+ elm_menu_close(g_context_menu);
+ evas_object_del(g_context_menu);
+ }
+
+ params_ = params;
+
+ bool has_link = !params.unfiltered_link_url.is_empty();
+ Evas_Object* parent =
+ static_cast<Evas_Object*>(web_contents_->GetContentNativeView());
+
+ Evas_Object* menu = elm_menu_add(parent);
+ Elm_Object_Item* menu_it = NULL;
+
+ if (has_link) {
+ elm_menu_item_add(menu, NULL, NULL, "Open in new window",
+ OpenInNewWindow, ¶ms_);
+ elm_menu_item_separator_add(menu, NULL);
+ }
+
+ if (params_.is_editable) {
+ menu_it = elm_menu_item_add(menu, NULL, NULL, "Cut",
+ Cut, web_contents_);
+ elm_object_item_disabled_set(menu_it,
+ (params_.edit_flags & WebContextMenuData::CanCut) == 0);
+ menu_it = elm_menu_item_add(menu, NULL, NULL, "Copy",
+ Copy, web_contents_);
+ elm_object_item_disabled_set(menu_it,
+ (params_.edit_flags & WebContextMenuData::CanCopy) == 0);
+ menu_it = elm_menu_item_add(menu, NULL, NULL, "Paste",
+ Paste, web_contents_);
+ elm_object_item_disabled_set(menu_it,
+ (params_.edit_flags & WebContextMenuData::CanPaste) == 0);
+ menu_it = elm_menu_item_add(menu, NULL, "delete", "Delete",
+ Delete, web_contents_);
+ elm_object_item_disabled_set(menu_it,
+ (params_.edit_flags & WebContextMenuData::CanDelete) == 0);
+ elm_menu_item_separator_add(menu, NULL);
+ }
+
+ menu_it = elm_menu_item_add(menu, NULL, "back", "Back",
+ Back, web_contents_);
+ elm_object_item_disabled_set(menu_it,
+ !web_contents_->GetController().CanGoBack());
+ menu_it = elm_menu_item_add(menu, NULL, "forward", "Forward",
+ Forward, web_contents_);
+ elm_object_item_disabled_set(menu_it,
+ !web_contents_->GetController().CanGoForward());
+ elm_menu_item_add(menu, NULL, "reload", "Reload",
+ Reload, web_contents_);
+
+ g_context_menu = menu;
+ elm_menu_move(menu, params.x, params.y);
+ evas_object_show(menu);
+}
+
+} // namespace content
--- /dev/null
+# Copyright (c) 2015 Samsung Electronics. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'window-factory',
+ 'type': 'static_library',
+ 'dependencies': [
+ '<(DEPTH)/tizen_src/build/system.gyp:evas',
+ '<(DEPTH)/tizen_src/build/system.gyp:elementary',
+ ],
+ 'include_dirs': [
+ '<(DEPTH)',
+ ],
+ 'sources': [
+ 'window_factory.h',
+ 'window_factory.cc',
+ ],
+ },
+ {
+ 'target_name': 'efl-init',
+ 'type': 'static_library',
+ 'dependencies': [
+ '<(DEPTH)/tizen_src/build/system.gyp:evas',
+ '<(DEPTH)/tizen_src/build/system.gyp:elementary',
+ ],
+ 'include_dirs': [
+ '<(DEPTH)',
+ ],
+ 'sources': [
+ 'init.h',
+ 'init.cc',
+ ],
+ }
+ ],
+}
--- /dev/null
+// Copyright (c) 2015 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "efl/init.h"
+
+#include <Elementary.h>
+#include <Ecore_X.h>
+#include <Ecore.h>
+
+#include "base/logging.h"
+#include "base/message_loop/message_loop.h"
+#include "base/message_loop/message_pump_ecore.h"
+#include "cc/base/switches.h"
+#include "content/public/common/content_switches.h"
+#include "ui/gfx/screen_efl.h"
+#include "ui/gfx/switches.h"
+#include "ui/gl/gl_switches.h"
+
+namespace efl {
+
+namespace {
+scoped_ptr<base::MessagePump> MessagePumpFactory() {
+ return scoped_ptr<base::MessagePump>(new base::MessagePumpEcore);
+}
+} // namespace
+
+int Initialize(int argc, const char* argv[]) {
+ elm_init(argc, (char**)argv);
+ ecore_init();
+ ecore_x_init(NULL);
+ eina_init();
+ evas_init();
+
+ setenv("ELM_ACCEL", "hw", 1);
+ elm_config_preferred_engine_set("opengl_x11");
+
+ if (!base::MessageLoop::InitMessagePumpForUIFactory(&MessagePumpFactory)) {
+ LOG(ERROR) << "Failed to install EFL message pump!";
+ return 1;
+ }
+
+ ui::InstallScreenInstance();
+
+ return 0;
+}
+
+void AppendPortParams(base::CommandLine& cmdline) {
+ cmdline.AppendSwitchASCII(switches::kUseGL,
+ gfx::kGLImplementationEGLName);
+ cmdline.AppendSwitch(cc::switches::kCompositeToMailbox);
+ cmdline.AppendSwitch(switches::kInProcessGPU);
+ cmdline.AppendSwitch(switches::kDisableDelegatedRenderer);
+}
+
+} // namespace efl
--- /dev/null
+// Copyright (c) 2015 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef _EFL_PORT_IMPL_INIT_H_
+#define _EFL_PORT_IMPL_INIT_H_
+
+#include "base/command_line.h"
+
+namespace efl {
+
+int Initialize(int argc, const char* argv[]);
+
+void AppendPortParams(base::CommandLine&);
+
+} // namespace efl
+
+#endif // _EFL_PORT_IMPL_INIT_H_
--- /dev/null
+// Copyright (c) 2015 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "efl/window_factory.h"
+
+#include <Elementary.h>
+
+#include "base/logging.h"
+
+using content::WebContents;
+
+namespace efl {
+
+std::map<const WebContents*, Evas_Object*> WindowFactory::window_map_;
+
+// static
+Evas_Object* WindowFactory::GetHostWindow(const WebContents* web_contents) {
+ DCHECK(web_contents);
+
+ if (window_map_.find(web_contents) != window_map_.end())
+ return window_map_[web_contents];
+
+ Evas_Object* win = elm_win_util_standard_add("", "");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ evas_object_smart_callback_add(win, "delete,request",
+ OnWindowRemoved, web_contents);
+
+ window_map_[web_contents] = win;
+
+ return win;
+}
+
+// static
+void WindowFactory::OnWindowRemoved(void* data, Evas_Object*, void*) {
+ const WebContents* wc = static_cast<const WebContents*>(data);
+
+ LOG(INFO) << "Closed EFL window host for WebContens: " << wc;
+
+ DCHECK(window_map_.find(wc) != window_map_.end());
+ window_map_.erase(wc);
+}
+
+} // namespace efl
--- /dev/null
+// Copyright (c) 2015 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef _EFL_WINDOW_FACTORY_EFL_H_
+#define _EFL_WINDOW_FACTORY_EFL_H_
+
+#include <Evas.h>
+#include <map>
+
+namespace content {
+class WebContents;
+};
+
+namespace efl {
+
+class WindowFactory {
+ public:
+ // TODO: Function should return NativeView, once NativeView typedef is fixed
+ static Evas_Object* GetHostWindow(const content::WebContents*);
+
+ private:
+ static void OnWindowRemoved(void*, Evas_Object*, void*);
+
+ static std::map<const content::WebContents*, Evas_Object*> window_map_;
+};
+
+} // namespace efl
+
+#endif
--- /dev/null
+# Copyright (c) 2015 Samsung Electronics. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'target_defaults': {
+ 'target_conditions': [
+ ['_target_name=="gpu_config"', {
+ 'conditions': [
+ ['building_for_tizen==1', {
+ 'sources/': [
+ ['exclude', 'config/gpu_driver_bug_list_json\\.cc$'],
+ ['exclude', 'config/gpu_info_collector_linux\\.cc$'],
+ ['exclude', 'config/gpu_info_collector_x11\\.cc$'],
+ ['exclude', 'config/software_rendering_list_json\\.cc$'],
+ ],
+ 'sources': [
+ 'config/gpu_driver_bug_list_json_efl.cc',
+ 'config/gpu_info_collector_efl.cc',
+ 'config/software_rendering_list_json_efl.cc',
+ ],
+ }],
+ ],
+ }],
+ ],
+ }
+}
--- /dev/null
+# Copyright (c) 2015 Samsung Electronics. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'target_defaults': {
+ 'target_conditions': [
+
+ ['_target_name=="webcore_rendering"', {
+ 'sources/': [
+ [ 'exclude', 'rendering/RenderThemeChromiumDefault\\.cpp$' ],
+ ],
+ 'sources': [
+ 'rendering/RenderThemeChromiumDefault_override.cpp',
+ 'rendering/RenderThemeChromiumTizen.cpp',
+ 'rendering/RenderThemeChromiumTizen.h',
+ ],
+ }],
+
+ ['_target_name=="webcore_generated"', {
+ 'sources': [
+ '<(SHARED_INTERMEDIATE_DIR)/TizenUserAgentStyleSheets.h',
+ '<(SHARED_INTERMEDIATE_DIR)/TizenUserAgentStyleSheetsData.cpp',
+ ],
+ 'actions': [
+ {
+ 'action_name': 'TizenUserAgentStyleSheets',
+ 'variables': {
+ 'scripts': [
+ '<(DEPTH)/third_party/WebKit/Source/build/scripts/make-file-arrays.py',
+ ],
+ 'stylesheets': [
+ '<(DEPTH)/tizen_src/chromium_impl/third_party/WebKit/Source/core/rendering/themeChromiumTizen.css',
+ ],
+ },
+ 'inputs': [
+ '<@(scripts)',
+ '<@(stylesheets)'
+ ],
+ 'outputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/TizenUserAgentStyleSheets.h',
+ '<(SHARED_INTERMEDIATE_DIR)/TizenUserAgentStyleSheetsData.cpp',
+ ],
+ 'action': [
+ 'python',
+ '<@(scripts)',
+ '--namespace',
+ 'blink',
+ '--out-h=<(SHARED_INTERMEDIATE_DIR)/TizenUserAgentStyleSheets.h',
+ '--out-cpp=<(SHARED_INTERMEDIATE_DIR)/TizenUserAgentStyleSheetsData.cpp',
+ '<@(stylesheets)',
+ ],
+ },
+ ], # actions
+ }],
+
+ ], # target_conditions
+ }, # target_defaults
+}
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "clipboard_efl.h"
+#include "ui/base/clipboard/clipboard_efl.h"
#include <Elementary.h>
#include "base/logging.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
-#include "components/clipboard/clipboard_helper_efl.h"
#include "third_party/skia/include/core/SkBitmap.h"
-#include "third_party/WebKit/Source/platform/clipboard/ClipboardMimeTypes.h"
-#include "ui/gfx/size.h"
+#include "ui/base/clipboard/clipboard_helper_efl.h"
+#include "ui/gfx/geometry/size.h"
using base::string16;
const char kRTFFormat[] = "rtf";
const char kBitmapFormat[] = "bitmap";
const char kWebKitSmartPasteFormat[] = "webkit_smart";
-const char kBookmarkFormat[] = "bookmark";
const char kMimeTypePepperCustomData[] = "chromium/x-pepper-custom-data";
const char kMimeTypeWebCustomData[] = "chromium/x-web-custom-data";
} // namespace
types->clear();
*contains_filenames = false;
if (IsFormatAvailable(GetPlainTextFormatType(), type))
- types->push_back(base::ASCIIToUTF16(blink::mimeTypeTextPlain));
+ types->push_back(base::UTF8ToUTF16(GetPlainTextFormatType().ToString()));
if (IsFormatAvailable(GetHtmlFormatType(), type))
- types->push_back(base::ASCIIToUTF16(blink::mimeTypeTextHTML));
+ types->push_back(base::UTF8ToUTF16(GetHtmlFormatType().ToString()));
if (IsFormatAvailable(GetBitmapFormatType(), type))
- types->push_back(base::ASCIIToUTF16(blink::mimeTypeImagePng));
+ types->push_back(base::UTF8ToUTF16(GetBitmapFormatType().ToString()));
}
void ClipboardEfl::ReadText(ClipboardType type, string16* result) const {
void ClipboardEfl::WriteHTML(const char* markup_data, size_t markup_len,
const char* url_data, size_t url_len) {
- ClipboardHelperEfl::GetInstance()->
- SetData(std::string(markup_data, markup_len), ClipboardHelperEfl::CLIPBOARD_DATA_TYPE_MARKUP);
+ NOTIMPLEMENTED();
}
void ClipboardEfl::WriteRTF(const char* rtf_data, size_t data_len) {
#define CLIPBOARD_EFL_H
#include "ui/base/clipboard/clipboard.h"
+
namespace ui {
class ClipboardEfl: public Clipboard {
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/clipboard/clipboard_helper_efl.h"
-#include "eweb_view.h"
+#include "ui/base/clipboard/clipboard_helper_efl.h"
#include <Evas.h>
#include <Ecore_Evas.h>
-#include <Ecore_X.h>
+#include "ecore_x_wrapper.h"
#include <Elementary.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include "base/memory/singleton.h"
+#include "base/logging.h"
+#include "base/strings/string16.h"
+#include "base/strings/utf_string_conversions.h"
namespace {
int bufferLength;
ClipboardHelperEfl* clipboardHelper;
+#warning "TODO: Add proper delegate class for clipboard related functionality EWK needs."
EWebView* webView;
};
const char kCbhmAtomItem[] = "CBHM_ITEM";
const char kCbhmAtomMessage[] = "CBHM_MSG";
const char kCbhmAtomTextHtml[] = "text/html;charset=utf-8";
-const char kCbhmAtomTextUri[] = "text/uri";
const char kCbhmAtomTextUriList[] = "text/uri-list";
const char kCbhmAtomUTF8String[] = "UTF8_STRING";
const char kCbhmAtomXWindow[] = "CBHM_XWIN";
}
static void pasteSelectedClipboardItem(std::string data, std::string type, EWebView *webview) {
+#if 0
content::SelectionControllerEfl* controller = webview->GetSelectionController();
if (controller)
controller->HideHandleAndContextMenu();
webview->ExecuteEditCommand(type.c_str(), data.c_str());
ClipboardHelperEfl::connectClipboardWindow();
+#endif
}
static Eina_Bool clearClip(void* data, int type, void* event) {
pasteSelectedClipboardItem(
std::string(reinterpret_cast<char*>(pData->data), pData->length),
"InsertImage", clipData->webView);
- return 0;
+ return 0;
}
static int notifyEdje(ClipData* clipData, Ecore_X_Event_Selection_Notify* notifyData) {
SendCbhmMessage(kCbhmMessageShow0);
connectClipboardWindow();
+#if 0
view->SmartCallback<EWebViewCallbacks::ClipboardOpened>().call(0);
+#endif
}
void ClipboardHelperEfl::connectClipboardWindow() {
#include <string>
#include <Ecore.h>
-#include "ecore_x_wrapper.h"
+#include <Ecore_X.h>
#include "base/basictypes.h"
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "screen_efl.h"
-#include "eweb_view.h"
+#include "ui/gfx/screen_efl.h"
#include <X11/Xlib.h>
+#include "content/browser/renderer_host/dip_util.h"
#include "ui/gfx/screen_type_delegate.h"
#include "ui/base/x/x11_util.h"
+#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/display.h"
#include "ui/gfx/display_observer.h"
#include "ui/gfx/screen.h"
#include "ui/gfx/x/x11_types.h"
-#include "ui/views/view.h"
-#include "content/browser/renderer_host/dip_util.h"
namespace ui {
#endif
} // namespace
-class EflScreen : public gfx::Screen {
+class ScreenEfl : public gfx::Screen {
public:
- EflScreen() {
+ ScreenEfl() {
}
- virtual ~EflScreen() {
+ ~ScreenEfl() override {
}
- virtual gfx::Point GetCursorScreenPoint() override {
+ gfx::Point GetCursorScreenPoint() override {
XDisplay* display = gfx::GetXDisplay();
::Window root, child;
return gfx::Point(root_x, root_y);
}
- virtual gfx::NativeWindow GetWindowUnderCursor() override {
+ gfx::NativeWindow GetWindowUnderCursor() override {
return GetWindowAtScreenPoint(GetCursorScreenPoint());
}
- virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override {
+ gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override {
return NULL;
}
- virtual int GetNumDisplays() const override {
+ int GetNumDisplays() const override {
return 1;
}
- virtual std::vector<gfx::Display> GetAllDisplays() const override {
+ std::vector<gfx::Display> GetAllDisplays() const override {
return std::vector<gfx::Display>(1, GetPrimaryDisplay());
}
- virtual gfx::Display GetDisplayNearestWindow(gfx::NativeView view) const override {
+ gfx::Display GetDisplayNearestWindow(gfx::NativeView view) const override {
return GetPrimaryDisplay();
}
- virtual gfx::Display GetDisplayNearestPoint(
+ gfx::Display GetDisplayNearestPoint(
const gfx::Point& point) const override {
return GetPrimaryDisplay();
}
- virtual gfx::Display GetDisplayMatching(
+ gfx::Display GetDisplayMatching(
const gfx::Rect& match_rect) const override {
return GetPrimaryDisplay();
}
- virtual gfx::Display GetPrimaryDisplay() const override {
+ gfx::Display GetPrimaryDisplay() const override {
::Screen* screen = DefaultScreenOfDisplay(gfx::GetXDisplay());
const float device_scale_factor =
gfx::Display display(0);
+# warning "Figure out proper way to get current screen orientation"
+#if 0
// TODO(Youngsoo Choi): If there's a way to get orientation
// from platform not using saved value, it would be better.
display.SetRotationAsDegree(EWebView::GetOrientation());
+#endif
int width, height;
if (display.rotation() == gfx::Display::ROTATE_90 ||
return display;
}
- virtual void AddObserver(gfx::DisplayObserver* observer) override {
+ void AddObserver(gfx::DisplayObserver* observer) override {
}
- virtual void RemoveObserver(gfx::DisplayObserver* observer) override {
+ void RemoveObserver(gfx::DisplayObserver* observer) override {
}
private:
- DISALLOW_COPY_AND_ASSIGN(EflScreen);
+ DISALLOW_COPY_AND_ASSIGN(ScreenEfl);
};
void InstallScreenInstance()
static bool installed = false;
if (!installed) {
installed = true;
- gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, new ui::EflScreen());
+ gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, new ui::ScreenEfl());
}
}
} // namespace ui
namespace gfx {
Screen* CreateNativeScreen() {
- return new ui::EflScreen();
+ return new ui::ScreenEfl();
}
} // namespace gfx
#ifndef SCREEN_EFL
#define SCREEN_EFL
-#include "ui/gfx/screen.h"
-
namespace ui {
void InstallScreenInstance();
// Define OpenNewXDisplay and GetXDisplay to some unused name to be able to
// replace it with our own implementation.
+#define OpenNewXDisplay OpenNewXDisplayOverride
#define GetXDisplay GetXDisplayOverride
#include "ui/gfx/x/x11_types.cc"
#undef GetXDisplay
+#undef OpenNewXDisplay
-#include "ecore_x_wrapper.h"
+#include <Ecore_X.h>
#include <X11/Xlib.h>
namespace gfx {
-XDisplay* GetXDisplay() {
+Display* OpenNewXDisplay() {
static Display* display = static_cast<Display*>(ecore_x_display_get());
return display;
}
+XDisplay* GetXDisplay() {
+ return OpenNewXDisplay();
+}
+
}
#include <X11/Xlib.h>
#include <X11/Xmd.h>
#include <dri2/dri2.h>
+#include <dri2.h>
#include <stdint.h>
#include <libdrm/drm.h>
#include <tbm_bufmgr.h>
// static
EGLConfig EflPixmap::ChooseConfig() {
- // TODO(uzair.jaleel): Confirm these values on TV platform.
EGLint config_attributes_list[] = {
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT | EGL_PIXMAP_BIT,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 24,
EGL_STENCIL_SIZE, 8,
+#if defined(OS_TIZEN_TV)
EGL_SAMPLES, 4,
+#else
+ EGL_SAMPLES, 2,
+#endif
EGL_NONE
};
// initialize method in GLContextEGL
#define GLContextEGL GLContextEGLOverride
-#define private public
+#define private protected
#include "ui/gl/gl_context_egl.cc"
namespace gfx {
-struct GL_EXPORT GLContextEGL : public GLContextEGLOverride {
+class GL_EXPORT GLContextEGL : public GLContextEGLOverride {
+ public:
GLContextEGL(GLShareGroup* share_group);
- bool Initialize(
- GLSurface* compatible_surface, GpuPreference gpu_preference);
+ bool Initialize(GLSurface* compatible_surface,
+ GpuPreference gpu_preference) override;
+
+ private:
+ ~GLContextEGL() {};
};
GLContextEGL::GLContextEGL(GLShareGroup* share_group) :
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "gl/gl_shared_context_efl.h"
+#include "ui/gl/gl_shared_context_efl.h"
+
+#include <EGL/egl.h>
+#include <Ecore_Evas.h>
+#include <Evas_GL.h>
#include "base/threading/thread_restrictions.h"
#include "gpu/command_buffer/service/mailbox_manager_impl.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_share_group.h"
-#include <Ecore_Evas.h>
-#include <Evas_GL.h>
-
// Defined in gl_current_context_efl.cc because of conflict in chromium
// and efl gl includes.
extern void* GLGetCurentContext();
struct GLSharedContextEflPrivate : public gfx::GLContext {
- virtual bool Initialize(
+ GLSharedContextEflPrivate(Evas_Object* object)
+ : GLContext(GLSharedContextEfl::GetShareGroup()) {
+ Evas* evas = evas_object_evas_get(object);
+ evas_gl_config_ = evas_gl_config_new();
+ evas_gl_config_->options_bits = EVAS_GL_OPTIONS_NONE;
+ evas_gl_config_->color_format = EVAS_GL_RGBA_8888;
+ evas_gl_config_->depth_bits = EVAS_GL_DEPTH_BIT_24;
+ evas_gl_config_->stencil_bits = EVAS_GL_STENCIL_BIT_8;
+
+ evas_gl_ = evas_gl_new(evas);
+ evas_gl_context_ = evas_gl_context_create(evas_gl_, 0);
+ if (!evas_gl_context_)
+ LOG(FATAL) << "GLSharedContextEflPrivate(): Create evas gl context Fail";
+
+ evas_gl_surface_ = evas_gl_surface_create(
+ evas_gl_, evas_gl_config_, 1, 1);
+ if (!evas_gl_surface_)
+ LOG(FATAL) << "GLSharedContextEflPrivate(): Create evas gl Surface Fail";
+
+ evas_gl_make_current(evas_gl_, evas_gl_surface_, evas_gl_context_);
+ handle_ = GLGetCurentContext();
+ CHECK(handle_ != EGL_NO_CONTEXT);
+ evas_gl_make_current(evas_gl_, 0, 0);
+ }
+
+ bool Initialize(
gfx::GLSurface*, gfx::GpuPreference) override {
NOTREACHED();
return false;
}
- virtual void Destroy() override {
+ void Destroy() override {
NOTREACHED();
}
- virtual bool MakeCurrent(gfx::GLSurface*) override {
+ bool MakeCurrent(gfx::GLSurface*) override {
NOTREACHED();
return false;
}
- virtual void ReleaseCurrent(gfx::GLSurface*) override {
+ void ReleaseCurrent(gfx::GLSurface*) override {
NOTREACHED();
}
- virtual bool IsCurrent(gfx::GLSurface*) override {
+ bool IsCurrent(gfx::GLSurface*) override {
NOTREACHED();
return false;
}
- virtual void* GetHandle() override {
+ void* GetHandle() override {
return handle_;
}
- virtual void SetSwapInterval(int) override {
+ void SetSwapInterval(int) override {
NOTREACHED();
}
- GLSharedContextEflPrivate(Evas_Object* object);
+ private:
+ friend struct GLSharedContextEfl;
- ~GLSharedContextEflPrivate();
+ ~GLSharedContextEflPrivate() override {
+ evas_gl_surface_destroy(evas_gl_, evas_gl_surface_);
+ evas_gl_context_destroy(evas_gl_, evas_gl_context_);
+ evas_gl_config_free(evas_gl_config_);
+ evas_gl_free(evas_gl_);
+ }
void* handle_;
Evas_GL* evas_gl_;
Evas_GL_Config* evas_gl_config_;
};
-GLSharedContextEflPrivate::GLSharedContextEflPrivate(Evas_Object* object) :
- GLContext(GLSharedContextEfl::GetShareGroup()) {
- Evas* evas = evas_object_evas_get(object);
- evas_gl_config_ = evas_gl_config_new();
- evas_gl_config_->options_bits = EVAS_GL_OPTIONS_NONE;
- evas_gl_config_->color_format = EVAS_GL_RGBA_8888;
- evas_gl_config_->depth_bits = EVAS_GL_DEPTH_BIT_24;
- evas_gl_config_->stencil_bits = EVAS_GL_STENCIL_BIT_8;
-
- evas_gl_ = evas_gl_new(evas);
- evas_gl_context_ = evas_gl_context_create(evas_gl_, 0);
- if (!evas_gl_context_) {
- LOG(ERROR) << "GLSharedContextEflPrivate(): Create evas gl context Fail";
- }
-
- evas_gl_surface_ = evas_gl_surface_create(
- evas_gl_, evas_gl_config_, 1, 1);
- if (!evas_gl_surface_) {
- LOG(ERROR) << "GLSharedContextEflPrivate(): Create evas gl Surface Fail";
- }
-
- evas_gl_make_current(evas_gl_, evas_gl_surface_, evas_gl_context_);
- handle_ = GLGetCurentContext();
- evas_gl_make_current(evas_gl_, 0, 0);
-}
-
-GLSharedContextEflPrivate::~GLSharedContextEflPrivate() {
- evas_gl_surface_destroy(evas_gl_, evas_gl_surface_);
- evas_gl_context_destroy(evas_gl_, evas_gl_context_);
- evas_gl_config_free(evas_gl_config_);
- evas_gl_free(evas_gl_);
+namespace {
+static GLSharedContextEflPrivate* g_private_part = NULL;
}
-static GLSharedContextEflPrivate *g_private_part = NULL;
-
// static
void GLSharedContextEfl::Initialize(Evas_Object* object) {
- if (! g_private_part) {
+ if (!g_private_part) {
base::ThreadRestrictions::ScopedAllowIO allow_io;
g_private_part = new GLSharedContextEflPrivate(object);
}
#include "base/task_runner_util.h"
#include "ui/gfx/display.h"
#include "ui/gfx/image/image.h"
-#include "ui/gfx/rect.h"
+#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/screen.h"
namespace ui {
--- /dev/null
+# Copyright (c) 2015 Samsung Electronics. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables': {
+ 'external_ui_base_deps': [
+ '<(DEPTH)/tizen_src/build/system.gyp:elementary',
+ ],
+ 'external_ui_gl_deps': [
+ '<(DEPTH)/tizen_src/build/system.gyp:evas',
+ '<(DEPTH)/tizen_src/build/system.gyp:ecore-evas',
+ '<(DEPTH)/tizen_src/build/system.gyp:libdri2',
+ '<(DEPTH)/tizen_src/build/system.gyp:libdrm',
+ '<(DEPTH)/tizen_src/build/system.gyp:libtbm',
+ ],
+ 'external_ui_gfx_x11_deps': [
+ '<(DEPTH)/tizen_src/build/system.gyp:ecore-x',
+ ],
+ 'external_ui_events_deps': [
+ '<(DEPTH)/tizen_src/chromium_impl/ui/ui_targets_efl.gyp:ui_events_source_inject',
+ ],
+ },
+ 'target_defaults': {
+ 'target_conditions': [
+
+ ['_target_name=="gfx"', {
+ 'sources': [
+ '<(DEPTH)/ui/gfx/nine_image_painter.cc',
+ '<(DEPTH)/ui/gfx/nine_image_painter.h',
+ 'gfx/screen_efl.h',
+ 'gfx/screen_efl.cc',
+ ],
+ }],
+
+ ['_target_name=="gfx_x11"', {
+ 'sources': [
+ 'gfx/x/x11_types_override.cc',
+ ],
+ 'sources/': [
+ [ 'exclude', 'x11_types.cc$' ],
+ ],
+ }],
+
+ ['_target_name=="gl"', {
+ 'sources/': [
+ [ 'exclude', 'gl_context_egl\\.cc$' ],
+ ],
+ 'sources': [
+ 'gl/gl_shared_context_efl.h',
+ 'gl/gl_shared_context_efl.cc',
+ 'gl/gl_context_egl_override.cc',
+ 'gl/gl_current_context_efl.cc',
+ ],
+ 'conditions': [
+ ['building_for_tizen==1', {
+ 'sources': [
+ 'gl/gl_image_efl_pixmap.cc',
+ 'gl/gl_image_efl_pixmap.h',
+ 'gl/efl_pixmap.cc',
+ 'gl/efl_pixmap.h',
+ ],
+ }],
+ ],
+ }],
+
+ ['_target_name=="ui_base"', {
+ 'sources': [
+ '<(DEPTH)/ui/base/nine_image_painter_factory.cc',
+ '<(DEPTH)/ui/base/nine_image_painter_factory.h',
+ 'base/resource/resource_bundle_efl.cc',
+ 'base/clipboard/clipboard_efl.cc',
+ 'base/clipboard/clipboard_efl.h',
+ 'base/clipboard/clipboard_helper_efl.cc',
+ 'base/clipboard/clipboard_helper_efl.h',
+ ],
+ }],
+
+ ['_target_name=="snapshot"', {
+ 'sources': [
+ 'snapshot/snapshot_efl.cc',
+ ],
+ }],
+
+ ['_target_name=="x11_events_platform"', {
+ 'sources': [
+ 'events/platform/x11/x11_event_source_efl.cc',
+ ],
+ 'sources/': [
+ ['exclude', 'x11_event_source_glib\\.cc$'],
+ ['exclude', 'x11_event_source_libevent\\.cc$'],
+ ]
+ }],
+
+ ['_target_name=="gesture_detection"', {
+ 'sources/': [
+ ['exclude', 'gesture_detection/gesture_configuration_default\\.cc$']
+ ],
+ 'sources': [
+ 'events/gesture_detection/gesture_configuration_efl.cc',
+ ],
+ }],
+
+ ], # target_conditions
+ } # target_defaults
+}
+
--- /dev/null
+# copyright (c) 2015 samsung electronics. all rights reserved.
+# use of this source code is governed by a bsd-style license that can be
+# found in the license file.
+
+{
+ 'target_defaults': {
+ 'include_dirs': [
+ '<(DEPTH)',
+ ],
+ },
+ 'targets': [
+ {
+ 'target_name': 'ui_events_source_inject',
+ 'type': 'static_library',
+ 'sources': [
+ '<(DEPTH)/ui/events/gestures/gesture_recognizer_impl.cc',
+ '<(DEPTH)/ui/events/gestures/gesture_recognizer_impl.h',
+ '<(DEPTH)/ui/events/gestures/gesture_provider_aura.cc',
+ '<(DEPTH)/ui/events/gestures/gesture_provider_aura.h',
+ '<(DEPTH)/ui/events/gestures/motion_event_aura.cc',
+ '<(DEPTH)/ui/events/gestures/motion_event_aura.h',
+ ],
+ },
+ {
+ 'target_name': 'ui_native_theme_inject',
+ 'type': 'static_library',
+ 'sources': [
+ '<(DEPTH)/ui/native_theme/native_theme_aura.h',
+ '<(DEPTH)/ui/native_theme/native_theme_aura.cc',
+ ],
+ 'dependencies': [
+ '<(DEPTH)/skia/skia.gyp:skia',
+ ]
+ }
+ ],
+}
+
+
+++ /dev/null
-// Copyright 2014 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "common/webcursor_efl.h"
-
-#include "base/logging.h"
-#include "third_party/WebKit/public/platform/WebCursorInfo.h"
-
-#include <Ecore_X.h>
-
-using namespace blink;
-
-int GetCursorType(int type) {
- switch (type) {
- case WebCursorInfo::TypePointer:
- return ECORE_X_CURSOR_XTERM;
- case WebCursorInfo::TypeCross:
- return ECORE_X_CURSOR_CROSS;
- case WebCursorInfo::TypeHand:
- return ECORE_X_CURSOR_HAND2;
- case WebCursorInfo::TypeIBeam:
- return ECORE_X_CURSOR_XTERM;
- case WebCursorInfo::TypeWait:
- return ECORE_X_CURSOR_WATCH;
- case WebCursorInfo::TypeHelp:
- return ECORE_X_CURSOR_QUESTION_ARROW;
- case WebCursorInfo::TypeEastResize:
- return ECORE_X_CURSOR_RIGHT_SIDE;
- case WebCursorInfo::TypeNorthResize:
- return ECORE_X_CURSOR_TOP_SIDE;
- case WebCursorInfo::TypeNorthEastResize:
- return ECORE_X_CURSOR_TOP_RIGHT_CORNER;
- case WebCursorInfo::TypeNorthWestResize:
- return ECORE_X_CURSOR_TOP_LEFT_CORNER;
- case WebCursorInfo::TypeSouthResize:
- return ECORE_X_CURSOR_BOTTOM_SIDE;
- case WebCursorInfo::TypeSouthEastResize:
- return ECORE_X_CURSOR_BOTTOM_RIGHT_CORNER;
- case WebCursorInfo::TypeSouthWestResize:
- return ECORE_X_CURSOR_BOTTOM_LEFT_CORNER;
- case WebCursorInfo::TypeWestResize:
- return ECORE_X_CURSOR_LEFT_SIDE;
- case WebCursorInfo::TypeNorthSouthResize:
- return ECORE_X_CURSOR_SB_V_DOUBLE_ARROW;
- case WebCursorInfo::TypeEastWestResize:
- return ECORE_X_CURSOR_SB_H_DOUBLE_ARROW;
- case WebCursorInfo::TypeNorthEastSouthWestResize:
- case WebCursorInfo::TypeNorthWestSouthEastResize:
- // There isn't really a useful cursor available for these.
- return ECORE_X_CURSOR_XTERM;
- case WebCursorInfo::TypeColumnResize:
- return ECORE_X_CURSOR_SB_H_DOUBLE_ARROW; // TODO(evanm): is this correct?
- case WebCursorInfo::TypeRowResize:
- return ECORE_X_CURSOR_SB_V_DOUBLE_ARROW; // TODO(evanm): is this correct?
- case WebCursorInfo::TypeMiddlePanning:
- return ECORE_X_CURSOR_FLEUR;
- case WebCursorInfo::TypeEastPanning:
- return ECORE_X_CURSOR_SB_RIGHT_ARROW;
- case WebCursorInfo::TypeNorthPanning:
- return ECORE_X_CURSOR_SB_UP_ARROW;
- case WebCursorInfo::TypeNorthEastPanning:
- return ECORE_X_CURSOR_TOP_RIGHT_CORNER;
- case WebCursorInfo::TypeNorthWestPanning:
- return ECORE_X_CURSOR_TOP_LEFT_CORNER;
- case WebCursorInfo::TypeSouthPanning:
- return ECORE_X_CURSOR_SB_DOWN_ARROW;
- case WebCursorInfo::TypeSouthEastPanning:
- return ECORE_X_CURSOR_BOTTOM_RIGHT_CORNER;
- case WebCursorInfo::TypeSouthWestPanning:
- return ECORE_X_CURSOR_BOTTOM_LEFT_CORNER;
- case WebCursorInfo::TypeWestPanning:
- return ECORE_X_CURSOR_SB_LEFT_ARROW;
- case WebCursorInfo::TypeMove:
- return ECORE_X_CURSOR_FLEUR;
- case WebCursorInfo::TypeVerticalText:
- return ECORE_X_CURSOR_XTERM;
- case WebCursorInfo::TypeCell:
- return ECORE_X_CURSOR_XTERM;
- case WebCursorInfo::TypeContextMenu:
- return ECORE_X_CURSOR_XTERM;
- case WebCursorInfo::TypeAlias:
- return ECORE_X_CURSOR_XTERM;
- case WebCursorInfo::TypeProgress:
- return ECORE_X_CURSOR_WATCH;
- case WebCursorInfo::TypeNoDrop:
- return ECORE_X_CURSOR_XTERM;
- case WebCursorInfo::TypeCopy:
- return ECORE_X_CURSOR_XTERM;
- case WebCursorInfo::TypeNone:
- return ECORE_X_CURSOR_XTERM;
- case WebCursorInfo::TypeNotAllowed:
- return ECORE_X_CURSOR_XTERM;
- case WebCursorInfo::TypeZoomIn:
- case WebCursorInfo::TypeZoomOut:
- case WebCursorInfo::TypeGrab:
- case WebCursorInfo::TypeGrabbing:
- case WebCursorInfo::TypeCustom:
- return ECORE_X_CURSOR_XTERM; // Need to check the ECORE_X_CURSOR_XTERM
- }
- NOTREACHED();
- return ECORE_X_CURSOR_XTERM;
-}
+++ /dev/null
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WEBCURSOR_EFL_H_
-#define WEBCURSOR_EFL_H_
-
-int GetCursorType(int type);
-
-#endif
+++ /dev/null
-// Copyright 2014 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/shell/browser/shell.h"
-
-#include <Evas.h>
-#include <Ecore_Evas.h>
-#include <Elementary.h>
-
-#include "base/command_line.h"
-#include "base/strings/utf_string_conversions.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/common/content_switches.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/shell/common/shell_switches.h"
-#include "ui/gl/gl_switches.h"
-#include "cc/base/switches.h"
-
-namespace content {
-
-Evas_Object* Shell::native_view_ = NULL;
-Shell::Impl* Shell::impl_ = NULL;
-
-class Shell::Impl {
- public:
- Impl(gfx::Size size)
- : url_bar_(NULL), web_view_(NULL)
- , refresh_btn_(NULL), stop_btn_(NULL), back_btn_(NULL)
- , forward_btn_(NULL), exit_handler_(NULL), shell_(NULL) {
- elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
- elm_config_preferred_engine_set("opengl_x11");
- window_ = elm_win_util_standard_add(
- "content_shell_efl", "Content Shell EFL");
- elm_win_autodel_set(window_, EINA_TRUE);
- evas_object_resize(window_, size.width(), size.height());
-
- Evas_Object *box = elm_box_add(window_);
- evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(window_, box);
- evas_object_show(box);
-
- if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
- CreateURLBar(box);
-
- Evas* evas = evas_object_evas_get(window_);
- web_view_ = evas_object_image_filled_add(evas);
- evas_object_image_size_set(web_view_, size.width(), size.height());
- evas_object_size_hint_align_set(web_view_, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(web_view_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_box_pack_end(box, web_view_);
- evas_object_show(web_view_);
-
- evas_object_event_callback_add(web_view_, EVAS_CALLBACK_RESIZE, OnResize, this);
- exit_handler_ = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, &OnExit, this);
- evas_object_smart_callback_add(window_, "delete,request", OnWindowDelRequest, this);
- }
-
- void CreateURLBar(Evas_Object* box) {
- Evas_Object *icon = NULL;
-
- url_bar_ = elm_entry_add(box);
- elm_entry_single_line_set(url_bar_, EINA_TRUE);
- elm_entry_scrollable_set(url_bar_, EINA_TRUE);
- elm_entry_input_panel_layout_set(url_bar_, ELM_INPUT_PANEL_LAYOUT_URL);
- evas_object_size_hint_weight_set(url_bar_, EVAS_HINT_EXPAND, 0.0f);
- evas_object_size_hint_align_set(url_bar_, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_smart_callback_add(url_bar_, "activated", OnURLEntered, this);
- elm_box_pack_end(box, url_bar_);
- evas_object_show(url_bar_);
-
- Evas_Object *button_box = elm_box_add(box);
- elm_box_horizontal_set(button_box, EINA_TRUE);
-
- back_btn_ = elm_button_add(button_box);
- icon = elm_icon_add(button_box);
- elm_icon_standard_set(icon, "arrow_left");
- elm_object_part_content_set(back_btn_, "icon", icon);
- evas_object_smart_callback_add(back_btn_, "clicked", OnBack, this);
- elm_box_pack_end(button_box, back_btn_);
- evas_object_show(back_btn_);
-
- forward_btn_ = elm_button_add(button_box);
- icon = elm_icon_add(button_box);
- elm_icon_standard_set(icon, "arrow_right");
- elm_object_part_content_set(forward_btn_, "icon", icon);
- evas_object_smart_callback_add(forward_btn_, "clicked", OnForward, this);
- elm_box_pack_end(button_box, forward_btn_);
- evas_object_show(forward_btn_);
-
- refresh_btn_ = elm_button_add(button_box);
- icon = elm_icon_add(button_box);
- elm_icon_standard_set(icon, "refresh");
- elm_object_part_content_set(refresh_btn_, "icon", icon);
- evas_object_smart_callback_add(refresh_btn_, "clicked", OnRefresh, this);
- elm_box_pack_end(button_box, refresh_btn_);
- evas_object_show(refresh_btn_);
-
- stop_btn_ = elm_button_add(button_box);
- icon = elm_icon_add(button_box);
- elm_icon_standard_set(icon, "close");
- elm_object_part_content_set(stop_btn_, "icon", icon);
- evas_object_smart_callback_add(stop_btn_, "clicked", OnStop, this);
- elm_box_pack_end(button_box, stop_btn_);
- evas_object_show(stop_btn_);
-
-#if !defined(OS_TIZEN)
- elm_object_text_set(back_btn_, "Back");
- elm_object_text_set(forward_btn_, "Forward");
- elm_object_text_set(refresh_btn_, "Refresh");
- elm_object_text_set(stop_btn_, "Stop");
-#endif
-
- evas_object_show(button_box);
- elm_object_part_content_set(url_bar_, "icon", button_box);
- }
-
- void SetAddressBarURL(const char* url) {
- // XXX: Check unnecessart when HW rendering works on desktop
- if (url_bar_) {
- elm_object_text_set(url_bar_, url);
- }
- }
-
- Evas_Object* GetWebView() const {
- return web_view_;
- }
-
- void SetShell(Shell* shell) {
- shell_ = shell;
- }
-
- void ShowWindow(int width, int height) {
- evas_object_resize(window_, width, height);
- evas_object_show(window_);
- }
-
- void SetWindowTitle(const base::string16& title) {
- elm_win_title_set(window_, UTF16ToUTF8(title).c_str());
- }
-
- void ToggleControl(UIControl control, bool is_enabled) {
- // XXX: After HW rendering is fixed on desktop elm buttons
- // should always exist when entering this function
- if (control == BACK_BUTTON && back_btn_) {
- elm_object_disabled_set(back_btn_, !is_enabled);
- } else if (control == FORWARD_BUTTON && forward_btn_) {
- elm_object_disabled_set(forward_btn_, !is_enabled);
- } else if (control == STOP_BUTTON && stop_btn_) {
- elm_object_disabled_set(stop_btn_, !is_enabled);
- }
- }
-
- private:
- void Close() {
- elm_exit();
- shell_->Close();
- }
-
- static void OnResize(void* data, Evas*, Evas_Object*, void*) {
- Shell::Impl* thiz = static_cast<Shell::Impl*>(data);
-
- int width, height;
- evas_object_geometry_get(thiz->web_view_, 0, 0, &width, &height);
- evas_object_image_size_set(native_view_, width, height);
-
- if (thiz->shell_ && thiz->shell_->web_contents()) {
- thiz->shell_->web_contents()->GetRenderViewHost()->WasResized();
- }
- }
-
- static Eina_Bool OnExit(void* data, int, void*) {
- static_cast<Shell::Impl*>(data)->Close();
- return 1;
- }
-
- static void OnWindowDelRequest(void* data, Evas_Object*, void*) {
- Shell::Impl* thiz = static_cast<Shell::Impl*>(data);
- thiz->window_ = NULL;
- thiz->Close();
- }
-
- static void OnBack(void* data, Evas_Object*, void*) {
- static_cast<Shell::Impl*>(data)->shell_->GoBackOrForward(-1);
- }
-
- static void OnForward(void* data, Evas_Object*, void*) {
- static_cast<Shell::Impl*>(data)->shell_->GoBackOrForward(1);
- }
-
- static void OnRefresh(void* data, Evas_Object*, void*) {
- static_cast<Shell::Impl*>(data)->shell_->Reload();
- }
-
- static void OnStop(void* data, Evas_Object*, void*) {
- static_cast<Shell::Impl*>(data)->shell_->Stop();
- }
-
- static void OnURLEntered(void *data, Evas_Object *obj, void*) {
- GURL url(elm_object_text_get(obj));
- if (!url.has_scheme()) {
- url = GURL(std::string("http://") + std::string(elm_object_text_get(obj)));
- elm_object_text_set(obj, url.spec().c_str());
- }
- static_cast<Shell::Impl*>(data)->shell_->LoadURL(url);
- }
-
- Evas_Object* window_;
- Evas_Object* url_bar_;
- Evas_Object* web_view_;
- Evas_Object* refresh_btn_;
- Evas_Object* stop_btn_;
- Evas_Object* back_btn_;
- Evas_Object* forward_btn_;
- Ecore_Event_Handler* exit_handler_;
-
- Shell* shell_;
-};
-
-// static
-void Shell::PlatformInitialize(const gfx::Size& default_window_size) {
- elm_init(0, NULL);
-
- impl_ = new Impl(default_window_size);
- native_view_ = impl_->GetWebView();
-
- // This is not the best place to append port specific flags, but
- // it works and keeps changes to upsteam sources minimal.
- //
- // XXX: Investigate why EFL port does not work without threaded
- // compositing.
- CommandLine::ForCurrentProcess()->
- AppendSwitch(switches::kDisableDelegatedRenderer);
- CommandLine::ForCurrentProcess()->
- AppendSwitch(cc::switches::kCompositeToMailbox);
-
- LOG(INFO) << "EFL Shell platform initialized";
-}
-
-void Shell::PlatformExit() {
- native_view_ = NULL;
- LOG(INFO) << "EFL Shell platform exit";
-}
-
-void Shell::PlatformCleanUp() {
- delete impl_;
-}
-
-void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) {
- impl_->ToggleControl(control, is_enabled);
-}
-
-void Shell::PlatformSetAddressBarURL(const GURL& url) {
- impl_->SetAddressBarURL(url.spec().c_str());
-}
-
-void Shell::PlatformSetIsLoading(bool loading) {
-}
-
-void Shell::PlatformCreateWindow(int width, int height) {
- impl_->ShowWindow(width, height);
-}
-
-void Shell::PlatformSetContents() {
- impl_->SetShell(this);
-}
-
-void Shell::PlatformResizeSubViews() {
-}
-
-void Shell::Close() {
- LOG(INFO) << "Closing Content Shell EFL";
- delete this;
-}
-
-void Shell::PlatformSetTitle(const base::string16& title) {
- impl_->SetWindowTitle(title);
-}
-
-bool Shell::PlatformHandleContextMenu(
- const content::ContextMenuParams& params) {
- return false;
-}
-
-} // namespace content
+++ /dev/null
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/public/app/content_main.h"
-
-#include <Ecore_Evas.h>
-#include <Ecore_X.h>
-
-#include "content/shell/app/shell_main_delegate.h"
-#include "content/browser/gpu/gpu_process_host.h"
-#include "base/message_loop/message_loop.h"
-#include "gpu/gpu_thread_override_efl.h"
-#include "shell/message_pump_efl.h"
-#include "screen_efl.h"
-
-scoped_ptr<base::MessagePump> MessagePumpFactory() {
- return scoped_ptr<base::MessagePump>(new base::MessagePumpEfl);
-}
-
-int main(int argc, const char* argv[]) {
- ecore_init();
- ecore_x_init(NULL);
- eina_init();
- evas_init();
- if (!base::MessageLoop::InitMessagePumpForUIFactory(&MessagePumpFactory)) {
- LOG(ERROR) << "Failed to install EFL message pump!";
- return 1;
- }
-
- ui::InstallScreenInstance();
- content::GpuProcessHost::RegisterGpuMainThreadFactory(CreateInProcessGpuThreadEfl);
-
- content::ShellMainDelegate delegate;
-
- content::ContentMainParams prams(&delegate);
- prams.argc = argc;
- prams.argv = argv;
- return content::ContentMain(prams);
-}
+++ /dev/null
-// Copyright 2014 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/shell/browser/shell_web_contents_view_delegate.h"
-
-namespace content {
-
-WebContentsViewDelegate* CreateShellWebContentsViewDelegate(
- WebContents* web_contents) {
- return NULL;
-}
-
-} // namespace content
+++ /dev/null
-{
- 'targets': [{
- 'target_name': 'tizen_theme',
- 'type': 'static_library',
-
- 'includes': [
- # NOTE: gyp includes need to be relative
- '../../../build/common.gypi',
- '../../../third_party/WebKit/Source/build/features.gypi',
- '../../../skia/skia_common.gypi',
- ],
- 'dependencies': [
- '<(chrome_src_dir)/third_party/WebKit/Source/core/core.gyp:webcore',
- ],
- 'include_dirs': [
- '.',
- '<(chrome_src_dir)',
- '<(chrome_src_dir)/gpu',
- '<(chrome_src_dir)/third_party/WebKit',
- '<(chrome_src_dir)/third_party/WebKit/Source',
- '<(chrome_src_dir)/third_party/skia/include/core',
- '<(chrome_src_dir)/third_party/skia/include/utils',
- '<(chrome_src_dir)/v8/include',
- '<(SHARED_INTERMEDIATE_DIR)',
- '<(SHARED_INTERMEDIATE_DIR)/webkit/',
- '<(SHARED_INTERMEDIATE_DIR)/blink',
- ],
- 'defines': [
- 'INSIDE_BLINK=1',
- '<@(feature_defines)',
- ],
- 'sources': [
- 'RenderThemeChromiumDefault_override.cpp',
- 'RenderThemeChromiumTizen.cpp',
- 'RenderThemeChromiumTizen.h',
- '<(SHARED_INTERMEDIATE_DIR)/TizenUserAgentStyleSheetsData.cpp',
- ],
- 'actions': [
- {
- 'action_name': 'TizenUserAgentStyleSheets',
- 'variables': {
- 'scripts': [
- '<(chrome_src_dir)/third_party/WebKit/Source/build/scripts/make-file-arrays.py',
- ],
- 'stylesheets': [ 'themeChromiumTizen.css', ],
- },
- 'inputs': [
- '<@(scripts)',
- '<@(stylesheets)'
- ],
- 'outputs': [
- '<(SHARED_INTERMEDIATE_DIR)/TizenUserAgentStyleSheets.h',
- '<(SHARED_INTERMEDIATE_DIR)/TizenUserAgentStyleSheetsData.cpp',
- ],
- 'action': [
- 'python',
- '<@(scripts)',
- '--namespace',
- 'blink',
- '--out-h=<(SHARED_INTERMEDIATE_DIR)/TizenUserAgentStyleSheets.h',
- '--out-cpp=<(SHARED_INTERMEDIATE_DIR)/TizenUserAgentStyleSheetsData.cpp',
- '<@(stylesheets)',
- ],
- },
- ], # actions
- }],
-}
+++ /dev/null
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/native_theme/native_theme_efl.h"
-
-#include <limits>
-
-#include "base/logging.h"
-#include "ui/base/layout.h"
-#include "ui/base/nine_image_painter_factory.h"
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/image/image_skia.h"
-#include "ui/gfx/nine_image_painter.h"
-#include "ui/gfx/path.h"
-#include "ui/gfx/rect.h"
-#include "ui/gfx/size.h"
-#include "ui/gfx/skbitmap_operations.h"
-#include "ui/gfx/skia_util.h"
-#include "ui/native_theme/common_theme.h"
-#include "ui/native_theme/native_theme_switches.h"
-#include "ui/resources/grit/ui_resources.h"
-
-using gfx::NineImagePainter;
-
-#define EMPTY_IMAGE_GRID { 0, 0, 0, 0, 0, 0, 0, 0, 0 }
-
-namespace ui {
-
-namespace {
-
-const int kScrollbarThumbImages[NativeTheme::kNumStates][9] = {
- EMPTY_IMAGE_GRID,
- IMAGE_GRID(IDR_SCROLLBAR_THUMB_BASE_HOVER),
- IMAGE_GRID(IDR_SCROLLBAR_THUMB_BASE_NORMAL),
- IMAGE_GRID(IDR_SCROLLBAR_THUMB_BASE_PRESSED)
-};
-
-const int kScrollbarArrowButtonImages[NativeTheme::kNumStates][9] = {
- EMPTY_IMAGE_GRID,
- IMAGE_GRID(IDR_SCROLLBAR_ARROW_BUTTON_BASE_HOVER),
- IMAGE_GRID(IDR_SCROLLBAR_ARROW_BUTTON_BASE_NORMAL),
- IMAGE_GRID(IDR_SCROLLBAR_ARROW_BUTTON_BASE_PRESSED)
-};
-
-const uint8 kScrollbarOverlayThumbFillAlphas[NativeTheme::kNumStates] = {
- 0, // Does not matter, will not paint for disabled state.
- 178, // Hover state, opacity 70%, alpha would be 0.7 * 255.
- 140, // Normal state, opacity 55%, alpha would be 0.55 * 255.
- 178 // Pressed state, opacity 70%, alpha would be 0.7 * 255.
-};
-
-const uint8 kScrollbarOverlayThumbStrokeAlphas[NativeTheme::kNumStates] = {
- 0, // Does not matter, will not paint for disabled state.
- 51, // Hover state, opacity 20%, alpha would be 0.2 * 255.
- 38, // Normal state, opacity 15%, alpha would be 0.15 * 255.
- 51 // Pressed state, opacity 20%, alpha would be 0.2 * 255.
-};
-
-const int kScrollbarOverlayThumbStrokeImages[9] =
- IMAGE_GRID_NO_CENTER(IDR_SCROLLBAR_OVERLAY_THUMB_STROKE);
-
-const int kScrollbarOverlayThumbFillImages[9] =
- IMAGE_GRID(IDR_SCROLLBAR_OVERLAY_THUMB_FILL);
-
-const int kScrollbarTrackImages[9] = IMAGE_GRID(IDR_SCROLLBAR_BASE);
-
-} // namespace
-
-#if !defined(OS_WIN)
-// static
-NativeTheme* NativeTheme::instance() {
- return NativeThemeEfl::instance();
-}
-
-// static
-NativeThemeEfl* NativeThemeEfl::instance() {
- CR_DEFINE_STATIC_LOCAL(NativeThemeEfl, s_native_theme, ());
- return &s_native_theme;
-}
-#endif
-
-NativeThemeEfl::NativeThemeEfl() {
- // We don't draw scrollbar buttons.
-#if defined(OS_CHROMEOS)
- set_scrollbar_button_length(0);
-#endif
-
- // Images and alphas declarations assume the following order.
- COMPILE_ASSERT(kDisabled == 0, states_unexpectedly_changed);
- COMPILE_ASSERT(kHovered == 1, states_unexpectedly_changed);
- COMPILE_ASSERT(kNormal == 2, states_unexpectedly_changed);
- COMPILE_ASSERT(kPressed == 3, states_unexpectedly_changed);
-}
-
-NativeThemeEfl::~NativeThemeEfl() {
-}
-
-void NativeThemeEfl::PaintMenuPopupBackground(
- SkCanvas* canvas,
- const gfx::Size& size,
- const MenuBackgroundExtraParams& menu_background) const {
- SkColor color = GetSystemColor(NativeTheme::kColorId_MenuBackgroundColor);
- if (menu_background.corner_radius > 0) {
- SkPaint paint;
- paint.setStyle(SkPaint::kFill_Style);
- paint.setFlags(SkPaint::kAntiAlias_Flag);
- paint.setColor(color);
-
- gfx::Path path;
- SkRect rect = SkRect::MakeWH(SkIntToScalar(size.width()),
- SkIntToScalar(size.height()));
- SkScalar radius = SkIntToScalar(menu_background.corner_radius);
- SkScalar radii[8] = {radius, radius, radius, radius,
- radius, radius, radius, radius};
- path.addRoundRect(rect, radii);
-
- canvas->drawPath(path, paint);
- } else {
- canvas->drawColor(color, SkXfermode::kSrc_Mode);
- }
-}
-
-void NativeThemeEfl::PaintMenuItemBackground(
- SkCanvas* canvas,
- State state,
- const gfx::Rect& rect,
- const MenuListExtraParams& menu_list) const {
- CommonThemePaintMenuItemBackground(canvas, state, rect);
-}
-
-void NativeThemeEfl::PaintArrowButton(
- SkCanvas* gc,
- const gfx::Rect& rect,
- Part direction,
- State state) const {
- if (direction == kInnerSpinButton) {
- FallbackTheme::PaintArrowButton(gc, rect, direction, state);
- return;
- }
- PaintPainter(GetOrCreatePainter(
- kScrollbarArrowButtonImages, state,
- scrollbar_arrow_button_painters_),
- gc, rect);
-
- // Aura-win uses slightly different arrow colors.
- SkColor arrow_color = GetArrowColor(state);
- switch (state) {
- case kHovered:
- case kNormal:
- arrow_color = SkColorSetRGB(0x50, 0x50, 0x50);
- break;
- case kPressed:
- arrow_color = SK_ColorWHITE;
- default:
- break;
- }
- PaintArrow(gc, rect, direction, arrow_color);
-}
-
-void NativeThemeEfl::PaintScrollbarTrack(
- SkCanvas* sk_canvas,
- Part part,
- State state,
- const ScrollbarTrackExtraParams& extra_params,
- const gfx::Rect& rect) const {
- // Overlay Scrollbar should never paint a scrollbar track.
- DCHECK(!IsOverlayScrollbarEnabled());
- if (!scrollbar_track_painter_)
- scrollbar_track_painter_ = CreateNineImagePainter(kScrollbarTrackImages);
- PaintPainter(scrollbar_track_painter_.get(), sk_canvas, rect);
-}
-
-void NativeThemeEfl::PaintScrollbarThumb(SkCanvas* sk_canvas,
- Part part,
- State state,
- const gfx::Rect& rect) const {
- gfx::Rect thumb_rect(rect);
- if (IsOverlayScrollbarEnabled()) {
- // Overlay scrollbar has no track, just paint thumb directly.
- // Do not paint if state is disabled.
- if (state == kDisabled)
- return;
-
- if (!scrollbar_overlay_thumb_painter_) {
- scrollbar_overlay_thumb_painter_ =
- CreateDualPainter(kScrollbarOverlayThumbFillImages,
- kScrollbarOverlayThumbFillAlphas,
- kScrollbarOverlayThumbStrokeImages,
- kScrollbarOverlayThumbStrokeAlphas);
- }
-
- PaintDualPainter(
- scrollbar_overlay_thumb_painter_.get(), sk_canvas, thumb_rect, state);
- return;
- }
- // If there are no scrollbuttons then provide some padding so that thumb
- // doesn't touch the top of the track.
- const int extra_padding = (scrollbar_button_length() == 0) ? 2 : 0;
- if (part == NativeTheme::kScrollbarVerticalThumb)
- thumb_rect.Inset(2, extra_padding, 2, extra_padding);
- else
- thumb_rect.Inset(extra_padding, 2, extra_padding, 2);
- PaintPainter(GetOrCreatePainter(
- kScrollbarThumbImages, state, scrollbar_thumb_painters_),
- sk_canvas,
- thumb_rect);
-}
-
-void NativeThemeEfl::PaintScrollbarThumbStateTransition(
- SkCanvas* canvas,
- State startState,
- State endState,
- double progress,
- const gfx::Rect& rect) const {
- // Only Overlay scrollbars should have state transition animation.
- DCHECK(IsOverlayScrollbarEnabled());
- if (!scrollbar_overlay_thumb_painter_) {
- scrollbar_overlay_thumb_painter_ =
- CreateDualPainter(kScrollbarOverlayThumbFillImages,
- kScrollbarOverlayThumbFillAlphas,
- kScrollbarOverlayThumbStrokeImages,
- kScrollbarOverlayThumbStrokeAlphas);
- }
-
- PaintDualPainterTransition(scrollbar_overlay_thumb_painter_.get(),
- canvas,
- rect,
- startState,
- endState,
- progress);
-}
-
-void NativeThemeEfl::PaintScrollbarCorner(SkCanvas* canvas,
- State state,
- const gfx::Rect& rect) const {
- // Overlay Scrollbar should never paint a scrollbar corner.
- DCHECK(!IsOverlayScrollbarEnabled());
- SkPaint paint;
- paint.setColor(SkColorSetRGB(0xF1, 0xF1, 0xF1));
- paint.setStyle(SkPaint::kFill_Style);
- paint.setXfermodeMode(SkXfermode::kSrc_Mode);
- canvas->drawIRect(RectToSkIRect(rect), paint);
-}
-
-NineImagePainter* NativeThemeEfl::GetOrCreatePainter(
- const int images[kNumStates][9],
- State state,
- scoped_ptr<NineImagePainter> painters[kNumStates]) const {
- if (painters[state])
- return painters[state].get();
- if (images[state][0] == 0) {
- // Must always provide normal state images.
- DCHECK_NE(kNormal, state);
- return GetOrCreatePainter(images, kNormal, painters);
- }
- painters[state] = CreateNineImagePainter(images[state]);
- return painters[state].get();
-}
-
-void NativeThemeEfl::PaintPainter(NineImagePainter* painter,
- SkCanvas* sk_canvas,
- const gfx::Rect& rect) const {
- DCHECK(painter);
- scoped_ptr<gfx::Canvas> canvas(CommonThemeCreateCanvas(sk_canvas));
- painter->Paint(canvas.get(), rect);
-}
-
-scoped_ptr<NativeThemeEfl::DualPainter> NativeThemeEfl::CreateDualPainter(
- const int fill_image_ids[9],
- const uint8 fill_alphas[kNumStates],
- const int stroke_image_ids[9],
- const uint8 stroke_alphas[kNumStates]) const {
- scoped_ptr<NativeThemeEfl::DualPainter> dual_painter(
- new NativeThemeEfl::DualPainter(CreateNineImagePainter(fill_image_ids),
- fill_alphas,
- CreateNineImagePainter(stroke_image_ids),
- stroke_alphas));
- return dual_painter.Pass();
-}
-
-void NativeThemeEfl::PaintDualPainter(
- NativeThemeEfl::DualPainter* dual_painter,
- SkCanvas* sk_canvas,
- const gfx::Rect& rect,
- State state) const {
- DCHECK(dual_painter);
- scoped_ptr<gfx::Canvas> canvas(CommonThemeCreateCanvas(sk_canvas));
- dual_painter->fill_painter->Paint(
- canvas.get(), rect, dual_painter->fill_alphas[state]);
- dual_painter->stroke_painter->Paint(
- canvas.get(), rect, dual_painter->stroke_alphas[state]);
-}
-
-void NativeThemeEfl::PaintDualPainterTransition(
- NativeThemeEfl::DualPainter* dual_painter,
- SkCanvas* sk_canvas,
- const gfx::Rect& rect,
- State startState,
- State endState,
- double progress) const {
- DCHECK(dual_painter);
- scoped_ptr<gfx::Canvas> canvas(CommonThemeCreateCanvas(sk_canvas));
- uint8 fill_alpha = dual_painter->fill_alphas[startState] +
- (dual_painter->fill_alphas[endState] -
- dual_painter->fill_alphas[startState]) *
- progress;
- uint8 stroke_alpha = dual_painter->stroke_alphas[startState] +
- (dual_painter->stroke_alphas[endState] -
- dual_painter->stroke_alphas[startState]) *
- progress;
-
- dual_painter->fill_painter->Paint(canvas.get(), rect, fill_alpha);
- dual_painter->stroke_painter->Paint(canvas.get(), rect, stroke_alpha);
-}
-
-NativeThemeEfl::DualPainter::DualPainter(
- scoped_ptr<NineImagePainter> fill_painter,
- const uint8 fill_alphas[kNumStates],
- scoped_ptr<NineImagePainter> stroke_painter,
- const uint8 stroke_alphas[kNumStates])
- : fill_painter(fill_painter.Pass()),
- fill_alphas(fill_alphas),
- stroke_painter(stroke_painter.Pass()),
- stroke_alphas(stroke_alphas) {}
-
-NativeThemeEfl::DualPainter::~DualPainter() {}
-
-} // namespace ui
+++ /dev/null
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_NATIVE_THEME_NATIVE_THEME_EFL_H_
-#define UI_NATIVE_THEME_NATIVE_THEME_EFL_H_
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "ui/native_theme/fallback_theme.h"
-
-namespace gfx {
-class NineImagePainter;
-}
-
-namespace ui {
-
-// EFL implementation of native theme support.
-class NATIVE_THEME_EXPORT NativeThemeEfl : public FallbackTheme {
- public:
- static NativeThemeEfl* instance();
-
- protected:
- NativeThemeEfl();
- virtual ~NativeThemeEfl();
-
- // Overridden from NativeThemeBase:
- virtual void PaintMenuPopupBackground(
- SkCanvas* canvas,
- const gfx::Size& size,
- const MenuBackgroundExtraParams& menu_background) const override;
- virtual void PaintMenuItemBackground(
- SkCanvas* canvas,
- State state,
- const gfx::Rect& rect,
- const MenuListExtraParams& menu_list) const override;
- virtual void PaintArrowButton(SkCanvas* gc,
- const gfx::Rect& rect,
- Part direction,
- State state) const override;
- virtual void PaintScrollbarTrack(
- SkCanvas* sk_canvas,
- Part part,
- State state,
- const ScrollbarTrackExtraParams& extra_params,
- const gfx::Rect& rect) const override;
- virtual void PaintScrollbarThumb(SkCanvas* sk_canvas,
- Part part,
- State state,
- const gfx::Rect& rect) const override;
- virtual void PaintScrollbarCorner(SkCanvas* canvas,
- State state,
- const gfx::Rect& rect) const override;
-
- virtual void PaintScrollbarThumbStateTransition(SkCanvas* canvas,
- State startState,
- State endState,
- double progress,
- const gfx::Rect& rect) const
- override;
-
- // Returns the NineImagePainter used to paint the specified state, creating if
- // necessary. If no image is provided for the specified state the normal state
- // images are used.
- gfx::NineImagePainter* GetOrCreatePainter(
- const int image_ids[kNumStates][9],
- State state,
- scoped_ptr<gfx::NineImagePainter> painters[kNumStates]) const;
-
- // Paints |painter| into the canvas using |rect|.
- void PaintPainter(gfx::NineImagePainter* painter,
- SkCanvas* sk_canvas,
- const gfx::Rect& rect) const;
-
- mutable scoped_ptr<gfx::NineImagePainter> scrollbar_track_painter_;
-
- mutable scoped_ptr<gfx::NineImagePainter>
- scrollbar_thumb_painters_[kNumStates];
-
- mutable scoped_ptr<gfx::NineImagePainter>
- scrollbar_arrow_button_painters_[kNumStates];
-
- private:
- struct DualPainter {
- // For overlay scrollbar thumbs, fill and stroke are controlled separately,
- // and each state is achieved by painting with different opacity. This
- // struct bundles information of painter generated using assets and alpha
- // value associated with each state, so that a DualPainter for overlay
- // scrollbar thumb would only need state as input to paint correctly.
- DualPainter(scoped_ptr<gfx::NineImagePainter> fill_painter,
- const uint8 fill_alphas[kNumStates],
- scoped_ptr<gfx::NineImagePainter> stroke_painter,
- const uint8 stroke_alphas[kNumStates]);
- ~DualPainter();
-
- scoped_ptr<gfx::NineImagePainter> fill_painter;
- const uint8* const fill_alphas;
- scoped_ptr<gfx::NineImagePainter> stroke_painter;
- const uint8* const stroke_alphas;
- };
-
- // Returns DualPainter from specific fill and stroke, creating if necessary.
- scoped_ptr<DualPainter> CreateDualPainter(
- const int fill_image_ids[9],
- const uint8 fill_alphas[kNumStates],
- const int stroke_image_ids[9],
- const uint8 stroke_alphas[kNumStates]) const;
-
- // Paints |dualPainter| into the canvas using |rect| and specific alpha.
- void PaintDualPainter(DualPainter* dual_painter,
- SkCanvas* sk_canvas,
- const gfx::Rect& rect,
- State state) const;
-
- void PaintDualPainterTransition(DualPainter* dual_painter,
- SkCanvas* sk_canvas,
- const gfx::Rect& rect,
- State startState,
- State endState,
- double progress) const;
-
- mutable scoped_ptr<DualPainter> scrollbar_overlay_thumb_painter_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeThemeEfl);
-};
-
-} // namespace ui
-
-#endif // UI_NATIVE_THEME_NATIVE_THEME_EFL_H_
--- /dev/null
+# Copyright (c) 2015 Samsung Electronics. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables': {
+ 'use_aura%': 0,
+ 'use_efl%' : 1,
+
+ 'building_for_tizen%': 0,
+ 'building_for_tizen_mobile%': 0,
+ 'building_for_tizen_tv%': 0,
+
+ 'data_dir%' : '/usr/share/chromium-efl/',
+ 'exe_dir%' : '/usr/lib/chromium-efl/',
+ 'edje_dir%' : '/usr/share/chromium-efl/themes/',
+ 'locale_dir%': '/usr/share/chromium-efl/locale/',
+
+ 'prebuilt_ld_gold_dir%': '',
+
+ 'chromium_efl_tizen_version%': '2.4',
+
+ 'conditions': [
+ ['building_for_tizen_mobile==1', {
+ 'gcc_4_6_x': 1,
+ }, {
+ 'gcc_4_6_x': 0,
+ }],
+ ],
+
+ 'grit_additional_defines': [ '-D', 'use_efl' ],
+ },
+
+ 'includes': [
+ 'build/efl_filename_rules.gypi',
+ 'chromium_impl/chromium_impl.gypi',
+ ],
+
+ 'target_defaults': {
+ 'conditions': [
+ ['use_efl==1', {
+ 'defines': [
+ 'USE_EFL=1',
+ ],
+ 'include_dirs': [
+ '<(DEPTH)/tizen_src/chromium_impl',
+ ],
+ }],
+ # Mobile gcc 4.6.x hack begin
+ ['gcc_4_6_x==1', {
+ 'defines': [
+ 'GCC_4_6_X=1',
+ 'override=',
+ 'final=',
+ ],
+ 'cflags_cc': [ '-std=gnu++0x', '-fpermissive' ],
+ }],
+ # Mobile gcc 4.6.x hack end
+ ['prebuilt_ld_gold_dir!=""', {
+ 'ldflags': [
+ '-B<(prebuilt_ld_gold_dir)',
+ ]
+ }],
+ ['gcc_version >= 49', {
+ 'ldflags': [
+ # In GCC 4.9, the linker (either bfd or gold) is called with the -plugin argument
+ # which our current bundled gold linker (in build/prebuild) does not accept.
+ # Since our gold a x64 64bit statically linked binary, even if we rebuild it
+ # with plugin support enabled, the plugin being loaded would be a 32bit ARM binary.
+ # and load would fail. So we disable linker's plugin loadeir (specifically
+ # gcc's liblto_plugin).
+ '-fno-use-linker-plugin',
+ ],
+ }],
+ ['building_for_tizen==1', {
+ 'defines': [
+ 'OS_TIZEN=1',
+ # For GCC 4.5.3 bundled arm.h has a bug and don't define __ARM_PCS when it should.
+ # Force define this flag for the whole chromium on gbs gcc 4.5.3.
+ # Non-arm builds will ingore it in any case.
+ '__ARM_PCS',
+ ],
+ 'conditions': [
+ ['chromium_efl_tizen_version=="2.4"', {
+ 'defines': [
+ 'TIZEN_V_2_4=1',
+ ],
+ }],
+ ['chromium_efl_tizen_version=="2.3"', {
+ 'defines': [
+ 'TIZEN_V_2_3=1',
+ ],
+ }],
+ ['chromium_efl_tizen_version=="2.2.1"', {
+ 'defines': [
+ 'TIZEN_LEGACY_V_2_2_1=1',
+ ],
+ }],
+ ['chromium_efl_tizen_version=="3.0"', {
+ 'defines': [
+ 'TIZEN_V_3_0=1',
+ ],
+ }],
+ ],
+ }],
+ ['building_for_tizen_mobile==1', {
+ 'defines': [
+ 'OS_TIZEN_MOBILE=1',
+ 'TIZEN_CONTENTS_DETECTION=1',
+ 'TIZEN_ENABLE_CAPI_SUPPORT=1',
+ ],
+ }],
+ ['building_for_tizen_tv==1', {
+ 'defines': [
+ 'OS_TIZEN_TV=1',
+ ],
+ }],
+ ],
+ 'include_dirs': [
+ '.',
+ # Mobile gcc 4.6.x hack begin
+ '<(DEPTH)/tizen_src/gcc46_compat_wrappers',
+ # Mobile gcc 4.6.x hack end
+ ],
+ # Mobile gcc 4.6.x hack begin
+ 'target_conditions': [
+ ['_target_name=="boringssl" or _target_name=="crypto" or _target_name=="genperf" or _target_name=="yasm" or _target_name=="speech_proto" or _target_name=="skia_library" or _target_name=="http_server" or _target_name=="libjingle" or _target_name=="libjingle_webrtc_common" or _target_name=="content_renderer" or _target_name=="mesa_libglslcommon"', {
+ 'defines!': [
+ 'final=',
+ ],
+ }],
+ ['_target_name=="usrsctplib"', {
+ 'defines!': [
+ 'override=',
+ ],
+ }],
+ ['_target_name=="webrtc_base" or _target_name=="rtc_base" or _target_name=="v8_base"', {
+ 'defines!': [
+ 'final=',
+ 'override=',
+ ],
+ }],
+ ],
+ # Mobile gcc 4.6.x hack end
+ }, #target_defaults
+}