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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
ash / assistant / assistant_setup_controller.h [blame]
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_ASSISTANT_ASSISTANT_SETUP_CONTROLLER_H_
#define ASH_ASSISTANT_ASSISTANT_SETUP_CONTROLLER_H_
#include <map>
#include <string>
#include "ash/assistant/ui/assistant_view_delegate.h"
#include "ash/public/cpp/assistant/assistant_setup.h"
#include "ash/public/cpp/assistant/controller/assistant_controller.h"
#include "ash/public/cpp/assistant/controller/assistant_controller_observer.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observation.h"
namespace ash {
class AssistantControllerImpl;
class AssistantSetupController : public AssistantControllerObserver,
public AssistantViewDelegateObserver {
public:
explicit AssistantSetupController(
AssistantControllerImpl* assistant_controller);
AssistantSetupController(const AssistantSetupController&) = delete;
AssistantSetupController& operator=(const AssistantSetupController&) = delete;
~AssistantSetupController() override;
// AssistantControllerObserver:
void OnAssistantControllerConstructed() override;
void OnAssistantControllerDestroying() override;
void OnDeepLinkReceived(
assistant::util::DeepLinkType type,
const std::map<std::string, std::string>& params) override;
// AssistantViewDelegateObserver:
void OnOptInButtonPressed() override;
void StartOnboarding(bool relaunch, FlowType type = FlowType::kConsentFlow);
private:
void OnOptInFlowFinished(bool relaunch, bool completed);
const raw_ptr<AssistantControllerImpl>
assistant_controller_; // Owned by Shell.
base::ScopedObservation<AssistantController, AssistantControllerObserver>
assistant_controller_observation_{this};
base::WeakPtrFactory<AssistantSetupController> weak_ptr_factory_{this};
};
} // namespace ash
#endif // ASH_ASSISTANT_ASSISTANT_SETUP_CONTROLLER_H_