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

Unified Diff: chrome/browser/ui/views/overlay/overlay_window_views.cc

Issue 2905833004: [OverlayWindow] Add platform-independent window and views implementation. (Closed)
Patch Set: Remove BaseWindow subclassing per conversation with sky@. Created 3 years, 6 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: chrome/browser/ui/views/overlay/overlay_window_views.cc
diff --git a/chrome/browser/ui/views/overlay/overlay_window_views.cc b/chrome/browser/ui/views/overlay/overlay_window_views.cc
new file mode 100644
index 0000000000000000000000000000000000000000..603ac85618d75eb73ba83e02b769e28f1da1e2e4
--- /dev/null
+++ b/chrome/browser/ui/views/overlay/overlay_window_views.cc
@@ -0,0 +1,68 @@
+// Copyright 2017 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 "chrome/browser/ui/views/overlay/overlay_window_views.h"
+
+// static
+std::unique_ptr<OverlayWindow> OverlayWindow::Create() {
+ return base::WrapUnique(new OverlayWindowViews());
+}
+
+OverlayWindowViews::OverlayWindowViews() {
+ widget_.reset(new views::Widget());
+}
+
+OverlayWindowViews::~OverlayWindowViews() = default;
+
+void OverlayWindowViews::Init() {
+ // TODO(apacible): Finalize the type of widget.
+ views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
+
+ // TODO(apacible): Update preferred sizing and positioning.
+ params.bounds = gfx::Rect(200, 200, 700, 500);
+ params.keep_on_top = true;
+ params.visible_on_all_workspaces = true;
+
+ widget_->Init(params);
+ widget_->Show();
+
+ // TODO(apacible): Set the WidgetDelegate for more control over behavior.
mlamouri (slow - plz ping) 2017/07/07 10:34:38 could you have this TODO and the above point to th
apacible 2017/07/18 01:08:28 Done.
+}
+
+bool OverlayWindowViews::IsActive() const {
+ return widget_->IsActive();
+}
+
+void OverlayWindowViews::Show() {
+ widget_->Show();
+}
+
+void OverlayWindowViews::Hide() {
+ widget_->Hide();
+}
+
+void OverlayWindowViews::Close() {
+ widget_->Close();
+}
+
+void OverlayWindowViews::Activate() {
+ widget_->Activate();
+}
+
+bool OverlayWindowViews::IsAlwaysOnTop() const {
+ return true;
+}
+
+ui::Layer* OverlayWindowViews::GetLayer() {
+ return widget_->GetLayer();
+}
+
+gfx::NativeWindow OverlayWindowViews::GetNativeWindow() const {
+ return widget_->GetNativeWindow();
+}
+
+// Retrieves the window's current bounds, including its window.
mlamouri (slow - plz ping) 2017/07/07 10:34:38 Is this comment needed?
sky 2017/07/11 18:02:25 This comment should be in overlay_window.h
+gfx::Rect OverlayWindowViews::GetBounds() const {
+ return widget_->GetRestoredBounds();
+}

Powered by Google App Engine
This is Rietveld 408576698