| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/views/overlay/overlay_window_views.h" |
| 6 |
| 7 #include "ui/views/widget/widget.h" |
| 8 |
| 9 // static |
| 10 std::unique_ptr<OverlayWindow> OverlayWindow::Create() { |
| 11 return base::WrapUnique(new OverlayWindowViews()); |
| 12 } |
| 13 |
| 14 OverlayWindowViews::OverlayWindowViews() { |
| 15 widget_.reset(new views::Widget()); |
| 16 } |
| 17 |
| 18 OverlayWindowViews::~OverlayWindowViews() = default; |
| 19 |
| 20 void OverlayWindowViews::Init() { |
| 21 // TODO(apacible): Finalize the type of widget. http://crbug/726621 |
| 22 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
| 23 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 24 |
| 25 // TODO(apacible): Update preferred sizing and positioning. |
| 26 // http://crbug/726621 |
| 27 params.bounds = gfx::Rect(200, 200, 700, 500); |
| 28 params.keep_on_top = true; |
| 29 params.visible_on_all_workspaces = true; |
| 30 |
| 31 widget_->Init(params); |
| 32 widget_->Show(); |
| 33 |
| 34 // TODO(apacible): Set the WidgetDelegate for more control over behavior. |
| 35 // http://crbug/726621 |
| 36 } |
| 37 |
| 38 bool OverlayWindowViews::IsActive() const { |
| 39 return widget_->IsActive(); |
| 40 } |
| 41 |
| 42 void OverlayWindowViews::Show() { |
| 43 widget_->Show(); |
| 44 } |
| 45 |
| 46 void OverlayWindowViews::Hide() { |
| 47 widget_->Hide(); |
| 48 } |
| 49 |
| 50 void OverlayWindowViews::Close() { |
| 51 widget_->Close(); |
| 52 } |
| 53 |
| 54 void OverlayWindowViews::Activate() { |
| 55 widget_->Activate(); |
| 56 } |
| 57 |
| 58 bool OverlayWindowViews::IsAlwaysOnTop() const { |
| 59 return true; |
| 60 } |
| 61 |
| 62 ui::Layer* OverlayWindowViews::GetLayer() { |
| 63 return widget_->GetLayer(); |
| 64 } |
| 65 |
| 66 gfx::NativeWindow OverlayWindowViews::GetNativeWindow() const { |
| 67 return widget_->GetNativeWindow(); |
| 68 } |
| 69 |
| 70 gfx::Rect OverlayWindowViews::GetBounds() const { |
| 71 return widget_->GetRestoredBounds(); |
| 72 } |
| OLD | NEW |