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

Unified Diff: ui/views/accessibility/native_view_accessibility.cc

Issue 2718073003: Views a11y: Convert View's NativeViewAccessibility to a unique_ptr. (Closed)
Patch Set: Fix compile error. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/accessibility/native_view_accessibility.cc
diff --git a/ui/views/accessibility/native_view_accessibility.cc b/ui/views/accessibility/native_view_accessibility.cc
index 409ac5a80e802e46f6db09e2a8bbbb0cbce44b65..a362e75d45ac014c861fd1344fa1b2f6033a1ca0 100644
--- a/ui/views/accessibility/native_view_accessibility.cc
+++ b/ui/views/accessibility/native_view_accessibility.cc
@@ -4,6 +4,7 @@
#include "ui/views/accessibility/native_view_accessibility.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "ui/events/event_utils.h"
#include "ui/gfx/native_widget_types.h"
@@ -15,8 +16,10 @@ namespace views {
#if !defined(PLATFORM_HAS_NATIVE_VIEW_ACCESSIBILITY_IMPL)
// static
-NativeViewAccessibility* NativeViewAccessibility::Create(View* view) {
- return new NativeViewAccessibility(view);
+std::unique_ptr<NativeViewAccessibility> NativeViewAccessibility::Create(
+ View* view) {
+ return base::WrapUnique<NativeViewAccessibility>(
tapted 2017/02/28 06:29:12 nit: Comment here like // Use WrapUnique rather t
Patti Lor 2017/02/28 22:24:24 Done - sorry, I forgot :(
+ new NativeViewAccessibility(view));
}
#endif // !defined(PLATFORM_HAS_NATIVE_VIEW_ACCESSIBILITY_IMPL)
@@ -38,10 +41,6 @@ gfx::NativeViewAccessible NativeViewAccessibility::GetNativeObject() {
return ax_node_ ? ax_node_->GetNativeViewAccessible() : nullptr;
}
-void NativeViewAccessibility::Destroy() {
- delete this;
-}
-
void NativeViewAccessibility::NotifyAccessibilityEvent(ui::AXEvent event_type) {
if (ax_node_)
ax_node_->NotifyAccessibilityEvent(event_type);

Powered by Google App Engine
This is Rietveld 408576698