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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, 10, 3)); |
81 } | 81 } |
82 | 82 |
83 SystemTray::~SystemTray() { | 83 SystemTray::~SystemTray() { |
| 84 if (popup_) |
| 85 popup_->CloseNow(); |
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 |
91 void SystemTray::AddTrayItem(SystemTrayItem* item) { | 93 void SystemTray::AddTrayItem(SystemTrayItem* item) { |
92 items_.push_back(item); | 94 items_.push_back(item); |
93 | 95 |
(...skipping 33 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 |