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 30 matching lines...) Expand all Loading... |
41 #include "ui/aura/client/aura_constants.h" | 41 #include "ui/aura/client/aura_constants.h" |
42 #include "ui/aura/client/cursor_client.h" | 42 #include "ui/aura/client/cursor_client.h" |
43 #include "ui/aura/client/focus_client.h" | 43 #include "ui/aura/client/focus_client.h" |
44 #include "ui/aura/client/screen_position_client.h" | 44 #include "ui/aura/client/screen_position_client.h" |
45 #include "ui/aura/client/stacking_client.h" | 45 #include "ui/aura/client/stacking_client.h" |
46 #include "ui/aura/client/tooltip_client.h" | 46 #include "ui/aura/client/tooltip_client.h" |
47 #include "ui/aura/client/window_types.h" | 47 #include "ui/aura/client/window_types.h" |
48 #include "ui/aura/env.h" | 48 #include "ui/aura/env.h" |
49 #include "ui/aura/root_window.h" | 49 #include "ui/aura/root_window.h" |
50 #include "ui/aura/window.h" | 50 #include "ui/aura/window.h" |
| 51 #include "ui/aura/window_destruction_observer.h" |
51 #include "ui/aura/window_observer.h" | 52 #include "ui/aura/window_observer.h" |
52 #include "ui/aura/window_tracker.h" | 53 #include "ui/aura/window_tracker.h" |
53 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 54 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
54 #include "ui/base/events/event.h" | 55 #include "ui/base/events/event.h" |
55 #include "ui/base/events/event_utils.h" | 56 #include "ui/base/events/event_utils.h" |
56 #include "ui/base/gestures/gesture_recognizer.h" | 57 #include "ui/base/gestures/gesture_recognizer.h" |
57 #include "ui/base/hit_test.h" | 58 #include "ui/base/hit_test.h" |
58 #include "ui/base/ime/input_method.h" | 59 #include "ui/base/ime/input_method.h" |
59 #include "ui/base/ui_base_types.h" | 60 #include "ui/base/ui_base_types.h" |
60 #include "ui/compositor/layer.h" | 61 #include "ui/compositor/layer.h" |
(...skipping 1956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2017 if (event->handled()) | 2018 if (event->handled()) |
2018 return; | 2019 return; |
2019 } | 2020 } |
2020 | 2021 |
2021 // We need to handle the Escape key for Pepper Flash. | 2022 // We need to handle the Escape key for Pepper Flash. |
2022 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { | 2023 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { |
2023 // Focus the window we were created from. | 2024 // Focus the window we were created from. |
2024 if (host_tracker_.get() && !host_tracker_->windows().empty()) { | 2025 if (host_tracker_.get() && !host_tracker_->windows().empty()) { |
2025 aura::Window* host = *(host_tracker_->windows().begin()); | 2026 aura::Window* host = *(host_tracker_->windows().begin()); |
2026 aura::client::FocusClient* client = aura::client::GetFocusClient(host); | 2027 aura::client::FocusClient* client = aura::client::GetFocusClient(host); |
2027 if (client) | 2028 if (client) { |
| 2029 // Calling host->Focus() may delete |this|. We create a local |
| 2030 // observer for that. In that case we exit without further |
| 2031 // access to any members. |
| 2032 aura::WindowDestructionObserver destruction_observer(window_); |
2028 host->Focus(); | 2033 host->Focus(); |
| 2034 if (destruction_observer.destroyed()) { |
| 2035 event->SetHandled(); |
| 2036 return; |
| 2037 } |
| 2038 } |
2029 } | 2039 } |
2030 if (!in_shutdown_) { | 2040 if (!in_shutdown_) { |
2031 in_shutdown_ = true; | 2041 in_shutdown_ = true; |
2032 host_->Shutdown(); | 2042 host_->Shutdown(); |
2033 } | 2043 } |
2034 } else { | 2044 } else { |
2035 // We don't have to communicate with an input method here. | 2045 // We don't have to communicate with an input method here. |
2036 if (!event->HasNativeEvent()) { | 2046 if (!event->HasNativeEvent()) { |
2037 NativeWebKeyboardEvent webkit_event( | 2047 NativeWebKeyboardEvent webkit_event( |
2038 event->type(), | 2048 event->type(), |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2649 RenderWidgetHost* widget) { | 2659 RenderWidgetHost* widget) { |
2650 return new RenderWidgetHostViewAura(widget); | 2660 return new RenderWidgetHostViewAura(widget); |
2651 } | 2661 } |
2652 | 2662 |
2653 // static | 2663 // static |
2654 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 2664 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
2655 GetScreenInfoForWindow(results, NULL); | 2665 GetScreenInfoForWindow(results, NULL); |
2656 } | 2666 } |
2657 | 2667 |
2658 } // namespace content | 2668 } // namespace content |
OLD | NEW |