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 "view_manager/public/cpp/view.h" | 5 #include "view_manager/public/cpp/view.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
| 8 #include <string> |
8 | 9 |
9 #include "mojo/public/cpp/application/service_provider_impl.h" | 10 #include "mojo/public/cpp/application/service_provider_impl.h" |
10 #include "view_manager/public/cpp/lib/view_manager_client_impl.h" | 11 #include "view_manager/public/cpp/lib/view_manager_client_impl.h" |
11 #include "view_manager/public/cpp/lib/view_private.h" | 12 #include "view_manager/public/cpp/lib/view_private.h" |
12 #include "view_manager/public/cpp/view_observer.h" | 13 #include "view_manager/public/cpp/view_observer.h" |
13 #include "view_manager/public/cpp/view_tracker.h" | 14 #include "view_manager/public/cpp/view_tracker.h" |
14 | 15 |
15 namespace mojo { | 16 namespace mojo { |
16 | 17 |
17 namespace { | 18 namespace { |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 // no change. | 241 // no change. |
241 return; | 242 return; |
242 } | 243 } |
243 | 244 |
244 if (value) { | 245 if (value) { |
245 properties_[name] = *value; | 246 properties_[name] = *value; |
246 } else if (it != properties_.end()) { | 247 } else if (it != properties_.end()) { |
247 properties_.erase(it); | 248 properties_.erase(it); |
248 } | 249 } |
249 | 250 |
| 251 // TODO: add test coverage of this (450303). |
| 252 if (manager_) { |
| 253 Array<uint8_t> transport_value; |
| 254 if (value) { |
| 255 transport_value.resize(value->size()); |
| 256 if (value->size()) |
| 257 memcpy(&transport_value.front(), &(value->front()), value->size()); |
| 258 } |
| 259 static_cast<ViewManagerClientImpl*>(manager_)->SetProperty( |
| 260 id_, name, transport_value.Pass()); |
| 261 } |
| 262 |
250 FOR_EACH_OBSERVER( | 263 FOR_EACH_OBSERVER( |
251 ViewObserver, observers_, | 264 ViewObserver, observers_, |
252 OnViewSharedPropertyChanged(this, name, old_value_ptr, value)); | 265 OnViewSharedPropertyChanged(this, name, old_value_ptr, value)); |
253 } | 266 } |
254 | 267 |
255 bool View::IsDrawn() const { | 268 bool View::IsDrawn() const { |
256 if (!visible_) | 269 if (!visible_) |
257 return false; | 270 return false; |
258 return parent_ ? parent_->IsDrawn() : drawn_; | 271 return parent_ ? parent_->IsDrawn() : drawn_; |
259 } | 272 } |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 void View::NotifyViewVisibilityChangedUp(View* target) { | 546 void View::NotifyViewVisibilityChangedUp(View* target) { |
534 // Start with the parent as we already notified |this| | 547 // Start with the parent as we already notified |this| |
535 // in NotifyViewVisibilityChangedDown. | 548 // in NotifyViewVisibilityChangedDown. |
536 for (View* view = parent(); view; view = view->parent()) { | 549 for (View* view = parent(); view; view = view->parent()) { |
537 bool ret = view->NotifyViewVisibilityChangedAtReceiver(target); | 550 bool ret = view->NotifyViewVisibilityChangedAtReceiver(target); |
538 DCHECK(ret); | 551 DCHECK(ret); |
539 } | 552 } |
540 } | 553 } |
541 | 554 |
542 } // namespace mojo | 555 } // namespace mojo |
OLD | NEW |