}
WebContents::~WebContents() {
+#if defined(OS_TIZEN)
+ atom::AtomBrowserClient::RemoveTizenWebContentsView(web_contents());
+#endif
// The destroy() is called.
if (managed_web_contents()) {
// For webview we need to tell content module to do some cleanup work before
}
bool WebContents::HandleContextMenu(const content::ContextMenuParams& params) {
+#if defined(OS_TIZEN)
+ // return false for Tizen web apps
+ auto app_data = common::ApplicationDataManager::GetCurrentAppData();
+ if (app_data && !app_data->IsElectronApp())
+ return false;
+#endif
if (params.custom_context.is_pepper_menu) {
Emit("pepper-context-menu", std::make_pair(params, web_contents()));
web_contents()->NotifyContextMenuClosed(params.custom_context);
#include "atom/browser/atom_quota_permission_context.h"
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
#include "atom/browser/atom_speech_recognition_manager_delegate.h"
-#include "atom/browser/native_window.h"
#include "atom/browser/web_contents_permission_helper.h"
#include "atom/browser/web_contents_preferences.h"
#include "atom/browser/window_list.h"
#include "v8/include/v8.h"
#if defined(OS_TIZEN)
+#include <algorithm>
+#include "atom/browser/native_window_efl.h"
#include "content/browser/speech/tts_message_filter_efl.h"
+#include "tizen/browser/tizen_web_contents_view_delegate.h"
#else
+#include "atom/browser/native_window.h"
#include "chrome/browser/speech/tts_message_filter.h"
#endif
RemoveSandboxedRendererId(process_id);
}
+#if defined(OS_TIZEN)
+content::WebContentsViewDelegate* AtomBrowserClient::GetWebContentsViewDelegate(
+ content::WebContents* web_contents) {
+ auto tizen_view = new tizen::TizenWebContentsView(web_contents);
+ std::unique_ptr<tizen::TizenWebContentsView> p(tizen_view);
+ tizen_views_.push_back(std::move(p));
+ return new tizen::TizenWebContentsViewDelegate(tizen_view);
+}
+
+// static
+void AtomBrowserClient::RemoveTizenWebContentsView(content::WebContents* web_contents) {
+ tizen_views_.erase(std::remove_if(tizen_views_.begin(), tizen_views_.end(),
+ [web_contents] (std::unique_ptr<tizen::TizenWebContentsView>& wv) {
+ return wv->web_contents() == web_contents;
+ }),
+ tizen_views_.end());
+}
+
+tizen::TizenWebContentsView* AtomBrowserClient::GetTizenWebContentsView(content::WebContents* web_contents) {
+ for (auto& it: tizen_views_) {
+ if (it->web_contents() == web_contents)
+ return it.get();
+ }
+ return nullptr;
+}
+#endif
+
} // namespace atom
#include "brightray/browser/browser_client.h"
#include "content/public/browser/render_process_host_observer.h"
+#if defined (OS_TIZEN)
+#include "tizen/browser/tizen_web_contents_view.h"
+#endif
namespace content {
class QuotaPermissionContext;
class ClientCertificateDelegate;
+#if defined(OS_TIZEN)
+class WebContentsViewDelegate;
+#endif
}
namespace net {
namespace atom {
class AtomResourceDispatcherHostDelegate;
+#if defined(OS_TIZEN)
+static std::vector<std::unique_ptr<tizen::TizenWebContentsView>> tizen_views_;
+#endif
class AtomBrowserClient : public brightray::BrowserClient,
public content::RenderProcessHostObserver {
static void SetCustomServiceWorkerSchemes(
const std::vector<std::string>& schemes);
+#if defined(OS_TIZEN)
+ static tizen::TizenWebContentsView* GetTizenWebContentsView(content::WebContents* web_contents);
+ static void RemoveTizenWebContentsView(content::WebContents* web_contents);
+#endif
+
protected:
// content::ContentBrowserClient:
void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
void GetAdditionalAllowedSchemesForFileSystem(
std::vector<std::string>* schemes) override;
bool ShouldAllowOpenURL(content::SiteInstance* site_instance, const GURL& url) override;
+#if defined(OS_TIZEN)
+ content::WebContentsViewDelegate* GetWebContentsViewDelegate(
+ content::WebContents* web_contents) override;
+#endif
// brightray::BrowserClient:
brightray::BrowserMainParts* OverrideCreateBrowserMainParts(
void RemoveSandboxedRendererId(int process_id);
bool IsRendererSandboxed(int process_id);
+#if defined(OS_TIZEN)
+ std::vector<std::unique_ptr<tizen::TizenWebContentsView>> web_views_;
+#endif
+
// pending_render_process => current_render_process.
std::map<int, int> pending_processes_;
// Set that contains the process ids of all sandboxed renderers
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tizen_web_contents_view.h"
+
+namespace tizen {
+
+TizenWebContentsView::TizenWebContentsView(content::WebContents* web_contents)
+ : web_contents_(web_contents) {}
+
+} // namespace tizen
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// This class resembles EWebView
+// Empty functions will be replaced by full-fledged functions
+// in later patches
+
+#ifndef TIZEN_BROWSER_TIZEN_WEB_CONTENTS_VIEW_H_
+#define TIZEN_BROWSER_TIZEN_WEB_CONTENTS_VIEW_H_
+
+#include "content/public/common/context_menu_params.h"
+#include "content/public/browser/web_contents.h"
+#include "ui/gfx/geometry/rect.h"
+
+namespace tizen {
+
+class TizenWebContentsView {
+ public:
+ TizenWebContentsView(content::WebContents* web_contents);
+ content::WebContents* web_contents() { return web_contents_; }
+ void HandleLongPressGesture(const content::ContextMenuParams&) {}
+ void ShowContextMenu(const content::ContextMenuParams&) {}
+ void OnSelectionRectReceived(const gfx::Rect& selection_rect) const {}
+
+ private:
+ content::WebContents* web_contents_;
+};
+
+} // namespace tizen
+
+#endif // TIZEN_BROWSER_TIZEN_WEB_CONTENTS_VIEW_H_
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tizen/browser/tizen_web_contents_view_delegate.h"
+
+namespace tizen {
+
+TizenWebContentsViewDelegate::TizenWebContentsViewDelegate(TizenWebContentsView* wv)
+ : web_view_(wv) {
+}
+
+// Note: WebContentsViewDelegate::ShowContextMenu is the hook called
+// by chromium in response to either a long press gesture (in case of
+// touch-based input event is the source) or a right button mouse click
+// (in case source is mouse-based).
+// For the former, JSWRT apps enter selection mode, whereas for the
+// later, context menu is shown right way.
+void TizenWebContentsViewDelegate::ShowContextMenu(
+ content::RenderFrameHost* render_frame_host,
+ const content::ContextMenuParams& params) {
+ if (params.source_type == ui::MENU_SOURCE_LONG_PRESS) {
+ // Touch events check is not needed as they're enabled by default
+ web_view_->HandleLongPressGesture(params);
+ } else {
+ web_view_->ShowContextMenu(params);
+ }
+}
+
+void TizenWebContentsViewDelegate::OnSelectionRectReceived(
+ const gfx::Rect& selection_rect) const {
+ web_view_->OnSelectionRectReceived(selection_rect);
+}
+
+} // namespace tizen
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TIZEN_BROWSER_TIZEN_WEB_CONTENTS_VIEW_DELEGATE_H_
+#define TIZEN_BROWSER_TIZEN_WEB_CONTENTS_VIEW_DELEGATE_H_
+
+#include "content/public/browser/web_contents_view_delegate.h"
+#include "content/public/common/menu_item.h"
+#include "tizen/browser/tizen_web_contents_view.h"
+
+namespace content {
+class RenderFrameHost;
+}
+
+namespace tizen {
+
+class TizenWebContentsViewDelegate
+ : public content::WebContentsViewDelegate {
+ public:
+ TizenWebContentsViewDelegate(TizenWebContentsView*);
+
+ void ShowContextMenu(
+ content::RenderFrameHost* render_frame_host,
+ const content::ContextMenuParams& params) override;
+
+ void OnSelectionRectReceived(const gfx::Rect& selection_rect) const override;
+
+ private:
+ TizenWebContentsView* web_view_;
+};
+
+} // namespace tizen
+
+#endif // TIZEN_BROWSER_TIZEN_WEB_CONTENTS_VIEW_DELEGATE_H_
\ No newline at end of file
'tizen/src/browser/wrt_service.h',
'tizen/browser/tizen_browser_parts.cc',
'tizen/browser/tizen_browser_parts.h',
+ 'tizen/browser/tizen_web_contents_view_delegate.cc',
+ 'tizen/browser/tizen_web_contents_view_delegate.h',
+ 'tizen/browser/tizen_web_contents_view.cc',
+ 'tizen/browser/tizen_web_contents_view.h',
'tizen/browser/vibration_manager.cc',
'tizen/browser/vibration_manager.h',
],