js_dialogs_efl was originally implemented for content_shell_efl.
As content_shell_efl itself is removed, js_dialogs_efl is
no longer needed.
Reference: https://review.tizen.org/gerrit/#/c/290505/
Change-Id: If93ab010cf0d2f6bbe74b2864a2fdec4df110a29
Signed-off-by: Nikhil Shingne <n.shingne@samsung.com>
chromium_code = 1
}
-js_dialog_efl_deps = [ "//tizen_src/chromium_impl/components/js_dialogs_efl" ]
-
external_display_embedder_sources = [
"//tizen_src/chromium_impl/components/viz/service/display_embedder/skia_output_device_offscreen_tbm.cc",
"//tizen_src/chromium_impl/components/viz/service/display_embedder/skia_output_device_offscreen_tbm.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.
-
-static_library("js_dialogs_efl") {
- configs += [
- "//tizen_src/build:elementary",
- "//tizen_src/build:libelementary",
- "//tizen_src/build:efl-extension",
- "//tizen_src/build:libefl-extension",
- ]
- deps = [
- "//base",
- "//content/public/common",
- ]
- include_dirs = [ ".." ]
- sources = [
- "javascript_dialog_manager_efl.cc",
- "javascript_dialog_manager_efl.h",
- "javascript_modal_dialog_efl.cc",
- "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(
- WebContents* web_contents,
- RenderFrameHost* render_frame_host,
- JavaScriptDialogType dialog_type,
- const std::u16string& message_text,
- const std::u16string& default_prompt_text,
- DialogClosedCallback callback,
- bool* did_suppress_message) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(web_contents);
-
- JavaScriptModalDialogEfl::Type efl_type;
-
- switch (dialog_type) {
- case JAVASCRIPT_DIALOG_TYPE_ALERT:
- efl_type = JavaScriptModalDialogEfl::ALERT;
- break;
- case JAVASCRIPT_DIALOG_TYPE_CONFIRM:
- efl_type = JavaScriptModalDialogEfl::CONFIRM;
- break;
- case JAVASCRIPT_DIALOG_TYPE_PROMPT:
- efl_type = JavaScriptModalDialogEfl::PROMPT;
- break;
- default:
- NOTREACHED();
- }
-
- CancelDialogs(web_contents, false);
- open_dialogs_[web_contents] =
- new JavaScriptModalDialogEfl(web_contents, efl_type, message_text,
- default_prompt_text, std::move(callback));
-}
-
-void JavaScriptDialogManagerEfl::RunBeforeUnloadDialog(
- content::WebContents* web_contents,
- RenderFrameHost* render_frame_host,
- bool is_reload,
- DialogClosedCallback callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- CancelDialogs(web_contents, false);
- open_dialogs_[web_contents] = new JavaScriptModalDialogEfl(
- web_contents, JavaScriptModalDialogEfl::NAVIGATION,
- base::UTF8ToUTF16(
- std::string(dgettext("WebKit", "IDS_WEBVIEW_POP_LEAVE_THIS_PAGE_Q"))),
- std::u16string(), std::move(callback));
-}
-
-bool JavaScriptDialogManagerEfl::HandleJavaScriptDialog(
- content::WebContents* web_contents,
- bool accept,
- const std::u16string* prompt_override) {
- NOTIMPLEMENTED();
- return false;
-}
-
-void JavaScriptDialogManagerEfl::CancelDialogs(
- content::WebContents* web_contents,
- bool reset_state) {
- if (open_dialogs_.find(web_contents) != open_dialogs_.end()) {
- open_dialogs_[web_contents]->Close();
- delete open_dialogs_[web_contents];
- }
-}
-
-} // namespace content
+++ /dev/null
-// Copyright 2014 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 JAVASCRIPT_DIALOG_MANAGER_EFL_H_
-#define JAVASCRIPT_DIALOG_MANAGER_EFL_H_
-
-#include <string>
-#include <map>
-#include <Evas.h>
-
-#include "base/functional/callback.h"
-#include "base/functional/callback_forward.h"
-#include "content/public/browser/javascript_dialog_manager.h"
-#include "content/public/common/javascript_dialog_type.h"
-#include "url/gurl.h"
-
-namespace content{
-
-class WebContents;
-class JavaScriptModalDialogEfl;
-
-class JavaScriptDialogManagerEfl: public JavaScriptDialogManager {
- public:
- JavaScriptDialogManagerEfl();
- ~JavaScriptDialogManagerEfl() override;
-
- JavaScriptDialogManagerEfl(const JavaScriptDialogManagerEfl&) = delete;
- JavaScriptDialogManagerEfl& operator=(const JavaScriptDialogManagerEfl&) =
- delete;
-
- // Displays a JavaScript dialog. |did_suppress_message| will not be nil; if
- // |true| is returned in it, the caller will handle faking the reply.
- void RunJavaScriptDialog(WebContents* web_contents,
- RenderFrameHost* render_frame_host,
- JavaScriptDialogType dialog_type,
- const std::u16string& message_text,
- const std::u16string& default_prompt_text,
- DialogClosedCallback callback,
- bool* did_suppress_message) override;
-
- // Displays a dialog asking the user if they want to leave a page.
- void RunBeforeUnloadDialog(WebContents* web_contents,
- RenderFrameHost* render_frame_host,
- bool is_reload,
- DialogClosedCallback callback) override;
-
- // Accepts or dismisses the active JavaScript dialog, which must be owned
- // by the given |web_contents|. If |prompt_override| is not null, the prompt
- // text of the dialog should be set before accepting. Returns true if the
- // dialog was handled.
- bool HandleJavaScriptDialog(WebContents* web_contents,
- bool accept,
- const std::u16string* prompt_override) override;
-
- // Cancels all active and pending dialogs for the given WebContents. If
- // |reset_state| is true, resets any saved state tied to |web_contents|.
- void CancelDialogs(WebContents* web_contents, bool reset_state) override;
-
- private:
- std::map<WebContents*, JavaScriptModalDialogEfl*> open_dialogs_;
-};
-
-} // namespace content
-
-#endif /* JAVASCRIPT_DIALOG_MANAGER_EFL_H_ */
+++ /dev/null
-// Copyright 2014 Samsung Electroncs. 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/functional/callback.h"
-#include "base/path_service.h"
-#include "base/strings/utf_string_conversions.h"
-#include "content/public/browser/web_contents.h"
-
-#if BUILDFLAG(IS_TIZEN)
-#include <efl_extension.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 std::u16string& message_text,
- const std::u16string& default_prompt_text,
- JavaScriptDialogManager::DialogClosedCallback callback)
- : popup_(NULL),
- callback_(std::move(callback)),
- prompt_entry_(NULL),
- imf_context_(NULL) {
-#if !defined(USE_AURA)
- 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 BUILDFLAG(IS_TIZEN)
- eext_object_event_callback_add(popup_, EEXT_CALLBACK_BACK,
- &OnCancelButtonPressed, this);
-#endif
-
- evas_object_show(popup_);
-#endif
-}
-
-JavaScriptModalDialogEfl::~JavaScriptModalDialogEfl() {
- Close();
-}
-
-void JavaScriptModalDialogEfl::SetLabelText(const std::u16string& txt) {
- std::string txt2;
- base::ReplaceChars(base::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 std::u16string& message,
- const std::u16string& content) {
- if (type == PROMPT) {
- DCHECK(message.length());
- elm_object_part_text_set(popup_, "title,text",
- base::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_, base::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",
- base::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_) {
- std::move(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/functional/callback.h"
-#include "base/functional/callback_forward.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 std::u16string& message_text,
- const std::u16string& default_prompt_text,
- JavaScriptDialogManager::DialogClosedCallback);
- ~JavaScriptModalDialogEfl();
-
- void Close(bool accept = false, std::string reply = std::string());
-
- private:
- void InitContent(Type,
- const std::u16string& message,
- const std::u16string& content);
- void InitButtons(Type);
-
- void SetLabelText(const std::u16string& 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_ */
]
external_content_shell_deps = [ "//tizen_src/chromium_impl/efl:efl-init" ]
-external_content_shell_deps += js_dialog_efl_deps
if (is_tizen) {
external_content_browser_configs += [