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 #include "chrome/browser/ui/views/panels/panel_stack_view.h" | 5 #include "chrome/browser/ui/views/panels/panel_stack_view.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/panels/panel.h" | 10 #include "chrome/browser/ui/panels/panel.h" |
11 #include "chrome/browser/ui/panels/panel_manager.h" | 11 #include "chrome/browser/ui/panels/panel_manager.h" |
12 #include "chrome/browser/ui/panels/stacked_panel_collection.h" | 12 #include "chrome/browser/ui/panels/stacked_panel_collection.h" |
13 #include "chrome/browser/ui/views/panels/panel_view.h" | 13 #include "chrome/browser/ui/views/panels/panel_view.h" |
14 #include "ui/base/animation/linear_animation.h" | 14 #include "ui/gfx/animation/linear_animation.h" |
15 #include "ui/gfx/image/image_skia.h" | 15 #include "ui/gfx/image/image_skia.h" |
16 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
17 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
18 | 18 |
19 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
20 #include "base/win/windows_version.h" | 20 #include "base/win/windows_version.h" |
21 #include "chrome/browser/shell_integration.h" | 21 #include "chrome/browser/shell_integration.h" |
22 #include "ui/base/win/shell.h" | 22 #include "ui/base/win/shell.h" |
23 #include "ui/views/win/hwnd_util.h" | 23 #include "ui/views/win/hwnd_util.h" |
24 #endif | 24 #endif |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 if (!bounds_updates_.empty()) { | 151 if (!bounds_updates_.empty()) { |
152 UpdatePanelsBounds(); | 152 UpdatePanelsBounds(); |
153 bounds_updates_.clear(); | 153 bounds_updates_.clear(); |
154 } | 154 } |
155 | 155 |
156 bounds_updates_started_ = false; | 156 bounds_updates_started_ = false; |
157 NotifyBoundsUpdateCompleted(); | 157 NotifyBoundsUpdateCompleted(); |
158 return; | 158 return; |
159 } | 159 } |
160 | 160 |
161 bounds_animator_.reset(new ui::LinearAnimation( | 161 bounds_animator_.reset(new gfx::LinearAnimation( |
162 PanelManager::AdjustTimeInterval(kSetBoundsAnimationMs), | 162 PanelManager::AdjustTimeInterval(kSetBoundsAnimationMs), |
163 kDefaultFramerateHz, | 163 kDefaultFramerateHz, |
164 this)); | 164 this)); |
165 bounds_animator_->Start(); | 165 bounds_animator_->Start(); |
166 } | 166 } |
167 | 167 |
168 void PanelStackView::NotifyBoundsUpdateCompleted() { | 168 void PanelStackView::NotifyBoundsUpdateCompleted() { |
169 delegate_->PanelBoundsBatchUpdateCompleted(); | 169 delegate_->PanelBoundsBatchUpdateCompleted(); |
170 | 170 |
171 #if defined(OS_WIN) | 171 #if defined(OS_WIN) |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 #if defined(OS_WIN) | 306 #if defined(OS_WIN) |
307 if (!panels_.empty() && window_ && focused_now == window_->GetNativeView()) { | 307 if (!panels_.empty() && window_ && focused_now == window_->GetNativeView()) { |
308 Panel* panel_to_focus = | 308 Panel* panel_to_focus = |
309 panels_.front()->stack()->most_recently_active_panel(); | 309 panels_.front()->stack()->most_recently_active_panel(); |
310 if (panel_to_focus) | 310 if (panel_to_focus) |
311 panel_to_focus->Activate(); | 311 panel_to_focus->Activate(); |
312 } | 312 } |
313 #endif | 313 #endif |
314 } | 314 } |
315 | 315 |
316 void PanelStackView::AnimationEnded(const ui::Animation* animation) { | 316 void PanelStackView::AnimationEnded(const gfx::Animation* animation) { |
317 bounds_updates_started_ = false; | 317 bounds_updates_started_ = false; |
318 | 318 |
319 PanelManager* panel_manager = PanelManager::GetInstance(); | 319 PanelManager* panel_manager = PanelManager::GetInstance(); |
320 for (BoundsUpdates::const_iterator iter = bounds_updates_.begin(); | 320 for (BoundsUpdates::const_iterator iter = bounds_updates_.begin(); |
321 iter != bounds_updates_.end(); ++iter) { | 321 iter != bounds_updates_.end(); ++iter) { |
322 panel_manager->OnPanelAnimationEnded(iter->first); | 322 panel_manager->OnPanelAnimationEnded(iter->first); |
323 } | 323 } |
324 bounds_updates_.clear(); | 324 bounds_updates_.clear(); |
325 | 325 |
326 NotifyBoundsUpdateCompleted(); | 326 NotifyBoundsUpdateCompleted(); |
327 } | 327 } |
328 | 328 |
329 void PanelStackView::AnimationProgressed(const ui::Animation* animation) { | 329 void PanelStackView::AnimationProgressed(const gfx::Animation* animation) { |
330 UpdatePanelsBounds(); | 330 UpdatePanelsBounds(); |
331 } | 331 } |
332 | 332 |
333 void PanelStackView::UpdatePanelsBounds() { | 333 void PanelStackView::UpdatePanelsBounds() { |
334 #if defined(OS_WIN) | 334 #if defined(OS_WIN) |
335 // Add an extra count for the background stack window. | 335 // Add an extra count for the background stack window. |
336 HDWP defer_update = ::BeginDeferWindowPos(bounds_updates_.size() + 1); | 336 HDWP defer_update = ::BeginDeferWindowPos(bounds_updates_.size() + 1); |
337 #endif | 337 #endif |
338 | 338 |
339 // Update the bounds for each panel in the update list. | 339 // Update the bounds for each panel in the update list. |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 ::DeferWindowPos(defer_window_pos_info, | 537 ::DeferWindowPos(defer_window_pos_info, |
538 views::HWNDForWidget(window), | 538 views::HWNDForWidget(window), |
539 NULL, | 539 NULL, |
540 bounds.x(), | 540 bounds.x(), |
541 bounds.y(), | 541 bounds.y(), |
542 bounds.width(), | 542 bounds.width(), |
543 bounds.height(), | 543 bounds.height(), |
544 SWP_NOACTIVATE | SWP_NOZORDER); | 544 SWP_NOACTIVATE | SWP_NOZORDER); |
545 } | 545 } |
546 #endif | 546 #endif |
OLD | NEW |