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

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

Issue 11299219: Rework FocusManager as FocusClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 13 matching lines...) Expand all
24 #include "content/port/browser/render_widget_host_view_port.h" 24 #include "content/port/browser/render_widget_host_view_port.h"
25 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/render_view_host.h" 26 #include "content/public/browser/render_view_host.h"
27 #include "content/public/browser/user_metrics.h" 27 #include "content/public/browser/user_metrics.h"
28 #include "content/public/common/content_switches.h" 28 #include "content/public/common/content_switches.h"
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h" 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h"
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
32 #include "ui/aura/client/aura_constants.h" 32 #include "ui/aura/client/aura_constants.h"
33 #include "ui/aura/client/cursor_client.h" 33 #include "ui/aura/client/cursor_client.h"
34 #include "ui/aura/client/focus_client.h"
34 #include "ui/aura/client/screen_position_client.h" 35 #include "ui/aura/client/screen_position_client.h"
35 #include "ui/aura/client/stacking_client.h" 36 #include "ui/aura/client/stacking_client.h"
36 #include "ui/aura/client/tooltip_client.h" 37 #include "ui/aura/client/tooltip_client.h"
37 #include "ui/aura/client/window_types.h" 38 #include "ui/aura/client/window_types.h"
38 #include "ui/aura/env.h" 39 #include "ui/aura/env.h"
39 #include "ui/aura/root_window.h" 40 #include "ui/aura/root_window.h"
40 #include "ui/aura/window.h" 41 #include "ui/aura/window.h"
41 #include "ui/aura/window_observer.h" 42 #include "ui/aura/window_observer.h"
42 #include "ui/aura/window_tracker.h" 43 #include "ui/aura/window_tracker.h"
43 #include "ui/base/clipboard/scoped_clipboard_writer.h" 44 #include "ui/base/clipboard/scoped_clipboard_writer.h"
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 window = GetParent(window); 499 window = GetParent(window);
499 DCHECK(GetParent(window) == parent); 500 DCHECK(GetParent(window) == parent);
500 } 501 }
501 if (!GetProp(window, kWidgetOwnerProperty)) 502 if (!GetProp(window, kWidgetOwnerProperty))
502 CHECK(SetProp(window, kWidgetOwnerProperty, this)); 503 CHECK(SetProp(window, kWidgetOwnerProperty, this));
503 } 504 }
504 #endif // defined(OS_WIN) 505 #endif // defined(OS_WIN)
505 } 506 }
506 507
507 void RenderWidgetHostViewAura::Focus() { 508 void RenderWidgetHostViewAura::Focus() {
508 // Make sure we have a FocusManager before attempting to Focus(). In some 509 // Make sure we have a FocusClient before attempting to Focus(). In some
509 // situations we may not yet be in a valid Window hierarchy (such as reloading 510 // situations we may not yet be in a valid Window hierarchy (such as reloading
510 // after out of memory discared the tab). 511 // after out of memory discarded the tab).
511 if (window_->GetFocusManager()) 512 aura::client::FocusClient* client = aura::client::GetFocusClient(window_);
513 if (client)
512 window_->Focus(); 514 window_->Focus();
513 } 515 }
514 516
515 void RenderWidgetHostViewAura::Blur() { 517 void RenderWidgetHostViewAura::Blur() {
516 window_->Blur(); 518 window_->Blur();
517 } 519 }
518 520
519 bool RenderWidgetHostViewAura::HasFocus() const { 521 bool RenderWidgetHostViewAura::HasFocus() const {
520 return window_->HasFocus(); 522 return window_->HasFocus();
521 } 523 }
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnKeyEvent"); 1500 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnKeyEvent");
1499 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab() && 1501 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab() &&
1500 popup_child_host_view_->OnKeyEvent(event)) 1502 popup_child_host_view_->OnKeyEvent(event))
1501 return ui::ER_HANDLED; 1503 return ui::ER_HANDLED;
1502 1504
1503 // We need to handle the Escape key for Pepper Flash. 1505 // We need to handle the Escape key for Pepper Flash.
1504 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { 1506 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) {
1505 // Focus the window we were created from. 1507 // Focus the window we were created from.
1506 if (host_tracker_.get() && !host_tracker_->windows().empty()) { 1508 if (host_tracker_.get() && !host_tracker_->windows().empty()) {
1507 aura::Window* host = *(host_tracker_->windows().begin()); 1509 aura::Window* host = *(host_tracker_->windows().begin());
1508 if (host->GetFocusManager()) 1510 aura::client::FocusClient* client = aura::client::GetFocusClient(host);
1511 if (client)
1509 host->Focus(); 1512 host->Focus();
1510 } 1513 }
1511 if (!in_shutdown_) { 1514 if (!in_shutdown_) {
1512 in_shutdown_ = true; 1515 in_shutdown_ = true;
1513 host_->Shutdown(); 1516 host_->Shutdown();
1514 } 1517 }
1515 } else { 1518 } else {
1516 // We don't have to communicate with an input method here. 1519 // We don't have to communicate with an input method here.
1517 if (!event->HasNativeEvent()) { 1520 if (!event->HasNativeEvent()) {
1518 // Send a fabricated event, which is usually a VKEY_PROCESSKEY IME event. 1521 // Send a fabricated event, which is usually a VKEY_PROCESSKEY IME event.
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1993 RenderWidgetHost* widget) { 1996 RenderWidgetHost* widget) {
1994 return new RenderWidgetHostViewAura(widget); 1997 return new RenderWidgetHostViewAura(widget);
1995 } 1998 }
1996 1999
1997 // static 2000 // static
1998 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 2001 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
1999 GetScreenInfoForWindow(results, NULL); 2002 GetScreenInfoForWindow(results, NULL);
2000 } 2003 }
2001 2004
2002 } // namespace content 2005 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_views.cc ('k') | content/shell/shell_stacking_client_ash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698