| 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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
| 6 | 6 |
| 7 #include "ui/views/view.h" | 7 #include "ui/views/view.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 const View* GetHierarchyRoot(const View* view) { | 76 const View* GetHierarchyRoot(const View* view) { |
| 77 const View* root = view; | 77 const View* root = view; |
| 78 while (root && root->parent()) | 78 while (root && root->parent()) |
| 79 root = root->parent(); | 79 root = root->parent(); |
| 80 return root; | 80 return root; |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace | 83 } // namespace |
| 84 | 84 |
| 85 // static | 85 // static |
| 86 ViewsDelegate* ViewsDelegate::views_delegate = NULL; | |
| 87 | |
| 88 // static | |
| 89 const char View::kViewClassName[] = "View"; | 86 const char View::kViewClassName[] = "View"; |
| 90 | 87 |
| 91 //////////////////////////////////////////////////////////////////////////////// | 88 //////////////////////////////////////////////////////////////////////////////// |
| 92 // View, public: | 89 // View, public: |
| 93 | 90 |
| 94 // Creation and lifetime ------------------------------------------------------- | 91 // Creation and lifetime ------------------------------------------------------- |
| 95 | 92 |
| 96 View::View() | 93 View::View() |
| 97 : owned_by_client_(false), | 94 : owned_by_client_(false), |
| 98 id_(0), | 95 id_(0), |
| (...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 if (!native_view_accessibility_) | 1273 if (!native_view_accessibility_) |
| 1277 native_view_accessibility_ = NativeViewAccessibility::Create(this); | 1274 native_view_accessibility_ = NativeViewAccessibility::Create(this); |
| 1278 if (native_view_accessibility_) | 1275 if (native_view_accessibility_) |
| 1279 return native_view_accessibility_->GetNativeObject(); | 1276 return native_view_accessibility_->GetNativeObject(); |
| 1280 return NULL; | 1277 return NULL; |
| 1281 } | 1278 } |
| 1282 | 1279 |
| 1283 void View::NotifyAccessibilityEvent( | 1280 void View::NotifyAccessibilityEvent( |
| 1284 ui::AXEvent event_type, | 1281 ui::AXEvent event_type, |
| 1285 bool send_native_event) { | 1282 bool send_native_event) { |
| 1286 if (ViewsDelegate::views_delegate) | 1283 if (ViewsDelegate::GetInstance()) |
| 1287 ViewsDelegate::views_delegate->NotifyAccessibilityEvent(this, event_type); | 1284 ViewsDelegate::GetInstance()->NotifyAccessibilityEvent(this, event_type); |
| 1288 | 1285 |
| 1289 if (send_native_event && GetWidget()) { | 1286 if (send_native_event && GetWidget()) { |
| 1290 if (!native_view_accessibility_) | 1287 if (!native_view_accessibility_) |
| 1291 native_view_accessibility_ = NativeViewAccessibility::Create(this); | 1288 native_view_accessibility_ = NativeViewAccessibility::Create(this); |
| 1292 if (native_view_accessibility_) | 1289 if (native_view_accessibility_) |
| 1293 native_view_accessibility_->NotifyAccessibilityEvent(event_type); | 1290 native_view_accessibility_->NotifyAccessibilityEvent(event_type); |
| 1294 } | 1291 } |
| 1295 } | 1292 } |
| 1296 | 1293 |
| 1297 // Scrolling ------------------------------------------------------------------- | 1294 // Scrolling ------------------------------------------------------------------- |
| (...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2368 // Message the RootView to do the drag and drop. That way if we're removed | 2365 // Message the RootView to do the drag and drop. That way if we're removed |
| 2369 // the RootView can detect it and avoid calling us back. | 2366 // the RootView can detect it and avoid calling us back. |
| 2370 gfx::Point widget_location(event.location()); | 2367 gfx::Point widget_location(event.location()); |
| 2371 ConvertPointToWidget(this, &widget_location); | 2368 ConvertPointToWidget(this, &widget_location); |
| 2372 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2369 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
| 2373 // WARNING: we may have been deleted. | 2370 // WARNING: we may have been deleted. |
| 2374 return true; | 2371 return true; |
| 2375 } | 2372 } |
| 2376 | 2373 |
| 2377 } // namespace views | 2374 } // namespace views |
| OLD | NEW |