@@ -40,10 +40,6 @@ constexpr gfx::Insets kContentInsets{kContentVerticalPadding};
40
40
// bottom if there's this much pixel left.
41
41
constexpr int kPrepareEndOfView = 30 ;
42
42
43
- // After the user is finished navigating to a different month, this is how long
44
- // we wait before fetchiung more events.
45
- constexpr base::TimeDelta kScrollingSettledTimeout = base::Milliseconds(100 );
46
-
47
43
// TODO(https://crbug.com/1236276): for some language it may start from "M".
48
44
constexpr int kDefaultWeekTitles [] = {
49
45
IDS_ASH_CALENDAR_SUN, IDS_ASH_CALENDAR_MON, IDS_ASH_CALENDAR_TUE,
@@ -124,15 +120,15 @@ class CalendarView::MonthYearHeaderView : public views::View {
124
120
: month_label_(AddChildView(std::make_unique<views::Label>())) {
125
121
switch (type) {
126
122
case PREVIOUS:
127
- date_ = calendar_view_controller->GetPreviousMonthFirstDay (1 );
123
+ date_ = calendar_view_controller->GetPreviousMonthFirstDay ();
128
124
month_name_ = calendar_view_controller->GetPreviousMonthName ();
129
125
break ;
130
126
case CURRENT:
131
127
date_ = calendar_view_controller->GetOnScreenMonthFirstDay ();
132
128
month_name_ = calendar_view_controller->GetOnScreenMonthName ();
133
129
break ;
134
130
case NEXT:
135
- date_ = calendar_view_controller->GetNextMonthFirstDay (1 );
131
+ date_ = calendar_view_controller->GetNextMonthFirstDay ();
136
132
month_name_ = calendar_view_controller->GetNextMonthName ();
137
133
break ;
138
134
}
@@ -192,12 +188,7 @@ CalendarView::CalendarView(DetailedViewDelegate* delegate,
192
188
CalendarViewController* calendar_view_controller)
193
189
: TrayDetailedView(delegate),
194
190
controller_ (controller),
195
- calendar_view_controller_(calendar_view_controller),
196
- scrolling_settled_timer_(
197
- FROM_HERE,
198
- kScrollingSettledTimeout ,
199
- base::BindRepeating (&CalendarView::OnScrollingSettledTimerFired,
200
- base::Unretained (this ))) {
191
+ calendar_view_controller_(calendar_view_controller) {
201
192
CreateTitleRow (IDS_ASH_CALENDAR_TITLE);
202
193
203
194
// Add the header.
@@ -272,10 +263,6 @@ CalendarView::CalendarView(DetailedViewDelegate* delegate,
272
263
273
264
CalendarView::~CalendarView () = default ;
274
265
275
- void CalendarView::Init () {
276
- calendar_view_controller_->FetchEvents ();
277
- }
278
-
279
266
void CalendarView::CreateExtraTitleRowButtons () {
280
267
DCHECK (!reset_to_today_button_);
281
268
tri_view ()->SetContainerVisible (TriView::Container::END, /* visible=*/ true );
@@ -309,14 +296,14 @@ views::Button* CalendarView::CreateInfoButton(
309
296
void CalendarView::SetMonthViews () {
310
297
previous_label_ = AddLabelWithId (LabelType::PREVIOUS);
311
298
previous_month_ =
312
- AddMonth (calendar_view_controller_->GetPreviousMonthFirstDay (1 ));
299
+ AddMonth (calendar_view_controller_->GetPreviousMonthFirstDay ());
313
300
314
301
current_label_ = AddLabelWithId (LabelType::CURRENT);
315
302
current_month_ =
316
303
AddMonth (calendar_view_controller_->GetOnScreenMonthFirstDay ());
317
304
318
305
next_label_ = AddLabelWithId (LabelType::NEXT);
319
- next_month_ = AddMonth (calendar_view_controller_->GetNextMonthFirstDay (1 ));
306
+ next_month_ = AddMonth (calendar_view_controller_->GetNextMonthFirstDay ());
320
307
}
321
308
322
309
int CalendarView::PositionOfCurrentMonth () {
@@ -498,20 +485,11 @@ void CalendarView::OnMonthChanged(const base::Time::Exploded current_month) {
498
485
499
486
header_->SetText (calendar_view_controller_->GetOnScreenMonthName ());
500
487
header_year_->SetText (year_string);
501
-
502
- scrolling_settled_timer_.Reset ();
503
- }
504
-
505
- void CalendarView::OnEventsFetched (
506
- const google_apis::calendar::EventList* events) {
507
- // No need to store the events, but we need to notify the month views that
508
- // something may have changed and they need to refresh.
509
- SchedulePaint ();
510
488
}
511
489
512
490
void CalendarView::ScrollUpOneMonth () {
513
491
calendar_view_controller_->UpdateMonth (
514
- calendar_view_controller_->GetPreviousMonthFirstDay (1 ));
492
+ calendar_view_controller_->GetPreviousMonthFirstDay ());
515
493
content_view_->RemoveChildViewT (next_label_);
516
494
content_view_->RemoveChildViewT (next_month_);
517
495
@@ -521,7 +499,7 @@ void CalendarView::ScrollUpOneMonth() {
521
499
current_month_ = previous_month_;
522
500
523
501
previous_month_ =
524
- AddMonth (calendar_view_controller_->GetPreviousMonthFirstDay (1 ),
502
+ AddMonth (calendar_view_controller_->GetPreviousMonthFirstDay (),
525
503
/* add_at_front=*/ true );
526
504
if (IsDateCellViewFocused ())
527
505
previous_month_->EnableFocus ();
@@ -550,7 +528,7 @@ void CalendarView::ScrollDownOneMonth() {
550
528
previous_label_->GetPreferredSize ().height ();
551
529
552
530
calendar_view_controller_->UpdateMonth (
553
- calendar_view_controller_->GetNextMonthFirstDay (1 ));
531
+ calendar_view_controller_->GetNextMonthFirstDay ());
554
532
555
533
content_view_->RemoveChildViewT (previous_label_);
556
534
content_view_->RemoveChildViewT (previous_month_);
@@ -561,7 +539,7 @@ void CalendarView::ScrollDownOneMonth() {
561
539
current_month_ = next_month_;
562
540
563
541
next_label_ = AddLabelWithId (LabelType::NEXT);
564
- next_month_ = AddMonth (calendar_view_controller_->GetNextMonthFirstDay (1 ));
542
+ next_month_ = AddMonth (calendar_view_controller_->GetNextMonthFirstDay ());
565
543
if (IsDateCellViewFocused ())
566
544
next_month_->EnableFocus ();
567
545
@@ -696,10 +674,6 @@ void CalendarView::OnEvent(ui::Event* event) {
696
674
}
697
675
}
698
676
699
- void CalendarView::OnScrollingSettledTimerFired () {
700
- calendar_view_controller_->FetchEvents ();
701
- }
702
-
703
677
BEGIN_METADATA (CalendarView, views::View)
704
678
END_METADATA
705
679
0 commit comments