Commit 15467f9c authored by kylechar's avatar kylechar Committed by Commit bot

Rename PlatformScreen implementations.

Improve naming of PlatformScreen implementations.

BUG=none

Review-Url: https://codereview.chromium.org/2317073003
Cr-Commit-Position: refs/heads/master@{#417036}
parent 7fe419af
...@@ -19,18 +19,18 @@ source_set("display") { ...@@ -19,18 +19,18 @@ source_set("display") {
if (use_ozone && is_chromeos) { if (use_ozone && is_chromeos) {
sources += [ sources += [
"platform_screen_impl_ozone.cc", "platform_screen_ozone.cc",
"platform_screen_impl_ozone.h", "platform_screen_ozone.h",
] ]
deps += [ deps += [
"//skia", "//skia",
"//ui/ozone:ozone", "//ui/ozone",
] ]
} else { } else {
sources += [ sources += [
"platform_screen_impl.cc", "platform_screen_stub.cc",
"platform_screen_impl.h", "platform_screen_stub.h",
] ]
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "services/ui/display/platform_screen_impl_ozone.h" #include "services/ui/display/platform_screen_ozone.h"
#include <memory> #include <memory>
...@@ -27,16 +27,16 @@ const SkColor kChromeOsBootColor = SkColorSetRGB(0xfe, 0xfe, 0xfe); ...@@ -27,16 +27,16 @@ const SkColor kChromeOsBootColor = SkColorSetRGB(0xfe, 0xfe, 0xfe);
// static // static
std::unique_ptr<PlatformScreen> PlatformScreen::Create() { std::unique_ptr<PlatformScreen> PlatformScreen::Create() {
return base::MakeUnique<PlatformScreenImplOzone>(); return base::MakeUnique<PlatformScreenOzone>();
} }
PlatformScreenImplOzone::PlatformScreenImplOzone() {} PlatformScreenOzone::PlatformScreenOzone() {}
PlatformScreenImplOzone::~PlatformScreenImplOzone() { PlatformScreenOzone::~PlatformScreenOzone() {
display_configurator_.RemoveObserver(this); display_configurator_.RemoveObserver(this);
} }
void PlatformScreenImplOzone::Init(PlatformScreenDelegate* delegate) { void PlatformScreenOzone::Init(PlatformScreenDelegate* delegate) {
DCHECK(delegate); DCHECK(delegate);
delegate_ = delegate; delegate_ = delegate;
...@@ -60,11 +60,11 @@ void PlatformScreenImplOzone::Init(PlatformScreenDelegate* delegate) { ...@@ -60,11 +60,11 @@ void PlatformScreenImplOzone::Init(PlatformScreenDelegate* delegate) {
} }
} }
int64_t PlatformScreenImplOzone::GetPrimaryDisplayId() const { int64_t PlatformScreenOzone::GetPrimaryDisplayId() const {
return primary_display_id_; return primary_display_id_;
} }
void PlatformScreenImplOzone::ProcessRemovedDisplays( void PlatformScreenOzone::ProcessRemovedDisplays(
const ui::DisplayConfigurator::DisplayStateList& snapshots) { const ui::DisplayConfigurator::DisplayStateList& snapshots) {
std::vector<int64_t> current_ids; std::vector<int64_t> current_ids;
for (ui::DisplaySnapshot* snapshot : snapshots) for (ui::DisplaySnapshot* snapshot : snapshots)
...@@ -91,7 +91,7 @@ void PlatformScreenImplOzone::ProcessRemovedDisplays( ...@@ -91,7 +91,7 @@ void PlatformScreenImplOzone::ProcessRemovedDisplays(
} }
} }
void PlatformScreenImplOzone::ProcessModifiedDisplays( void PlatformScreenOzone::ProcessModifiedDisplays(
const ui::DisplayConfigurator::DisplayStateList& snapshots) { const ui::DisplayConfigurator::DisplayStateList& snapshots) {
for (ui::DisplaySnapshot* snapshot : snapshots) { for (ui::DisplaySnapshot* snapshot : snapshots) {
auto iter = GetCachedDisplayIterator(snapshot->display_id()); auto iter = GetCachedDisplayIterator(snapshot->display_id());
...@@ -106,7 +106,7 @@ void PlatformScreenImplOzone::ProcessModifiedDisplays( ...@@ -106,7 +106,7 @@ void PlatformScreenImplOzone::ProcessModifiedDisplays(
} }
} }
void PlatformScreenImplOzone::UpdateCachedDisplays() { void PlatformScreenOzone::UpdateCachedDisplays() {
// Walk through cached displays after processing the snapshots to find any // Walk through cached displays after processing the snapshots to find any
// removed or modified displays. This ensures that we only send one update per // removed or modified displays. This ensures that we only send one update per
// display to the delegate. // display to the delegate.
...@@ -135,7 +135,7 @@ void PlatformScreenImplOzone::UpdateCachedDisplays() { ...@@ -135,7 +135,7 @@ void PlatformScreenImplOzone::UpdateCachedDisplays() {
} }
} }
void PlatformScreenImplOzone::AddNewDisplays( void PlatformScreenOzone::AddNewDisplays(
const ui::DisplayConfigurator::DisplayStateList& snapshots) { const ui::DisplayConfigurator::DisplayStateList& snapshots) {
for (ui::DisplaySnapshot* snapshot : snapshots) { for (ui::DisplaySnapshot* snapshot : snapshots) {
const int64_t id = snapshot->display_id(); const int64_t id = snapshot->display_id();
...@@ -159,15 +159,15 @@ void PlatformScreenImplOzone::AddNewDisplays( ...@@ -159,15 +159,15 @@ void PlatformScreenImplOzone::AddNewDisplays(
} }
} }
PlatformScreenImplOzone::CachedDisplayIterator PlatformScreenOzone::CachedDisplayIterator
PlatformScreenImplOzone::GetCachedDisplayIterator(int64_t display_id) { PlatformScreenOzone::GetCachedDisplayIterator(int64_t display_id) {
return std::find_if(cached_displays_.begin(), cached_displays_.end(), return std::find_if(cached_displays_.begin(), cached_displays_.end(),
[display_id](const DisplayInfo& display_info) { [display_id](const DisplayInfo& display_info) {
return display_info.id == display_id; return display_info.id == display_id;
}); });
} }
void PlatformScreenImplOzone::OnDisplayModeChanged( void PlatformScreenOzone::OnDisplayModeChanged(
const ui::DisplayConfigurator::DisplayStateList& displays) { const ui::DisplayConfigurator::DisplayStateList& displays) {
ProcessRemovedDisplays(displays); ProcessRemovedDisplays(displays);
ProcessModifiedDisplays(displays); ProcessModifiedDisplays(displays);
...@@ -175,7 +175,7 @@ void PlatformScreenImplOzone::OnDisplayModeChanged( ...@@ -175,7 +175,7 @@ void PlatformScreenImplOzone::OnDisplayModeChanged(
AddNewDisplays(displays); AddNewDisplays(displays);
} }
void PlatformScreenImplOzone::OnDisplayModeChangeFailed( void PlatformScreenOzone::OnDisplayModeChangeFailed(
const ui::DisplayConfigurator::DisplayStateList& displays, const ui::DisplayConfigurator::DisplayStateList& displays,
ui::MultipleDisplayState failed_new_state) { ui::MultipleDisplayState failed_new_state) {
LOG(ERROR) << "OnDisplayModeChangeFailed from DisplayConfigurator"; LOG(ERROR) << "OnDisplayModeChangeFailed from DisplayConfigurator";
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef SERVICES_UI_DISPLAY_PLATFORM_SCREEN_IMPL_OZONE_H_ #ifndef SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_
#define SERVICES_UI_DISPLAY_PLATFORM_SCREEN_IMPL_OZONE_H_ #define SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_
#include <stdint.h> #include <stdint.h>
...@@ -18,13 +18,13 @@ ...@@ -18,13 +18,13 @@
namespace display { namespace display {
// PlatformScreenImplOzone provides the necessary functionality to configure all // PlatformScreenOzone provides the necessary functionality to configure all
// attached physical displays on the ozone platform. // attached physical displays on the ozone platform.
class PlatformScreenImplOzone : public PlatformScreen, class PlatformScreenOzone : public PlatformScreen,
public ui::DisplayConfigurator::Observer { public ui::DisplayConfigurator::Observer {
public: public:
PlatformScreenImplOzone(); PlatformScreenOzone();
~PlatformScreenImplOzone() override; ~PlatformScreenOzone() override;
// PlatformScreen: // PlatformScreen:
void Init(PlatformScreenDelegate* delegate) override; void Init(PlatformScreenDelegate* delegate) override;
...@@ -92,9 +92,9 @@ class PlatformScreenImplOzone : public PlatformScreen, ...@@ -92,9 +92,9 @@ class PlatformScreenImplOzone : public PlatformScreen,
std::vector<DisplayInfo> cached_displays_; std::vector<DisplayInfo> cached_displays_;
gfx::Point next_display_origin_; gfx::Point next_display_origin_;
DISALLOW_COPY_AND_ASSIGN(PlatformScreenImplOzone); DISALLOW_COPY_AND_ASSIGN(PlatformScreenOzone);
}; };
} // namespace display } // namespace display
#endif // SERVICES_UI_DISPLAY_PLATFORM_SCREEN_IMPL_OZONE_H_ #endif // SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "services/ui/display/platform_screen.h" #include "services/ui/display/platform_screen.h"
#include "services/ui/display/platform_screen_impl_ozone.h" #include "services/ui/display/platform_screen_ozone.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/display/chromeos/display_configurator.h" #include "ui/display/chromeos/display_configurator.h"
...@@ -101,7 +101,7 @@ class TestPlatformScreenDelegate : public PlatformScreenDelegate { ...@@ -101,7 +101,7 @@ class TestPlatformScreenDelegate : public PlatformScreenDelegate {
}; };
// Test fixture with helpers to act like ui::DisplayConfigurator and send // Test fixture with helpers to act like ui::DisplayConfigurator and send
// OnDisplayModeChanged() to PlatformScreenImplOzone. // OnDisplayModeChanged() to PlatformScreenOzone.
class PlatformScreenOzoneTest : public testing::Test { class PlatformScreenOzoneTest : public testing::Test {
public: public:
PlatformScreenOzoneTest() {} PlatformScreenOzoneTest() {}
...@@ -170,7 +170,7 @@ class PlatformScreenOzoneTest : public testing::Test { ...@@ -170,7 +170,7 @@ class PlatformScreenOzoneTest : public testing::Test {
void SetUp() override { void SetUp() override {
testing::Test::SetUp(); testing::Test::SetUp();
ui::OzonePlatform::InitializeForUI(); ui::OzonePlatform::InitializeForUI();
platform_screen_ = base::MakeUnique<PlatformScreenImplOzone>(); platform_screen_ = base::MakeUnique<PlatformScreenOzone>();
platform_screen_->Init(&delegate_); platform_screen_->Init(&delegate_);
// Double check the expected display exists and clear counters. // Double check the expected display exists and clear counters.
...@@ -191,7 +191,7 @@ class PlatformScreenOzoneTest : public testing::Test { ...@@ -191,7 +191,7 @@ class PlatformScreenOzoneTest : public testing::Test {
} }
TestPlatformScreenDelegate delegate_; TestPlatformScreenDelegate delegate_;
std::unique_ptr<PlatformScreenImplOzone> platform_screen_; std::unique_ptr<PlatformScreenOzone> platform_screen_;
std::vector<std::unique_ptr<DisplaySnapshot>> snapshots_; std::vector<std::unique_ptr<DisplaySnapshot>> snapshots_;
}; };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "services/ui/display/platform_screen_impl.h" #include "services/ui/display/platform_screen_stub.h"
#include <memory> #include <memory>
...@@ -21,26 +21,26 @@ const int64_t kDisplayId = 1; ...@@ -21,26 +21,26 @@ const int64_t kDisplayId = 1;
// static // static
std::unique_ptr<PlatformScreen> PlatformScreen::Create() { std::unique_ptr<PlatformScreen> PlatformScreen::Create() {
return base::MakeUnique<PlatformScreenImpl>(); return base::MakeUnique<PlatformScreenStub>();
} }
PlatformScreenImpl::PlatformScreenImpl() : weak_ptr_factory_(this) {} PlatformScreenStub::PlatformScreenStub() : weak_ptr_factory_(this) {}
PlatformScreenImpl::~PlatformScreenImpl() {} PlatformScreenStub::~PlatformScreenStub() {}
void PlatformScreenImpl::FixedSizeScreenConfiguration() { void PlatformScreenStub::FixedSizeScreenConfiguration() {
delegate_->OnDisplayAdded(this, kDisplayId, gfx::Rect(1024, 768)); delegate_->OnDisplayAdded(this, kDisplayId, gfx::Rect(1024, 768));
} }
void PlatformScreenImpl::Init(PlatformScreenDelegate* delegate) { void PlatformScreenStub::Init(PlatformScreenDelegate* delegate) {
DCHECK(delegate); DCHECK(delegate);
delegate_ = delegate; delegate_ = delegate;
base::ThreadTaskRunnerHandle::Get()->PostTask( base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&PlatformScreenImpl::FixedSizeScreenConfiguration, FROM_HERE, base::Bind(&PlatformScreenStub::FixedSizeScreenConfiguration,
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr()));
} }
int64_t PlatformScreenImpl::GetPrimaryDisplayId() const { int64_t PlatformScreenStub::GetPrimaryDisplayId() const {
return kDisplayId; return kDisplayId;
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef SERVICES_UI_DISPLAY_PLATFORM_SCREEN_IMPL_H_ #ifndef SERVICES_UI_DISPLAY_PLATFORM_SCREEN_STUB_H_
#define SERVICES_UI_DISPLAY_PLATFORM_SCREEN_IMPL_H_ #define SERVICES_UI_DISPLAY_PLATFORM_SCREEN_STUB_H_
#include <stdint.h> #include <stdint.h>
...@@ -13,12 +13,12 @@ ...@@ -13,12 +13,12 @@
namespace display { namespace display {
// PlatformScreenImpl provides the necessary functionality to configure all // PlatformScreenStub provides the necessary functionality to configure a fixed
// attached physical displays on non-ozone platforms. // 1024x768 display for non-ozone platforms.
class PlatformScreenImpl : public PlatformScreen { class PlatformScreenStub : public PlatformScreen {
public: public:
PlatformScreenImpl(); PlatformScreenStub();
~PlatformScreenImpl() override; ~PlatformScreenStub() override;
private: private:
// Fake creation of a single 1024x768 display. // Fake creation of a single 1024x768 display.
...@@ -30,11 +30,11 @@ class PlatformScreenImpl : public PlatformScreen { ...@@ -30,11 +30,11 @@ class PlatformScreenImpl : public PlatformScreen {
PlatformScreenDelegate* delegate_ = nullptr; PlatformScreenDelegate* delegate_ = nullptr;
base::WeakPtrFactory<PlatformScreenImpl> weak_ptr_factory_; base::WeakPtrFactory<PlatformScreenStub> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(PlatformScreenImpl); DISALLOW_COPY_AND_ASSIGN(PlatformScreenStub);
}; };
} // namespace display } // namespace display
#endif // SERVICES_UI_DISPLAY_PLATFORM_SCREEN_IMPL_H_ #endif // SERVICES_UI_DISPLAY_PLATFORM_SCREEN_STUB_H_
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