blob: abc57a259fc373186307eb514c6690bca6b344a7 [file] [log] [blame]
David Black6b4b1ad22018-08-21 02:45:081// Copyright 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#ifndef ASH_ASSISTANT_ASSISTANT_CACHE_CONTROLLER_H_
6#define ASH_ASSISTANT_ASSISTANT_CACHE_CONTROLLER_H_
7
David Black02974f82018-08-21 22:56:058#include "ash/assistant/assistant_controller_observer.h"
David Black6b4b1ad22018-08-21 02:45:089#include "ash/assistant/model/assistant_cache_model.h"
David Black02974f82018-08-21 22:56:0510#include "ash/assistant/model/assistant_ui_model_observer.h"
David Black6b4b1ad22018-08-21 02:45:0811#include "ash/public/interfaces/voice_interaction_controller.mojom.h"
12#include "base/macros.h"
13#include "mojo/public/cpp/bindings/binding.h"
14
15namespace ash {
16
17class AssistantCacheModelObserver;
David Black02974f82018-08-21 22:56:0518class AssistantController;
David Black6b4b1ad22018-08-21 02:45:0819
David Black02974f82018-08-21 22:56:0520class AssistantCacheController : public AssistantControllerObserver,
21 public AssistantUiModelObserver,
22 public mojom::VoiceInteractionObserver {
David Black6b4b1ad22018-08-21 02:45:0823 public:
David Black02974f82018-08-21 22:56:0524 explicit AssistantCacheController(AssistantController* assistant_controller);
David Black6b4b1ad22018-08-21 02:45:0825 ~AssistantCacheController() override;
26
27 // Returns a reference to the underlying model.
28 const AssistantCacheModel* model() const { return &model_; }
29
30 // Adds/removes the specified cache model |observer|.
31 void AddModelObserver(AssistantCacheModelObserver* observer);
32 void RemoveModelObserver(AssistantCacheModelObserver* observer);
33
David Black02974f82018-08-21 22:56:0534 // AssistantControllerObserver:
35 void OnAssistantControllerConstructed() override;
36 void OnAssistantControllerDestroying() override;
37
38 // AssistantUiModelObserver:
David Black4c6b9e22018-08-27 20:31:3139 void OnUiVisibilityChanged(AssistantVisibility new_visibility,
40 AssistantVisibility old_visibility,
41 AssistantSource source) override;
David Black02974f82018-08-21 22:56:0542
David Black6b4b1ad22018-08-21 02:45:0843 private:
44 // mojom::VoiceInteractionObserver:
45 void OnVoiceInteractionStatusChanged(
46 mojom::VoiceInteractionState state) override {}
47 void OnVoiceInteractionSettingsEnabled(bool enabled) override {}
48 void OnVoiceInteractionContextEnabled(bool enabled) override;
49 void OnVoiceInteractionHotwordEnabled(bool enabled) override {}
50 void OnVoiceInteractionSetupCompleted(bool completed) override {}
51 void OnAssistantFeatureAllowedChanged(
52 mojom::AssistantAllowedState state) override {}
Muyuan Li999dcf62018-08-22 18:12:1253 void OnLocaleChanged(const std::string& locale) override {}
David Black6b4b1ad22018-08-21 02:45:0854
55 void UpdateConversationStarters();
56
David Black02974f82018-08-21 22:56:0557 AssistantController* const assistant_controller_; // Owned by Shell.
58
David Black6b4b1ad22018-08-21 02:45:0859 mojo::Binding<mojom::VoiceInteractionObserver> voice_interaction_binding_;
60
61 AssistantCacheModel model_;
62
63 DISALLOW_COPY_AND_ASSIGN(AssistantCacheController);
64};
65
66} // namespace ash
67
68#endif // ASH_ASSISTANT_ASSISTANT_CACHE_CONTROLLER_H_