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

Side by Side Diff: services/ui/view_manager/view_layout_request.cc

Issue 1415493003: mozart: Initial commit of the view manager. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: applied review comments Created 5 years, 1 month 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/logging.h"
6 #include "services/ui/view_manager/view_layout_request.h"
7
8 namespace view_manager {
9
10 ViewLayoutRequest::ViewLayoutRequest(
11 mojo::ui::ViewLayoutParamsPtr layout_params)
12 : issued(false),
13 layout_params_(layout_params.Pass()),
14 was_dispatched_(false) {}
15
16 ViewLayoutRequest::~ViewLayoutRequest() {
17 if (!was_dispatched_)
18 DispatchLayoutInfo(nullptr);
19 }
20
21 void ViewLayoutRequest::AddCallback(const ViewLayoutCallback& callback) {
22 DCHECK(!was_dispatched_);
23 callbacks_.emplace_back(callback);
24 }
25
26 void ViewLayoutRequest::DispatchLayoutInfo(mojo::ui::ViewLayoutInfo* info) {
27 DCHECK(!was_dispatched_);
28 was_dispatched_ = true;
29 for (auto callback : callbacks_)
jamesr 2015/10/27 23:13:10 const auto&, you don't wanna copy the callback eve
jeffbrown 2015/10/28 01:37:29 Done.
30 callback.Run(info ? info->Clone() : nullptr);
31 }
32
33 } // namespace view_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698