| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/tabs/dragged_tab_controller.h" | 5 #include "chrome/browser/views/tabs/dragged_tab_controller.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "app/animation.h" | |
| 11 #include "app/animation_delegate.h" | |
| 12 #include "app/slide_animation.h" | |
| 13 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| 14 #include "base/callback.h" | 11 #include "base/callback.h" |
| 15 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
| 16 #include "chrome/browser/browser_window.h" | 13 #include "chrome/browser/browser_window.h" |
| 17 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 14 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 18 #include "chrome/browser/tab_contents/tab_contents.h" | 15 #include "chrome/browser/tab_contents/tab_contents.h" |
| 19 #include "chrome/browser/tabs/tab_strip_model.h" | 16 #include "chrome/browser/tabs/tab_strip_model.h" |
| 20 #include "chrome/browser/metrics/user_metrics.h" | 17 #include "chrome/browser/metrics/user_metrics.h" |
| 21 #include "chrome/browser/views/frame/browser_view.h" | 18 #include "chrome/browser/views/frame/browser_view.h" |
| 22 #include "chrome/browser/views/tabs/base_tab.h" | 19 #include "chrome/browser/views/tabs/base_tab.h" |
| 23 #include "chrome/browser/views/tabs/base_tab_strip.h" | 20 #include "chrome/browser/views/tabs/base_tab_strip.h" |
| 24 #include "chrome/browser/views/tabs/browser_tab_strip_controller.h" | 21 #include "chrome/browser/views/tabs/browser_tab_strip_controller.h" |
| 25 #include "chrome/browser/views/tabs/dragged_tab_view.h" | 22 #include "chrome/browser/views/tabs/dragged_tab_view.h" |
| 26 #include "chrome/browser/views/tabs/native_view_photobooth.h" | 23 #include "chrome/browser/views/tabs/native_view_photobooth.h" |
| 27 #include "chrome/browser/views/tabs/side_tab.h" | 24 #include "chrome/browser/views/tabs/side_tab.h" |
| 28 #include "chrome/browser/views/tabs/side_tab_strip.h" | 25 #include "chrome/browser/views/tabs/side_tab_strip.h" |
| 29 #include "chrome/browser/views/tabs/tab.h" | 26 #include "chrome/browser/views/tabs/tab.h" |
| 30 #include "chrome/browser/views/tabs/tab_strip.h" | 27 #include "chrome/browser/views/tabs/tab_strip.h" |
| 31 #include "chrome/common/notification_details.h" | 28 #include "chrome/common/notification_details.h" |
| 32 #include "chrome/common/notification_source.h" | 29 #include "chrome/common/notification_source.h" |
| 33 #include "gfx/canvas_skia.h" | 30 #include "gfx/canvas_skia.h" |
| 34 #include "grit/theme_resources.h" | 31 #include "grit/theme_resources.h" |
| 35 #include "third_party/skia/include/core/SkBitmap.h" | 32 #include "third_party/skia/include/core/SkBitmap.h" |
| 33 #include "ui/base/animation/animation.h" |
| 34 #include "ui/base/animation/animation_delegate.h" |
| 35 #include "ui/base/animation/slide_animation.h" |
| 36 #include "views/event.h" | 36 #include "views/event.h" |
| 37 #include "views/widget/root_view.h" | 37 #include "views/widget/root_view.h" |
| 38 #include "views/widget/widget.h" | 38 #include "views/widget/widget.h" |
| 39 #include "views/window/window.h" | 39 #include "views/window/window.h" |
| 40 | 40 |
| 41 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
| 42 #include "views/widget/widget_win.h" | 42 #include "views/widget/widget_win.h" |
| 43 #endif | 43 #endif |
| 44 | 44 |
| 45 #if defined(OS_LINUX) | 45 #if defined(OS_LINUX) |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 } // namespace | 193 } // namespace |
| 194 | 194 |
| 195 /////////////////////////////////////////////////////////////////////////////// | 195 /////////////////////////////////////////////////////////////////////////////// |
| 196 // DockDisplayer | 196 // DockDisplayer |
| 197 | 197 |
| 198 // DockDisplayer is responsible for giving the user a visual indication of a | 198 // DockDisplayer is responsible for giving the user a visual indication of a |
| 199 // possible dock position (as represented by DockInfo). DockDisplayer shows | 199 // possible dock position (as represented by DockInfo). DockDisplayer shows |
| 200 // a window with a DockView in it. Two animations are used that correspond to | 200 // a window with a DockView in it. Two animations are used that correspond to |
| 201 // the state of DockInfo::in_enable_area. | 201 // the state of DockInfo::in_enable_area. |
| 202 class DraggedTabController::DockDisplayer : public AnimationDelegate { | 202 class DraggedTabController::DockDisplayer : public ui::AnimationDelegate { |
| 203 public: | 203 public: |
| 204 DockDisplayer(DraggedTabController* controller, | 204 DockDisplayer(DraggedTabController* controller, |
| 205 const DockInfo& info) | 205 const DockInfo& info) |
| 206 : controller_(controller), | 206 : controller_(controller), |
| 207 popup_(NULL), | 207 popup_(NULL), |
| 208 popup_view_(NULL), | 208 popup_view_(NULL), |
| 209 ALLOW_THIS_IN_INITIALIZER_LIST(animation_(this)), | 209 ALLOW_THIS_IN_INITIALIZER_LIST(animation_(this)), |
| 210 hidden_(false), | 210 hidden_(false), |
| 211 in_enable_area_(info.in_enable_area()) { | 211 in_enable_area_(info.in_enable_area()) { |
| 212 #if defined(OS_WIN) | 212 #if defined(OS_WIN) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 return; | 258 return; |
| 259 | 259 |
| 260 if (!popup_) { | 260 if (!popup_) { |
| 261 delete this; | 261 delete this; |
| 262 return; | 262 return; |
| 263 } | 263 } |
| 264 hidden_ = true; | 264 hidden_ = true; |
| 265 animation_.Hide(); | 265 animation_.Hide(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 virtual void AnimationProgressed(const Animation* animation) { | 268 virtual void AnimationProgressed(const ui::Animation* animation) { |
| 269 UpdateLayeredAlpha(); | 269 UpdateLayeredAlpha(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 virtual void AnimationEnded(const Animation* animation) { | 272 virtual void AnimationEnded(const ui::Animation* animation) { |
| 273 if (!hidden_) | 273 if (!hidden_) |
| 274 return; | 274 return; |
| 275 #if defined(OS_WIN) | 275 #if defined(OS_WIN) |
| 276 static_cast<views::WidgetWin*>(popup_)->Close(); | 276 static_cast<views::WidgetWin*>(popup_)->Close(); |
| 277 #else | 277 #else |
| 278 NOTIMPLEMENTED(); | 278 NOTIMPLEMENTED(); |
| 279 #endif | 279 #endif |
| 280 delete this; | 280 delete this; |
| 281 } | 281 } |
| 282 | 282 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 296 DraggedTabController* controller_; | 296 DraggedTabController* controller_; |
| 297 | 297 |
| 298 // Window we're showing. | 298 // Window we're showing. |
| 299 views::Widget* popup_; | 299 views::Widget* popup_; |
| 300 | 300 |
| 301 // NativeView of |popup_|. We cache this to avoid the possibility of | 301 // NativeView of |popup_|. We cache this to avoid the possibility of |
| 302 // invoking a method on popup_ after we close it. | 302 // invoking a method on popup_ after we close it. |
| 303 gfx::NativeView popup_view_; | 303 gfx::NativeView popup_view_; |
| 304 | 304 |
| 305 // Animation for when first made visible. | 305 // Animation for when first made visible. |
| 306 SlideAnimation animation_; | 306 ui::SlideAnimation animation_; |
| 307 | 307 |
| 308 // Have we been hidden? | 308 // Have we been hidden? |
| 309 bool hidden_; | 309 bool hidden_; |
| 310 | 310 |
| 311 // Value of DockInfo::in_enable_area. | 311 // Value of DockInfo::in_enable_area. |
| 312 bool in_enable_area_; | 312 bool in_enable_area_; |
| 313 }; | 313 }; |
| 314 | 314 |
| 315 /////////////////////////////////////////////////////////////////////////////// | 315 /////////////////////////////////////////////////////////////////////////////// |
| 316 // DraggedTabController, public: | 316 // DraggedTabController, public: |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 #else | 1336 #else |
| 1337 NOTIMPLEMENTED(); | 1337 NOTIMPLEMENTED(); |
| 1338 #endif | 1338 #endif |
| 1339 } | 1339 } |
| 1340 } | 1340 } |
| 1341 | 1341 |
| 1342 TabStripModel* DraggedTabController::GetModel(BaseTabStrip* tabstrip) const { | 1342 TabStripModel* DraggedTabController::GetModel(BaseTabStrip* tabstrip) const { |
| 1343 return static_cast<BrowserTabStripController*>(tabstrip->controller())-> | 1343 return static_cast<BrowserTabStripController*>(tabstrip->controller())-> |
| 1344 model(); | 1344 model(); |
| 1345 } | 1345 } |
| OLD | NEW |