OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 void NativeAddReference() override { native_ref_count_++; } | 31 void NativeAddReference() override { native_ref_count_++; } |
32 | 32 |
33 void NativeReleaseReference() override { | 33 void NativeReleaseReference() override { |
34 native_ref_count_--; | 34 native_ref_count_--; |
35 if (native_ref_count_ == 0) | 35 if (native_ref_count_ == 0) |
36 delete this; | 36 delete this; |
37 } | 37 } |
38 | 38 |
39 int native_ref_count_; | 39 int native_ref_count_; |
40 static int global_obj_count_; | 40 static int global_obj_count_; |
41 | |
42 #if defined(OS_WIN) | |
43 // Adds some padding to prevent a heap-buffer-overflow when an instance of | |
44 // this class is casted into a BrowserAccessibilityWin pointer. | |
45 // http://crbug.com/235508 | |
46 // TODO(dmazzoni): Fix this properly. | |
47 static const size_t kDataSize = sizeof(int) + sizeof(BrowserAccessibility); | |
48 uint8_t padding_[sizeof(BrowserAccessibilityWin) - kDataSize]; | |
49 #endif | |
50 }; | 41 }; |
51 | 42 |
52 int CountedBrowserAccessibility::global_obj_count_ = 0; | 43 int CountedBrowserAccessibility::global_obj_count_ = 0; |
53 | 44 |
54 // Factory that creates a CountedBrowserAccessibility. | 45 // Factory that creates a CountedBrowserAccessibility. |
55 class CountedBrowserAccessibilityFactory | 46 class CountedBrowserAccessibilityFactory |
56 : public BrowserAccessibilityFactory { | 47 : public BrowserAccessibilityFactory { |
57 public: | 48 public: |
58 ~CountedBrowserAccessibilityFactory() override {} | 49 ~CountedBrowserAccessibilityFactory() override {} |
59 BrowserAccessibility* Create() override { | 50 BrowserAccessibility* Create() override { |
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 events2[0].event_type = ui::AX_EVENT_NONE; | 1593 events2[0].event_type = ui::AX_EVENT_NONE; |
1603 manager->OnAccessibilityEvents(events2); | 1594 manager->OnAccessibilityEvents(events2); |
1604 | 1595 |
1605 // Make sure that the focused node was updated to the new root and | 1596 // Make sure that the focused node was updated to the new root and |
1606 // that this doesn't crash. | 1597 // that this doesn't crash. |
1607 ASSERT_EQ(3, manager->GetRoot()->GetId()); | 1598 ASSERT_EQ(3, manager->GetRoot()->GetId()); |
1608 ASSERT_EQ(3, manager->GetFocus()->GetId()); | 1599 ASSERT_EQ(3, manager->GetFocus()->GetId()); |
1609 } | 1600 } |
1610 | 1601 |
1611 } // namespace content | 1602 } // namespace content |
OLD | NEW |