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

Unified Diff: mojo/public/cpp/application/lazy_interface_ptr.h

Issue 537843002: Expose NavigatorHost via Embed() rather than globally. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@viewman3
Patch Set: darments Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/examples/window_manager/window_manager.cc ('k') | mojo/services/html_viewer/html_document_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/application/lazy_interface_ptr.h
diff --git a/mojo/public/cpp/application/lazy_interface_ptr.h b/mojo/public/cpp/application/lazy_interface_ptr.h
index 62d0ae9f6ee32d414ec63ce69f9b4362b5dd682b..908ea0854b83ea12541fbfc9b37983f9bb1b6bb9 100644
--- a/mojo/public/cpp/application/lazy_interface_ptr.h
+++ b/mojo/public/cpp/application/lazy_interface_ptr.h
@@ -13,12 +13,21 @@
namespace mojo {
template<typename Interface>
-class LazyInterfacePtr : InterfacePtr<Interface> {
+class LazyInterfacePtr : public InterfacePtr<Interface> {
public:
+ LazyInterfacePtr() : service_provider_(NULL) {}
+
LazyInterfacePtr(ServiceProvider* service_provider)
: service_provider_(service_provider) {
}
+ void set_service_provider(ServiceProvider* service_provider) {
+ if (service_provider != service_provider_) {
+ InterfacePtr<Interface>::reset();
+ }
+ service_provider_ = service_provider;
+ }
+
Interface* get() const {
if (!InterfacePtr<Interface>::get()) {
mojo::ConnectToService<Interface>(
« no previous file with comments | « mojo/examples/window_manager/window_manager.cc ('k') | mojo/services/html_viewer/html_document_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698