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

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

Issue 527153002: Fix the issue that GetFrameWindow() may change between AddObserver and RemoveObserver in KeyboardCo… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "content/public/browser/render_widget_host.h" 9 #include "content/public/browser/render_widget_host.h"
10 #include "content/public/browser/render_widget_host_iterator.h" 10 #include "content/public/browser/render_widget_host_iterator.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 else 136 else
137 command.AppendArg("0"); 137 command.AppendArg("0");
138 VLOG(1) << "Running " << command.GetCommandLineString(); 138 VLOG(1) << "Running " << command.GetCommandLineString();
139 base::LaunchOptions options; 139 base::LaunchOptions options;
140 options.wait = true; 140 options.wait = true;
141 base::LaunchProcess(command, options, NULL); 141 base::LaunchProcess(command, options, NULL);
142 #endif 142 #endif
143 } 143 }
144 144
145 aura::Window *GetFrameWindow(aura::Window *window) { 145 aura::Window *GetFrameWindow(aura::Window *window) {
146 // Each container window has a non-negative id. Stop traversing at the child
147 // of a container window.
148 if (!window) 146 if (!window)
149 return NULL; 147 return NULL;
150 while(window->parent() && window->parent()->id() < 0) { 148 while(window->parent()) {
Shu Chen 2014/09/02 04:43:42 Kevin/Biao, do you think there is a case that a to
bshe 2014/09/02 12:58:47 I am not familiar with this code. kevers@ could co
Shu Chen 2014/09/02 14:30:43 Done. I've changed to safer solution.
151 window = window->parent(); 149 window = window->parent();
152 } 150 }
153 return window; 151 return window;
154 } 152 }
155 153
156 } // namespace 154 } // namespace
157 155
158 namespace keyboard { 156 namespace keyboard {
159 157
160 // Observer for both keyboard show and hide animations. It should be owned by 158 // Observer for both keyboard show and hide animations. It should be owned by
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 564
567 void KeyboardController::RemoveBoundsChangedObserver(aura::Window* window) { 565 void KeyboardController::RemoveBoundsChangedObserver(aura::Window* window) {
568 aura::Window* target_window = GetFrameWindow(window); 566 aura::Window* target_window = GetFrameWindow(window);
569 if (target_window && 567 if (target_window &&
570 target_window->HasObserver(window_bounds_observer_.get())) { 568 target_window->HasObserver(window_bounds_observer_.get())) {
571 target_window->RemoveObserver(window_bounds_observer_.get()); 569 target_window->RemoveObserver(window_bounds_observer_.get());
572 } 570 }
573 } 571 }
574 572
575 } // namespace keyboard 573 } // 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