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/tray_bubble_view.h" | 5 #include "ash/system/tray/tray_bubble_view.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/system/tray/tray_constants.h" | 9 #include "ash/system/tray/tray_constants.h" |
10 #include "ash/wm/shelf_layout_manager.h" | 10 #include "ash/wm/shelf_layout_manager.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 // static | 240 // static |
241 const int TrayBubbleView::InitParams::kArrowDefaultOffset = -1; | 241 const int TrayBubbleView::InitParams::kArrowDefaultOffset = -1; |
242 | 242 |
243 TrayBubbleView::InitParams::InitParams(AnchorType anchor_type, | 243 TrayBubbleView::InitParams::InitParams(AnchorType anchor_type, |
244 ShelfAlignment shelf_alignment) | 244 ShelfAlignment shelf_alignment) |
245 : anchor_type(anchor_type), | 245 : anchor_type(anchor_type), |
246 shelf_alignment(shelf_alignment), | 246 shelf_alignment(shelf_alignment), |
247 bubble_width(kTrayPopupWidth), | 247 bubble_width(kTrayPopupWidth), |
248 max_height(0), | 248 max_height(0), |
249 can_activate(false), | 249 can_activate(false), |
| 250 close_on_deactivate(true), |
250 arrow_offset(kArrowDefaultOffset), | 251 arrow_offset(kArrowDefaultOffset), |
251 arrow_color(kHeaderBackgroundColorDark) { | 252 arrow_color(kHeaderBackgroundColorDark) { |
252 } | 253 } |
253 | 254 |
254 TrayBubbleView* TrayBubbleView::Create(views::View* anchor, | 255 TrayBubbleView* TrayBubbleView::Create(views::View* anchor, |
255 Host* host, | 256 Host* host, |
256 const InitParams& init_params) { | 257 const InitParams& init_params) { |
257 // Set arrow_location here so that it can be passed correctly to the | 258 // Set arrow_location here so that it can be passed correctly to the |
258 // BubbleView constructor. | 259 // BubbleView constructor. |
259 views::BubbleBorder::ArrowLocation arrow_location; | 260 views::BubbleBorder::ArrowLocation arrow_location; |
(...skipping 19 matching lines...) Expand all Loading... |
279 views::View* anchor, | 280 views::View* anchor, |
280 Host* host) | 281 Host* host) |
281 : views::BubbleDelegateView(anchor, arrow_location), | 282 : views::BubbleDelegateView(anchor, arrow_location), |
282 params_(init_params), | 283 params_(init_params), |
283 host_(host) { | 284 host_(host) { |
284 set_margins(gfx::Insets()); | 285 set_margins(gfx::Insets()); |
285 set_parent_window(Shell::GetContainer( | 286 set_parent_window(Shell::GetContainer( |
286 anchor->GetWidget()->GetNativeWindow()->GetRootWindow(), | 287 anchor->GetWidget()->GetNativeWindow()->GetRootWindow(), |
287 internal::kShellWindowId_SettingBubbleContainer)); | 288 internal::kShellWindowId_SettingBubbleContainer)); |
288 set_notify_enter_exit_on_child(true); | 289 set_notify_enter_exit_on_child(true); |
| 290 set_close_on_deactivate(init_params.close_on_deactivate); |
289 SetPaintToLayer(true); | 291 SetPaintToLayer(true); |
290 SetFillsBoundsOpaquely(true); | 292 SetFillsBoundsOpaquely(true); |
291 } | 293 } |
292 | 294 |
293 TrayBubbleView::~TrayBubbleView() { | 295 TrayBubbleView::~TrayBubbleView() { |
294 // Inform host items (models) that their views are being destroyed. | 296 // Inform host items (models) that their views are being destroyed. |
295 if (host_) | 297 if (host_) |
296 host_->BubbleViewDestroyed(); | 298 host_->BubbleViewDestroyed(); |
297 } | 299 } |
298 | 300 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 return; | 496 return; |
495 } | 497 } |
496 // Handle clicking outside the bubble and tray. We don't block the event, so | 498 // Handle clicking outside the bubble and tray. We don't block the event, so |
497 // it will also be handled by whatever widget was clicked on. | 499 // it will also be handled by whatever widget was clicked on. |
498 OnClickedOutsideView(); | 500 OnClickedOutsideView(); |
499 } | 501 } |
500 | 502 |
501 | 503 |
502 } // namespace internal | 504 } // namespace internal |
503 } // namespace ash | 505 } // namespace ash |
OLD | NEW |