| 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..df64f68cb84ac7dc9d8957e048fe4a921fdb4f3e 100644
|
| --- a/ash/sticky_keys/sticky_keys_overlay.cc
|
| +++ b/ash/sticky_keys/sticky_keys_overlay.cc
|
| @@ -103,12 +103,16 @@ void StickyKeyOverlayLabel::SetKeyState(StickyKeyState state) {
|
| // StickyKeysOverlayView
|
| class StickyKeysOverlayView : public views::WidgetDelegateView {
|
| public:
|
| + // This object is not owned by the views hiearchy or by the widget. The
|
| + // StickyKeysOverlay is the only class that should create and destroy this
|
| + // view.
|
| StickyKeysOverlayView();
|
|
|
| ~StickyKeysOverlayView() override;
|
|
|
| // views::WidgetDelegateView overrides:
|
| void OnPaint(gfx::Canvas* canvas) override;
|
| + void DeleteDelegate() override;
|
|
|
| void SetKeyState(ui::EventFlags modifier, StickyKeyState state);
|
|
|
| @@ -127,6 +131,9 @@ class StickyKeysOverlayView : public views::WidgetDelegateView {
|
| };
|
|
|
| StickyKeysOverlayView::StickyKeysOverlayView() {
|
| + // The parent StickyKeysOverlay object owns this view.
|
| + set_owned_by_client();
|
| +
|
| const gfx::Font& font =
|
| ui::ResourceBundle::GetSharedInstance().GetFont(kKeyLabelFontStyle);
|
| int font_size = font.GetFontSize();
|
| @@ -166,6 +173,10 @@ void StickyKeysOverlayView::OnPaint(gfx::Canvas* canvas) {
|
| views::WidgetDelegateView::OnPaint(canvas);
|
| }
|
|
|
| +void StickyKeysOverlayView::DeleteDelegate() {
|
| + // This view object is owned by StickyKeysOverlay, so no-op here.
|
| +}
|
| +
|
| void StickyKeysOverlayView::SetKeyState(ui::EventFlags modifier,
|
| StickyKeyState state) {
|
| ModifierLabelMap::iterator it = modifier_label_map_.find(modifier);
|
| @@ -215,14 +226,14 @@ StickyKeysOverlay::StickyKeysOverlay()
|
| params.accept_events = false;
|
| params.keep_on_top = true;
|
| params.remove_standard_frame = true;
|
| - params.delegate = overlay_view_;
|
| + params.delegate = overlay_view_.get();
|
| params.bounds = CalculateOverlayBounds();
|
| params.parent = Shell::GetContainer(Shell::GetTargetRootWindow(),
|
| kShellWindowId_OverlayContainer);
|
| overlay_widget_.reset(new views::Widget);
|
| overlay_widget_->Init(params);
|
| overlay_widget_->SetVisibilityChangedAnimationsEnabled(false);
|
| - overlay_widget_->SetContentsView(overlay_view_);
|
| + overlay_widget_->SetContentsView(overlay_view_.get());
|
| overlay_widget_->GetNativeView()->SetName("StickyKeysOverlay");
|
| }
|
|
|
|
|