| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 canvas.DrawColor(color); | 70 canvas.DrawColor(color); |
| 71 SetContents(skia::GetTopDevice(*canvas.sk_canvas())->accessBitmap(true)); | 71 SetContents(skia::GetTopDevice(*canvas.sk_canvas())->accessBitmap(true)); |
| 72 } | 72 } |
| 73 | 73 |
| 74 View::View(ViewManager* manager) | 74 View::View(ViewManager* manager) |
| 75 : id_(static_cast<ViewManagerClientImpl*>(manager)->CreateView()), | 75 : id_(static_cast<ViewManagerClientImpl*>(manager)->CreateView()), |
| 76 node_(NULL), | 76 node_(NULL), |
| 77 manager_(manager) {} | 77 manager_(manager) {} |
| 78 | 78 |
| 79 View::View() | 79 View::View() |
| 80 : id_(-1), | 80 : id_(static_cast<Id>(-1)), |
| 81 node_(NULL), | 81 node_(NULL), |
| 82 manager_(NULL) {} | 82 manager_(NULL) {} |
| 83 | 83 |
| 84 View::~View() { | 84 View::~View() { |
| 85 ScopedDestructionNotifier notifier(this); | 85 ScopedDestructionNotifier notifier(this); |
| 86 // TODO(beng): It'd be better to do this via a destruction observer in the | 86 // TODO(beng): It'd be better to do this via a destruction observer in the |
| 87 // ViewManagerClientImpl. | 87 // ViewManagerClientImpl. |
| 88 if (manager_) | 88 if (manager_) |
| 89 static_cast<ViewManagerClientImpl*>(manager_)->RemoveView(id_); | 89 static_cast<ViewManagerClientImpl*>(manager_)->RemoveView(id_); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void View::LocalDestroy() { | 92 void View::LocalDestroy() { |
| 93 delete this; | 93 delete this; |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace view_manager | 96 } // namespace view_manager |
| 97 } // namespace mojo | 97 } // namespace mojo |
| OLD | NEW |