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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 10963045: Makes closing a fullscreen window refocus the window it came from. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | ui/aura/window_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index a0c54fa90f4e5b200154a4163eaf152026dca4de..fe5ef1e07503ff64a732c1a75f800c358894106f 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -37,6 +37,7 @@
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
+#include "ui/aura/window_tracker.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
#include "ui/base/events/event.h"
#include "ui/base/gestures/gesture_recognizer.h"
@@ -153,7 +154,7 @@ class RenderWidgetHostViewAura::WindowObserver : public aura::WindowObserver {
explicit WindowObserver(RenderWidgetHostViewAura* view) : view_(view) {}
virtual ~WindowObserver() {}
- // Overridden from aura::WindowObserver:
+ // Overridden from aura::WindowObserver:
virtual void OnWindowRemovingFromRootWindow(aura::Window* window) OVERRIDE {
view_->RemovingFromRootWindow();
}
@@ -283,6 +284,10 @@ void RenderWidgetHostViewAura::InitAsFullscreen(
if (reference_host_view) {
aura::Window* reference_window =
static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_;
+ if (reference_window) {
+ host_tracker_.reset(new aura::WindowTracker);
+ host_tracker_->Add(reference_window);
+ }
gfx::Display display =
gfx::Screen::GetDisplayNearestWindow(reference_window);
aura::client::StackingClient* stacking_client =
@@ -1355,6 +1360,12 @@ ui::EventResult RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) {
// We need to handle the Escape key for Pepper Flash.
if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) {
+ // Focus the window we were created from.
+ if (host_tracker_.get() && !host_tracker_->windows().empty()) {
+ aura::Window* host = *(host_tracker_->windows().begin());
+ if (host->GetFocusManager())
+ host->Focus();
+ }
if (!in_shutdown_) {
in_shutdown_ = true;
host_->Shutdown();
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | ui/aura/window_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698