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

Unified Diff: services/ui/ws/platform_display_default.cc

Issue 2507943002: Move PlatformDisplayDefault into it's own file. (Closed)
Patch Set: Fixes. Created 4 years, 1 month 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 | « services/ui/ws/platform_display_default.h ('k') | services/ui/ws/test_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/platform_display_default.cc
diff --git a/services/ui/ws/platform_display.cc b/services/ui/ws/platform_display_default.cc
similarity index 72%
copy from services/ui/ws/platform_display.cc
copy to services/ui/ws/platform_display_default.cc
index 72bb054c6d720c246b0b81860fe0e953a0ac5770..9492e85cb8fdd0d5da5d16a0032c53b18d6fbefd 100644
--- a/services/ui/ws/platform_display.cc
+++ b/services/ui/ws/platform_display_default.cc
@@ -1,26 +1,13 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2016 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 "services/ui/ws/platform_display.h"
+#include "services/ui/ws/platform_display_default.h"
-#include <utility>
-
-#include "base/numerics/safe_conversions.h"
-#include "build/build_config.h"
-#include "cc/ipc/quads.mojom.h"
-#include "cc/output/copy_output_request.h"
-#include "cc/output/delegated_frame_data.h"
#include "gpu/ipc/client/gpu_channel_host.h"
-#include "services/service_manager/public/cpp/connection.h"
-#include "services/service_manager/public/cpp/connector.h"
#include "services/ui/display/platform_screen.h"
-#include "services/ui/surfaces/display_compositor.h"
-#include "services/ui/ws/platform_display_factory.h"
#include "services/ui/ws/platform_display_init_params.h"
#include "services/ui/ws/server_window.h"
-#include "services/ui/ws/window_coordinate_conversions.h"
-#include "third_party/skia/include/core/SkXfermode.h"
#include "ui/base/cursor/cursor_loader.h"
#include "ui/display/display.h"
#include "ui/events/event.h"
@@ -39,24 +26,11 @@
#endif
namespace ui {
-
namespace ws {
-// static
-PlatformDisplayFactory* PlatformDisplay::factory_ = nullptr;
-
-// static
-std::unique_ptr<PlatformDisplay> PlatformDisplay::Create(
- const PlatformDisplayInitParams& init_params) {
- if (factory_)
- return factory_->CreatePlatformDisplay();
-
- return base::MakeUnique<DefaultPlatformDisplay>(init_params);
-}
-
-DefaultPlatformDisplay::DefaultPlatformDisplay(
+PlatformDisplayDefault::PlatformDisplayDefault(
const PlatformDisplayInitParams& init_params)
- : id_(init_params.display_id),
+ : display_id_(init_params.display_id),
#if !defined(OS_ANDROID)
cursor_loader_(ui::CursorLoader::Create()),
#endif
@@ -64,7 +38,18 @@ DefaultPlatformDisplay::DefaultPlatformDisplay(
metrics_(init_params.metrics) {
}
-void DefaultPlatformDisplay::Init(PlatformDisplayDelegate* delegate) {
+PlatformDisplayDefault::~PlatformDisplayDefault() {
+ // Don't notify the delegate from the destructor.
+ delegate_ = nullptr;
+
+ frame_generator_.reset();
+ // Destroy the PlatformWindow early on as it may call us back during
+ // destruction and we want to be in a known state. But destroy the surface
+ // first because it can still be using the platform window.
+ platform_window_.reset();
+}
+
+void PlatformDisplayDefault::Init(PlatformDisplayDelegate* delegate) {
delegate_ = delegate;
DCHECK(!metrics_.pixel_size.IsEmpty());
@@ -90,38 +75,27 @@ void DefaultPlatformDisplay::Init(PlatformDisplayDelegate* delegate) {
platform_window_->Show();
}
-int64_t DefaultPlatformDisplay::GetId() const {
- return id_;
-}
-
-DefaultPlatformDisplay::~DefaultPlatformDisplay() {
- // Don't notify the delegate from the destructor.
- delegate_ = nullptr;
-
- frame_generator_.reset();
- // Destroy the PlatformWindow early on as it may call us back during
- // destruction and we want to be in a known state. But destroy the surface
- // first because it can still be using the platform window.
- platform_window_.reset();
+int64_t PlatformDisplayDefault::GetId() const {
+ return display_id_;
}
-void DefaultPlatformDisplay::SetViewportSize(const gfx::Size& size) {
+void PlatformDisplayDefault::SetViewportSize(const gfx::Size& size) {
platform_window_->SetBounds(gfx::Rect(size));
}
-void DefaultPlatformDisplay::SetTitle(const base::string16& title) {
+void PlatformDisplayDefault::SetTitle(const base::string16& title) {
platform_window_->SetTitle(title);
}
-void DefaultPlatformDisplay::SetCapture() {
+void PlatformDisplayDefault::SetCapture() {
platform_window_->SetCapture();
}
-void DefaultPlatformDisplay::ReleaseCapture() {
+void PlatformDisplayDefault::ReleaseCapture() {
platform_window_->ReleaseCapture();
}
-void DefaultPlatformDisplay::SetCursorById(mojom::Cursor cursor_id) {
+void PlatformDisplayDefault::SetCursorById(mojom::Cursor cursor_id) {
#if !defined(OS_ANDROID)
// TODO(erg): This still isn't sufficient, and will only use native cursors
// that chrome would use, not custom image cursors. For that, we should
@@ -134,33 +108,34 @@ void DefaultPlatformDisplay::SetCursorById(mojom::Cursor cursor_id) {
#endif
}
-void DefaultPlatformDisplay::UpdateTextInputState(
+void PlatformDisplayDefault::UpdateTextInputState(
const ui::TextInputState& state) {
ui::PlatformImeController* ime = platform_window_->GetPlatformImeController();
if (ime)
ime->UpdateTextInputState(state);
}
-void DefaultPlatformDisplay::SetImeVisibility(bool visible) {
+void PlatformDisplayDefault::SetImeVisibility(bool visible) {
ui::PlatformImeController* ime = platform_window_->GetPlatformImeController();
if (ime)
ime->SetImeVisibility(visible);
}
-gfx::Rect DefaultPlatformDisplay::GetBounds() const {
+gfx::Rect PlatformDisplayDefault::GetBounds() const {
return metrics_.bounds;
}
-bool DefaultPlatformDisplay::IsPrimaryDisplay() const {
- return display::PlatformScreen::GetInstance()->GetPrimaryDisplayId() == id_;
+bool PlatformDisplayDefault::IsPrimaryDisplay() const {
+ return display::PlatformScreen::GetInstance()->GetPrimaryDisplayId() ==
+ display_id_;
}
-void DefaultPlatformDisplay::OnGpuChannelEstablished(
+void PlatformDisplayDefault::OnGpuChannelEstablished(
scoped_refptr<gpu::GpuChannelHost> channel) {
frame_generator_->OnGpuChannelEstablished(channel);
}
-bool DefaultPlatformDisplay::UpdateViewportMetrics(
+bool PlatformDisplayDefault::UpdateViewportMetrics(
const display::ViewportMetrics& metrics) {
if (metrics_ == metrics)
return false;
@@ -175,18 +150,18 @@ bool DefaultPlatformDisplay::UpdateViewportMetrics(
return true;
}
-const display::ViewportMetrics& DefaultPlatformDisplay::GetViewportMetrics()
+const display::ViewportMetrics& PlatformDisplayDefault::GetViewportMetrics()
const {
return metrics_;
}
-void DefaultPlatformDisplay::UpdateEventRootLocation(ui::LocatedEvent* event) {
+void PlatformDisplayDefault::UpdateEventRootLocation(ui::LocatedEvent* event) {
gfx::Point location = event->location();
location.Offset(metrics_.bounds.x(), metrics_.bounds.y());
event->set_root_location(location);
}
-void DefaultPlatformDisplay::OnBoundsChanged(const gfx::Rect& new_bounds) {
+void PlatformDisplayDefault::OnBoundsChanged(const gfx::Rect& new_bounds) {
// We only care if the window size has changed.
if (new_bounds.size() == metrics_.pixel_size)
return;
@@ -196,10 +171,9 @@ void DefaultPlatformDisplay::OnBoundsChanged(const gfx::Rect& new_bounds) {
// something but that isn't fully flushed out.
}
-void DefaultPlatformDisplay::OnDamageRect(const gfx::Rect& damaged_region) {
-}
+void PlatformDisplayDefault::OnDamageRect(const gfx::Rect& damaged_region) {}
-void DefaultPlatformDisplay::DispatchEvent(ui::Event* event) {
+void PlatformDisplayDefault::DispatchEvent(ui::Event* event) {
if (event->IsLocatedEvent())
UpdateEventRootLocation(event->AsLocatedEvent());
@@ -243,20 +217,20 @@ void DefaultPlatformDisplay::DispatchEvent(ui::Event* event) {
#endif
}
-void DefaultPlatformDisplay::OnCloseRequest() {
+void PlatformDisplayDefault::OnCloseRequest() {
display::PlatformScreen::GetInstance()->RequestCloseDisplay(GetId());
}
-void DefaultPlatformDisplay::OnClosed() {}
+void PlatformDisplayDefault::OnClosed() {}
-void DefaultPlatformDisplay::OnWindowStateChanged(
+void PlatformDisplayDefault::OnWindowStateChanged(
ui::PlatformWindowState new_state) {}
-void DefaultPlatformDisplay::OnLostCapture() {
+void PlatformDisplayDefault::OnLostCapture() {
delegate_->OnNativeCaptureLost();
}
-void DefaultPlatformDisplay::OnAcceleratedWidgetAvailable(
+void PlatformDisplayDefault::OnAcceleratedWidgetAvailable(
gfx::AcceleratedWidget widget,
float device_scale_factor) {
// This will get called after Init() is called, either synchronously as part
@@ -266,16 +240,15 @@ void DefaultPlatformDisplay::OnAcceleratedWidgetAvailable(
frame_generator_->OnAcceleratedWidgetAvailable(widget);
}
-void DefaultPlatformDisplay::OnAcceleratedWidgetDestroyed() {
+void PlatformDisplayDefault::OnAcceleratedWidgetDestroyed() {
NOTREACHED();
}
-void DefaultPlatformDisplay::OnActivationChanged(bool active) {}
+void PlatformDisplayDefault::OnActivationChanged(bool active) {}
-bool DefaultPlatformDisplay::IsInHighContrastMode() {
+bool PlatformDisplayDefault::IsInHighContrastMode() {
return delegate_ ? delegate_->IsInHighContrastMode() : false;
}
} // namespace ws
-
} // namespace ui
« no previous file with comments | « services/ui/ws/platform_display_default.h ('k') | services/ui/ws/test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698