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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 10377066: aura: Close fullscreen RenderWidgetHostViewAura on blur. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: simplify testing code (reupload) Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
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/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 DISALLOW_COPY_AND_ASSIGN(ResizeLock); 187 DISALLOW_COPY_AND_ASSIGN(ResizeLock);
188 }; 188 };
189 189
190 //////////////////////////////////////////////////////////////////////////////// 190 ////////////////////////////////////////////////////////////////////////////////
191 // RenderWidgetHostViewAura, public: 191 // RenderWidgetHostViewAura, public:
192 192
193 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host) 193 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host)
194 : host_(RenderWidgetHostImpl::From(host)), 194 : host_(RenderWidgetHostImpl::From(host)),
195 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), 195 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))),
196 in_shutdown_(false),
196 is_fullscreen_(false), 197 is_fullscreen_(false),
197 popup_parent_host_view_(NULL), 198 popup_parent_host_view_(NULL),
198 popup_child_host_view_(NULL), 199 popup_child_host_view_(NULL),
199 is_loading_(false), 200 is_loading_(false),
200 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 201 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
201 can_compose_inline_(true), 202 can_compose_inline_(true),
202 has_composition_text_(false), 203 has_composition_text_(false),
203 current_surface_(0), 204 current_surface_(0),
204 paint_canvas_(NULL), 205 paint_canvas_(NULL),
205 synthetic_move_sent_(false), 206 synthetic_move_sent_(false),
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 void RenderWidgetHostViewAura::RenderViewGone(base::TerminationStatus status, 394 void RenderWidgetHostViewAura::RenderViewGone(base::TerminationStatus status,
394 int error_code) { 395 int error_code) {
395 UpdateCursorIfOverSelf(); 396 UpdateCursorIfOverSelf();
396 Destroy(); 397 Destroy();
397 } 398 }
398 399
399 void RenderWidgetHostViewAura::Destroy() { 400 void RenderWidgetHostViewAura::Destroy() {
400 // Beware, this function is not called on all destruction paths. It will 401 // Beware, this function is not called on all destruction paths. It will
401 // implicitly end up calling ~RenderWidgetHostViewAura though, so all 402 // implicitly end up calling ~RenderWidgetHostViewAura though, so all
402 // destruction/cleanup code should happen there, not here. 403 // destruction/cleanup code should happen there, not here.
404 in_shutdown_ = true;
403 delete window_; 405 delete window_;
404 } 406 }
405 407
406 void RenderWidgetHostViewAura::SetTooltipText(const string16& tooltip_text) { 408 void RenderWidgetHostViewAura::SetTooltipText(const string16& tooltip_text) {
407 tooltip_ = tooltip_text; 409 tooltip_ = tooltip_text;
408 aura::RootWindow* root_window = window_->GetRootWindow(); 410 aura::RootWindow* root_window = window_->GetRootWindow();
409 if (aura::client::GetTooltipClient(root_window)) 411 if (aura::client::GetTooltipClient(root_window))
410 aura::client::GetTooltipClient(root_window)->UpdateTooltip(window_); 412 aura::client::GetTooltipClient(root_window)->UpdateTooltip(window_);
411 } 413 }
412 414
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 } else { 914 } else {
913 host_->SetInputMethodActive(false); 915 host_->SetInputMethodActive(false);
914 } 916 }
915 } 917 }
916 918
917 void RenderWidgetHostViewAura::OnBlur() { 919 void RenderWidgetHostViewAura::OnBlur() {
918 host_->SetActive(false); 920 host_->SetActive(false);
919 host_->Blur(); 921 host_->Blur();
920 922
921 ui::InputMethod* input_method = GetInputMethod(); 923 ui::InputMethod* input_method = GetInputMethod();
922 if (input_method) { 924 if (input_method && input_method->GetTextInputClient() == this)
923 if (input_method->GetTextInputClient() == this) 925 input_method->SetFocusedTextInputClient(NULL);
924 input_method->SetFocusedTextInputClient(NULL); 926 host_->SetInputMethodActive(false);
927
928 // If we lose the focus while fullscreen, close the window; Pepper Flash won't
929 // do it for us (unlike NPAPI Flash).
930 if (is_fullscreen_ && !in_shutdown_) {
931 in_shutdown_ = true;
932 host_->Shutdown();
925 } 933 }
926 host_->SetInputMethodActive(false);
927 } 934 }
928 935
929 bool RenderWidgetHostViewAura::OnKeyEvent(aura::KeyEvent* event) { 936 bool RenderWidgetHostViewAura::OnKeyEvent(aura::KeyEvent* event) {
930 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab() && 937 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab() &&
931 popup_child_host_view_->OnKeyEvent(event)) 938 popup_child_host_view_->OnKeyEvent(event))
932 return true; 939 return true;
933 940
934 // We need to handle the Escape key for Pepper Flash. 941 // We need to handle the Escape key for Pepper Flash.
935 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { 942 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) {
936 host_->Shutdown(); 943 if (!in_shutdown_) {
944 in_shutdown_ = true;
945 host_->Shutdown();
946 }
937 } else { 947 } else {
938 // We don't have to communicate with an input method here. 948 // We don't have to communicate with an input method here.
939 if (!event->HasNativeEvent()) { 949 if (!event->HasNativeEvent()) {
940 // Send a fabricated event, which is usually a VKEY_PROCESSKEY IME event. 950 // Send a fabricated event, which is usually a VKEY_PROCESSKEY IME event.
941 NativeWebKeyboardEvent webkit_event(event->type(), 951 NativeWebKeyboardEvent webkit_event(event->type(),
942 false /* is_char */, 952 false /* is_char */,
943 event->GetCharacter(), 953 event->GetCharacter(),
944 event->flags(), 954 event->flags(),
945 base::Time::Now().ToDoubleT()); 955 base::Time::Now().ToDoubleT());
946 host_->ForwardKeyboardEvent(webkit_event); 956 host_->ForwardKeyboardEvent(webkit_event);
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( 1287 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget(
1278 RenderWidgetHost* widget) { 1288 RenderWidgetHost* widget) {
1279 return new RenderWidgetHostViewAura(widget); 1289 return new RenderWidgetHostViewAura(widget);
1280 } 1290 }
1281 1291
1282 // static 1292 // static
1283 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( 1293 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo(
1284 WebKit::WebScreenInfo* results) { 1294 WebKit::WebScreenInfo* results) {
1285 GetScreenInfoForWindow(results, NULL); 1295 GetScreenInfoForWindow(results, NULL);
1286 } 1296 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698