| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/view.h" | 5 #include "views/view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } | 209 } |
| 210 return false; | 210 return false; |
| 211 } | 211 } |
| 212 | 212 |
| 213 int View::GetIndexOf(const View* view) const { | 213 int View::GetIndexOf(const View* view) const { |
| 214 Views::const_iterator i(std::find(children_.begin(), children_.end(), view)); | 214 Views::const_iterator i(std::find(children_.begin(), children_.end(), view)); |
| 215 return i != children_.end() ? static_cast<int>(i - children_.begin()) : -1; | 215 return i != children_.end() ? static_cast<int>(i - children_.begin()) : -1; |
| 216 } | 216 } |
| 217 | 217 |
| 218 // TODO(beng): remove | 218 // TODO(beng): remove |
| 219 const Window* View::GetWindow() const { | |
| 220 const Widget* widget = GetWidget(); | |
| 221 return widget ? widget->GetContainingWindow() : NULL; | |
| 222 } | |
| 223 | |
| 224 // TODO(beng): remove | |
| 225 Window* View::GetWindow() { | |
| 226 return const_cast<Window*>(const_cast<const View*>(this)->GetWindow()); | |
| 227 } | |
| 228 | |
| 229 // TODO(beng): remove | |
| 230 bool View::ContainsNativeView(gfx::NativeView native_view) const { | 219 bool View::ContainsNativeView(gfx::NativeView native_view) const { |
| 231 for (int i = 0, count = child_count(); i < count; ++i) { | 220 for (int i = 0, count = child_count(); i < count; ++i) { |
| 232 if (GetChildViewAt(i)->ContainsNativeView(native_view)) | 221 if (GetChildViewAt(i)->ContainsNativeView(native_view)) |
| 233 return true; | 222 return true; |
| 234 } | 223 } |
| 235 return false; | 224 return false; |
| 236 } | 225 } |
| 237 | 226 |
| 238 // Size and disposition -------------------------------------------------------- | 227 // Size and disposition -------------------------------------------------------- |
| 239 | 228 |
| (...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1906 result.append(GetChildViewAt(i)->PrintViewGraph(false)); | 1895 result.append(GetChildViewAt(i)->PrintViewGraph(false)); |
| 1907 | 1896 |
| 1908 if (first) | 1897 if (first) |
| 1909 result.append("}\n"); | 1898 result.append("}\n"); |
| 1910 | 1899 |
| 1911 return result; | 1900 return result; |
| 1912 } | 1901 } |
| 1913 #endif | 1902 #endif |
| 1914 | 1903 |
| 1915 } // namespace views | 1904 } // namespace views |
| OLD | NEW |