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.h" | 5 #include "ash/system/tray/system_tray.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell/panel_window.h" | 9 #include "ash/shell/panel_window.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 system_bubble_->bubble()->UpdateView(items, bubble_type); | 395 system_bubble_->bubble()->UpdateView(items, bubble_type); |
396 } else { | 396 } else { |
397 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, | 397 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, |
398 GetAnchorAlignment(), | 398 GetAnchorAlignment(), |
399 kTrayPopupWidth); | 399 kTrayPopupWidth); |
400 init_params.can_activate = can_activate; | 400 init_params.can_activate = can_activate; |
401 if (detailed) { | 401 if (detailed) { |
402 // This is the case where a volume control or brightness control bubble | 402 // This is the case where a volume control or brightness control bubble |
403 // is created. | 403 // is created. |
404 init_params.max_height = default_bubble_height_; | 404 init_params.max_height = default_bubble_height_; |
405 init_params.top_color = kBackgroundColor; | |
406 init_params.arrow_color = kBackgroundColor; | 405 init_params.arrow_color = kBackgroundColor; |
407 } else { | 406 } else { |
408 init_params.top_color = kBackgroundColor; | |
409 init_params.arrow_color = kHeaderBackgroundColorDark; | 407 init_params.arrow_color = kHeaderBackgroundColorDark; |
410 } | 408 } |
411 init_params.arrow_offset = arrow_offset; | 409 init_params.arrow_offset = arrow_offset; |
412 SystemTrayBubble* bubble = new SystemTrayBubble(this, items, bubble_type); | 410 SystemTrayBubble* bubble = new SystemTrayBubble(this, items, bubble_type); |
413 system_bubble_.reset(new internal::SystemBubbleWrapper(bubble)); | 411 system_bubble_.reset(new internal::SystemBubbleWrapper(bubble)); |
414 system_bubble_->InitView(this, tray_container(), &init_params); | 412 system_bubble_->InitView(this, tray_container(), &init_params); |
415 } | 413 } |
416 // Save height of default view for creating detailed views directly. | 414 // Save height of default view for creating detailed views directly. |
417 if (!detailed) | 415 if (!detailed) |
418 default_bubble_height_ = system_bubble_->bubble_view()->height(); | 416 default_bubble_height_ = system_bubble_->bubble_view()->height(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 if (system_bubble_.get()) { | 461 if (system_bubble_.get()) { |
464 anchor = system_bubble_->bubble_view(); | 462 anchor = system_bubble_->bubble_view(); |
465 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE; | 463 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE; |
466 } else { | 464 } else { |
467 anchor = tray_container(); | 465 anchor = tray_container(); |
468 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY; | 466 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY; |
469 } | 467 } |
470 TrayBubbleView::InitParams init_params(anchor_type, | 468 TrayBubbleView::InitParams init_params(anchor_type, |
471 GetAnchorAlignment(), | 469 GetAnchorAlignment(), |
472 kTrayPopupWidth); | 470 kTrayPopupWidth); |
473 init_params.top_color = kBackgroundColor; | |
474 init_params.arrow_color = kBackgroundColor; | 471 init_params.arrow_color = kBackgroundColor; |
475 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]); | 472 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]); |
476 notification_bubble_.reset( | 473 notification_bubble_.reset( |
477 new internal::SystemBubbleWrapper(notification_bubble)); | 474 new internal::SystemBubbleWrapper(notification_bubble)); |
478 notification_bubble_->InitView(this, anchor, &init_params); | 475 notification_bubble_->InitView(this, anchor, &init_params); |
479 | 476 |
480 if (notification_bubble->bubble_view()->child_count() == 0) { | 477 if (notification_bubble->bubble_view()->child_count() == 0) { |
481 // It is possible that none of the items generated actual notifications. | 478 // It is possible that none of the items generated actual notifications. |
482 DestroyNotificationBubble(); | 479 DestroyNotificationBubble(); |
483 return; | 480 return; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 ConvertPointToWidget(this, &point); | 581 ConvertPointToWidget(this, &point); |
585 arrow_offset = point.x(); | 582 arrow_offset = point.x(); |
586 } | 583 } |
587 } | 584 } |
588 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); | 585 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); |
589 } | 586 } |
590 return true; | 587 return true; |
591 } | 588 } |
592 | 589 |
593 } // namespace ash | 590 } // namespace ash |
OLD | NEW |