| 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/panel_window.h" | 7 #include "ash/shell/panel_window.h" |
| 8 #include "ash/system/tray/system_tray_item.h" | 8 #include "ash/system/tray/system_tray_item.h" |
| 9 #include "ash/wm/shadow_types.h" | 9 #include "ash/wm/shadow_types.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 class SystemTrayBubble : public views::BubbleDelegateView { | 24 class SystemTrayBubble : public views::BubbleDelegateView { |
| 25 public: | 25 public: |
| 26 SystemTrayBubble(ash::SystemTray* tray, | 26 SystemTrayBubble(ash::SystemTray* tray, |
| 27 std::vector<ash::SystemTrayItem*>& items, | 27 std::vector<ash::SystemTrayItem*>& items, |
| 28 bool detailed) | 28 bool detailed) |
| 29 : views::BubbleDelegateView(tray, views::BubbleBorder::BOTTOM_RIGHT), | 29 : views::BubbleDelegateView(tray, views::BubbleBorder::BOTTOM_RIGHT), |
| 30 tray_(tray), | 30 tray_(tray), |
| 31 items_(items), | 31 items_(items), |
| 32 detailed_(detailed) { | 32 detailed_(detailed) { |
| 33 set_margin(1); | 33 set_margin(0); |
| 34 } | 34 } |
| 35 | 35 |
| 36 virtual ~SystemTrayBubble() { | 36 virtual ~SystemTrayBubble() { |
| 37 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin(); | 37 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin(); |
| 38 it != items_.end(); | 38 it != items_.end(); |
| 39 ++it) { | 39 ++it) { |
| 40 if (detailed_) | 40 if (detailed_) |
| 41 (*it)->DestroyDetailedView(); | 41 (*it)->DestroyDetailedView(); |
| 42 else | 42 else |
| 43 (*it)->DestroyDefaultView(); | 43 (*it)->DestroyDefaultView(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace | 72 } // namespace |
| 73 | 73 |
| 74 namespace ash { | 74 namespace ash { |
| 75 | 75 |
| 76 SystemTray::SystemTray() | 76 SystemTray::SystemTray() |
| 77 : items_(), | 77 : items_(), |
| 78 popup_(NULL) { | 78 popup_(NULL) { |
| 79 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, | 79 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, |
| 80 5, 10, 3)); | 80 5, 0, 3)); |
| 81 set_background(views::Background::CreateSolidBackground( |
| 82 SkColorSetARGB(127, 0, 0, 0))); |
| 81 } | 83 } |
| 82 | 84 |
| 83 SystemTray::~SystemTray() { | 85 SystemTray::~SystemTray() { |
| 84 for (std::vector<SystemTrayItem*>::iterator it = items_.begin(); | 86 for (std::vector<SystemTrayItem*>::iterator it = items_.begin(); |
| 85 it != items_.end(); | 87 it != items_.end(); |
| 86 ++it) { | 88 ++it) { |
| 87 (*it)->DestroyTrayView(); | 89 (*it)->DestroyTrayView(); |
| 88 } | 90 } |
| 89 } | 91 } |
| 90 | 92 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 ShowItems(items_, false); | 129 ShowItems(items_, false); |
| 128 return true; | 130 return true; |
| 129 } | 131 } |
| 130 | 132 |
| 131 void SystemTray::OnWidgetClosing(views::Widget* widget) { | 133 void SystemTray::OnWidgetClosing(views::Widget* widget) { |
| 132 CHECK_EQ(popup_, widget); | 134 CHECK_EQ(popup_, widget); |
| 133 popup_ = NULL; | 135 popup_ = NULL; |
| 134 } | 136 } |
| 135 | 137 |
| 136 } // namespace ash | 138 } // namespace ash |
| OLD | NEW |