"browser/sound_effect_tizen.cc",
"browser/ssl_host_state_delegate_efl.cc",
"browser/ssl_host_state_delegate_efl.h",
+ "browser/tizen_extensible_host.cc",
+ "browser/tizen_extensible_host.h",
"browser/web_view_browser_message_filter.cc",
"browser/web_view_browser_message_filter.h",
"browser_context_efl.cc",
"common/print_pages_params.cc",
"common/print_pages_params.h",
"common/render_messages_ewk.h",
- "common/tizen_extensible.cc",
- "common/tizen_extensible.h",
"common/version_info.cc",
"common/version_info.h",
"common/version_info_efl.h",
"renderer/render_frame_observer_efl.h",
"renderer/render_thread_observer_efl.cc",
"renderer/render_thread_observer_efl.h",
+ "renderer/tizen_extensible.cc",
+ "renderer/tizen_extensible.h",
"wrt/dynamicplugin.cc",
"wrt/dynamicplugin.h",
"wrt/v8widget.cc",
--- /dev/null
+// Copyright 2016 Samsung Electronics. All rights reseoved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "browser/tizen_extensible_host.h"
+
+#include "common/render_messages_ewk.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_source.h"
+#include "content/public/browser/notification_types.h"
+#include "content/public/browser/render_process_host.h"
+
+// static
+TizenExtensibleHost* TizenExtensibleHost::GetInstance() {
+ return base::Singleton<TizenExtensibleHost>::get();
+}
+
+TizenExtensibleHost::TizenExtensibleHost()
+ : extensible_api_table_{
+ {"background,music", true},
+ {"background,vibration", false},
+ {"block,multimedia,on,call", false},
+ {"csp", false},
+ {"encrypted,database", false},
+ {"fullscreen", false},
+ {"mediastream,record", false},
+ {"media,volume,control", false},
+ {"prerendering,for,rotation", false},
+ {"rotate,camera,view", true},
+ {"rotation,lock", false},
+ {"sound,mode", false},
+ {"support,fullscreen", true},
+ {"visibility,suspend", false},
+ {"xwindow,for,fullscreen,video", false},
+ {"support,multimedia", true},
+ } {}
+
+TizenExtensibleHost::~TizenExtensibleHost() {}
+
+void TizenExtensibleHost::Initialize() {
+ if (registrar_.IsEmpty()) {
+ registrar_.Add(
+ this, content::NOTIFICATION_RENDERER_PROCESS_CREATED,
+ content::NotificationService::AllBrowserContextsAndSources());
+ registrar_.Add(
+ this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
+ content::NotificationService::AllBrowserContextsAndSources());
+ }
+}
+
+void TizenExtensibleHost::Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ content::RenderProcessHost* process =
+ content::Source<content::RenderProcessHost>(source).ptr();
+ DCHECK(process);
+
+ int renderer_id = process->GetID();
+ switch (type) {
+ case content::NOTIFICATION_RENDERER_PROCESS_CREATED: {
+ renderers_.insert(renderer_id);
+ UpdateTizenExtensible(renderer_id);
+ break;
+ }
+ case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: {
+ renderers_.erase(renderer_id);
+ break;
+ }
+ default:
+ NOTREACHED();
+ break;
+ }
+}
+
+void TizenExtensibleHost::UpdateTizenExtensible(int render_process_id) {
+ DCHECK(render_process_id);
+ DCHECK(renderers_.find(render_process_id) != renderers_.end());
+ content::RenderProcessHost* host =
+ content::RenderProcessHost::FromID(render_process_id);
+ if (host)
+ host->Send(new EwkProcessMsg_UpdateTizenExtensible(extensible_api_table_));
+}
+
+bool TizenExtensibleHost::SetExtensibleAPI(const std::string& api_name,
+ bool enable) {
+ auto it = extensible_api_table_.find(api_name);
+ if (it == extensible_api_table_.end())
+ return false;
+ it->second = enable;
+
+ for_each(renderers_.begin(), renderers_.end(), [api_name, enable](int e) {
+ content::RenderProcessHost* host = content::RenderProcessHost::FromID(e);
+ if (host)
+ host->Send(new EwkProcessMsg_SetExtensibleAPI(api_name, enable));
+ });
+
+ return true;
+}
+
+bool TizenExtensibleHost::GetExtensibleAPI(const std::string& api_name) {
+ auto it = extensible_api_table_.find(api_name);
+ return ((it == extensible_api_table_.end()) ? false : it->second);
+}
--- /dev/null
+// Copyright 2016 Samsung Electronics. All rights reseoved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EWK_EFL_INTEGRATION_BROWSER_TIZEN_EXTENSIBLE_HOST_H
+#define EWK_EFL_INTEGRATION_BROWSER_TIZEN_EXTENSIBLE_HOST_H
+
+#include <map>
+#include <set>
+#include <string>
+
+#include "base/compiler_specific.h"
+#include "base/memory/singleton.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+#include "public/ewk_context.h"
+
+class TizenExtensibleHost : public content::NotificationObserver {
+ public:
+ static TizenExtensibleHost* GetInstance();
+ void Initialize();
+
+ // content::NotificationObserver implementation:
+ void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) override;
+ void UpdateTizenExtensible(int render_process_id);
+
+ // Tizen Extensible API
+ bool SetExtensibleAPI(const std::string& api_name, bool enable);
+ bool GetExtensibleAPI(const std::string& api_name);
+
+ private:
+ TizenExtensibleHost();
+ ~TizenExtensibleHost() override;
+
+ TizenExtensibleHost(const TizenExtensibleHost&) = delete;
+ TizenExtensibleHost& operator=(const TizenExtensibleHost&) = delete;
+
+ content::NotificationRegistrar registrar_;
+ std::set<int> renderers_;
+ std::map<std::string, bool> extensible_api_table_;
+ friend struct base::DefaultSingletonTraits<TizenExtensibleHost>;
+};
+
+#endif // EWK_EFL_INTEGRATION_BROWSER_TIZEN_EXTENSIBLE_HOST_H
#include "ipc_message_start_ewk.h"
typedef std::map<std::string, std::string> StringMap;
+typedef std::map<std::string, bool> ExtensibleApiMap;
#define IPC_MESSAGE_START EwkMsgStart
bool /* prevState */,
bool /* nextState */)
+IPC_MESSAGE_CONTROL1(EwkProcessMsg_UpdateTizenExtensible,
+ ExtensibleApiMap /* Extensible APIs */)
+IPC_MESSAGE_CONTROL2(EwkProcessMsg_SetExtensibleAPI,
+ std::string /* api name */,
+ bool /* enable */)
+
IPC_MESSAGE_ROUTED0(EwkHostMsg_DidNotAllowScript)
+++ /dev/null
-// Copyright 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 "tizen_extensible.h"
-
-
-TizenExtensible::TizenExtensible() :
- extensible_API_table_ {
- { "background,music", true },
- { "csp", false },
- { "encrypted,database", false },
- { "fullscreen", false },
- { "fullscreen,forbid,auto,exit", false },
- { "mediastream,record", false },
- { "media,volume,control", false },
- { "prerendering,for,rotation", false },
- { "rotate,camera,view", true },
- { "rotation,lock", false },
- { "sound,mode", false },
- { "support,fullscreen", true },
- { "visibility,suspend", false },
- { "xwindow,for,fullscreen,video", false },
- { "support,multimedia", true },
- } {
-
-}
-
-bool TizenExtensible::SetAPI(const std::string& api_name, const bool enable) {
- auto it = extensible_API_table_.find(api_name);
- if (it == extensible_API_table_.end())
- return false;
- it->second = enable;
- return true;
-}
-
-bool TizenExtensible::GetAPI(const std::string& api_name) const {
- auto it = extensible_API_table_.find(api_name);
- if (it == extensible_API_table_.end())
- return false;
- return it->second;
-}
-
+++ /dev/null
-// Copyright 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 TIZEN_EXTENSIBLE_h
-#define TIZEN_EXTENSIBLE_h
-
-#include <string>
-#include <unordered_map>
-
-class TizenExtensible {
- public:
- static TizenExtensible* create() {
- return new TizenExtensible();
- }
-
- bool SetAPI(const std::string& api_name, const bool enable);
- bool GetAPI(const std::string& api_name) const;
-
- private:
- TizenExtensible();
- std::unordered_map<std::string, bool> extensible_API_table_;
-};
-
-#endif // TIZEN_EXTENSIBLE_h
#include "base/synchronization/waitable_event.h"
#include "base/task/thread_pool.h"
#include "browser/favicon/favicon_database.h"
+#include "browser/tizen_extensible_host.h"
#include "browser/webdata/web_data_service_factory.h"
#include "components/autofill/content/browser/content_autofill_driver.h"
#include "content/public/browser/browser_context.h"
ewk_favicon_database_.reset(new EwkFaviconDatabase(this));
notification_cb_.reset(
new EWebContextNotificationCallback(nullptr, nullptr, nullptr, nullptr));
- tizen_extensible_.reset(TizenExtensible::create());
+ TizenExtensibleHost::GetInstance()->Initialize();
#if BUILDFLAG(IS_TIZEN)
if (should_preload_injected_bundle) {
}
bool EWebContext::SetExtensibleAPI(const std::string& api_name, bool enable) {
- return tizen_extensible_->SetAPI(api_name, enable);
+ return TizenExtensibleHost::GetInstance()->SetExtensibleAPI(api_name, enable);
}
bool EWebContext::GetExtensibleAPI(const std::string& api_name) {
- return tizen_extensible_->GetAPI(api_name);
+ return TizenExtensibleHost::GetInstance()->GetExtensibleAPI(api_name);
}
#include "base/files/file_path.h"
#include "browser/web_cache_efl/web_cache_manager_efl.h"
-#include "common/tizen_extensible.h"
#include "private/ewk_cookie_manager_private.h"
#include "public/ewk_context.h"
#include "public/ewk_context_product.h"
class CookieManager;
class Ewk_Wrt_Message_Data;
-class TizenExtensible;
class EwkFaviconDatabase;
namespace content {
std::unique_ptr<WebCacheManagerEfl> web_cache_manager_;
std::unique_ptr<content::BrowserContextEfl> browser_context_;
std::unique_ptr<Ewk_Cookie_Manager> ewk_cookie_manager_;
- std::unique_ptr<TizenExtensible> tizen_extensible_;
std::unique_ptr<EwkFaviconDatabase> ewk_favicon_database_;
std::string proxy_uri_;
std::string proxy_username_;
Eina_Bool ewk_context_tizen_extensible_api_set(Ewk_Context * /*context*/, Ewk_Extensible_API /*extensibleAPI*/, Eina_Bool /*enable*/)
{
- //This API will not be implemented with chromium engine based Ewk View
+ // This API was deprecated.
NOTIMPLEMENTED();
return EINA_FALSE;
}
Eina_Bool ewk_context_tizen_extensible_api_get(Ewk_Context * /*context*/, Ewk_Extensible_API /*extensibleAPI*/)
{
- //This API will not be implemented with chromium engine based Ewk View
+ // This API was deprecated.
NOTIMPLEMENTED();
return EINA_FALSE;
}
Eina_Bool ewk_context_background_music_get(Ewk_Context* context)
{
- LOG_EWK_API_MOCKUP();
- return EINA_FALSE;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(context, EINA_FALSE);
+ return ewk_context_tizen_extensible_api_string_get(context,
+ "background,music");
}
Eina_Bool ewk_context_background_music_set(Ewk_Context* context, Eina_Bool enable)
{
- LOG_EWK_API_MOCKUP();
- return EINA_FALSE;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(context, EINA_FALSE);
+ return ewk_context_tizen_extensible_api_string_set(
+ context, "background,music", enable);
}
Eina_Bool ewk_context_block_multimedia_on_call_get(Ewk_Context* context)
{
- LOG_EWK_API_MOCKUP();
- return EINA_FALSE;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(context, EINA_FALSE);
+ return ewk_context_tizen_extensible_api_string_get(
+ context, "block,multimedia,on,call");
}
Eina_Bool ewk_context_block_multimedia_on_call_set(Ewk_Context* context, Eina_Bool enable)
{
- LOG_EWK_API_MOCKUP();
- return EINA_FALSE;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(context, EINA_FALSE);
+ return ewk_context_tizen_extensible_api_string_set(
+ context, "block,multimedia,on,call", enable);
}
Eina_Bool ewk_context_rotation_lock_get(Ewk_Context* context)
{
- LOG_EWK_API_MOCKUP();
- return EINA_FALSE;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(context, EINA_FALSE);
+ return ewk_context_tizen_extensible_api_string_get(context, "rotation,lock");
}
Eina_Bool ewk_context_rotation_lock_set(Ewk_Context* context, Eina_Bool enable)
{
- LOG_EWK_API_MOCKUP();
- return EINA_FALSE;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(context, EINA_FALSE);
+ return ewk_context_tizen_extensible_api_string_set(context, "rotation,lock",
+ enable);
}
Eina_Bool ewk_context_sound_overlap_get(Ewk_Context* context)
{
- LOG_EWK_API_MOCKUP();
- return EINA_FALSE;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(context, EINA_FALSE);
+ return ewk_context_tizen_extensible_api_string_get(context, "sound,mode");
}
Eina_Bool ewk_context_sound_overlap_set(Ewk_Context* context, Eina_Bool enable)
{
- LOG_EWK_API_MOCKUP();
- return EINA_FALSE;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(context, EINA_FALSE);
+ return ewk_context_tizen_extensible_api_string_set(context, "sound,mode",
+ enable);
}
Eina_Bool ewk_context_app_control_set(const Ewk_Context* context, void* app_control)
#include "common/render_messages_ewk.h"
#include "content/public/renderer/render_thread.h"
#include "renderer/content_renderer_client_efl.h"
+#include "renderer/tizen_extensible.h"
#include "third_party/blink/public/platform/web_cache.h"
#include "third_party/sqlite/sqlite3.h"
#include "v8/include/v8.h"
IPC_BEGIN_MESSAGE_MAP(RenderThreadObserverEfl, message)
IPC_MESSAGE_HANDLER(EflViewMsg_ClearCache, OnClearCache)
IPC_MESSAGE_HANDLER(EflViewMsg_SetCache, OnSetCache)
+ IPC_MESSAGE_HANDLER(EwkProcessMsg_SetExtensibleAPI, OnSetExtensibleAPI)
+ IPC_MESSAGE_HANDLER(EwkProcessMsg_UpdateTizenExtensible,
+ OnUpdateTizenExtensible)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
#endif
}
+void RenderThreadObserverEfl::OnSetExtensibleAPI(const std::string& api_name,
+ bool enable) {
+ TizenExtensible::GetInstance()->SetExtensibleAPI(api_name, enable);
+}
+
+void RenderThreadObserverEfl::OnUpdateTizenExtensible(
+ const std::map<std::string, bool>& params) {
+ TizenExtensible::GetInstance()->UpdateTizenExtensible(params);
+}
\ No newline at end of file
#ifndef RENDER_THREAD_OBSERVER_EFL_H
#define RENDER_THREAD_OBSERVER_EFL_H
+#include <map>
#include <string>
#include "base/compiler_specific.h"
explicit RenderThreadObserverEfl(ContentRendererClientEfl* content_client);
bool OnControlMessageReceived(const IPC::Message& message) override;
void OnClearCache();
-
+
private:
void OnSetCache(const CacheParamsEfl& params);
ContentRendererClientEfl* content_client_;
+ void OnSetExtensibleAPI(const std::string& api_name, bool enable);
+ void OnUpdateTizenExtensible(const std::map<std::string, bool>& params);
};
#endif
--- /dev/null
+// Copyright 2016 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 "renderer/tizen_extensible.h"
+
+TizenExtensible::TizenExtensible() :
+ extensible_api_table_ {
+ { "background,music", true },
+ { "background,vibration", false },
+ { "block,multimedia,on,call", false},
+ { "csp", false },
+ { "encrypted,database", false },
+ { "fullscreen", false },
+ { "mediastream,record", false },
+ { "media,volume,control", false },
+ { "prerendering,for,rotation", false },
+ { "rotate,camera,view", true },
+ { "rotation,lock", false },
+ { "sound,mode", false },
+ { "support,fullscreen", true },
+ { "visibility,suspend", false },
+ { "xwindow,for,fullscreen,video", false },
+ { "support,multimedia", true },
+ },
+ initialized_(false) {
+}
+
+TizenExtensible::~TizenExtensible() {
+ extensible_api_table_.clear();
+}
+
+void TizenExtensible::UpdateTizenExtensible(
+ const std::map<std::string, bool>& params) {
+ extensible_api_table_.clear();
+ extensible_api_table_ = params;
+ initialized_ = true;
+}
+
+bool TizenExtensible::SetExtensibleAPI(const std::string& api_name,
+ bool enable) {
+ auto it = extensible_api_table_.find(api_name);
+ if (it == extensible_api_table_.end())
+ return false;
+ it->second = enable;
+
+ return true;
+}
+
+bool TizenExtensible::GetExtensibleAPI(const std::string& api_name) const {
+ if (!initialized_)
+ return false;
+
+ auto it = extensible_api_table_.find(api_name);
+ if (it == extensible_api_table_.end())
+ return false;
+
+ return it->second;
+}
--- /dev/null
+// Copyright 2016 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 EWK_EFL_INTEGRATION_RENDERER_TIZEN_EXTENSIBLE_H_
+#define EWK_EFL_INTEGRATION_RENDERER_TIZEN_EXTENSIBLE_H_
+
+#include <map>
+#include <string>
+
+#include "base/memory/singleton.h"
+
+class TizenExtensible {
+ public:
+ static TizenExtensible* GetInstance() {
+ return base::Singleton<TizenExtensible>::get();
+ }
+ void UpdateTizenExtensible(const std::map<std::string, bool>& params);
+
+ // Tizen Extensible API
+ bool SetExtensibleAPI(const std::string& api_name, bool enable);
+ bool GetExtensibleAPI(const std::string& api_name) const;
+
+ private:
+ TizenExtensible();
+ ~TizenExtensible();
+
+ TizenExtensible(const TizenExtensible&) = delete;
+ TizenExtensible& operator=(const TizenExtensible&) = delete;
+
+ std::map<std::string, bool> extensible_api_table_;
+ bool initialized_;
+ friend struct base::DefaultSingletonTraits<TizenExtensible>;
+};
+
+#endif // EWK_EFL_INTEGRATION_RENDERER_TIZEN_EXTENSIBLE_H_