Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: ash/shelf/overflow_bubble.cc

Issue 1929203002: mash: Fix crash when clicking on the shelf overflow icon (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/root_window_controller.h ('k') | ash/system/tray/tray_background_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/shelf/overflow_bubble.h" 5 #include "ash/shelf/overflow_bubble.h"
6 6
7 #include "ash/root_window_controller.h"
8 #include "ash/shelf/overflow_bubble_view.h" 7 #include "ash/shelf/overflow_bubble_view.h"
9 #include "ash/shelf/shelf.h" 8 #include "ash/shelf/shelf.h"
10 #include "ash/shelf/shelf_view.h" 9 #include "ash/shelf/shelf_view.h"
11 #include "ash/shelf/shelf_widget.h" 10 #include "ash/shelf/shelf_widget.h"
12 #include "ash/shell.h" 11 #include "ash/shell.h"
13 #include "ash/system/tray/system_tray.h" 12 #include "ash/system/tray/tray_background_view.h"
14 #include "ui/aura/client/screen_position_client.h" 13 #include "ui/aura/client/screen_position_client.h"
15 #include "ui/aura/window_event_dispatcher.h" 14 #include "ui/aura/window_event_dispatcher.h"
16 #include "ui/events/event.h" 15 #include "ui/events/event.h"
17 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
18 17
19 namespace ash { 18 namespace ash {
20 19
21 OverflowBubble::OverflowBubble() 20 OverflowBubble::OverflowBubble()
22 : bubble_(NULL), 21 : bubble_(NULL),
23 anchor_(NULL), 22 anchor_(NULL),
24 shelf_view_(NULL) { 23 shelf_view_(NULL) {
25 } 24 }
26 25
27 OverflowBubble::~OverflowBubble() { 26 OverflowBubble::~OverflowBubble() {
28 Hide(); 27 Hide();
29 } 28 }
30 29
31 void OverflowBubble::Show(views::View* anchor, ShelfView* shelf_view) { 30 void OverflowBubble::Show(views::View* anchor, ShelfView* shelf_view) {
32 Hide(); 31 Hide();
33 32
34 bubble_ = new OverflowBubbleView(); 33 bubble_ = new OverflowBubbleView();
35 bubble_->InitOverflowBubble(anchor, shelf_view); 34 bubble_->InitOverflowBubble(anchor, shelf_view);
36 shelf_view_ = shelf_view; 35 shelf_view_ = shelf_view;
37 anchor_ = anchor; 36 anchor_ = anchor;
38 37
38 // TODO(jamescook): Change this to a PointerWatcher.
39 Shell::GetInstance()->AddPreTargetHandler(this); 39 Shell::GetInstance()->AddPreTargetHandler(this);
40 40
41 RootWindowController::ForWindow(anchor->GetWidget()->GetNativeView())-> 41 TrayBackgroundView::InitializeBubbleAnimations(bubble_->GetWidget());
42 GetSystemTray()->InitializeBubbleAnimations(bubble_->GetWidget());
43 bubble_->GetWidget()->AddObserver(this); 42 bubble_->GetWidget()->AddObserver(this);
44 bubble_->GetWidget()->Show(); 43 bubble_->GetWidget()->Show();
45 } 44 }
46 45
47 void OverflowBubble::Hide() { 46 void OverflowBubble::Hide() {
48 if (!IsShowing()) 47 if (!IsShowing())
49 return; 48 return;
50 49
51 Shell::GetInstance()->RemovePreTargetHandler(this); 50 Shell::GetInstance()->RemovePreTargetHandler(this);
52 bubble_->GetWidget()->RemoveObserver(this); 51 bubble_->GetWidget()->RemoveObserver(this);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 90
92 void OverflowBubble::OnWidgetDestroying(views::Widget* widget) { 91 void OverflowBubble::OnWidgetDestroying(views::Widget* widget) {
93 DCHECK(widget == bubble_->GetWidget()); 92 DCHECK(widget == bubble_->GetWidget());
94 bubble_ = NULL; 93 bubble_ = NULL;
95 anchor_ = NULL; 94 anchor_ = NULL;
96 shelf_view_->shelf()->SchedulePaint(); 95 shelf_view_->shelf()->SchedulePaint();
97 shelf_view_ = NULL; 96 shelf_view_ = NULL;
98 } 97 }
99 98
100 } // namespace ash 99 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller.h ('k') | ash/system/tray/tray_background_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698