%define _binary_payload w3.gzdio
Name: crosswalk
-Version: 11.39.252.0
+Version: 11.39.256.0
Release: 0
Summary: Chromium-based app runtime
License: (BSD-3-Clause and LGPL-2.1+)
-LASTCHANGE=35b73bc7d43d8dcab600c2afedcdcf21de0651ee
+LASTCHANGE=ea46c0b6279a60b0173a092f0e9f0403a2a047a9
net::URLRequestContextGetter* context,
const GURL& url,
const base::string16& access_token) {
-#if defined(OS_ANDROID) || defined(OS_TIZEN)
+#if defined(OS_ANDROID)
// Android uses its own SystemLocationProvider.
return NULL;
#else
}
LocationProvider* LocationArbitratorImpl::NewSystemLocationProvider() {
-#if defined(OS_TIZEN)
- return content::NewSystemLocationProvider();
-#elif defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
return NULL;
#else
return content::NewSystemLocationProvider();
#if defined(OS_TIZEN)
if (IsArchitectureX86_64()) {
- // TODO(halton): Add 64-bit VA driver when 64-bit Tizen support
- // is ready.
- return false;
+ I965DrvVideoPath = "/usr/lib64/dri/i965_dri.so";
} else if (IsArchitectureI386()) {
I965DrvVideoPath = "/usr/lib/dri/i965_dri.so";
}
--- /dev/null
+# Ignore errors about override vs OVERRIDE, see https://groups.google.com/a/chromium.org/forum/#!msg/chromium-dev/EW0wSDQQK8I/H0gsPtDtRmAJ
+filter=-readability/inheritance
# Edit these when rolling DEPS.xwalk.
# -----------------------------------
-chromium_crosswalk_rev = '35b73bc7d43d8dcab600c2afedcdcf21de0651ee'
+chromium_crosswalk_rev = 'ea46c0b6279a60b0173a092f0e9f0403a2a047a9'
v8_crosswalk_rev = '5b2efeab77f1cda6d70f98f20b393fe40ea6898a'
ozone_wayland_rev = '6379cd118da098b55a5934ce1a90b377a177ed40'
MAJOR=11
MINOR=39
-BUILD=252
+BUILD=256
PATCH=0
#include "xwalk/application/common/constants.h"
#include "xwalk/application/common/manifest_handlers/warp_handler.h"
#include "xwalk/runtime/browser/runtime.h"
-#include "xwalk/runtime/browser/runtime_context.h"
-#include "xwalk/runtime/browser/runtime_defered_ui_strategy.h"
+#include "xwalk/runtime/browser/runtime_ui_delegate.h"
+#include "xwalk/runtime/browser/xwalk_browser_context.h"
#include "xwalk/runtime/browser/xwalk_runner.h"
#if defined(OS_TIZEN)
scoped_ptr<Application> Application::Create(
scoped_refptr<ApplicationData> data,
- RuntimeContext* context) {
+ XWalkBrowserContext* context) {
#if defined(OS_TIZEN)
return make_scoped_ptr<Application>(new ApplicationTizen(data, context));
#else
Application::Application(
scoped_refptr<ApplicationData> data,
- RuntimeContext* runtime_context)
+ XWalkBrowserContext* browser_context)
: data_(data),
render_process_host_(NULL),
web_contents_(NULL),
security_mode_enabled_(false),
- runtime_context_(runtime_context),
+ browser_context_(browser_context),
observer_(NULL),
- ui_strategy_(new RuntimeDeferedUIStrategy),
remote_debugging_enabled_(false),
weak_factory_(this) {
- DCHECK(runtime_context_);
+ DCHECK(browser_context_);
DCHECK(data_.get());
}
return false;
remote_debugging_enabled_ = launch_params.remote_debugging;
-
- Runtime* runtime = Runtime::Create(
- runtime_context_,
- this, content::SiteInstance::CreateForURL(runtime_context_, url));
+ auto site = content::SiteInstance::CreateForURL(browser_context_, url);
+ Runtime* runtime = Runtime::Create(browser_context_, site);
+ runtime->set_observer(this);
+ runtimes_.push_back(runtime);
render_process_host_ = runtime->GetRenderProcessHost();
render_process_host_->AddObserver(this);
web_contents_ = runtime->web_contents();
NativeAppWindow::CreateParams params;
params.net_wm_pid = launch_params.launcher_pid;
params.state = is_wgt ?
- GetWindowShowState<Manifest::TYPE_WIDGET>(launch_params):
+ GetWindowShowState<Manifest::TYPE_WIDGET>(launch_params) :
GetWindowShowState<Manifest::TYPE_MANIFEST>(launch_params);
- window_show_params_.state = params.state;
+ window_show_params_ = params;
+ // Only the first runtime can have a launch screen.
params.splash_screen_path = GetSplashScreenPath();
-
- ui_strategy_->Show(runtime, params);
+ runtime->set_ui_delegate(DefaultRuntimeUIDelegate::Create(runtime, params));
+ // We call "Show" after RP is initialized to reduce
+ // the application start up time.
return true;
}
}
void Application::Terminate() {
- std::set<Runtime*> to_be_closed(runtimes_);
- std::for_each(to_be_closed.begin(), to_be_closed.end(),
- std::mem_fun(&Runtime::Close));
+ std::vector<Runtime*> to_be_closed(runtimes_.get());
+ for (Runtime* runtime : to_be_closed)
+ runtime->Close();
}
int Application::GetRenderProcessHostID() const {
return render_process_host_->GetID();
}
-void Application::OnRuntimeAdded(Runtime* runtime) {
- DCHECK(runtime);
+void Application::OnNewRuntimeAdded(Runtime* runtime) {
runtime->set_remote_debugging_enabled(remote_debugging_enabled_);
- if (!runtimes_.empty())
- ui_strategy_->Show(runtime, window_show_params_);
- runtimes_.insert(runtime);
+ runtime->set_observer(this);
+ runtime->set_ui_delegate(
+ DefaultRuntimeUIDelegate::Create(runtime, window_show_params_));
+ runtime->Show();
+ runtimes_.push_back(runtime);
}
-void Application::OnRuntimeRemoved(Runtime* runtime) {
- DCHECK(runtime);
- runtimes_.erase(runtime);
+void Application::OnRuntimeClosed(Runtime* runtime) {
+ auto found = std::find(runtimes_.begin(), runtimes_.end(), runtime);
+ CHECK(found != runtimes_.end());
+ LOG(INFO) << "Application::OnRuntimeClosed " << runtime;
+ runtimes_.erase(found);
if (runtimes_.empty())
base::MessageLoop::current()->PostTask(FROM_HERE,
observer_->OnApplicationTerminated(this);
}
+void Application::RenderChannelCreated() {
+ CHECK(!runtimes_.empty());
+ runtimes_.front()->Show();
+}
+
bool Application::UseExtension(const std::string& extension_name) const {
// TODO(Bai): Tells whether the application contains the specified extension
return true;
#include "xwalk/application/browser/application_security_policy.h"
#include "xwalk/application/common/application_data.h"
#include "xwalk/runtime/browser/runtime.h"
-#include "xwalk/runtime/browser/runtime_ui_strategy.h"
-
namespace content {
class RenderProcessHost;
namespace xwalk {
-class RuntimeContext;
+class XWalkBrowserContext;
+class XWalkAppExtensionBridge;
namespace application {
// immediately after its termination.
void Terminate();
- const std::set<Runtime*>& runtimes() const { return runtimes_; }
+ const std::vector<Runtime*>& runtimes() const { return runtimes_.get(); }
// Returns the unique application id which is used to distinguish the
// application amoung both running applications and installed ones
void set_observer(Observer* observer) { observer_ = observer; }
- RuntimeUIStrategy* ui_strategy() { return ui_strategy_.get(); }
+ base::WeakPtr<Application> GetWeakPtr() {
+ return weak_factory_.GetWeakPtr();
+ }
protected:
- Application(scoped_refptr<ApplicationData> data, RuntimeContext* context);
+ Application(scoped_refptr<ApplicationData> data,
+ XWalkBrowserContext* context);
virtual bool Launch(const LaunchParams& launch_params);
virtual void InitSecurityPolicy();
// Runtime::Observer implementation.
- virtual void OnRuntimeAdded(Runtime* runtime) OVERRIDE;
- virtual void OnRuntimeRemoved(Runtime* runtime) OVERRIDE;
+ virtual void OnNewRuntimeAdded(Runtime* runtime) override;
+ virtual void OnRuntimeClosed(Runtime* runtime) override;
// Get the path of splash screen image. Return empty path by default.
// Sub class can override it to return a specific path.
virtual base::FilePath GetSplashScreenPath();
- std::set<Runtime*> runtimes_;
- RuntimeContext* runtime_context_;
+ XWalkBrowserContext* browser_context_;
+ ScopedVector<Runtime> runtimes_;
scoped_refptr<ApplicationData> const data_;
// The application's render process host.
content::RenderProcessHost* render_process_host_;
content::WebContents* web_contents_;
bool security_mode_enabled_;
- scoped_ptr<RuntimeUIStrategy> ui_strategy_;
- xwalk::NativeAppWindow::CreateParams window_show_params_;
-
- base::WeakPtr<Application> GetWeakPtr() {
- return weak_factory_.GetWeakPtr();
- }
+ NativeAppWindow::CreateParams window_show_params_;
private:
// We enforce ApplicationService ownership.
friend class ApplicationService;
+ // XWalkAppExtensionBridge gives notifications.
+ friend class xwalk::XWalkAppExtensionBridge;
static scoped_ptr<Application> Create(scoped_refptr<ApplicationData> data,
- RuntimeContext* context);
+ XWalkBrowserContext* context);
// content::RenderProcessHostObserver implementation.
virtual void RenderProcessExited(content::RenderProcessHost* host,
GURL GetAbsoluteURLFromKey(const std::string& key);
void NotifyTermination();
+ // Notification from XWalkAppExtensionBridge.
+ void RenderChannelCreated();
Observer* observer_;
#include "xwalk/application/common/application_manifest_constants.h"
#include "xwalk/application/common/application_file_util.h"
#include "xwalk/application/common/id_util.h"
-#include "xwalk/runtime/browser/runtime_context.h"
#include "xwalk/runtime/browser/runtime.h"
+#include "xwalk/runtime/browser/xwalk_browser_context.h"
#include "xwalk/runtime/common/xwalk_paths.h"
#if defined(OS_TIZEN)
namespace application {
-ApplicationService::ApplicationService(RuntimeContext* runtime_context)
- : runtime_context_(runtime_context) {
+ApplicationService::ApplicationService(XWalkBrowserContext* browser_context)
+ : browser_context_(browser_context) {
}
scoped_ptr<ApplicationService> ApplicationService::Create(
- RuntimeContext* runtime_context) {
+ XWalkBrowserContext* browser_context) {
#if defined(OS_TIZEN)
return make_scoped_ptr<ApplicationService>(
- new ApplicationServiceTizen(runtime_context));
+ new ApplicationServiceTizen(browser_context));
#else
- return make_scoped_ptr(new ApplicationService(runtime_context));
+ return make_scoped_ptr(new ApplicationService(browser_context));
#endif
}
}
Application* application = Application::Create(application_data,
- runtime_context_).release();
+ browser_context_).release();
ScopedVector<Application>::iterator app_iter =
applications_.insert(applications_.end(), application);
// FIXME: So far we simply clean up all the app persistent data,
// further we need to add an appropriate logic to handle it.
content::BrowserContext::GarbageCollectStoragePartitions(
- runtime_context_,
+ browser_context_,
make_scoped_ptr(new base::hash_set<base::FilePath>()),
base::Bind(&base::DoNothing));
}
namespace xwalk {
-class RuntimeContext;
+class XWalkBrowserContext;
namespace application {
virtual ~ApplicationService();
static scoped_ptr<ApplicationService> Create(
- RuntimeContext* runtime_context);
+ XWalkBrowserContext* browser_context);
// Launch an unpacked application using path to the manifest file
// of an unpacked application.
const std::string& perm_table);
protected:
- explicit ApplicationService(RuntimeContext* runtime_context);
+ explicit ApplicationService(XWalkBrowserContext* browser_context);
Application* Launch(scoped_refptr<ApplicationData> application_data,
const Application::LaunchParams& launch_params);
// Implementation of Application::Observer.
virtual void OnApplicationTerminated(Application* app) OVERRIDE;
- RuntimeContext* runtime_context_;
+ XWalkBrowserContext* browser_context_;
ScopedVector<Application> applications_;
ObserverList<Observer> observers_;
#include "xwalk/application/browser/application.h"
#include "xwalk/application/common/id_util.h"
#include "xwalk/application/common/tizen/application_storage.h"
-#include "xwalk/runtime/browser/runtime_context.h"
+#include "xwalk/runtime/browser/xwalk_browser_context.h"
namespace xwalk {
return base_path.Append(kApplicationDataDirName).Append(app_id);
}
-void CollectUnusedStoragePartitions(RuntimeContext* context,
+void CollectUnusedStoragePartitions(XWalkBrowserContext* context,
ApplicationStorage* storage) {
std::vector<std::string> app_ids;
if (!storage->GetInstalledApplicationIDs(app_ids))
} // namespace
ApplicationServiceTizen::ApplicationServiceTizen(
- RuntimeContext* runtime_context)
- : ApplicationService(runtime_context),
- application_storage_(new ApplicationStorage(runtime_context->GetPath())) {
- CollectUnusedStoragePartitions(runtime_context, application_storage_.get());
+ XWalkBrowserContext* browser_context)
+ : ApplicationService(browser_context),
+ application_storage_(new ApplicationStorage(browser_context->GetPath())) {
+ CollectUnusedStoragePartitions(browser_context, application_storage_.get());
}
ApplicationServiceTizen::~ApplicationServiceTizen() {
private:
friend class ApplicationService;
- explicit ApplicationServiceTizen(RuntimeContext* runtime_context);
+ explicit ApplicationServiceTizen(XWalkBrowserContext* browser_context);
// Note : do not export app storage from this class! We need consider
// making ApplicationSystemTizen (owning the storage) instead.
scoped_ptr<ApplicationStorage> application_storage_;
#include "xwalk/application/common/id_util.h"
#include "xwalk/application/extension/application_runtime_extension.h"
#include "xwalk/application/extension/application_widget_extension.h"
-#include "xwalk/runtime/browser/runtime_context.h"
+#include "xwalk/runtime/browser/xwalk_browser_context.h"
#include "xwalk/runtime/common/xwalk_switches.h"
#if defined(OS_LINUX)
namespace xwalk {
namespace application {
-ApplicationSystem::ApplicationSystem(RuntimeContext* runtime_context)
- : runtime_context_(runtime_context),
+ApplicationSystem::ApplicationSystem(XWalkBrowserContext* browser_context)
+ : browser_context_(browser_context),
application_service_(ApplicationService::Create(
- runtime_context)) {}
+ browser_context)) {}
ApplicationSystem::~ApplicationSystem() {
}
// static
scoped_ptr<ApplicationSystem> ApplicationSystem::Create(
- RuntimeContext* runtime_context) {
+ XWalkBrowserContext* browser_context) {
scoped_ptr<ApplicationSystem> app_system;
#if defined(OS_LINUX)
- app_system.reset(new ApplicationSystemLinux(runtime_context));
+ app_system.reset(new ApplicationSystemLinux(browser_context));
#else
- app_system.reset(new ApplicationSystem(runtime_context));
+ app_system.reset(new ApplicationSystem(browser_context));
#endif
return app_system.Pass();
}
}
namespace xwalk {
-class RuntimeContext;
+class XWalkBrowserContext;
}
namespace xwalk {
// The ApplicationSystem manages the creation and destruction of services which
// related to applications' runtime model.
// There's one-to-one correspondence between ApplicationSystem and
-// RuntimeContext.
+// XWalkBrowserContext.
class ApplicationSystem {
public:
virtual ~ApplicationSystem();
- static scoped_ptr<ApplicationSystem> Create(RuntimeContext* runtime_context);
+ static scoped_ptr<ApplicationSystem> Create(
+ XWalkBrowserContext* browser_context);
// The ApplicationService is created at startup.
ApplicationService* application_service() {
extensions::XWalkExtensionVector* extensions);
protected:
- explicit ApplicationSystem(RuntimeContext* runtime_context);
+ explicit ApplicationSystem(XWalkBrowserContext* browser_context);
private:
// Note: initialization order matters.
- RuntimeContext* runtime_context_;
+ XWalkBrowserContext* browser_context_;
scoped_ptr<ApplicationService> application_service_;
DISALLOW_COPY_AND_ASSIGN(ApplicationSystem);
namespace xwalk {
namespace application {
-ApplicationSystemLinux::ApplicationSystemLinux(RuntimeContext* runtime_context)
- : ApplicationSystem(runtime_context) {
+ApplicationSystemLinux::ApplicationSystemLinux(XWalkBrowserContext* context)
+ : ApplicationSystem(context) {
#if defined(SHARED_PROCESS_MODE)
service_provider_.reset(
new ApplicationServiceProviderLinux(application_service(),
class ApplicationSystemLinux : public ApplicationSystem {
public:
- explicit ApplicationSystemLinux(RuntimeContext* runtime_context);
+ explicit ApplicationSystemLinux(XWalkBrowserContext* browser_context);
virtual ~ApplicationSystemLinux();
DBusManager& dbus_manager();
#include "content/public/browser/screen_orientation_dispatcher_host.h"
#include "content/public/browser/screen_orientation_provider.h"
-#include "xwalk/runtime/browser/runtime_context.h"
+#include "xwalk/runtime/browser/xwalk_browser_context.h"
#include "xwalk/runtime/browser/runtime_url_request_context_getter.h"
#include "xwalk/runtime/browser/ui/native_app_window.h"
#include "xwalk/runtime/browser/ui/native_app_window_tizen.h"
return;
}
request_id_ = request_id;
- const std::set<Runtime*>& runtimes = app_->runtimes();
+ const std::vector<Runtime*>& runtimes = app_->runtimes();
DCHECK(!runtimes.empty());
// FIXME: Probably need better alignment with
// https://w3c.github.io/screen-orientation/#screen-orientation-lock-lifetime
- std::set<Runtime*>::iterator it = runtimes.begin();
- for (; it != runtimes.end(); ++it) {
+ for (auto it = runtimes.begin(); it != runtimes.end(); ++it) {
NativeAppWindow* window = (*it)->window();
if (window && window->IsActive()) {
ToNativeAppWindowTizen(window)->LockOrientation(lock);
ApplicationTizen::ApplicationTizen(
scoped_refptr<ApplicationData> data,
- RuntimeContext* runtime_context)
- : Application(data, runtime_context),
+ XWalkBrowserContext* browser_context)
+ : Application(data, browser_context),
#if defined(OS_TIZEN_MOBILE)
root_window_(NULL),
#endif
ui::PlatformEventSource::GetInstance()->AddPlatformEventObserver(this);
#endif
cookie_manager_ = scoped_ptr<CookieManager>(
- new CookieManager(id(), runtime_context_));
+ new CookieManager(id(), browser_context_));
}
ApplicationTizen::~ApplicationTizen() {
void ApplicationTizen::Hide() {
DCHECK(!runtimes_.empty());
- std::set<Runtime*>::iterator it = runtimes_.begin();
- for (; it != runtimes_.end(); ++it) {
+ for (auto it = runtimes_.begin(); it != runtimes_.end(); ++it) {
if ((*it)->window())
(*it)->window()->Minimize();
}
render_process_host_->Send(new ViewMsg_SuspendJSEngine(true));
DCHECK(!runtimes_.empty());
- std::set<Runtime*>::iterator it = runtimes_.begin();
- for (; it != runtimes_.end(); ++it) {
+ for (auto it = runtimes_.begin(); it != runtimes_.end(); ++it) {
if ((*it)->web_contents())
(*it)->web_contents()->WasHidden();
}
render_process_host_->Send(new ViewMsg_SuspendJSEngine(false));
DCHECK(!runtimes_.empty());
- std::set<Runtime*>::iterator it = runtimes_.begin();
- for (; it != runtimes_.end(); ++it) {
+ for (auto it = runtimes_.begin(); it != runtimes_.end(); ++it) {
if ((*it)->web_contents())
(*it)->web_contents()->WasShown();
}
if (info && !info->hwkey_enabled())
return;
- for (std::set<xwalk::Runtime*>::iterator it = runtimes_.begin();
+ for (auto it = runtimes_.begin();
it != runtimes_.end(); ++it) {
(*it)->web_contents()->GetRenderViewHost()->Send(new ViewMsg_HWKeyPressed(
(*it)->web_contents()->GetRoutingID(), key_event->key_code()));
cookie_manager_->SetUserAgentString(render_process_host_, user_agent_string);
}
-void ApplicationTizen::OnRuntimeAdded(Runtime* runtime) {
+void ApplicationTizen::OnNewRuntimeAdded(Runtime* runtime) {
DCHECK(runtime);
- Application::OnRuntimeAdded(runtime);
+ Application::OnNewRuntimeAdded(runtime);
#if defined(OS_TIZEN_MOBILE)
if (root_window_ && runtimes_.size() > 1)
root_window_->Show();
#endif
}
-void ApplicationTizen::OnRuntimeRemoved(Runtime* runtime) {
+void ApplicationTizen::OnRuntimeClosed(Runtime* runtime) {
DCHECK(runtime);
- Application::OnRuntimeRemoved(runtime);
+ Application::OnRuntimeClosed(runtime);
#if defined(OS_TIZEN_MOBILE)
if (runtimes_.empty() && root_window_) {
root_window_->Close();
private:
friend class Application;
ApplicationTizen(scoped_refptr<ApplicationData> data,
- RuntimeContext* context);
+ XWalkBrowserContext* context);
virtual bool Launch(const LaunchParams& launch_params) OVERRIDE;
virtual base::FilePath GetSplashScreenPath() OVERRIDE;
// Runtime::Observer implementation.
- virtual void OnRuntimeAdded(Runtime* runtime) OVERRIDE;
- virtual void OnRuntimeRemoved(Runtime* runtime) OVERRIDE;
+ virtual void OnNewRuntimeAdded(Runtime* runtime) OVERRIDE;
+ virtual void OnRuntimeClosed(Runtime* runtime) OVERRIDE;
#if defined(USE_OZONE)
virtual void WillProcessEvent(const ui::PlatformEvent& event) OVERRIDE;
} // namespace application_widget_keys
+const char kW3CNamespaceKey[] = "widget.@namespace";
const char kW3CNamespacePrefix[] = "http://www.w3.org/ns/widgets";
#if defined(OS_TIZEN)
const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
#endif
} // namespace application_widget_keys
+extern const char kW3CNamespaceKey[];
extern const char kW3CNamespacePrefix[];
#if defined(OS_TIZEN)
extern const char kTizenNamespacePrefix[];
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright (c) 2014 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 <string>
#include "base/basictypes.h"
#include "xwalk/application/common/id_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace xwalk {
namespace application {
+namespace {
+
+std::string MakePlatformId(const std::string& arg) {
+#if defined(OS_TIZEN)
+ return "xwalk." + arg;
+#else
+ return arg;
+#endif
+}
+
+} // namespace
+
TEST(IDUtilTest, GenerateID) {
const uint8 public_key_info[] = {
0x30, 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
std::string application_id = GenerateId(
std::string(reinterpret_cast<const char*>(&public_key_info[0]),
arraysize(public_key_info)));
- EXPECT_EQ("melddjfinppjdikinhbgehiennejpfhp", application_id);
- EXPECT_EQ("jpignaibiiemhngfjkcpokkamffknabf", GenerateId("test"));
+ EXPECT_EQ(MakePlatformId("melddjfinppjdikinhbgehiennejpfhp"),
+ application_id);
- EXPECT_EQ("ncocknphbhhlhkikpnnlmbcnbgdempcd", GenerateId("_"));
+ EXPECT_EQ(MakePlatformId("jpignaibiiemhngfjkcpokkamffknabf"),
+ GenerateId("test"));
- EXPECT_EQ("jimneklojkjdibfkgiiophfhjhbdgcfi",
- GenerateId(
- "this_string_is_longer_than_a_single_sha256_hash_digest"));
+ EXPECT_EQ(MakePlatformId("ncocknphbhhlhkikpnnlmbcnbgdempcd"),
+ GenerateId("_"));
+
+ EXPECT_EQ(MakePlatformId("jimneklojkjdibfkgiiophfhjhbdgcfi"),
+ GenerateId("this_string_is_longer_than_a_single_sha256_hash_digest"));
}
TEST(IDUtilTest, IsValidApplicationID) {
- EXPECT_TRUE(IsValidApplicationID("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
- EXPECT_TRUE(IsValidApplicationID("pppppppppppppppppppppppppppppppp"));
- EXPECT_TRUE(IsValidApplicationID("abcdefghijklmnopabcdefghijklmnop"));
- EXPECT_TRUE(IsValidApplicationID("ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP"));
- EXPECT_FALSE(IsValidApplicationID("abcdefghijklmnopabcdefghijklmno"));
- EXPECT_FALSE(IsValidApplicationID("abcdefghijklmnopabcdefghijklmnopa"));
- EXPECT_FALSE(IsValidApplicationID("0123456789abcdef0123456789abcdef"));
- EXPECT_FALSE(IsValidApplicationID("abcdefghijklmnopabcdefghijklmnoq"));
- EXPECT_FALSE(IsValidApplicationID("abcdefghijklmnopabcdefghijklmno0"));
+ EXPECT_TRUE(IsValidApplicationID(
+ MakePlatformId("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")));
+ EXPECT_TRUE(IsValidApplicationID(
+ MakePlatformId("pppppppppppppppppppppppppppppppp")));
+ EXPECT_TRUE(IsValidApplicationID(
+ MakePlatformId("abcdefghijklmnopabcdefghijklmnop")));
+ EXPECT_FALSE(IsValidApplicationID(
+ MakePlatformId("abcdefghijklmnopabcdefghijklmno")));
+ EXPECT_FALSE(IsValidApplicationID(
+ MakePlatformId("abcdefghijklmnopabcdefghijklmnopa")));
+ EXPECT_FALSE(IsValidApplicationID(
+ MakePlatformId("0123456789abcdef0123456789abcdef")));
+ EXPECT_FALSE(IsValidApplicationID(
+ MakePlatformId("abcdefghijklmnopabcdefghijklmnoq")));
+ EXPECT_FALSE(IsValidApplicationID(
+ MakePlatformId("abcdefghijklmnopabcdefghijklmno0")));
+
+// For Tizen platform upper case letters in application id are not allowed
+// so we expect false unlike in the other platforms that accept them.
+#if defined(OS_TIZEN)
+ EXPECT_FALSE(IsValidApplicationID(
+ MakePlatformId("ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP")));
+#else
+ EXPECT_TRUE(IsValidApplicationID(
+ MakePlatformId("ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP")));
+#endif
+
+#if defined(OS_TIZEN)
+ EXPECT_FALSE(IsValidApplicationID("abcdefghijklmnopabcdefghijklmnop"));
+#endif
}
} // namespace application
// Copyright (c) 2014 Intel Corporation. All rights reserved.
+// Copyright (c) 2014 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 "xwalk/application/common/manifest_handlers/tizen_navigation_handler.h"
-
#include <string>
#include <vector>
#include "base/memory/scoped_ptr.h"
+#include "testing/gtest/include/gtest/gtest.h"
#include "xwalk/application/common/application_manifest_constants.h"
#include "xwalk/application/common/manifest.h"
#include "xwalk/application/common/manifest_handlers/unittest_util.h"
-#include "testing/gtest/include/gtest/gtest.h"
+#include "xwalk/application/common/manifest_handlers/tizen_navigation_handler.h"
namespace xwalk {
};
TEST_F(TizenNavigationHandlerTest, NoNavigation) {
- scoped_ptr<base::DictionaryValue> manifest = CreateDefaultWGTManifest();
- scoped_refptr<ApplicationData> application = CreateApplication(*manifest);
+ scoped_ptr<base::DictionaryValue> manifest = CreateDefaultWidgetConfig();
+ scoped_refptr<ApplicationData> application =
+ CreateApplication(Manifest::TYPE_WIDGET, *manifest);
EXPECT_TRUE(application.get());
EXPECT_FALSE(GetNavigationInfo(application));
}
TEST_F(TizenNavigationHandlerTest, OneNavigation) {
- scoped_ptr<base::DictionaryValue> manifest = CreateDefaultWGTManifest();
+ scoped_ptr<base::DictionaryValue> manifest = CreateDefaultWidgetConfig();
manifest->SetString(keys::kAllowNavigationKey, "http://www.sample.com");
- scoped_refptr<ApplicationData> application = CreateApplication(*manifest);
+ scoped_refptr<ApplicationData> application =
+ CreateApplication(Manifest::TYPE_WIDGET, *manifest);
EXPECT_TRUE(application.get());
EXPECT_EQ(application->GetManifest()->type(), Manifest::TYPE_WIDGET);
const TizenNavigationInfo* info = GetNavigationInfo(application);
}
TEST_F(TizenNavigationHandlerTest, Navigations) {
- scoped_ptr<base::DictionaryValue> manifest = CreateDefaultWGTManifest();
+ scoped_ptr<base::DictionaryValue> manifest = CreateDefaultWidgetConfig();
manifest->SetString(keys::kAllowNavigationKey,
"http://www.sample1.com www.sample2.com");
- scoped_refptr<ApplicationData> application = CreateApplication(*manifest);
+ scoped_refptr<ApplicationData> application =
+ CreateApplication(Manifest::TYPE_WIDGET, *manifest);
EXPECT_TRUE(application.get());
EXPECT_EQ(application->GetManifest()->type(), Manifest::TYPE_WIDGET);
const TizenNavigationInfo* info = GetNavigationInfo(application);
#include <string>
#include "xwalk/application/common/application_manifest_constants.h"
-#include "xwalk/application/common/manifest.h"
namespace xwalk {
-namespace keys = application_widget_keys;
+namespace manifest_keys = application_manifest_keys;
+namespace widget_keys = application_widget_keys;
namespace application {
} // namespace
-scoped_ptr<base::DictionaryValue> CreateDefaultW3CManifest() {
+scoped_ptr<base::DictionaryValue> CreateDefaultManifestConfig() {
scoped_ptr<base::DictionaryValue> manifest(new base::DictionaryValue());
- // widget attributes
+ manifest->SetString(manifest_keys::kXWalkVersionKey, kDefaultVersion);
+ manifest->SetString(manifest_keys::kNameKey, kDefaultName);
- manifest->SetString(
- DotConnect(keys::kWidgetKey, keys::kNamespaceKey),
- kW3CNamespacePrefix);
+ return manifest.Pass();
+}
- manifest->SetString(keys::kVersionKey, kDefaultVersion);
+scoped_ptr<base::DictionaryValue> CreateDefaultWidgetConfig() {
+ scoped_ptr<base::DictionaryValue> manifest(new base::DictionaryValue());
- manifest->SetString(keys::kNameKey, kDefaultName);
+ // widget attributes
- return manifest.Pass();
-}
+ manifest->SetString(
+ DotConnect(widget_keys::kWidgetKey, widget_keys::kNamespaceKey),
+ kW3CNamespacePrefix);
+ manifest->SetString(widget_keys::kVersionKey, kDefaultVersion);
+ manifest->SetString(widget_keys::kNameKey, kDefaultName);
#if defined(OS_TIZEN)
-scoped_ptr<base::DictionaryValue> CreateDefaultWGTManifest() {
- scoped_ptr<base::DictionaryValue> manifest(CreateDefaultW3CManifest());
-
// widget.application attributes
manifest->SetString(
- DotConnect(keys::kTizenApplicationKey,
- keys::kNamespaceKey),
+ DotConnect(widget_keys::kTizenApplicationKey,
+ widget_keys::kNamespaceKey),
kTizenNamespacePrefix);
-
manifest->SetString(
- DotConnect(keys::kTizenApplicationKey,
- keys::kTizenApplicationIdKey),
+ DotConnect(widget_keys::kTizenApplicationKey,
+ widget_keys::kTizenApplicationIdKey),
DotConnect(kDefaultPackageId, kDefaultApplicationName));
-
manifest->SetString(
- DotConnect(keys::kTizenApplicationKey,
- keys::kTizenApplicationPackageKey),
+ DotConnect(widget_keys::kTizenApplicationKey,
+ widget_keys::kTizenApplicationPackageKey),
kDefaultPackageId);
-
manifest->SetString(
- DotConnect(keys::kTizenApplicationKey,
- keys::kTizenApplicationRequiredVersionKey),
+ DotConnect(widget_keys::kTizenApplicationKey,
+ widget_keys::kTizenApplicationRequiredVersionKey),
kDefaultRequiredVersion);
+#endif
+
return manifest.Pass();
}
-#endif // defined(OS_TIZEN)
-
-scoped_refptr<ApplicationData> CreateApplication(
+scoped_refptr<ApplicationData> CreateApplication(Manifest::Type type,
const base::DictionaryValue& manifest) {
std::string error;
scoped_refptr<ApplicationData> application = ApplicationData::Create(
base::FilePath(), std::string(), ApplicationData::LOCAL_DIRECTORY,
- make_scoped_ptr(new Manifest(make_scoped_ptr(manifest.DeepCopy()),
- Manifest::TYPE_WIDGET)),
+ make_scoped_ptr(new Manifest(make_scoped_ptr(manifest.DeepCopy()), type)),
&error);
return application;
}
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "xwalk/application/common/application_data.h"
+#include "xwalk/application/common/manifest.h"
namespace xwalk {
namespace application {
-scoped_ptr<base::DictionaryValue> CreateDefaultW3CManifest();
+scoped_ptr<base::DictionaryValue> CreateDefaultManifestConfig();
+scoped_ptr<base::DictionaryValue> CreateDefaultWidgetConfig();
-#if defined(OS_TIZEN)
-
-scoped_ptr<base::DictionaryValue> CreateDefaultWGTManifest();
-
-#endif // defined(OS_TIZEN)
-
-scoped_refptr<ApplicationData> CreateApplication(
+scoped_refptr<ApplicationData> CreateApplication(Manifest::Type type,
const base::DictionaryValue& manifest);
} // namespace application
// Copyright (c) 2013 Intel Corporation. All rights reserved.
+// Copyright (c) 2014 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 "xwalk/application/common/manifest_handlers/warp_handler.h"
-
+#include "base/memory/scoped_ptr.h"
#include "xwalk/application/common/application_manifest_constants.h"
+#include "xwalk/application/common/manifest_handlers/unittest_util.h"
+#include "xwalk/application/common/manifest_handlers/warp_handler.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace xwalk {
namespace application {
+namespace {
+
+const WARPInfo* GetWARPInfo(
+ scoped_refptr<ApplicationData> application) {
+ const WARPInfo* info = static_cast<WARPInfo*>(
+ application->GetManifestData(keys::kAccessKey));
+ return info;
+}
+
+} // namespace
+
class WARPHandlerTest: public testing::Test {
- public:
- virtual void SetUp() OVERRIDE {
- manifest.SetString(keys::kNameKey, "no name");
- manifest.SetString(keys::kVersionKey, "0");
- }
-
- scoped_refptr<ApplicationData> CreateApplication() {
- std::string error;
- scoped_refptr<ApplicationData> application = ApplicationData::Create(
- base::FilePath(), std::string(), ApplicationData::LOCAL_DIRECTORY,
- make_scoped_ptr(new Manifest(make_scoped_ptr(manifest.DeepCopy()),
- Manifest::TYPE_WIDGET)),
- &error);
- return application;
- }
-
- const WARPInfo* GetWARPInfo(
- scoped_refptr<ApplicationData> application) {
- const WARPInfo* info = static_cast<WARPInfo*>(
- application->GetManifestData(keys::kAccessKey));
- return info;
- }
-
- base::DictionaryValue manifest;
};
// FIXME: the default WARP policy settings in WARP manifest handler
// are temporally removed, since they had affected some tests and legacy apps.
TEST_F(WARPHandlerTest, NoWARP) {
- scoped_refptr<ApplicationData> application = CreateApplication();
+ scoped_ptr<base::DictionaryValue> manifest = CreateDefaultWidgetConfig();
+ scoped_refptr<ApplicationData> application =
+ CreateApplication(Manifest::TYPE_WIDGET, *manifest);
EXPECT_TRUE(application.get());
EXPECT_FALSE(GetWARPInfo(application));
}
base::DictionaryValue* warp = new base::DictionaryValue;
warp->SetString(keys::kAccessOriginKey, "http://www.sample.com");
warp->SetBoolean(keys::kAccessSubdomainsKey, true);
- manifest.Set(keys::kAccessKey, warp);
- scoped_refptr<ApplicationData> application = CreateApplication();
+ scoped_ptr<base::DictionaryValue> manifest = CreateDefaultWidgetConfig();
+ manifest->Set(keys::kAccessKey, warp);
+ scoped_refptr<ApplicationData> application =
+ CreateApplication(Manifest::TYPE_WIDGET, *manifest);
EXPECT_TRUE(application.get());
- EXPECT_EQ(application->manifest_type(), Manifest::TYPE_WIDGET);
const WARPInfo* info = GetWARPInfo(application);
EXPECT_TRUE(info);
scoped_ptr<base::ListValue> list(info->GetWARP()->DeepCopy());
base::ListValue* warp_list = new base::ListValue;
warp_list->Append(warp1);
warp_list->Append(warp2);
- manifest.Set(keys::kAccessKey, warp_list);
- scoped_refptr<ApplicationData> application = CreateApplication();
+ scoped_ptr<base::DictionaryValue> manifest = CreateDefaultWidgetConfig();
+ manifest->Set(keys::kAccessKey, warp_list);
+ scoped_refptr<ApplicationData> application =
+ CreateApplication(Manifest::TYPE_WIDGET, *manifest);
EXPECT_TRUE(application.get());
- EXPECT_EQ(application->manifest_type(), Manifest::TYPE_WIDGET);
const WARPInfo* info = GetWARPInfo(application);
EXPECT_TRUE(info);
return true;
}
+bool WidgetHandler::Validate(
+ scoped_refptr<const ApplicationData> application,
+ std::string* error) const {
+ const Manifest* manifest = application->GetManifest();
+ DCHECK(manifest);
+ std::string ns_value;
+ manifest->GetString(kW3CNamespaceKey, &ns_value);
+ if (base::strcasecmp(kW3CNamespacePrefix, ns_value.c_str()) != 0) {
+ *error = std::string("The widget namespace is invalid.");
+ return false;
+ }
+ return true;
+}
+
bool WidgetHandler::AlwaysParseForType(Manifest::Type type) const {
return true;
}
virtual bool AlwaysParseForType(Manifest::Type type) const OVERRIDE;
virtual std::vector<std::string> Keys() const OVERRIDE;
+ virtual bool Validate(scoped_refptr<const ApplicationData> application,
+ std::string* error) const OVERRIDE;
+
private:
DISALLOW_COPY_AND_ASSIGN(WidgetHandler);
};
// No Preferences and full other information
void SetAllInfoToManifest(base::DictionaryValue* manifest) {
// Insert some key-value pairs into manifest use full key
+ manifest->SetString(kW3CNamespaceKey, kW3CNamespacePrefix);
manifest->SetString(keys::kAuthorKey, author);
manifest->SetString(keys::kDescriptionKey, decription);
manifest->SetString(keys::kNameKey, name);
TEST_F(WidgetHandlerTest, ParseManifestWithOnlyNameAndVersion) {
base::DictionaryValue manifest;
+ manifest.SetString(kW3CNamespaceKey, kW3CNamespacePrefix);
manifest.SetString(keys::kNameKey, "no name");
manifest.SetString(keys::kVersionKey, "0");
#include <string>
#include <vector>
+#include "base/macros.h"
#include "base/file_util.h"
#include "third_party/re2/re2/re2.h"
#include "xwalk/application/common/application_file_util.h"
return AIL_CB_RET_CONTINUE;
}
-const char kXWalkPackageType[] = "wgt";
+const char* kXWalkPackageTypes[] = {"wgt", "xpk"};
bool GetPackageType(const std::string& application_id,
xwalk::application::Manifest::Type* package_type) {
bool ApplicationStorageImpl::GetInstalledApplicationIDs(
std::vector<std::string>& app_ids) { // NOLINT
- ail_filter_h filter;
- int count;
uid_t uid = getuid();
- ail_error_e ret = ail_filter_new(&filter);
- if (ret != AIL_ERROR_OK) {
- LOG(ERROR) << "Failed to create AIL filter.";
- return false;
- }
- // Filters out web apps (installed from WGT and XPK packages).
- ret = ail_filter_add_str(
- filter, AIL_PROP_X_SLP_PACKAGETYPE_STR, kXWalkPackageType);
- if (ret != AIL_ERROR_OK) {
- LOG(ERROR) << "Failed to init AIL filter.";
- ail_filter_destroy(filter);
- return false;
- }
+ for (size_t i = 0; i < arraysize(kXWalkPackageTypes); ++i) {
+ int count = 0;
+ ail_filter_h filter;
+ ail_error_e ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ LOG(ERROR) << "Failed to create AIL filter.";
+ return false;
+ }
+ // Filters out web apps (installed from WGT and XPK packages).
+ ret = ail_filter_add_str(
+ filter, AIL_PROP_X_SLP_PACKAGETYPE_STR, kXWalkPackageTypes[i]);
+ if (ret != AIL_ERROR_OK) {
+ LOG(ERROR) << "Failed to init AIL filter.";
+ ail_filter_destroy(filter);
+ return false;
+ }
- if (uid != GLOBAL_USER)
- ret = ail_filter_count_usr_appinfo(filter, &count, uid);
- else
- ret = ail_filter_count_appinfo(filter, &count);
-
- if (ret != AIL_ERROR_OK) {
- LOG(ERROR) << "Failed to count AIL app info.";
- ail_filter_destroy(filter);
- return false;
- }
-
- if (count > 0) {
if (uid != GLOBAL_USER)
- ail_filter_list_usr_appinfo_foreach(filter, appinfo_get_app_id_cb,
- &app_ids, uid);
+ ret = ail_filter_count_usr_appinfo(filter, &count, uid);
else
- ail_filter_list_appinfo_foreach(filter, appinfo_get_app_id_cb, &app_ids);
+ ret = ail_filter_count_appinfo(filter, &count);
+
+ if (ret != AIL_ERROR_OK) {
+ LOG(ERROR) << "Failed to count AIL app info.";
+ ail_filter_destroy(filter);
+ return false;
+ }
+
+ if (count > 0) {
+ if (uid != GLOBAL_USER)
+ ail_filter_list_usr_appinfo_foreach(filter, appinfo_get_app_id_cb,
+ &app_ids, uid);
+ else
+ ail_filter_list_appinfo_foreach(
+ filter, appinfo_get_app_id_cb, &app_ids);
+ }
+
+ ail_filter_destroy(filter);
}
- ail_filter_destroy(filter);
return true;
}
CookieManager::CookieManager(
const std::string& app_id,
- RuntimeContext* runtime_context)
+ XWalkBrowserContext* browser_context)
: app_id_(app_id),
- runtime_context_(runtime_context) {
+ browser_context_(browser_context) {
}
void CookieManager::CookieDeleted(bool success) {
void CookieManager::DeleteSessionOnlyOriginCookies(
const net::CookieList& cookies) {
- net::URLRequestContext* request_context = runtime_context_->
+ net::URLRequestContext* request_context = browser_context_->
GetURLRequestContextGetterById(
std::string(app_id_))->GetURLRequestContext();
if (!request_context)
const std::string& url,
const std::string& cookie_name) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
- net::URLRequestContext* request_context = runtime_context_->
+ net::URLRequestContext* request_context = browser_context_->
GetURLRequestContextGetterById(app_id_)->GetURLRequestContext();
net::CookieStore* cookie_store = request_context->cookie_store();
cookie_store->GetCookieMonster()->GetAllCookiesAsync(
#include "net/cookies/canonical_cookie.h"
-#include "xwalk/runtime/browser/runtime_context.h"
+#include "xwalk/runtime/browser/xwalk_browser_context.h"
namespace xwalk {
class CookieManager {
public:
- CookieManager(const std::string& app_id, RuntimeContext* runtime_context);
+ CookieManager(const std::string& app_id,
+ XWalkBrowserContext* browser_context);
void RemoveAllCookies();
void SetUserAgentString(content::RenderProcessHost* render_process_host,
const std::string& user_agent_string);
const std::string& cookie_name);
const std::string app_id_;
- RuntimeContext* runtime_context_;
+ XWalkBrowserContext* browser_context_;
};
} // namespace xwalk
#include "xwalk/application/common/manifest_handlers/widget_handler.h"
#include "xwalk/application/extension/application_widget_storage.h"
#include "xwalk/runtime/browser/runtime.h"
-#include "xwalk/runtime/browser/runtime_context.h"
+#include "xwalk/runtime/browser/xwalk_browser_context.h"
#include "xwalk/runtime/browser/xwalk_runner.h"
#include "xwalk/runtime/common/xwalk_paths.h"
{
- 'targets': [
+ 'targets': [
{
'target_name': 'xwalk_launcher',
'type': 'executable',
],
'dependencies': [
'../../../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
+ '../../../build/system.gyp:gio',
'../../../extensions/extensions.gyp:xwalk_extensions',
'../../../application/common/xwalk_application_common.gypi:xwalk_application_common_lib',
],
'xwalk_launcher_main.cc',
],
'conditions' : [
- ['OS=="linux"', {
- 'dependencies': [
- '../../../build/system.gyp:gio',
- ],
- }],
['tizen==1', {
'dependencies': [
- '../../../build/system.gyp:gio',
'../../../build/system.gyp:tizen',
'../../../build/system.gyp:tizen_appcore_common'
],
#endif
#if defined(OS_TIZEN)
- if (xwalk_tizen_check_user_app())
+ if (xwalk_tizen_check_group_users())
exit(1);
#endif
#include "base/path_service.h"
#include "xwalk/application/common/tizen/application_storage.h"
-#include "xwalk/application/tools/tizen/xwalk_tizen_user.h"
#include "xwalk/runtime/common/xwalk_paths.h"
#include "dbus/bus.h"
#include "dbus/message.h"
#include "dbus/object_proxy.h"
+#if defined(OS_TIZEN)
+#include "xwalk/application/tools/tizen/xwalk_tizen_user.h"
+#endif
+
using xwalk::application::ApplicationData;
using xwalk::application::ApplicationStorage;
int main(int argc, char* argv[]) {
#if defined(OS_TIZEN)
- if (xwalk_tizen_check_user_for_xwalkctl())
- exit(1);
+ if (xwalk_tizen_check_group_users())
+ return 1;
#endif
GOptionContext* context = g_option_context_new("- Crosswalk Setter");
g_option_context_add_main_entries(context, entries, NULL);
if (!g_option_context_parse(context, &argc, &argv, &error)) {
g_print("option parsing failed: %s\n", error->message);
g_option_context_free(context);
- exit(1);
+ return 1;
}
g_option_context_free(context);
base::AtExitManager at_exit;
if (debugging_port != debugging_port_not_set) {
if (!EnableRemoteDebugging(static_cast<int>(debugging_port)))
- exit(1);
+ return 1;
} else {
// FIXME : there should be a way to get application Id from platform, so
// the below code should not be needed.
PathService::Get(xwalk::DIR_DATA_PATH, &data_path);
scoped_ptr<ApplicationStorage> storage(new ApplicationStorage(data_path));
if (!list_applications(storage.get()))
- exit(1);
+ return 1;
}
return 0;
g_type_init();
#endif
- if (xwalk_tizen_check_user_for_xwalkctl())
- exit(1);
+ if (xwalk_tizen_check_user_for_xwalk_backend())
+ return 1;
context = g_option_context_new("- Crosswalk Application Management");
if (!context) {
g_print("g_option_context_new failed\n");
- exit(1);
+ return 1;
}
g_option_context_add_main_entries(context, entries, NULL);
if (!g_option_context_parse(context, &argc, &argv, &error)) {
g_print("option parsing failed: %s\n", error->message);
g_option_context_free(context);
- exit(1);
+ return 1;
}
g_option_context_free(context);
'../../../application/common/xwalk_application_common.gypi:xwalk_application_common_lib',
'../../../build/system.gyp:gio',
'../../../build/system.gyp:tizen',
+ '../../../build/system.gyp:tizen_tzplatform_config',
],
'include_dirs': [
'../../../..',
#include <tzplatform_config.h>
-int xwalk_tizen_check_user_app(void) {
+int xwalk_tizen_check_group_users(void) {
char* buffer = NULL;
int err = 0;
struct group grp;
free(buffer);
return -EINVAL;
}
+
if ((!current_g) ||
- (strcmp(current_g->gr_name, "users") &&
- strcmp(current_g->gr_name, "app"))) {
- fprintf(stderr, "group '%s' is not allowed :",
- current_g ? current_g->gr_name : "<NULL>");
- fprintf(stderr, "launching an application will not work\n");
- free(buffer);
- return -EINVAL;
+ strcmp(current_g->gr_name, "users")) {
+ fprintf(stderr, "group '%s' is not allowed :",
+ current_g ? current_g->gr_name : "<NULL>");
+ fprintf(stderr, "launching an application will not work\n");
+ free(buffer);
+ return -EINVAL;
}
return 0;
}
-int xwalk_tizen_check_user_for_xwalkctl(void) {
+int xwalk_tizen_check_user_for_xwalk_backend(void) {
char* buffer = NULL;
int err = 0;
struct group grp;
free(buffer);
return -EINVAL;
}
- if ((!current_g) ||
- (strcmp(current_g->gr_name, "users") &&
- strcmp(current_g->gr_name, "app") &&
- (strcmp(current_g->gr_name, "root") &&
- getuid() == tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)))) {
+
+ if ((!current_g) || (
+ strcmp(current_g->gr_name, "users") &&
+ getuid() != tzplatform_getuid(TZ_SYS_GLOBALAPP_USER))) {
fprintf(stderr, "group '%s' is not allowed :",
current_g ? current_g->gr_name : "<NULL>");
fprintf(stderr, "launching an application will not work\n");
// causes applications connecting to the session D-Bus bus to fail, for example.
// This is a Tizen specific workaround.
-int xwalk_tizen_check_user_app(void);
-int xwalk_tizen_check_user_for_xwalkctl(void);
+int xwalk_tizen_check_group_users(void);
+int xwalk_tizen_check_user_for_xwalk_backend(void);
#endif // XWALK_APPLICATION_TOOLS_TIZEN_XWALK_TIZEN_USER_H_
['tizen==1', {
'targets': [
{
+ 'target_name': 'tizen_tzplatform_config',
+ 'type': 'none',
+ 'variables': {
+ 'packages': [
+ 'libtzplatform-config',
+ ],
+ },
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(pkg-config --cflags <@(packages))',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(pkg-config --libs-only-L --libs-only-other <@(packages))',
+ ],
+ 'libraries': [
+ '<!@(pkg-config --libs-only-l <@(packages))',
+ ],
+ },
+ },
+ {
'target_name': 'tizen_geolocation',
'type': 'none',
'variables': {
'type': 'none',
'variables': {
'packages': [
- 'libtzplatform-config',
'ail',
'dlog',
'nss',
const base::string16 passString = base::ASCIIToUTF16("Pass");
const base::string16 failString = base::ASCIIToUTF16("Fail");
- content::RunAllPendingInMessageLoop();
- content::TitleWatcher title_watcher(runtime()->web_contents(), passString);
+ xwalk::Runtime* runtime = CreateRuntime();
+ content::TitleWatcher title_watcher(runtime->web_contents(), passString);
title_watcher.AlsoWaitForTitle(failString);
#if defined(OS_LINUX)
.Append(FILE_PATH_LITERAL("native_file_system"))
.Append(FILE_PATH_LITERAL("native_file_system_api_browsertest.html"));
- xwalk_test_utils::NavigateToURL(runtime(), net::FilePathToFileURL(test_file));
+ xwalk_test_utils::NavigateToURL(runtime, net::FilePathToFileURL(test_file));
EXPECT_EQ(passString, title_watcher.WaitAndGetTitle());
}
#include "xwalk/extensions/common/xwalk_extension.h"
-#include <string.h>
-
#include "base/logging.h"
namespace xwalk {
XWalkExtension::~XWalkExtension() {}
-const base::ListValue& XWalkExtension::entry_points() const {
+const std::vector<std::string>& XWalkExtension::entry_points() const {
return entry_points_;
}
// Returns a list of entry points for which the extension should be loaded
// when accessed. Entry points are used when the extension needs to have
// objects outside the namespace that is implicitly created using its name.
- virtual const base::ListValue& entry_points() const;
+ virtual const std::vector<std::string>& entry_points() const;
void set_permissions_delegate(XWalkExtension::PermissionsDelegate* delegate) {
permissions_delegate_ = delegate;
javascript_api_ = javascript_api;
}
void set_entry_points(const std::vector<std::string>& entry_points) {
- entry_points_.AppendStrings(entry_points);
+ entry_points_.insert(entry_points_.end(), entry_points.begin(),
+ entry_points.end());
}
private:
// message passing.
std::string javascript_api_;
- // FIXME(jeez): convert this to std::vector<std::string> to avoid
- // extra conversions later on.
- base::ListValue entry_points_;
+ std::vector<std::string> entry_points_;
// Permission check delegate for both in and out of process extensions.
PermissionsDelegate* permissions_delegate_;
return false;
}
- const base::ListValue& entry_points = extension->entry_points();
- base::ListValue::const_iterator it = entry_points.begin();
+ const std::vector<std::string>& entry_points = extension->entry_points();
- for (; it != entry_points.end(); ++it) {
- std::string entry_point;
- (*it)->GetAsString(&entry_point);
+ for (const std::string& entry_point : entry_points) {
extension_symbols_.insert(entry_point);
}
}
bool XWalkExtensionServer::ValidateExtensionEntryPoints(
- const base::ListValue& entry_points) {
- base::ListValue::const_iterator it = entry_points.begin();
-
- for (; it != entry_points.end(); ++it) {
- std::string entry_point;
-
- (*it)->GetAsString(&entry_point);
-
+ const std::vector<std::string>& entry_points) {
+ for (const std::string& entry_point : entry_points) {
if (!ValidateExtensionIdentifier(entry_point))
return false;
extension_parameters.name = extension->name();
extension_parameters.js_api = extension->javascript_api();
- const base::ListValue& entry_points = extension->entry_points();
- base::ListValue::const_iterator entry_it = entry_points.begin();
- for (; entry_it != entry_points.end(); ++entry_it) {
- std::string entry_point;
- (*entry_it)->GetAsString(&entry_point);
+ const std::vector<std::string>& entry_points = extension->entry_points();
+ for (const std::string& entry_point : entry_points) {
extension_parameters.entry_points.push_back(entry_point);
}
void DeleteInstanceMap();
- bool ValidateExtensionEntryPoints(const base::ListValue& entry_points);
+ bool ValidateExtensionEntryPoints(
+ const std::vector<std::string>& entry_points);
base::Lock sender_lock_;
IPC::Sender* sender_;
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
+using xwalk::Runtime;
using xwalk::extensions::XWalkExtensionService;
class BadExtensionTest : public XWalkExtensionsTestBase {
};
IN_PROC_BROWSER_TEST_F(BadExtensionTest, DoNotCrash) {
- content::RunAllPendingInMessageLoop();
LOG(WARNING) << "This test will produce a lot warnings which are expected."
<< " The goal is to not crash.";
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("bad.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ Runtime* runtime = CreateRuntime();
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
IN_PROC_BROWSER_TEST_F(BadExtensionTest, NavigateDoNotCrash) {
- content::RunAllPendingInMessageLoop();
LOG(WARNING) << "This test will produce a lot warnings which are expected."
<< " The goal is to not crash.";
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("bad.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ Runtime* runtime = CreateRuntime();
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
for (int i = 0; i < 5; i++) {
- xwalk_test_utils::NavigateToURL(runtime(), url);
- WaitForLoadStop(runtime()->web_contents());
+ xwalk_test_utils::NavigateToURL(runtime, url);
+ WaitForLoadStop(runtime->web_contents());
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
}
#include "xwalk/test/base/xwalk_test_utils.h"
using namespace xwalk::extensions; // NOLINT
+using xwalk::Runtime;
namespace {
IN_PROC_BROWSER_TEST_F(XWalkExtensionsConflictsWithNameTest,
OnlyCleanInstanceLoaded) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(
base::FilePath(),
base::FilePath().AppendASCII("conflicting_names.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
EXPECT_TRUE(g_clean_extension_loaded);
IN_PROC_BROWSER_TEST_F(XWalkExtensionsConflictsWithEntryPointTest,
OnlyCleanInstanceLoaded) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(
base::FilePath(),
base::FilePath().AppendASCII("conflicting_names.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
EXPECT_TRUE(g_clean_extension_loaded);
#include "xwalk/test/base/xwalk_test_utils.h"
using namespace xwalk::extensions; // NOLINT
+using xwalk::Runtime;
namespace {
IN_PROC_BROWSER_TEST_F(XWalkExtensionsContextDestructionTest,
ContextIsDestroyedWhenNavigating) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("context_destruction.html"));
{
- content::TitleWatcher title_watcher(runtime()->web_contents(), kFailString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kFailString);
title_watcher.AlsoWaitForTitle(kPassString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
{
- content::TitleWatcher title_watcher(runtime()->web_contents(), kFailString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kFailString);
title_watcher.AlsoWaitForTitle(kPassString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
#include "content/public/test/browser_test_utils.h"
using xwalk::extensions::XWalkExtensionService;
+using xwalk::Runtime;
class CrashExtensionTest : public XWalkExtensionsTestBase {
public:
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("crash.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ Runtime* runtime = CreateRuntime();
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
- WaitForLoadStop(runtime()->web_contents());
+ xwalk_test_utils::NavigateToURL(runtime, url);
+ WaitForLoadStop(runtime->web_contents());
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
content::RunAllPendingInMessageLoop();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("test_export_object.html"));
-
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ xwalk::Runtime* runtime = CreateRuntime();
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
#include "xwalk/test/base/xwalk_test_utils.h"
using namespace xwalk::extensions; // NOLINT
+using xwalk::Runtime;
namespace {
IN_PROC_BROWSER_TEST_F(XWalkExtensionsIFrameTest,
ContextsAreCreatedForIFrames) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("counter_with_iframes.html"));
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
SPIN_FOR_1_SECOND_OR_UNTIL_TRUE(g_count == 3);
ASSERT_EQ(g_count, 3);
}
IN_PROC_BROWSER_TEST_F(XWalkExtensionsIFrameTest,
ContextsAreNotCreatedForIFramesWithBlankPages) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("blank_iframes.html"));
// full of blank iframes and afterwards we navigate to another page.
// ModuleSystems should not be created and consequentially not deleted for the
// blank iframes.
- xwalk_test_utils::NavigateToURL(runtime(), url);
- content::TitleWatcher title_watcher1(runtime()->web_contents(), kPassString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
- content::TitleWatcher title_watcher2(runtime()->web_contents(), kPassString);
+ xwalk_test_utils::NavigateToURL(runtime, url);
+ content::TitleWatcher title_watcher1(runtime->web_contents(), kPassString);
+ xwalk_test_utils::NavigateToURL(runtime, url);
+ content::TitleWatcher title_watcher2(runtime->web_contents(), kPassString);
}
// This test reproduces the problem found in bug
// delete it when releasing the script context.
IN_PROC_BROWSER_TEST_F(XWalkExtensionsIFrameTest,
IFrameUsingDocumentWriteShouldNotCrash) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("iframe_using_document_write.html"));
for (int i = 0; i < 5; i++) {
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
}
// iframe_keep_reference.html for more details.
IN_PROC_BROWSER_TEST_F(XWalkExtensionsIFrameTest,
KeepingReferenceToFunctionFromDestroyedIFrame) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(
base::FilePath(),
base::FilePath().AppendASCII("iframe_keep_reference.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
ASSERT_EQ(g_count, 1);
}
#include "content/public/test/test_utils.h"
using xwalk::extensions::XWalkExtensionService;
+using xwalk::Runtime;
class ExternalExtensionTest : public XWalkExtensionsTestBase {
public:
};
IN_PROC_BROWSER_TEST_F(ExternalExtensionTest, ExternalExtension) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("echo.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
IN_PROC_BROWSER_TEST_F(ExternalExtensionTest, NavigateWithExternalExtension) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("echo.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
for (int i = 0; i < 5; i++) {
- xwalk_test_utils::NavigateToURL(runtime(), url);
- WaitForLoadStop(runtime()->web_contents());
+ xwalk_test_utils::NavigateToURL(runtime, url);
+ WaitForLoadStop(runtime->web_contents());
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
}
IN_PROC_BROWSER_TEST_F(ExternalExtensionTest, ExternalExtensionSync) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(
base::FilePath(),
base::FilePath().AppendASCII("sync_echo.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
IN_PROC_BROWSER_TEST_F(RuntimeInterfaceTest, GetRuntimeVariable) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(
base::FilePath(),
base::FilePath().AppendASCII("get_runtime_variable.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
IN_PROC_BROWSER_TEST_F(MultipleEntryPointsExtension, MultipleEntryPoints) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(
base::FilePath(),
base::FilePath().AppendASCII("entry_points.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
IN_PROC_BROWSER_TEST_F(MultipleEntryPointsExtension, SetterLoadsExtension) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(
base::FilePath(),
base::FilePath().AppendASCII("setter_callback_entry_point.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
IN_PROC_BROWSER_TEST_F(MultipleEntryPointsExtension, ReplacementObjectIsUsed) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(
base::FilePath(),
base::FilePath().AppendASCII(
"lazy_loaded_extension_overrides_object.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
using xwalk::Runtime;
using xwalk::extensions::XWalkExtensionVector;
-namespace {
-Runtime* CreateWithDefaultWindow(
- xwalk::RuntimeContext* runtime_context, const GURL& url,
- Runtime::Observer* observer = NULL) {
- Runtime* runtime = Runtime::Create(runtime_context, observer);
- runtime->LoadURL(url);
-#if !defined(OS_ANDROID)
- xwalk::RuntimeUIStrategy ui_strategy;
- xwalk::NativeAppWindow::CreateParams params;
- ui_strategy.Show(runtime, params);
-#endif
- return runtime;
-}
-} // namespace
-
class ExternalExtensionMultiProcessTest : public XWalkExtensionsTestBase {
public:
ExternalExtensionMultiProcessTest()
: register_extensions_count_(0) {}
- virtual ~ExternalExtensionMultiProcessTest() {
- original_runtimes_.clear();
- notification_observer_.reset();
- }
-
- // SetUpOnMainThread is called after BrowserMainRunner was initialized and
- // just before RunTestOnMainThread.
- virtual void SetUpOnMainThread() OVERRIDE {
- notification_observer_.reset(
- new content::WindowedNotificationObserver(
- xwalk::NOTIFICATION_RUNTIME_OPENED,
- content::NotificationService::AllSources()));
- original_runtimes_.assign(runtimes().begin(), runtimes().end());
- }
-
- // Block UI thread until a new Runtime instance is created.
- Runtime* WaitForSingleNewRuntime() {
- notification_observer_->Wait();
- for (RuntimeList::const_iterator it = runtimes().begin();
- it != runtimes().end(); ++it) {
- RuntimeList::iterator target =
- std::find(original_runtimes_.begin(), original_runtimes_.end(), *it);
- // Not found means a new one.
- if (target == original_runtimes_.end()) {
- original_runtimes_.push_back(*it);
- return *it;
- }
- }
- return NULL;
- }
-
// This will be called everytime a new RenderProcess has been created.
virtual void CreateExtensionsForUIThread(
XWalkExtensionVector* extensions) OVERRIDE {
}
private:
- RuntimeList original_runtimes_;
- scoped_ptr<content::WindowedNotificationObserver> notification_observer_;
-
int register_extensions_count_;
};
IN_PROC_BROWSER_TEST_F(ExternalExtensionMultiProcessTest,
OpenLinkInNewRuntimeAndSameRP) {
- size_t len = runtimes().size();
-
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("same_rp.html"));
-
- xwalk_test_utils::NavigateToURL(runtime(), url);
- WaitForLoadStop(runtime()->web_contents());
-
+ Runtime* runtime = CreateRuntime(url);
+ size_t len = runtimes().size();
EXPECT_EQ(1, CountRegisterExtensions());
- SimulateMouseClick(runtime()->web_contents(), 0,
+ SimulateMouseClick(runtime->web_contents(), 0,
blink::WebMouseEvent::ButtonLeft);
content::RunAllPendingInMessageLoop();
- Runtime* second = WaitForSingleNewRuntime();
- EXPECT_TRUE(NULL != second);
- EXPECT_NE(runtime(), second);
EXPECT_EQ(len + 1, runtimes().size());
+ Runtime* second = runtimes().back();
+ EXPECT_TRUE(NULL != second);
+ EXPECT_NE(runtime, second);
EXPECT_EQ(1, CountRegisterExtensions());
}
IN_PROC_BROWSER_TEST_F(ExternalExtensionMultiProcessTest,
OpenLinkInNewRuntimeAndNewRP) {
- size_t len = runtimes().size();
-
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("new_rp.html"));
-
- xwalk_test_utils::NavigateToURL(runtime(), url);
- WaitForLoadStop(runtime()->web_contents());
-
+ Runtime* runtime = CreateRuntime(url);
+ size_t len = runtimes().size();
EXPECT_EQ(1, CountRegisterExtensions());
- SimulateMouseClick(runtime()->web_contents(), 0,
+ SimulateMouseClick(runtime->web_contents(), 0,
blink::WebMouseEvent::ButtonLeft);
content::RunAllPendingInMessageLoop();
- Runtime* second = WaitForSingleNewRuntime();
- EXPECT_TRUE(NULL != second);
- EXPECT_NE(runtime(), second);
EXPECT_EQ(len + 1, runtimes().size());
+ Runtime* second = runtimes().back();
+ EXPECT_TRUE(NULL != second);
+ EXPECT_NE(runtime, second);
EXPECT_EQ(2, CountRegisterExtensions());
}
IN_PROC_BROWSER_TEST_F(ExternalExtensionMultiProcessTest,
CreateNewRuntimeAndNewRP) {
- size_t len = runtimes().size();
-
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("new_rp.html"));
-
- xwalk_test_utils::NavigateToURL(runtime(), url);
- WaitForLoadStop(runtime()->web_contents());
+ Runtime* runtime = CreateRuntime(url);
+ size_t len = runtimes().size();
EXPECT_EQ(1, CountRegisterExtensions());
- Runtime* new_runtime = CreateWithDefaultWindow(
- GetRuntimeContext(), url, runtime_registry());
- EXPECT_EQ(new_runtime, WaitForSingleNewRuntime());
- EXPECT_NE(runtime(), new_runtime);
- content::RunAllPendingInMessageLoop();
+ Runtime* new_runtime = CreateRuntime(url);
+ EXPECT_NE(runtime, new_runtime);
EXPECT_EQ(len + 1, runtimes().size());
EXPECT_EQ(2, CountRegisterExtensions());
}
#include "xwalk/test/base/xwalk_test_utils.h"
using namespace xwalk::extensions; // NOLINT
+using xwalk::Runtime;
const char kInProcessExtensionThread[] = "in_process_extension_thread";
const char kInProcessUIThread[] = "in_process_ui_thread";
};
IN_PROC_BROWSER_TEST_F(InProcessThreadsTest, InProcessThreads) {
- content::RunAllPendingInMessageLoop();
-
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ Runtime* runtime = CreateRuntime();
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("in_process_threads.html"));
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
using namespace xwalk::extensions; // NOLINT
using namespace xwalk::jsapi::test; // NOLINT
+using xwalk::Runtime;
TestExtension::TestExtension() {
set_name("test");
};
IN_PROC_BROWSER_TEST_F(InternalExtensionTest, InternalExtension) {
- content::RunAllPendingInMessageLoop();
-
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ Runtime* runtime = CreateRuntime();
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("test_internal_extension.html"));
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
#include "content/public/test/browser_test_utils.h"
using xwalk::extensions::XWalkExtensionService;
+using xwalk::Runtime;
class NamespaceReadOnlyExtensionTest : public XWalkExtensionsTestBase {
public:
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII(
"namespace_read_only.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ Runtime* runtime = CreateRuntime();
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
- WaitForLoadStop(runtime()->web_contents());
+ xwalk_test_utils::NavigateToURL(runtime, url);
+ WaitForLoadStop(runtime->web_contents());
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
NamespaceReadOnlyExtensionTest, NamespaceReadOnlyAfterEntryPointCalled) {
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("namespace_read_only_with_entrypoint.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ Runtime* runtime = CreateRuntime();
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
- WaitForLoadStop(runtime()->web_contents());
+ xwalk_test_utils::NavigateToURL(runtime, url);
+ WaitForLoadStop(runtime->web_contents());
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
#include "xwalk/test/base/xwalk_test_utils.h"
using namespace xwalk::extensions; // NOLINT
+using xwalk::Runtime;
namespace {
IN_PROC_BROWSER_TEST_F(XWalkExtensionsNestedNamespaceTest,
InstanceCreatedForInnerExtension) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("inner_outer.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
EXPECT_TRUE(g_outer_extension_loaded);
IN_PROC_BROWSER_TEST_F(XWalkExtensionsNestedNamespaceTest,
InstanceNotCreatedForUnusedInnerExtension) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("outer.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
EXPECT_TRUE(g_outer_extension_loaded);
IN_PROC_BROWSER_TEST_F(XWalkExtensionsTrampolinesForNested,
InstanceCreatedForExtensionUsedByAnother) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("another.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
EXPECT_TRUE(g_another_extension_loaded);
#include "xwalk/test/base/xwalk_test_utils.h"
using namespace xwalk::extensions; // NOLINT
+using xwalk::Runtime;
class TestV8ToolsExtensionInstance : public XWalkExtensionInstance {
public:
- explicit TestV8ToolsExtensionInstance() {
- }
-
virtual void HandleMessage(scoped_ptr<base::Value> msg) OVERRIDE {}
};
IN_PROC_BROWSER_TEST_F(XWalkExtensionsV8ToolsTest,
V8ToolsWorks) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("test_v8tools.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
#include "base/time/time.h"
using namespace xwalk::extensions; // NOLINT
+using xwalk::Runtime;
namespace {
class DelayedEchoContext : public XWalkExtensionInstance {
public:
- explicit DelayedEchoContext() {
- }
virtual void HandleMessage(scoped_ptr<base::Value> msg) OVERRIDE {
PostMessageToJS(msg.Pass());
}
};
IN_PROC_BROWSER_TEST_F(XWalkExtensionsTest, EchoExtension) {
- content::RunAllPendingInMessageLoop();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("test_extension.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ Runtime* runtime = CreateRuntime();
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
IN_PROC_BROWSER_TEST_F(XWalkExtensionsTest, ExtensionWithInvalidNameIgnored) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("test_extension.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
EXPECT_TRUE(EchoExtension::s_instance_was_created);
}
IN_PROC_BROWSER_TEST_F(XWalkExtensionsTest, EchoExtensionSync) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII(
"sync_echo.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
IN_PROC_BROWSER_TEST_F(XWalkExtensionsDelayedTest, EchoExtensionSync) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII(
"sync_echo.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
IN_PROC_BROWSER_TEST_F(XWalkExtensionsTest, BulkDataExtension) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("bulk_data_transmission.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
%define _binary_payload w3.gzdio
Name: crosswalk
-Version: 11.39.252.0
+Version: 11.39.256.0
Release: 0
Summary: Chromium-based app runtime
License: (BSD-3-Clause and LGPL-2.1+)
MediaPlayerBridge.setResourceLoadingFilter(
new XWalkMediaPlayerResourceLoadingFilter());
- XWalkPreferencesInternal.load(this);
-
setNativeContent(nativeInit());
+
+ XWalkPreferencesInternal.load(this);
}
private void setNativeContent(long newNativeContent) {
#include "xwalk/runtime/browser/android/net/android_protocol_handler.h"
#include "xwalk/runtime/browser/android/net/android_stream_reader_url_request_job.h"
#include "xwalk/runtime/browser/android/net/input_stream_impl.h"
-#include "xwalk/runtime/browser/runtime_context.h"
+#include "xwalk/runtime/browser/xwalk_browser_context.h"
#include "xwalk/runtime/browser/xwalk_runner.h"
using base::android::ScopedJavaLocalRef;
scoped_ptr<AndroidStreamReaderURLRequestJob::Delegate>
stream_reader_job_delegate_impl(new StreamReaderJobDelegateImpl(this));
- RuntimeContext* runtime_context =
- XWalkRunner::GetInstance()->runtime_context();
- std::string content_security_policy = runtime_context->GetCSPString();
+ XWalkBrowserContext* browser_context =
+ XWalkRunner::GetInstance()->browser_context();
+ std::string content_security_policy = browser_context->GetCSPString();
return new AndroidStreamReaderURLRequestJob(
request, network_delegate, stream_reader_job_delegate_impl.Pass(),
#include "xwalk/runtime/browser/android/net/android_stream_reader_url_request_job.h"
#include "xwalk/runtime/browser/android/net/input_stream_impl.h"
#include "xwalk/runtime/browser/android/net/url_constants.h"
-#include "xwalk/runtime/browser/runtime_context.h"
+#include "xwalk/runtime/browser/xwalk_browser_context.h"
#include "xwalk/runtime/browser/xwalk_runner.h"
using base::android::AttachCurrentThread;
scoped_ptr<AndroidStreamReaderURLRequestJobDelegateImpl> reader_delegate(
new AndroidStreamReaderURLRequestJobDelegateImpl());
- xwalk::RuntimeContext* runtime_context =
- xwalk::XWalkRunner::GetInstance()->runtime_context();
- std::string content_security_policy = runtime_context->GetCSPString();
+ xwalk::XWalkBrowserContext* browser_context =
+ xwalk::XWalkRunner::GetInstance()->browser_context();
+ std::string content_security_policy = browser_context->GetCSPString();
return new AndroidStreamReaderURLRequestJob(
request,
#include "content/public/browser/web_contents.h"
#include "content/public/common/frame_navigate_params.h"
#include "xwalk/runtime/browser/android/xwalk_contents_client_bridge.h"
-#include "xwalk/runtime/browser/runtime_context.h"
+#include "xwalk/runtime/browser/xwalk_browser_context.h"
#include "xwalk/runtime/common/android/xwalk_render_view_messages.h"
namespace xwalk {
const content::FrameNavigateParams& params) {
DCHECK(CalledOnValidThread());
- RuntimeContext::FromWebContents(web_contents())
+ XWalkBrowserContext::FromWebContents(web_contents())
->AddVisitedURLs(params.redirects);
}
#include "xwalk/runtime/browser/android/xwalk_contents_client_bridge_base.h"
#include "xwalk/runtime/browser/android/xwalk_contents_io_thread_client_impl.h"
#include "xwalk/runtime/browser/android/xwalk_web_contents_delegate.h"
-#include "xwalk/runtime/browser/runtime_context.h"
#include "xwalk/runtime/browser/runtime_resource_dispatcher_host_delegate_android.h"
+#include "xwalk/runtime/browser/xwalk_browser_context.h"
#include "xwalk/runtime/browser/xwalk_runner.h"
#include "jni/XWalkContent_jni.h"
std::string csp;
ManifestGetString(manifest, keys::kCSPKey, keys::kDeprecatedCSPKey, &csp);
- RuntimeContext* runtime_context =
- XWalkRunner::GetInstance()->runtime_context();
- CHECK(runtime_context);
- runtime_context->SetCSPString(csp);
+ XWalkBrowserContext* browser_context =
+ XWalkRunner::GetInstance()->browser_context();
+ CHECK(browser_context);
+ browser_context->SetCSPString(csp);
ScopedJavaLocalRef<jstring> url_buffer =
base::android::ConvertUTF8ToJavaString(env, url);
static jlong Init(JNIEnv* env, jobject obj) {
scoped_ptr<WebContents> web_contents(content::WebContents::Create(
content::WebContents::CreateParams(
- XWalkRunner::GetInstance()->runtime_context())));
+ XWalkRunner::GetInstance()->browser_context())));
return reinterpret_cast<intptr_t>(new XWalkContent(web_contents.Pass()));
}
namespace xwalk {
ApplicationComponent::ApplicationComponent(
- RuntimeContext* runtime_context)
- : app_system_(application::ApplicationSystem::Create(runtime_context)),
+ XWalkBrowserContext* browser_context)
+ : app_system_(application::ApplicationSystem::Create(browser_context)),
extensions_enabled_(true) {}
ApplicationComponent::~ApplicationComponent() {}
namespace xwalk {
-class RuntimeContext;
+class XWalkBrowserContext;
namespace application {
class ApplicationSystem;
// Applications being launched.
class ApplicationComponent : public XWalkComponent {
public:
- explicit ApplicationComponent(RuntimeContext* runtime_context);
+ explicit ApplicationComponent(XWalkBrowserContext* browser_context);
virtual ~ApplicationComponent();
// Used by Android since extensions for Application are not supported there.
#include "xwalk/runtime/browser/devtools/remote_debugging_server.h"
-#include "xwalk/runtime/browser/devtools/xwalk_devtools_delegate.h"
-#include "xwalk/runtime/browser/runtime_context.h"
#include "content/public/browser/devtools_http_handler.h"
#include "net/socket/tcp_server_socket.h"
+#include "xwalk/runtime/browser/devtools/xwalk_devtools_delegate.h"
+#include "xwalk/runtime/browser/xwalk_browser_context.h"
namespace xwalk {
};
RemoteDebuggingServer::RemoteDebuggingServer(
- RuntimeContext* runtime_context,
+ XWalkBrowserContext* browser_context,
const std::string& ip,
int port,
const std::string& frontend_url) {
namespace xwalk {
-class RuntimeContext;
+class XWalkBrowserContext;
class RemoteDebuggingServer {
public:
- RemoteDebuggingServer(RuntimeContext* runtime_context,
+ RemoteDebuggingServer(XWalkBrowserContext* browser_context,
const std::string& ip,
int port,
const std::string& frontend_url);
#include "testing/gmock/include/gmock/gmock.h"
using xwalk::Runtime;
-namespace {
-Runtime* CreateWithDefaultWindow(
- xwalk::RuntimeContext* runtime_context, const GURL& url,
- Runtime::Observer* observer = NULL) {
- Runtime* runtime = Runtime::Create(runtime_context, observer);
- runtime->LoadURL(url);
-#if !defined(OS_ANDROID)
- xwalk::RuntimeUIStrategy ui_strategy;
- xwalk::NativeAppWindow::CreateParams params;
- ui_strategy.Show(runtime, params);
-#endif
- return runtime;
-}
-} // namespace
class XWalkDevToolsTest : public InProcessBrowserTest {
public:
IN_PROC_BROWSER_TEST_F(XWalkDevToolsTest, RemoteDebugging) {
GURL localhost_url("http://127.0.0.1:9222");
- Runtime* debugging_host = CreateWithDefaultWindow(
- GetRuntimeContext(), localhost_url, runtime_registry());
+ Runtime* debugging_host = CreateRuntime(localhost_url);
content::WaitForLoadStop(debugging_host->web_contents());
base::string16 real_title = debugging_host->web_contents()->GetTitle();
base::string16 expected_title = base::ASCIIToUTF16("XWalk Remote Debugging");
#include "net/socket/tcp_listen_socket.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/snapshot/snapshot.h"
-#include "xwalk/runtime/browser/runtime.h"
using content::DevToolsAgentHost;
using content::RenderViewHost;
namespace {
Runtime* CreateWithDefaultWindow(
- RuntimeContext* runtime_context, const GURL& url,
- Runtime::Observer* observer = NULL) {
- Runtime* runtime = Runtime::Create(runtime_context, observer);
+ XWalkBrowserContext* browser_context, const GURL& url,
+ Runtime::Observer* observer) {
+ Runtime* runtime = Runtime::Create(browser_context);
+ runtime->set_observer(observer);
runtime->LoadURL(url);
#if !defined(OS_ANDROID)
- RuntimeUIStrategy ui_strategy;
- NativeAppWindow::CreateParams params;
- ui_strategy.Show(runtime, params);
+ runtime->set_ui_delegate(DefaultRuntimeUIDelegate::Create(runtime));
+ runtime->Show();
#endif
return runtime;
}
return scoped_ptr<net::StreamListenSocket>();
}
-XWalkDevToolsDelegate::XWalkDevToolsDelegate(RuntimeContext* runtime_context)
- : runtime_context_(runtime_context),
+XWalkDevToolsDelegate::XWalkDevToolsDelegate(XWalkBrowserContext* context)
+ : browser_context_(context),
weak_factory_(this) {
}
scoped_ptr<content::DevToolsTarget>
XWalkDevToolsDelegate::CreateNewTarget(const GURL& url) {
Runtime* runtime = CreateWithDefaultWindow(
- runtime_context_, GURL(url::kAboutBlankURL));
+ browser_context_, GURL(url::kAboutBlankURL), this);
return scoped_ptr<content::DevToolsTarget>(
new Target(DevToolsAgentHost::GetOrCreateFor(runtime->web_contents())));
}
callback.Run(targets);
}
+void XWalkDevToolsDelegate::OnNewRuntimeAdded(Runtime* runtime) {
+ runtime->set_observer(this);
+ runtime->set_ui_delegate(DefaultRuntimeUIDelegate::Create(runtime));
+ runtime->Show();
+}
+
+void XWalkDevToolsDelegate::OnRuntimeClosed(Runtime* runtime) {
+ delete runtime;
+}
+
} // namespace xwalk
#include "content/public/browser/devtools_http_handler_delegate.h"
#include "content/public/browser/devtools_manager_delegate.h"
#include "url/gurl.h"
+#include "xwalk/runtime/browser/runtime.h"
namespace content {
class DevToolsHttpHandler;
namespace xwalk {
-class RuntimeContext;
+class XWalkBrowserContext;
class XWalkDevToolsHttpHandlerDelegate :
public content::DevToolsHttpHandlerDelegate {
DISALLOW_COPY_AND_ASSIGN(XWalkDevToolsHttpHandlerDelegate);
};
-class XWalkDevToolsDelegate : public content::DevToolsManagerDelegate {
+class XWalkDevToolsDelegate : public content::DevToolsManagerDelegate,
+ public Runtime::Observer {
public:
- explicit XWalkDevToolsDelegate(RuntimeContext* runtime_context);
+ explicit XWalkDevToolsDelegate(XWalkBrowserContext* browser_context);
virtual ~XWalkDevToolsDelegate();
virtual void Inspect(
scoped_refptr<base::RefCountedBytes> png);
private:
+ // Runtime::Observer
+ virtual void OnNewRuntimeAdded(Runtime* runtime) override;
+ virtual void OnRuntimeClosed(Runtime* runtime) override;
+
using ThumbnailMap = std::map<GURL, std::string>;
ThumbnailMap thumbnail_map_;
- RuntimeContext* runtime_context_;
+ XWalkBrowserContext* browser_context_;
base::WeakPtrFactory<XWalkDevToolsDelegate> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(XWalkDevToolsDelegate);
};
}
} // namespace xwalk
-
-namespace content {
-__attribute__((visibility("default"))) content::LocationProvider*
- NewSystemLocationProvider() {
- return new xwalk::LocationProviderTizen;
-}
-
-} // namespace content
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
-#include "xwalk/runtime/browser/image_util.h"
-#include "xwalk/runtime/browser/media/media_capture_devices_dispatcher.h"
-#include "xwalk/runtime/browser/runtime_context.h"
-#include "xwalk/runtime/browser/runtime_file_select_helper.h"
-#include "xwalk/runtime/browser/ui/color_chooser.h"
-#include "xwalk/runtime/browser/xwalk_runner.h"
-#include "xwalk/runtime/common/xwalk_notification_types.h"
-#include "xwalk/runtime/common/xwalk_switches.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_source.h"
-#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/native_widget_types.h"
+#include "xwalk/runtime/browser/image_util.h"
+#include "xwalk/runtime/browser/media/media_capture_devices_dispatcher.h"
+#include "xwalk/runtime/browser/runtime_file_select_helper.h"
+#include "xwalk/runtime/browser/ui/color_chooser.h"
+#include "xwalk/runtime/browser/xwalk_browser_context.h"
+#include "xwalk/runtime/browser/xwalk_runner.h"
+#include "xwalk/runtime/common/xwalk_notification_types.h"
+#include "xwalk/runtime/common/xwalk_switches.h"
#if defined(OS_TIZEN)
#include "content/public/browser/site_instance.h"
#endif
#if !defined(OS_ANDROID)
-#include "xwalk/runtime/browser/runtime_ui_strategy.h"
+#include "xwalk/runtime/browser/runtime_ui_delegate.h"
#endif
using content::FaviconURL;
namespace xwalk {
// static
-Runtime* Runtime::Create(RuntimeContext* runtime_context,
- Observer* observer,
+Runtime* Runtime::Create(XWalkBrowserContext* browser_context,
content::SiteInstance* site) {
- WebContents::CreateParams params(runtime_context, site);
+ WebContents::CreateParams params(browser_context, site);
params.routing_id = MSG_ROUTING_NONE;
WebContents* web_contents = WebContents::Create(params);
- return new Runtime(web_contents, observer);
+ return new Runtime(web_contents);
}
-Runtime::Runtime(content::WebContents* web_contents, Observer* observer)
+Runtime::Runtime(content::WebContents* web_contents)
: WebContentsObserver(web_contents),
web_contents_(web_contents),
- window_(NULL),
- weak_ptr_factory_(this),
fullscreen_options_(NO_FULLSCREEN),
remote_debugging_enabled_(false),
- observer_(observer) {
+ ui_delegate_(nullptr),
+ observer_(nullptr),
+ weak_ptr_factory_(this) {
web_contents_->SetDelegate(this);
- content::NotificationService::current()->Notify(
- xwalk::NOTIFICATION_RUNTIME_OPENED,
- content::Source<Runtime>(this),
- content::NotificationService::NoDetails());
- if (observer_)
- observer_->OnRuntimeAdded(this);
-}
-
-Runtime::~Runtime() {
- content::NotificationService::current()->Notify(
- xwalk::NOTIFICATION_RUNTIME_CLOSED,
- content::Source<Runtime>(this),
- content::NotificationService::NoDetails());
- if (observer_)
- observer_->OnRuntimeRemoved(this);
-}
-
-void Runtime::EnableTitleUpdatedNotification() {
registrar_.Add(this,
content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED,
content::Source<content::WebContents>(web_contents_.get()));
}
-void Runtime::set_app_icon(const gfx::Image& app_icon) {
- app_icon_ = app_icon;
- if (window_ && !app_icon_.IsEmpty())
- window_->UpdateIcon(app_icon_);
+Runtime::~Runtime() {
+ if (ui_delegate_)
+ ui_delegate_->DeleteDelegate();
}
void Runtime::LoadURL(const GURL& url) {
web_contents_->Focus();
}
+void Runtime::Show() {
+ if (ui_delegate_)
+ ui_delegate_->Show();
+}
+
void Runtime::Close() {
- if (window_) {
- window_->Close();
- return;
- }
- // Runtime should not free itself on Close but be owned
- // by Application.
- delete this;
+ web_contents_->Close();
+}
+
+NativeAppWindow* Runtime::window() {
+ if (ui_delegate_)
+ return static_cast<DefaultRuntimeUIDelegate*>(ui_delegate_)->window();
+ return nullptr;
}
content::RenderProcessHost* Runtime::GetRenderProcessHost() {
fullscreen_options_ |= FULLSCREEN_FOR_TAB;
else
fullscreen_options_ &= ~FULLSCREEN_FOR_TAB;
-
- if (enter_fullscreen) {
- window_->SetFullscreen(true);
- } else if (!fullscreen_options_ & FULLSCREEN_FOR_LAUNCH) {
- window_->SetFullscreen(false);
- }
+ if (ui_delegate_)
+ ui_delegate_->SetFullscreen(
+ enter_fullscreen || (fullscreen_options_ & FULLSCREEN_FOR_LAUNCH));
}
bool Runtime::IsFullscreenForTabOrPending(
}
void Runtime::CloseContents(content::WebContents* source) {
- window_->Close();
+ if (ui_delegate_)
+ ui_delegate_->Close();
+
+ if (observer_)
+ observer_->OnRuntimeClosed(this);
}
bool Runtime::CanOverscrollContent() const {
const base::string16& frame_name,
const GURL& target_url,
content::WebContents* new_contents) {
- new Runtime(new_contents, observer_);
+ if (observer_)
+ observer_->OnNewRuntimeAdded(new Runtime(new_contents));
+ else
+ LOG(WARNING) << "New web contents is left unhandled.";
}
void Runtime::DidNavigateMainFramePostCommit(
content::WebContents* web_contents,
SkColor initial_color,
const std::vector<content::ColorSuggestion>& suggestions) {
+#if defined(TOOLKIT_VIEWS)
return xwalk::ShowColorChooser(web_contents, initial_color);
+#else
+ return WebContentsDelegate::OpenColorChooser(web_contents,
+ initial_color,
+ suggestions);
+#endif
}
void Runtime::RunFileChooser(
if (bitmaps.empty())
return;
app_icon_ = gfx::Image::CreateFrom1xBitmap(bitmaps[0]);
- window_->UpdateIcon(app_icon_);
+ if (ui_delegate_)
+ ui_delegate_->UpdateIcon(app_icon_);
}
void Runtime::Observe(int type,
content::Details<std::pair<content::NavigationEntry*, bool> >(
details).ptr();
- if (title->first) {
- base::string16 text = title->first->GetTitle();
- window_->UpdateTitle(text);
- }
+ if (title->first && ui_delegate_)
+ ui_delegate_->UpdateTitle(title->first->GetTitle());
}
}
-void Runtime::OnWindowDestroyed() {
- // Runtime should not free itself on Close but be owned
- // by Application.
- delete this;
-}
-
void Runtime::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
XWalkMediaCaptureDevicesDispatcher::RunRequestMediaAccessPermission(
web_contents, request, callback);
}
+
} // namespace xwalk
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "xwalk/runtime/browser/runtime_ui_strategy.h"
-#include "xwalk/runtime/browser/ui/native_app_window.h"
+#include "xwalk/runtime/browser/runtime_ui_delegate.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_delegate.h"
namespace xwalk {
-class NativeAppWindow;
-class RuntimeContext;
+class XWalkBrowserContext;
+class RuntimeUIDelegate;
// Runtime represents the running environment for a web page. It is responsible
-// for maintaning its owned WebContents and handling any communication between
-// WebContents and native app window.
+// for maintaning its owned WebContents.
class Runtime : public content::WebContentsDelegate,
public content::WebContentsObserver,
- public content::NotificationObserver,
- public NativeAppWindowDelegate {
+ public content::NotificationObserver {
public:
// New "Runtimes" are also created from Runtime::WebContentsCreated which
// is overridden WebContentsDelegate method. The "observer" is needed to
class Observer {
public:
// Called when a new Runtime instance is added.
- virtual void OnRuntimeAdded(Runtime* runtime) = 0;
+ virtual void OnNewRuntimeAdded(Runtime* new_runtime) = 0;
// Called when a Runtime instance is removed.
- virtual void OnRuntimeRemoved(Runtime* runtime) = 0;
+ virtual void OnRuntimeClosed(Runtime* runtime) = 0;
protected:
virtual ~Observer() {}
// Fullscreen entered by HTML requestFullscreen.
FULLSCREEN_FOR_TAB = 1 << 1,
};
+ virtual ~Runtime();
- void SetObserver(Observer* observer) { observer_ = observer; }
+ void set_ui_delegate(RuntimeUIDelegate* ui_delegate) {
+ ui_delegate_ = ui_delegate;
+ }
+ void set_observer(Observer* observer) { observer_ = observer; }
// Create a new Runtime instance with the given browsing context.
- static Runtime* Create(RuntimeContext*,
- Observer* = NULL, content::SiteInstance* = NULL);
+ static Runtime* Create(XWalkBrowserContext* context,
+ content::SiteInstance* site = nullptr);
void LoadURL(const GURL& url);
+ void Show();
void Close();
content::WebContents* web_contents() const { return web_contents_.get(); }
- NativeAppWindow* window() const { return window_; }
- void set_window(NativeAppWindow* window) { window_ = window; }
+ // FIXME : This method should be removed.
+ NativeAppWindow* window();
gfx::Image app_icon() const { return app_icon_; }
- void set_app_icon(const gfx::Image& app_icon);
- void EnableTitleUpdatedNotification();
unsigned int fullscreen_options() { return fullscreen_options_; }
void set_fullscreen_options(unsigned int options) {
fullscreen_options_ = options;
bool remote_debugging_enabled() const { return remote_debugging_enabled_; }
protected:
- Runtime(content::WebContents* web_contents, Observer* observer);
- virtual ~Runtime();
+ explicit Runtime(content::WebContents* web_contents);
// Overridden from content::WebContentsDelegate:
virtual content::WebContents* OpenURLFromTab(
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
- // NativeAppWindowDelegate implementation.
- virtual void OnWindowDestroyed() OVERRIDE;
-
// Notification manager.
content::NotificationRegistrar registrar_;
// The WebContents owned by this runtime.
scoped_ptr<content::WebContents> web_contents_;
- NativeAppWindow* window_;
-
gfx::Image app_icon_;
- base::WeakPtrFactory<Runtime> weak_ptr_factory_;
-
unsigned int fullscreen_options_;
bool remote_debugging_enabled_;
-
+ RuntimeUIDelegate* ui_delegate_;
Observer* observer_;
+ base::WeakPtrFactory<Runtime> weak_ptr_factory_;
};
} // namespace xwalk
+++ /dev/null
-// Copyright (c) 2014 Intel Corporation. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "xwalk/runtime/browser/runtime_defered_ui_strategy.h"
-
-#include "xwalk/runtime/browser/runtime.h"
-
-namespace xwalk {
-RuntimeDeferedUIStrategy::RuntimeDeferedUIStrategy()
- : defered_show_(true) {}
-
-RuntimeDeferedUIStrategy::~RuntimeDeferedUIStrategy() {}
-
-void RuntimeDeferedUIStrategy::Show(
- Runtime* runtime, const NativeAppWindow::CreateParams& params) {
- if (!defered_show_) {
- RuntimeUIStrategy::Show(runtime, params);
- return;
- }
-
- runtime_map_[runtime] = params;
-}
-
-void RuntimeDeferedUIStrategy::ShowStoredRuntimes() {
- for (const auto& item : runtime_map_) {
- RuntimeUIStrategy::Show(item.first, item.second);
- }
- defered_show_ = false;
-}
-} // namespace xwalk
+++ /dev/null
-// Copyright (c) 2014 Intel Corporation. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef XWALK_RUNTIME_BROWSER_RUNTIME_DEFERED_UI_STRATEGY_H_
-#define XWALK_RUNTIME_BROWSER_RUNTIME_DEFERED_UI_STRATEGY_H_
-
-#include <map>
-
-#include "xwalk/runtime/browser/runtime_ui_strategy.h"
-#include "xwalk/runtime/browser/ui/native_app_window.h"
-
-namespace xwalk {
-class Runtime;
-
-class RuntimeDeferedUIStrategy : public RuntimeUIStrategy {
- public:
- RuntimeDeferedUIStrategy();
- virtual ~RuntimeDeferedUIStrategy();
-
- // Override from RuntimeUIStrategy.
- virtual void Show(Runtime* runtime,
- const NativeAppWindow::CreateParams& params) OVERRIDE;
-
- void ShowStoredRuntimes();
-
- private:
- std::map<Runtime*, NativeAppWindow::CreateParams> runtime_map_;
- bool defered_show_;
-};
-
-inline RuntimeDeferedUIStrategy*
-ToRuntimeDeferedUIStrategy(RuntimeUIStrategy* ui_strategy) {
- return static_cast<RuntimeDeferedUIStrategy*>(ui_strategy);
-}
-} // namespace xwalk
-#endif // XWALK_RUNTIME_BROWSER_RUNTIME_DEFERED_UI_STRATEGY_H_
class GURL;
namespace content {
- class WebContents;
+class WebContents;
}
namespace xwalk {
-class RuntimeContext;
+class XWalkBrowserContext;
class RuntimeGeolocationPermissionContext
: public base::RefCountedThreadSafe<RuntimeGeolocationPermissionContext> {
--- /dev/null
+// Copyright (c) 2014 Intel Corporation. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "xwalk/runtime/browser/runtime_ui_delegate.h"
+
+#include "base/command_line.h"
+#include "grit/xwalk_resources.h"
+#include "ui/base/resource/resource_bundle.h"
+#include "ui/gfx/image/image.h"
+#include "xwalk/runtime/browser/image_util.h"
+#include "xwalk/runtime/browser/runtime.h"
+#include "xwalk/runtime/common/xwalk_switches.h"
+
+namespace xwalk {
+// FIXME : Need to figure out what code paths are used by Android and not
+// compile the unneeded files.
+#if !defined(OS_ANDROID)
+namespace {
+// The default size for web content area size.
+const int kDefaultWidth = 840;
+const int kDefaultHeight = 600;
+
+NativeAppWindow* CreateWindow(
+ Runtime* runtime, const NativeAppWindow::CreateParams& params) {
+ NativeAppWindow* window = NativeAppWindow::Create(params);
+ // FIXME : Pass an App icon in params.
+ // Set the app icon if it is passed from command line.
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ gfx::Image app_icon;
+ if (command_line->HasSwitch(switches::kAppIcon)) {
+ base::FilePath icon_file =
+ command_line->GetSwitchValuePath(switches::kAppIcon);
+ app_icon = xwalk_utils::LoadImageFromFilePath(icon_file);
+ } else {
+ // Otherwise, use the default icon for Crosswalk app.
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
+ app_icon = rb.GetNativeImageNamed(IDR_XWALK_ICON_48);
+ }
+
+ window->UpdateIcon(app_icon);
+
+ unsigned int fullscreen_options = runtime->fullscreen_options();
+ if (params.state == ui::SHOW_STATE_FULLSCREEN)
+ fullscreen_options |= Runtime::FULLSCREEN_FOR_LAUNCH;
+ else
+ fullscreen_options &= ~Runtime::FULLSCREEN_FOR_LAUNCH;
+ runtime->set_fullscreen_options(fullscreen_options);
+
+ return window;
+}
+
+} // namespace
+#endif
+
+RuntimeUIDelegate* DefaultRuntimeUIDelegate::Create(
+ Runtime* runtime, const NativeAppWindow::CreateParams& params) {
+ return new DefaultRuntimeUIDelegate(runtime, params);
+}
+
+DefaultRuntimeUIDelegate::DefaultRuntimeUIDelegate(
+ Runtime* runtime, const NativeAppWindow::CreateParams& params)
+ : runtime_(runtime),
+ window_params_(params),
+ window_(nullptr) {
+ DCHECK(runtime_);
+}
+
+DefaultRuntimeUIDelegate::~DefaultRuntimeUIDelegate() {
+}
+
+void DefaultRuntimeUIDelegate::Show() {
+#if !defined(OS_ANDROID)
+ if (!window_) {
+ if (window_params_.bounds.IsEmpty())
+ window_params_.bounds = gfx::Rect(0, 0, kDefaultWidth, kDefaultHeight);
+ window_params_.delegate = this;
+ window_params_.web_contents = runtime_->web_contents();
+ window_ = CreateWindow(runtime_, window_params_);
+ }
+ window_->Show();
+#else
+ NOTIMPLEMENTED();
+#endif
+}
+
+void DefaultRuntimeUIDelegate::UpdateTitle(const base::string16& text) {
+ if (window_)
+ window_->UpdateTitle(text);
+}
+
+void DefaultRuntimeUIDelegate::UpdateIcon(const gfx::Image& image) {
+ if (window_)
+ window_->UpdateIcon(image);
+}
+
+void DefaultRuntimeUIDelegate::SetFullscreen(bool enter_fullscreen) {
+ if (window_)
+ window_->SetFullscreen(enter_fullscreen);
+}
+
+void DefaultRuntimeUIDelegate::Close() {
+ if (window_)
+ window_->Close();
+}
+
+void DefaultRuntimeUIDelegate::DeleteDelegate() {
+ runtime_ = nullptr;
+ if (window_) {
+ window_->Close();
+ return;
+ }
+ delete this;
+}
+
+void DefaultRuntimeUIDelegate::OnWindowDestroyed() {
+ window_ = nullptr;
+ if (runtime_) {
+ runtime_->Close();
+ return;
+ }
+ delete this;
+}
+
+} // namespace xwalk
--- /dev/null
+// Copyright (c) 2014 Intel Corporation. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef XWALK_RUNTIME_BROWSER_RUNTIME_UI_DELEGATE_H_
+#define XWALK_RUNTIME_BROWSER_RUNTIME_UI_DELEGATE_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "xwalk/runtime/browser/ui/native_app_window.h"
+
+namespace xwalk {
+class Runtime;
+
+class RuntimeUIDelegate {
+ public:
+ virtual ~RuntimeUIDelegate() {}
+ virtual void Show() = 0;
+ virtual void UpdateTitle(const base::string16& text) = 0;
+ virtual void UpdateIcon(const gfx::Image& image) = 0;
+ virtual void SetFullscreen(bool enter_fullscreen) = 0;
+ virtual void Close() = 0;
+ virtual void DeleteDelegate() = 0;
+};
+
+// The default implementation displays WebContents in a separate window.
+class DefaultRuntimeUIDelegate : public RuntimeUIDelegate,
+ public NativeAppWindowDelegate {
+ public:
+ static RuntimeUIDelegate* Create(
+ Runtime* runtime,
+ const NativeAppWindow::CreateParams& params =
+ NativeAppWindow::CreateParams());
+ virtual ~DefaultRuntimeUIDelegate();
+
+ NativeAppWindow* window() { return window_; }
+
+ private:
+ DefaultRuntimeUIDelegate(Runtime* runtime,
+ const NativeAppWindow::CreateParams& params);
+ // RuntimeUIDelegate
+ virtual void Show() override;
+ virtual void UpdateTitle(const base::string16& text) override;
+ virtual void UpdateIcon(const gfx::Image& image) override;
+ virtual void SetFullscreen(bool enter_fullscreen) override;
+ virtual void Close() override;
+ virtual void DeleteDelegate() override;
+ // NativeAppWindowDelegate
+ virtual void OnWindowDestroyed() override;
+
+ private:
+ Runtime* runtime_;
+ NativeAppWindow::CreateParams window_params_;
+ NativeAppWindow* window_;
+};
+
+
+} // namespace xwalk
+
+#endif // XWALK_RUNTIME_BROWSER_RUNTIME_UI_DELEGATE_H_
+++ /dev/null
-// Copyright (c) 2014 Intel Corporation. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "xwalk/runtime/browser/runtime_ui_strategy.h"
-
-#include "base/command_line.h"
-#include "grit/xwalk_resources.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/image/image.h"
-#include "xwalk/runtime/browser/image_util.h"
-#include "xwalk/runtime/browser/runtime.h"
-#include "xwalk/runtime/common/xwalk_switches.h"
-
-namespace xwalk {
-namespace {
-#if !defined(OS_ANDROID)
-// The default size for web content area size.
-const int kDefaultWidth = 840;
-const int kDefaultHeight = 600;
-
-void ApplyWindowDefaultParams(Runtime* runtime,
- NativeAppWindow::CreateParams* params) {
- if (!params->delegate)
- params->delegate = runtime;
- if (!params->web_contents)
- params->web_contents = runtime->web_contents();
- if (params->bounds.IsEmpty())
- params->bounds = gfx::Rect(0, 0, kDefaultWidth, kDefaultHeight);
-
- unsigned int fullscreen_options = runtime->fullscreen_options();
- if (params->state == ui::SHOW_STATE_FULLSCREEN)
- fullscreen_options |= Runtime::FULLSCREEN_FOR_LAUNCH;
- else
- fullscreen_options &= ~Runtime::FULLSCREEN_FOR_LAUNCH;
- runtime->set_fullscreen_options(fullscreen_options);
-}
-#endif
-} // namespace
-
-RuntimeUIStrategy::RuntimeUIStrategy() {}
-
-RuntimeUIStrategy::~RuntimeUIStrategy() {}
-
-void RuntimeUIStrategy::Show(
- Runtime* runtime, const NativeAppWindow::CreateParams& params) {
-#if defined(OS_ANDROID)
- NOTIMPLEMENTED();
-#else
- NativeAppWindow::CreateParams effective_params(params);
- ApplyWindowDefaultParams(runtime, &effective_params);
-
- // Set the app icon if it is passed from command line.
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- gfx::Image app_icon;
- if (command_line->HasSwitch(switches::kAppIcon)) {
- base::FilePath icon_file =
- command_line->GetSwitchValuePath(switches::kAppIcon);
- app_icon = xwalk_utils::LoadImageFromFilePath(icon_file);
- } else {
- // Otherwise, use the default icon for Crosswalk app.
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- app_icon = rb.GetNativeImageNamed(IDR_XWALK_ICON_48);
- }
-
- runtime->EnableTitleUpdatedNotification();
-
- NativeAppWindow* window = NativeAppWindow::Create(effective_params);
- runtime->set_window(window);
-
- runtime->set_app_icon(app_icon);
- window->Show();
-#endif
-}
-} // namespace xwalk
+++ /dev/null
-// Copyright (c) 2014 Intel Corporation. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef XWALK_RUNTIME_BROWSER_RUNTIME_UI_STRATEGY_H_
-#define XWALK_RUNTIME_BROWSER_RUNTIME_UI_STRATEGY_H_
-
-#include "xwalk/runtime/browser/ui/native_app_window.h"
-
-namespace xwalk {
-class Runtime;
-
-class RuntimeUIStrategy {
- public:
- RuntimeUIStrategy();
- virtual ~RuntimeUIStrategy();
- virtual void Show(Runtime* runtime,
- const NativeAppWindow::CreateParams& params);
-};
-
-} // namespace xwalk
-
-#endif // XWALK_RUNTIME_BROWSER_RUNTIME_UI_STRATEGY_H_
--- /dev/null
+// Copyright (c) 2014 Intel Corporation. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "xwalk/runtime/browser/ui/native_app_window_aura.h"
+
+#include "base/command_line.h"
+#include "content/public/browser/web_contents.h"
+#include "content/browser/web_contents/web_contents_view.h"
+#include "ui/aura/client/aura_constants.h"
+#include "ui/wm/core/default_activation_client.h"
+#include "ui/aura/client/default_capture_client.h"
+#include "ui/aura/env.h"
+#include "ui/aura/layout_manager.h"
+#include "ui/aura/test/test_focus_client.h"
+#include "ui/aura/test/test_screen.h"
+#include "ui/aura/test/test_window_tree_client.h"
+#include "ui/aura/window.h"
+#include "ui/aura/window_event_dispatcher.h"
+#include "ui/base/cursor/cursor.h"
+#include "ui/base/cursor/image_cursors.h"
+#include "ui/base/ime/input_method.h"
+#include "ui/base/ime/input_method_delegate.h"
+#include "ui/base/ime/input_method_factory.h"
+#include "ui/gfx/screen.h"
+#include "ui/wm/core/cursor_manager.h"
+#include "ui/wm/core/native_cursor_manager.h"
+#include "ui/wm/core/native_cursor_manager_delegate.h"
+
+namespace xwalk {
+
+const int kDefaultTestWindowWidthDip = 800;
+const int kDefaultTestWindowHeightDip = 600;
+
+const char kXwalkHostWindowBounds[] = "xwalk-host-window-bounds";
+
+namespace {
+
+class FillLayout : public aura::LayoutManager {
+ public:
+ explicit FillLayout(aura::Window* root)
+ : root_(root) {
+ }
+
+ virtual ~FillLayout() {}
+
+ private:
+ // aura::LayoutManager:
+ virtual void OnWindowResized() override {
+ }
+
+ virtual void OnWindowAddedToLayout(aura::Window* child) override {
+ child->SetBounds(root_->bounds());
+ }
+
+ virtual void OnWillRemoveWindowFromLayout(aura::Window* child) override {
+ }
+
+ virtual void OnWindowRemovedFromLayout(aura::Window* child) override {
+ }
+
+ virtual void OnChildWindowVisibilityChanged(aura::Window* child,
+ bool visible) override {
+ }
+
+ virtual void SetChildBounds(aura::Window* child,
+ const gfx::Rect& requested_bounds) override {
+ SetChildBoundsDirect(child, requested_bounds);
+ }
+
+ aura::Window* root_;
+
+ DISALLOW_COPY_AND_ASSIGN(FillLayout);
+};
+
+// Taken from app_shell.
+// A class that bridges the gap between CursorManager and Aura. It borrows
+// heavily from AshNativeCursorManager.
+class ShellNativeCursorManager : public wm::NativeCursorManager {
+ public:
+ explicit ShellNativeCursorManager(aura::WindowTreeHost* host)
+ : host_(host),
+ image_cursors_(new ui::ImageCursors) {}
+ virtual ~ShellNativeCursorManager() {}
+
+ // wm::NativeCursorManager overrides.
+ virtual void SetDisplay(
+ const gfx::Display& display,
+ wm::NativeCursorManagerDelegate* delegate) override {
+ if (image_cursors_->SetDisplay(display, display.device_scale_factor()))
+ SetCursor(delegate->GetCursor(), delegate);
+ }
+
+ virtual void SetCursor(
+ gfx::NativeCursor cursor,
+ wm::NativeCursorManagerDelegate* delegate) override {
+ image_cursors_->SetPlatformCursor(&cursor);
+ cursor.set_device_scale_factor(image_cursors_->GetScale());
+ delegate->CommitCursor(cursor);
+
+ if (delegate->IsCursorVisible())
+ ApplyCursor(cursor);
+ }
+
+ virtual void SetVisibility(
+ bool visible,
+ wm::NativeCursorManagerDelegate* delegate) override {
+ delegate->CommitVisibility(visible);
+
+ if (visible) {
+ SetCursor(delegate->GetCursor(), delegate);
+ } else {
+ gfx::NativeCursor invisible_cursor(ui::kCursorNone);
+ image_cursors_->SetPlatformCursor(&invisible_cursor);
+ ApplyCursor(invisible_cursor);
+ }
+ }
+
+ virtual void SetCursorSet(
+ ui::CursorSetType cursor_set,
+ wm::NativeCursorManagerDelegate* delegate) override {
+ image_cursors_->SetCursorSet(cursor_set);
+ delegate->CommitCursorSet(cursor_set);
+ if (delegate->IsCursorVisible())
+ SetCursor(delegate->GetCursor(), delegate);
+ }
+
+ virtual void SetMouseEventsEnabled(
+ bool enabled,
+ wm::NativeCursorManagerDelegate* delegate) override {
+ delegate->CommitMouseEventsEnabled(enabled);
+ SetVisibility(delegate->IsCursorVisible(), delegate);
+ }
+
+ private:
+ // Sets |cursor| as the active cursor within Aura.
+ void ApplyCursor(gfx::NativeCursor cursor) {
+ host_->SetCursor(cursor);
+ }
+
+ aura::WindowTreeHost* host_; // Not owned.
+
+ scoped_ptr<ui::ImageCursors> image_cursors_;
+
+ DISALLOW_COPY_AND_ASSIGN(ShellNativeCursorManager);
+};
+
+class MinimalInputEventFilter : public ui::internal::InputMethodDelegate,
+ public ui::EventHandler {
+ public:
+ explicit MinimalInputEventFilter(aura::WindowTreeHost* host)
+ : host_(host),
+ input_method_(ui::CreateInputMethod(this,
+ gfx::kNullAcceleratedWidget)) {
+ input_method_->Init(true);
+ host_->window()->AddPreTargetHandler(this);
+ host_->window()->SetProperty(aura::client::kRootWindowInputMethodKey,
+ input_method_.get());
+ }
+
+ virtual ~MinimalInputEventFilter() {
+ host_->window()->RemovePreTargetHandler(this);
+ host_->window()->SetProperty(aura::client::kRootWindowInputMethodKey,
+ static_cast<ui::InputMethod*>(NULL));
+ }
+
+ private:
+ // ui::EventHandler:
+ virtual void OnKeyEvent(ui::KeyEvent* event) override {
+ // See the comment in InputMethodEventFilter::OnKeyEvent() for details.
+ if (event->IsTranslated()) {
+ event->SetTranslated(false);
+ } else if (input_method_->DispatchKeyEvent(*event)) {
+ event->StopPropagation();
+ }
+ }
+
+ // ui::internal::InputMethodDelegate:
+ virtual bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override {
+ // See the comment in InputMethodEventFilter::DispatchKeyEventPostIME() for
+ // details.
+ ui::KeyEvent aura_event(event);
+ aura_event.SetTranslated(true);
+ ui::EventDispatchDetails details =
+ host_->dispatcher()->OnEventFromSource(&aura_event);
+ return aura_event.handled() || details.dispatcher_destroyed;
+ }
+
+ aura::WindowTreeHost* host_;
+ scoped_ptr<ui::InputMethod> input_method_;
+
+ DISALLOW_COPY_AND_ASSIGN(MinimalInputEventFilter);
+};
+
+} // namespace
+
+// mimicking Shell::ShellPlatformDataAura
+NativeAppWindowAura::NativeAppWindowAura(
+ const NativeAppWindow::CreateParams& create_params)
+ : web_contents_(create_params.web_contents) {
+ aura::Env::CreateInstance(true);
+ gfx::Size size;
+
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(kXwalkHostWindowBounds)) {
+ const std::string size_str =
+ command_line->GetSwitchValueASCII(kXwalkHostWindowBounds);
+ int width, height;
+ if (sscanf(size_str.c_str(), "%d,%d", &width, &height) == 2)
+ size = gfx::Size(width, height);
+ }
+
+ if (size.IsEmpty())
+ size = gfx::Size(kDefaultTestWindowWidthDip, kDefaultTestWindowHeightDip);
+
+ host_.reset(aura::WindowTreeHost::Create(gfx::Rect(size)));
+ host_->InitHost();
+ host_->window()->SetLayoutManager(new FillLayout(host_->window()));
+
+ focus_client_.reset(new aura::test::TestFocusClient());
+ aura::client::SetFocusClient(host_->window(), focus_client_.get());
+
+ new wm::DefaultActivationClient(host_->window());
+ capture_client_.reset(
+ new aura::client::DefaultCaptureClient(host_->window()));
+ window_tree_client_.reset(
+ new aura::test::TestWindowTreeClient(host_->window()));
+ ime_filter_.reset(new MinimalInputEventFilter(host_.get()));
+
+ cursor_manager_.reset(
+ new wm::CursorManager(scoped_ptr<wm::NativeCursorManager>(
+ new ShellNativeCursorManager(host_.get()))));
+ cursor_manager_->SetDisplay(
+ gfx::Screen::GetNativeScreen()->GetPrimaryDisplay());
+ cursor_manager_->SetCursor(ui::kCursorPointer);
+ aura::client::SetCursorClient(host_->window(), cursor_manager_.get());
+
+ // mimicking Shell::PlatformSetContents
+ aura::Window* content = web_contents_->GetNativeView();
+ aura::Window* parent = host_->window();
+ if (!parent->Contains(content))
+ parent->AddChild(content);
+
+ content->Show();
+ parent->Show();
+
+ web_contents_->Focus();
+}
+
+NativeAppWindowAura::~NativeAppWindowAura() {
+ aura::Env::DeleteInstance();
+}
+
+gfx::NativeWindow NativeAppWindowAura::GetNativeWindow() const {
+ return NULL;
+}
+
+void NativeAppWindowAura::UpdateIcon(const gfx::Image& icon) {
+}
+
+void NativeAppWindowAura::UpdateTitle(const base::string16& title) {
+}
+
+gfx::Rect NativeAppWindowAura::GetRestoredBounds() const {
+ return gfx::Rect();
+}
+
+gfx::Rect NativeAppWindowAura::GetBounds() const {
+ return host_->GetBounds();
+}
+
+void NativeAppWindowAura::SetBounds(const gfx::Rect& bounds) {
+ host_->SetBounds(bounds);
+}
+
+void NativeAppWindowAura::Focus() {
+}
+
+void NativeAppWindowAura::Show() {
+ host_->Show();
+}
+
+void NativeAppWindowAura::Hide() {
+ host_->Hide();
+}
+
+void NativeAppWindowAura::Maximize() {
+}
+
+void NativeAppWindowAura::Minimize() {
+}
+
+void NativeAppWindowAura::SetFullscreen(bool fullscreen) {
+}
+
+void NativeAppWindowAura::Restore() {
+}
+
+void NativeAppWindowAura::FlashFrame(bool flash) {
+}
+
+void NativeAppWindowAura::Close() {
+}
+
+bool NativeAppWindowAura::IsActive() const {
+ return true;
+}
+
+bool NativeAppWindowAura::IsMaximized() const {
+ return true;
+}
+
+bool NativeAppWindowAura::IsMinimized() const {
+ return false;
+}
+
+bool NativeAppWindowAura::IsFullscreen() const {
+ return true;
+}
+
+// static
+NativeAppWindow* NativeAppWindow::Create(
+ const NativeAppWindow::CreateParams& create_params) {
+ return new NativeAppWindowAura(create_params);
+}
+
+// static
+void NativeAppWindow::Initialize() {
+ // At least Athena, Content Shell and Chromecast use the "TestScreen" class
+ // not exactly for testing but production instead. So I think we are fine on
+ // using it as long they are using it as well.
+ aura::TestScreen* screen = aura::TestScreen::Create(gfx::Size());
+ gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen);
+}
+
+} // namespace xwalk
--- /dev/null
+// Copyright (c) 2014 Intel Corporation. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef XWALK_RUNTIME_BROWSER_UI_NATIVE_APP_WINDOW_AURA_H_
+#define XWALK_RUNTIME_BROWSER_UI_NATIVE_APP_WINDOW_AURA_H_
+
+#include <string>
+
+#include "base/memory/scoped_ptr.h"
+#include "ui/aura/window_tree_host.h"
+#include "xwalk/runtime/browser/ui/native_app_window.h"
+
+namespace aura {
+namespace client {
+class DefaultCaptureClient;
+class FocusClient;
+class WindowTreeClient;
+}
+}
+
+namespace gfx {
+class Size;
+}
+
+namespace ui {
+class EventHandler;
+}
+
+namespace wm {
+class CursorManager;
+}
+
+namespace xwalk {
+
+class TopViewLayout;
+
+class NativeAppWindowAura : public NativeAppWindow {
+ public:
+ explicit NativeAppWindowAura(const NativeAppWindow::CreateParams& params);
+ virtual ~NativeAppWindowAura();
+
+ // NativeAppWindow implementation.
+ virtual gfx::NativeWindow GetNativeWindow() const override;
+ virtual void UpdateIcon(const gfx::Image& icon) override;
+ virtual void UpdateTitle(const base::string16& title) override;
+ virtual gfx::Rect GetRestoredBounds() const override;
+ virtual gfx::Rect GetBounds() const override;
+ virtual void SetBounds(const gfx::Rect& bounds) override;
+ virtual void Focus() override;
+ virtual void Show() override;
+ virtual void Hide() override;
+ virtual void Maximize() override;
+ virtual void Minimize() override;
+ virtual void SetFullscreen(bool fullscreen) override;
+ virtual void Restore() override;
+ virtual void FlashFrame(bool flash) override;
+ virtual void Close() override;
+ virtual bool IsActive() const override;
+ virtual bool IsMaximized() const override;
+ virtual bool IsMinimized() const override;
+ virtual bool IsFullscreen() const override;
+
+ private:
+ scoped_ptr<aura::WindowTreeHost> host_;
+ scoped_ptr<aura::client::FocusClient> focus_client_;
+ scoped_ptr<wm::CursorManager> cursor_manager_;
+ scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
+ scoped_ptr<aura::client::WindowTreeClient> window_tree_client_;
+ scoped_ptr<ui::EventHandler> ime_filter_;
+
+ content::WebContents* web_contents_;
+
+ DISALLOW_COPY_AND_ASSIGN(NativeAppWindowAura);
+};
+
+} // namespace xwalk
+
+#endif // XWALK_RUNTIME_BROWSER_UI_NATIVE_APP_WINDOW_AURA_H_
if (display.bounds().width() > display.bounds().height()) {
// Landscape devices have landscape-primary as default.
- rot = static_cast<gfx::Display::Rotation>((rot - 1) % 4);
+ rot = static_cast<gfx::Display::Rotation>((rot + 3) % 4);
}
return rot;
#include <string>
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/notification_service.h"
#include "xwalk/application/browser/application.h"
#include "xwalk/application/browser/application_service.h"
#include "xwalk/application/browser/application_system.h"
#include "xwalk/application/browser/application_service_provider_linux.h"
#include "xwalk/application/browser/linux/running_application_object.h"
#endif
-#include "xwalk/runtime/browser/runtime_defered_ui_strategy.h"
namespace xwalk {
+using application::Application;
+using application::ApplicationService;
+using application::ApplicationSystem;
+
XWalkAppExtensionBridge::XWalkAppExtensionBridge()
- : app_system_(NULL) {
+ : app_system_(nullptr) {
}
XWalkAppExtensionBridge::~XWalkAppExtensionBridge() {}
int render_process_id,
const IPC::ChannelHandle& channel_handle) {
#if defined(OS_LINUX)
- CHECK(app_system_);
- application::ApplicationService* service = app_system_->application_service();
- application::Application* app =
- service->GetApplicationByRenderHostID(render_process_id);
+ Application* app = GetApplication(render_process_id);
CHECK(app);
application::ApplicationSystemLinux* app_system =
void XWalkAppExtensionBridge::RenderChannelCreated(
int render_process_id) {
- CHECK(app_system_);
- application::ApplicationService *service =
- app_system_->application_service();
- application::Application *app =
- service->GetApplicationByRenderHostID(render_process_id);
+ Application* app = GetApplication(render_process_id);
if (!app)
return;
+ content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
+ base::Bind(&Application::RenderChannelCreated, app->GetWeakPtr()));
+}
- content::BrowserThread::PostTask(
- content::BrowserThread::UI,
- FROM_HERE,
- base::Bind(
- &RuntimeDeferedUIStrategy::ShowStoredRuntimes,
- base::Unretained(ToRuntimeDeferedUIStrategy(app->ui_strategy()))));
+Application* XWalkAppExtensionBridge::GetApplication(int render_process_id) {
+ CHECK(app_system_);
+ ApplicationService* service =
+ app_system_->application_service();
+ return service->GetApplicationByRenderHostID(render_process_id);
}
+
} // namespace xwalk
namespace xwalk {
+namespace application {
+class Application;
+}
+
// The class is the main interface for co-operations between the two major
// xwalk components -- the application subsystem and the extension subsystem.
// Because of the dependency requirements two components cound not include
virtual void RenderChannelCreated(int render_process_id) OVERRIDE;
private:
+ application::Application* GetApplication(int render_process_id);
application::ApplicationSystem* app_system_;
DISALLOW_COPY_AND_ASSIGN(XWalkAppExtensionBridge);
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "xwalk/runtime/browser/runtime_context.h"
+#include "xwalk/runtime/browser/xwalk_browser_context.h"
#include <string>
#include <utility>
namespace xwalk {
-class RuntimeContext::RuntimeResourceContext : public content::ResourceContext {
+class XWalkBrowserContext::RuntimeResourceContext :
+ public content::ResourceContext {
public:
RuntimeResourceContext() : getter_(NULL) {}
virtual ~RuntimeResourceContext() {}
DISALLOW_COPY_AND_ASSIGN(RuntimeResourceContext);
};
-RuntimeContext::RuntimeContext()
+XWalkBrowserContext::XWalkBrowserContext()
: resource_context_(new RuntimeResourceContext) {
InitWhileIOAllowed();
#if defined(OS_ANDROID)
#endif
}
-RuntimeContext::~RuntimeContext() {
+XWalkBrowserContext::~XWalkBrowserContext() {
if (resource_context_.get()) {
BrowserThread::DeleteSoon(
BrowserThread::IO, FROM_HERE, resource_context_.release());
}
// static
-RuntimeContext* RuntimeContext::FromWebContents(
+XWalkBrowserContext* XWalkBrowserContext::FromWebContents(
content::WebContents* web_contents) {
// This is safe; this is the only implementation of the browser context.
- return static_cast<RuntimeContext*>(web_contents->GetBrowserContext());
+ return static_cast<XWalkBrowserContext*>(
+ web_contents->GetBrowserContext());
}
-void RuntimeContext::InitWhileIOAllowed() {
+void XWalkBrowserContext::InitWhileIOAllowed() {
CommandLine* cmd_line = CommandLine::ForCurrentProcess();
if (cmd_line->HasSwitch(switches::kXWalkDataPath)) {
base::FilePath path =
cmd_line->GetSwitchValuePath(switches::kXWalkDataPath);
PathService::OverrideAndCreateIfNeeded(
- xwalk::DIR_DATA_PATH, path, false, true);
+ DIR_DATA_PATH, path, false, true);
}
}
-base::FilePath RuntimeContext::GetPath() const {
+base::FilePath XWalkBrowserContext::GetPath() const {
base::FilePath result;
#if defined(OS_ANDROID)
CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &result));
result = result.Append(
cmd_line->GetSwitchValuePath(switches::kXWalkProfileName));
#else
- CHECK(PathService::Get(xwalk::DIR_DATA_PATH, &result));
+ CHECK(PathService::Get(DIR_DATA_PATH, &result));
#endif
return result;
}
-bool RuntimeContext::IsOffTheRecord() const {
+bool XWalkBrowserContext::IsOffTheRecord() const {
// We don't consider off the record scenario.
return false;
}
-content::DownloadManagerDelegate* RuntimeContext::GetDownloadManagerDelegate() {
+content::DownloadManagerDelegate*
+XWalkBrowserContext::GetDownloadManagerDelegate() {
content::DownloadManager* manager = BrowserContext::GetDownloadManager(this);
if (!download_manager_delegate_.get()) {
return download_manager_delegate_.get();
}
-net::URLRequestContextGetter* RuntimeContext::GetRequestContext() {
+net::URLRequestContextGetter* XWalkBrowserContext::GetRequestContext() {
return GetDefaultStoragePartition(this)->GetURLRequestContext();
}
net::URLRequestContextGetter*
- RuntimeContext::GetRequestContextForRenderProcess(
+ XWalkBrowserContext::GetRequestContextForRenderProcess(
int renderer_child_id) {
#if defined(OS_ANDROID)
return GetRequestContext();
#endif
}
-net::URLRequestContextGetter* RuntimeContext::GetMediaRequestContext() {
+net::URLRequestContextGetter* XWalkBrowserContext::GetMediaRequestContext() {
return GetRequestContext();
}
net::URLRequestContextGetter*
- RuntimeContext::GetMediaRequestContextForRenderProcess(
+ XWalkBrowserContext::GetMediaRequestContextForRenderProcess(
int renderer_child_id) {
#if defined(OS_ANDROID)
return GetRequestContext();
}
net::URLRequestContextGetter*
- RuntimeContext::GetMediaRequestContextForStoragePartition(
+ XWalkBrowserContext::GetMediaRequestContextForStoragePartition(
const base::FilePath& partition_path,
bool in_memory) {
#if defined(OS_ANDROID)
#endif
}
-content::ResourceContext* RuntimeContext::GetResourceContext() {
+content::ResourceContext* XWalkBrowserContext::GetResourceContext() {
return resource_context_.get();
}
content::BrowserPluginGuestManager*
-RuntimeContext::GetGuestManager() {
+XWalkBrowserContext::GetGuestManager() {
return NULL;
}
-storage::SpecialStoragePolicy* RuntimeContext::GetSpecialStoragePolicy() {
+storage::SpecialStoragePolicy* XWalkBrowserContext::GetSpecialStoragePolicy() {
return NULL;
}
-content::PushMessagingService* RuntimeContext::GetPushMessagingService() {
+content::PushMessagingService* XWalkBrowserContext::GetPushMessagingService() {
return NULL;
}
-content::SSLHostStateDelegate* RuntimeContext::GetSSLHostStateDelegate() {
+content::SSLHostStateDelegate* XWalkBrowserContext::GetSSLHostStateDelegate() {
return NULL;
}
-RuntimeURLRequestContextGetter* RuntimeContext::GetURLRequestContextGetterById(
+RuntimeURLRequestContextGetter*
+XWalkBrowserContext::GetURLRequestContextGetterById(
const std::string& pkg_id) {
for (PartitionPathContextGetterMap::iterator it = context_getters_.begin();
it != context_getters_.end(); ++it) {
return 0;
}
-net::URLRequestContextGetter* RuntimeContext::CreateRequestContext(
+net::URLRequestContextGetter* XWalkBrowserContext::CreateRequestContext(
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) {
DCHECK(!url_request_getter_.get());
}
net::URLRequestContextGetter*
- RuntimeContext::CreateRequestContextForStoragePartition(
+ XWalkBrowserContext::CreateRequestContextForStoragePartition(
const base::FilePath& partition_path,
bool in_memory,
content::ProtocolHandlerMap* protocol_handlers,
}
#if defined(OS_ANDROID)
-void RuntimeContext::SetCSPString(const std::string& csp) {
+void XWalkBrowserContext::SetCSPString(const std::string& csp) {
// Check format of csp string.
std::vector<std::string> policies;
base::SplitString(csp, ';', &policies);
csp_ = csp;
}
-std::string RuntimeContext::GetCSPString() const {
+std::string XWalkBrowserContext::GetCSPString() const {
return csp_;
}
-void RuntimeContext::InitVisitedLinkMaster() {
+void XWalkBrowserContext::InitVisitedLinkMaster() {
visitedlink_master_.reset(
new visitedlink::VisitedLinkMaster(this, this, false));
visitedlink_master_->Init();
}
-void RuntimeContext::AddVisitedURLs(const std::vector<GURL>& urls) {
+void XWalkBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) {
DCHECK(visitedlink_master_.get());
visitedlink_master_->AddURLs(urls);
}
-void RuntimeContext::RebuildTable(
+void XWalkBrowserContext::RebuildTable(
const scoped_refptr<URLEnumerator>& enumerator) {
// XWalkView rebuilds from XWalkWebChromeClient.getVisitedHistory. The client
// can change in the lifetime of this XWalkView and may not yet be set here.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef XWALK_RUNTIME_BROWSER_RUNTIME_CONTEXT_H_
-#define XWALK_RUNTIME_BROWSER_RUNTIME_CONTEXT_H_
+#ifndef XWALK_RUNTIME_BROWSER_XWALK_BROWSER_CONTEXT_H_
+#define XWALK_RUNTIME_BROWSER_XWALK_BROWSER_CONTEXT_H_
#if defined(OS_ANDROID)
#include <string>
class RuntimeDownloadManagerDelegate;
class RuntimeURLRequestContextGetter;
-class RuntimeContext
+class XWalkBrowserContext
: public content::BrowserContext
#if defined(OS_ANDROID)
, public visitedlink::VisitedLinkDelegate
#endif
{
public:
- RuntimeContext();
- virtual ~RuntimeContext();
+ XWalkBrowserContext();
+ virtual ~XWalkBrowserContext();
- // Convenience method to returns the RuntimeContext corresponding to the
+ // Convenience method to returns the XWalkBrowserContext corresponding to the
// given WebContents.
- static RuntimeContext* FromWebContents(content::WebContents* web_contents);
+ static XWalkBrowserContext* FromWebContents(
+ content::WebContents* web_contents);
// BrowserContext implementation.
virtual base::FilePath GetPath() const OVERRIDE;
private:
class RuntimeResourceContext;
- // Performs initialization of the RuntimeContext while IO is still
+ // Performs initialization of the XWalkBrowserContext while IO is still
// allowed on the current thread.
void InitWhileIOAllowed();
PartitionPathContextGetterMap;
PartitionPathContextGetterMap context_getters_;
- DISALLOW_COPY_AND_ASSIGN(RuntimeContext);
+ DISALLOW_COPY_AND_ASSIGN(XWalkBrowserContext);
};
} // namespace xwalk
-#endif // XWALK_RUNTIME_BROWSER_RUNTIME_CONTEXT_H_
+#endif // XWALK_RUNTIME_BROWSER_XWALK_BROWSER_CONTEXT_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/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"
#endif
#if defined(USE_AURA) && defined(USE_X11)
-#include "ui/base/ime/input_method_initializer.h"
#include "ui/events/x/touch_factory_x11.h"
#endif
+#if !defined(OS_CHROMEOS) && defined(USE_AURA) && defined(OS_LINUX)
+#include "ui/base/ime/input_method_initializer.h"
+#endif
+
namespace {
// FIXME: Compare with method in startup_browser_creator.cc.
}
void XWalkBrowserMainParts::PreEarlyInitialization() {
-#if defined(USE_AURA) && defined(USE_X11)
- ui::InitializeInputMethodForTesting();
+#if !defined(OS_CHROMEOS) && defined(USE_AURA) && defined(OS_LINUX)
+ ui::InitializeInputMethodForTesting();
#endif
}
#include "xwalk/extensions/common/xwalk_extension.h"
#include "xwalk/extensions/common/xwalk_extension_switches.h"
#include "xwalk/runtime/browser/android/cookie_manager.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 "xwalk/runtime/browser/geolocation/xwalk_access_token_store.h"
#include "xwalk/runtime/browser/media/media_capture_devices_dispatcher.h"
#include "xwalk/runtime/browser/renderer_host/pepper/xwalk_browser_pepper_host_factory.h"
-#include "xwalk/runtime/browser/runtime_context.h"
#include "xwalk/runtime/browser/runtime_quota_permission_context.h"
#include "xwalk/runtime/browser/speech/speech_recognition_manager_delegate.h"
+#include "xwalk/runtime/browser/xwalk_browser_context.h"
#include "xwalk/runtime/browser/xwalk_browser_main_parts.h"
#include "xwalk/runtime/browser/xwalk_render_message_filter.h"
#include "xwalk/runtime/browser/xwalk_runner.h"
#if defined(OS_TIZEN)
#include "xwalk/application/common/application_manifest_constants.h"
+#include "xwalk/runtime/browser/geolocation/tizen/location_provider_tizen.h"
#include "xwalk/runtime/browser/runtime_platform_util.h"
#include "xwalk/runtime/browser/tizen/xwalk_web_contents_view_delegate.h"
#include "xwalk/runtime/browser/xwalk_browser_main_parts_tizen.h"
: xwalk_runner_(xwalk_runner),
url_request_context_getter_(NULL),
main_parts_(NULL),
- runtime_context_(NULL) {
+ browser_context_(NULL) {
DCHECK(!g_browser_client);
g_browser_client = this;
}
content::BrowserContext* browser_context,
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) {
- runtime_context_ = static_cast<RuntimeContext*>(browser_context);
- url_request_context_getter_ = runtime_context_->
+ browser_context_ = static_cast<XWalkBrowserContext*>(browser_context);
+ url_request_context_getter_ = browser_context_->
CreateRequestContext(protocol_handlers, request_interceptors.Pass());
return url_request_context_getter_;
}
bool in_memory,
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) {
- return static_cast<RuntimeContext*>(browser_context)->
+ return static_cast<XWalkBrowserContext*>(browser_context)->
CreateRequestContextForStoragePartition(
partition_path, in_memory, protocol_handlers,
request_interceptors.Pass());
}
#endif
+content::LocationProvider*
+XWalkContentBrowserClient::OverrideSystemLocationProvider() {
+#if defined(OS_TIZEN)
+ return new LocationProviderTizen();
+#else
+ return nullptr;
+#endif
+}
void XWalkContentBrowserClient::GetStoragePartitionConfigForSite(
content::BrowserContext* browser_context,
content::DevToolsManagerDelegate*
XWalkContentBrowserClient::GetDevToolsManagerDelegate() {
- return new XWalkDevToolsDelegate(runtime_context_);
+ return new XWalkDevToolsDelegate(browser_context_);
}
} // namespace xwalk
namespace xwalk {
-class RuntimeContext;
+class XWalkBrowserContext;
class XWalkBrowserMainParts;
class XWalkRunner;
virtual void ResourceDispatcherHostCreated() OVERRIDE;
#endif
+ virtual content::LocationProvider* OverrideSystemLocationProvider() override;
+
virtual void GetStoragePartitionConfigForSite(
content::BrowserContext* browser_context,
const GURL& site,
scoped_refptr<RuntimeGeolocationPermissionContext>
geolocation_permission_context_;
XWalkBrowserMainParts* main_parts_;
- RuntimeContext* runtime_context_;
+ XWalkBrowserContext* browser_context_;
scoped_ptr<RuntimeResourceDispatcherHostDelegate>
resource_dispatcher_host_delegate_;
class XWalkDownloadBrowserTest : public InProcessBrowserTest {
public:
+ XWalkDownloadBrowserTest()
+ : InProcessBrowserTest(),
+ runtime_(nullptr) {}
+
virtual void SetUpOnMainThread() OVERRIDE {
ASSERT_TRUE(downloads_directory_.CreateUniqueTempDir());
+ runtime_ = CreateRuntime(GURL());
- DownloadManagerImpl* manager = DownloadManagerForXWalk(runtime());
+ DownloadManagerImpl* manager = DownloadManagerForXWalk(runtime_);
RuntimeDownloadManagerDelegate* delegate =
static_cast<RuntimeDownloadManagerDelegate*>(manager->GetDelegate());
delegate->SetDownloadBehaviorForTesting(downloads_directory_.path());
DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL);
}
+ protected:
+ Runtime* runtime_;
+
private:
// Location of the downloads directory for these tests
base::ScopedTempDir downloads_directory_;
GURL url = xwalk_test_utils::GetTestURL(
base::FilePath().AppendASCII("download"),
base::FilePath().AppendASCII("test.lib"));
- scoped_ptr<DownloadTestObserver> observer(CreateWaiter(runtime(), 1));
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ scoped_ptr<DownloadTestObserver> observer(CreateWaiter(runtime_, 1));
+ xwalk_test_utils::NavigateToURL(runtime_, url);
observer->WaitForFinished();
EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::COMPLETE));
std::vector<DownloadItem*> downloads;
- DownloadManagerForXWalk(runtime())->GetAllDownloads(&downloads);
+ DownloadManagerForXWalk(runtime_)->GetAllDownloads(&downloads);
ASSERT_EQ(1u, downloads.size());
ASSERT_EQ(DownloadItem::COMPLETE, downloads[0]->GetState());
base::FilePath file(downloads[0]->GetFullPath());
base::FilePath(), base::FilePath().AppendASCII("file_to_select")));
GURL url = xwalk_test_utils::GetTestURL(
base::FilePath(), base::FilePath().AppendASCII("form_input.html"));
- xwalk_test_utils::NavigateToURL(runtime(), url);
- content::WaitForLoadStop(runtime()->web_contents());
+ Runtime* runtime = CreateRuntime(url);
+ content::WaitForLoadStop(runtime->web_contents());
bool ret = content::ExecuteScript(
- runtime()->web_contents(), "doSelectFile();");
+ runtime->web_contents(), "doSelectFile();");
EXPECT_TRUE(ret);
content::RunAllPendingInMessageLoop();
base::string16 expected_title = base::ASCIIToUTF16("file selected: ");
expected_title.append(
base::ASCIIToUTF16(g_file_selected_path.BaseName().MaybeAsASCII()));
- content::TitleWatcher title_watcher(runtime()->web_contents(),
+ content::TitleWatcher title_watcher(runtime->web_contents(),
expected_title);
EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title);
}
SetBrowserTestColor(r, g, b);
GURL url = xwalk_test_utils::GetTestURL(
base::FilePath(), base::FilePath().AppendASCII("form_input.html"));
- xwalk_test_utils::NavigateToURL(runtime(), url);
- content::WaitForLoadStop(runtime()->web_contents());
+ Runtime* runtime = CreateRuntime(url);
+ content::WaitForLoadStop(runtime->web_contents());
bool ret = content::ExecuteScript(
- runtime()->web_contents(), "doChooseColor();");
+ runtime->web_contents(), "doChooseColor();");
EXPECT_TRUE(ret);
content::RunAllPendingInMessageLoop();
base::string16 expected_title = base::ASCIIToUTF16("color chosen: ");
char rgb[8];
base::snprintf(rgb, sizeof(rgb), "#%02x%02x%02x", r, g, b);
expected_title.append(base::ASCIIToUTF16(rgb));
- content::TitleWatcher title_watcher(runtime()->web_contents(),
+ content::TitleWatcher title_watcher(runtime->web_contents(),
expected_title);
EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title);
}
#include "xwalk/extensions/common/xwalk_extension_switches.h"
#include "xwalk/runtime/browser/application_component.h"
#include "xwalk/runtime/browser/devtools/remote_debugging_server.h"
-#include "xwalk/runtime/browser/runtime_context.h"
#include "xwalk/runtime/browser/storage_component.h"
#include "xwalk/runtime/browser/sysapps_component.h"
#include "xwalk/runtime/browser/xwalk_app_extension_bridge.h"
+#include "xwalk/runtime/browser/xwalk_browser_context.h"
#include "xwalk/runtime/browser/xwalk_browser_main_parts.h"
#include "xwalk/runtime/browser/xwalk_component.h"
#include "xwalk/runtime/browser/xwalk_content_browser_client.h"
}
void XWalkRunner::PreMainMessageLoopRun() {
- runtime_context_.reset(new RuntimeContext);
+ browser_context_.reset(new XWalkBrowserContext);
app_extension_bridge_.reset(new XWalkAppExtensionBridge());
CommandLine* cmd_line = CommandLine::ForCurrentProcess();
void XWalkRunner::PostMainMessageLoopRun() {
DestroyComponents();
extension_service_.reset();
- runtime_context_.reset();
+ browser_context_.reset();
DisableRemoteDebugging();
}
}
scoped_ptr<ApplicationComponent> XWalkRunner::CreateAppComponent() {
- return make_scoped_ptr(new ApplicationComponent(runtime_context_.get()));
+ return make_scoped_ptr(new ApplicationComponent(browser_context_.get()));
}
scoped_ptr<SysAppsComponent> XWalkRunner::CreateSysAppsComponent() {
const char* local_ip = "0.0.0.0";
if (port > 0 && port < 65535) {
remote_debugging_server_.reset(
- new RemoteDebuggingServer(runtime_context(),
+ new RemoteDebuggingServer(browser_context(),
local_ip, port, std::string()));
}
}
namespace xwalk {
-class RuntimeContext;
class ApplicationComponent;
class RemoteDebuggingServer;
class SysAppsComponent;
+class XWalkBrowserContext;
class XWalkComponent;
class XWalkContentBrowserClient;
class XWalkAppExtensionBridge;
// - In situations where you don't control the creation of a certain
// object. Certain APIs doesn't allow us to pass the dependencies, so we
// need to reach them some way.
- RuntimeContext* runtime_context() { return runtime_context_.get(); }
+ XWalkBrowserContext* browser_context() { return browser_context_.get(); }
application::ApplicationSystem* app_system();
extensions::XWalkExtensionService* extension_service() {
return extension_service_.get();
content::ContentBrowserClient* GetContentBrowserClient();
scoped_ptr<XWalkContentBrowserClient> content_browser_client_;
- scoped_ptr<RuntimeContext> runtime_context_;
+ scoped_ptr<XWalkBrowserContext> browser_context_;
scoped_ptr<extensions::XWalkExtensionService> extension_service_;
scoped_ptr<XWalkAppExtensionBridge> app_extension_bridge_;
#include "base/strings/utf_string_conversions.h"
#include "xwalk/runtime/browser/image_util.h"
#include "xwalk/runtime/browser/runtime.h"
-#include "xwalk/runtime/browser/runtime_ui_strategy.h"
+#include "xwalk/runtime/browser/runtime_ui_delegate.h"
#include "xwalk/runtime/common/xwalk_notification_types.h"
#include "xwalk/test/base/in_process_browser_test.h"
#include "xwalk/test/base/xwalk_test_utils.h"
using xwalk::NativeAppWindow;
using xwalk::Runtime;
+using content::NotificationService;
using content::WebContents;
+using content::WindowedNotificationObserver;
using testing::_;
-namespace {
-Runtime* CreateWithDefaultWindow(
- xwalk::RuntimeContext* runtime_context, const GURL& url,
- Runtime::Observer* observer = NULL) {
- Runtime* runtime = Runtime::Create(runtime_context, observer);
- runtime->LoadURL(url);
-#if !defined(OS_ANDROID)
- xwalk::RuntimeUIStrategy ui_strategy;
- xwalk::NativeAppWindow::CreateParams params;
- ui_strategy.Show(runtime, params);
-#endif
- return runtime;
-}
-} // namespace
-
-// Observer for NOTIFICATION_FULLSCREEN_CHANGED notifications.
-class FullscreenNotificationObserver
- : public content::WindowedNotificationObserver {
- public:
- FullscreenNotificationObserver() : WindowedNotificationObserver(
- xwalk::NOTIFICATION_FULLSCREEN_CHANGED,
- content::NotificationService::AllSources()) {}
- private:
- DISALLOW_COPY_AND_ASSIGN(FullscreenNotificationObserver);
-};
-
class XWalkRuntimeTest : public InProcessBrowserTest {
- public:
- XWalkRuntimeTest() {}
- virtual ~XWalkRuntimeTest() {
- original_runtimes_.clear();
- notification_observer_.reset();
- }
-
- void Relaunch(const CommandLine& new_command_line) {
- base::LaunchProcess(new_command_line, base::LaunchOptions(), NULL);
- }
-
- // SetUpOnMainThread is called after BrowserMainRunner was initialized and
- // just before RunTestOnMainThread (aka. TestBody).
- virtual void SetUpOnMainThread() OVERRIDE {
- notification_observer_.reset(
- new content::WindowedNotificationObserver(
- xwalk::NOTIFICATION_RUNTIME_OPENED,
- content::NotificationService::AllSources()));
- original_runtimes_.assign(runtimes().begin(), runtimes().end());
- }
-
- // Block UI thread until a new Runtime instance is created.
- Runtime* WaitForSingleNewRuntime() {
- notification_observer_->Wait();
- const RuntimeList& runtime_list = runtimes();
- for (RuntimeList::const_iterator it = runtime_list.begin();
- it != runtime_list.end(); ++it) {
- RuntimeList::iterator target =
- std::find(original_runtimes_.begin(), original_runtimes_.end(), *it);
- // Not found means a new one.
- if (target == original_runtimes_.end()) {
- original_runtimes_.push_back(*it);
- return *it;
- }
- }
- return NULL;
- }
-
- private:
- RuntimeList original_runtimes_;
- scoped_ptr<content::WindowedNotificationObserver> notification_observer_;
};
-// FIXME(hmin): Since currently the browser process is not shared by multiple
-// app launch, this test is disabled to avoid floody launches.
-IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, DISABLED_SecondLaunch) {
- Relaunch(GetCommandLineForRelaunch());
-
- Runtime* second_runtime = NULL;
- EXPECT_TRUE(second_runtime == WaitForSingleNewRuntime());
- ASSERT_EQ(2u, runtimes().size());
-}
-
IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, CreateAndCloseRuntime) {
size_t len = runtimes().size();
- ASSERT_EQ(1, len);
-
// Create a new Runtime instance.
GURL url(test_server()->GetURL("test.html"));
- Runtime* new_runtime = CreateWithDefaultWindow(
- GetRuntimeContext(), url, runtime_registry());
- EXPECT_TRUE(url == new_runtime->web_contents()->GetURL());
- EXPECT_EQ(new_runtime, WaitForSingleNewRuntime());
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime(url);
+ EXPECT_TRUE(url == runtime->web_contents()->GetURL());
EXPECT_EQ(len + 1, runtimes().size());
// Close the newly created Runtime instance.
- new_runtime->Close();
+ runtime->Close();
content::RunAllPendingInMessageLoop();
EXPECT_EQ(len, runtimes().size());
}
IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, LoadURLAndClose) {
GURL url(test_server()->GetURL("test.html"));
+ Runtime* runtime = CreateRuntime(url);
size_t len = runtimes().size();
- runtime()->LoadURL(url);
- content::RunAllPendingInMessageLoop();
- EXPECT_EQ(len, runtimes().size());
- runtime()->Close();
+ runtime->Close();
content::RunAllPendingInMessageLoop();
EXPECT_EQ(len - 1, runtimes().size());
}
IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, CloseNativeWindow) {
GURL url(test_server()->GetURL("test.html"));
- Runtime* new_runtime = CreateWithDefaultWindow(
- GetRuntimeContext(), url, runtime_registry());
+ Runtime* new_runtime = CreateRuntime(url);
size_t len = runtimes().size();
new_runtime->window()->Close();
content::RunAllPendingInMessageLoop();
IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, LaunchWithFullscreenWindow) {
GURL url(test_server()->GetURL("test.html"));
- Runtime* new_runtime = Runtime::Create(
- GetRuntimeContext(), runtime_registry());
-
NativeAppWindow::CreateParams params;
params.state = ui::SHOW_STATE_FULLSCREEN;
- scoped_ptr<xwalk::RuntimeUIStrategy> ui_strategy(
- new xwalk::RuntimeUIStrategy);
- ui_strategy->Show(new_runtime, params);
- xwalk_test_utils::NavigateToURL(new_runtime, url);
+ Runtime* new_runtime = CreateRuntime(url, params);
EXPECT_TRUE(new_runtime->window()->IsFullscreen());
}
IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, HTML5FullscreenAPI) {
- size_t len = runtimes().size();
GURL url = xwalk_test_utils::GetTestURL(
base::FilePath(), base::FilePath().AppendASCII("fullscreen.html"));
- xwalk_test_utils::NavigateToURL(runtime(), url);
- EXPECT_TRUE(false == runtime()->window()->IsFullscreen());
+ Runtime* runtime = CreateRuntime(url);
+ EXPECT_TRUE(false == runtime->window()->IsFullscreen());
+
+ WindowedNotificationObserver enter_observer(
+ xwalk::NOTIFICATION_FULLSCREEN_CHANGED,
+ NotificationService::AllSources());
- FullscreenNotificationObserver enter_observer;
bool ret = content::ExecuteScript(
- runtime()->web_contents(), "doFullscreenClick();");
+ runtime->web_contents(), "doFullscreenClick();");
EXPECT_TRUE(ret);
content::RunAllPendingInMessageLoop();
enter_observer.Wait();
// Calling doFullscreenClick defined in fullscreen.html leads to enter into
// fullscreen window state, so it's expected to be fullscreen.
- EXPECT_TRUE(true == runtime()->window()->IsFullscreen());
+ EXPECT_TRUE(true == runtime->window()->IsFullscreen());
+
+ WindowedNotificationObserver exit_observer(
+ xwalk::NOTIFICATION_FULLSCREEN_CHANGED,
+ NotificationService::AllSources());
- FullscreenNotificationObserver exit_observer;
ret = content::ExecuteScript(
- runtime()->web_contents(), "doExitFullscreenClick();");
+ runtime->web_contents(), "doExitFullscreenClick();");
EXPECT_TRUE(ret);
content::RunAllPendingInMessageLoop();
exit_observer.Wait();
// Calling doExitFullscreenClick defined in fullscreen.html leads to exit
// fullscreen window state, so it's expected to be not fullscreen.
- EXPECT_TRUE(false == runtime()->window()->IsFullscreen());
+ EXPECT_TRUE(false == runtime->window()->IsFullscreen());
}
GURL url = xwalk_test_utils::GetTestURL(
base::FilePath(), base::FilePath().AppendASCII("title.html"));
base::string16 title = base::ASCIIToUTF16("Dummy Title");
- content::TitleWatcher title_watcher(runtime()->web_contents(), title);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ Runtime* runtime = CreateRuntime();
+ content::TitleWatcher title_watcher(runtime->web_contents(), title);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(title, title_watcher.WaitAndGetTitle());
- NativeAppWindow* window = runtime()->window();
+ NativeAppWindow* window = runtime->window();
base::string16 window_title = window->GetNativeWindow()->title();
EXPECT_EQ(title, window_title);
}
#endif
IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, OpenLinkInNewRuntime) {
- size_t len = runtimes().size();
GURL url = xwalk_test_utils::GetTestURL(
base::FilePath(), base::FilePath().AppendASCII("new_target.html"));
- xwalk_test_utils::NavigateToURL(runtime(), url);
- bool ret = content::ExecuteScript(runtime()->web_contents(), "doClick();");
+ Runtime* runtime = CreateRuntime(url);
+ size_t len = runtimes().size();
+ bool ret = content::ExecuteScript(runtime->web_contents(), "doClick();");
EXPECT_TRUE(ret);
content::RunAllPendingInMessageLoop();
// Calling doClick defined in new_target.html leads to open a href in a new
// target window, and so it is expected to create a new Runtime instance.
- Runtime* second = WaitForSingleNewRuntime();
- EXPECT_TRUE(NULL != second);
- EXPECT_NE(runtime(), second);
EXPECT_EQ(len + 1, runtimes().size());
+ Runtime* second = runtimes().back();
+ EXPECT_TRUE(NULL != second);
+ EXPECT_NE(runtime, second);
}
#if defined(OS_TIZEN)
GURL url = xwalk_test_utils::GetTestURL(
base::FilePath(), base::FilePath().AppendASCII("tizenwebuifw.html"));
base::string16 title = base::ASCIIToUTF16("Pass");
- content::TitleWatcher title_watcher(runtime()->web_contents(), title);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ Runtime* runtime = CreateRuntime();
+ content::TitleWatcher title_watcher(runtime->web_contents(), title);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(title, title_watcher.WaitAndGetTitle());
}
#endif
enum NotificationType {
NOTIFICATION_XWALK_START = content::NOTIFICATION_CONTENT_END,
- // Notify that a new Runtime instance is created. The source is a
- // Source<Runtime> containing the affected Runtime. No details is provided.
- NOTIFICATION_RUNTIME_OPENED = NOTIFICATION_XWALK_START,
-
- // Notify that a Runtime instance is close. The source is a Source<Runtime>
- // containing the affected Runtime. No details is provided.
- NOTIFICATION_RUNTIME_CLOSED,
-
// Notify that fullscreen state of a NativeAppWindow is changed.
- NOTIFICATION_FULLSCREEN_CHANGED,
+ NOTIFICATION_FULLSCREEN_CHANGED = NOTIFICATION_XWALK_START,
NOTIFICATION_XWALK_END,
};
#if defined(OS_WIN)
#include "base/base_paths_win.h"
+#elif defined(OS_TIZEN)
+#include <tzplatform_config.h>
#elif defined(OS_LINUX)
#include "base/environment.h"
#include "base/nix/xdg_util.h"
const base::FilePath::CharType kInternalNaClPluginFileName[] =
FILE_PATH_LITERAL("internal-nacl-plugin");
-#if defined(OS_LINUX)
+#if defined(OS_TIZEN)
+base::FilePath GetAppPath() {
+ const char* app_path = getuid() != tzplatform_getuid(TZ_SYS_GLOBALAPP_USER) ?
+ tzplatform_getenv(TZ_USER_APP) :
+ tzplatform_getenv(TZ_SYS_RW_APP);
+ return base::FilePath(app_path);
+}
+
+#elif defined(OS_LINUX)
base::FilePath GetConfigPath() {
scoped_ptr<base::Environment> env(base::Environment::Create());
return base::nix::GetXDGDirectory(
CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &cur));
cur = cur.Append(xwalk_suffix);
-#elif defined(OS_TIZEN) || defined(OS_LINUX)
+#elif defined(OS_TIZEN)
+ cur = GetAppPath().Append(xwalk_suffix);
+
+#elif defined(OS_LINUX)
cur = GetConfigPath().Append(xwalk_suffix);
#elif defined(OS_MACOSX)
const base::string16 passString = base::ASCIIToUTF16("Pass");
const base::string16 failString = base::ASCIIToUTF16("Fail");
- content::RunAllPendingInMessageLoop();
- content::TitleWatcher title_watcher(runtime()->web_contents(), passString);
+ xwalk::Runtime* runtime = CreateRuntime();
+ content::TitleWatcher title_watcher(runtime->web_contents(), passString);
title_watcher.AlsoWaitForTitle(failString);
base::FilePath test_file;
.Append(FILE_PATH_LITERAL("common"))
.Append(FILE_PATH_LITERAL("common_api_browsertest.html"));
- xwalk_test_utils::NavigateToURL(runtime(), net::FilePathToFileURL(test_file));
+ xwalk_test_utils::NavigateToURL(runtime, net::FilePathToFileURL(test_file));
EXPECT_EQ(passString, title_watcher.WaitAndGetTitle());
}
const base::string16 passString = base::ASCIIToUTF16("Pass");
const base::string16 failString = base::ASCIIToUTF16("Fail");
- content::RunAllPendingInMessageLoop();
- content::TitleWatcher title_watcher(runtime()->web_contents(), passString);
+ xwalk::Runtime* runtime = CreateRuntime();
+ content::TitleWatcher title_watcher(runtime->web_contents(), passString);
title_watcher.AlsoWaitForTitle(failString);
base::FilePath test_file;
.Append(FILE_PATH_LITERAL("device_capabilities"))
.Append(FILE_PATH_LITERAL("device_capabilities_api_browsertest.html"));
- xwalk_test_utils::NavigateToURL(runtime(), net::FilePathToFileURL(test_file));
+ xwalk_test_utils::NavigateToURL(runtime, net::FilePathToFileURL(test_file));
EXPECT_EQ(passString, title_watcher.WaitAndGetTitle());
}
#include "xwalk/test/base/xwalk_test_utils.h"
using namespace xwalk::extensions; // NOLINT
+using xwalk::Runtime;
namespace {
const base::string16 passString = base::ASCIIToUTF16("Pass");
const base::string16 failString = base::ASCIIToUTF16("Fail");
- content::RunAllPendingInMessageLoop();
- content::TitleWatcher title_watcher(runtime()->web_contents(), passString);
+ Runtime* runtime = CreateRuntime();
+ content::TitleWatcher title_watcher(runtime->web_contents(), passString);
title_watcher.AlsoWaitForTitle(failString);
base::FilePath test_file;
.Append(FILE_PATH_LITERAL("raw_socket"))
.Append(FILE_PATH_LITERAL("raw_socket_api_browsertest.html"));
- xwalk_test_utils::NavigateToURL(runtime(), net::FilePathToFileURL(test_file));
+ xwalk_test_utils::NavigateToURL(runtime, net::FilePathToFileURL(test_file));
EXPECT_EQ(passString, title_watcher.WaitAndGetTitle());
}
#include "base/strings/string_number_conversions.h"
#include "base/test/test_file_util.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
using xwalk::Runtime;
using xwalk::XWalkContentRendererClient;
using xwalk::XWalkRunner;
+using xwalk::NativeAppWindow;
namespace {
base::LazyInstance<XWalkContentRendererClient>::Leaky
g_xwalk_content_renderer_client = LAZY_INSTANCE_INITIALIZER;
#endif
-
-Runtime* CreateWithDefaultWindow(
- xwalk::RuntimeContext* runtime_context, const GURL& url,
- Runtime::Observer* observer = NULL) {
- Runtime* runtime = Runtime::Create(runtime_context, observer);
- runtime->LoadURL(url);
-#if !defined(OS_ANDROID)
- xwalk::RuntimeUIStrategy ui_strategy;
- xwalk::NativeAppWindow::CreateParams params;
- ui_strategy.Show(runtime, params);
-#endif
- return runtime;
-}
-
-} // namespace
-
-RuntimeRegistry::RuntimeRegistry() {
-}
-
-RuntimeRegistry::~RuntimeRegistry() {
-}
-
-void RuntimeRegistry::CloseAll() {
- if (runtimes_.empty())
- return;
-
- RuntimeList cached(runtimes_);
- std::for_each(cached.begin(), cached.end(), std::mem_fun(&Runtime::Close));
- // Wait until all windows are closed.
- content::RunAllPendingInMessageLoop();
- DCHECK(runtimes_.empty()) << runtimes_.size();
-}
-
-void RuntimeRegistry::OnRuntimeAdded(Runtime* runtime) {
- DCHECK(runtime);
- runtimes_.push_back(runtime);
-}
-
-void RuntimeRegistry::OnRuntimeRemoved(Runtime* runtime) {
- DCHECK(runtime);
- RuntimeList::iterator it =
- std::find(runtimes_.begin(), runtimes_.end(), runtime);
- DCHECK(it != runtimes_.end());
- runtimes_.erase(it);
-
- if (runtimes_.empty())
- base::MessageLoop::current()->PostTask(
- FROM_HERE, base::MessageLoop::QuitClosure());
-}
-
-InProcessBrowserTest::InProcessBrowserTest()
- : runtime_registry_(new RuntimeRegistry),
- runtime_(NULL) {
- CreateTestServer(base::FilePath(FILE_PATH_LITERAL("xwalk/test/data")));
-}
-
-InProcessBrowserTest::~InProcessBrowserTest() {
-}
-
-base::CommandLine InProcessBrowserTest::GetCommandLineForRelaunch() {
+// Return a CommandLine object that is used to relaunch the browser_test
+// binary as a browser process.
+base::CommandLine GetCommandLineForRelaunch() {
base::CommandLine new_command_line(
base::CommandLine::ForCurrentProcess()->GetProgram());
CommandLine::SwitchMap switches =
CommandLine::ForCurrentProcess()->GetSwitches();
new_command_line.AppendSwitch(content::kLaunchAsBrowser);
- for (base::CommandLine::SwitchMap::const_iterator iter = switches.begin();
- iter != switches.end(); ++iter) {
+ for (auto iter = switches.begin(); iter != switches.end(); ++iter) {
new_command_line.AppendSwitchNative((*iter).first, (*iter).second);
}
return new_command_line;
}
+} // namespace
+
+InProcessBrowserTest::InProcessBrowserTest() {
+ CreateTestServer(base::FilePath(FILE_PATH_LITERAL("xwalk/test/data")));
+}
+
+InProcessBrowserTest::~InProcessBrowserTest() {
+}
+
void InProcessBrowserTest::SetUp() {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
// Allow subclasses to change the command line before running any tests.
SetUpCommandLine(command_line);
// Add command line arguments that are used by all InProcessBrowserTests.
- PrepareTestCommandLine(command_line);
+ xwalk_test_utils::PrepareBrowserCommandLineForTests(command_line);
// Single-process mode is not set in BrowserMain, so process it explicitly,
// and set up renderer.
BrowserTestBase::SetUp();
}
-xwalk::RuntimeContext* InProcessBrowserTest::GetRuntimeContext() const {
- return XWalkRunner::GetInstance()->runtime_context();
-}
-
-void InProcessBrowserTest::PrepareTestCommandLine(
- base::CommandLine* command_line) {
- // Propagate commandline settings from test_launcher_utils.
- xwalk_test_utils::PrepareBrowserCommandLineForTests(command_line);
-}
-
-const InProcessBrowserTest::RuntimeList& InProcessBrowserTest::runtimes()
- const {
- return runtime_registry_->runtimes();
+Runtime* InProcessBrowserTest::CreateRuntime(
+ const GURL& url, const NativeAppWindow::CreateParams& params) {
+ Runtime* runtime = Runtime::Create(
+ XWalkRunner::GetInstance()->browser_context());
+ runtime->set_observer(this);
+ runtimes_.push_back(runtime);
+ runtime->LoadURL(url);
+ content::WaitForLoadStop(runtime->web_contents());
+ runtime->set_ui_delegate(
+ xwalk::DefaultRuntimeUIDelegate::Create(runtime, params));
+ runtime->Show();
+ return runtime;
}
void InProcessBrowserTest::RunTestOnMainThreadLoop() {
// Pump startup related events.
content::RunAllPendingInMessageLoop();
- // FIXME : Unfortunately too many tests now rely on the 'runtime()'
- // method, instead they should just create runtimes themselves
- // when needed and thus the 'runtime()' method should be removed
- // as well as 'runtime_' initialization below.
- runtime_ = CreateWithDefaultWindow(
- GetRuntimeContext(),
- GURL(), runtime_registry_.get());
- content::WaitForLoadStop(runtime_->web_contents());
- content::RunAllPendingInMessageLoop();
SetUpOnMainThread();
// gtest in that it invokes TearDown even if Setup fails.
ProperMainThreadCleanup();
- runtime_registry_->CloseAll();
+ CloseAll();
+}
+
+void InProcessBrowserTest::OnNewRuntimeAdded(Runtime* runtime) {
+ DCHECK(runtime);
+ runtimes_.push_back(runtime);
+ runtime->set_observer(this);
+ runtime->set_ui_delegate(
+ xwalk::DefaultRuntimeUIDelegate::Create(runtime));
+ runtime->Show();
+}
+
+void InProcessBrowserTest::OnRuntimeClosed(Runtime* runtime) {
+ DCHECK(runtime);
+ auto it = std::find(runtimes_.begin(), runtimes_.end(), runtime);
+ DCHECK(it != runtimes_.end());
+ runtimes_.erase(it);
+
+ if (runtimes_.empty())
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE, base::MessageLoop::QuitClosure());
+}
+
+void InProcessBrowserTest::CloseAll() {
+ if (runtimes_.empty())
+ return;
+
+ RuntimeList to_be_closed(runtimes_.get());
+ for (Runtime* runtime : to_be_closed)
+ runtime->Close();
+ // Wait until all windows are closed.
+ content::RunAllPendingInMessageLoop();
+ DCHECK(runtimes_.empty()) << runtimes_.size();
}
bool InProcessBrowserTest::CreateDataPathDir() {
}
return xwalk_test_utils::OverrideDataPathDir(data_path_dir);
}
+
#include "base/files/scoped_temp_dir.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_base.h"
#include "testing/gtest/include/gtest/gtest.h"
class RuleBasedHostResolverProc;
}
-class RuntimeRegistry : public xwalk::Runtime::Observer {
- public:
- typedef std::vector<xwalk::Runtime*> RuntimeList;
- RuntimeRegistry();
- virtual ~RuntimeRegistry();
-
- void CloseAll();
- const RuntimeList& runtimes() const { return runtimes_; }
-
- private:
- virtual void OnRuntimeAdded(xwalk::Runtime* runtime) OVERRIDE;
- virtual void OnRuntimeRemoved(xwalk::Runtime* runtime) OVERRIDE;
-
- RuntimeList runtimes_;
-};
-
// Base class for tests wanting to bring up a runtime (aka. browser) in the
// unit test process.
//
// Reference comments in chrome/test/base/in_process_browser_test.h file
// about how to write a InProcessBrowserTest.
//
-class InProcessBrowserTest : public content::BrowserTestBase {
+class InProcessBrowserTest : public content::BrowserTestBase,
+ public xwalk::Runtime::Observer {
public:
- typedef RuntimeRegistry::RuntimeList RuntimeList;
+ using RuntimeList = std::vector<xwalk::Runtime*>;
InProcessBrowserTest();
virtual ~InProcessBrowserTest();
// Configures everything for an in process browser test, then invokes
// BrowserMain. BrowserMain ends up invoking RunTestOnMainThreadLoop.
- virtual void SetUp() OVERRIDE;
+ virtual void SetUp() override;
protected:
- // FIXME : Two following methods should be removed!
- xwalk::Runtime* runtime() const { return runtime_; }
- const RuntimeList& runtimes() const;
- // Use this as an observer when create a 'Runtime' instance within a test.
- RuntimeRegistry* runtime_registry() const {
- return runtime_registry_.get(); }
+ const RuntimeList& runtimes() const { return runtimes_.get(); }
- xwalk::RuntimeContext* GetRuntimeContext() const;
+ xwalk::Runtime* CreateRuntime(
+ const GURL& url = GURL(),
+ const xwalk::NativeAppWindow::CreateParams& params =
+ xwalk::NativeAppWindow::CreateParams());
// Override this to add any custom cleanup code that needs to be done on the
// main thread before the browser is torn down.
virtual void ProperMainThreadCleanup() {}
// BrowserTestBase:
- virtual void RunTestOnMainThreadLoop() OVERRIDE;
-
- // Return a CommandLine object that is used to relaunch the browser_test
- // binary as a browser process.
- base::CommandLine GetCommandLineForRelaunch();
+ virtual void RunTestOnMainThreadLoop() override;
private:
+ // xwalk::Runtime::Observer
+ virtual void OnNewRuntimeAdded(xwalk::Runtime* runtime) override;
+ virtual void OnRuntimeClosed(xwalk::Runtime* runtime) override;
+
+ void CloseAll();
// Create data path directory for this test to avoid pollution in default
// data path. Return true if success.
bool CreateDataPathDir();
- // Prepare command line that will be used to launch the child browser process
- // with an in-process test.
- void PrepareTestCommandLine(base::CommandLine* command_line);
-
- scoped_ptr<RuntimeRegistry> runtime_registry_;
- // FIXME : Should be removed.
- xwalk::Runtime* runtime_;
+ ScopedVector<xwalk::Runtime> runtimes_;
// Temporary data path directory. Used only when a data path directory is not
// specified in the command line.
'experimental/native_file_system/native_file_system_extension.cc',
'experimental/native_file_system/native_file_system_extension.h',
'experimental/native_file_system/virtual_root_provider_mac.cc',
+ 'experimental/native_file_system/virtual_root_provider_tizen.cc',
'experimental/native_file_system/virtual_root_provider_win.cc',
'experimental/native_file_system/virtual_root_provider.cc',
'experimental/native_file_system/virtual_root_provider.h',
'runtime/browser/renderer_host/pepper/xwalk_browser_pepper_host_factory.h',
'runtime/browser/runtime.cc',
'runtime/browser/runtime.h',
- 'runtime/browser/runtime_context.cc',
- 'runtime/browser/runtime_context.h',
- 'runtime/browser/runtime_defered_ui_strategy.cc',
- 'runtime/browser/runtime_defered_ui_strategy.h',
'runtime/browser/runtime_download_manager_delegate.cc',
'runtime/browser/runtime_download_manager_delegate.h',
'runtime/browser/runtime_file_select_helper.cc',
'runtime/browser/runtime_resource_dispatcher_host_delegate_android.h',
'runtime/browser/runtime_select_file_policy.cc',
'runtime/browser/runtime_select_file_policy.h',
- 'runtime/browser/runtime_ui_strategy.cc',
- 'runtime/browser/runtime_ui_strategy.h',
+ 'runtime/browser/runtime_ui_delegate.cc',
+ 'runtime/browser/runtime_ui_delegate.h',
'runtime/browser/runtime_url_request_context_getter.cc',
'runtime/browser/runtime_url_request_context_getter.h',
'runtime/browser/speech/speech_recognition_manager_delegate.cc',
'runtime/browser/ui/color_chooser_mac.cc',
'runtime/browser/ui/native_app_window.cc',
'runtime/browser/ui/native_app_window.h',
+ 'runtime/browser/ui/native_app_window_aura.cc',
+ 'runtime/browser/ui/native_app_window_aura.h',
'runtime/browser/ui/native_app_window_android.cc',
'runtime/browser/ui/native_app_window_mac.h',
'runtime/browser/ui/native_app_window_mac.mm',
'runtime/browser/xwalk_app_extension_bridge.h',
'runtime/browser/xwalk_application_mac.h',
'runtime/browser/xwalk_application_mac.mm',
+ 'runtime/browser/xwalk_browser_context.cc',
+ 'runtime/browser/xwalk_browser_context.h',
'runtime/browser/xwalk_browser_main_parts.cc',
'runtime/browser/xwalk_browser_main_parts.h',
'runtime/browser/xwalk_browser_main_parts_android.cc',
'../content/app/resources/content_resources.gyp:content_resources',
'../ui/compositor/compositor.gyp:compositor',
'build/system.gyp:tizen_geolocation',
+ 'build/system.gyp:tizen_tzplatform_config',
'sysapps/sysapps_resources.gyp:xwalk_sysapps_resources',
'tizen/xwalk_tizen.gypi:xwalk_tizen_lib',
'<(DEPTH)/third_party/jsoncpp/jsoncpp.gyp:jsoncpp',
'../components/components.gyp:web_modal',
'../components/components.gyp:renderer_context_menu',
],
- 'cflags': [
- '<!@(pkg-config --cflags libtzplatform-config)',
- ],
- 'link_settings': {
- 'libraries': [
- '<!@(pkg-config --libs libtzplatform-config)',
- ],
- },
'sources': [
- 'experimental/native_file_system/virtual_root_provider_tizen.cc',
'runtime/browser/tizen/tizen_locale_listener.cc',
'runtime/browser/tizen/tizen_locale_listener.h',
'runtime/browser/tizen/xwalk_web_contents_view_delegate.cc',
'../ui/views/views.gyp:views',
'../ui/resources/ui_resources.gyp:ui_resources',
],
+ 'sources/': [
+ ['exclude', 'runtime/browser/ui/native_app_window_aura.cc'],
+ ],
+ }, { # toolkit_views==0
+ 'sources/': [
+ ['exclude', 'runtime/browser/ui/xwalk_views_delegate.cc'],
+ ['exclude', 'runtime/browser/ui/color_chooser_aura.cc'],
+ ],
}], # toolkit_views==1
['use_aura==1', {
'dependencies': [
'../ui/aura/aura.gyp:aura',
],
- }, { # use_aura==0
- 'sources/': [
- ['exclude', '_aura\\.cc$'],
- ],
}],
['disable_nacl==0', {
'conditions': [