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

Unified Diff: ash/sticky_keys/sticky_keys_overlay.cc

Issue 754763005: Speculative fix for sticky keys overlay crash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: ash/sticky_keys/sticky_keys_overlay.cc
diff --git a/ash/sticky_keys/sticky_keys_overlay.cc b/ash/sticky_keys/sticky_keys_overlay.cc
index 0766ba25ad2e7cdda2ac5ed875254de6622073e0..464d9f684567166abb0b56576568fad8a1cb3289 100644
--- a/ash/sticky_keys/sticky_keys_overlay.cc
+++ b/ash/sticky_keys/sticky_keys_overlay.cc
@@ -109,6 +109,7 @@ class StickyKeysOverlayView : public views::WidgetDelegateView {
// views::WidgetDelegateView overrides:
void OnPaint(gfx::Canvas* canvas) override;
+ void DeleteDelegate() override;
void SetKeyState(ui::EventFlags modifier, StickyKeyState state);
@@ -166,6 +167,13 @@ void StickyKeysOverlayView::OnPaint(gfx::Canvas* canvas) {
views::WidgetDelegateView::OnPaint(canvas);
}
+void StickyKeysOverlayView::DeleteDelegate() {
+ // The ownership of a WidgetDelegateView is kind of tricky. It has the
+ // lifetime semantics of both a View and a WidgetDelegate. We should just rely
+ // on the Views semantics and do nothing here. This object will be deleted
+ // when the parent widget is deleted.
+}
+
void StickyKeysOverlayView::SetKeyState(ui::EventFlags modifier,
StickyKeyState state) {
ModifierLabelMap::iterator it = modifier_label_map_.find(modifier);
@@ -279,6 +287,10 @@ StickyKeyState StickyKeysOverlay::GetModifierKeyState(
return overlay_view_->GetKeyState(modifier);
}
+views::Widget* StickyKeysOverlay::GetWidgetForTesting() {
+ return overlay_widget_.get();
+}
+
gfx::Rect StickyKeysOverlay::CalculateOverlayBounds() {
int x = is_visible_ ? kHorizontalOverlayOffset : -widget_size_.width();
return gfx::Rect(gfx::Point(x, kVerticalOverlayOffset), widget_size_);

Powered by Google App Engine
This is Rietveld 408576698