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

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: Improved tests 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 ViewRegistry::~ViewRegistry() {} 60 ViewRegistry::~ViewRegistry() {}
61 61
62 void ViewRegistry::ConnectAssociates( 62 void ViewRegistry::ConnectAssociates(
63 mojo::ApplicationImpl* app_impl, 63 mojo::ApplicationImpl* app_impl,
64 const std::vector<std::string>& urls, 64 const std::vector<std::string>& urls,
65 const AssociateConnectionErrorCallback& connection_error_callback) { 65 const AssociateConnectionErrorCallback& connection_error_callback) {
66 associate_table_.ConnectAssociates(app_impl, this, urls, 66 associate_table_.ConnectAssociates(app_impl, this, urls,
67 connection_error_callback); 67 connection_error_callback);
68 } 68 }
69 69
70 // REGISTERING ASSOCIATES
71
72 void ViewRegistry::RegisterViewAssociate(
73 mojo::ui::ViewInspector* view_inspector,
74 mojo::ui::ViewAssociatePtr view_associate,
75 const std::string& url,
76 const AssociateConnectionErrorCallback& connection_error_callback) {
77 associate_table_.RegisterViewAssociate(
78 view_inspector, // q: is this the right place to get the view inspector??
79 view_associate.Pass());
80 }
81
70 // CREATE / DESTROY VIEWS 82 // CREATE / DESTROY VIEWS
71 83
72 void ViewRegistry::CreateView( 84 void ViewRegistry::CreateView(
73 mojo::InterfaceRequest<mojo::ui::View> view_request, 85 mojo::InterfaceRequest<mojo::ui::View> view_request,
74 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, 86 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request,
75 mojo::ui::ViewListenerPtr view_listener, 87 mojo::ui::ViewListenerPtr view_listener,
76 const mojo::String& label) { 88 const mojo::String& label) {
77 DCHECK(view_request.is_pending()); 89 DCHECK(view_request.is_pending());
78 DCHECK(view_owner_request.is_pending()); 90 DCHECK(view_owner_request.is_pending());
79 DCHECK(view_listener); 91 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); 779 auto it = views_by_token_.find(view_token_value);
768 return it != views_by_token_.end() ? it->second : nullptr; 780 return it != views_by_token_.end() ? it->second : nullptr;
769 } 781 }
770 782
771 ViewTreeState* ViewRegistry::FindViewTree(uint32_t view_tree_token_value) { 783 ViewTreeState* ViewRegistry::FindViewTree(uint32_t view_tree_token_value) {
772 auto it = view_trees_by_token_.find(view_tree_token_value); 784 auto it = view_trees_by_token_.find(view_tree_token_value);
773 return it != view_trees_by_token_.end() ? it->second : nullptr; 785 return it != view_trees_by_token_.end() ? it->second : nullptr;
774 } 786 }
775 787
776 } // namespace view_manager 788 } // namespace view_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698