Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: services/ui/public/cpp/window.cc

Issue 2511883006: Mojo C++ bindings: switch services/ui/public/interfaces mojom target to use STL types. (Closed)
Patch Set: . Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "services/ui/public/cpp/window.h" 5 #include "services/ui/public/cpp/window.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 display_id_(display::Display::kInvalidDisplayID), 602 display_id_(display::Display::kInvalidDisplayID),
603 cursor_id_(mojom::Cursor::CURSOR_NULL), 603 cursor_id_(mojom::Cursor::CURSOR_NULL),
604 parent_drawn_(false) {} 604 parent_drawn_(false) {}
605 605
606 void Window::SetSharedPropertyInternal(const std::string& name, 606 void Window::SetSharedPropertyInternal(const std::string& name,
607 const std::vector<uint8_t>* value) { 607 const std::vector<uint8_t>* value) {
608 if (!WasCreatedByThisClientOrIsRoot(this)) 608 if (!WasCreatedByThisClientOrIsRoot(this))
609 return; 609 return;
610 610
611 if (client_) { 611 if (client_) {
612 mojo::Array<uint8_t> transport_value(nullptr); 612 base::Optional<std::vector<uint8_t>> transport_value;
613 if (value) { 613 if (value) {
614 transport_value.resize(value->size()); 614 transport_value.emplace(value->size());
615 if (value->size()) 615 if (value->size())
616 memcpy(&transport_value.front(), &(value->front()), value->size()); 616 memcpy(&transport_value.value().front(), &(value->front()),
617 value->size());
617 } 618 }
618 // TODO: add test coverage of this (450303). 619 // TODO: add test coverage of this (450303).
619 client_->SetProperty(this, name, std::move(transport_value)); 620 client_->SetProperty(this, name, std::move(transport_value));
620 } 621 }
621 LocalSetSharedProperty(name, value); 622 LocalSetSharedProperty(name, value);
622 } 623 }
623 624
624 int64_t Window::SetLocalPropertyInternal(const void* key, 625 int64_t Window::SetLocalPropertyInternal(const void* key,
625 const char* name, 626 const char* name,
626 PropertyDeallocator deallocator, 627 PropertyDeallocator deallocator,
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 notifier->NotifyWindowReordered(); 964 notifier->NotifyWindowReordered();
964 965
965 return true; 966 return true;
966 } 967 }
967 968
968 // static 969 // static
969 Window** Window::GetStackingTarget(Window* window) { 970 Window** Window::GetStackingTarget(Window* window) {
970 return &window->stacking_target_; 971 return &window->stacking_target_;
971 } 972 }
972 } // namespace ui 973 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/public/cpp/tests/window_tree_client_unittest.cc ('k') | services/ui/public/cpp/window_tree_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698