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

Unified Diff: chrome/browser/ui/aura/native_window_tracker_aura.cc

Issue 662073002: Fix crash when user closes window prior to the "Confirm Install" prompt showing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/install_prompt_navigator
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/aura/native_window_tracker_aura.cc
diff --git a/chrome/browser/ui/aura/native_window_tracker_aura.cc b/chrome/browser/ui/aura/native_window_tracker_aura.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bd1106aafdad099f479fcab894245c9945e039aa
--- /dev/null
+++ b/chrome/browser/ui/aura/native_window_tracker_aura.cc
@@ -0,0 +1,34 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/aura/native_window_tracker_aura.h"
+
+#include "ui/aura/window.h"
+
+NativeWindowTrackerAura::NativeWindowTrackerAura(
+ gfx::NativeWindow window)
+ : window_(window) {
+ window->AddObserver(this);
+}
+
+NativeWindowTrackerAura::~NativeWindowTrackerAura() {
+ if (window_)
+ window_->RemoveObserver(this);
+}
+
+bool NativeWindowTrackerAura::WasNativeWindowClosed() const {
+ return window_ == nullptr;
+}
+
+void NativeWindowTrackerAura::OnWindowDestroying(
+ aura::Window* window) {
+ window_->RemoveObserver(this);
+ window_ = nullptr;
+}
+
+// static
+scoped_ptr<NativeWindowTracker> NativeWindowTracker::Create(
+ gfx::NativeWindow window) {
+ return scoped_ptr<NativeWindowTracker>(new NativeWindowTrackerAura(window));
+}

Powered by Google App Engine
This is Rietveld 408576698