Commit 0073e99b authored by aa's avatar aa Committed by Commit bot

Expose NavigatorHost via Embed() rather than globally.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#293469}
parent ba3e74de
......@@ -12,6 +12,7 @@
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/application_impl.h"
#include "mojo/public/cpp/application/application_runner_chromium.h"
#include "mojo/public/cpp/application/connect.h"
#include "mojo/services/public/cpp/geometry/geometry_type_converters.h"
#include "mojo/services/public/cpp/view_manager/view.h"
#include "mojo/services/public/cpp/view_manager/view_manager.h"
......@@ -169,7 +170,6 @@ class Browser : public ApplicationDelegate,
view_manager_client_factory_.reset(
new ViewManagerClientFactory(app->shell(), this));
views_init_.reset(new ViewsInit);
app->ConnectToService("mojo:mojo_window_manager", &navigator_host_);
app->ConnectToService("mojo:mojo_window_manager", &window_manager_);
}
......@@ -209,6 +209,7 @@ class Browser : public ApplicationDelegate,
ServiceProviderImpl* exported_services,
scoped_ptr<ServiceProvider> imported_services) OVERRIDE {
// TODO: deal with OnEmbed() being invoked multiple times.
ConnectToService(imported_services.get(), &navigator_host_);
view_manager_ = view_manager;
root_ = root;
root_->AddObserver(this);
......@@ -230,9 +231,7 @@ class Browser : public ApplicationDelegate,
printf("User entered this URL: %s\n", url.spec().c_str());
NavigationDetailsPtr nav_details(NavigationDetails::New());
nav_details->request->url = String::From(url);
navigator_host_->RequestNavigate(view_manager_->GetRoots().front()->id(),
TARGET_NEW_NODE,
nav_details.Pass());
navigator_host_->RequestNavigate(TARGET_NEW_NODE, nav_details.Pass());
}
return false;
}
......
......@@ -12,6 +12,7 @@
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/application_impl.h"
#include "mojo/public/cpp/application/application_runner_chromium.h"
#include "mojo/public/cpp/application/connect.h"
#include "mojo/public/cpp/application/interface_factory_impl.h"
#include "mojo/services/public/cpp/view_manager/view.h"
#include "mojo/services/public/cpp/view_manager/view_manager.h"
......@@ -29,7 +30,13 @@ namespace examples {
const SkColor kColors[] = {SK_ColorYELLOW, SK_ColorRED, SK_ColorGREEN,
SK_ColorMAGENTA};
class EmbeddedApp;
struct Window {
Window(View* root, scoped_ptr<ServiceProvider> embedder_service_provider)
: root(root),
embedder_service_provider(embedder_service_provider.Pass()) {}
View* root;
scoped_ptr<ServiceProvider> embedder_service_provider;
};
class EmbeddedApp
: public ApplicationDelegate,
......@@ -45,11 +52,6 @@ class EmbeddedApp
virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE {
view_manager_client_factory_.reset(
new ViewManagerClientFactory(app->shell(), this));
// TODO(aa): Weird for embeddee to talk to embedder by URL. Seems like
// embedder should be able to specify the SP embeddee receives, then
// communication can be anonymous.
app->ConnectToService("mojo:mojo_window_manager", &navigator_host_);
}
virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
......@@ -64,7 +66,7 @@ class EmbeddedApp
ServiceProviderImpl* exported_services,
scoped_ptr<ServiceProvider> imported_services) OVERRIDE {
root->AddObserver(this);
roots_[root->id()] = root;
windows_[root->id()] = new Window(root, imported_services.Pass());
root->SetColor(kColors[next_color_++ % arraysize(kColors)]);
}
virtual void OnViewManagerDisconnected(ViewManager* view_manager) OVERRIDE {
......@@ -73,8 +75,8 @@ class EmbeddedApp
// Overridden from ViewObserver:
virtual void OnViewDestroyed(View* view) OVERRIDE {
DCHECK(roots_.find(view->id()) != roots_.end());
roots_.erase(view->id());
DCHECK(windows_.find(view->id()) != windows_.end());
windows_.erase(view->id());
}
virtual void OnViewInputEvent(View* view, const EventPtr& event) OVERRIDE {
if (event->action == EVENT_TYPE_MOUSE_RELEASED) {
......@@ -82,17 +84,18 @@ class EmbeddedApp
NavigationDetailsPtr nav_details(NavigationDetails::New());
nav_details->request->url =
"http://www.aaronboodman.com/z_dropbox/test.html";
navigator_host_->RequestNavigate(view->id(), TARGET_SOURCE_NODE,
nav_details.Pass());
NavigatorHostPtr navigator_host;
ConnectToService(windows_[view->id()]->embedder_service_provider.get(),
&navigator_host);
navigator_host->RequestNavigate(TARGET_SOURCE_NODE, nav_details.Pass());
}
}
}
NavigatorHostPtr navigator_host_;
scoped_ptr<ViewManagerClientFactory> view_manager_client_factory_;
typedef std::map<Id, View*> RootMap;
RootMap roots_;
typedef std::map<Id, Window*> WindowMap;
WindowMap windows_;
int next_color_;
......
......@@ -186,23 +186,6 @@ class ControlPanel : public views::ButtonListener {
DISALLOW_COPY_AND_ASSIGN(ControlPanel);
};
class NavigatorImpl : public InterfaceImpl<Navigator> {
public:
explicit NavigatorImpl(MediaViewer* viewer) : viewer_(viewer) {}
virtual ~NavigatorImpl() {}
private:
// Overridden from Navigator:
virtual void Navigate(
uint32_t view_id,
NavigationDetailsPtr navigation_details,
ResponseDetailsPtr response_details) OVERRIDE;
MediaViewer* viewer_;
DISALLOW_COPY_AND_ASSIGN(NavigatorImpl);
};
class MediaViewer
: public ApplicationDelegate,
public ViewManagerDelegate,
......@@ -210,8 +193,7 @@ class MediaViewer
public ViewObserver {
public:
MediaViewer()
: navigator_factory_(this),
app_(NULL),
: app_(NULL),
view_manager_(NULL),
root_view_(NULL),
control_view_(NULL),
......@@ -225,39 +207,6 @@ class MediaViewer
root_view_->RemoveObserver(this);
}
void Navigate(
uint32_t view_id,
NavigationDetailsPtr navigation_details,
ResponseDetailsPtr response_details) {
// TODO(yzshen): This shouldn't be needed once FIFO is ready.
if (!view_manager_) {
pending_navigate_request_.reset(new PendingNavigateRequest);
pending_navigate_request_->view_id = view_id;
pending_navigate_request_->navigation_details = navigation_details.Pass();
pending_navigate_request_->response_details = response_details.Pass();
return;
}
std::string handler = GetHandlerForContentType(
response_details->response->mime_type);
if (handler.empty())
return;
content_view_->Embed(handler);
if (navigation_details) {
NavigatorPtr navigator;
app_->ConnectToService(handler, &navigator);
navigator->Navigate(content_view_->id(), navigation_details.Pass(),
response_details.Pass());
}
// TODO(yzshen): determine the set of controls to show based on what
// interfaces the embedded app provides.
app_->ConnectToService(handler, &zoomable_media_);
}
private:
typedef std::map<std::string, std::string> HandlerMap;
......@@ -278,7 +227,6 @@ class MediaViewer
virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
OVERRIDE {
connection->AddService(&navigator_factory_);
connection->AddService(view_manager_client_factory_.get());
return true;
}
......@@ -311,14 +259,9 @@ class MediaViewer
LayoutViews();
root_view_->AddObserver(this);
if (pending_navigate_request_) {
scoped_ptr<PendingNavigateRequest> request(
pending_navigate_request_.release());
Navigate(request->view_id, request->navigation_details.Pass(),
request->response_details.Pass());
}
content_view_->Embed("TODO");
}
virtual void OnViewManagerDisconnected(
ViewManager* view_manager) OVERRIDE {
DCHECK_EQ(view_manager_, view_manager);
......@@ -360,8 +303,6 @@ class MediaViewer
return it != handler_map_.end() ? it->second : std::string();
}
InterfaceFactoryImplWithContext<NavigatorImpl, MediaViewer>
navigator_factory_;
scoped_ptr<ViewManagerClientFactory> view_manager_client_factory_;
ApplicationImpl* app_;
......@@ -373,19 +314,10 @@ class MediaViewer
ControlPanel control_panel_;
ZoomableMediaPtr zoomable_media_;
HandlerMap handler_map_;
scoped_ptr<PendingNavigateRequest> pending_navigate_request_;
DISALLOW_COPY_AND_ASSIGN(MediaViewer);
};
void NavigatorImpl::Navigate(
uint32_t view_id,
NavigationDetailsPtr navigation_details,
ResponseDetailsPtr response_details) {
viewer_->Navigate(view_id, navigation_details.Pass(),
response_details.Pass());
}
} // namespace examples
} // namespace mojo
......
......@@ -13,6 +13,7 @@
#include "mojo/public/cpp/application/application_impl.h"
#include "mojo/public/cpp/application/application_runner_chromium.h"
#include "mojo/public/cpp/application/interface_factory_impl.h"
#include "mojo/public/cpp/application/service_provider_impl.h"
#include "mojo/services/public/cpp/geometry/geometry_type_converters.h"
#include "mojo/services/public/cpp/input_events/input_events_type_converters.h"
#include "mojo/services/public/cpp/view_manager/view.h"
......@@ -66,19 +67,19 @@ class WindowManagerConnection : public InterfaceImpl<IWindowManager> {
class NavigatorHostImpl : public InterfaceImpl<NavigatorHost> {
public:
explicit NavigatorHostImpl(WindowManager* window_manager)
: window_manager_(window_manager) {}
explicit NavigatorHostImpl(WindowManager* window_manager, Id view_id)
: window_manager_(window_manager), view_id_(view_id) {}
virtual ~NavigatorHostImpl() {
}
private:
virtual void DidNavigateLocally(uint32 source_view_id,
const mojo::String& url) OVERRIDE;
virtual void DidNavigateLocally(const mojo::String& url) OVERRIDE;
virtual void RequestNavigate(
uint32 source_view_id,
Target target,
NavigationDetailsPtr nav_details) OVERRIDE;
WindowManager* window_manager_;
Id view_id_;
DISALLOW_COPY_AND_ASSIGN(NavigatorHostImpl);
};
......@@ -249,6 +250,34 @@ class RootLayoutManager : public ViewObserver {
DISALLOW_COPY_AND_ASSIGN(RootLayoutManager);
};
class Window : public InterfaceFactory<NavigatorHost> {
public:
Window(WindowManager* window_manager, View* view)
: window_manager_(window_manager), view_(view) {}
virtual ~Window() {}
View* view() const { return view_; }
void Embed(const std::string& url) {
scoped_ptr<ServiceProviderImpl> service_provider_impl(
new ServiceProviderImpl());
service_provider_impl->AddService<NavigatorHost>(this);
view_->Embed(url, service_provider_impl.Pass());
}
private:
// InterfaceFactory<NavigatorHost>
virtual void Create(ApplicationConnection* connection,
InterfaceRequest<NavigatorHost> request) OVERRIDE {
BindToRequest(new NavigatorHostImpl(window_manager_, view_->id()),
&request);
}
WindowManager* window_manager_;
View* view_;
};
class WindowManager
: public ApplicationDelegate,
public DebugPanel::Delegate,
......@@ -258,7 +287,6 @@ class WindowManager
public:
WindowManager()
: window_manager_factory_(this),
navigator_host_factory_(this),
launcher_ui_(NULL),
view_manager_(NULL),
window_manager_app_(new WindowManagerApp(this, this)),
......@@ -272,13 +300,10 @@ class WindowManager
}
void CloseWindow(Id view_id) {
View* view = view_manager_->GetViewById(view_id);
DCHECK(view);
std::vector<View*>::iterator iter =
std::find(windows_.begin(), windows_.end(), view);
WindowVector::iterator iter = GetWindowByViewId(view_id);
DCHECK(iter != windows_.end());
windows_.erase(iter);
view->Destroy();
(*iter)->view()->Destroy();
}
void ShowKeyboard(Id view_id, const gfx::Rect& bounds) {
......@@ -314,7 +339,7 @@ class WindowManager
// Overridden from DebugPanel::Delegate:
virtual void CloseTopWindow() OVERRIDE {
if (!windows_.empty())
CloseWindow(windows_.back()->id());
CloseWindow(windows_.back()->view()->id());
}
virtual void RequestNavigate(
......@@ -325,6 +350,8 @@ class WindowManager
}
private:
typedef std::vector<Window*> WindowVector;
// Overridden from ApplicationDelegate:
virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE {
app_ = app;
......@@ -335,7 +362,6 @@ class WindowManager
virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
MOJO_OVERRIDE {
connection->AddService(&window_manager_factory_);
connection->AddService(&navigator_host_factory_);
window_manager_app_->ConfigureIncomingConnection(connection);
return true;
}
......@@ -377,7 +403,8 @@ class WindowManager
virtual void Embed(
const String& url,
InterfaceRequest<ServiceProvider> service_provider) OVERRIDE {
CreateWindow(url);
const Id kInvalidSourceViewId = 0;
OnLaunch(kInvalidSourceViewId, TARGET_DEFAULT, url);
}
virtual void DispatchEvent(EventPtr event) MOJO_OVERRIDE {}
......@@ -405,21 +432,22 @@ class WindowManager
}
}
View* dest_view = NULL;
Window* dest_view = NULL;
if (target == TARGET_SOURCE_NODE) {
View* source_view = view_manager_->GetViewById(source_view_id);
bool app_initiated = std::find(windows_.begin(), windows_.end(),
source_view) != windows_.end();
WindowVector::iterator source_view = GetWindowByViewId(source_view_id);
bool app_initiated = source_view != windows_.end();
if (app_initiated)
dest_view = source_view;
dest_view = *source_view;
else if (!windows_.empty())
dest_view = windows_.back();
}
if (dest_view)
dest_view->Embed(url);
else
CreateWindow(url);
if (!dest_view) {
dest_view = CreateWindow();
windows_.push_back(dest_view);
}
dest_view->Embed(url);
}
// TODO(beng): proper layout manager!!
......@@ -430,11 +458,12 @@ class WindowManager
gfx::Rect bounds = view->bounds();
bounds.Inset(kBorderInset, kBorderInset);
bounds.set_height(kTextfieldHeight);
launcher_ui_ = CreateChild(content_view_id_, "mojo:mojo_browser", bounds);
return launcher_ui_->id();
launcher_ui_ = CreateWindow(bounds);
launcher_ui_->Embed("mojo:mojo_browser");
return launcher_ui_->view()->id();
}
void CreateWindow(const std::string& url) {
Window* CreateWindow() {
View* view = view_manager_->GetViewById(content_view_id_);
gfx::Rect bounds(kBorderInset,
2 * kBorderInset + kTextfieldHeight,
......@@ -443,23 +472,20 @@ class WindowManager
view->bounds().height() -
(3 * kBorderInset + kTextfieldHeight));
if (!windows_.empty()) {
gfx::Point position = windows_.back()->bounds().origin();
gfx::Point position = windows_.back()->view()->bounds().origin();
position.Offset(35, 35);
bounds.set_origin(position);
}
windows_.push_back(CreateChild(content_view_id_, url, bounds));
return CreateWindow(bounds);
}
View* CreateChild(Id parent_id,
const std::string& url,
const gfx::Rect& bounds) {
View* view = view_manager_->GetViewById(parent_id);
View* embedded = View::Create(view_manager_);
view->AddChild(embedded);
embedded->SetBounds(bounds);
embedded->Embed(url);
embedded->SetFocus();
return embedded;
Window* CreateWindow(const gfx::Rect& bounds) {
View* content = view_manager_->GetViewById(content_view_id_);
View* view = View::Create(view_manager_);
content->AddChild(view);
view->SetBounds(bounds);
view->SetFocus();
return new Window(this, view);
}
bool IsDescendantOfKeyboard(View* target) {
......@@ -483,15 +509,24 @@ class WindowManager
return view->id();
}
WindowVector::iterator GetWindowByViewId(Id view_id) {
for (std::vector<Window*>::iterator iter = windows_.begin();
iter != windows_.end();
++iter) {
if ((*iter)->view()->id() == view_id) {
return iter;
}
}
return windows_.end();
}
InterfaceFactoryImplWithContext<WindowManagerConnection, WindowManager>
window_manager_factory_;
InterfaceFactoryImplWithContext<NavigatorHostImpl, WindowManager>
navigator_host_factory_;
scoped_ptr<ViewsInit> views_init_;
DebugPanel* debug_panel_;
View* launcher_ui_;
std::vector<View*> windows_;
Window* launcher_ui_;
WindowVector windows_;
ViewManager* view_manager_;
scoped_ptr<RootLayoutManager> root_layout_manager_;
......@@ -518,16 +553,13 @@ void WindowManagerConnection::HideKeyboard(Id view_id) {
window_manager_->HideKeyboard(view_id);
}
void NavigatorHostImpl::DidNavigateLocally(uint32 source_view_id,
const mojo::String& url) {
window_manager_->DidNavigateLocally(source_view_id, url);
void NavigatorHostImpl::DidNavigateLocally(const mojo::String& url) {
window_manager_->DidNavigateLocally(view_id_, url);
}
void NavigatorHostImpl::RequestNavigate(
uint32 source_view_id,
Target target,
NavigationDetailsPtr nav_details) {
window_manager_->RequestNavigate(source_view_id, target, nav_details.Pass());
void NavigatorHostImpl::RequestNavigate(Target target,
NavigationDetailsPtr nav_details) {
window_manager_->RequestNavigate(view_id_, target, nav_details.Pass());
}
} // namespace examples
......
......@@ -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>(
......
......@@ -83,17 +83,17 @@ bool CanNavigateLocally(blink::WebFrame* frame,
HTMLDocumentView::HTMLDocumentView(
URLResponsePtr response,
scoped_ptr<ServiceProvider> imported_services,
ServiceProviderImpl* exported_services,
InterfaceRequest<ServiceProvider> service_provider_request,
Shell* shell)
: imported_services_(imported_services.Pass()),
shell_(shell),
: shell_(shell),
web_view_(NULL),
root_(NULL),
view_manager_client_factory_(shell, this),
repaint_pending_(false),
weak_factory_(this) {
ServiceProviderImpl* exported_services = new ServiceProviderImpl();
exported_services->AddService(&view_manager_client_factory_);
BindToRequest(exported_services, &service_provider_request);
Load(response.Pass());
}
......@@ -104,11 +104,15 @@ HTMLDocumentView::~HTMLDocumentView() {
root_->RemoveObserver(this);
}
void HTMLDocumentView::OnEmbed(ViewManager* view_manager,
View* root,
ServiceProviderImpl* exported_services,
scoped_ptr<ServiceProvider> imported_services) {
void HTMLDocumentView::OnEmbed(
ViewManager* view_manager,
View* root,
ServiceProviderImpl* embedee_service_provider_impl,
scoped_ptr<ServiceProvider> embedder_service_provider) {
root_ = root;
embedder_service_provider_ = embedder_service_provider.Pass();
navigator_host_.set_service_provider(embedder_service_provider_.get());
root_->SetColor(SK_ColorCYAN); // Dummy background color.
web_view_->resize(root_->bounds().size());
root_->AddObserver(this);
......@@ -190,8 +194,7 @@ blink::WebNavigationPolicy HTMLDocumentView::decidePolicyForNavigation(
NavigationDetailsPtr nav_details(NavigationDetails::New());
nav_details->request = URLRequest::From(request);
GetNavigatorHost()->RequestNavigate(
root_->id(),
navigator_host_->RequestNavigate(
WebNavigationPolicyToNavigationTarget(default_policy),
nav_details.Pass());
......@@ -208,8 +211,7 @@ void HTMLDocumentView::didAddMessageToConsole(
void HTMLDocumentView::didNavigateWithinPage(
blink::WebLocalFrame* frame, const blink::WebHistoryItem& history_item,
blink::WebHistoryCommitType commit_type) {
GetNavigatorHost()->DidNavigateLocally(root_->id(),
history_item.urlString().utf8());
navigator_host_->DidNavigateLocally(history_item.urlString().utf8());
}
void HTMLDocumentView::OnViewBoundsChanged(View* view,
......@@ -252,14 +254,4 @@ void HTMLDocumentView::Repaint() {
root_->SetContents(canvas->getDevice()->accessBitmap(false));
}
NavigatorHost* HTMLDocumentView::GetNavigatorHost() {
if (!navigator_host_.get()) {
// TODO(aa): This should come via |imported_services| in OnEmbed().
InterfacePtr<ServiceProvider> sp;
shell_->ConnectToApplication("mojo:mojo_window_manager", Get(&sp));
ConnectToService(sp.get(), &navigator_host_);
}
return navigator_host_.get();
}
} // namespace mojo
......@@ -7,6 +7,7 @@
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
#include "mojo/public/cpp/application/lazy_interface_ptr.h"
#include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h"
#include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
#include "mojo/services/public/cpp/view_manager/view_observer.h"
......@@ -29,17 +30,14 @@ class HTMLDocumentView : public blink::WebViewClient,
public:
// Load a new HTMLDocument with |response|.
//
// |imported_from_connector| is used to request services of the connecting
// application (e.g., the application that called
// Shell::ConnectToApplication()).
//
// |exported_to_connector| is used to export services from this
// HTMLDocumentView to the connecting application.
// |service_provider_request| should be used to implement a
// ServiceProvider which exposes services to the connecting application.
// Commonly, the connecting application is the ViewManager and it will
// request ViewManagerClient.
//
// |shell| is the Shell connection for this mojo::Application.
HTMLDocumentView(URLResponsePtr response,
scoped_ptr<ServiceProvider> imported_from_connector,
ServiceProviderImpl* exported_to_connector,
InterfaceRequest<ServiceProvider> service_provider_request,
Shell* shell);
virtual ~HTMLDocumentView();
......@@ -74,8 +72,8 @@ class HTMLDocumentView : public blink::WebViewClient,
virtual void OnEmbed(
ViewManager* view_manager,
View* root,
ServiceProviderImpl* exported_to_embedder,
scoped_ptr<ServiceProvider> exported_from_embedder) OVERRIDE;
ServiceProviderImpl* embedee_service_provider_impl,
scoped_ptr<ServiceProvider> embedder_service_provider) OVERRIDE;
virtual void OnViewManagerDisconnected(ViewManager* view_manager) OVERRIDE;
// ViewObserver methods:
......@@ -87,12 +85,11 @@ class HTMLDocumentView : public blink::WebViewClient,
void Load(URLResponsePtr response);
void Repaint();
NavigatorHost* GetNavigatorHost();
URLResponsePtr response_;
scoped_ptr<ServiceProvider> imported_services_;
scoped_ptr<ServiceProvider> embedder_service_provider_;
Shell* shell_;
InterfacePtr<NavigatorHost> navigator_host_;
LazyInterfacePtr<NavigatorHost> navigator_host_;
blink::WebView* web_view_;
View* root_;
ViewManagerClientFactory view_manager_client_factory_;
......
......@@ -9,7 +9,6 @@
#include "mojo/public/cpp/application/application_impl.h"
#include "mojo/public/cpp/application/application_runner_chromium.h"
#include "mojo/public/cpp/application/interface_factory_impl.h"
#include "mojo/public/cpp/application/service_provider_impl.h"
#include "mojo/services/html_viewer/blink_platform_impl.h"
#include "mojo/services/html_viewer/html_document_view.h"
#include "mojo/services/public/interfaces/content_handler/content_handler.mojom.h"
......@@ -29,13 +28,9 @@ class ContentHandlerImpl : public InterfaceImpl<ContentHandler> {
virtual void OnConnect(
const mojo::String& url,
URLResponsePtr response,
InterfaceRequest<ServiceProvider> service_provider) OVERRIDE {
ServiceProviderImpl* exported_services = new ServiceProviderImpl();
BindToRequest(exported_services, &service_provider);
scoped_ptr<ServiceProvider> remote(
exported_services->CreateRemoteServiceProvider());
InterfaceRequest<ServiceProvider> service_provider_request) OVERRIDE {
new HTMLDocumentView(
response.Pass(), remote.Pass(), exported_services, shell_);
response.Pass(), service_provider_request.Pass(), shell_);
}
Shell* shell_;
......
......@@ -37,22 +37,11 @@ struct ResponseDetails {
// Embedders that support navigation of implement this interface.
interface NavigatorHost {
RequestNavigate(uint32 source_node_id, Target target,
NavigationDetails? details);
RequestNavigate(Target target, NavigationDetails? details);
// Applications call this to inform hosts of navigations they performed
// locally. For example, pushState() navigations in an HTML application.
DidNavigateLocally(uint32 source_node_id, string? url);
};
// Applications implement this interface to support navigation of their views
// by embedders.
// |response_details| can be NULL when a navigation was not the result of a
// network load.
interface Navigator {
Navigate(uint32 node_id,
NavigationDetails? navigation_details,
ResponseDetails? response_details);
DidNavigateLocally(string? url);
};
}
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