From 0ca4a32440ba3746eeae12116b8c648debd0e3e6 Mon Sep 17 00:00:00 2001 From: Mikhail Pozdnyakov Date: Tue, 2 Dec 2014 16:34:31 +0200 Subject: [PATCH] Rename xwalk::Runtime to xwalk::XWalkContent Rename xwalk::Runtime to xwalk::XWalkContent and stop compiling it on Android. --- application/browser/application.cc | 55 +++++++------ application/browser/application.h | 23 +++--- application/browser/application_service.cc | 2 +- application/browser/application_tizen.cc | 75 +++++++++--------- application/browser/application_tizen.h | 6 +- .../application_runtime_extension.cc | 2 +- .../extension/application_widget_extension.cc | 2 +- application/test/application_test.cc | 4 +- .../native_file_system_api_browsertest.cc | 4 +- extensions/browser/xwalk_extension_service.h | 2 +- extensions/test/bad_extension_test.cc | 8 +- extensions/test/conflicting_entry_points.cc | 8 +- extensions/test/context_destruction.cc | 6 +- extensions/test/crash_extension_process.cc | 6 +- extensions/test/export_object.cc | 4 +- extensions/test/extension_in_iframe.cc | 12 +-- extensions/test/external_extension.cc | 18 ++--- .../test/external_extension_multi_process.cc | 16 ++-- .../test/in_process_threads_browsertest.cc | 6 +- .../test/internal_extension_browsertest.cc | 6 +- extensions/test/namespace_read_only.cc | 8 +- extensions/test/nested_namespace.cc | 10 +-- extensions/test/v8tools_module.cc | 6 +- .../test/xwalk_extensions_browsertest.cc | 14 ++-- .../devtools/xwalk_devtools_browsertest.cc | 6 +- .../devtools/xwalk_devtools_delegate.cc | 78 +++++++++++-------- .../devtools/xwalk_devtools_delegate.h | 20 +++-- runtime/browser/runtime_ui_delegate.cc | 32 ++++---- runtime/browser/runtime_ui_delegate.h | 8 +- runtime/browser/ui/native_app_window_mac.mm | 2 +- .../browser/{runtime.cc => xwalk_content.cc} | 74 +++++++++--------- .../browser/{runtime.h => xwalk_content.h} | 39 +++++----- runtime/browser/xwalk_download_browsertest.cc | 12 +-- .../browser/xwalk_form_input_browsertest.cc | 8 +- runtime/browser/xwalk_runtime_browsertest.cc | 22 +++--- sysapps/common/common_api_browsertest.cc | 4 +- .../device_capabilities_api_browsertest.cc | 4 +- .../raw_socket/raw_socket_api_browsertest.cc | 6 +- test/base/in_process_browser_test.cc | 46 +++++------ test/base/in_process_browser_test.h | 17 ++-- test/base/xwalk_test_utils.cc | 4 +- test/base/xwalk_test_utils.h | 4 +- xwalk.gyp | 8 +- 43 files changed, 360 insertions(+), 337 deletions(-) rename runtime/browser/{runtime.cc => xwalk_content.cc} (80%) rename runtime/browser/{runtime.h => xwalk_content.h} (84%) diff --git a/application/browser/application.cc b/application/browser/application.cc index 64e85ea5cd..14e6c22193 100644 --- a/application/browser/application.cc +++ b/application/browser/application.cc @@ -21,7 +21,7 @@ #include "xwalk/application/common/application_manifest_constants.h" #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/xwalk_content.h" #include "xwalk/runtime/browser/runtime_ui_delegate.h" #include "xwalk/runtime/browser/xwalk_browser_context.h" #include "xwalk/runtime/browser/xwalk_runner.h" @@ -204,7 +204,7 @@ ui::WindowShowState Application::GetWindowShowState( } bool Application::Launch(const LaunchParams& launch_params) { - if (!runtimes_.empty()) { + if (!pages_.empty()) { LOG(ERROR) << "Attempt to launch app with id " << id() << ", but it is already running."; return false; @@ -220,14 +220,14 @@ bool Application::Launch(const LaunchParams& launch_params) { remote_debugging_enabled_ = launch_params.remote_debugging; 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(); + XWalkContent* page = XWalkContent::Create(browser_context_, site); + page->set_observer(this); + pages_.push_back(page); + render_process_host_ = page->GetRenderProcessHost(); render_process_host_->AddObserver(this); - web_contents_ = runtime->web_contents(); + web_contents_ = page->web_contents(); InitSecurityPolicy(); - runtime->LoadURL(url); + page->LoadURL(url); NativeAppWindow::CreateParams params; params.net_wm_pid = launch_params.launcher_pid; @@ -236,9 +236,9 @@ bool Application::Launch(const LaunchParams& launch_params) { GetWindowShowState(launch_params); window_show_params_ = params; - // Only the first runtime can have a launch screen. + // Only the first page can have a launch screen. params.splash_screen_path = GetSplashScreenPath(); - runtime->set_ui_delegate(DefaultRuntimeUIDelegate::Create(runtime, params)); + page->set_ui_delegate(DefaultRuntimeUIDelegate::Create(page, params)); // We call "Show" after RP is initialized to reduce // the application start up time. @@ -256,9 +256,9 @@ GURL Application::GetAbsoluteURLFromKey(const std::string& key) { } void Application::Terminate() { - std::vector to_be_closed(runtimes_.get()); - for (Runtime* runtime : to_be_closed) - runtime->Close(); + std::vector to_be_closed(pages_.get()); + for (XWalkContent* content : to_be_closed) + content->Close(); } int Application::GetRenderProcessHostID() const { @@ -266,22 +266,21 @@ int Application::GetRenderProcessHostID() const { return render_process_host_->GetID(); } -void Application::OnNewRuntimeAdded(Runtime* runtime) { - runtime->set_remote_debugging_enabled(remote_debugging_enabled_); - runtime->set_observer(this); - runtime->set_ui_delegate( - DefaultRuntimeUIDelegate::Create(runtime, window_show_params_)); - runtime->Show(); - runtimes_.push_back(runtime); +void Application::OnContentCreated(XWalkContent* page) { + page->set_remote_debugging_enabled(remote_debugging_enabled_); + page->set_observer(this); + page->set_ui_delegate( + DefaultRuntimeUIDelegate::Create(page, window_show_params_)); + page->Show(); + pages_.push_back(page); } -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); +void Application::OnContentClosed(XWalkContent* page) { + auto found = std::find(pages_.begin(), pages_.end(), page); + CHECK(found != pages_.end()); + pages_.erase(found); - if (runtimes_.empty()) + if (pages_.empty()) base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(&Application::NotifyTermination, weak_factory_.GetWeakPtr())); @@ -309,8 +308,8 @@ void Application::NotifyTermination() { } void Application::RenderChannelCreated() { - CHECK(!runtimes_.empty()); - runtimes_.front()->Show(); + CHECK(!pages_.empty()); + pages_.front()->Show(); } bool Application::UseExtension(const std::string& extension_name) const { diff --git a/application/browser/application.h b/application/browser/application.h index 38d24dae52..48eda988a3 100644 --- a/application/browser/application.h +++ b/application/browser/application.h @@ -21,7 +21,8 @@ #include "ui/base/ui_base_types.h" #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/ui/native_app_window.h" +#include "xwalk/runtime/browser/xwalk_content.h" namespace content { class RenderProcessHost; @@ -43,15 +44,15 @@ class ApplicationSecurityPolicy; // ApplicationService will delete an Application instance when it is // terminated. // There's one-to-one correspondence between Application and Render Process -// Host, obtained from its "runtimes" (pages). -class Application : public Runtime::Observer, +// Host, obtained from its "contents" (pages). +class Application : public XWalkContent::Observer, public content::RenderProcessHostObserver { public: virtual ~Application(); class Observer { public: - // Invoked when application is terminated - all its pages (runtimes) + // Invoked when application is terminated - all its pages (contents) // are closed. virtual void OnApplicationTerminated(Application* app) {} @@ -68,7 +69,7 @@ class Application : public Runtime::Observer, bool remote_debugging; }; - // Closes all the application's runtimes (application pages). + // Closes all the application's pages (application pages). // NOTE: Application is terminated asynchronously. // Please use ApplicationService::Observer::WillDestroyApplication() // interface to be notified about actual app termination. @@ -77,7 +78,7 @@ class Application : public Runtime::Observer, // immediately after its termination. void Terminate(); - const std::vector& runtimes() const { return runtimes_.get(); } + const std::vector& pages() const { return pages_.get(); } // Returns the unique application id which is used to distinguish the // application amoung both running applications and installed ones @@ -93,7 +94,7 @@ class Application : public Runtime::Observer, // Tells whether the application use the specified extension. bool UseExtension(const std::string& extension_name) const; - // The runtime permission mapping is registered by extension which + // The content permission mapping is registered by extension which // implements some specific API, for example: // "bluetooth" -> "bluetooth.read, bluetooth.write, bluetooth.management" // Whenever there comes a API permission request, we can tell whether @@ -122,16 +123,16 @@ class Application : public Runtime::Observer, virtual bool Launch(const LaunchParams& launch_params); virtual void InitSecurityPolicy(); - // Runtime::Observer implementation. - virtual void OnNewRuntimeAdded(Runtime* runtime) override; - virtual void OnRuntimeClosed(Runtime* runtime) override; + // XWalkContent::Observer implementation. + virtual void OnContentCreated(XWalkContent* content) override; + virtual void OnContentClosed(XWalkContent* content) 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(); XWalkBrowserContext* browser_context_; - ScopedVector runtimes_; + ScopedVector pages_; scoped_refptr const data_; // The application's render process host. content::RenderProcessHost* render_process_host_; diff --git a/application/browser/application_service.cc b/application/browser/application_service.cc index 2dbc11de05..afae1f26b2 100644 --- a/application/browser/application_service.cc +++ b/application/browser/application_service.cc @@ -22,7 +22,7 @@ #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.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/runtime/browser/xwalk_browser_context.h" #include "xwalk/runtime/common/xwalk_paths.h" diff --git a/application/browser/application_tizen.cc b/application/browser/application_tizen.cc index 4d8d31fce1..dfd8920b3a 100644 --- a/application/browser/application_tizen.cc +++ b/application/browser/application_tizen.cc @@ -44,25 +44,25 @@ namespace application { const char kDefaultMediaAppClass[] = "player"; namespace { #if defined(OS_TIZEN_MOBILE) -void ApplyRootWindowParams(Runtime* runtime, +void ApplyRootWindowParams(XWalkContent* content, NativeAppWindow::CreateParams* params) { if (!params->delegate) - params->delegate = runtime; + params->delegate = content; if (params->bounds.IsEmpty()) params->bounds = gfx::Rect(0, 0, 840, 600); - unsigned int fullscreen_options = runtime->fullscreen_options(); + unsigned int fullscreen_options = content->fullscreen_options(); if (params->state == ui::SHOW_STATE_FULLSCREEN) - fullscreen_options |= Runtime::FULLSCREEN_FOR_LAUNCH; + fullscreen_options |= XWalkContent::FULLSCREEN_FOR_LAUNCH; else fullscreen_options &= ~Runtime::FULLSCREEN_FOR_LAUNCH; - runtime->set_fullscreen_options(fullscreen_options); + content->set_fullscreen_options(fullscreen_options); } -NativeAppWindow* CreateRootWindow(Runtime* runtime, +NativeAppWindow* CreateRootWindow(XWalkContent* content, const NativeAppWindow::CreateParams& params) { NativeAppWindow::CreateParams effective_params(params); - ApplyRootWindowParams(runtime, &effective_params); + ApplyRootWindowParams(content, &effective_params); return NativeAppWindow::Create(effective_params); } #endif @@ -109,11 +109,11 @@ class ScreenOrientationProviderTizen : return; } request_id_ = request_id; - const std::vector& runtimes = app_->runtimes(); - DCHECK(!runtimes.empty()); + const std::vector& pages = app_->pages(); + DCHECK(!pages.empty()); // FIXME: Probably need better alignment with // https://w3c.github.io/screen-orientation/#screen-orientation-lock-lifetime - for (auto it = runtimes.begin(); it != runtimes.end(); ++it) { + for (auto it = pages.begin(); it != pages.end(); ++it) { NativeAppWindow* window = (*it)->window(); if (window && window->IsActive()) { ToNativeAppWindowTizen(window)->LockOrientation(lock); @@ -157,17 +157,17 @@ ApplicationTizen::~ApplicationTizen() { } void ApplicationTizen::Hide() { - DCHECK(!runtimes_.empty()); - for (auto it = runtimes_.begin(); it != runtimes_.end(); ++it) { - if ((*it)->window()) - (*it)->window()->Minimize(); + DCHECK(!pages_.empty()); + for (XWalkContent* page : pages_) { + if (auto window = page->window()) + window->Minimize(); } } void ApplicationTizen::Show() { - DCHECK(!runtimes_.empty()); - for (Runtime* runtime : runtimes_) { - if (auto window = runtime->window()) + DCHECK(!pages_.empty()); + for (XWalkContent* page : pages_) { + if (auto window = page->window()) window->Restore(); } } @@ -175,8 +175,8 @@ void ApplicationTizen::Show() { bool ApplicationTizen::Launch(const LaunchParams& launch_params) { if (Application::Launch(launch_params)) { #if defined(OS_TIZEN_MOBILE) - if (!runtimes_.empty()) { - root_window_ = CreateRootWindow(*(runtimes_.begin()), + if (!pages_.empty()) { + root_window_ = CreateRootWindow(*(pages_.begin()), window_show_params_); window_show_params_.parent = root_window_->GetNativeWindow(); root_window_->Show(); @@ -234,10 +234,9 @@ void ApplicationTizen::Suspend() { DCHECK(render_process_host_); render_process_host_->Send(new ViewMsg_SuspendJSEngine(true)); - DCHECK(!runtimes_.empty()); - for (auto it = runtimes_.begin(); it != runtimes_.end(); ++it) { - if ((*it)->web_contents()) - (*it)->web_contents()->WasHidden(); + DCHECK(!pages_.empty()); + for (XWalkContent* page : pages_) { + page->web_contents()->WasHidden(); } is_suspended_ = true; } @@ -249,10 +248,9 @@ void ApplicationTizen::Resume() { DCHECK(render_process_host_); render_process_host_->Send(new ViewMsg_SuspendJSEngine(false)); - DCHECK(!runtimes_.empty()); - for (auto it = runtimes_.begin(); it != runtimes_.end(); ++it) { - if ((*it)->web_contents()) - (*it)->web_contents()->WasShown(); + DCHECK(!pages_.empty()); + for (XWalkContent* page : pages_) { + page->web_contents()->WasShown(); } is_suspended_ = false; } @@ -282,10 +280,9 @@ void ApplicationTizen::DidProcessEvent( if (info && !info->hwkey_enabled()) return; - 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())); + for (XWalkContent* page : pages_) { + page->web_contents()->GetRenderViewHost()->Send(new ViewMsg_HWKeyPressed( + page->web_contents()->GetRoutingID(), key_event->key_code())); } } #endif @@ -299,20 +296,20 @@ void ApplicationTizen::SetUserAgentString( cookie_manager_->SetUserAgentString(render_process_host_, user_agent_string); } -void ApplicationTizen::OnNewRuntimeAdded(Runtime* runtime) { - DCHECK(runtime); - Application::OnNewRuntimeAdded(runtime); +void ApplicationTizen::OnContentCreated(XWalkContent* content) { + DCHECK(content); + Application::OnContentCreated(content); #if defined(OS_TIZEN_MOBILE) - if (root_window_ && runtimes_.size() > 1) + if (root_window_ && pages_.size() > 1) root_window_->Show(); #endif } -void ApplicationTizen::OnRuntimeClosed(Runtime* runtime) { - DCHECK(runtime); - Application::OnRuntimeClosed(runtime); +void ApplicationTizen::OnContentClosed(XWalkContent* content) { + DCHECK(content); + Application::OnContentClosed(content); #if defined(OS_TIZEN_MOBILE) - if (runtimes_.empty() && root_window_) { + if (pages_.empty() && root_window_) { root_window_->Close(); root_window_ = NULL; } diff --git a/application/browser/application_tizen.h b/application/browser/application_tizen.h index 98e5b41cea..29f3dbf70b 100644 --- a/application/browser/application_tizen.h +++ b/application/browser/application_tizen.h @@ -42,9 +42,9 @@ class ApplicationTizen : // NOLINT virtual base::FilePath GetSplashScreenPath() OVERRIDE; - // Runtime::Observer implementation. - virtual void OnNewRuntimeAdded(Runtime* runtime) OVERRIDE; - virtual void OnRuntimeClosed(Runtime* runtime) OVERRIDE; + // XWalkContent::Observer implementation. + virtual void OnContentCreated(XWalkContent* content) OVERRIDE; + virtual void OnContentClosed(XWalkContent* content) OVERRIDE; #if defined(USE_OZONE) virtual void WillProcessEvent(const ui::PlatformEvent& event) OVERRIDE; diff --git a/application/extension/application_runtime_extension.cc b/application/extension/application_runtime_extension.cc index e5c936d4dc..a85ed3af12 100644 --- a/application/extension/application_runtime_extension.cc +++ b/application/extension/application_runtime_extension.cc @@ -12,7 +12,7 @@ #include "ui/base/resource/resource_bundle.h" #include "xwalk/application/browser/application.h" #include "xwalk/application/common/application_data.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" using content::BrowserThread; diff --git a/application/extension/application_widget_extension.cc b/application/extension/application_widget_extension.cc index af28a65fb1..18d3e1f8eb 100644 --- a/application/extension/application_widget_extension.cc +++ b/application/extension/application_widget_extension.cc @@ -19,7 +19,7 @@ #include "xwalk/application/common/application_manifest_constants.h" #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/xwalk_content.h" #include "xwalk/runtime/browser/xwalk_browser_context.h" #include "xwalk/runtime/browser/xwalk_runner.h" #include "xwalk/runtime/common/xwalk_paths.h" diff --git a/application/test/application_test.cc b/application/test/application_test.cc index dd017450ff..57ed6b90af 100644 --- a/application/test/application_test.cc +++ b/application/test/application_test.cc @@ -35,7 +35,7 @@ IN_PROC_BROWSER_TEST_F(ApplicationTest, TestMultiApp) { test_runner_->WaitForTestNotification(); EXPECT_EQ(test_runner_->GetTestsResult(), ApiTestRunner::PASS); // The App1 has 2 pages: main doc page and "main.html" page. - EXPECT_EQ(app1->runtimes().size(), 1); + EXPECT_EQ(app1->pages().size(), 1); EXPECT_EQ(service->active_applications().size(), currently_running_count + 1); EXPECT_EQ(service->GetApplicationByID(app1->id()), app1); @@ -59,7 +59,7 @@ IN_PROC_BROWSER_TEST_F(ApplicationTest, TestMultiApp) { EXPECT_EQ(test_runner_->GetTestsResult(), ApiTestRunner::PASS); // The App2 also has 2 pages: main doc page and "main.html" page. - EXPECT_EQ(app2->runtimes().size(), 1); + EXPECT_EQ(app2->pages().size(), 1); // Check that the apps have different IDs and RPH IDs. EXPECT_NE(app1->id(), app2->id()); diff --git a/experimental/native_file_system/native_file_system_api_browsertest.cc b/experimental/native_file_system/native_file_system_api_browsertest.cc index d20cd0bc94..9bf19e84e2 100644 --- a/experimental/native_file_system/native_file_system_api_browsertest.cc +++ b/experimental/native_file_system/native_file_system_api_browsertest.cc @@ -8,7 +8,7 @@ #include "content/public/test/test_utils.h" #include "net/base/filename_util.h" #include "xwalk/experimental/native_file_system/virtual_root_provider.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/test/base/in_process_browser_test.h" #include "xwalk/test/base/xwalk_test_utils.h" @@ -16,7 +16,7 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, NativeFileSystem) { const base::string16 passString = base::ASCIIToUTF16("Pass"); const base::string16 failString = base::ASCIIToUTF16("Fail"); - xwalk::Runtime* runtime = CreateRuntime(); + xwalk::XWalkContent* runtime = CreateContent(); content::TitleWatcher title_watcher(runtime->web_contents(), passString); title_watcher.AlsoWaitForTitle(failString); diff --git a/extensions/browser/xwalk_extension_service.h b/extensions/browser/xwalk_extension_service.h index 6e856e11aa..2fb879bb08 100644 --- a/extensions/browser/xwalk_extension_service.h +++ b/extensions/browser/xwalk_extension_service.h @@ -76,7 +76,7 @@ class XWalkExtensionService : public content::NotificationObserver, scoped_ptr runtime_variables); // To be called when a RenderProcess died, so we can gracefully shutdown the - // associated ExtensionProcess. See Runtime::RenderProcessGone() and + // associated ExtensionProcess. See XWalkContent::RenderProcessGone() and // XWalkContentBrowserClient::RenderProcessHostGone(). void OnRenderProcessDied(content::RenderProcessHost* host); diff --git a/extensions/test/bad_extension_test.cc b/extensions/test/bad_extension_test.cc index 90273b1141..7692fffcc0 100644 --- a/extensions/test/bad_extension_test.cc +++ b/extensions/test/bad_extension_test.cc @@ -7,12 +7,12 @@ #include "base/strings/utf_string_conversions.h" #include "xwalk/extensions/browser/xwalk_extension_service.h" #include "xwalk/extensions/test/xwalk_extensions_test_base.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/test/base/xwalk_test_utils.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" -using xwalk::Runtime; +using xwalk::XWalkContent; using xwalk::extensions::XWalkExtensionService; class BadExtensionTest : public XWalkExtensionsTestBase { @@ -29,7 +29,7 @@ IN_PROC_BROWSER_TEST_F(BadExtensionTest, DoNotCrash) { << " The goal is to not crash."; GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("bad.html")); - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); content::TitleWatcher title_watcher(runtime->web_contents(), kPassString); title_watcher.AlsoWaitForTitle(kFailString); xwalk_test_utils::NavigateToURL(runtime, url); @@ -41,7 +41,7 @@ IN_PROC_BROWSER_TEST_F(BadExtensionTest, NavigateDoNotCrash) { << " The goal is to not crash."; GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("bad.html")); - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); content::TitleWatcher title_watcher(runtime->web_contents(), kPassString); title_watcher.AlsoWaitForTitle(kFailString); diff --git a/extensions/test/conflicting_entry_points.cc b/extensions/test/conflicting_entry_points.cc index 650230efd8..2eaaf64866 100644 --- a/extensions/test/conflicting_entry_points.cc +++ b/extensions/test/conflicting_entry_points.cc @@ -8,11 +8,11 @@ #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" #include "xwalk/extensions/common/xwalk_extension.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/test/base/xwalk_test_utils.h" using namespace xwalk::extensions; // NOLINT -using xwalk::Runtime; +using xwalk::XWalkContent; namespace { @@ -107,7 +107,7 @@ class XWalkExtensionsConflictsWithEntryPointTest IN_PROC_BROWSER_TEST_F(XWalkExtensionsConflictsWithNameTest, OnlyCleanInstanceLoaded) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL( base::FilePath(), base::FilePath().AppendASCII("conflicting_names.html")); @@ -123,7 +123,7 @@ IN_PROC_BROWSER_TEST_F(XWalkExtensionsConflictsWithNameTest, IN_PROC_BROWSER_TEST_F(XWalkExtensionsConflictsWithEntryPointTest, OnlyCleanInstanceLoaded) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL( base::FilePath(), base::FilePath().AppendASCII("conflicting_names.html")); diff --git a/extensions/test/context_destruction.cc b/extensions/test/context_destruction.cc index 6520338db0..b52fe41210 100644 --- a/extensions/test/context_destruction.cc +++ b/extensions/test/context_destruction.cc @@ -10,12 +10,12 @@ #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" #include "xwalk/extensions/common/xwalk_extension.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/test/base/in_process_browser_test.h" #include "xwalk/test/base/xwalk_test_utils.h" using namespace xwalk::extensions; // NOLINT -using xwalk::Runtime; +using xwalk::XWalkContent; namespace { @@ -86,7 +86,7 @@ class XWalkExtensionsContextDestructionTest : public XWalkExtensionsTestBase { IN_PROC_BROWSER_TEST_F(XWalkExtensionsContextDestructionTest, ContextIsDestroyedWhenNavigating) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("context_destruction.html")); diff --git a/extensions/test/crash_extension_process.cc b/extensions/test/crash_extension_process.cc index 0aefe90961..442a99d30e 100644 --- a/extensions/test/crash_extension_process.cc +++ b/extensions/test/crash_extension_process.cc @@ -8,12 +8,12 @@ #include "xwalk/extensions/browser/xwalk_extension_service.h" #include "xwalk/extensions/common/xwalk_extension_switches.h" #include "xwalk/extensions/test/xwalk_extensions_test_base.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/test/base/xwalk_test_utils.h" #include "content/public/test/browser_test_utils.h" using xwalk::extensions::XWalkExtensionService; -using xwalk::Runtime; +using xwalk::XWalkContent; class CrashExtensionTest : public XWalkExtensionsTestBase { public: @@ -34,7 +34,7 @@ IN_PROC_BROWSER_TEST_F(CrashExtensionTest, CrashExtensionProcessKeepBPAlive) { GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("crash.html")); - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); content::TitleWatcher title_watcher(runtime->web_contents(), kPassString); xwalk_test_utils::NavigateToURL(runtime, url); diff --git a/extensions/test/export_object.cc b/extensions/test/export_object.cc index 3daf7225e5..9fa471eda9 100644 --- a/extensions/test/export_object.cc +++ b/extensions/test/export_object.cc @@ -7,7 +7,7 @@ #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" #include "xwalk/extensions/common/xwalk_extension.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/test/base/in_process_browser_test.h" #include "xwalk/test/base/xwalk_test_utils.h" @@ -65,7 +65,7 @@ IN_PROC_BROWSER_TEST_F(XWalkExtensionsExportObjectTest, content::RunAllPendingInMessageLoop(); GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("test_export_object.html")); - xwalk::Runtime* runtime = CreateRuntime(); + xwalk::XWalkContent* runtime = CreateContent(); content::TitleWatcher title_watcher(runtime->web_contents(), kPassString); title_watcher.AlsoWaitForTitle(kFailString); xwalk_test_utils::NavigateToURL(runtime, url); diff --git a/extensions/test/extension_in_iframe.cc b/extensions/test/extension_in_iframe.cc index 3c5be22b84..f166cc696f 100644 --- a/extensions/test/extension_in_iframe.cc +++ b/extensions/test/extension_in_iframe.cc @@ -10,12 +10,12 @@ #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" #include "xwalk/extensions/common/xwalk_extension.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/test/base/in_process_browser_test.h" #include "xwalk/test/base/xwalk_test_utils.h" using namespace xwalk::extensions; // NOLINT -using xwalk::Runtime; +using xwalk::XWalkContent; namespace { @@ -61,7 +61,7 @@ class XWalkExtensionsIFrameTest : public XWalkExtensionsTestBase { IN_PROC_BROWSER_TEST_F(XWalkExtensionsIFrameTest, ContextsAreCreatedForIFrames) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("counter_with_iframes.html")); xwalk_test_utils::NavigateToURL(runtime, url); @@ -71,7 +71,7 @@ IN_PROC_BROWSER_TEST_F(XWalkExtensionsIFrameTest, IN_PROC_BROWSER_TEST_F(XWalkExtensionsIFrameTest, ContextsAreNotCreatedForIFramesWithBlankPages) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("blank_iframes.html")); @@ -97,7 +97,7 @@ IN_PROC_BROWSER_TEST_F(XWalkExtensionsIFrameTest, // delete it when releasing the script context. IN_PROC_BROWSER_TEST_F(XWalkExtensionsIFrameTest, IFrameUsingDocumentWriteShouldNotCrash) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("iframe_using_document_write.html")); @@ -114,7 +114,7 @@ IN_PROC_BROWSER_TEST_F(XWalkExtensionsIFrameTest, // iframe_keep_reference.html for more details. IN_PROC_BROWSER_TEST_F(XWalkExtensionsIFrameTest, KeepingReferenceToFunctionFromDestroyedIFrame) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL( base::FilePath(), base::FilePath().AppendASCII("iframe_keep_reference.html")); diff --git a/extensions/test/external_extension.cc b/extensions/test/external_extension.cc index a6f09bd265..d49899300a 100644 --- a/extensions/test/external_extension.cc +++ b/extensions/test/external_extension.cc @@ -7,13 +7,13 @@ #include "base/strings/utf_string_conversions.h" #include "xwalk/extensions/browser/xwalk_extension_service.h" #include "xwalk/extensions/test/xwalk_extensions_test_base.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/test/base/xwalk_test_utils.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" using xwalk::extensions::XWalkExtensionService; -using xwalk::Runtime; +using xwalk::XWalkContent; class ExternalExtensionTest : public XWalkExtensionsTestBase { public: @@ -44,7 +44,7 @@ class MultipleEntryPointsExtension : public XWalkExtensionsTestBase { }; IN_PROC_BROWSER_TEST_F(ExternalExtensionTest, ExternalExtension) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("echo.html")); content::TitleWatcher title_watcher(runtime->web_contents(), kPassString); @@ -54,7 +54,7 @@ IN_PROC_BROWSER_TEST_F(ExternalExtensionTest, ExternalExtension) { } IN_PROC_BROWSER_TEST_F(ExternalExtensionTest, NavigateWithExternalExtension) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("echo.html")); content::TitleWatcher title_watcher(runtime->web_contents(), kPassString); @@ -68,7 +68,7 @@ IN_PROC_BROWSER_TEST_F(ExternalExtensionTest, NavigateWithExternalExtension) { } IN_PROC_BROWSER_TEST_F(ExternalExtensionTest, ExternalExtensionSync) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL( base::FilePath(), base::FilePath().AppendASCII("sync_echo.html")); @@ -79,7 +79,7 @@ IN_PROC_BROWSER_TEST_F(ExternalExtensionTest, ExternalExtensionSync) { } IN_PROC_BROWSER_TEST_F(RuntimeInterfaceTest, GetRuntimeVariable) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL( base::FilePath(), base::FilePath().AppendASCII("get_runtime_variable.html")); @@ -90,7 +90,7 @@ IN_PROC_BROWSER_TEST_F(RuntimeInterfaceTest, GetRuntimeVariable) { } IN_PROC_BROWSER_TEST_F(MultipleEntryPointsExtension, MultipleEntryPoints) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL( base::FilePath(), base::FilePath().AppendASCII("entry_points.html")); @@ -101,7 +101,7 @@ IN_PROC_BROWSER_TEST_F(MultipleEntryPointsExtension, MultipleEntryPoints) { } IN_PROC_BROWSER_TEST_F(MultipleEntryPointsExtension, SetterLoadsExtension) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL( base::FilePath(), base::FilePath().AppendASCII("setter_callback_entry_point.html")); @@ -112,7 +112,7 @@ IN_PROC_BROWSER_TEST_F(MultipleEntryPointsExtension, SetterLoadsExtension) { } IN_PROC_BROWSER_TEST_F(MultipleEntryPointsExtension, ReplacementObjectIsUsed) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL( base::FilePath(), base::FilePath().AppendASCII( diff --git a/extensions/test/external_extension_multi_process.cc b/extensions/test/external_extension_multi_process.cc index 494a157ab5..5d4451e6cd 100644 --- a/extensions/test/external_extension_multi_process.cc +++ b/extensions/test/external_extension_multi_process.cc @@ -5,7 +5,7 @@ #include "base/native_library.h" #include "base/path_service.h" #include "xwalk/extensions/test/xwalk_extensions_test_base.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/runtime/common/xwalk_notification_types.h" #include "xwalk/test/base/xwalk_test_utils.h" #include "content/public/browser/notification_service.h" @@ -13,7 +13,7 @@ #include "content/public/test/test_utils.h" using xwalk::NativeAppWindow; -using xwalk::Runtime; +using xwalk::XWalkContent; using xwalk::extensions::XWalkExtensionVector; class ExternalExtensionMultiProcessTest : public XWalkExtensionsTestBase { @@ -39,7 +39,7 @@ IN_PROC_BROWSER_TEST_F(ExternalExtensionMultiProcessTest, OpenLinkInNewRuntimeAndSameRP) { GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("same_rp.html")); - Runtime* runtime = CreateRuntime(url); + XWalkContent* runtime = CreateContent(url); size_t len = runtimes().size(); EXPECT_EQ(1, CountRegisterExtensions()); @@ -47,7 +47,7 @@ IN_PROC_BROWSER_TEST_F(ExternalExtensionMultiProcessTest, blink::WebMouseEvent::ButtonLeft); content::RunAllPendingInMessageLoop(); EXPECT_EQ(len + 1, runtimes().size()); - Runtime* second = runtimes().back(); + XWalkContent* second = runtimes().back(); EXPECT_TRUE(NULL != second); EXPECT_NE(runtime, second); EXPECT_EQ(1, CountRegisterExtensions()); @@ -57,7 +57,7 @@ IN_PROC_BROWSER_TEST_F(ExternalExtensionMultiProcessTest, OpenLinkInNewRuntimeAndNewRP) { GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("new_rp.html")); - Runtime* runtime = CreateRuntime(url); + XWalkContent* runtime = CreateContent(url); size_t len = runtimes().size(); EXPECT_EQ(1, CountRegisterExtensions()); @@ -65,7 +65,7 @@ IN_PROC_BROWSER_TEST_F(ExternalExtensionMultiProcessTest, blink::WebMouseEvent::ButtonLeft); content::RunAllPendingInMessageLoop(); EXPECT_EQ(len + 1, runtimes().size()); - Runtime* second = runtimes().back(); + XWalkContent* second = runtimes().back(); EXPECT_TRUE(NULL != second); EXPECT_NE(runtime, second); EXPECT_EQ(2, CountRegisterExtensions()); @@ -75,11 +75,11 @@ IN_PROC_BROWSER_TEST_F(ExternalExtensionMultiProcessTest, CreateNewRuntimeAndNewRP) { GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("new_rp.html")); - Runtime* runtime = CreateRuntime(url); + XWalkContent* runtime = CreateContent(url); size_t len = runtimes().size(); EXPECT_EQ(1, CountRegisterExtensions()); - Runtime* new_runtime = CreateRuntime(url); + XWalkContent* new_runtime = CreateContent(url); EXPECT_NE(runtime, new_runtime); EXPECT_EQ(len + 1, runtimes().size()); EXPECT_EQ(2, CountRegisterExtensions()); diff --git a/extensions/test/in_process_threads_browsertest.cc b/extensions/test/in_process_threads_browsertest.cc index 4d3132efbe..8f4d72e7e5 100644 --- a/extensions/test/in_process_threads_browsertest.cc +++ b/extensions/test/in_process_threads_browsertest.cc @@ -7,11 +7,11 @@ #include "content/public/test/test_utils.h" #include "xwalk/extensions/common/xwalk_extension.h" #include "xwalk/extensions/test/xwalk_extensions_test_base.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/test/base/xwalk_test_utils.h" using namespace xwalk::extensions; // NOLINT -using xwalk::Runtime; +using xwalk::XWalkContent; const char kInProcessExtensionThread[] = "in_process_extension_thread"; const char kInProcessUIThread[] = "in_process_ui_thread"; @@ -78,7 +78,7 @@ class InProcessThreadsTest : public XWalkExtensionsTestBase { }; IN_PROC_BROWSER_TEST_F(InProcessThreadsTest, InProcessThreads) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); content::TitleWatcher title_watcher(runtime->web_contents(), kPassString); title_watcher.AlsoWaitForTitle(kFailString); diff --git a/extensions/test/internal_extension_browsertest.cc b/extensions/test/internal_extension_browsertest.cc index 4ea58dc7e5..561d467180 100644 --- a/extensions/test/internal_extension_browsertest.cc +++ b/extensions/test/internal_extension_browsertest.cc @@ -12,12 +12,12 @@ #include "ui/base/resource/resource_bundle.h" #include "xwalk/extensions/test/test.h" #include "xwalk/extensions/test/xwalk_extensions_test_base.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/test/base/xwalk_test_utils.h" using namespace xwalk::extensions; // NOLINT using namespace xwalk::jsapi::test; // NOLINT -using xwalk::Runtime; +using xwalk::XWalkContent; TestExtension::TestExtension() { set_name("test"); @@ -163,7 +163,7 @@ class InternalExtensionTest : public XWalkExtensionsTestBase { }; IN_PROC_BROWSER_TEST_F(InternalExtensionTest, InternalExtension) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); content::TitleWatcher title_watcher(runtime->web_contents(), kPassString); title_watcher.AlsoWaitForTitle(kFailString); diff --git a/extensions/test/namespace_read_only.cc b/extensions/test/namespace_read_only.cc index 8164aa3faf..af19e6e650 100644 --- a/extensions/test/namespace_read_only.cc +++ b/extensions/test/namespace_read_only.cc @@ -8,12 +8,12 @@ #include "xwalk/extensions/browser/xwalk_extension_service.h" #include "xwalk/extensions/common/xwalk_extension_switches.h" #include "xwalk/extensions/test/xwalk_extensions_test_base.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/test/base/xwalk_test_utils.h" #include "content/public/test/browser_test_utils.h" using xwalk::extensions::XWalkExtensionService; -using xwalk::Runtime; +using xwalk::XWalkContent; class NamespaceReadOnlyExtensionTest : public XWalkExtensionsTestBase { public: @@ -28,7 +28,7 @@ IN_PROC_BROWSER_TEST_F(NamespaceReadOnlyExtensionTest, NamespaceReadOnly) { GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII( "namespace_read_only.html")); - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); content::TitleWatcher title_watcher(runtime->web_contents(), kPassString); title_watcher.AlsoWaitForTitle(kFailString); @@ -42,7 +42,7 @@ IN_PROC_BROWSER_TEST_F( NamespaceReadOnlyExtensionTest, NamespaceReadOnlyAfterEntryPointCalled) { GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("namespace_read_only_with_entrypoint.html")); - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); content::TitleWatcher title_watcher(runtime->web_contents(), kPassString); title_watcher.AlsoWaitForTitle(kFailString); diff --git a/extensions/test/nested_namespace.cc b/extensions/test/nested_namespace.cc index be9159d6a6..00c04e9869 100644 --- a/extensions/test/nested_namespace.cc +++ b/extensions/test/nested_namespace.cc @@ -7,11 +7,11 @@ #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" #include "xwalk/extensions/common/xwalk_extension.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/test/base/xwalk_test_utils.h" using namespace xwalk::extensions; // NOLINT -using xwalk::Runtime; +using xwalk::XWalkContent; namespace { @@ -108,7 +108,7 @@ class XWalkExtensionsTrampolinesForNested : public XWalkExtensionsTestBase { IN_PROC_BROWSER_TEST_F(XWalkExtensionsNestedNamespaceTest, InstanceCreatedForInnerExtension) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("inner_outer.html")); @@ -123,7 +123,7 @@ IN_PROC_BROWSER_TEST_F(XWalkExtensionsNestedNamespaceTest, IN_PROC_BROWSER_TEST_F(XWalkExtensionsNestedNamespaceTest, InstanceNotCreatedForUnusedInnerExtension) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("outer.html")); @@ -138,7 +138,7 @@ IN_PROC_BROWSER_TEST_F(XWalkExtensionsNestedNamespaceTest, IN_PROC_BROWSER_TEST_F(XWalkExtensionsTrampolinesForNested, InstanceCreatedForExtensionUsedByAnother) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("another.html")); diff --git a/extensions/test/v8tools_module.cc b/extensions/test/v8tools_module.cc index 113b7e751c..c500a07a7f 100644 --- a/extensions/test/v8tools_module.cc +++ b/extensions/test/v8tools_module.cc @@ -7,12 +7,12 @@ #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" #include "xwalk/extensions/common/xwalk_extension.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/test/base/in_process_browser_test.h" #include "xwalk/test/base/xwalk_test_utils.h" using namespace xwalk::extensions; // NOLINT -using xwalk::Runtime; +using xwalk::XWalkContent; class TestV8ToolsExtensionInstance : public XWalkExtensionInstance { public: @@ -49,7 +49,7 @@ class XWalkExtensionsV8ToolsTest : public XWalkExtensionsTestBase { IN_PROC_BROWSER_TEST_F(XWalkExtensionsV8ToolsTest, V8ToolsWorks) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("test_v8tools.html")); diff --git a/extensions/test/xwalk_extensions_browsertest.cc b/extensions/test/xwalk_extensions_browsertest.cc index 651075575a..0118e8bb4d 100644 --- a/extensions/test/xwalk_extensions_browsertest.cc +++ b/extensions/test/xwalk_extensions_browsertest.cc @@ -5,7 +5,7 @@ #include "xwalk/extensions/test/xwalk_extensions_test_base.h" #include "xwalk/extensions/common/xwalk_extension.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/test/base/in_process_browser_test.h" #include "xwalk/test/base/xwalk_test_utils.h" #include "content/public/test/browser_test_utils.h" @@ -14,7 +14,7 @@ #include "base/time/time.h" using namespace xwalk::extensions; // NOLINT -using xwalk::Runtime; +using xwalk::XWalkContent; namespace { @@ -169,7 +169,7 @@ class XWalkExtensionsDelayedTest : public XWalkExtensionsTestBase { IN_PROC_BROWSER_TEST_F(XWalkExtensionsTest, EchoExtension) { GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("test_extension.html")); - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); content::TitleWatcher title_watcher(runtime->web_contents(), kPassString); title_watcher.AlsoWaitForTitle(kFailString); xwalk_test_utils::NavigateToURL(runtime, url); @@ -177,7 +177,7 @@ IN_PROC_BROWSER_TEST_F(XWalkExtensionsTest, EchoExtension) { } IN_PROC_BROWSER_TEST_F(XWalkExtensionsTest, ExtensionWithInvalidNameIgnored) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("test_extension.html")); content::TitleWatcher title_watcher(runtime->web_contents(), kPassString); @@ -190,7 +190,7 @@ IN_PROC_BROWSER_TEST_F(XWalkExtensionsTest, ExtensionWithInvalidNameIgnored) { } IN_PROC_BROWSER_TEST_F(XWalkExtensionsTest, EchoExtensionSync) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII( "sync_echo.html")); @@ -201,7 +201,7 @@ IN_PROC_BROWSER_TEST_F(XWalkExtensionsTest, EchoExtensionSync) { } IN_PROC_BROWSER_TEST_F(XWalkExtensionsDelayedTest, EchoExtensionSync) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII( "sync_echo.html")); @@ -212,7 +212,7 @@ IN_PROC_BROWSER_TEST_F(XWalkExtensionsDelayedTest, EchoExtensionSync) { } IN_PROC_BROWSER_TEST_F(XWalkExtensionsTest, BulkDataExtension) { - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("bulk_data_transmission.html")); content::TitleWatcher title_watcher(runtime->web_contents(), kPassString); diff --git a/runtime/browser/devtools/xwalk_devtools_browsertest.cc b/runtime/browser/devtools/xwalk_devtools_browsertest.cc index ba8255070c..ad4c47c63a 100644 --- a/runtime/browser/devtools/xwalk_devtools_browsertest.cc +++ b/runtime/browser/devtools/xwalk_devtools_browsertest.cc @@ -4,7 +4,7 @@ #include "base/command_line.h" #include "base/strings/utf_string_conversions.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/test/base/in_process_browser_test.h" #include "xwalk/test/base/xwalk_test_utils.h" #include "content/public/common/content_switches.h" @@ -15,7 +15,7 @@ #include "net/base/net_util.h" #include "testing/gmock/include/gmock/gmock.h" -using xwalk::Runtime; +using xwalk::XWalkContent; class XWalkDevToolsTest : public InProcessBrowserTest { public: @@ -30,7 +30,7 @@ class XWalkDevToolsTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(XWalkDevToolsTest, RemoteDebugging) { GURL localhost_url("http://127.0.0.1:9222"); - Runtime* debugging_host = CreateRuntime(localhost_url); + XWalkContent* debugging_host = CreateContent(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"); diff --git a/runtime/browser/devtools/xwalk_devtools_delegate.cc b/runtime/browser/devtools/xwalk_devtools_delegate.cc index bdfec662ee..6c068e1c60 100644 --- a/runtime/browser/devtools/xwalk_devtools_delegate.cc +++ b/runtime/browser/devtools/xwalk_devtools_delegate.cc @@ -23,6 +23,11 @@ #include "net/socket/tcp_listen_socket.h" #include "ui/base/resource/resource_bundle.h" #include "ui/snapshot/snapshot.h" +#include "xwalk/runtime/browser/xwalk_browser_context.h" + +#if !defined(OS_ANDROID) +#include "xwalk/runtime/browser/runtime_ui_delegate.h" +#endif using content::DevToolsAgentHost; using content::RenderViewHost; @@ -94,19 +99,23 @@ Target::Target(scoped_refptr agent_host) } GURL Target::GetFaviconDataURL(WebContents* web_contents) const { +#if !defined(OS_ANDROID) // Convert icon image to "data:" url. - xwalk::Runtime* runtime = - static_cast(web_contents->GetDelegate()); - if (!runtime || runtime->app_icon().IsEmpty()) + xwalk::XWalkContent* content = + static_cast(web_contents->GetDelegate()); + if (!content || content->app_icon().IsEmpty()) return GURL(); scoped_refptr icon_bytes = - runtime->app_icon().Copy1xPNGBytes(); + content->app_icon().Copy1xPNGBytes(); std::string str_url; str_url.append(reinterpret_cast(icon_bytes->front()), icon_bytes->size()); base::Base64Encode(str_url, &str_url); str_url.insert(0, "data:image/png;base64,"); return GURL(str_url); +#else + return GURL(); +#endif } bool Target::Activate() const { @@ -121,21 +130,6 @@ bool Target::Close() const { namespace xwalk { -namespace { -Runtime* CreateWithDefaultWindow( - 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) - runtime->set_ui_delegate(DefaultRuntimeUIDelegate::Create(runtime)); - runtime->Show(); -#endif - return runtime; -} -} // namespace - XWalkDevToolsHttpHandlerDelegate::XWalkDevToolsHttpHandlerDelegate() { } @@ -215,10 +209,29 @@ std::string XWalkDevToolsDelegate::GetPageThumbnailData(const GURL& url) { scoped_ptr XWalkDevToolsDelegate::CreateNewTarget(const GURL& url) { - Runtime* runtime = CreateWithDefaultWindow( - browser_context_, GURL(url::kAboutBlankURL), this); + using content::WebContents; +#if !defined(OS_ANDROID) + XWalkContent* content = XWalkContent::Create(browser_context_); + content->set_observer(this); + content->set_ui_delegate(DefaultRuntimeUIDelegate::Create(content)); + content->LoadURL(GURL(url::kAboutBlankURL)); + content->Show(); + WebContents* web_contents = content->web_contents(); +#else + // FIXME : this is just repeating of the previously existed code path. + // However the implementation for Android MUST be reconsidered. + WebContents::CreateParams params(browser_context_); + params.routing_id = MSG_ROUTING_NONE; + WebContents* web_contents = WebContents::Create(params); + content::NavigationController::LoadURLParams load_params( + GURL(url::kAboutBlankURL)); + load_params.transition_type = ui::PageTransitionFromInt( + ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); + web_contents->GetController().LoadURLWithParams(load_params); + web_contents->Focus(); +#endif return scoped_ptr( - new Target(DevToolsAgentHost::GetOrCreateFor(runtime->web_contents()))); + new Target(DevToolsAgentHost::GetOrCreateFor(web_contents))); } void XWalkDevToolsDelegate::EnumerateTargets(TargetCallback callback) { @@ -228,23 +241,24 @@ void XWalkDevToolsDelegate::EnumerateTargets(TargetCallback callback) { for (content::DevToolsAgentHost::List::iterator it = agents.begin(); it != agents.end(); ++it) { #if !defined(OS_ANDROID) - Runtime* runtime = - static_cast((*it)->GetWebContents()->GetDelegate()); - if (runtime && runtime->remote_debugging_enabled()) + XWalkContent* content = + static_cast((*it)->GetWebContents()->GetDelegate()); + if (content && content->remote_debugging_enabled()) #endif targets.push_back(new Target(*it)); } callback.Run(targets); } - -void XWalkDevToolsDelegate::OnNewRuntimeAdded(Runtime* runtime) { - runtime->set_observer(this); - runtime->set_ui_delegate(DefaultRuntimeUIDelegate::Create(runtime)); - runtime->Show(); +#if !defined(OS_ANDROID) +void XWalkDevToolsDelegate::OnContentCreated(XWalkContent* content) { + content->set_observer(this); + content->set_ui_delegate(DefaultRuntimeUIDelegate::Create(content)); + content->Show(); } -void XWalkDevToolsDelegate::OnRuntimeClosed(Runtime* runtime) { - delete runtime; +void XWalkDevToolsDelegate::OnContentClosed(XWalkContent* content) { + delete content; } +#endif } // namespace xwalk diff --git a/runtime/browser/devtools/xwalk_devtools_delegate.h b/runtime/browser/devtools/xwalk_devtools_delegate.h index 614348be65..3f9def403e 100644 --- a/runtime/browser/devtools/xwalk_devtools_delegate.h +++ b/runtime/browser/devtools/xwalk_devtools_delegate.h @@ -16,7 +16,9 @@ #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" +#if !defined(OS_ANDROID) +#include "xwalk/runtime/browser/xwalk_content.h" +#endif namespace content { class DevToolsHttpHandler; @@ -44,8 +46,11 @@ class XWalkDevToolsHttpHandlerDelegate : DISALLOW_COPY_AND_ASSIGN(XWalkDevToolsHttpHandlerDelegate); }; -class XWalkDevToolsDelegate : public content::DevToolsManagerDelegate, - public Runtime::Observer { +class XWalkDevToolsDelegate : public content::DevToolsManagerDelegate +#if !defined(OS_ANDROID) + , public XWalkContent::Observer +#endif + { public: explicit XWalkDevToolsDelegate(XWalkBrowserContext* browser_context); virtual ~XWalkDevToolsDelegate(); @@ -67,10 +72,11 @@ class XWalkDevToolsDelegate : public content::DevToolsManagerDelegate, scoped_refptr png); private: - // Runtime::Observer - virtual void OnNewRuntimeAdded(Runtime* runtime) override; - virtual void OnRuntimeClosed(Runtime* runtime) override; - +#if !defined(OS_ANDROID) + // XWalkContent::Observer + virtual void OnContentCreated(XWalkContent* content) override; + virtual void OnContentClosed(XWalkContent* content) override; +#endif using ThumbnailMap = std::map; ThumbnailMap thumbnail_map_; XWalkBrowserContext* browser_context_; diff --git a/runtime/browser/runtime_ui_delegate.cc b/runtime/browser/runtime_ui_delegate.cc index 94f9a77999..fe9a381141 100644 --- a/runtime/browser/runtime_ui_delegate.cc +++ b/runtime/browser/runtime_ui_delegate.cc @@ -9,7 +9,7 @@ #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/browser/xwalk_content.h" #include "xwalk/runtime/common/xwalk_switches.h" namespace xwalk { @@ -22,7 +22,7 @@ const int kDefaultWidth = 840; const int kDefaultHeight = 600; NativeAppWindow* RuntimeCreateWindow( - Runtime* runtime, const NativeAppWindow::CreateParams& params) { + XWalkContent* content, 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. @@ -40,12 +40,12 @@ NativeAppWindow* RuntimeCreateWindow( window->UpdateIcon(app_icon); - unsigned int fullscreen_options = runtime->fullscreen_options(); + unsigned int fullscreen_options = content->fullscreen_options(); if (params.state == ui::SHOW_STATE_FULLSCREEN) - fullscreen_options |= Runtime::FULLSCREEN_FOR_LAUNCH; + fullscreen_options |= XWalkContent::FULLSCREEN_FOR_LAUNCH; else - fullscreen_options &= ~Runtime::FULLSCREEN_FOR_LAUNCH; - runtime->set_fullscreen_options(fullscreen_options); + fullscreen_options &= ~XWalkContent::FULLSCREEN_FOR_LAUNCH; + content->set_fullscreen_options(fullscreen_options); return window; } @@ -54,16 +54,16 @@ NativeAppWindow* RuntimeCreateWindow( #endif RuntimeUIDelegate* DefaultRuntimeUIDelegate::Create( - Runtime* runtime, const NativeAppWindow::CreateParams& params) { - return new DefaultRuntimeUIDelegate(runtime, params); + XWalkContent* content, const NativeAppWindow::CreateParams& params) { + return new DefaultRuntimeUIDelegate(content, params); } DefaultRuntimeUIDelegate::DefaultRuntimeUIDelegate( - Runtime* runtime, const NativeAppWindow::CreateParams& params) - : runtime_(runtime), + XWalkContent* content, const NativeAppWindow::CreateParams& params) + : content_(content), window_params_(params), window_(nullptr) { - DCHECK(runtime_); + DCHECK(content_); } DefaultRuntimeUIDelegate::~DefaultRuntimeUIDelegate() { @@ -75,8 +75,8 @@ void DefaultRuntimeUIDelegate::Show() { 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_ = RuntimeCreateWindow(runtime_, window_params_); + window_params_.web_contents = content_->web_contents(); + window_ = RuntimeCreateWindow(content_, window_params_); } window_->Show(); #else @@ -105,7 +105,7 @@ void DefaultRuntimeUIDelegate::Close() { } void DefaultRuntimeUIDelegate::DeleteDelegate() { - runtime_ = nullptr; + content_ = nullptr; if (window_) { window_->Close(); return; @@ -115,8 +115,8 @@ void DefaultRuntimeUIDelegate::DeleteDelegate() { void DefaultRuntimeUIDelegate::OnWindowDestroyed() { window_ = nullptr; - if (runtime_) { - runtime_->Close(); + if (content_) { + content_->Close(); return; } delete this; diff --git a/runtime/browser/runtime_ui_delegate.h b/runtime/browser/runtime_ui_delegate.h index a65b76958b..8afab2244c 100644 --- a/runtime/browser/runtime_ui_delegate.h +++ b/runtime/browser/runtime_ui_delegate.h @@ -9,7 +9,7 @@ #include "xwalk/runtime/browser/ui/native_app_window.h" namespace xwalk { -class Runtime; +class XWalkContent; class RuntimeUIDelegate { public: @@ -27,7 +27,7 @@ class DefaultRuntimeUIDelegate : public RuntimeUIDelegate, public NativeAppWindowDelegate { public: static RuntimeUIDelegate* Create( - Runtime* runtime, + XWalkContent* content, const NativeAppWindow::CreateParams& params = NativeAppWindow::CreateParams()); virtual ~DefaultRuntimeUIDelegate(); @@ -35,7 +35,7 @@ class DefaultRuntimeUIDelegate : public RuntimeUIDelegate, NativeAppWindow* window() { return window_; } private: - DefaultRuntimeUIDelegate(Runtime* runtime, + DefaultRuntimeUIDelegate(XWalkContent* content, const NativeAppWindow::CreateParams& params); // RuntimeUIDelegate virtual void Show() override; @@ -48,7 +48,7 @@ class DefaultRuntimeUIDelegate : public RuntimeUIDelegate, virtual void OnWindowDestroyed() override; private: - Runtime* runtime_; + XWalkContent* content_; NativeAppWindow::CreateParams window_params_; NativeAppWindow* window_; }; diff --git a/runtime/browser/ui/native_app_window_mac.mm b/runtime/browser/ui/native_app_window_mac.mm index f3fc0b36e7..71355e79b7 100644 --- a/runtime/browser/ui/native_app_window_mac.mm +++ b/runtime/browser/ui/native_app_window_mac.mm @@ -7,7 +7,7 @@ #include "base/mac/mac_util.h" #include "base/strings/sys_string_conversions.h" #include "base/values.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/runtime/common/xwalk_notification_types.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/web_contents.h" diff --git a/runtime/browser/runtime.cc b/runtime/browser/xwalk_content.cc similarity index 80% rename from runtime/browser/runtime.cc rename to runtime/browser/xwalk_content.cc index 7330c304dc..7d9bd51523 100644 --- a/runtime/browser/runtime.cc +++ b/runtime/browser/xwalk_content.cc @@ -2,7 +2,7 @@ // 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.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include #include @@ -47,16 +47,16 @@ using content::WebContents; namespace xwalk { // static -Runtime* Runtime::Create(XWalkBrowserContext* browser_context, - content::SiteInstance* site) { +XWalkContent* XWalkContent::Create(XWalkBrowserContext* browser_context, + content::SiteInstance* site) { WebContents::CreateParams params(browser_context, site); params.routing_id = MSG_ROUTING_NONE; WebContents* web_contents = WebContents::Create(params); - return new Runtime(web_contents); + return new XWalkContent(web_contents); } -Runtime::Runtime(content::WebContents* web_contents) +XWalkContent::XWalkContent(content::WebContents* web_contents) : WebContentsObserver(web_contents), web_contents_(web_contents), fullscreen_options_(NO_FULLSCREEN), @@ -64,18 +64,19 @@ Runtime::Runtime(content::WebContents* web_contents) ui_delegate_(nullptr), observer_(nullptr), weak_ptr_factory_(this) { + DCHECK(web_contents_); web_contents_->SetDelegate(this); registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, content::Source(web_contents_.get())); } -Runtime::~Runtime() { +XWalkContent::~XWalkContent() { if (ui_delegate_) ui_delegate_->DeleteDelegate(); } -void Runtime::LoadURL(const GURL& url) { +void XWalkContent::LoadURL(const GURL& url) { content::NavigationController::LoadURLParams params(url); params.transition_type = ui::PageTransitionFromInt( ui::PAGE_TRANSITION_TYPED | @@ -84,29 +85,29 @@ void Runtime::LoadURL(const GURL& url) { web_contents_->Focus(); } -void Runtime::Show() { +void XWalkContent::Show() { if (ui_delegate_) ui_delegate_->Show(); } -void Runtime::Close() { +void XWalkContent::Close() { web_contents_->Close(); } -NativeAppWindow* Runtime::window() { +NativeAppWindow* XWalkContent::window() { if (ui_delegate_) return static_cast(ui_delegate_)->window(); return nullptr; } -content::RenderProcessHost* Runtime::GetRenderProcessHost() { +content::RenderProcessHost* XWalkContent::GetRenderProcessHost() { return web_contents_->GetRenderProcessHost(); } ////////////////////////////////////////////////////// // content::WebContentsDelegate: ////////////////////////////////////////////////////// -content::WebContents* Runtime::OpenURLFromTab( +content::WebContents* XWalkContent::OpenURLFromTab( content::WebContents* source, const content::OpenURLParams& params) { #if defined(OS_ANDROID) DCHECK(params.disposition == CURRENT_TAB); @@ -129,12 +130,12 @@ content::WebContents* Runtime::OpenURLFromTab( return source; } -void Runtime::LoadingStateChanged(content::WebContents* source, +void XWalkContent::LoadingStateChanged(content::WebContents* source, bool to_different_document) { } -void Runtime::ToggleFullscreenModeForTab(content::WebContents* web_contents, - bool enter_fullscreen) { +void XWalkContent::ToggleFullscreenModeForTab( + content::WebContents* web_contents, bool enter_fullscreen) { if (enter_fullscreen) fullscreen_options_ |= FULLSCREEN_FOR_TAB; else @@ -144,30 +145,30 @@ void Runtime::ToggleFullscreenModeForTab(content::WebContents* web_contents, enter_fullscreen || (fullscreen_options_ & FULLSCREEN_FOR_LAUNCH)); } -bool Runtime::IsFullscreenForTabOrPending( +bool XWalkContent::IsFullscreenForTabOrPending( const content::WebContents* web_contents) const { return (fullscreen_options_ & FULLSCREEN_FOR_TAB) != 0; } -void Runtime::RequestToLockMouse(content::WebContents* web_contents, +void XWalkContent::RequestToLockMouse(content::WebContents* web_contents, bool user_gesture, bool last_unlocked_by_target) { web_contents->GotResponseToLockMouseRequest(true); } -void Runtime::CloseContents(content::WebContents* source) { +void XWalkContent::CloseContents(content::WebContents* source) { if (ui_delegate_) ui_delegate_->Close(); if (observer_) - observer_->OnRuntimeClosed(this); + observer_->OnContentClosed(this); } -bool Runtime::CanOverscrollContent() const { +bool XWalkContent::CanOverscrollContent() const { return false; } -bool Runtime::PreHandleKeyboardEvent( +bool XWalkContent::PreHandleKeyboardEvent( content::WebContents* source, const content::NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { @@ -179,40 +180,40 @@ bool Runtime::PreHandleKeyboardEvent( return false; } -void Runtime::HandleKeyboardEvent( +void XWalkContent::HandleKeyboardEvent( content::WebContents* source, const content::NativeWebKeyboardEvent& event) { } -void Runtime::WebContentsCreated( +void XWalkContent::WebContentsCreated( content::WebContents* source_contents, int opener_render_frame_id, const base::string16& frame_name, const GURL& target_url, content::WebContents* new_contents) { if (observer_) - observer_->OnNewRuntimeAdded(new Runtime(new_contents)); + observer_->OnContentCreated(new XWalkContent(new_contents)); else LOG(WARNING) << "New web contents is left unhandled."; } -void Runtime::DidNavigateMainFramePostCommit( +void XWalkContent::DidNavigateMainFramePostCommit( content::WebContents* web_contents) { } -content::JavaScriptDialogManager* Runtime::GetJavaScriptDialogManager() { +content::JavaScriptDialogManager* XWalkContent::GetJavaScriptDialogManager() { return NULL; } -void Runtime::ActivateContents(content::WebContents* contents) { +void XWalkContent::ActivateContents(content::WebContents* contents) { contents->GetRenderViewHost()->Focus(); } -void Runtime::DeactivateContents(content::WebContents* contents) { +void XWalkContent::DeactivateContents(content::WebContents* contents) { contents->GetRenderViewHost()->Blur(); } -content::ColorChooser* Runtime::OpenColorChooser( +content::ColorChooser* XWalkContent::OpenColorChooser( content::WebContents* web_contents, SkColor initial_color, const std::vector& suggestions) { @@ -225,7 +226,7 @@ content::ColorChooser* Runtime::OpenColorChooser( #endif } -void Runtime::RunFileChooser( +void XWalkContent::RunFileChooser( content::WebContents* web_contents, const content::FileChooserParams& params) { #if defined(USE_AURA) && defined(OS_LINUX) @@ -235,7 +236,7 @@ void Runtime::RunFileChooser( #endif } -void Runtime::EnumerateDirectory(content::WebContents* web_contents, +void XWalkContent::EnumerateDirectory(content::WebContents* web_contents, int request_id, const base::FilePath& path) { #if defined(USE_AURA) && defined(OS_LINUX) @@ -245,7 +246,8 @@ void Runtime::EnumerateDirectory(content::WebContents* web_contents, #endif } -void Runtime::DidUpdateFaviconURL(const std::vector& candidates) { +void XWalkContent::DidUpdateFaviconURL( + const std::vector& candidates) { DLOG(INFO) << "Candidates: "; for (size_t i = 0; i < candidates.size(); ++i) DLOG(INFO) << candidates[i].icon_url.spec(); @@ -265,10 +267,10 @@ void Runtime::DidUpdateFaviconURL(const std::vector& candidates) { true, // Is a favicon 0, // No maximum size base::Bind( - &Runtime::DidDownloadFavicon, weak_ptr_factory_.GetWeakPtr())); + &XWalkContent::DidDownloadFavicon, weak_ptr_factory_.GetWeakPtr())); } -void Runtime::DidDownloadFavicon(int id, +void XWalkContent::DidDownloadFavicon(int id, int http_status_code, const GURL& image_url, const std::vector& bitmaps, @@ -280,7 +282,7 @@ void Runtime::DidDownloadFavicon(int id, ui_delegate_->UpdateIcon(app_icon_); } -void Runtime::Observe(int type, +void XWalkContent::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { if (type == content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED) { @@ -293,7 +295,7 @@ void Runtime::Observe(int type, } } -void Runtime::RequestMediaAccessPermission( +void XWalkContent::RequestMediaAccessPermission( content::WebContents* web_contents, const content::MediaStreamRequest& request, const content::MediaResponseCallback& callback) { diff --git a/runtime/browser/runtime.h b/runtime/browser/xwalk_content.h similarity index 84% rename from runtime/browser/runtime.h rename to runtime/browser/xwalk_content.h index 994c5ff09a..bd792a5f57 100644 --- a/runtime/browser/runtime.h +++ b/runtime/browser/xwalk_content.h @@ -2,15 +2,14 @@ // 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_H_ -#define XWALK_RUNTIME_BROWSER_RUNTIME_H_ +#ifndef XWALK_RUNTIME_BROWSER_XWALK_CONTENT_H_ +#define XWALK_RUNTIME_BROWSER_XWALK_CONTENT_H_ #include #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.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" @@ -29,25 +28,25 @@ class WebContents; namespace xwalk { +class NativeAppWindow; class XWalkBrowserContext; class RuntimeUIDelegate; -// Runtime represents the running environment for a web page. It is responsible -// for maintaning its owned WebContents. -class Runtime : public content::WebContentsDelegate, - public content::WebContentsObserver, - public content::NotificationObserver { +// XWalkContent is responsible for maintaning its owned WebContents. +class XWalkContent : public content::WebContentsDelegate, + public content::WebContentsObserver, + public content::NotificationObserver { public: - // New "Runtimes" are also created from Runtime::WebContentsCreated which + // New "contents" are also created from XWalkContent::WebContentsCreated which // is overridden WebContentsDelegate method. The "observer" is needed to - // observe appearance and removal of such Runtime instances. + // observe appearance of such XWalkContent instances. class Observer { public: - // Called when a new Runtime instance is added. - virtual void OnNewRuntimeAdded(Runtime* new_runtime) = 0; + // Called when a new XWalkContent instance is added. + virtual void OnContentCreated(XWalkContent* content) = 0; - // Called when a Runtime instance is removed. - virtual void OnRuntimeClosed(Runtime* runtime) = 0; + // Called when a XWalkContent instance is closed. + virtual void OnContentClosed(XWalkContent* content) = 0; protected: virtual ~Observer() {} @@ -61,15 +60,15 @@ class Runtime : public content::WebContentsDelegate, // Fullscreen entered by HTML requestFullscreen. FULLSCREEN_FOR_TAB = 1 << 1, }; - virtual ~Runtime(); + virtual ~XWalkContent(); 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(XWalkBrowserContext* context, + // Create a new XWalkContent instance with the given browsing context. + static XWalkContent* Create(XWalkBrowserContext* context, content::SiteInstance* site = nullptr); void LoadURL(const GURL& url); @@ -93,7 +92,7 @@ class Runtime : public content::WebContentsDelegate, bool remote_debugging_enabled() const { return remote_debugging_enabled_; } protected: - explicit Runtime(content::WebContents* web_contents); + explicit XWalkContent(content::WebContents* web_contents); // Overridden from content::WebContentsDelegate: virtual content::WebContents* OpenURLFromTab( @@ -171,9 +170,9 @@ class Runtime : public content::WebContentsDelegate, bool remote_debugging_enabled_; RuntimeUIDelegate* ui_delegate_; Observer* observer_; - base::WeakPtrFactory weak_ptr_factory_; + base::WeakPtrFactory weak_ptr_factory_; }; } // namespace xwalk -#endif // XWALK_RUNTIME_BROWSER_RUNTIME_H_ +#endif // XWALK_RUNTIME_BROWSER_XWALK_CONTENT_H_ diff --git a/runtime/browser/xwalk_download_browsertest.cc b/runtime/browser/xwalk_download_browsertest.cc index 8d0b591cd9..046e325ad8 100644 --- a/runtime/browser/xwalk_download_browsertest.cc +++ b/runtime/browser/xwalk_download_browsertest.cc @@ -7,7 +7,7 @@ #include "base/files/file_path.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/runtime/browser/runtime_download_manager_delegate.h" #include "xwalk/runtime/browser/ui/color_chooser.h" #include "xwalk/test/base/in_process_browser_test.h" @@ -20,7 +20,7 @@ #include "content/public/test/download_test_observer.h" #include "content/public/test/test_utils.h" -using xwalk::Runtime; +using xwalk::XWalkContent; using xwalk::RuntimeDownloadManagerDelegate; using content::DownloadItem; using content::DownloadManager; @@ -31,7 +31,7 @@ using content::BrowserContext; namespace { -static DownloadManagerImpl* DownloadManagerForXWalk(Runtime* runtime) { +static DownloadManagerImpl* DownloadManagerForXWalk(XWalkContent* runtime) { return static_cast( BrowserContext::GetDownloadManager( runtime->web_contents()->GetBrowserContext())); @@ -45,7 +45,7 @@ class XWalkDownloadBrowserTest : public InProcessBrowserTest { virtual void SetUpOnMainThread() OVERRIDE { ASSERT_TRUE(downloads_directory_.CreateUniqueTempDir()); - runtime_ = CreateRuntime(GURL()); + runtime_ = CreateContent(GURL()); DownloadManagerImpl* manager = DownloadManagerForXWalk(runtime_); RuntimeDownloadManagerDelegate* delegate = @@ -55,14 +55,14 @@ class XWalkDownloadBrowserTest : public InProcessBrowserTest { // Create a DownloadTestObserverTerminal that will wait for the // specified number of downloads to finish. - DownloadTestObserver* CreateWaiter(Runtime* runtime, int num_downloads) { + DownloadTestObserver* CreateWaiter(XWalkContent* runtime, int num_downloads) { DownloadManager* download_manager = DownloadManagerForXWalk(runtime); return new DownloadTestObserverTerminal(download_manager, num_downloads, DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL); } protected: - Runtime* runtime_; + XWalkContent* runtime_; private: // Location of the downloads directory for these tests diff --git a/runtime/browser/xwalk_form_input_browsertest.cc b/runtime/browser/xwalk_form_input_browsertest.cc index 51c551777d..5dcd1ec5e6 100644 --- a/runtime/browser/xwalk_form_input_browsertest.cc +++ b/runtime/browser/xwalk_form_input_browsertest.cc @@ -4,7 +4,7 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/runtime/browser/ui/color_chooser.h" #include "xwalk/test/base/in_process_browser_test.h" #include "xwalk/test/base/xwalk_test_utils.h" @@ -16,7 +16,7 @@ #include "ui/shell_dialogs/select_file_dialog.h" #include "ui/shell_dialogs/select_file_dialog_factory.h" -using xwalk::Runtime; +using xwalk::XWalkContent; namespace { @@ -100,7 +100,7 @@ IN_PROC_BROWSER_TEST_F(XWalkFormInputTest, DISABLED_FileSelector) { base::FilePath(), base::FilePath().AppendASCII("file_to_select"))); GURL url = xwalk_test_utils::GetTestURL( base::FilePath(), base::FilePath().AppendASCII("form_input.html")); - Runtime* runtime = CreateRuntime(url); + XWalkContent* runtime = CreateContent(url); content::WaitForLoadStop(runtime->web_contents()); bool ret = content::ExecuteScript( runtime->web_contents(), "doSelectFile();"); @@ -119,7 +119,7 @@ IN_PROC_BROWSER_TEST_F(XWalkFormInputTest, ColorChooser) { SetBrowserTestColor(r, g, b); GURL url = xwalk_test_utils::GetTestURL( base::FilePath(), base::FilePath().AppendASCII("form_input.html")); - Runtime* runtime = CreateRuntime(url); + XWalkContent* runtime = CreateContent(url); content::WaitForLoadStop(runtime->web_contents()); bool ret = content::ExecuteScript( runtime->web_contents(), "doChooseColor();"); diff --git a/runtime/browser/xwalk_runtime_browsertest.cc b/runtime/browser/xwalk_runtime_browsertest.cc index 035f2e69d8..108cd1287d 100644 --- a/runtime/browser/xwalk_runtime_browsertest.cc +++ b/runtime/browser/xwalk_runtime_browsertest.cc @@ -11,7 +11,7 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "xwalk/runtime/browser/image_util.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.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" @@ -35,7 +35,7 @@ #endif using xwalk::NativeAppWindow; -using xwalk::Runtime; +using xwalk::XWalkContent; using content::NotificationService; using content::WebContents; using content::WindowedNotificationObserver; @@ -48,7 +48,7 @@ IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, CreateAndCloseRuntime) { size_t len = runtimes().size(); // Create a new Runtime instance. GURL url(test_server()->GetURL("test.html")); - Runtime* runtime = CreateRuntime(url); + XWalkContent* runtime = CreateContent(url); EXPECT_TRUE(url == runtime->web_contents()->GetURL()); EXPECT_EQ(len + 1, runtimes().size()); @@ -60,7 +60,7 @@ IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, CreateAndCloseRuntime) { IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, LoadURLAndClose) { GURL url(test_server()->GetURL("test.html")); - Runtime* runtime = CreateRuntime(url); + XWalkContent* runtime = CreateContent(url); size_t len = runtimes().size(); runtime->Close(); content::RunAllPendingInMessageLoop(); @@ -69,7 +69,7 @@ IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, LoadURLAndClose) { IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, CloseNativeWindow) { GURL url(test_server()->GetURL("test.html")); - Runtime* new_runtime = CreateRuntime(url); + XWalkContent* new_runtime = CreateContent(url); size_t len = runtimes().size(); new_runtime->window()->Close(); content::RunAllPendingInMessageLoop(); @@ -81,7 +81,7 @@ IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, LaunchWithFullscreenWindow) { GURL url(test_server()->GetURL("test.html")); NativeAppWindow::CreateParams params; params.state = ui::SHOW_STATE_FULLSCREEN; - Runtime* new_runtime = CreateRuntime(url, params); + XWalkContent* new_runtime = CreateContent(url, params); EXPECT_TRUE(new_runtime->window()->IsFullscreen()); } @@ -89,7 +89,7 @@ IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, LaunchWithFullscreenWindow) { IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, HTML5FullscreenAPI) { GURL url = xwalk_test_utils::GetTestURL( base::FilePath(), base::FilePath().AppendASCII("fullscreen.html")); - Runtime* runtime = CreateRuntime(url); + XWalkContent* runtime = CreateContent(url); EXPECT_TRUE(false == runtime->window()->IsFullscreen()); WindowedNotificationObserver enter_observer( @@ -125,7 +125,7 @@ IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, GetWindowTitle) { GURL url = xwalk_test_utils::GetTestURL( base::FilePath(), base::FilePath().AppendASCII("title.html")); base::string16 title = base::ASCIIToUTF16("Dummy Title"); - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); content::TitleWatcher title_watcher(runtime->web_contents(), title); xwalk_test_utils::NavigateToURL(runtime, url); EXPECT_EQ(title, title_watcher.WaitAndGetTitle()); @@ -139,7 +139,7 @@ IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, GetWindowTitle) { IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, OpenLinkInNewRuntime) { GURL url = xwalk_test_utils::GetTestURL( base::FilePath(), base::FilePath().AppendASCII("new_target.html")); - Runtime* runtime = CreateRuntime(url); + XWalkContent* runtime = CreateContent(url); size_t len = runtimes().size(); bool ret = content::ExecuteScript(runtime->web_contents(), "doClick();"); EXPECT_TRUE(ret); @@ -147,7 +147,7 @@ IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, OpenLinkInNewRuntime) { // 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. EXPECT_EQ(len + 1, runtimes().size()); - Runtime* second = runtimes().back(); + XWalkContent* second = runtimes().back(); EXPECT_TRUE(NULL != second); EXPECT_NE(runtime, second); } @@ -157,7 +157,7 @@ IN_PROC_BROWSER_TEST_F(XWalkRuntimeTest, LoadTizenWebUiFwFile) { GURL url = xwalk_test_utils::GetTestURL( base::FilePath(), base::FilePath().AppendASCII("tizenwebuifw.html")); base::string16 title = base::ASCIIToUTF16("Pass"); - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); content::TitleWatcher title_watcher(runtime->web_contents(), title); xwalk_test_utils::NavigateToURL(runtime, url); EXPECT_EQ(title, title_watcher.WaitAndGetTitle()); diff --git a/sysapps/common/common_api_browsertest.cc b/sysapps/common/common_api_browsertest.cc index 4e7d6d3d9e..d4dcc5b026 100644 --- a/sysapps/common/common_api_browsertest.cc +++ b/sysapps/common/common_api_browsertest.cc @@ -12,7 +12,7 @@ #include "net/base/filename_util.h" #include "xwalk/extensions/browser/xwalk_extension_service.h" #include "xwalk/extensions/common/xwalk_extension.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/sysapps/common/binding_object.h" #include "xwalk/test/base/in_process_browser_test.h" #include "xwalk/test/base/xwalk_test_utils.h" @@ -172,7 +172,7 @@ IN_PROC_BROWSER_TEST_F(SysAppsCommonTest, SysAppsCommon) { const base::string16 passString = base::ASCIIToUTF16("Pass"); const base::string16 failString = base::ASCIIToUTF16("Fail"); - xwalk::Runtime* runtime = CreateRuntime(); + xwalk::XWalkContent* runtime = CreateContent(); content::TitleWatcher title_watcher(runtime->web_contents(), passString); title_watcher.AlsoWaitForTitle(failString); diff --git a/sysapps/device_capabilities/device_capabilities_api_browsertest.cc b/sysapps/device_capabilities/device_capabilities_api_browsertest.cc index 7a022108c2..8b44f184c2 100644 --- a/sysapps/device_capabilities/device_capabilities_api_browsertest.cc +++ b/sysapps/device_capabilities/device_capabilities_api_browsertest.cc @@ -7,7 +7,7 @@ #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" #include "net/base/filename_util.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/test/base/in_process_browser_test.h" #include "xwalk/test/base/xwalk_test_utils.h" @@ -15,7 +15,7 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, SysAppsDeviceCapabilities) { const base::string16 passString = base::ASCIIToUTF16("Pass"); const base::string16 failString = base::ASCIIToUTF16("Fail"); - xwalk::Runtime* runtime = CreateRuntime(); + xwalk::XWalkContent* runtime = CreateContent(); content::TitleWatcher title_watcher(runtime->web_contents(), passString); title_watcher.AlsoWaitForTitle(failString); diff --git a/sysapps/raw_socket/raw_socket_api_browsertest.cc b/sysapps/raw_socket/raw_socket_api_browsertest.cc index d8d701f7c6..842696d905 100644 --- a/sysapps/raw_socket/raw_socket_api_browsertest.cc +++ b/sysapps/raw_socket/raw_socket_api_browsertest.cc @@ -9,12 +9,12 @@ #include "net/base/filename_util.h" #include "xwalk/extensions/browser/xwalk_extension_service.h" #include "xwalk/extensions/common/xwalk_extension.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/test/base/in_process_browser_test.h" #include "xwalk/test/base/xwalk_test_utils.h" using namespace xwalk::extensions; // NOLINT -using xwalk::Runtime; +using xwalk::XWalkContent; namespace { @@ -58,7 +58,7 @@ IN_PROC_BROWSER_TEST_F(SysAppsRawSocketTest, SysAppsRawSocket) { const base::string16 passString = base::ASCIIToUTF16("Pass"); const base::string16 failString = base::ASCIIToUTF16("Fail"); - Runtime* runtime = CreateRuntime(); + XWalkContent* runtime = CreateContent(); content::TitleWatcher title_watcher(runtime->web_contents(), passString); title_watcher.AlsoWaitForTitle(failString); diff --git a/test/base/in_process_browser_test.cc b/test/base/in_process_browser_test.cc index 3a2d1dd370..be9f7fe9fe 100644 --- a/test/base/in_process_browser_test.cc +++ b/test/base/in_process_browser_test.cc @@ -36,7 +36,7 @@ #include "xwalk/runtime/renderer/tizen/xwalk_content_renderer_client_tizen.h" #endif -using xwalk::Runtime; +using xwalk::XWalkContent; using xwalk::XWalkContentRendererClient; using xwalk::XWalkRunner; using xwalk::NativeAppWindow; @@ -92,18 +92,18 @@ void InProcessBrowserTest::SetUp() { BrowserTestBase::SetUp(); } -Runtime* InProcessBrowserTest::CreateRuntime( +XWalkContent* InProcessBrowserTest::CreateContent( const GURL& url, const NativeAppWindow::CreateParams& params) { - Runtime* runtime = Runtime::Create( + XWalkContent* content = XWalkContent::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; + content->set_observer(this); + runtimes_.push_back(content); + content->LoadURL(url); + content::WaitForLoadStop(content->web_contents()); + content->set_ui_delegate( + xwalk::DefaultRuntimeUIDelegate::Create(content, params)); + content->Show(); + return content; } void InProcessBrowserTest::RunTestOnMainThreadLoop() { @@ -122,18 +122,18 @@ void InProcessBrowserTest::RunTestOnMainThreadLoop() { 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::OnContentCreated(XWalkContent* content) { + DCHECK(content); + runtimes_.push_back(content); + content->set_observer(this); + content->set_ui_delegate( + xwalk::DefaultRuntimeUIDelegate::Create(content)); + content->Show(); } -void InProcessBrowserTest::OnRuntimeClosed(Runtime* runtime) { - DCHECK(runtime); - auto it = std::find(runtimes_.begin(), runtimes_.end(), runtime); +void InProcessBrowserTest::OnContentClosed(XWalkContent* content) { + DCHECK(content); + auto it = std::find(runtimes_.begin(), runtimes_.end(), content); DCHECK(it != runtimes_.end()); runtimes_.erase(it); @@ -147,8 +147,8 @@ void InProcessBrowserTest::CloseAll() { return; RuntimeList to_be_closed(runtimes_.get()); - for (Runtime* runtime : to_be_closed) - runtime->Close(); + for (XWalkContent* content : to_be_closed) + content->Close(); // Wait until all windows are closed. content::RunAllPendingInMessageLoop(); DCHECK(runtimes_.empty()) << runtimes_.size(); diff --git a/test/base/in_process_browser_test.h b/test/base/in_process_browser_test.h index 576a83995f..65abcd1533 100644 --- a/test/base/in_process_browser_test.h +++ b/test/base/in_process_browser_test.h @@ -16,7 +16,8 @@ #include "content/public/test/browser_test_base.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/page_transition_types.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/runtime_ui_delegate.h" +#include "xwalk/runtime/browser/xwalk_content.h" namespace base { class CommandLine; @@ -37,9 +38,9 @@ class RuleBasedHostResolverProc; // about how to write a InProcessBrowserTest. // class InProcessBrowserTest : public content::BrowserTestBase, - public xwalk::Runtime::Observer { + public xwalk::XWalkContent::Observer { public: - using RuntimeList = std::vector; + using RuntimeList = std::vector; InProcessBrowserTest(); virtual ~InProcessBrowserTest(); @@ -51,7 +52,7 @@ class InProcessBrowserTest : public content::BrowserTestBase, protected: const RuntimeList& runtimes() const { return runtimes_.get(); } - xwalk::Runtime* CreateRuntime( + xwalk::XWalkContent* CreateContent( const GURL& url = GURL(), const xwalk::NativeAppWindow::CreateParams& params = xwalk::NativeAppWindow::CreateParams()); @@ -64,16 +65,16 @@ class InProcessBrowserTest : public content::BrowserTestBase, virtual void RunTestOnMainThreadLoop() override; private: - // xwalk::Runtime::Observer - virtual void OnNewRuntimeAdded(xwalk::Runtime* runtime) override; - virtual void OnRuntimeClosed(xwalk::Runtime* runtime) override; + // xwalk::XWalkContent::Observer + virtual void OnContentCreated(xwalk::XWalkContent* runtime) override; + virtual void OnContentClosed(xwalk::XWalkContent* runtime) override; void CloseAll(); // Create data path directory for this test to avoid pollution in default // data path. Return true if success. bool CreateDataPathDir(); - ScopedVector runtimes_; + ScopedVector runtimes_; // Temporary data path directory. Used only when a data path directory is not // specified in the command line. diff --git a/test/base/xwalk_test_utils.cc b/test/base/xwalk_test_utils.cc index 47f46e6443..101e892306 100644 --- a/test/base/xwalk_test_utils.cc +++ b/test/base/xwalk_test_utils.cc @@ -11,7 +11,7 @@ #include "base/path_service.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" -#include "xwalk/runtime/browser/runtime.h" +#include "xwalk/runtime/browser/xwalk_content.h" #include "xwalk/runtime/common/xwalk_paths.h" #include "xwalk/runtime/common/xwalk_switches.h" #include "content/public/browser/navigation_controller.h" @@ -62,7 +62,7 @@ GURL GetTestURL(const base::FilePath& dir, const base::FilePath& file) { // Navigate a specified URL in the given Runtime. It will block until the // navigation completes. -void NavigateToURL(xwalk::Runtime* runtime, const GURL& url) { +void NavigateToURL(xwalk::XWalkContent* runtime, const GURL& url) { if (runtime->web_contents()->IsLoading()) content::WaitForLoadStop(runtime->web_contents()); diff --git a/test/base/xwalk_test_utils.h b/test/base/xwalk_test_utils.h index bc87dd6b0c..ba7030333f 100644 --- a/test/base/xwalk_test_utils.h +++ b/test/base/xwalk_test_utils.h @@ -16,7 +16,7 @@ class CommandLine; } namespace xwalk { -class Runtime; +class XWalkContent; } // A set of utilities for test code that launches separate processes. @@ -40,7 +40,7 @@ base::FilePath GetTestFilePath(const base::FilePath& dir, // Navigate a specified URL in the given Runtime. It will block until the // navigation completes. -void NavigateToURL(xwalk::Runtime* runtime, const GURL& url); +void NavigateToURL(xwalk::XWalkContent* runtime, const GURL& url); } // namespace xwalk_test_utils diff --git a/xwalk.gyp b/xwalk.gyp index 95d865f1f7..817edf0fb3 100644 --- a/xwalk.gyp +++ b/xwalk.gyp @@ -151,8 +151,6 @@ 'runtime/browser/media/media_capture_devices_dispatcher.h', 'runtime/browser/renderer_host/pepper/xwalk_browser_pepper_host_factory.cc', 'runtime/browser/renderer_host/pepper/xwalk_browser_pepper_host_factory.h', - 'runtime/browser/runtime.cc', - 'runtime/browser/runtime.h', 'runtime/browser/runtime_download_manager_delegate.cc', 'runtime/browser/runtime_download_manager_delegate.h', 'runtime/browser/runtime_file_select_helper.cc', @@ -227,6 +225,8 @@ 'runtime/browser/xwalk_browser_main_parts_tizen.cc', 'runtime/browser/xwalk_browser_main_parts_tizen.h', 'runtime/browser/xwalk_component.h', + 'runtime/browser/xwalk_content.cc', + 'runtime/browser/xwalk_content.h', 'runtime/browser/xwalk_content_browser_client.cc', 'runtime/browser/xwalk_content_browser_client.h', 'runtime/browser/xwalk_render_message_filter.cc', @@ -330,6 +330,10 @@ 'experimental/native_file_system/virtual_root_provider_android.cc', ], 'sources!':[ + 'runtime/browser/xwalk_content.cc', + 'runtime/browser/xwalk_content.h', + 'runtime/browser/runtime_ui_delegate.cc', + 'runtime/browser/runtime_ui_delegate.h', 'runtime/renderer/xwalk_render_process_observer_generic.cc', 'runtime/renderer/xwalk_render_process_observer_generic.h', ],