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

Side by Side 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 unified diff | Download patch
OLDNEW
(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() : widget_(new views::Widget()) {}
13
14 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.
15
16 void OverlayWindowViews::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* OverlayWindowViews::GetLayer() {
32 return widget_->GetLayer();
33 }
34
35 bool OverlayWindowViews::IsActive() const {
36 return widget_->IsActive();
37 }
38
39 // Window is never maximized.
40 bool OverlayWindowViews::IsMaximized() const {
41 return false;
42 }
43
44 // Window is never minimized.
45 bool OverlayWindowViews::IsMinimized() const {
46 return false;
47 }
48
49 // Window is never fullscreened.
50 bool OverlayWindowViews::IsFullscreen() const {
51 return false;
52 }
53
54 gfx::NativeWindow OverlayWindowViews::GetNativeWindow() const {
55 return widget_->GetNativeWindow();
56 }
57
58 gfx::Rect OverlayWindowViews::GetRestoredBounds() const {
59 return GetBounds();
60 }
61
62 // Returns the restore state for the window (platform dependent).
63 ui::WindowShowState OverlayWindowViews::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 OverlayWindowViews::GetBounds() const {
71 return widget_->GetRestoredBounds();
72 }
73
74 void OverlayWindowViews::Show() {
75 widget_->Show();
76 }
77
78 void OverlayWindowViews::Hide() {
79 widget_->Hide();
80 }
81
82 void OverlayWindowViews::ShowInactive() {
83 NOTREACHED();
84 }
85
86 void OverlayWindowViews::Close() {
87 widget_->Close();
88 }
89
90 void OverlayWindowViews::Activate() {
91 widget_->Activate();
92 }
93
94 void OverlayWindowViews::Deactivate() {
95 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
96 }
97
98 void OverlayWindowViews::Maximize() {
99 NOTREACHED();
100 }
101
102 void OverlayWindowViews::Minimize() {
103 NOTREACHED();
104 }
105
106 void OverlayWindowViews::Restore() {
107 NOTREACHED();
108 }
109
110 void OverlayWindowViews::SetBounds(const gfx::Rect& bounds) {
111 NOTREACHED();
112 }
113
114 void OverlayWindowViews::FlashFrame(bool flash) {
115 NOTREACHED();
116 }
117
118 bool OverlayWindowViews::IsAlwaysOnTop() const {
119 return true;
120 }
121
122 void OverlayWindowViews::SetAlwaysOnTop(bool always_on_top) {
123 NOTREACHED();
124 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698