OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "ui/aura/client/cursor_client.h" | 47 #include "ui/aura/client/cursor_client.h" |
48 #include "ui/aura/client/cursor_client_observer.h" | 48 #include "ui/aura/client/cursor_client_observer.h" |
49 #include "ui/aura/client/focus_client.h" | 49 #include "ui/aura/client/focus_client.h" |
50 #include "ui/aura/client/screen_position_client.h" | 50 #include "ui/aura/client/screen_position_client.h" |
51 #include "ui/aura/client/stacking_client.h" | 51 #include "ui/aura/client/stacking_client.h" |
52 #include "ui/aura/client/tooltip_client.h" | 52 #include "ui/aura/client/tooltip_client.h" |
53 #include "ui/aura/client/window_types.h" | 53 #include "ui/aura/client/window_types.h" |
54 #include "ui/aura/env.h" | 54 #include "ui/aura/env.h" |
55 #include "ui/aura/root_window.h" | 55 #include "ui/aura/root_window.h" |
56 #include "ui/aura/window.h" | 56 #include "ui/aura/window.h" |
57 #include "ui/aura/window_destruction_observer.h" | |
58 #include "ui/aura/window_observer.h" | 57 #include "ui/aura/window_observer.h" |
59 #include "ui/aura/window_tracker.h" | 58 #include "ui/aura/window_tracker.h" |
60 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 59 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
61 #include "ui/base/events/event.h" | 60 #include "ui/base/events/event.h" |
62 #include "ui/base/events/event_utils.h" | 61 #include "ui/base/events/event_utils.h" |
63 #include "ui/base/gestures/gesture_recognizer.h" | 62 #include "ui/base/gestures/gesture_recognizer.h" |
64 #include "ui/base/hit_test.h" | 63 #include "ui/base/hit_test.h" |
65 #include "ui/base/ime/input_method.h" | 64 #include "ui/base/ime/input_method.h" |
66 #include "ui/base/ui_base_types.h" | 65 #include "ui/base/ui_base_types.h" |
67 #include "ui/compositor/layer.h" | 66 #include "ui/compositor/layer.h" |
(...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2469 return; | 2468 return; |
2470 } | 2469 } |
2471 | 2470 |
2472 // We need to handle the Escape key for Pepper Flash. | 2471 // We need to handle the Escape key for Pepper Flash. |
2473 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { | 2472 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { |
2474 // Focus the window we were created from. | 2473 // Focus the window we were created from. |
2475 if (host_tracker_.get() && !host_tracker_->windows().empty()) { | 2474 if (host_tracker_.get() && !host_tracker_->windows().empty()) { |
2476 aura::Window* host = *(host_tracker_->windows().begin()); | 2475 aura::Window* host = *(host_tracker_->windows().begin()); |
2477 aura::client::FocusClient* client = aura::client::GetFocusClient(host); | 2476 aura::client::FocusClient* client = aura::client::GetFocusClient(host); |
2478 if (client) { | 2477 if (client) { |
2479 // Calling host->Focus() may delete |this|. We create a local | 2478 // Calling host->Focus() may delete |this|. We create a local observer |
2480 // observer for that. In that case we exit without further | 2479 // for that. In that case we exit without further access to any members. |
2481 // access to any members. | 2480 aura::WindowTracker tracker; |
2482 aura::WindowDestructionObserver destruction_observer(window_); | 2481 aura::Window* window = window_; |
| 2482 tracker.Add(window); |
2483 host->Focus(); | 2483 host->Focus(); |
2484 if (destruction_observer.destroyed()) { | 2484 if (!tracker.Contains(window)) { |
2485 event->SetHandled(); | 2485 event->SetHandled(); |
2486 return; | 2486 return; |
2487 } | 2487 } |
2488 } | 2488 } |
2489 } | 2489 } |
2490 if (!in_shutdown_) { | 2490 if (!in_shutdown_) { |
2491 in_shutdown_ = true; | 2491 in_shutdown_ = true; |
2492 host_->Shutdown(); | 2492 host_->Shutdown(); |
2493 } | 2493 } |
2494 } else { | 2494 } else { |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3208 RenderWidgetHost* widget) { | 3208 RenderWidgetHost* widget) { |
3209 return new RenderWidgetHostViewAura(widget); | 3209 return new RenderWidgetHostViewAura(widget); |
3210 } | 3210 } |
3211 | 3211 |
3212 // static | 3212 // static |
3213 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3213 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3214 GetScreenInfoForWindow(results, NULL); | 3214 GetScreenInfoForWindow(results, NULL); |
3215 } | 3215 } |
3216 | 3216 |
3217 } // namespace content | 3217 } // namespace content |
OLD | NEW |