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

Side by Side Diff: chrome/renderer/render_widget.cc

Issue 660408: Revert 39670 which breaks suggestion popup... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 9 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/renderer/render_widget.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/renderer/render_widget.h" 5 #include "chrome/renderer/render_widget.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/gfx/point.h" 8 #include "base/gfx/point.h"
9 #include "base/gfx/size.h" 9 #include "base/gfx/size.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 closing_(false), 60 closing_(false),
61 ime_is_active_(false), 61 ime_is_active_(false),
62 ime_control_enable_ime_(true), 62 ime_control_enable_ime_(true),
63 ime_control_x_(-1), 63 ime_control_x_(-1),
64 ime_control_y_(-1), 64 ime_control_y_(-1),
65 ime_control_new_state_(false), 65 ime_control_new_state_(false),
66 ime_control_updated_(false), 66 ime_control_updated_(false),
67 ime_control_busy_(false), 67 ime_control_busy_(false),
68 activatable_(activatable), 68 activatable_(activatable),
69 pending_window_rect_count_(0), 69 pending_window_rect_count_(0),
70 suppress_next_char_events_(false), 70 suppress_next_char_events_(false) {
71 showing_popup_menu_(false),
72 popup_menu_owner_widget_(NULL) {
73 RenderProcess::current()->AddRefProcess(); 71 RenderProcess::current()->AddRefProcess();
74 DCHECK(render_thread_); 72 DCHECK(render_thread_);
75 } 73 }
76 74
77 RenderWidget::~RenderWidget() { 75 RenderWidget::~RenderWidget() {
78 DCHECK(!webwidget_) << "Leaking our WebWidget!"; 76 DCHECK(!webwidget_) << "Leaking our WebWidget!";
79 if (current_paint_buf_) { 77 if (current_paint_buf_) {
80 RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_); 78 RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_);
81 current_paint_buf_ = NULL; 79 current_paint_buf_ = NULL;
82 } 80 }
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 DidHandleKeyEvent(); 336 DidHandleKeyEvent();
339 } 337 }
340 338
341 void RenderWidget::OnMouseCaptureLost() { 339 void RenderWidget::OnMouseCaptureLost() {
342 if (webwidget_) 340 if (webwidget_)
343 webwidget_->mouseCaptureLost(); 341 webwidget_->mouseCaptureLost();
344 } 342 }
345 343
346 void RenderWidget::OnSetFocus(bool enable) { 344 void RenderWidget::OnSetFocus(bool enable) {
347 has_focus_ = enable; 345 has_focus_ = enable;
348 if (webwidget_) { 346 if (webwidget_)
349 // Suppress focus / blur event if this RenderView creates a popup 347 webwidget_->setFocus(enable);
350 // menu and the popup menu is showing.
351 // This is because the popup menu is a child of the RenderView and
352 // when user clicks select control to show popup, we should not
353 // consider this as focusing changes, so the focus / blur events
354 // after popup menu is showing should be suppressed. The flag
355 // will be reset once the popup menu is closed (see
356 // RenderWidget::PopupMenuClosed).
357 if (!showing_popup_menu_)
358 webwidget_->setFocus(enable);
359 }
360
361 if (enable) { 348 if (enable) {
362 // Force to retrieve the state of the focused widget to determine if we 349 // Force to retrieve the state of the focused widget to determine if we
363 // should activate IMEs next time when this process calls the UpdateIME() 350 // should activate IMEs next time when this process calls the UpdateIME()
364 // function. 351 // function.
365 ime_control_updated_ = true; 352 ime_control_updated_ = true;
366 ime_control_new_state_ = true; 353 ime_control_new_state_ = true;
367 } 354 }
368 } 355 }
369 356
370 void RenderWidget::ClearFocus() { 357 void RenderWidget::ClearFocus() {
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 MessageLoop::current()->PostTask(FROM_HERE, 613 MessageLoop::current()->PostTask(FROM_HERE,
627 NewRunnableMethod(this, &RenderWidget::ClearFocus)); 614 NewRunnableMethod(this, &RenderWidget::ClearFocus));
628 } 615 }
629 } 616 }
630 617
631 void RenderWidget::didBlur() { 618 void RenderWidget::didBlur() {
632 Send(new ViewHostMsg_Blur(routing_id_)); 619 Send(new ViewHostMsg_Blur(routing_id_));
633 } 620 }
634 621
635 void RenderWidget::DoDeferredClose() { 622 void RenderWidget::DoDeferredClose() {
636 if (popup_menu_owner_widget_.get()) {
637 popup_menu_owner_widget_->PopupMenuClosed();
638 popup_menu_owner_widget_ = NULL;
639 }
640
641 Send(new ViewHostMsg_Close(routing_id_)); 623 Send(new ViewHostMsg_Close(routing_id_));
642 } 624 }
643 625
644 void RenderWidget::closeWidgetSoon() { 626 void RenderWidget::closeWidgetSoon() {
645 // If a page calls window.close() twice, we'll end up here twice, but that's 627 // If a page calls window.close() twice, we'll end up here twice, but that's
646 // OK. It is safe to send multiple Close messages. 628 // OK. It is safe to send multiple Close messages.
647 629
648 // Ask the RenderWidgetHost to initiate close. We could be called from deep 630 // Ask the RenderWidgetHost to initiate close. We could be called from deep
649 // in Javascript. If we ask the RendwerWidgetHost to close now, the window 631 // in Javascript. If we ask the RendwerWidgetHost to close now, the window
650 // could be closed before the JS finishes executing. So instead, post a 632 // could be closed before the JS finishes executing. So instead, post a
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 860
879 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { 861 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) {
880 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); 862 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin();
881 i != plugin_window_moves_.end(); ++i) { 863 i != plugin_window_moves_.end(); ++i) {
882 if (i->window == window) { 864 if (i->window == window) {
883 plugin_window_moves_.erase(i); 865 plugin_window_moves_.erase(i);
884 break; 866 break;
885 } 867 }
886 } 868 }
887 } 869 }
888
889 void RenderWidget::SetPopupMenuOwnerWidget(RenderWidget* widget) {
890 popup_menu_owner_widget_ = widget;
891 }
892
893 void RenderWidget::PopupMenuClosed() {
894 showing_popup_menu_ = false;
895 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698