| 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/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell/panel_window.h" | 8 #include "ash/shell/panel_window.h" |
| 9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/system/audio/tray_volume.h" | 10 #include "ash/system/audio/tray_volume.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "ui/views/layout/box_layout.h" | 47 #include "ui/views/layout/box_layout.h" |
| 48 #include "ui/views/layout/fill_layout.h" | 48 #include "ui/views/layout/fill_layout.h" |
| 49 #include "ui/views/view.h" | 49 #include "ui/views/view.h" |
| 50 | 50 |
| 51 namespace { | 51 namespace { |
| 52 | 52 |
| 53 // Adjust the size of SystemTrayContainer with additional padding. | 53 // Adjust the size of SystemTrayContainer with additional padding. |
| 54 const int kTrayContainerVerticalPaddingBottomAlignment = 1; | 54 const int kTrayContainerVerticalPaddingBottomAlignment = 1; |
| 55 const int kTrayContainerHorizontalPaddingBottomAlignment = 1; | 55 const int kTrayContainerHorizontalPaddingBottomAlignment = 1; |
| 56 const int kTrayContainerVerticalPaddingVerticalAlignment = 1; | 56 const int kTrayContainerVerticalPaddingVerticalAlignment = 1; |
| 57 const int kTrayContainerHorizontalPaddingVerticalAlignment = 2; | 57 const int kTrayContainerHorizontalPaddingVerticalAlignment = 1; |
| 58 | 58 |
| 59 } // namespace | 59 } // namespace |
| 60 | 60 |
| 61 namespace ash { | 61 namespace ash { |
| 62 | 62 |
| 63 namespace internal { | 63 namespace internal { |
| 64 | 64 |
| 65 // Container for all the items in the tray. The container auto-resizes the | 65 // Container for all the items in the tray. The container auto-resizes the |
| 66 // widget when necessary. | 66 // widget when necessary. |
| 67 class SystemTrayContainer : public views::View { | 67 class SystemTrayContainer : public views::View { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 AddTrayItem(tray_date); | 233 AddTrayItem(tray_date); |
| 234 SetVisible(ash::Shell::GetInstance()->tray_delegate()-> | 234 SetVisible(ash::Shell::GetInstance()->tray_delegate()-> |
| 235 GetTrayVisibilityOnStartup()); | 235 GetTrayVisibilityOnStartup()); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void SystemTray::AddTrayItem(SystemTrayItem* item) { | 238 void SystemTray::AddTrayItem(SystemTrayItem* item) { |
| 239 items_.push_back(item); | 239 items_.push_back(item); |
| 240 | 240 |
| 241 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); | 241 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); |
| 242 views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus()); | 242 views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus()); |
| 243 item->UpdateAfterShelfAlignmentChange( |
| 244 ash::Shell::GetInstance()->system_tray()->shelf_alignment()); |
| 245 |
| 243 if (tray_item) { | 246 if (tray_item) { |
| 244 tray_container_->AddChildViewAt(tray_item, 0); | 247 tray_container_->AddChildViewAt(tray_item, 0); |
| 245 PreferredSizeChanged(); | 248 PreferredSizeChanged(); |
| 246 tray_item_map_[item] = tray_item; | 249 tray_item_map_[item] = tray_item; |
| 247 } | 250 } |
| 248 } | 251 } |
| 249 | 252 |
| 250 void SystemTray::RemoveTrayItem(SystemTrayItem* item) { | 253 void SystemTray::RemoveTrayItem(SystemTrayItem* item) { |
| 251 NOTIMPLEMENTED(); | 254 NOTIMPLEMENTED(); |
| 252 } | 255 } |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 | 581 |
| 579 void SystemTray::OnPaintFocusBorder(gfx::Canvas* canvas) { | 582 void SystemTray::OnPaintFocusBorder(gfx::Canvas* canvas) { |
| 580 // The tray itself expands to the right and bottom edge of the screen to make | 583 // The tray itself expands to the right and bottom edge of the screen to make |
| 581 // sure clicking on the edges brings up the popup. However, the focus border | 584 // sure clicking on the edges brings up the popup. However, the focus border |
| 582 // should be only around the container. | 585 // should be only around the container. |
| 583 if (GetWidget() && GetWidget()->IsActive()) | 586 if (GetWidget() && GetWidget()->IsActive()) |
| 584 canvas->DrawFocusRect(tray_container_->bounds()); | 587 canvas->DrawFocusRect(tray_container_->bounds()); |
| 585 } | 588 } |
| 586 | 589 |
| 587 } // namespace ash | 590 } // namespace ash |
| OLD | NEW |