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

Side by Side Diff: chrome/browser/ui/touch/frame/touch_browser_frame_view.cc

Issue 5847004: Fix layout of the virtual keyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser
Patch Set: Created 10 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
« no previous file with comments | « chrome/browser/ui/touch/frame/touch_browser_frame_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/ui/touch/frame/touch_browser_frame_view.h" 5 #include "chrome/browser/ui/touch/frame/touch_browser_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/renderer_host/site_instance.h" 10 #include "chrome/browser/renderer_host/site_instance.h"
(...skipping 25 matching lines...) Expand all
36 NotificationType::NAV_ENTRY_COMMITTED, 36 NotificationType::NAV_ENTRY_COMMITTED,
37 NotificationService::AllSources()); 37 NotificationService::AllSources());
38 registrar_.Add(this, 38 registrar_.Add(this,
39 NotificationType::FOCUS_CHANGED_IN_PAGE, 39 NotificationType::FOCUS_CHANGED_IN_PAGE,
40 NotificationService::AllSources()); 40 NotificationService::AllSources());
41 } 41 }
42 42
43 TouchBrowserFrameView::~TouchBrowserFrameView() { 43 TouchBrowserFrameView::~TouchBrowserFrameView() {
44 } 44 }
45 45
46 void TouchBrowserFrameView::Layout() {
47 OpaqueBrowserFrameView::Layout();
48
49 if (!keyboard_)
50 return;
51
52 keyboard_->SetBounds(GetBoundsForReservedArea());
53 keyboard_->SetVisible(keyboard_showing_);
54 keyboard_->Layout();
55 }
56
46 /////////////////////////////////////////////////////////////////////////////// 57 ///////////////////////////////////////////////////////////////////////////////
47 // TouchBrowserFrameView, protected: 58 // TouchBrowserFrameView, protected:
48 int TouchBrowserFrameView::GetReservedHeight() const { 59 int TouchBrowserFrameView::GetReservedHeight() const {
49 if (keyboard_showing_) 60 if (keyboard_showing_)
50 return kKeyboardHeight; 61 return kKeyboardHeight;
51 62
52 return 0; 63 return 0;
53 } 64 }
54 65
55 /////////////////////////////////////////////////////////////////////////////// 66 ///////////////////////////////////////////////////////////////////////////////
(...skipping 21 matching lines...) Expand all
77 if (should_show_keyboard) 88 if (should_show_keyboard)
78 InitVirtualKeyboard(); 89 InitVirtualKeyboard();
79 90
80 if (should_show_keyboard == keyboard_showing_) 91 if (should_show_keyboard == keyboard_showing_)
81 return; 92 return;
82 93
83 DCHECK(keyboard_); 94 DCHECK(keyboard_);
84 95
85 keyboard_showing_ = should_show_keyboard; 96 keyboard_showing_ = should_show_keyboard;
86 97
87 keyboard_->SetBounds(GetBoundsForReservedArea());
88 keyboard_->SetVisible(should_show_keyboard);
89
90 // Because the NonClientFrameView is a sibling of the ClientView, we rely on 98 // Because the NonClientFrameView is a sibling of the ClientView, we rely on
91 // the parent to resize the ClientView instead of resizing it directly. 99 // the parent to resize the ClientView instead of resizing it directly.
92 GetParent()->Layout(); 100 GetParent()->Layout();
93 } 101 }
94 102
95 void TouchBrowserFrameView::Observe(NotificationType type, 103 void TouchBrowserFrameView::Observe(NotificationType type,
96 const NotificationSource& source, 104 const NotificationSource& source,
97 const NotificationDetails& details) { 105 const NotificationDetails& details) {
98 Browser* browser = browser_view()->browser(); 106 Browser* browser = browser_view()->browser();
99 if (type == NotificationType::FOCUS_CHANGED_IN_PAGE) { 107 if (type == NotificationType::FOCUS_CHANGED_IN_PAGE) {
100 // Only modify the keyboard state if the notification is coming from 108 // Only modify the keyboard state if the notification is coming from
101 // a source within the same Browser. 109 // a source within the same Browser.
102 Source<RenderViewHost> specific_source(source); 110 Source<RenderViewHost> specific_source(source);
103 for (int i = 0; i < browser->tab_count(); ++i) { 111 for (int i = 0; i < browser->tab_count(); ++i) {
104 if (browser->GetTabContentsAt(i)->render_view_host() == 112 if (browser->GetTabContentsAt(i)->render_view_host() ==
105 specific_source.ptr()) { 113 specific_source.ptr()) {
106 UpdateKeyboardAndLayout(*Details<const bool>(details).ptr()); 114 UpdateKeyboardAndLayout(*Details<const bool>(details).ptr());
107 break; 115 break;
108 } 116 }
109 } 117 }
110 } else if (type == NotificationType::NAV_ENTRY_COMMITTED) { 118 } else if (type == NotificationType::NAV_ENTRY_COMMITTED) {
111 Browser* source_browser = Browser::GetBrowserForController( 119 Browser* source_browser = Browser::GetBrowserForController(
112 Source<NavigationController>(source).ptr(), NULL); 120 Source<NavigationController>(source).ptr(), NULL);
113 // If the Browser for the keyboard has navigated, hide the keyboard. 121 // If the Browser for the keyboard has navigated, hide the keyboard.
114 if (source_browser == browser) { 122 if (source_browser == browser) {
115 UpdateKeyboardAndLayout(false); 123 UpdateKeyboardAndLayout(false);
116 } 124 }
117 } 125 }
118 } 126 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/touch/frame/touch_browser_frame_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698