| 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 #include "ash/shelf/shelf_view.h" | 5 #include "ash/shelf/shelf_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 } | 234 } |
| 235 return view_model_->view_at(index); | 235 return view_model_->view_at(index); |
| 236 } | 236 } |
| 237 | 237 |
| 238 private: | 238 private: |
| 239 views::ViewModel* view_model_; | 239 views::ViewModel* view_model_; |
| 240 | 240 |
| 241 DISALLOW_COPY_AND_ASSIGN(LauncherFocusSearch); | 241 DISALLOW_COPY_AND_ASSIGN(LauncherFocusSearch); |
| 242 }; | 242 }; |
| 243 | 243 |
| 244 class ShelfButtonFocusBorder : public views::FocusBorder { | |
| 245 public: | |
| 246 ShelfButtonFocusBorder() {} | |
| 247 virtual ~ShelfButtonFocusBorder() {} | |
| 248 | |
| 249 private: | |
| 250 // views::FocusBorder overrides: | |
| 251 virtual void Paint(const View& view, gfx::Canvas* canvas) const OVERRIDE { | |
| 252 gfx::Rect rect(view.GetLocalBounds()); | |
| 253 rect.Inset(1, 1); | |
| 254 canvas->DrawRect(rect, kFocusBorderColor); | |
| 255 } | |
| 256 | |
| 257 DISALLOW_COPY_AND_ASSIGN(ShelfButtonFocusBorder); | |
| 258 }; | |
| 259 | |
| 260 // AnimationDelegate used when inserting a new item. This steadily increases the | 244 // AnimationDelegate used when inserting a new item. This steadily increases the |
| 261 // opacity of the layer as the animation progress. | 245 // opacity of the layer as the animation progress. |
| 262 class FadeInAnimationDelegate | 246 class FadeInAnimationDelegate |
| 263 : public views::BoundsAnimator::OwnedAnimationDelegate { | 247 : public views::BoundsAnimator::OwnedAnimationDelegate { |
| 264 public: | 248 public: |
| 265 explicit FadeInAnimationDelegate(views::View* view) : view_(view) {} | 249 explicit FadeInAnimationDelegate(views::View* view) : view_(view) {} |
| 266 virtual ~FadeInAnimationDelegate() {} | 250 virtual ~FadeInAnimationDelegate() {} |
| 267 | 251 |
| 268 // AnimationDelegate overrides: | 252 // AnimationDelegate overrides: |
| 269 virtual void AnimationProgressed(const Animation* animation) OVERRIDE { | 253 virtual void AnimationProgressed(const Animation* animation) OVERRIDE { |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 views::ImageButton::ALIGN_BOTTOM)); | 931 views::ImageButton::ALIGN_BOTTOM)); |
| 948 view = button; | 932 view = button; |
| 949 } | 933 } |
| 950 break; | 934 break; |
| 951 } | 935 } |
| 952 | 936 |
| 953 default: | 937 default: |
| 954 break; | 938 break; |
| 955 } | 939 } |
| 956 view->set_context_menu_controller(this); | 940 view->set_context_menu_controller(this); |
| 957 view->set_focus_border(new ShelfButtonFocusBorder); | 941 view->set_focus_border(views::FocusBorder::CreateSolidFocusBorder( |
| 942 kFocusBorderColor, |
| 943 gfx::Insets(1, 1, 1, 1))); |
| 958 | 944 |
| 959 DCHECK(view); | 945 DCHECK(view); |
| 960 ConfigureChildView(view); | 946 ConfigureChildView(view); |
| 961 return view; | 947 return view; |
| 962 } | 948 } |
| 963 | 949 |
| 964 void ShelfView::FadeIn(views::View* view) { | 950 void ShelfView::FadeIn(views::View* view) { |
| 965 view->SetVisible(true); | 951 view->SetVisible(true); |
| 966 view->layer()->SetOpacity(0); | 952 view->layer()->SetOpacity(0); |
| 967 AnimateToIdealBounds(); | 953 AnimateToIdealBounds(); |
| (...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1967 break; | 1953 break; |
| 1968 case ash::SHELF_ALIGNMENT_TOP: | 1954 case ash::SHELF_ALIGNMENT_TOP: |
| 1969 distance = coordinate.y() - bounds.bottom(); | 1955 distance = coordinate.y() - bounds.bottom(); |
| 1970 break; | 1956 break; |
| 1971 } | 1957 } |
| 1972 return distance > 0 ? distance : 0; | 1958 return distance > 0 ? distance : 0; |
| 1973 } | 1959 } |
| 1974 | 1960 |
| 1975 } // namespace internal | 1961 } // namespace internal |
| 1976 } // namespace ash | 1962 } // namespace ash |
| OLD | NEW |