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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 settings.SetTransitionDuration( | 174 settings.SetTransitionDuration( |
175 base::TimeDelta::FromMilliseconds(kSwipeDelayMS)); | 175 base::TimeDelta::FromMilliseconds(kSwipeDelayMS)); |
176 settings.SetTweenType(gfx::Tween::EASE_OUT); | 176 settings.SetTweenType(gfx::Tween::EASE_OUT); |
177 new_layer->SetTransform(gfx::Transform()); | 177 new_layer->SetTransform(gfx::Transform()); |
178 } | 178 } |
179 } | 179 } |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
183 void SystemTrayBubble::InitView(views::View* anchor, | 183 void SystemTrayBubble::InitView(views::View* anchor, |
184 user::LoginStatus login_status, | 184 LoginStatus login_status, |
185 TrayBubbleView::InitParams* init_params) { | 185 TrayBubbleView::InitParams* init_params) { |
186 DCHECK(bubble_view_ == NULL); | 186 DCHECK(bubble_view_ == NULL); |
187 | 187 |
188 if (bubble_type_ == BUBBLE_TYPE_DETAILED && | 188 if (bubble_type_ == BUBBLE_TYPE_DETAILED && |
189 init_params->max_height < kDetailedBubbleMaxHeight) { | 189 init_params->max_height < kDetailedBubbleMaxHeight) { |
190 init_params->max_height = kDetailedBubbleMaxHeight; | 190 init_params->max_height = kDetailedBubbleMaxHeight; |
191 } else if (bubble_type_ == BUBBLE_TYPE_NOTIFICATION) { | 191 } else if (bubble_type_ == BUBBLE_TYPE_NOTIFICATION) { |
192 init_params->close_on_deactivate = false; | 192 init_params->close_on_deactivate = false; |
193 } | 193 } |
194 bubble_view_ = TrayBubbleView::Create( | 194 bubble_view_ = TrayBubbleView::Create( |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 bool SystemTrayBubble::ShouldShowShelf() const { | 274 bool SystemTrayBubble::ShouldShowShelf() const { |
275 for (std::vector<ash::SystemTrayItem*>::const_iterator it = items_.begin(); | 275 for (std::vector<ash::SystemTrayItem*>::const_iterator it = items_.begin(); |
276 it != items_.end(); | 276 it != items_.end(); |
277 ++it) { | 277 ++it) { |
278 if ((*it)->ShouldShowShelf()) | 278 if ((*it)->ShouldShowShelf()) |
279 return true; | 279 return true; |
280 } | 280 } |
281 return false; | 281 return false; |
282 } | 282 } |
283 | 283 |
284 void SystemTrayBubble::CreateItemViews(user::LoginStatus login_status) { | 284 void SystemTrayBubble::CreateItemViews(LoginStatus login_status) { |
285 std::vector<views::View*> item_views; | 285 std::vector<views::View*> item_views; |
286 // If a system modal dialog is present, create the same tray as | 286 // If a system modal dialog is present, create the same tray as |
287 // in locked state. | 287 // in locked state. |
288 if (Shell::GetInstance()->IsSystemModalWindowOpen() && | 288 if (Shell::GetInstance()->IsSystemModalWindowOpen() && |
289 login_status != user::LOGGED_IN_NONE) { | 289 login_status != LoginStatus::NOT_LOGGED_IN) { |
290 login_status = user::LOGGED_IN_LOCKED; | 290 login_status = LoginStatus::LOCKED; |
291 } | 291 } |
292 | 292 |
293 views::View* focus_view = NULL; | 293 views::View* focus_view = NULL; |
294 for (size_t i = 0; i < items_.size(); ++i) { | 294 for (size_t i = 0; i < items_.size(); ++i) { |
295 views::View* view = NULL; | 295 views::View* view = NULL; |
296 switch (bubble_type_) { | 296 switch (bubble_type_) { |
297 case BUBBLE_TYPE_DEFAULT: | 297 case BUBBLE_TYPE_DEFAULT: |
298 view = items_[i]->CreateDefaultView(login_status); | 298 view = items_[i]->CreateDefaultView(login_status); |
299 if (items_[i]->restore_focus()) | 299 if (items_[i]->restore_focus()) |
300 focus_view = view; | 300 focus_view = view; |
(...skipping 15 matching lines...) Expand all 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 |