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/system/tray/system_tray_bubble.h" | 5 #include "ash/system/tray/system_tray_bubble.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
9 #include "ash/system/tray/system_tray_delegate.h" | 9 #include "ash/system/tray/system_tray_delegate.h" |
10 #include "ash/system/tray/system_tray_item.h" | 10 #include "ash/system/tray/system_tray_item.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 : layer_(layer) { | 46 : layer_(layer) { |
47 } | 47 } |
48 | 48 |
49 ~AnimationObserverDeleteLayer() override {} | 49 ~AnimationObserverDeleteLayer() override {} |
50 | 50 |
51 void OnImplicitAnimationsCompleted() override { | 51 void OnImplicitAnimationsCompleted() override { |
52 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); | 52 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); |
53 } | 53 } |
54 | 54 |
55 private: | 55 private: |
56 scoped_ptr<ui::Layer> layer_; | 56 std::unique_ptr<ui::Layer> layer_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(AnimationObserverDeleteLayer); | 58 DISALLOW_COPY_AND_ASSIGN(AnimationObserverDeleteLayer); |
59 }; | 59 }; |
60 | 60 |
61 } // namespace | 61 } // namespace |
62 | 62 |
63 // SystemTrayBubble | 63 // SystemTrayBubble |
64 | 64 |
65 SystemTrayBubble::SystemTrayBubble( | 65 SystemTrayBubble::SystemTrayBubble( |
66 ash::SystemTray* tray, | 66 ash::SystemTray* tray, |
(...skipping 11 matching lines...) Expand all Loading... |
78 // Reset the host pointer in bubble_view_ in case its destruction is deferred. | 78 // Reset the host pointer in bubble_view_ in case its destruction is deferred. |
79 if (bubble_view_) | 79 if (bubble_view_) |
80 bubble_view_->reset_delegate(); | 80 bubble_view_->reset_delegate(); |
81 } | 81 } |
82 | 82 |
83 void SystemTrayBubble::UpdateView( | 83 void SystemTrayBubble::UpdateView( |
84 const std::vector<ash::SystemTrayItem*>& items, | 84 const std::vector<ash::SystemTrayItem*>& items, |
85 BubbleType bubble_type) { | 85 BubbleType bubble_type) { |
86 DCHECK(bubble_type != BUBBLE_TYPE_NOTIFICATION); | 86 DCHECK(bubble_type != BUBBLE_TYPE_NOTIFICATION); |
87 | 87 |
88 scoped_ptr<ui::Layer> scoped_layer; | 88 std::unique_ptr<ui::Layer> scoped_layer; |
89 if (bubble_type != bubble_type_) { | 89 if (bubble_type != bubble_type_) { |
90 base::TimeDelta swipe_duration = | 90 base::TimeDelta swipe_duration = |
91 base::TimeDelta::FromMilliseconds(kSwipeDelayMS); | 91 base::TimeDelta::FromMilliseconds(kSwipeDelayMS); |
92 scoped_layer = bubble_view_->RecreateLayer(); | 92 scoped_layer = bubble_view_->RecreateLayer(); |
93 // Keep the reference to layer as we need it after releasing it. | 93 // Keep the reference to layer as we need it after releasing it. |
94 ui::Layer* layer = scoped_layer.get(); | 94 ui::Layer* layer = scoped_layer.get(); |
95 DCHECK(layer); | 95 DCHECK(layer); |
96 layer->SuppressPaint(); | 96 layer->SuppressPaint(); |
97 | 97 |
98 // When transitioning from detailed view to default view, animate the | 98 // When transitioning from detailed view to default view, animate the |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 // 2 items, which are the bottom header row and the one just above it. | 316 // 2 items, which are the bottom header row and the one just above it. |
317 bubble_view_->AddChildView(new TrayPopupItemContainer( | 317 bubble_view_->AddChildView(new TrayPopupItemContainer( |
318 item_views[i], is_default_bubble, | 318 item_views[i], is_default_bubble, |
319 is_default_bubble && (i < item_views.size() - 2))); | 319 is_default_bubble && (i < item_views.size() - 2))); |
320 } | 320 } |
321 if (focus_view) | 321 if (focus_view) |
322 focus_view->RequestFocus(); | 322 focus_view->RequestFocus(); |
323 } | 323 } |
324 | 324 |
325 } // namespace ash | 325 } // namespace ash |
OLD | NEW |