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

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

Issue 1949233002: Create a RegisterViewAssociate method in ViewManager (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: one more compile fix Created 4 years, 7 months 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 2015 The Chromium Authors. All rights reserved. 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 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/view_manager/view_registry.h" 5 #include "services/ui/view_manager/view_registry.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 if (overrides->view_layout) 52 if (overrides->view_layout)
53 value->view_layout = overrides->view_layout.Clone(); 53 value->view_layout = overrides->view_layout.Clone();
54 } 54 }
55 } // namespace 55 } // namespace
56 56
57 ViewRegistry::ViewRegistry(mojo::gfx::composition::CompositorPtr compositor) 57 ViewRegistry::ViewRegistry(mojo::gfx::composition::CompositorPtr compositor)
58 : compositor_(compositor.Pass()) {} 58 : compositor_(compositor.Pass()) {}
59 59
60 ViewRegistry::~ViewRegistry() {} 60 ViewRegistry::~ViewRegistry() {}
61 61
62 void ViewRegistry::ConnectAssociates( 62 // REGISTERING ASSOCIATES
63 mojo::ApplicationImpl* app_impl, 63
64 const std::vector<std::string>& urls, 64 void ViewRegistry::RegisterViewAssociate(
65 const AssociateConnectionErrorCallback& connection_error_callback) { 65 mojo::ui::ViewInspector* view_inspector,
66 associate_table_.ConnectAssociates(app_impl, this, urls, 66 mojo::ui::ViewAssociatePtr view_associate,
67 connection_error_callback); 67 mojo::InterfaceRequest<mojo::ui::ViewAssociateOwner> view_associate_owner,
68 const mojo::String& label) {
69 associate_table_.RegisterViewAssociate(view_inspector, view_associate.Pass(),
jeffbrown 2016/05/18 18:07:16 Please sanitize the label here before using it. S
mikejurka 2016/05/18 19:09:10 Done.
70 view_associate_owner.Pass(), label);
68 } 71 }
69 72
73 void ViewRegistry::FinishedRegisteringViewAssociates() {
74 associate_table_.FinishedRegisteringViewAssociates();
75 };
76
70 // CREATE / DESTROY VIEWS 77 // CREATE / DESTROY VIEWS
71 78
72 void ViewRegistry::CreateView( 79 void ViewRegistry::CreateView(
73 mojo::InterfaceRequest<mojo::ui::View> view_request, 80 mojo::InterfaceRequest<mojo::ui::View> view_request,
74 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, 81 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request,
75 mojo::ui::ViewListenerPtr view_listener, 82 mojo::ui::ViewListenerPtr view_listener,
76 const mojo::String& label) { 83 const mojo::String& label) {
77 DCHECK(view_request.is_pending()); 84 DCHECK(view_request.is_pending());
78 DCHECK(view_owner_request.is_pending()); 85 DCHECK(view_owner_request.is_pending());
79 DCHECK(view_listener); 86 DCHECK(view_listener);
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 auto it = views_by_token_.find(view_token_value); 774 auto it = views_by_token_.find(view_token_value);
768 return it != views_by_token_.end() ? it->second : nullptr; 775 return it != views_by_token_.end() ? it->second : nullptr;
769 } 776 }
770 777
771 ViewTreeState* ViewRegistry::FindViewTree(uint32_t view_tree_token_value) { 778 ViewTreeState* ViewRegistry::FindViewTree(uint32_t view_tree_token_value) {
772 auto it = view_trees_by_token_.find(view_tree_token_value); 779 auto it = view_trees_by_token_.find(view_tree_token_value);
773 return it != view_trees_by_token_.end() ? it->second : nullptr; 780 return it != view_trees_by_token_.end() ? it->second : nullptr;
774 } 781 }
775 782
776 } // namespace view_manager 783 } // namespace view_manager
OLDNEW
« services/ui/view_manager/view_associate_table.cc ('K') | « services/ui/view_manager/view_registry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698