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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 10962011: Allow tap gestures to open the IME on Android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 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
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 "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 #include "webkit/plugins/npapi/webplugin_impl.h" 197 #include "webkit/plugins/npapi/webplugin_impl.h"
198 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" 198 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h"
199 199
200 #if defined(OS_ANDROID) 200 #if defined(OS_ANDROID)
201 #include "content/common/android/device_info.h" 201 #include "content/common/android/device_info.h"
202 #include "content/renderer/android/address_detector.h" 202 #include "content/renderer/android/address_detector.h"
203 #include "content/renderer/android/content_detector.h" 203 #include "content/renderer/android/content_detector.h"
204 #include "content/renderer/android/email_detector.h" 204 #include "content/renderer/android/email_detector.h"
205 #include "content/renderer/android/phone_number_detector.h" 205 #include "content/renderer/android/phone_number_detector.h"
206 #include "content/renderer/media/stream_texture_factory_impl_android.h" 206 #include "content/renderer/media/stream_texture_factory_impl_android.h"
207 #include "third_party/WebKit/Source/WebKit/chromium/public/android/WebInputEvent Factory.h"
207 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h" 208 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h"
208 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFloatPoin t.h" 209 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFloatPoin t.h"
209 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFloatRect .h" 210 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFloatRect .h"
210 #include "ui/gfx/rect_f.h" 211 #include "ui/gfx/rect_f.h"
211 #include "webkit/media/android/webmediaplayer_android.h" 212 #include "webkit/media/android/webmediaplayer_android.h"
212 #include "webkit/media/android/webmediaplayer_manager_android.h" 213 #include "webkit/media/android/webmediaplayer_manager_android.h"
213 #elif defined(OS_WIN) 214 #elif defined(OS_WIN)
214 // TODO(port): these files are currently Windows only because they concern: 215 // TODO(port): these files are currently Windows only because they concern:
215 // * theming 216 // * theming
216 #include "ui/base/native_theme/native_theme_win.h" 217 #include "ui/base/native_theme/native_theme_win.h"
(...skipping 26 matching lines...) Expand all
243 using WebKit::WebElement; 244 using WebKit::WebElement;
244 using WebKit::WebExternalPopupMenu; 245 using WebKit::WebExternalPopupMenu;
245 using WebKit::WebExternalPopupMenuClient; 246 using WebKit::WebExternalPopupMenuClient;
246 using WebKit::WebFileChooserCompletion; 247 using WebKit::WebFileChooserCompletion;
247 using WebKit::WebFileSystem; 248 using WebKit::WebFileSystem;
248 using WebKit::WebFileSystemCallbacks; 249 using WebKit::WebFileSystemCallbacks;
249 using WebKit::WebFindOptions; 250 using WebKit::WebFindOptions;
250 using WebKit::WebFormControlElement; 251 using WebKit::WebFormControlElement;
251 using WebKit::WebFormElement; 252 using WebKit::WebFormElement;
252 using WebKit::WebFrame; 253 using WebKit::WebFrame;
254 using WebKit::WebGestureEvent;
253 using WebKit::WebGraphicsContext3D; 255 using WebKit::WebGraphicsContext3D;
254 using WebKit::WebHistoryItem; 256 using WebKit::WebHistoryItem;
255 using WebKit::WebHTTPBody; 257 using WebKit::WebHTTPBody;
256 using WebKit::WebIconURL; 258 using WebKit::WebIconURL;
257 using WebKit::WebImage; 259 using WebKit::WebImage;
258 using WebKit::WebInputElement; 260 using WebKit::WebInputElement;
261 using WebKit::WebInputEvent;
259 using WebKit::WebIntentRequest; 262 using WebKit::WebIntentRequest;
260 using WebKit::WebIntentServiceInfo; 263 using WebKit::WebIntentServiceInfo;
261 using WebKit::WebMediaPlayer; 264 using WebKit::WebMediaPlayer;
262 using WebKit::WebMediaPlayerAction; 265 using WebKit::WebMediaPlayerAction;
263 using WebKit::WebMediaPlayerClient; 266 using WebKit::WebMediaPlayerClient;
264 using WebKit::WebMouseEvent; 267 using WebKit::WebMouseEvent;
265 using WebKit::WebNavigationPolicy; 268 using WebKit::WebNavigationPolicy;
266 using WebKit::WebNavigationType; 269 using WebKit::WebNavigationType;
267 using WebKit::WebNode; 270 using WebKit::WebNode;
268 using WebKit::WebPageSerializer; 271 using WebKit::WebPageSerializer;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 331
329 #if defined(OS_ANDROID) 332 #if defined(OS_ANDROID)
330 using content::AddressDetector; 333 using content::AddressDetector;
331 using content::ContentDetector; 334 using content::ContentDetector;
332 using content::EmailDetector; 335 using content::EmailDetector;
333 using content::PhoneNumberDetector; 336 using content::PhoneNumberDetector;
334 using WebKit::WebContentDetectionResult; 337 using WebKit::WebContentDetectionResult;
335 using WebKit::WebFloatPoint; 338 using WebKit::WebFloatPoint;
336 using WebKit::WebFloatRect; 339 using WebKit::WebFloatRect;
337 using WebKit::WebHitTestResult; 340 using WebKit::WebHitTestResult;
341 using WebKit::WebInputEventFactory;
338 #endif 342 #endif
339 343
340 //----------------------------------------------------------------------------- 344 //-----------------------------------------------------------------------------
341 345
342 typedef std::map<WebKit::WebView*, RenderViewImpl*> ViewMap; 346 typedef std::map<WebKit::WebView*, RenderViewImpl*> ViewMap;
343 static base::LazyInstance<ViewMap> g_view_map = LAZY_INSTANCE_INITIALIZER; 347 static base::LazyInstance<ViewMap> g_view_map = LAZY_INSTANCE_INITIALIZER;
344 348
345 // Time, in seconds, we delay before sending content state changes (such as form 349 // Time, in seconds, we delay before sending content state changes (such as form
346 // state and scroll position) to the browser. We delay sending changes to avoid 350 // state and scroll position) to the browser. We delay sending changes to avoid
347 // spamming the browser. 351 // spamming the browser.
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 // seems safest to not execute the rest. 2064 // seems safest to not execute the rest.
2061 if (!frame->executeCommand(WebString::fromUTF8(it->name), 2065 if (!frame->executeCommand(WebString::fromUTF8(it->name),
2062 WebString::fromUTF8(it->value))) 2066 WebString::fromUTF8(it->value)))
2063 break; 2067 break;
2064 did_execute_command = true; 2068 did_execute_command = true;
2065 } 2069 }
2066 2070
2067 return did_execute_command; 2071 return did_execute_command;
2068 } 2072 }
2069 2073
2074 void RenderViewImpl::didHandleGestureEvent(const WebGestureEvent& event,
2075 bool eventSwallowed) {
jam 2012/09/20 18:01:22 nit: event_swallowed per style guide (also in head
olilan 2012/09/21 11:23:56 Done.
2076 #if defined(OS_ANDROID)
2077 if (event.type == WebInputEvent::GestureTap
2078 || event.type == WebInputEvent::GestureLongPress) {
jam 2012/09/20 18:01:22 nit: || should be on previous line per style guide
olilan 2012/09/21 11:23:56 Done.
2079 UpdateTextInputState(SHOW_IME_IF_NEEDED);
2080 }
2081 #endif
2082 }
2083
2070 WebKit::WebColorChooser* RenderViewImpl::createColorChooser( 2084 WebKit::WebColorChooser* RenderViewImpl::createColorChooser(
2071 WebKit::WebColorChooserClient* client, 2085 WebKit::WebColorChooserClient* client,
2072 const WebKit::WebColor& initial_color) { 2086 const WebKit::WebColor& initial_color) {
2073 RendererWebColorChooserImpl* color_chooser = 2087 RendererWebColorChooserImpl* color_chooser =
2074 new RendererWebColorChooserImpl(this, client); 2088 new RendererWebColorChooserImpl(this, client);
2075 color_chooser->Open(static_cast<SkColor>(initial_color)); 2089 color_chooser->Open(static_cast<SkColor>(initial_color));
2076 return color_chooser; 2090 return color_chooser;
2077 } 2091 }
2078 2092
2079 bool RenderViewImpl::runFileChooser( 2093 bool RenderViewImpl::runFileChooser(
(...skipping 3525 matching lines...) Expand 10 before | Expand all | Expand 10 after
5605 (*plugin_it)->SetWindowFocus(true); 5619 (*plugin_it)->SetWindowFocus(true);
5606 #endif 5620 #endif
5607 (*plugin_it)->SetContentAreaFocus(enable); 5621 (*plugin_it)->SetContentAreaFocus(enable);
5608 } 5622 }
5609 } 5623 }
5610 // Notify all Pepper plugins. 5624 // Notify all Pepper plugins.
5611 pepper_delegate_.OnSetFocus(enable); 5625 pepper_delegate_.OnSetFocus(enable);
5612 } 5626 }
5613 5627
5614 void RenderViewImpl::PpapiPluginFocusChanged() { 5628 void RenderViewImpl::PpapiPluginFocusChanged() {
5615 UpdateTextInputState(); 5629 UpdateTextInputState(DO_NOT_SHOW_IME);
5616 UpdateSelectionBounds(); 5630 UpdateSelectionBounds();
5617 } 5631 }
5618 5632
5619 void RenderViewImpl::PpapiPluginTextInputTypeChanged() { 5633 void RenderViewImpl::PpapiPluginTextInputTypeChanged() {
5620 UpdateTextInputState(); 5634 UpdateTextInputState(DO_NOT_SHOW_IME);
5621 if (renderer_accessibility_) 5635 if (renderer_accessibility_)
5622 renderer_accessibility_->FocusedNodeChanged(WebNode()); 5636 renderer_accessibility_->FocusedNodeChanged(WebNode());
5623 } 5637 }
5624 5638
5625 void RenderViewImpl::PpapiPluginCaretPositionChanged() { 5639 void RenderViewImpl::PpapiPluginCaretPositionChanged() {
5626 UpdateSelectionBounds(); 5640 UpdateSelectionBounds();
5627 } 5641 }
5628 5642
5629 bool RenderViewImpl::GetPpapiPluginCaretBounds(gfx::Rect* rect) { 5643 bool RenderViewImpl::GetPpapiPluginCaretBounds(gfx::Rect* rect) {
5630 if (!pepper_delegate_.IsPluginFocused()) 5644 if (!pepper_delegate_.IsPluginFocused())
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
6149 6163
6150 updating_frame_tree_ = true; 6164 updating_frame_tree_ = true;
6151 active_frame_id_map_.clear(); 6165 active_frame_id_map_.clear();
6152 6166
6153 target_process_id_ = process_id; 6167 target_process_id_ = process_id;
6154 target_routing_id_ = route_id; 6168 target_routing_id_ = route_id;
6155 CreateFrameTree(webview()->mainFrame(), frames); 6169 CreateFrameTree(webview()->mainFrame(), frames);
6156 6170
6157 updating_frame_tree_ = false; 6171 updating_frame_tree_ = false;
6158 } 6172 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698