import("//testing/test.gni")
import("//third_party/ffmpeg/ffmpeg_options.gni")
-if (use_efl) {
- import("//tizen_src/chromium_impl/chrome/chrome_tests_efl.gni")
-}
-
declare_args() {
# Make macOS request permissions for the chrome binary instead of its parent
# process (usually the Terminmal.app).
deps += [ ":buildflags" ]
frameworks = [ "Carbon.framework" ]
}
-
- if (use_efl) {
- sources -= external_exclude_chrome_test_driver_sources
- }
}
if (is_linux) {
-# Copyright 2014 The Chromium Authors
+# Copyright 2014 The Chromium Author
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
} else if (is_ios) {
import("//build/config/ios/config.gni")
}
-if (use_efl && !use_aura) {
- import("//tizen_src/chromium_impl/content/shell/shell_efl.gni")
-}
# TODO(crbug.com/1336055, spang): Investigate using shell_views with cast builds as
# true.
":content_shell_lib_warnings",
"//build/config:precompiled_headers",
]
- if (use_efl && !use_aura) {
- configs += external_content_shell_efl_configs
- }
defines = [
"CONTENT_SHELL_VERSION=\"$content_shell_version\"",
"//components/crash/core/app",
]
}
- if (use_efl && !use_aura) {
- deps += external_content_shell_efl_deps
- }
if (enable_plugins) {
sources += [
if (use_ozone) {
deps += [ "//ui/ozone" ]
}
-
- if (use_efl && !use_aura) {
- sources += external_content_shell_lib_efl_sources
- }
}
grit("content_shell_resources_grit") {
# Set rpath to find our own libfreetype even in a non-component build.
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
}
-
- if (use_efl && !use_aura) {
- deps += external_content_shell_efl_deps
- configs += external_content_shell_efl_configs
-
- sources += external_content_shell_efl_sources
- sources -= external_exclude_content_shell_efl_sources
- }
}
if (is_fuchsia) {
+++ /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.
-
-import("//tizen_src/build/config/tizen_features.gni")
-
-# For //chrome/test/chromedriver:lib target
-# It seems that keycode_text_conversion_win.cc is not used in gn files so no need to exclude it.
-external_exclude_chrome_test_driver_sources = [] #[ "test/chromedriver/keycode_text_conversion_win.cc" ]
-if (use_wayland) {
- #external_exclude_chrome_test_driver_sources += [ "test/chromedriver/keycode_text_conversion_x.cc" ]
-}
"//tizen_src/build:libevas",
]
-external_content_shell_configs = [
- "//tizen_src/build:evas",
- "//tizen_src/build:libevas",
- "//tizen_src/build:ecore-evas",
- "//tizen_src/build:libecore-evas",
- "//tizen_src/build:elementary",
- "//tizen_src/build:libelementary",
-]
-
-external_content_shell_deps = [ "//tizen_src/chromium_impl/efl:efl-init" ]
-
if (is_tizen) {
external_content_browser_configs += [
"//tizen_src/build:vconf",
external_content_browser_configs += [ "//tizen_src/build:libx11" ]
external_content_browser_extra_configs += [ "//tizen_src/build:ecore-x" ]
external_content_browser_extra_configs += [ "//tizen_src/build:libecore-x" ]
- external_content_shell_configs += [ "//tizen_src/build:ecore-x" ]
- external_content_shell_configs += [ "//tizen_src/build:libecore-x" ]
} else {
external_content_common_configs += [ "//tizen_src/build:ecore-wayland" ]
external_content_common_configs += [ "//tizen_src/build:libecore-wayland" ]
- external_content_shell_configs += [ "//tizen_src/build:ecore-wayland" ]
- external_content_shell_configs += [ "//tizen_src/build:libecore-wayland" ]
}
+++ /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 "cc/base/switches.h"
-#include "components/js_dialogs_efl/javascript_dialog_manager_efl.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/common/content_switches.h"
-#include "content/shell/common/shell_switches.h"
-#include "content/web_test/browser/web_test_javascript_dialog_manager.h"
-#include "efl/window_factory.h"
-#include "ui/gl/gl_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 (!switches::IsRunWebTestsSwitchPresent())
- CreateURLBar(box);
-
-#if !defined(USE_AURA)
- 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);
-#endif
- }
-
- 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 !BUILDFLAG(IS_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(ShellPlatformDelegate::UIControl control,
- bool is_enabled) {
- if (control == ShellPlatformDelegate::BACK_BUTTON && back_btn_) {
- elm_object_disabled_set(back_btn_, !is_enabled);
- } else if (control == ShellPlatformDelegate::FORWARD_BUTTON &&
- forward_btn_) {
- elm_object_disabled_set(forward_btn_, !is_enabled);
- } else if (control == ShellPlatformDelegate::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_;
- gfx::Size initial_size = Shell::GetShellDefaultSize();
- Shell::CreateNewWindow(shell->web_contents()->GetBrowserContext(),
- GURL("https://www.google.com"), nullptr,
- initial_size);
- }
-
- 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://") + 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();
-}
-}
-
-#if !defined(EWK_BRINGUP) // FIXME: m85 bringup
-// static
-void Shell::PlatformInitialize(const gfx::Size& default_window_size) {
- elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
- 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);
- gfx::Size initial_size = Shell::GetShellDefaultSize();
- evas_object_resize(win, initial_size.width(), initial_size.height());
- evas_object_show(win);
- window_ = win;
- impl_ = new Impl(this, static_cast<Evas_Object*>(window_));
-}
-
-void Shell::PlatformResizeSubViews() {}
-
-void Shell::PlatformSetTitle(const std::u16string& title) {
- elm_win_title_set(static_cast<Evas_Object*>(window_),
- base::UTF16ToUTF8(title).c_str());
-}
-#endif
-
-JavaScriptDialogManager* Shell::GetJavaScriptDialogManager(
- WebContents* source) {
- if (!dialog_manager_) {
- if (switches::IsRunWebTestsSwitchPresent()) {
- dialog_manager_.reset(new WebTestJavaScriptDialogManager);
- } 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 "base/at_exit.h"
-#include "content/shell/app/shell_main_delegate.h"
-#include "efl/init.h"
-
-int main(int argc, const char* argv[]) {
- base::AtExitManager at_exit;
- 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 2020 Samsung Electronics Inc. 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_platform_delegate.h"
-
-#include "content/public/browser/render_widget_host_view.h"
-#include "content/public/browser/web_contents.h"
-#include "content/shell/browser/shell.h"
-
-namespace content {
-
-struct ShellPlatformDelegate::ShellData {
- gfx::NativeWindow window;
-};
-
-struct ShellPlatformDelegate::PlatformData {};
-
-ShellPlatformDelegate::ShellPlatformDelegate() = default;
-ShellPlatformDelegate::~ShellPlatformDelegate() = default;
-
-void ShellPlatformDelegate::Initialize(const gfx::Size& default_window_size) {
- platform_ = std::make_unique<PlatformData>();
-}
-
-void ShellPlatformDelegate::CreatePlatformWindow(
- Shell* shell,
- const gfx::Size& initial_size) {}
-
-gfx::NativeWindow ShellPlatformDelegate::GetNativeWindow(Shell* shell) {
- return gfx::NativeWindow();
-}
-
-void ShellPlatformDelegate::CleanUp(Shell* shell) {}
-
-void ShellPlatformDelegate::SetContents(Shell* shell) {}
-
-void ShellPlatformDelegate::ResizeWebContent(Shell* shell,
- const gfx::Size& content_size) {}
-
-void ShellPlatformDelegate::EnableUIControl(Shell* shell,
- UIControl control,
- bool is_enabled) {}
-
-void ShellPlatformDelegate::SetAddressBarURL(Shell* shell, const GURL& url) {}
-
-void ShellPlatformDelegate::SetIsLoading(Shell* shell, bool loading) {}
-
-void ShellPlatformDelegate::SetTitle(Shell* shell,
- const std::u16string& title) {}
-
-void ShellPlatformDelegate::MainFrameCreated(Shell* shell) {}
-
-bool ShellPlatformDelegate::DestroyShell(Shell* shell) {
- return false;
-}
-
-} // namespace content
+++ /dev/null
-// Copyright 2013 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/shell/browser/shell_web_contents_view_delegate.h"
-
-#include <Evas.h>
-#include <Elementary.h>
-
-#include "base/command_line.h"
-#include "content/public/browser/render_view_host.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/blink/public/common/context_menu_data/context_menu_data.h"
-#include "third_party/blink/public/common/context_menu_data/edit_flags.h"
-
-using blink::ContextMenuDataEditFlags;
-
-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, nullptr,
- gfx::Size());
-}
-
-void StartDragging(void* data, Evas_Object*, void*) {
- WebContents* wc = static_cast<WebContents*>(data);
- RenderViewHost* rvh = wc->GetRenderViewHost();
-#if !defined(EWK_BRINGUP) // FIXME: m67 bringup
- rvh->StartDragging();
-#endif
-}
-
-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(content::ReloadType::NORMAL, 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 !defined(USE_AURA)
- if (switches::IsRunWebTestsSwitchPresent())
- 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 !defined(EWK_BRINGUP) // FIXME: m67 bringup
- if (params.is_draggable) {
- elm_menu_item_add(menu, NULL, NULL, "Start dragging", StartDragging,
- web_contents_);
- }
-#endif
-
- 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 & ContextMenuDataEditFlags::kCanCut) == 0);
- menu_it = elm_menu_item_add(menu, NULL, NULL, "Copy", Copy, web_contents_);
- elm_object_item_disabled_set(
- menu_it,
- (params_.edit_flags & ContextMenuDataEditFlags::kCanCopy) == 0);
- menu_it =
- elm_menu_item_add(menu, NULL, NULL, "Paste", Paste, web_contents_);
- elm_object_item_disabled_set(
- menu_it,
- (params_.edit_flags & ContextMenuDataEditFlags::kCanPaste) == 0);
- menu_it = elm_menu_item_add(menu, NULL, "delete", "Delete", Delete,
- web_contents_);
- elm_object_item_disabled_set(
- menu_it,
- (params_.edit_flags & ContextMenuDataEditFlags::kCanDelete) == 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);
-#endif
-}
-
-} // 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.
-
-import("//tizen_src/build/config/tizen_features.gni")
-import("//tizen_src/chromium_impl/components/components.gni")
-
-external_content_shell_efl_configs = [
- "//tizen_src/build:evas",
- "//tizen_src/build:libevas",
- "//tizen_src/build:ecore-evas",
- "//tizen_src/build:libecore-evas",
- "//tizen_src/build:elementary",
- "//tizen_src/build:libelementary",
-]
-
-if (use_wayland) {
- external_content_shell_efl_configs += [
- "//tizen_src/build:ecore-wayland",
- "//tizen_src/build:libecore-wayland",
- ]
-} else {
- external_content_shell_efl_configs += [
- "//tizen_src/build:ecore-x",
- "//tizen_src/build:libecore-x",
- ]
-}
-
-external_content_shell_efl_deps = [ "//tizen_src/chromium_impl/efl:efl-init" ]
-external_content_shell_efl_deps += js_dialog_efl_deps
-
-external_content_shell_lib_efl_sources = [
- "//tizen_src/chromium_impl/content/shell/browser/shell_efl.cc",
- "//tizen_src/chromium_impl/content/shell/browser/shell_platform_delegate_efl.cc",
- "//tizen_src/chromium_impl/content/shell/browser/shell_web_contents_view_delegate_efl.cc",
-]
-
-external_content_shell_efl_sources =
- [ "//tizen_src/chromium_impl/content/shell/browser/shell_main_efl.cc" ]
-
-external_exclude_content_shell_efl_sources = [ "app/shell_main.cc" ]
+++ /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 "device/battery/battery_status_manager_tizen.h"
-
-#include <device/battery.h>
-#include <system/device.h>
-#include <vconf/vconf.h>
-
-namespace device {
-
-namespace {
-
-typedef void (*battery_remaining_time_changed_cb)(int time, void* data);
-
-battery_remaining_time_changed_cb timetofull_changed_cb = NULL;
-battery_remaining_time_changed_cb timetoempty_changed_cb = NULL;
-void* timetofull_cb_user_data = NULL;
-void* timetoempty_cb_user_data = NULL;
-
-void timetofull_vconf_cb(keynode_t* key, void* data) {
- BatteryStatusManagerTizen* bsm =
- static_cast<BatteryStatusManagerTizen*>(data);
- if (!bsm || !timetofull_changed_cb)
- return;
-
- const char* keyname = vconf_keynode_get_name(key);
- if (keyname == NULL)
- return;
-
- int time = 0;
- if (strcmp(keyname, VCONFKEY_PM_BATTERY_TIMETOFULL) == 0 &&
- bsm->GetRemainingTimeUntilFullyCharged(&time) == DEVICE_ERROR_NONE &&
- time > 0) {
- timetofull_changed_cb(time, timetofull_cb_user_data);
- }
-}
-
-void timetoempty_vconf_cb(keynode_t* key, void* data) {
- BatteryStatusManagerTizen* bsm =
- static_cast<BatteryStatusManagerTizen*>(data);
-
- if (!bsm || !timetoempty_changed_cb)
- return;
-
- const char* keyname = vconf_keynode_get_name(key);
- if (keyname == NULL)
- return;
-
- int time = 0;
- if (strcmp(keyname, VCONFKEY_PM_BATTERY_TIMETOEMPTY) == 0 &&
- bsm->GetRemainingTimeUntilDischarged(&time) == DEVICE_ERROR_NONE &&
- time > 0) {
- timetoempty_changed_cb(time, timetoempty_cb_user_data);
- }
-}
-
-void OnChargingStatusChanged(keynode_t* key, void* data) {
- BatteryStatusManagerTizen* bsm =
- static_cast<BatteryStatusManagerTizen*>(data);
- if (!bsm)
- return;
-
- int charging = 0;
- if (vconf_get_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, &charging) < 0)
- return;
-
- BatteryStatus current_status = bsm->GetCurrentStatus();
- current_status.charging = charging > 0;
- current_status.charging_time = std::numeric_limits<double>::infinity();
- current_status.discharging_time = std::numeric_limits<double>::infinity();
-
- int left_time = 0;
- if (current_status.charging) {
- bsm->GetRemainingTimeUntilFullyCharged(&left_time);
- if (left_time > 0)
- current_status.charging_time = left_time;
- } else {
- bsm->GetRemainingTimeUntilDischarged(&left_time);
- if (left_time > 0)
- current_status.discharging_time = left_time;
- }
-
- bsm->SetCurrentStatus(current_status);
- bsm->GetBatteryUpdateCallback().Run(current_status);
-}
-
-void OnLevelChanged(int percent, void* data) {
- BatteryStatusManagerTizen* bsm =
- static_cast<BatteryStatusManagerTizen*>(data);
- if (!bsm)
- return;
-
- BatteryStatus current_status = bsm->GetCurrentStatus();
- current_status.level = percent / 100.0;
- bsm->SetCurrentStatus(current_status);
- bsm->GetBatteryUpdateCallback().Run(current_status);
-}
-
-void OnChargingTimeChanged(int time, void* data) {
- BatteryStatusManagerTizen* bsm =
- static_cast<BatteryStatusManagerTizen*>(data);
- if (!bsm)
- return;
-
- BatteryStatus current_status = bsm->GetCurrentStatus();
- current_status.charging_time = time;
- bsm->SetCurrentStatus(current_status);
- bsm->GetBatteryUpdateCallback().Run(current_status);
-}
-
-void OnDischargingTimeChanged(int time, void* data) {
- BatteryStatusManagerTizen* bsm =
- static_cast<BatteryStatusManagerTizen*>(data);
- if (!bsm)
- return;
-
- BatteryStatus current_status = bsm->GetCurrentStatus();
- current_status.discharging_time = time;
- bsm->SetCurrentStatus(current_status);
- bsm->GetBatteryUpdateCallback().Run(current_status);
-}
-
-int SetRemainingTimeUntilFullyChargedCb(
- battery_remaining_time_changed_cb callback, void* data) {
- if (callback == NULL)
- return DEVICE_ERROR_INVALID_PARAMETER;
-
- if (vconf_notify_key_changed(VCONFKEY_PM_BATTERY_TIMETOFULL,
- timetofull_vconf_cb, NULL) < 0)
- return DEVICE_ERROR_OPERATION_FAILED;
-
- timetofull_changed_cb = callback;
- timetofull_cb_user_data = data;
- return DEVICE_ERROR_NONE;
-}
-
-int SetRemainingTimeUntilDischargedCb(
- battery_remaining_time_changed_cb callback, void* data) {
- if (callback == NULL)
- return DEVICE_ERROR_INVALID_PARAMETER;
-
- if (vconf_notify_key_changed(VCONFKEY_PM_BATTERY_TIMETOEMPTY,
- timetoempty_vconf_cb, NULL) < 0)
- return DEVICE_ERROR_OPERATION_FAILED;
-
- timetoempty_changed_cb = callback;
- timetoempty_cb_user_data = data;
- return DEVICE_ERROR_NONE;
-}
-
-int UnsetRemainingTimeUntilFullyChargedCb() {
- if (vconf_ignore_key_changed(VCONFKEY_PM_BATTERY_TIMETOFULL,
- timetofull_vconf_cb) < 0)
- return DEVICE_ERROR_OPERATION_FAILED;
-
- timetofull_changed_cb = NULL;
- timetofull_cb_user_data = NULL;
- return DEVICE_ERROR_NONE;
-}
-
-int UnsetRemainingTimeUntilDischargedCb() {
- if (vconf_ignore_key_changed(VCONFKEY_PM_BATTERY_TIMETOEMPTY,
- timetoempty_vconf_cb) < 0)
- return DEVICE_ERROR_OPERATION_FAILED;
-
- timetoempty_changed_cb = NULL;
- timetoempty_cb_user_data = NULL;
- return DEVICE_ERROR_NONE;
-}
-
-} // namespace
-
-std::unique_ptr<BatteryStatusManager> BatteryStatusManager::Create(
- const BatteryStatusService::BatteryUpdateCallback& callback) {
- return std::unique_ptr<BatteryStatusManager>(
- new BatteryStatusManagerTizen(callback));
-}
-
-BatteryStatusManagerTizen::BatteryStatusManagerTizen(
- const BatteryStatusService::BatteryUpdateCallback& callback)
- : callback_(callback) {
-}
-
-BatteryStatusManagerTizen::~BatteryStatusManagerTizen() {
-}
-
-int BatteryStatusManagerTizen::GetRemainingTimeUntilFullyCharged(
- int* time) const {
- DCHECK(time != NULL);
- bool charging = false;
- if (device_battery_is_charging(&charging) != DEVICE_ERROR_NONE ||
- charging == false)
- return DEVICE_ERROR_OPERATION_FAILED;
-
- int temp_time = 0;
- if (vconf_get_int(VCONFKEY_PM_BATTERY_TIMETOFULL, &temp_time) < 0 ||
- temp_time < 0)
- return DEVICE_ERROR_OPERATION_FAILED;
-
- *time = temp_time;
- return DEVICE_ERROR_NONE;
-}
-
-int BatteryStatusManagerTizen::GetRemainingTimeUntilDischarged(
- int* time) const {
- DCHECK(time != NULL);
- bool charging = false;
- if (device_battery_is_charging(&charging) != DEVICE_ERROR_NONE ||
- charging == true)
- return DEVICE_ERROR_OPERATION_FAILED;
-
- int temp_time = 0;
- if (vconf_get_int(VCONFKEY_PM_BATTERY_TIMETOEMPTY, time) < 0 ||
- time < 0)
- return DEVICE_ERROR_OPERATION_FAILED;
-
- *time = temp_time;
- return DEVICE_ERROR_NONE;
-}
-
-bool BatteryStatusManagerTizen::StartListeningBatteryChange() {
-#if !defined(EWK_BRINGUP) // FIXME: m67 bringup
- if (vconf_notify_key_changed(
- VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, OnChargingStatusChanged, this) ||
- device_battery_set_cb(OnLevelChanged, this) != DEVICE_ERROR_NONE ||
- SetRemainingTimeUntilFullyChargedCb(OnChargingTimeChanged, this)
- != DEVICE_ERROR_NONE ||
- SetRemainingTimeUntilDischargedCb(OnDischargingTimeChanged, this)
- != DEVICE_ERROR_NONE) {
- StopListeningBatteryChange();
- return false;
- }
-#endif
-
- int charging = 0;
- if (vconf_get_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, &charging) < 0)
- return false;
-
- int level = 0, charging_time = 0, discharging_time = 0;
- device_battery_get_percent(&level);
- GetRemainingTimeUntilFullyCharged(&charging_time);
- GetRemainingTimeUntilDischarged(&discharging_time);
-
- current_status_.charging = charging > 0;
- current_status_.level = level / 100.0;
- current_status_.charging_time = charging_time > 0 ? charging_time :
- std::numeric_limits<double>::infinity();
- current_status_.discharging_time = discharging_time > 0 ? discharging_time :
- std::numeric_limits<double>::infinity();
-
- callback_.Run(current_status_);
- return true;
-}
-
-void BatteryStatusManagerTizen::StopListeningBatteryChange() {
- UnsetRemainingTimeUntilFullyChargedCb();
- UnsetRemainingTimeUntilDischargedCb();
- vconf_ignore_key_changed(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW,
- OnChargingStatusChanged);
-#if !defined(EWK_BRINGUP) // FIXME: m67 bringup
- device_battery_unset_cb();
-#endif
-}
-
-} // namespace device
+++ /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 DEVICE_BATTERY_BATTERY_STATUS_MANAGER_TIZEN_H_
-#define DEVICE_BATTERY_BATTERY_STATUS_MANAGER_TIZEN_H_
-
-#include "device/battery/battery_status_manager.h"
-
-namespace device {
-
-class BatteryStatusManagerTizen : public BatteryStatusManager {
- public:
- explicit BatteryStatusManagerTizen(
- const BatteryStatusService::BatteryUpdateCallback& callback);
- ~BatteryStatusManagerTizen() override;
-
- BatteryStatusManagerTizen(const BatteryStatusManagerTizen&) = delete;
- BatteryStatusManagerTizen& operator=(const BatteryStatusManagerTizen&) =
- delete;
-
- BatteryStatus GetCurrentStatus() const { return current_status_; }
- void SetCurrentStatus(BatteryStatus status) { current_status_ = status; }
-
- BatteryStatusService::BatteryUpdateCallback GetBatteryUpdateCallback() const {
- return callback_;
- }
-
- int GetRemainingTimeUntilFullyCharged(int* time) const;
- int GetRemainingTimeUntilDischarged(int* time) const;
-
- private:
- bool StartListeningBatteryChange() override;
- void StopListeningBatteryChange() override;
-
- BatteryStatus current_status_;
- BatteryStatusService::BatteryUpdateCallback callback_;
-};
-
-} // namespace content
-
-#endif // DEVICE_BATTERY_BATTERY_STATUS_MANAGER_TIZEN_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.
-
-external_device_battery_configs = [
- "//tizen_src/build:capi-system-device",
- "//tizen_src/build:libcapi-system-device",
- "//tizen_src/build:vconf",
- "//tizen_src/build:libvconf",
-]
-
-external_device_battery_sources = [
- "//tizen_src/chromium_impl/device/battery/battery_status_manager_tizen.cc",
- "//tizen_src/chromium_impl/device/battery/battery_status_manager_tizen.h",
-]
return WebViewDelegateEwk::GetInstance().GetWebViewFromEvasObject(eo);
}
-void EWebView::OnViewFocusIn(void* data, Evas*, Evas_Object*, void*) {
- auto view = static_cast<EWebView*>(data);
- view->SetFocus(EINA_TRUE);
-}
-
-void EWebView::OnViewFocusOut(void* data, Evas*, Evas_Object*, void*) {
- auto view = static_cast<EWebView*>(data);
- view->SetFocus(EINA_FALSE);
-}
-
void EWebView::VisibleContentChangedCallback(void* user_data,
Evas_Object* /*object*/,
void* event_info) {
OnCustomScrollBeginCallback, this);
evas_object_smart_callback_add(ewk_view_, kCustomScrollEndSignalName,
OnCustomScrollEndCallback, this);
- evas_object_event_callback_add(ewk_view_, EVAS_CALLBACK_FOCUS_IN,
- OnViewFocusIn, this);
- evas_object_event_callback_add(ewk_view_, EVAS_CALLBACK_FOCUS_OUT,
- OnViewFocusOut, this);
#if BUILDFLAG(IS_TIZEN)
window_rotate_handler_ = ecore_event_handler_add(
ECORE_WL2_EVENT_WINDOW_ROTATE, RotateWindowCb, this);
gin_native_bridge_dispatcher_host_.reset();
if (ewk_view_) {
- evas_object_event_callback_del(ewk_view_, EVAS_CALLBACK_FOCUS_IN,
- OnViewFocusIn);
- evas_object_event_callback_del(ewk_view_, EVAS_CALLBACK_FOCUS_OUT,
- OnViewFocusOut);
evas_object_smart_callback_del(ewk_view_, kVisibleContentChangedSignalName,
VisibleContentChangedCallback);
evas_object_smart_callback_del(ewk_view_, kCustomScrollBeginSignalName,
const base::FilePath& file_path,
int64_t file_size);
- static void OnViewFocusIn(void* data, Evas*, Evas_Object*, void*);
- static void OnViewFocusOut(void* data, Evas*, Evas_Object*, void*);
static void VisibleContentChangedCallback(void* user_data,
Evas_Object* object,
void* event_info);