diff options
author | sievers <sievers@chromium.org> | 2015-10-16 13:44:36 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-16 20:45:18 +0000 |
commit | 1b4ef1a69b08dd2d779521118ddb1f3a285d4c83 (patch) | |
tree | 6322eab33bc0a505b2623ce3e0346b6aa649094b /ui/aura/window_tree_host_win.cc | |
parent | 37f80293c26fb0192c80f93207d917f8aa92fbfa (diff) | |
download | chromium_src-1b4ef1a69b08dd2d779521118ddb1f3a285d4c83.zip chromium_src-1b4ef1a69b08dd2d779521118ddb1f3a285d4c83.tar.gz chromium_src-1b4ef1a69b08dd2d779521118ddb1f3a285d4c83.tar.bz2 |
aura: Unify Ozone+Windows+Android WindowTreeHost
This effectively adds an Android WindowTreeHost.
For these three most platform-specific stuff
happens in PlatformWindow* and the WTH is mostly
a shim.
BUG=507792
Review URL: https://codereview.chromium.org/1390883003
Cr-Commit-Position: refs/heads/master@{#354585}
Diffstat (limited to 'ui/aura/window_tree_host_win.cc')
-rw-r--r-- | ui/aura/window_tree_host_win.cc | 155 |
1 files changed, 0 insertions, 155 deletions
diff --git a/ui/aura/window_tree_host_win.cc b/ui/aura/window_tree_host_win.cc deleted file mode 100644 index ea7bf24..0000000 --- a/ui/aura/window_tree_host_win.cc +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/aura/window_tree_host_win.h" - -#include <windows.h> - -#include <algorithm> - -#include "base/message_loop/message_loop.h" -#include "ui/aura/client/cursor_client.h" -#include "ui/aura/window_event_dispatcher.h" -#include "ui/base/cursor/cursor_loader_win.h" -#include "ui/base/view_prop.h" -#include "ui/compositor/compositor.h" -#include "ui/events/event.h" -#include "ui/gfx/display.h" -#include "ui/gfx/geometry/insets.h" -#include "ui/gfx/native_widget_types.h" -#include "ui/gfx/screen.h" -#include "ui/platform_window/win/win_window.h" - -using std::max; -using std::min; - -namespace aura { - -// static -WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) { - return new WindowTreeHostWin(bounds); -} - -WindowTreeHostWin::WindowTreeHostWin(const gfx::Rect& bounds) - : has_capture_(false), - widget_(gfx::kNullAcceleratedWidget), - window_(new ui::WinWindow(this, bounds)) { -} - -WindowTreeHostWin::~WindowTreeHostWin() { - DestroyCompositor(); - DestroyDispatcher(); - window_.reset(); -} - -ui::EventSource* WindowTreeHostWin::GetEventSource() { - return this; -} - -gfx::AcceleratedWidget WindowTreeHostWin::GetAcceleratedWidget() { - return widget_; -} - -void WindowTreeHostWin::ShowImpl() { - window_->Show(); -} - -void WindowTreeHostWin::HideImpl() { - window_->Hide(); -} - -gfx::Rect WindowTreeHostWin::GetBounds() const { - return window_->GetBounds(); -} - -void WindowTreeHostWin::SetBounds(const gfx::Rect& bounds) { - window_->SetBounds(bounds); -} - -gfx::Point WindowTreeHostWin::GetLocationOnNativeScreen() const { - return window_->GetBounds().origin(); -} - -void WindowTreeHostWin::SetCapture() { - if (!has_capture_) { - has_capture_ = true; - window_->SetCapture(); - } -} - -void WindowTreeHostWin::ReleaseCapture() { - if (has_capture_) - window_->ReleaseCapture(); -} - -void WindowTreeHostWin::SetCursorNative(gfx::NativeCursor native_cursor) { - // Custom web cursors are handled directly. - if (native_cursor == ui::kCursorCustom) - return; - - ui::CursorLoaderWin cursor_loader; - cursor_loader.SetPlatformCursor(&native_cursor); - ::SetCursor(native_cursor.platform()); -} - -void WindowTreeHostWin::MoveCursorToNative(const gfx::Point& location) { - // Deliberately not implemented. -} - -void WindowTreeHostWin::OnCursorVisibilityChangedNative(bool show) { - NOTIMPLEMENTED(); -} - -void WindowTreeHostWin::OnBoundsChanged(const gfx::Rect& new_bounds) { - gfx::Rect old_bounds = bounds_; - bounds_ = new_bounds; - if (bounds_.origin() != old_bounds.origin()) - OnHostMoved(bounds_.origin()); - if (bounds_.size() != old_bounds.size()) - OnHostResized(bounds_.size()); -} - -void WindowTreeHostWin::OnDamageRect(const gfx::Rect& damage_rect) { - compositor()->ScheduleRedrawRect(damage_rect); -} - -void WindowTreeHostWin::DispatchEvent(ui::Event* event) { - ui::EventDispatchDetails details = SendEventToProcessor(event); - if (details.dispatcher_destroyed) - event->SetHandled(); -} - -void WindowTreeHostWin::OnCloseRequest() { - // TODO: this obviously shouldn't be here. - base::MessageLoopForUI::current()->QuitWhenIdle(); -} - -void WindowTreeHostWin::OnClosed() { -} - -void WindowTreeHostWin::OnWindowStateChanged( - ui::PlatformWindowState new_state) { -} - -void WindowTreeHostWin::OnLostCapture() { - if (has_capture_) { - has_capture_ = false; - OnHostLostWindowCapture(); - } -} - -void WindowTreeHostWin::OnAcceleratedWidgetAvailable( - gfx::AcceleratedWidget widget, - float device_pixel_ratio) { - widget_ = widget; - CreateCompositor(); - WindowTreeHost::OnAcceleratedWidgetAvailable(); -} - -void WindowTreeHostWin::OnActivationChanged(bool active) { - if (active) - OnHostActivated(); -} - -} // namespace aura |