Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / xwalk / application / browser / linux / running_application_object.cc
index 87877dc..67c50c2 100644 (file)
@@ -62,20 +62,6 @@ RunningApplicationObject::RunningApplicationObject(
   // IPC on extension process side is implemented,
   // these methods have to be removed.
   dbus_object()->ExportMethod(
-      kRunningApplicationDBusInterface, "RemoveAllCookies",
-      base::Bind(&RunningApplicationObject::OnRemoveAllCookies,
-                 base::Unretained(this)),
-      base::Bind(&RunningApplicationObject::OnExported,
-                 base::Unretained(this)));
-
-  dbus_object()->ExportMethod(
-      kRunningApplicationDBusInterface, "SetUserAgentString",
-      base::Bind(&RunningApplicationObject::OnSetUserAgentString,
-                 base::Unretained(this)),
-      base::Bind(&RunningApplicationObject::OnExported,
-                 base::Unretained(this)));
-
-  dbus_object()->ExportMethod(
       kRunningApplicationDBusInterface, "Terminate",
       base::Bind(&RunningApplicationObject::OnTerminate,
                  base::Unretained(this)),
@@ -110,6 +96,20 @@ RunningApplicationObject::RunningApplicationObject(
                  base::Unretained(this)),
       base::Bind(&RunningApplicationObject::OnExported,
                  base::Unretained(this)));
+
+  dbus_object()->ExportMethod(
+      kRunningApplicationDBusInterface, "RemoveAllCookies",
+      base::Bind(&RunningApplicationObject::OnRemoveAllCookies,
+                 base::Unretained(this)),
+      base::Bind(&RunningApplicationObject::OnExported,
+                 base::Unretained(this)));
+
+  dbus_object()->ExportMethod(
+      kRunningApplicationDBusInterface, "SetUserAgentString",
+      base::Bind(&RunningApplicationObject::OnSetUserAgentString,
+                 base::Unretained(this)),
+      base::Bind(&RunningApplicationObject::OnExported,
+                 base::Unretained(this)));
 #endif
 }
 
@@ -131,60 +131,6 @@ void RunningApplicationObject::OnExported(const std::string& interface_name,
   }
 }
 
-void RunningApplicationObject::SetUserAgentStringOnIOThread(
-    const std::string& user_agent_string) {
-  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
-  ToApplicationTizen(application_)->SetUserAgentString(user_agent_string);
-}
-
-void RunningApplicationObject::OnRemoveAllCookies(dbus::MethodCall* method_call,
-    dbus::ExportedObject::ResponseSender response_sender) {
-  if (method_call->GetSender() != launcher_name_) {
-    scoped_ptr<dbus::ErrorResponse> error_response =
-        dbus::ErrorResponse::FromMethodCall(method_call,
-                                            kRunningApplicationDBusError,
-                                            "Not permitted");
-    response_sender.Run(error_response.PassAs<dbus::Response>());
-    return;
-  }
-
-  ToApplicationTizen(application_)->RemoveAllCookies();
-
-  scoped_ptr<dbus::Response> response =
-      dbus::Response::FromMethodCall(method_call);
-  response_sender.Run(response.Pass());
-}
-
-void RunningApplicationObject::OnSetUserAgentString(
-    dbus::MethodCall* method_call,
-    dbus::ExportedObject::ResponseSender response_sender) {
-  if (method_call->GetSender() != launcher_name_) {
-    scoped_ptr<dbus::ErrorResponse> error_response =
-        dbus::ErrorResponse::FromMethodCall(method_call,
-                                            kRunningApplicationDBusError,
-                                            "Not permitted");
-    response_sender.Run(error_response.PassAs<dbus::Response>());
-    return;
-  }
-  dbus::MessageReader reader(method_call);
-  std::string new_user_agent;
-  if (reader.PopString(&new_user_agent)) {
-    content::BrowserThread::PostTask(
-        content::BrowserThread::IO, FROM_HERE,
-        base::Bind(&RunningApplicationObject::SetUserAgentStringOnIOThread,
-                   base::Unretained(this), new_user_agent));
-    scoped_ptr<dbus::Response> response =
-        dbus::Response::FromMethodCall(method_call);
-    response_sender.Run(response.Pass());
-  } else {
-    scoped_ptr<dbus::ErrorResponse> error_response =
-        dbus::ErrorResponse::FromMethodCall(method_call,
-                                            kRunningApplicationDBusError,
-                                            "Wrong user agent string");
-    response_sender.Run(error_response.PassAs<dbus::Response>());
-  }
-}
-
 void RunningApplicationObject::OnTerminate(
     dbus::MethodCall* method_call,
     dbus::ExportedObject::ResponseSender response_sender) {
@@ -275,6 +221,60 @@ void RunningApplicationObject::OnResume(
       dbus::Response::FromMethodCall(method_call);
   response_sender.Run(response.Pass());
 }
+
+void RunningApplicationObject::OnRemoveAllCookies(dbus::MethodCall* method_call,
+    dbus::ExportedObject::ResponseSender response_sender) {
+  if (method_call->GetSender() != launcher_name_) {
+    scoped_ptr<dbus::ErrorResponse> error_response =
+        dbus::ErrorResponse::FromMethodCall(method_call,
+                                            kRunningApplicationDBusError,
+                                            "Not permitted");
+    response_sender.Run(error_response.PassAs<dbus::Response>());
+    return;
+  }
+
+  ToApplicationTizen(application_)->RemoveAllCookies();
+
+  scoped_ptr<dbus::Response> response =
+      dbus::Response::FromMethodCall(method_call);
+  response_sender.Run(response.Pass());
+}
+
+void RunningApplicationObject::SetUserAgentStringOnIOThread(
+    const std::string& user_agent_string) {
+  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+  ToApplicationTizen(application_)->SetUserAgentString(user_agent_string);
+}
+
+void RunningApplicationObject::OnSetUserAgentString(
+    dbus::MethodCall* method_call,
+    dbus::ExportedObject::ResponseSender response_sender) {
+  if (method_call->GetSender() != launcher_name_) {
+    scoped_ptr<dbus::ErrorResponse> error_response =
+        dbus::ErrorResponse::FromMethodCall(method_call,
+                                            kRunningApplicationDBusError,
+                                            "Not permitted");
+    response_sender.Run(error_response.PassAs<dbus::Response>());
+    return;
+  }
+  dbus::MessageReader reader(method_call);
+  std::string new_user_agent;
+  if (reader.PopString(&new_user_agent)) {
+    content::BrowserThread::PostTask(
+        content::BrowserThread::IO, FROM_HERE,
+        base::Bind(&RunningApplicationObject::SetUserAgentStringOnIOThread,
+                   base::Unretained(this), new_user_agent));
+    scoped_ptr<dbus::Response> response =
+        dbus::Response::FromMethodCall(method_call);
+    response_sender.Run(response.Pass());
+  } else {
+    scoped_ptr<dbus::ErrorResponse> error_response =
+        dbus::ErrorResponse::FromMethodCall(method_call,
+                                            kRunningApplicationDBusError,
+                                            "Wrong user agent string");
+    response_sender.Run(error_response.PassAs<dbus::Response>());
+  }
+}
 #endif
 
 void RunningApplicationObject::ListenForOwnerChange() {