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

Side by Side Diff: mojo/examples/window_manager/window_manager.cc

Issue 580353002: mojo: Fix crash in example WM when closing window. (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 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 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "mojo/application/application_runner_chromium.h" 7 #include "mojo/application/application_runner_chromium.h"
8 #include "mojo/examples/keyboard/keyboard.mojom.h" 8 #include "mojo/examples/keyboard/keyboard.mojom.h"
9 #include "mojo/examples/window_manager/debug_panel.h" 9 #include "mojo/examples/window_manager/debug_panel.h"
10 #include "mojo/examples/window_manager/window_manager.mojom.h" 10 #include "mojo/examples/window_manager/window_manager.mojom.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 virtual ~WindowManager() { 292 virtual ~WindowManager() {
293 // host() may be destroyed by the time we get here. 293 // host() may be destroyed by the time we get here.
294 // TODO: figure out a way to always cleanly remove handler. 294 // TODO: figure out a way to always cleanly remove handler.
295 if (window_manager_app_->host()) 295 if (window_manager_app_->host())
296 window_manager_app_->host()->window()->RemovePreTargetHandler(this); 296 window_manager_app_->host()->window()->RemovePreTargetHandler(this);
297 } 297 }
298 298
299 void CloseWindow(Id view_id) { 299 void CloseWindow(Id view_id) {
300 WindowVector::iterator iter = GetWindowByViewId(view_id); 300 WindowVector::iterator iter = GetWindowByViewId(view_id);
301 DCHECK(iter != windows_.end()); 301 DCHECK(iter != windows_.end());
302 Window* window = *iter;
302 windows_.erase(iter); 303 windows_.erase(iter);
303 (*iter)->view()->Destroy(); 304 window->view()->Destroy();
304 } 305 }
305 306
306 void ShowKeyboard(Id view_id, const gfx::Rect& bounds) { 307 void ShowKeyboard(Id view_id, const gfx::Rect& bounds) {
307 // TODO: this needs to validate |view_id|. That is, it shouldn't assume 308 // TODO: this needs to validate |view_id|. That is, it shouldn't assume
308 // |view_id| is valid and it also needs to make sure the client that sent 309 // |view_id| is valid and it also needs to make sure the client that sent
309 // this really owns |view_id|. 310 // this really owns |view_id|.
310 // TODO: honor |bounds|. 311 // TODO: honor |bounds|.
311 if (!keyboard_manager_) { 312 if (!keyboard_manager_) {
312 keyboard_manager_.reset(new KeyboardManager); 313 keyboard_manager_.reset(new KeyboardManager);
313 View* parent = view_manager_->GetRoots().back(); 314 View* parent = view_manager_->GetRoots().back();
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 window_manager_->RequestNavigate(view_id_, target, request.Pass()); 556 window_manager_->RequestNavigate(view_id_, target, request.Pass());
556 } 557 }
557 558
558 } // namespace examples 559 } // namespace examples
559 } // namespace mojo 560 } // namespace mojo
560 561
561 MojoResult MojoMain(MojoHandle shell_handle) { 562 MojoResult MojoMain(MojoHandle shell_handle) {
562 mojo::ApplicationRunnerChromium runner(new mojo::examples::WindowManager); 563 mojo::ApplicationRunnerChromium runner(new mojo::examples::WindowManager);
563 return runner.Run(shell_handle); 564 return runner.Run(shell_handle);
564 } 565 }
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