| 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/launcher/overflow_bubble.h" | 5 #include "ash/launcher/overflow_bubble.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/launcher/launcher_types.h" | 9 #include "ash/launcher/launcher_types.h" |
| 10 #include "ash/launcher/launcher_view.h" | 10 #include "ash/launcher/launcher_view.h" |
| 11 #include "ash/root_window_controller.h" |
| 11 #include "ash/system/tray/system_tray.h" | 12 #include "ash/system/tray/system_tray.h" |
| 12 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 13 #include "ash/wm/shelf_layout_manager.h" | 14 #include "ash/wm/shelf_layout_manager.h" |
| 15 #include "ui/aura/root_window.h" |
| 14 #include "ui/gfx/insets.h" | 16 #include "ui/gfx/insets.h" |
| 15 #include "ui/gfx/screen.h" | 17 #include "ui/gfx/screen.h" |
| 16 #include "ui/views/bubble/bubble_delegate.h" | 18 #include "ui/views/bubble/bubble_delegate.h" |
| 17 #include "ui/views/bubble/bubble_frame_view.h" | 19 #include "ui/views/bubble/bubble_frame_view.h" |
| 18 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
| 19 | 21 |
| 20 namespace ash { | 22 namespace ash { |
| 21 namespace internal { | 23 namespace internal { |
| 22 | 24 |
| 23 namespace { | 25 namespace { |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 int overflow_start_index) { | 253 int overflow_start_index) { |
| 252 Hide(); | 254 Hide(); |
| 253 | 255 |
| 254 OverflowBubbleView* bubble_view = new OverflowBubbleView(); | 256 OverflowBubbleView* bubble_view = new OverflowBubbleView(); |
| 255 bubble_view->InitOverflowBubble(delegate, | 257 bubble_view->InitOverflowBubble(delegate, |
| 256 model, | 258 model, |
| 257 anchor, | 259 anchor, |
| 258 overflow_start_index); | 260 overflow_start_index); |
| 259 | 261 |
| 260 bubble_ = bubble_view; | 262 bubble_ = bubble_view; |
| 261 ash::Shell::GetInstance()->system_tray()->InitializeBubbleAnimations( | 263 RootWindowController::ForWindow(anchor->GetWidget()->GetNativeView())-> |
| 262 bubble_->GetWidget()); | 264 GetSystemTray()->InitializeBubbleAnimations(bubble_->GetWidget()); |
| 263 bubble_->GetWidget()->AddObserver(this); | 265 bubble_->GetWidget()->AddObserver(this); |
| 264 bubble_->GetWidget()->Show(); | 266 bubble_->GetWidget()->Show(); |
| 265 } | 267 } |
| 266 | 268 |
| 267 void OverflowBubble::Hide() { | 269 void OverflowBubble::Hide() { |
| 268 if (!IsShowing()) | 270 if (!IsShowing()) |
| 269 return; | 271 return; |
| 270 | 272 |
| 271 bubble_->GetWidget()->RemoveObserver(this); | 273 bubble_->GetWidget()->RemoveObserver(this); |
| 272 bubble_->GetWidget()->Close(); | 274 bubble_->GetWidget()->Close(); |
| 273 bubble_ = NULL; | 275 bubble_ = NULL; |
| 274 } | 276 } |
| 275 | 277 |
| 276 void OverflowBubble::OnWidgetClosing(views::Widget* widget) { | 278 void OverflowBubble::OnWidgetClosing(views::Widget* widget) { |
| 277 DCHECK(widget == bubble_->GetWidget()); | 279 DCHECK(widget == bubble_->GetWidget()); |
| 278 bubble_ = NULL; | 280 bubble_ = NULL; |
| 279 } | 281 } |
| 280 | 282 |
| 281 } // namespace internal | 283 } // namespace internal |
| 282 } // namespace ash | 284 } // namespace ash |
| OLD | NEW |