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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 | 390 |
391 // Destroy the notification bubble here so that it doesn't get rebuilt | 391 // Destroy the notification bubble here so that it doesn't get rebuilt |
392 // while we add items to the main bubble_ (e.g. in HideNotificationView). | 392 // while we add items to the main bubble_ (e.g. in HideNotificationView). |
393 notification_bubble_.reset(); | 393 notification_bubble_.reset(); |
394 | 394 |
395 if (system_bubble_.get() && creation_type == BUBBLE_USE_EXISTING) { | 395 if (system_bubble_.get() && creation_type == BUBBLE_USE_EXISTING) { |
396 system_bubble_->bubble()->UpdateView(items, bubble_type); | 396 system_bubble_->bubble()->UpdateView(items, bubble_type); |
397 } else { | 397 } else { |
398 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, | 398 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, |
399 GetAnchorAlignment(), | 399 GetAnchorAlignment(), |
400 kTrayPopupWidth); | 400 kTrayPopupMinWidth, |
| 401 kTrayPopupMaxWidth); |
401 init_params.can_activate = can_activate; | 402 init_params.can_activate = can_activate; |
402 if (detailed) { | 403 if (detailed) { |
403 // This is the case where a volume control or brightness control bubble | 404 // This is the case where a volume control or brightness control bubble |
404 // is created. | 405 // is created. |
405 init_params.max_height = default_bubble_height_; | 406 init_params.max_height = default_bubble_height_; |
406 init_params.arrow_color = kBackgroundColor; | 407 init_params.arrow_color = kBackgroundColor; |
407 } else { | 408 } else { |
408 init_params.arrow_color = kHeaderBackgroundColorDark; | 409 init_params.arrow_color = kHeaderBackgroundColorDark; |
409 } | 410 } |
410 init_params.arrow_offset = arrow_offset; | 411 init_params.arrow_offset = arrow_offset; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 TrayBubbleView::AnchorType anchor_type; | 462 TrayBubbleView::AnchorType anchor_type; |
462 if (system_bubble_.get()) { | 463 if (system_bubble_.get()) { |
463 anchor = system_bubble_->bubble_view(); | 464 anchor = system_bubble_->bubble_view(); |
464 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE; | 465 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE; |
465 } else { | 466 } else { |
466 anchor = tray_container(); | 467 anchor = tray_container(); |
467 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY; | 468 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY; |
468 } | 469 } |
469 TrayBubbleView::InitParams init_params(anchor_type, | 470 TrayBubbleView::InitParams init_params(anchor_type, |
470 GetAnchorAlignment(), | 471 GetAnchorAlignment(), |
471 kTrayPopupWidth); | 472 kTrayPopupMinWidth, |
| 473 kTrayPopupMaxWidth); |
472 init_params.arrow_color = kBackgroundColor; | 474 init_params.arrow_color = kBackgroundColor; |
473 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]); | 475 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]); |
474 notification_bubble_.reset( | 476 notification_bubble_.reset( |
475 new internal::SystemBubbleWrapper(notification_bubble)); | 477 new internal::SystemBubbleWrapper(notification_bubble)); |
476 notification_bubble_->InitView(this, anchor, &init_params); | 478 notification_bubble_->InitView(this, anchor, &init_params); |
477 | 479 |
478 if (notification_bubble->bubble_view()->child_count() == 0) { | 480 if (notification_bubble->bubble_view()->child_count() == 0) { |
479 // It is possible that none of the items generated actual notifications. | 481 // It is possible that none of the items generated actual notifications. |
480 DestroyNotificationBubble(); | 482 DestroyNotificationBubble(); |
481 return; | 483 return; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 ConvertPointToWidget(this, &point); | 584 ConvertPointToWidget(this, &point); |
583 arrow_offset = point.x(); | 585 arrow_offset = point.x(); |
584 } | 586 } |
585 } | 587 } |
586 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); | 588 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); |
587 } | 589 } |
588 return true; | 590 return true; |
589 } | 591 } |
590 | 592 |
591 } // namespace ash | 593 } // namespace ash |
OLD | NEW |