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

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: Remove BaseWindow subclassing per conversation with sky@. Created 3 years, 5 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() {
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.
20 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
21
22 // TODO(apacible): Update preferred sizing and positioning.
23 params.bounds = gfx::Rect(200, 200, 700, 500);
24 params.keep_on_top = true;
25 params.visible_on_all_workspaces = true;
26
27 widget_->Init(params);
28 widget_->Show();
29
30 // TODO(apacible): Set the WidgetDelegate for more control over behavior.
mlamouri (slow - plz ping) 2017/07/07 10:34:38 could you have this TODO and the above point to th
apacible 2017/07/18 01:08:28 Done.
31 }
32
33 bool OverlayWindowViews::IsActive() const {
34 return widget_->IsActive();
35 }
36
37 void OverlayWindowViews::Show() {
38 widget_->Show();
39 }
40
41 void OverlayWindowViews::Hide() {
42 widget_->Hide();
43 }
44
45 void OverlayWindowViews::Close() {
46 widget_->Close();
47 }
48
49 void OverlayWindowViews::Activate() {
50 widget_->Activate();
51 }
52
53 bool OverlayWindowViews::IsAlwaysOnTop() const {
54 return true;
55 }
56
57 ui::Layer* OverlayWindowViews::GetLayer() {
58 return widget_->GetLayer();
59 }
60
61 gfx::NativeWindow OverlayWindowViews::GetNativeWindow() const {
62 return widget_->GetNativeWindow();
63 }
64
65 // Retrieves the window's current bounds, including its window.
mlamouri (slow - plz ping) 2017/07/07 10:34:38 Is this comment needed?
sky 2017/07/11 18:02:25 This comment should be in overlay_window.h
66 gfx::Rect OverlayWindowViews::GetBounds() const {
67 return widget_->GetRestoredBounds();
68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698