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

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

Issue 6020013: Wrap the virtual keyboard in a container view. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: last patch was missing changes 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/touch/frame/touch_browser_frame_view.h ('k') | chrome/chrome_browser.gypi » ('j') | 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>
8
9 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/renderer_host/render_view_host.h" 8 #include "chrome/browser/renderer_host/render_view_host.h"
11 #include "chrome/browser/renderer_host/site_instance.h"
12 #include "chrome/browser/tab_contents/navigation_controller.h" 9 #include "chrome/browser/tab_contents/navigation_controller.h"
13 #include "chrome/browser/tab_contents/tab_contents.h" 10 #include "chrome/browser/tab_contents/tab_contents.h"
14 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/views/dom_view.h" 12 #include "chrome/browser/ui/touch/frame/keyboard_container_view.h"
16 #include "chrome/browser/ui/views/frame/browser_view.h" 13 #include "chrome/browser/ui/views/frame/browser_view.h"
17 #include "chrome/common/notification_service.h" 14 #include "chrome/common/notification_service.h"
18 #include "chrome/common/notification_type.h" 15 #include "chrome/common/notification_type.h"
19 #include "chrome/common/url_constants.h"
20 #include "gfx/rect.h" 16 #include "gfx/rect.h"
21 17
22 namespace { 18 namespace {
23 19
24 const int kKeyboardHeight = 300; 20 const int kKeyboardHeight = 300;
25 21
26 } // namespace 22 } // namespace
27 23
28 /////////////////////////////////////////////////////////////////////////////// 24 ///////////////////////////////////////////////////////////////////////////////
29 // TouchBrowserFrameView, public: 25 // TouchBrowserFrameView, public:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 return 0; 60 return 0;
65 } 61 }
66 62
67 /////////////////////////////////////////////////////////////////////////////// 63 ///////////////////////////////////////////////////////////////////////////////
68 // TouchBrowserFrameView, private: 64 // TouchBrowserFrameView, private:
69 65
70 void TouchBrowserFrameView::InitVirtualKeyboard() { 66 void TouchBrowserFrameView::InitVirtualKeyboard() {
71 if (keyboard_) 67 if (keyboard_)
72 return; 68 return;
73 69
74 keyboard_ = new DOMView;
75
76 Profile* keyboard_profile = browser_view()->browser()->profile(); 70 Profile* keyboard_profile = browser_view()->browser()->profile();
77 DCHECK(keyboard_profile) << "Profile required for virtual keyboard."; 71 DCHECK(keyboard_profile) << "Profile required for virtual keyboard.";
78 72
79 GURL keyboard_url(chrome::kChromeUIKeyboardURL); 73 keyboard_ = new KeyboardContainerView(keyboard_profile);
80 keyboard_->Init(keyboard_profile,
81 SiteInstance::CreateSiteInstanceForURL(keyboard_profile, keyboard_url));
82 keyboard_->LoadURL(keyboard_url);
83
84 keyboard_->SetVisible(false); 74 keyboard_->SetVisible(false);
85 AddChildView(keyboard_); 75 AddChildView(keyboard_);
86 } 76 }
87 77
88 void TouchBrowserFrameView::UpdateKeyboardAndLayout(bool should_show_keyboard) { 78 void TouchBrowserFrameView::UpdateKeyboardAndLayout(bool should_show_keyboard) {
89 if (should_show_keyboard) 79 if (should_show_keyboard)
90 InitVirtualKeyboard(); 80 InitVirtualKeyboard();
91 81
92 if (should_show_keyboard == keyboard_showing_) 82 if (should_show_keyboard == keyboard_showing_)
93 return; 83 return;
(...skipping 28 matching lines...) Expand all
122 Source<RenderViewHost>(source).ptr()) 112 Source<RenderViewHost>(source).ptr())
123 UpdateKeyboardAndLayout(*Details<const bool>(details).ptr()); 113 UpdateKeyboardAndLayout(*Details<const bool>(details).ptr());
124 } else if (type == NotificationType::NAV_ENTRY_COMMITTED) { 114 } else if (type == NotificationType::NAV_ENTRY_COMMITTED) {
125 Browser* source_browser = Browser::GetBrowserForController( 115 Browser* source_browser = Browser::GetBrowserForController(
126 Source<NavigationController>(source).ptr(), NULL); 116 Source<NavigationController>(source).ptr(), NULL);
127 // If the Browser for the keyboard has navigated, hide the keyboard. 117 // If the Browser for the keyboard has navigated, hide the keyboard.
128 if (source_browser == browser) 118 if (source_browser == browser)
129 UpdateKeyboardAndLayout(false); 119 UpdateKeyboardAndLayout(false);
130 } 120 }
131 } 121 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/touch/frame/touch_browser_frame_view.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698