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

Unified Diff: ui/display/android/screen_android.h

Issue 2416403002: Reland of Android: support multiple displays on C++ side (Closed)
Patch Set: Update a map of Displays from Java Created 4 years, 2 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
Index: ui/display/android/screen_android.h
diff --git a/ui/display/test/test_screen.h b/ui/display/android/screen_android.h
similarity index 53%
copy from ui/display/test/test_screen.h
copy to ui/display/android/screen_android.h
index fb822f5d8dcd67e11426add22056ad13f72583b6..3304317ce1ed47b3e25991a97ccc55590884fcc2 100644
--- a/ui/display/test/test_screen.h
+++ b/ui/display/android/screen_android.h
@@ -1,53 +1,45 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
boliu 2016/10/26 17:24:20 remove (c)
Tima Vaisburd 2016/10/27 07:55:58 Gone while moving/renaming
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UI_DISPLAY_TEST_TEST_SCREEN_H_
-#define UI_DISPLAY_TEST_TEST_SCREEN_H_
+#include <map>
-#include <vector>
-
-#include "base/macros.h"
#include "ui/display/display.h"
+#include "ui/display/display_export.h"
#include "ui/display/screen.h"
namespace display {
-namespace test {
-
-// A dummy implementation of display::Screen that contains a single
-// display::Display only. The contained Display can be accessed and modified via
-// TestScreen::display().
-//
-// NOTE: Adding and removing display::DisplayOberver's are no-ops and observers
-// will NOT be notified ever.
-class TestScreen : public Screen {
+
+class DISPLAY_EXPORT ScreenAndroid : public Screen {
public:
- TestScreen();
- ~TestScreen() override;
+ ScreenAndroid();
+ ~ScreenAndroid();
- Display* display() { return &display_; }
+ // Disallow copy and assign.
+ ScreenAndroid(const ScreenAndroid& rhs) = delete;
+ ScreenAndroid& operator=(const ScreenAndroid& rhs) = delete;
- // display::Screen:
+ // Screen interface.
gfx::Point GetCursorScreenPoint() override;
bool IsWindowUnderCursor(gfx::NativeWindow window) override;
gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override;
+
int GetNumDisplays() const override;
std::vector<Display> GetAllDisplays() const override;
Display GetDisplayNearestWindow(gfx::NativeView view) const override;
Display GetDisplayNearestPoint(const gfx::Point& point) const override;
Display GetDisplayMatching(const gfx::Rect& match_rect) const override;
Display GetPrimaryDisplay() const override;
+
void AddObserver(DisplayObserver* observer) override;
void RemoveObserver(DisplayObserver* observer) override;
- private:
- // The only display.
- Display display_;
+ // Called from Java side.
+ void UpdateDisplay(int display_id, const Display& display);
+ void RemoveDisplay(int display_id);
- DISALLOW_COPY_AND_ASSIGN(TestScreen);
+ private:
+ std::map<int, Display> displays_;
mthiesse 2016/10/26 14:49:49 It looks like other platforms (like ash) keep thei
boliu 2016/10/26 17:24:20 The point here is we don't want to expose ScreenAn
Tima Vaisburd 2016/10/27 07:55:58 Renamed screen_android.cc into display_android_man
};
-} // namespace test
} // namespace display
-
-#endif // UI_DISPLAY_TEST_TEST_SCREEN_H_

Powered by Google App Engine
This is Rietveld 408576698