blob: 6e274fb45f36802506e8d172d5c6f4aab97e2b9a [file] [log] [blame]
David Blacke8f815042018-03-28 18:59:371// Copyright (c) 2018 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "ash/assistant/ash_assistant_controller.h"
6
7#include "ash/shell.h"
8#include "ash/shell_delegate.h"
9
10namespace ash {
11
12AshAssistantController::AshAssistantController()
13 : assistant_controller_binding_(this),
14 assistant_event_subscriber_binding_(this) {}
15
16AshAssistantController::~AshAssistantController() {
17 assistant_controller_binding_.Close();
18 assistant_event_subscriber_binding_.Close();
19}
20
21void AshAssistantController::BindRequest(
22 mojom::AshAssistantControllerRequest request) {
23 assistant_controller_binding_.Bind(std::move(request));
24}
25
26void AshAssistantController::SetAssistant(
27 chromeos::assistant::mojom::AssistantPtr assistant) {
28 // Subscribe to Assistant events.
29 chromeos::assistant::mojom::AssistantEventSubscriberPtr ptr;
30 assistant_event_subscriber_binding_.Bind(mojo::MakeRequest(&ptr));
31 assistant->AddAssistantEventSubscriber(std::move(ptr));
32}
33
34void AshAssistantController::OnHtmlResponse(const std::string& response) {
35 // TODO(dmblack): Handle.
36 NOTIMPLEMENTED();
37}
38
39void AshAssistantController::OnTextResponse(const std::string& response) {
40 // TODO(dmblack): Handle.
41 NOTIMPLEMENTED();
42}
43
44void AshAssistantController::OnOpenUrlResponse(const GURL& url) {
45 Shell::Get()->shell_delegate()->OpenUrlFromArc(url);
46}
47
48} // namespace ash