1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- // Copyright 2022 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.
- #ifndef ASH_SYSTEM_CAMERA_AUTOZOOM_NUDGE_CONTROLLER_H_
- #define ASH_SYSTEM_CAMERA_AUTOZOOM_NUDGE_CONTROLLER_H_
- #include "ash/ash_export.h"
- #include "ash/public/cpp/session/session_observer.h"
- #include "ash/system/camera/autozoom_observer.h"
- #include "ash/system/tray/system_nudge_controller.h"
- #include "base/time/time.h"
- class PrefService;
- class PrefRegistrySimple;
- namespace ash {
- class AutozoomControllerImpl;
- class ASH_EXPORT AutozoomNudgeController : public SystemNudgeController,
- public AutozoomObserver,
- public SessionObserver {
- public:
- explicit AutozoomNudgeController(AutozoomControllerImpl* controller);
- AutozoomNudgeController(const AutozoomNudgeController&) = delete;
- AutozoomNudgeController& operator=(const AutozoomNudgeController&) = delete;
- ~AutozoomNudgeController() override;
- // SessionObserver:
- void OnActiveUserPrefServiceChanged(PrefService* prefs) override;
- // Registers profile prefs.
- static void RegisterProfilePrefs(PrefRegistrySimple* registry);
- protected:
- // SystemNudgeController:
- std::unique_ptr<SystemNudge> CreateSystemNudge() override;
- private:
- // Gets whether the user had enabled autozoom before.
- bool GetHadEnabled(PrefService* prefs);
- // Gets the number of times the nudge has been shown.
- int GetShownCount(PrefService* prefs);
- // Gets the last time the nudge was shown.
- base::Time GetLastShownTime(PrefService* prefs);
- // Checks whether another nudge can be shown.
- bool ShouldShowNudge(PrefService* prefs);
- // Gets the current time.
- base::Time GetTime();
- // Resets nudge state and show nudge timer.
- void HandleNudgeShown();
- // AutozoomObserver:
- void OnAutozoomStateChanged(
- cros::mojom::CameraAutoFramingState state) override;
- void OnAutozoomControlEnabledChanged(bool enabled) override;
- // Owned by ash/Shell.
- AutozoomControllerImpl* const autozoom_controller_;
- };
- } // namespace ash
- #endif // ASH_SYSTEM_CAMERA_AUTOZOOM_NUDGE_CONTROLLER_H_
|