| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/services/public/cpp/view_manager/view.h" | 5 #include "mojo/services/public/cpp/view_manager/view.h" |
| 6 | 6 |
| 7 #include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h" | 7 #include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h" |
| 8 #include "mojo/services/public/cpp/view_manager/lib/view_private.h" | 8 #include "mojo/services/public/cpp/view_manager/lib/view_private.h" |
| 9 #include "mojo/services/public/cpp/view_manager/node.h" | 9 #include "mojo/services/public/cpp/view_manager/node.h" |
| 10 #include "mojo/services/public/cpp/view_manager/view_observer.h" | 10 #include "mojo/services/public/cpp/view_manager/view_observer.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 canvas.DrawColor(color); | 68 canvas.DrawColor(color); |
| 69 SetContents(skia::GetTopDevice(*canvas.sk_canvas())->accessBitmap(true)); | 69 SetContents(skia::GetTopDevice(*canvas.sk_canvas())->accessBitmap(true)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 View::View(ViewManager* manager) | 72 View::View(ViewManager* manager) |
| 73 : id_(static_cast<ViewManagerClientImpl*>(manager)->CreateView()), | 73 : id_(static_cast<ViewManagerClientImpl*>(manager)->CreateView()), |
| 74 node_(NULL), | 74 node_(NULL), |
| 75 manager_(manager) {} | 75 manager_(manager) {} |
| 76 | 76 |
| 77 View::View() | 77 View::View() |
| 78 : id_(-1), | 78 : id_(static_cast<Id>(-1)), |
| 79 node_(NULL), | 79 node_(NULL), |
| 80 manager_(NULL) {} | 80 manager_(NULL) {} |
| 81 | 81 |
| 82 View::~View() { | 82 View::~View() { |
| 83 ScopedDestructionNotifier notifier(this); | 83 ScopedDestructionNotifier notifier(this); |
| 84 // TODO(beng): It'd be better to do this via a destruction observer in the | 84 // TODO(beng): It'd be better to do this via a destruction observer in the |
| 85 // ViewManagerClientImpl. | 85 // ViewManagerClientImpl. |
| 86 if (manager_) | 86 if (manager_) |
| 87 static_cast<ViewManagerClientImpl*>(manager_)->RemoveView(id_); | 87 static_cast<ViewManagerClientImpl*>(manager_)->RemoveView(id_); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void View::LocalDestroy() { | 90 void View::LocalDestroy() { |
| 91 delete this; | 91 delete this; |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace view_manager | 94 } // namespace view_manager |
| 95 } // namespace mojo | 95 } // namespace mojo |
| OLD | NEW |