Commit 89636c39 authored by sky's avatar sky Committed by Commit bot

Adds ability to specify how aura::Env is created in content

aura::Env::CreateInstance() takes a type. This patch plumbs the type
through to content::MainFunctionParams and Content::ConteintMainParams
so that consumers can specify how they want Env configured.

BUG=672932
TEST=none
R=jam@chromium.org

Review-Url: https://codereview.chromium.org/2567113002
Cr-Commit-Position: refs/heads/master@{#438023}
parent a0c2bf8d
......@@ -453,6 +453,10 @@ class ContentMainRunnerImpl : public ContentMainRunner {
int Initialize(const ContentMainParams& params) override {
ui_task_ = params.ui_task;
#if defined(USE_AURA)
env_mode_ = params.env_mode;
#endif
base::EnableTerminationOnOutOfMemory();
#if defined(OS_WIN)
base::win::RegisterInvalidParamHandler();
......@@ -782,6 +786,9 @@ class ContentMainRunnerImpl : public ContentMainRunner {
#elif defined(OS_MACOSX)
main_params.autorelease_pool = autorelease_pool_.get();
#endif
#if defined(USE_AURA)
main_params.env_mode = env_mode_;
#endif
return RunNamedProcessTypeMain(process_type, main_params, delegate_);
}
......@@ -840,6 +847,10 @@ class ContentMainRunnerImpl : public ContentMainRunner {
base::Closure* ui_task_;
#if defined(USE_AURA)
aura::Env::Mode env_mode_ = aura::Env::Mode::LOCAL;
#endif
DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
};
......
......@@ -1577,7 +1577,7 @@ bool BrowserMainLoop::InitializeToolkit() {
// Env creates the compositor. Aura widgets need the compositor to be created
// before they can be initialized by the browser.
env_ = aura::Env::CreateInstance();
env_ = aura::Env::CreateInstance(parameters_.env_mode);
#endif // defined(USE_AURA)
if (parts_)
......
......@@ -21,6 +21,7 @@
# //content/public/app:both_sources (source set)
import("//build/config/chrome_build.gni")
import("//build/config/ui.gni")
import("//services/service_manager/public/service_manifest.gni")
public_app_shared_sources = [
......@@ -42,6 +43,10 @@ public_app_shared_deps = [
"//content/public/utility:utility_sources",
]
if (use_aura) {
public_app_shared_deps += [ "//ui/aura" ]
}
if (is_component_build) {
source_set("both_sources") {
# Only the main content shared library can pull this in.
......
......@@ -15,6 +15,10 @@
#include <windows.h>
#endif
#if defined(USE_AURA)
#include "ui/aura/env.h"
#endif
namespace sandbox {
struct SandboxInterfaceInfo;
}
......@@ -51,6 +55,10 @@ struct ContentMainParams {
// Used by browser_tests. If non-null BrowserMain schedules this task to run
// on the MessageLoop. It's owned by the test code.
base::Closure* ui_task;
#if defined(USE_AURA)
aura::Env::Mode env_mode = aura::Env::Mode::LOCAL;
#endif
};
#if defined(OS_ANDROID)
......
......@@ -5,6 +5,7 @@
import("//build/buildflag_header.gni")
import("//build/config/chromecast_build.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//media/media_options.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//ppapi/features/features.gni")
......@@ -273,6 +274,10 @@ source_set("common_sources") {
"//ui/gfx/ipc/skia",
]
if (use_aura) {
deps += [ "//ui/aura" ]
}
# //content/common needs to include public headers.
allow_circular_includes_from = [
"//content/common",
......
......@@ -25,6 +25,10 @@ class ScopedNSAutoreleasePool;
}
#endif
#if defined(USE_AURA)
#include "ui/aura/env.h"
#endif
namespace content {
struct MainFunctionParams {
......@@ -50,6 +54,10 @@ struct MainFunctionParams {
bool zygote_child;
#endif
#if defined(USE_AURA)
aura::Env::Mode env_mode = aura::Env::Mode::LOCAL;
#endif
// Used by InProcessBrowserTest. If non-null BrowserMain schedules this
// task to run on the MessageLoop and BrowserInit is not invoked.
base::Closure* ui_task;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment