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

Side by Side Diff: chrome/browser/ui/views/panels/panel_stack_view.h

Issue 2263863002: Remove implementation of Panels on OSes other than ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR feedback Created 4 years, 4 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 (c) 2013 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 #ifndef CHROME_BROWSER_UI_VIEWS_PANELS_PANEL_STACK_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_PANELS_PANEL_STACK_VIEW_H_
7
8 #include <list>
9 #include <map>
10 #include <memory>
11
12 #include "base/macros.h"
13 #include "build/build_config.h"
14 #include "chrome/browser/ui/panels/native_panel_stack_window.h"
15 #include "ui/gfx/animation/animation_delegate.h"
16 #include "ui/views/focus/widget_focus_manager.h"
17 #include "ui/views/widget/widget_delegate.h"
18 #include "ui/views/widget/widget_observer.h"
19
20 #if defined(OS_WIN)
21 #include "chrome/browser/ui/views/panels/taskbar_window_thumbnailer_win.h"
22 #include "ui/base/win/hwnd_subclass.h"
23 #endif
24
25 namespace gfx {
26 class LinearAnimation;
27 }
28 namespace views {
29 class Widget;
30 }
31
32 // A native window that acts as the owner of all panels in the stack, in order
33 // to make all panels appear as a single window on the taskbar or launcher.
34 class PanelStackView : public NativePanelStackWindow,
35 public views::WidgetFocusChangeListener,
36 #if defined(OS_WIN)
37 public ui::HWNDMessageFilter,
38 public TaskbarWindowThumbnailerDelegateWin,
39 #endif
40 public gfx::AnimationDelegate {
41 public:
42 explicit PanelStackView(NativePanelStackWindowDelegate* delegate);
43 ~PanelStackView() override;
44
45 protected:
46 // Overridden from NativePanelStackWindow:
47 void Close() override;
48 void AddPanel(Panel* panel) override;
49 void RemovePanel(Panel* panel) override;
50 void MergeWith(NativePanelStackWindow* another) override;
51 bool IsEmpty() const override;
52 bool HasPanel(Panel* panel) const override;
53 void MovePanelsBy(const gfx::Vector2d& delta) override;
54 void BeginBatchUpdatePanelBounds(bool animate) override;
55 void AddPanelBoundsForBatchUpdate(Panel* panel,
56 const gfx::Rect& new_bounds) override;
57 void EndBatchUpdatePanelBounds() override;
58 bool IsAnimatingPanelBounds() const override;
59 void Minimize() override;
60 bool IsMinimized() const override;
61 void DrawSystemAttention(bool draw_attention) override;
62 void OnPanelActivated(Panel* panel) override;
63
64 private:
65 typedef std::list<Panel*> Panels;
66
67 // The map value is old bounds of the panel.
68 typedef std::map<Panel*, gfx::Rect> BoundsUpdates;
69
70 // Overridden from views::WidgetFocusChangeListener:
71 void OnNativeFocusChanged(gfx::NativeView focused_now) override;
72
73 // Overridden from AnimationDelegate:
74 void AnimationEnded(const gfx::Animation* animation) override;
75 void AnimationProgressed(const gfx::Animation* animation) override;
76 void AnimationCanceled(const gfx::Animation* animation) override;
77
78 // Updates the bounds of panels as specified in batch update data.
79 void UpdatePanelsBounds();
80
81 // Notifies the delegate that the updates of the panel bounds are completed.
82 void NotifyBoundsUpdateCompleted();
83
84 // Computes/updates the minimum bounds that could fit all panels.
85 gfx::Rect GetStackWindowBounds() const;
86 void UpdateStackWindowBounds();
87
88 views::Widget* CreateWindowWithBounds(const gfx::Rect& bounds);
89 void EnsureWindowCreated();
90
91 // Makes the stack window own the panel window such that multiple panels
92 // stacked together could appear as a single window on the taskbar or
93 // launcher.
94 static void MakeStackWindowOwnPanelWindow(Panel* panel,
95 PanelStackView* stack_window);
96
97 #if defined(OS_WIN)
98 // Overridden from ui::HWNDMessageFilter:
99 bool FilterMessage(HWND hwnd,
100 UINT message,
101 WPARAM w_param,
102 LPARAM l_param,
103 LRESULT* l_result) override;
104
105 // Overridden from TaskbarWindowThumbnailerDelegateWin:
106 std::vector<HWND> GetSnapshotWindowHandles() const override;
107
108 // Updates the live preview snapshot when something changes, like
109 // adding/removing/moving/resizing a stacked panel.
110 void RefreshLivePreviewThumbnail();
111
112 // Updates the bounds of the widget window in a deferred way.
113 void DeferUpdateNativeWindowBounds(HDWP defer_window_pos_info,
114 views::Widget* window,
115 const gfx::Rect& bounds);
116 #endif
117
118 NativePanelStackWindowDelegate* delegate_;
119
120 views::Widget* window_; // Weak pointer, own us.
121
122 // Tracks all panels that are enclosed by this window.
123 Panels panels_;
124
125 // Is the taskbar icon of the underlying window being flashed in order to
126 // draw the user's attention?
127 bool is_drawing_attention_;
128
129 #if defined(OS_WIN)
130 // The custom live preview snapshot is always provided for the stack window.
131 // This is because the system might not show the snapshot correctly for
132 // a small window, like collapsed panel.
133 std::unique_ptr<TaskbarWindowThumbnailerWin> thumbnailer_;
134 #endif
135
136 // For batch bounds update.
137 bool animate_bounds_updates_;
138 bool bounds_updates_started_;
139 BoundsUpdates bounds_updates_;
140
141 // Used to animate the bounds changes at a synchronized pace.
142 std::unique_ptr<gfx::LinearAnimation> bounds_animator_;
143
144 DISALLOW_COPY_AND_ASSIGN(PanelStackView);
145 };
146
147 #endif // CHROME_BROWSER_UI_VIEWS_PANELS_PANEL_STACK_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/panels/panel_frame_view.cc ('k') | chrome/browser/ui/views/panels/panel_stack_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698