Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_PANELS_PANEL_STACK_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PANELS_PANEL_STACK_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PANELS_PANEL_STACK_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PANELS_PANEL_STACK_VIEW_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "chrome/browser/ui/panels/native_panel_stack_window.h" | 12 #include "chrome/browser/ui/panels/native_panel_stack_window.h" |
| 13 #include "ui/base/animation/animation_delegate.h" | 13 #include "ui/base/animation/animation_delegate.h" |
| 14 #include "ui/views/focus/widget_focus_manager.h" | 14 #include "ui/views/focus/widget_focus_manager.h" |
| 15 #include "ui/views/widget/widget_delegate.h" | 15 #include "ui/views/widget/widget_delegate.h" |
| 16 #include "ui/views/widget/widget_observer.h" | 16 #include "ui/views/widget/widget_observer.h" |
| 17 | 17 |
| 18 class TaskbarWindowThumbnailerWin; | 18 #if defined(OS_WIN) |
| 19 #include "chrome/browser/ui/views/panels/taskbar_window_thumbnailer_win.h" | |
| 20 #endif | |
| 21 | |
| 19 namespace ui { | 22 namespace ui { |
| 20 class LinearAnimation; | 23 class LinearAnimation; |
| 21 } | 24 } |
| 22 namespace views { | 25 namespace views { |
| 23 class Widget; | 26 class Widget; |
| 24 } | 27 } |
| 25 | 28 |
| 26 // A native window that acts as the owner of all panels in the stack, in order | 29 // A native window that acts as the owner of all panels in the stack, in order |
| 27 // to make all panels appear as a single window on the taskbar or launcher. | 30 // to make all panels appear as a single window on the taskbar or launcher. |
| 28 class PanelStackView : public NativePanelStackWindow, | 31 class PanelStackView : public NativePanelStackWindow, |
| 29 public views::WidgetObserver, | 32 public views::WidgetObserver, |
| 30 public views::WidgetDelegateView, | 33 public views::WidgetDelegateView, |
| 31 public views::WidgetFocusChangeListener, | 34 public views::WidgetFocusChangeListener, |
| 35 #if defined(OS_WIN) | |
| 36 public TaskbarWindowThumbnailerDelegateWin, | |
| 37 #endif | |
| 32 public ui::AnimationDelegate { | 38 public ui::AnimationDelegate { |
| 33 public: | 39 public: |
| 34 explicit PanelStackView(NativePanelStackWindowDelegate* delegate); | 40 explicit PanelStackView(NativePanelStackWindowDelegate* delegate); |
| 35 virtual ~PanelStackView(); | 41 virtual ~PanelStackView(); |
| 36 | 42 |
| 37 protected: | 43 protected: |
| 38 // Overridden from NativePanelStackWindow: | 44 // Overridden from NativePanelStackWindow: |
| 39 virtual void Close() OVERRIDE; | 45 virtual void Close() OVERRIDE; |
| 40 virtual void AddPanel(Panel* panel) OVERRIDE; | 46 virtual void AddPanel(Panel* panel) OVERRIDE; |
| 41 virtual void RemovePanel(Panel* panel) OVERRIDE; | 47 virtual void RemovePanel(Panel* panel) OVERRIDE; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 69 | 75 |
| 70 // Overridden from views::WidgetObserver: | 76 // Overridden from views::WidgetObserver: |
| 71 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; | 77 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; |
| 72 virtual void OnWidgetActivationChanged(views::Widget* widget, | 78 virtual void OnWidgetActivationChanged(views::Widget* widget, |
| 73 bool active) OVERRIDE; | 79 bool active) OVERRIDE; |
| 74 | 80 |
| 75 // Overridden from views::WidgetFocusChangeListener: | 81 // Overridden from views::WidgetFocusChangeListener: |
| 76 virtual void OnNativeFocusChange(gfx::NativeView focused_before, | 82 virtual void OnNativeFocusChange(gfx::NativeView focused_before, |
| 77 gfx::NativeView focused_now) OVERRIDE; | 83 gfx::NativeView focused_now) OVERRIDE; |
| 78 | 84 |
| 85 #if defined(OS_WIN) | |
|
Dmitry Titov
2013/05/29 01:14:48
Could you please group all OS_WIN things under a s
jianli
2013/05/29 18:31:52
Done.
| |
| 86 virtual std::vector<HWND> GetSnapshotWindowHandles() const OVERRIDE; | |
| 87 #endif | |
| 88 | |
| 79 // Overridden from AnimationDelegate: | 89 // Overridden from AnimationDelegate: |
| 80 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 90 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 81 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 91 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 82 | 92 |
| 83 // Updates the bounds of panels as specified in batch update data. | 93 // Updates the bounds of panels as specified in batch update data. |
| 84 void UpdatePanelsBounds(); | 94 void UpdatePanelsBounds(); |
| 85 | 95 |
| 86 // Computes/updates the minimum bounds that could fit all panels. | 96 // Computes/updates the minimum bounds that could fit all panels. |
| 87 gfx::Rect GetStackWindowBounds() const; | 97 gfx::Rect GetStackWindowBounds() const; |
| 88 void UpdateStackWindowBounds(); | 98 void UpdateStackWindowBounds(); |
| 89 | 99 |
| 90 views::Widget* CreateWindowWithBounds(const gfx::Rect& bounds); | 100 views::Widget* CreateWindowWithBounds(const gfx::Rect& bounds); |
| 91 void EnsureWindowCreated(); | 101 void EnsureWindowCreated(); |
| 92 | 102 |
| 93 // Makes the stack window own the panel window such that multiple panels | 103 // Makes the stack window own the panel window such that multiple panels |
| 94 // stacked together could appear as a single window on the taskbar or | 104 // stacked together could appear as a single window on the taskbar or |
| 95 // launcher. | 105 // launcher. |
| 96 static void MakeStackWindowOwnPanelWindow(Panel* panel, | 106 static void MakeStackWindowOwnPanelWindow(Panel* panel, |
| 97 PanelStackView* stack_window); | 107 PanelStackView* stack_window); |
| 98 | 108 |
| 99 #if defined(OS_WIN) | 109 #if defined(OS_WIN) |
| 110 // If there is a minimized panel in the stack, we want to provide our custom | |
| 111 // thumbnail to live preview. This is because the system preview of the | |
| 112 // minimized panel is showned up narrower than the regular panel. | |
| 113 void StartOrStopCustomThumbnailForMinimizePanel(); | |
| 114 | |
| 100 // Capture the thumbnail of the whole stack and provide it to live preview | 115 // Capture the thumbnail of the whole stack and provide it to live preview |
| 101 // (available since Windows 7). | 116 // (available since Windows 7). |
| 102 void CaptureThumbnailForLivePreview(); | 117 void CaptureThumbnailForLivePreview(bool should_capture_now); |
|
Dmitry Titov
2013/05/29 01:14:48
This should be named like "StartThumbnailer", beca
| |
| 103 | 118 |
| 104 // Updates the bounds of the widget window in a deferred way. | 119 // Updates the bounds of the widget window in a deferred way. |
| 105 void DeferUpdateNativeWindowBounds(HDWP defer_window_pos_info, | 120 void DeferUpdateNativeWindowBounds(HDWP defer_window_pos_info, |
| 106 views::Widget* window, | 121 views::Widget* window, |
| 107 const gfx::Rect& bounds); | 122 const gfx::Rect& bounds); |
| 108 #endif | 123 #endif |
| 109 | 124 |
| 110 NativePanelStackWindowDelegate* delegate_; | 125 NativePanelStackWindowDelegate* delegate_; |
| 111 | 126 |
| 112 views::Widget* window_; // Weak pointer, own us. | 127 views::Widget* window_; // Weak pointer, own us. |
| 113 | 128 |
| 114 bool is_closing_; | 129 bool is_closing_; |
| 115 | 130 |
| 116 // Tracks all panels that are enclosed by this window. | 131 // Tracks all panels that are enclosed by this window. |
| 117 Panels panels_; | 132 Panels panels_; |
| 118 | 133 |
| 119 // Is the taskbar icon of the underlying window being flashed in order to | 134 // Is the taskbar icon of the underlying window being flashed in order to |
| 120 // draw the user's attention? | 135 // draw the user's attention? |
| 121 bool is_drawing_attention_; | 136 bool is_drawing_attention_; |
| 122 | 137 |
| 138 // True if the system minimize is being performed. On Windows, the system | |
| 139 // will activate the window before it is minimized. Sets this flag such that | |
| 140 // we will not stop the thumbnailer when the stack windows is activated due | |
| 141 // to this. | |
| 142 bool is_minimizing_; | |
| 143 | |
| 123 #if defined(OS_WIN) | 144 #if defined(OS_WIN) |
| 124 // Used to provide custom taskbar thumbnail for Windows 7 and later. | 145 // Used to provide custom taskbar thumbnail for Windows 7 and later. |
| 125 scoped_ptr<TaskbarWindowThumbnailerWin> thumbnailer_; | 146 scoped_ptr<TaskbarWindowThumbnailerWin> thumbnailer_; |
| 126 #endif | 147 #endif |
| 127 | 148 |
| 128 // For batch bounds update. | 149 // For batch bounds update. |
| 129 bool animate_bounds_updates_; | 150 bool animate_bounds_updates_; |
| 130 bool bounds_updates_started_; | 151 bool bounds_updates_started_; |
| 131 BoundsUpdates bounds_updates_; | 152 BoundsUpdates bounds_updates_; |
| 132 | 153 |
| 133 // Used to animate the bounds changes at a synchronized pace. | 154 // Used to animate the bounds changes at a synchronized pace. |
| 134 scoped_ptr<ui::LinearAnimation> bounds_animator_; | 155 scoped_ptr<ui::LinearAnimation> bounds_animator_; |
| 135 | 156 |
| 136 DISALLOW_COPY_AND_ASSIGN(PanelStackView); | 157 DISALLOW_COPY_AND_ASSIGN(PanelStackView); |
| 137 }; | 158 }; |
| 138 | 159 |
| 139 #endif // CHROME_BROWSER_UI_VIEWS_PANELS_PANEL_STACK_VIEW_H_ | 160 #endif // CHROME_BROWSER_UI_VIEWS_PANELS_PANEL_STACK_VIEW_H_ |
| OLD | NEW |