WebView : Support custom UserAgent
authorSeungkeun Lee <sngn.lee@samsung.com>
Mon, 27 Apr 2015 02:14:50 +0000 (11:14 +0900)
committerSeungkeun Lee <sngn.lee@samsung.com>
Mon, 27 Apr 2015 02:14:50 +0000 (11:14 +0900)
- SetUserAgent
- SetAppInfo

Change-Id: I332d3228f8601144bca0333eb8f4b562c5c62a61

src/runtime/web_view.cc
src/runtime/web_view.h
src/runtime/web_view_impl.cc
src/runtime/web_view_impl.h

index c105038..aa713da 100755 (executable)
@@ -57,5 +57,12 @@ Evas_Object* WebView::evas_object() const {
   return impl_->evas_object();
 }
 
-}  // namespace wrt
+void WebView::SetAppInfo(const std::string& app_name,
+                         const std::string& version) {
+  impl_->SetAppInfo(app_name, version);
+}
 
+void WebView::SetUserAgent(const std::string& user_agent) {
+  impl_->SetUserAgent(user_agent.c_str());
+}
+}  // namespace wrt
index e451b64..4399deb 100755 (executable)
@@ -54,6 +54,8 @@ class WebView {
   void Reload();
   void SetVisibility(bool show);
   bool EvalJavascript(const std::string& script);
+  void SetAppInfo(const std::string& app_name, const std::string& version);
+  void SetUserAgent(const std::string& user_agent);
 
   void SetEventListener(EventListener* listener);
   Evas_Object* evas_object() const;
index b306a30..5592968 100755 (executable)
@@ -465,6 +465,13 @@ void WebViewImpl::SetEventListener(WebView::EventListener* listener) {
   listener_ = listener;
 }
 
-}  // namespace wrt
-
+void WebViewImpl::SetAppInfo(const std::string& app_name,
+                             const std::string& version) {
+  std::string ua = app_name + "/" + version;
+  ewk_view_application_name_for_user_agent_set(ewk_view_, ua.c_str());
+}
+void WebViewImpl::SetUserAgent(const std::string& user_agent) {
+  ewk_view_user_agent_set(ewk_view_, user_agent.c_str());
+}
 
+}  // namespace wrt
index dd25077..3a89b96 100755 (executable)
@@ -30,6 +30,8 @@ class WebViewImpl {
   void Reload();
   void SetVisibility(bool show);
   bool EvalJavascript(const std::string& script);
+  void SetAppInfo(const std::string& app_name, const std::string& version);
+  void SetUserAgent(const std::string& user_agent);
 
   void SetEventListener(WebView::EventListener* listener);
   Evas_Object* evas_object() const;