Chromium Code Reviews| 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/pip/pip_window_views.h" | |
| 6 | |
| 7 // static | |
| 8 std::unique_ptr<PipWindow> PipWindow::Create() { | |
| 9 return base::WrapUnique(new PipWindowViews()); | |
| 10 } | |
| 11 | |
| 12 PipWindowViews::PipWindowViews() : widget_(new views::Widget()) {} | |
| 13 | |
| 14 PipWindowViews::~PipWindowViews() {} | |
|
mlamouri (slow - plz ping)
2017/06/05 13:09:33
instead of {} you can do `= default;`
apacible
2017/06/13 07:58:09
Done.
| |
| 15 | |
| 16 void PipWindowViews::Init() { | |
| 17 // TODO(apacible): Finalize the type of widget. | |
| 18 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | |
| 19 | |
| 20 // TODO(apacible): Update preferred sizing and positioning. | |
| 21 params.bounds = gfx::Rect(200, 200, 700, 500); | |
| 22 params.keep_on_top = true; | |
| 23 params.visible_on_all_workspaces = true; | |
| 24 | |
| 25 widget_->Init(params); | |
| 26 widget_->Show(); | |
| 27 | |
| 28 // TODO(apacible): Set the WidgetDelegate for more control over behavior. | |
| 29 } | |
| 30 | |
| 31 ui::Layer* PipWindowViews::GetLayer() { | |
| 32 return widget_->GetLayer(); | |
| 33 } | |
| 34 | |
| 35 bool PipWindowViews::IsActive() const { | |
| 36 return widget_->IsActive(); | |
| 37 } | |
| 38 | |
| 39 // Window is never maximized. | |
| 40 bool PipWindowViews::IsMaximized() const { | |
| 41 return false; | |
| 42 } | |
| 43 | |
| 44 // Window is never minimized. | |
| 45 bool PipWindowViews::IsMinimized() const { | |
| 46 return false; | |
| 47 } | |
| 48 | |
| 49 // Window is never fullscreened. | |
| 50 bool PipWindowViews::IsFullscreen() const { | |
| 51 return false; | |
| 52 } | |
| 53 | |
| 54 gfx::NativeWindow PipWindowViews::GetNativeWindow() const { | |
| 55 return widget_->GetNativeWindow(); | |
| 56 } | |
| 57 | |
| 58 gfx::Rect PipWindowViews::GetRestoredBounds() const { | |
| 59 return GetBounds(); | |
| 60 } | |
| 61 | |
| 62 // Returns the restore state for the window (platform dependent). | |
| 63 ui::WindowShowState PipWindowViews::GetRestoredState() const { | |
| 64 return ui::SHOW_STATE_NORMAL; | |
| 65 } | |
| 66 | |
| 67 // Retrieves the window's current bounds, including its window. | |
| 68 // This will only differ from GetRestoredBounds() for maximized | |
| 69 // and minimized windows. | |
| 70 gfx::Rect PipWindowViews::GetBounds() const { | |
| 71 return widget_->GetRestoredBounds(); | |
| 72 } | |
| 73 | |
| 74 void PipWindowViews::Show() { | |
| 75 widget_->Show(); | |
| 76 } | |
| 77 | |
| 78 void PipWindowViews::Hide() { | |
| 79 widget_->Hide(); | |
| 80 } | |
| 81 | |
| 82 void PipWindowViews::ShowInactive() { | |
| 83 NOTREACHED(); | |
| 84 } | |
| 85 | |
| 86 void PipWindowViews::Close() { | |
| 87 widget_->Close(); | |
| 88 } | |
| 89 | |
| 90 void PipWindowViews::Activate() { | |
| 91 widget_->Activate(); | |
| 92 } | |
| 93 | |
| 94 void PipWindowViews::Deactivate() { | |
| 95 NOTREACHED(); | |
| 96 } | |
| 97 | |
| 98 void PipWindowViews::Maximize() { | |
| 99 NOTREACHED(); | |
| 100 } | |
| 101 | |
| 102 void PipWindowViews::Minimize() { | |
| 103 NOTREACHED(); | |
| 104 } | |
| 105 | |
| 106 void PipWindowViews::Restore() { | |
| 107 NOTREACHED(); | |
| 108 } | |
| 109 | |
| 110 void PipWindowViews::SetBounds(const gfx::Rect& bounds) { | |
| 111 NOTREACHED(); | |
| 112 } | |
| 113 | |
| 114 void PipWindowViews::FlashFrame(bool flash) { | |
| 115 NOTREACHED(); | |
| 116 } | |
| 117 | |
| 118 bool PipWindowViews::IsAlwaysOnTop() const { | |
| 119 return true; | |
| 120 } | |
| 121 | |
| 122 void PipWindowViews::SetAlwaysOnTop(bool always_on_top) { | |
| 123 NOTREACHED(); | |
| 124 } | |
| OLD | NEW |