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

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

Issue 2905833004: [OverlayWindow] Add platform-independent window and views implementation. (Closed)
Patch Set: Rename PIP to Overlay. 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..457375d427d8f41758cdb2b949f2bc84fd5dece2
--- /dev/null
+++ b/chrome/browser/ui/views/overlay/overlay_window_views.cc
@@ -0,0 +1,124 @@
+// 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_(new views::Widget()) {}
+
+OverlayWindowViews::~OverlayWindowViews() = default;
sky 2017/06/20 16:51:39 It's not clear what the ownership model is you're
apacible 2017/06/24 00:42:03 Updated.
+
+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.
+}
+
+ui::Layer* OverlayWindowViews::GetLayer() {
+ return widget_->GetLayer();
+}
+
+bool OverlayWindowViews::IsActive() const {
+ return widget_->IsActive();
+}
+
+// Window is never maximized.
+bool OverlayWindowViews::IsMaximized() const {
+ return false;
+}
+
+// Window is never minimized.
+bool OverlayWindowViews::IsMinimized() const {
+ return false;
+}
+
+// Window is never fullscreened.
+bool OverlayWindowViews::IsFullscreen() const {
+ return false;
+}
+
+gfx::NativeWindow OverlayWindowViews::GetNativeWindow() const {
+ return widget_->GetNativeWindow();
+}
+
+gfx::Rect OverlayWindowViews::GetRestoredBounds() const {
+ return GetBounds();
+}
+
+// Returns the restore state for the window (platform dependent).
+ui::WindowShowState OverlayWindowViews::GetRestoredState() const {
+ return ui::SHOW_STATE_NORMAL;
+}
+
+// Retrieves the window's current bounds, including its window.
+// This will only differ from GetRestoredBounds() for maximized
+// and minimized windows.
+gfx::Rect OverlayWindowViews::GetBounds() const {
+ return widget_->GetRestoredBounds();
+}
+
+void OverlayWindowViews::Show() {
+ widget_->Show();
+}
+
+void OverlayWindowViews::Hide() {
+ widget_->Hide();
+}
+
+void OverlayWindowViews::ShowInactive() {
+ NOTREACHED();
+}
+
+void OverlayWindowViews::Close() {
+ widget_->Close();
+}
+
+void OverlayWindowViews::Activate() {
+ widget_->Activate();
+}
+
+void OverlayWindowViews::Deactivate() {
+ NOTREACHED();
sky 2017/06/20 16:51:39 Why do you have a bunch of NOTREACHEDs? If they ar
apacible 2017/06/24 00:42:03 These will be filled out later. A couple functions
sky 2017/06/26 15:38:44 It's hard for me to readily tell from this cl what
+}
+
+void OverlayWindowViews::Maximize() {
+ NOTREACHED();
+}
+
+void OverlayWindowViews::Minimize() {
+ NOTREACHED();
+}
+
+void OverlayWindowViews::Restore() {
+ NOTREACHED();
+}
+
+void OverlayWindowViews::SetBounds(const gfx::Rect& bounds) {
+ NOTREACHED();
+}
+
+void OverlayWindowViews::FlashFrame(bool flash) {
+ NOTREACHED();
+}
+
+bool OverlayWindowViews::IsAlwaysOnTop() const {
+ return true;
+}
+
+void OverlayWindowViews::SetAlwaysOnTop(bool always_on_top) {
+ NOTREACHED();
+}

Powered by Google App Engine
This is Rietveld 408576698