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

Unified Diff: services/ui/display/platform_screen_impl.cc

Issue 2274353003: Add PlatformScreenDelegate and start implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixes for comments. Created 4 years, 4 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 | « services/ui/display/platform_screen_impl.h ('k') | services/ui/display/platform_screen_impl_ozone.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/display/platform_screen_impl.cc
diff --git a/services/ui/display/platform_screen_impl.cc b/services/ui/display/platform_screen_impl.cc
index 702906fbbc246d7161564e61462c7dce08e1f953..a077af3e4b55847ebf4df3e3a1c870ad3e1a1459 100644
--- a/services/ui/display/platform_screen_impl.cc
+++ b/services/ui/display/platform_screen_impl.cc
@@ -4,6 +4,8 @@
#include "services/ui/display/platform_screen_impl.h"
+#include <memory>
+
#include "base/bind.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
@@ -15,28 +17,27 @@ namespace {
const int64_t kDisplayId = 1;
-void FixedSizeScreenConfiguration(
- const PlatformScreen::ConfiguredDisplayCallback& callback) {
- callback.Run(kDisplayId, gfx::Rect(1024, 768));
-}
-
} // namespace
// static
std::unique_ptr<PlatformScreen> PlatformScreen::Create() {
- return base::WrapUnique(new PlatformScreenImpl);
+ return base::MakeUnique<PlatformScreenImpl>();
}
-PlatformScreenImpl::PlatformScreenImpl() {}
+PlatformScreenImpl::PlatformScreenImpl() : weak_ptr_factory_(this) {}
PlatformScreenImpl::~PlatformScreenImpl() {}
-void PlatformScreenImpl::Init() {}
+void PlatformScreenImpl::FixedSizeScreenConfiguration() {
+ delegate_->OnDisplayAdded(this, kDisplayId, gfx::Rect(1024, 768));
+}
-void PlatformScreenImpl::ConfigurePhysicalDisplay(
- const PlatformScreen::ConfiguredDisplayCallback& callback) {
+void PlatformScreenImpl::Init(PlatformScreenDelegate* delegate) {
+ DCHECK(delegate);
+ delegate_ = delegate;
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(&FixedSizeScreenConfiguration, callback));
+ FROM_HERE, base::Bind(&PlatformScreenImpl::FixedSizeScreenConfiguration,
+ weak_ptr_factory_.GetWeakPtr()));
}
int64_t PlatformScreenImpl::GetPrimaryDisplayId() const {
« no previous file with comments | « services/ui/display/platform_screen_impl.h ('k') | services/ui/display/platform_screen_impl_ozone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698