diff --git a/packages/webview_flutter_ewk/.gitignore b/packages/webview_flutter_ewk/.gitignore new file mode 100644 index 000000000..e9dc58d3d --- /dev/null +++ b/packages/webview_flutter_ewk/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +.dart_tool/ + +.packages +.pub/ + +build/ diff --git a/packages/webview_flutter_ewk/CHANGELOG.md b/packages/webview_flutter_ewk/CHANGELOG.md new file mode 100644 index 000000000..2df996514 --- /dev/null +++ b/packages/webview_flutter_ewk/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.1.0 + +* Initial release \ No newline at end of file diff --git a/packages/webview_flutter_ewk/LICENSE b/packages/webview_flutter_ewk/LICENSE new file mode 100644 index 000000000..4e5cfe14e --- /dev/null +++ b/packages/webview_flutter_ewk/LICENSE @@ -0,0 +1,26 @@ +Copyright (c) 2020 Samsung Electronics Co., Ltd. All rights reserved. +Copyright (c) 2017 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the names of the copyright holders nor the names of the + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/webview_flutter_ewk/README.md b/packages/webview_flutter_ewk/README.md new file mode 100644 index 000000000..aad3daae6 --- /dev/null +++ b/packages/webview_flutter_ewk/README.md @@ -0,0 +1,59 @@ +# webview_flutter_tizen_ewk + +The Tizen implementation of [`webview_flutter`](https://github.com/flutter/plugins/tree/master/packages/webview_flutter). + +## Supported devices + +This plugin is available on these types of devices: + +- Galaxy Watch or TV (running Tizen 5.5 or later) + +## Required privileges + +To use this plugin, add below lines under the `` section in your `tizen-manifest.xml` file, + +```xml + + http://tizen.org/privilege/internet + +``` + +## Usage + +This package is not an _endorsed_ implementation of `webview_flutter`. Therefore, you have to include `webview_flutter_tizen_ewk` alongside `webview_flutter` as dependencies in your `pubspec.yaml` file. + +```yaml +dependencies: + webview_flutter: ^1.0.6 + webview_flutter_tizen_ewk: ^0.1.0 +``` + +## Example + +```dart +import 'dart:io'; +import 'package:webview_flutter/webview_flutter.dart'; + +class WebViewExample extends StatefulWidget { + @override + WebViewExampleState createState() => WebViewExampleState(); +} + +class WebViewExampleState extends State { + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return WebView( + initialUrl: 'https://flutter.dev', + ); + } +} +``` + +## Limitations +- This plugin is only supported on **Galaxy Watch and TV** devices running Tizen 5.5 or later. +- This is an initial webview plugin for Tizen and is implemented based on Tizen Chromium-EWK engine. \ No newline at end of file diff --git a/packages/webview_flutter_ewk/example/.gitignore b/packages/webview_flutter_ewk/example/.gitignore new file mode 100644 index 000000000..9d532b18a --- /dev/null +++ b/packages/webview_flutter_ewk/example/.gitignore @@ -0,0 +1,41 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Web related +lib/generated_plugin_registrant.dart + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json diff --git a/packages/webview_flutter_ewk/example/README.md b/packages/webview_flutter_ewk/example/README.md new file mode 100644 index 000000000..7c99e1895 --- /dev/null +++ b/packages/webview_flutter_ewk/example/README.md @@ -0,0 +1,7 @@ +# webview_flutter_tizen_ewk_example + +Demonstrates how to use the webview_flutter_tizen_ewk plugin. + +## Getting Started + +To run this app on your Tizen device, use [flutter-tizen](https://github.com/flutter-tizen/flutter-tizen). \ No newline at end of file diff --git a/packages/webview_flutter_ewk/example/integration_test/webview_flutter_tizen_test.dart b/packages/webview_flutter_ewk/example/integration_test/webview_flutter_tizen_test.dart new file mode 100644 index 000000000..5ef75496d --- /dev/null +++ b/packages/webview_flutter_ewk/example/integration_test/webview_flutter_tizen_test.dart @@ -0,0 +1,1219 @@ +// Copyright 2018 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. + +// @dart = 2.9 + +import 'dart:math'; +import 'dart:typed_data'; + +import 'package:flutter/services.dart'; +import 'package:flutter/src/foundation/basic_types.dart'; +import 'package:flutter/src/gestures/recognizer.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:webview_flutter/platform_interface.dart'; +import 'package:webview_flutter/webview_flutter.dart'; +import 'package:webview_flutter_tizen_ewk/webview_flutter_tizen_ewk.dart'; +import 'package:integration_test/integration_test.dart'; + +typedef void VoidCallback(); + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + final _FakePlatformViewsController fakePlatformViewsController = + _FakePlatformViewsController(); + + final _FakeCookieManager _fakeCookieManager = _FakeCookieManager(); + + setUpAll(() { + SystemChannels.platform_views.setMockMethodCallHandler( + fakePlatformViewsController.fakePlatformViewsMethodHandler); + SystemChannels.platform + .setMockMethodCallHandler(_fakeCookieManager.onMethodCall); + }); + + setUp(() { + WebView.platform = TizenWebView(); + fakePlatformViewsController.reset(); + _fakeCookieManager.reset(); + }); + + testWidgets('Create WebView', (WidgetTester tester) async { + await tester.pumpWidget(const WebView()); + }); + + testWidgets('Initial url', (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + initialUrl: 'https://youtube.com', + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + + expect(await controller.currentUrl(), 'https://youtube.com'); + }); + + testWidgets('Javascript mode', (WidgetTester tester) async { + await tester.pumpWidget(const WebView( + initialUrl: 'https://youtube.com', + javascriptMode: JavascriptMode.unrestricted, + )); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + expect(platformWebView.javascriptMode, JavascriptMode.unrestricted); + + await tester.pumpWidget(const WebView( + initialUrl: 'https://youtube.com', + javascriptMode: JavascriptMode.disabled, + )); + expect(platformWebView.javascriptMode, JavascriptMode.disabled); + }); + + testWidgets('Load url', (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + + expect(controller, isNotNull); + + await controller.loadUrl('https://flutter.io'); + + expect(await controller.currentUrl(), 'https://flutter.io'); + }); + + testWidgets('Invalid urls', (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + + expect(controller, isNotNull); + + expect(() => controller.loadUrl(null), throwsA(anything)); + expect(await controller.currentUrl(), isNull); + + expect(() => controller.loadUrl(''), throwsA(anything)); + expect(await controller.currentUrl(), isNull); + + // Missing schema. + expect(() => controller.loadUrl('flutter.io'), throwsA(anything)); + expect(await controller.currentUrl(), isNull); + }); + + testWidgets('Headers in loadUrl', (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + + expect(controller, isNotNull); + + final Map headers = { + 'CACHE-CONTROL': 'ABC' + }; + await controller.loadUrl('https://flutter.io', headers: headers); + expect(await controller.currentUrl(), equals('https://flutter.io')); + }); + + testWidgets("Can't go back before loading a page", + (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + + expect(controller, isNotNull); + + final bool canGoBackNoPageLoaded = await controller.canGoBack(); + + expect(canGoBackNoPageLoaded, false); + }); + + testWidgets("Clear Cache", (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + + expect(controller, isNotNull); + expect(fakePlatformViewsController.lastCreatedView.hasCache, true); + + await controller.clearCache(); + + expect(fakePlatformViewsController.lastCreatedView.hasCache, false); + }); + + testWidgets("Can't go back with no history", (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + initialUrl: 'https://flutter.io', + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + + expect(controller, isNotNull); + final bool canGoBackFirstPageLoaded = await controller.canGoBack(); + + expect(canGoBackFirstPageLoaded, false); + }); + + testWidgets('Can go back', (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + initialUrl: 'https://flutter.io', + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + + expect(controller, isNotNull); + + await controller.loadUrl('https://www.google.com'); + final bool canGoBackSecondPageLoaded = await controller.canGoBack(); + + expect(canGoBackSecondPageLoaded, true); + }); + + testWidgets("Can't go forward before loading a page", + (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + + expect(controller, isNotNull); + + final bool canGoForwardNoPageLoaded = await controller.canGoForward(); + + expect(canGoForwardNoPageLoaded, false); + }); + + testWidgets("Can't go forward with no history", (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + initialUrl: 'https://flutter.io', + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + + expect(controller, isNotNull); + final bool canGoForwardFirstPageLoaded = await controller.canGoForward(); + + expect(canGoForwardFirstPageLoaded, false); + }); + + testWidgets('Can go forward', (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + initialUrl: 'https://flutter.io', + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + + expect(controller, isNotNull); + + await controller.loadUrl('https://youtube.com'); + await controller.goBack(); + final bool canGoForwardFirstPageBacked = await controller.canGoForward(); + + expect(canGoForwardFirstPageBacked, true); + }); + + testWidgets('Go back', (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + initialUrl: 'https://youtube.com', + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + + expect(controller, isNotNull); + + expect(await controller.currentUrl(), 'https://youtube.com'); + + await controller.loadUrl('https://flutter.io'); + + expect(await controller.currentUrl(), 'https://flutter.io'); + + await controller.goBack(); + + expect(await controller.currentUrl(), 'https://youtube.com'); + }); + + testWidgets('Go forward', (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + initialUrl: 'https://youtube.com', + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + + expect(controller, isNotNull); + + expect(await controller.currentUrl(), 'https://youtube.com'); + + await controller.loadUrl('https://flutter.io'); + + expect(await controller.currentUrl(), 'https://flutter.io'); + + await controller.goBack(); + + expect(await controller.currentUrl(), 'https://youtube.com'); + + await controller.goForward(); + + expect(await controller.currentUrl(), 'https://flutter.io'); + }); + + testWidgets('Current URL', (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + + expect(controller, isNotNull); + + // Test a WebView without an explicitly set first URL. + expect(await controller.currentUrl(), isNull); + + await controller.loadUrl('https://youtube.com'); + expect(await controller.currentUrl(), 'https://youtube.com'); + + await controller.loadUrl('https://flutter.io'); + expect(await controller.currentUrl(), 'https://flutter.io'); + + await controller.goBack(); + expect(await controller.currentUrl(), 'https://youtube.com'); + }); + + testWidgets('Reload url', (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + initialUrl: 'https://flutter.io', + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + expect(platformWebView.currentUrl, 'https://flutter.io'); + expect(platformWebView.amountOfReloadsOnCurrentUrl, 0); + + await controller.reload(); + + expect(platformWebView.currentUrl, 'https://flutter.io'); + expect(platformWebView.amountOfReloadsOnCurrentUrl, 1); + + await controller.loadUrl('https://youtube.com'); + + expect(platformWebView.amountOfReloadsOnCurrentUrl, 0); + }); + + testWidgets('evaluate Javascript', (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + initialUrl: 'https://flutter.io', + javascriptMode: JavascriptMode.unrestricted, + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + expect( + await controller.evaluateJavascript("fake js string"), "fake js string", + reason: 'should get the argument'); + expect( + () => controller.evaluateJavascript(null), + throwsA(anything), + ); + }); + + testWidgets('evaluate Javascript with JavascriptMode disabled', + (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + initialUrl: 'https://flutter.io', + javascriptMode: JavascriptMode.disabled, + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + expect( + () => controller.evaluateJavascript('fake js string'), + throwsA(anything), + ); + expect( + () => controller.evaluateJavascript(null), + throwsA(anything), + ); + }); + + testWidgets('Cookies can be cleared once', (WidgetTester tester) async { + await tester.pumpWidget( + const WebView( + initialUrl: 'https://flutter.io', + ), + ); + final CookieManager cookieManager = CookieManager(); + final bool hasCookies = await cookieManager.clearCookies(); + expect(hasCookies, true); + }); + + testWidgets('Second cookie clear does not have cookies', + (WidgetTester tester) async { + await tester.pumpWidget( + const WebView( + initialUrl: 'https://flutter.io', + ), + ); + final CookieManager cookieManager = CookieManager(); + final bool hasCookies = await cookieManager.clearCookies(); + expect(hasCookies, true); + final bool hasCookiesSecond = await cookieManager.clearCookies(); + expect(hasCookiesSecond, false); + }); + + testWidgets('Initial JavaScript channels', (WidgetTester tester) async { + await tester.pumpWidget( + WebView( + initialUrl: 'https://youtube.com', + // TODO(iskakaushik): Remove this when collection literals makes it to stable. + // ignore: prefer_collection_literals + javascriptChannels: [ + JavascriptChannel( + name: 'Tts', onMessageReceived: (JavascriptMessage msg) {}), + JavascriptChannel( + name: 'Alarm', onMessageReceived: (JavascriptMessage msg) {}), + ].toSet(), + ), + ); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + expect(platformWebView.javascriptChannelNames, + unorderedEquals(['Tts', 'Alarm'])); + }); + + test('Only valid JavaScript channel names are allowed', () { + final JavascriptMessageHandler noOp = (JavascriptMessage msg) {}; + JavascriptChannel(name: 'Tts1', onMessageReceived: noOp); + JavascriptChannel(name: '_Alarm', onMessageReceived: noOp); + JavascriptChannel(name: 'foo_bar_', onMessageReceived: noOp); + + VoidCallback createChannel(String name) { + return () { + JavascriptChannel(name: name, onMessageReceived: noOp); + }; + } + + expect(createChannel('1Alarm'), throwsAssertionError); + expect(createChannel('foo.bar'), throwsAssertionError); + expect(createChannel(''), throwsAssertionError); + }); + + testWidgets('Unique JavaScript channel names are required', + (WidgetTester tester) async { + await tester.pumpWidget( + WebView( + initialUrl: 'https://youtube.com', + // TODO(iskakaushik): Remove this when collection literals makes it to stable. + // ignore: prefer_collection_literals + javascriptChannels: [ + JavascriptChannel( + name: 'Alarm', onMessageReceived: (JavascriptMessage msg) {}), + JavascriptChannel( + name: 'Alarm', onMessageReceived: (JavascriptMessage msg) {}), + ].toSet(), + ), + ); + expect(tester.takeException(), isNot(null)); + }); + + testWidgets('JavaScript channels update', (WidgetTester tester) async { + await tester.pumpWidget( + WebView( + initialUrl: 'https://youtube.com', + // TODO(iskakaushik): Remove this when collection literals makes it to stable. + // ignore: prefer_collection_literals + javascriptChannels: [ + JavascriptChannel( + name: 'Tts', onMessageReceived: (JavascriptMessage msg) {}), + JavascriptChannel( + name: 'Alarm', onMessageReceived: (JavascriptMessage msg) {}), + ].toSet(), + ), + ); + + await tester.pumpWidget( + WebView( + initialUrl: 'https://youtube.com', + // TODO(iskakaushik): Remove this when collection literals makes it to stable. + // ignore: prefer_collection_literals + javascriptChannels: [ + JavascriptChannel( + name: 'Tts', onMessageReceived: (JavascriptMessage msg) {}), + JavascriptChannel( + name: 'Alarm2', onMessageReceived: (JavascriptMessage msg) {}), + JavascriptChannel( + name: 'Alarm3', onMessageReceived: (JavascriptMessage msg) {}), + ].toSet(), + ), + ); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + expect(platformWebView.javascriptChannelNames, + unorderedEquals(['Tts', 'Alarm2', 'Alarm3'])); + }); + + testWidgets('Remove all JavaScript channels and then add', + (WidgetTester tester) async { + // This covers a specific bug we had where after updating javascriptChannels to null, + // updating it again with a subset of the previously registered channels fails as the + // widget's cache of current channel wasn't properly updated when updating javascriptChannels to + // null. + await tester.pumpWidget( + WebView( + initialUrl: 'https://youtube.com', + // TODO(iskakaushik): Remove this when collection literals makes it to stable. + // ignore: prefer_collection_literals + javascriptChannels: [ + JavascriptChannel( + name: 'Tts', onMessageReceived: (JavascriptMessage msg) {}), + ].toSet(), + ), + ); + + await tester.pumpWidget( + const WebView( + initialUrl: 'https://youtube.com', + ), + ); + + await tester.pumpWidget( + WebView( + initialUrl: 'https://youtube.com', + // TODO(iskakaushik): Remove this when collection literals makes it to stable. + // ignore: prefer_collection_literals + javascriptChannels: [ + JavascriptChannel( + name: 'Tts', onMessageReceived: (JavascriptMessage msg) {}), + ].toSet(), + ), + ); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + expect(platformWebView.javascriptChannelNames, + unorderedEquals(['Tts'])); + }); + + testWidgets('JavaScript channel messages', (WidgetTester tester) async { + final List ttsMessagesReceived = []; + final List alarmMessagesReceived = []; + await tester.pumpWidget( + WebView( + initialUrl: 'https://youtube.com', + // TODO(iskakaushik): Remove this when collection literals makes it to stable. + // ignore: prefer_collection_literals + javascriptChannels: [ + JavascriptChannel( + name: 'Tts', + onMessageReceived: (JavascriptMessage msg) { + ttsMessagesReceived.add(msg.message); + }), + JavascriptChannel( + name: 'Alarm', + onMessageReceived: (JavascriptMessage msg) { + alarmMessagesReceived.add(msg.message); + }), + ].toSet(), + ), + ); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + expect(ttsMessagesReceived, isEmpty); + expect(alarmMessagesReceived, isEmpty); + + platformWebView.fakeJavascriptPostMessage('Tts', 'Hello'); + platformWebView.fakeJavascriptPostMessage('Tts', 'World'); + + expect(ttsMessagesReceived, ['Hello', 'World']); + }); + + group('$PageStartedCallback', () { + testWidgets('onPageStarted is not null', (WidgetTester tester) async { + String returnedUrl; + + await tester.pumpWidget(WebView( + initialUrl: 'https://youtube.com', + onPageStarted: (String url) { + returnedUrl = url; + }, + )); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + platformWebView.fakeOnPageStartedCallback(); + + expect(platformWebView.currentUrl, returnedUrl); + }); + + testWidgets('onPageStarted is null', (WidgetTester tester) async { + await tester.pumpWidget(const WebView( + initialUrl: 'https://youtube.com', + onPageStarted: null, + )); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + // The platform side will always invoke a call for onPageStarted. This is + // to test that it does not crash on a null callback. + platformWebView.fakeOnPageStartedCallback(); + }); + + testWidgets('onPageStarted changed', (WidgetTester tester) async { + String returnedUrl; + + await tester.pumpWidget(WebView( + initialUrl: 'https://youtube.com', + onPageStarted: (String url) {}, + )); + + await tester.pumpWidget(WebView( + initialUrl: 'https://youtube.com', + onPageStarted: (String url) { + returnedUrl = url; + }, + )); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + platformWebView.fakeOnPageStartedCallback(); + + expect(platformWebView.currentUrl, returnedUrl); + }); + }); + + group('$PageFinishedCallback', () { + testWidgets('onPageFinished is not null', (WidgetTester tester) async { + String returnedUrl; + + await tester.pumpWidget(WebView( + initialUrl: 'https://youtube.com', + onPageFinished: (String url) { + returnedUrl = url; + }, + )); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + platformWebView.fakeOnPageFinishedCallback(); + + expect(platformWebView.currentUrl, returnedUrl); + }); + + testWidgets('onPageFinished is null', (WidgetTester tester) async { + await tester.pumpWidget(const WebView( + initialUrl: 'https://youtube.com', + onPageFinished: null, + )); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + // The platform side will always invoke a call for onPageFinished. This is + // to test that it does not crash on a null callback. + platformWebView.fakeOnPageFinishedCallback(); + }); + + testWidgets('onPageFinished changed', (WidgetTester tester) async { + String returnedUrl; + + await tester.pumpWidget(WebView( + initialUrl: 'https://youtube.com', + onPageFinished: (String url) {}, + )); + + await tester.pumpWidget(WebView( + initialUrl: 'https://youtube.com', + onPageFinished: (String url) { + returnedUrl = url; + }, + )); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + platformWebView.fakeOnPageFinishedCallback(); + + expect(platformWebView.currentUrl, returnedUrl); + }); + }); + + group('navigationDelegate', () { + testWidgets('hasNavigationDelegate', (WidgetTester tester) async { + await tester.pumpWidget(const WebView( + initialUrl: 'https://youtube.com', + )); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + expect(platformWebView.hasNavigationDelegate, false); + + await tester.pumpWidget(WebView( + initialUrl: 'https://youtube.com', + navigationDelegate: (NavigationRequest r) => null, + )); + + expect(platformWebView.hasNavigationDelegate, true); + }); + + testWidgets('Block navigation', (WidgetTester tester) async { + final List navigationRequests = []; + + await tester.pumpWidget(WebView( + initialUrl: 'https://youtube.com', + navigationDelegate: (NavigationRequest request) { + navigationRequests.add(request); + // Only allow navigating to https://flutter.dev + return request.url == 'https://flutter.dev' + ? NavigationDecision.navigate + : NavigationDecision.prevent; + })); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + expect(platformWebView.hasNavigationDelegate, true); + + platformWebView.fakeNavigate('https://www.google.com'); + // The navigation delegate only allows navigation to https://flutter.dev + // so we should still be in https://youtube.com. + expect(platformWebView.currentUrl, 'https://youtube.com'); + expect(navigationRequests.length, 1); + expect(navigationRequests[0].url, 'https://www.google.com'); + expect(navigationRequests[0].isForMainFrame, true); + + platformWebView.fakeNavigate('https://flutter.dev'); + await tester.pump(); + expect(platformWebView.currentUrl, 'https://flutter.dev'); + }); + }); + + group('debuggingEnabled', () { + testWidgets('enable debugging', (WidgetTester tester) async { + await tester.pumpWidget(const WebView( + debuggingEnabled: true, + )); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + expect(platformWebView.debuggingEnabled, true); + }); + + testWidgets('defaults to false', (WidgetTester tester) async { + await tester.pumpWidget(const WebView()); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + expect(platformWebView.debuggingEnabled, false); + }); + + testWidgets('can be changed', (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + await tester.pumpWidget(WebView(key: key)); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + await tester.pumpWidget(WebView( + key: key, + debuggingEnabled: true, + )); + + expect(platformWebView.debuggingEnabled, true); + + await tester.pumpWidget(WebView( + key: key, + debuggingEnabled: false, + )); + + expect(platformWebView.debuggingEnabled, false); + }); + }); + + // Currently, webview for tizen cannot satisfy this test due to its implementation limitations. + /* + group('Custom platform implementation', () { + setUpAll(() { + WebView.platform = MyWebViewPlatform(); + }); + tearDownAll(() { + WebView.platform = null; + }); + + testWidgets('creation', (WidgetTester tester) async { + await tester.pumpWidget( + const WebView( + initialUrl: 'https://youtube.com', + gestureNavigationEnabled: true, + ), + ); + + final MyWebViewPlatform builder = WebView.platform; + final MyWebViewPlatformController platform = builder.lastPlatformBuilt; + + expect( + platform.creationParams, + MatchesCreationParams(CreationParams( + initialUrl: 'https://youtube.com', + webSettings: WebSettings( + javascriptMode: JavascriptMode.disabled, + hasNavigationDelegate: false, + debuggingEnabled: false, + userAgent: WebSetting.of(null), + gestureNavigationEnabled: true, + ), + // TODO(iskakaushik): Remove this when collection literals makes it to stable. + // ignore: prefer_collection_literals + javascriptChannelNames: Set(), + ))); + }); + + testWidgets('loadUrl', (WidgetTester tester) async { + WebViewController controller; + await tester.pumpWidget( + WebView( + initialUrl: 'https://youtube.com', + onWebViewCreated: (WebViewController webViewController) { + controller = webViewController; + }, + ), + ); + + final MyWebViewPlatform builder = WebView.platform; + final MyWebViewPlatformController platform = builder.lastPlatformBuilt; + + final Map headers = { + 'header': 'value', + }; + + await controller.loadUrl('https://google.com', headers: headers); + + expect(platform.lastUrlLoaded, 'https://google.com'); + expect(platform.lastRequestHeaders, headers); + }); + }); + */ + testWidgets('Set UserAgent', (WidgetTester tester) async { + await tester.pumpWidget(const WebView( + initialUrl: 'https://youtube.com', + javascriptMode: JavascriptMode.unrestricted, + )); + + final FakePlatformWebView platformWebView = + fakePlatformViewsController.lastCreatedView; + + expect(platformWebView.userAgent, isNull); + + await tester.pumpWidget(const WebView( + initialUrl: 'https://youtube.com', + javascriptMode: JavascriptMode.unrestricted, + userAgent: 'UA', + )); + + expect(platformWebView.userAgent, 'UA'); + }); +} + +class FakePlatformWebView { + FakePlatformWebView(int id, Map params) { + if (params.containsKey('initialUrl')) { + final String initialUrl = params['initialUrl']; + if (initialUrl != null) { + history.add(initialUrl); + currentPosition++; + } + } + if (params.containsKey('javascriptChannelNames')) { + javascriptChannelNames = + List.from(params['javascriptChannelNames']); + } + javascriptMode = JavascriptMode.values[params['settings']['jsMode']]; + hasNavigationDelegate = + params['settings']['hasNavigationDelegate'] ?? false; + debuggingEnabled = params['settings']['debuggingEnabled']; + userAgent = params['settings']['userAgent']; + channel = MethodChannel( + 'plugins.flutter.io/webview_$id', const StandardMethodCodec()); + channel.setMockMethodCallHandler(onMethodCall); + } + + MethodChannel channel; + + List history = []; + int currentPosition = -1; + int amountOfReloadsOnCurrentUrl = 0; + bool hasCache = true; + + String get currentUrl => history.isEmpty ? null : history[currentPosition]; + JavascriptMode javascriptMode; + List javascriptChannelNames; + + bool hasNavigationDelegate; + bool debuggingEnabled; + String userAgent; + + Future onMethodCall(MethodCall call) { + switch (call.method) { + case 'loadUrl': + final Map request = call.arguments; + _loadUrl(request['url']); + return Future.sync(() {}); + case 'updateSettings': + if (call.arguments['jsMode'] != null) { + javascriptMode = JavascriptMode.values[call.arguments['jsMode']]; + } + if (call.arguments['hasNavigationDelegate'] != null) { + hasNavigationDelegate = call.arguments['hasNavigationDelegate']; + } + if (call.arguments['debuggingEnabled'] != null) { + debuggingEnabled = call.arguments['debuggingEnabled']; + } + userAgent = call.arguments['userAgent']; + break; + case 'canGoBack': + return Future.sync(() => currentPosition > 0); + break; + case 'canGoForward': + return Future.sync(() => currentPosition < history.length - 1); + break; + case 'goBack': + currentPosition = max(-1, currentPosition - 1); + return Future.sync(() {}); + break; + case 'goForward': + currentPosition = min(history.length - 1, currentPosition + 1); + return Future.sync(() {}); + case 'reload': + amountOfReloadsOnCurrentUrl++; + return Future.sync(() {}); + break; + case 'currentUrl': + return Future.value(currentUrl); + break; + case 'evaluateJavascript': + return Future.value(call.arguments); + break; + case 'addJavascriptChannels': + final List channelNames = List.from(call.arguments); + javascriptChannelNames.addAll(channelNames); + break; + case 'removeJavascriptChannels': + final List channelNames = List.from(call.arguments); + javascriptChannelNames + .removeWhere((String channel) => channelNames.contains(channel)); + break; + case 'clearCache': + hasCache = false; + return Future.sync(() {}); + } + return Future.sync(() {}); + } + + void fakeJavascriptPostMessage(String jsChannel, String message) { + final StandardMethodCodec codec = const StandardMethodCodec(); + final Map arguments = { + 'channel': jsChannel, + 'message': message + }; + final ByteData data = codec + .encodeMethodCall(MethodCall('javascriptChannelMessage', arguments)); + ServicesBinding.instance.defaultBinaryMessenger + .handlePlatformMessage(channel.name, data, (ByteData data) {}); + } + + // Fakes a main frame navigation that was initiated by the webview, e.g when + // the user clicks a link in the currently loaded page. + void fakeNavigate(String url) { + if (!hasNavigationDelegate) { + print('no navigation delegate'); + _loadUrl(url); + return; + } + final StandardMethodCodec codec = const StandardMethodCodec(); + final Map arguments = { + 'url': url, + 'isForMainFrame': true + }; + final ByteData data = + codec.encodeMethodCall(MethodCall('navigationRequest', arguments)); + ServicesBinding.instance.defaultBinaryMessenger + .handlePlatformMessage(channel.name, data, (ByteData data) { + final bool allow = codec.decodeEnvelope(data); + if (allow) { + _loadUrl(url); + } + }); + } + + void fakeOnPageStartedCallback() { + final StandardMethodCodec codec = const StandardMethodCodec(); + + final ByteData data = codec.encodeMethodCall(MethodCall( + 'onPageStarted', + {'url': currentUrl}, + )); + + ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage( + channel.name, + data, + (ByteData data) {}, + ); + } + + void fakeOnPageFinishedCallback() { + final StandardMethodCodec codec = const StandardMethodCodec(); + + final ByteData data = codec.encodeMethodCall(MethodCall( + 'onPageFinished', + {'url': currentUrl}, + )); + + ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage( + channel.name, + data, + (ByteData data) {}, + ); + } + + void _loadUrl(String url) { + history = history.sublist(0, currentPosition + 1); + history.add(url); + currentPosition++; + amountOfReloadsOnCurrentUrl = 0; + } +} + +class _FakePlatformViewsController { + FakePlatformWebView lastCreatedView; + + Future fakePlatformViewsMethodHandler(MethodCall call) { + switch (call.method) { + case 'create': + final Map args = call.arguments; + final Map params = _decodeParams(args['params']); + lastCreatedView = FakePlatformWebView( + args['id'], + params, + ); + return Future.sync(() => 1); + default: + return Future.sync(() {}); + } + } + + void reset() { + lastCreatedView = null; + } +} + +Map _decodeParams(Uint8List paramsMessage) { + final ByteBuffer buffer = paramsMessage.buffer; + final ByteData messageBytes = buffer.asByteData( + paramsMessage.offsetInBytes, + paramsMessage.lengthInBytes, + ); + return const StandardMessageCodec().decodeMessage(messageBytes); +} + +class _FakeCookieManager { + _FakeCookieManager() { + final MethodChannel channel = const MethodChannel( + 'plugins.flutter.io/cookie_manager', + StandardMethodCodec(), + ); + channel.setMockMethodCallHandler(onMethodCall); + } + + bool hasCookies = true; + + Future onMethodCall(MethodCall call) { + switch (call.method) { + case 'clearCookies': + bool hadCookies = false; + if (hasCookies) { + hadCookies = true; + hasCookies = false; + } + return Future.sync(() { + return hadCookies; + }); + break; + } + return Future.sync(() => null); + } + + void reset() { + hasCookies = true; + } +} + +class MyWebViewPlatform implements WebViewPlatform { + MyWebViewPlatformController lastPlatformBuilt; + + @override + Widget build({ + BuildContext context, + CreationParams creationParams, + @required WebViewPlatformCallbacksHandler webViewPlatformCallbacksHandler, + @required WebViewPlatformCreatedCallback onWebViewPlatformCreated, + Set> gestureRecognizers, + }) { + assert(onWebViewPlatformCreated != null); + lastPlatformBuilt = MyWebViewPlatformController( + creationParams, gestureRecognizers, webViewPlatformCallbacksHandler); + onWebViewPlatformCreated(lastPlatformBuilt); + return Container(); + } + + @override + Future clearCookies() { + return Future.sync(() => null); + } +} + +class MyWebViewPlatformController extends WebViewPlatformController { + MyWebViewPlatformController(this.creationParams, this.gestureRecognizers, + WebViewPlatformCallbacksHandler platformHandler) + : super(platformHandler); + + CreationParams creationParams; + Set> gestureRecognizers; + + String lastUrlLoaded; + Map lastRequestHeaders; + + @override + Future loadUrl(String url, Map headers) { + equals(1, 1); + lastUrlLoaded = url; + lastRequestHeaders = headers; + return null; + } +} + +class MatchesWebSettings extends Matcher { + MatchesWebSettings(this._webSettings); + + final WebSettings _webSettings; + + @override + Description describe(Description description) => + description.add('$_webSettings'); + + @override + bool matches( + covariant WebSettings webSettings, Map matchState) { + return _webSettings.javascriptMode == webSettings.javascriptMode && + _webSettings.hasNavigationDelegate == + webSettings.hasNavigationDelegate && + _webSettings.debuggingEnabled == webSettings.debuggingEnabled && + _webSettings.gestureNavigationEnabled == + webSettings.gestureNavigationEnabled && + _webSettings.userAgent == webSettings.userAgent; + } +} + +class MatchesCreationParams extends Matcher { + MatchesCreationParams(this._creationParams); + + final CreationParams _creationParams; + + @override + Description describe(Description description) => + description.add('$_creationParams'); + + @override + bool matches(covariant CreationParams creationParams, + Map matchState) { + return _creationParams.initialUrl == creationParams.initialUrl && + MatchesWebSettings(_creationParams.webSettings) + .matches(creationParams.webSettings, matchState) && + orderedEquals(_creationParams.javascriptChannelNames) + .matches(creationParams.javascriptChannelNames, matchState); + } +} diff --git a/packages/webview_flutter_ewk/example/lib/main.dart b/packages/webview_flutter_ewk/example/lib/main.dart new file mode 100644 index 000000000..cdb05d526 --- /dev/null +++ b/packages/webview_flutter_ewk/example/lib/main.dart @@ -0,0 +1,353 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// ignore_for_file: public_member_api_docs + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:webview_flutter/webview_flutter.dart'; + +void main() => runApp(MaterialApp(home: WebViewExample())); + +const String kNavigationExamplePage = ''' + +Navigation Delegate Example + +

+The navigation delegate is set to block navigation to the youtube website. +

+ + + +'''; + +class WebViewExample extends StatefulWidget { + @override + _WebViewExampleState createState() => _WebViewExampleState(); +} + +class _WebViewExampleState extends State { + final Completer _controller = + Completer(); + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Flutter WebView example'), + // This drop down menu demonstrates that Flutter widgets can be shown over the web view. + actions: [ + NavigationControls(_controller.future), + SampleMenu(_controller.future), + ], + ), + // We're using a Builder here so we have a context that is below the Scaffold + // to allow calling Scaffold.of(context) so we can show a snackbar. + body: Builder(builder: (BuildContext context) { + return WebView( + initialUrl: 'https://www.apache.org/licenses/LICENSE-2.0.txt', + javascriptMode: JavascriptMode.unrestricted, + onWebViewCreated: (WebViewController webViewController) { + _controller.complete(webViewController); + }, + onProgress: (int progress) { + print("WebView is loading (progress : $progress%)"); + }, + javascriptChannels: { + _toasterJavascriptChannel(context), + }, + navigationDelegate: (NavigationRequest request) { + if (request.url.startsWith('https://www.youtube.com/')) { + print('blocking navigation to $request}'); + return NavigationDecision.prevent; + } + print('allowing navigation to $request'); + return NavigationDecision.navigate; + }, + onPageStarted: (String url) { + print('Page started loading: $url'); + }, + onPageFinished: (String url) { + print('Page finished loading: $url'); + }, + gestureNavigationEnabled: true, + ); + }), + floatingActionButton: favoriteButton(), + ); + } + + JavascriptChannel _toasterJavascriptChannel(BuildContext context) { + return JavascriptChannel( + name: 'Toaster', + onMessageReceived: (JavascriptMessage message) { + // ignore: deprecated_member_use + Scaffold.of(context).showSnackBar( + SnackBar(content: Text(message.message)), + ); + }); + } + + Widget favoriteButton() { + return FutureBuilder( + future: _controller.future, + builder: (BuildContext context, + AsyncSnapshot controller) { + if (controller.hasData) { + return FloatingActionButton( + onPressed: () async { + final String url = (await controller.data!.currentUrl())!; + // ignore: deprecated_member_use + Scaffold.of(context).showSnackBar( + SnackBar(content: Text('Favorited $url')), + ); + }, + child: const Icon(Icons.favorite), + ); + } + return Container(); + }); + } +} + +enum MenuOptions { + showUserAgent, + listCookies, + clearCookies, + addToCache, + listCache, + clearCache, + navigationDelegate, +} + +class SampleMenu extends StatelessWidget { + SampleMenu(this.controller); + + final Future controller; + final CookieManager cookieManager = CookieManager(); + + @override + Widget build(BuildContext context) { + return FutureBuilder( + future: controller, + builder: + (BuildContext context, AsyncSnapshot controller) { + return PopupMenuButton( + onSelected: (MenuOptions value) { + switch (value) { + case MenuOptions.showUserAgent: + _onShowUserAgent(controller.data!, context); + break; + case MenuOptions.listCookies: + _onListCookies(controller.data!, context); + break; + case MenuOptions.clearCookies: + _onClearCookies(context); + break; + case MenuOptions.addToCache: + _onAddToCache(controller.data!, context); + break; + case MenuOptions.listCache: + _onListCache(controller.data!, context); + break; + case MenuOptions.clearCache: + _onClearCache(controller.data!, context); + break; + case MenuOptions.navigationDelegate: + _onNavigationDelegateExample(controller.data!, context); + break; + } + }, + itemBuilder: (BuildContext context) => >[ + PopupMenuItem( + value: MenuOptions.showUserAgent, + child: const Text('Show user agent'), + enabled: controller.hasData, + ), + const PopupMenuItem( + value: MenuOptions.listCookies, + child: Text('List cookies'), + ), + const PopupMenuItem( + value: MenuOptions.clearCookies, + child: Text('Clear cookies'), + ), + const PopupMenuItem( + value: MenuOptions.addToCache, + child: Text('Add to cache'), + ), + const PopupMenuItem( + value: MenuOptions.listCache, + child: Text('List cache'), + ), + const PopupMenuItem( + value: MenuOptions.clearCache, + child: Text('Clear cache'), + ), + const PopupMenuItem( + value: MenuOptions.navigationDelegate, + child: Text('Navigation Delegate example'), + ), + ], + ); + }, + ); + } + + void _onShowUserAgent( + WebViewController controller, BuildContext context) async { + // Send a message with the user agent string to the Toaster JavaScript channel we registered + // with the WebView. + await controller.evaluateJavascript( + 'Toaster.postMessage("User Agent: " + navigator.userAgent);'); + } + + void _onListCookies( + WebViewController controller, BuildContext context) async { + final String cookies = + await controller.evaluateJavascript('document.cookie'); + // ignore: deprecated_member_use + Scaffold.of(context).showSnackBar(SnackBar( + content: Column( + mainAxisAlignment: MainAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + const Text('Cookies:'), + _getCookieList(cookies), + ], + ), + )); + } + + void _onAddToCache(WebViewController controller, BuildContext context) async { + await controller.evaluateJavascript( + 'caches.open("test_caches_entry"); localStorage["test_localStorage"] = "dummy_entry";'); + // ignore: deprecated_member_use + Scaffold.of(context).showSnackBar(const SnackBar( + content: Text('Added a test entry to cache.'), + )); + } + + void _onListCache(WebViewController controller, BuildContext context) async { + await controller.evaluateJavascript('caches.keys()' + '.then((cacheKeys) => JSON.stringify({"cacheKeys" : cacheKeys, "localStorage" : localStorage}))' + '.then((caches) => Toaster.postMessage(caches))'); + } + + void _onClearCache(WebViewController controller, BuildContext context) async { + await controller.clearCache(); + // ignore: deprecated_member_use + Scaffold.of(context).showSnackBar(const SnackBar( + content: Text("Cache cleared."), + )); + } + + void _onClearCookies(BuildContext context) async { + final bool hadCookies = await cookieManager.clearCookies(); + String message = 'There were cookies. Now, they are gone!'; + if (!hadCookies) { + message = 'There are no cookies.'; + } + // ignore: deprecated_member_use + Scaffold.of(context).showSnackBar(SnackBar( + content: Text(message), + )); + } + + void _onNavigationDelegateExample( + WebViewController controller, BuildContext context) async { + final String contentBase64 = + base64Encode(const Utf8Encoder().convert(kNavigationExamplePage)); + await controller.loadUrl('data:text/html;base64,$contentBase64'); + } + + Widget _getCookieList(String cookies) { + if (cookies == null || cookies == '""') { + return Container(); + } + final List cookieList = cookies.split(';'); + final Iterable cookieWidgets = + cookieList.map((String cookie) => Text(cookie)); + return Column( + mainAxisAlignment: MainAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: cookieWidgets.toList(), + ); + } +} + +class NavigationControls extends StatelessWidget { + const NavigationControls(this._webViewControllerFuture) + : assert(_webViewControllerFuture != null); + + final Future _webViewControllerFuture; + + @override + Widget build(BuildContext context) { + return FutureBuilder( + future: _webViewControllerFuture, + builder: + (BuildContext context, AsyncSnapshot snapshot) { + final bool webViewReady = + snapshot.connectionState == ConnectionState.done; + final WebViewController controller = snapshot.data!; + return Row( + children: [ + IconButton( + icon: const Icon(Icons.arrow_back_ios), + onPressed: !webViewReady + ? null + : () async { + if (await controller.canGoBack()) { + await controller.goBack(); + } else { + // ignore: deprecated_member_use + Scaffold.of(context).showSnackBar( + const SnackBar(content: Text("No back history item")), + ); + return; + } + }, + ), + IconButton( + icon: const Icon(Icons.arrow_forward_ios), + onPressed: !webViewReady + ? null + : () async { + if (await controller.canGoForward()) { + await controller.goForward(); + } else { + // ignore: deprecated_member_use + Scaffold.of(context).showSnackBar( + const SnackBar( + content: Text("No forward history item")), + ); + return; + } + }, + ), + IconButton( + icon: const Icon(Icons.replay), + onPressed: !webViewReady + ? null + : () { + controller.reload(); + }, + ), + ], + ); + }, + ); + } +} diff --git a/packages/webview_flutter_ewk/example/pubspec.yaml b/packages/webview_flutter_ewk/example/pubspec.yaml new file mode 100644 index 000000000..928d9cb9c --- /dev/null +++ b/packages/webview_flutter_ewk/example/pubspec.yaml @@ -0,0 +1,23 @@ +name: webview_flutter_tizen_ewk_example +description: Demonstrates how to use the webview_flutter_tizen_ewk plugin. + +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=2.0.0" + +dependencies: + flutter: + sdk: flutter + webview_flutter: ^2.0.4 + webview_flutter_tizen_ewk: + path: ../ + +dev_dependencies: + flutter_driver: + sdk: flutter + integration_test: ^1.0.1 + integration_test_tizen: + path: ../../integration_test/ + +flutter: + uses-material-design: true diff --git a/packages/webview_flutter_ewk/example/test_driver/integration_test.dart b/packages/webview_flutter_ewk/example/test_driver/integration_test.dart new file mode 100644 index 000000000..e17afb0de --- /dev/null +++ b/packages/webview_flutter_ewk/example/test_driver/integration_test.dart @@ -0,0 +1,5 @@ +// @dart = 2.9 + +import 'package:integration_test/integration_test_driver.dart'; + +Future main() => integrationDriver(); diff --git a/packages/webview_flutter_ewk/example/tizen/.gitignore b/packages/webview_flutter_ewk/example/tizen/.gitignore new file mode 100644 index 000000000..750f3af1b --- /dev/null +++ b/packages/webview_flutter_ewk/example/tizen/.gitignore @@ -0,0 +1,5 @@ +flutter/ +.vs/ +*.user +bin/ +obj/ diff --git a/packages/webview_flutter_ewk/example/tizen/App.cs b/packages/webview_flutter_ewk/example/tizen/App.cs new file mode 100644 index 000000000..6dd4a6356 --- /dev/null +++ b/packages/webview_flutter_ewk/example/tizen/App.cs @@ -0,0 +1,20 @@ +using Tizen.Flutter.Embedding; + +namespace Runner +{ + public class App : FlutterApplication + { + protected override void OnCreate() + { + base.OnCreate(); + + GeneratedPluginRegistrant.RegisterPlugins(this); + } + + static void Main(string[] args) + { + var app = new App(); + app.Run(args); + } + } +} diff --git a/packages/webview_flutter_ewk/example/tizen/Runner.csproj b/packages/webview_flutter_ewk/example/tizen/Runner.csproj new file mode 100644 index 000000000..f8346a628 --- /dev/null +++ b/packages/webview_flutter_ewk/example/tizen/Runner.csproj @@ -0,0 +1,26 @@ + + + + Exe + tizen40 + + + + portable + + + none + + + + + + + + + + %(RecursiveDir) + + + + diff --git a/packages/webview_flutter_ewk/example/tizen/shared/res/ic_launcher.png b/packages/webview_flutter_ewk/example/tizen/shared/res/ic_launcher.png new file mode 100644 index 000000000..4d6372eeb Binary files /dev/null and b/packages/webview_flutter_ewk/example/tizen/shared/res/ic_launcher.png differ diff --git a/packages/webview_flutter_ewk/example/tizen/tizen-manifest.xml b/packages/webview_flutter_ewk/example/tizen/tizen-manifest.xml new file mode 100644 index 000000000..77b1dbabd --- /dev/null +++ b/packages/webview_flutter_ewk/example/tizen/tizen-manifest.xml @@ -0,0 +1,13 @@ + + + + + + ic_launcher.png + + + + http://tizen.org/privilege/internet + + + diff --git a/packages/webview_flutter_ewk/lib/webview_flutter_tizen_ewk.dart b/packages/webview_flutter_ewk/lib/webview_flutter_tizen_ewk.dart new file mode 100644 index 000000000..988502e86 --- /dev/null +++ b/packages/webview_flutter_ewk/lib/webview_flutter_tizen_ewk.dart @@ -0,0 +1,871 @@ +// Copyright 2021 Samsung Electronics Co., Ltd. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:async'; +import 'dart:typed_data'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter/semantics.dart'; +import 'package:flutter/rendering.dart'; + +import 'package:webview_flutter/webview_flutter.dart'; +import 'package:webview_flutter/platform_interface.dart'; +import 'package:webview_flutter/src/webview_method_channel.dart'; + +enum _TizenViewState { + waitingForSize, + creating, + created, + disposed, +} + +enum PlatformViewHitTestBehavior { + opaque, + translucent, + transparent, +} + +enum _PlatformViewState { + uninitialized, + resizing, + ready, +} + +class TizenViewController extends PlatformViewController { + TizenViewController._({ + required this.viewId, + required String viewType, + required TextDirection layoutDirection, + dynamic creationParams, + MessageCodec? creationParamsCodec, + bool waitingForSize = true, + }) : assert(viewId != null), + assert(viewType != null), + assert(layoutDirection != null), + assert(creationParams == null || creationParamsCodec != null), + _viewType = viewType, + _layoutDirection = layoutDirection, + _creationParams = creationParams, + _creationParamsCodec = creationParamsCodec, + _state = waitingForSize + ? _TizenViewState.waitingForSize + : _TizenViewState.creating; + + @override + final int viewId; + + final String _viewType; + + TextDirection _layoutDirection; + + _TizenViewState _state; + + final dynamic _creationParams; + + final MessageCodec? _creationParamsCodec; + + final List _platformViewCreatedCallbacks = + []; + + static int pointerAction(int pointerId, int action) { + return ((pointerId << 8) & 0xff00) | (action & 0xff); + } + + int? _textureId; + + int? get textureId => _textureId; + + late Size _size; + + Future setSize(Size size) async { + assert(_state != _TizenViewState.disposed, + 'trying to size a disposed Tizen View. View id: $viewId'); + + assert(size != null); + assert(!size.isEmpty); + + if (_state == _TizenViewState.waitingForSize) { + _size = size; + return create(); + } + await SystemChannels.platform_views + .invokeMethod('resize', { + 'id': viewId, + 'width': size.width, + 'height': size.height, + }); + } + + Future _sendCreateMessage() async { + assert(!_size.isEmpty, + 'trying to create $TizenViewController without setting a valid size.'); + + final Map args = { + 'id': viewId, + 'viewType': _viewType, + 'width': _size.width, + 'height': _size.height, + 'direction': _layoutDirection == TextDirection.ltr ? 0 : 1, + }; + if (_creationParams != null) { + final ByteData paramsByteData = + _creationParamsCodec!.encodeMessage(_creationParams)!; + args['params'] = Uint8List.view( + paramsByteData.buffer, + 0, + paramsByteData.lengthInBytes, + ); + } + _textureId = + await SystemChannels.platform_views.invokeMethod('create', args); + } + + Future _sendDisposeMessage() { + return SystemChannels.platform_views + .invokeMethod('dispose', { + 'id': viewId, + 'hybrid': false, + }); + } + + Future create() async { + assert(_state != _TizenViewState.disposed, + 'trying to create a disposed Tizen view'); + await _sendCreateMessage(); + + _state = _TizenViewState.created; + for (final PlatformViewCreatedCallback callback + in _platformViewCreatedCallbacks) { + callback(viewId); + } + } + + @Deprecated('Call `controller.viewId` instead. ' + 'This feature was deprecated after v1.20.0-2.0.pre.') + int get id => viewId; + + set pointTransformer(PointTransformer transformer) { + assert(transformer != null); + } + + bool get isCreated => _state == _TizenViewState.created; + + void addOnPlatformViewCreatedListener(PlatformViewCreatedCallback listener) { + assert(listener != null); + assert(_state != _TizenViewState.disposed); + _platformViewCreatedCallbacks.add(listener); + } + + /// Removes a callback added with [addOnPlatformViewCreatedListener]. + void removeOnPlatformViewCreatedListener( + PlatformViewCreatedCallback listener) { + assert(_state != _TizenViewState.disposed); + _platformViewCreatedCallbacks.remove(listener); + } + + Future setLayoutDirection(TextDirection layoutDirection) async { + assert(_state != _TizenViewState.disposed, + 'trying to set a layout direction for a disposed UIView. View id: $viewId'); + + if (layoutDirection == _layoutDirection) { + return; + } + + assert(layoutDirection != null); + _layoutDirection = layoutDirection; + + if (_state == _TizenViewState.waitingForSize) { + return; + } + + await SystemChannels.platform_views + .invokeMethod('setDirection', { + 'id': viewId, + 'direction': layoutDirection == TextDirection.ltr ? 0 : 1, + }); + } + + @override + Future dispatchPointerEvent(PointerEvent event) async { + if (event is PointerHoverEvent) { + return; + } + + int eventType = 0; + if (event is PointerDownEvent) { + eventType = 0; + } else if (event is PointerMoveEvent) { + eventType = 1; + } else if (event is PointerUpEvent) { + eventType = 2; + } else { + throw UnimplementedError('Not Implemented'); + } + await SystemChannels.platform_views + .invokeMethod('touch', { + 'id': viewId, + 'event': [ + eventType, // int, pointer event type + event.buttons, // int, mouse button type (left, right, middle) + event.localPosition.dx, // double, global position x + event.localPosition.dy, // double, global position y + event.localDelta.dx, // double, moved position x + event.localDelta.dy, // double, moved position y + ] + }); + } + + @override + Future clearFocus() { + if (_state != _TizenViewState.created) { + return Future.value(); + } + print('TizenViewController::clearFocus() : $viewId'); + return SystemChannels.platform_views + .invokeMethod('clearFocus', viewId); + } + + @override + Future dispose() async { + print('TizenViewController::dispose()'); + if (_state == _TizenViewState.creating || _state == _TizenViewState.created) + await _sendDisposeMessage(); + _platformViewCreatedCallbacks.clear(); + _state = _TizenViewState.disposed; + PlatformViewsServiceTizen._instance._focusCallbacks.remove(viewId); + } +} + +class TizenView extends StatefulWidget { + const TizenView({ + Key? key, + required this.viewType, + this.onPlatformViewCreated, + this.hitTestBehavior = PlatformViewHitTestBehavior.opaque, + this.layoutDirection, + this.gestureRecognizers, + this.creationParams, + this.creationParamsCodec, + }) : assert(viewType != null), + assert(hitTestBehavior != null), + assert(creationParams == null || creationParamsCodec != null), + super(key: key); + + final String viewType; + final PlatformViewCreatedCallback? onPlatformViewCreated; + final PlatformViewHitTestBehavior hitTestBehavior; + final TextDirection? layoutDirection; + final Set>? gestureRecognizers; + final dynamic creationParams; + final MessageCodec? creationParamsCodec; + + @override + State createState() => _TizenWebViewState(); +} + +class PlatformViewsServiceTizen { + PlatformViewsServiceTizen._() { + SystemChannels.platform_views.setMethodCallHandler(_onMethodCall); + } + static final PlatformViewsServiceTizen _instance = + PlatformViewsServiceTizen._(); + + Future _onMethodCall(MethodCall call) { + print('TizenView::_onMethodCall() - ${call.method}'); + switch (call.method) { + case 'viewFocused': + final int id = call.arguments as int; + print('viewFocused: id - $id'); + if (_focusCallbacks.containsKey(id)) { + _focusCallbacks[id]!(); + } + break; + default: + throw UnimplementedError( + "${call.method} was invoked but isn't implemented by PlatformViewsService"); + } + return Future.value(); + } + + final Map _focusCallbacks = {}; + + static TizenViewController initTizenView({ + required int id, + required String viewType, + required TextDirection layoutDirection, + dynamic creationParams, + MessageCodec? creationParamsCodec, + VoidCallback? onFocus, + }) { + assert(id != null); + assert(viewType != null); + assert(layoutDirection != null); + assert(creationParams == null || creationParamsCodec != null); + + print( + 'PlatformViewsServiceTizen::initTizenView [id:$id] [onFocus:$onFocus]'); + + final TizenViewController controller = TizenViewController._( + viewId: id, + viewType: viewType, + layoutDirection: layoutDirection, + creationParams: creationParams, + creationParamsCodec: creationParamsCodec, + ); + + _instance._focusCallbacks[id] = onFocus ?? () {}; + return controller; + } +} + +typedef _HandlePointerEvent = Future Function(PointerEvent event); + +// This recognizer constructs gesture recognizers from a set of gesture recognizer factories +// it was give, adds all of them to a gesture arena team with the _PlatformViewGestureRecognizer +// as the team captain. +// As long as the gesture arena is unresolved, the recognizer caches all pointer events. +// When the team wins, the recognizer sends all the cached pointer events to `_handlePointerEvent`, and +// sets itself to a "forwarding mode" where it will forward any new pointer event to `_handlePointerEvent`. +class _PlatformViewGestureRecognizer extends OneSequenceGestureRecognizer { + _PlatformViewGestureRecognizer( + _HandlePointerEvent handlePointerEvent, + this.gestureRecognizerFactories, { + PointerDeviceKind? kind, + }) : super(kind: kind) { + team = GestureArenaTeam()..captain = this; + _gestureRecognizers = gestureRecognizerFactories.map( + (Factory recognizerFactory) { + final OneSequenceGestureRecognizer gestureRecognizer = + recognizerFactory.constructor(); + gestureRecognizer.team = team; + // The below gesture recognizers requires at least one non-empty callback to + // compete in the gesture arena. + // https://github.com/flutter/flutter/issues/35394#issuecomment-562285087 + if (gestureRecognizer is LongPressGestureRecognizer) { + gestureRecognizer.onLongPress ??= () {}; + } else if (gestureRecognizer is DragGestureRecognizer) { + gestureRecognizer.onDown ??= (_) {}; + } else if (gestureRecognizer is TapGestureRecognizer) { + gestureRecognizer.onTapDown ??= (_) {}; + } + return gestureRecognizer; + }, + ).toSet(); + _handlePointerEvent = handlePointerEvent; + } + + late _HandlePointerEvent _handlePointerEvent; + + // Maps a pointer to a list of its cached pointer events. + // Before the arena for a pointer is resolved all events are cached here, if we win the arena + // the cached events are dispatched to `_handlePointerEvent`, if we lose the arena we clear the cache for + // the pointer. + final Map> cachedEvents = >{}; + + // Pointer for which we have already won the arena, events for pointers in this set are + // immediately dispatched to `_handlePointerEvent`. + final Set forwardedPointers = {}; + + // We use OneSequenceGestureRecognizers as they support gesture arena teams. + // TODO(amirh): get a list of GestureRecognizers here. + // https://github.com/flutter/flutter/issues/20953 + final Set> gestureRecognizerFactories; + late Set _gestureRecognizers; + + @override + void addAllowedPointer(PointerDownEvent event) { + startTrackingPointer(event.pointer, event.transform); + for (final OneSequenceGestureRecognizer recognizer in _gestureRecognizers) { + recognizer.addPointer(event); + } + } + + @override + String get debugDescription => 'Platform view'; + + @override + void didStopTrackingLastPointer(int pointer) {} + + @override + void handleEvent(PointerEvent event) { + if (!forwardedPointers.contains(event.pointer)) { + _cacheEvent(event); + } else { + _handlePointerEvent(event); + } + stopTrackingIfPointerNoLongerDown(event); + } + + @override + void acceptGesture(int pointer) { + _flushPointerCache(pointer); + forwardedPointers.add(pointer); + } + + @override + void rejectGesture(int pointer) { + stopTrackingPointer(pointer); + cachedEvents.remove(pointer); + } + + void _cacheEvent(PointerEvent event) { + if (!cachedEvents.containsKey(event.pointer)) { + cachedEvents[event.pointer] = []; + } + cachedEvents[event.pointer]!.add(event); + } + + void _flushPointerCache(int pointer) { + cachedEvents.remove(pointer)?.forEach(_handlePointerEvent); + } + + @override + void stopTrackingPointer(int pointer) { + super.stopTrackingPointer(pointer); + forwardedPointers.remove(pointer); + } + + void reset() { + forwardedPointers.forEach(super.stopTrackingPointer); + forwardedPointers.clear(); + cachedEvents.keys.forEach(super.stopTrackingPointer); + cachedEvents.clear(); + resolve(GestureDisposition.rejected); + } +} + +class RenderTizenView extends RenderBox with _PlatformViewGestureMixin { + /// Creates a render object for an Tizen view. + RenderTizenView({ + required TizenViewController viewController, + required PlatformViewHitTestBehavior hitTestBehavior, + required Set> gestureRecognizers, + Clip clipBehavior = Clip.hardEdge, + }) : assert(viewController != null), + assert(hitTestBehavior != null), + assert(gestureRecognizers != null), + _viewController = viewController, + _clipBehavior = clipBehavior { + _viewController.pointTransformer = (Offset offset) => globalToLocal(offset); + updateGestureRecognizers(gestureRecognizers); + _viewController.addOnPlatformViewCreatedListener(_onPlatformViewCreated); + this.hitTestBehavior = hitTestBehavior; + } + + _PlatformViewState _state = _PlatformViewState.uninitialized; + + TizenViewController get viewcontroller => _viewController; + TizenViewController _viewController; + + set viewController(TizenViewController viewController) { + assert(_viewController != null); + assert(viewController != null); + if (_viewController == viewController) { + return; + } + _viewController.removeOnPlatformViewCreatedListener(_onPlatformViewCreated); + _viewController = viewController; + _sizePlatformView(); + if (_viewController.isCreated) { + markNeedsSemanticsUpdate(); + } + _viewController.addOnPlatformViewCreatedListener(_onPlatformViewCreated); + } + + Clip get clipBehavior => _clipBehavior; + Clip _clipBehavior = Clip.hardEdge; + set clipBehavior(Clip value) { + assert(value != null); + if (value != _clipBehavior) { + _clipBehavior = value; + markNeedsPaint(); + markNeedsSemanticsUpdate(); + } + } + + void _onPlatformViewCreated(int id) { + markNeedsSemanticsUpdate(); + } + + void updateGestureRecognizers( + Set> gestureRecognizers) { + _updateGestureRecognizersWithCallBack( + gestureRecognizers, _viewController.dispatchPointerEvent); + } + + @override + bool get sizedByParent => true; + + @override + bool get alwaysNeedsCompositing => true; + + @override + bool get isRepaintBoundary => true; + + @override + void performResize() { + size = constraints.biggest; + _sizePlatformView(); + } + + late Size _currentTizenViewSize; + + Future _sizePlatformView() async { + if (_state == _PlatformViewState.resizing || size.isEmpty) { + return; + } + _state = _PlatformViewState.resizing; + markNeedsPaint(); + + Size targetSize; + do { + targetSize = size; + await _viewController.setSize(targetSize); + _currentTizenViewSize = targetSize; + } while (size != targetSize); + + _state = _PlatformViewState.ready; + markNeedsPaint(); + } + + @override + void paint(PaintingContext context, Offset offset) { + if (_viewController.textureId == null) { + return; + } + if ((size.width < _currentTizenViewSize.width || + size.height < _currentTizenViewSize.height) && + clipBehavior != Clip.none) { + _clipRectLayer = context.pushClipRect( + true, offset, offset & size, _paintTexture, + clipBehavior: clipBehavior, oldLayer: _clipRectLayer); + return; + } + _clipRectLayer = null; + _paintTexture(context, offset); + } + + ClipRectLayer? _clipRectLayer; + + void _paintTexture(PaintingContext context, Offset offset) { + context.addLayer(TextureLayer( + rect: offset & _currentTizenViewSize, + textureId: _viewController.textureId!, + freeze: _state == _PlatformViewState.resizing, + )); + } + + @override + void describeSemanticsConfiguration(SemanticsConfiguration config) { + super.describeSemanticsConfiguration(config); + + config.isSemanticBoundary = true; + + if (_viewController.isCreated) { + config.platformViewId = _viewController.viewId; + } + } +} + +class _TizenPlatformTextureView extends LeafRenderObjectWidget { + const _TizenPlatformTextureView({ + Key? key, + required this.controller, + required this.hitTestBehavior, + required this.gestureRecognizers, + this.clipBehavior = Clip.hardEdge, + }) : assert(controller != null), + assert(hitTestBehavior != null), + assert(gestureRecognizers != null), + super(key: key); + + final TizenViewController controller; + final PlatformViewHitTestBehavior hitTestBehavior; + final Set> gestureRecognizers; + final Clip clipBehavior; + + @override + RenderObject createRenderObject(BuildContext context) => RenderTizenView( + viewController: controller, + hitTestBehavior: hitTestBehavior, + gestureRecognizers: gestureRecognizers, + clipBehavior: clipBehavior, + ); + + @override + void updateRenderObject(BuildContext context, RenderTizenView renderObject) { + renderObject.viewController = controller; + renderObject.hitTestBehavior = hitTestBehavior; + renderObject.updateGestureRecognizers(gestureRecognizers); + } +} + +class _TizenWebViewState extends State { + int? _id; + late TizenViewController _controller; + TextDirection? _layoutDirection; + bool _initialized = false; + FocusNode? _focusNode; + + static final Set> _emptyRecognizersSet = + >{}; + + @override + Widget build(BuildContext context) { + return Focus( + focusNode: _focusNode, + onFocusChange: _onFocusChange, + child: _TizenPlatformTextureView( + controller: _controller, + hitTestBehavior: widget.hitTestBehavior, + gestureRecognizers: + widget.gestureRecognizers ?? _emptyRecognizersSet), + ); + } + + void _initializeOnce() { + if (_initialized) { + return; + } + _initialized = true; + _createNewTizenWebView(); + _focusNode = FocusNode(debugLabel: 'TizenWebView(id: $_id)'); + } + + @override + void didChangeDependencies() { + print('_TizenWebViewState::didChangeDependencies()'); + super.didChangeDependencies(); + final TextDirection newLayoutDirection = _findLayoutDirection(); + final bool didChangeLayoutDirection = + _layoutDirection != newLayoutDirection; + _layoutDirection = newLayoutDirection; + + _initializeOnce(); + if (didChangeLayoutDirection) { + _controller.setLayoutDirection(_layoutDirection!); + } + } + + @override + void didUpdateWidget(TizenView oldWidget) { + print('_TizenWebViewState::didUpdateWidget()'); + super.didUpdateWidget(oldWidget); + + final TextDirection newLayoutDirection = _findLayoutDirection(); + final bool didChangeLayoutDirection = + _layoutDirection != newLayoutDirection; + _layoutDirection = newLayoutDirection; + + if (widget.viewType != oldWidget.viewType) { + _controller.dispose(); + _createNewTizenWebView(); + return; + } + + if (didChangeLayoutDirection) { + _controller.setLayoutDirection(_layoutDirection!); + } + } + + TextDirection _findLayoutDirection() { + assert( + widget.layoutDirection != null || debugCheckHasDirectionality(context)); + return widget.layoutDirection ?? Directionality.of(context); + } + + @override + void dispose() { + print('_TizenWebViewState::dispose()'); + _controller.dispose(); + super.dispose(); + } + + void _createNewTizenWebView() { + _id = platformViewsRegistry.getNextPlatformViewId(); + _controller = PlatformViewsServiceTizen.initTizenView( + id: _id!, + viewType: widget.viewType, + layoutDirection: _layoutDirection!, + creationParams: widget.creationParams, + creationParamsCodec: widget.creationParamsCodec, + onFocus: () { + print('_TizenWebViewState::_createNewTizenWebView() - onFocus()'); + _focusNode!.requestFocus(); + }, + ); + if (widget.onPlatformViewCreated != null) { + _controller + .addOnPlatformViewCreatedListener(widget.onPlatformViewCreated!); + } + } + + void _onFocusChange(bool isFocused) { + print('_TizenWebViewState::_onFocusChange(isFocused:$isFocused)'); + if (!_controller.isCreated) { + return; + } + + if (!isFocused) { + _controller.clearFocus().catchError((dynamic e) { + if (e is MissingPluginException) { + return; + } + }); + return; + } + SystemChannels.textInput + .invokeMethod( + 'TextInput.setPlatformViewClient', + _id, + ) + .catchError((dynamic e) { + if (e is MissingPluginException) { + return; + } + }); + } +} + +class TizenWebView implements WebViewPlatform { + static void register() { + WebView.platform = TizenWebView(); + } + + @override + Widget build({ + required BuildContext context, + required CreationParams creationParams, + WebViewPlatformCreatedCallback? onWebViewPlatformCreated, + Set>? gestureRecognizers, + required WebViewPlatformCallbacksHandler webViewPlatformCallbacksHandler, + }) { + assert(webViewPlatformCallbacksHandler != null); + return GestureDetector( + onLongPress: () {}, + excludeFromSemantics: true, + child: TizenView( + viewType: 'plugins.flutter.io/webview', + onPlatformViewCreated: (int id) { + if (onWebViewPlatformCreated == null) { + return; + } + onWebViewPlatformCreated(MethodChannelWebViewPlatform( + id, webViewPlatformCallbacksHandler)); + }, + gestureRecognizers: gestureRecognizers, + layoutDirection: TextDirection.rtl, + creationParams: + MethodChannelWebViewPlatform.creationParamsToMap(creationParams), + creationParamsCodec: const StandardMessageCodec(), + ), + ); + } + + @override + Future clearCookies() => MethodChannelWebViewPlatform.clearCookies(); +} + +bool _factoryTypesSetEquals(Set>? a, Set>? b) { + if (a == b) { + return true; + } + if (a == null || b == null) { + return false; + } + return setEquals(_factoriesTypeSet(a), _factoriesTypeSet(b)); +} + +Set _factoriesTypeSet(Set> factories) { + return factories.map((Factory factory) => factory.type).toSet(); +} + +/// The Mixin handling the pointer events and gestures of a platform view render box. +mixin _PlatformViewGestureMixin on RenderBox implements MouseTrackerAnnotation { + /// How to behave during hit testing. + // Changing _hitTestBehavior might affect which objects are considered hovered over. + set hitTestBehavior(PlatformViewHitTestBehavior value) { + if (value != _hitTestBehavior) { + _hitTestBehavior = value; + if (owner != null) { + markNeedsPaint(); + } + } + } + + PlatformViewHitTestBehavior? _hitTestBehavior; + + _HandlePointerEvent? _handlePointerEvent; + + /// {@macro flutter.rendering.platformView.updateGestureRecognizers} + /// + /// Any active gesture arena the `PlatformView` participates in is rejected when the + /// set of gesture recognizers is changed. + void _updateGestureRecognizersWithCallBack( + Set> gestureRecognizers, + _HandlePointerEvent handlePointerEvent) { + assert(gestureRecognizers != null); + assert( + _factoriesTypeSet(gestureRecognizers).length == gestureRecognizers.length, + 'There were multiple gesture recognizer factories for the same type, there must only be a single ' + 'gesture recognizer factory for each gesture recognizer type.', + ); + if (_factoryTypesSetEquals( + gestureRecognizers, _gestureRecognizer?.gestureRecognizerFactories)) { + return; + } + _gestureRecognizer?.dispose(); + _gestureRecognizer = + _PlatformViewGestureRecognizer(handlePointerEvent, gestureRecognizers); + _handlePointerEvent = handlePointerEvent; + } + + _PlatformViewGestureRecognizer? _gestureRecognizer; + + @override + bool hitTest(BoxHitTestResult result, {required Offset position}) { + if (_hitTestBehavior == PlatformViewHitTestBehavior.transparent || + !size.contains(position)) { + return false; + } + result.add(BoxHitTestEntry(this, position)); + return _hitTestBehavior == PlatformViewHitTestBehavior.opaque; + } + + @override + bool hitTestSelf(Offset position) => + _hitTestBehavior != PlatformViewHitTestBehavior.transparent; + + @override + PointerEnterEventListener? get onEnter => null; + + @override + PointerExitEventListener? get onExit => null; + + @override + MouseCursor get cursor => MouseCursor.uncontrolled; + + @override + bool get validForMouseTracker => true; + + @override + void handleEvent(PointerEvent event, HitTestEntry entry) { + if (event is PointerDownEvent) { + _gestureRecognizer!.addPointer(event); + } + if (event is PointerHoverEvent) { + _handlePointerEvent?.call(event); + } + } + + @override + void detach() { + _gestureRecognizer!.reset(); + super.detach(); + } +} diff --git a/packages/webview_flutter_ewk/pubspec.yaml b/packages/webview_flutter_ewk/pubspec.yaml new file mode 100644 index 000000000..5c2d059bd --- /dev/null +++ b/packages/webview_flutter_ewk/pubspec.yaml @@ -0,0 +1,25 @@ +name: webview_flutter_tizen_ewk +description: Tizen implementation of the webview plugin +homepage: https://github.com/flutter-tizen/plugins +version: 0.1.0 + +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=2.0.0" + +dependencies: + flutter: + sdk: flutter + webview_flutter: ^2.0.4 + +dev_dependencies: + flutter_test: + sdk: flutter + +flutter: + plugin: + platforms: + tizen: + pluginClass: WebviewFlutterTizenEwkPlugin + fileName: webview_flutter_tizen_ewk_plugin.h + dartPluginClass: TizenWebView diff --git a/packages/webview_flutter_ewk/tizen/.gitignore b/packages/webview_flutter_ewk/tizen/.gitignore new file mode 100644 index 000000000..a2a7d62b1 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/.gitignore @@ -0,0 +1,5 @@ +.cproject +.sign +crash-info/ +Debug/ +Release/ diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/EWebKit.h b/packages/webview_flutter_ewk/tizen/inc/ewk/EWebKit.h new file mode 100644 index 000000000..44c2eb21b --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/EWebKit.h @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2016 Samsung Electronics. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * @file EWebKit.h + * @brief This file contains the header files that are required by + * Chromium-efl. + * + * It includes all the header files that are exported to public API. + */ + +#ifndef EWebKit_h +#define EWebKit_h + +#include "ewk_autofill_profile.h" +#include "ewk_back_forward_list.h" +#include "ewk_back_forward_list_item.h" +#include "ewk_context.h" +#include "ewk_context_menu.h" +#include "ewk_cookie_manager.h" +#include "ewk_error.h" +#include "ewk_geolocation.h" +#include "ewk_intercept_request.h" +#include "ewk_main.h" +#include "ewk_manifest.h" +#include "ewk_policy_decision.h" +#include "ewk_security_origin.h" +#include "ewk_settings.h" +#include "ewk_view.h" + +/** + * @ingroup CAPI_WEB_FRAMEWORK + * @defgroup WEBVIEW WebView + * @brief The WebView API provides functions to display web pages and control + * web pages. + * + * @section WEBVIEW_HEADER Required Header + * \#include + * + * @section WEBVIEW_OVERVIEW Overview + * The WebView API provides functions to display web pages and control + * web pages. It is based on the Chromium engine, which is one of the most + * popular layout engines to render web pages. + * + * @section WEBVIEW_SMART_OBJECT Smart object + * It is Chromium main smart object. This object provides view related APIs of + * Chromium to EFL object.\n + * The following signals (see evas_object_smart_callback_add()) are emitted: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Signals Type Description
close,window void Window is closed
contextmenu,customize Ewk_Context_Menu* Requested context menu items can be customized by app side
contextmenu,selected Ewk_Context_Menu_Item* A context menu item is selected
create,window Evas_Object** A new window is created
fullscreen,enterfullscreen bool* Reports to enter fullscreen
fullscreen,exitfullscreen void Reports to exit fullscreen
load,committed void Reports load committed
load,error Ewk_Error* Reports load error
load,finished void Reports load finished
load,progress double* Load progress has changed
load,started void Reports load started
geolocation,permission,request Ewk_Geolocation_Permission_Request* Requests geolocation permission
policy,navigation,decide Ewk_Policy_Decision* A navigation policy decision should be taken
policy,newwindow,decide Ewk_Policy_Decision* A new window policy decision should be taken
policy,response,decide Ewk_Policy_Decision* A response policy decision should be taken
text,found unsigned* The requested text was found and it gives the number of matches + *
title,changed const char* Title of the main frame was changed
url,changed const char* Url of the main frame was changed
did,not,allow,script void Javascript did not allowed
+ */ + +#endif // EWebKit_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/EWebKit_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/EWebKit_internal.h new file mode 100644 index 000000000..1d6c082b5 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/EWebKit_internal.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file EWebKit_internal.h + * @brief Contains the header files that are required by Chromium-EFL. + * + * It includes the all header files that are exported to internal API. + */ + +#ifndef EWebKit_internal_h +#define EWebKit_internal_h + +#include "ewk_application_cache_manager_internal.h" +#include "ewk_auth_challenge_internal.h" +#include "ewk_auth_request_internal.h" +#include "ewk_autofill_credit_card_internal.h" +#include "ewk_certificate_internal.h" +#include "ewk_console_message_internal.h" +#include "ewk_content_screening_detection_internal.h" +#include "ewk_context_internal.h" +#include "ewk_context_menu_internal.h" +#include "ewk_cookie_manager_internal.h" +#include "ewk_custom_handlers_internal.h" +#include "ewk_dispatcher_internal.h" +#include "ewk_enums_internal.h" +#include "ewk_error_internal.h" +#include "ewk_favicon_database_internal.h" +#include "ewk_frame_internal.h" +#include "ewk_geolocation_internal.h" +#include "ewk_history_internal.h" +#include "ewk_hit_test_internal.h" +#include "ewk_intercept_request_internal.h" +#include "ewk_ipc_message_internal.h" +#include "ewk_log_internal.h" +#include "ewk_main_internal.h" +#include "ewk_manifest_internal.h" +#include "ewk_notification_internal.h" +#include "ewk_object_internal.h" +#include "ewk_page_group_internal.h" +#include "ewk_policy_decision_internal.h" +#include "ewk_popup_menu_item_internal.h" +#include "ewk_quota_permission_request_internal.h" +#include "ewk_security_origin_internal.h" +#include "ewk_settings_internal.h" +#include "ewk_storage_manager_internal.h" +#include "ewk_text_style_internal.h" +#include "ewk_touch_internal.h" +#include "ewk_tracing_internal.h" +#include "ewk_user_media_internal.h" +#include "ewk_view_internal.h" +#include "ewk_web_application_icon_data_internal.h" +#include "ewk_window_features_internal.h" + +#endif // EWebKit_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/EWebKit_product.h b/packages/webview_flutter_ewk/tizen/inc/ewk/EWebKit_product.h new file mode 100644 index 000000000..cf4cc38c6 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/EWebKit_product.h @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file EWebKit_product.h + * @brief Contains the header files that are required by Chromium-EFL. + * + * It includes the all header files that are exported to product API. + */ + +#ifndef EWebKit_product_h +#define EWebKit_product_h + +#include "ewk_autofill_profile_product.h" +#include "ewk_context_menu_product.h" +#include "ewk_context_product.h" +#include "ewk_cookie_manager_product.h" +#include "ewk_file_chooser_request_product.h" +#include "ewk_form_repost_decision_product.h" +#include "ewk_highcontrast_product.h" +#include "ewk_media_downloadable_font_info_product.h" +#include "ewk_media_parental_rating_info_product.h" +#include "ewk_media_playback_info_product.h" +#include "ewk_media_subtitle_info_product.h" +#include "ewk_settings_product.h" +#include "ewk_value_product.h" +#include "ewk_view_product.h" + +/** + * @ingroup CAPI_WEB_FRAMEWORK + * @brief The WebView API product specific functions. + * + * @section WEBVIEW_HEADER Required Header + * \#include + * + * @section WEBVIEW_OVERVIEW Overview + * Product specific API + * + * @section WEBVIEW_SMART_OBJECT Smart object + * The following signals (see evas_object_smart_callback_add()) are emitted: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Signals Type Description
link,hover,over char* Mouse cursor hovers over a link
link,hover,out char* Mouse cursor is moved away from a link
+ */ + +#endif // EWebKit_product_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_app_installation_request_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_app_installation_request_internal.h new file mode 100644 index 000000000..97b72306d --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_app_installation_request_internal.h @@ -0,0 +1,78 @@ +// Copyright 2017 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_app_installation_request_internal_h +#define ewk_app_installation_request_internal_h + +#include "ewk_manifest.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Struct for app installation request. + * + * @since_tizen 4.0 + */ +typedef struct _Ewk_App_Installation_Request Ewk_App_Installation_Request; + +/** + * @brief Gets origin from which app installation request was called + * + * @since_tizen 4.0 + * + * @param[in] request app installation request + * + * @return @c origin string. The string is only valid until related + * Ewk_App_Installation_Request object is valid. + */ +EXPORT_API const char* ewk_app_installation_request_origin_get( + Ewk_App_Installation_Request* request); + +/** + * @brief Gets app url provided along with app installation request + * + * @since_tizen 4.0 + * + * @param[in] request app installation request + * + * @return @c app url string. The string is only valid until related + * Ewk_App_Installation_Request object is valid. + */ +EXPORT_API const char* ewk_app_installation_request_app_url_get( + Ewk_App_Installation_Request* request); + +/** + * @brief Gets manifest obtained from url provided along with app installation + * request + * + * @since_tizen 4.0 + * + * @param[in] request app installation request + * + * @return @c manifest instance. The object is only valid until related + * Ewk_App_Installation_Request object is valid. + */ +EXPORT_API Ewk_View_Request_Manifest* ewk_app_installation_request_manifest_get( + Ewk_App_Installation_Request* request); + +/** + * @brief Gets service worker url provided along with app installation request + * + * @since_tizen 4.0 + * + * @param[in] request app installation request + * + * @return @c service worker url string. The string is only valid until related; + * Can be nullptr Ewk_App_Installation_Request object is valid. + */ +EXPORT_API const char* ewk_app_installation_request_service_worker_url_get( + Ewk_App_Installation_Request* request); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_app_installation_request_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_application_cache_manager_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_application_cache_manager_internal.h new file mode 100644 index 000000000..afd9d5204 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_application_cache_manager_internal.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2014-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_application_cache_manager_internal.h + * @brief Describes the Ewk Application Cache Manager API. + */ + +#ifndef ewk_application_cache_manager_internal_h +#define ewk_application_cache_manager_internal_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for Ewk_Application_Cache_Manager */ +typedef struct EwkApplicationCacheManager Ewk_Application_Cache_Manager; + +/** + * Deletes all web application caches. + * + * @param manager Ewk_Application_Cache_Manager object + * + * @return @c EINA_TRUE on successful request or @c EINA FALSE on failure + */ +EXPORT_API Eina_Bool +ewk_application_cache_manager_clear(Ewk_Application_Cache_Manager *manager); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_application_cache_manager_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_auth_challenge_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_auth_challenge_internal.h new file mode 100644 index 000000000..6b08377dc --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_auth_challenge_internal.h @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_auth_challenge_internal.h + * @brief Describes the authentication challenge API. + */ + +#ifndef ewk_auth_challenge_internal_h +#define ewk_auth_challenge_internal_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for _Ewk_Auth_Challenge */ +typedef struct _Ewk_Auth_Challenge Ewk_Auth_Challenge; + +/** + * Gets the realm string of authentication challenge received from + * "Ewk_View_Authentication_Callback" function. + * + * @param auth_challenge authentication challenge instance received from + * "Ewk_View_Authentication_Callback" function. + * @return the realm of authentication challenge on success, @c 0 otherwise + * + * @see ewk_view_authentication_callback_set + */ +EXPORT_API const char* ewk_auth_challenge_realm_get( + Ewk_Auth_Challenge* auth_challenge); + +/** + * Gets the url string of authentication challenge received from + * "Ewk_View_Authentication_Callback" function. + * + * @param auth_challenge authentication challenge request instance received from + * "Ewk_View_Authentication_Callback" function. + * @return the url of authentication challenge on success, @c 0 otherwise + * + * @see ewk_view_authentication_callback_set + */ +EXPORT_API const char* ewk_auth_challenge_url_get( + Ewk_Auth_Challenge* auth_challenge); + +/** + * Suspend the operation for authentication challenge. + * + * @param auth_challenge authentication challenge instance received from + * "Ewk_View_Authentication_Callback" function. + * + * @see ewk_view_authentication_callback_set + */ +EXPORT_API void ewk_auth_challenge_suspend(Ewk_Auth_Challenge* auth_challenge); + +/** + * If user select ok, send credential for authentication challenge from user + * input. + * + * @param auth_challenge authentication challenge instance received from + * "Ewk_View_Authentication_Callback" function. + * @param user user id from user input. + * @param password user password from user input. + * + * @see ewk_view_authentication_callback_set + */ +EXPORT_API void ewk_auth_challenge_credential_use( + Ewk_Auth_Challenge* auth_challenge, const char* user, const char* password); + +/** + * If user select cancel, send cancellation notification for authentication + * challenge. + * + * @param auth_challenge authentication challenge instance received from + * "Ewk_View_Authentication_Callback" function. + * + * @see ewk_view_authentication_callback_set + */ +EXPORT_API void ewk_auth_challenge_credential_cancel( + Ewk_Auth_Challenge* auth_challenge); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_auth_challenge_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_auth_request_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_auth_request_internal.h new file mode 100644 index 000000000..c838bcc08 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_auth_request_internal.h @@ -0,0 +1,84 @@ +/* + * copyright (C) 2012 Intel Corporation. All rights reserved. + * Copyright (C) 2014-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_auth_request_internal.h + * @brief Describes the Ewk Authentication Request API. + */ + +#ifndef ewk_auth_request_internal_h +#define ewk_auth_request_internal_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for _Ewk_Auth_Challenge */ +typedef struct _Ewk_Auth_Challenge Ewk_Auth_Request; + +/** + * Set credential for the authentication request. + * + * @param request request object to update + * + * @return @c EINA_TRUE if the credential was successfuly sent, @c EINA_FALSE + * otherwise. + */ +EXPORT_API Eina_Bool ewk_auth_request_authenticate(Ewk_Auth_Request *request, + const char *username, + const char *password); + +/** + * Cancels the authentication request. + * + * @param request request object to cancel + * + * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_auth_request_cancel(Ewk_Auth_Request *request); + +/** + * Queries the authentication realm. + * + * @param request request object to query + * + * @return the realm pointer, that may be @c NULL. This pointer is + * guaranteed to be eina_stringshare, so whenever possible + * save yourself some cpu cycles and use + * eina_stringshare_ref() instead of eina_stringshare_add() or + * strdup() + */ +EXPORT_API const char *ewk_auth_request_realm_get( + const Ewk_Auth_Request *request); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_auth_request_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_autofill_credit_card_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_autofill_credit_card_internal.h new file mode 100644 index 000000000..2d3560e5f --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_autofill_credit_card_internal.h @@ -0,0 +1,192 @@ +/* + * Copyright (C) 2019 Samsung Electronics. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * @file ewk_autofill_credit_card_internal.h + * @brief This file describes the Ewk Autofill CreditCard API. + */ + +#ifndef ewk_autofill_credit_card_internal_h +#define ewk_autofill_credit_card_internal_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + * @{ + */ + +/** + * @if MOBILE + * \enum _Ewk_Autofill_Credit_Card_Data_Type + * @brief Enumeration that provides an option to autofill credit_card data + * types. + * + * @since_tizen 4.0 + * @endif + */ + +enum _Ewk_Autofill_Credit_Card_Data_Type { + EWK_CREDIT_CARD_ID = 0, + EWK_CREDIT_CARD_NAME_FULL, + EWK_CREDIT_CARD_NUMBER, + EWK_CREDIT_CARD_EXP_MONTH, + EWK_CREDIT_CARD_EXP_4_DIGIT_YEAR, + EWK_MAX_CREDIT_CARD +}; + +/** + * @if MOBILE + * @brief Enumeration that creates a type name for the + * Ewk_Autofill_Credit_Card_Data_Type. + * + * @since_tizen 4.0 + * @endif + */ +typedef enum _Ewk_Autofill_Credit_Card_Data_Type + Ewk_Autofill_Credit_Card_Data_Type; + +/** + * @if MOBILE + * @brief The structure type that creates a type name for + * #Ewk_Autofill_CreditCard. + * + * @since_tizen 4.0 + * @endif + */ +typedef struct _Ewk_Autofill_CreditCard Ewk_Autofill_CreditCard; + +/** + * @if MOBILE + * @brief Creates a new credit_card + * + * The created credit_card must be deleted by ewk_autofill_credit_card_delete + * + * @since_tizen 4.0 + * + * @return @c Ewk_Autofill_CreditCard if new credit_card is successfully + created, + @c NULL otherwise + * + * @see ewk_autofill_credit_card_data_set + * @see ewk_autofill_credit_card_delete + * @endif + */ +EXPORT_API Ewk_Autofill_CreditCard* ewk_autofill_credit_card_new(void); + +/** + * @if MOBILE + * @brief Deletes a given credit_card + * + * The API will delete the a particular credit_card only from the memory. + * To remove the credit_card permenantly use + * ewk_context_form_autofill_credit_card_remove + * + * @since_tizen 4.0 + * + * @param[in] credit_card name + * + * @see ewk_autofill_credit_card_new + * @see ewk_context_form_autofill_credit_card_get + * @see ewk_context_form_autofill_credit_card_remove + * @endif + */ +EXPORT_API void ewk_autofill_credit_card_delete(Ewk_Autofill_CreditCard* card); + +/** + * @if MOBILE + * @brief Sets the data in the credit_card created by + * ewk_autofill_credit_card_new + * + * The data set by this function is set locally. To save it to database use + * ewk_context_form_autofill_credit_card_add + * + * @since_tizen 4.0 + * + * @param[in] credit_card contains the credit_card data + * @param[in] type type of attribute to be set + * @param[in] value value of the attribute + * + * @see ewk_autofill_credit_card_data_get + * @see Ewk_Autofill_Credit_Card_Data_Type + * @see ewk_context_form_autofill_credit_card_add + * @endif + */ +EXPORT_API void ewk_autofill_credit_card_data_set( + Ewk_Autofill_CreditCard* card, Ewk_Autofill_Credit_Card_Data_Type type, + const char* value); + +/** + * @if MOBILE + * @brief Gets the id attribute value from a given credit_card + * + * The credit_card obtained from ewk_context_form_autofill_credit_card_get will + * be used to get the credit_cardid + * + * @param[in] credit_card name of credit_card + * + * @since_tizen 4.0 + * + * @return @c Value of attribute (unsigned), @c 0 otherwise + * + * @see ewk_autofill_credit_card_new + * @see ewk_context_form_autofill_credit_card_get + * @see ewk_context_form_autofill_credit_card_get_all + * @endif + */ +EXPORT_API unsigned ewk_autofill_credit_card_id_get( + Ewk_Autofill_CreditCard* card); + +/** + * @if MOBILE + * @brief Gets the attribute value from a given credit_card + * + * The credit_card obtained from ewk_context_form_autofill_credit_card_get will + * be used to get the data + * + * @since_tizen 4.0 + * + * @param[in] credit_card name of credit_card + * @param[in] type name of attribute + * + * @return @c Value of attribute (Eina_Stringshare*), @c NULL otherwise + * The string should be released with eina_stringshare_del() + * + * @see ewk_autofill_credit_card_new + * @see ewk_context_form_autofill_credit_card_get + * @see ewk_context_form_autofill_credit_card_get_all + * @endif + */ +EXPORT_API Eina_Stringshare* ewk_autofill_credit_card_data_get( + Ewk_Autofill_CreditCard* credit_card, + Ewk_Autofill_Credit_Card_Data_Type type); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif // ewk_autofill_credit_card_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_autofill_profile.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_autofill_profile.h new file mode 100644 index 000000000..0537db332 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_autofill_profile.h @@ -0,0 +1,189 @@ +/* + * Copyright (C) 2016 Samsung Electronics. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * @file ewk_autofill_profile.h + * @brief This file describes the Ewk Autofill Profile API. + */ + +#ifndef ewk_autofill_profile_h +#define ewk_autofill_profile_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + * @{ + */ + +/** + * @if MOBILE + * \enum _Ewk_Autofill_Profile_Data_Type + * @brief Enumeration that provides an option to autofill profile data types. + * + * @since_tizen 2.4 + * @endif + */ +enum _Ewk_Autofill_Profile_Data_Type { + EWK_PROFILE_ID = 0, /**< Id */ + EWK_PROFILE_NAME, /**< Name */ + EWK_PROFILE_COMPANY, /**< Company */ + EWK_PROFILE_ADDRESS1, /**< Address1 */ + EWK_PROFILE_ADDRESS2, /**< Address2 */ + EWK_PROFILE_CITY_TOWN, /**< City Town */ + EWK_PROFILE_STATE_PROVINCE_REGION, /**< State Province Region */ + EWK_PROFILE_ZIPCODE, /**< Zipcode */ + EWK_PROFILE_COUNTRY, /**< Country */ + EWK_PROFILE_PHONE, /**< Phone */ + EWK_PROFILE_EMAIL, /**< Email */ + EWK_MAX_AUTOFILL /**< Max Autofill */ +}; + +/** + * @if MOBILE + * @brief Enumeration that creates a type name for the + * Ewk_Autofill_Profile_Data_Type. + * + * @since_tizen 2.4 + * @endif + */ +typedef enum _Ewk_Autofill_Profile_Data_Type Ewk_Autofill_Profile_Data_Type; + +/** + * @if MOBILE + * @brief The structure type that creates a type name for #Ewk_Autofill_Profile. + * + * @since_tizen 2.4 + * @endif + */ +typedef struct _Ewk_Autofill_Profile Ewk_Autofill_Profile; + +/** + * @if MOBILE + * @brief Creates a new profile + * + * The created profile must be deleted by ewk_autofill_profile_delete + * + * @since_tizen 2.4 + * + * @return @c Ewk_Autofill_Profile if new profile is successfully created, + @c NULL otherwise + * + * @see ewk_autofill_profile_data_set + * @see ewk_autofill_profile_delete + * @endif + */ +EXPORT_API Ewk_Autofill_Profile* ewk_autofill_profile_new(void); + +/** + * @if MOBILE + * @brief Deletes a given profile + * + * The API will delete the a particular profile only from the memory. + * To remove the profile permanently use + * ewk_context_form_autofill_profile_remove + * + * @since_tizen 2.4 + * + * @param[in] profile name + * + * @see ewk_autofill_profile_new + * @see ewk_context_form_autofill_profile_get + * @see ewk_context_form_autofill_profile_remove + * @endif + */ +EXPORT_API void ewk_autofill_profile_delete(Ewk_Autofill_Profile* profile); + +/** + * @if MOBILE + * @brief Sets the data in the profile created by ewk_autofill_profile_new + * + * The data set by this function is set locally. To save it to database use + * ewk_context_form_autofill_profile_add + * + * @since_tizen 2.4 + * + * @param[in] profile contains the profile data + * @param[in] name type of attribute to be set + * @param[in] value value of the attribute + * + * @see ewk_autofill_profile_data_get + * @see Ewk_Autofill_Profile_Data_Type + * @see ewk_context_form_autofill_profile_add + * @endif + */ +EXPORT_API void ewk_autofill_profile_data_set( + Ewk_Autofill_Profile* profile, Ewk_Autofill_Profile_Data_Type name, + const char* value); + +/** + * @if MOBILE + * @brief Gets the id attribute value from a given profile + * + * The profile obtained from ewk_context_form_autofill_profile_get will be used + * to get the profile id + * + * @param[in] profile name of profile + * + * @since_tizen 2.4 + * + * @return @c Value of attribute (unsigned), @c 0 otherwise + * + * @see ewk_autofill_profile_new + * @see ewk_context_form_autofill_profile_get + * @see ewk_context_form_autofill_profile_get_all + * @endif + */ +EXPORT_API unsigned ewk_autofill_profile_id_get(Ewk_Autofill_Profile* profile); + +/** + * @if MOBILE + * @brief Gets the attribute value from a given profile + * + * The profile obtained from ewk_context_form_autofill_profile_get will be used + * to get the data + * + * @since_tizen 2.4 + * + * @param[in] profile name of profile + * @param[in] name name of attribute + * + * @return @c Value of attribute (char*), @c NULL otherwise + * + * @see ewk_autofill_profile_new + * @see ewk_context_form_autofill_profile_get + * @see ewk_context_form_autofill_profile_get_all + * @endif + */ +EXPORT_API const char* ewk_autofill_profile_data_get( + Ewk_Autofill_Profile* profile, Ewk_Autofill_Profile_Data_Type name); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif // ewk_autofill_profile_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_autofill_profile_product.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_autofill_profile_product.h new file mode 100644 index 000000000..fe765e411 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_autofill_profile_product.h @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2018-2019 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_autofill_profile_product_h +#define ewk_autofill_profile_product_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + * @{ + */ + +/** + * @if TV + * @brief The structure type that creates a type name for #Ewk_Form_Info. + * + * @since_tizen 5.0 + * @endif + */ +typedef struct _Ewk_Form_Info Ewk_Form_Info; + +/** + * @if TV + * \enum _Ewk_Form_Type + * @brief Enumeration that provides an option to form types. + * + * @since_tizen 5.0 + * @endif + */ +enum _Ewk_Form_Type { + EWK_FORM_NONE = 0, + EWK_FORM_USERNAME, + EWK_FORM_PASSWORD, + EWK_FORM_BOTH +}; + +/** + * @if TV + * @brief Enumeration that creates a type name for the Ewk_Form_Type. + * + * @since_tizen 5.0 + * @endif + */ +typedef enum _Ewk_Form_Type Ewk_Form_Type; + +/** + * @if TV + * @brief Gets the form type from a given form information + * + * @since_tizen 5.0 + * + * @param[in] form information + * + * @return @c Type of form + * + * @endif + */ +EXPORT_API Ewk_Form_Type +ewk_autofill_profile_form_type_get(Ewk_Form_Info* info); + +/** + * @if TV + * @brief Gets the user name from a given form information + * + * @since_tizen 5.0 + * + * @param[in] form information + * + * @return @c user name + * + * @endif + */ +EXPORT_API const char* ewk_autofill_profile_form_user_name_get( + Ewk_Form_Info* info); + +/** + * @if TV + * @brief Gets the password from a given form info + * + * @since_tizen 5.0 + * + * @param[in] form information + * + * @return @c password + * + * @endif + */ +EXPORT_API const char* ewk_autofill_profile_form_password_get( + Ewk_Form_Info* info); + +/** + * @if TV + * @brief Gets the user name element from a given form info + * + * @since_tizen 5.0 + * + * @param[in] form information + * + * @return @c user name element + * + * @endif + */ +EXPORT_API const char* ewk_autofill_profile_form_username_element_get( + Ewk_Form_Info* info); + +/** + * @if TV + * @brief Gets the password element from a given form info + * + * @since_tizen 5.0 + * + * @param[in] form information + * + * @return @c password element + * + * @endif + */ +EXPORT_API const char* ewk_autofill_profile_form_password_element_get( + Ewk_Form_Info* info); + +/** + * @if TV + * @brief Gets the action url from a given form info + * + * @since_tizen 5.0 + * + * @param[in] form information + * + * @return @c action url + * + * @endif + */ +EXPORT_API const char* ewk_autofill_profile_form_action_url_get( + Ewk_Form_Info* info); + +/** + * @if TV + * @brief Gets the domain from a given form info + * + * @since_tizen 5.0 + * + * @param[in] form information + * + * @return @c domain + * + * @endif + */ +EXPORT_API const char* ewk_autofill_profile_form_domain_get( + Ewk_Form_Info* info); +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif // ewk_autofill_profile_product_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_back_forward_list.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_back_forward_list.h new file mode 100644 index 000000000..cb6193fcf --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_back_forward_list.h @@ -0,0 +1,167 @@ +/* + * Copyright (C) 2012 Intel Corporation. + * Copyright (C) 2014-2016 Samsung Electronics. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * @file ewk_back_forward_list.h + * @brief This file describes the Ewk Back Forward List API. + */ + +#ifndef ewk_back_forward_list_h +#define ewk_back_forward_list_h + +#include +#include + +#include "ewk_back_forward_list_item.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + * @{ + */ + +/** + * @brief The structure type that creates a type name for + * Ewk_Back_Forward_List. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + */ +typedef struct _Ewk_Back_Forward_List Ewk_Back_Forward_List; + +/** + * @brief Returns the current item in the @a list. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] list The back-forward list instance + * + * @return The current item in the @a list,\n + * otherwise @c NULL in case of an error + */ +EXPORT_API Ewk_Back_Forward_List_Item* ewk_back_forward_list_current_item_get( + const Ewk_Back_Forward_List* list); + +/** + * @brief Returns the item that precedes the current item in the @a list. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] list The back-forward list instance + * + * @return The item that precedes the current item in the @a list,\n + * otherwise @c NULL in case of an error + */ +EXPORT_API Ewk_Back_Forward_List_Item* ewk_back_forward_list_previous_item_get( + const Ewk_Back_Forward_List* list); + +/** + * @brief Returns the item that follows the current item in the @a list. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] list The back-forward list instance + * + * @return The item that follows the current item in the @a list,\n + * otherwise @c NULL in case of an error + */ +EXPORT_API Ewk_Back_Forward_List_Item* ewk_back_forward_list_next_item_get( + const Ewk_Back_Forward_List* list); + +/** + * @brief Returns the item at a given @a index relative to the current item. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] list The back-forward list instance + * @param[in] index The index of the item + * + * @return The item at a given @a index relative to the current item,\n + * otherwise @c NULL in case of an error + */ +EXPORT_API Ewk_Back_Forward_List_Item* ewk_back_forward_list_item_at_index_get( + const Ewk_Back_Forward_List* list, int index); + +/** + * @brief Returns the length of the back-forward list including the current + * item. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] list The back-forward list instance + * + * @return The length of the back-forward list including the current item,\n + * otherwise @c 0 in case of an error + */ +EXPORT_API unsigned ewk_back_forward_list_count(Ewk_Back_Forward_List* list); + +/** + * @brief Creates a list containing the items preceding the current item limited + * by @a limit. + * + * @details The @c Ewk_Back_Forward_List_Item elements are located in the result + list starting with the oldest one.\n + * If @a limit is equal to @c -1 all the items preceding the current + * item are returned. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] list The back-forward list instance + * @param[in] limit The number of items to retrieve + * + * @return @c Eina_List containing @c Ewk_Back_Forward_List_Item elements,\n + * otherwise @c NULL in case of an error\n + * The Eina_List and its items should be freed after use\n + * Use ewk_back_forward_list_item_unref() to free the items + */ +EXPORT_API Eina_List* ewk_back_forward_list_n_back_items_copy( + const Ewk_Back_Forward_List* list, int limit); + +/** + * @brief Creates the list containing the items following the current item + * limited by @a limit. + * + * @details The @c Ewk_Back_Forward_List_Item elements are located in the result + * list starting with the oldest one.\n + * If @a limit is equal to @c -1 all the items preceding the current + * item are returned. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] list The back-forward list instance + * @param[in] limit The number of items to retrieve + * + * @return @c Eina_List containing @c Ewk_Back_Forward_List_Item elements,\n + * otherwise @c NULL in case of an error,\n + * The Eina_List and its items should be freed after use\n + * Use ewk_back_forward_list_item_unref() to free the items + */ +EXPORT_API Eina_List* ewk_back_forward_list_n_forward_items_copy( + const Ewk_Back_Forward_List* list, int limit); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif // ewk_back_forward_list_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_back_forward_list_item.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_back_forward_list_item.h new file mode 100644 index 000000000..0879f9040 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_back_forward_list_item.h @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2012 Intel Corporation. + * Copyright (C) 2014-2016 Samsung Electronics. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * @file ewk_back_forward_list_item.h + * @brief This file describes the Ewk Back Forward List Item API. + */ + +#ifndef ewk_back_forward_list_item_h +#define ewk_back_forward_list_item_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + * @{ + */ + +/** + * @brief The structure type that creates a type name for + * Ewk_Back_Forward_List_Item. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + */ +typedef struct _Ewk_Back_Forward_List_Item Ewk_Back_Forward_List_Item; + +/** + * @brief Increases the reference count of the given object. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] item The back-forward list item instance to increase the reference + * count + * + * @return A pointer to the object on success,\n + * otherwise @c NULL + */ +EXPORT_API Ewk_Back_Forward_List_Item* ewk_back_forward_list_item_ref( + Ewk_Back_Forward_List_Item* item); + +/** + * @brief Decreases the reference count of the given object, + * possibly freeing it. + * + * @details When the reference count reaches @c 0, the item is freed. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] item The back-forward list item instance to decrease the reference + * count + */ +EXPORT_API void ewk_back_forward_list_item_unref( + Ewk_Back_Forward_List_Item* item); + +/** + * @brief Returns the URL of the item. + * + * @details The returned URL may differ from the original URL (For example, + * if the page is redirected). + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] item The back-forward list item instance + * + * @return The URL of the @a item,\n + * otherwise @c NULL in case of an error\n + * This pointer is guaranteed to be eina_stringshare,\n + * so whenever possible save yourself some CPU cycles and\n + * use eina_stringshare_ref() instead of eina_stringshare_add() or + * strdup() + * + * @see ewk_back_forward_list_item_original_url_get() + */ +EXPORT_API const char* ewk_back_forward_list_item_url_get( + const Ewk_Back_Forward_List_Item* item); + +/** + * @brief Returns the title of the item. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] item The back-forward list item instance + * + * @return The title of the @a item,\n + * otherwise @c NULL in case of an error\n + * This pointer is guaranteed to be eina_stringshare,\n + * so whenever possible save yourself some CPU cycles and\n + * use eina_stringshare_ref() instead of eina_stringshare_add() or + * strdup() + */ +EXPORT_API const char* ewk_back_forward_list_item_title_get( + const Ewk_Back_Forward_List_Item* item); + +/** + * @brief Returns the original URL of the item. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] item The back-forward list item instance + * + * @return The original URL of the @a item,\n + * otherwise @c NULL in case of an error\n + * This pointer is guaranteed to be eina_stringshare,\n + * so whenever possible save yourself some CPU cycles and\n + * use eina_stringshare_ref() instead of eina_stringshare_add() or + * strdup() + * + * @see ewk_back_forward_list_item_url_get() + */ +EXPORT_API const char* ewk_back_forward_list_item_original_url_get( + const Ewk_Back_Forward_List_Item* item); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif // ewk_back_forward_list_item_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_certificate_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_certificate_internal.h new file mode 100644 index 000000000..9d55ef0b5 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_certificate_internal.h @@ -0,0 +1,211 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_certificate_internal.h + * @brief This file describes the engine APIs which allow deciding + * whether pages with certificate compromise should be opened or not. + */ + +#ifndef ewk_certificate_internal_h +#define ewk_certificate_internal_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum _Ewk_Certificate_Policy_Decision_Error { + EWK_CERTIFICATE_POLICY_DECISION_ERROR_COMMON_NAME_INVALID, /**< The server + responded with a certificate whose common name did not match the host + name. */ + + EWK_CERTIFICATE_POLICY_DECISION_ERROR_DATE_INVALID, /**< The server responded + with a certificate that by our clock, appears to either not yet be valid or + to have expired. */ + + EWK_CERTIFICATE_POLICY_DECISION_ERROR_AUTHORITY_INVALID, /**< The server + responded with a certificate that is signed by an authority we don't + trust. */ + + EWK_CERTIFICATE_POLICY_DECISION_ERROR_NO_REVOCATION_MECHANISM, /**< + The certificate has no mechanism for determining if it is revoked. In + effect, this certificate cannot be revoked. */ + + EWK_CERTIFICATE_POLICY_DECISION_ERROR_UNABLE_TO_CHECK_REVOCATION, /**< + Revocation information for the security certificate for this site is not + available. */ + + EWK_CERTIFICATE_POLICY_DECISION_ERROR_REVOKED, /**< The server responded with + a certificate that has been revoked. */ + + EWK_CERTIFICATE_POLICY_DECISION_ERROR_INVALID, /**< The server responded with + a certificate that is invalid. */ + + EWK_CERTIFICATE_POLICY_DECISION_ERROR_WEAK_ALGORITHM, /**< The server + responded with a certificate that is signed using a weak signature + algorithm. */ + + EWK_CERTIFICATE_POLICY_DECISION_ERROR_NON_UNIQUE_NAME, /**< The host name + specified in the certificate is not unique. */ + + EWK_CERTIFICATE_POLICY_DECISION_ERROR_WEAK_KEY, /**< The server responded with + a certificate that contains a weak key (e.g. a too-small RSA key). */ + + EWK_CERTIFICATE_POLICY_DECISION_ERROR_PINNED_KEY_NOT_IN_CHAIN, /**< + The certificate didn't match the public key pins for the host name. */ + + EWK_CERTIFICATE_POLICY_DECISION_ERROR_NAME_VIOLATION, /**< The certificate + claimed DNS names that are in violation of name constraints. */ + + EWK_CERTIFICATE_POLICY_DECISION_ERROR_VALIDITY_TOO_LONG, /**< + The certificate's validity period is too long. */ + + EWK_CERTIFICATE_POLICY_DECISION_ERROR_UNKNOWN = 1000 /**< Reported in case of + wrong usage of ewk_certificate_policy_decision_error_get API. */ +} Ewk_Certificate_Policy_Decision_Error; + +typedef struct _Ewk_Certificate_Policy_Decision Ewk_Certificate_Policy_Decision; + +/** + * Set the variable to allow the site access about certificate error. + * After this function call Ewk_Certificate_Policy_Decision object becomes + * invalid. + * + * @param certificate_policy_decision certificate information data + * + * @param allowed decided permission value from user + */ +EXPORT_API void ewk_certificate_policy_decision_allowed_set( + Ewk_Certificate_Policy_Decision* certificate_policy_decision, + Eina_Bool allowed); + +/** + * Suspend the operation for certificate error policy decision. + * + * This suspends the operation for certificate error policy decision when the + * signal for policy is emitted. This is very usefull to decide the policy from + * the additional UI operation like the popup. After calling this API the client + * must call ewk_certificate_policy_decision_allowed_set in order to finalize + * the certificate handling. Otherwise the memory leak will occur. + * + * @param certificate_policy_decision certificate information data + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_certificate_policy_decision_suspend( + Ewk_Certificate_Policy_Decision* certificate_policy_decision); + +/** + * Get the variable url to check the site's url data about certificate error. + * + * @param certificate_policy_decision certificate information data + * + * @return @c url string on success or empty string on failure. The string + * is only valid until related Ewk_Certificate_Policy_Decision object is valid. + */ +EXPORT_API Eina_Stringshare* ewk_certificate_policy_decision_url_get( + Ewk_Certificate_Policy_Decision* certificate_policy_decision); + +/** + * Get the variable certificate pem data to check the information about + * certificate error. + * + * @param certificate_policy_decision certificate information data + * + * @return @c certificate pem string on success or empty string on failure. + * The string is only valid until related Ewk_Certificate_Policy_Decision + * object is valid. + */ +EXPORT_API Eina_Stringshare* +ewk_certificate_policy_decision_certificate_pem_get( + Ewk_Certificate_Policy_Decision* certificate_policy_decision); + +/** + * Get the error of the certificate. + * + * @param certificate_policy_decision certificate information data + * + * @return @c error number on success or + * EWK_CERTIFICATE_POLICY_DECISION_ERROR_UNKNOWN on failure + */ +EXPORT_API Ewk_Certificate_Policy_Decision_Error +ewk_certificate_policy_decision_error_get( + Ewk_Certificate_Policy_Decision* certificate_policy_decision); + +/** + * @brief The structure type that hold certificate's information + */ +typedef struct _Ewk_Certificate_Info Ewk_Certificate_Info; + +/** + * @brief Query certificate's PEM data + * + * @param[in] cert_info Certificate's information + * + * @return A certificate itself in the PEM format. It may be null what indicates + * that webpage doesn't use the SSL protocol (e.g. HTTP). + */ +EXPORT_API const char* ewk_certificate_info_pem_get( + const Ewk_Certificate_Info* cert_info); + +/** + * @brief Query if the context loaded with a given certificate is secure + * + * @details Even that webpage was successfully loaded with a given certificate, + * its context may not be secure. Secure context means that webpage is fully + * authenticated (using SSL certificates) and its content doesn't contain any + * insecure elements (like HTTP CSS, images, scripts etc.) + * + * @param[in] cert_info Certificate's information + * + * @return EINA_TRUE if the context is secure. Otherwise returns EINA_FALSE + */ +EXPORT_API Eina_Bool +ewk_certificate_info_is_context_secure(const Ewk_Certificate_Info* cert_info); + +/** + * Returns information whether the certificate compromise comes from main frame. + * + * Certificate issue can be associated with main frame or sub resource + * such as image, script, font etc. Browsers usually notify the user about + * certificate compromise if it comes from main frame, whereas all + * sub resource are silently blocked, since the user does not really + * have a context for making the right decision. + * + * @certificate_policy_decision certificate information data + * + * @return @c EINA_TRUE if the certificate compromise comes from main frame, + * @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_certificate_policy_decision_from_main_frame_get( + const Ewk_Certificate_Policy_Decision* certificate_policy_decision); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_chromium.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_chromium.h new file mode 100644 index 000000000..a4ac07383 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_chromium.h @@ -0,0 +1,44 @@ +// 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_chromium_efl_h +#define ewk_chromium_efl_h + +#include "EWebKit.h" +#include "EWebKit_internal.h" +#include "EWebKit_product.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief This file is no longer supported and all its function are + * deprecated now. It will be removed soon. + */ + +/** + * Append specified flag to chromium command line. This method should + * be called after @ewk_set_arguments, but before @ewk_init. Calling it + * after @ewk_init won't have any affects as in most cases chromium has + * already processed most command line parameters. + * + * @deprecated Deprecated since Tizen 3.0. + * This has been deprecated due to it was exposed on the internal needs. + * Secondly, this function can not add command line switches defined as pair + * (flag=value). + * If there is a need to pass command line param it can be achieved + * by ewk_set_arguments. + * + * @param flag Chromium command line flag + * + * @returns EINA_TRUE in case the call succeeded, EINA_FALSE in case it + * was called before ewk_set_arguments, or the flag argument was NULL. + */ +EXPORT_API Eina_Bool ewk_chromium_append_command_line_flag(const char* flag); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_console_message_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_console_message_internal.h new file mode 100644 index 000000000..3f779a88e --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_console_message_internal.h @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2014-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_console_message_internal.h + * @brief Describes the Console Message API. + */ + +#ifndef ewk_console_message_internal_h +#define ewk_console_message_internal_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for @a _Ewk_Console_Message. */ +typedef struct _Ewk_Console_Message Ewk_Console_Message; + +/// Creates a type name for Ewk_Console_Message_Level. +typedef enum { + EWK_CONSOLE_MESSAGE_LEVEL_NULL, + EWK_CONSOLE_MESSAGE_LEVEL_LOG, + EWK_CONSOLE_MESSAGE_LEVEL_WARNING, + EWK_CONSOLE_MESSAGE_LEVEL_ERROR, + EWK_CONSOLE_MESSAGE_LEVEL_DEBUG, + EWK_CONSOLE_MESSAGE_LEVEL_INFO, +} Ewk_Console_Message_Level; + +/** + * Returns the log severity of the console message from the Console Message + object + * + * @param message console message object + * + * @return Ewk_Console_Message_Level indicating the console message level, + LogMessageLevel = 1, + WarningMessageLevel = 2, + ErrorMessageLevel = 3, + DebugMessageLevel = 4, + InfoMessageLevel = 5 + */ +EXPORT_API Ewk_Console_Message_Level +ewk_console_message_level_get(const Ewk_Console_Message *message); + +/** + * Returns the console message text from the Console Message object + * + * @param message console message object + * + * @return console message text on success or empty string on failure + */ +EXPORT_API Eina_Stringshare *ewk_console_message_text_get( + const Ewk_Console_Message *message); + +/** + * Returns line no of the console message from the Console Message object + * + * @param message console message object + * + * @return the line number of the message on success or 0 on failure + */ +EXPORT_API unsigned ewk_console_message_line_get( + const Ewk_Console_Message *message); + +/** + * Returns the source of the console message from the Console Message object + * + * @param message console message object + * + * @return source of the console message on success or empty string on failure + */ +EXPORT_API Eina_Stringshare *ewk_console_message_source_get( + const Ewk_Console_Message *message); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_console_message_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_content_screening_detection_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_content_screening_detection_internal.h new file mode 100644 index 000000000..6d3a0baba --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_content_screening_detection_internal.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_content_screening_detection_internal_h +#define ewk_content_screening_detection_internal_h + +#include +#include + +#include "ewk_error.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _Ewk_Content_Screening_Detection Ewk_Content_Screening_Detection; + +/** + * Get the variable error structure to check the error cause about malware + * error. + * + * @param content_screening_detection malware information data + * + * @return @c error + */ +EXPORT_API Ewk_Error* ewk_content_screening_detection_error_get( + Ewk_Content_Screening_Detection* content_screening_detection); + +#ifdef __cplusplus +} +#endif +#endif // ewk_content_screening_detection_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_content_screening_detection_product.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_content_screening_detection_product.h new file mode 100644 index 000000000..e23560d01 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_content_screening_detection_product.h @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_content_screening_detection_product_h +#define ewk_content_screening_detection_product_h + +#include +#include + +#include "ewk_error.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _Ewk_Content_Screening_Detection Ewk_Content_Screening_Detection; + +/** + * Set the variable to allow the release confirm about malware error. + * + * @param content_screening_detection malware information data + * + * @param confirmed decided permission value from user + */ +EXPORT_API void ewk_content_screening_detection_confirmed_set( + Ewk_Content_Screening_Detection* content_screening_detection, + Eina_Bool confirmed); + +/** + * Suspend the operation for content screening detection. + * + * This suspends the operation for content screening detection when the signal + * is emitted. This is very usefull to decide the policy from the additional UI + * operation like the popup. + * + * @param content_screening_detection malware information data + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API void ewk_content_screening_detection_suspend( + Ewk_Content_Screening_Detection* content_screening_detection); + +/** + * Get the variable errro structure to check the error cause about malware + * error. + * + * @param content_screening_detection malware information data + * + * @return @c error + */ +EXPORT_API Ewk_Error* ewk_content_screening_detection_error_get( + Ewk_Content_Screening_Detection* content_screening_detection); + +/** + * @brief Get the level to check the error cause about malware error. + * + * @since_tizen 2.3 + * + * @param[in] content_screening_detection malware information data + * + * @return level + */ +EXPORT_API int ewk_content_screening_detection_level_get( + Ewk_Content_Screening_Detection* content_screening_detection); + +/** + * @brief Get the name to check the error cause about malware error. + * + * @since_tizen 2.3 + * + * @param[in] content_screening_detection malware information data + * + * @return name + */ +EXPORT_API const char* ewk_content_screening_detection_name_get( + Ewk_Content_Screening_Detection* content_screening_detection); + +/** + * @brief Get the url to check the error cause about malware error. + * + * @since_tizen 2.3 + * + * @param[in] content_screening_detection malware information data + * + * @return url + */ +EXPORT_API const char* ewk_content_screening_detection_url_get( + Ewk_Content_Screening_Detection* content_screening_detection); + +#ifdef __cplusplus +} +#endif +#endif // ewk_content_screening_detection_product_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context.h new file mode 100644 index 000000000..31ceff611 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context.h @@ -0,0 +1,529 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * @file ewk_context.h + * @brief This file describes the Ewk Context API. + * + * @remarks ewk_context encapsulates all pages related to the specific use of + * Chromium-efl + * + * Applications have the option of creating a context different from the default + * one and using it for a group of pages. All pages in the same context share + * the same preferences, visited link set, local storage, and so on. + * + * A process model can be specified per context. The default one is the shared + * model where the web-engine process is shared among the pages in the context. + * The second model allows each page to use a separate web-engine process. + * This latter model is currently not supported by Chromium-efl. + * + */ + +#ifndef ewk_context_h +#define ewk_context_h + +#include +#include +#include + +#include "ewk_autofill_profile.h" +#include "ewk_cookie_manager.h" +#include "ewk_intercept_request.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + * @{ + */ + +/** + * @brief The structure type that creates a type name for #Ewk_Context. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + */ +typedef struct Ewk_Context Ewk_Context; + +/** + * @brief Contains option for cache model + * + * @since_tizen 2.4 + */ +enum _Ewk_Cache_Model { + EWK_CACHE_MODEL_DOCUMENT_VIEWER, /**< Use the smallest cache capacity. */ + EWK_CACHE_MODEL_DOCUMENT_BROWSER, /**< Use bigger cache capacity than + EWK_CACHE_MODEL_DOCUMENT_VIEWER. */ + EWK_CACHE_MODEL_PRIMARY_WEBBROWSER /**< Use the biggest cache capacity. */ +}; + +/** + * @brief The structure type that creates a type name for Ewk_Cache_Model. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif + */ +typedef enum _Ewk_Cache_Model Ewk_Cache_Model; + +/** + * @brief Gets the cookie manager instance for this @a context. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] context The context object to query + * + * @return The Ewk_Cookie_Manager object instance,\n + * otherwise @c NULL in case of failure + */ +EXPORT_API Ewk_Cookie_Manager* ewk_context_cookie_manager_get( + const Ewk_Context* context); + +/** + * @if MOBILE + * @brief Requests for deleting all web application caches. + * + * @since_tizen 2.4 + * + * @param[in] context Context object + * + * @return @c EINA_TRUE on success, otherwise @c EINA FALSE + * @endif + */ +EXPORT_API Eina_Bool +ewk_context_application_cache_delete_all(Ewk_Context* context); + +/** + * @brief Requests to set the cache model. + * + * The default cache option is #EWK_CACHE_MODEL_DOCUMENT_VIEWER. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] context The context object + * @param[in] model The cache model + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_context_cache_model_set(Ewk_Context* context, + Ewk_Cache_Model model); + +/** + * @brief Returns the cache model type. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] context The context object + * + * @return #Ewk_Cache_Model + */ +EXPORT_API Ewk_Cache_Model +ewk_context_cache_model_get(const Ewk_Context* context); + +/** + * @if MOBILE + * @brief Saves the created profile into permanent storage + * + * The profile used to save must be created by ewk_autofill_profile_new. + * Data can be added to the created profile by ewk_autofill_profile_data_set. + * + * @since_tizen 2.4 + * + * @param[in] context Context object + * @param[in] profile Ewk_Autofill_Profile + * + * @return @c EINA_TRUE if the profile data is saved successfully, otherwise + * @c EINA_FALSE + * + * @see ewk_autofill_profile_new + * @endif + */ +EXPORT_API Eina_Bool ewk_context_form_autofill_profile_add( + Ewk_Context* context, Ewk_Autofill_Profile* profile); + +/** + * @if MOBILE + * @brief Gets the existing profile for given index + * + * @since_tizen 2.4 + * + * @param[in] context Context object + * @param[in] id Profile + * + * @return @c Ewk_Autofill_Profile if profile exists, otherwise @c NULL + * + * @see ewk_autofill_profile_delete + * @endif + */ +EXPORT_API Ewk_Autofill_Profile* ewk_context_form_autofill_profile_get( + Ewk_Context* context, unsigned id); + +/** + * @if MOBILE + * @brief Gets a list of all existing profiles + * + * The obtained profile must be deleted by ewk_autofill_profile_delete. + * + * @since_tizen 2.4 + * + * @param[in] context Context object + * + * @return @c Eina_List of Ewk_Autofill_Profile, otherwise @c NULL + * + * @see ewk_autofill_profile_delete + * @endif + */ +EXPORT_API Eina_List* ewk_context_form_autofill_profile_get_all( + Ewk_Context* context); + +/** + * @if MOBILE + * @brief Sets the given profile for the given id + * + * Data can be added to the created profile by ewk_autofill_profile_data_set. + * + * @since_tizen 2.4 + * + * @param[in] context Context object + * @param[in] id Profile + * @param[in] profile Ewk_Autofill_Profile + * + * @return @c EINA_TRUE if the profile data is set successfully, otherwise + * @c EINA_FALSE + * + * @see ewk_autofill_profile_new + * @see ewk_context_form_autofill_profile_add + * @endif + */ +EXPORT_API Eina_Bool ewk_context_form_autofill_profile_set( + Ewk_Context* context, unsigned id, Ewk_Autofill_Profile* profile); + +/** + * @if MOBILE + * @brief Removes Autofill Form profile completely + * + * @since_tizen 2.4 + * + * @param[in] context Context object + * @param[in] id Profile + * + * @return @c EINA_TRUE if the profile data is removed successfully, otherwise + @c EINA_FALSE + * + * @see ewk_context_form_autofill_profile_get_all + * @endif + */ +EXPORT_API Eina_Bool +ewk_context_form_autofill_profile_remove(Ewk_Context* context, unsigned id); + +/** + * @if MOBILE + * @brief Deletes all candidate form data from DB + * + * @since_tizen 2.4 + * + * @param[in] context Context object + * @endif + */ +EXPORT_API void ewk_context_form_candidate_data_delete_all( + Ewk_Context* context); + +/** + * @if MOBILE + * @brief Deletes whole password data from DB + * + * @since_tizen 2.4 + * + * @param context Context object + * @endif + */ +EXPORT_API void ewk_context_form_password_data_delete_all(Ewk_Context* context); + +/** + * @brief Clears HTTP caches in the local storage and + * all resources cached in memory\n + * such as images, CSS, JavaScript, XSL, and fonts for @a context. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] context The context object to clear all resource caches + */ +EXPORT_API void ewk_context_resource_cache_clear(Ewk_Context* context); + +/** + * @if MOBILE + * @brief Requests to get image representing the given URL. + * + * @since_tizen 2.4 + * + * @param[in] context Context object + * @param[in] uri Which url to query icon, must not be @c 0 + * @param[in] canvas Evas instance where to add resulting object, + * must not be @c 0 + * + * @return @c Evas_Object instance, otherwise @c 0 + * @endif + */ +EXPORT_API Evas_Object* ewk_context_icon_database_icon_object_add( + Ewk_Context* context, const char* uri, Evas* canvas); + +/** + * @if MOBILE + * @brief Requests for deleting all web indexed databases. + * + * @since_tizen 2.4 + * + * @param[in] context Context object + * + * @return @c EINA_TRUE on success, otherwise @c EINA_FALSE + * @endif + */ +EXPORT_API Eina_Bool +ewk_context_web_indexed_database_delete_all(Ewk_Context* context); + +/** + * @if MOBILE + * @brief Deletes web storage. + * + * @details This function does not ensure that all data will be removed. + * Should be used to extend free physical memory. + * + * @since_tizen 2.4 + * + * @param[in] context Context object + * + * @return @c EINA_TRUE on success, otherwise @c EINA_FALSE + * @endif + */ +EXPORT_API Eina_Bool ewk_context_web_storage_delete_all(Ewk_Context* context); + +/** + * @brief Callback for intercept request feature. + * + * @details Ewk_Context_Intercept_Request_Callback callback allows host + * application to intercept a resource request and write custom + * response. + * + * @warning Callback is not called on UI thread, so user should be cautious + * when accessing their data also used on UI thread. No ewk api other + * than ewk_intercept_request_* api should be used in the callback. + * + * @remarks Inside the callback user can use the following EWK API calls on + * a given Ewk_Intercept_Request instance to decide if request should + * be intercepted or handled normally: + * - ewk_intercept_request_url_get + * - ewk_intercept_request_http_method_get + * - ewk_intercept_request_headers_get + * + * To let engine handle the request normally, use + * ewk_intercept_request_ignore *inside* the callback. Using it later + * results in undefined behavior. + * + * To respond to a request with a custom response, use + * ewk_intercept_request_response_set or + * ewk_intercept_request_response_body_set inside or outside the + * callback. Using it outside of the callback is advised for better + * responsiveness. If your responses take too much time to prepare, it + * would block handling other requests. You can also use + * ewk_intercept_request_response_write outside the callback to write + * response in chunks. + * + * Handling a request is done after using either + * ewk_intercept_request_ignore, ewk_intercept_request_response_set, + * ewk_intercept_request_response_body_set, and in some cases after + * ewk_intercept_request_response_write_chunk. + * + * Further EWK API calls on this Ewk_Intercept_Request instance result + * in undefined behavior. + * + * Failing to call one of these functions results in leaking + * Ewk_Intercept_Request object. + * + * @since_tizen 3.0 + * + * @param[in] ewk_context Ewk_Context for which callback was set + * @param[in] intercept_request Intercept request object for reading request + * info and writing response data + * @param[in] user_data User data passed to + * ewk_context_intercept_request_callback_set + */ +typedef void (*Ewk_Context_Intercept_Request_Callback)( + Ewk_Context* ewk_context, Ewk_Intercept_Request* intercept_request, + void* user_data); + +/** + * @brief Sets Ewk_Context_Intercept_Request_Callback + * + * @details Sets Ewk_Context_Intercept_Request_Callback to give a chance to + * intercept resource request before sending it and return a custom + * response. + * + * @remarks Pass NULL pointer as @a callback to reset current callback. + * + * @since_tizen 3.0 + * + * @param[in] ewk_context Ewk_Context object to intercept requests + * @param[in] callback New callback, NULL resets current callback + * @param[in] user_data User data passed to @a callback + * + * @see Ewk_Context_Intercept_Request_Callback + */ +EXPORT_API void ewk_context_intercept_request_callback_set( + Ewk_Context* ewk_context, Ewk_Context_Intercept_Request_Callback callback, + void* user_data); + +/** + * @brief Sets Ewk_Context_Intercept_Request_Cancel_Callback + * + * @details Sets Ewk_Context_Intercept_Request_Cancel_Callback to give a chance + * to notify intercept resource request to client when url request is cancelled. + * + * @remarks Pass NULL pointer as @a callback to reset current callback. + * + * + * @param[in] ewk_context Ewk_Context object to intercept requests + * @param[in] callback New callback, NULL resets current callback + * @param[in] user_data User data passed to @a callback + * + * @see Ewk_Context_Intercept_Request_Callback + */ + +typedef Ewk_Context_Intercept_Request_Callback + Ewk_Context_Intercept_Request_Cancel_Callback; + +EXPORT_API void ewk_context_intercept_request_cancel_callback_set( + Ewk_Context* ewk_context, + Ewk_Context_Intercept_Request_Cancel_Callback callback, void* user_data); + +/** + * @brief Gets the enabled state of background music. + * + * @since_tizen 4.0 + * + * @param[in] context The context object + * + * @return @c EINA_TRUE if background music is enabled, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_background_music_get(Ewk_Context* context); + +/** + * @brief Sets the enabled state of background music. + * + * @details This function allows the application to continue playing instead of + * pausing when it moves to the background. + * + * @since_tizen 4.0 + * + * @param[in] context The context object + * @param[in] enable Enable or disable background music + * + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_background_music_set(Ewk_Context* context, + Eina_Bool enable); + +/** + * @brief Gets the enabled state of blocking multimedia on call. + * + * @since_tizen 4.0 + * + * @param[in] context The context object + * + * @return @c EINA_TRUE if blocking multimedia on call is enabled, @c EINA_FALSE + * otherwise + */ +EXPORT_API Eina_Bool +ewk_context_block_multimedia_on_call_get(Ewk_Context* context); + +/** + * @brief Sets the enabled state of blocking multimedia on call. + * + * @details The application can set the flag to allow or disallow media playback + * during active call. + * + * @since_tizen 4.0 + * + * @param[in] context The context object + * @param[in] enable Enable or disable blocking multimedia on call + * + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_block_multimedia_on_call_set( + Ewk_Context* context, Eina_Bool enable); + +/** + * @brief Gets the enabled state of rotation lock. + * + * @since_tizen 4.0 + * + * @param[in] context The context object + * + * @return @c EINA_TRUE if rotation lock is enabled, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_rotation_lock_get(Ewk_Context* context); + +/** + * @brief Sets the enabled state of rotation lock. + * + * @details The application can use this function to lock the auto screen + * rotation feature. + * + * @since_tizen 4.0 + * + * @param[in] context The context object + * @param[in] enable Enable or disable rotation lock + * + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_rotation_lock_set(Ewk_Context* context, + Eina_Bool enable); + +/** + * @brief Gets the enabled state of sound overlap. + * + * @since_tizen 4.0 + * + * @param[in] context The context object + * + * @return @c EINA_TRUE if sound overlap is enabled, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_sound_overlap_get(Ewk_Context* context); + +/** + * @brief Sets the enabled state of sound overlap. + * + * @details The application can set the flag to allow or disallow the sound + * overlap with other apps. + * + * @since_tizen 4.0 + * + * @param[in] context The context object + * @param[in] enable Enable or disable sound overlap + * + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_sound_overlap_set(Ewk_Context* context, + Eina_Bool enable); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif // ewk_context_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context_internal.h new file mode 100644 index 000000000..c653d4a06 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context_internal.h @@ -0,0 +1,989 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_context_internal.h + * @brief Describes the context API. + * + * @note ewk_context encapsulates all pages related to specific use of + * Chromium-efl + * + * Applications have the option of creating a context different than the default + * one and use it for a group of pages. All pages in the same context share the + * same preferences, visited link set, local storage, etc. + * + * A process model can be specified per context. The default one is the shared + * model where the web-engine process is shared among the pages in the context. + * The second model allows each page to use a separate web-engine process. + * This latter model is currently not supported by Chromium-efl. + */ + +#ifndef ewk_context_internal_h +#define ewk_context_internal_h + +#include "ewk_application_cache_manager_internal.h" +#include "ewk_context.h" +#include "ewk_favicon_database_internal.h" +#include "ewk_notification_internal.h" +#include "ewk_security_origin_internal.h" +#include "ewk_storage_manager_internal.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// Extensible API enum is not supported in chromium. +typedef void* Ewk_Extensible_API; + +typedef struct Ewk_Context_Exceeded_Quota Ewk_Context_Exceeded_Quota; + +typedef void (*Ewk_Context_Notification_Show_Callback)(Ewk_Context*, + Ewk_Notification*, + void*); + +typedef void (*Ewk_Context_Notification_Cancel_Callback)(Ewk_Context*, uint64_t, + void*); + +/** + * @internal + * @brief Enumeration for compression proxy image quality. + * @since_tizen 2.3 + */ +enum _Ewk_Compression_Proxy_Image_Quality { + EWK_COMPRESSION_PROXY_IMAGE_QUALITY_LOW = 0, /**< @internal Low */ + EWK_COMPRESSION_PROXY_IMAGE_QUALITY_MEDIUM, /**< @internal Medium */ + EWK_COMPRESSION_PROXY_IMAGE_QUALITY_HIGH /**< @internal High */ +}; + +/** + * @internal + * @brief Creates a type name for @a #Ewk_Compression_Proxy_Image_Quality. + * @since_tizen 2.3 + */ +typedef enum _Ewk_Compression_Proxy_Image_Quality + Ewk_Compression_Proxy_Image_Quality; + +/** + * Deletes Ewk_Context. + * + * @param context Ewk_Context to delete + */ +EXPORT_API void ewk_context_delete(Ewk_Context* context); + +/** + * Notify low memory to free unused memory. + * + * @param o context object to notify low memory. + * + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise. + */ +EXPORT_API Eina_Bool ewk_context_notify_low_memory(Ewk_Context* ewkContext); + +/** + * @typedef Ewk_Local_File_System_Origins_Get_Callback + * Ewk_Local_File_System_Origins_Get_Callback + * @brief Type definition for use with + * ewk_context_local_file_system_origins_get() + */ +typedef void (*Ewk_Local_File_System_Origins_Get_Callback)(Eina_List* origins, + void* user_data); + +/** + * Callback for ewk_context_application_cache_origins_get + * + * @param origins web application cache origins + * @param user_data user_data will be passsed when + * ewk_context_application_cache_origins_get is called + */ +typedef void (*Ewk_Web_Application_Cache_Origins_Get_Callback)( + Eina_List* origins, void* user_data); + +/** + * Callback for ewk_context_application_cache_quota_get. + * + * @param quota web application cache quota + * @param user_data user_data will be passsed when + * ewk_context_application_cache_quota_get is called + */ +typedef void (*Ewk_Web_Application_Cache_Quota_Get_Callback)(int64_t quota, + void* user_data); + +/** + * Callback for ewk_context_application_cache_usage_for_origin_get. + * + * @param usage web application cache usage for origin + * @param user_data user_data will be passsed when + * ewk_context_application_cache_usage_for_origin_get is called + */ +typedef void (*Ewk_Web_Application_Cache_Usage_For_Origin_Get_Callback)( + int64_t usage, void* user_data); + +/** + * Callback for ewk_context_application_cache_path_get. + * + * @param path web application cache directory + * @param user_data user_data will be passsed when + * ewk_context_application_cache_path_get is called + */ +// typedef void (*Ewk_Web_Application_Cache_Path_Get_Callback)(const char* path, +// void* user_data); + +/** + * Callback for ewk_context_web_database_origins_get. + * + * @param origins web database origins + * @param user_data user_data will be passsed when + * ewk_context_web_database_origins_get is called + */ +typedef void (*Ewk_Web_Database_Origins_Get_Callback)(Eina_List* origins, + void* user_data); + +/** + * Callback for ewk_context_web_database_quota_for_origin_get. + * + * @param quota web database quota + * @param user_data user_data will be passsed when + * ewk_context_web_database_quota_for_origin_get is called + */ +typedef void (*Ewk_Web_Database_Quota_Get_Callback)(uint64_t quota, + void* user_data); + +/** + * Callback for ewk_context_web_database_path_get. + * + * @param path web database directory + * @param user_data user_data will be passsed when + * ewk_context_web_database_path_get is called + */ +// typedef void (*Ewk_Web_Database_Path_Get_Callback)(const char* path, void* +// user_data); + +/** + * Callback for didStartDownload + * + * @param download_url url to download + * @param user_data user_data will be passsed when download is started + */ +typedef void (*Ewk_Context_Did_Start_Download_Callback)( + const char* download_url, void* user_data); + +/** + * Callback for overriding default mime type + * + * @param url url for which the mime type can be overridden + * @param mime current mime type assumed by the web engine + * @param new_mime string with a new mime type for content pointer by url. + * Should be allocated dynamically by malloc or calloc. If callback returns + * EINA_TRUE, the browser will take ownership of the allocated memory and free + * it when it's no longer needed using the free() function + * @return true in case mime should be overridden by the contents of new_mime, + * false otherwise. If false will be returned, the browser won't free the + * new_mime + * @param user_data user_data will be passsed when + * ewk_context_mime_override_callback_set is called + */ +typedef Eina_Bool (*Ewk_Context_Override_Mime_For_Url_Callback)( + const char* url, const char* mime, char** new_mime, void* user_data); + +/* + * Callback for changed profiles. + * + * @param data user data will be passed when autofill profile is changed + */ +typedef void (*Ewk_Context_Form_Autofill_Profile_Changed_Callback)(void* data); + +/* + * Callback for changed credit_cards. + * + * @param data user data will be passed when credit card is changed + */ +typedef void (*Ewk_Context_Form_Autofill_CreditCard_Changed_Callback)( + void* data); + +/** + * Sets callback for credit_cards change notification. + * + * @param callback pointer to callback function + * @param user_data user data returned on callback + * + */ +EXPORT_API void ewk_context_form_autofill_credit_card_changed_callback_set( + Ewk_Context_Form_Autofill_CreditCard_Changed_Callback callback, + void* user_data); + +/** + * Requests for freeing origins. + * + * @param origins list of origins + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_origins_free(Eina_List* origins); + +/** + * Requests for deleting web application cache for origin. + * + * @param context context object + * @param origin application cache origin + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_application_cache_delete( + Ewk_Context* context, Ewk_Security_Origin* origin); + +/** + * Requests for getting application cache usage for origin. + * + * @param context context object + * @param origin security origin + * @param result_callback callback to get web database usage + * @param user_data user_data will be passed when result_callback is called + * -I.e., user data will be kept until callback is called + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_application_cache_usage_for_origin_get( + Ewk_Context* context, const Ewk_Security_Origin* origin, + Ewk_Web_Application_Cache_Usage_For_Origin_Get_Callback callback, + void* user_data); + +/** + * Requests for deleting web databases for origin. + * + * @param context context object + * @param origin database origin + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_web_database_delete( + Ewk_Context* context, Ewk_Security_Origin* origin); + +/** + * Requests for getting web database origins. + * + * @param context context object + * @param result_callback callback to get web database origins + * @param user_data user_data will be passed when result_callback is called + * -I.e., user data will be kept until callback is called + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + * + * @see ewk_context_origins_free + */ +EXPORT_API Eina_Bool ewk_context_web_database_origins_get( + Ewk_Context* context, Ewk_Web_Database_Origins_Get_Callback callback, + void* user_data); + +/** + * Requests for setting soup data path(soup data include cookie and cache). + * + * @param context context object + * @param path soup data path to set + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_soup_data_directory_set(Ewk_Context* context, + const char* path); + +/** + * Toggles the cache enable and disable + * + * Function works asynchronously. + * By default the cache is disabled resulting in not storing network data on + * disk. + * + * @param context context object + * @param enable or disable cache + * + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_cache_disabled_set(Ewk_Context* ewkContext, + Eina_Bool cacheDisabled); + +/** + * Adds CA certificates to persistent NSS certificate database + * + * Function accepts a path to a CA certificate file, a path to a directory + * containing CA certificate files, or a colon-seprarated list of those. + * + * Certificate files should have *.crt extension. + * + * Directories are traversed recursively. + * + * @param context context object + * @param certificate_file path to a CA certificate file(s), see above for + * details + * + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_certificate_file_set( + Ewk_Context* context, const char* certificate_path); + +/** + * @internal + * @brief Enable or disable proxy + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] enabled enable or disable proxy + * + */ +EXPORT_API void ewk_context_compression_proxy_enabled_set(Ewk_Context* context, + Eina_Bool enabled); + +/** + * @internal + * @brief Returns currently proxy is enabled or not + * + * @since_tizen 2.3 + * + * @param[in] context context object + * + * @return @c EINA_TRUE on enabled or @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool +ewk_context_compression_proxy_enabled_get(Ewk_Context* context); + +/** + * @internal + * @brief Set image quality of proxy compression + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] quality image quality + * + */ +EXPORT_API void ewk_context_compression_proxy_image_quality_set( + Ewk_Context* context, Ewk_Compression_Proxy_Image_Quality quality); + +/** + * @internal + * @brief Returns current image quality + * + * @since_tizen 2.3 + * + * @param[in] context context object + * + * @return @c Ewk_Compression_Proxy_Image_Quality + */ +EAPI Ewk_Compression_Proxy_Image_Quality +ewk_context_compression_proxy_image_quality_get(Ewk_Context* context); + +/** + * @internal + * @brief Returns original and compressed data size + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[out] original_size uncompressed data size + * @param[out] compressed_size compressed size + * + */ +EXPORT_API void ewk_context_compression_proxy_data_size_get( + Ewk_Context* context, unsigned* original_size, unsigned* compressed_size); + +/** + * @internal + * @brief Reset original and compressed data size + * + * @since_tizen 2.3 + * + * @param[in] context context object + * + */ +EXPORT_API void ewk_context_compression_proxy_data_size_reset( + Ewk_Context* context); + +/** + * Gets CA certifcate file path + * + * It returns an internal string and should not be modified. + * + * @param context context object + * + * @return @c certificate_file is path which is set during + * ewk_context_certificate_file_set or @c NULL otherwise + */ +EXPORT_API const char* ewk_context_certificate_file_get( + const Ewk_Context* context); + +/** + * Requests to clear cache + * + * @param context context object + * + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_cache_clear(Ewk_Context* ewkContext); + +/** + * Sets callback for started download. + * + * @param context context object + * @param callback callback for started download + * @param user_data user data + */ +EXPORT_API void ewk_context_did_start_download_callback_set( + Ewk_Context* context, Ewk_Context_Did_Start_Download_Callback callback, + void* user_data); + +/** + * Sets callback for overriding mime type + * + * @param context context object + * @param callback callback to be invoked whenver the mime type can be + * overridden + * @param user_data user data + */ +EXPORT_API void ewk_context_mime_override_callback_set( + Ewk_Context* context, Ewk_Context_Override_Mime_For_Url_Callback callback, + void* user_data); + +/** + * @typedef Ewk_Vibration_Client_Vibrate_Cb Ewk_Vibration_Client_Vibrate_Cb + * @brief Type definition for a function that will be called back when vibrate + * request receiveed from the vibration controller. + */ +typedef void (*Ewk_Vibration_Client_Vibrate_Cb)(uint64_t vibration_time, + void* user_data); + +/** + * @typedef Ewk_Vibration_Client_Vibration_Cancel_Cb + * Ewk_Vibration_Client_Vibration_Cancel_Cb + * @brief Type definition for a function that will be called back when cancel + * vibration request receiveed from the vibration controller. + */ +typedef void (*Ewk_Vibration_Client_Vibration_Cancel_Cb)(void* user_data); + +/** + * Increases the reference count of the given object. + * + * @param context context object to increase the reference count + * + * @return Ewk_Context object on success or @c NULL on failure + */ +EXPORT_API Ewk_Context* ewk_context_ref(Ewk_Context* context); + +/** + * Decreases the reference count of the given object, possibly freeing it. + * + * When the reference count it's reached 0, the Ewk_Context is freed. + * + * @param context context object to decrease the reference count + */ +EXPORT_API void ewk_context_unref(Ewk_Context* context); +/** + * Gets default Ewk_Context instance. + * + * The returned Ewk_Context object @b should not be unref'ed if application + * does not call ewk_context_ref() for that. + * + * @return Ewk_Context object. + */ +EXPORT_API Ewk_Context* ewk_context_default_get(void); + +/** + * Creates a new Ewk_Context. + * + * The returned Ewk_Context object @b should be unref'ed after use. + * + * @return Ewk_Context object on success or @c NULL on failure + * + * @see ewk_context_unref + * @see ewk_context_new_with_injected_bundle_path + */ +EXPORT_API Ewk_Context* ewk_context_new(void); + +/** + * Creates a new Ewk_Context. + * + * The returned Ewk_Context object @b should be unref'ed after use. + * + * @param path path of injected bundle library + * + * @return Ewk_Context object on success or @c NULL on failure + * + * @see ewk_context_unref + * @see ewk_context_new + */ +EXPORT_API Ewk_Context* ewk_context_new_with_injected_bundle_path( + const char* path); + +/** + * @brief Creates a new Ewk_Context in incognito mode. + * + * @param[in] path Path of injected bundle library + * + * @return The Ewk_Context object on success or otherwise @c NULL on failure + * + * @see ewk_context_new + * @see ewk_context_new_with_injected_bundle_path + */ +EXPORT_API Ewk_Context* +ewk_context_new_with_injected_bundle_path_in_incognito_mode(const char* path); + +/** + * Sets additional plugin directory. + * + * @param context context object + * @param path the directory to be set + * + * @return @c EINA_TRUE if the directory was set, @c EINA_FALSE otherwise + */ +EINA_DEPRECATED EXPORT_API Eina_Bool +ewk_context_additional_plugin_path_set(Ewk_Context* context, const char* path); + +/** + * Sets vibration client callbacks to handle the tactile feedback in the form of + * vibration in the client application when the content asks for vibration. + * + * To stop listening for vibration events, you may call this function with @c + * NULL for the callbacks. + * + * @param context context object to set vibration client callbacks. + * @param vibrate The function to call when the vibrate request received from + * the controller (may be @c NULL). + * @param cancel The function to call when the cancel vibration request received + * from the controller (may be @c NULL). + * @param data User data (may be @c NULL). + */ +EXPORT_API void ewk_context_vibration_client_callbacks_set( + Ewk_Context* context, Ewk_Vibration_Client_Vibrate_Cb vibrate, + Ewk_Vibration_Client_Vibration_Cancel_Cb cancel, void* data); + +/** + * Sets callback for profiles change notification. + * + * @param callback pointer to callback function + * @param user_data user data returned on callback + * + */ +EXPORT_API void ewk_context_form_autofill_profile_changed_callback_set( + Ewk_Context_Form_Autofill_Profile_Changed_Callback callback, + void* user_data); + +/** + * Gets the existing profile for given index + * + * The obtained profile must be deleted by ewk_autofill_profile_delete. + * + * @param context context object + * @param id profile id + * + * @return @c Ewk_Autofill_Profile if profile exists, @c NULL otherwise + * @see ewk_autofill_profile_delete + */ +EXPORT_API Ewk_Autofill_Profile* ewk_context_form_autofill_profile_get( + Ewk_Context* context, unsigned id); + +/** + * Get tizen extensible api enable state + * + * @param context context object + * @param extensible_api extensible API name of every kind + * + * @return @c EINA_TRUE if the extensibleAPI set as true or @c EINA_FALSE + * otherwise + */ +EXPORT_API Eina_Bool ewk_context_tizen_extensible_api_string_get( + Ewk_Context* context, const char* extensible_api); + +/** + * Toggles tizen extensible api enable and disable + * + * @param context context object + * @param extensible_api extensible API name of every kind + * @param enable enable or disable tizen extensible api + * + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_tizen_extensible_api_string_set( + Ewk_Context* context, const char* extensible_api, Eina_Bool enable); + +/** + * Toggles tizen extensible api enable and disable + * + * @param context context object + * @param extensibleAPI extensible API of every kind + * @param enable enable or disable tizen extensible api + * + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise + */ +EINA_DEPRECATED EXPORT_API Eina_Bool ewk_context_tizen_extensible_api_set( + Ewk_Context* context, Ewk_Extensible_API extensible_api, Eina_Bool enable); + +/** + * Get tizen extensible api enable state + * + * @param context context object + * @param extensibleAPI extensible API of every kind + * * + * @return @c EINA_TRUE if the extensibleAPI set as true or @c EINA_FALSE + * otherwise + */ +EINA_DEPRECATED EXPORT_API Eina_Bool ewk_context_tizen_extensible_api_get( + Ewk_Context* ewkContext, Ewk_Extensible_API extensibleAPI); + +/** + * Reset storage path such as web storage, web database, application cache and + * so on + * + * @param context context object + * + */ +EXPORT_API void ewk_context_storage_path_reset(Ewk_Context* ewkContext); + +/** + * Sets the given id for the pixmap + * + * @param context context object + * @param pixmap id + * + * @return @c EINA_TRUE if the pixmap set successfully, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_pixmap_set(Ewk_Context* context, int pixmap); + +/** + * Start the inspector server + * + * @param context context object + * @param port number + * + * @return @c return the port number + */ +EXPORT_API unsigned int ewk_context_inspector_server_start(Ewk_Context* context, + unsigned int port); + +/** + * Stop the inspector server + * + * @param context context object + * + * @return @c EINA_TRUE if the inspector server stop set successfully, @c + * EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_inspector_server_stop(Ewk_Context* context); + +///------- belows are extension of chromium-ewk --------------------------- + +/** + * Gets the id for the pixmap + * + * @param context context object + * + * @return @c id for the pixmap. On error default return is 0. + */ +EXPORT_API int ewk_context_pixmap_get(Ewk_Context* context); + +EINA_DEPRECATED EXPORT_API void ewk_send_widget_info(Ewk_Context* context, + const char* tizen_id, + double scale, + const char* theme, + const char* encodedBundle); + +/** + * Sets tizen application id for @a context. + * + * Must be called before loading content in order to call + * DynamicPluginStartSession of injected bundle. + * + * @param context context object + * @param tizen_app_id tizen application id + */ +EXPORT_API void ewk_context_tizen_app_id_set(Ewk_Context* context, + const char* tizen_app_id); + +/** + * Sets tizen application version for @a context. + * + * Must be called after use ewk_context_tizen_app_id_set + * or ewk_send_widget_info beacuse need drop the process + * privillage and set dynamic plugin. + * + * @param context context object + * @param tizen_app_version tizen application version + * + * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_tizen_app_version_set( + Ewk_Context* context, const char* tizen_app_version); + +/** + * Gets the application cache manager instance for this @a context. + * + * @param context context object to query. + * + * @return Ewk_Cookie_Manager object instance or @c NULL in case of failure. + */ +EXPORT_API Ewk_Application_Cache_Manager* +ewk_context_application_cache_manager_get(const Ewk_Context* context); + +/** + * Gets the favicon database instance for this @a context. + * + * @param context context object to query. + * + * @return Ewk_Favicon_Database object instance or @c NULL in case of failure. + */ +EXPORT_API Ewk_Favicon_Database* ewk_context_favicon_database_get( + const Ewk_Context* context); + +/** + * Sets the favicon database directory for this @a context. + * + * Sets the directory path to be used to store the favicons database + * for @a context on disk. Passing @c NULL as @a directory_path will + * result in using the default directory for the platform. + * + * Calling this method also means enabling the favicons database for + * its use from the applications, it is therefore expected to be + * called only once. Further calls for the same instance of + * @a context will not have any effect. + * + * @param context context object to update + * @param directory_path database directory path to set + * + * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_favicon_database_directory_set( + Ewk_Context* context, const char* directory_path); + +/** + * Gets the storage manager instance for this @a context. + * + * @param context context object to query. + * + * @return Ewk_Storage_Manager object instance or @c NULL in case of failure. + */ +EXPORT_API Ewk_Storage_Manager* ewk_context_storage_manager_get( + const Ewk_Context* context); + +/** + * Requests for deleting all web databases. + * + * @param context context object + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_web_database_delete_all(Ewk_Context* context); + +/** + * Sets app_control. + * + * @param context context object + * @param app_control app_control handle. + * + * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise + * + */ +EXPORT_API Eina_Bool ewk_context_app_control_set(const Ewk_Context* context, + void* app_control); + +EXPORT_API Eina_Bool ewk_context_notification_callbacks_set( + Ewk_Context* context, Ewk_Context_Notification_Show_Callback show_callback, + Ewk_Context_Notification_Cancel_Callback cancel_callback, void* user_data); + +EXPORT_API Eina_Bool +ewk_context_notification_callbacks_reset(Ewk_Context* context); + +/** + * Set time offset + * + * @param context context object + * @param timeOffset The value will be added to system time as offset, it will + * be used for adjusting JS Date, certificate, cookie, animation etc. + * + */ +EXPORT_API void ewk_context_time_offset_set(Ewk_Context* context, + double time_offset); + +/** + * Set timezone offset + * + * @param context context object + * @param timezoneOffset The value will be used to set tz ENV. + * @param daylightSavingTime The value is for daylight saving time use, and will + * be used to set tz ENV. + * + */ +EXPORT_API void ewk_context_timezone_offset_set(Ewk_Context* context, + double time_zone_offset, + double daylight_saving_time); + +/** + * Sets max refresh rate for @a context. + * + * @param context context object + * @param max_refresh_rate screen FPS will not exceed max_refresh_rate. It can + * be from @c 1 to @c 60 + */ +EXPORT_API void ewk_context_max_refresh_rate_set(Ewk_Context* context, + int max_refresh_rate); + +enum _Ewk_Audio_Latency_Mode { + EWK_AUDIO_LATENCY_MODE_LOW = 0, /**< Low audio latency mode */ + EWK_AUDIO_LATENCY_MODE_MID, /**< Middle audio latency mode */ + EWK_AUDIO_LATENCY_MODE_HIGH, /**< High audio latency mode */ + EWK_AUDIO_LATENCY_MODE_ERROR = -1 /** Error */ +}; + +typedef enum _Ewk_Audio_Latency_Mode Ewk_Audio_Latency_Mode; + +/** + * @brief Set the mode of audio latency. + * + * @since_tizen 3.0 + * + * @param[in] context context object + * @param[in] latency_mode Ewk_Audio_Latency_Mode + * + * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_audio_latency_mode_set( + Ewk_Context* context, Ewk_Audio_Latency_Mode latency_mode); + +/** + * @brief Get the mode of audio latency. + * + * @since_tizen 3.0 + * + * @param[in] context context object + * + * @return @c Ewk_Audio_Latency_Mode if successful, @c + * EWK_AUDIO_LATENCY_MODE_ERROR otherwise + */ +EXPORT_API Ewk_Audio_Latency_Mode +ewk_context_audio_latency_mode_get(Ewk_Context* context); + +/** + * @typedef Ewk_Push_Message_Cb + * @brief Type definition for a function that will be called back when send + * web_push_message request receiveed from the web_push controller. + */ +typedef void (*Ewk_Push_Message_Cb)(const char* sender_id, + const char* push_data, void* user_data); + +/** + * Sets web push callbacks to handle the web push message + * + * To stop web push events, you may call this function with @c + * NULL for the callbacks. + * + * @param context context object to set vibration client callbacks. + * @param push call function when the send the web push message from the + * controller (may be @c NULL). + * @param user_data User data (may be @c NULL). + * + * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_push_message_callback_set( + Ewk_Context* context, Ewk_Push_Message_Cb callback, void* user_data); + +/** + * Sends the web push message to control web push events. + * + * @param context context object to set vibration client callbacks. + * @param push_data User data (may be @c NULL). + * + * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_send_push_message(Ewk_Context* context, + const char* push_data); + +/** + * Result callback for @a ewk_context_service_worker_register api. + * + * @param context context object + * @param scope_url scope url for which service worker registration was called + * @param script_url service worker script url + * @param result @c EINA_TRUE on success or @c EINA_FALSE on failure + * @param user_data user data passed to @a ewk_context_service_worker_register + * api + */ +typedef void (*Ewk_Context_Service_Worker_Registration_Result_Callback)( + Ewk_Context* context, const char* scope_url, const char* script_url, + Eina_Bool result, void* user_data); + +/** + * Register service worker for scope. It allows to register third party service + * workers also. + * + * @param context context object + * @param scope_url scope url for which service worker should be registered + * @param script_url service worker script url + * @param result_callback result callback + * @param user_data user data to be passed to @a result_callback + */ +EXPORT_API void ewk_context_service_worker_register( + Ewk_Context* context, const char* scope_url, const char* script_url, + Ewk_Context_Service_Worker_Registration_Result_Callback result_callback, + void* user_data); + +/** + * Result callback for @a ewk_context_service_worker_unregister api. + * + * @param context context object + * @param scope_url scope url for which service worker unregistration was called + * @param result @c EINA_TRUE on success or @c EINA_FALSE on failure + * @param user_data user data passed to @a ewk_context_service_worker_unregister + * api + */ +typedef void (*Ewk_Context_Service_Worker_Unregistration_Result_Callback)( + Ewk_Context* context, const char* scope_url, Eina_Bool result, + void* user_data); + +/** + * Unregister service worker for scope. + * + * @param context context object + * @param scope_url scope url for which service worker should be registered + * @param result_callback result callback + * @param user_data user data to be passed to @a result_callback + */ +EXPORT_API void ewk_context_service_worker_unregister( + Ewk_Context* context, const char* scope_url, + Ewk_Context_Service_Worker_Unregistration_Result_Callback result_callback, + void* user_data); + +/** + * Sets whether to allow app control scheme(appcontrol://) or not. + * + * @since_tizen 5.0 + * + * @param[in] context context object to enable/disable app control scheme + * @param[in] enabled a state to set + * + */ +EXPORT_API void ewk_context_enable_app_control(Ewk_Context* context, + Eina_Bool enabled); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_context_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context_menu.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context_menu.h new file mode 100644 index 000000000..f57b58b1f --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context_menu.h @@ -0,0 +1,319 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * @file ewk_context_menu.h + * @brief Describes the context menu API. + */ + +#ifndef ewk_context_menu_h +#define ewk_context_menu_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + * @{ + */ + +/** + * \enum _Ewk_Context_Menu_Item_Tag + * @brief Enumeration that provides the tags of items for the context menu. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif + */ +enum _Ewk_Context_Menu_Item_Tag { + EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION = 0, /**< No action */ + EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK_IN_NEW_WINDOW, /**< Open link in new + window */ + EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_LINK_TO_DISK, /**< Download link to disk */ + EWK_CONTEXT_MENU_ITEM_TAG_COPY_LINK_TO_CLIPBOARD, /**< Copy link to clipboard + */ + EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW, /**< Open image in new + window */ + EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_CURRENT_WINDOW, /**< Open image in + current window */ + EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_IMAGE_TO_DISK, /**< Download image to disk + */ + EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_TO_CLIPBOARD, /**< Copy image to + clipboard */ + EWK_CONTEXT_MENU_ITEM_TAG_OPEN_FRAME_IN_NEW_WINDOW, /**< Open frame in new + window */ + EWK_CONTEXT_MENU_ITEM_TAG_COPY, /**< Copy */ + EWK_CONTEXT_MENU_ITEM_TAG_GO_BACK, /**< Go back */ + EWK_CONTEXT_MENU_ITEM_TAG_GO_FORWARD, /**< Go forward */ + EWK_CONTEXT_MENU_ITEM_TAG_STOP, /**< Stop */ + EWK_CONTEXT_MENU_ITEM_TAG_SHARE, /**< Share */ + EWK_CONTEXT_MENU_ITEM_TAG_RELOAD, /**< Reload */ + EWK_CONTEXT_MENU_ITEM_TAG_CUT, /**< Cut */ + EWK_CONTEXT_MENU_ITEM_TAG_PASTE, /**< Paste */ + EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_GUESS, /**< Spelling guess */ + EWK_CONTEXT_MENU_ITEM_TAG_NO_GUESSES_FOUND, /**< Guess found */ + EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_SPELLING, /**< Ignore spelling */ + EWK_CONTEXT_MENU_ITEM_TAG_LEARN_SPELLING, /**< Learn spelling */ + EWK_CONTEXT_MENU_ITEM_TAG_OTHER, /**< Other */ + EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_IN_SPOTLIGHT, /**< Search in spotlight */ + EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB, /**< Search web */ + EWK_CONTEXT_MENU_ITEM_TAG_LOOK_UP_IN_DICTIONARY, /**< Look up in dictionary */ + EWK_CONTEXT_MENU_ITEM_TAG_OPEN_WITH_DEFAULT_APPLICATION, /**< Open with + default + application */ + EWK_CONTEXT_MENU_ITEM_TAG_PDF_ACTUAL_SIZE, /**< PDF actual size */ + EWK_CONTEXT_MENU_ITEM_TAG_PDF_ZOOM_IN, /**< PDF zoom in */ + EWK_CONTEXT_MENU_ITEM_TAG_PDF_ZOOM_OUT, /**< PDF zoom out */ + EWK_CONTEXT_MENU_ITEM_TAG_PDF_AUTO_SIZE, /**< PDF auto size */ + EWK_CONTEXT_MENU_ITEM_TAG_PDF_SINGLE_PAGE, /**< PDF single page */ + EWK_CONTEXT_MENU_ITEM_TAG_PDF_FACTING_PAGES, /**< PDF facting page */ + EWK_CONTEXT_MENU_ITEM_TAG_PDF_CONTINUOUS, /**< PDF continuous */ + EWK_CONTEXT_MENU_ITEM_TAG_PDF_NEXT_PAGE, /**< PDF next page */ + EWK_CONTEXT_MENU_ITEM_TAG_PDF_PREVIOUS_PAGE, /**< PDF previous page */ + EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK, /**< Open link */ + EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_GRAMMAR, /**< Ignore grammar */ + EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_MENU, /**< Spelling menu */ + EWK_CONTEXT_MENU_ITEM_TAG_SHOW_SPELLING_PANEL, /**< Show spelling panel */ + EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING, /**< Check spelling */ + EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING_WHILE_TYPING, /**< Check spelling + white typing */ + EWK_CONTEXT_MENU_ITEM_TAG_CHECK_GRAMMAR_WITH_SPELLING, /**< Check grammar with + spelling */ + EWK_CONTEXT_MENU_ITEM_TAG_FONT_MENU, /**< Font menu */ + EWK_CONTEXT_MENU_ITEM_TAG_SHOW_FONTS, /**< Show fonts */ + EWK_CONTEXT_MENU_ITEM_TAG_BOLD, /**< Bold */ + EWK_CONTEXT_MENU_ITEM_TAG_ITALIC, /**< Italic */ + EWK_CONTEXT_MENU_ITEM_TAG_UNDERLINE, /**< Underline */ + EWK_CONTEXT_MENU_ITEM_TAG_OUTLINE, /**< Outline */ + EWK_CONTEXT_MENU_ITEM_TAG_STYLES, /**< Style */ + EWK_CONTEXT_MENU_ITEM_TAG_SHOW_COLORS, /**< Show colors */ + EWK_CONTEXT_MENU_ITEM_TAG_SPEECH_MENU, /**< Speech menu */ + EWK_CONTEXT_MENU_ITEM_TAG_START_SPEAKING, /**< Start speaking */ + EWK_CONTEXT_MENU_ITEM_TAG_STOP_SPEAKING, /**< Stop speaking */ + EWK_CONTEXT_MENU_ITEM_TAG_WRITING_DIRECTION_MENU, /**< Writing direction menu + */ + EWK_CONTEXT_MENU_ITEM_TAG_DEFAULT_DIRECTION, /**< Default direction */ + EWK_CONTEXT_MENU_ITEM_TAG_LEFT_TO_RIGHT, /**< Left to right */ + EWK_CONTEXT_MENU_ITEM_TAG_RIGHT_TO_LEFT, /**< Right to left */ + EWK_CONTEXT_MENU_ITEM_TAG_PDF_SINGLE_PAGE_SCROLLING, /**< PDF single page + scrolling */ + EWK_CONTEXT_MENU_ITEM_TAG_PDF_FACING_PAGES_SCROLLING, /**< PDF facing page + scrolling */ + EWK_CONTEXT_MENU_ITEM_TAG_INSPECT_ELEMENT, /**< Inspect element */ + EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_MENU, /**< Text direction menu */ + EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_DEFAULT, /**< Text direction default + */ + EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_LEFT_TO_RIGHT, /**< Text direction + left to right */ + EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_RIGHT_TO_LEFT, /**< Text direction + right to left */ + EWK_CONTEXT_MENU_ITEM_TAG_CORRECT_SPELLING_AUTOMATICALLY, /**< Correct + spelling + automatically */ + EWK_CONTEXT_MENU_ITEM_TAG_SUBSTITUTIONS_MENU, /**< Substitutions menu */ + EWK_CONTEXT_MENU_ITEM_TAG_SHOW_SUBSTITUTIONS, /**< Show substitutions */ + EWK_CONTEXT_MENU_ITEM_TAG_SMART_COPY_PASTE, /**< Smart copy paste */ + EWK_CONTEXT_MENU_ITEM_TAG_SMART_QUOTES, /**< Smart quotes */ + EWK_CONTEXT_MENU_ITEM_TAG_SMART_DASHES, /**< Smart dashes */ + EWK_CONTEXT_MENU_ITEM_TAG_SMART_LINKS, /**< Smart links */ + EWK_CONTEXT_MENU_ITEM_TAG_TEXT_REPLACEMENT, /**< Text replacement */ + EWK_CONTEXT_MENU_ITEM_TAG_TRANSFORMATIONS_MENU, /**< Transformation menu */ + EWK_CONTEXT_MENU_ITEM_TAG_MAKE_UPPER_CASE, /**< Make upper case */ + EWK_CONTEXT_MENU_ITEM_TAG_MAKE_LOWER_CASE, /**< Make lower case */ + EWK_CONTEXT_MENU_ITEM_TAG_CAPITALIZE, /**< Capitalize */ + EWK_CONTEXT_MENU_ITEM_TAG_CHANGE_BACK, /**< Change back */ + EWK_CONTEXT_MENU_ITEM_TAG_OPEN_MEDIA_IN_NEW_WINDOW, /**< Open media in new + window */ + EWK_CONTEXT_MENU_ITEM_TAG_COPY_MEDIA_LINK_TO_CLIPBOARD, /**< Copy media link + to clipboard */ + EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_CONTROLS, /**< Toggle media controls */ + EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_LOOP, /**< Toggle media loop */ + EWK_CONTEXT_MENU_ITEM_TAG_ENTER_VIDEO_FULLSCREEN, /**< Enter video fullscreen + */ + EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_PLAY_PAUSE, /**< Media play pause */ + EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_MUTE, /**< Media mute */ + EWK_CONTEXT_MENU_ITEM_TAG_DICTATION_ALTERNATIVE, /**< Dictation alternative */ + EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL, /**< Select all */ + EWK_CONTEXT_MENU_ITEM_TAG_SELECT_WORD, /**< Select word */ + EWK_CONTEXT_MENU_ITEM_TAG_TEXT_SELECTION_MODE, /**< Text selection mode */ + EWK_CONTEXT_MENU_ITEM_TAG_CLIPBOARD, /**< Clipboard */ + EWK_CONTEXT_MENU_ITEM_TAG_DRAG, /**< Drag */ + EWK_CONTEXT_MENU_ITEM_TAG_TRANSLATE, /**< Translate */ + EWK_CONTEXT_MENU_ITEM_TAG_COPY_LINK_DATA, /**< Copy link data */ + EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG = + 10000 /**< If app want to add customized item, use enum value after + #EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG */ +}; + +/** + * @brief The structure type that creates a type name for + * Ewk_Context_Menu_Item_Tag. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif + */ +typedef uint32_t Ewk_Context_Menu_Item_Tag; + +/** + * @brief The structure type that creates a type name for _Ewk_Context_Menu. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif + */ +typedef struct _Ewk_Context_Menu Ewk_Context_Menu; + +/** + * @brief The structure type that creates a type name for + * _Ewk_Context_Menu_Item. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif + */ +typedef struct _Ewk_Context_Menu_Item Ewk_Context_Menu_Item; + +/** + * @brief Counts the number of the context menu item. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif + * + * @param[in] menu The context menu object + * + * @return The number of current context menu item + */ +EXPORT_API unsigned ewk_context_menu_item_count(Ewk_Context_Menu* menu); + +/** + * @brief Returns the nth item in a context menu. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif + * + * @param[in] menu The context menu object + * @param[in] n The number of the item + * + * @return The nth item of context menu + */ +EXPORT_API Ewk_Context_Menu_Item* ewk_context_menu_nth_item_get( + Ewk_Context_Menu* menu, unsigned int n); + +/** + * @brief Removes the context menu item from the context menu object. + * + * @remarks If all context menu items are removed, neither context menu nor\n + * selection handles will be shown. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif + * + * @param[in] menu The context menu object + * @param[in] item The context menu item to remove + * + * @return @c EINA_TRUE on successful request,\n + * otherwise @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_menu_item_remove(Ewk_Context_Menu* menu, + Ewk_Context_Menu_Item* item); + +/** + * @if MOBILE + * @brief Adds the context menu item to the context menu object. + * + * @since_tizen 2.3 + * + * @param[in] menu The context menu object + * @param[in] tag The tag of context menu item + * @param[in] title The title of context menu item + * @param[in] enabled If @c true the context menu item is enabled,\n + * otherwise @c false + * + * @return @c EINA_TRUE on successful request,\n + * otherwise @c EINA_FALSE on failure + * @endif + */ +EXPORT_API Eina_Bool ewk_context_menu_item_append_as_action( + Ewk_Context_Menu* menu, Ewk_Context_Menu_Item_Tag tag, const char* title, + Eina_Bool enabled); + +/** + * @if MOBILE + * @brief Adds the context menu item to the context menu object. + * + * @since_tizen 2.3 + * + * @param[in] menu The context menu object + * @param[in] tag The tag of context menu item + * @param[in] title The title of context menu item + * @param[in] icon_file The path of icon to be set on context menu item + * @param[in] enabled If @c true the context menu item is enabled,\n + * otherwise @c false + * + * @return @c EINA_TRUE on successful request,\n + * otherwise @c EINA_FALSE on failure + * @endif + */ +EXPORT_API Eina_Bool ewk_context_menu_item_append(Ewk_Context_Menu* menu, + Ewk_Context_Menu_Item_Tag tag, + const char* title, + const char* icon_file, + Eina_Bool enabled); + +/** + * @brief Returns the tag of context menu item. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif + * + * @param[in] item The context menu item object + * + * @return The tag of context menu item + */ +EXPORT_API Ewk_Context_Menu_Item_Tag +ewk_context_menu_item_tag_get(Ewk_Context_Menu_Item* item); + +/** + * @if MOBILE + * @brief Returns the link url string of context menu item. + * + * @since_tizen 2.3 + * + * @param[in] item The context menu item object + * + * @return The current link url string on success,\n + * otherwise @c 0 on failure + * @endif + */ +EXPORT_API const char* ewk_context_menu_item_link_url_get( + Ewk_Context_Menu_Item* item); + +/** + * @if MOBILE + * @brief Returns the image url string of context menu item. + * + * @since_tizen 2.3 + * + * @param[in] item The context menu item object + * + * @return The current image url string on success,\n + * otherwise @c 0 on failure + * @endif + */ +EXPORT_API const char* ewk_context_menu_item_image_url_get( + Ewk_Context_Menu_Item* item); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif // ewk_context_menu_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context_menu_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context_menu_internal.h new file mode 100644 index 000000000..266d1f1b4 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context_menu_internal.h @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_context_menu_internal.h + * @brief Describes the context menu API. + */ + +#ifndef ewk_context_menu_internal_h +#define ewk_context_menu_internal_h + +#include "ewk_context_menu.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \enum _Ewk_Context_Menu_Item_Type + * @brief Enumeration that defines the types of the items for the context + * menu. + */ +enum _Ewk_Context_Menu_Item_Type { + EWK_CONTEXT_MENU_ITEM_TYPE_ACTION, + EWK_CONTEXT_MENU_ITEM_TYPE_CHECKABLE_ACTION, + EWK_CONTEXT_MENU_ITEM_TYPE_SEPARATOR, + EWK_CONTEXT_MENU_ITEM_TYPE_SUBMENU +}; + +/** + * @brief Creates a type name for _Ewk_Context_Menu_Item_Type + */ +typedef enum _Ewk_Context_Menu_Item_Type Ewk_Context_Menu_Item_Type; + +/** + * Returns the type of context menu item. + * + * @param item The context menu item object + * + * @return The type of context menu item + */ +EXPORT_API Ewk_Context_Menu_Item_Type +ewk_context_menu_item_type_get(Ewk_Context_Menu_Item* item); + +/** + * Returns the item is enabled. + * + * @param item The context menu item object to get enabled state + * + * @return EINA_TRUE if it is enabled, @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool +ewk_context_menu_item_enabled_get(const Ewk_Context_Menu_Item* item); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_context_menu_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context_menu_product.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context_menu_product.h new file mode 100644 index 000000000..d599e8c48 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context_menu_product.h @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_context_menu_product.h + * @brief Describes the context menu product API. + */ + +#ifndef ewk_context_menu_product_h +#define ewk_context_menu_product_h + +#include "ewk_context_menu_internal.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief The enum of Ewk_Context_Menu_Item_Tag for additional item tags + * @since_tizen 2.4.0.2 + */ + +enum _Ewk_Context_Menu_New_Item_Tag { + EWK_CONTEXT_MENU_ITEM_NEW_TAGS = 9000, + EWK_CONTEXT_MENU_ITEM_TAG_QUICKMEMO, + EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK_IN_BACKGROUND +}; + +/** + * Gets a title of the item. + * + * @param item the item to get the title + * @return a title of the item on success, or @c NULL on failure + * + * @see ewk_context_menu_item_title_set + */ +EXPORT_API const char *ewk_context_menu_item_title_get( + const Ewk_Context_Menu_Item *item); + +/** + * Queries if the item is toggled. + * + * @param item the item to query if the item is toggled + * @return @c EINA_TRUE if the item is toggled or @c EINA_FALSE if not or on + * failure + */ +EXPORT_API Eina_Bool +ewk_context_menu_item_checked_get(const Ewk_Context_Menu_Item *item); + +/** + * Gets the submenu for the item. + * + * @param item item to get the submenu + * + * @return the pointer to submenu on success or @c NULL on failure + */ +EXPORT_API Ewk_Context_Menu *ewk_context_menu_item_submenu_get( + const Ewk_Context_Menu_Item *item); + +/** + * Gets the list of items. + * + * @param o the context menu to get list of the items + * @return the list of the items on success or @c NULL on failure + */ +EXPORT_API const Eina_List *ewk_context_menu_items_get( + const Ewk_Context_Menu *o); + +/** + * Gets the parent menu for the item. + * + * @param o item to get the parent + * + * @return the pointer to parent menu on success or @c NULL on failure + */ +EXPORT_API Ewk_Context_Menu *ewk_context_menu_item_parent_menu_get( + const Ewk_Context_Menu_Item *o); + +/** + * Selects the item from the context menu. + * + * @param menu the context menu + * @param item the item is selected + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_menu_item_select(Ewk_Context_Menu *menu, + Ewk_Context_Menu_Item *item); + +/** + * Hides the context menu. + * + * @param menu the context menu to hide + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_menu_hide(Ewk_Context_Menu *menu); + +#if defined(OS_TIZEN_TV) +/** + * Gets the x_position of context menu. + * + * @param menu the context menu to get x_position + * @return the x_position of context menu on success or @c 0 on failure + */ +EXPORT_API int ewk_context_menu_pos_x_get(Ewk_Context_Menu *menu); + +/** + * Gets the y_position of context menu. + * + * @param menu the context menu to get y_position + * @return the y_position of context menu on success or @c 0 on failure + */ +EXPORT_API int ewk_context_menu_pos_y_get(Ewk_Context_Menu *menu); +#endif // OS_TIZEN_TV + +#ifdef __cplusplus +} +#endif + +#endif // ewk_context_menu_product_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context_product.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context_product.h new file mode 100644 index 000000000..4faea23ff --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_context_product.h @@ -0,0 +1,932 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_context_product.h + * @brief Describes the context API. + * + * @note ewk_context encapsulates all pages related to specific use of + * Chromium-efl + * + * Applications have the option of creating a context different than the default + * one and use it for a group of pages. All pages in the same context share the + * same preferences, visited link set, local storage, etc. + * + * A process model can be specified per context. The default one is the shared + * model where the web-engine process is shared among the pages in the context. + * The second model allows each page to use a separate web-engine process. + * This latter model is currently not supported by Chromium-efl. + * + */ + +#ifndef ewk_context_product_h +#define ewk_context_product_h + +#include + +#include "ewk_context_internal.h" + +#ifdef __cplusplus +extern "C" { +#endif + +enum _Ewk_Application_Type { + EWK_APPLICATION_TYPE_WEBBROWSER = 0, + EWK_APPLICATION_TYPE_HBBTV = 1, + EWK_APPLICATION_TYPE_TIZENWRT = 2, + EWK_APPLICATION_TYPE_OTHER = 3 +}; + +typedef enum _Ewk_Application_Type Ewk_Application_Type; + +/** + * @brief Enumeration for password popup option. + * @since_tizen 2.3 + */ +enum Ewk_Context_Password_Popup_Option { + EWK_CONTEXT_PASSWORD_POPUP_SAVE, /**< The option of response */ + EWK_CONTEXT_PASSWORD_POPUP_NOT_NOW, /**< The option of response */ + EWK_CONTEXT_PASSWORD_POPUP_NEVER /**< The option of response */ +}; +/** + * @brief Creates a type name for @a Ewk_Context_Password_Popup_Option. + * @since_tizen 2.3 + */ +typedef enum Ewk_Context_Password_Popup_Option + Ewk_Context_Password_Popup_Option; + +/** + * Callback to check a file request is allowed for specific tizen app id + * + * @param tizen_app_id Tizen app id. + * @param url The url for the file request. + * @return @c EINA_TRUE if the url can access or @c EINA_FALSE otherwise. + */ +typedef Eina_Bool (*Ewk_Context_Check_Accessible_Path_Callback)( + const char* tizen_app_id, const char* url, void* user_data); + +/** + * @brief Sets the given proxy to network backend of specific context. + * Proxy string and bypass_rule string follow rules of proxy_config.h + * Note that, it does not support username:password. If proxy string + * contains username:password, the proxy setting will not work. + * default auth setting see @c ewk_context_proxy_default_auth_set api + * + * @since_tizen 2.3 + * + * @param[in] context context object to set proxy + * @param[in] proxy URI to set + * @param[in] bypass rule to set + */ +EXPORT_API void ewk_context_proxy_set(Ewk_Context* context, const char* proxy, + const char* bypass_rule); + +/** + * @brief Gets the proxy URI from the network backend of specific context. + * + * @details It returns an internal string and should not\n + * be modified. The string is guaranteed to be stringshared. + * until next call of @c ewk_context_proxy_set api + * or @a context is destroyed. + * + * @since_tizen 2.3 + * + * @param[in] context context object to get proxy URI + * + * @return current proxy URI or @c NULL if it's not set + * + * @see ewk_context_proxy_set + */ +EXPORT_API const char* ewk_context_proxy_uri_get(Ewk_Context* context); + +/** + * @brief Sets the given proxy URI to network backend of specific context. + * + * @since_tizen 2.3 + * + * @param[in] context object to set proxy URI + * @param[in] proxy URI to set + */ +EXPORT_API void ewk_context_proxy_uri_set(Ewk_Context* context, + const char* proxy); + +/** + * @brief Gets the proxy bypass rule from the network backend of specific + * context. + * + * @details It returns an internal string and should not + * be modified. The string is guaranteed to be stringshared, + * until next call of @c ewk_context_proxy_set api + * or @a context is destroyed. + * + * @since_tizen 3.0 + * + * @param[in] context context object to get proxy bypass rule + * + * @return current proxy bypass rule or @c NULL if it's not set + * + * @see ewk_context_proxy_set + */ +EXPORT_API const char* ewk_context_proxy_bypass_rule_get(Ewk_Context* context); + +/* + * Set a new max size for URL in Tizen APP. + * + * Must be called before loading URL. + * + * @param context context object + * @param max_chars max chars for url + */ +EXPORT_API void ewk_context_url_maxchars_set(Ewk_Context* context, + size_t max_chars); + +/** + * @brief Sets a proxy auth credential to network backend of specific context. + * + * @details Normally, proxy auth credential should be got from the callback + * set by ewk_view_authentication_callback_set, once the username in + * this API has been set with a non-null value, the authentication + * callback will never been invoked. Try to avoid using this API. + * + * @since_tizen 3.0 + * + * @param[in] context context object to set proxy + * @param[in] username username to set + * @param[in] password password to set + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_proxy_default_auth_set(Ewk_Context* context, + const char* username, + const char* password); + +/** + * @brief Callback for ewk_context_local_file_system_origins_get + * + * @since_tizen 2.3 + * + * @param[in] origins local file system origins + * @param[in] user_data user_data will be passsed when + * ewk_context_local_file_system_origins_get is called + */ +typedef void (*Ewk_Local_File_System_Origins_Get_Callback)(Eina_List* origins, + void* user_data); + +/** + * @brief Callback for ewk_context_web_database_quota_for_origin_get. + * + * @since_tizen 2.3 + * + * @param[in] quota web database quota + * @param[in] user_data user_data will be passsed when + * ewk_context_web_database_quota_for_origin_get is called + */ +typedef void (*Ewk_Web_Database_Quota_Get_Callback)(uint64_t quota, + void* user_data); + +/** + * @brief Callback for ewk_context_web_storage_origins_get. + * + * @since_tizen 2.3 + * + * @param[in] origins web storage origins + * @param[in] user_data user_data will be passsed when + * ewk_context_web_storage_origins_get is called + */ +typedef void (*Ewk_Web_Storage_Origins_Get_Callback)(Eina_List* origins, + void* user_data); + +/** + * @brief Callback for ewk_context_web_database_usage_for_origin_get. + * + * @since_tizen 2.3 + * + * @param[in] usage web database usage + * @param[in] user_data user_data will be passsed when + * ewk_context_web_database_usage_for_origin_get is called + */ +typedef void (*Ewk_Web_Database_Usage_Get_Callback)(uint64_t usage, + void* user_data); + +/** + * @brief Callback for ewk_context_web_storage_usage_for_origin_get. + * + * @since_tizen 2.3 + * + * @param[in] usage usage of web storage + * @param[in] user_data user_data will be passsed when + * ewk_context_web_storage_usage_for_origin_get is called + */ +typedef void (*Ewk_Web_Storage_Usage_Get_Callback)(uint64_t usage, + void* user_data); + +/** + * @brief Callback for didStartDownload + * + * @since_tizen 2.3 + * + * @param[in] download_url url to download + * @param[in] user_data user_data will be passsed when download is started + */ +typedef void (*Ewk_Context_Did_Start_Download_Callback)( + const char* download_url, void* user_data); + +/** + * @brief Callback for passworSaveConfirmPopupCallbackCall + * + * @since_tizen 2.3 + * + * @param[in] view current view + * @param[in] user_data user_data will be passsed when password save confirm + * popup show + */ +typedef void (*Ewk_Context_Password_Confirm_Popup_Callback)(Evas_Object* view, + void* user_data); + +/** + * @brief Sets callback for show password confirm popup. + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] callback callback for show password confirm popup + * @param[in] user_data user data + */ +EXPORT_API void ewk_context_password_confirm_popup_callback_set( + Ewk_Context* context, Ewk_Context_Password_Confirm_Popup_Callback callback, + void* user_data); + +/** + * @brief Password confirm popup reply + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] result The option of response + */ +EXPORT_API void ewk_context_password_confirm_popup_reply( + Ewk_Context* context, Ewk_Context_Password_Popup_Option result); + +/** + * @brief Requests for setting application cache quota for origin. + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] origin serucity origin + * @param[in] quota size of quota + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_application_cache_quota_for_origin_set( + Ewk_Context* context, const Ewk_Security_Origin* origin, int64_t quota); + +/** + * @brief Requests for deleting all local file systems. + * + * @since_tizen 2.3 + * + * @param[in] context context object + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool +ewk_context_local_file_system_all_delete(Ewk_Context* context); + +/** + * @brief Requests for deleting local file system for origin. + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] origin local file system origin + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_local_file_system_delete( + Ewk_Context* context, Ewk_Security_Origin* origin); + +/** + * @brief Requests for getting local file system origins. + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] callback callback to get local file system origins + * @param[in] user_data user_data will be passed when callback is called\n + * -I.e., user data will be kept until callback is called + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + * + * @see ewk_context_origins_free + */ +EXPORT_API Eina_Bool ewk_context_local_file_system_origins_get( + const Ewk_Context* context, + Ewk_Local_File_System_Origins_Get_Callback callback, void* user_data); + +/** + * @brief Requests for deleting web databases for origin. + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] origin database origin + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_web_database_delete( + Ewk_Context* context, Ewk_Security_Origin* origin); + +/** + * @brief Requests for setting web database quota for origin. + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] origin database origin + * @param[in] quota size of quota + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_web_database_quota_for_origin_set( + Ewk_Context* context, Ewk_Security_Origin* origin, uint64_t quota); + +/** + * @brief Deletes origin that is stored in web storage db. + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] origin origin of db + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_web_storage_origin_delete( + Ewk_Context* context, Ewk_Security_Origin* origin); + +/** + * @brief Gets list of origins that is stored in web storage db. + * + * @details This function allocates memory for context structure made from + * callback and user_data. + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] callback callback to get web storage origins + * @param[in] user_data user_data will be passed when callback is called\n + * -I.e., user data will be kept until callback is called + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure + * + * @see ewk_context_origins_free() + */ +EXPORT_API Eina_Bool ewk_context_web_storage_origins_get( + Ewk_Context* context, Ewk_Web_Storage_Origins_Get_Callback callback, + void* user_data); + +/** + * @brief Gets usage of web storage for certain origin. + * + * @details This function allocates memory for context structure made from + * callback and user_data. + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] origin security origin + * @param[in] callback callback to get web storage usage + * @param[in] user_data user_data will be passed when callback is called\n + * -I.e., user data will be kept until callback is called + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_web_storage_usage_for_origin_get( + Ewk_Context* context, Ewk_Security_Origin* origin, + Ewk_Web_Storage_Usage_Get_Callback callback, void* user_data); + +/** + * @brief Queries if the cache is enabled + * + * @since_tizen 2.3 + * + * @param[in] context context object + * + * @return @c EINA_TRUE is cache is enabled or @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_cache_disabled_get(const Ewk_Context* context); + +/** + * @brief start memory sampler. + * + * @since_tizen 2.3 + * + * @details This function is for logging of memory usage. The log file will be + * created in /tmp path. Sample is gathered every second until the + * specified interval has passed, 0 for infinite. + * + * @param[in] context context object + * @param[in] timer_interval time in seconds after which sampler should + * stop gathering the measurement + */ +EXPORT_API void ewk_context_memory_sampler_start(Ewk_Context* context, + double timer_interval); + +/** + * @brief stop memory sampler. + * + * @param[in] context context object + */ +EXPORT_API void ewk_context_memory_sampler_stop(Ewk_Context* context); + +/** + * @brief Callback for ewk_context_vibration_client_callbacks_set + * + * @since_tizen 2.3 + * + * @details Type definition for a function that will be called back when vibrate + * request receiveed from the vibration controller. + * + * @param[in] vibration_time the number of vibration times + * @param[in] user_data user_data will be passsed when + * ewk_context_vibration_client_callbacks_set is called + */ +typedef void (*Ewk_Vibration_Client_Vibrate_Cb)(uint64_t vibration_time, + void* user_data); + +/** + * @brief Callback for ewk_context_vibration_client_callbacks_set + * + * @since_tizen 2.3 + * + * @details Type definition for a function that will be called back when cancel + * vibration request receiveed from the vibration controller. + * + * @param[in] user_data user_data will be passsed when + * ewk_context_vibration_client_callbacks_set is called + */ +typedef void (*Ewk_Vibration_Client_Vibration_Cancel_Cb)(void* user_data); + +/** + * @brief Sets memory saving mode. + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] mode or disable memory saving mode + * + */ +EXPORT_API void ewk_context_memory_saving_mode_set(Ewk_Context* context, + Eina_Bool mode); + +/** + * @brief Struct for password data + * @since_tizen 2.3 + */ +struct Ewk_Password_Data { + char* url; + Eina_Bool useFingerprint; +}; + +/** + * @brief Deletes password data from DB for given URL + * + * @details The API will delete the a password data from DB. + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] url url saved form password + * + * @see ewk_context_form_password_data_list_free + * @see ewk_context_form_password_data_list_get + */ +EXPORT_API void ewk_context_form_password_data_delete(Ewk_Context* context, + const char* url); + +/** + * @brief Callback for ewk_context_form_password_data_list_get + * + * @since_tizen 3.0 + * + * @param[in] list list of Ewk_Password_Data + * @param[in] user_data user_data will be passed when + * ewk_context_form_password_data_list_get is called + */ +typedef void (*Ewk_Context_Form_Password_Data_List_Get_Callback)( + Eina_List* list, void* user_data); + +/** + * @brief Asynchronous request to get list of all password data + * + * @since_tizen 3.0 + * + * @param[in] context context object + * @param[in] callback callback to get list of password data + * @param[in] user_data user data will be passed when callback is called + * + * @see ewk_context_form_password_data_delete + * @see ewk_context_form_password_data_list_free + */ +EXPORT_API void ewk_context_form_password_data_list_get( + Ewk_Context* context, + Ewk_Context_Form_Password_Data_List_Get_Callback callback, void* user_data); + +/** + * @brief Deletes a given password data list + * + * @details The API will delete the a password data list only from the memory.\n + * To remove the password data for URL permenantly, + * use ewk_context_form_password_data_delete + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] list Eina_List with Ewk_Password_Data + * + * @see ewk_context_form_password_data_delete + * @see ewk_context_form_password_data_list_get + */ +EXPORT_API void ewk_context_form_password_data_list_free(Ewk_Context* context, + Eina_List* list); + +/** + * @brief Requests setting of the favicon database path. + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] path database path + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_icon_database_path_set(Ewk_Context* context, + const char* path); + +/** + * @brief Deletes all known icons from database. + * + * @since_tizen 2.3 + * + * @param[in] context context object + */ +EXPORT_API void ewk_context_icon_database_delete_all(Ewk_Context* context); + +/** + * @brief Requests for getting web database quota for origin. + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] callback callback to get web database quota + * @param[in] user_data user_data will be passed when callback is called\n + * -I.e., user data will be kept until callback is called + * @param[in] origin database origin + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_web_database_quota_for_origin_get( + Ewk_Context* context, Ewk_Web_Database_Quota_Get_Callback callback, + void* user_data, Ewk_Security_Origin* origin); + +/** + * @brief Requests for getting web application cache origins. + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] callback callback to get web application cache origins + * @param[in] user_data user_data will be passsed when callback is called + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + * + * @see ewk_context_origins_free + */ +EXPORT_API Eina_Bool ewk_context_application_cache_origins_get( + Ewk_Context* context, + Ewk_Web_Application_Cache_Origins_Get_Callback callback, void* user_data); + +/** + * To declare application type + * + * @param context context object + * @param applicationType The Ewk_Application_Type enum + * + */ +EXPORT_API void ewk_context_application_type_set( + Ewk_Context* ewkContext, const Ewk_Application_Type applicationType); + +/** + * @brief Returns the application type. + * + * @param[in] context The context object + * + * @return #Ewk_Application_Type + */ +EXPORT_API Ewk_Application_Type +ewk_context_application_type_get(Ewk_Context* ewkContext); + +EXPORT_API void ewk_context_form_candidate_data_clear(Ewk_Context* ewkContext); + +EXPORT_API void ewk_context_form_password_data_clear(Ewk_Context* ewkContext); + +/** + * Requests for setting application memory cache capacities. + * + * @param ewk_context context object + * @param cache_min_dead_capacity set min dead memory cache value + * @param cache_max_dead_capacity set max dead memory cache value + * @param cache_total_capacity set total memory cache value + * + */ +EXPORT_API void ewk_context_cache_model_memory_cache_capacities_set( + Ewk_Context* ewk_context, uint32_t cache_min_dead_capacity, + uint32_t cache_max_dead_capacity, uint32_t cache_total_capacity); + +/** + * Requests for getting application page cache capacity. + * + * @param ewk_context context object + * @param cache_value the page memory cache value + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_cache_model_page_cache_capacity_get( + Ewk_Context* ewk_context, uint32_t* cache_value); + +/** + * Requests for setting application page cache capacity. + * + * @param ewk_context context object + * @param capacity set page memory cache capacity value + */ +EXPORT_API void ewk_context_cache_model_page_cache_capacity_set( + Ewk_Context* ewk_context, uint32_t capacity); + +/** + * Requests for application memory cache capacity. + * + * @param ewk_context context object + * @param capacity_value the memory cache capacity value + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_cache_model_memory_cache_capacity_get( + Ewk_Context* ewk_context, uint32_t* capacity_value); + +/** + * Requests for application memory min dead capacity. + * + * @param ewk_context context object + * @param capacity_value the memory min dead capacity value + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_cache_model_memory_min_dead_capacity_get( + Ewk_Context* ewk_context, uint32_t* capacity_value); + +/** + * Requests for application memory max dead capacity. + * + * @param ewk_context context object + * @param capacity_value the memory max dead capacity value + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_cache_model_memory_max_dead_capacity_get( + Ewk_Context* ewk_context, uint32_t* capacity_value); + +/** + * @brief Sets default zoom factor + * + * Sets default zoom factor for all pages opened with this context. Default + * zoom can be overridden with ewk_view_page_zoom_set on per page basis. + * + * @since_tizen 3.0 + * + * @param[in] context context object + * @param[in] zoom_factor default zoom factor + */ +EXPORT_API void ewk_context_default_zoom_factor_set(Ewk_Context* context, + double zoom_factor); + +/** + * @brief Gets default zoom factor + * + * Gets default zoom factor for all pages opened with this context. + * + * @since_tizen 3.0 + * + * @param[in] context context object + * + * @return @c default zoom factor or negative value on error + */ +EXPORT_API double ewk_context_default_zoom_factor_get(Ewk_Context* context); + +/** + * @brief Sets callback for checking file request accessibility. When requested + * to load a file, need to invoke the callback to check whether the file + * path is accessible + * + * @param context context object + * @param callback The callback of Ewk_Context_Check_Accessible_Path_Callback + * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_context_check_accessible_path_callback_set( + Ewk_Context* context, Ewk_Context_Check_Accessible_Path_Callback callback, + void* user_data); + +/** + * @brief Registers url schemes as CORS enabled. It is applied + * for all the pages opened within the context. + * This API is supposed to be used by Web frameworks, + * not by Web browser application. + * + * @param context context object + * @param schemes The URL schemes list which will be added to + * web security policy as valid schemes to pass CORS check. + * + */ +EXPORT_API void ewk_context_register_url_schemes_as_cors_enabled( + Ewk_Context* context, const Eina_List* schemes); + +/** + * @brief Register JS plugin mime types. It is applied + * for all the pages opened within the context. + * The API is intended to be used by web applications to + * override default behaviour of the object tag. + * + * @param context context object + * @param mime_types The MIME types will be checked by the renderer frame loader + * to skip creating default frame for the object tags + * with the registered MIME type. + */ +EXPORT_API void ewk_context_register_jsplugin_mime_types( + Ewk_Context* context, const Eina_List* mime_types); + +/** + * Sets callback for started download. + * + * @param context context object + * @param callback callback for started download + * @param user_data user data + */ +EXPORT_API void ewk_context_did_start_download_callback_set( + Ewk_Context* context, Ewk_Context_Did_Start_Download_Callback callback, + void* user_data); + +/** + * Sets vibration client callbacks to handle the tactile feedback in the form of + * vibration in the client application when the content asks for vibration. + * + * To stop listening for vibration events, you may call this function with @c + * @param vibrate The function to call when the vibrate request received from + * the controller (may be @c NULL). + * @param cancel The function to call when the cancel vibration request received + * from the controller (may be @c NULL). + * @param data User data (may be @c NULL). + */ +EXPORT_API void ewk_context_vibration_client_callbacks_set( + Ewk_Context* context, Ewk_Vibration_Client_Vibrate_Cb vibrate, + Ewk_Vibration_Client_Vibration_Cancel_Cb cancel, void* data); + +/** + * @brief Set WebSDI. + * To use WebSDI for client authentication, + * 'web-sdi' metadata need to be added in config.xml of each app. + * In that case, XWalk will call ewk_context_websdi_set API with true + * value. + * + * @param enable true means app wants to get a Client Certificate as WebSDI, + * otherwise, false + */ +EXPORT_API void ewk_context_websdi_set(Eina_Bool enable); + +EXPORT_API Eina_Bool ewk_context_websdi_get(); + +/** + * @brief Set disable nosniff. + * Some apps have the wrong "Content-Type" in response header and + * at the same time, set "X-Content-Type-Options:nosniff" which + * don't allow WebCore to sniff the right content type + * + *since_tizen 3.0 + * + * + * @param context context object. + * @param enable true means app wants to disable nosniff, + * otherwise, false + */ +EXPORT_API void ewk_context_disable_nosniff_set(Ewk_Context* context, + Eina_Bool enable); + +/** + * @brief Set EMP Certificate file. + * First, Try to check a empCAPath and load certificate files in a + * empCAPath. If there is no file or it is not valid file, Try to load + * certificate files in a defaultCAPath. + * + * @param context context object. + * @param empCAPath Path to certificate files downloaded via EMP + * @param defaultCAPath Path to certificate files have been used + */ +EXPORT_API void ewk_context_emp_certificate_file_set( + Ewk_Context* context, const char* emp_ca_path, const char* default_ca_path); + +/** + * @brief Requests for getting web database usage for origin. + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] callback callback to get web database usage + * @param[in] user_data user_data will be passed when callback is called\n + * -I.e., user data will be kept until callback is called + * @param[in] origin database origin + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_context_web_database_usage_for_origin_get( + Ewk_Context* context, Ewk_Web_Database_Usage_Get_Callback callback, + void* user_data, Ewk_Security_Origin* origin); + +/** + * @brief Updates use fingerprint value from DB for given URL + * + * @details The API will update use fingerprint value on DB for given URL. + * + * @since_tizen 2.3 + * + * @param[in] context context object + * @param[in] url url saved form password + * @param[in] useFingerprint fingerprint for given URL will be used or not + * + * @see ewk_context_form_password_data_list_free + * @see ewk_context_form_password_data_delete + * @see ewk_context_form_password_data_list_get + */ +EXPORT_API void ewk_context_form_password_data_update(Ewk_Context* context, + const char* url, + Eina_Bool useFingerprint); + +/** + * @brief Sets the list of preferred languages. + * + * @details This function sets the list of preferred langages.\n + * This list will be used to build the "Accept-Language" header that + * will be included in the network requests.\n + * The client can pass @c NULL for languages to clear what is set + * before. + * + * @since_tizen 2.3 + * + * @remarks All contexts will be affected. + * + * @param[in] languages The list of preferred languages (char* as data),\n + * otherwise @c NULL + */ +EXPORT_API void ewk_context_preferred_languages_set(Eina_List* languages); + +/** + * Sets PWA storage path @a context. + * + * @param context context object + * @param pwa_storage_path PWA storage path + * + * @return @c EINA_TRUE if the pwa_storage_path set successfully, @c EINA_FALSE + * otherwise + */ +EXPORT_API Eina_Bool ewk_context_pwa_storage_path_set( + Ewk_Context* context, const char* pwa_storage_path); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif // ewk_context_product_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_cookie_manager.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_cookie_manager.h new file mode 100644 index 000000000..cf1e236bd --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_cookie_manager.h @@ -0,0 +1,196 @@ +/* + * Copyright (C) 2012 Intel Corporation. + * Copyright (C) 2013-2016 Samsung Electronics. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * @file ewk_cookie_manager.h + * @brief This file describes the Ewk Cookie Manager API. + */ + +#ifndef ewk_cookie_manager_h +#define ewk_cookie_manager_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + * @{ + */ + +/** + * @brief The structure type that creates a type name for #Ewk_Cookie_Manager. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + */ +typedef struct Ewk_Cookie_Manager Ewk_Cookie_Manager; + +/** + * \enum Ewk_Cookie_Accept_Policy + * + * @brief Enumeration that contains accept policies for the cookies. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + */ +enum Ewk_Cookie_Accept_Policy { + EWK_COOKIE_ACCEPT_POLICY_ALWAYS, /**< Accepts every cookie sent from any page + */ + EWK_COOKIE_ACCEPT_POLICY_NEVER, /**< Rejects all cookies */ + EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY /**< Accepts only cookies set by the + main document loaded */ +}; + +/** + * @brief Enumeration that creates a type name for the Ewk_Cookie_Accept_Policy. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + */ +typedef enum Ewk_Cookie_Accept_Policy Ewk_Cookie_Accept_Policy; + +/** + * @brief Sets @a policy as the cookie acceptance policy for @a manager. + * + * @details By default, only cookies set by the main document loaded are + * accepted. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] manager The cookie manager to update + * @param[in] policy A #Ewk_Cookie_Accept_Policy + */ +EXPORT_API void ewk_cookie_manager_accept_policy_set( + Ewk_Cookie_Manager* manager, Ewk_Cookie_Accept_Policy policy); + +/** + * @brief Called for use with ewk_cookie_manager_accept_policy_async_get(). + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] policy A #Ewk_Cookie_Accept_Policy + * @param[in] event_info The user data that will be passed when + * ewk_cookie_manager_accept_policy_async_get() is called + */ +typedef void (*Ewk_Cookie_Manager_Policy_Async_Get_Cb)( + Ewk_Cookie_Accept_Policy policy, void* event_info); + +/** + * @brief Gets the cookie acceptance policy of @a manager asynchronously. + * + * @details By default, only cookies set by the main document loaded are + * accepted. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] manager The cookie manager to query + * @param[in] callback The function to call when the policy is received + * @param[in] data The user data (may be @c NULL) + */ +EXPORT_API void ewk_cookie_manager_accept_policy_async_get( + const Ewk_Cookie_Manager* manager, + Ewk_Cookie_Manager_Policy_Async_Get_Cb callback, void* data); + +/** + * @brief Deletes all the cookies of @a manager. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] manager The cookie manager to update + */ +EXPORT_API void ewk_cookie_manager_cookies_clear(Ewk_Cookie_Manager* manager); + +/** + * @brief Queries if the cookie manager allows cookies for file scheme URLs. + * + * @since_tizen 3.0 + * + * @param[in] manager The cookie manager to query + * + * @return @c EINA_TRUE if cookies for file scheme are allowed or @c EINA_FALSE + * otherwise + */ +EXPORT_API Eina_Bool +ewk_cookie_manager_file_scheme_cookies_allow_get(Ewk_Cookie_Manager* manager); + +/** + * @brief Sets whether cookie manager allows cookies for file scheme URLs. + * + * @since_tizen 3.0 + * + * @param[in] manager The cookie manager to allow file scheme for cookies + * @param[in] allow A state to set + */ +EXPORT_API void ewk_cookie_manager_file_scheme_cookies_allow_set( + Ewk_Cookie_Manager* manager, Eina_Bool allow); + +/** + * \enum Ewk_Cookie_Persistent_Storage + * @brief Enumeration that creates a type name for the + * #Ewk_Cookie_Persistent_Storage. + * @since_tizen 3.0 + */ +enum Ewk_Cookie_Persistent_Storage { + EWK_COOKIE_PERSISTENT_STORAGE_TEXT, /**< @deprecated Cookies are stored in a + text file in the Mozilla "cookies.txt" + format. (Deprecated since 6.0) */ + EWK_COOKIE_PERSISTENT_STORAGE_SQLITE /**< Cookies are stored in a SQLite file + in the current Mozilla format. */ +}; + +/** + * @brief The enum type that creates a type name for + * Ewk_Cookie_Persistent_Storage. + * @since_tizen 3.0 + */ +typedef enum Ewk_Cookie_Persistent_Storage Ewk_Cookie_Persistent_Storage; + +/** + * @brief Sets the @a path where non-session cookies are stored persistently + * using + * @a storage as the format to read/write the cookies. + * + * @details Cookies are initially read from @a path/Cookies to create an initial + * set of cookies. Then, non-session cookies will be written to @a + * path/Cookies. By default, @a manager doesn't store the cookies persistently, + * so you need to call this method to keep cookies saved across sessions. If @a + * path does not exist it will be created. + * + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output + * path is relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or + * output path is relevant to external storage. + * + * @since_tizen 3.0 + * + * @param[in] manager The cookie manager to update + * @param[in] path The path where to read/write Cookies + * @param[in] storage The type of storage + */ +EXPORT_API void ewk_cookie_manager_persistent_storage_set( + Ewk_Cookie_Manager* manager, const char* path, + Ewk_Cookie_Persistent_Storage storage); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif // ewk_cookie_manager_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_cookie_manager_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_cookie_manager_internal.h new file mode 100644 index 000000000..cb94e3539 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_cookie_manager_internal.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_cookie_manager_internal.h + * @brief Describes the Ewk Cookie Manager API. + */ + +#ifndef ewk_cookie_manager_internal_h +#define ewk_cookie_manager_internal_h + +#include "ewk_cookie_manager.h" +#include "ewk_error.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @typedef Ewk_Cookie_Manager_Async_Hostnames_Get_Cb + * Ewk_Cookie_Manager_Async_Hostnames_Get_Cb + * @brief Callback type for use with + * ewk_cookie_manager_async_hostnames_with_cookies_get + * + * @note The @a hostnames list items are guaranteed to be eina_stringshare. + * Whenever possible save yourself some cpu cycles and use + * eina_stringshare_ref() instead of eina_stringshare_add() or strdup(). + */ +typedef void (*Ewk_Cookie_Manager_Async_Hostnames_Get_Cb)(Eina_List *hostnames, + Ewk_Error *error, + void *event_info); + +/** + * Asynchronously get the list of host names for which @a manager contains + * cookies. + * + * @param manager The cookie manager to query. + * @param callback The function to call when the host names have been received. + * @param data User data (may be @c NULL). + */ +EXPORT_API void ewk_cookie_manager_async_hostnames_with_cookies_get( + const Ewk_Cookie_Manager *manager, + Ewk_Cookie_Manager_Async_Hostnames_Get_Cb callback, void *data); + +/** + * Remove all cookies of @a manager for the given @a hostname. + * + * @param manager The cookie manager to update. + * @param hostname A host name. + */ +EXPORT_API void ewk_cookie_manager_hostname_cookies_clear( + Ewk_Cookie_Manager *manager, const char *hostname); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_cookie_manager_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_cookie_manager_product.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_cookie_manager_product.h new file mode 100644 index 000000000..c1e20a195 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_cookie_manager_product.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_cookie_manager_product.h + * @brief Describes the Ewk Cookie Manager product API. + */ + +#ifndef ewk_cookie_manager_product_h +#define ewk_cookie_manager_product_h + +#include "ewk_cookie_manager.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @typedef Ewk_Cookie_Manager_Changes_Watch_Cb + * Ewk_Cookie_Manager_Changes_Watch_Cb + * @brief Callback type for use with ewk_cookie_manager_changes_watch() + * @warning Callback is not called on UI thread, so user should be cautious + * when accessing their data also used on UI thread. + */ +typedef void (*Ewk_Cookie_Manager_Changes_Watch_Cb)(void *event_info); + +/** + * Watch for cookies' changes in @a manager. + * + * Pass @c NULL as value for @a callback to stop watching for changes. + * + * When the cookie is modified, it actually is deleted and added again so + * the callback is called twice. User data provided to the API is passed + * to callback function as a parameter. Callback function is not informed + * about action type (add/delete) and does not get any identification + * information about it (like page URL or cookie name). + * + * @param manager The cookie manager to watch. + * @param callback function that will be called every time cookies are added, + * removed or modified. + * @param data User data (may be @c NULL). + */ +EXPORT_API void ewk_cookie_manager_changes_watch( + Ewk_Cookie_Manager *manager, Ewk_Cookie_Manager_Changes_Watch_Cb callback, + void *data); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_cookie_manager_product_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_cookie_parser.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_cookie_parser.h new file mode 100644 index 000000000..8a4416b87 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_cookie_parser.h @@ -0,0 +1,78 @@ +/** + * @file ewk_cookie_parser + * @brief EWK Cookie Parser + * + * This class exposes the Chromium cookie parser. It allows + * for ewk components to handle cookie-alike structures without + * re-inventing the wheel. + * + * Copyright 2020 by Samsung Electronics, Inc., + * + * This software is the confidential and proprietary information + * of Samsung Electronics, Inc. ("Confidential Information"). You + * shall not disclose such Confidential Information and shall use + * it only in accordance with the terms of the license agreement + * you entered into with Samsung. + */ + +#ifndef __EWK_COOKIE_PARSER_H__ +#define __EWK_COOKIE_PARSER_H__ + +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + */ + +/** + * @brief This structure is used to return the contents of the parsed cookie. + * This structure is used a bridge between the Chromium cookie handling code + * and the calling application. + */ +struct EWKCookieContents { + time_t expiry_date_utc; + std::string domain; + std::string name; + std::string path; + std::string value; +}; + +/** + * @brief Parses a Cookie String and Returns the Contents. + * + * @details The application can use this function use the internal Cookie + * parsing code to decode cookie strings. This allows the calling + * application to manage non-standard cookies without effecting the + * security policies that have been set up in Chromium. These can be + * used for non-standard schemes the may want to use cookies. + * + * The cookie is only treated as valid if it should be readably by a + * javascript function. I.e. if the HttpOnly and Secure flags are not + * set. It is the responsibility of the calling application to check to + * see if the cookies expiry_date has expired. + * + * NOTE: if the cookie has an expiry_date == 0 then the cookie should + * be treated as a session cookie. + * + * @since_tizen 4.0 + * + * @param[in] cookie_str The cookie string to be decoded. + * @param[out] cookie The decoded cookie data. + * + * @return @c true if the cookie string is value, else false. + */ +EXPORT_API Eina_Bool ewk_parse_cookie(const std::string& cookie_str, + EWKCookieContents& cookie); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_custom_handlers_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_custom_handlers_internal.h new file mode 100644 index 000000000..1232a6cf3 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_custom_handlers_internal.h @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2012-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_custom_handlers_internal.h + * @brief Custom scheme and content handlers. + * (http://www.w3.org/TR/html5/timers.html#custom-handlers) + */ + +#ifndef ewk_custom_handlers_internal_h +#define ewk_custom_handlers_internal_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct Ewk_Custom_Handlers_Data Ewk_Custom_Handlers_Data; + +/// Defines the handler states. +enum _Ewk_Custom_Handlers_State { + /// Indicates that no attempt has been made to register the given handler. + EWK_CUSTOM_HANDLERS_NEW, + /// Indicates that the given handler has been registered or that the site is + /// blocked from registering the handler. + EWK_CUSTOM_HANDLERS_REGISTERED, + /// Indicates that the given handler has been offered but was rejected. + EWK_CUSTOM_HANDLERS_DECLINED +}; + +/// Creates a type name for @a _Ewk_Custom_Handlers_State. +typedef enum _Ewk_Custom_Handlers_State Ewk_Custom_Handlers_State; + +/** + * Get target(scheme or mime type) of custom handlers. + * + * @param data custom handlers's structure. + * + * @return @c target (scheme or mime type). + */ +EINA_DEPRECATED EXPORT_API Eina_Stringshare* +ewk_custom_handlers_data_target_get(const Ewk_Custom_Handlers_Data* data); + +/** + * Get base url of custom handlers. + * + * @param data custom handlers's structure. + * + * @return @c base url. + */ +EINA_DEPRECATED EXPORT_API Eina_Stringshare* +ewk_custom_handlers_data_base_url_get(const Ewk_Custom_Handlers_Data* data); + +/** + * Get url of custom handlers. + * + * @param data custom handlers's structure. + * + * @return @c url. + */ +EINA_DEPRECATED EXPORT_API Eina_Stringshare* ewk_custom_handlers_data_url_get( + const Ewk_Custom_Handlers_Data* data); + +/** + * Get title of custom handlers. + * + * @param data custom handlers's structure. + * + * @return @c title. + */ +EINA_DEPRECATED EXPORT_API Eina_Stringshare* ewk_custom_handlers_data_title_get( + const Ewk_Custom_Handlers_Data* data); + +/** + * Set result of isProtocolRegistered API. + * + * @param data custom handlers's structure + * @param result(Ewk_Custom_Handlers_State) of isProtocolRegistered and + * isContentRegistered API + */ +EINA_DEPRECATED EXPORT_API void ewk_custom_handlers_data_result_set( + Ewk_Custom_Handlers_Data* data, Ewk_Custom_Handlers_State result); +#ifdef __cplusplus +} +#endif +#endif // ewk_custom_handlers_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_dispatcher_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_dispatcher_internal.h new file mode 100644 index 000000000..b2e831424 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_dispatcher_internal.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_dispatcher_internal_h +#define ewk_dispatcher_internal_h + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*ewk_dispatch_callback)(void *); + +/** + * Call once from the thread you want the dispatcher work on. + * It should be main thread usually. + * + */ +EXPORT_API void ewk_dispatcher_touch(); + +EXPORT_API void ewk_dispatcher_dispatch(ewk_dispatch_callback cb, + void *user_data, unsigned delay); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_dispatcher_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_enums_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_enums_internal.h new file mode 100644 index 000000000..eb9de8215 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_enums_internal.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_enums_internal_h +#define ewk_enums_internal_h + +#ifdef __cplusplus +extern "C" { +#endif + +// #if OS(TIZEN) +/// Represents types of gesture. +enum _Ewk_Gesture_Type { + EWK_GESTURE_TAP, + EWK_GESTURE_LONG_PRESS, + EWK_GESTURE_PAN, + EWK_GESTURE_FLICK, + EWK_GESTURE_PINCH +}; +/// Creates a type name for @a _Ewk_Gesture_Type. +typedef enum _Ewk_Gesture_Type Ewk_Gesture_Type; +// #endif // #if OS(TIZEN) + +//#if ENABLE(TIZEN_ORIENTATION_EVENTS) +enum _Ewk_Screen_Orientation { + EWK_SCREEN_ORIENTATION_PORTRAIT_PRIMARY = 1, + EWK_SCREEN_ORIENTATION_LANDSCAPE_PRIMARY = 1 << 1, + EWK_SCREEN_ORIENTATION_PORTRAIT_SECONDARY = 1 << 2, + EWK_SCREEN_ORIENTATION_LANDSCAPE_SECONDARY = 1 << 3 +}; +typedef enum _Ewk_Screen_Orientation Ewk_Screen_Orientation; +//#endif + +#ifdef __cplusplus +} +#endif + +#endif // ewk_enums_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_error.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_error.h new file mode 100644 index 000000000..6f6044709 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_error.h @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2012 Intel Corporation. + * Copyright (C) 2013-2016 Samsung Electronics. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * @file ewk_error.h + * @brief This file describes the Ewk Web Error API. + */ + +#ifndef ewk_error_h +#define ewk_error_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + * @{ + */ + +/** + * @if MOBILE + * @brief The structure type that creates a type name for #Ewk_Error. + * @since_tizen 2.3 + * @endif + */ +typedef struct _Ewk_Error Ewk_Error; + +/** + * @if MOBILE + * \enum Ewk_Error_Code + * @brief Enumeration that provides an option to error codes. + * @since_tizen 2.3 + * @endif + */ +typedef enum { + EWK_ERROR_CODE_UNKNOWN, /**< Unknown */ + EWK_ERROR_CODE_CANCELED, /**< User canceled */ + EWK_ERROR_CODE_CANT_SUPPORT_MIMETYPE, + /**< Can't show page for this MIME Type */ + EWK_ERROR_CODE_FAILED_FILE_IO, /**< Error */ + EWK_ERROR_CODE_CANT_CONNECT, /**< Cannot connect to Network */ + EWK_ERROR_CODE_CANT_LOOKUP_HOST, /**< Fail to look up host from DNS */ + EWK_ERROR_CODE_FAILED_TLS_HANDSHAKE, /**< Fail to SSL/TLS handshake */ + EWK_ERROR_CODE_INVALID_CERTIFICATE, /**< Received certificate is invalid */ + EWK_ERROR_CODE_REQUEST_TIMEOUT, /**< Connection timeout */ + EWK_ERROR_CODE_TOO_MANY_REDIRECTS, /**< Too many redirects */ + EWK_ERROR_CODE_TOO_MANY_REQUESTS, /**< Too many requests during this load */ + EWK_ERROR_CODE_BAD_URL, /**< Malformed url */ + EWK_ERROR_CODE_UNSUPPORTED_SCHEME, /**< Unsupported scheme */ + EWK_ERROR_CODE_AUTHENTICATION, /**< User authentication failed on server */ + EWK_ERROR_CODE_INTERNAL_SERVER, /**< Web server has internal server error */ + EWK_ERROR_CODE_CANNOTSHOWMIMETYPE = 100, + EWK_ERROR_CODE_CANNOTSHOWURL, + EWK_ERROR_CODE_FRAMELOADINTERRUPTEDBYPOLICYCHANGE, + EWK_ERROR_CODE_CANNOTUSERESTRICTEDPORT, + EWK_ERROR_CODE_CANNOTFINDPLUGIN = 200, + EWK_ERROR_CODE_CANNOTLOADPLUGIN, + EWK_ERROR_CODE_JAVAUNAVAILABLE, + EWK_ERROR_CODE_PLUGINCANCELLEDCONNECTION, + EWK_ERROR_CODE_PLUGINWILLHANDLELOAD, +} Ewk_Error_Code; + +/** + * @if MOBILE + * @brief Query failing URL for this error. + * + * @details URL that failed loading. + * + * @since_tizen 2.3 + * + * @param[in] error The error object to query + * + * @return The URL pointer, that may be @c NULL. This pointer is\n + * guaranteed to be eina_stringshare, so whenever possible\n + * save yourself some cpu cycles and use\n + * eina_stringshare_ref() instead of eina_stringshare_add() or\n + * strdup() + * @endif + */ +EXPORT_API const char* ewk_error_url_get(const Ewk_Error* error); + +/** + * @if MOBILE + * @brief Query the error code. + * + * @since_tizen 2.3 + * + * @param[in] error The error object to query + * + * @return The error code #Ewk_Error_Code + * @endif + */ +EXPORT_API int ewk_error_code_get(const Ewk_Error* error); + +/** + * @if MOBILE + * @brief Query description for this error. + * + * @since_tizen 2.3 + * + * @param[in] error The error object to query + * + * @return The description pointer, that may be @c NULL. This pointer is\n + * guaranteed to be eina_stringshare, so whenever possible\n + * save yourself some cpu cycles and use\n + * eina_stringshare_ref() instead of eina_stringshare_add() or\n + * strdup() + * @endif + */ +EXPORT_API const char* ewk_error_description_get(const Ewk_Error* error); + +/** + * @if MOBILE + * @brief Query if error should be treated as a cancellation. + * + * @since_tizen 2.3 + * + * @param[in] error The error object to query + * + * @return @c EINA_TRUE if this error should be treated as a cancellation\n + * otherwise @c EINA_FALSE + * @endif + */ +EXPORT_API Eina_Bool ewk_error_cancellation_get(const Ewk_Error* error); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif // ewk_error_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_error_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_error_internal.h new file mode 100644 index 000000000..e1d2adb86 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_error_internal.h @@ -0,0 +1,201 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_error_internal.h + * @brief Describes the Web Error API. + */ + +#ifndef ewk_error_internal_h +#define ewk_error_internal_h + +#include "ewk_error.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// Creates a type name for Ewk_Error_Type. +typedef enum { + EWK_ERROR_TYPE_NONE, + EWK_ERROR_TYPE_INTERNAL, + EWK_ERROR_TYPE_NETWORK, + EWK_ERROR_TYPE_POLICY, + EWK_ERROR_TYPE_PLUGIN, + EWK_ERROR_TYPE_DOWNLOAD, + EWK_ERROR_TYPE_PRINT +} Ewk_Error_Type; + +typedef enum { + EWK_ERROR_NETWORK_STATUS_NONE, + + /* Transport Errors */ + EWK_ERROR_NETWORK_STATUS_CANCELLED = 1, + EWK_ERROR_NETWORK_STATUS_CANT_RESOLVE, + EWK_ERROR_NETWORK_STATUS_CANT_RESOLVE_PROXY, + EWK_ERROR_NETWORK_STATUS_CANT_CONNECT, + EWK_ERROR_NETWORK_STATUS_CANT_CONNECT_PROXY, + EWK_ERROR_NETWORK_STATUS_SSL_FAILED, + EWK_ERROR_NETWORK_STATUS_IO_ERROR, + EWK_ERROR_NETWORK_STATUS_MALFORMED, + EWK_ERROR_NETWORK_STATUS_TRY_AGAIN, + EWK_ERROR_NETWORK_STATUS_TOO_MANY_REDIRECTS, + EWK_ERROR_NETWORK_STATUS_TLS_FAILED, + + /* HTTP Status Codes */ + EWK_ERROR_NETWORK_STATUS_CONTINUE = 100, + EWK_ERROR_NETWORK_STATUS_SWITCHING_PROTOCOLS, + EWK_ERROR_NETWORK_STATUS_PROCESSING, + + EWK_ERROR_NETWORK_STATUS_OK = 200, + EWK_ERROR_NETWORK_STATUS_CREATED, + EWK_ERROR_NETWORK_STATUS_ACCEPTED, + EWK_ERROR_NETWORK_STATUS_NON_AUTHORITATIVE, + EWK_ERROR_NETWORK_STATUS_NO_CONTENT, + EWK_ERROR_NETWORK_STATUS_RESET_CONTENT, + EWK_ERROR_NETWORK_STATUS_PARTIAL_CONTENT, + EWK_ERROR_NETWORK_STATUS_MULTI_STATUS, + + EWK_ERROR_NETWORK_STATUS_MULTIPLE_CHOICES = 300, + EWK_ERROR_NETWORK_STATUS_MOVED_PERMANENTLY, + EWK_ERROR_NETWORK_STATUS_FOUND = 302, + EWK_ERROR_NETWORK_STATUS_MOVED_TEMPORARILY = 302, + EWK_ERROR_NETWORK_STATUS_SEE_OTHER, + EWK_ERROR_NETWORK_STATUS_NOT_MODIFIED, + EWK_ERROR_NETWORK_STATUS_USE_PROXY, + EWK_ERROR_NETWORK_STATUS_NOT_APPEARING_IN_THIS_PROTOCOL, + EWK_ERROR_NETWORK_STATUS_TEMPORARY_REDIRECT, + + EWK_ERROR_NETWORK_STATUS_BAD_REQUEST = 400, + EWK_ERROR_NETWORK_STATUS_UNAUTHORIZED, + EWK_ERROR_NETWORK_STATUS_PAYMENT_REQUIRED, + EWK_ERROR_NETWORK_STATUS_FORBIDDEN, + EWK_ERROR_NETWORK_STATUS_NOT_FOUND, + EWK_ERROR_NETWORK_STATUS_METHOD_NOT_ALLOWED, + EWK_ERROR_NETWORK_STATUS_NOT_ACCEPTABLE, + EWK_ERROR_NETWORK_STATUS_PROXY_AUTHENTICATION_REQUIRED, + EWK_ERROR_NETWORK_STATUS_PROXY_UNAUTHORIZED = + EWK_ERROR_NETWORK_STATUS_PROXY_AUTHENTICATION_REQUIRED, + EWK_ERROR_NETWORK_STATUS_REQUEST_TIMEOUT, + EWK_ERROR_NETWORK_STATUS_CONFLICT, + EWK_ERROR_NETWORK_STATUS_GONE, + EWK_ERROR_NETWORK_STATUS_LENGTH_REQUIRED, + EWK_ERROR_NETWORK_STATUS_PRECONDITION_FAILED, + EWK_ERROR_NETWORK_STATUS_REQUEST_ENTITY_TOO_LARGE, + EWK_ERROR_NETWORK_STATUS_REQUEST_URI_TOO_LONG, + EWK_ERROR_NETWORK_STATUS_UNSUPPORTED_MEDIA_TYPE, + EWK_ERROR_NETWORK_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE, + EWK_ERROR_NETWORK_STATUS_INVALID_RANGE = + EWK_ERROR_NETWORK_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE, + EWK_ERROR_NETWORK_STATUS_EXPECTATION_FAILED, + EWK_ERROR_NETWORK_STATUS_UNPROCESSABLE_ENTITY = 422, + EWK_ERROR_NETWORK_STATUS_LOCKED, + EWK_ERROR_NETWORK_STATUS_FAILED_DEPENDENCY, + + EWK_ERROR_NETWORK_STATUS_INTERNAL_SERVER_ERROR = 500, + EWK_ERROR_NETWORK_STATUS_NOT_IMPLEMENTED, + EWK_ERROR_NETWORK_STATUS_BAD_GATEWAY, + EWK_ERROR_NETWORK_STATUS_SERVICE_UNAVAILABLE, + EWK_ERROR_NETWORK_STATUS_GATEWAY_TIMEOUT, + EWK_ERROR_NETWORK_STATUS_HTTP_VERSION_NOT_SUPPORTED, + EWK_ERROR_NETWORK_STATUS_INSUFFICIENT_STORAGE = 507, + EWK_ERROR_NETWORK_STATUS_NOT_EXTENDED = 510 +} Ewk_Error_Network_Status; + +typedef enum { + EWK_ERROR_IO_CODE_FAILED, + EWK_ERROR_IO_CODE_NOT_FOUND, + EWK_ERROR_IO_CODE_EXISTS, + EWK_ERROR_IO_CODE_IS_DIRECTORY, + EWK_ERROR_IO_CODE_NOT_DIRECTORY, + EWK_ERROR_IO_CODE_NOT_EMPTY, + EWK_ERROR_IO_CODE_NOT_REGULAR_FILE, + EWK_ERROR_IO_CODE_NOT_SYMBOLIC_LINK, + EWK_ERROR_IO_CODE_NOT_MOUNTABLE_FILE, + EWK_ERROR_IO_CODE_FILENAME_TOO_LONG, + EWK_ERROR_IO_CODE_INVALID_FILENAME, + EWK_ERROR_IO_CODE_TOO_MANY_LINKS, + EWK_ERROR_IO_CODE_NO_SPACE, + EWK_ERROR_IO_CODE_INVALID_ARGUMENT, + EWK_ERROR_IO_CODE_PERMISSION_DENIED, + EWK_ERROR_IO_CODE_NOT_SUPPORTED, + EWK_ERROR_IO_CODE_NOT_MOUNTED, + EWK_ERROR_IO_CODE_ALREADY_MOUNTED, + EWK_ERROR_IO_CODE_CLOSED, + EWK_ERROR_IO_CODE_CANCELLED, + EWK_ERROR_IO_CODE_PENDING, + EWK_ERROR_IO_CODE_READ_ONLY, + EWK_ERROR_IO_CODE_CANT_CREATE_BACKUP, + EWK_ERROR_IO_CODE_WRONG_ETAG, + EWK_ERROR_IO_CODE_TIMED_OUT, + EWK_ERROR_IO_CODE_WOULD_RECURSE, + EWK_ERROR_IO_CODE_BUSY, + EWK_ERROR_IO_CODE_WOULD_BLOCK, + EWK_ERROR_IO_CODE_HOST_NOT_FOUND, + EWK_ERROR_IO_CODE_WOULD_MERGE, + EWK_ERROR_IO_CODE_FAILED_HANDLED, + EWK_ERROR_IO_CODE_TOO_MANY_OPEN_FILES, + EWK_ERROR_IO_CODE_NOT_INITIALIZED, + EWK_ERROR_IO_CODE_ADDRESS_IN_USE, + EWK_ERROR_IO_CODE_PARTIAL_INPUT, + EWK_ERROR_IO_CODE_INVALID_DATA, + EWK_ERROR_IO_CODE_DBUS_ERROR, + EWK_ERROR_IO_CODE_HOST_UNREACHABLE, + EWK_ERROR_IO_CODE_NETWORK_UNREACHABLE, + EWK_ERROR_IO_CODE_CONNECTION_REFUSED, + EWK_ERROR_IO_CODE_PROXY_FAILED, + EWK_ERROR_IO_CODE_PROXY_AUTH_FAILED, + EWK_ERROR_IO_CODE_PROXY_NEED_AUTH, + EWK_ERROR_IO_CODE_PROXY_NOT_ALLOWED +} Ewk_Error_Io_Code; + +/** + * Query type for this error. + * + * @param error error object to query. + * + * @return the error type, that may be @c NULL. This pointer is + * guaranteed to be eina_stringshare, so whenever possible + * save yourself some cpu cycles and use + * eina_stringshare_ref() instead of eina_stringshare_add() or + * strdup(). + */ +EXPORT_API Ewk_Error_Type ewk_error_type_get(const Ewk_Error* error); + +/** + * Returns domain from Ewk_Error. + * + * @param error Ewk_Error object received from "load,error" evas object smart + * callback + * + * @return @c domain string on success or empty string on failure + */ +EXPORT_API const char* ewk_error_domain_get(const Ewk_Error* error); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_error_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_export.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_export.h new file mode 100644 index 000000000..adc05152f --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_export.h @@ -0,0 +1,22 @@ +// Copyright 2013 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_EXPORT_H_ +#define EWK_EXPORT_H_ + +#ifdef EXPORT_API +#undef EXPORT_API +#endif + +#ifdef __GNUC__ +#if __GNUC__ >= 4 +#define EXPORT_API __attribute__((visibility("default"))) +#else +#define EXPORT_API +#endif +#else +#define EXPORT_API +#endif + +#endif // EWK_EXPORT_H diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_favicon_database_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_favicon_database_internal.h new file mode 100644 index 000000000..f637b71c0 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_favicon_database_internal.h @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * Copyright (C) 2014-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_favicon_database_internal.h + * @brief Describes the Ewk Favicon Database API. + */ + +#ifndef ewk_favicon_database_internal_h +#define ewk_favicon_database_internal_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for @a Ewk_Favicon_Database. */ +typedef struct EwkFaviconDatabase Ewk_Favicon_Database; + +/** + * @typedef Ewk_Favicon_Database_Icon_Change_Cb + * Ewk_Favicon_Database_Icon_Change_Cb + * @brief Callback type for use with + * ewk_favicon_database_icon_change_callback_add and + * ewk_favicon_database_icon_change_callback_del + */ +typedef void (*Ewk_Favicon_Database_Icon_Change_Cb)(const char *page_url, + void *event_info); + +/** + * Retrieves from the database the favicon for the given @a page_url + * + * @param database database object to query + * @param page_url URL of the page to get the favicon for + * @param evas The canvas to add the favicon to + * + * @return The favicon as an Evas_Object if successful, @c NULL otherwise. + * The returned Evas_Object needs to be freed after use. + */ +EXPORT_API Evas_Object *ewk_favicon_database_icon_get( + Ewk_Favicon_Database *database, const char *page_url, Evas *evas); + +/** + * Add (register) a callback function to a icon change event + * + * @param database database object to register the callback + * @param callback callback function to be called when an icon changes + * @param data the data pointer that was to be passed to the callback + */ +EXPORT_API void ewk_favicon_database_icon_change_callback_add( + Ewk_Favicon_Database *database, + Ewk_Favicon_Database_Icon_Change_Cb callback, void *data); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_favicon_database_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_file_chooser_request_product.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_file_chooser_request_product.h new file mode 100644 index 000000000..cc44185e3 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_file_chooser_request_product.h @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * Copyright (C) 2020 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_file_chooser_request_product.h + * @brief Describes the Ewk File Chooser API. + */ + +#ifndef EWK_EFL_INTEGRATION_PUBLIC_EWK_FILE_CHOOSER_REQUEST_PRODUCT_H_ +#define EWK_EFL_INTEGRATION_PUBLIC_EWK_FILE_CHOOSER_REQUEST_PRODUCT_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for Ewk_File_Chooser_Request */ +typedef struct _Ewk_File_Chooser_Request Ewk_File_Chooser_Request; + +/** + * Queries if it is allowed to select multiple files or not. + * + * @param request request object to query + * + * @return @c EINA_TRUE if it is allowed to select multiple files, + * @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_file_chooser_request_allow_multiple_files_get( + const Ewk_File_Chooser_Request* request); + +/** + * Queries the list of accepted MIME types. + * + * Possible MIME types are: + * - "audio\/\*": All sound files are accepted + * - "video\/\*": All video files are accepted + * - "image\/\*": All image files are accepted + * - standard IANA MIME type (see http://www.iana.org/assignments/media-types/ + * for a complete list) + * + * @param request request object to query + * + * @return The list of accepted MIME types. The list items are guaranteed to be + * stringshared. The caller needs to free the list and its items after use + */ +EXPORT_API Eina_List* ewk_file_chooser_request_accepted_mimetypes_get( + const Ewk_File_Chooser_Request* request); + +/** + * Cancels the file chooser request. + * + * @param request request object to cancel + * + * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool +ewk_file_chooser_request_cancel(Ewk_File_Chooser_Request* request); + +/** + * Sets the files chosen by the user. + * + * @param request request object to update + * + * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise + * + * @see ewk_file_chooser_request_file_choose() + */ +EXPORT_API Eina_Bool ewk_file_chooser_request_files_choose( + Ewk_File_Chooser_Request* request, const Eina_List* chosen_files); + +/** + * Sets the file chosen by the user. + * + * This is a convenience function in case only one file needs to be set. + * + * @param request request object to update + * + * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise + * + * @see ewk_file_chooser_request_files_choose() + */ +EXPORT_API Eina_Bool ewk_file_chooser_request_file_choose( + Ewk_File_Chooser_Request* request, const char* chosen_file); + +#ifdef __cplusplus +} +#endif + +#endif // EWK_EFL_INTEGRATION_PUBLIC_EWK_FILE_CHOOSER_REQUEST_PRODUCT_H_ diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_form_repost_decision_product.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_form_repost_decision_product.h new file mode 100644 index 000000000..3d60b6c6f --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_form_repost_decision_product.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2017 Samsung Electronics. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * @file ewk_form_repost_decision_product.h + * @brief This file describes the Ewk RepostForm API. + */ + +#ifndef ewk_form_repost_decision_product_h +#define ewk_form_repost_decision_product_h + +#include + +#include "tizen.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief The structure type that creates a type name for + * #Ewk_Form_Repost_Decision_Request + * + */ +typedef struct _Ewk_Form_Repost_Decision_Request + Ewk_Form_Repost_Decision_Request; + +/** + * Reply the result about form repost decision + * + * @param request Ewk_Form_Repost_Decision_Request object to get the + * information about repostform decision request. + * @param allow result about repostform decision request. + */ +EXPORT_API void ewk_form_repost_decision_request_reply( + Ewk_Form_Repost_Decision_Request* request, Eina_Bool allow); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_form_repost_decision_product_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_frame_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_frame_internal.h new file mode 100644 index 000000000..7f2c41809 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_frame_internal.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2012-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_frame_internal_h +#define ewk_frame_internal_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _Ewk_Frame _Ewk_Frame; + +typedef _Ewk_Frame* Ewk_Frame_Ref; + +/** + * Callback for ewk_frame_source_get + * + * @param frame frame object to get the frame source + * @param source frame source on success, or NULL on failure + * @param user_data user data + */ +typedef void (*Ewk_Frame_Source_Get_Callback)(Ewk_Frame_Ref frame, + const char* source, + void* user_data); + +/** + * Gets whether a MIME type can be displayed in the frame. + * + * @param frame frame object + * @param mime_type a mime type + * + * @return @c EINA_TRUE if the MIME type can be displayed or @c EINA_FALSE + * otherwise + */ +EXPORT_API Eina_Bool ewk_frame_can_show_mime_type(Ewk_Frame_Ref frame, + char* mime_type); + +/** + * Gets whether the frame is main frame. + * + * @param frame frame object + * + * @return @c EINA_TRUE if the frame is main frame or @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_frame_is_main_frame(Ewk_Frame_Ref frame); + +#ifdef __cplusplus +} +#endif +#endif // ewk_frame_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_geolocation.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_geolocation.h new file mode 100644 index 000000000..0a246f2c0 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_geolocation.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * @file ewk_geolocation.h + * @brief This file describes the Ewk Geolocation API. + */ + +#ifndef ewk_geolocation_h +#define ewk_geolocation_h + +#include +#include + +#include "ewk_security_origin.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + * @{ + */ + +/** + * @brief The structure type that creates a type name for + * #Ewk_Geolocation_Permission_Request. + * + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + */ +typedef struct _Ewk_Geolocation_Permission_Request + Ewk_Geolocation_Permission_Request; + +/** + * @brief Requests for getting origin of geolocation permission request. + * + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * + * @param[in] request Ewk_Geolocation_Permission_Request object to get origin + * + * @return security origin of geolocation permission data + */ +EXPORT_API const Ewk_Security_Origin * +ewk_geolocation_permission_request_origin_get( + const Ewk_Geolocation_Permission_Request *request); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif // ewk_geolocation_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_geolocation_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_geolocation_internal.h new file mode 100644 index 000000000..8fe44eb1e --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_geolocation_internal.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_geolocation_internal_h +#define ewk_geolocation_internal_h + +#include "ewk_geolocation.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Request to allow / deny the geolocation permission request + * + * @param request permission request to allow or deny permission + * @param allow allow or deny permission for geolocation + * + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_geolocation_permission_request_set( + Ewk_Geolocation_Permission_Request* request, Eina_Bool allow); + +/** + * Suspend the operation for permission request. + * + * This suspends the operation for permission request. + * This is very useful to decide the policy from the additional UI operation + * like the popup. + * + * @param request Ewk_Geolocation_Permission_Request object to suspend + * permission request + */ +EXPORT_API void ewk_geolocation_permission_request_suspend( + Ewk_Geolocation_Permission_Request* request); + +/** + * Reply the result about geolocation permission. + * + * @param request Ewk_Geolocation_Permission_Request object to get the + * information about geolocation permission request. + * @param allow result about geolocation permission + */ +EXPORT_API Eina_Bool ewk_geolocation_permission_reply( + Ewk_Geolocation_Permission_Request* request, Eina_Bool allow); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_geolocation_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_highcontrast_product.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_highcontrast_product.h new file mode 100644 index 000000000..6e84a182c --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_highcontrast_product.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_highcontrast_h +#define ewk_highcontrast_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Set enable/disable highcontrast. + * + * If highcontrast enabled, highcontrast controller listen system highcontrast + * configuration. + * + * @param enabled enable/disable set for high contrast + */ +EXPORT_API void ewk_highcontrast_enabled_set(Eina_Bool enabled); + +/** + * Returns current hightcontrast settings. + * + * @return EINA_TRUE if highcontrast enabled + */ +EXPORT_API Eina_Bool ewk_highcontrast_enabled_get(); + +/** + * Add highcontrast forbidden URL. + * + * If the current page's url contains this url, it should not use highcontrast + filter + * + * @param url URL that should not apply hightcontrast filter + * @return @c EINA_TRUE if successfully added or @c EINA_FALSE otherwise + Note that add a reduplicative url will return EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_highcontrast_forbidden_url_add(const char* url); + +/** + * Remove the specific highcontrast forbidden URL. + * + * @param url URL that already in the forbidden url list + * @return @c EINA_TRUE if successfully removed or @c EINA_FALSE otherwise + Note that if the url is not exist in the list it will return + EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_highcontrast_forbidden_url_remove(const char* url); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_highcontrast_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_history_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_history_internal.h new file mode 100644 index 000000000..bbee5abda --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_history_internal.h @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2014-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_history_internal.h + * @brief Describes the history(back & forward list) API of visited page. + */ + +#ifndef ewk_history_internal_h +#define ewk_history_internal_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for _Ewk_History */ +typedef struct _Ewk_History Ewk_History; + +/** Creates a type name for _Ewk_History_Item */ +typedef struct _Ewk_History_Item Ewk_History_Item; + +/** + * Get the whole length of back list. + * + * @param history to get the whole back list + * + * @return number of elements in whole list. + */ +EXPORT_API int ewk_history_back_list_length_get(Ewk_History* history); + +/** + * Get the whole length of forward list. + * + * @param history to get the whole forward list + * + * @return number of elements in whole list. + */ +EXPORT_API int ewk_history_forward_list_length_get(Ewk_History* history); + +/** + * Get the item at a given index relative to the current item. + * + * @param history which history instance to query. + * @param index position of item to get. + * + * @note The back list item in case of index < 0, the current item in case of + * index == 0, the forward list item in case of index > 0. + * + * @return the item at a given index relative to the current item. + */ +EXPORT_API Ewk_History_Item* ewk_history_nth_item_get(Ewk_History* history, + int index); + +/** + * Query URI for given list item. + * + * @param item history item to query. + * + * @return the URI pointer, that may be @c NULL. + */ +EXPORT_API const char* ewk_history_item_uri_get(Ewk_History_Item* item); + +/** + * Query title for given list item. + * + * @param item history item to query. + * + * @return the title pointer, that may be @c NULL. + */ +EXPORT_API const char* ewk_history_item_title_get(Ewk_History_Item* item); + +/** + * Free given history instance. + * + * @param history what to free. + */ +EXPORT_API void ewk_history_free(Ewk_History* history); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_history_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_hit_test_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_hit_test_internal.h new file mode 100644 index 000000000..79f2a3883 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_hit_test_internal.h @@ -0,0 +1,204 @@ +/* + * Copyright (C) 2014-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_hit_test_internal_h +#define ewk_hit_test_internal_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Ewk_Hit_Test_Mode: + * @EWK_HIT_TEST_MODE_DEFAULT: link data. + * @EWK_HIT_TEST_MODE_NODE_DATA: extra node data(tag name, node value, attribute + * infomation, etc). + * @EWK_HIT_TEST_MODE_IMAGE_DATA: extra image data(image data, image data + * length, image file name exteionsion, etc). + * @EWK_HIT_TEST_MODE_ALL: all data. + * + * Enum values with flags representing the hit test mode. + */ + +typedef enum { + EWK_HIT_TEST_MODE_DEFAULT = 1 << 1, + EWK_HIT_TEST_MODE_NODE_DATA = 1 << 2, + EWK_HIT_TEST_MODE_IMAGE_DATA = 1 << 3, + EWK_HIT_TEST_MODE_ALL = EWK_HIT_TEST_MODE_DEFAULT | + EWK_HIT_TEST_MODE_NODE_DATA | + EWK_HIT_TEST_MODE_IMAGE_DATA +} Ewk_Hit_Test_Mode; + +/** + * Ewk_Hit_Test_Result_Context: + * @EWK_HIT_TEST_RESULT_CONTEXT_DOCUMENT: anywhere in the document. + * @EWK_HIT_TEST_RESULT_CONTEXT_LINK: a hyperlink element. + * @EWK_HIT_TEST_RESULT_CONTEXT_IMAGE: an image element. + * @EWK_HIT_TEST_RESULT_CONTEXT_MEDIA: a video or audio element. + * @EWK_HIT_TEST_RESULT_CONTEXT_SELECTION: the area is selected by the user. + * @EWK_HIT_TEST_RESULT_CONTEXT_EDITABLE: the area is editable by the user. + * @EWK_HIT_TEST_RESULT_CONTEXT_TEXT: the area is text. + * + * Enum values with flags representing the context of a #Ewk_Hit_Test. + */ +typedef enum { + EWK_HIT_TEST_RESULT_CONTEXT_DOCUMENT = 1 << 1, + EWK_HIT_TEST_RESULT_CONTEXT_LINK = 1 << 2, + EWK_HIT_TEST_RESULT_CONTEXT_IMAGE = 1 << 3, + EWK_HIT_TEST_RESULT_CONTEXT_MEDIA = 1 << 4, + EWK_HIT_TEST_RESULT_CONTEXT_SELECTION = 1 << 5, + EWK_HIT_TEST_RESULT_CONTEXT_EDITABLE = 1 << 6, + EWK_HIT_TEST_RESULT_CONTEXT_TEXT = 1 << 7 +} Ewk_Hit_Test_Result_Context; + +/** Creates a type name for _Ewk_Hit_Test */ +typedef struct _Ewk_Hit_Test Ewk_Hit_Test; + +/** + * Frees hit test instance created by ewk_view_hit_test_new(). + * + * @param hit_test instance + */ +EXPORT_API void ewk_hit_test_free(Ewk_Hit_Test* hit_test); + +/** + * Gets the context of the hit test + * + * @param hit_test instance + * @return a bitmask of the hit test context on success, @c + * EWK_HIT_TEST_RESULT_CONTEXT_DOCUMENT otherwise. + */ +EXPORT_API Ewk_Hit_Test_Result_Context +ewk_hit_test_result_context_get(Ewk_Hit_Test* hit_test); + +/** + * Gets the link uri string of the hit test + * + * @param hit_test instance + * @return the URI of the link element in the coordinates of the hit test on + * success, @c 0 otherwise. + */ +EXPORT_API const char* ewk_hit_test_link_uri_get(Ewk_Hit_Test* hit_test); + +/** + * Gets the link title string of the hit test + * + * @param hit_test instance + * @return the title of the link element in the coordinates of the hit test on + * success, @c 0 otherwise. + */ +EXPORT_API const char* ewk_hit_test_link_title_get(Ewk_Hit_Test* hit_test); + +/** + * Gets the link label string of the hit test + * + * @param hit_test instance + * @return the label of the link element in the coordinates of the hit test on + * success, @c 0 otherwise. + */ +EXPORT_API const char* ewk_hit_test_link_label_get(Ewk_Hit_Test* hit_test); + +/** + * Gets the image uri string of the hit test + * + * @param hit_test instance + * @return the URI of the image element in the coordinates of the hit test on + * success, @c 0 otherwise. + */ +EXPORT_API const char* ewk_hit_test_image_uri_get(Ewk_Hit_Test* hit_test); + +/** + * Gets the media uri string of the hit test + * + * @param hit_test instance + * @return the URI of the media element in the coordinates of the hit test on + * success, @c 0 otherwise. + */ +EXPORT_API const char* ewk_hit_test_media_uri_get(Ewk_Hit_Test* hit_test); + +/** + * Gets the tag name string of hit element of the hit test + * + * @param hit_test instance + * @return the tag name of the hit element in the coordinates of the hit test on + * success, @c 0 otherwise. + */ +EXPORT_API const char* ewk_hit_test_tag_name_get(Ewk_Hit_Test* hit_test); + +/** + * Gets the node value string of hit element of the hit test + * + * @param hit_test instance + * @return the node value of the hit element in the coordinates of the hit test + * on success, @c 0 otherwise. + */ +EXPORT_API const char* ewk_hit_test_node_value_get(Ewk_Hit_Test* hit_test); + +/** + * Gets the attribute data of hit element of the hit test + * + * @param hit_test instance + * @return the attribute data of the hit element in the coordinates of the hit + * test on success, @c 0 otherwise. + */ +EXPORT_API Eina_Hash* ewk_hit_test_attribute_hash_get(Ewk_Hit_Test* hit_test); + +/** + * Gets the image buffer of hit element of the hit test + * + * @param hit_test instance + * @return the image buffer of the hit element in the coordinates of the hit + * test on success, @c 0 otherwise. + */ +EXPORT_API void* ewk_hit_test_image_buffer_get(Ewk_Hit_Test* hit_test); + +/** + * Gets the image buffer length of hit element of the hit test + * + * @param hit_test instance + * @return the image buffer length of the hit element in the coordinates of the + * hit test on success, @c 0 otherwise. Buffer length is truncated to 32 bit. + */ +EXPORT_API unsigned int ewk_hit_test_image_buffer_length_get( + Ewk_Hit_Test* hit_test); + +/** + * Gets the image fiile name extension string of hit element of the hit test + * + * @param hit_test instance + * @return the image fiile name extension of the hit element in the coordinates + * of the hit test on success, @c 0 otherwise. + */ +EXPORT_API const char* ewk_hit_test_image_file_name_extension_get( + Ewk_Hit_Test* hit_test); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_hit_test_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_intercept_request.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_intercept_request.h new file mode 100644 index 000000000..9b7d9d14d --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_intercept_request.h @@ -0,0 +1,326 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * @file ewk_intercept_request.h + * @brief This file describes the Intercept Request EWK API. + */ + +#ifndef EWK_EFL_INTEGRATION_PUBLIC_EWK_INTERCEPT_REQUEST_H_ +#define EWK_EFL_INTEGRATION_PUBLIC_EWK_INTERCEPT_REQUEST_H_ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + * @{ + */ + +/** + * @brief Handle for intercepted request. Used for getting information about + * request and writing custom response. + * + * @since_tizen 3.0 + */ +typedef struct _Ewk_Intercept_Request Ewk_Intercept_Request; + +/** + * @brief Returns request url from Intercept Request object. + * + * @remarks Returned string is owned by Intercept Request object, you have to + * make a copy if you want to use it past owner lifetime. + * + * @since_tizen 3.0 + * + * @param[in] intercept_request intercept request instance received from + * #Ewk_Context_Intercept_Request_Callback ewk_context callback + * + * @return @c url string on success or NULL on failure + */ +EXPORT_API const char* ewk_intercept_request_url_get( + Ewk_Intercept_Request* intercept_request); + +/** + * @brief Returns request method from Intercept Request object. + * + * @remarks Returned string is owned by Intercept Request object, you have to + * make a copy if you want to use it past owner lifetime. + * + * @since_tizen 3.0 + * + * @param[in] intercept_request intercept request instance received from + * #Ewk_Context_Intercept_Request_Callback ewk_context callback + * + * @return @c method string on success or NULL on failure + */ +EXPORT_API const char* ewk_intercept_request_http_method_get( + Ewk_Intercept_Request* intercept_request); + +/** + * @brief Returns request headers from Intercept Request object. + * + * @remarks Returned hash map is owned by Intercept Request object, you have to + * make a copy if you want to use it past owner lifetime. + * + * @since_tizen 3.0 + * + * @param[in] intercept_request intercept request instance received from + * #Ewk_Context_Intercept_Request_Callback ewk_context callback + * + * @return @c Eina_Hash mapping from header name string to header value string + * on success or NULL on failure + */ +EXPORT_API const Eina_Hash* ewk_intercept_request_headers_get( + Ewk_Intercept_Request* intercept_request); + +/** + * @brief Ignores request so engine will handle it normally. + * + * @details When application doesn't have a response for intercepted request + * url, it calls this function, which notifies engine to proceed with + * normal resource loading. + * + * @remarks After this call, handling the request is done. Any further calls on + * the Ewk_Intercept_Request instance result in undefined behavior. + * + * Only use this function from inside the + * #Ewk_Context_Intercept_Request_Callback. + * + * @since_tizen 3.0 + * + * @param[in] intercept_request Intercept Request instance received in + * #Ewk_Context_Intercept_Request_Callback + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool +ewk_intercept_request_ignore(Ewk_Intercept_Request* intercept_request); + +/** + * @brief Writes whole response with headers at once. + * + * @details This function can be used to write whole response at once. To call + * it, application should have full response headers and body ready + * for the intercepted request. + * + * @remarks It is allowed to use this function both inside and outside + * the #Ewk_Context_Intercept_Request_Callback. + * + * After this call, handling the request is done. Any further calls on + * the Ewk_Intercept_Request instance result in undefined behavior. + * + * You can't use this call after you started writing response in + * chunks with @a ewk_intercept_request_response_write_chunk. + * + * Alternatively you can use following functions which are more + * convenient: + * - ewk_intercept_request_response_status_set() + * - ewk_intercept_request_response_header_add() + * - ewk_intercept_request_response_header_map_add() + * - ewk_intercept_request_response_body_set() + * - ewk_intercept_request_response_write_chunk() + * + * Using this function overrides status and headers set with functions + * listed above. + * + * @since_tizen 3.0 + * + * @param[in] intercept_request Intercept Request instance received from + * #Ewk_Context_Intercept_Request_Callback ewk_context callback + * @param[in] headers Null-terminated string representing response's headers + * for the intercept request. + * By HTTP spec, lines should end with a newline ('\\r\\n') and + * headers should end with an empty line ('\\r\\n\\r\\n'). + * @param[in] body Response body for the intercept request + * @param[in] length Length of response body + * + * @return @c EINA_TRUE on success or EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_intercept_request_response_set( + Ewk_Intercept_Request* intercept_request, const char* headers, + const char* body, size_t length); + +/** + * @brief Sets status code and status text of response for intercepted request. + * + * @remarks It is allowed to use this function both inside and outside the + * #Ewk_Context_Intercept_Request_Callback. + * + * In case of failure of this function finish writing for this + * intercept request. + * + * @since_tizen 3.0 + * + * @param[in] intercept_request Intercept Request instance received from + * #Ewk_Context_Intercept_Request_Callback ewk_context callback + * @param[in] status_code HTTP response status code + * @param[in] custom_status_text HTTP response reason phrase, pass NULL to use + * recommended reason phrase (example: "OK" for code 200) + * + * @return @c EINA_TRUE on success or EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_intercept_request_response_status_set( + Ewk_Intercept_Request* intercept_request, int status_code, + const char* custom_status_text); + +/** + * @brief Adds HTTP header to response for intercepted request. + * + * @remarks It is allowed to use this function both inside and outside + * the #Ewk_Context_Intercept_Request_Callback. + * + * In case of failure of this function finish writing for this + * intercept request. + * + * @since_tizen 3.0 + * + * @param[in] intercept_request Intercept Request instance received from + * #Ewk_Context_Intercept_Request_Callback ewk_context callback + * @param[in] field_name HTTP header field name + * @param[in] field_value HTTP header field value + * + * @return @c EINA_TRUE on success or EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_intercept_request_response_header_add( + Ewk_Intercept_Request* intercept_request, const char* field_name, + const char* field_value); + +/** + * @brief Adds HTTP headers to response for intercepted request. + * + * @remarks It is allowed to use this function both inside and outside + * the #Ewk_Context_Intercept_Request_Callback. + * + * In case of failure of this function finish writing for this + * intercept request. + * + * @since_tizen 3.0 + * + * @param[in] intercept_request Intercept Request instance received from + * #Ewk_Context_Intercept_Request_Callback ewk_context callback. + * @param[in] headers Map from HTTP header field names to field values, both + * represented as null terminated strings + * + * @return @c EINA_TRUE on success or EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_intercept_request_response_header_map_add( + Ewk_Intercept_Request* intercept_request, const Eina_Hash* headers); + +/** + * @brief Writes whole response body at once. + * + * @details This function can be used to write response body. To call it, + * application should have full response body ready for the + * intercepted request. + * + * @remarks It is allowed to use this function both inside and outside + * the #Ewk_Context_Intercept_Request_Callback. + * + * After this call, handling the request is done. Any further calls on + * the Ewk_Intercept_Request instance result in undefined behavior. + * + * You can't use this call after you started writing response + * in chunks with @a ewk_intercept_request_response_write_chunk. + * + * @since_tizen 3.0 + * + * @param[in] intercept_request Intercept Request instance received from + * #Ewk_Context_Intercept_Request_Callback ewk_context callback + * @param[in] body Response body for the intercept request + * @param[in] length Length of response body + * + * @return @c EINA_TRUE on success or EINA_FALSE on failure + * + * @pre Before writing response body, you should set response status and + * headers using the following functions: + * - ewk_intercept_request_response_status_set() + * - ewk_intercept_request_response_header_add() + * - ewk_intercept_request_response_header_map_add() + * + */ +EXPORT_API Eina_Bool ewk_intercept_request_response_body_set( + Ewk_Intercept_Request* intercept_request, const char* body, size_t length); + +/** + * @brief Writes a part of response body. + * + * @details This function can be used to write response body in chunks. + * Application doesn't have to prepare full response body before + * calling this function, it can be used as soon as a part of response + * is ready. + * + * @remarks If this function returns EINA_FALSE, handling the request is done. + * Any further calls on the Ewk_Intercept_Request instance result in + * undefined behavior. User should always check return value, because + * response to this request might not be needed anymore, and function + * can return EINA_FALSE even though user still has data to write. + * + * It is only allowed to use this function *outside* of the + * #Ewk_Context_Intercept_Request_Callback. + * + * If a part of response body has been written with this function, you + * can't use the following functions anymore: + * - ewk_intercept_request_response_set + * - ewk_intercept_request_response_body_set + * + * Using this function with too big chunks of data defeats its + * purpose. Engine uses chunks of response written with this function + * without waiting for end of data, which is its main advantage over + * @a ewk_intercept_request_response_body_set. + * + * @since_tizen 3.0 + * + * @param[in] intercept_request Intercept Request instance received from + * #Ewk_Context_Intercept_Request_Callback ewk_context callback + * @param[in] chunk Part of response body for intercepted request + * @param[in] length Length of response body part + * + * @return @c EINA_TRUE on success or EINA_FALSE on failure + * + * @pre Before writing response body, you should set response status + * and headers using the following functions: + * - ewk_intercept_request_response_status_set() + * - ewk_intercept_request_response_header_add() + * - ewk_intercept_request_response_header_map_add() + * + * @post After writing full response body in chunks using this function, call + * it again with NULL as @a chunk and 0 as @a length, to signal that + * response body is finished. + * + * Use the same arguments if there is a failure with preparing the rest + * of response body on application side, and you don't want or can't + * continue writing parts. + */ +EXPORT_API Eina_Bool ewk_intercept_request_response_write_chunk( + Ewk_Intercept_Request* intercept_request, const char* chunk, size_t length); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif // EWK_EFL_INTEGRATION_PUBLIC_EWK_INTERCEPT_REQUEST_H_ diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_intercept_request_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_intercept_request_internal.h new file mode 100644 index 000000000..e6fa3cadc --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_intercept_request_internal.h @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef EWK_EFL_INTEGRATION_PUBLIC_EWK_INTERCEPT_REQUEST_INTERNAL_H_ +#define EWK_EFL_INTEGRATION_PUBLIC_EWK_INTERCEPT_REQUEST_INTERNAL_H_ + +#include +#include + +#include "ewk_intercept_request.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Returns request url sheme from Intercept Request object. + * + * Returned string is owned by Intercept Request object, you have to make a + * copy if you want to use it past owner lifetime. + * + * @param intercept_request intercept request instance received from + * Ewk_Context_Intercept_Request_Callback ewk_context callback + * + * @return @c url sheme string on success or NULL on failure + */ +EXPORT_API const char* ewk_intercept_request_scheme_get( + Ewk_Intercept_Request* intercept_request); + +/** + * @brief Returns request's body from Intercept Request object. + * + * @remarks Returned bytes are owned by Intercept Request object, you have to + * make a copy if you want to use it past owner lifetime. + * + * It is only allowed to use this function *inside* the + * Ewk_Context_Intercept_Request_Callback. + * + * Use ewk_intercept_request_body_length_get to get length of returned + * bytes. + * + * @since_tizen 3.0 + * + * @param[in] intercept_request intercept request instance received from + * Ewk_Context_Intercept_Request_Callback ewk_context callback + * + * @return @c request's body data on success or NULL on failure + */ +EXPORT_API const char* ewk_intercept_request_body_get( + Ewk_Intercept_Request* intercept_request); + +/** + * @brief Returns request's body's length from Intercept Request object. + * + * @remarks It is only allowed to use this function *inside* the + * Ewk_Context_Intercept_Request_Callback. + * + * @since_tizen 3.0 + * + * @param[in] intercept_request intercept request instance received from + * Ewk_Context_Intercept_Request_Callback ewk_context callback + * + * @return @c request's body length on success or -1 on failure + */ +EXPORT_API int64_t +ewk_intercept_request_body_length_get(Ewk_Intercept_Request* intercept_request); + +#ifdef __cplusplus +} +#endif + +#endif // EWK_EFL_INTEGRATION_PUBLIC_EWK_INTERCEPT_REQUEST_INTERNAL_H_ diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_ipc_message_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_ipc_message_internal.h new file mode 100644 index 000000000..ae1b162b5 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_ipc_message_internal.h @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2014-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_ipc_message_internal.h + * @brief Custom support for ipc messages + */ + +#ifndef ewk_ipc_message_internal_h +#define ewk_ipc_message_internal_h + +#include +#include + +#include "ewk_context_internal.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct Ewk_Wrt_Message_Data Ewk_IPC_Wrt_Message_Data; + +/* + * Create new Ewk_Wrt_Message_Data object. It has to freed by the caller + * using ewk_ipc_wrt_message_data_del() + */ +EXPORT_API Ewk_IPC_Wrt_Message_Data *ewk_ipc_wrt_message_data_new(); + +/* + * Delete the Ewk_Wrt_Message_Object passed by the caller. + */ +EXPORT_API void ewk_ipc_wrt_message_data_del(Ewk_IPC_Wrt_Message_Data *data); + +/* + * Set message type + * + * @return false if NULL string was provided, true otherwise + */ +EXPORT_API Eina_Bool ewk_ipc_wrt_message_data_type_set( + Ewk_IPC_Wrt_Message_Data *data, const char *type); + +/* + * Get the type of given message. The string should be released with + * eina_stringshare_del() + * + * @return true on success, false in case provided data structure is NULL + */ +EXPORT_API Eina_Stringshare *ewk_ipc_wrt_message_data_type_get( + const Ewk_IPC_Wrt_Message_Data *data); + +/* + * Set message value + * + * @return false if NULL string was provided, true otherwise + */ +EXPORT_API Eina_Bool ewk_ipc_wrt_message_data_value_set( + Ewk_IPC_Wrt_Message_Data *data, const char *value); + +/* + * Get message value. The string should be released with eina_stringshare_del() + * + * @return true on success, false in case provided data structure is NULL + */ +EXPORT_API Eina_Stringshare *ewk_ipc_wrt_message_data_value_get( + const Ewk_IPC_Wrt_Message_Data *data); + +/* + * Set message ID + * + * @return false if NULL string was provided, true otherwise + */ +EXPORT_API Eina_Bool +ewk_ipc_wrt_message_data_id_set(Ewk_IPC_Wrt_Message_Data *data, const char *id); + +/* + * Get message ID. The string should be released with eina_stringshare_del() + * + * @return true on success, false in case provided data structure is NULL + */ +EXPORT_API Eina_Stringshare *ewk_ipc_wrt_message_data_id_get( + const Ewk_IPC_Wrt_Message_Data *data); + +/* + * Get message reference ID + * + * @return false if NULL string was provided, true otherwise + */ +EXPORT_API Eina_Bool ewk_ipc_wrt_message_data_reference_id_set( + Ewk_IPC_Wrt_Message_Data *data, const char *reference_id); + +/* + * Set message reference ID. The string should be released with + * eina_stringshare_del() + * + * @return true on success, false in case provided data structure is NULL + */ +EXPORT_API Eina_Stringshare *ewk_ipc_wrt_message_data_reference_id_get( + const Ewk_IPC_Wrt_Message_Data *data); + +/** + * Send IPC message to Wrt + * + * Plugins -> Wrt (Renderer->Browser) + */ +EXPORT_API Eina_Bool ewk_ipc_plugins_message_send( + int routingId, const Ewk_IPC_Wrt_Message_Data *data); + +/** + * Send IPC message to Plugins + * + * Wrt -> Plugins (Browser->Renderer) + * //TODO - it is always send to all rendereres - it need to be modified + */ +EXPORT_API Eina_Bool ewk_ipc_wrt_message_send( + Ewk_Context *context, const Ewk_IPC_Wrt_Message_Data *data); + +/** + * Send Synchronous IPC message to Wrt + * + * Plugins -> Wrt (answer: -> Plugins) (Renderer->Browser -> Renderer) + * + * If success the value member will be set by the handler + */ +EXPORT_API Eina_Bool ewk_ipc_plugins_sync_message_send( + int routingId, Ewk_IPC_Wrt_Message_Data *data); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_ipc_message_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_log_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_log_internal.h new file mode 100644 index 000000000..5d4947df4 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_log_internal.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_log_internal.h + * @brief flags related to logging functions. + */ + +#ifndef ewk_log_internal_h +#define ewk_log_internal_h + +#include + +extern int _ewk_log_dom; + +#define CRITICAL(...) EINA_LOG_DOM_CRIT(_ewk_log_dom, __VA_ARGS__) +#define ERR(...) EINA_LOG_DOM_ERR(_ewk_log_dom, __VA_ARGS__) +#define WARN(...) EINA_LOG_DOM_WARN(_ewk_log_dom, __VA_ARGS__) +#define INFO(...) EINA_LOG_DOM_INFO(_ewk_log_dom, __VA_ARGS__) +#define DBG(...) EINA_LOG_DOM_DBG(_ewk_log_dom, __VA_ARGS__) + +#endif // ewk_log_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_main.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_main.h new file mode 100644 index 000000000..3a991f92e --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_main.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2016 Samsung Electronics + * Copyright (C) 2012 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * @file ewk_main.h + * @brief This file is the general initialization of Chromium-efl, + not tied to any view object. + */ + +#ifndef ewk_main_h +#define ewk_main_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + * @{ + */ + +/** + * @brief Initializes Chromium's instance. + * + * - Initializes components needed by EFL,\n + * - Increases a reference count of Chromium's instance. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @return A reference count of Chromium's instance on success,\n + * otherwise @c 0 on failure + */ +EXPORT_API int ewk_init(void); + +/** + * @brief Decreases a reference count of Chromium's instance, + * possibly destroying it. + * + * @details If the reference count reaches @c 0, Chromium's instance is + * destroyed. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @return A reference count of Chromium's instance + */ +EXPORT_API int ewk_shutdown(void); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif // ewk_main_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_main_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_main_internal.h new file mode 100644 index 000000000..cb4916a8b --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_main_internal.h @@ -0,0 +1,196 @@ +/* + * Copyright (C) 2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_main_internal.h + * @brief The general initialization of Chromium-efl, + * not tied to any view object. + */ + +#ifndef ewk_main_internal_h +#define ewk_main_internal_h + +#include "ewk_main.h" + +#ifdef __cplusplus +extern "C" { +#endif + +enum Ewk_Process_Model { + EWK_PROCESS_MODEL_MULTI, + EWK_PROCESS_MODEL_MULTI_WITH_SINGLE_RENDERER, + EWK_PROCESS_MODEL_SINGLE, +}; + +/** + * @brief Enumeration that creates a type name for the #Ewk_Process_Model. + * @since_tizen 6.0 + */ +typedef enum Ewk_Process_Model Ewk_Process_Model; + +/** + * @brief Decide which process model to use to launch Chromium + * + * Must be called before the following APIs:\n + * ewk_view_add\n + * ewk_view_add_in_incognito_mode\n + * ewk_view_add_with_context\n + * ewk_view_add_with_session_data\n + * ewk_context_default_get\n + * ewk_context_new\n + * ewk_context_new_with_injected_bundle_path + * + * @details Choose process model from single process model, + * multi process model and multi process model with single renderer + * process. + * + * @since_tizen 6.0 + */ +EXPORT_API void ewk_process_model_set(Ewk_Process_Model process_model); + +/** + * @brief Enable memory optimization mode. + * + * Must be called before the following APIs:\n + * ewk_view_add\n + * ewk_view_add_in_incognito_mode\n + * ewk_view_add_with_context\n + * ewk_view_add_with_session_data\n + * ewk_context_default_get\n + * ewk_context_new\n + * ewk_context_new_with_injected_bundle_path + * + * @details Memory optimization mode decreases memory usage especially graphic + * related. But, it could cause performance degradations. + * + * @since_tizen 6.0 + */ +EXPORT_API void ewk_memory_optimization_mode_enable(void); + +/** + * Set argument count and argument vector. + * + * Must be called before the following APIs:\n + * ewk_view_add\n + * ewk_view_add_in_incognito_mode\n + * ewk_view_add_with_context\n + * ewk_view_add_with_session_data\n + * ewk_context_default_get\n + * ewk_context_new\n + * ewk_context_new_with_injected_bundle_path + * + * This API allows passing application arguments to the engine. + * Also there is possible to add custom parameters. However, + * the engine expects *original* application arguments + * to remain unchanged. Passing copy of them using strdup and friends + * is prohibited. The recommended way to call this API is: + * + * int main(int argc, char* argv[]) { + * ewk_set_arguments(argc, argv); + * ... + * } + * + * or + * + * int main(int argc, char* argv[]) { + * char* arg_options[] = { + * argv[0], + * "my_custom_param_1", + * "my_custom_param_2", + * }; + * int arg_cnt = sizeof(arg_options) / sizeof(arg_options[0]); + * ewk_set_arguments(arg_cnt, arg_options); + * } + * + * @note Calling the function for the second time has no user-visible effect. + * + * @param argc argument count + * @param argv argument array + */ +EXPORT_API void ewk_set_arguments(int argc, char** argv); + +/** + * Deprecated. + * Set home directory. + * + * If new path is NULL or empty string, home directory is considered as not set. + * + */ +EINA_DEPRECATED EXPORT_API void ewk_home_directory_set(const char* path); + +/** + * @brief Set version selection policy + * + * @details Set a version selection policy when plural web engines are + * installed. If the runtime prefers preload version, set 0. + * If the runtime prefers updated version, set 1. + * Each product may have a different default policy so this function + * provides a way to set a definitive policy to each runtime. + * + * @since_tizen 5.5 + * + * @note Must be called before ewk_init. Calling the function after ewk_init has + * no effect. + * + * @param[in] preference 0 means conservative. 1 means progressive. + * + * @return current policy + * + * @see ewk_init + */ +EXPORT_API int ewk_set_version_policy(int preference); + +/** + * @brief Set timeout for wating chromium mount. + * + * @details It waits up to timeout for chromium mount event + * by calling LwipcWaitEvent api and returns immediately + * when chromium mount is completed + * + * @since_tizen 5.5 + * + * @param[in] timeout_msec timeout value (in milliseconds) + * + * @return @c true if chromium mount is done, otherwise @c false + * + */ +EXPORT_API Eina_Bool ewk_wait_chromium_ready(unsigned int timeout_msec); + +/** + * @brief Check if the chromium mount is done. + * + * @details Check if the chromium mount is complete by calling LwipcIsDone. + * + * @since_tizen 5.5 + * + * @return @c true if chromium mount is done, otherwise @c false + * + */ +EXPORT_API Eina_Bool ewk_check_chromium_ready(); + +#ifdef __cplusplus +} +#endif +#endif // ewk_main_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_manifest.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_manifest.h new file mode 100644 index 000000000..50e6ce980 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_manifest.h @@ -0,0 +1,324 @@ +// 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_manifest_h +#define ewk_manifest_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + * @{ + */ + +/** + * @brief Get for web page manifest. Used for getting information about + * the manifest of web page. + * + * @since_tizen 3.0 + */ +typedef struct _Ewk_View_Request_Manifest Ewk_View_Request_Manifest; + +/** + * \enum _Ewk_View_Orientation_Type + * @brief Enumeration that provides the type of orientation. + * These are attributes locking the screen orientation. + * + * @details It contains enum values used to specify orientation types. + * + * @since_tizen 3.0 + */ +enum _Ewk_View_Orientation_Type { + WebScreenOrientationLockDefault = 0, /**< Equivalent to unlock. */ + WebScreenOrientationLockPortraitPrimary, /**< portrait-primary */ + WebScreenOrientationLockPortraitSecondary, /**< portrait-secondary */ + WebScreenOrientationLockLandscapePrimary, /**< landscape-primary */ + WebScreenOrientationLockLandscapeSecondary, /**< landscape-secondary */ + WebScreenOrientationLockAny, /**< any */ + WebScreenOrientationLockLandscape, /**< landscape */ + WebScreenOrientationLockPortrait, /**< portrait */ + WebScreenOrientationLockNatural, /**< natural */ +}; + +/** + * @brief Enumeration that creates a type name for the + * #_Ewk_View_Orientation_Type. + * + * @since_tizen 3.0 + */ +typedef enum _Ewk_View_Orientation_Type Ewk_View_Orientation_Type; + +/** + * \enum _Ewk_View_Web_Display_Mode + * + * @brief Enumeration that provides the mode of web display. + * These are attributes representing how the web application is being + * presented within the context. + * + * @details It contains enum values used to specify web display mode. + * + * @since_tizen 3.0 + */ +enum _Ewk_View_Web_Display_Mode { + WebDisplayModeUndefined = 0, /**< undefined */ + WebDisplayModeBrowser, /**< browser */ + WebDisplayModeMinimalUi, /**< minimul-ui */ + WebDisplayModeStandalone, /**< standalone */ + WebDisplayModeFullscreen, /**< fullscreen */ + WebDisplayModeLast = WebDisplayModeFullscreen +}; + +/** + * @brief Enumeration that creates a type name for the + * #_Ewk_View_Web_Display_Mode. + * + * @since_tizen 3.0 + */ +typedef enum _Ewk_View_Web_Display_Mode Ewk_View_Web_Display_Mode; + +/** + * @brief Get the short name of the manifest + * + * @since_tizen 3.0 + * + * @param[in] manifest Manifest object to get manifest information. + * + * @return @c short name string if short name exists otherwise null. + * The string is only valid until related Ewk_View_Request_Manifest object is + * valid. + * + * @see Ewk_View_Request_Manifest_Callback + */ +EXPORT_API const char* ewk_manifest_short_name_get( + Ewk_View_Request_Manifest* manifest); + +/** + * @brief Get the name of the manifest + * + * @since_tizen 3.0 + * + * @param[in] manifest Manifest object to get manifest information. + * + * @return @c name string if name exists otherwise null. The string + * is only valid until related Ewk_View_Request_Manifest object is valid. + * + * @see Ewk_View_Request_Manifest_Callback + */ +EXPORT_API const char* ewk_manifest_name_get( + Ewk_View_Request_Manifest* manifest); + +/** + * @brief Get the start url of the manifest + * + * @since_tizen 3.0 + * + * @param[in] manifest Manifest object to get manifest information. + * + * @return @c start url string if start url exists otherwise null. The string + * is only valid until related Ewk_View_Request_Manifest object is valid. + * + * @see Ewk_View_Request_Manifest_Callback + */ +EXPORT_API const char* ewk_manifest_start_url_get( + Ewk_View_Request_Manifest* manifest); + +/** + * @brief Get the orientation type of the manifest + * + * @since_tizen 3.0 + * + * @param[in] manifest Manifest object to get manifest information. + * + * @return @c orientation type enum if orientation type exists + * otherwise WebScreenOrientationLockDefault. + * The enum is only valid until related + * Ewk_View_Request_Manifest object is valid. + * + * @see Ewk_View_Request_Manifest_Callback + */ +EXPORT_API Ewk_View_Orientation_Type +ewk_manifest_orientation_type_get(Ewk_View_Request_Manifest* manifest); + +/** + * @brief Get the web display mode of the manifest + * + * @since_tizen 3.0 + * + * @param[in] manifest Manifest object to get manifest information. + * + * @return @c web display mode enum if web display mode exists + * otherwise WebDisplayModeUndefined. + * The enum is only valid until related + * Ewk_View_Request_Manifest object is valid. + * + * @see Ewk_View_Request_Manifest_Callback + */ +EXPORT_API Ewk_View_Web_Display_Mode +ewk_manifest_web_display_mode_get(Ewk_View_Request_Manifest* manifest); + +/** + * @brief Get the theme color of the manifest + * + * @since_tizen 3.0 + * + * @param[in] manifest Manifest object to get manifest information. + * + * @param[out] r The red component of the theme color, + * Pass NULL if you don't want to get the value. + * @param[out] g The green component of the theme color, + * Pass NULL if you don't want to get the value. + * @param[out] b The blue component of the theme color, + * Pass NULL if you don't want to get the value. + * @param[out] a The alpha component of the theme color, + * Pass NULL if you don't want to get the value. + * + * @return @c EINA_TRUE if theme color exists + * otherwise EINA_FALSE. The value is only valid + * until related Ewk_View_Request_Manifest object is valid. + * + * @see Ewk_View_Request_Manifest_Callback + */ +EXPORT_API Eina_Bool +ewk_manifest_theme_color_get(Ewk_View_Request_Manifest* manifest, uint8_t* r, + uint8_t* g, uint8_t* b, uint8_t* a); + +/** + * @brief Get the background color of the manifest + * + * @since_tizen 3.0 + * + * @param[in] manifest Manifest object to get manifest information. + * + * @param[out] r The red component of the background color, + * Pass NULL if you don't want to get the value. + * @param[out] g The green component of the background color, + * Pass NULL if you don't want to get the value. + * @param[out] b The blue component of the background color, + * Pass NULL if you don't want to get the value. + * @param[out] a The alpha component of the background color, + * Pass NULL if you don't want to get the value. + * + * @return @c EINA_TRUE if background color exists + * otherwise EINA_FALSE. The value is only valid + * until related Ewk_View_Request_Manifest object is valid. + * + * @see Ewk_View_Request_Manifest_Callback + */ +EXPORT_API Eina_Bool ewk_manifest_background_color_get( + Ewk_View_Request_Manifest* manifest, uint8_t* r, uint8_t* g, uint8_t* b, + uint8_t* a); + +/** + * @brief Get the count of icon of the manifest + * + * @since_tizen 3.0 + * + * @param[in] manifest Manifest object to get manifest information. + * + * @return @c count of icon if icons exist otherwise 0. The value + * is only valid until related Ewk_View_Request_Manifest object is valid. + * + * @see Ewk_View_Request_Manifest_Callback + */ +EXPORT_API size_t +ewk_manifest_icons_count_get(Ewk_View_Request_Manifest* manifest); + +/** + * @brief Get the src of icon of the manifest + * + * @since_tizen 3.0 + * + * @param[in] manifest Manifest object to get manifest information. + * @param[in] number the index of icons to be obtained + * + * @return @c src of icon if src exists otherwise null. The value + * is only valid until related Ewk_View_Request_Manifest object is valid. + * + * @see Ewk_View_Request_Manifest_Callback + */ +EXPORT_API const char* ewk_manifest_icons_src_get( + Ewk_View_Request_Manifest* manifest, size_t number); + +/** + * @brief Get the type of icon of the manifest + * + * @since_tizen 3.0 + * + * @param[in] manifest Manifest object to get manifest information. + * @param[in] number the index of icons to be obtained + * + * @return @c type of icon if type exists otherwise null. The string + * is only valid until related Ewk_View_Request_Manifest object is valid. + * + * @see Ewk_View_Request_Manifest_Callback + */ +EXPORT_API const char* ewk_manifest_icons_type_get( + Ewk_View_Request_Manifest* manifest, size_t number); + +/** + * @brief Get the count of the icon's sizes + * + * @since_tizen 3.0 + * + * @param[in] manifest Manifest object to get manifest information. + * @param[in] number the index of icons to be obtained + * + * @return @c count of the icon's sizes if size of icons exists otherwise 0. + * The value is only valid until related + * Ewk_View_Request_Manifest object is valid. + * + * @see Ewk_View_Request_Manifest_Callback + */ +EXPORT_API size_t ewk_manifest_icons_sizes_count_get( + Ewk_View_Request_Manifest* manifest, size_t number); + +/** + * @brief Get the width of icon of the manifest + * + * @since_tizen 3.0 + * + * @param[in] manifest Manifest object to get manifest information. + * @param[in] number the index of icons to be obtained + * @param[in] sizes_number the index of sizes to be obtained + * + * @return @c width of icon if width exists otherwise -1. + * The value is only valid until related + * Ewk_View_Request_Manifest object is valid. + * + * @see Ewk_View_Request_Manifest_Callback + */ +EXPORT_API int ewk_manifest_icons_width_get(Ewk_View_Request_Manifest* manifest, + size_t number, size_t sizes_number); + +/** + * @brief Get the height of icon of the manifest + * + * @since_tizen 3.0 + * + * @param[in] manifest Manifest object to get manifest information. + * @param[in] number the index of icons to be obtained + * @param[in] sizes_number the index of sizes to be obtained + * + * @return @c height of icon if height exists otherwise -1. + * The value is only valid until related + * Ewk_View_Request_Manifest object is valid. + * + * @see Ewk_View_Request_Manifest_Callback + */ +EXPORT_API int ewk_manifest_icons_height_get( + Ewk_View_Request_Manifest* manifest, size_t number, size_t sizes_number); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif // ewk_manifest_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_manifest_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_manifest_internal.h new file mode 100644 index 000000000..414d78ac8 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_manifest_internal.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2017 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_manifest_internal_h +#define ewk_manifest_internal_h + +#include + +#include "ewk_manifest.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _Ewk_View_Request_Manifest Ewk_View_Request_Manifest; + +/** + * @brief Get the spp_sender_id from the manifest + * + * @since_tizen 3.0 + * + * @param[in] manifest object to get manifest information. + * + * @return @c string of spp_sender_id. + * The value is only valid until related + * Ewk_View_Request_Manifest object is valid. + * + * @see Ewk_View_Request_Manifest_Callback + */ +EXPORT_API const char* ewk_manifest_push_sender_id_get( + Ewk_View_Request_Manifest* manifest); + +#ifdef __cplusplus +} +#endif +#endif // ewk_manifest_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_downloadable_font_info.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_downloadable_font_info.h new file mode 100644 index 000000000..30917565f --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_downloadable_font_info.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2018 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_media_downloadable_font_info_h +#define ewk_media_downloadable_font_info_h + +#include "ewk_media_downloadable_font_info_product.h" +#include "private/ewk_private.h" + +#ifdef __cplusplus +extern "C" { +#endif + +Ewk_Media_Downloadable_Font_Info* ewkMediaDownloadableFontInfoCreate( + const char* schemeIdUri, const char* value, const char* data, int type) { + Ewk_Media_Downloadable_Font_Info* font_info = + new Ewk_Media_Downloadable_Font_Info; + font_info->schemeIdUri = eina_stringshare_add(schemeIdUri ? schemeIdUri : ""); + font_info->value = eina_stringshare_add(value ? value : ""); + font_info->data = eina_stringshare_add(data ? data : ""); + font_info->type = type; + return font_info; +} + +void ewkMediaDownloadableFontInfoDelete( + Ewk_Media_Downloadable_Font_Info* font_info) { + if (font_info->schemeIdUri) eina_stringshare_del(font_info->schemeIdUri); + if (font_info->value) eina_stringshare_del(font_info->value); + if (font_info->data) eina_stringshare_del(font_info->data); + delete font_info; +} + +#ifdef __cplusplus +} +#endif +#endif // ewk_media_downloadable_font_info_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_downloadable_font_info_product.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_downloadable_font_info_product.h new file mode 100644 index 000000000..556ac2ebc --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_downloadable_font_info_product.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2018 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_media_downloadable_font_info_product_h +#define ewk_media_downloadable_font_info_product_h + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _Ewk_Media_Downloadable_Font_Info { + const char* schemeIdUri; + const char* value; + const char* data; + int type; +} Ewk_Media_Downloadable_Font_Info; + +#ifdef __cplusplus +} +#endif +#endif // ewk_media_downloadable_font_info_product_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_parental_rating_info.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_parental_rating_info.h new file mode 100644 index 000000000..d1e117597 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_parental_rating_info.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2018 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_media_parental_rating_info.h + * @brief This file describes the ewk media parental rating info API. + */ + +#ifndef ewk_media_parental_rating_info_h +#define ewk_media_parental_rating_info_h + +#include "ewk_media_parental_rating_info_product.h" +#include "private/ewk_private.h" + +#ifdef __cplusplus +extern "C" { +#endif + +Ewk_Media_Parental_Rating_Info* ewkMediaParentalRatingInfoCreate( + const char* info, const char* url) { + Ewk_Media_Parental_Rating_Info* data = new Ewk_Media_Parental_Rating_Info; + data->parentalInfoStr = eina_stringshare_add(info ? info : ""); + data->url = eina_stringshare_add(url ? url : ""); + return data; +} + +void ewkMediaParentalRatingInfoDelete(Ewk_Media_Parental_Rating_Info* data) { + if (data->parentalInfoStr) eina_stringshare_del(data->parentalInfoStr); + if (data->url) eina_stringshare_del(data->url); + delete data; +} + +#ifdef __cplusplus +} +#endif +#endif // ewk_media_parental_rating_info_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_parental_rating_info_product.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_parental_rating_info_product.h new file mode 100644 index 000000000..752ec9501 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_parental_rating_info_product.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2018 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_media_playback_info_product.h + * @brief This file describes the ewk media playback info API. + */ + +#ifndef ewk_media_parental_rating_info_product_h +#define ewk_media_parental_rating_info_product_h + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _Ewk_Media_Parental_Rating_Info { + const char* parentalInfoStr; + const char* url; +} Ewk_Media_Parental_Rating_Info; + +#ifdef __cplusplus +} +#endif +#endif // ewk_media_playback_info_product_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_playback_info.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_playback_info.h new file mode 100644 index 000000000..d26b5bfff --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_playback_info.h @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_media_playback_info.h + * @brief This file describes the ewk media playback info API. + */ + +#ifndef ewk_media_playback_info_h +#define ewk_media_playback_info_h +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _Ewk_Media_Playback_Info Ewk_Media_Playback_Info; + +/** + * Get url of media. + * + * @param meia playback info's structure + * + * @return @c media url + */ +EXPORT_API const char* ewk_media_playback_info_media_url_get( + Ewk_Media_Playback_Info* data); + +/** + * Get mime type of media. + * + * @param meia playback info's structure + * + * @return @c mime type + */ +EXPORT_API const char* ewk_media_playback_info_mime_type_get( + Ewk_Media_Playback_Info* data); + +/** + * Get translated url of media. + * + * @param media playback info's structure + * + * @return @c translated url + */ +EXPORT_API const char* ewk_media_playback_info_translated_url_get( + Ewk_Media_Playback_Info* data); + +/** + * Get drm info of media. + * + * @param media playback info's structure + * + * @return @c drm info + */ +EXPORT_API const char* ewk_media_playback_info_drm_info_get( + Ewk_Media_Playback_Info* data); + +/** + * Set media resource acquired of media. + * + * @param media playback info's structure + */ +EXPORT_API void ewk_media_playback_info_media_resource_acquired_set( + Ewk_Media_Playback_Info* data, Eina_Bool media_resource_acquired); + +/** + * Set translated url of media. + * + * @param media playback info's structure + */ +EXPORT_API void ewk_media_playback_info_translated_url_set( + Ewk_Media_Playback_Info* data, const char* translated_url); + +/** + * Set drm info of media. + * + * @param media playback info's structure + */ +EXPORT_API void ewk_media_playback_info_drm_info_set( + Ewk_Media_Playback_Info* data, const char* drm_info); + +#ifdef __cplusplus +} +#endif +#endif // ewk_media_playback_info_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_playback_info_product.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_playback_info_product.h new file mode 100644 index 000000000..a402a1f9e --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_playback_info_product.h @@ -0,0 +1,166 @@ +/* + * Copyright (C) 2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_media_playback_info_product.h + * @brief This file describes the ewk media playback info API. + */ + +#ifndef ewk_media_playback_info_product_h +#define ewk_media_playback_info_product_h + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Enum values used to inform webengine about decoder used by broadcast. + */ +typedef enum Ewk_Hardware_Decoders { + EWK_HARDWARE_DECODERS_NONE, + EWK_HARDWARE_DECODERS_MAIN, + EWK_HARDWARE_DECODERS_SUB, +} Ewk_Hardware_Decoders; + +typedef struct _Ewk_Media_Playback_Info Ewk_Media_Playback_Info; + +/** + * Get video id of media. + * + * @param meia playback info's structure + * + * @return @c video id + */ +EXPORT_API const int ewk_media_playback_info_video_id_get( + Ewk_Media_Playback_Info* data); + +/** + * Get url of media. + * + * @param meia playback info's structure + * + * @return @c media url + */ +EXPORT_API const char* ewk_media_playback_info_media_url_get( + Ewk_Media_Playback_Info* data); + +/** + * Get mime type of media. + * + * @param meia playback info's structure + * + * @return @c mime type + */ +EXPORT_API const char* ewk_media_playback_info_mime_type_get( + Ewk_Media_Playback_Info* data); + +/** + * Get translated url of media. + * + * @param media playback info's structure + * + * @return @c translated url + */ +EXPORT_API const char* ewk_media_playback_info_translated_url_get( + Ewk_Media_Playback_Info* data); + +/** + * Get drm info of media. + * + * @param media playback info's structure + * + * @return @c drm info + */ +EXPORT_API const char* ewk_media_playback_info_drm_info_get( + Ewk_Media_Playback_Info* data); + +/** + * Get decoder info of media. + * + * @param data playback info's structure + * + * @return @c decoder name + */ +EXPORT_API Ewk_Hardware_Decoders +ewk_media_playback_info_decoder_get(Ewk_Media_Playback_Info* data); + +/** + * Set media resource acquired of media. + * + * @param media playback info's structure + */ +EXPORT_API void ewk_media_playback_info_media_resource_acquired_set( + Ewk_Media_Playback_Info* data, Eina_Bool media_resource_acquired); + +/** + * Set translated url of media. + * + * @param media playback info's structure + */ +EXPORT_API void ewk_media_playback_info_translated_url_set( + Ewk_Media_Playback_Info* data, const char* translated_url); + +/** + * Set drm info of media. + * + * @param media playback info's structure + */ +EXPORT_API void ewk_media_playback_info_drm_info_set( + Ewk_Media_Playback_Info* data, const char* drm_info); + +#if defined(OS_TIZEN_TV_PRODUCT) +Ewk_Media_Playback_Info* ewkMediaPlaybackInfoCreate( + const int player_id, const char* url, const char* mime_type, + Ewk_Hardware_Decoders decoder); +Eina_Bool ewk_media_playback_info_media_resource_acquired_get( + Ewk_Media_Playback_Info* data); +void ewkMediaPlaybackInfoDelete(Ewk_Media_Playback_Info* data); +#endif + +typedef struct _Ewk_DRM_Init_Data_Info { + int init_type; + void* data; + int data_length; +} Ewk_DRM_Init_Data_Info; + +typedef struct _Ewk_DRM_Init_Complete_Info { + unsigned int pssh_data_length; + unsigned char* pssh_data; + int decryptor; +} Ewk_DRM_Init_Complete_Info; + +typedef struct _Ewk_DRM_Error_Info { + int error_code; + const char* error_string; +} Ewk_DRM_Error_Info; + +#ifdef __cplusplus +} +#endif +#endif // ewk_media_playback_info_product_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_subtitle_info.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_subtitle_info.h new file mode 100644 index 000000000..31311ffc0 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_subtitle_info.h @@ -0,0 +1,105 @@ +// 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. + +/** + * @file ewk_media_subtitle_info.h + * @brief . + */ + +#ifndef ewk_media_subtitle_info_h +#define ewk_media_subtitle_info_h +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _Ewk_Media_Subtitle_Info Ewk_Media_Subtitle_Info; + +/** + * Get id of subtitle. + * + * @param meia subtitle info's structure + * + * @return @c subtitle id + */ +EXPORT_API int ewk_media_subtitle_info_id_get(Ewk_Media_Subtitle_Info *data); + +/** + * Get url of subtitle. + * + * @param meia subtitle info's structure + * + * @return @c subtitle url + */ +EXPORT_API const char *ewk_media_subtitle_info_url_get( + Ewk_Media_Subtitle_Info *data); + +/** + * Get srcLang of subtitle. + * + * @param meia subtitle info's structure + * + * @return @c subtitle srcLang + */ +EXPORT_API const char *ewk_media_subtitle_info_lang_get( + Ewk_Media_Subtitle_Info *data); + +/** + * Get label of subtitle. + * + * @param meia subtitle info's structure + * + * @return @c subtitle label + */ +EXPORT_API const char *ewk_media_subtitle_info_label_get( + Ewk_Media_Subtitle_Info *data); + +typedef struct _Ewk_Media_Subtitle_Data Ewk_Media_Subtitle_Data; + +/** + * Get id of subtitle. + * + * @param meia subtitle data's structure + * + * @return @c subtitle id + */ +EXPORT_API int ewk_media_subtitle_data_id_get(Ewk_Media_Subtitle_Data *data); + +/** + * Get timestamp of subtitle. + * + * @param meia subtitle data's structure + * + * @return @c subtitle timestamp + */ +EXPORT_API double ewk_media_subtitle_data_timestamp_get( + Ewk_Media_Subtitle_Data *data); + +/** + * Get data size of subtitle. + * + * @param meia subtitle data's structure + * + * @return @c subtitle data size + */ +EXPORT_API unsigned ewk_media_subtitle_data_size_get( + Ewk_Media_Subtitle_Data *data); + +/** + * Get data of subtitle. + * + * @param meia subtitle data's structure + * + * @return @c subtitle data + */ +EXPORT_API const void *ewk_media_subtitle_data_get( + Ewk_Media_Subtitle_Data *data); + +#ifdef __cplusplus +} +#endif +#endif // ewk_media_subtitle_info_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_subtitle_info_product.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_subtitle_info_product.h new file mode 100644 index 000000000..d957371a4 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_media_subtitle_info_product.h @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_media_subtitle_info_product.h + * @brief . + */ + +#ifndef ewk_media_subtitle_info_product_h +#define ewk_media_subtitle_info_product_h + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _Ewk_Media_Subtitle_Info Ewk_Media_Subtitle_Info; + +/** + * Get id of subtitle. + * + * @param meia subtitle info's structure + * + * @return @c subtitle id + */ +EXPORT_API int ewk_media_subtitle_info_id_get(Ewk_Media_Subtitle_Info *data); + +/** + * Get url of subtitle. + * + * @param meia subtitle info's structure + * + * @return @c subtitle url + */ +EXPORT_API const char *ewk_media_subtitle_info_url_get( + Ewk_Media_Subtitle_Info *data); + +/** + * Get srcLang of subtitle. + * + * @param meia subtitle info's structure + * + * @return @c subtitle srcLang + */ +EXPORT_API const char *ewk_media_subtitle_info_lang_get( + Ewk_Media_Subtitle_Info *data); + +/** + * Get label of subtitle. + * + * @param meia subtitle info's structure + * + * @return @c subtitle label + */ +EXPORT_API const char *ewk_media_subtitle_info_label_get( + Ewk_Media_Subtitle_Info *data); + +typedef struct _Ewk_Media_Subtitle_Data Ewk_Media_Subtitle_Data; + +/** + * Get id of subtitle. + * + * @param meia subtitle data's structure + * + * @return @c subtitle id + */ +EXPORT_API int ewk_media_subtitle_data_id_get(Ewk_Media_Subtitle_Data *data); + +/** + * Get timestamp of subtitle. + * + * @param meia subtitle data's structure + * + * @return @c subtitle timestamp + */ +EXPORT_API double ewk_media_subtitle_data_timestamp_get( + Ewk_Media_Subtitle_Data *data); + +/** + * Get data size of subtitle. + * + * @param meia subtitle data's structure + * + * @return @c subtitle data size + */ +EXPORT_API unsigned ewk_media_subtitle_data_size_get( + Ewk_Media_Subtitle_Data *data); + +/** + * Get data of subtitle. + * + * @param meia subtitle data's structure + * + * @return @c subtitle data + */ +EXPORT_API const void *ewk_media_subtitle_data_get( + Ewk_Media_Subtitle_Data *data); + +#if defined(OS_TIZEN_TV_PRODUCT) +Ewk_Media_Subtitle_Info *ewkMediaSubtitleInfoCreate(int id, const char *url, + const char *lang, + const char *label); + +void ewkMediaSubtitleInfoDelete(Ewk_Media_Subtitle_Info *data); + +Ewk_Media_Subtitle_Data *ewkMediaSubtitleDataCreate(int id, double timestamp, + const void *data, + unsigned size); + +void ewkMediaSubtitleDataDelete(Ewk_Media_Subtitle_Data *data); +#endif + +#ifdef __cplusplus +} +#endif +#endif // ewk_media_subtitle_info_product_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_notification_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_notification_internal.h new file mode 100644 index 000000000..8e090d4df --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_notification_internal.h @@ -0,0 +1,277 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_notification_internal_h +#define ewk_notification_internal_h + +#include +#include +#include + +#include "ewk_security_origin_internal.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct _Ewk_Notification_Permission { + const char* origin; + Eina_Bool allowed; +}; + +typedef struct Ewk_Notification Ewk_Notification; +typedef struct _Ewk_Notification_Permission Ewk_Notification_Permission; +typedef struct Ewk_Notification_Permission_Request + Ewk_Notification_Permission_Request; +typedef void (*Ewk_Notification_Show_Callback)(Ewk_Notification*, void*); +typedef void (*Ewk_Notification_Cancel_Callback)(uint64_t, void*); + +/** + * Sets callbacks for notifications handling. + * + * These callbacks will receive all notifications from all webview instances. + * @e show_callback is used to display notification UI. Embeder should call + * ewk_notification_showed after it displays notification UI. @e cancel_callback + * will be called after notification is closed by engine. It's used to notify + * embeder that related notification UI should be destroyed. + * + * @param show_callback notification show callback. Can't be NULL + * @param cancel_callback notification close callback. Can't be NULL + * @param user_data extra data for callback + * + * @return EINA_TRUE on success, EINA_FALSE on failure (i.e. when ewk_init was + * not called) + */ +EXPORT_API Eina_Bool ewk_notification_callbacks_set( + Ewk_Notification_Show_Callback show_callback, + Ewk_Notification_Cancel_Callback cancel_callback, void* user_data); + +/** + * Resets notification callbacks to NULL + * + * @return EINA_TRUE on success, EINA_FALSE on failure (i.e. when ewk_init was + * not called) + */ +EXPORT_API Eina_Bool ewk_notification_callbacks_reset(); + +/** + * Get notification icon as Evas_Object + * + * @param ewk_notification pointer to notification data + * @param evas canvas where icon object will be added + * + * @return Evas_Object containing icon if successful, @c NULL otherwise. + * Caller takes ownership of returned Evas_Object. + */ +EXPORT_API Evas_Object* ewk_notification_icon_get( + const Ewk_Notification* ewk_notification, Evas* evas); + +/** + * Save notification icon as PNG image + * + * @param ewk_notification notification data pointer + * @param path path where file will be saved + * + * @return EINA_TRUE on success + */ +EXPORT_API Eina_Bool ewk_notification_icon_save_as_png( + const Ewk_Notification* ewk_notification, const char* path); + +/** + * Requests for getting body of notification. + * + * @param ewk_notification pointer of notificaion data + * + * @return body of notification + * Lifetime only valid as long as @a ewk_notification is valid. + */ +EXPORT_API const char* ewk_notification_body_get( + const Ewk_Notification* ewk_notification); + +/** + * Notify that notification is clicked. + * + * @param notification_id identifier of notification + * + * @return EINA_TRUE on success, EINA_FALSE if notification id is invalid + */ +EXPORT_API Eina_Bool ewk_notification_clicked(uint64_t notification_id); + +/** + * Requests for getting icon url of notification. + * + * @param ewk_notification pointer of notification data + * + * @return Always returns NULL - this API is deprecated. + * + * @deprecated + */ +EINA_DEPRECATED EXPORT_API const char* ewk_notification_icon_url_get( + const Ewk_Notification* ewk_notification); + +/** + * Requests for getting id of notification. + * + * @param ewk_notification pointer of notification data + * + * @return id of notification + */ +EXPORT_API uint64_t +ewk_notification_id_get(const Ewk_Notification* ewk_notification); + +/** + * Requests for setting cached notification permissions. + * + * By calling this notification permission is replaced as passed + * ewk_notification_permissions. + * + * @param context context object + * @param ewk_notification_permissions list of cached + * permissions(Ewk_Notification_Permission) + * + * @return EINA_TRUE if successful, EINA_FALSE if ewk_init was not called + */ +EXPORT_API Eina_Bool ewk_notification_cached_permissions_set( + Eina_List* ewk_notification_permissions); + +/** + * Requests for getting origin of notification permission request. + * + * @param request Ewk_Notification_Permission_Request object to get origin for + * notification permission request + * + * @return security origin of notification permission request + * Lifetime only valid as long as @a ewk_notification is valid. + */ +EXPORT_API const Ewk_Security_Origin* +ewk_notification_permission_request_origin_get( + const Ewk_Notification_Permission_Request* request); + +/** + * Reply the result about notification permission. + * + * @param request Ewk_Notification_Permission_Request object to get the + * infomation about notification permission request. + * @param allow result about notification permission + * + * @return EINA_TRUE is successful. EINA_FALSE if reply was already called for + * this request or if request is NULL + */ +EXPORT_API Eina_Bool ewk_notification_permission_reply( + Ewk_Notification_Permission_Request* request, Eina_Bool allow); + +/** + * Deprecated, use ewk_notification_permission_reply instead. + * Sets permission of notification. + * + * @param request Ewk_Notification_Permission_Request object to allow/deny + * notification permission request is freed in this function. + * @param allowed @c EINA_TRUE if permission is allowed, @c EINA_FALSE if + * permission is denied + * + * @return EINA_TRUE is successful. EINA_FALSE if reply was already called for + * this request or if request is NULL + * + * @deprecated + * @see ewk_notification_permission_reply + */ +EINA_DEPRECATED EXPORT_API Eina_Bool ewk_notification_permission_request_set( + Ewk_Notification_Permission_Request* request, Eina_Bool allowed); + +/** + * Suspend the operation for permission request. + * + * This suspends the operation for permission request. + * This is very useful to decide the policy from the additional UI operation + * like the popup. + * + * @param request Ewk_Notification_Permission_Request object to suspend + * notification permission request + */ +EXPORT_API Eina_Bool ewk_notification_permission_request_suspend( + Ewk_Notification_Permission_Request* request); + +/** + * Notify that notification policies are removed. + * + * @param context context object + * @param origins list of security origins(made by UAs) + */ +EXPORT_API Eina_Bool ewk_notification_policies_removed(Eina_List* origins); + +/** + * Requests for getting security origin of notification. + * + * @param ewk_notification pointer of notification data + * + * @return security origin of notification + * Lifetime only valid as long as @a ewk_notification is valid. + */ +EXPORT_API const Ewk_Security_Origin* ewk_notification_security_origin_get( + const Ewk_Notification* ewk_notification); + +/** + * Notify that notification is showed. + * + * @param notification_id identifier of notification + */ +EXPORT_API Eina_Bool ewk_notification_showed(uint64_t notification_id); + +/** + * Notify that notification was closed. + * + * @param notification_id identifier of notification + * @param by_user informs whether notification was closed by user + * action or by some other application logic + */ +EXPORT_API Eina_Bool ewk_notification_closed(uint64_t notification_id, + Eina_Bool by_user); + +/** + * Requests for getting title of notification. + * + * @param ewk_notification pointer of notification data + * + * @return title of notification + * Lifetime only valid as long as @a ewk_notification is valid. + */ +EXPORT_API const char* ewk_notification_title_get( + const Ewk_Notification* ewk_notification); + +/** + * Query if the notification is silent + * + * @param ewk_notification pointer of notification data + * + * @return @c EINA_TRUE if the notification must be silent, @c EINA_FALSE + * otherwise + */ +EXPORT_API Eina_Bool +ewk_notification_silent_get(const Ewk_Notification* ewk_notification); + +#ifdef __cplusplus +} +#endif +#endif // ewk_notification_internal.h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_object_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_object_internal.h new file mode 100644 index 000000000..83edb3ce7 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_object_internal.h @@ -0,0 +1,67 @@ +/* + * copyright (C) 2012 Intel Corporation. All rights reserved. + * Copyright (C) 2014-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_object_internal.h + * @brief Describes the Ewk Ref Counted API. + */ + +#ifndef ewk_object_internal_h +#define ewk_object_internal_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for Ewk_Object */ +typedef struct EwkObject Ewk_Object; + +/** + * Increases the reference count of the given Ewk_Object. + * + * @param object the Ewk_Object instance to increase the reference count + * + * @return a pointer to the object on success, @c NULL otherwise. + */ +EXPORT_API Ewk_Object *ewk_object_ref(Ewk_Object *object); + +/** + * Decreases the reference count of the given Ewk_Object, possibly freeing it. + * + * When the reference count reaches 0, the item is freed. + * + * @param object the Ewk_Object instance to decrease the reference count + */ +EXPORT_API void ewk_object_unref(Ewk_Object *object); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_object_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_page_group_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_page_group_internal.h new file mode 100644 index 000000000..a343d92b6 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_page_group_internal.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2014-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_page_group_internal.h + * @brief Describes the Ewk Page Group API. + */ + +#ifndef ewk_page_group_internal_h +#define ewk_page_group_internal_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Declare Ewk_Page_Group as Ewk_Object. + * + * @see Ewk_Object + */ +typedef struct EwkObject Ewk_Page_Group; + +/** + * Creates a new Ewk_Page_Group. + * + * The returned Ewk_Page_Group object @b should be unref'ed after use. + * + * @return Ewk_Page_Group object on success or @c NULL on failure + * + * @see ewk_object_unref + */ +EXPORT_API Ewk_Page_Group *ewk_page_group_create(const char *identifier); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_page_group_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_policy_decision.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_policy_decision.h new file mode 100644 index 000000000..44c13940d --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_policy_decision.h @@ -0,0 +1,242 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * @file ewk_policy_decision.h + * @brief This file describes the Ewk Policy Decision API. + */ + +#ifndef ewk_policy_decision_h +#define ewk_policy_decision_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + * @{ + */ + +/** + * \enum _Ewk_Policy_Decision_Type + * @brief Enumeration that provides an option to policy decision types. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + */ +enum _Ewk_Policy_Decision_Type { + EWK_POLICY_DECISION_USE, /**< Use */ + EWK_POLICY_DECISION_DOWNLOAD, /**< Download */ + EWK_POLICY_DECISION_IGNORE /**< Ignore */ +}; + +/** + * @brief Enumeration that creates a type name for the Ewk_Policy_Decision_Type. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + */ +typedef enum _Ewk_Policy_Decision_Type Ewk_Policy_Decision_Type; + +/** + * @brief The structure type that creates a type name for Ewk_Policy_Decision. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + */ +typedef struct _Ewk_Policy_Decision Ewk_Policy_Decision; + +/** + * \enum _Ewk_Policy_Navigation_Type + * @brief Enumeration that provides an option to policy navigation types. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + */ +enum _Ewk_Policy_Navigation_Type { + EWK_POLICY_NAVIGATION_TYPE_LINK_CLICKED = 0, /**< Link clicked */ + EWK_POLICY_NAVIGATION_TYPE_FORM_SUBMITTED = 1, /**< Form submitted */ + EWK_POLICY_NAVIGATION_TYPE_BACK_FORWARD = 2, /**< Back forward */ + EWK_POLICY_NAVIGATION_TYPE_RELOAD = 3, /**< Reload */ + EWK_POLICY_NAVIGATION_TYPE_FORM_RESUBMITTED = 4, /**< Form resubmitted */ + EWK_POLICY_NAVIGATION_TYPE_OTHER = 5 /**< Other */ +}; + +/** + * @brief Enumeration that creates a type name for #Ewk_Policy_Navigation_Type. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + */ +typedef enum _Ewk_Policy_Navigation_Type Ewk_Policy_Navigation_Type; + +/** + * @brief Returns a cookie from the Policy Decision object. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] policy_decision The policy decision object + * + * @return The cookie string on success,\n + * otherwise an empty string on failure + */ +EXPORT_API const char* ewk_policy_decision_cookie_get( + Ewk_Policy_Decision* policy_decision); + +/** + * @brief Returns a URL from the Policy Decision object. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] policy_decision The policy decision object + * + * @return The URL string on success,\n + * otherwise an empty string on failure + */ +EXPORT_API const char* ewk_policy_decision_url_get( + Ewk_Policy_Decision* policy_decision); + +/** + * @brief Returns a scheme from the Policy Decision object. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] policy_decision The policy decision object + * + * @return The scheme string on success,\n + * otherwise an empty string on failure + */ +EXPORT_API const char* ewk_policy_decision_scheme_get( + Ewk_Policy_Decision* policy_decision); + +/** + * @brief Returns a host from the Policy Decision object. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] policy_decision The policy decision object + * + * @return The host string on success,\n + * otherwise an empty string on failure + */ +EXPORT_API const char* ewk_policy_decision_host_get( + Ewk_Policy_Decision* policy_decision); + +/** + * @brief Returns an HTTP method from the Policy Decision object. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] policy_decision The policy decision object + * + * @return The HTTP method string on success,\n + * otherwise an empty string on failure + */ +EXPORT_API const char* ewk_policy_decision_http_method_get( + Ewk_Policy_Decision* policy_decision); + +/** + * @brief Returns a MIME type for response data from the Policy Decision object. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] policy_decision policy decision object + * + * @return The MIME type string on success,\n + * otherwise an empty string on failure + */ +EXPORT_API const char* ewk_policy_decision_response_mime_get( + Ewk_Policy_Decision* policy_decision); + +/** + * @brief Return HTTP headers for response data from the Policy Decision object. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] policy_decision The policy decision object + * + * @return The HTTP headers on success,\n + * otherwise @c NULL on failure + */ +EXPORT_API const Eina_Hash* ewk_policy_decision_response_headers_get( + Ewk_Policy_Decision* policy_decision); + +/** + * @brief Returns an HTTP status code from the Policy Decision object. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] policy_decision The policy decision object + * + * @return The HTTP status code number + */ +EXPORT_API int ewk_policy_decision_response_status_code_get( + Ewk_Policy_Decision* policy_decision); + +/** + * @brief Returns a policy type from the Policy Decision object. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] policy_decision The policy decision object + * + * @return The policy type + */ +EXPORT_API Ewk_Policy_Decision_Type +ewk_policy_decision_type_get(const Ewk_Policy_Decision* policy_decision); + +/** + * @brief Accepts the action which triggers this decision. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] policy_decision The policy decision object + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool +ewk_policy_decision_use(Ewk_Policy_Decision* policy_decision); + +/** + * @brief Ignores the action which triggers this decision. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] policy_decision The policy decision object + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool +ewk_policy_decision_ignore(Ewk_Policy_Decision* policy_decision); + +/** + * @brief Returns a navigation type from the Policy Decision object. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] policy_decision The policy decision object + * + * @return The navigation type + */ +EXPORT_API Ewk_Policy_Navigation_Type +ewk_policy_decision_navigation_type_get(Ewk_Policy_Decision* policy_decision); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif // ewk_policy_decision_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_policy_decision_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_policy_decision_internal.h new file mode 100644 index 000000000..5fa1dff4d --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_policy_decision_internal.h @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_policy_decision_internal_h +#define ewk_policy_decision_internal_h + +#include "ewk_frame_internal.h" +#include "ewk_policy_decision.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Returns user id for Authorization from Policy Decision object. + * + * @param policy_decision policy decision object + * + * @return @c user id string on success or empty string on failure + */ +EXPORT_API const char* ewk_policy_decision_userid_get( + const Ewk_Policy_Decision* policy_decision); + +/** + * Returns password for Authorization from Policy Decision object. + * + * @param policy_decision policy decision object + * + * @return @c password string on success or empty string on failure + */ +EXPORT_API const char* ewk_policy_decision_password_get( + const Ewk_Policy_Decision* policy_decision); + +/** + * Suspend the operation for policy decision. + * + * This suspends the operation for policy decision when the signal for policy is + * emitted. This is very useful to decide the policy from the additional UI + * operation like the popup. + * + * @param policy_decision policy decision object + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool +ewk_policy_decision_suspend(Ewk_Policy_Decision* policy_decision); + +/** + * Cause a download from this decision. + * + * @param policy_decision policy decision object + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EINA_DEPRECATED EXPORT_API Eina_Bool +ewk_policy_decision_download(Ewk_Policy_Decision* policy_decision); + +/** + * Gets the frame reference from Policy Decision object. + * + * @param policy_decision policy decision object + * + * @return frame reference on success, or NULL on failure + */ +EXPORT_API Ewk_Frame_Ref +ewk_policy_decision_frame_get(Ewk_Policy_Decision* policy_decision); + +/** + * Checks if frame requested in policy decision is main frame. + * + * @param policy_decision policy decision object + * + * @return @c EINA_TRUE or @c EINA_FALSE + */ +EXPORT_API Eina_Bool +ewk_policy_decision_is_main_frame(const Ewk_Policy_Decision* policy_decision); + +#ifdef __cplusplus +} +#endif +#endif // ewk_policy_decision_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_policy_decision_product.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_policy_decision_product.h new file mode 100644 index 000000000..b89b44087 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_policy_decision_product.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_policy_decision_product_h +#define ewk_policy_decision_product_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Returns http body from Policy Decision object. + * + * @since_tizen 2.4 + * + * @param[in] policy_decision policy decsision object + * + * @return @c http body string on success or empty string on failure + */ +EXPORT_API const char* ewk_policy_decision_http_body_get( + Ewk_Policy_Decision* policy_decision); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif // ewk_policy_decision_product_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_popup_menu_item_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_popup_menu_item_internal.h new file mode 100644 index 000000000..f648d6fc3 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_popup_menu_item_internal.h @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2012-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_popup_menu_item_internal.h + * @brief Describes the Ewk Popup Menu Item API. + */ + +#ifndef ewk_popup_menu_item_internal_h +#define ewk_popup_menu_item_internal_h + +#include +#include + +#include "ewk_view.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** Enum values containing type of popup menu item. */ +typedef enum { + EWK_POPUP_MENU_SEPARATOR, + EWK_POPUP_MENU_ITEM, + EWK_POPUP_MENU_UNKNOWN = -1 +} Ewk_Popup_Menu_Item_Type; + +/** Creates a type name for Ewk_Popup_Menu_Item */ +typedef struct Ewk_Popup_Menu_Item Ewk_Popup_Menu_Item; + +/** + * Returns type of the popup menu item. + * + * @param item the popup menu item instance + * + * @return the type of the @a item or @c EWK_POPUP_MENU_UNKNOWN in case of + * error. + */ +EXPORT_API Ewk_Popup_Menu_Item_Type +ewk_popup_menu_item_type_get(const Ewk_Popup_Menu_Item *item); + +/** + * Returns text of the popup menu item. + * + * @param item the popup menu item instance + * + * @return the text of the @a item or @c NULL in case of error. This pointer is + * guaranteed to be eina_stringshare, so whenever possible + * save yourself some cpu cycles and use + * eina_stringshare_ref() instead of eina_stringshare_add() or + * strdup() + */ +EXPORT_API const char *ewk_popup_menu_item_text_get( + const Ewk_Popup_Menu_Item *item); + +/** + * Returns whether the popup menu item is selected or not. + * + * @param item the popup menu item instance + * + * @return @c EINA_TRUE if the popup menu item is selected, @c EINA_FALSE + * otherwise. + */ +EXPORT_API Eina_Bool +ewk_popup_menu_item_selected_get(const Ewk_Popup_Menu_Item *item); + +#ifdef __cplusplus +} +#endif +#endif // ewk_popup_menu_item_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_quota_permission_request_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_quota_permission_request_internal.h new file mode 100644 index 000000000..0b85c0b12 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_quota_permission_request_internal.h @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_quota_permission_request_internal_h +#define ewk_quota_permission_request_internal_h + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _Ewk_Quota_Permission_Request Ewk_Quota_Permission_Request; + +/** + * Requests for getting protocol of quota permission request + * + * @param request quota permission request + * + * @return protocol of security origin + */ +EXPORT_API Eina_Stringshare* ewk_quota_permission_request_origin_protocol_get( + const Ewk_Quota_Permission_Request* request); + +/** + * Requests for getting host of quota permission request + * + * @param request quota permission request + * + * @return host of security origin + */ +EXPORT_API Eina_Stringshare* ewk_quota_permission_request_origin_host_get( + const Ewk_Quota_Permission_Request* request); + +/** + * Requests for getting port of quota permission request + * + * @param request quota permission request + * + * @return port of security origin + */ +EXPORT_API uint16_t ewk_quota_permission_request_origin_port_get( + const Ewk_Quota_Permission_Request* request); + +/** + * Requests for getting new quota size of quota permission request + * + * @param request quota permission request + * + * @return protocol of security origin + */ +EXPORT_API int64_t ewk_quota_permission_request_quota_get( + const Ewk_Quota_Permission_Request* request); + +/** + * Requests for checking if storage type of quota permission request is + * persistent + * + * @param request quota permission request + * + * @return @c EINA_TRUE if storage is persistent, otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_quota_permission_request_is_persistent_get( + const Ewk_Quota_Permission_Request* request); + +#ifdef __cplusplus +} +#endif +#endif // ewk_quota_permission_request_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_security_origin.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_security_origin.h new file mode 100644 index 000000000..611b1bd4e --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_security_origin.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * @file ewk_security_origin.h + * @brief This file describes the Ewk Security API. + */ + +#ifndef ewk_security_origin_h +#define ewk_security_origin_h + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + * @{ + */ + +/** + * @brief The structure type that creates a type name for #Ewk_Security_Origin. + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + */ +typedef struct _Ewk_Security_Origin Ewk_Security_Origin; + +/** + * @brief Requests for getting host of security origin. + * + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * + * @param[in] origin Security origin + * + * @return host of security origin + */ +EXPORT_API Eina_Stringshare* ewk_security_origin_host_get( + const Ewk_Security_Origin* origin); + +/** + * @brief Requests for getting host of security origin. + * + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * + * @param[in] origin Security origin + * + * @return host of security origin + */ +EXPORT_API Eina_Stringshare* ewk_security_origin_protocol_get( + const Ewk_Security_Origin* origin); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif // ewk_security_origin_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_security_origin_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_security_origin_internal.h new file mode 100644 index 000000000..459cc1678 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_security_origin_internal.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_security_origin_internal_h +#define ewk_security_origin_internal_h + +#include "ewk_security_origin.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Requests for getting host of security origin. + * + * @param origin security origin + * + * @return host of security origin + */ +EXPORT_API uint16_t +ewk_security_origin_port_get(const Ewk_Security_Origin *origin); + +/** + * Release all resources allocated by a security origin object. + * + * @param o security origin object + */ +EXPORT_API void ewk_security_origin_free(Ewk_Security_Origin *o); + +/** + * Creates a security origin for a url. + * + * @param url the url for the security origin. + * + * @return the security origin object + */ +EXPORT_API Ewk_Security_Origin *ewk_security_origin_new_from_string( + const char *url); + +#ifdef __cplusplus +} +#endif +#endif // ewk_security_origin_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_settings.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_settings.h new file mode 100644 index 000000000..402dbd215 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_settings.h @@ -0,0 +1,282 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * @file ewk_settings.h + * @brief This file describes the Ewk Settings API. + * + * @remarks The ewk_settings is used for setting the preference of a specific + * ewk_view. We can get the ewk_settings from ewk_view using + * the ewk_view_settings_get() API. + */ + +#ifndef ewk_settings_h +#define ewk_settings_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + * @{ + */ + +/** + * @brief The structure type that creates a type name for #Ewk_Settings. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + */ +typedef struct Ewk_Settings Ewk_Settings; + +/** + * @if MOBILE + * @brief Requests enable/disable password form autofill + * + * @since_tizen 2.4 + * + * @param[in] settings Settings object to set password form autofill + * @param[in] enable @c EINA_TRUE to enable password form autofill + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success, otherwise @c EINA_FALSE + * @endif + */ +EXPORT_API Eina_Bool ewk_settings_autofill_password_form_enabled_set( + Ewk_Settings* settings, Eina_Bool enable); + +/** + * @if MOBILE + * @brief Requests enable/disable form candidate data for autofill + * + * @since_tizen 2.4 + * + * @param[in] settings Settings object to set form candidate data for autofill + * @param[in] enable @c EINA_TRUE to enable form candidate data for autofill + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success, otherwise @c EINA_FALSE + * @endif + */ +EXPORT_API Eina_Bool ewk_settings_form_candidate_data_enabled_set( + Ewk_Settings* settings, Eina_Bool enable); + +/** + * @if MOBILE + * @brief Enables/disables form autofill profile feature. + * + * @since_tizen 2.4 + * + * @param[in] settings Settings object to set the form autofill profile + * @param[in] enable @c EINA_TRUE to enable the text autosizing + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success, otherwise @c EINA_FALSE + * @endif + */ +EXPORT_API Eina_Bool ewk_settings_form_profile_data_enabled_set( + Ewk_Settings* settings, Eina_Bool enable); + +/** + * @if MOBILE + * @brief Requests setting of auto fit. + * + * @since_tizen 2.3 + * + * @param[in] settings The settings object to fit to width + * @param[in] enable If @c true the settings object is fit to width,\n + * otherwise @c false + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE on failure + * @endif + */ +EXPORT_API Eina_Bool ewk_settings_auto_fitting_set(Ewk_Settings* settings, + Eina_Bool enable); + +/** + * @if MOBILE + * @brief Returns the auto fit status. + * + * @since_tizen 2.3 + * + * @param[in] settings The settings object to fit to width + * + * @return @c EINA_TRUE if auto fit is enabled,\n + * otherwise @c EINA_FALSE + * @endif + */ +EXPORT_API Eina_Bool +ewk_settings_auto_fitting_get(const Ewk_Settings* settings); + +/** + * @brief Enables/disables JavaScript executing. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] settings The settings object to set JavaScript executing + * @param[in] enable If @c EINA_TRUE JavaScript executing is enabled,\n + * otherwise @c EINA_FALSE to disable it + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_javascript_enabled_set(Ewk_Settings* settings, + Eina_Bool enable); + +/** + * @brief Returns whether JavaScript can be executable. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] settings The settings object to query if JavaScript can be + * executed + * + * @return @c EINA_TRUE if JavaScript can be executed,\n + * otherwise @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool +ewk_settings_javascript_enabled_get(const Ewk_Settings* settings); + +/** + * @brief Enables/disables auto loading of images. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] settings The settings object to set auto loading of images + * @param[in] automatic If @c EINA_TRUE auto loading of images is enabled,\n + * otherwise @c EINA_FALSE to disable it + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_loads_images_automatically_set( + Ewk_Settings* settings, Eina_Bool automatic); + +/** + * @brief Returns whether images can be loaded automatically. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] settings The settings object to get auto loading of images + * + * @return @c EINA_TRUE if images are loaded automatically,\n + * otherwise @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool +ewk_settings_loads_images_automatically_get(const Ewk_Settings* settings); + +/** + * @brief Sets the default text encoding name. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] settings The settings object to set the default text encoding name + * @param[in] encoding The default text encoding name + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_default_text_encoding_name_set( + Ewk_Settings* settings, const char* encoding); + +/** + * @brief Gets the default text encoding name. + * + * @details The returned string is guaranteed to be stringshared. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] settings The settings object to query the default text encoding + * name + * + * @return The default text encoding name + */ +EXPORT_API const char* ewk_settings_default_text_encoding_name_get( + const Ewk_Settings* settings); + +/** + * @brief Sets the default font size. + * + * @details By default, the default font size is @c 16. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] settings The settings object to set the default font size + * @param[in] size A new default font size to set + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_default_font_size_set(Ewk_Settings* settings, + int size); + +/** + * @brief Returns the default font size. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] settings The settings object to get the default font size + * + * @return The default font size,\n + * otherwise @c 0 on failure + */ +EXPORT_API int ewk_settings_default_font_size_get(const Ewk_Settings* settings); + +/** + * @brief Enables/disables if the scripts can open new windows. + * + * @details By default, the scripts can open new windows. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] settings The settings object to set if the scripts can open + * new windows + * @param[in] enable If @c EINA_TRUE the scripts can open new windows\n + * otherwise @c EINA_FALSE if not + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE on failure (scripts are disabled) + */ +EXPORT_API Eina_Bool ewk_settings_scripts_can_open_windows_set( + Ewk_Settings* settings, Eina_Bool enable); + +/** + * @brief Returns whether the scripts can open new windows. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] settings The settings object to query whether the scripts can + * open new windows + * + * @return @c EINA_TRUE if the scripts can open new windows\n + * otherwise @c EINA_FALSE if not or on failure (scripts are disabled) + */ +EXPORT_API Eina_Bool +ewk_settings_scripts_can_open_windows_get(const Ewk_Settings* settings); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif // ewk_settings_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_settings_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_settings_internal.h new file mode 100644 index 000000000..ac330f395 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_settings_internal.h @@ -0,0 +1,653 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_settings_internal.h + * @brief Describes the settings API. + * + * @note The ewk_settings is for setting the preference of specific ewk_view. + * We can get the ewk_settings from ewk_view using ewk_view_settings_get() API. + */ + +#ifndef ewk_settings_internal_h +#define ewk_settings_internal_h + +#include "ewk_settings.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Creates a type name for the callback function used to notify the client when + * the continuous spell checking setting was changed by WebKit. + * + * @param enable @c EINA_TRUE if continuous spell checking is enabled or @c + * EINA_FALSE if it's disabled + */ +typedef void (*Ewk_Settings_Continuous_Spell_Checking_Change_Cb)( + Eina_Bool enable); + +/** + * \enum _Ewk_Editable_Link_Behavior + * + * @brief Editable link behavior mode (Must remain in sync with + * WKEditableLinkBehavior) + */ +enum _Ewk_Editable_Link_Behavior { + EWK_EDITABLE_LINK_BEHAVIOR_DEFAULT, + EWK_EDITABLE_LINK_BEHAVIOR_ALWAYS_LIVE, + EWK_EDITABLE_LINK_BEHAVIOR_ONLY_LIVE_WITH_SHIFTKEY, + EWK_EDITABLE_LINK_BEHAVIOR_LIVE_WHEN_NOT_FOCUSED, + EWK_EDITABLE_LINK_BEHAVIOR_NEVER_LIVE +}; +typedef enum _Ewk_Editable_Link_Behavior Ewk_Editable_Link_Behavior; + +enum _Ewk_Legacy_Font_Size_Mode { + EWK_LEGACY_FONT_SIZE_MODE_ALWAYS, + EWK_LEGACY_FONT_SIZE_MODE_ONLY_IF_PIXEL_VALUES_MATCH, + EWK_LEGACY_FONT_SIZE_MODE_NEVER +}; + +typedef enum _Ewk_Legacy_Font_Size_Mode Ewk_Legacy_Font_Size_Mode; + +enum _Ewk_List_Style_Position { + EWK_LIST_STYLE_POSITION_OUTSIDE, /**< Default WebKit value. */ + EWK_LIST_STYLE_POSITION_INSIDE +}; +typedef enum _Ewk_List_Style_Position Ewk_List_Style_Position; + +/* + * Enables/disables the Javascript Fullscreen API. The Javascript API allows + * to request full screen mode, for more information see: + * http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html + * + * Default value for Javascript Fullscreen API setting is @c EINA_TRUE . + * + * @param settings settings object to enable Javascript Fullscreen API + * @param enable @c EINA_TRUE to enable Javascript Fullscreen API or + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_fullscreen_enabled_set(Ewk_Settings *settings, + Eina_Bool enable); + +/** + * Returns whether the Javascript Fullscreen API is enabled or not. + * + * @param settings settings object to query whether Javascript Fullscreen API is + * enabled + * + * @return @c EINA_TRUE if the Javascript Fullscreen API is enabled + * @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool +ewk_settings_fullscreen_enabled_get(const Ewk_Settings *settings); + +/* + * Enables/disables swipe to refresh feature. Swipe to refresh allows + * us to refresh page using swipe gesture. + * + * Default value for swipe to refresh setting is @c EINA_FALSE. + * + * @param settings settings object to enable swipe to refresh feature + * @param enable @c EINA_TRUE to enable swipe to refresh feature or + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_swipe_to_refresh_enabled_set( + Ewk_Settings *settings, Eina_Bool enable); + +/** + * Returns whether swipe to refresh feature is enabled or not. + * + * @param settings settings object to query whether swipe to refresh feature is + * enabled + * + * @return @c EINA_TRUE if the swipe to refresh feature is enabled + * @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool +ewk_settings_swipe_to_refresh_enabled_get(const Ewk_Settings *settings); + +/** + * Requests enables/disables the plug-ins. + * + * @param settings settings object to set the plug-ins + * @param enable @c EINA_TRUE to enable the plug-ins + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_plugins_enabled_set(Ewk_Settings *settings, + Eina_Bool enable); + +/** + * Returs enables/disables the plug-ins. + * + * @param settings settings object to set the plug-ins + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool +ewk_settings_plugins_enabled_get(const Ewk_Settings *settings); + +/** + * Checks whether WebKit supports the @a encoding. + * + * @param encoding the encoding string to check whether WebKit supports it + * + * @return @c EINA_TRUE if WebKit supports @a encoding + * @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool ewk_settings_is_encoding_valid(const char *encoding); + +/** + * Sets link magnifier enabled. + * + * @param settings settings object + * @param enabled link magnifier enabled + */ +EXPORT_API void ewk_settings_link_magnifier_enabled_set(Ewk_Settings *settings, + Eina_Bool enabled); + +/** + * Gets link magnifier enabled. + * + * @param settings settings object + * + * @return @c EINA_TRUE if link magnifier enabled, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool +ewk_settings_link_magnifier_enabled_get(const Ewk_Settings *settings); + +/** + * Requests to enable/disable link effect + * + * @param settings settings object to enable/disable link effect + * + * @param linkEffectEnabled @c EINA_TRUE to enable the link effect + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_link_effect_enabled_set( + Ewk_Settings *settings, Eina_Bool linkEffectEnabled); + +/** + * Returns enable/disable link effect + * + * @param settings settings object to get whether link effect is enabled or + * disabled + * + * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable + */ +EXPORT_API Eina_Bool +ewk_settings_link_effect_enabled_get(const Ewk_Settings *settings); + +/** + * Requests to set using default keypad (default value : true) + * + * @param settings settings object to use default keypad + * @param enable @c EINA_TRUE to use default keypad @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_default_keypad_enabled_set( + Ewk_Settings *settings, Eina_Bool enable); + +/** + * Returns enable/disable using default keypad + * + * @param settings settings object to use default keypad + * + * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable + */ +EXPORT_API Eina_Bool +ewk_settings_default_keypad_enabled_get(const Ewk_Settings *settings); + +/** + * Requests to set using keypad without user action (default value : true) + * + * @param settings settings object using keypad without user action + * @param enable @c EINA_TRUE to use without user action @c EINA_FALSE to + * disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_uses_keypad_without_user_action_set( + Ewk_Settings *settings, Eina_Bool enable); + +/** + * Returns using keypad without user action + * + * @param settings settings object using keypad without user action + * @param settings settings object to query using keypad without user action + * + * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable + */ +EXPORT_API Eina_Bool +ewk_settings_uses_keypad_without_user_action_get(const Ewk_Settings *settings); + +/** + * Requests setting use of text zoom. + * + * @param settings settings object to text zoom + * @param enable to text zoom. + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_text_zoom_enabled_set(Ewk_Settings *settings, + Eina_Bool enable); + +/** + * Returns whether text zoom is enabled or not. + * + * @param settings settings object to text zoom + * + * @return @c EINA_TRUE if enable text zoom or @c EINA_FALSE. + */ +EXPORT_API Eina_Bool +ewk_settings_text_zoom_enabled_get(const Ewk_Settings *settings); + +/** + * Requests enable/disable text selection by default WebKit. + * + * @param settings setting object to set text selection by default WebKit + * @param enable @c EINA_TRUE to enable text selection by default WebKit + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_text_selection_enabled_set( + Ewk_Settings *settings, Eina_Bool enable); + +/** + * Returns if text selection by default WebKit is enabled or disabled. + * + * @param settings setting object to get text selection by default WebKit + * + * @return @c EINA_TRUE if text selection by default WebKit is enabled + * @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool +ewk_settings_text_selection_enabled_get(const Ewk_Settings *settings); + +/** + * Requests enables/disables to clear text selection when webview lose focus + * + * @param settings setting object to set to clear text selection when webview + * lose focus + * @param enable @c EINA_TRUE to clear text selection when webview lose focus + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_clear_text_selection_automatically_set( + Ewk_Settings *settings, Eina_Bool enable); + +/** + * Enables/disables text autosizing. + * + * By default, the text autosizing is disabled. + * + * @param settings settings object to set the text autosizing + * @param enable @c EINA_TRUE to enable the text autosizing + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + * + * @see ewk_settings_text_autosizing_enabled_get() + */ +EXPORT_API Eina_Bool ewk_settings_text_autosizing_enabled_set( + Ewk_Settings *settings, Eina_Bool enable); + +/** + * Returns whether the text autosizing is enabled. + * + * The text autosizing is a feature which adjusts the font size of text in wide + * columns, and makes text more legible. + * + * @param settings settings object to query whether text autosizing is enabled + * + * @return @c EINA_TRUE if the text autosizing is enabled + * @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool +ewk_settings_text_autosizing_enabled_get(const Ewk_Settings *settings); + +/** + * Requests to enable/disable edge effect + * + * @param settings settings object to enable/disable edge effect + * + * @param enable @c EINA_TRUE to enable the edge effect + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool +ewk_settings_edge_effect_enabled_set(Ewk_Settings *settings, Eina_Bool enable); + +/** + * Returns enable/disable edge effect + * + * @param settings settings object to get whether edge effect is enabled or + * disabled + * + * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable + */ +EXPORT_API Eina_Bool +ewk_settings_edge_effect_enabled_get(const Ewk_Settings *settings); + +/** + * Requests to enable/disable to select word by double tap + * + * @param settings settings object to enable/disable to select word by double + * tap + * @param enable @c EINA_TRUE to select word by double tap + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_select_word_automatically_set( + Ewk_Settings *settings, Eina_Bool enabled); + +/** + * Returns enable/disable text selection by double tap + * + * @param settings settings object to get whether word by double tap is selected + * + * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable + */ +EXPORT_API Eina_Bool +ewk_settings_select_word_automatically_get(const Ewk_Settings *settings); + +/** + * Sets legacy font size mode + * + * @param settings settings object + * @param mode legacy font size mode + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_current_legacy_font_size_mode_set( + Ewk_Settings *settings, Ewk_Legacy_Font_Size_Mode mode); + +/** + * Returns set legacy font size mode + * + * @param settings settings object + * + * @return @c Ewk_Legacy_Font_Size_Mode set legacy font size mode + */ +EXPORT_API Ewk_Legacy_Font_Size_Mode +ewk_settings_current_legacy_font_size_mode_get(const Ewk_Settings *settings); + +/** + * Sets to paste image as URI (default: paste as base64-encoded-data) + * + * @param settings settings object + * @param enable @c EINA_TRUE to paste image as URI @c EINA_FALSE to paste + * image as data + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_paste_image_uri_mode_set( + Ewk_Settings *settings, Eina_Bool enabled); + +/** + * Returns whether paste image as URI mode is enabled + * + * @param settings settings object + * + * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable + */ +EXPORT_API Eina_Bool +ewk_settings_paste_image_uri_mode_get(const Ewk_Settings *settings); + +/** + * DEPRECATED. + * Gets the initial position value for the HTML list element
    . + * + * @param settings setting object to get the initial position value + * + * @return the initial position value for the HTML list element. + */ +EINA_DEPRECATED EXPORT_API Ewk_List_Style_Position +ewk_settings_initial_list_style_position_get(const Ewk_Settings *settings); + +/** + * DEPRECATED. + * Sets the initial position value for the HTML list element
      . + * + * This value affect the lists that are going to be created, + * does not make sense to manipulate it for existed elements. + * + * @param settings setting object to set the initial list style position + * @param style a new style to set + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EINA_DEPRECATED EXPORT_API Eina_Bool +ewk_settings_initial_list_style_position_set(Ewk_Settings *settings, + Ewk_List_Style_Position style); + +/** + * Enable or disable supporting of -webkit-text-size-adjust + * + * -webkit-text-size-adjust affects text size adjusting feature. + * + * @param settings setting object to set the support of -webkit-text-size-adjust + * @param enable @c EINA_TRUE to support -webkit-text-size-adjust, @c EINA_FALSE + * not to support + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_webkit_text_size_adjust_enabled_set( + Ewk_Settings *settings, Eina_Bool enabled); + +/** + * @brief Gets the staus of -webkit-text-size-adjust supporting. + * + * @since_tizen 2.3 + * + * @param[in] settings setting object to get the status of + * -webkit-text-size-adjust supporting + * + * @return the status of -webkit-text-size-adjust supporting + */ +EXPORT_API Eina_Bool +ewk_settings_webkit_text_size_adjust_enabled_get(const Ewk_Settings *settings); + +/** + * Requests to enable/disable to detect email address when tapping on email + * address without link property + * + * @param settings settings object to enable/disable to detect email address + * when tapping on email address without link property + * + * @param enable @c EINA_TRUE to enable to detect email address when tapping on + * email address without link property + * @c EINA_FALSE to disable + */ +EXPORT_API void ewk_settings_detect_contents_automatically_set( + Ewk_Settings *settings, Eina_Bool enable); + +/** + * Returns enable/disable to detect email address when tapping on email address + * without link property + * + * @param settings settings object to get whether email address is detected when + * tapping on email address without link property + * + * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable + */ +EXPORT_API Eina_Bool +ewk_settings_detect_contents_automatically_get(const Ewk_Settings *settings); + +/** + * Sets cache builder mode enabled. + * + * @param settings settings object + * @param enabled cache builder mode + */ +EXPORT_API void ewk_settings_cache_builder_enabled_set(Ewk_Settings *settings, + Eina_Bool enabled); + +/** + * Requests enables/disables to the specific extra feature + * + * @param settings setting object to enable/disable the specific extra feature + * @param feature feature name + * @param enable @c EINA_TRUE to enable the specific extra feature + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API void ewk_settings_extra_feature_set(Ewk_Settings *settings, + const char *feature, + Eina_Bool enable); + +/** + * Returns enable/disable to the specific extra feature + * + * @param settings settings object to get whether the specific extra feature is + * enabled or not. + * @param feature feature name + * + * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable + */ +EXPORT_API Eina_Bool ewk_settings_extra_feature_get( + const Ewk_Settings *settings, const char *feature); + +/** + * Enables/disables the javascript access to clipboard. + * + * By default, JavaScript access to clipboard is disabled. + * + * @param settings settings object to set javascript access to clipboard + * @param enable @c EINA_TRUE to enable javascript access to clipboard + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_javascript_can_access_clipboard_set( + Ewk_Settings *settings, Eina_Bool enable); + +/** + * Returns whether javascript access to clipboard is enabled. + * + * @param settings settings object to query if the javascript can access to + * clipboard + * + * @return @c EINA_TRUE if the javascript can access to clipboard + * @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool +ewk_settings_javascript_can_access_clipboard_get(const Ewk_Settings *settings); + +/** + * Enables/disables the DOM Paste is allowed. + * + * By default, DOM Paste is disabled. + * + * @param settings settings object to set DOM Paste allowance + * @param enable @c EINA_TRUE to enable DOM Paste + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_dom_paste_allowed_set(Ewk_Settings *settings, + Eina_Bool enable); + +/** + * Returns whether DOM Paste is allowed. + * + * @param settings settings object to query if the DOM Paste is enabled. + * + * @return @c EINA_TRUE if the DOM Paste is enabled + * @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool +ewk_settings_dom_paste_allowed_get(const Ewk_Settings *settings); + +/** + * Sets compatibility mode with the given Tizen version. + * + * @since_tizen 3.0 + * + * This API allows rendering the pages as if they are run with the specified + * engine version. The compatibility mode changes behavior of web features + * since they follow the newest specifications resulting in different behaviour + * for web apps/pages written for earlier engines. + * + * To have content compatible with Tizen 2.4 (WebKit) one should call: + * ewk_settings_tizen_compatibility_mode_set(settings, 2, 4, 0); + * + * This API must be called before loading content. + * + * @param settings setting object on which compatibility mode is set + * @param major major version + * @param minor minor version + * @param release release version + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_tizen_compatibility_mode_set( + Ewk_Settings *settings, unsigned major, unsigned minor, unsigned release); + +/** + * Sets whether the webview supports multiple windows. + * + * If set to true, 'create,window' callback must be implemented by appliction. + * If it is false, current webview will be reused to navigate. + * + * Default value is @c EINA_TRUE. + * + * @since_tizen 6.0 + * + * @param settings setting object + * @param support whether to support multiple windows + */ +EXPORT_API void ewk_settings_multiple_windows_support_set( + Ewk_Settings *settings, Eina_Bool support); + +/** + * Gets whether the webview supports multiple windows. + * + * @since_tizen 6.0 + * + * @param settings setting object + */ +EXPORT_API Eina_Bool +ewk_settings_multiple_windows_support_get(Ewk_Settings *settings); + +#ifdef __cplusplus +} +#endif +#endif // ewk_settings_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_settings_product.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_settings_product.h new file mode 100644 index 000000000..122ecf7e0 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_settings_product.h @@ -0,0 +1,967 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_settings_product.h + * @brief Describes the settings API. + * + * @note The ewk_settings is for setting the preference of specific ewk_view. + * We can get the ewk_settings from ewk_view using ewk_view_settings_get() API. + */ + +#ifndef ewk_settings_product_h +#define ewk_settings_product_h + +#include "ewk_settings_internal.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Requests setting of force zoom. + * + * @param settings settings object to enable force zoom + * @param enable to force zoom + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_force_zoom_set(Ewk_Settings* settings, + Eina_Bool enable); + +/** + * Returns the force zoom status. + * + * @param settings settings object to enable force zoom + * + * @return @c EINA_TRUE if enable force zoom or @c EINA_FALSE. + */ +EXPORT_API Eina_Bool ewk_settings_force_zoom_get(const Ewk_Settings* settings); + +/** + * Requests to set the default font size. + * + * @param settings settings object to set the default font size + * @param size a new default font size to set + * + * @return @c EINA_TRUE on success @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_settings_font_default_size_set(Ewk_Settings* settings, + int size); + +/** + * Returns the default font size. + * + * @param settings settings object to set the default font size + * + * @return @c default font size. + */ +EXPORT_API int ewk_settings_font_default_size_get(const Ewk_Settings* settings); + +/** + * Requests enables/disables if the scripts can open the new windows. + * + * @param settings settings object to set if the scripts can open the new + * windows + * @param allow @c EINA_TRUE if the scripts can open the new windows + * @c EINA_FALSE if not + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure (scripts are + * disabled) + */ +EXPORT_API Eina_Bool +ewk_settings_scripts_window_open_set(Ewk_Settings* settings, Eina_Bool allow); + +/** + * Returns enables/disables if the scripts can open the new windows. + * + * @param settings settings object to set if the scripts can open the new + * windows + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure (scripts are + * disabled) + */ +EXPORT_API Eina_Bool +ewk_settings_scripts_window_open_get(const Ewk_Settings* settings); + +/** + * Returns default text encoding name. + * + * @param settings settings object to query default text encoding nae + * + * @return default text encoding name + */ +EXPORT_API const char* ewk_settings_default_encoding_get( + const Ewk_Settings* settings); + +/** + * Requests to set default text encoding name. + * + * @param settings settings object to set default text encoding name + * @param encoding default text encoding name + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_default_encoding_set(Ewk_Settings* settings, + const char* encoding); + +/** + * Requests to set editable link behavior. + * + * @param settings settings object to set editable link behavior + * @param behavior editable link behaviro + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_editable_link_behavior_set( + Ewk_Settings* settings, Ewk_Editable_Link_Behavior behavior); + +/** + * Requests to set the load remote images enable/disable + * + * @param settings settings object to set load remote images + * + * @param loadRemoteImages @c EINA_TRUE to enable the load remote images + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_load_remote_images_set( + Ewk_Settings* settings, Eina_Bool loadRemoteImages); + +/** + * Returns enable/disable the load remote images + * + * @param settings settings object to get editable link behavior + * + * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable + */ +EXPORT_API Eina_Bool +ewk_settings_load_remote_images_get(const Ewk_Settings* settings); + +/** + * Returns uses encoding detector. + * + * @deprecated Deprecated since Tizen 3.0. + * + * @param settings settings object to query uses encoding detector + * + * @see ewk_settings_encoding_detector_enabled_get + * + * @return uses encoding detector + */ +EINA_DEPRECATED EXPORT_API Eina_Bool +ewk_settings_uses_encoding_detector_get(const Ewk_Settings* settings); + +/** + * Returns if password form autofill is enabled or disabled. + * + * @param setting setting object to get password form autofill + * + * @return @c EINA_TRUE if password form autofill is enabled + * @c EINA_FALSE if password form autofill is disabled + */ +EXPORT_API Eina_Bool +ewk_settings_autofill_password_form_enabled_get(Ewk_Settings* settings); + +/** + * Returns if form candidate data for autofill is enabled or disabled. + * + * @param setting setting object to get form candidate data for autofill + * + * @return @c EINA_TRUE if form candidate data for autofill is enabled + * @c EINA_FALSE if form candidate data for autofill is disabled + */ +EXPORT_API Eina_Bool +ewk_settings_form_candidate_data_enabled_get(Ewk_Settings* settings); + +/** + * Returns whether the autofill_text feature is enabled. + * + * @param settings settings object to query whether autofill_text feature is + * enabled + * + * @return @c EINA_TRUE if the autofill_text feature is enabled + * @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool +ewk_settings_form_profile_data_enabled_get(const Ewk_Settings* settings); + +/** + * Returns whether text selection is cleared when webview lose focus or not. + * + * @param settings setting object to get whether text selection is cleared when + * webview lose focus or not + * + * @return @c EINA_TRUE if text selection is cleared when webview lose focus + * @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool ewk_settings_clear_text_selection_automatically_get( + const Ewk_Settings* settings); + +/** + * Requests for drawing layer borders. + * + * @param settings settings object to drawing layer borders. + * @param enable EINA_TRUE to draw layer borders. + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ + +EXPORT_API Eina_Bool ewk_settings_compositing_borders_visible_set( + Ewk_Settings* settings, Eina_Bool enable); + +/** + * Requests to set the scan malware enable/disable. + * + * @param settings settings object to set scan malware + * + * @param scan_malware_enabled @c EINA_TRUE to enable the scan malware + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_scan_malware_enabled_set( + Ewk_Settings* settings, Eina_Bool scan_malware_enabled); + +/** + * @brief Returns enable/disable scan malware. + * + * @since_tizen 2.3 + * + * @param[in] settings settings object to get malware scan behavior + * + * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable + */ +EXPORT_API Eina_Bool +ewk_settings_scan_malware_enabled_get(const Ewk_Settings* settings); + +/** + * Requests to enable/disable spdy. + * + * @deprecated Deprecated since Tizen 4.0. + * + * @param settings param not needed, only present for API compatibility + * + * @param spdy_enabled @c EINA_TRUE to enable the spdy @c EINA_FALSE to disable + * + * @return always @c EINA_TRUE, only present for API compatibility + */ +EINA_DEPRECATED EXPORT_API Eina_Bool +ewk_settings_spdy_enabled_set(Ewk_Settings* settings, Eina_Bool spdy_enabled); + +/** + * Get spdy enabled/disabled state. + * + * @deprecated Deprecated since Tizen 4.0. + * + * @param settings param not needed, only present for API compatibility + * + * @return @c EINA_TRUE if enabled or @c EINA_FALSE if disabled + */ +EINA_DEPRECATED EXPORT_API Eina_Bool +ewk_settings_spdy_enabled_get(Ewk_Settings* settings); + +/** + * Requests to set the performance features of soup enable/disable. + * + * @param settings settings object to set performance features on soup + * + * @param spdy_enabled @c EINA_TRUE to enable the performance features on soup + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_performance_features_enabled_set( + Ewk_Settings* settings, Eina_Bool performance_features_enabled); + +/** + * @brief Returns enable/disable performance features on soup. + * + * @since_tizen 2.3 + * + * @param[in] settings settings object to get performance features + * + * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable + */ +EXPORT_API Eina_Bool +ewk_settings_performance_features_enabled_get(const Ewk_Settings* settings); + +/** + * Requests to set using encoding detector. + * + * @deprecated Deprecated since Tizen 3.0. + * + * @param settings settings object to set using encoding detector + * @param use use encoding detector + * + * @see ewk_settings_encoding_detector_enabled_set + */ +EINA_DEPRECATED EXPORT_API Eina_Bool +ewk_settings_uses_encoding_detector_set(Ewk_Settings* settings, Eina_Bool use); + +/** + * Enables/disables the encoding detector. + * + * By default, the encoding detector is disabled. + * + * @param settings settings object to set the encoding detector + * @param enable @c EINA_TRUE to enable the encoding detector, + * @c EINA_FALSE to disable + * + * @since_tizen 3.0 + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_encoding_detector_enabled_set( + Ewk_Settings* settings, Eina_Bool enable); + +/** + * Queries whether the encoding detector is enabled or not. + * + * @since_tizen 3.0 + * + * @param settings settings object to query using encoding detector + * + * @return @c EINA_TRUE if encoding detecor is enabled + * @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool +ewk_settings_encoding_detector_enabled_get(const Ewk_Settings* settings); + +/** + * Set to load https sub resource when it has certificate error. + * + * @param settings settings object to enable/disable load sub resource + * @param enabled a state to set + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_load_sub_resource_with_certificate_error_set( + Ewk_Settings* settings, Eina_Bool enabled); + +/* + * Set to add http head DNT(do not track). + * + * @param settings settings object to enable/disable set DNT in http head. + * @param enabled a state to set + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_do_not_track_set(Ewk_Settings* settings, + Eina_Bool enabled); + +/** + *@brief Set to allow running mixed contents or not. + * + * @since_tizen 3.0 + * + * @param[in] settings The settings object to set mixed contents reply + * @param[in] allow If @c EINA_TRUE allow to run mixed contents\n + * otherwise @c EINA_FALSE to not allow running mixed contents + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool +ewk_settings_mixed_contents_set(const Ewk_Settings* settings, Eina_Bool allow); + +/** + * @deprecated Deprecated since Tizen 3.0. + * + * Enable/disable cache builder extension mode. + * + * By default, the cache builder extension is disabled. + * Notify node position to client when focused node is change. + * Can find focusable node from last known mouse position. + * Support fast scroll when long pressing the direction key. + * + * @param settings settings object + * @param enabled @c EINA_TRUE to enable the cache builder extension + * @c EINA_FALSE to disable + */ +EINA_DEPRECATED EXPORT_API void +ewk_settings_cache_builder_extension_enabled_set(Ewk_Settings* settings, + Eina_Bool enabled); + +/** + * @deprecated Deprecated since Tizen 3.0. + * + * Enable/disable focus ring. + * + * @note Focus ring is enabled by default but disabled for wrt on TV profile + * + * @param settings settings object + * @param enabled @c EINA_TRUE to enable the focus ring + * @c EINA_FALSE to disable + */ +EINA_DEPRECATED EXPORT_API void ewk_settings_focus_ring_enabled_set( + Ewk_Settings* settings, Eina_Bool enabled); + +/** + * Enables/disables the viewport meta tag. + * + * By default, the viewport meta tag is enabled on mobile and wearable, + * but it is disabled on TV. + * + * @param settings settings object + * @param enable @c EINA_TRUE to enable the viewport meta tag + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_viewport_meta_tag_set(Ewk_Settings* settings, + Eina_Bool enable); + +/** + * Returns whether the viewport meta tag is enabled. + * + * @param settings settings object + * + * @return @c EINA_TRUE if the viewport meta tag is enabled + * @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool +ewk_settings_viewport_meta_tag_get(const Ewk_Settings* settings); + +/** + * Allow/disallow to run and display mixed contents. + * + * By default, WebCore don't allow run and display mixed contents. + * Some Apps want to allow them by default + * + * @param settings settings object + * @param enable @c EINA_TRUE to allow run and display mixed contents + * @c EINA_FALSE to disable + * + */ +EXPORT_API void ewk_settings_default_mixed_contents_policy_set( + Ewk_Settings* settings, Eina_Bool enable); + +/** + * Enable/disable the WebGL feature. + * + * By default, the WebGL feature is Enabled. + * Some Apps want to disallow WebGL feature. + * + * @note Should be used before ewk_view_url_set(). + * + * @param settings settings object + * @param disable @c EINA_TRUE to disable WebGL. + * @c EINA_FALSE to enable. + * + */ +EXPORT_API void ewk_settings_disable_webgl_set(Ewk_Settings* settings, + Eina_Bool disable); + +/** + * Enables/disables web security. + * + * By default, the web security is enabled. + * + * @param settings settings object to set the web security + * @param enable @c EINA_TRUE to enable the web security + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + * + * @see ewk_settings_web_security_enabled_get() + */ +EXPORT_API Eina_Bool +ewk_settings_web_security_enabled_set(Ewk_Settings* settings, Eina_Bool enable); + +/** + * Returns whether the web security is enabled. + * + * @param settings settings object to query whether web security is enabled + * + * @return @c EINA_TRUE if the web security is enabled + * @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool +ewk_settings_web_security_enabled_get(const Ewk_Settings* settings); + +/** + * Set to uses the arrow scroll. + * + * @param settings settings object + * @param enabled a state to set + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_uses_arrow_scroll_set(Ewk_Settings* settings, + Eina_Bool enabled); + +/** + * Returns whether uses arrow scroll is enabled or not. + * + * @param settings settings object + * + * @return @c EINA_TRUE if uses arrow is enabled, @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_settings_uses_arrow_scroll_get(Ewk_Settings* settings); + +/** + * Set to uses scrollbar thumb focus notifications. + * + * @param settings settings object + * @param enabled a state to set + */ +EXPORT_API Eina_Bool ewk_settings_uses_scrollbar_thumb_focus_notifications_set( + Ewk_Settings* settings, Eina_Bool use); + +/** + * Allow/Disallow file access from external url + * + * By default, file access from external url is disallowed + * + * This is only for TV Product + * + * @param settings settings object to allow file access from external url + * @param enable @c EINA_TRUE to allow file access from external url + * @c EINA_FALSE to disallow + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + * + * @see ewk_settings_allow_file_access_from_external_url_get() + */ +EXPORT_API Eina_Bool ewk_settings_allow_file_access_from_external_url_set( + Ewk_Settings* settings, Eina_Bool allow); + +/** + * Set to support the media playback notification. + * + * This is only for TV Product + * + * @param settings settings object + * @param enabled a state to set + * + */ +EXPORT_API void ewk_settings_media_playback_notification_set( + Ewk_Settings* settings, Eina_Bool enabled); + +/** + * Returns enable/disable the media playback notification. + * + * This is only for TV Product + * + * @param settings settings object + * + * @return @c EINA_TRUE if media plyaback notification is enabled, @c EINA_FALSE + * otherwise + */ +EXPORT_API Eina_Bool +ewk_settings_media_playback_notification_get(const Ewk_Settings* settings); + +/** + * Set to support the subtitle notification. + * + * @param settings settings object + * @param enabled a state to set + * + */ +EXPORT_API void ewk_settings_media_subtitle_notification_set( + Ewk_Settings* settings, Eina_Bool enabled); + +/** + * Returns enable/disable the subtitle notification. + * + * @param settings settings object + * + * @return @c EINA_TRUE if subtitle notification is enabled, @c EINA_FALSE +otherwise + */ +EXPORT_API Eina_Bool +ewk_settings_media_subtitle_notification_get(const Ewk_Settings* settings); + +/** + * Returns whether file access from external url is enabled + * + * This is only for TV Product + * + * @param settings settings object to query whether file access from external + * url is enabled + * + * @return @c EINA_TRUE if file access from external url is allow + * @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool ewk_settings_allow_file_access_from_external_url_get( + const Ewk_Settings* settings); + +/** + * @brief Requests to enable/disable private browsing. + * + * @details This setting change affects all webview with same context. + * + * @since_tizen 2.3 + * + * @param[in] settings The settings object to set private browsing + * @param[in] enable If @c EINA_TRUE private browsing is enabled\n + * otherwise @c EINA_FALSE to disable it + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_private_browsing_enabled_set( + Ewk_Settings* settings, Eina_Bool enable); + +/** + * @brief Enables/disables private browsing. + * + * @since_tizen 2.3 + * + * @param[in] settings The settings object to query if private browsing is + * enabled + * + * @return @c EINA_TRUE if private browsing is enabled,\n + * otherwise @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool +ewk_settings_private_browsing_enabled_get(const Ewk_Settings* settings); + +/** + * Requests enables/disables to the specific extra feature + * + * @param settings setting object to enable/disable the specific extra feature + * @param feature feature name + * @param enable @c EINA_TRUE to enable the specific extra feature + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API void ewk_settings_extra_feature_set(Ewk_Settings* settings, + const char* feature, + Eina_Bool enable); + +/** + * Returns enable/disable to the specific extra feature + * + * @param settings settings object to get whether the specific extra feature is + * enabled or not. + * @param feature feature name + * + * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable + */ +EXPORT_API Eina_Bool ewk_settings_extra_feature_get( + const Ewk_Settings* settings, const char* feature); + +/** + * Enables/disables text autosizing. + * + * By default, the text autosizing is disabled. + * + * @param settings settings object to set the text autosizing + * @param enable @c EINA_TRUE to enable the text autosizing + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + * + * @see ewk_settings_text_autosizing_enabled_get() + */ +EXPORT_API Eina_Bool ewk_settings_text_autosizing_enabled_set( + Ewk_Settings* settings, Eina_Bool enable); + +/** + * Returns whether the text autosizing is enabled. + * + * The text autosizing is a feature which adjusts the font size of text in wide + * columns, and makes text more legible. + * + * @param settings settings object to query whether text autosizing is enabled + * + * @return @c EINA_TRUE if the text autosizing is enabled + * @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool +ewk_settings_text_autosizing_enabled_get(const Ewk_Settings* settings); + +/** + * Sets the scale factor for text autosizing. + * + * Default value is 1.0. + * + * @param settings settings object to set the text autosizing + * @param factor font scale factor for text autosizing + */ +EXPORT_API Eina_Bool ewk_settings_text_autosizing_font_scale_factor_set( + Ewk_Settings* settings, double factor); + +/** + * Gets the current scale factor for text autosizing. + * + * @param settings settings object to set scale factor for text autosizing + * + * @return the current font scale factor for text autosizing. + * In case of error, it returns non-positive value. + */ +EXPORT_API double ewk_settings_text_autosizing_font_scale_factor_get( + const Ewk_Settings* settings); + +/** + * @brief Sets the scale factor for text autosizing. + * + * @details Default value is 1.0. + * + * @param settings settings object to set the text autosizing + * @param factor font scale factor for text autosizing + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_text_autosizing_scale_factor_set( + Ewk_Settings* settings, double factor); + +/** + * @brief Gets the current scale factor for text autosizing. + * + * @param settings settings object to set scale factor for text autosizing + * + * @return the current font scale factor for text autosizing + */ +EXPORT_API double ewk_settings_text_autosizing_scale_factor_get( + const Ewk_Settings* settings); + +/** + * Sets text style for selection mode enabled. + * + * @param settings settings object + * @param enabled text style for selection mode + */ + +EXPORT_API void ewk_settings_text_style_state_enabled_set( + Ewk_Settings* settings, Eina_Bool enabled); + +/** + * Gets text style for selection mode enabled. + * + * @param settings settings object + * + * @return @c EINA_TRUE if text style for selection mode enabled, @c EINA_FALSE + * otherwise + */ +EXPORT_API Eina_Bool +ewk_settings_text_style_state_enabled_get(const Ewk_Settings* settings); + +/** + * @brief Enables/disables legacy font size mode + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] settings settings object + * @param[in] enable If @c EINA_TRUE legacy font size is enabled\n + * otherwise @c EINA_FALSE to disable it + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_legacy_font_size_enabled_set( + Ewk_Settings* settings, Eina_Bool enabled); + +/** + * @brief Return whether legacy font size mode is enabled + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] settings settings object + * + * @return @c EINA_TRUE if Ewk_Legacy_Font_Size_Mode set to legacy font size + * mode + * @c EINA_FALSE if Ewk_Legacy_Font_Size_Mode not set to legacy font size + * mode + */ +EXPORT_API Eina_Bool +ewk_settings_legacy_font_size_enabled_get(Ewk_Settings* settings); + +/** + * @brief Sets font-family as system font for font rendering + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] settings settings object + * @param[in] use @c EINA_TRUE to use one of the system fonts which is selected + * by user in Settings + * @c EINA_FALSE to use a system default font + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_settings_use_system_font_set(Ewk_Settings* settings, + Eina_Bool use); + +/** + * @brief Returns whether we use the system font which is selected by user in + * Settings or use a system default font + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] settings settings object + * + * @return @c EINA_TRUE if we use the sysem font which is selected by user in + * Settings + * @c EINA_FALSE if we use a system default font or on failure + */ +EXPORT_API Eina_Bool ewk_settings_use_system_font_get(Ewk_Settings* settings); + +/** + * @brief Requests enables/disables to control text selection handles from app + * + * @since_tizen 2.3 + * + * @param[in] settings setting object to set to control text selection handles + * from app + * @param[in] enable @c EINA_TRUE to control text selection handles from app\n + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API void ewk_settings_selection_handle_enabled_set( + Ewk_Settings* settings, Eina_Bool enable); + +/** +* @brief Returns whether text selection handles are controlled from app or not +* +* @since_tizen 2.3 +* +* @param[in] settings setting object to get whether text selection handles are +controlled from app or not +* +* @return @c EINA_TRUE if text selection handles are controlled from app\n +* @c EINA_FALSE if not or on failure +*/ +EXPORT_API Eina_Bool +ewk_settings_selection_handle_enabled_get(const Ewk_Settings* settings); + +/** + * @brief disclose Set-Cookie headers over IPC. + * Some apps which get cookie through xhr.getAllResponseHeaders interface + * Currently blink don't disclose response header with Set-Cookie field + * to XMLHttpRequest. + * + * @since_tizen 3.0 + * + * @param[in] settings setting object + * @param[in] Enabled true means app allow to disclose "Set-Cookie" + * + */ +EXPORT_API void ewk_settings_disclose_set_cookie_headers_enabled( + Ewk_Settings* settings, Eina_Bool Enabled); + +/** + * @brief Request to set the spatial navigation usage set by hbbtv + * + * @since_tizen 3.0 + * + * @param[in] settings setting object + * @param[in] enable @c EINA_TRUE enable to use spatial navigation + * @c EINA_FALSE to disable + */ +EXPORT_API void ewk_settings_spatial_navigation_enabled_set( + Ewk_Settings* settings, Eina_Bool enable); + +/** + * Request to set enable/disable the ime panel + * + * By default, the ime panel is enabled + * Some Apps want to disable ime panel + * + * @param settings setting object + * @param enabled @c EINA_TRUE to enable ime panel + * @c EINA_FALSE to disable ime panel + * + */ +EXPORT_API void ewk_settings_ime_panel_enabled_set(Ewk_Settings* settings, + Eina_Bool enabled); + +/** + * Returns whether the ime panel is enabled or disabled + * + * @param settings setting object + * + * @return @c EINA_TRUE enable ime panel or @c EINA_FALSE disable ime panel + */ +EXPORT_API Eina_Bool +ewk_settings_ime_panel_enabled_get(const Ewk_Settings* settings); + +/** + * Request to set enable/disable drag and drop + * + * By default, the drag and drop is Disabled + * + * @param settings settings object + * @param enabled @c EINA_TRUE to enable drag and drop + * @c EINA_FALSE to disable drag and drop + * + */ +EXPORT_API void ewk_settings_drag_drop_enabled_set(Ewk_Settings* settings, + Eina_Bool enabled); + +/** + * Returns whether drag and drop is enabled or disabled + * + * @param settings settings object + * + * @return @c EINA_TRUE drag and drop is enabled, @c EINA_FALSE drag and drop is + * disabled + */ +EXPORT_API Eina_Bool +ewk_settings_drag_drop_enabled_get(const Ewk_Settings* settings); + +/** + * Request to set enable/disable clipboard + * + * By default, the clipboard is Disabled + * + * @param settings settings object + * @param enabled @c EINA_TRUE to enable clipboard + * @c EINA_FALSE to disable clipboard + * + */ +EXPORT_API void ewk_settings_clipboard_enabled_set(Ewk_Settings* settings, + Eina_Bool enabled); + +/** + * Returns whether clipboard is enabled + * + * @param settings settings object + * + * @return @c EINA_TRUE clipboard is enabled, @c EINA_FALSE clipboard is + * disabled + */ +EXPORT_API Eina_Bool +ewk_settings_clipboard_enabled_get(const Ewk_Settings* settings); + +/** + * Request to enable/disable create select menu by client + * + * By default, the disabled create select menu by client + * + * @param settings settings object + * @param enabled @c EINA_TRUE to enable create select pick by client + * @c EINA_FALSE to disable create select pick by client + * + */ +EXPORT_API void ewk_settings_create_select_menu_by_client( + Ewk_Settings* settings, Eina_Bool enabled); + +#ifdef __cplusplus +} +#endif +#endif // ewk_settings_product_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_storage_manager_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_storage_manager_internal.h new file mode 100644 index 000000000..b3a68a4c5 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_storage_manager_internal.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2012-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_storage_manager_internal.h + * @brief Describes the Ewk Storage Manager API. + * + * Ewk Storage Manager manages web storage. + */ + +#ifndef ewk_storage_manager_internal_h +#define ewk_storage_manager_internal_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for Ewk_Storage_Manager. */ +typedef struct EwkStorageManager Ewk_Storage_Manager; + +/** + * Deletes all local storage. + * + * @param manager Ewk_Storage_Manager object + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool +ewk_storage_manager_entries_clear(Ewk_Storage_Manager *manager); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_storage_manager_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_text_style_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_text_style_internal.h new file mode 100644 index 000000000..2fa4049a6 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_text_style_internal.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_text_style_internal_h +#define ewk_text_style_internal_h + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + EWK_TEXT_STYLE_STATE_FALSE, + EWK_TEXT_STYLE_STATE_TRUE, + EWK_TEXT_STYLE_STATE_MIXED +} Ewk_Text_Style_State; + +typedef struct _Ewk_Text_Style Ewk_Text_Style; + +EINA_DEPRECATED EXPORT_API Ewk_Text_Style_State +ewk_text_style_underline_get(Ewk_Text_Style* text_style); +EINA_DEPRECATED EXPORT_API Ewk_Text_Style_State +ewk_text_style_italic_get(Ewk_Text_Style* text_style); +EINA_DEPRECATED EXPORT_API Ewk_Text_Style_State +ewk_text_style_bold_get(Ewk_Text_Style* text_style); +EINA_DEPRECATED EXPORT_API Ewk_Text_Style_State +ewk_text_style_ordered_list_get(Ewk_Text_Style* text_style); +EINA_DEPRECATED EXPORT_API Ewk_Text_Style_State +ewk_text_style_unordered_list_get(Ewk_Text_Style* text_style); +EINA_DEPRECATED EXPORT_API Eina_Bool ewk_text_style_position_get( + Ewk_Text_Style* text_style, Evas_Point* start_point, Evas_Point* end_point); +EINA_DEPRECATED EXPORT_API Eina_Bool ewk_text_style_bg_color_get( + Ewk_Text_Style* textStyle, int* r, int* g, int* b, int* a); +EINA_DEPRECATED EXPORT_API Eina_Bool ewk_text_style_color_get( + Ewk_Text_Style* textStyle, int* r, int* g, int* b, int* a); +EINA_DEPRECATED EXPORT_API const char* ewk_text_style_font_size_get( + Ewk_Text_Style* textStyle); +EINA_DEPRECATED EXPORT_API Eina_Bool +ewk_text_style_has_composition_get(Ewk_Text_Style* textStyle); +EINA_DEPRECATED EXPORT_API Ewk_Text_Style_State +ewk_text_style_align_center_get(Ewk_Text_Style* textStyle); +EINA_DEPRECATED EXPORT_API Ewk_Text_Style_State +ewk_text_style_align_left_get(Ewk_Text_Style* textStyle); +EINA_DEPRECATED EXPORT_API Ewk_Text_Style_State +ewk_text_style_align_right_get(Ewk_Text_Style* textStyle); +EINA_DEPRECATED EXPORT_API Ewk_Text_Style_State +ewk_text_style_align_full_get(Ewk_Text_Style* textStyle); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_text_style_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_touch_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_touch_internal.h new file mode 100644 index 000000000..ffa791beb --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_touch_internal.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2012-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_touch_internal_h +#define ewk_touch_internal_h + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/// Represents types of touch event. +typedef enum { + EWK_TOUCH_START, + EWK_TOUCH_MOVE, + EWK_TOUCH_END, + EWK_TOUCH_CANCEL +} Ewk_Touch_Event_Type; + +/// Creates a type name for Ewk_Touch_Point. +typedef struct _Ewk_Touch_Point Ewk_Touch_Point; + +/// Represents a touch point. +struct _Ewk_Touch_Point { + int id; /**< identifier of the touch event */ + int x; /**< the horizontal position of the touch event */ + int y; /**< the vertical position of the touch event */ + Evas_Touch_Point_State state; /**< state of the touch event */ +}; + +#ifdef __cplusplus +} +#endif + +#endif // ewk_touch_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_tracing_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_tracing_internal.h new file mode 100644 index 000000000..3487d0b26 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_tracing_internal.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2014-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_tracing_internal_h +#define ewk_tracing_internal_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Start recording traces. + * + * @param categories comma separated list of categories e.g. cc,ipc + * @param trace_options traces options (currently not used). + * @param trace_file_name filename in which traces should be recorded. + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure. + */ +EXPORT_API Eina_Bool ewk_start_tracing(const char* categories, + const char* trace_options, + const char* trace_file_name); + +/** + * Stop recording traces, works only if recording is started before calling + * this. + */ +EXPORT_API void ewk_stop_tracing(); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_tracing_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_user_media_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_user_media_internal.h new file mode 100644 index 000000000..bf8ee58c0 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_user_media_internal.h @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_user_media_internal_h +#define ewk_user_media_internal_h + +#include +#include + +#include "ewk_security_origin_internal.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _Ewk_User_Media_Permission_Request + Ewk_User_Media_Permission_Request; + +/** + * enum _Ewk_User_Media_Device_Type + * @brief Contains device type option for media permission request + * + */ +enum _Ewk_User_Media_Device_Type { + EWK_USER_MEDIA_DEVICE_TYPE_NONE = 0, + EWK_USER_MEDIA_DEVICE_TYPE_MICROPHONE = 1, /* MicroPhone type */ + EWK_USER_MEDIA_DEVICE_TYPE_CAMERA = 2, /* Camera type */ + EWK_USER_MEDIA_DEVICE_TYPE_MICROPHONE_AND_CAMERA = + 3 /* Both MicroPhone and Camera. */ +}; + +/** + * @brief The enum type that creates a type name for + * _Ewk_User_Media_Device_Type. + */ +typedef enum _Ewk_User_Media_Device_Type Ewk_User_Media_Device_Type; + +/** + * Requests for getting origin of local media permission request. + * + * @param request Ewk_User_Media_Permission_Request object to get origin for + * userMedia permission request + * + * @return security origin of userMedia permission request + */ +EXPORT_API const Ewk_Security_Origin* +ewk_user_media_permission_request_origin_get( + const Ewk_User_Media_Permission_Request* request); + +/** + * Sets the permission to access local media + * + * @param request Ewk_View_User_Media_Permission_Request object for userMedia + * permission + * @param allowed decided permission value from user + */ +EXPORT_API void ewk_user_media_permission_request_set( + Ewk_User_Media_Permission_Request* request, Eina_Bool allowed); + +/** + * Suspend the operation for user media permission + * + * @param request user media permission request object + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_user_media_permission_request_suspend( + Ewk_User_Media_Permission_Request* request); + +/** + * Reply the result about user media permission. + * + * @param request Ewk_User_Media_Permission_Request object to get + * the information about user media permission request + * @param allow result about user media permission + */ +EXPORT_API void ewk_user_media_permission_reply( + Ewk_User_Media_Permission_Request* request, Eina_Bool allow); + +/** + * Requests for getting message of local media permission request. + * + * @param request Ewk_User_Media_Permission_Request object to get message for + * userMedia permission request + * + * @return message of userMedia permission request + */ +EXPORT_API const char* ewk_user_media_permission_request_message_get( + const Ewk_User_Media_Permission_Request* request); + +/** + * Get the type of device type for media permission request message. + * + * @param request Ewk_User_Media_Permission_Request object to get message for + * userMedia permission request + * + * @return The type of device type, MicroPhone, Camera, or both of them. + */ +EXPORT_API Ewk_User_Media_Device_Type +ewk_user_media_permission_request_device_type_get( + const Ewk_User_Media_Permission_Request* request); + +#ifdef __cplusplus +} +#endif +#endif // ewk_user_media_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_value_product.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_value_product.h new file mode 100644 index 000000000..1389eb5aa --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_value_product.h @@ -0,0 +1,366 @@ +/* + * Copyright (C) 2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef EWK_EFL_INTEGRATION_PUBLIC_EWK_VALUE_PRODUCT_H_ +#define EWK_EFL_INTEGRATION_PUBLIC_EWK_VALUE_PRODUCT_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef const void* Ewk_Value; + +typedef int32_t Ewk_Value_Type; + +/** + * Increases the reference count of the given Ewk_Value. + * + * @param value the Ewk_Value instance to increase the reference count + * + * @return a pointer to the object on success, @c NULL otherwise. + */ +EXPORT_API Ewk_Value ewk_value_ref(Ewk_Value value); + +/** + * Decreases the reference count of the given Ewk_Value, freeing it when + * the reference count reaches 0. For compound values (like arrays and + * dictionaries) all values are removed. + * + * @param value the Ewk_Value instance to decrease the reference count + */ +EXPORT_API void ewk_value_unref(Ewk_Value value); + +/** + * Returns type of the given value. + * The returned type can be compared to one returned by @c + * ewk_value_xxx_type_get() functions. + * + * @param value the Ewk_Value to get type from + * + * @return the type of value + * + * @see ewk_value_null_type_get + * @see ewk_value_boolean_type_get + * @see ewk_value_double_type_get + * @see ewk_value_int_type_get + * @see ewk_value_string_type_get + * @see ewk_value_array_type_get + * @see ewk_value_dictionary_type_get + */ +EXPORT_API Ewk_Value_Type ewk_value_type_get(Ewk_Value value); + +/** + * Returns type of null/invalid Ewk_Value. + * + * @return the type + */ +EXPORT_API Ewk_Value_Type ewk_value_null_type_get(); + +/** + * Creates Ewk_Value from boolean value and passes ownership to the caller. + * + * @param initial_value the initial value + * + * @return the created Ewk_Value + */ +EXPORT_API Ewk_Value ewk_value_boolean_new(Eina_Bool initial_value); + +/** + * Returns type of boolean Ewk_Value. + * + * @return the type + */ +EXPORT_API Ewk_Value_Type ewk_value_boolean_type_get(); + +/** + * Gets boolean from Ewk_Value. + * Fails if Ewk_Value is not of boolean type. + * + * @param value the value + * @param dst the extracted value + * + * @return the EINA_TRUE if successful, EINA_FALSE otherwise. + */ +EXPORT_API Eina_Bool ewk_value_boolean_value_get(Ewk_Value value, + Eina_Bool* dst); + +/** + * Creates Ewk_Value from double and passes ownership to the caller. + * + * @param initial_value the initial value + * + * @return the created Ewk_Value + */ +EXPORT_API Ewk_Value ewk_value_double_new(double initial_value); + +/** + * Returns type of double Ewk_Value. + * + * @return the type + */ +EXPORT_API Ewk_Value_Type ewk_value_double_type_get(); + +/** + * Gets double from Ewk_Value. + * Fails if Ewk_Value is not of double type. + * + * @param value the value + * @param dst the extracted value + * + * @return the EINA_TRUE if successful, EINA_FALSE otherwise. + */ +EXPORT_API Eina_Bool ewk_value_double_value_get(Ewk_Value value, double* dst); + +/** + * Creates Ewk_Value from integer and passes ownership to the caller. + * + * @param initial_value the initial value + * + * @return the created Ewk_Value + */ +EXPORT_API Ewk_Value ewk_value_int_new(int initial_value); + +/** + * Returns type of integer Ewk_Value. + * + * @return the type + */ +EXPORT_API Ewk_Value_Type ewk_value_int_type_get(); + +/** + * Gets integer from Ewk_Value. + * Fails if Ewk_Value is not of integer type. + * + * @param value the value + * @param dst the extracted value + * + * @return the EINA_TRUE if successful, EINA_FALSE otherwise. + */ +EXPORT_API Eina_Bool ewk_value_int_value_get(Ewk_Value value, int* dst); + +/** + * Creates Ewk_Value from string and passes ownership to the caller. + * + * @param initial_value the initial value + * + * @return the created Ewk_Value + */ +EXPORT_API Ewk_Value ewk_value_string_new(const char* initial_value); + +/** + * Returns type of string Ewk_Value. + * + * @return the type + */ +EXPORT_API Ewk_Value_Type ewk_value_string_type_get(); + +/** + * Gets string from Ewk_Value. + * Fails if Ewk_Value is not of string type. + * + * @param value the value + * + * @return the EINA shared string value if successful, NULL otherwise. + */ +EXPORT_API Eina_Stringshare* ewk_value_string_value_get(Ewk_Value value); + +/** + * Creates Ewk_Value as array and passes ownership to the caller. + * + * @return the created Ewk_Value + */ +EXPORT_API Ewk_Value ewk_value_array_new(); + +/** + * Returns type of array Ewk_Value. + * + * @return the type + */ +EXPORT_API Ewk_Value_Type ewk_value_array_type_get(); + +/** + * Checks whether array is mutable. The given Ewk_Value must be of array type. + * + * @param array the value + * + * @return EINA_TRUE if array is mutable, EINA_FALSE otherwise. + */ +EXPORT_API Eina_Bool ewk_value_array_is_mutable(Ewk_Value array); + +/** + * Adds @c value at the end of the @c array. The given @c array must be of array + * type. + * The value can be of any type. The value is deep copied. + * + * @param array the array + * @param value the value + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. + */ +EXPORT_API Eina_Bool ewk_value_array_append(Ewk_Value array, Ewk_Value value); + +/** + * Returns size of the given @c array. + * + * @param array the array + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. + */ +EXPORT_API size_t ewk_value_array_count(Ewk_Value array); + +/** + * Gets @c value from the @c array at given @c position. + * WARNING: Currently copy of the value is returned and the ownership + * of that value is passed to the caller. + * + * @param array the array + * @param position the position + * @param dst the extracted value + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. + */ +EXPORT_API Eina_Bool ewk_value_array_get(Ewk_Value array, size_t position, + Ewk_Value* dst); + +/** + * Removes value from the @c array at given @c position. + * + * @param array the array + * @param position the position + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. + */ +EXPORT_API Eina_Bool ewk_value_array_remove(Ewk_Value array, size_t position); + +/** + * Creates Ewk_Value as dictionary and passes ownership to the caller. + * + * @return the created Ewk_Value + */ +EXPORT_API Ewk_Value ewk_value_dictionary_new(); + +/** + * Returns type of dictionary Ewk_Value. + * + * @return the type + */ +EXPORT_API Ewk_Value_Type ewk_value_dictionary_type_get(); + +/** + * Checks whether dictionary is mutable. The given Ewk_Value must be of + * dictionary type. + * + * @param dictionary the value + * + * @return EINA_TRUE if dictionary is mutable, EINA_FALSE otherwise. + */ +EXPORT_API Eina_Bool ewk_value_dictionary_is_mutable(Ewk_Value dictionary); + +/** + * Gets array of existing keys in the @c dictionary. The given @c dictionary + * must be of dictionary type. + * WARNING: Currently array containing copies is returned and the ownership + * of that array is passed to the caller. + * + * @param dictionary the dictionary + * @param keys array of strings + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. + */ +EXPORT_API Eina_Bool ewk_value_dictionary_keys(Ewk_Value dictionary, + Ewk_Value* keys); + +/** + * Sets @c value in the @c dictionary at given @c key. The given @c dictionary + * must be of dictionary type. + * The value can be of any type. Key must be a string value. + * Overwrites old value if key existed before. + * The value is deep copied. + * + * @param dictionary the dictionary + * @param key the key + * @param value the value + * @param new_entry the EINA_TRUE if key did not exist before in dictionary, + * EINA_FALSE otherwise. + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. + */ +EXPORT_API Eina_Bool ewk_value_dictionary_set(Ewk_Value dictionary, + Ewk_Value key, Ewk_Value value, + Eina_Bool* new_entry); + +/** + * Adds @c value to the @c dictionary at given @c key. The given @c dictionary + * must be of dictionary type. + * The value can be of any type. Key must be a string value. + * Does nothing if key existed before. + * The value is deep copied. + * + * @param dictionary the dictionary + * @param key the key + * @param value the value + * @param new_entry the EINA_TRUE if key did not exist before in dictionary, + * EINA_FALSE otherwise. + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. + */ +EXPORT_API Eina_Bool ewk_value_dictionary_add(Ewk_Value dictionary, + Ewk_Value key, Ewk_Value value, + Eina_Bool* new_entry); + +/** + * Gets @c value from the @c dictionary at given @c key. The given @c dictionary + * must be of dictionary type. + * WARNING: Currently copy of the value is returned and the ownership + * of that value is passed to the caller. + * + * @param dictionary the dictionary + * @param key the key + * @param dst the value + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. + */ +EXPORT_API Eina_Bool ewk_value_dictionary_get(Ewk_Value dictionary, + Ewk_Value key, Ewk_Value* dst); + +/** + * Removes value from the @c dictionary at given @c key. + * + * @param dictionary the dictionary + * @param key the key + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. + */ +EXPORT_API Eina_Bool ewk_value_dictionary_remove(Ewk_Value dictionary, + Ewk_Value key); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // EWK_EFL_INTEGRATION_PUBLIC_EWK_VALUE_PRODUCT_H_ diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_view.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_view.h new file mode 100644 index 000000000..e97ae5a71 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_view.h @@ -0,0 +1,795 @@ +/* + * Copyright (C) 2011-2016 Samsung Electronics. + * Copyright (C) 2012 Intel Corporation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * @file ewk_view.h + * @brief This file describes the Chromium-efl main smart object. + * + * This object provides view related APIs of Chromium to EFL objects. + */ + +#ifndef ewk_view_h +#define ewk_view_h + +#include +#include +#include +#include + +#include "ewk_back_forward_list.h" +#include "ewk_context.h" +#include "ewk_context_menu.h" +#include "ewk_manifest.h" +#include "ewk_settings.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup WEBVIEW + * @{ + */ + +/** + * @brief Request to set the current page's visibility. + * + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * + * @param[in] o View object to set the visibility. + * @param[in] enable EINA_TRUE to set on the visibility of the page, + * EINA_FALSE otherwise. + * + * @return @c EINA_TRUE on success, otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_visibility_set(Evas_Object* o, Eina_Bool enable); + +/** + * @brief Sends the orientation of the device. + * + * If orientation value is changed, orientationchanged event will occur. + * + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * + * @param[in] o View object to receive orientation event. + * @param[in] orientation The new orientation of the device. (degree) + * + * orientation will be 0 degrees when the device is oriented to natural position + * ,-90 degrees when it's left side is at the top + * , 90 degrees when it's right side is at the top + * ,180 degrees when it is upside down. + */ +EXPORT_API void ewk_view_orientation_send(Evas_Object* o, int orientation); + +/** + * @if MOBILE + * @brief Returns the selection text. + * + * @details Returned string becomes invalidated upon next call to this api. + * + * @since_tizen 2.4 + * + * @param[in] o View object to get selection text. + * + * @return @c selection text, otherwise @c NULL + * @endif + */ +EXPORT_API const char* ewk_view_text_selection_text_get(Evas_Object* o); + +/** + * @if MOBILE + * @brief Clears the current selection. + * + * @since_tizen 2.4 + * + * @param[in] o View object with selection in progress + * + * @return @c EINA_TRUE on success, otherwise @c EINA_FALSE + * @endif + */ +EXPORT_API Eina_Bool ewk_view_text_selection_clear(Evas_Object* o); + +/** + * @brief Creates a new EFL Chromium view object. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] e The canvas object where to create the view object + * + * @return The view object on success,\n + * otherwise @c NULL on failure + */ +EXPORT_API Evas_Object* ewk_view_add(Evas* e); + +/** + * @brief Creates a new EFL web view object in incognito mode. + * + * @since_tizen 3.0 + * + * @param[in] e The canvas object where to create the view object + * + * @return The view object on success,\n + * otherwise @c NULL on failure + */ +EXPORT_API Evas_Object* ewk_view_add_in_incognito_mode(Evas* e); + +/** + * @brief Gets the #Ewk_Context of this view. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to get the #Ewk_Context + * + * @return The #Ewk_Context of this view,\n + * otherwise @c NULL on failure + */ +EXPORT_API Ewk_Context* ewk_view_context_get(const Evas_Object* o); + +/** + * @brief Asks the object to load the given URL. + * + * @remarks You can only be sure that url changed after ewk view\n + * smart callback 'url,changed' is called. This is important for\n + * EWK API functions which operate on pages. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to load @a url + * @param[in] url The uniform resource identifier to load + * + * @return @c EINA_TRUE if @a o is valid, irrespective of load,\n + * otherwise @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_url_set(Evas_Object* o, const char* url); + +/** + * @brief Returns the current URL string of the view object. + * + * @details It returns an internal string that should not be modified.\n + * The string is guaranteed to be stringshared. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to get the current URL + * + * @return The current URL on success,\n + * otherwise @c NULL on failure + */ +EXPORT_API const char* ewk_view_url_get(const Evas_Object* o); + +/** + * @brief Returns the original URL string of the view object. + * + * @details It returns an internal string that should not be modified.\n + * The string is guaranteed to be stringshared. + * + * @since_tizen 4.0 + * + * @param[in] o The view object to get the original URL + * + * @return The original URL on success,\n + * otherwise @c NULL on failure + */ +EXPORT_API const char* ewk_view_original_url_get(const Evas_Object* o); + +/** + * @brief Asks the main frame to reload the current document. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to reload the current document + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_reload(Evas_Object* o); + +/** + * @brief Asks the main frame to stop loading. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to stop loading + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_stop(Evas_Object* o); + +/** + * @brief Gets the #Ewk_Settings of this view. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to get the #Ewk_Settings + * + * @return The #Ewk_Settings of this view,\n + * otherwise @c NULL on failure + */ +EXPORT_API Ewk_Settings* ewk_view_settings_get(const Evas_Object* o); + +/** + * @brief Asks the main frame to navigate back in history. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to navigate back + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_back(Evas_Object* o); + +/** + * @brief Asks the main frame to navigate forward in history. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to navigate forward + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_forward(Evas_Object* o); + +/** + * @brief Checks whether it is possible to navigate backwards one item in + * history. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to query if backward navigation is possible + * + * @return @c EINA_TRUE if it is possible to navigate backwards in history,\n + * otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_back_possible(Evas_Object* o); + +/** + * @brief Checks whether it is possible to navigate forwards one item in + * history. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to query if forward navigation is possible + * + * @return @c EINA_TRUE if it is possible to navigate forwards in history,\n + * otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_forward_possible(Evas_Object* o); + +/** + * @brief Gets the back-forward list associated with this view. + * + * @details The returned instance is unique for this view and thus multiple + * calls\n + * to this function with the same view as a parameter returns the + * same handle.\n + * This handle is alive while the view is alive, thus one might want\n + * to listen for EVAS_CALLBACK_DEL on a given view (@a o) to know\n + * when to stop using the returned handle. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to get the back-forward navigation list + * + * @return The back-forward list instance handle associated with this view + */ +EXPORT_API Ewk_Back_Forward_List* ewk_view_back_forward_list_get( + const Evas_Object* o); + +/** + * @brief Clears the back-forward list of a page. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to clear the back-forward list + */ +EXPORT_API void ewk_view_back_forward_list_clear(const Evas_Object* o); + +/** + * @brief Gets the current title of the main frame. + * + * @details It returns an internal string that should not be modified.\n + * The string is guaranteed to be stringshared. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to get the current title + * + * @return The current title on success,\n + * otherwise @c NULL on failure + */ +EXPORT_API const char* ewk_view_title_get(const Evas_Object* o); + +/** + * @brief Gets the current load progress of the page. + * + * @details The progress estimation from @c 0.0 to @c 1.0. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to get the current progress + * + * @return The load progress of the page, value from @c 0.0 to @c 1.0,\n + * otherwise @c -1.0 on failure + */ +EXPORT_API double ewk_view_load_progress_get(const Evas_Object* o); + +/** + * @brief Requests to set the user agent string. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to set the user agent string + * @param[in] user_agent The user agent string to set,\n + * otherwise @c NULL to restore the default one + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_user_agent_set(Evas_Object* o, + const char* user_agent); + +/** + * @brief Returns the user agent string. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to get the user agent string + * + * @return The user agent string + */ +EXPORT_API const char* ewk_view_user_agent_get(const Evas_Object* o); + +/** + * @brief Gets the last known content's size. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to get the content's size + * @param[in] width The width pointer to store the content's size width, + * may be @c 0 + * @param[in] height The height pointer to store the content's size height, + * may be @c 0 + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE on failure and\n + * @a width and @a height are zeroed + */ +EXPORT_API Eina_Bool ewk_view_contents_size_get(const Evas_Object* o, + Evas_Coord* width, + Evas_Coord* height); + +/** + * @brief Callback for ewk_view_script_execute(). + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object + * @param[in] result_value The value returned by the script\n + * If executed script returns a value, it would be @a result_value,\n + * otherwise @c NULL if there is no value returned by the script + * @param[in] user_data The user_data will be passed when + * ewk_view_script_execute() is called + */ +typedef void (*Ewk_View_Script_Execute_Cb)(Evas_Object* o, + const char* result_value, + void* user_data); + +/** + * @brief Requests the execution of the given script. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @remarks This allows to use @c NULL for the callback parameter\n + * So, if the result data from the script is not required, + * @c NULL might be used for the callback parameter\n + * Also, @a script should be valid statement according to JavaScript + * language\n If @a script is empty, NULL or invalid statement, this function + * returns @c EINA_FALSE + * + * @param[in] o The view object to execute the script + * @param[in] script The JavaScript code string to execute + * @param[in] callback The result callback + * @param[in] user_data The user data + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool +ewk_view_script_execute(Evas_Object* o, const char* script, + Ewk_View_Script_Execute_Cb callback, void* user_data); + +/** + * @brief Scales the current page, centered at the given point. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to set the zoom level + * @param[in] scale_factor A new level to set + * @param[in] cx The x value of the center coordinate + * @param[in] cy The y value of the center coordinate + * + * @return @c EINA_TRUE on success,\n + * otherwise EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_scale_set(Evas_Object* o, double scale_factor, + int cx, int cy); + +/** + * @brief Gets the current scale factor of the page. + * + * @details It returns the previous scale factor after ewk_view_scale_set() is + * called immediately\n + * until the scale factor of the page is really changed. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to get the scale factor of + * + * @return The current scale factor in use on success,\n + * otherwise @c -1.0 on failure + */ +EXPORT_API double ewk_view_scale_get(const Evas_Object* o); + +/** + * @brief Exits fullscreen when the back key is pressed. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to exit the fullscreen mode + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_fullscreen_exit(Evas_Object* o); + +/** + * @brief Suspends the operation associated with the view object. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to suspend + */ +EXPORT_API void ewk_view_suspend(Evas_Object* o); + +/** + * @brief Resumes the operation associated with the view object after calling + * ewk_view_suspend(). + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to resume + */ +EXPORT_API void ewk_view_resume(Evas_Object* o); + +/** + * \enum Ewk_Http_Method + * @brief Enumeration that provides HTTP method options. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + */ +enum Ewk_Http_Method { + EWK_HTTP_METHOD_GET, /**< Get */ + EWK_HTTP_METHOD_HEAD, /**< Head */ + EWK_HTTP_METHOD_POST, /**< Post */ + EWK_HTTP_METHOD_PUT, /**< Put */ + EWK_HTTP_METHOD_DELETE, /**< Delete */ +}; + +/** + * @brief Enumeration that creates a type name for the #Ewk_Http_Method. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + */ +typedef enum Ewk_Http_Method Ewk_Http_Method; + +/** + * @brief Requests loading of the given request data. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to load + * @param[in] url The uniform resource identifier to load + * @param[in] method The http method + * @param[in] headers The http headers + * @param[in] body The http body data + * + * @return @c EINA_TRUE on a successful request,\n + * otherwise @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_url_request_set(Evas_Object* o, const char* url, + Ewk_Http_Method method, + Eina_Hash* headers, + const char* body); + +/** + * @if MOBILE + * @brief Requests loading the given contents by MIME type into the view object. + * + * @since_tizen 2.3 + * + * @param[in] o The view object to load + * @param[in] contents The content to load + * @param[in] contents_size The size of @a contents (in bytes) + * @param[in] mime_type The type of @a contents, + * if @c 0 is given "text/html" is assumed + * @param[in] encoding The encoding for @a contents, + * if @c 0 is given "UTF-8" is assumed + * @param[in] base_uri The base URI to use for relative resources, + * may be @c 0,\n if provided @b must be an absolute URI + * + * @return @c EINA_TRUE on a successful request,\n + * otherwise @c EINA_FALSE on errors + * @endif + */ +EXPORT_API Eina_Bool ewk_view_contents_set(Evas_Object* o, const char* contents, + size_t contents_size, + char* mime_type, char* encoding, + char* base_uri); + +/** + * @brief Scrolls the webpage of view by dx and dy. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to scroll + * @param[in] dx The horizontal offset to scroll + * @param[in] dy The vertical offset to scroll + */ +EXPORT_API void ewk_view_scroll_by(Evas_Object* o, int dx, int dy); + +/** + * @brief Gets the current scroll position of the given view. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to get the current scroll position + * @param[in] x The pointer to store the horizontal position, may be @c NULL + * @param[in] y The pointer to store the vertical position, may be @c NULL + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_scroll_pos_get(Evas_Object* o, int* x, int* y); + +/** + * @brief Sets an absolute scroll of the given view. + * + * @details Both values are from zero to the contents size minus + * the viewport size. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to scroll + * @param[in] x The horizontal position to scroll + * @param[in] y The vertical position to scroll + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_scroll_set(Evas_Object* o, int x, int y); + +/** + * Enum values used to specify search options. + * @brief Enumeration that provides the option to find text. + * @details It contains enum values used to specify search options. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + */ +enum Ewk_Find_Options { + EWK_FIND_OPTIONS_NONE, /**< No search flags, this means a case sensitive, no + wrap, forward only search */ + EWK_FIND_OPTIONS_CASE_INSENSITIVE = 1 << 0, /**< Case insensitive search */ + EWK_FIND_OPTIONS_AT_WORD_STARTS = + 1 << 1, /**< Search text only at the beginning of the words */ + EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START = + 1 << 2, /**< Treat capital letters in the middle of words as word start */ + EWK_FIND_OPTIONS_BACKWARDS = 1 << 3, /**< Search backwards */ + EWK_FIND_OPTIONS_WRAP_AROUND = + 1 << 4, /**< If not present the search stops at the end of the document */ + EWK_FIND_OPTIONS_SHOW_OVERLAY = 1 << 5, /**< Show overlay */ + EWK_FIND_OPTIONS_SHOW_FIND_INDICATOR = 1 << 6, /**< Show indicator */ + EWK_FIND_OPTIONS_SHOW_HIGHLIGHT = 1 << 7 /**< Show highlight */ +}; + +/** + * @brief Enumeration that creates a type name for the #Ewk_Find_Options. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + */ +typedef enum Ewk_Find_Options Ewk_Find_Options; + +/** + * @brief Searches and highlights the given string in the document. + * + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o The view object to find text + * @param[in] text The text to find + * @param[in] options The options to find + * @param[in] max_match_count The maximum match count to find, unlimited if @c 0 + * + * @return @c EINA_TRUE on success,\n + * otherwise EINA_FALSE on errors + */ +EXPORT_API Eina_Bool ewk_view_text_find(Evas_Object* o, const char* text, + Ewk_Find_Options options, + unsigned max_match_count); + +/** + * @brief Loads the specified @a html string as the content of the view. + * + * @details External objects such as stylesheets or images referenced + * in the HTML\n document are located relative to @a baseUrl.\n + * + * @remarks There is an alternative API + * ewk_view_html_string_override_current_entry_load() which is able to override + * current entry which prevents from backing back to malicious page. + * + * If an @a unreachableUrl is passed it is used as the url for the loaded + * content.\n This is typically used to display error pages for a failed load. + * + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 2.3.1 @endif + * + * @param[in] o view object to load the HTML into + * @param[in] html HTML data to load + * @param[in] base_url Base URL used for relative paths to external objects + * (optional) + * @param[in] unreachable_url URL that could not be reached (optional) + * + * @return @c EINA_TRUE if it the HTML was successfully loaded, + * @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_view_html_string_load(Evas_Object* o, const char* html, + const char* base_url, + const char* unreachable_url); + +/** + * @brief A ScriptMessage contains information that sent from JavaScript running + * in a webpage. + * + * @since_tizen 3.0 + */ +struct _Ewk_Script_Message { + const char* name; /**< The name used to expose the object in JavaScript*/ + void* body; /**< Message body */ +}; + +/** + * @brief A struct that creates a type name for the #Ewk_Script_Message. + * @since_tizen 3.0 + */ +typedef struct _Ewk_Script_Message Ewk_Script_Message; + +/** + * @brief Callback for ewk_view_javascript_message_handler_add(). + * + * @since_tizen 3.0 + * + * @param[in] o The view object + * @param[in] message The ScriptMessage returned by the script. \n + * It will be passed when ewk_view_javascript_message_handler_add() is + * called. + */ +typedef void (*Ewk_View_Script_Message_Cb)(Evas_Object* o, + Ewk_Script_Message message); + +/** + * @brief Injects the supplied javascript message handler into webview. + * + * @since_tizen 3.0 + * + * @remarks Note that injected objects will not appear in JavaScript + * until the page is next (re)loaded. + * + * Certainly, specify privileges of using native API to users, + * if using native API affects system settings, stability or security. + * Privilege display name & description which will be noticed to user. + * + * @param[in] o The view object + * @param[in] callback The result callback + * @param[in] name The name used to expose the object in JavaScript + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_javascript_message_handler_add( + Evas_Object* o, Ewk_View_Script_Message_Cb callback, const char* name); + +/** + * @brief Requests the execution of given name & result to the JavaScript + * runtime. + * + * @since_tizen 3.0 + * + * @param[in] o The view object + * @param[in] name The name used to expose the object in JavaScript + * @param[in] result The result to the JavaScript runtime + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_evaluate_javascript(Evas_Object* o, + const char* name, + const char* result); + +/** + * @brief Requests to set or unset a web view as the currently focused one. + * + * @since_tizen 3.0 + * + * @param[in] o The view object. + * @param[in] focused @c EINA_TRUE to set the focus on the web view, + * @c EINA_FALSE to remove the focus from the web view. + * + * @return @c EINA_TRUE on success, otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_focus_set(const Evas_Object* o, + Eina_Bool focused); + +/** + * @brief Checks whether a web view has the focus. + * + * @since_tizen 3.0 + * + * @param[in] o The view object. + * + * @return @c EINA_TRUE if the web view has the focus, otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_focus_get(const Evas_Object* o); + +/** + * @brief Callback invoked when requested manifest inform is responded. + * + * @since_tizen 3.0 + * + * @param[in] o View object for which callback was set + * @param[in] manifest Received manifest object of current's page + * This object is valid after callback data is received. + * If the manifest file is empty, it is returned NULL. + * @param[in] user_data User data passed to + * ewk_view_request_manifest + * + * @see ewk_view_request_manifest + */ +typedef void (*Ewk_View_Request_Manifest_Callback)( + Evas_Object* o, Ewk_View_Request_Manifest* manifest, void* user_data); + +/** + * @brief Requests the manifest data of current's page. + * + * @since_tizen 3.0 + * + * @param[in] o view object to request the manifest information + * @param[in] callback Ewk_View_Request_Manifest_Callback function to request + * manifest information + * @param[in] user_data user data + * + * @see Ewk_View_Request_Manifest_Callback + */ +EXPORT_API void ewk_view_request_manifest( + Evas_Object* o, Ewk_View_Request_Manifest_Callback callback, + void* user_data); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif // ewk_view_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_view_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_view_internal.h new file mode 100644 index 000000000..9a0df91a2 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_view_internal.h @@ -0,0 +1,1720 @@ +/* + * Copyright (C) 2011-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_view_internal.h + * @brief Chromium main smart object. + * + * This object provides view related APIs of Chromium to EFL object. + */ + +#ifndef ewk_view_internal_h +#define ewk_view_internal_h + +#include "ewk_app_installation_request_internal.h" +#include "ewk_auth_challenge_internal.h" +#include "ewk_context_internal.h" +#include "ewk_enums_internal.h" +#include "ewk_frame_internal.h" +#include "ewk_geolocation_internal.h" +#include "ewk_history_internal.h" +#include "ewk_hit_test_internal.h" +#include "ewk_page_group_internal.h" +#include "ewk_quota_permission_request_internal.h" +#include "ewk_touch_internal.h" +#include "ewk_user_media_internal.h" +#include "ewk_view.h" +#include "ewk_window_features_internal.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// Enum values containing text directionality values. +typedef enum { + EWK_TEXT_DIRECTION_RIGHT_TO_LEFT, + EWK_TEXT_DIRECTION_LEFT_TO_RIGHT +} Ewk_Text_Direction; + +enum Ewk_Password_Popup_Option { + EWK_PASSWORD_POPUP_SAVE, + EWK_PASSWORD_POPUP_NOT_NOW, + EWK_PASSWORD_POPUP_NEVER, + EWK_PASSWORD_POPUP_OK = EWK_PASSWORD_POPUP_SAVE, + EWK_PASSWORD_POPUP_CANCEL = EWK_PASSWORD_POPUP_NOT_NOW +}; +typedef enum Ewk_Password_Popup_Option Ewk_Password_Popup_Option; + +typedef struct Ewk_View_Smart_Data Ewk_View_Smart_Data; +typedef struct Ewk_View_Smart_Class Ewk_View_Smart_Class; + +enum Ewk_Select_Menu_Item_Type { + OPTION, + CHECKABLE_OPTION, + GROUP, + SEPARATOR, + SUBMENU, // This is currently only used by Pepper, not by WebKit. + TYPE_LAST = SUBMENU +}; +typedef enum Ewk_Select_Menu_Item_Type Ewk_Select_Menu_Item_Type; + +struct Ewk_Select_Menu_Item_Info { + const char* label; + const char* icon; + const char* tool_tip; + Ewk_Select_Menu_Item_Type type; + unsigned action; + Eina_Bool rtl; + Eina_Bool has_directional_override; + Eina_Bool enabled; + Eina_Bool checked; + Eina_List* submenu; +}; +typedef struct Ewk_Select_Menu_Item_Info Ewk_Select_Menu_Item_Info; + +struct Ewk_Select_Menu { + Evas_Object* evas_object; + int selected_index; + Eina_List* items; + Eina_Bool is_multiple_selection; + Eina_Rectangle bounds; + double item_font_size; +}; +typedef struct Ewk_Select_Menu Ewk_Select_Menu; + +// #if PLATFORM(TIZEN) +/// Creates a type name for _Ewk_Event_Gesture. +typedef struct Ewk_Event_Gesture Ewk_Event_Gesture; + +/// Represents a gesture event. +struct Ewk_Event_Gesture { + Ewk_Gesture_Type type; /**< type of the gesture event */ + Evas_Coord_Point position; /**< position of the gesture event */ + Evas_Point velocity; /**< velocity of the gesture event. The unit is pixel per + second. */ + double scale; /**< scale of the gesture event */ + int count; /**< count of the gesture */ + unsigned int timestamp; /**< timestamp of the gesture */ +}; + +// #if ENABLE(TIZEN_FOCUS_UI) +enum Ewk_Unfocus_Direction { + EWK_UNFOCUS_DIRECTION_NONE = 0, + EWK_UNFOCUS_DIRECTION_FORWARD, + EWK_UNFOCUS_DIRECTION_BACKWARD, + EWK_UNFOCUS_DIRECTION_UP, + EWK_UNFOCUS_DIRECTION_DOWN, + EWK_UNFOCUS_DIRECTION_LEFT, + EWK_UNFOCUS_DIRECTION_RIGHT, +}; +typedef enum Ewk_Unfocus_Direction Ewk_Unfocus_Direction; +// #endif + +// #if ENABLE(TIZEN_INPUT_TAG_EXTENSION) +/** + * \enum Ewk_Input_Type + * @brief Provides type of focused input element + */ +enum Ewk_Input_Type { + EWK_INPUT_TYPE_TEXT, + EWK_INPUT_TYPE_TELEPHONE, + EWK_INPUT_TYPE_NUMBER, + EWK_INPUT_TYPE_EMAIL, + EWK_INPUT_TYPE_URL, + EWK_INPUT_TYPE_PASSWORD, + EWK_INPUT_TYPE_COLOR, + EWK_INPUT_TYPE_DATE, + EWK_INPUT_TYPE_DATETIME, + EWK_INPUT_TYPE_DATETIMELOCAL, + EWK_INPUT_TYPE_MONTH, + EWK_INPUT_TYPE_TIME, + EWK_INPUT_TYPE_WEEK +}; +typedef enum Ewk_Input_Type Ewk_Input_Type; +// #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION) + +// #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) +/** + * \enum Ewk_Selection_Handle_Type + * @brief Provides type of selection handle + */ +enum Ewk_Selection_Handle_Type { + EWK_SELECTION_HANDLE_TYPE_LEFT, + EWK_SELECTION_HANDLE_TYPE_RIGHT, + EWK_SELECTION_HANDLE_TYPE_LARGE +}; +typedef enum Ewk_Selection_Handle_Type Ewk_Selection_Handle_Type; +// #endif // ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) +// #endif // #if PLATFORM(TIZEN) + +enum Ewk_View_Mode { + EWK_VIEW_MODE_WINDOWED = 0, + EWK_VIEW_MODE_FLOATING, + EWK_VIEW_MODE_FULLSCREEN, + EWK_VIEW_MODE_MAXIMIZED, + EWK_VIEW_MODE_MINIMIZED +}; +typedef enum Ewk_View_Mode Ewk_View_Mode; + +enum Ewk_Top_Control_State { + EWK_TOP_CONTROL_SHOWN = 1, + EWK_TOP_CONTROL_HIDDEN = 2, + EWK_TOP_CONTROL_BOTH = 3 +}; +typedef enum Ewk_Top_Control_State Ewk_Top_Control_State; + +enum Ewk_Mouse_Button_Type { + EWK_Mouse_Button_Left = 1, + EWK_Mouse_Button_Middle = 2, + EWK_Mouse_Button_Right = 3 +}; +typedef enum Ewk_Mouse_Button_Type Ewk_Mouse_Button_Type; + +/// Ewk view's class, to be overridden by sub-classes. +struct Ewk_View_Smart_Class { + Evas_Smart_Class sc; /**< all but 'data' is free to be changed. */ + unsigned long version; + + Evas_Object* (*window_create)( + Ewk_View_Smart_Data* sd, + const Ewk_Window_Features* + window_features); /**< creates a new window, requested by webkit */ + void (*window_close)(Ewk_View_Smart_Data* sd); /**< closes a window */ + + Eina_Bool (*context_menu_show)(Ewk_View_Smart_Data* sd, Evas_Coord x, + Evas_Coord y, Ewk_Context_Menu* menu); + Eina_Bool (*context_menu_hide)(Ewk_View_Smart_Data* sd); + + Eina_Bool (*popup_menu_show)(Ewk_View_Smart_Data* sd, Eina_Rectangle rect, + Ewk_Text_Direction text_direction, + double page_scale_factor, Eina_List* items, + int selected_index); + Eina_Bool (*popup_menu_hide)(Ewk_View_Smart_Data* sd); + Eina_Bool (*popup_menu_update)(Ewk_View_Smart_Data* sd, Eina_Rectangle rect, + Ewk_Text_Direction text_direction, + Eina_List* items, int selected_index); + + Eina_Bool (*text_selection_down)(Ewk_View_Smart_Data* sd, int x, int y); + Eina_Bool (*text_selection_up)(Ewk_View_Smart_Data* sd, int x, int y); + + Eina_Bool (*input_picker_show)(Ewk_View_Smart_Data* sd, + Ewk_Input_Type inputType, + const char* inputValue); + + Eina_Bool (*orientation_lock)(Ewk_View_Smart_Data* sd, int orientations); + void (*orientation_unlock)(Ewk_View_Smart_Data* sd); + + // event handling: + // - returns true if handled + // - if overridden, have to call parent method if desired + Eina_Bool (*focus_in)(Ewk_View_Smart_Data* sd); + Eina_Bool (*focus_out)(Ewk_View_Smart_Data* sd); + Eina_Bool (*fullscreen_enter)(Ewk_View_Smart_Data* sd, + Ewk_Security_Origin* origin); + Eina_Bool (*fullscreen_exit)(Ewk_View_Smart_Data* sd); + Eina_Bool (*mouse_wheel)(Ewk_View_Smart_Data* sd, + const Evas_Event_Mouse_Wheel* ev); + Eina_Bool (*mouse_down)(Ewk_View_Smart_Data* sd, + const Evas_Event_Mouse_Down* ev); + Eina_Bool (*mouse_up)(Ewk_View_Smart_Data* sd, const Evas_Event_Mouse_Up* ev); + Eina_Bool (*mouse_move)(Ewk_View_Smart_Data* sd, + const Evas_Event_Mouse_Move* ev); + Eina_Bool (*key_down)(Ewk_View_Smart_Data* sd, const Evas_Event_Key_Down* ev); + Eina_Bool (*key_up)(Ewk_View_Smart_Data* sd, const Evas_Event_Key_Up* ev); + + // color picker: + // - Shows and hides color picker. + Eina_Bool (*input_picker_color_request)(Ewk_View_Smart_Data* sd, int r, int g, + int b, int a); + Eina_Bool (*input_picker_color_dismiss)(Ewk_View_Smart_Data* sd); + + // storage: + // - Web database. + unsigned long long (*exceeded_database_quota)( + Ewk_View_Smart_Data* sd, const char* databaseName, + const char* displayName, unsigned long long currentQuota, + unsigned long long currentOriginUsage, + unsigned long long currentDatabaseUsage, + unsigned long long expectedUsage); + + Eina_Bool (*formdata_candidate_show)(Ewk_View_Smart_Data* sd, int x, int y, + int w, int h); + Eina_Bool (*formdata_candidate_hide)(Ewk_View_Smart_Data* sd); + Eina_Bool (*formdata_candidate_update_data)(Ewk_View_Smart_Data* sd, + Eina_List* dataList); + Eina_Bool (*formdata_candidate_is_showing)(Ewk_View_Smart_Data* sd); + + Eina_Bool (*gesture_start)(Ewk_View_Smart_Data* sd, + const Ewk_Event_Gesture* ev); + Eina_Bool (*gesture_end)(Ewk_View_Smart_Data* sd, + const Ewk_Event_Gesture* ev); + Eina_Bool (*gesture_move)(Ewk_View_Smart_Data* sd, + const Ewk_Event_Gesture* ev); + + void (*selection_handle_down)(Ewk_View_Smart_Data* sd, + Ewk_Selection_Handle_Type handleType, int x, + int y); + void (*selection_handle_move)(Ewk_View_Smart_Data* sd, + Ewk_Selection_Handle_Type handleType, int x, + int y); + void (*selection_handle_up)(Ewk_View_Smart_Data* sd, + Ewk_Selection_Handle_Type handleType, int x, + int y); + + Eina_Bool (*window_geometry_set)(Ewk_View_Smart_Data* sd, Evas_Coord x, + Evas_Coord y, Evas_Coord width, + Evas_Coord height); + Eina_Bool (*window_geometry_get)(Ewk_View_Smart_Data* sd, Evas_Coord* x, + Evas_Coord* y, Evas_Coord* width, + Evas_Coord* height); +}; + +// #if PLATFORM(TIZEN) +/** + * Callback for ewk_view_web_app_capable_get + * + * @param capable web application capable + * @param user_data user_data will be passsed when ewk_view_web_app_capable_get + * is called + */ +typedef void (*Ewk_Web_App_Capable_Get_Callback)(Eina_Bool capable, + void* user_data); + +/** + * Callback for ewk_view_web_app_icon_get + * + * @param icon_url web application icon + * @param user_data user_data will be passsed when ewk_view_web_app_icon_get is + * called + */ +typedef void (*Ewk_Web_App_Icon_URL_Get_Callback)(const char* icon_url, + void* user_data); + +/** + * Callback for ewk_view_screenshot_contents_get_async + * + * @param image captured screenshot + * @param user_data user_data will be passsed when + * ewk_view_screenshot_contents_get_async is called + */ +typedef void (*Ewk_Web_App_Screenshot_Captured_Callback)(Evas_Object* image, + void* user_data); + +/** + * Callback for ewk_view_web_app_icon_urls_get. + * + * @param icon_urls list of Ewk_Web_App_Icon_Data for web app + * @param user_data user_data will be passsed when + * ewk_view_web_app_icon_urls_get is called + */ +typedef void (*Ewk_Web_App_Icon_URLs_Get_Callback)(Eina_List* icon_urls, + void* user_data); +// #endif + +/** + * Callback for ewk_view_notification_permission_callback_set + * + * @param o view object to request the notification permission + * @param request Ewk_Notification_Permission_Request object to get the + * information about notification permission request. + * @param user_data user data + * + * @return returned value is not used + */ +typedef Eina_Bool (*Ewk_View_Notification_Permission_Callback)( + Evas_Object* o, Ewk_Notification_Permission_Request* request, + void* user_data); + +/** + * Defines a callback for scale change. + * + * @param o view object to register on scale change + * @param scale_factor the scale applied to view + * @param user_data a pointer to data specified by + * ewk_view_scale_changed_callback_set + */ +typedef void (*Ewk_View_Scale_Changed_Callback)(Evas_Object* o, + double scale_factor, + void* user_data); + +/** + * Defines a callback for show or hide the notification to user. + * + * @param o view object to register on scale change + * @param show bool flag to indicate whether to show the mic notification. + * show is true when bluetooth mic is opened or voice key is pressed + * shortly. show is false when voice key is hold for more than 500ms + * @param user_data a pointer to data specified by + * ewk_view_smartrc_show_mic_notification_callback_set + */ +typedef void (*Ewk_View_SmartRC_Mic_Notification_Callback)(Evas_Object* o, + Eina_Bool show, + void* user_data); + +/** + * The version you have to put into the version field + * in the @a Ewk_View_Smart_Class structure. + */ +#define EWK_VIEW_SMART_CLASS_VERSION 1UL + +/** + * Initializer for whole Ewk_View_Smart_Class structure. + * + * @param smart_class_init initializer to use for the "base" field + * (Evas_Smart_Class). + * + * @see EWK_VIEW_SMART_CLASS_INIT_NULL + * @see EWK_VIEW_SMART_CLASS_INIT_VERSION + * @see EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION + */ +#define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) \ + { smart_class_init, EWK_VIEW_SMART_CLASS_VERSION } + +/** + * Initializer to zero a whole Ewk_View_Smart_Class structure. + * + * @see EWK_VIEW_SMART_CLASS_INIT_VERSION + * @see EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION + * @see EWK_VIEW_SMART_CLASS_INIT + */ +#define EWK_VIEW_SMART_CLASS_INIT_NULL \ + EWK_VIEW_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NULL) + +/** + * Initializer to zero a whole Ewk_View_Smart_Class structure and set + * name and version. + * + * Similar to EWK_VIEW_SMART_CLASS_INIT_NULL, but will set version field of + * Evas_Smart_Class (base field) to latest EVAS_SMART_CLASS_VERSION and name + * to the specific value. + * + * It will keep a reference to name field as a "const char *", that is, + * name must be available while the structure is used (hint: static or global!) + * and will not be modified. + * + * @see EWK_VIEW_SMART_CLASS_INIT_NULL + * @see EWK_VIEW_SMART_CLASS_INIT_VERSION + * @see EWK_VIEW_SMART_CLASS_INIT + */ +#define EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION(name) \ + EWK_VIEW_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NAME_VERSION(name)) + +typedef struct EwkViewImpl EwkViewImpl; +/** + * @brief Contains an internal View data. + * + * It is to be considered private by users, but may be extended or + * changed by sub-classes (that's why it's in public header file). + */ +struct Ewk_View_Smart_Data { + Evas_Object_Smart_Clipped_Data base; + const Ewk_View_Smart_Class* api; /**< reference to casted class instance */ + Evas_Object* self; /**< reference to owner object */ + EwkViewImpl* priv; /**< should never be accessed, c++ stuff */ + struct { + Evas_Coord x, y, w, h; /**< last used viewport */ + } view; + struct { /**< what changed since last smart_calculate */ + Eina_Bool any : 1; + + // WebKit use these but we don't. We should remove these if we are sure + // we do it right. + Eina_Bool size : 1; + Eina_Bool position : 1; + } changed; +}; + +/** + * Sets the smart class APIs, enabling view to be inherited. + * + * @param api class definition to set, all members with the + * exception of @a Evas_Smart_Class->data may be overridden, must + * @b not be @c NULL + * + * @note @a Evas_Smart_Class->data is used to implement type checking and + * is not supposed to be changed/overridden. If you need extra + * data for your smart class to work, just extend + * Ewk_View_Smart_Class instead. + * The Evas_Object which inherits the ewk_view should use + * ewk_view_smart_add() to create Evas_Object instead of + * evas_object_smart_add() because it performs additional initialization + * for the ewk_view. + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure (probably + * version mismatch) + * + * @see ewk_view_smart_add() + */ +EXPORT_API Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class* api); + +/** + * Creates a new EFL WebKit view object with Evas_Smart and Ewk_Context. + * + * @note The Evas_Object which inherits the ewk_view should create its + * Evas_Object using this API instead of evas_object_smart_add() + * because the default initialization for ewk_view is done in this API. + * + * @param e canvas object where to create the view object + * @param smart Evas_Smart object. Its type should be EWK_VIEW_TYPE_STR + * @param context Ewk_Context object which is used for initializing + * @param pageGroup Ewk_Page_Group object which is used for initializing + * + * @return view object on success or @c NULL on failure + */ +EXPORT_API Evas_Object* ewk_view_smart_add(Evas* e, Evas_Smart* smart, + Ewk_Context* context, + Ewk_Page_Group* pageGroup); + +/** + * Creates a new EFL WebKit view object based on specific Ewk_Context. + * + * @note If used to created a new ewk_view object in response to a + * "create,window" smart signal (emitted by the web engine), this + * function must pass as context parameter the same context instance + * as of the originating ewk_view object's context, e.g.: + * + * - Scenario 1: parent view created with default context: + * + * parent_view = ewk_view_add(evas); // uses the default context. + * or + * parent_view = ewk_view_add_with_context(evas, + * ewk_context_default_get()); then + * // Valid cases: + * child_view = ewk_view_add_with_context(evas, + * ewk_view_context_get(parent_view)); or child_view = + * ewk_view_add_with_context(evas, ewk_context_default_get()); + * + * // Invalid case: + * view_view = ewk_view_add_with_context(evas, ewk_context_new()); + * + * - Scenario 2: parent created with a new context: + * + * parent_view = ewk_view_add_with_context(evas, ewk_context_new()); + * then + * // Valid case: + * child_view = ewk_view_add_with_context(evas, + * ewk_view_context_get(parent_view)); + * + * // Invalid cases: + * child_view = ewk_view_add_with_context(evas, ewk_context_new()); + * or + * child_view = ewk_view_add_with_context(evas, + * ewk_context_default_get()); + * + * @param e canvas object where to create the view object + * @param context Ewk_Context object to declare process model + * + * @return view object on success or @c NULL on failure + */ +EXPORT_API Evas_Object* ewk_view_add_with_context(Evas* e, + Ewk_Context* context); + +/** + * @brief Gets the widget of this view. + * + * @since_tizen 3.0 + * + * @param[in] o The view object to get the widget + * + * @return widget on success or @c NULL on failure + */ +EXPORT_API Evas_Object* ewk_view_widget_get(Evas_Object* view); + +enum Ewk_Page_Visibility_State { + EWK_PAGE_VISIBILITY_STATE_VISIBLE, + EWK_PAGE_VISIBILITY_STATE_HIDDEN, + EWK_PAGE_VISIBILITY_STATE_PRERENDER +}; +typedef enum Ewk_Page_Visibility_State Ewk_Page_Visibility_State; + +/** + * Callback for ewk_view_script_execute + * + * @param o the view object + * @param result_value value returned by script + * @param user_data user data + */ +typedef void (*Ewk_View_Script_Execute_Callback)(Evas_Object* o, + const char* result_value, + void* user_data); + +/** + * Callback for ewk_view_plain_text_get + * + * @param o the view object + * @param plain_text the contents of the given frame converted to plain text + * @param user_data user data + */ +typedef void (*Ewk_View_Plain_Text_Get_Callback)(Evas_Object* o, + const char* plain_text, + void* user_data); + +/** + * Creates a type name for the callback function used to get the page contents. + * + * @param o view object + * @param data mhtml data of the page contents + * @param user_data user data will be passed when ewk_view_mhtml_data_get is + * called + */ +typedef void (*Ewk_View_MHTML_Data_Get_Callback)(Evas_Object* o, + const char* data, + void* user_data); + +/** + * @brief Gets whether horizontal panning is holding. + * + * @since_tizen 2.3 + * + * @param[in] o view object to get whether horizontal panning is holding + * + * @return @c EINA_TRUE if horizontal panning is holding + * @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool ewk_view_horizontal_panning_hold_get(Evas_Object* o); + +/** + * @brief Sets to hold horizontal panning. + * + * @since_tizen 2.3 + * + * @param[in] o view object to set to hold horizontal panning + * @param[in] hold @c EINA_TRUE to hold horizontal panning + * @c EINA_FALSE not to hold + */ +EXPORT_API void ewk_view_horizontal_panning_hold_set(Evas_Object* o, + Eina_Bool hold); + +/** + * @brief Gets whether vertical panning is holding. + * + * @since_tizen 2.3 + * + * @param[in] o view object to get whether vertical panning is holding + * + * @return @c EINA_TRUE if vertical panning is holding + * @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool ewk_view_vertical_panning_hold_get(Evas_Object* o); + +/** + * Block/Release the vertical pan + * + * @param o view object on which pan is to be blocked/release + * @param hold status of pan + */ +EXPORT_API void ewk_view_vertical_panning_hold_set(Evas_Object* o, + Eina_Bool hold); + +/** + * Gets the minimum and maximum value of the scale range or -1 on failure + * + * @param o view object to get the minimum and maximum value of the scale range + * @param min_scale Pointer to an double in which to store the minimum scale + * factor of the object. + * @param max_scale Pointer to an double in which to store the maximum scale + * factor of the object. + * + * @note Use @c NULL pointers on the scale components you're not + * interested in: they'll be ignored by the function. + */ +EXPORT_API void ewk_view_scale_range_get(Evas_Object* o, double* min_scale, + double* max_scale); + +typedef Eina_Bool (*Ewk_View_Password_Confirm_Popup_Callback)( + Evas_Object* o, const char* message, void* user_data); +EXPORT_API void ewk_view_password_confirm_popup_callback_set( + Evas_Object* o, Ewk_View_Password_Confirm_Popup_Callback callback, + void* user_data); +EXPORT_API void ewk_view_password_confirm_popup_reply( + Evas_Object* o, Ewk_Password_Popup_Option result); + +typedef Eina_Bool (*Ewk_View_JavaScript_Alert_Callback)(Evas_Object* o, + const char* alert_text, + void* user_data); +EXPORT_API void ewk_view_javascript_alert_callback_set( + Evas_Object* o, Ewk_View_JavaScript_Alert_Callback callback, + void* user_data); +EXPORT_API void ewk_view_javascript_alert_reply(Evas_Object* o); + +typedef Eina_Bool (*Ewk_View_JavaScript_Confirm_Callback)(Evas_Object* o, + const char* message, + void* user_data); +EXPORT_API void ewk_view_javascript_confirm_callback_set( + Evas_Object* o, Ewk_View_JavaScript_Confirm_Callback callback, + void* user_data); + +/** + * Callback for ewk_view_javascript_prompt_callback_set + * + * @param o the view object + * @param message the text to be displayed on the prompt popup + * @param default_value default text to be entered in the prompt dialog + * @param user_data user data + */ +typedef Eina_Bool (*Ewk_View_JavaScript_Prompt_Callback)( + Evas_Object* o, const char* message, const char* default_value, + void* user_data); + +/** + * Display javascript prompt popup + * + * @param o view object + * @param callback callback function to be called when the prompt popup is to be + * opened + * @param user_data user data + * + */ +EXPORT_API void ewk_view_javascript_prompt_callback_set( + Evas_Object* o, Ewk_View_JavaScript_Prompt_Callback callback, + void* user_data); + +//#if ENABLE(TIZEN_APPLICATION_CACHE) +typedef Eina_Bool (*Ewk_View_Applicacion_Cache_Permission_Callback)( + Evas_Object* o, Ewk_Security_Origin* origin, void* user_data); +//#endif + +typedef void (*Ewk_View_Exceeded_Indexed_Database_Quota_Callback)( + Evas_Object* o, Ewk_Security_Origin* origin, long long currentQuota, + void* user_data); +EXPORT_API void ewk_view_exceeded_indexed_database_quota_callback_set( + Evas_Object* o, Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback, + void* user_data); +EXPORT_API void ewk_view_exceeded_indexed_database_quota_reply(Evas_Object* o, + Eina_Bool allow); + +typedef Eina_Bool (*Ewk_View_Exceeded_Database_Quota_Callback)( + Evas_Object* o, Ewk_Security_Origin* origin, const char* database_name, + unsigned long long expectedQuota, void* user_data); +EXPORT_API void ewk_view_exceeded_database_quota_callback_set( + Evas_Object* o, Ewk_View_Exceeded_Database_Quota_Callback callback, + void* user_data); +EXPORT_API void ewk_view_exceeded_database_quota_reply(Evas_Object* o, + Eina_Bool allow); + +typedef Eina_Bool (*Ewk_View_Exceeded_Local_File_System_Quota_Callback)( + Evas_Object* o, Ewk_Security_Origin* origin, long long currentQuota, + void* user_data); +EXPORT_API void ewk_view_exceeded_local_file_system_quota_callback_set( + Evas_Object* o, Ewk_View_Exceeded_Local_File_System_Quota_Callback callback, + void* user_data); +EXPORT_API void ewk_view_exceeded_local_file_system_quota_reply( + Evas_Object* o, Eina_Bool allow); +//#if ENABLE(TIZEN_FOCUS_UI) +typedef Eina_Bool (*Ewk_View_Unfocus_Allow_Callback)( + Evas_Object* o, Ewk_Unfocus_Direction direction, void* user_data); +//#endif + +/** + * Callback for geolocation permission request feature. + * + * @param ewk_view view object where geolocation permission was requested + * @param request geolocation permission request object + * @param user_data user data passed to + * ewk_view_geolocation_permission_callback_set + * + * @return Unused + */ +typedef Eina_Bool (*Ewk_View_Geolocation_Permission_Callback)( + Evas_Object* ewk_view, Ewk_Geolocation_Permission_Request* request, + void* user_data); + +/** + * Sets callback which will be called upon geolocation permission request. This + * function can be used also to unset this callback. Do that by passing NULL as + * callback param. + * + * @param ewk_view view object to set the callback to + * @param callback callback function called upon geolocation permission request + * @param user_data user_data passsed to set callback when called + * + * @note When callback is set by this function, it will be called insted of + * "geolocation,permission,request" smart callback. + */ +EXPORT_API void ewk_view_geolocation_permission_callback_set( + Evas_Object* ewk_view, Ewk_View_Geolocation_Permission_Callback callback, + void* user_data); + +typedef Eina_Bool (*Ewk_View_User_Media_Permission_Callback)( + Evas_Object* ewk_view, + Ewk_User_Media_Permission_Request* user_media_permission_request, + void* user_data); +EXPORT_API void ewk_view_user_media_permission_callback_set( + Evas_Object* ewk_view, Ewk_View_User_Media_Permission_Callback callback, + void* user_data); + +/** + * Callback for ewk_view_authentication_callback_set + * + * @param o the view object + * @param auth_challenge Ewk_Auth_Challenge object to get the information about + * authentication + * @param user_data user data + */ +typedef void (*Ewk_View_Authentication_Callback)( + Evas_Object* o, Ewk_Auth_Challenge* auth_challenge, void* user_data); + +/** + * Sets the callback authentication. + * + * @param o the view object + * @param callback callback function to be called when the authentication is + * called + * @param user_data user data + * + * @note When callback is set by this function, + * class of Ewk_Auth_Challenge is passed by callback function. + * + * @see Ewk_View_Authentication_Callback + */ +EXPORT_API void ewk_view_authentication_callback_set( + Evas_Object* o, Ewk_View_Authentication_Callback callback, void* user_data); + +EXPORT_API Eina_Bool ewk_view_mode_set(Evas_Object* ewkView, + Ewk_View_Mode view_mode); + +/** + * Requests the specified plain text string into the view object + * + * @note The mime type of document will be "text/plain". + * + * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors + */ +EXPORT_API Eina_Bool ewk_view_plain_text_set(Evas_Object* o, + const char* plain_text); + +/** + * Requests for setting page visibility state. + * + * @param o view object to set the page visibility + * @param page_visibility_state visible state of the page to set + * @param initial_state @c EINA_TRUE if this function is called at page + * initialization time, + * @c EINA_FALSE otherwise + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_page_visibility_state_set( + Evas_Object* o, Ewk_Page_Visibility_State page_visibility_state, + Eina_Bool initial_state); + +/** + * Request to set the user agent with application name. + * + * @param o view object to set the user agent with application name + * + * @param application_name string to set the user agent + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_application_name_for_user_agent_set( + Evas_Object* o, const char* application_name); + +/** + * Returns application name string. + * + * @param o view object to get the application name + * + * @return @c application name. The returned string @b should be freed by + * eina_stringshare_del() after use. + */ +EXPORT_API const char* ewk_view_application_name_for_user_agent_get( + const Evas_Object* o); + +/* + * add custom header + * + * @param o view object to add custom header + * + * @param name custom header name to add the custom header + * + * @param value custom header value to add the custom header + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_custom_header_add(const Evas_Object* o, + const char* name, + const char* value); +/** + * remove custom header + * + * @param o view object to remove custom header + * + * @param name custom header name to remove the custom header + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_custom_header_remove(const Evas_Object* o, + const char* name); +/** + * clears all custom headers + * + * @param o view object to clear custom headers + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_custom_header_clear(const Evas_Object* o); + +/** + * Returns the evas image object of the specified viewArea of page + * + * The returned evas image object @b should be freed after use. + * + * @param o view object to get specified rectangle of cairo surface. + * @param viewArea rectangle of cairo surface. + * @param scaleFactor scale factor of cairo surface. + * @param canvas canvas for creating evas image. + * + * @return newly allocated evas image object on sucess or @c 0 on failure. + */ +EXPORT_API Evas_Object* ewk_view_screenshot_contents_get( + const Evas_Object* o, Eina_Rectangle viewArea, float scaleFactor, + Evas* canvas); + +/** + * Makes request of evas image object of the specified viewArea of page + * asynchronously + * + * The returned evas image object through async callback @b should be freed + * after use. + * + * @param o view object to get specified rectangle of cairo surface. + * @param viewArea rectangle of cairo surface. + * @param scaleFactor scale factor of cairo surface. + * @param canvas canvas for creating evas image. + * @param callback result callback to get captured screenshot. + * @param user_data will be passed when result_callback is called + * -I.e., user data will be kept until callback is called. + * + * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors. + */ +EXPORT_API Eina_Bool ewk_view_screenshot_contents_get_async( + const Evas_Object* o, Eina_Rectangle viewArea, float scaleFactor, + Evas* canvas, Ewk_Web_App_Screenshot_Captured_Callback callback, + void* user_data); + +/** + * Start a server for inspecting web pages + * This server will be used by Remote Web Browser to transfer messages over + * network + * + * @param [o] view object to debug + * @param [in] port It is a port number for the server. A free port on system + * will be allocated if port is 0 + * + * @return @c assigned port number on success or @c 0 on failure + */ +EXPORT_API unsigned int ewk_view_inspector_server_start(Evas_Object* o, + unsigned int port); + +/** + * Stop a server for inspecting web pages + * + * @param [o] view object to debug + * + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_view_inspector_server_stop(Evas_Object* o); + +/** + * Gets the possible scroll size of the given view. + * + * Possible scroll size is contents size minus the viewport size. + * + * @param o view object to get scroll size + * @param w the pointer to store the horizontal size that is possible to scroll, + * may be @c 0 + * @param h the pointer to store the vertical size that is possible to scroll, + * may be @c 0 + * + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise and + * values are zeroed + */ +EXPORT_API Eina_Bool ewk_view_scroll_size_get(const Evas_Object* o, int* w, + int* h); + +/** + * Executes editor command. + * + * @param o view object to execute command + * @param command editor command to execute + * @param value the value to be passed into command + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_command_execute(Evas_Object* o, + const char* command, + const char* value); + +/** + * Retrieve the contents in plain text. + * + * @param o view object whose contents to retrieve. + * @param callback result callback + * @param user_data user data + * + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_view_plain_text_get( + Evas_Object* o, Ewk_View_Plain_Text_Get_Callback callback, void* user_data); + +/** + * Get page contents as MHTML data + * + * @param o view object to get the page contents + * @param callback callback function to be called when the operation is finished + * @param user_data user data to be passed to the callback function + * + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_view_mhtml_data_get( + Evas_Object* o, Ewk_View_MHTML_Data_Get_Callback callback, void* user_data); + +typedef void (*Ewk_View_Hit_Test_Request_Callback)(Evas_Object* o, int x, int y, + int hit_test_mode, + Ewk_Hit_Test*, + void* user_data); + +/** + * Requests new hit test for given view object and point. + * + * @param o view object to do hit test on + * @param x the horizontal position to query + * @param y the vertical position to query + * @param hit_test_mode the Ewk_Hit_Test_Mode enum value to query + * @param callback callback to be executed when hit test request was + * finished + * + * @return EINA_TRUE if hit test request was queued, otherwise EINA_FALSE + */ +EXPORT_API Eina_Bool +ewk_view_hit_test_request(Evas_Object* o, int x, int y, int hit_test_mode, + Ewk_View_Hit_Test_Request_Callback, void* user_data); + +/** + * Deprecated. + * Notify that notification is closed. + * + * @param notification_list list of Ewk_Notification pointer + * notification_list is freed in this function. + * + * @return this function will always return EINA_FALSE since it is deprecated + * + * @deprecated + * @see ewk_notification_closed + */ +EINA_DEPRECATED EXPORT_API Eina_Bool +ewk_view_notification_closed(Evas_Object* o, Eina_List* notification_list); + +/** + * @deprecated Deprecated since Tizen 5.0. Manual encoding selection is removed + * from upstream Sets the encoding and reloads the page. + * + * @param ewkView view to set the encoding + * @param encoding the new encoding to set or @c 0 to restore the default one + */ +EINA_DEPRECATED EXPORT_API void ewk_view_encoding_custom_set( + Evas_Object* ewkView, const char* encoding); + +// #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION) + +/** + * Sets whether the ewk_view supports the mouse events or not. + * + * The ewk_view will support the mouse events if EINA_TRUE or not support the + * mouse events otherwise. The default value is EINA_TRUE. + * + * @param o view object to enable/disable the mouse events + * @param enabled a state to set + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object* o, + Eina_Bool enabled); + +/** + * Queries if the ewk_view supports the mouse events. + * + * @param o view object to query if the mouse events are enabled + * + * @return @c EINA_TRUE if the mouse events are enabled or @c EINA_FALSE + * otherwise + */ +EXPORT_API Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object* o); + +typedef Eina_Bool (*Ewk_Orientation_Lock_Cb)(Evas_Object* o, + Eina_Bool need_lock, + int orientation, void* user_data); + +/** + * Deprecated + * Sets callback of orientation lock function + * + * func will be called when screen lock is called or unlock is called. + * When screen.lockOrientation is called, need_lock will be true and orientation + * will be the flags which should be locked. + * For example, when contents called 'screen.lockOrientation("portrait"), + * orientation will be EWK_SCREEN_ORIENTATION_PORTRAIT_PRIMARY | + * EWK_SCREEN_ORIENTATION_PORTRAIT_SECONDARY When screen.unlockOrientation is + * called, need_lock will be false. + * + * @param o view object to set the callback of orientation + * @param func callback function to be called when screen orientation is locked + * or unlocked. + * @param use_data user_data will be passsed when ewk_view_web_app_icon_get is + * called + * + * @return current URI on success or @c 0 on failure + */ +EINA_DEPRECATED EXPORT_API void ewk_view_orientation_lock_callback_set( + Evas_Object* o, Ewk_Orientation_Lock_Cb func, void* user_data); + +/** + * Sets the callback on the scale factor change. + * + * The given callback function will be called when the engine has successfully + * changed the scale factor. It happens, for example, after ewk_view_scale_set + * call but not only. The engine itself can change the scale while rendering + * the content, for example, when ewk_settings_auto_fitting is turned on. + * + * @param o view object to set the callback + * @param callback the callback funtion which will be called on scale change + * @param user_data pointer to the data which will be passed while calling the + * callback + */ +EXPORT_API void ewk_view_scale_changed_callback_set( + Evas_Object* o, Ewk_View_Scale_Changed_Callback callback, void* user_data); + +/** + * Clears the highlight of searched text. + * + * @param o view object to find text + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on errors + */ +EXPORT_API Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object* o); + +/** + * Sets whether the ewk_view supports the touch events or not. + * + * The ewk_view will support the touch events if @c EINA_TRUE or not support the + * touch events otherwise. The default value is @c EINA_FALSE. + * + * @param o view object to enable/disable the touch events + * @param enabled a state to set + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object* o, + Eina_Bool enabled); + +/** + * Queries if the ewk_view supports the touch events. + * + * @param o view object to query if the touch events are enabled + * + * @return @c EINA_TRUE if the touch events are enabled or @c EINA_FALSE + * otherwise + */ +EXPORT_API Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object* o); + +/// Enum values containing Content Security Policy header types. +enum _Ewk_CSP_Header_Type { + EWK_REPORT_ONLY, + EWK_ENFORCE_POLICY, + EWK_DEFAULT_POLICY +}; +typedef enum _Ewk_CSP_Header_Type Ewk_CSP_Header_Type; + +/** + * Set received Content Security Policy data from web app + * + * @param o view object + * @param policy Content Security Policy data + * @param type Content Security Policy header type + * + */ +EXPORT_API void ewk_view_content_security_policy_set(Evas_Object* o, + const char* policy, + Ewk_CSP_Header_Type type); + +/** + * When font-family is "Tizen", use system's Settings font as default + * font-family + * + * @param o view object + * + */ +EXPORT_API void ewk_view_use_settings_font(Evas_Object* o); + +/* + * Get cookies associated with an URL. + * + * @param o view object in which URL is opened. + * @param url the url for which cookies needs to be obtained. + * + * @return @c character array containing cookies, @c NULL if no cookies are + * found. + * + * The return character array has to be owned by the application and freed when + * not required. + */ +EXPORT_API char* ewk_view_get_cookies_for_url(Evas_Object* o, const char* url); + +/** + * Sets whether to draw transparent background or not. + * + * @param o view object to enable/disable transparent background + * @param enabled a state to set + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool +ewk_view_draws_transparent_background_set(Evas_Object* o, Eina_Bool enabled); + +/** + * @brief Queries if transparent background is enabled. + * + * @since_tizen 2.3 + * + * @param[in] o view object to get whether transparent background is enabled or + * not + * + * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable + */ +EXPORT_API Eina_Bool ewk_view_draws_transparent_background_get(Evas_Object* o); + +/** + * @brief Sets the background color and transparency of the view. + * + * @note Should be used after ewk_view_url_set(). + * + * @param[in] o view object to change the background color + * @param[in] r red color component [0..255] + * @param[in] g green color component [0..255] + * @param[in] b blue color component [0..255] + * @param[in] a transparency [0..255] + * + * @return @c EINA_TRUE on success, otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_bg_color_set(Evas_Object* o, int r, int g, int b, + int a); + +/** + * set a font for browser application + * + * @param o view object + * + */ +EXPORT_API void ewk_view_browser_font_set(Evas_Object* o); + +/** + * Load the error page which web page is not found. + * + * @param ewkView view object whose session needs to be stored. + * @param ErrorUrl that could not be found. + * + * @return void + */ +EXPORT_API void ewk_view_not_found_error_page_load(Evas_Object* ewkView, + const char* ErrorUrl); + +/** + * Enable or disable supporting of the split scrolling for overflow scroll. + * + * @param ewkView view object to set the support of the split scrolling for + * overflow scroll + * @param enable @c EINA_TRUE to support split scrolling, @c EINA_FALSE not to + * support + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_split_scroll_overflow_enabled_set( + Evas_Object* ewkView, const Eina_Bool enabled); + +/** + * @brief Gets the staus of split scrolling supporting for overflow scroll. + * + * @since_tizen 2.3 + * + * @param[in] o view object to get the status of split scrolling supporting + * + * @return the status of split scrolling supporting + */ +EXPORT_API Eina_Bool +ewk_view_split_scroll_overflow_enabled_get(const Evas_Object* o); + +/** + * Deprecated. + * Enable/disable focus ring. + * + * @note Focus ring is enabled by default but disabled for wrt on TV profile + * + * @param ewkView view object + * @param enabled @c EINA_TRUE to enable the focus ring, @c EINA_FALSE to + * disable + * + */ +EINA_DEPRECATED EXPORT_API void ewk_view_draw_focus_ring_enable_set( + Evas_Object* ewkView, Eina_Bool enable); + +/** + * Queries the current zoom factor of the page. + * + * @param o view object to get the zoom factor + * + * @return current zoom factor in use on success or @c -1.0 on failure + */ +EXPORT_API double ewk_view_page_zoom_get(const Evas_Object* o); + +/** + * Sets zoom factor of the current page. + * + * @note ewk_view_page_zoom_set internally might use older page than current + * one, if you called it immediately after ewk_view_url_set. To be safe + * from such race, use it from inside 'url,changed' callback, which can + * be registered on ewk_view. + * + * @param o view object to set the zoom level + * @param zoom_factor a new level to set + * + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_view_page_zoom_set(Evas_Object* o, double zoom_factor); + +/** + * Creates a new EFL WebKit view object with Evas_Smart and Ewk_Context. + * + * @note The Evas_Object which inherits the ewk_view should create its + * Evas_Object using this API instead of evas_object_smart_add() + * because the default initialization for ewk_view is done in this API. + * + * @param e canvas object where to create the view object + * @param smart Evas_Smart object. Its type should be EWK_VIEW_TYPE_STR + * @param context Ewk_Context object which is used for initializing + * @param pageGroup Ewk_Page_Group object which is used for initializing + * + * @return view object on success or @c NULL on failure + */ +EXPORT_API Evas_Object* ewk_view_smart_add(Evas* e, Evas_Smart* smart, + Ewk_Context* context, + Ewk_Page_Group* pageGroup); + +/** + * Callback for quota permission request feature. + * + * @param ewkView view object where quota permission was requested + * @param request quota permission request object + * @param user_data user_data passed to + * ewk_view_quota_permission_request_callback_set + */ +typedef void (*Ewk_Quota_Permission_Request_Callback)( + Evas_Object* ewkView, const Ewk_Quota_Permission_Request* request, + void* user_data); + +/** + * Sets callback quota permission request. + * + * func will be called when page requests increased storage quota. + * + * @param ewkView view object to set the callback + * @param func callback function to be called when quota permission is requested + * @param use_data user_data will be passsed to callback function + * + * @return void + */ +EXPORT_API void ewk_view_quota_permission_request_callback_set( + Evas_Object* ewkView, Ewk_Quota_Permission_Request_Callback callback, + void* user_data); + +/** + * Set reply to quota permission request. + * + * Set @c EINA_TRUE if user accepts new quota size for origin + * or @c EINA_FALSE if user doesn't accept new quota for origin. + * + * @param request view object to set the support of the split scrolling for + * overflow scroll + * @param enable @c EINA_TRUE allow quota size, @c EINA_FALSE + * + * @return void + */ +EXPORT_API void ewk_view_quota_permission_request_reply( + const Ewk_Quota_Permission_Request* request, const Eina_Bool allow); + +/** + * Cancels quota permission request. + * + * @param request view object to set the support of the split scrolling for + * overflow scroll + * + * @return void + */ +EXPORT_API void ewk_view_quota_permission_request_cancel( + const Ewk_Quota_Permission_Request* request); + +/* + * Requests web login using password database. + * + * @param o view object + * + * @return void + */ +EXPORT_API Eina_Bool ewk_view_web_login_request(Evas_Object* ewkView); + +/** + * Sets the notification permission callback. + * + * @param o view object to request the notification permission + * @param callback Ewk_View_Notification_Permission_Callback function to + * notification permission + * @param user_data user data + */ +EXPORT_API void ewk_view_notification_permission_callback_set( + Evas_Object* o, Ewk_View_Notification_Permission_Callback callback, + void* user_data); + +/** + * @brief Callback invoked when theme color is changed + * + * @details Ewk_View_Did_Change_Theme_Color_Callback callback allows host\n + * application to receive information regarding theme color change.\n + * Callback will be called in following cases:\n + * - no "theme-color" meta tag => "theme-color" meta tag\n + * - "theme-color" meta tag => different "theme-color" meta tag\n + * - "theme-color" meta tag => no "theme-color" meta tag\n + * In case of no "theme-color" meta tag @a r, @a g, @a b and @a a\n + * equal 0. + * + * @since_tizen 3.0 + * + * @param[in] o View object for which callback was set + * @param[in] r Red color component ranged from 0 to 255 + * @param[in] g Green color component ranged from 0 to 255 + * @param[in] b Blue color component ranged from 0 to 255 + * @param[in] a Opacity value ranged from 0 to 255 + * @param[in] user_data User data passed to\n + * ewk_view_did_change_theme_color_callback_set + * + * @see ewk_view_did_change_theme_color_callback_set + */ +typedef void (*Ewk_View_Did_Change_Theme_Color_Callback)(Evas_Object* o, int r, + int g, int b, int a, + void* user_data); + +/** + * @brief Sets Ewk_View_Did_Change_Theme_Color_Callback + * + * @since_tizen 3.0 + * + * @param[in] o View object to receive theme color change information + * @param[in] callback New callback, NULL resets current callback + * @param[in] user_data User data that will be passed to @a callback + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE + * + * @see Ewk_View_Did_Change_Theme_Color_Callback + */ +EXPORT_API Eina_Bool ewk_view_did_change_theme_color_callback_set( + Evas_Object* o, Ewk_View_Did_Change_Theme_Color_Callback callback, + void* user_data); + +/** + * @brief Callback invoked when save page is done + * + * @since_tizen 3.0 + * + * @param[in] o View object for which callback was set + * @param[in] file_path File path of saved page on success or @c NULL on failure + * @param[in] user_data User data passed to ewk_view_save_page + * + * @see ewk_view_save_page_as_mhtml + */ +typedef void (*Ewk_View_Save_Page_Callback)(Evas_Object* o, + const char* file_path, + void* user_data); + +/** + * @brief Save current page as MHTML format + * + * @since_tizen 3.0 + * + * @param[in] o View object which has page to save + * @param[in] path File path where saved page should be placed\n + * It can be full path of saved page or path of + * existing directory\n + * If path is existing directory, file name will be chosen\n + * according to the title of the current page\n + * (e.g. /path-to-directory/Google.mhtml)\n + * If path has no extension, default extension(mhtml)\n + * will be appended + * @param[in] callback Callback to be called when the operation is finished + * @param[in] user_data User data that will be passed to @a callback + * + * @return @c EINA_TRUE on successful request,\n + * otherwise @c EINA_FALSE + * + * @see Ewk_View_Save_Page_Callback + */ +EXPORT_API Eina_Bool ewk_view_save_page_as_mhtml( + Evas_Object* o, const char* path, Ewk_View_Save_Page_Callback callback, + void* user_data); + +/* + * @brief Set Reader mode enable + * + * @since_tizen 3.0 + * + * @param[in] ewk_view view object to enable/disable the Reader mode + * @param[in] enable a state to set + * + * @note Reader Mode support or not will be known after the ewk_view object\n + * received "reader,mode" callback from evas_object smart callback. + */ +EXPORT_API void ewk_view_reader_mode_set(Evas_Object* ewk_view, + Eina_Bool enable); + +/** + * @brief Sets the height of top controls. + * + * @since_tizen 3.0 + * + * @param[in] ewk_view view object to set height of top control + * @param[in] top_height the height of the top controls in pixels + * @param[in] bottom_height the height of the bottom controls in pixels + * + * @return @c EINA_TRUE on success @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_view_top_controls_height_set(Evas_Object* ewk_view, + size_t top_height, + size_t bottom_height); + +/** + * @brief Sets the state of top controls. + * + * @since_tizen 3.0 + * + * @note EWK_TOP_CONTROL_BOTH for current to preserve the current position. + * + * @param[in] ewk_view view object to set state of top control + * @param[in] constraint constrain the top controls to being shown or hidden + * @param[in] current set current state + * @param[in] animate whether or not to animate to the proper state + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_top_controls_state_set( + Evas_Object* ewk_view, Ewk_Top_Control_State constraint, + Ewk_Top_Control_State current, Eina_Bool animation); + +/** + * @brief Sets the visibility of main frame scrollbar. + * + * @since_tizen 2.3 + * + * @param[in] o view object + * @param[in] visible visibility of main frame scrollbar + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool +ewk_view_main_frame_scrollbar_visible_set(Evas_Object* o, Eina_Bool visible); + +/** + * @brief Set Default XHR LongPolling Timeout. + * + * @details XML Http Request by default does not have a timeout value. The + * timeout can be set using "timeout" field during creation of XHR + * object. This API allows for setting the timeout globally for + * whole View. Request timeout value will be calculated as minimum + * of argument of the API and value set in XHR field. If XHR field + * value is 0, value from API will be used. + * + * @since_tizen 3.0 + * + * @param[in] o view object + * @param[in] timeout XHR LongPolling timeout value (in seconds) + */ +EXPORT_API void ewk_view_session_timeout_set(Evas_Object* o, + unsigned long timeout); + +/** + * @brief Enforces web page to close + * + * @since_tizen 3.0 + * + * @param[in] o view + * + * @return @c EINA_TRUE on success @c EINA_FALSE otherwise + * + */ +EXPORT_API Eina_Bool ewk_view_page_close(Evas_Object* o); + +/** + * @brief Requests the manifest data from a given URL. + * + * @since_tizen 3.0 + * + * @param[in] o view object to request the manifest information + * @param[in] callback Ewk_View_Request_Manifest_Callback function + * @param[in] manifest_url a given URL + * @param[in] host_url a host url used to resolve relative URLs + * located in manifest file + * + * @see Ewk_View_Request_Manifest_Callback + */ +EXPORT_API void ewk_view_request_manifest_from_url( + Evas_Object* o, Ewk_View_Request_Manifest_Callback callback, + void* user_data, const char* host_url, const char* manifest_url); + +/** + * Callback for @a ewk_view_app_installation_request_callback_set api. + * + * @since_tizen 4.0 + * + * @param[in] o view object + * @param[in] request app installation request + * @param[in] user_data user data passed to + * @a ewk_view_app_installation_request_callback_set api + */ +typedef void (*Ewk_App_Installation_Request_Callback)( + Evas_Object* o, Ewk_App_Installation_Request* request, void* user_data); + +/** + * Set callback handling app installation request. It is called in reaction to + * window.navigator.installApp() api being called. + * + * @since_tizen 4.0 + * + * @param[in] o view object + * @param[in] callback callback to be set; Can be null + * @param[in] user_data user data to be passed to @a callback; Can be null + */ +EXPORT_API void ewk_view_app_installation_request_callback_set( + Evas_Object* o, Ewk_App_Installation_Request_Callback callback, + void* user_data); + +/** + * Sets the state to apply Blur Effect for widgets + * + * @since_tizen 3.0 + * + * This function let WebKit knows that the widget is tizen 2.x widget. + * WebKit will query this information to decide to apply Blur effect or not. + * @param[in] o view object to set the visibility state. + * @param[in] state @c EINA_TRUE if tizen 2.x widget + * @c EINA_FALSE otherwise. + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure. + */ +EXPORT_API void ewk_view_mirrored_blur_set(Evas_Object* o, Eina_Bool state); + +/** + * Sets whether the ewk_view renders to offscreen buffer or not. + * + * @since_tizen 5.0 + * + * @param[in] o view object + * @param[in] enabled a state to set + */ +EXPORT_API void ewk_view_offscreen_rendering_enabled_set(Evas_Object* o, + Eina_Bool enabled); + +/** + * Sets the window object which is used for IME. + * + * @since_tizen 5.5 + * + * @param[in] o view object + * @param[in] window the top-level window object + */ +EXPORT_API void ewk_view_ime_window_set(Evas_Object* o, void* window); + +/** + * Sends mouse down event. + * + * @since_tizen 6.0 + * + * @param[in] o view object + * @param[in] button button type + * @param[in] x horizontal position of mouse event + * @param[in] y vertical position of mouse event + */ +EXPORT_API void ewk_view_feed_mouse_down(Evas_Object* o, + Ewk_Mouse_Button_Type button, int x, + int y); + +/** + * Sends mouse up event. + * + * @since_tizen 6.0 + * + * @param[in] o view object + * @param[in] button button type + * @param[in] x horizontal position of mouse event + * @param[in] y vertical position of mouse event + */ +EXPORT_API void ewk_view_feed_mouse_up(Evas_Object* o, + Ewk_Mouse_Button_Type button, int x, + int y); + +/** + * Sends mouse move event. + * + * @since_tizen 6.0 + * + * @param[in] o view object + * @param[in] x horizontal position of mouse event + * @param[in] y vertical position of mouse event + */ +EXPORT_API void ewk_view_feed_mouse_move(Evas_Object* o, int x, int y); + +/** + * Sends mouse wheel event. + * + * @since_tizen 6.0 + * + * @param[in] o view object + * @param[in] y_direction wheel mouse direction + * @param[in] step how much mouse wheel was scrolled up or down + * @param[in] x horizontal position of mouse event + * @param[in] y vertical position of mouse event + */ +EXPORT_API void ewk_view_feed_mouse_wheel(Evas_Object* o, Eina_Bool y_direction, + int step, int x, int y); + +/** + * Sends mouse out event. + * + * @since_tizen 6.0 + * + * @param[in] o view object + */ +EXPORT_API void ewk_view_feed_mouse_out(Evas_Object* o); + +#ifdef __cplusplus +} +#endif +#endif // ewk_view_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_view_product.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_view_product.h new file mode 100644 index 000000000..94f0b4efa --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_view_product.h @@ -0,0 +1,1565 @@ +/* + * Copyright (C) 2011-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_view_product.h + * @brief Chromium main smart object. + * + * This object provides view related APIs of Chromium to EFL object. + */ + +#ifndef ewk_view_product_h +#define ewk_view_product_h + +#include "ewk_context_product.h" +#include "ewk_media_playback_info_product.h" +#include "ewk_value_product.h" +#include "ewk_view_internal.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * A callback to check whether allowed to run mixed content or not + * + * @param ewkView view object + * @param user_data user_data will be passed when callback is called + * @return true: allow to run mixed content. false: not allow to run mixed + * content + */ +typedef Eina_Bool (*Ewk_View_Run_Mixed_Content_Confirm_Callback)( + Evas_Object* ewkView, void* user_data); + +/** + * @brief Creates a new EFL Chromium view object. + * + * @since_tizen 2.3 + * + * @param[in] e canvas object where to create the view object + * @param[in] data a pointer to data to restore session data + * @param[in] length length of session data to restore session data + * + * @return view object on success or @c NULL on failure + */ +EXPORT_API Evas_Object* ewk_view_add_with_session_data(Evas* e, + const char* data, + unsigned length); + +/** + * @brief Gets the reference object for frame that represents the main frame. + * + * @since_tizen 2.3 + * + * @param[in] o view object to get main frame + * + * @return frame reference of frame object on success, or NULL on failure + */ +EXPORT_API Ewk_Frame_Ref ewk_view_main_frame_get(Evas_Object* o); + +/** + * @brief Reply of javascript alert popup + * + * @since_tizen 2.3 + * + * @param[in] o view object + */ +EXPORT_API void ewk_view_javascript_alert_reply(Evas_Object* o); + +/** + * @brief Reply of javascript confirm popup + * + * @since_tizen 2.3 + * + * @param[in] o view object + * @param[in] result result of javascript confirm popup + */ +EXPORT_API void ewk_view_javascript_confirm_reply(Evas_Object* o, + Eina_Bool result); + +/** + * @brief Reply of javascript prompt popup + * + * @since_tizen 2.3 + * + * @param[in] o view object + * @param[in] result entered characters of javascript prompt popup + */ +EXPORT_API void ewk_view_javascript_prompt_reply(Evas_Object* o, + const char* result); + +/** + * @brief Callback for before unload popup + * + * @since_tizen 2.3 + * + * @param[in] o view object + * @param[in] message the contents of before unload popup + * @param[in] user_data user data + */ +typedef Eina_Bool (*Ewk_View_Before_Unload_Confirm_Panel_Callback)( + Evas_Object* o, const char* message, void* user_data); + +/** + * @brief Sets callback of before unload popup + * + * @since_tizen 2.3 + * + * @param[in] o view object to set the callback + * @param[in] callback callback function for before unload popoup + * @param[in] user_data user data + */ +EXPORT_API void ewk_view_before_unload_confirm_panel_callback_set( + Evas_Object* o, Ewk_View_Before_Unload_Confirm_Panel_Callback callback, + void* user_data); + +/** + * @brief Reply of before unload popup + * + * @since_tizen 2.3 + * + * @param[in] o view object + * @param[in] result result of before unload popup + */ +EXPORT_API void ewk_view_before_unload_confirm_panel_reply(Evas_Object* o, + Eina_Bool result); + +/** + * @brief Sets callback of getting application cache permission. + * + * @since_tizen 2.3 + * + * @param[in] o view object to set the callback of application cache permission + * @param[in] callback function to be called when application cache need to + * get permission + * @param[in] user_data user data + */ +EXPORT_API void ewk_view_application_cache_permission_callback_set( + Evas_Object* o, Ewk_View_Applicacion_Cache_Permission_Callback callback, + void* user_data); + +/** + * @brief Application cache permission confirm popup reply + * + * @since_tizen 2.3 + * + * @param[in] o view object to reply permission confirm popup + * @param[in] allow of response + */ +EXPORT_API void ewk_view_application_cache_permission_reply(Evas_Object* o, + Eina_Bool allow); + +/** + * @brief Set to callback to controll unfocus operation from the arrow of + * h/w keyboard. + * + * @since_tizen 2.3 + * + * @param[in] o view object + * @param[in] callback callback to controll unfocus operation from the arrow of + * h/w keyboard + * @param[in] user_data user data + */ +EXPORT_API void ewk_view_unfocus_allow_callback_set( + Evas_Object* o, Ewk_View_Unfocus_Allow_Callback callback, void* user_data); + +/** + * @brief Set to callback to show or hide the notification of bluetooth mic to + * user. + * + * @since_tizen 5.0 + * + * @param[in] o view object + * @param[in] callback to show or hide the notification + * @param[in] user_data user_data will be passed when result_callback is + * called\n -I.e., user data will be kept until callback is called + */ +EXPORT_API void ewk_view_smartrc_show_mic_notification_callback_set( + Evas_Object* o, Ewk_View_SmartRC_Mic_Notification_Callback callback, + void* user_data); + +/** + * @brief Requests loading the given contents. + * + * @since_tizen 2.3 + * + * @param[in] o view object to load document + * @param[in] html what to load + * @param[in] base_uri base uri to use for relative resources, may be @c 0,\n + * if provided @b must be an absolute uri + * + * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors + */ +EXPORT_API Eina_Bool ewk_view_html_contents_set(Evas_Object* o, + const char* html, + const char* base_uri); + +/** + * @brief Callback for ewk_view_cache_image_get + * + * @since_tizen 3.0 + * + * @param[in] o view object + * @param[in] image_url url of the image in the cache + * @param[in] image cache image @b should be freed after use + * @param[in] user_data user data + */ +typedef void (*Ewk_View_Cache_Image_Get_Callback)(Evas_Object* o, + const char* image_url, + Evas_Object* image, + void* user_data); + +/** + * @brief Asynchronous request for get the cache image specified in url. + * + * @since_tizen 3.0 + * + * @param[in] o view object + * @param[in] image_url url of the image in the cache + * @param[in] canvas canvas for creating evas image + * @param[in] callback result callback to get cache image + * @param[in] user_data user_data will be passed when @a callback is called + * + * @return @c EINA_TRUE on successful request, @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_cache_image_get( + const Evas_Object* o, const char* image_url, Evas* canvas, + Ewk_View_Cache_Image_Get_Callback callback, void* user_data); + +/** + * @brief Requests for getting web application capable. + * + * @since_tizen 2.3 + * + * @param[in] o view object + * @param[in] callback result callback to get web database quota + * @param[in] user_data user_data will be passed when result_callback is + * called\n -I.e., user data will be kept until callback is called + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_web_application_capable_get( + Evas_Object* o, Ewk_Web_App_Capable_Get_Callback callback, void* user_data); + +/** + * @brief Requests for getting web application icon string. + * + * @since_tizen 2.3 + * + * @param[in] o view object + * @param[in] callback result callback to get web database quota + * @param[in] user_data user_data will be passed when result_callback is + * called\n -I.e., user data will be kept until callback is called + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_web_application_icon_url_get( + Evas_Object* o, Ewk_Web_App_Icon_URL_Get_Callback callback, + void* user_data); + +/** + * @brief Requests for getting web application icon list of + * Ewk_Web_App_Icon_Data. + * + * @since_tizen 2.3 + * + * @param[in] o view object + * @param[in] callback result callback to get web application icon urls + * @param[in] user_data user_data will be passed when result_callback is + * called\n -I.e., user data will be kept until callback is called + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_web_application_icon_urls_get( + Evas_Object* o, Ewk_Web_App_Icon_URLs_Get_Callback callback, + void* user_data); + +/** + * @brief Get the whole history(whole back & forward list) associated with this + * view. + * + * @since_tizen 2.3 + * + * @param[in] o view object to get the history(whole back & forward list) + * + * @return a newly allocated history of @b newly allocated item\n + * instance. This memory of each item must be released with\n + * ewk_history_free() after use + * + * @see ewk_history_free() + */ +EXPORT_API Ewk_History* ewk_view_history_get(Evas_Object* o); + +/** + * @brief Gets the selection ranges + * + * @since_tizen 2.3 + * + * @param[in] o view object to get theselection ranges + * @param[out] left_rect the start lect(left rect) of the selection ranges + * @param[out] right_rect the end lect(right rect) of the selection ranges + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_text_selection_range_get( + Evas_Object* o, Eina_Rectangle* left_rect, Eina_Rectangle* right_rect); + +/** + * @brief Sets the focused input element value + * + * @since_tizen 2.3 + * + * @param[in] o view object to send the value + * @param[in] value the string value to be set + */ +EXPORT_API void ewk_view_focused_input_element_value_set(Evas_Object* o, + const char* value); + +/** + * @brief Gets the focused input element's value + * + * @since_tizen 2.3 + * + * @param[in] o view object to get the value + * + * @return focused input element's value on success or NULL on failure + */ +EXPORT_API const char* ewk_view_focused_input_element_value_get(Evas_Object* o); + +/** + * @brief Selects index of current popup menu. + * + * @since_tizen 2.3 + * + * @param[in] o view object contains popup menu + * @param[in] index index of item to select + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably\n + * popup menu is not selected or index is out of range) + */ +EXPORT_API Eina_Bool ewk_view_popup_menu_select(Evas_Object* o, + unsigned int index); + +/** + * @brief Selects Multiple indexes of current popup menu. + * + * @since_tizen 2.3 + * + * @param[in] o view object contains popup menu. + * @param[in] changed_list list of item selected and deselected + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably\n + * popup menu is not selected or index is out of range) + */ +EXPORT_API Eina_Bool +ewk_view_popup_menu_multiple_select(Evas_Object* o, Eina_Inarray* changed_list); + +/* + * @brief Sets the user chosen color. To be used when implementing a color + * picker. + * + * @details The function should only be called when a color has been requested + * by the document.\n If called when this is not the case or when the + * input picker has been dismissed, this\n function will fail and + * return EINA_FALSE. + * + * @since_tizen 2.3 + * + * @param[in] o view object contains color picker + * @param[in] r red channel value to be set + * @param[in] g green channel value to be set + * @param[in] b blue channel value to be set + * @param[in] a alpha channel value to be set + * + * @return @c EINA_TRUE on success @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_view_color_picker_color_set(Evas_Object* o, int r, + int g, int b, int a); + +/** + * @brief Feeds the touch event to the view. + * + * @since_tizen 2.3 + * + * @param[in] o view object to feed touch event + * @param[in] type the type of touch event + * @param[in] points a list of points (Ewk_Touch_Point) to process + * @param[in] modifiers an Evas_Modifier handle to the list of modifier keys\n + * registered in the Evas. Users can get the Evas_Modifier from the + * Evas\n using evas_key_modifier_get() and can set each modifier key + * using\n evas_key_modifier_on() and evas_key_modifier_off() + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_feed_touch_event(Evas_Object* o, + Ewk_Touch_Event_Type type, + const Eina_List* points, + const Evas_Modifier* modifiers); + +/** + * Creates a type name for the callback function used to get the background + * color. + * + * @param o view object + * @param r red color component + * @param g green color component + * @param b blue color component + * @param a transparency + * @param user_data user data will be passed when ewk_view_bg_color_get is + * called + */ +typedef void (*Ewk_View_Background_Color_Get_Callback)(Evas_Object* o, int r, + int g, int b, int a, + void* user_data); + +/** + * Gets the background color and transparency of the view. + * + * @param o view object to get the background color from + * @param callback callback function + * @param user_data user data will be passed when the callback is called + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + * + * On success the background color of the view object o is retrieved + * in the callback function + */ +EXPORT_API Eina_Bool ewk_view_bg_color_get( + Evas_Object* o, Ewk_View_Background_Color_Get_Callback callback, + void* user_data); + +/** + * Callback for ewk_view_main_frame_scrollbar_visible_get + * + * @param o view object + * @param visibility visibility of main frame scrollbar + * @param user_data user data passed to + * ewk_view_main_frame_scrollbar_visible_get + */ +typedef void (*Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback)( + Evas_Object* o, Eina_Bool visible, void* user_data); + +/** + * @brief Gets the visibility of main frame scrollbar. + * + * @since_tizen 3.0 + * + * @param[in] o view object + * @param callback callback function + * @param user_data user data will be passed when the callback is caller + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + * + * On success the visibility of the scrollbar of the view object o is retrieved + * in the callback function + */ +EXPORT_API Eina_Bool ewk_view_main_frame_scrollbar_visible_get( + Evas_Object* view, + Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback callback, + void* user_data); + +/** + * @brief Gets the session data to be saved in a persistent store on + * browser exit + * + * @since_tizen 2.3 + * + * @param[in] o view object whose session needs to be stored. + * @param[in] data out parameter session data + * @param[in] length out parameter length of session data + */ +EXPORT_API void ewk_view_session_data_get(Evas_Object* o, const char** data, + unsigned* length); + +/** + * @brief Reloads the current page's document without cache. + * + * @since_tizen 2.3 + * + * @param[in] o view object to reload current document + * + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_view_reload_bypass_cache(Evas_Object* o); + +/** + * @brief Creates a new hit test for the given veiw object and point. + * + * @since_tizen 2.3 + * + * @remarks The returned object should be freed by ewk_hit_test_free(). + * + * @param[in] o view object to do hit test on + * @param[in] x the horizontal position to query + * @param[in] y the vertical position to query + * @param[in] hit_test_mode the #Ewk_Hit_Test_Mode enum value to query + * + * @return a newly allocated hit test on success, @c 0 otherwise + */ +EXPORT_API Ewk_Hit_Test* ewk_view_hit_test_new(Evas_Object* o, int x, int y, + int hit_test_mode); + +/** + * Create PDF file of page contents + * + * @param o view object to get page contents. + * @param width the suface width of PDF file. + * @param height the suface height of PDF file. + * @param fileName the file name for creating PDF file. + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +/* This return value is status of the request not the status of actual + * operation. There should be some callback to get the actual status or reason + * of failure. + */ +EXPORT_API Eina_Bool ewk_view_contents_pdf_get(Evas_Object* o, int width, + int height, + const char* fileName); + +/** + * Requests for setting callback function + * + * @param ewkView view object + * @param user_data user_data will be passed when callback is called + * @param callback callback function + */ +EXPORT_API void ewk_view_run_mixed_content_confirm_callback_set( + Evas_Object* ewkView, Ewk_View_Run_Mixed_Content_Confirm_Callback callback, + void* user_data); + +/** + * Returns the current favicon of view object. + * + * @param item view object to get current icon URL + * + * @return current favicon on success or @c NULL if unavailable or on failure. + * The returned Evas_Object needs to be freed after use. + */ +EXPORT_API Evas_Object* ewk_view_favicon_get(const Evas_Object* ewkView); + +/** + * To resume new url network loading + * + * @param item view object to resume new url loading + * + */ +EXPORT_API void ewk_view_resume_network_loading(Evas_Object* ewkView); + +EXPORT_API void ewk_view_poweroff_suspend(Evas_Object* item); + +/** + * To suspend all url loading + * + * @param item view object to suspend url loading + * + */ +EXPORT_API void ewk_view_suspend_network_loading(Evas_Object* ewkView); + +/** + * This function should be use for browser edge scroll. + * It can also be used when the mouse pointer is out of webview. + * Scrolls webpage of view by dx and dy. + * + * @param item view object to scroll + * @param dx horizontal offset to scroll + * @param dy vertical offset to scroll + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. + */ +EXPORT_API Eina_Bool ewk_view_edge_scroll_by(Evas_Object* item, int dx, int dy); + +/** + * Allow a browser to set its own cursor by setting a flag + * which prevents setting a default web page cursor. + * + * @param ewkView view object + * @param enable EINA_TRUE - prevent update of cursor by engine + * EINA_FALSE - allow for update of cursor by engine + */ +EXPORT_API void ewk_view_set_cursor_by_client(Evas_Object* ewkView, + Eina_Bool enable); + +/** + * Reply of running mixed content or not + * + * @param ewkView view object + * @param result reply + */ +EXPORT_API void ewk_view_run_mixed_content_confirm_reply(Evas_Object* ewkView, + Eina_Bool result); + +/** + * Sets the cover-area (soon rect) multiplier. + * + * @param ewkView view object + * @param cover_area_multiplier the multiplier of cover-area. + */ +EXPORT_API void ewk_view_tile_cover_area_multiplier_set( + Evas_Object* ewkView, float cover_area_multiplier); + +/** + * Set to enabled/disabled clear tiles on hide. + * + * @param ewkView view object + * @param enabled/disabled a state to set + * + */ +EXPORT_API void ewk_view_clear_tiles_on_hide_enabled_set(Evas_Object* ewkView, + Eina_Bool enable); + +/** + * @brief Callback for ewk_view_is_video_playing + * + * @param[in] o the view object + * @param[in] is_playing video is playing or not + * @param[in] user_data user_data will be passsed when ewk_view_is_video_playing + * is called + */ +typedef void (*Ewk_Is_Video_Playing_Callback)(Evas_Object* o, + Eina_Bool is_playing, + void* user_data); + +/** + * @brief Asynchronous request for check if there is a video playing in the + * given view + * + * @param[in] o The view object + * @param[in] callback result callback to get web application capable + * @param[in] user_data user_data will be passed when result_callback is called + * + * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_is_video_playing( + Evas_Object* o, Ewk_Is_Video_Playing_Callback callback, void* user_data); + +/** + * Callback for ewk_view_stop_video + * + * @param o view object + * @param is_stopped video is stopped or not + * @param user_data user_data will be passsed when ewk_view_stop_video is called + */ +typedef void (*Ewk_Stop_Video_Callback)(Evas_Object* o, Eina_Bool is_stopped, + void* user_data); + +/** + * Asynchronous request for stopping any playing video in the given view + * + * @param[in] o The view object + * @param[in] callback result callback to get web application capable + * @param[in] user_data user_data will be passed when result_callback is called + * + * @return @c EINA_TRUE if any video was stopped or @c EINA_FALSE is there was + * no active video + */ +EXPORT_API Eina_Bool ewk_view_stop_video(Evas_Object* o, + Ewk_Stop_Video_Callback callback, + void* user_data); + +/** + * @brief Sets the support of video hole and video window, Use H/W overlay for + * performance of video output + * + * @since_tizen 3.0 + * + * @param[in] o the view object + * @param[in] o the top-level window object + * @param[in] enable EINA_TRUE to set on support the video hole, + * EINA_FALSE otherwise + * @param[in] enable EINA_TRUE to set on the video window of video hole, + * EINA_FALSE to set on the video windowless of video hole + * + * @return return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_set_support_video_hole(Evas_Object* ewkView, + void* window, + Eina_Bool enable, + Eina_Bool isVideoWindow); + +/** + * @brief Sets the support of canvas hole, Use H/W overlay for video quality of + * WebGL 360 degree. Also, The WebBrowser provisionally want to show plane 360 + * video through canvas hole. + * + * @since_tizen 3.0 + * + * @note Should be used after ewk_view_url_set(). + * + * @param[in] o the view object + * @param[in] url string (ex. "youtube.com") + * + * @return return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_set_support_canvas_hole(Evas_Object* ewkView, + const char* url); + +/** + * Callback for the generic sync call. + * It requests for performing operation/call giving its name. Arguments + * and return value is operation/call specific. + * + * @param[in] name requested call name + * @param[in] arguments call argumets, format is defined by opertion itself + * @param[in] user_data user_data will be passed when result_callback is called + * + * @return return value from the call, format is defind by operation itself + */ +typedef Ewk_Value (*Generic_Sync_Call_Callback)(const char* name, + Ewk_Value arguments, + void* user_data); + +/** + * Sets the function pointer for the generic sync call + * + * @param ewk_view view object to set the function pointer in + * @param cb pointer to the function + * @param user_data pointer to user data to be passed to the function when + * it's being called + */ +EXPORT_API void ewk_view_widget_pepper_extension_callback_set( + Evas_Object* ewk_view, Generic_Sync_Call_Callback cb, void* user_data); + +/** + * Sets the pepper widget extension info + * + * @param ewk_view view object to set the info in + * @param widget_pepper_ext_info the Ewk_Value containing the information + */ +EXPORT_API void ewk_view_widget_pepper_extension_info_set( + Evas_Object* ewk_view, Ewk_Value widget_pepper_ext_info); + +/** + * @brief Sets the support of 4K video, Customize the device pixel ratio for + * video plane. + * + * @since_tizen 3.0 + * + * @note Should be used after ewk_view_url_set(). + * + * @param[in] o the view object + * @param[in] o enabled a state to set + * + * @return return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool +ewk_view_set_custom_device_pixel_ratio(Evas_Object* ewkView, Eina_Bool enabled); + +/** + * @brief Gets whether horizontal panning is holding. + * + * @since_tizen 2.3 + * + * @param[in] o view object to get whether horizontal panning is holding + * + * @return @c EINA_TRUE if horizontal panning is holding + * @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool ewk_view_horizontal_panning_hold_get(Evas_Object* o); + +/** + * @brief Sets to hold horizontal panning. + * + * @since_tizen 2.3 + * + * @param[in] o view object to set to hold horizontal panning + * @param[in] hold @c EINA_TRUE to hold horizontal panning + * @c EINA_FALSE not to hold + */ +EXPORT_API void ewk_view_horizontal_panning_hold_set(Evas_Object* o, + Eina_Bool hold); + +/** + * @brief Gets whether vertical panning is holding. + * + * @since_tizen 2.3 + * + * @param[in] o view object to get whether vertical panning is holding + * + * @return @c EINA_TRUE if vertical panning is holding + * @c EINA_FALSE if not or on failure + */ +EXPORT_API Eina_Bool ewk_view_vertical_panning_hold_get(Evas_Object* o); + +/** + * Block/Release the vertical pan + * + * @param o view object on which pan is to be blocked/release + * @param hold status of pan + */ +EXPORT_API void ewk_view_vertical_panning_hold_set(Evas_Object* o, + Eina_Bool hold); + +/** + * Set the translated url to media player. + * + * @param ewkView view object + * @param url string + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_media_translated_url_set(Evas_Object* ewkView, + const char* url); + +/** + * Set app is preload type or not. + * + * @param ewkView view object + * @param is_preload if app is preload type + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_app_preload_set(Evas_Object* ewkView, + Eina_Bool is_preload); + +/** + * Set app enable marlin or not. + * + * @param ewkView view object + * @param is_enable if app enable marlin drm + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_marlin_enable_set(Evas_Object* ewkView, + Eina_Bool is_enable); + +/** + * Sets whitelisted DRM key systems. Passed key systems will be available + * through EME. Other systems even if available in the platform will be + * unavailable through EME + * + * @param ewkView View object + * @param list Key system names + * @param list_size Key system count + */ +EXPORT_API Eina_Bool ewk_view_key_system_whitelist_set(Evas_Object* ewkView, + const char** list, + unsigned list_size); + +/** + * Sets the active DRM system identifier as provided by the HbbTV application. + * + * @param ewkView View object + * @param drm_system_id Identifier of requested DRM system + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_active_drm_set(Evas_Object* view, + const char* drm_system_id); + +/** + * Inform webengine about decoder used by broadcast for dual decoding. + * + * @param view View object + * @param decoder Identifier of used decoder + */ +EXPORT_API void ewk_view_broadcast_decoder_set(Evas_Object* view, + Ewk_Hardware_Decoders decoder); + +/** + * Set the selected text track language to media player. + * + * @param ewkView view object + * @param lang_list comma separated three_digit_language code. (For example + * "eng,deu") + * + */ +EXPORT_API void ewk_media_set_subtitle_lang(Evas_Object* ewkView, + const char* lang_list); + +/** + * Set parental rating result to media player. + * + * @param ewkView view object + * @param url media url + * @param is_pass authentication result true/false + * + */ +EXPORT_API void ewk_media_set_parental_rating_result(Evas_Object* ewkView, + const char* url, + Eina_Bool is_pass); + +/** + * Set the if use high bit rate to media player. + * + * @param ewkView view object + * @param is_high if app use high bit rate + * + */ +EXPORT_API void ewk_media_start_with_high_bit_rate(Evas_Object* ewkView, + Eina_Bool is_high_bitrate); + +/** + * @brief Sends key event. + * + * @since_tizen 2.4 + * + * @param[in] o The view object + * @param[in] key_event Evas_Event_Key_Down struct or Evas_Event_Key_Up struct + * @param[in] isPress EINA_TRUE: keydown, EINA_FALSE: keyup + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_send_key_event(Evas_Object* o, void* key_event, + Eina_Bool is_press); + +/** + * @brief Sets whether the ewk_view supports the key events or not. + * + * @since_tizen 2.4 + * + * @note Should be used after ewk_view_url_set(). + * + * @remarks The ewk_view will support the key events if EINA_TRUE or not support + * the key events otherwise. The default value is EINA_TRUE. + * + * @param[in] o The view object + * @param[in] enabled a state to set + * + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_key_events_enabled_set(Evas_Object* o, + Eina_Bool enabled); + +enum Ewk_Scrollbar_Orientation { + EWK_HORIZONTAL_SCROLLBAR = 0, + EWK_VERTICAL_SCROLLBAR +}; + +typedef enum Ewk_Scrollbar_Orientation Ewk_Scrollbar_Orientation; + +struct Ewk_Scrollbar_Data { + Ewk_Scrollbar_Orientation orientation; /**< scrollbar orientation */ + Eina_Bool focused; /**< isFocused */ +}; + +typedef struct Ewk_Scrollbar_Data Ewk_Scrollbar_Data; + +/** + * @brief Adds an item to back forward list + * + * @since_tizen 2.4 + * + * @param[in] o The view object + * @param[in] item The back-forward list item instance + * @return @c EINA_TRUE on success,\n + * otherwise @c EINA_FALSE + */ +EXPORT_API Eina_Bool ewk_view_add_item_to_back_forward_list( + Evas_Object* o, const Ewk_Back_Forward_List_Item* item); + +/** + * @brief Load the specified @a html string as the content of the view + * overriding current history entry. Can be used to ignore the malicious page + * while navigation backward/forward. + * + * @since_tizen 3.0 + * + * @param[in] view object to load the HTML into + * @param[in] html HTML data to load + * @param[in] base_url Base URL used for relative paths to external objects + * (optional) + * @param[in] unreachable_url URL that could not be reached (optional) + * + * @return @c EINA_TRUE if it the HTML was successfully loaded, + * @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_view_html_string_override_current_entry_load( + Evas_Object* view, const char* html, const char* base_uri, + const char* unreachable_url); + +/** + * Sets whether to draw transparent background or not. + * + * @param o view object to enable/disable transparent background + * @param enabled a state to set + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool +ewk_view_draws_transparent_background_set(Evas_Object* o, Eina_Bool enabled); + +/** + * Creates a type name for the callback function used to get the page contents. + * + * @param o view object + * @param data mhtml data of the page contents + * @param user_data user data will be passed when ewk_view_mhtml_data_get is + * called + */ +typedef void (*Ewk_View_MHTML_Data_Get_Callback)(Evas_Object* o, + const char* data, + void* user_data); + +/** + * Get page contents as MHTML data + * + * @param o view object to get the page contents + * @param callback callback function to be called when the operation is finished + * @param user_data user data to be passed to the callback function + * + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_view_mhtml_data_get( + Evas_Object* o, Ewk_View_MHTML_Data_Get_Callback callback, void* user_data); + +/** + * Gets the minimum and maximum value of the scale range or -1 on failure + * + * @param o view object to get the minimum and maximum value of the scale range + * @param min_scale Pointer to an double in which to store the minimum scale + * factor of the object. + * @param max_scale Pointer to an double in which to store the maximum scale + * factor of the object. + * + * @note Use @c NULL pointers on the scale components you're not + * interested in: they'll be ignored by the function. + */ +EXPORT_API void ewk_view_scale_range_get(Evas_Object* o, double* min_scale, + double* max_scale); + +/** + * Returns the evas image object of the specified viewArea of page + * + * The returned evas image object @b should be freed after use. + * + * @param o view object to get specified rectangle of cairo surface. + * @param viewArea rectangle of cairo surface. + * @param scaleFactor scale factor of cairo surface. + * @param canvas canvas for creating evas image. + * + * @return newly allocated evas image object on sucess or @c 0 on failure. + */ +EXPORT_API Evas_Object* ewk_view_screenshot_contents_get( + const Evas_Object* o, Eina_Rectangle viewArea, float scaleFactor, + Evas* canvas); + +/** + * Gets the possible scroll size of the given view. + * + * Possible scroll size is contents size minus the viewport size. + * + * @param o view object to get scroll size + * @param w the pointer to store the horizontal size that is possible to scroll, + * may be @c 0 + * @param h the pointer to store the vertical size that is possible to scroll, + * may be @c 0 + * + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise and + * values are zeroed + */ +EXPORT_API Eina_Bool ewk_view_scroll_size_get(const Evas_Object* o, int* w, + int* h); + +/** + * Clears the highlight of searched text. + * + * @param o view object to find text + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on errors + */ +EXPORT_API Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object* o); + +/** + * Counts the given string in the document. + * + * This does not highlight the matched string and just count the matched + * string.\n + * + * As the search is carried out through the whole document,\n + * only the following #Ewk_Find_Options are valid.\n + * - EWK_FIND_OPTIONS_NONE\n + * - EWK_FIND_OPTIONS_CASE_INSENSITIVE\n + * - EWK_FIND_OPTIONS_AT_WORD_START\n + * - EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START\n + * + * The "text,found" callback will be called with the number of matched string. + * + * @since_tizen 2.3 + * + * @param o view object to find text + * @param text text to find + * @param options options to find + * @param max_match_count maximum match count to find, unlimited if 0 + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on errors + */ +EXPORT_API Eina_Bool ewk_view_text_matches_count(Evas_Object* o, + const char* text, + Ewk_Find_Options options, + unsigned max_match_count); + +/** + * Gets the current text zoom level. + * + * @param o view object to get the zoom level + * + * @return current zoom level in use on success or @c -1.0 on failure + */ +EXPORT_API double ewk_view_text_zoom_get(const Evas_Object* o); + +/** + * Sets the current text zoom level. + * + * @param o view object to set the zoom level + * @param textZoomFactor a new level to set + * + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_view_text_zoom_set(Evas_Object* o, + double text_zoom_factor); + +/** + * @brief Draw the evas image object for the VoiceManager + * + * @since_tizen 3.0 + * + * @param[in] view the view object + * @param[in] image evas image obejct for drawing + * @param[in] rect rectangle of image object for drawing + */ +EXPORT_API void ewk_view_voicemanager_label_draw(Evas_Object* view, + Evas_Object* image, + Eina_Rectangle rect); + +/** + * @brief Hide and remove all labels for the VoiceManager + * + * @details All labels are cleared on mouse down. + * + * @since_tizen 3.0 + * + * @param[in] view the view object + */ +EXPORT_API void ewk_view_voicemanager_labels_clear(Evas_Object* view); + +/** + * This api is used for Canal+ App and HBB TV Application. + * They need to access various url required a client authentication while the + * apps is running. So when XWalk call this API with host and related cert path, + * We store these information to map. After that, When we get the "Certificate + * Request" packet from server, We find matched cert path to host in the map. + * + * @param ewkView view object to add host and cert path to the map + * @param host host that required client authentication + * @param cert_path the file path stored certificate + * + */ +EXPORT_API void ewk_view_add_dynamic_certificate_path( + const Evas_Object* ewkView, const char* host, const char* cert_path); + +/** + * @brief Request to set the atk usage set by web app(config.xml). + * + * Some TV apps use WebSpeech instead of use ATK for regulation U.S.FCC + * + * @since_tizen 3.0 @if TV @endif + * + * @param[in] o View object to set the atk use. + * @param[in] enable EINA_TRUE to set on the atk use. + * EINA_FALSE makes atk not to use, but app use WebSpeech instead of + * ATK. + */ +EXPORT_API void ewk_view_atk_deactivation_by_app(Evas_Object* view, + Eina_Bool enable); + +typedef enum { + EWK_TTS_MODE_DEFAULT = 0, /**< Default mode for normal application */ + EWK_TTS_MODE_NOTIFICATION = + 1, /**< Notification mode(it has same behavior with EWK_TTS_MODE_DEFAULT. + not supported in vd) */ + EWK_TTS_MODE_SCREEN_READER = + 2 /**< Accessibiliity mode(TTS works only for accessibility mode) */ +} ewk_tts_mode; + +/** + * @brief Sets tts mode + * up to tizen 4.0(in VD), default tts mode is EWK_TTS_MODE_SCREEN_READER. + * so TTS api disabled when accessibility mode turn off. + * this api provided to use tts api in none accessibility mode + * (tts mode decided in chromium's init time. so it should be called in init + * time) tts mode affect to below web apis speech_syntesis + * + * @since_tizen 4.0 @if TV @endif + * + * @param[in] o View object to set. + * @param[in] ewk_tts_mode. + * + */ +EXPORT_API Eina_Bool ewk_view_tts_mode_set(Evas_Object* view, + ewk_tts_mode tts_mode); + +/** + * remove custom header + * + * @param o view object to remove custom header + * + * @param name custom header name to remove the custom header + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_custom_header_remove(const Evas_Object* o, + const char* name); + +/** + * Returns application name string. + * + * @param o view object to get the application name + * + * @return @c application name. The returned string @b should be freed by + * eina_stringshare_del() after use. + */ +EXPORT_API const char* ewk_view_application_name_for_user_agent_get( + const Evas_Object* o); + +/* + * Get cookies associated with an URL. + * + * @param o view object in which URL is opened. + * @param url the url for which cookies needs to be obtained. + * + * @return @c character array containing cookies, @c NULL if no cookies are + * found. + * + * The return character array has to be owned by the application and freed when + * not required. + */ +EXPORT_API char* ewk_view_cookies_get(Evas_Object* o, const char* url); + +/** + * @internal + * @brief Callback for ewk_view_notification_show_callback_set + * + * @since_tizen 2.3 + * + * @param[in] o view object to request the notification show + * @param[in] notification Ewk_Notification object to get the information about + * notification show request + * @param[in] user_data user data + */ +typedef Eina_Bool (*Ewk_View_Notification_Show_Callback)( + Evas_Object* o, Ewk_Notification* notification, void* user_data); + +/** + * @internal + * @brief Sets the notification show callback. + * + * @since_tizen 2.3 + * + * @param[in] o view object to request the notification show + * @param[in] show_callback Ewk_View_Notification_Show_Callback function to + * notification show + * @param[in] user_data user data + */ +EXPORT_API void ewk_view_notification_show_callback_set( + Evas_Object* o, Ewk_View_Notification_Show_Callback show_callback, + void* user_data); + +/** + * @internal + * @brief Callback for ewk_view_notification_cancel_callback_set + * + * @since_tizen 2.3 + * + * @param[in] o view object to request the notification cancel + * @param[in] notification_id Ewk_Notification object to get the information + * about notification cancel request + * @param[in] user_data user data + */ +typedef Eina_Bool (*Ewk_View_Notification_Cancel_Callback)( + Evas_Object* o, uint64_t notification_id, void* user_data); + +/** + * @internal + * @brief Sets the notification cancel callback. + * + * @since_tizen 2.3 + * + * @param[in] o view object to request the notification show + * @param[in] cancel_callback Ewk_View_Notification_Cancel_Callback function to + * notification cancel + * @param[in] user_data user data + */ +EXPORT_API void ewk_view_notification_cancel_callback_set( + Evas_Object* o, Ewk_View_Notification_Cancel_Callback cancel_callback, + void* user_data); + +/** + * @brief Gets the current custom character encoding name. + * + * @since_tizen 2.3 + * + * @param[in] o view object to get the current encoding + * + * @return @c eina_strinshare containing the current encoding, or\n + * @c NULL if it's not set + */ +EXPORT_API const char* ewk_view_custom_encoding_get(const Evas_Object* o); + +/** + * @brief Sets the custom character encoding and reloads the page. + * + * @since_tizen 2.3 + * + * @param[in] o view to set the encoding + * @param[in] encoding the new encoding to set or @c NULL to restore the default + * one + * + * @return @c EINA_TRUE on success @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_view_custom_encoding_set(Evas_Object* o, + const char* encoding); + +/** + * @brief Forces web page to relayout + * + * @since_tizen 2.3 + * + * @param [in] o view + */ +EXPORT_API void ewk_view_force_layout(const Evas_Object* o); + +/** + * Gets the video's timestamp. + * + * @param o view object to get the video's timestamp + * + * @return timestamp value + */ +EXPORT_API double ewk_view_media_current_time_get(const Evas_Object* o); + +/** + * @brief Enforces web page to close + * + * @since_tizen 3.0 + * + * @param[in] o view + * + * @return @c EINA_TRUE on success @c EINA_FALSE otherwise + */ +EXPORT_API Eina_Bool ewk_view_page_close(Evas_Object* o); + +/** + * Clear all tile resources. + * + * @param ewkView view object + */ +EXPORT_API void ewk_view_clear_all_tiles_resources(Evas_Object* ewkView); + +/** + * Request canvas to be shown in full-screen. + * + * @param ewkView view object + */ +EXPORT_API void ewk_view_request_canvas_fullscreen(Evas_Object* ewkView); + +/** + * play 360 video in the view + * + * @param ewkView view object + */ +EXPORT_API void ewk_view_360video_play(Evas_Object* ewkView); + +/** + * pause 360 video in the view + * + * @param ewkView view object + */ +EXPORT_API void ewk_view_360video_pause(Evas_Object* ewkView); + +/** + * Callback for ewk_view_360video_duration + * + * @param o view object + * @param duration 360 video's duration + * @param user_data user_data will be passsed when ewk_view_360video_duration is + * called + */ +typedef void (*Ewk_360_Video_Duration_Callback)(Evas_Object* o, double duration, + void* user_data); + +/** + * get duration of the 360 video in the view + * + * @param ewkView view object + * + * @return duration of the video + */ +EXPORT_API void ewk_view_360video_duration( + Evas_Object* ewkView, Ewk_360_Video_Duration_Callback callback, + void* user_data); + +/** + * Callback for ewk_view_360video_current_time + * + * @param o view object + * @param current_time 360 video's current time + * @param user_data user_data will be passsed when + * ewk_view_360video_current_time is called + */ +typedef void (*Ewk_360_Video_CurrentTime_Callback)(Evas_Object* o, + double current_time, + void* user_data); + +/** + * get current time of the 360 video in the view + * + * @param ewkView view object + * + * @return current time of the video + */ +EXPORT_API void ewk_view_360video_current_time( + Evas_Object* ewkView, Ewk_360_Video_CurrentTime_Callback callback, + void* user_data); + +/** + * set current time of the 360 video in the view + * + * @param ewkView view object + * + * @param current_time set current time + */ +EXPORT_API void ewk_view_360video_set_current_time(Evas_Object* ewkView, + double current_time); + +/** + * @brief Request to set the atk usage set by web app(config.xml). + * + * Some TV apps use WebSpeech instead of use ATK for regulation U.S.FCC + * + * @since_tizen 3.0 @if TV @endif + * + * @param[in] o View object to set the atk use. + * @param[in] enable EINA_TRUE to set on the atk use. + * EINA_FALSE makes atk not to use, but app use WebSpeech instead of + * ATK. + */ +EXPORT_API void ewk_view_atk_deactivation_by_app(Evas_Object* view, + Eina_Bool enable); + +/** + * Requests execution of the given script in the main frame and subframes of the + * page. + * + * The result value for the execution can be retrieved from the asynchronous + * callback. + * + * @param o The view to execute script + * @param script JavaScript to execute + * @param callback The function to call when the execution is completed, may be + * @c NULL + * @param user_data User data, may be @c NULL + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_script_execute_all_frames( + Evas_Object* o, const char* script, Ewk_View_Script_Execute_Cb callback, + void* user_data); + +/** + * Floating video's window ON/OFF + * + * @param o view object + * @param bool status (true/false) + * + */ +EXPORT_API void ewk_view_floating_window_state_changed(const Evas_Object* o, + Eina_Bool status); + +/** + * Auto login by samsung pass + * + * @param view view object + * @param user_name user name to login + * @param password user password to login + * + */ +EXPORT_API void ewk_view_auto_login(Evas_Object* view, const char* user_name, + const char* password); + +/** + * Requests execution of the given script in the main frame and subframes of the + * page. + * + * The result value for the execution can be retrieved from the asynchronous + * callback. + * + * @param o The view to execute script + * @param script JavaScript to execute + * @param callback The function to call when the execution is completed, may be + * @c NULL + * @param user_data User data, may be @c NULL + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_script_execute_all_frames( + Evas_Object* o, const char* script, Ewk_View_Script_Execute_Cb callback, + void* user_data); + +/** + * @brief Selects index of select popup menu. + * + * @since_tizen 6.0 + * + * @param[in] view view object contains popup menu + * @param[in] index index of item to select + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably\n + * popup menu is not selected or index is out of range) + */ +EXPORT_API Eina_Bool ewk_view_select_menu_select(Evas_Object* view, int index); + +/** + * @brief Selects Multiple indexes of select popup menu. + * + * @since_tizen 6.0 + * + * @param[in] view view object contains popup menu. + * @param[in] changed_list list of item selected and deselected + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably\n + * popup menu is not selected or index is out of range) + */ +EXPORT_API Eina_Bool +ewk_view_select_menu_multiple_select(Evas_Object* view, Eina_List* select_list); + +/** + * @brief Hides the select menu. + * + * @since_tizen 6.0 + * + * @param[in] view the view object + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure + */ +EXPORT_API Eina_Bool ewk_view_select_menu_hide(Evas_Object* view); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif // ewk_view_product_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_web_application_icon_data_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_web_application_icon_data_internal.h new file mode 100644 index 000000000..0fde335af --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_web_application_icon_data_internal.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_web_application_icon_data_internal_h +#define ewk_web_application_icon_data_internal_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/// Creates a type name for _Ewk_Web_App_Icon_Data. +typedef struct _Ewk_Web_App_Icon_Data Ewk_Web_App_Icon_Data; + +/** + * Requests for getting icon size string of Ewk_Web_App_Icon_Data. + * + * @param icon_data Ewk_Web_App_Icon_Data object to get icon size + * + * @return icon size string of requested icon data + */ +EXPORT_API const char *ewk_web_application_icon_data_size_get( + Ewk_Web_App_Icon_Data *data); + +/** + * Requests for getting icon url string of Ewk_Web_App_Icon_Data. + * + * @param icon_data Ewk_Web_App_Icon_Data object to get icon url + * + * @return icon url string of requested icon data + */ +EXPORT_API const char *ewk_web_application_icon_data_url_get( + Ewk_Web_App_Icon_Data *data); + +#ifdef __cplusplus +} +#endif +#endif // ewk_web_application_icon_data_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_window_features_internal.h b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_window_features_internal.h new file mode 100644 index 000000000..3dd295265 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/ewk/ewk_window_features_internal.h @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2014-2016 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_window_features_internal.h + * @brief Access to the features of window. + */ + +#ifndef ewk_window_features_internal_h +#define ewk_window_features_internal_h + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Declare Ewk_Window_Features as Ewk_Object. + * + * @see Ewk_Object + */ +// EwkObject is removed or deprecated +// typedef struct EwkObject Ewk_Window_Features; + +typedef struct _Ewk_Window_Features Ewk_Window_Features; + +/** + * Queries the toolbar visibility of the window feature. + * + * @param window_features the object to get properties + * + * @return @c EINA_TRUE is the toolbar should be visible, @c EINA_FALSE + * otherwise + */ +EXPORT_API Eina_Bool ewk_window_features_toolbar_visible_get( + const Ewk_Window_Features *window_features); + +/** + * Queries the statusbar visibility of the window feature. + * + * @param window_features the object to get properties + * + * @return @c EINA_TRUE is the statusbar should be visible, @c EINA_FALSE + * otherwise + */ +EXPORT_API Eina_Bool ewk_window_features_statusbar_visible_get( + const Ewk_Window_Features *window_features); + +/** + * Queries the scrollbar visibility of the window feature. + * + * @param window_features the object to get properties + * + * @return @c EINA_TRUE is the scrollbars should be visible, @c EINA_FALSE + * otherwise + */ +EXPORT_API Eina_Bool ewk_window_features_scrollbars_visible_get( + const Ewk_Window_Features *window_features); + +/** + * Queries the menubar visibility of the window feature. + * + * @param window_features the object to get properties + * + * @return @c EINA_TRUE is the menubar should be visible, @c EINA_FALSE + * otherwise + */ +EXPORT_API Eina_Bool ewk_window_features_menubar_visible_get( + const Ewk_Window_Features *window_features); + +/** + * Queries the locationbar visibility of the window feature. + * + * @param window_features the object to get properties + * + * @return @c EINA_TRUE is the locationbar should be visible, @c EINA_FALSE + * otherwise + */ +EXPORT_API Eina_Bool ewk_window_features_locationbar_visible_get( + const Ewk_Window_Features *window_features); + +/** + * Queries if the window is resizable. + * + * @param window_features the object to get properties + * + * @return @c EINA_TRUE is the window should be resizable, @c EINA_FALSE + * otherwise + */ +EXPORT_API Eina_Bool +ewk_window_features_resizable_get(const Ewk_Window_Features *window_features); + +/** + * Queries the the window is fullscreen + * + * @param window_features the object to get properties + * + * @return @c EINA_TRUE is the window should be fullscreen, @c EINA_FALSE + * otherwise + */ +EXPORT_API Eina_Bool +ewk_window_features_fullscreen_get(const Ewk_Window_Features *window_features); + +/** + * Gets geometry properties of an Ewk_Window_Features. + * + * Properties are returned in the respective pointers. Passing @c NULL to any of + * these pointers will cause that property to not be returned. + * + * @param window_features the window's features + * @param x the pointer to store x position + * @param y the pointer to store y position + * @param w the pointer to store width + * @param h the pointer to store height + */ +EXPORT_API void ewk_window_features_geometry_get( + const Ewk_Window_Features *window_features, float *x, float *y, float *w, + float *h); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_window_features_internal_h diff --git a/packages/webview_flutter_ewk/tizen/inc/webview_flutter_tizen_ewk_plugin.h b/packages/webview_flutter_ewk/tizen/inc/webview_flutter_tizen_ewk_plugin.h new file mode 100644 index 000000000..52951cf19 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/inc/webview_flutter_tizen_ewk_plugin.h @@ -0,0 +1,23 @@ +#ifndef FLUTTER_PLUGIN_WEBVIEW_FLUTTER_TIZEN_EWK_PLUGIN_H_ +#define FLUTTER_PLUGIN_WEBVIEW_FLUTTER_TIZEN_EWK_PLUGIN_H_ + +#include + +#ifdef FLUTTER_PLUGIN_IMPL +#define FLUTTER_PLUGIN_EXPORT __attribute__((visibility("default"))) +#else +#define FLUTTER_PLUGIN_EXPORT +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +FLUTTER_PLUGIN_EXPORT void WebviewFlutterTizenEwkPluginRegisterWithRegistrar( + FlutterDesktopPluginRegistrarRef registrar); + +#if defined(__cplusplus) +} // extern "C" +#endif + +#endif // FLUTTER_PLUGIN_WEBVIEW_FLUTTER_TIZEN_EWK_PLUGIN_H_ diff --git a/packages/webview_flutter_ewk/tizen/lib/armel/libchromium-ewk.so b/packages/webview_flutter_ewk/tizen/lib/armel/libchromium-ewk.so new file mode 100755 index 000000000..fdd1fe559 Binary files /dev/null and b/packages/webview_flutter_ewk/tizen/lib/armel/libchromium-ewk.so differ diff --git a/packages/webview_flutter_ewk/tizen/project_def.prop b/packages/webview_flutter_ewk/tizen/project_def.prop new file mode 100644 index 000000000..87900830f --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/project_def.prop @@ -0,0 +1,31 @@ +# See https://docs.tizen.org/application/tizen-studio/native-tools/project-conversion +# for details. + +APPNAME = webview_flutter_tizen_ewk_plugin +type = sharedLib +profile = common-5.5 + +# Source files +USER_SRCS += src/*.cc + +# User defines +USER_DEFS = +USER_UNDEFS = +USER_CPP_DEFS = TIZEN_DEPRECATION DEPRECATION_WARNING FLUTTER_PLUGIN_IMPL +USER_CPP_UNDEFS = + +# Compiler/linker flags +USER_CFLAGS_MISC = +USER_CPPFLAGS_MISC = -c -fmessage-length=0 +USER_LFLAGS = -lchromium-ewk -Wl,-rpath='$$ORIGIN' -Llib/${BUILD_ARCH} + +# Libraries and objects +USER_LIB_DIRS = lib/${BUILD_ARCH} +USER_LIBS = lightweight-web-engine.flutter +#USER_LIBS = chromium-ewk +USER_OBJS = + +# User includes +USER_INC_DIRS = inc src inc/ewk +USER_INC_FILES = +USER_CPP_INC_FILES = diff --git a/packages/webview_flutter_ewk/tizen/src/log.h b/packages/webview_flutter_ewk/tizen/src/log.h new file mode 100644 index 000000000..b7cc625e3 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/src/log.h @@ -0,0 +1,24 @@ +#ifndef __LOG_H__ +#define __LOG_H__ + +#include + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "WebviewFlutterTizenEwkPlugin" + +#ifndef __MODULE__ +#define __MODULE__ strrchr("/" __FILE__, '/') + 1 +#endif + +#define LOG(prio, fmt, arg...) \ + dlog_print(prio, LOG_TAG, "%s: %s(%d) > " fmt, __MODULE__, __func__, \ + __LINE__, ##arg) + +#define LOG_DEBUG(fmt, args...) LOG(DLOG_DEBUG, fmt, ##args) +#define LOG_INFO(fmt, args...) LOG(DLOG_INFO, fmt, ##args) +#define LOG_WARN(fmt, args...) LOG(DLOG_WARN, fmt, ##args) +#define LOG_ERROR(fmt, args...) LOG(DLOG_ERROR, fmt, ##args) + +#endif // __LOG_H__ diff --git a/packages/webview_flutter_ewk/tizen/src/webview.cc b/packages/webview_flutter_ewk/tizen/src/webview.cc new file mode 100644 index 000000000..74f6187d6 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/src/webview.cc @@ -0,0 +1,532 @@ +// Copyright 2021 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "webview.h" + +#include +#include +#include + +#include "log.h" +#include "webview_factory.h" + +template +class NavigationRequestResult : public flutter::MethodResult { + public: + NavigationRequestResult(std::string url, WebView* webview) + : url_(url), webview_(webview) {} + + void SuccessInternal(const T* should_load) override { + if (std::holds_alternative(*should_load)) { + if (std::get(*should_load)) { + LoadUrl(); + } + } + } + + void ErrorInternal(const std::string& error_code, + const std::string& error_message, + const T* error_details) override { + throw std::invalid_argument("navigationRequest calls must succeed [code:" + + error_code + "][msg:" + error_message + "]"); + } + + void NotImplementedInternal() override { + throw std::invalid_argument( + "navigationRequest must be implemented by the webview method channel"); + } + + private: + void LoadUrl() { + if (webview_ && webview_->GetWebViewInstance()) { + ewk_view_url_set(webview_->GetWebViewInstance(), url_.c_str()); + } + } + + std::string url_; + WebView* webview_; +}; + +static std::string ErrorCodeToString(int error_code) { + switch (error_code) { + case EWK_ERROR_CODE_AUTHENTICATION: + return "authentication"; + case EWK_ERROR_CODE_BAD_URL: + return "badUrl"; + case EWK_ERROR_CODE_FAILED_TLS_HANDSHAKE: + return "failedSslHandshake"; + case EWK_ERROR_CODE_FAILED_FILE_IO: + return "file"; + case EWK_ERROR_CODE_CANT_LOOKUP_HOST: + return "hostLookup"; + case EWK_ERROR_CODE_REQUEST_TIMEOUT: + return "timeout"; + case EWK_ERROR_CODE_TOO_MANY_REQUESTS: + return "tooManyRequests"; + case EWK_ERROR_CODE_UNKNOWN: + return "unknown"; + case EWK_ERROR_CODE_UNSUPPORTED_SCHEME: + return "unsupportedScheme"; + } + + std::string message = + "Could not find a string for errorCode: " + std::to_string(error_code); + throw std::invalid_argument(message); +} + +std::string ExtractStringFromMap(const flutter::EncodableValue& arguments, + const char* key) { + if (std::holds_alternative(arguments)) { + flutter::EncodableMap values = std::get(arguments); + flutter::EncodableValue value = values[flutter::EncodableValue(key)]; + if (std::holds_alternative(value)) + return std::get(value); + } + return std::string(); +} +int ExtractIntFromMap(const flutter::EncodableValue& arguments, + const char* key) { + if (std::holds_alternative(arguments)) { + flutter::EncodableMap values = std::get(arguments); + flutter::EncodableValue value = values[flutter::EncodableValue(key)]; + if (std::holds_alternative(value)) return std::get(value); + } + return -1; +} +double ExtractDoubleFromMap(const flutter::EncodableValue& arguments, + const char* key) { + if (std::holds_alternative(arguments)) { + flutter::EncodableMap values = std::get(arguments); + flutter::EncodableValue value = values[flutter::EncodableValue(key)]; + if (std::holds_alternative(value)) return std::get(value); + } + return -1; +} + +WebView::WebView(flutter::PluginRegistrar* registrar, int viewId, + flutter::TextureRegistrar* texture_registrar, double width, + double height, flutter::EncodableMap& params, void* winHandle) + : PlatformView(registrar, viewId, winHandle), + texture_registrar_(texture_registrar), + webview_instance_(nullptr), + width_(width), + height_(height), + candidate_surface_(nullptr), + rendered_surface_(nullptr), + has_navigation_delegate_(false), + has_progress_tracking_(false), + texture_variant_(nullptr), + gpu_buffer_(nullptr) + +{ + texture_variant_ = new flutter::TextureVariant(flutter::GpuBufferTexture( + [this](size_t width, size_t height) -> const FlutterDesktopGpuBuffer* { + return this->ObtainGpuBuffer(width, height); + }, + [this](void* buffer) -> void { this->DestructBuffer(buffer); })); + SetTextureId(texture_registrar_->RegisterTexture(texture_variant_)); + InitWebView(); + + channel_ = std::make_unique>( + GetPluginRegistrar()->messenger(), GetChannelName(), + &flutter::StandardMethodCodec::GetInstance()); + channel_->SetMethodCallHandler( + [webview = this](const auto& call, auto result) { + webview->HandleMethodCall(call, std::move(result)); + }); + + auto cookie_channel = + std::make_unique>( + GetPluginRegistrar()->messenger(), + "plugins.flutter.io/cookie_manager", + &flutter::StandardMethodCodec::GetInstance()); + cookie_channel->SetMethodCallHandler( + [webview = this](const auto& call, auto result) { + webview->HandleCookieMethodCall(call, std::move(result)); + }); + + std::string url; + auto initial_url = params[flutter::EncodableValue("initialUrl")]; + if (std::holds_alternative(initial_url)) { + url = std::get(initial_url); + } else { + url = "about:blank"; + } + + auto settings = params[flutter::EncodableValue("settings")]; + if (std::holds_alternative(settings)) { + auto settingList = std::get(settings); + if (settingList.size() > 0) { + ApplySettings(settingList); + } + } + + auto names = params[flutter::EncodableValue("javascriptChannelNames")]; + if (std::holds_alternative(names)) { + auto name_list = std::get(names); + for (size_t i = 0; i < name_list.size(); i++) { + if (std::holds_alternative(name_list[i])) { + RegisterJavaScriptChannelName(std::get(name_list[i])); + } + } + } + + if (!webview_instance_) return; + + auto user_agent = params[flutter::EncodableValue("userAgent")]; + if (std::holds_alternative(user_agent)) { + ewk_view_user_agent_set(webview_instance_, + std::get(user_agent).c_str()); + } + ewk_view_url_set(webview_instance_, url.c_str()); +} + +void WebView::ApplySettings(flutter::EncodableMap settings) { + for (auto const& [key, val] : settings) { + if (std::holds_alternative(key)) { + std::string k = std::get(key); + if ("jsMode" == k) { + } else if ("hasNavigationDelegate" == k) { + if (std::holds_alternative(val)) { + has_navigation_delegate_ = std::get(val); + } + } else if ("debuggingEnabled" == k) { + } else if ("gestureNavigationEnabled" == k) { + } else if ("userAgent" == k) { + if (std::holds_alternative(val)) { + ewk_view_user_agent_set(webview_instance_, + std::get(val).c_str()); + } + } + } + } +} + +void WebView::RegisterJavaScriptChannelName(const std::string& name) { + LOG_DEBUG("RegisterJavaScriptChannelName(channelName: %s)\n", name.c_str()); +} + +WebView::~WebView() { Dispose(); } + +std::string WebView::GetChannelName() { + return "plugins.flutter.io/webview_" + std::to_string(GetViewId()); +} + +void WebView::Dispose() { + texture_registrar_->UnregisterTexture(GetTextureId()); + + if (texture_variant_) { + delete texture_variant_; + texture_variant_ = nullptr; + } + + if (gpu_buffer_) { + delete gpu_buffer_; + gpu_buffer_ = nullptr; + } + + if (webview_instance_) { + evas_object_del(webview_instance_); + webview_instance_ = nullptr; + } +} + +void WebView::Resize(double width, double height) { + LOG_DEBUG("WebView::Resize width: %f height: %f \n", width, height); + width_ = width; + height_ = height; + evas_object_resize(webview_instance_, width_, height_); +} + +void WebView::Touch(int type, int button, double x, double y, double dx, + double dy) { + Ewk_Touch_Event_Type mouse_event_type = EWK_TOUCH_START; + Evas_Touch_Point_State state = EVAS_TOUCH_POINT_DOWN; + if (type == 0) { // down event + mouse_event_type = EWK_TOUCH_START; + state = EVAS_TOUCH_POINT_DOWN; + } else if (type == 1) { // move event + mouse_event_type = EWK_TOUCH_MOVE; + state = EVAS_TOUCH_POINT_MOVE; + + } else if (type == 2) { // up event + mouse_event_type = EWK_TOUCH_END; + state = EVAS_TOUCH_POINT_UP; + } else { + // TODO: Not implemented + } + Eina_List* pointList = 0; + Ewk_Touch_Point* point = new Ewk_Touch_Point; + point->id = 0; + point->x = x; + point->y = y; + point->state = state; + pointList = eina_list_append(pointList, point); + + ewk_view_feed_touch_event(webview_instance_, mouse_event_type, pointList, 0); + eina_list_free(pointList); +} + +void WebView::ClearFocus() { + LOG_DEBUG("WebView::ClearFocus()"); + ewk_view_focus_set(webview_instance_, false); +} + +void WebView::SetDirection(int direction) { + LOG_DEBUG("WebView::SetDirection direction: %d\n", direction); + // TODO: implement this if necessary +} + +void WebView::InitWebView() { + if (!gpu_buffer_) { + gpu_buffer_ = new FlutterDesktopGpuBuffer(); + } + + ewk_init(); + Ecore_Evas* evas = ecore_evas_new("wayland_egl", 0, 0, 1, 1, 0); + Ewk_Context* context = ewk_context_default_get(); + + webview_instance_ = ewk_view_add(ecore_evas_get(evas)); + ecore_evas_focus_set(evas, true); + ewk_view_focus_set(webview_instance_, true); + ewk_view_offscreen_rendering_enabled_set(webview_instance_, true); + + Ewk_Settings* settings = ewk_view_settings_get(webview_instance_); + + context = ewk_view_context_get(webview_instance_); + Ewk_Cookie_Manager* manager = ewk_context_cookie_manager_get(context); + ewk_cookie_manager_accept_policy_set(manager, + EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY); + ewk_view_ime_window_set(webview_instance_, + (Ecore_Wl2_Window*)platform_window_); + ewk_settings_viewport_meta_tag_set(settings, false); + ewk_view_key_events_enabled_set(webview_instance_, true); + ewk_context_cache_model_set(context, EWK_CACHE_MODEL_PRIMARY_WEBBROWSER); + + evas_object_smart_callback_add(webview_instance_, "offscreen,frame,rendered", + &WebView::OnFrameRendered, this); + evas_object_smart_callback_add(webview_instance_, "load,started", + &WebView::OnLoadStarted, this); + evas_object_smart_callback_add(webview_instance_, "load,progress", + &WebView::OnLoadInProgress, this); + evas_object_smart_callback_add(webview_instance_, "load,finished", + &WebView::OnLoadFinished, this); + evas_object_smart_callback_add(webview_instance_, "load,error", + &WebView::OnLoadError, this); + evas_object_smart_callback_add(webview_instance_, "url,changed", + &WebView::OnUrlChanged, this); + evas_object_smart_callback_add(webview_instance_, "console,message", + &WebView::OnConsoleMessage, this); + Resize(width_, height_); + evas_object_show(webview_instance_); +} + +void WebView::HandleMethodCall( + const flutter::MethodCall& method_call, + std::unique_ptr> result) { + if (!webview_instance_) { + return; + } + const auto method_name = method_call.method_name(); + const auto& arguments = *method_call.arguments(); + + LOG_DEBUG("WebView::HandleMethodCall : %s \n ", method_name.c_str()); + + if (method_name.compare("loadUrl") == 0) { + std::string url = ExtractStringFromMap(arguments, "url"); + ewk_view_url_set(webview_instance_, url.c_str()); + + result->Success(); + } else if (method_name.compare("updateSettings") == 0) { + if (std::holds_alternative(arguments)) { + auto settings = std::get(arguments); + if (settings.size() > 0) { + try { + ApplySettings(settings); + } catch (const std::invalid_argument& ex) { + LOG_ERROR("[Exception] %s\n", ex.what()); + result->Error(ex.what()); + return; + } + } + } + result->Success(); + } else if (method_name.compare("canGoBack") == 0) { + result->Success( + flutter::EncodableValue(ewk_view_back_possible(webview_instance_))); + } else if (method_name.compare("canGoForward") == 0) { + result->Success( + flutter::EncodableValue(ewk_view_forward_possible(webview_instance_))); + } else if (method_name.compare("goBack") == 0) { + ewk_view_back(webview_instance_); + result->Success(); + } else if (method_name.compare("goForward") == 0) { + ewk_view_forward(webview_instance_); + result->Success(); + } else if (method_name.compare("reload") == 0) { + ewk_view_reload(webview_instance_); + result->Success(); + } else if (method_name.compare("currentUrl") == 0) { + result->Success( + flutter::EncodableValue(ewk_view_url_get(webview_instance_))); + } else if (method_name.compare("evaluateJavascript") == 0) { + if (std::holds_alternative(arguments)) { + std::string js_string = std::get(arguments); + ewk_view_script_execute(webview_instance_, js_string.c_str(), + &WebView::OnEvaluateJavaScript, nullptr); + } else { + result->Error("Invalid Arguments", "Invalid Arguments"); + } + } else if (method_name.compare("addJavascriptChannels") == 0) { + result->NotImplemented(); + } else if (method_name.compare("removeJavascriptChannels") == 0) { + result->NotImplemented(); + } else if (method_name.compare("clearCache") == 0) { + result->NotImplemented(); + } else if (method_name.compare("getTitle") == 0) { + result->Success(flutter::EncodableValue( + std::string(ewk_view_title_get(webview_instance_)))); + } else if (method_name.compare("scrollTo") == 0) { + int x = ExtractIntFromMap(arguments, "x"); + int y = ExtractIntFromMap(arguments, "y"); + ewk_view_scroll_set(webview_instance_, x, y); + result->Success(); + } else if (method_name.compare("scrollBy") == 0) { + int x = ExtractIntFromMap(arguments, "x"); + int y = ExtractIntFromMap(arguments, "y"); + ewk_view_scroll_by(webview_instance_, x, y); + result->Success(); + } else if (method_name.compare("getScrollX") == 0) { + result->NotImplemented(); + } else if (method_name.compare("getScrollY") == 0) { + result->NotImplemented(); + } else { + result->NotImplemented(); + } +} + +void WebView::HandleCookieMethodCall( + const flutter::MethodCall& method_call, + std::unique_ptr> result) { + if (webview_instance_ == nullptr) { + result->Error("Not Webview created"); + return; + } + + const auto method_name = method_call.method_name(); + LOG_DEBUG("WebView::HandleMethodCall : %s \n ", method_name.c_str()); + + if (method_name.compare("clearCookies") == 0) { + result->NotImplemented(); + } else { + result->NotImplemented(); + } +} + +void WebView::OnFrameRendered(void* data, Evas_Object*, void* buffer) { + if (buffer) { + WebView* webview = (WebView*)data; + webview->candidate_surface_ = static_cast(buffer); + webview->texture_registrar_->MarkTextureFrameAvailable( + webview->GetTextureId()); + } +} + +void WebView::OnLoadStarted(void* data, Evas_Object*, void*) { + WebView* webview = (WebView*)data; + std::string url = std::string(ewk_view_url_get(webview->webview_instance_)); + LOG_DEBUG("RegisterOnPageStartedHandler(url: %s)\n", url.c_str()); + flutter::EncodableMap map; + map.insert(std::make_pair( + flutter::EncodableValue("url"), flutter::EncodableValue(url))); + auto args = std::make_unique(map); + webview->channel_->InvokeMethod("onPageStarted", std::move(args)); +} + +void WebView::OnLoadInProgress(void* data, Evas_Object*, void*) {} + +void WebView::OnLoadFinished(void* data, Evas_Object*, void*) { + WebView* webview = (WebView*)data; + std::string url = std::string(ewk_view_url_get(webview->webview_instance_)); + flutter::EncodableMap map; + map.insert(std::make_pair( + flutter::EncodableValue("url"), flutter::EncodableValue(url))); + auto args = std::make_unique(map); + webview->channel_->InvokeMethod("onPageFinished", std::move(args)); +} + +void WebView::OnLoadError(void* data, Evas_Object*, void* rawError) { + WebView* webview = (WebView*)data; + Ewk_Error* error = static_cast(rawError); + flutter::EncodableMap map; + + map.insert(std::make_pair( + flutter::EncodableValue("errorCode"), + flutter::EncodableValue(ewk_error_code_get(error)))); + map.insert(std::make_pair( + flutter::EncodableValue("description"), + flutter::EncodableValue(ewk_error_description_get(error)))); + map.insert(std::make_pair( + flutter::EncodableValue("errorType"), + flutter::EncodableValue(ErrorCodeToString(ewk_error_code_get(error))))); + map.insert(std::make_pair( + flutter::EncodableValue("failingUrl"), + flutter::EncodableValue(ewk_error_url_get(error)))); + auto args = std::make_unique(map); + webview->channel_->InvokeMethod("onWebResourceError", std::move(args)); +} + +void WebView::OnUrlChanged(void* data, Evas_Object*, void* newUrl) {} + +void WebView::OnConsoleMessage(void*, Evas_Object*, void* eventInfo) { + Ewk_Console_Message* message = (Ewk_Console_Message*)eventInfo; + LOG_DEBUG("console message:%s: %d: %d: %s", + ewk_console_message_source_get(message), + ewk_console_message_line_get(message), + ewk_console_message_level_get(message), + ewk_console_message_text_get(message)); +} + +void WebView::OnEvaluateJavaScript(Evas_Object* o, const char* result, + void* data) {} + +void WebView::OnJavaScriptMessage(Evas_Object* o, Ewk_Script_Message message) {} + +Eina_Bool WebView::OnJavaScriptAlert(Evas_Object* o, const char* alert_text, + void*) { + return false; +} + +Eina_Bool WebView::OnJavaScriptConfirm(Evas_Object* o, const char* message, + void*) { + return false; +} + +Eina_Bool WebView::OnJavaScriptPrompt(Evas_Object* o, const char* message, + const char* default_value, void*) { + return false; +} + +FlutterDesktopGpuBuffer* WebView::ObtainGpuBuffer(size_t width, size_t height) { + if (!candidate_surface_) { + if (!rendered_surface_) { + return nullptr; + } else { + return gpu_buffer_; + } + } + + rendered_surface_ = candidate_surface_; + candidate_surface_ = nullptr; + if (gpu_buffer_) { + gpu_buffer_->buffer = static_cast(rendered_surface_); + gpu_buffer_->width = width; + gpu_buffer_->height = height; + } + return gpu_buffer_; +} + +void WebView::DestructBuffer(void* buffer) { + // TODO +} diff --git a/packages/webview_flutter_ewk/tizen/src/webview.h b/packages/webview_flutter_ewk/tizen/src/webview.h new file mode 100644 index 000000000..ae2674c40 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/src/webview.h @@ -0,0 +1,89 @@ +// Copyright 2021 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_PLUGIN_WEBVIEW_FLUTTER_TIZEN_EWK_WEVIEW_H_ +#define FLUTTER_PLUGIN_WEBVIEW_FLUTTER_TIZEN_EWK_WEVIEW_H_ + +#include +#include +#include +#include +#include +#include + +#include "EWebKit_internal.h" +#include "EWebKit_product.h" + +class WebView : public PlatformView { + public: + WebView(flutter::PluginRegistrar* registrar, int viewId, + flutter::TextureRegistrar* textureRegistrar, double width, + double height, flutter::EncodableMap& params, void* winHandle); + ~WebView(); + virtual void Dispose() override; + virtual void Resize(double width, double height) override; + virtual void Touch(int type, int button, double x, double y, double dx, + double dy) override; + virtual void SetDirection(int direction) override; + virtual void ClearFocus() override; + + // Key input event + virtual void DispatchKeyDownEvent(Ecore_Event_Key* key) {} + virtual void DispatchKeyUpEvent(Ecore_Event_Key* key) {} + virtual void DispatchCompositionUpdateEvent(const char* str, int size) {} + virtual void DispatchCompositionEndEvent(const char* str, int size) {} + virtual void SetSoftwareKeyboardContext(Ecore_IMF_Context* context) {} + + Evas_Object* GetWebViewInstance() { return webview_instance_; } + + FlutterDesktopGpuBuffer* ObtainGpuBuffer(size_t width, size_t height); + void DestructBuffer(void* buffer); + + private: + void HandleMethodCall( + const flutter::MethodCall& method_call, + std::unique_ptr> result); + void HandleCookieMethodCall( + const flutter::MethodCall& method_call, + std::unique_ptr> result); + std::string GetChannelName(); + void InitWebView(); + + void RegisterJavaScriptChannelName(const std::string& name); + void ApplySettings(flutter::EncodableMap); + + flutter::TextureRegistrar* texture_registrar_; + + static void OnFrameRendered(void* data, Evas_Object*, void* buffer); + static void OnLoadStarted(void* data, Evas_Object*, void*); + static void OnLoadInProgress(void* data, Evas_Object*, void*); + static void OnLoadFinished(void* data, Evas_Object*, void*); + static void OnLoadError(void* data, Evas_Object*, void* rawError); + static void OnUrlChanged(void* data, Evas_Object*, void* newUrl); + static void OnConsoleMessage(void*, Evas_Object*, void* eventInfo); + static void OnEvaluateJavaScript(Evas_Object* o, const char* result, + void* data); + static void OnJavaScriptMessage(Evas_Object* o, Ewk_Script_Message message); + static Eina_Bool OnJavaScriptAlert(Evas_Object* o, const char* alert_text, + void*); + static Eina_Bool OnJavaScriptConfirm(Evas_Object* o, const char* message, + void*); + static Eina_Bool OnJavaScriptPrompt(Evas_Object* o, const char* message, + const char* default_value, void*); + + Evas_Object* webview_instance_; + + double width_; + double height_; + tbm_surface_h candidate_surface_; + tbm_surface_h rendered_surface_; + bool has_navigation_delegate_; + bool has_progress_tracking_; + std::unique_ptr> channel_; + + flutter::TextureVariant* texture_variant_; + FlutterDesktopGpuBuffer* gpu_buffer_; +}; + +#endif // FLUTTER_PLUGIN_WEBVIEW_FLUTTER_TIZEN_EWK_WEVIEW_H_ diff --git a/packages/webview_flutter_ewk/tizen/src/webview_factory.cc b/packages/webview_flutter_ewk/tizen/src/webview_factory.cc new file mode 100644 index 000000000..c765a7b4f --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/src/webview_factory.cc @@ -0,0 +1,37 @@ +// Copyright 2021 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "webview_factory.h" + +#include +#include +#include +#include +#include + +#include "log.h" +#include "webview_flutter_tizen_ewk_plugin.h" + +WebViewFactory::WebViewFactory(flutter::PluginRegistrar* registrar, + flutter::TextureRegistrar* textureRegistrar) + : PlatformViewFactory(registrar), texture_registrar_(textureRegistrar) {} + +PlatformView* WebViewFactory::Create(int viewId, double width, double height, + const std::vector& createParams) { + flutter::EncodableMap params; + auto decodedValue = *GetCodec().DecodeMessage(createParams); + if (std::holds_alternative(decodedValue)) { + params = std::get(decodedValue); + } + + try { + return new WebView(GetPluginRegistrar(), viewId, texture_registrar_, width, + height, params, platform_window_); + } catch (const std::invalid_argument& ex) { + LOG_ERROR("[Exception] %s\n", ex.what()); + return nullptr; + } +} + +void WebViewFactory::Dispose() {} diff --git a/packages/webview_flutter_ewk/tizen/src/webview_factory.h b/packages/webview_flutter_ewk/tizen/src/webview_factory.h new file mode 100644 index 000000000..d1ba81a12 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/src/webview_factory.h @@ -0,0 +1,22 @@ +// Copyright 2021 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_PLUGIN_WEBVIEW_FLUTTER_TIZEN_EWK_WEVIEW_FACTORY_H_ +#define FLUTTER_PLUGIN_WEBVIEW_FLUTTER_TIZEN_EWK_WEVIEW_FACTORY_H_ + +#include "webview.h" +class WebViewFactory : public PlatformViewFactory { + public: + WebViewFactory(flutter::PluginRegistrar* registrar, + flutter::TextureRegistrar* textureRegistrar); + virtual void Dispose() override; + virtual PlatformView* Create( + int viewId, double width, double height, + const std::vector& createParams) override; + + private: + flutter::TextureRegistrar* texture_registrar_; +}; + +#endif // FLUTTER_PLUGIN_WEBVIEW_FLUTTER_TIZEN_EWK_WEVIEW_FACTORY_H_ diff --git a/packages/webview_flutter_ewk/tizen/src/webview_flutter_tizen_ewk_plugin.cc b/packages/webview_flutter_ewk/tizen/src/webview_flutter_tizen_ewk_plugin.cc new file mode 100644 index 000000000..4f8e056c8 --- /dev/null +++ b/packages/webview_flutter_ewk/tizen/src/webview_flutter_tizen_ewk_plugin.cc @@ -0,0 +1,32 @@ +// Copyright 2021 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "webview_flutter_tizen_ewk_plugin.h" + +#include + +#include "webview_factory.h" + +static constexpr char kViewType[] = "plugins.flutter.io/webview"; + +class WebviewFlutterTizenEwkPlugin : public flutter::Plugin { + public: + static void RegisterWithRegistrar(flutter::PluginRegistrar* registrar) { + auto plugin = std::make_unique(); + registrar->AddPlugin(std::move(plugin)); + } + WebviewFlutterTizenEwkPlugin() {} + virtual ~WebviewFlutterTizenEwkPlugin() {} +}; + +void WebviewFlutterTizenEwkPluginRegisterWithRegistrar( + FlutterDesktopPluginRegistrarRef registrar) { + flutter::PluginRegistrar* core_registrar = + flutter::PluginRegistrarManager::GetInstance() + ->GetRegistrar(registrar); + auto factory = std::make_unique( + core_registrar, core_registrar->texture_registrar()); + FlutterRegisterViewFactory(registrar, kViewType, std::move(factory)); + WebviewFlutterTizenEwkPlugin::RegisterWithRegistrar(core_registrar); +}