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

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

Issue 754763005: Speculative fix for sticky keys overlay crash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add more asserts Created 6 years 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
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 #ifndef ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_ 5 #ifndef ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_
6 #define ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_ 6 #define ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/sticky_keys/sticky_keys_state.h" 9 #include "ash/sticky_keys/sticky_keys_state.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 void SetModifierKeyState(ui::EventFlags modifier, 44 void SetModifierKeyState(ui::EventFlags modifier,
45 StickyKeyState state); 45 StickyKeyState state);
46 46
47 // Get the current state of the sticky key modifier in the overlay. 47 // Get the current state of the sticky key modifier in the overlay.
48 StickyKeyState GetModifierKeyState(ui::EventFlags modifier); 48 StickyKeyState GetModifierKeyState(ui::EventFlags modifier);
49 49
50 // Returns true if the overlay is currently visible. If the overlay is 50 // Returns true if the overlay is currently visible. If the overlay is
51 // animating, the returned value is the target of the animation. 51 // animating, the returned value is the target of the animation.
52 bool is_visible() { return is_visible_; } 52 bool is_visible() { return is_visible_; }
53 53
54 // Returns the underlying views::Widget for testing purposes. The returned
55 // widget is owned by StickyKeysOverlay.
56 views::Widget* GetWidgetForTesting();
57
54 private: 58 private:
55 // Returns the current bounds of the overlay, which is based on visibility. 59 // Returns the current bounds of the overlay, which is based on visibility.
56 gfx::Rect CalculateOverlayBounds(); 60 gfx::Rect CalculateOverlayBounds();
57 61
58 // gfx::LayerAnimationObserver overrides: 62 // gfx::LayerAnimationObserver overrides:
59 void OnLayerAnimationEnded(ui::LayerAnimationSequence* sequence) override; 63 void OnLayerAnimationEnded(ui::LayerAnimationSequence* sequence) override;
60 void OnLayerAnimationAborted(ui::LayerAnimationSequence* sequence) override; 64 void OnLayerAnimationAborted(ui::LayerAnimationSequence* sequence) override;
61 void OnLayerAnimationScheduled(ui::LayerAnimationSequence* sequence) override; 65 void OnLayerAnimationScheduled(ui::LayerAnimationSequence* sequence) override;
62 66
63 bool is_visible_; 67 bool is_visible_;
68 // Note: keep the order the same. |overlay_view_| must outlive
69 // |overlay_widget_|.
70 scoped_ptr<StickyKeysOverlayView> overlay_view_;
Jun Mukai 2014/12/04 21:58:55 Why it must outlive?
Tim Song 2014/12/04 23:53:37 Done. This is no longer needed after getting rid o
64 scoped_ptr<views::Widget> overlay_widget_; 71 scoped_ptr<views::Widget> overlay_widget_;
65 // Ownership of |overlay_view_| is passed to the view heirarchy.
66 StickyKeysOverlayView* overlay_view_;
67 gfx::Size widget_size_; 72 gfx::Size widget_size_;
68 }; 73 };
69 74
70 } // namespace ash 75 } // namespace ash
71 76
72 #endif // ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_ 77 #endif // ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698