| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PANELS_PANEL_BROWSER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 public content::NotificationObserver, | 25 public content::NotificationObserver, |
| 26 public NativePanel, | 26 public NativePanel, |
| 27 public ui::AnimationDelegate { | 27 public ui::AnimationDelegate { |
| 28 public: | 28 public: |
| 29 PanelBrowserView(Browser* browser, Panel* panel, const gfx::Rect& bounds); | 29 PanelBrowserView(Browser* browser, Panel* panel, const gfx::Rect& bounds); |
| 30 virtual ~PanelBrowserView(); | 30 virtual ~PanelBrowserView(); |
| 31 | 31 |
| 32 Panel* panel() const { return panel_.get(); } | 32 Panel* panel() const { return panel_.get(); } |
| 33 bool closed() const { return closed_; } | 33 bool closed() const { return closed_; } |
| 34 bool focused() const { return focused_; } | 34 bool focused() const { return focused_; } |
| 35 bool force_to_paint_as_inactive() const { |
| 36 return force_to_paint_as_inactive_; |
| 37 } |
| 35 | 38 |
| 36 PanelBrowserFrameView* GetFrameView() const; | 39 PanelBrowserFrameView* GetFrameView() const; |
| 37 | 40 |
| 38 // Called from frame view when titlebar receives a mouse event. | 41 // Called from frame view when titlebar receives a mouse event. |
| 39 // Return true if the event is handled. | 42 // Return true if the event is handled. |
| 40 // |mouse_location| is in screen coordinates. | 43 // |mouse_location| is in screen coordinates. |
| 41 bool OnTitlebarMousePressed(const gfx::Point& mouse_location); | 44 bool OnTitlebarMousePressed(const gfx::Point& mouse_location); |
| 42 bool OnTitlebarMouseDragged(const gfx::Point& mouse_location); | 45 bool OnTitlebarMouseDragged(const gfx::Point& mouse_location); |
| 43 bool OnTitlebarMouseReleased(panel::ClickModifier modifier); | 46 bool OnTitlebarMouseReleased(panel::ClickModifier modifier); |
| 44 bool OnTitlebarMouseCaptureLost(); | 47 bool OnTitlebarMouseCaptureLost(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 73 virtual void Observe(int type, | 76 virtual void Observe(int type, |
| 74 const content::NotificationSource& source, | 77 const content::NotificationSource& source, |
| 75 const content::NotificationDetails& details) OVERRIDE; | 78 const content::NotificationDetails& details) OVERRIDE; |
| 76 | 79 |
| 77 // Overridden from views::WidgetDelegate: | 80 // Overridden from views::WidgetDelegate: |
| 78 virtual void OnDisplayChanged() OVERRIDE; | 81 virtual void OnDisplayChanged() OVERRIDE; |
| 79 virtual void OnWorkAreaChanged() OVERRIDE; | 82 virtual void OnWorkAreaChanged() OVERRIDE; |
| 80 virtual bool WillProcessWorkAreaChange() const OVERRIDE; | 83 virtual bool WillProcessWorkAreaChange() const OVERRIDE; |
| 81 virtual void OnWindowBeginUserBoundsChange() OVERRIDE; | 84 virtual void OnWindowBeginUserBoundsChange() OVERRIDE; |
| 82 virtual void OnWindowEndUserBoundsChange() OVERRIDE; | 85 virtual void OnWindowEndUserBoundsChange() OVERRIDE; |
| 86 virtual SkBitmap GetPreviewImage(const gfx::Size& size, bool live) OVERRIDE; |
| 83 | 87 |
| 84 // Overridden from views::Widget::Observer | 88 // Overridden from views::Widget::Observer |
| 85 virtual void OnWidgetActivationChanged(views::Widget* widget, | 89 virtual void OnWidgetActivationChanged(views::Widget* widget, |
| 86 bool active) OVERRIDE; | 90 bool active) OVERRIDE; |
| 87 | 91 |
| 88 // Overridden from NativePanel: | 92 // Overridden from NativePanel: |
| 89 virtual void ShowPanel() OVERRIDE; | 93 virtual void ShowPanel() OVERRIDE; |
| 90 virtual void ShowPanelInactive() OVERRIDE; | 94 virtual void ShowPanelInactive() OVERRIDE; |
| 91 virtual gfx::Rect GetPanelBounds() const OVERRIDE; | 95 virtual gfx::Rect GetPanelBounds() const OVERRIDE; |
| 92 virtual void SetPanelBounds(const gfx::Rect& bounds) OVERRIDE; | 96 virtual void SetPanelBounds(const gfx::Rect& bounds) OVERRIDE; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 118 const gfx::Size& content_size) const OVERRIDE; | 122 const gfx::Size& content_size) const OVERRIDE; |
| 119 virtual gfx::Size ContentSizeFromWindowSize( | 123 virtual gfx::Size ContentSizeFromWindowSize( |
| 120 const gfx::Size& window_size) const OVERRIDE; | 124 const gfx::Size& window_size) const OVERRIDE; |
| 121 virtual int TitleOnlyHeight() const OVERRIDE; | 125 virtual int TitleOnlyHeight() const OVERRIDE; |
| 122 virtual Browser* GetPanelBrowser() const OVERRIDE; | 126 virtual Browser* GetPanelBrowser() const OVERRIDE; |
| 123 virtual void DestroyPanelBrowser() OVERRIDE; | 127 virtual void DestroyPanelBrowser() OVERRIDE; |
| 124 virtual void EnsurePanelFullyVisible() OVERRIDE; | 128 virtual void EnsurePanelFullyVisible() OVERRIDE; |
| 125 virtual void SetPanelAlwaysOnTop(bool on_top) OVERRIDE; | 129 virtual void SetPanelAlwaysOnTop(bool on_top) OVERRIDE; |
| 126 virtual void EnableResizeByMouse(bool enable) OVERRIDE; | 130 virtual void EnableResizeByMouse(bool enable) OVERRIDE; |
| 127 virtual void UpdatePanelMinimizeRestoreButtonVisibility() OVERRIDE; | 131 virtual void UpdatePanelMinimizeRestoreButtonVisibility() OVERRIDE; |
| 132 virtual void PanelExpansionStateChanging( |
| 133 Panel::ExpansionState old_state, |
| 134 Panel::ExpansionState new_state) OVERRIDE; |
| 128 | 135 |
| 129 // Overridden from AnimationDelegate: | 136 // Overridden from AnimationDelegate: |
| 130 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 137 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 131 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 138 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 132 | 139 |
| 133 bool EndDragging(bool cancelled); | 140 bool EndDragging(bool cancelled); |
| 134 | 141 |
| 135 void SetBoundsInternal(const gfx::Rect& bounds, bool animate); | 142 void SetBoundsInternal(const gfx::Rect& bounds, bool animate); |
| 136 | 143 |
| 137 void ShowOrHidePanelAppIcon(bool show); | 144 void ShowOrHidePanelAppIcon(bool show); |
| 138 | 145 |
| 139 bool IsAnimatingBounds() const; | 146 bool IsAnimatingBounds() const; |
| 140 | 147 |
| 141 #if defined(OS_WIN) && !defined(USE_AURA) | 148 #if defined(OS_WIN) && !defined(USE_AURA) |
| 142 // Sets or clears the bitwise |attribute_value| for the attibute denoted by | 149 // Sets or clears the bitwise |attribute_value| for the attibute denoted by |
| 143 // |attribute_index|. This is used to update the style or extended style | 150 // |attribute_index|. This is used to update the style or extended style |
| 144 // for the native window. | 151 // for the native window. |
| 145 void UpdateWindowAttribute(int attribute_index, | 152 void UpdateWindowAttribute(int attribute_index, |
| 146 int attribute_value, | 153 int attribute_value, |
| 147 bool to_set); | 154 bool to_set); |
| 155 |
| 156 // Captures and returns the screenshot of the panel window. The caller is |
| 157 // responsible to release the returned SkBitmap instance. |
| 158 SkBitmap CaptureWindowImage(); |
| 148 #endif | 159 #endif |
| 149 | 160 |
| 150 scoped_ptr<Panel> panel_; | 161 scoped_ptr<Panel> panel_; |
| 151 gfx::Rect bounds_; | 162 gfx::Rect bounds_; |
| 152 | 163 |
| 153 // Is the panel being closed? Do not use it when it is closed. | 164 // Is the panel being closed? Do not use it when it is closed. |
| 154 bool closed_; | 165 bool closed_; |
| 155 | 166 |
| 156 // Is the panel receiving the focus? | 167 // Is the panel receiving the focus? |
| 157 bool focused_; | 168 bool focused_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 168 // moved more than kDragThreshold away from its starting position? | 179 // moved more than kDragThreshold away from its starting position? |
| 169 MouseDraggingState mouse_dragging_state_; | 180 MouseDraggingState mouse_dragging_state_; |
| 170 | 181 |
| 171 // Used to animate the bounds change. | 182 // Used to animate the bounds change. |
| 172 scoped_ptr<PanelBoundsAnimation> bounds_animator_; | 183 scoped_ptr<PanelBoundsAnimation> bounds_animator_; |
| 173 gfx::Rect animation_start_bounds_; | 184 gfx::Rect animation_start_bounds_; |
| 174 | 185 |
| 175 // Is the panel in highlighted state to draw people's attention? | 186 // Is the panel in highlighted state to draw people's attention? |
| 176 bool is_drawing_attention_; | 187 bool is_drawing_attention_; |
| 177 | 188 |
| 189 // Should we force to paint the panel as inactive? This is needed when we need |
| 190 // to capture the screenshot before an active panel goes minimized. |
| 191 bool force_to_paint_as_inactive_; |
| 192 |
| 178 // The last view that had focus in the panel. This is saved so that focus can | 193 // The last view that had focus in the panel. This is saved so that focus can |
| 179 // be restored properly when a drag ends. | 194 // be restored properly when a drag ends. |
| 180 views::View* old_focused_view_; | 195 views::View* old_focused_view_; |
| 181 | 196 |
| 182 content::NotificationRegistrar registrar_; | 197 content::NotificationRegistrar registrar_; |
| 183 | 198 |
| 199 #if defined(OS_WIN) && !defined(USE_AURA) |
| 200 // The bitmap of panel screenshot before it is minimized. This is used to |
| 201 // replace the live preview thumbnail when the panel is minimized. |
| 202 scoped_ptr<SkBitmap> capture_bitmap_; |
| 203 #endif |
| 204 |
| 184 DISALLOW_COPY_AND_ASSIGN(PanelBrowserView); | 205 DISALLOW_COPY_AND_ASSIGN(PanelBrowserView); |
| 185 }; | 206 }; |
| 186 | 207 |
| 187 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_ | 208 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_ |
| OLD | NEW |