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

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 change 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 545f31cc28923a2116a3dff889799778bdae21da..41789042243330c449719dbca5c46a559eec52a8 100644
--- a/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc
+++ b/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc
@@ -38,6 +38,9 @@ TouchBrowserFrameView::TouchBrowserFrameView(BrowserFrame* frame,
}
TouchBrowserFrameView::~TouchBrowserFrameView() {
+ if (focus_change_listener_.get()) {
+ GetFocusManager()->RemoveFocusChangeListener(focus_change_listener_.get());
+ }
}
void TouchBrowserFrameView::Layout() {
@@ -59,6 +62,15 @@ int TouchBrowserFrameView::GetReservedHeight() const {
return 0;
}
+void TouchBrowserFrameView::ViewHierarchyChanged(bool is_add, View* parent,
bryeung 2011/01/27 20:50:34 Why are we doing this in ViewHierarchyChanged? Is
oshima 2011/01/27 21:35:41 Yes, this is a standard item to initialize things
+ View* child) {
oshima 2011/01/27 19:58:33 fix indentation. see my comment in header.
varunjain 2011/01/27 23:01:38 Done.
+ OpaqueBrowserFrameView::ViewHierarchyChanged(is_add, parent, child);
+ if (!focus_change_listener_.get()) {
oshima 2011/01/27 19:58:33 You need to check GetWidget(). This assumes that t
varunjain 2011/01/27 23:01:38 GetWidget is checked inside GetFocusManager. I wil
+ focus_change_listener_.reset(new TouchBrowserFocusChangeListener(this));
+ GetFocusManager()->AddFocusChangeListener(focus_change_listener_.get());
bryeung 2011/01/27 20:50:34 Related to oshima's point: GetFocusManager can ret
varunjain 2011/01/27 23:01:38 Done.
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
// TouchBrowserFrameView, private:
@@ -118,3 +130,24 @@ void TouchBrowserFrameView::Observe(NotificationType type,
UpdateKeyboardAndLayout(false);
}
}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// TouchBrowserFocusChangeListener
+//
+///////////////////////////////////////////////////////////////////////////////
+
+TouchBrowserFrameView::TouchBrowserFocusChangeListener
+ ::TouchBrowserFocusChangeListener(TouchBrowserFrameView* browser_frame)
+ : touch_browser_frame_(browser_frame) {
+}
+
+void TouchBrowserFrameView::TouchBrowserFocusChangeListener::FocusWillChange(
+ views::View* focused_before, views::View* focused_now) {
+ if (!focused_before || (focused_now && focused_now->GetVirtualKeyboardType()
oshima 2011/01/27 19:58:33 moving the "(forcusd_now && .." to next line would
varunjain 2011/01/27 23:01:38 Done.
+ != focused_before->GetVirtualKeyboardType())) {
+ // TODO: support other types of keyboard.
+ touch_browser_frame_->UpdateKeyboardAndLayout(
+ focused_now->GetVirtualKeyboardType() == views::View::REGULAR_KEYBOARD);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698