diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-09 20:21:11 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-09 20:21:11 +0000 |
commit | cfd727ff8ea3e853a5e2f7c39cd1902fac090ecb (patch) | |
tree | e4f752f4fa1c3985abe91af25e7918c90a59768f /chrome | |
parent | 9b341774ce43e4034ac4465997b31e7b15fa1928 (diff) | |
download | chromium_src-cfd727ff8ea3e853a5e2f7c39cd1902fac090ecb.zip chromium_src-cfd727ff8ea3e853a5e2f7c39cd1902fac090ecb.tar.gz chromium_src-cfd727ff8ea3e853a5e2f7c39cd1902fac090ecb.tar.bz2 |
The popup for autofill is now never activated, even when clicked.
This allows us to hide it when the page loses focus.
(doing that previously would have caused the popup to be hidden before the click in the popup was sent to the renderer).
Most of the file changes are just renaming focus_on_show to activatable.
TEST=Open a form and make an autofill popup. Focus another window, the popup should disappear. Ensure the autofill still work properly, and the combo-box as well.
BUG=3844,5830
Review URL: http://codereview.chromium.org/17455
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7823 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/render_view_host.cc | 5 | ||||
-rw-r--r-- | chrome/browser/render_view_host.h | 2 | ||||
-rw-r--r-- | chrome/browser/render_view_host_delegate.h | 6 | ||||
-rw-r--r-- | chrome/browser/render_widget_helper.cc | 4 | ||||
-rw-r--r-- | chrome/browser/render_widget_helper.h | 2 | ||||
-rw-r--r-- | chrome/browser/render_widget_host_view_win.cc | 6 | ||||
-rw-r--r-- | chrome/browser/render_widget_host_view_win.h | 11 | ||||
-rw-r--r-- | chrome/browser/resource_message_filter.cc | 4 | ||||
-rw-r--r-- | chrome/browser/resource_message_filter.h | 2 | ||||
-rw-r--r-- | chrome/browser/web_contents_view.cc | 5 | ||||
-rw-r--r-- | chrome/browser/web_contents_view.h | 5 | ||||
-rw-r--r-- | chrome/browser/web_contents_view_win.cc | 8 | ||||
-rw-r--r-- | chrome/browser/web_contents_view_win.h | 2 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 2 | ||||
-rw-r--r-- | chrome/renderer/mock_render_thread.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/mock_render_thread.h | 2 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 4 | ||||
-rw-r--r-- | chrome/renderer/render_view.h | 3 | ||||
-rw-r--r-- | chrome/renderer/render_widget.cc | 11 | ||||
-rw-r--r-- | chrome/renderer/render_widget.h | 8 |
20 files changed, 44 insertions, 50 deletions
diff --git a/chrome/browser/render_view_host.cc b/chrome/browser/render_view_host.cc index f3b8e2b..e20f489 100644 --- a/chrome/browser/render_view_host.cc +++ b/chrome/browser/render_view_host.cc @@ -737,11 +737,10 @@ void RenderViewHost::OnMsgCreateWindow(int route_id, view->CreateNewWindow(route_id, modal_dialog_event); } -void RenderViewHost::OnMsgCreateWidget(int route_id, - bool focus_on_show) { +void RenderViewHost::OnMsgCreateWidget(int route_id, bool activatable) { RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); if (view) - view->CreateNewWidget(route_id, focus_on_show); + view->CreateNewWidget(route_id, activatable); } void RenderViewHost::OnMsgShowView(int route_id, diff --git a/chrome/browser/render_view_host.h b/chrome/browser/render_view_host.h index 17d8f97..a3c8683 100644 --- a/chrome/browser/render_view_host.h +++ b/chrome/browser/render_view_host.h @@ -410,7 +410,7 @@ class RenderViewHost : public RenderWidgetHost { // IPC message handlers: void OnMsgCreateWindow(int route_id, HANDLE modal_dialog_event); - void OnMsgCreateWidget(int route_id, bool focus_on_show); + void OnMsgCreateWidget(int route_id, bool activatable); void OnMsgShowView(int route_id, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, diff --git a/chrome/browser/render_view_host_delegate.h b/chrome/browser/render_view_host_delegate.h index 4cb7dcc..35e8770 100644 --- a/chrome/browser/render_view_host_delegate.h +++ b/chrome/browser/render_view_host_delegate.h @@ -61,10 +61,8 @@ class RenderViewHostDelegate { // The page is trying to open a new widget (e.g. a select popup). The // widget should be created associated with the given route, but it should // not be shown yet. That should happen in response to ShowCreatedWidget. - // If |focus_on_show| is true, the focus is given to the widget when shown, - // otherwise the focus is not changed. - virtual void CreateNewWidget(int route_id, - bool focus_on_show) = 0; + // If |activatable| is false, the widget cannot be activated or get focus. + virtual void CreateNewWidget(int route_id, bool activatable) = 0; // Show a previously created page with the specified disposition and bounds. // The window is identified by the route_id passed to CreateNewWindow. diff --git a/chrome/browser/render_widget_helper.cc b/chrome/browser/render_widget_helper.cc index 0d76141..337f0dd 100644 --- a/chrome/browser/render_widget_helper.cc +++ b/chrome/browser/render_widget_helper.cc @@ -219,10 +219,10 @@ void RenderWidgetHelper::CreateNewWindow(int opener_id, } void RenderWidgetHelper::CreateNewWidget(int opener_id, - bool focus_on_show, + bool activatable, int* route_id) { *route_id = GetNextRoutingID(); - ViewHostMsg_CreateWidgetWithRoute msg(opener_id, *route_id, focus_on_show); + ViewHostMsg_CreateWidgetWithRoute msg(opener_id, *route_id, activatable); ui_loop_->PostTask(FROM_HERE, NewRunnableMethod( this, &RenderWidgetHelper::OnSimulateReceivedMessage, msg)); } diff --git a/chrome/browser/render_widget_helper.h b/chrome/browser/render_widget_helper.h index c09462a..70a09ba 100644 --- a/chrome/browser/render_widget_helper.h +++ b/chrome/browser/render_widget_helper.h @@ -113,7 +113,7 @@ class RenderWidgetHelper : void CreateNewWindow(int opener_id, bool user_gesture, int* route_id, HANDLE* modal_dialog_event, HANDLE render_process); - void CreateNewWidget(int opener_id, bool focus_on_show, int* route_id); + void CreateNewWidget(int opener_id, bool activatable, int* route_id); private: // A class used to proxy a paint message. PaintMsgProxy objects are created diff --git a/chrome/browser/render_widget_host_view_win.cc b/chrome/browser/render_widget_host_view_win.cc index 04ad8f5..779d942 100644 --- a/chrome/browser/render_widget_host_view_win.cc +++ b/chrome/browser/render_widget_host_view_win.cc @@ -76,7 +76,7 @@ RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) shutdown_factory_(this), parent_hwnd_(NULL), is_loading_(false), - focus_on_show_(true) { + activatable_(true) { render_widget_host_->set_view(this); renderer_accessible_ = CommandLine().HasSwitch(switches::kEnableRendererAccessibility); @@ -162,7 +162,7 @@ void RenderWidgetHostViewWin::ForwardMouseEventToRenderer(UINT message, render_widget_host_->ForwardMouseEvent(event); - if (event.type == WebInputEvent::MOUSE_DOWN) { + if (activatable_ && event.type == WebInputEvent::MOUSE_DOWN) { // This is a temporary workaround for bug 765011 to get focus when the // mouse is clicked. This happens after the mouse down event is sent to // the renderer because normally Windows does a WM_SETFOCUS after @@ -765,7 +765,7 @@ LRESULT RenderWidgetHostViewWin::OnWheelEvent(UINT message, WPARAM wparam, LRESULT RenderWidgetHostViewWin::OnMouseActivate(UINT, WPARAM, LPARAM, BOOL& handled) { - if (!focus_on_show_) + if (!activatable_) return MA_NOACTIVATE; HWND focus_window = GetFocus(); diff --git a/chrome/browser/render_widget_host_view_win.h b/chrome/browser/render_widget_host_view_win.h index df6457c..bbf6e63 100644 --- a/chrome/browser/render_widget_host_view_win.h +++ b/chrome/browser/render_widget_host_view_win.h @@ -65,10 +65,10 @@ class RenderWidgetHostViewWin : close_on_deactivate_ = close_on_deactivate; } - void set_focus_on_show(bool focus) { - focus_on_show_ = focus; + void set_activatable(bool activatable) { + activatable_ = activatable; } - bool focus_on_show() const { return focus_on_show_; } + bool activatable() const { return activatable_; } void set_parent_hwnd(HWND parent) { parent_hwnd_ = parent; } @@ -263,8 +263,9 @@ class RenderWidgetHostViewWin : // value returns true for is_null() if we are not recording whiteout times. base::TimeTicks whiteout_start_time_; - // Whether the window should get focus when shown. Default is true. - bool focus_on_show_; + // Whether the window can be activated. Autocomplete popup windows for example + // cannot be activated. Default is true. + bool activatable_; // Whether the renderer is made accessible. // TODO(jcampan): http://b/issue?id=1432077 This is a temporary work-around diff --git a/chrome/browser/resource_message_filter.cc b/chrome/browser/resource_message_filter.cc index 76b7fe4..c15f4c1 100644 --- a/chrome/browser/resource_message_filter.cc +++ b/chrome/browser/resource_message_filter.cc @@ -236,9 +236,9 @@ void ResourceMessageFilter::OnMsgCreateWindow(int opener_id, } void ResourceMessageFilter::OnMsgCreateWidget(int opener_id, - bool focus_on_show, + bool activatable, int* route_id) { - render_widget_helper_->CreateNewWidget(opener_id, focus_on_show, route_id); + render_widget_helper_->CreateNewWidget(opener_id, activatable, route_id); } void ResourceMessageFilter::OnRequestResource( diff --git a/chrome/browser/resource_message_filter.h b/chrome/browser/resource_message_filter.h index e2d67ca..badf7b4 100644 --- a/chrome/browser/resource_message_filter.h +++ b/chrome/browser/resource_message_filter.h @@ -78,7 +78,7 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, private: void OnMsgCreateWindow(int opener_id, bool user_gesture, int* route_id, HANDLE* modal_dialog_event); - void OnMsgCreateWidget(int opener_id, bool focus_on_show, int* route_id); + void OnMsgCreateWidget(int opener_id, bool activatable, int* route_id); void OnRequestResource(const IPC::Message& msg, int request_id, const ViewHostMsg_Resource_Request& request); void OnCancelRequest(int request_id); diff --git a/chrome/browser/web_contents_view.cc b/chrome/browser/web_contents_view.cc index 6675474..3860fdf 100644 --- a/chrome/browser/web_contents_view.cc +++ b/chrome/browser/web_contents_view.cc @@ -22,11 +22,10 @@ void WebContentsView::CreateNewWindow(int route_id, HANDLE modal_dialog_event) { modal_dialog_event); } -void WebContentsView::CreateNewWidget(int route_id, - bool focus_on_show) { +void WebContentsView::CreateNewWidget(int route_id, bool activatable) { // Save the created widget associated with the route so we can show it later. pending_widget_views_[route_id] = CreateNewWidgetInternal(route_id, - focus_on_show); + activatable); } void WebContentsView::ShowCreatedWindow(int route_id, diff --git a/chrome/browser/web_contents_view.h b/chrome/browser/web_contents_view.h index 2bf1ac7..232b449 100644 --- a/chrome/browser/web_contents_view.h +++ b/chrome/browser/web_contents_view.h @@ -155,7 +155,7 @@ class WebContentsView : public RenderViewHostDelegate::View { virtual WebContents* CreateNewWindowInternal(int route_id, HANDLE modal_dialog_event) = 0; virtual RenderWidgetHostView* CreateNewWidgetInternal(int route_id, - bool focus_on_show) = 0; + bool activatable) = 0; virtual void ShowCreatedWindowInternal(WebContents* new_web_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, @@ -168,8 +168,7 @@ class WebContentsView : public RenderViewHostDelegate::View { // do some book-keeping associated with the request. The request is then // forwarded to *Internal which does platform-specific work. virtual void CreateNewWindow(int route_id, HANDLE modal_dialog_event); - virtual void CreateNewWidget(int route_id, - bool focus_on_show); + virtual void CreateNewWidget(int route_id, bool activatable); virtual void ShowCreatedWindow(int route_id, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, diff --git a/chrome/browser/web_contents_view_win.cc b/chrome/browser/web_contents_view_win.cc index dda346c..525ea4a 100644 --- a/chrome/browser/web_contents_view_win.cc +++ b/chrome/browser/web_contents_view_win.cc @@ -348,7 +348,7 @@ WebContents* WebContentsViewWin::CreateNewWindowInternal( RenderWidgetHostView* WebContentsViewWin::CreateNewWidgetInternal( int route_id, - bool focus_on_show) { + bool activatable) { // Create the widget and its associated view. // TODO(brettw) can widget creation be cross-platform? RenderWidgetHost* widget_host = @@ -364,7 +364,7 @@ RenderWidgetHostView* WebContentsViewWin::CreateNewWidgetInternal( widget_view->set_parent_hwnd( web_contents_->render_widget_host_view()->GetPluginHWND()); widget_view->set_close_on_deactivate(true); - widget_view->set_focus_on_show(focus_on_show); + widget_view->set_activatable(activatable); return widget_view; } @@ -409,8 +409,8 @@ void WebContentsViewWin::ShowCreatedWidgetInternal( widget_host_view_win->MoveWindow(initial_pos.x(), initial_pos.y(), initial_pos.width(), initial_pos.height(), TRUE); - widget_host_view_win->ShowWindow(widget_host_view_win->focus_on_show() ? - SW_SHOW : SW_SHOWNOACTIVATE); + widget_host_view_win->ShowWindow(widget_host_view_win->activatable() ? + SW_SHOW : SW_SHOWNA); widget_host->Init(); } diff --git a/chrome/browser/web_contents_view_win.h b/chrome/browser/web_contents_view_win.h index 0956bc2..604c462 100644 --- a/chrome/browser/web_contents_view_win.h +++ b/chrome/browser/web_contents_view_win.h @@ -50,7 +50,7 @@ class WebContentsViewWin : public WebContentsView, virtual WebContents* CreateNewWindowInternal( int route_id, HANDLE modal_dialog_event); virtual RenderWidgetHostView* CreateNewWidgetInternal(int route_id, - bool focus_on_show); + bool activatable); virtual void ShowCreatedWindowInternal(WebContents* new_web_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 38b92ae..44aa3cc 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -522,7 +522,7 @@ IPC_BEGIN_MESSAGES(ViewHost, 2) IPC_MESSAGE_ROUTED2(ViewHostMsg_CreateWidgetWithRoute, int /* route_id */, - bool /* focus on show */) + bool /* activatable */) // These two messages are sent to the parent RenderViewHost to display the // page/widget that was created by CreateView/CreateWidget. routing_id diff --git a/chrome/renderer/mock_render_thread.cc b/chrome/renderer/mock_render_thread.cc index 0f9db0d..a100a01 100644 --- a/chrome/renderer/mock_render_thread.cc +++ b/chrome/renderer/mock_render_thread.cc @@ -128,7 +128,7 @@ void MockRenderThread::OnMessageReceived(const IPC::Message& msg) { // The Widget expects to be returned valid route_id. void MockRenderThread::OnMsgCreateWidget(int opener_id, - bool focus_on_show, + bool activatable, int* route_id) { opener_id_ = opener_id; *route_id = routing_id_; diff --git a/chrome/renderer/mock_render_thread.h b/chrome/renderer/mock_render_thread.h index fc28517..5293461 100644 --- a/chrome/renderer/mock_render_thread.h +++ b/chrome/renderer/mock_render_thread.h @@ -94,7 +94,7 @@ class MockRenderThread : public RenderThreadBase { // The Widget expects to be returned valid route_id. void OnMsgCreateWidget(int opener_id, - bool focus_on_show, + bool activatable, int* route_id); // Routing id what will be assigned to the Widget. diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index c94e430..295e73a 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -1814,10 +1814,10 @@ WebView* RenderView::CreateWebView(WebView* webview, bool user_gesture) { } WebWidget* RenderView::CreatePopupWidget(WebView* webview, - bool focus_on_show) { + bool activatable) { RenderWidget* widget = RenderWidget::Create(routing_id_, render_thread_, - focus_on_show); + activatable); return widget->webwidget(); } diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index 23fd8b6..d60cd2c 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -204,8 +204,7 @@ class RenderView : public RenderWidget, bool is_redirect); virtual WebView* CreateWebView(WebView* webview, bool user_gesture); - virtual WebWidget* CreatePopupWidget(WebView* webview, - bool focus_on_show); + virtual WebWidget* CreatePopupWidget(WebView* webview, bool activatable); virtual WebPluginDelegate* CreatePluginDelegate( WebView* webview, const GURL& url, diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index a213c83..82a7fe7 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -69,8 +69,7 @@ DeferredCloses* DeferredCloses::current_ = NULL; /////////////////////////////////////////////////////////////////////////////// -RenderWidget::RenderWidget(RenderThreadBase* render_thread, - bool focus_on_show) +RenderWidget::RenderWidget(RenderThreadBase* render_thread, bool activatable) : routing_id_(MSG_ROUTING_NONE), opener_id_(MSG_ROUTING_NONE), render_thread_(render_thread), @@ -91,7 +90,7 @@ RenderWidget::RenderWidget(RenderThreadBase* render_thread, ime_control_new_state_(false), ime_control_updated_(false), ime_control_busy_(false), - focus_on_show_(focus_on_show) { + activatable_(activatable) { RenderProcess::AddRefProcess(); DCHECK(render_thread_); } @@ -111,10 +110,10 @@ RenderWidget::~RenderWidget() { /*static*/ RenderWidget* RenderWidget::Create(int32 opener_id, RenderThreadBase* render_thread, - bool focus_on_show) { + bool activatable) { DCHECK(opener_id != MSG_ROUTING_NONE); scoped_refptr<RenderWidget> widget = new RenderWidget(render_thread, - focus_on_show); + activatable); widget->Init(opener_id); // adds reference return widget; } @@ -130,7 +129,7 @@ void RenderWidget::Init(int32 opener_id) { webwidget_.swap(&webwidget); bool result = render_thread_->Send( - new ViewHostMsg_CreateWidget(opener_id, focus_on_show_, &routing_id_)); + new ViewHostMsg_CreateWidget(opener_id, activatable_, &routing_id_)); if (result) { render_thread_->AddRoute(routing_id_, this); // Take a reference on behalf of the RenderThread. This will be balanced diff --git a/chrome/renderer/render_widget.h b/chrome/renderer/render_widget.h index dfdb825..2ee001d 100644 --- a/chrome/renderer/render_widget.h +++ b/chrome/renderer/render_widget.h @@ -32,7 +32,7 @@ class RenderWidget : public IPC::Channel::Listener, // RenderThreadBase implementation, mostly commonly g_render_thread. static RenderWidget* Create(int32 opener_id, RenderThreadBase* render_thread, - bool focus_on_show); + bool activatable); // The routing ID assigned by the RenderProcess. Will be MSG_ROUTING_NONE if // not yet assigned a view ID, in which case, the process MUST NOT send @@ -89,7 +89,7 @@ class RenderWidget : public IPC::Channel::Listener, // without ref-counting is an error. friend class base::RefCounted<RenderWidget>; - RenderWidget(RenderThreadBase* render_thread, bool focus_on_show); + RenderWidget(RenderThreadBase* render_thread, bool activatable); virtual ~RenderWidget(); // Initializes this view with the given opener. CompleteInit must be called @@ -265,8 +265,8 @@ class RenderWidget : public IPC::Channel::Listener, bool ime_control_updated_; bool ime_control_busy_; - // Whether the window for this RenderWidget should be focused when shown. - bool focus_on_show_; + // Whether the window for this RenderWidget can be activated. + bool activatable_; // Holds all the needed plugin window moves for a scroll. std::vector<WebPluginGeometry> plugin_window_moves_; |