Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Unified Diff: ui/aura/env.cc

Issue 2446893005: Adds a porting layer so aura can be made to work with mus (Closed)
Patch Set: better Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/env.h ('k') | ui/aura/window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/env.cc
diff --git a/ui/aura/env.cc b/ui/aura/env.cc
index 07c113849ea030b6fc6cf2c11c3463f83aa69063..56714515c25f9b3c5ee471fb095136cdc5caa783 100644
--- a/ui/aura/env.cc
+++ b/ui/aura/env.cc
@@ -6,9 +6,11 @@
#include "base/command_line.h"
#include "base/lazy_instance.h"
+#include "base/memory/ptr_util.h"
#include "base/threading/thread_local.h"
#include "ui/aura/env_observer.h"
#include "ui/aura/input_state_lookup.h"
+#include "ui/aura/window_port_local.h"
#include "ui/events/event_target_iterator.h"
#include "ui/events/platform/platform_event_source.h"
@@ -43,9 +45,10 @@ Env::~Env() {
}
// static
-std::unique_ptr<Env> Env::CreateInstance() {
+std::unique_ptr<Env> Env::CreateInstance(
+ const WindowPortFactory& window_port_factory) {
DCHECK(!lazy_tls_ptr.Pointer()->Get());
- std::unique_ptr<Env> env(new Env());
+ std::unique_ptr<Env> env(new Env(window_port_factory));
env->Init();
return env;
}
@@ -63,6 +66,12 @@ Env* Env::GetInstanceDontCreate() {
return lazy_tls_ptr.Pointer()->Get();
}
+std::unique_ptr<WindowPort> Env::CreateWindowPort(Window* window) {
+ if (window_port_factory_.is_null())
+ return base::MakeUnique<WindowPortLocal>(window);
+ return window_port_factory_.Run(window);
+}
+
void Env::AddObserver(EnvObserver* observer) {
observers_.AddObserver(observer);
}
@@ -79,8 +88,9 @@ bool Env::IsMouseButtonDown() const {
////////////////////////////////////////////////////////////////////////////////
// Env, private:
-Env::Env()
- : mouse_button_flags_(0),
+Env::Env(const WindowPortFactory& window_port_factory)
+ : window_port_factory_(window_port_factory),
+ mouse_button_flags_(0),
is_touch_down_(false),
input_state_lookup_(InputStateLookup::Create()),
context_factory_(NULL) {
« no previous file with comments | « ui/aura/env.h ('k') | ui/aura/window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698