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

Side by Side Diff: ui/keyboard/keyboard_controller.cc

Issue 1094863005: Fix a crash in dtor of CallbackAnimationObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 5 years, 8 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/keyboard/keyboard_controller.h" 5 #include "ui/keyboard/keyboard_controller.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 109
110 } // namespace 110 } // namespace
111 111
112 namespace keyboard { 112 namespace keyboard {
113 113
114 // Observer for both keyboard show and hide animations. It should be owned by 114 // Observer for both keyboard show and hide animations. It should be owned by
115 // KeyboardController. 115 // KeyboardController.
116 class CallbackAnimationObserver : public ui::LayerAnimationObserver { 116 class CallbackAnimationObserver : public ui::LayerAnimationObserver {
117 public: 117 public:
118 CallbackAnimationObserver(ui::LayerAnimator* animator, 118 CallbackAnimationObserver(scoped_refptr<ui::LayerAnimator> animator,
sadrul 2015/04/27 18:56:16 const scoped_refptr<>&
bshe 2015/04/27 19:52:54 Done.
119 base::Callback<void(void)> callback); 119 base::Callback<void(void)> callback);
120 ~CallbackAnimationObserver() override; 120 ~CallbackAnimationObserver() override;
121 121
122 private: 122 private:
123 // Overridden from ui::LayerAnimationObserver: 123 // Overridden from ui::LayerAnimationObserver:
124 void OnLayerAnimationEnded(ui::LayerAnimationSequence* seq) override; 124 void OnLayerAnimationEnded(ui::LayerAnimationSequence* seq) override;
125 void OnLayerAnimationAborted(ui::LayerAnimationSequence* seq) override; 125 void OnLayerAnimationAborted(ui::LayerAnimationSequence* seq) override;
126 void OnLayerAnimationScheduled(ui::LayerAnimationSequence* seq) override {} 126 void OnLayerAnimationScheduled(ui::LayerAnimationSequence* seq) override {}
127 127
128 ui::LayerAnimator* animator_; 128 scoped_refptr<ui::LayerAnimator> animator_;
129 base::Callback<void(void)> callback_; 129 base::Callback<void(void)> callback_;
130 130
131 DISALLOW_COPY_AND_ASSIGN(CallbackAnimationObserver); 131 DISALLOW_COPY_AND_ASSIGN(CallbackAnimationObserver);
132 }; 132 };
133 133
134 CallbackAnimationObserver::CallbackAnimationObserver( 134 CallbackAnimationObserver::CallbackAnimationObserver(
135 ui::LayerAnimator* animator, base::Callback<void(void)> callback) 135 scoped_refptr<ui::LayerAnimator> animator,
136 base::Callback<void(void)> callback)
136 : animator_(animator), callback_(callback) { 137 : animator_(animator), callback_(callback) {
137 } 138 }
138 139
139 CallbackAnimationObserver::~CallbackAnimationObserver() { 140 CallbackAnimationObserver::~CallbackAnimationObserver() {
140 animator_->RemoveObserver(this); 141 animator_->RemoveObserver(this);
141 } 142 }
142 143
143 void CallbackAnimationObserver::OnLayerAnimationEnded( 144 void CallbackAnimationObserver::OnLayerAnimationEnded(
144 ui::LayerAnimationSequence* seq) { 145 ui::LayerAnimationSequence* seq) {
145 if (animator_->is_animating()) 146 if (animator_->is_animating())
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 proxy_->HideKeyboardContainer(container_.get()); 570 proxy_->HideKeyboardContainer(container_.get());
570 } 571 }
571 572
572 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { 573 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) {
573 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr; 574 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr;
574 if (target_window) 575 if (target_window)
575 window_bounds_observer_->AddObservedWindow(target_window); 576 window_bounds_observer_->AddObservedWindow(target_window);
576 } 577 }
577 578
578 } // namespace keyboard 579 } // namespace keyboard
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