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

Unified Diff: views/controls/native/native_view_host.cc

Issue 231022: Reverting 27113. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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 | « views/controls/native/native_view_host.h ('k') | views/controls/native/native_view_host_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/native/native_view_host.cc
===================================================================
--- views/controls/native/native_view_host.cc (revision 27114)
+++ views/controls/native/native_view_host.cc (working copy)
@@ -7,7 +7,6 @@
#include "base/logging.h"
#include "app/gfx/canvas.h"
#include "views/controls/native/native_view_host_wrapper.h"
-#include "views/focus/focus_manager.h"
#include "views/widget/widget.h"
namespace views {
@@ -21,10 +20,7 @@
NativeViewHost::NativeViewHost()
: native_view_(NULL),
fast_resize_(false),
- focus_native_view_(NULL) {
- // By default we make this view the one that should be set as the focused view
- // when the native view gets the focus.
- focus_view_ = this;
+ focus_view_(NULL) {
// The native widget is placed relative to the root. As such, we need to
// know when the position of any ancestor changes, or our visibility relative
// to other views changed as it'll effect our position relative to the root.
@@ -37,12 +33,10 @@
void NativeViewHost::Attach(gfx::NativeView native_view) {
DCHECK(!native_view_);
native_view_ = native_view;
- // If this NativeViewHost is the focus view, than it should obviously be
- // focusable. If it is not, then it acts as a container and we don't want it
- // to get focus through tab-traversal, so we make it not focusable.
- SetFocusable(focus_view_ == this);
- if (!focus_native_view_)
- focus_native_view_ = native_view;
+ // If set_focus_view() has not been invoked, this view is the one that should
+ // be seen as focused when the native view receives focus.
+ if (!focus_view_)
+ focus_view_ = this;
native_wrapper_->NativeViewAttached();
}
@@ -50,7 +44,6 @@
DCHECK(native_view_);
native_wrapper_->NativeViewDetaching();
native_view_ = NULL;
- focus_native_view_ = NULL;
}
void NativeViewHost::SetPreferredSize(const gfx::Size& size) {
@@ -64,22 +57,6 @@
native_view_ = NULL;
}
-void NativeViewHost::GotNativeFocus() {
- // Some NativeViewHost may not have an associated focus view. This is the
- // case for containers for example. They might still get the native focus,
- // if one non native view they contain gets focused. In that case, we should
- // not change the focused view.
- if (!focus_view_ || !focus_view_->IsFocusable())
- return;
-
- FocusManager* focus_manager = GetFocusManager();
- if (!focus_manager) {
- NOTREACHED();
- return;
- }
- focus_manager->SetFocusedView(focus_view_);
-}
-
////////////////////////////////////////////////////////////////////////////////
// NativeViewHost, View overrides:
@@ -157,12 +134,7 @@
}
void NativeViewHost::Focus() {
- FocusManager* focus_manager = GetFocusManager();
- if (!focus_manager) {
- NOTREACHED();
- return;
- }
- focus_manager->FocusNativeView(focus_native_view_);
+ native_wrapper_->SetFocus();
}
} // namespace views
« no previous file with comments | « views/controls/native/native_view_host.h ('k') | views/controls/native/native_view_host_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698