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

Unified Diff: chrome/browser/ui/touch/frame/touch_browser_frame_view.cc

Issue 6384004: Browser should get notified if a views textfield changes focus. In addition, (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Minor changes that were missed in last patch Created 9 years, 11 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
Index: chrome/browser/ui/touch/frame/touch_browser_frame_view.cc
diff --git a/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc b/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc
index 3838b4f6883f50634210874bfd8cab58b3655cec..95018e5524567cdfee59de5319bfa60949337a8c 100644
--- a/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc
+++ b/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc
@@ -35,7 +35,8 @@ TouchBrowserFrameView::TouchBrowserFrameView(BrowserFrame* frame,
BrowserView* browser_view)
: OpaqueBrowserFrameView(frame, browser_view),
keyboard_showing_(false),
- keyboard_(NULL) {
+ keyboard_(NULL),
+ focus_listener_added_(false) {
registrar_.Add(this,
NotificationType::NAV_ENTRY_COMMITTED,
NotificationService::AllSources());
@@ -50,6 +51,9 @@ TouchBrowserFrameView::TouchBrowserFrameView(BrowserFrame* frame,
}
TouchBrowserFrameView::~TouchBrowserFrameView() {
+ if (focus_listener_added_ && GetFocusManager()) {
+ GetFocusManager()->RemoveFocusChangeListener(this);
+ }
oshima 2011/01/27 23:39:09 no {} for single line condition.
varunjain 2011/01/28 01:55:57 moved removing the focus listener to ViewHierarchy
browser_view()->browser()->tabstrip_model()->RemoveObserver(this);
}
@@ -63,6 +67,17 @@ void TouchBrowserFrameView::Layout() {
keyboard_->SetBounds(GetBoundsForReservedArea());
}
+void TouchBrowserFrameView::FocusWillChange(views::View* focused_before,
+ views::View* focused_now) {
+ if (!focused_before ||
+ (focused_now && focused_now->GetContentType()
+ != focused_before->GetContentType())) {
+ // TODO: support other types of keyboard.
+ UpdateKeyboardAndLayout(
+ focused_now->GetContentType() == views::View::GENERIC_INPUT);
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
// TouchBrowserFrameView, protected:
int TouchBrowserFrameView::GetReservedHeight() const {
@@ -72,6 +87,16 @@ int TouchBrowserFrameView::GetReservedHeight() const {
return 0;
}
+void TouchBrowserFrameView::ViewHierarchyChanged(bool is_add,
+ View* parent,
+ View* child) {
+ OpaqueBrowserFrameView::ViewHierarchyChanged(is_add, parent, child);
+ if (!focus_listener_added_ && GetFocusManager()) {
+ GetFocusManager()->AddFocusChangeListener(this);
+ focus_listener_added_ = true;
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
// TouchBrowserFrameView, private:

Powered by Google App Engine
This is Rietveld 408576698