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

Unified Diff: ui/views/mus/window_tree_host_mus.cc

Issue 2009853002: Finish eliminating PlatformWindowMus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean-up and add TODO to WTHM Created 4 years, 7 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
« ui/views/mus/native_widget_mus.cc ('K') | « ui/views/mus/window_tree_host_mus.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/window_tree_host_mus.cc
diff --git a/ui/views/mus/window_tree_host_mus.cc b/ui/views/mus/window_tree_host_mus.cc
index e360eb05b46ba0ed6769758e0e49a248ecd6b3d9..df9b16a2615140d00c278729ece0843506f29a9a 100644
--- a/ui/views/mus/window_tree_host_mus.cc
+++ b/ui/views/mus/window_tree_host_mus.cc
@@ -5,15 +5,22 @@
#include "ui/views/mus/window_tree_host_mus.h"
#include "base/memory/ptr_util.h"
+#include "components/bitmap_uploader/bitmap_uploader.h"
+#include "components/mus/public/cpp/window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
+#include "ui/base/view_prop.h"
#include "ui/events/event.h"
+#include "ui/platform_window/stub/stub_window.h"
#include "ui/views/mus/input_method_mus.h"
#include "ui/views/mus/native_widget_mus.h"
-#include "ui/views/mus/platform_window_mus.h"
namespace views {
+namespace {
+static uint32_t accelerated_widget_count = 1;
+}
+
////////////////////////////////////////////////////////////////////////////////
// WindowTreeHostMus, public:
@@ -21,8 +28,34 @@ WindowTreeHostMus::WindowTreeHostMus(shell::Connector* connector,
NativeWidgetMus* native_widget,
mus::Window* window)
: native_widget_(native_widget) {
- SetPlatformWindow(
- base::WrapUnique(new PlatformWindowMus(this, connector, window)));
+ // We need accelerated widget numbers to be different for each
+ // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t
+ // has this property.
+#if defined(OS_WIN) || defined(OS_ANDROID)
+ gfx::AcceleratedWidget accelerated_widget =
+ reinterpret_cast<gfx::AcceleratedWidget>(accelerated_widget_count++);
+#else
+ gfx::AcceleratedWidget accelerated_widget =
+ static_cast<gfx::AcceleratedWidget>(accelerated_widget_count++);
+#endif
+ // TODO(markdittmer): Use correct device-scale-factor from |window|.
+ OnAcceleratedWidgetAvailable(accelerated_widget, 1.f);
+
+ // If no connector was passed, then it's entirely possible that mojo has not
+ // been initialized and BitmapUploader will not work. This occurs, for
+ // example, in some unit test contexts.
+ if (connector) {
+ bitmap_uploader_.reset(new bitmap_uploader::BitmapUploader(window));
+ bitmap_uploader_->Init(connector);
+ prop_.reset(new ui::ViewProp(
+ accelerated_widget,
+ bitmap_uploader::kBitmapUploaderForAcceleratedWidget,
+ bitmap_uploader_.get()));
+ }
+
+ SetPlatformWindow(base::WrapUnique(
+ new ui::StubWindow(nullptr)));
sadrul 2016/05/30 15:44:45 This might fit in a line? (make sure to do 'git cl
Mark Dittmer 2016/05/30 16:14:55 Done.
+
// The location of events is already transformed, and there is no way to
// correctly determine the reverse transform. So, don't attempt to transform
// event locations, else the root location is wrong.
@@ -39,11 +72,6 @@ WindowTreeHostMus::~WindowTreeHostMus() {
DestroyDispatcher();
}
-PlatformWindowMus* WindowTreeHostMus::platform_window() {
- return static_cast<PlatformWindowMus*>(
- WindowTreeHostPlatform::platform_window());
-}
-
void WindowTreeHostMus::DispatchEvent(ui::Event* event) {
if (event->IsKeyEvent() && GetInputMethod()) {
GetInputMethod()->DispatchKeyEvent(event->AsKeyEvent());
« ui/views/mus/native_widget_mus.cc ('K') | « ui/views/mus/window_tree_host_mus.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698