#ifndef ASH_GLANCEABLES_CLASSROOM_GLANCEABLES_CLASSROOM_STUDENT_VIEW_H_
#define ASH_GLANCEABLES_CLASSROOM_GLANCEABLES_CLASSROOM_STUDENT_VIEW_H_
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "ash/ash_export.h"
#include "ash/glanceables/common/glanceables_time_management_bubble_view.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
#include "ui/base/metadata/metadata_header_macros.h"
class GURL;
class PrefRegistrySimple;
class PrefService;
namespace views {
class Label;
}
namespace ash {
struct GlanceablesClassroomAssignment;
enum class StudentAssignmentsListType {
kAssigned = 0,
kNoDueDate = 1,
kMissing = 2,
kDone = 3,
kMaxValue = kDone
};
class ASH_EXPORT GlanceablesClassroomStudentView
: public GlanceablesTimeManagementBubbleView {
METADATA_HEADER(GlanceablesClassroomStudentView,
GlanceablesTimeManagementBubbleView)
public:
GlanceablesClassroomStudentView();
GlanceablesClassroomStudentView(const GlanceablesClassroomStudentView&) =
delete;
GlanceablesClassroomStudentView& operator=(
const GlanceablesClassroomStudentView&) = delete;
~GlanceablesClassroomStudentView() override;
static void RegisterUserProfilePrefs(PrefRegistrySimple* registry);
static void ClearUserStatePrefs(PrefService* pref_service);
void CancelUpdates();
private:
void OnHeaderIconPressed() override;
void OnFooterButtonPressed() override;
void SelectedListChanged() override;
void AnimateResize(ResizeAnimation::Type resize_type) override;
void OpenUrl(const GURL& url) const;
void OnItemViewPressed(bool initial_list_selected, const GURL& url);
void SelectedAssignmentListChanged(bool initial_update);
void OnGetAssignments(
const std::u16string& list_name,
bool initial_update,
bool success,
std::vector<std::unique_ptr<GlanceablesClassroomAssignment>> assignments);
raw_ptr<views::Label> empty_list_label_ = nullptr;
size_t total_assignments_ = 0u;
const base::Time shown_time_;
base::TimeTicks assignments_requested_time_;
std::optional<base::TimeTicks> list_shown_start_time_;
bool first_assignment_list_shown_ = false;
int selected_list_change_count_ = 0;
StudentAssignmentsListType selected_list_type_ =
StudentAssignmentsListType::kAssigned;
base::WeakPtrFactory<GlanceablesClassroomStudentView> weak_ptr_factory_{this};
};
}
#endif