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") {
mojom("interfaces") {
sources = [
"omnibox.mojom",
"view_embedder.mojom",
]
}
......@@ -36,7 +36,7 @@ Browser::Browser()
omnibox_(nullptr),
navigator_host_(this),
ui_(nullptr) {
exposed_services_impl_.AddService(this);
exposed_services_impl_.AddService<mojo::NavigatorHost>(this);
}
Browser::~Browser() {
......@@ -72,6 +72,7 @@ bool Browser::ConfigureIncomingConnection(
bool Browser::ConfigureOutgoingConnection(
mojo::ApplicationConnection* connection) {
connection->AddService<ViewEmbedder>(this);
return true;
}
......@@ -122,24 +123,6 @@ void Browser::OpenURL(const mojo::String& 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,
mojo::InterfaceRequest<mojo::ServiceProvider> services,
mojo::ServiceProviderPtr exposed_services) {
......@@ -170,4 +153,27 @@ void Browser::Embed(const mojo::String& 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
......@@ -11,10 +11,12 @@
#include "mandoline/services/navigation/public/interfaces/navigation.mojom.h"
#include "mandoline/ui/browser/navigator_host_impl.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_impl.h"
#include "mojo/application/public/cpp/connect.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 "url/gurl.h"
......@@ -31,7 +33,9 @@ class Browser : public mojo::ApplicationDelegate,
public mojo::ViewManagerDelegate,
public mojo::ViewManagerRootClient,
public OmniboxClient,
public mojo::InterfaceFactory<mojo::NavigatorHost> {
public ViewEmbedder,
public mojo::InterfaceFactory<mojo::NavigatorHost>,
public mojo::InterfaceFactory<ViewEmbedder> {
public:
Browser();
~Browser() override;
......@@ -63,13 +67,18 @@ class Browser : public mojo::ApplicationDelegate,
// Overridden from OmniboxClient:
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>:
void Create(mojo::ApplicationConnection* connection,
mojo::InterfaceRequest<mojo::NavigatorHost> request) override;
void Embed(const mojo::String& url,
mojo::InterfaceRequest<mojo::ServiceProvider> services,
mojo::ServiceProviderPtr exposed_services);
// Overridden from mojo::InterfaceFactory<ViewEmbedder>:
void Create(mojo::ApplicationConnection* connection,
mojo::InterfaceRequest<ViewEmbedder> request) override;
void ShowOmnibox(const mojo::String& url,
mojo::InterfaceRequest<mojo::ServiceProvider> services,
......@@ -88,6 +97,8 @@ class Browser : public mojo::ApplicationDelegate,
mojo::ServiceProviderImpl exposed_services_impl_;
scoped_ptr<MergedServiceProvider> merged_service_provider_;
mojo::WeakBindingSet<ViewEmbedder> view_embedder_bindings_;
NavigatorHostImpl navigator_host_;
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(
mojo::ApplicationConnection* connection) {
connection->AddService<Omnibox>(this);
connection->AddService(view_manager_client_factory_.get());
connection->ConnectToService(&view_embedder_);
return true;
}
......@@ -134,7 +135,8 @@ void OmniboxImpl::SetClient(OmniboxClientPtr client) {
void OmniboxImpl::ShowForURL(const mojo::String& url) {
url_ = url;
// TODO: get embedding working.
view_embedder_->Embed("mojo:omnibox", nullptr, nullptr);
}
} // namespace mandoline
......@@ -7,6 +7,7 @@
#include "components/view_manager/public/cpp/view_manager_delegate.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/interface_factory.h"
#include "mojo/common/weak_binding_set.h"
......@@ -68,6 +69,7 @@ class OmniboxImpl : public mojo::ApplicationDelegate,
views::Textfield* edit_;
mojo::WeakBindingSet<Omnibox> bindings_;
scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_;
ViewEmbedderPtr view_embedder_;
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