OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/time.h" | 11 #include "base/time.h" |
12 #include "chrome/browser/ui/panels/native_panel.h" | 12 #include "chrome/browser/ui/panels/native_panel.h" |
13 #include "chrome/browser/ui/views/frame/browser_view.h" | 13 #include "chrome/browser/ui/views/frame/browser_view.h" |
14 #include "ui/base/animation/animation_delegate.h" | 14 #include "ui/base/animation/animation_delegate.h" |
| 15 #include "ui/base/animation/slide_animation.h" |
15 | 16 |
16 class Browser; | 17 class Browser; |
17 class Panel; | 18 class Panel; |
18 class NativePanelTestingWin; | 19 class NativePanelTestingWin; |
19 class PanelBrowserFrameView; | 20 class PanelBrowserFrameView; |
20 namespace ui { | 21 |
21 class SlideAnimation; | 22 class PanelSlideAnimation : public ui::SlideAnimation { |
22 } | 23 public: |
| 24 PanelSlideAnimation(ui::AnimationDelegate* target, |
| 25 bool for_minimize, |
| 26 double animation_stop_to_show_titlebar) |
| 27 : ui::SlideAnimation(target), |
| 28 for_minimize_(for_minimize), |
| 29 animation_stop_to_show_titlebar_(animation_stop_to_show_titlebar) { } |
| 30 virtual ~PanelSlideAnimation() { } |
| 31 virtual double GetCurrentValue() const OVERRIDE; |
| 32 |
| 33 private: |
| 34 bool for_minimize_; |
| 35 double animation_stop_to_show_titlebar_; |
| 36 }; |
23 | 37 |
24 // A browser view that implements Panel specific behavior. | 38 // A browser view that implements Panel specific behavior. |
25 class PanelBrowserView : public BrowserView, | 39 class PanelBrowserView : public BrowserView, |
26 public NativePanel, | 40 public NativePanel, |
27 public ui::AnimationDelegate { | 41 public ui::AnimationDelegate { |
28 public: | 42 public: |
29 PanelBrowserView(Browser* browser, Panel* panel, const gfx::Rect& bounds); | 43 PanelBrowserView(Browser* browser, Panel* panel, const gfx::Rect& bounds); |
30 virtual ~PanelBrowserView(); | 44 virtual ~PanelBrowserView(); |
31 | 45 |
32 Panel* panel() const { return panel_.get(); } | 46 Panel* panel() const { return panel_.get(); } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 gfx::Point mouse_location_; | 155 gfx::Point mouse_location_; |
142 | 156 |
143 // Timestamp when the mouse was pressed. Used to detect long click. | 157 // Timestamp when the mouse was pressed. Used to detect long click. |
144 base::TimeTicks mouse_pressed_time_; | 158 base::TimeTicks mouse_pressed_time_; |
145 | 159 |
146 // Is the titlebar currently being dragged? That is, has the cursor | 160 // Is the titlebar currently being dragged? That is, has the cursor |
147 // moved more than kDragThreshold away from its starting position? | 161 // moved more than kDragThreshold away from its starting position? |
148 MouseDraggingState mouse_dragging_state_; | 162 MouseDraggingState mouse_dragging_state_; |
149 | 163 |
150 // Used to animate the bounds change. | 164 // Used to animate the bounds change. |
151 scoped_ptr<ui::SlideAnimation> bounds_animator_; | 165 scoped_ptr<PanelSlideAnimation> bounds_animator_; |
152 gfx::Rect animation_start_bounds_; | 166 gfx::Rect animation_start_bounds_; |
153 | 167 |
154 // Is the panel in highlighted state to draw people's attention? | 168 // Is the panel in highlighted state to draw people's attention? |
155 bool is_drawing_attention_; | 169 bool is_drawing_attention_; |
156 | 170 |
157 // Timestamp to prevent minimizing the panel when the user clicks the titlebar | 171 // Timestamp to prevent minimizing the panel when the user clicks the titlebar |
158 // to clear the attension state. | 172 // to clear the attension state. |
159 base::TimeTicks attention_cleared_time_; | 173 base::TimeTicks attention_cleared_time_; |
160 | 174 |
161 // The last view that had focus in the panel. This is saved so that focus can | 175 // The last view that had focus in the panel. This is saved so that focus can |
162 // be restored properly when a drag ends. | 176 // be restored properly when a drag ends. |
163 views::View* old_focused_view_; | 177 views::View* old_focused_view_; |
164 | 178 |
165 DISALLOW_COPY_AND_ASSIGN(PanelBrowserView); | 179 DISALLOW_COPY_AND_ASSIGN(PanelBrowserView); |
166 }; | 180 }; |
167 | 181 |
168 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_ | 182 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_ |
OLD | NEW |