#include "base/files/file_path.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/string_number_conversions.h"
+#include "cc/base/switches.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/common/content_switches.h"
+#include "content/public/common/main_function_params.h"
+#include "content/public/common/url_constants.h"
+#include "content/public/common/result_codes.h"
+#include "extensions/browser/extension_system.h"
+#include "net/base/filename_util.h"
+#include "ui/gl/gl_switches.h"
#include "xwalk/application/browser/application.h"
#include "xwalk/application/browser/application_system.h"
#include "xwalk/extensions/browser/xwalk_extension_service.h"
#include "xwalk/extensions/common/xwalk_extension_switches.h"
-#include "xwalk/runtime/browser/devtools/remote_debugging_server.h"
#include "xwalk/runtime/browser/runtime.h"
#include "xwalk/runtime/browser/runtime_context.h"
#include "xwalk/runtime/browser/xwalk_runner.h"
#include "xwalk/runtime/common/xwalk_runtime_features.h"
#include "xwalk/runtime/common/xwalk_switches.h"
-#include "cc/base/switches.h"
-#include "content/public/common/content_switches.h"
-#include "content/public/common/main_function_params.h"
-#include "content/public/common/url_constants.h"
-#include "content/public/common/result_codes.h"
-#include "net/base/net_util.h"
-#include "ui/gl/gl_switches.h"
+
+#if !defined(DISABLE_NACL)
+#include "components/nacl/browser/nacl_browser.h"
+#include "components/nacl/browser/nacl_process_host.h"
+#include "xwalk/runtime/browser/nacl_host/nacl_browser_delegate_impl.h"
+#endif
#if defined(USE_AURA) && defined(USE_X11)
#include "ui/base/ime/input_method_initializer.h"
namespace xswitches {
// Redefine settings not exposed by content module.
-const char kEnableViewport[] = "enable-viewport";
const char kEnableOverlayScrollbars[] = "enable-overlay-scrollbars";
}
XWalkBrowserMainParts::XWalkBrowserMainParts(
const content::MainFunctionParams& parameters)
: xwalk_runner_(XWalkRunner::GetInstance()),
- startup_url_(content::kAboutBlankURL),
+ startup_url_(url::kAboutBlankURL),
parameters_(parameters),
run_default_message_loop_(true) {
#if defined(OS_LINUX)
void XWalkBrowserMainParts::PreMainMessageLoopStart() {
CommandLine* command_line = CommandLine::ForCurrentProcess();
- command_line->AppendSwitch(xswitches::kEnableViewport);
+ command_line->AppendSwitch(switches::kEnableViewport);
+ command_line->AppendSwitch(switches::kEnableViewportMeta);
command_line->AppendSwitch(xswitches::kEnableOverlayScrollbars);
// This also enables pinch on Tizen.
command_line->AppendSwitch(switches::kEnableThreadedCompositing);
- // Show feedback on touch.
- command_line->AppendSwitch(switches::kEnableGestureTapHighlight);
-
// FIXME: Add comment why this is needed on Android and Tizen.
command_line->AppendSwitch(switches::kAllowFileAccessFromFiles);
+ // Enable SIMD.JS API by default.
+ /*
+ std::string js_flags("--simd_object");
+ if (command_line->HasSwitch(switches::kJavaScriptFlags)) {
+ js_flags += " ";
+ js_flags +=
+ command_line->GetSwitchValueASCII(switches::kJavaScriptFlags);
+ }
+ command_line->AppendSwitchASCII(switches::kJavaScriptFlags, js_flags);
+ */
+
startup_url_ = GetURLFromCommandLine(*command_line);
}
CommandLine* cmd_line = CommandLine::ForCurrentProcess();
#if defined(OS_TIZEN)
- static const std::string tec_path = "/usr/lib/tizen-extensions-crosswalk";
std::string value = cmd_line->GetSwitchValueASCII(
switches::kXWalkExternalExtensionsPath);
+#if defined(ARCH_CPU_64_BITS)
+ const char tec_path[] = "/usr/lib64/tizen-extensions-crosswalk";
+#else
+ const char tec_path[] = "/usr/lib/tizen-extensions-crosswalk";
+#endif
+
if (value.empty())
cmd_line->AppendSwitchASCII(switches::kXWalkExternalExtensionsPath,
tec_path);
if (!cmd_line->HasSwitch(
switches::kXWalkAllowExternalExtensionsForRemoteSources) &&
- !startup_url_.SchemeIsFile()) {
+ (!startup_url_.is_empty() && !startup_url_.SchemeIsFile())) {
VLOG(0) << "Unsupported scheme for external extensions: " <<
startup_url_.scheme();
return;
void XWalkBrowserMainParts::PreMainMessageLoopRun() {
xwalk_runner_->PreMainMessageLoopRun();
- runtime_context_ = xwalk_runner_->runtime_context();
extension_service_ = xwalk_runner_->extension_service();
if (extension_service_)
RegisterExternalExtensions();
+#if !defined(DISABLE_NACL)
+ NaClBrowserDelegateImpl* delegate = new NaClBrowserDelegateImpl();
+ nacl::NaClBrowser::SetDelegate(delegate);
+
+ content::BrowserThread::PostTask(
+ content::BrowserThread::IO,
+ FROM_HERE,
+ base::Bind(nacl::NaClProcessHost::EarlyStartup));
+#endif
+
CommandLine* command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kRemoteDebuggingPort)) {
std::string port_str =
command_line->GetSwitchValueASCII(switches::kRemoteDebuggingPort);
int port;
- const char* local_ip = "0.0.0.0";
- if (base::StringToInt(port_str, &port) && port > 0 && port < 65535) {
- remote_debugging_server_.reset(
- new RemoteDebuggingServer(runtime_context_,
- local_ip, port, std::string()));
- }
+ base::StringToInt(port_str, &port);
+ xwalk_runner_->EnableRemoteDebugging(port);
}
NativeAppWindow::Initialize();
- application::ApplicationSystem* app_system = xwalk_runner_->app_system();
- if (app_system->HandleApplicationManagementCommands(
- *command_line, startup_url_,
- run_default_message_loop_)) {
- return;
- }
-
if (command_line->HasSwitch(switches::kListFeaturesFlags)) {
XWalkRuntimeFeatures::GetInstance()->DumpFeaturesFlags();
run_default_message_loop_ = false;
return;
}
- if (xwalk_runner_->is_running_as_service()) {
- // In service mode, Crosswalk doesn't launch anything, just waits
- // for external requests to launch apps.
- VLOG(1) << "Crosswalk running as Service.";
- return;
- }
-
- if (app_system->LaunchFromCommandLine(*command_line, startup_url_,
- run_default_message_loop_)) {
- return;
- }
-
+#if !defined(SHARED_PROCESS_MODE)
+ application::ApplicationSystem* app_system = xwalk_runner_->app_system();
+ app_system->LaunchFromCommandLine(*command_line, startup_url_,
+ run_default_message_loop_);
// If the |ui_task| is specified in main function parameter, it indicates
// that we will run this UI task instead of running the the default main
// message loop. See |content::BrowserTestBase::SetUp| for |ui_task| usage
delete parameters_.ui_task;
run_default_message_loop_ = false;
}
+#endif
}
bool XWalkBrowserMainParts::MainMessageLoopRun(int* result_code) {