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

Side by Side Diff: ash/sticky_keys/sticky_keys_overlay.cc

Issue 1398403005: Prevent ~StickyKeysOverlay() from calling back into StickyKeysOverlay via the animator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/sticky_keys/sticky_keys_overlay.h" 5 #include "ash/sticky_keys/sticky_keys_overlay.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/sticky_keys/sticky_keys_controller.h" 9 #include "ash/sticky_keys/sticky_keys_controller.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 params.bounds = CalculateOverlayBounds(); 224 params.bounds = CalculateOverlayBounds();
225 params.parent = Shell::GetContainer(Shell::GetTargetRootWindow(), 225 params.parent = Shell::GetContainer(Shell::GetTargetRootWindow(),
226 kShellWindowId_OverlayContainer); 226 kShellWindowId_OverlayContainer);
227 overlay_widget_.reset(new views::Widget); 227 overlay_widget_.reset(new views::Widget);
228 overlay_widget_->Init(params); 228 overlay_widget_->Init(params);
229 overlay_widget_->SetVisibilityChangedAnimationsEnabled(false); 229 overlay_widget_->SetVisibilityChangedAnimationsEnabled(false);
230 overlay_widget_->SetContentsView(overlay_view_.get()); 230 overlay_widget_->SetContentsView(overlay_view_.get());
231 overlay_widget_->GetNativeView()->SetName("StickyKeysOverlay"); 231 overlay_widget_->GetNativeView()->SetName("StickyKeysOverlay");
232 } 232 }
233 233
234 StickyKeysOverlay::~StickyKeysOverlay() {} 234 StickyKeysOverlay::~StickyKeysOverlay() {
235 // Remove ourself from the animator to avoid being re-entrantly called in
236 // |overlay_widget_|'s destructor.
237 ui::Layer* layer = overlay_widget_->GetLayer();
238 if (layer) {
239 ui::LayerAnimator* animator = layer->GetAnimator();
240 if (animator)
241 animator->RemoveObserver(this);
242 }
243 }
235 244
236 void StickyKeysOverlay::Show(bool visible) { 245 void StickyKeysOverlay::Show(bool visible) {
237 if (is_visible_ == visible) 246 if (is_visible_ == visible)
238 return; 247 return;
239 248
240 is_visible_ = visible; 249 is_visible_ = visible;
241 if (is_visible_) 250 if (is_visible_)
242 overlay_widget_->Show(); 251 overlay_widget_->Show();
243 overlay_widget_->SetBounds(CalculateOverlayBounds()); 252 overlay_widget_->SetBounds(CalculateOverlayBounds());
244 253
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 ui::LayerAnimator* animator = overlay_widget_->GetLayer()->GetAnimator(); 316 ui::LayerAnimator* animator = overlay_widget_->GetLayer()->GetAnimator();
308 if (animator) 317 if (animator)
309 animator->RemoveObserver(this); 318 animator->RemoveObserver(this);
310 } 319 }
311 320
312 void StickyKeysOverlay::OnLayerAnimationScheduled( 321 void StickyKeysOverlay::OnLayerAnimationScheduled(
313 ui::LayerAnimationSequence* sequence) { 322 ui::LayerAnimationSequence* sequence) {
314 } 323 }
315 324
316 } // namespace ash 325 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698