summaryrefslogtreecommitdiffstats
path: root/components/html_viewer/content_handler_impl.cc
blob: 0b3b2ef93112f36914ef9bd80d831efe31e2426b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// 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.

#include "components/html_viewer/content_handler_impl.h"

#include <utility>

#include "components/html_viewer/html_document_application_delegate.h"

namespace html_viewer {

ContentHandlerImpl::ContentHandlerImpl(
    GlobalState* global_state,
    mojo::Shell* shell,
    mojo::InterfaceRequest<mojo::shell::mojom::ContentHandler> request)
    : global_state_(global_state),
      shell_(shell),
      binding_(this, std::move(request)),
      app_refcount_(shell_->CreateAppRefCount()) {}

ContentHandlerImpl::~ContentHandlerImpl() {
}

void ContentHandlerImpl::StartApplication(
    mojo::ApplicationRequest request,
    mojo::URLResponsePtr response,
    const mojo::Callback<void()>& destruct_callback) {
  // HTMLDocumentApplicationDelegate deletes itself.
  new HTMLDocumentApplicationDelegate(
      std::move(request), std::move(response), global_state_,
      shell_->CreateAppRefCount(), destruct_callback);
}

}  // namespace html_viewer