Chromium Code Reviews| 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" |
| 11 #include "chrome/browser/ui/panels/native_panel.h" | 11 #include "chrome/browser/ui/panels/native_panel.h" |
| 12 #include "chrome/browser/ui/views/frame/browser_view.h" | 12 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 13 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 14 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 15 #include "ui/base/animation/animation_delegate.h" | 15 #include "ui/base/animation/animation_delegate.h" |
| 16 | 16 |
| 17 class Browser; | 17 class Browser; |
| 18 class NativePanelTestingWin; | 18 class NativePanelTestingWin; |
| 19 class Panel; | 19 class Panel; |
| 20 class PanelBoundsAnimation; | 20 class PanelBoundsAnimation; |
| 21 class PanelBrowserFrameView; | 21 class PanelBrowserFrameView; |
| 22 class TaskbarWindowThumbnailerWin; | |
| 23 namespace ui { | |
| 24 class HWNDSubclass; | |
| 25 } | |
| 22 | 26 |
| 23 // A browser view that implements Panel specific behavior. | 27 // A browser view that implements Panel specific behavior. |
| 24 class PanelBrowserView : public BrowserView, | 28 class PanelBrowserView : public BrowserView, |
| 25 public content::NotificationObserver, | 29 public content::NotificationObserver, |
| 26 public NativePanel, | 30 public NativePanel, |
| 27 public ui::AnimationDelegate { | 31 public ui::AnimationDelegate { |
| 28 public: | 32 public: |
| 29 PanelBrowserView(Browser* browser, Panel* panel, const gfx::Rect& bounds); | 33 PanelBrowserView(Browser* browser, Panel* panel, const gfx::Rect& bounds); |
| 30 virtual ~PanelBrowserView(); | 34 virtual ~PanelBrowserView(); |
| 31 | 35 |
| 32 Panel* panel() const { return panel_.get(); } | 36 Panel* panel() const { return panel_.get(); } |
| 33 bool closed() const { return closed_; } | 37 bool closed() const { return closed_; } |
| 34 bool focused() const { return focused_; } | 38 bool focused() const { return focused_; } |
| 39 bool force_to_paint_as_inactive() const { | |
| 40 return force_to_paint_as_inactive_; | |
| 41 } | |
| 35 | 42 |
| 36 PanelBrowserFrameView* GetFrameView() const; | 43 PanelBrowserFrameView* GetFrameView() const; |
| 37 | 44 |
| 38 // Called from frame view when titlebar receives a mouse event. | 45 // Called from frame view when titlebar receives a mouse event. |
| 39 // Return true if the event is handled. | 46 // Return true if the event is handled. |
| 40 // |mouse_location| is in screen coordinates. | 47 // |mouse_location| is in screen coordinates. |
| 41 bool OnTitlebarMousePressed(const gfx::Point& mouse_location); | 48 bool OnTitlebarMousePressed(const gfx::Point& mouse_location); |
| 42 bool OnTitlebarMouseDragged(const gfx::Point& mouse_location); | 49 bool OnTitlebarMouseDragged(const gfx::Point& mouse_location); |
| 43 bool OnTitlebarMouseReleased(panel::ClickModifier modifier); | 50 bool OnTitlebarMouseReleased(panel::ClickModifier modifier); |
| 44 bool OnTitlebarMouseCaptureLost(); | 51 bool OnTitlebarMouseCaptureLost(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 const gfx::Size& content_size) const OVERRIDE; | 125 const gfx::Size& content_size) const OVERRIDE; |
| 119 virtual gfx::Size ContentSizeFromWindowSize( | 126 virtual gfx::Size ContentSizeFromWindowSize( |
| 120 const gfx::Size& window_size) const OVERRIDE; | 127 const gfx::Size& window_size) const OVERRIDE; |
| 121 virtual int TitleOnlyHeight() const OVERRIDE; | 128 virtual int TitleOnlyHeight() const OVERRIDE; |
| 122 virtual Browser* GetPanelBrowser() const OVERRIDE; | 129 virtual Browser* GetPanelBrowser() const OVERRIDE; |
| 123 virtual void DestroyPanelBrowser() OVERRIDE; | 130 virtual void DestroyPanelBrowser() OVERRIDE; |
| 124 virtual void EnsurePanelFullyVisible() OVERRIDE; | 131 virtual void EnsurePanelFullyVisible() OVERRIDE; |
| 125 virtual void SetPanelAlwaysOnTop(bool on_top) OVERRIDE; | 132 virtual void SetPanelAlwaysOnTop(bool on_top) OVERRIDE; |
| 126 virtual void EnableResizeByMouse(bool enable) OVERRIDE; | 133 virtual void EnableResizeByMouse(bool enable) OVERRIDE; |
| 127 virtual void UpdatePanelMinimizeRestoreButtonVisibility() OVERRIDE; | 134 virtual void UpdatePanelMinimizeRestoreButtonVisibility() OVERRIDE; |
| 135 virtual void PanelExpansionStateChanging( | |
| 136 Panel::ExpansionState old_state, | |
| 137 Panel::ExpansionState new_state) OVERRIDE; | |
| 128 | 138 |
| 129 // Overridden from AnimationDelegate: | 139 // Overridden from AnimationDelegate: |
| 130 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 140 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 131 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 141 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 132 | 142 |
| 133 bool EndDragging(bool cancelled); | 143 bool EndDragging(bool cancelled); |
| 134 | 144 |
| 135 void SetBoundsInternal(const gfx::Rect& bounds, bool animate); | 145 void SetBoundsInternal(const gfx::Rect& bounds, bool animate); |
| 136 | 146 |
| 137 void ShowOrHidePanelAppIcon(bool show); | 147 void ShowOrHidePanelAppIcon(bool show); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 168 // moved more than kDragThreshold away from its starting position? | 178 // moved more than kDragThreshold away from its starting position? |
| 169 MouseDraggingState mouse_dragging_state_; | 179 MouseDraggingState mouse_dragging_state_; |
| 170 | 180 |
| 171 // Used to animate the bounds change. | 181 // Used to animate the bounds change. |
| 172 scoped_ptr<PanelBoundsAnimation> bounds_animator_; | 182 scoped_ptr<PanelBoundsAnimation> bounds_animator_; |
| 173 gfx::Rect animation_start_bounds_; | 183 gfx::Rect animation_start_bounds_; |
| 174 | 184 |
| 175 // Is the panel in highlighted state to draw people's attention? | 185 // Is the panel in highlighted state to draw people's attention? |
| 176 bool is_drawing_attention_; | 186 bool is_drawing_attention_; |
| 177 | 187 |
| 188 // Should we force to paint the panel as inactive? This is needed when we need | |
| 189 // to capture the screenshot before an active panel goes minimized. | |
| 190 bool force_to_paint_as_inactive_; | |
| 191 | |
| 178 // The last view that had focus in the panel. This is saved so that focus can | 192 // The last view that had focus in the panel. This is saved so that focus can |
| 179 // be restored properly when a drag ends. | 193 // be restored properly when a drag ends. |
| 180 views::View* old_focused_view_; | 194 views::View* old_focused_view_; |
| 181 | 195 |
| 182 content::NotificationRegistrar registrar_; | 196 content::NotificationRegistrar registrar_; |
| 183 | 197 |
| 198 #if defined(OS_WIN) && !defined(USE_AURA) | |
|
Ben Goodger (Google)
2012/05/22 23:05:48
USE_ASH, methinks.
jianli
2012/05/22 23:34:04
Done.
| |
| 199 // Used to provide custom taskbar thumbnail for Windows 7 and later. | |
| 200 scoped_ptr<ui::HWNDSubclass> thumbnail_subclass_; | |
| 201 #endif | |
| 202 | |
| 184 DISALLOW_COPY_AND_ASSIGN(PanelBrowserView); | 203 DISALLOW_COPY_AND_ASSIGN(PanelBrowserView); |
| 185 }; | 204 }; |
| 186 | 205 |
| 187 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_ | 206 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_ |
| OLD | NEW |