| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 notification_bubble_.reset(); | 357 notification_bubble_.reset(); |
| 358 | 358 |
| 359 if (system_bubble_.get() && creation_type == BUBBLE_USE_EXISTING) { | 359 if (system_bubble_.get() && creation_type == BUBBLE_USE_EXISTING) { |
| 360 system_bubble_->bubble()->UpdateView(items, bubble_type); | 360 system_bubble_->bubble()->UpdateView(items, bubble_type); |
| 361 } else { | 361 } else { |
| 362 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, | 362 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, |
| 363 GetAnchorAlignment(), | 363 GetAnchorAlignment(), |
| 364 kTrayPopupMinWidth, | 364 kTrayPopupMinWidth, |
| 365 kTrayPopupMaxWidth); | 365 kTrayPopupMaxWidth); |
| 366 init_params.can_activate = can_activate; | 366 init_params.can_activate = can_activate; |
| 367 init_params.close_on_deactivate = false; | |
| 368 if (detailed) { | 367 if (detailed) { |
| 369 // This is the case where a volume control or brightness control bubble | 368 // This is the case where a volume control or brightness control bubble |
| 370 // is created. | 369 // is created. |
| 371 init_params.max_height = default_bubble_height_; | 370 init_params.max_height = default_bubble_height_; |
| 372 init_params.arrow_color = kBackgroundColor; | 371 init_params.arrow_color = kBackgroundColor; |
| 373 } else { | 372 } else { |
| 374 init_params.arrow_color = kHeaderBackgroundColor; | 373 init_params.arrow_color = kHeaderBackgroundColor; |
| 375 } | 374 } |
| 376 init_params.arrow_offset = arrow_offset; | 375 init_params.arrow_offset = arrow_offset; |
| 377 // For Volume and Brightness we don't want to show an arrow when | 376 // For Volume and Brightness we don't want to show an arrow when |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 } | 469 } |
| 471 | 470 |
| 472 void SystemTray::HideBubbleWithView(const TrayBubbleView* bubble_view) { | 471 void SystemTray::HideBubbleWithView(const TrayBubbleView* bubble_view) { |
| 473 if (system_bubble_.get() && bubble_view == system_bubble_->bubble_view()) { | 472 if (system_bubble_.get() && bubble_view == system_bubble_->bubble_view()) { |
| 474 DestroySystemBubble(); | 473 DestroySystemBubble(); |
| 475 UpdateNotificationBubble(); // State changed, re-create notifications. | 474 UpdateNotificationBubble(); // State changed, re-create notifications. |
| 476 GetShelfLayoutManager()->UpdateAutoHideState(); | 475 GetShelfLayoutManager()->UpdateAutoHideState(); |
| 477 } else if (notification_bubble_.get() && | 476 } else if (notification_bubble_.get() && |
| 478 bubble_view == notification_bubble_->bubble_view()) { | 477 bubble_view == notification_bubble_->bubble_view()) { |
| 479 DestroyNotificationBubble(); | 478 DestroyNotificationBubble(); |
| 479 } else { |
| 480 UpdateNotificationBubble(); |
| 480 } | 481 } |
| 481 } | 482 } |
| 482 | 483 |
| 483 bool SystemTray::ClickedOutsideBubble() { | 484 bool SystemTray::ClickedOutsideBubble() { |
| 484 if (!system_bubble_.get()) | 485 if (!system_bubble_.get()) |
| 485 return false; | 486 return false; |
| 486 HideBubbleWithView(system_bubble_->bubble_view()); | 487 HideBubbleWithView(system_bubble_->bubble_view()); |
| 487 return true; | 488 return true; |
| 488 } | 489 } |
| 489 | 490 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 ConvertPointToWidget(this, &point); | 536 ConvertPointToWidget(this, &point); |
| 536 arrow_offset = point.x(); | 537 arrow_offset = point.x(); |
| 537 } | 538 } |
| 538 } | 539 } |
| 539 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); | 540 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); |
| 540 } | 541 } |
| 541 return true; | 542 return true; |
| 542 } | 543 } |
| 543 | 544 |
| 544 } // namespace ash | 545 } // namespace ash |
| OLD | NEW |