| 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 // static |
| 8 std::unique_ptr<OverlayWindow> OverlayWindow::Create() { |
| 9 return base::WrapUnique(new OverlayWindowViews()); |
| 10 } |
| 11 |
| 12 OverlayWindowViews::OverlayWindowViews() { |
| 13 widget_.reset(new views::Widget()); |
| 14 } |
| 15 |
| 16 OverlayWindowViews::~OverlayWindowViews() = default; |
| 17 |
| 18 void OverlayWindowViews::Init() { |
| 19 // TODO(apacible): Finalize the type of widget. http://crbug/726621 |
| 20 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
| 21 |
| 22 // TODO(apacible): Update preferred sizing and positioning. |
| 23 // http://crbug/726621 |
| 24 params.bounds = gfx::Rect(200, 200, 700, 500); |
| 25 params.keep_on_top = true; |
| 26 params.visible_on_all_workspaces = true; |
| 27 |
| 28 widget_->Init(params); |
| 29 widget_->Show(); |
| 30 |
| 31 // TODO(apacible): Set the WidgetDelegate for more control over behavior. |
| 32 // http://crbug/726621 |
| 33 } |
| 34 |
| 35 bool OverlayWindowViews::IsActive() const { |
| 36 return widget_->IsActive(); |
| 37 } |
| 38 |
| 39 void OverlayWindowViews::Show() { |
| 40 widget_->Show(); |
| 41 } |
| 42 |
| 43 void OverlayWindowViews::Hide() { |
| 44 widget_->Hide(); |
| 45 } |
| 46 |
| 47 void OverlayWindowViews::Close() { |
| 48 widget_->Close(); |
| 49 } |
| 50 |
| 51 void OverlayWindowViews::Activate() { |
| 52 widget_->Activate(); |
| 53 } |
| 54 |
| 55 bool OverlayWindowViews::IsAlwaysOnTop() const { |
| 56 return true; |
| 57 } |
| 58 |
| 59 ui::Layer* OverlayWindowViews::GetLayer() { |
| 60 return widget_->GetLayer(); |
| 61 } |
| 62 |
| 63 gfx::NativeWindow OverlayWindowViews::GetNativeWindow() const { |
| 64 return widget_->GetNativeWindow(); |
| 65 } |
| 66 |
| 67 gfx::Rect OverlayWindowViews::GetBounds() const { |
| 68 return widget_->GetRestoredBounds(); |
| 69 } |
| OLD | NEW |