| // Copyright 2023 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef CHROME_BROWSER_UI_ASH_GLANCEABLES_GLANCEABLES_CLASSROOM_CLIENT_IMPL_H_ |
| #define CHROME_BROWSER_UI_ASH_GLANCEABLES_GLANCEABLES_CLASSROOM_CLIENT_IMPL_H_ |
| |
| #include <memory> |
| #include <string> |
| #include <vector> |
| |
| #include "ash/glanceables/classroom/glanceables_classroom_client.h" |
| #include "base/functional/callback_forward.h" |
| #include "base/memory/weak_ptr.h" |
| #include "google_apis/common/request_sender.h" |
| |
| namespace net { |
| struct NetworkTrafficAnnotationTag; |
| } // namespace net |
| |
| namespace ash { |
| |
| // Provides implementation for `GlanceablesClassroomClient`. Responsible for |
| // communication with Google Classroom API. |
| class GlanceablesClassroomClientImpl : public GlanceablesClassroomClient { |
| public: |
| // Provides an instance of `google_apis::RequestSender` for the client. |
| using CreateRequestSenderCallback = |
| base::RepeatingCallback<std::unique_ptr<google_apis::RequestSender>( |
| const std::vector<std::string>& scopes, |
| const net::NetworkTrafficAnnotationTag& traffic_annotation_tag)>; |
| |
| explicit GlanceablesClassroomClientImpl( |
| const CreateRequestSenderCallback& create_request_sender_callback); |
| GlanceablesClassroomClientImpl(const GlanceablesClassroomClientImpl&) = |
| delete; |
| GlanceablesClassroomClientImpl& operator=( |
| const GlanceablesClassroomClientImpl&) = delete; |
| ~GlanceablesClassroomClientImpl(); |
| |
| private: |
| // Callback passed from `GlanceablesKeyedService` that creates |
| // `request_sender_`. |
| const CreateRequestSenderCallback create_request_sender_callback_; |
| |
| base::WeakPtrFactory<GlanceablesClassroomClientImpl> weak_factory_{this}; |
| }; |
| |
| } // namespace ash |
| |
| #endif // CHROME_BROWSER_UI_ASH_GLANCEABLES_GLANCEABLES_CLASSROOM_CLIENT_IMPL_H_ |