| 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 <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/session/session_controller.h" |
| 10 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 11 #include "ash/shell_port.h" | 12 #include "ash/shell_port.h" |
| 12 #include "ash/system/tray/system_tray.h" | 13 #include "ash/system/tray/system_tray.h" |
| 13 #include "ash/system/tray/system_tray_delegate.h" | 14 #include "ash/system/tray/system_tray_delegate.h" |
| 14 #include "ash/system/tray/system_tray_item.h" | 15 #include "ash/system/tray/system_tray_item.h" |
| 15 #include "ash/system/tray/tray_bubble_wrapper.h" | 16 #include "ash/system/tray/tray_bubble_wrapper.h" |
| 16 #include "ash/system/tray/tray_constants.h" | 17 #include "ash/system/tray/tray_constants.h" |
| 17 #include "base/metrics/histogram_macros.h" | 18 #include "base/metrics/histogram_macros.h" |
| 18 #include "base/threading/thread_task_runner_handle.h" | 19 #include "base/threading/thread_task_runner_handle.h" |
| 19 #include "ui/compositor/layer.h" | 20 #include "ui/compositor/layer.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 shadow->SetOpacity(0.15f); | 136 shadow->SetOpacity(0.15f); |
| 136 } | 137 } |
| 137 } | 138 } |
| 138 } | 139 } |
| 139 | 140 |
| 140 DestroyItemViews(); | 141 DestroyItemViews(); |
| 141 bubble_view_->RemoveAllChildViews(true); | 142 bubble_view_->RemoveAllChildViews(true); |
| 142 | 143 |
| 143 items_ = items; | 144 items_ = items; |
| 144 bubble_type_ = bubble_type; | 145 bubble_type_ = bubble_type; |
| 145 CreateItemViews(Shell::Get()->system_tray_delegate()->GetUserLoginStatus()); | 146 CreateItemViews(Shell::Get()->session_controller()->login_status()); |
| 146 | 147 |
| 147 // Close bubble view if we failed to create the item view. | 148 // Close bubble view if we failed to create the item view. |
| 148 if (!bubble_view_->has_children()) { | 149 if (!bubble_view_->has_children()) { |
| 149 Close(); | 150 Close(); |
| 150 return; | 151 return; |
| 151 } | 152 } |
| 152 | 153 |
| 153 UpdateBottomPadding(); | 154 UpdateBottomPadding(); |
| 154 bubble_view_->GetWidget()->GetContentsView()->Layout(); | 155 bubble_view_->GetWidget()->GetContentsView()->Layout(); |
| 155 // Make sure that the bubble is large enough for the default view. | 156 // Make sure that the bubble is large enough for the default view. |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 } | 330 } |
| 330 } | 331 } |
| 331 | 332 |
| 332 if (focus_view) { | 333 if (focus_view) { |
| 333 tray_->ActivateBubble(); | 334 tray_->ActivateBubble(); |
| 334 focus_view->RequestFocus(); | 335 focus_view->RequestFocus(); |
| 335 } | 336 } |
| 336 } | 337 } |
| 337 | 338 |
| 338 } // namespace ash | 339 } // namespace ash |
| OLD | NEW |