| 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 #include "chrome/browser/ui/panels/panel_browser_view.h" | 5 #include "chrome/browser/ui/panels/panel_browser_view.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/ui/panels/panel.h" | 9 #include "chrome/browser/ui/panels/panel.h" |
| 10 #include "chrome/browser/ui/panels/panel_browser_frame_view.h" | 10 #include "chrome/browser/ui/panels/panel_browser_frame_view.h" |
| 11 #include "chrome/browser/ui/panels/panel_manager.h" | 11 #include "chrome/browser/ui/panels/panel_manager.h" |
| 12 #include "chrome/browser/ui/views/frame/browser_frame.h" | 12 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| 13 #include "chrome/browser/ui/webui/task_manager_dialog.h" | 13 #include "chrome/browser/ui/webui/task_manager_dialog.h" |
| 14 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
| 15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 16 #include "content/common/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
| 17 #include "grit/chromium_strings.h" | 17 #include "grit/chromium_strings.h" |
| 18 #include "ui/base/animation/slide_animation.h" | 18 #include "ui/base/animation/slide_animation.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "views/controls/label.h" | 20 #include "views/controls/label.h" |
| 21 #include "views/widget/widget.h" | 21 #include "views/widget/widget.h" |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 // This value is experimental and subjective. | 24 // This value is experimental and subjective. |
| 25 const int kSetBoundsAnimationMs = 180; | 25 const int kSetBoundsAnimationMs = 180; |
| 26 | 26 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 if (focused_) { | 169 if (focused_) { |
| 170 // Expand the panel if needed. | 170 // Expand the panel if needed. |
| 171 if (panel_->expansion_state() == Panel::MINIMIZED) | 171 if (panel_->expansion_state() == Panel::MINIMIZED) |
| 172 panel_->SetExpansionState(Panel::EXPANDED); | 172 panel_->SetExpansionState(Panel::EXPANDED); |
| 173 | 173 |
| 174 // Clear the attention state if needed. | 174 // Clear the attention state if needed. |
| 175 if (is_drawing_attention_) | 175 if (is_drawing_attention_) |
| 176 StopDrawingAttention(); | 176 StopDrawingAttention(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 NotificationService::current()->Notify( | 179 content::NotificationService::current()->Notify( |
| 180 chrome::NOTIFICATION_PANEL_CHANGED_ACTIVE_STATUS, | 180 chrome::NOTIFICATION_PANEL_CHANGED_ACTIVE_STATUS, |
| 181 content::Source<Panel>(panel()), | 181 content::Source<Panel>(panel()), |
| 182 NotificationService::NoDetails()); | 182 content::NotificationService::NoDetails()); |
| 183 } | 183 } |
| 184 | 184 |
| 185 bool PanelBrowserView::AcceleratorPressed( | 185 bool PanelBrowserView::AcceleratorPressed( |
| 186 const views::Accelerator& accelerator) { | 186 const views::Accelerator& accelerator) { |
| 187 if (mouse_pressed_ && accelerator.key_code() == ui::VKEY_ESCAPE) { | 187 if (mouse_pressed_ && accelerator.key_code() == ui::VKEY_ESCAPE) { |
| 188 OnTitlebarMouseCaptureLost(); | 188 OnTitlebarMouseCaptureLost(); |
| 189 return true; | 189 return true; |
| 190 } | 190 } |
| 191 | 191 |
| 192 // No other accelerator is allowed when the drag begins. | 192 // No other accelerator is allowed when the drag begins. |
| 193 if (mouse_dragging_state_ == DRAGGING_STARTED) | 193 if (mouse_dragging_state_ == DRAGGING_STARTED) |
| 194 return true; | 194 return true; |
| 195 | 195 |
| 196 return BrowserView::AcceleratorPressed(accelerator); | 196 return BrowserView::AcceleratorPressed(accelerator); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void PanelBrowserView::AnimationEnded(const ui::Animation* animation) { | 199 void PanelBrowserView::AnimationEnded(const ui::Animation* animation) { |
| 200 NotificationService::current()->Notify( | 200 content::NotificationService::current()->Notify( |
| 201 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, | 201 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, |
| 202 content::Source<Panel>(panel()), | 202 content::Source<Panel>(panel()), |
| 203 NotificationService::NoDetails()); | 203 content::NotificationService::NoDetails()); |
| 204 } | 204 } |
| 205 | 205 |
| 206 void PanelBrowserView::AnimationProgressed(const ui::Animation* animation) { | 206 void PanelBrowserView::AnimationProgressed(const ui::Animation* animation) { |
| 207 gfx::Rect new_bounds = bounds_animator_->CurrentValueBetween( | 207 gfx::Rect new_bounds = bounds_animator_->CurrentValueBetween( |
| 208 animation_start_bounds_, bounds_); | 208 animation_start_bounds_, bounds_); |
| 209 ::BrowserView::SetBounds(new_bounds); | 209 ::BrowserView::SetBounds(new_bounds); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void PanelBrowserView::OnDisplayChanged() { | 212 void PanelBrowserView::OnDisplayChanged() { |
| 213 BrowserView::OnDisplayChanged(); | 213 BrowserView::OnDisplayChanged(); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 } | 546 } |
| 547 | 547 |
| 548 bool NativePanelTestingWin::IsWindowSizeKnown() const { | 548 bool NativePanelTestingWin::IsWindowSizeKnown() const { |
| 549 return true; | 549 return true; |
| 550 } | 550 } |
| 551 | 551 |
| 552 bool NativePanelTestingWin::IsAnimatingBounds() const { | 552 bool NativePanelTestingWin::IsAnimatingBounds() const { |
| 553 return panel_browser_view_->bounds_animator_.get() && | 553 return panel_browser_view_->bounds_animator_.get() && |
| 554 panel_browser_view_->bounds_animator_->is_animating(); | 554 panel_browser_view_->bounds_animator_->is_animating(); |
| 555 } | 555 } |
| OLD | NEW |