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

Side by Side Diff: chrome/browser/ui/tab_contents/core_tab_helper.cc

Issue 89873002: Ensure that the OSK on Windows 8 shows up when we tap on an editable field in any WebContents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/tab_contents/core_tab_helper.h" 5 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 14 matching lines...) Expand all
25 #include "content/public/browser/render_view_host.h" 25 #include "content/public/browser/render_view_host.h"
26 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
27 #include "grit/generated_resources.h" 27 #include "grit/generated_resources.h"
28 #include "net/base/load_states.h" 28 #include "net/base/load_states.h"
29 #include "net/http/http_request_headers.h" 29 #include "net/http/http_request_headers.h"
30 #include "third_party/skia/include/core/SkBitmap.h" 30 #include "third_party/skia/include/core/SkBitmap.h"
31 #include "ui/base/l10n/l10n_util.h" 31 #include "ui/base/l10n/l10n_util.h"
32 #include "ui/gfx/codec/jpeg_codec.h" 32 #include "ui/gfx/codec/jpeg_codec.h"
33 33
34 #if defined(OS_WIN) 34 #if defined(OS_WIN)
35 #include "base/win/win_util.h" 35 #include "chrome/browser/ui/touch_web_contents_observer_win.h"
36 #endif 36 #endif
37 37
38 using content::WebContents; 38 using content::WebContents;
39 39
40 DEFINE_WEB_CONTENTS_USER_DATA_KEY(CoreTabHelper); 40 DEFINE_WEB_CONTENTS_USER_DATA_KEY(CoreTabHelper);
41 41
42 CoreTabHelper::CoreTabHelper(WebContents* web_contents) 42 CoreTabHelper::CoreTabHelper(WebContents* web_contents)
43 : content::WebContentsObserver(web_contents), 43 : content::WebContentsObserver(web_contents),
44 delegate_(NULL), 44 delegate_(NULL),
45 content_restrictions_(0) { 45 content_restrictions_(0) {
46 #if defined(OS_WIN)
47 TouchWebContentsObserver::CreateForWebContents(web_contents);
jam 2013/11/27 17:17:40 this should be created where CoreTabHelper gets cr
48 #endif
46 } 49 }
47 50
48 CoreTabHelper::~CoreTabHelper() { 51 CoreTabHelper::~CoreTabHelper() {
49 } 52 }
50 53
51 string16 CoreTabHelper::GetDefaultTitle() { 54 string16 CoreTabHelper::GetDefaultTitle() {
52 return l10n_util::GetStringUTF16(IDS_DEFAULT_TAB_TITLE); 55 return l10n_util::GetStringUTF16(IDS_DEFAULT_TAB_TITLE);
53 } 56 }
54 57
55 string16 CoreTabHelper::GetStatusText() const { 58 string16 CoreTabHelper::GetStatusText() const {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 before_unload_end_time_ = proceed_time; 191 before_unload_end_time_ = proceed_time;
189 } 192 }
190 193
191 void CoreTabHelper::BeforeUnloadDialogCancelled() { 194 void CoreTabHelper::BeforeUnloadDialogCancelled() {
192 OnCloseCanceled(); 195 OnCloseCanceled();
193 } 196 }
194 197
195 bool CoreTabHelper::OnMessageReceived(const IPC::Message& message) { 198 bool CoreTabHelper::OnMessageReceived(const IPC::Message& message) {
196 bool handled = true; 199 bool handled = true;
197 IPC_BEGIN_MESSAGE_MAP(CoreTabHelper, message) 200 IPC_BEGIN_MESSAGE_MAP(CoreTabHelper, message)
198 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FocusedNodeTouched,
199 OnFocusedNodeTouched)
200 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_RequestThumbnailForContextNode_ACK, 201 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_RequestThumbnailForContextNode_ACK,
201 OnRequestThumbnailForContextNodeACK) 202 OnRequestThumbnailForContextNodeACK)
202 IPC_MESSAGE_UNHANDLED(handled = false) 203 IPC_MESSAGE_UNHANDLED(handled = false)
203 IPC_END_MESSAGE_MAP() 204 IPC_END_MESSAGE_MAP()
204 return handled; 205 return handled;
205 } 206 }
206 207
207 void CoreTabHelper::OnFocusedNodeTouched(bool editable) {
208 #if defined(OS_WIN) && defined(USE_AURA)
209 if (editable) {
210 base::win::DisplayVirtualKeyboard();
211 } else {
212 base::win::DismissVirtualKeyboard();
213 }
214 #endif // OS_WIN && USE_AURA
215 }
216
217 // Handles the image thumbnail for the context node, composes a image search 208 // Handles the image thumbnail for the context node, composes a image search
218 // request based on the received thumbnail and opens the request in a new tab. 209 // request based on the received thumbnail and opens the request in a new tab.
219 void CoreTabHelper::OnRequestThumbnailForContextNodeACK( 210 void CoreTabHelper::OnRequestThumbnailForContextNodeACK(
220 const SkBitmap& bitmap, 211 const SkBitmap& bitmap,
221 const gfx::Size& original_size) { 212 const gfx::Size& original_size) {
222 if (bitmap.isNull()) 213 if (bitmap.isNull())
223 return; 214 return;
224 Profile* profile = 215 Profile* profile =
225 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 216 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
226 217
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 DCHECK(!content_type.empty()); 255 DCHECK(!content_type.empty());
265 open_url_params.uses_post = true; 256 open_url_params.uses_post = true;
266 open_url_params.browser_initiated_post_data = 257 open_url_params.browser_initiated_post_data =
267 base::RefCountedString::TakeString(post_data); 258 base::RefCountedString::TakeString(post_data);
268 open_url_params.extra_headers += base::StringPrintf( 259 open_url_params.extra_headers += base::StringPrintf(
269 "%s: %s\r\n", net::HttpRequestHeaders::kContentType, 260 "%s: %s\r\n", net::HttpRequestHeaders::kContentType,
270 content_type.c_str()); 261 content_type.c_str());
271 } 262 }
272 web_contents()->OpenURL(open_url_params); 263 web_contents()->OpenURL(open_url_params);
273 } 264 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698