Commit 28b82f54 authored by ben's avatar ben Committed by Commit bot

Get the omnibox to show up again. Sky's changes from yesterday removed the...

Get the omnibox to show up again. Sky's changes from yesterday removed the window manager interface. This is a temporary interface to allow the omnibox app to ask the browser app to place its window.

R=sadrul@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1135933003

Cr-Commit-Position: refs/heads/master@{#330241}
parent fb06a495
...@@ -71,5 +71,6 @@ source_set("kiosk_wm_lib") { ...@@ -71,5 +71,6 @@ source_set("kiosk_wm_lib") {
mojom("interfaces") { mojom("interfaces") {
sources = [ sources = [
"omnibox.mojom", "omnibox.mojom",
"view_embedder.mojom",
] ]
} }
...@@ -36,7 +36,7 @@ Browser::Browser() ...@@ -36,7 +36,7 @@ Browser::Browser()
omnibox_(nullptr), omnibox_(nullptr),
navigator_host_(this), navigator_host_(this),
ui_(nullptr) { ui_(nullptr) {
exposed_services_impl_.AddService(this); exposed_services_impl_.AddService<mojo::NavigatorHost>(this);
} }
Browser::~Browser() { Browser::~Browser() {
...@@ -72,6 +72,7 @@ bool Browser::ConfigureIncomingConnection( ...@@ -72,6 +72,7 @@ bool Browser::ConfigureIncomingConnection(
bool Browser::ConfigureOutgoingConnection( bool Browser::ConfigureOutgoingConnection(
mojo::ApplicationConnection* connection) { mojo::ApplicationConnection* connection) {
connection->AddService<ViewEmbedder>(this);
return true; return true;
} }
...@@ -122,24 +123,6 @@ void Browser::OpenURL(const mojo::String& url) { ...@@ -122,24 +123,6 @@ void Browser::OpenURL(const mojo::String& url) {
ReplaceContentWithURL(url); ReplaceContentWithURL(url);
} }
void Browser::Create(mojo::ApplicationConnection* connection,
mojo::InterfaceRequest<mojo::NavigatorHost> request) {
navigator_host_.Bind(request.Pass());
}
void Browser::ShowOmnibox(
const mojo::String& url,
mojo::InterfaceRequest<mojo::ServiceProvider> services,
mojo::ServiceProviderPtr exposed_services) {
if (!omnibox_) {
omnibox_ = root_->view_manager()->CreateView();
root_->AddChild(omnibox_);
omnibox_->SetVisible(true);
omnibox_->SetBounds(root_->bounds());
}
omnibox_->Embed(url, services.Pass(), exposed_services.Pass());
}
void Browser::Embed(const mojo::String& url, void Browser::Embed(const mojo::String& url,
mojo::InterfaceRequest<mojo::ServiceProvider> services, mojo::InterfaceRequest<mojo::ServiceProvider> services,
mojo::ServiceProviderPtr exposed_services) { mojo::ServiceProviderPtr exposed_services) {
...@@ -170,4 +153,27 @@ void Browser::Embed(const mojo::String& url, ...@@ -170,4 +153,27 @@ void Browser::Embed(const mojo::String& url,
navigator_host_.RecordNavigation(url); navigator_host_.RecordNavigation(url);
} }
void Browser::Create(mojo::ApplicationConnection* connection,
mojo::InterfaceRequest<mojo::NavigatorHost> request) {
navigator_host_.Bind(request.Pass());
}
void Browser::Create(mojo::ApplicationConnection* connection,
mojo::InterfaceRequest<ViewEmbedder> request) {
view_embedder_bindings_.AddBinding(this, request.Pass());
}
void Browser::ShowOmnibox(
const mojo::String& url,
mojo::InterfaceRequest<mojo::ServiceProvider> services,
mojo::ServiceProviderPtr exposed_services) {
if (!omnibox_) {
omnibox_ = root_->view_manager()->CreateView();
root_->AddChild(omnibox_);
omnibox_->SetVisible(true);
omnibox_->SetBounds(root_->bounds());
}
omnibox_->Embed(url, services.Pass(), exposed_services.Pass());
}
} // namespace mandoline } // namespace mandoline
...@@ -11,10 +11,12 @@ ...@@ -11,10 +11,12 @@
#include "mandoline/services/navigation/public/interfaces/navigation.mojom.h" #include "mandoline/services/navigation/public/interfaces/navigation.mojom.h"
#include "mandoline/ui/browser/navigator_host_impl.h" #include "mandoline/ui/browser/navigator_host_impl.h"
#include "mandoline/ui/browser/omnibox.mojom.h" #include "mandoline/ui/browser/omnibox.mojom.h"
#include "mandoline/ui/browser/view_embedder.mojom.h"
#include "mojo/application/public/cpp/application_delegate.h" #include "mojo/application/public/cpp/application_delegate.h"
#include "mojo/application/public/cpp/application_impl.h" #include "mojo/application/public/cpp/application_impl.h"
#include "mojo/application/public/cpp/connect.h" #include "mojo/application/public/cpp/connect.h"
#include "mojo/application/public/cpp/service_provider_impl.h" #include "mojo/application/public/cpp/service_provider_impl.h"
#include "mojo/common/weak_binding_set.h"
#include "ui/mojo/events/input_events.mojom.h" #include "ui/mojo/events/input_events.mojom.h"
#include "url/gurl.h" #include "url/gurl.h"
...@@ -31,7 +33,9 @@ class Browser : public mojo::ApplicationDelegate, ...@@ -31,7 +33,9 @@ class Browser : public mojo::ApplicationDelegate,
public mojo::ViewManagerDelegate, public mojo::ViewManagerDelegate,
public mojo::ViewManagerRootClient, public mojo::ViewManagerRootClient,
public OmniboxClient, public OmniboxClient,
public mojo::InterfaceFactory<mojo::NavigatorHost> { public ViewEmbedder,
public mojo::InterfaceFactory<mojo::NavigatorHost>,
public mojo::InterfaceFactory<ViewEmbedder> {
public: public:
Browser(); Browser();
~Browser() override; ~Browser() override;
...@@ -63,13 +67,18 @@ class Browser : public mojo::ApplicationDelegate, ...@@ -63,13 +67,18 @@ class Browser : public mojo::ApplicationDelegate,
// Overridden from OmniboxClient: // Overridden from OmniboxClient:
void OpenURL(const mojo::String& url) override; void OpenURL(const mojo::String& url) override;
// Overridden from ViewEmbedder:
void Embed(const mojo::String& url,
mojo::InterfaceRequest<mojo::ServiceProvider> services,
mojo::ServiceProviderPtr exposed_services) override;
// Overridden from mojo::InterfaceFactory<mojo::NavigatorHost>: // Overridden from mojo::InterfaceFactory<mojo::NavigatorHost>:
void Create(mojo::ApplicationConnection* connection, void Create(mojo::ApplicationConnection* connection,
mojo::InterfaceRequest<mojo::NavigatorHost> request) override; mojo::InterfaceRequest<mojo::NavigatorHost> request) override;
void Embed(const mojo::String& url, // Overridden from mojo::InterfaceFactory<ViewEmbedder>:
mojo::InterfaceRequest<mojo::ServiceProvider> services, void Create(mojo::ApplicationConnection* connection,
mojo::ServiceProviderPtr exposed_services); mojo::InterfaceRequest<ViewEmbedder> request) override;
void ShowOmnibox(const mojo::String& url, void ShowOmnibox(const mojo::String& url,
mojo::InterfaceRequest<mojo::ServiceProvider> services, mojo::InterfaceRequest<mojo::ServiceProvider> services,
...@@ -88,6 +97,8 @@ class Browser : public mojo::ApplicationDelegate, ...@@ -88,6 +97,8 @@ class Browser : public mojo::ApplicationDelegate,
mojo::ServiceProviderImpl exposed_services_impl_; mojo::ServiceProviderImpl exposed_services_impl_;
scoped_ptr<MergedServiceProvider> merged_service_provider_; scoped_ptr<MergedServiceProvider> merged_service_provider_;
mojo::WeakBindingSet<ViewEmbedder> view_embedder_bindings_;
NavigatorHostImpl navigator_host_; NavigatorHostImpl navigator_host_;
GURL current_url_; GURL current_url_;
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module mandoline;
import "mojo/application/public/interfaces/service_provider.mojom";
interface ViewEmbedder {
Embed(string url,
mojo.ServiceProvider&? services,
mojo.ServiceProvider? exposed_services);
};
...@@ -39,6 +39,7 @@ bool OmniboxImpl::ConfigureIncomingConnection( ...@@ -39,6 +39,7 @@ bool OmniboxImpl::ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) { mojo::ApplicationConnection* connection) {
connection->AddService<Omnibox>(this); connection->AddService<Omnibox>(this);
connection->AddService(view_manager_client_factory_.get()); connection->AddService(view_manager_client_factory_.get());
connection->ConnectToService(&view_embedder_);
return true; return true;
} }
...@@ -134,7 +135,8 @@ void OmniboxImpl::SetClient(OmniboxClientPtr client) { ...@@ -134,7 +135,8 @@ void OmniboxImpl::SetClient(OmniboxClientPtr client) {
void OmniboxImpl::ShowForURL(const mojo::String& url) { void OmniboxImpl::ShowForURL(const mojo::String& url) {
url_ = url; url_ = url;
// TODO: get embedding working.
view_embedder_->Embed("mojo:omnibox", nullptr, nullptr);
} }
} // namespace mandoline } // namespace mandoline
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "components/view_manager/public/cpp/view_manager_delegate.h" #include "components/view_manager/public/cpp/view_manager_delegate.h"
#include "mandoline/ui/browser/omnibox.mojom.h" #include "mandoline/ui/browser/omnibox.mojom.h"
#include "mandoline/ui/browser/view_embedder.mojom.h"
#include "mojo/application/public/cpp/application_delegate.h" #include "mojo/application/public/cpp/application_delegate.h"
#include "mojo/application/public/cpp/interface_factory.h" #include "mojo/application/public/cpp/interface_factory.h"
#include "mojo/common/weak_binding_set.h" #include "mojo/common/weak_binding_set.h"
...@@ -68,6 +69,7 @@ class OmniboxImpl : public mojo::ApplicationDelegate, ...@@ -68,6 +69,7 @@ class OmniboxImpl : public mojo::ApplicationDelegate,
views::Textfield* edit_; views::Textfield* edit_;
mojo::WeakBindingSet<Omnibox> bindings_; mojo::WeakBindingSet<Omnibox> bindings_;
scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_; scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_;
ViewEmbedderPtr view_embedder_;
DISALLOW_COPY_AND_ASSIGN(OmniboxImpl); DISALLOW_COPY_AND_ASSIGN(OmniboxImpl);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment