#include "chrome/browser/new_tab_page/modules/v2/calendar/google_calendar_page_handler.h"
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/hash/hash.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "chrome/browser/new_tab_page/modules/v2/calendar/calendar_data.mojom.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/search/ntp_features.h"
#include "components/signin/public/base/consent_level.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "google_apis/calendar/calendar_api_requests.h"
#include "google_apis/calendar/calendar_api_response_types.h"
#include "google_apis/common/auth_service.h"
#include "google_apis/common/request_sender.h"
#include "google_apis/gaia/gaia_constants.h"
namespace {
const char kGoogleCalendarLastDismissedTimePrefName[] = …;
const char kGoogleCalendarDriveIconUrl[] = …;
constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation = …;
ntp::calendar::mojom::CalendarEventPtr GetFakeEvent(int index) { … }
std::vector<ntp::calendar::mojom::CalendarEventPtr> GetFakeEvents() { … }
std::unique_ptr<google_apis::RequestSender> MakeSender(Profile* profile) { … }
}
void GoogleCalendarPageHandler::RegisterProfilePrefs(
PrefRegistrySimple* registry) { … }
GoogleCalendarPageHandler::GoogleCalendarPageHandler(
mojo::PendingReceiver<ntp::calendar::mojom::GoogleCalendarPageHandler>
handler,
Profile* profile,
std::unique_ptr<google_apis::RequestSender> sender)
: … { … }
GoogleCalendarPageHandler::GoogleCalendarPageHandler(
mojo::PendingReceiver<ntp::calendar::mojom::GoogleCalendarPageHandler>
handler,
Profile* profile)
: … { … }
GoogleCalendarPageHandler::~GoogleCalendarPageHandler() = default;
void GoogleCalendarPageHandler::GetEvents(GetEventsCallback callback) { … }
void GoogleCalendarPageHandler::DismissModule() { … }
void GoogleCalendarPageHandler::RestoreModule() { … }
void GoogleCalendarPageHandler::OnRequestComplete(
GetEventsCallback callback,
google_apis::ApiErrorCode response_code,
std::unique_ptr<google_apis::calendar::EventList> events) { … }