diff options
author | dtseng <dtseng@chromium.org> | 2015-02-19 12:32:21 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-19 20:33:02 +0000 |
commit | 54f3ac325c1d7ea298db1bd2ac36b3795f17a00b (patch) | |
tree | ff3cbeab91acd25eaf47364b87641be88edcddbe /ui/views | |
parent | 4a1511ef45627b827c47a34a65aee06028d71d3a (diff) | |
download | chromium_src-54f3ac325c1d7ea298db1bd2ac36b3795f17a00b.zip chromium_src-54f3ac325c1d7ea298db1bd2ac36b3795f17a00b.tar.gz chromium_src-54f3ac325c1d7ea298db1bd2ac36b3795f17a00b.tar.bz2 |
Reland #5: Ensure WebView notifies desktop automation on creation,
Previous attempts:
https://codereview.chromium.org/880063002
https://codereview.chromium.org/895623003/
https://codereview.chromium.org/890013006/
https://codereview.chromium.org/907973004/
https://codereview.chromium.org/940763002/
Marks all flakey tests as MANUAL. The tests appear to be taking longer than the timeout on buildbots.
BUG=460150
TBR=dmazzoni@chromium.org
Review URL: https://codereview.chromium.org/943693002
Cr-Commit-Position: refs/heads/master@{#317127}
Diffstat (limited to 'ui/views')
-rw-r--r-- | ui/views/accessibility/ax_aura_obj_cache.cc | 3 | ||||
-rw-r--r-- | ui/views/accessibility/ax_aura_obj_cache.h | 6 | ||||
-rw-r--r-- | ui/views/accessibility/ax_widget_obj_wrapper.cc | 6 | ||||
-rw-r--r-- | ui/views/controls/webview/webview.cc | 25 | ||||
-rw-r--r-- | ui/views/controls/webview/webview.h | 2 |
5 files changed, 28 insertions, 14 deletions
diff --git a/ui/views/accessibility/ax_aura_obj_cache.cc b/ui/views/accessibility/ax_aura_obj_cache.cc index ae2df20..05f1868 100644 --- a/ui/views/accessibility/ax_aura_obj_cache.cc +++ b/ui/views/accessibility/ax_aura_obj_cache.cc @@ -76,10 +76,11 @@ void AXAuraObjCache::Remove(int32 id) { delete obj; } -AXAuraObjCache::AXAuraObjCache() : current_id_(1) { +AXAuraObjCache::AXAuraObjCache() : current_id_(1), is_destroying_(false) { } AXAuraObjCache::~AXAuraObjCache() { + is_destroying_ = true; STLDeleteContainerPairSecondPointers(cache_.begin(), cache_.end()); cache_.clear(); } diff --git a/ui/views/accessibility/ax_aura_obj_cache.h b/ui/views/accessibility/ax_aura_obj_cache.h index 6e5d9e8..a8316b5 100644 --- a/ui/views/accessibility/ax_aura_obj_cache.h +++ b/ui/views/accessibility/ax_aura_obj_cache.h @@ -52,6 +52,9 @@ class VIEWS_EXPORT AXAuraObjCache { // Remove a cached entry based on an id. void Remove(int32 id); + // Indicates if this object's currently being destroyed. + bool is_destroying() { return is_destroying_; } + private: friend struct DefaultSingletonTraits<AXAuraObjCache>; @@ -75,6 +78,9 @@ class VIEWS_EXPORT AXAuraObjCache { std::map<int32, AXAuraObjWrapper*> cache_; int32 current_id_; + // True immediately when entering this object's destructor. + bool is_destroying_; + DISALLOW_COPY_AND_ASSIGN(AXAuraObjCache); }; diff --git a/ui/views/accessibility/ax_widget_obj_wrapper.cc b/ui/views/accessibility/ax_widget_obj_wrapper.cc index 36a3143..44fcfa8 100644 --- a/ui/views/accessibility/ax_widget_obj_wrapper.cc +++ b/ui/views/accessibility/ax_widget_obj_wrapper.cc @@ -17,8 +17,10 @@ AXWidgetObjWrapper::AXWidgetObjWrapper(Widget* widget) : widget_(widget) { } AXWidgetObjWrapper::~AXWidgetObjWrapper() { - widget_->RemoveObserver(this); - widget_->RemoveRemovalsObserver(this); + if (!AXAuraObjCache::GetInstance()->is_destroying()) { + widget_->RemoveObserver(this); + widget_->RemoveRemovalsObserver(this); + } widget_ = NULL; } diff --git a/ui/views/controls/webview/webview.cc b/ui/views/controls/webview/webview.cc index 2e4ba84..e872a58 100644 --- a/ui/views/controls/webview/webview.cc +++ b/ui/views/controls/webview/webview.cc @@ -78,7 +78,7 @@ void WebView::SetWebContents(content::WebContents* replacement) { DCHECK(!is_embedding_fullscreen_widget_); } AttachWebContents(); - NotifyMaybeTextInputClientChanged(); + NotifyMaybeTextInputClientAndAccessibilityChanged(); } void WebView::SetEmbedFullscreenWidgetMode(bool enable) { @@ -266,7 +266,7 @@ gfx::Size WebView::GetPreferredSize() const { void WebView::RenderProcessExited(content::RenderProcessHost* host, base::TerminationStatus status, int exit_code) { - NotifyMaybeTextInputClientChanged(); + NotifyMaybeTextInputClientAndAccessibilityChanged(); } void WebView::RenderProcessHostDestroyed(content::RenderProcessHost* host) { @@ -293,11 +293,11 @@ bool WebView::EmbedsFullscreenWidget() const { // WebView, content::WebContentsObserver implementation: void WebView::RenderViewReady() { - NotifyMaybeTextInputClientChanged(); + NotifyMaybeTextInputClientAndAccessibilityChanged(); } void WebView::RenderViewDeleted(content::RenderViewHost* render_view_host) { - NotifyMaybeTextInputClientChanged(); + NotifyMaybeTextInputClientAndAccessibilityChanged(); } void WebView::RenderViewHostChanged(content::RenderViewHost* old_host, @@ -305,7 +305,7 @@ void WebView::RenderViewHostChanged(content::RenderViewHost* old_host, FocusManager* const focus_manager = GetFocusManager(); if (focus_manager && focus_manager->GetFocusedView() == this) OnFocus(); - NotifyMaybeTextInputClientChanged(); + NotifyMaybeTextInputClientAndAccessibilityChanged(); } void WebView::WebContentsDestroyed() { @@ -313,7 +313,7 @@ void WebView::WebContentsDestroyed() { observing_render_process_host_->RemoveObserver(this); observing_render_process_host_ = nullptr; } - NotifyMaybeTextInputClientChanged(); + NotifyMaybeTextInputClientAndAccessibilityChanged(); } void WebView::DidShowFullscreenWidget(int routing_id) { @@ -332,11 +332,11 @@ void WebView::DidToggleFullscreenModeForTab(bool entered_fullscreen) { } void WebView::DidAttachInterstitialPage() { - NotifyMaybeTextInputClientChanged(); + NotifyMaybeTextInputClientAndAccessibilityChanged(); } void WebView::DidDetachInterstitialPage() { - NotifyMaybeTextInputClientChanged(); + NotifyMaybeTextInputClientAndAccessibilityChanged(); } //////////////////////////////////////////////////////////////////////////////// @@ -398,14 +398,19 @@ void WebView::ReattachForFullscreenChange(bool enter_fullscreen) { // the same. So, do not change attachment. OnBoundsChanged(bounds()); } - NotifyMaybeTextInputClientChanged(); + NotifyMaybeTextInputClientAndAccessibilityChanged(); } -void WebView::NotifyMaybeTextInputClientChanged() { +void WebView::NotifyMaybeTextInputClientAndAccessibilityChanged() { // Update the TextInputClient as needed; see GetTextInputClient(). FocusManager* const focus_manager = GetFocusManager(); if (focus_manager) focus_manager->OnTextInputClientChanged(this); + +#if defined(OS_CHROMEOS) + if (web_contents()) + NotifyAccessibilityEvent(ui::AX_EVENT_CHILDREN_CHANGED, false); +#endif // defined OS_CHROMEOS } content::WebContents* WebView::CreateWebContents( diff --git a/ui/views/controls/webview/webview.h b/ui/views/controls/webview/webview.h index af64b72..f97449b 100644 --- a/ui/views/controls/webview/webview.h +++ b/ui/views/controls/webview/webview.h @@ -149,7 +149,7 @@ class WEBVIEW_EXPORT WebView : public View, void AttachWebContents(); void DetachWebContents(); void ReattachForFullscreenChange(bool enter_fullscreen); - void NotifyMaybeTextInputClientChanged(); + void NotifyMaybeTextInputClientAndAccessibilityChanged(); // Create a regular or test web contents (based on whether we're running // in a unit test or not). |