OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/tabs/tab.h" | 5 #include "chrome/browser/ui/views/tabs/tab.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 // The minimum opacity (out of 1) when a tab (either active or inactive) is | 130 // The minimum opacity (out of 1) when a tab (either active or inactive) is |
131 // throbbing in the immersive mode light strip. | 131 // throbbing in the immersive mode light strip. |
132 const double kImmersiveTabMinThrobOpacity = 0.66; | 132 const double kImmersiveTabMinThrobOpacity = 0.66; |
133 | 133 |
134 // Number of steps in the immersive mode loading animation. | 134 // Number of steps in the immersive mode loading animation. |
135 const int kImmersiveLoadingStepCount = 32; | 135 const int kImmersiveLoadingStepCount = 32; |
136 | 136 |
137 const char kTabCloseButtonName[] = "TabCloseButton"; | 137 const char kTabCloseButtonName[] = "TabCloseButton"; |
138 const int kTabCloseButtonSize = 16; | 138 const int kTabCloseButtonSize = 16; |
139 | 139 |
140 // Layer-backed view for updating a waiting or loading tab spinner. | |
Peter Kasting
2015/10/09 08:03:23
Tiny nit: Please be consistent about using the wor
tapted
2015/10/09 11:00:31
Done.
| |
141 class ThrobberView : public views::View { | |
142 public: | |
143 explicit ThrobberView(Tab* owner) : owner_(owner) { | |
Peter Kasting
2015/10/09 08:03:24
Don't define any of these class methods inline; de
tapted
2015/10/09 11:00:31
Done.
| |
144 // Since the throbber animates, paint to a separate layer do reduce repaint | |
Peter Kasting
2015/10/09 08:03:24
Nit: do -> to ?
Maybe you want "can animate for a
tapted
2015/10/09 11:00:31
Done.
| |
145 // overheads. | |
Peter Kasting
2015/10/09 08:03:23
Nit: overheads -> overhead
tapted
2015/10/09 11:00:31
Done.
| |
146 SetPaintToLayer(true); | |
147 SetFillsBoundsOpaquely(false); | |
148 } | |
149 | |
150 // views::View: | |
151 bool CanProcessEventsWithinSubtree() const override { return false; } | |
152 | |
153 void OnPaint(gfx::Canvas* canvas) override { | |
154 const TabRendererData::NetworkState state = owner_->data().network_state; | |
155 if (state == TabRendererData::NETWORK_STATE_NONE) | |
156 return; | |
157 | |
158 const gfx::Rect bounds = GetLocalBounds(); | |
Peter Kasting
2015/10/09 08:03:23
Nit: Might as well define this just below |tp|, th
tapted
2015/10/09 11:00:31
Done.
| |
159 | |
160 // Paint network activity (aka throbber) animation frame. | |
Peter Kasting
2015/10/09 08:03:24
Nit: It's weird to say "aka throbber" in a class w
tapted
2015/10/09 11:00:31
Done.
| |
161 ui::ThemeProvider* tp = GetThemeProvider(); | |
162 if (state == TabRendererData::NETWORK_STATE_WAITING) { | |
163 if (waiting_start_time_ == base::TimeTicks()) | |
164 waiting_start_time_ = base::TimeTicks::Now(); | |
165 | |
166 waiting_state_.elapsed_time = | |
167 base::TimeTicks::Now() - waiting_start_time_; | |
168 gfx::PaintThrobberWaiting( | |
169 canvas, bounds, tp->GetColor(ThemeProperties::COLOR_THROBBER_WAITING), | |
170 waiting_state_.elapsed_time); | |
171 } else { | |
172 if (loading_start_time_ == base::TimeTicks()) | |
173 loading_start_time_ = base::TimeTicks::Now(); | |
174 | |
175 waiting_state_.color = | |
176 tp->GetColor(ThemeProperties::COLOR_THROBBER_WAITING); | |
177 gfx::PaintThrobberSpinningAfterWaiting( | |
178 canvas, bounds, | |
179 tp->GetColor(ThemeProperties::COLOR_THROBBER_SPINNING), | |
180 base::TimeTicks::Now() - loading_start_time_, &waiting_state_); | |
181 } | |
182 } | |
183 | |
184 private: | |
185 Tab* owner_; // Weak. Owns |this|. | |
186 | |
187 // The point in time when the tab icon was first painted in the waiting state. | |
188 base::TimeTicks waiting_start_time_; | |
189 | |
190 // The point in time when the tab icon was first painted in the loading state. | |
191 base::TimeTicks loading_start_time_; | |
192 | |
193 // Paint state for the throbber after the most recent waiting paint. | |
194 gfx::ThrobberWaitingState waiting_state_; | |
195 | |
196 DISALLOW_COPY_AND_ASSIGN(ThrobberView); | |
197 }; | |
198 | |
140 void DrawIconAtLocation(gfx::Canvas* canvas, | 199 void DrawIconAtLocation(gfx::Canvas* canvas, |
141 const gfx::ImageSkia& image, | 200 const gfx::ImageSkia& image, |
142 int image_offset, | 201 int image_offset, |
143 int dst_x, | 202 int dst_x, |
144 int dst_y, | 203 int dst_y, |
145 int icon_width, | 204 int icon_width, |
146 int icon_height, | 205 int icon_height, |
147 bool filter, | 206 bool filter, |
148 const SkPaint& paint) { | 207 const SkPaint& paint) { |
149 // NOTE: the clipping is a work around for 69528, it shouldn't be necessary. | 208 // NOTE: the clipping is a work around for 69528, it shouldn't be necessary. |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
405 // Tab, public: | 464 // Tab, public: |
406 | 465 |
407 Tab::Tab(TabController* controller) | 466 Tab::Tab(TabController* controller) |
408 : controller_(controller), | 467 : controller_(controller), |
409 closing_(false), | 468 closing_(false), |
410 dragging_(false), | 469 dragging_(false), |
411 detached_(false), | 470 detached_(false), |
412 favicon_hiding_offset_(0), | 471 favicon_hiding_offset_(0), |
413 immersive_loading_step_(0), | 472 immersive_loading_step_(0), |
414 should_display_crashed_favicon_(false), | 473 should_display_crashed_favicon_(false), |
474 throbber_(nullptr), | |
415 media_indicator_button_(nullptr), | 475 media_indicator_button_(nullptr), |
416 close_button_(nullptr), | 476 close_button_(nullptr), |
417 title_(new views::Label()), | 477 title_(new views::Label()), |
418 tab_activated_with_last_tap_down_(false), | 478 tab_activated_with_last_tap_down_(false), |
419 hover_controller_(this), | 479 hover_controller_(this), |
420 showing_icon_(false), | 480 showing_icon_(false), |
421 showing_media_indicator_(false), | 481 showing_media_indicator_(false), |
422 showing_close_button_(false), | 482 showing_close_button_(false), |
423 button_color_(SK_ColorTRANSPARENT) { | 483 button_color_(SK_ColorTRANSPARENT) { |
424 DCHECK(controller); | 484 DCHECK(controller); |
425 InitTabResources(); | 485 InitTabResources(); |
426 | 486 |
427 // So we get don't get enter/exit on children and don't prematurely stop the | 487 // So we get don't get enter/exit on children and don't prematurely stop the |
428 // hover. | 488 // hover. |
429 set_notify_enter_exit_on_child(true); | 489 set_notify_enter_exit_on_child(true); |
430 | 490 |
431 set_id(VIEW_ID_TAB); | 491 set_id(VIEW_ID_TAB); |
432 | 492 |
433 title_->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD); | 493 title_->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD); |
434 title_->SetElideBehavior(gfx::FADE_TAIL); | 494 title_->SetElideBehavior(gfx::FADE_TAIL); |
435 title_->SetHandlesTooltips(false); | 495 title_->SetHandlesTooltips(false); |
436 title_->SetAutoColorReadabilityEnabled(false); | 496 title_->SetAutoColorReadabilityEnabled(false); |
437 title_->SetText(CoreTabHelper::GetDefaultTitle()); | 497 title_->SetText(CoreTabHelper::GetDefaultTitle()); |
438 AddChildView(title_); | 498 AddChildView(title_); |
439 | 499 |
440 SetEventTargeter( | 500 SetEventTargeter( |
441 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); | 501 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); |
442 | 502 |
503 throbber_ = new ThrobberView(this); | |
504 AddChildView(throbber_); | |
505 | |
443 media_indicator_button_ = new MediaIndicatorButton(this); | 506 media_indicator_button_ = new MediaIndicatorButton(this); |
444 AddChildView(media_indicator_button_); | 507 AddChildView(media_indicator_button_); |
445 | 508 |
446 close_button_ = new TabCloseButton(this); | 509 close_button_ = new TabCloseButton(this); |
447 close_button_->SetAccessibleName( | 510 close_button_->SetAccessibleName( |
448 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); | 511 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); |
449 // The normal image is set by OnButtonColorMaybeChanged() because it depends | 512 // The normal image is set by OnButtonColorMaybeChanged() because it depends |
450 // on the current theme and active state. The hovered and pressed images | 513 // on the current theme and active state. The hovered and pressed images |
451 // don't depend on the these, so we can set them here. | 514 // don't depend on the these, so we can set them here. |
452 const gfx::ImageSkia& hovered = gfx::CreateVectorIcon( | 515 const gfx::ImageSkia& hovered = gfx::CreateVectorIcon( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
487 return controller_->IsTabSelected(this); | 550 return controller_->IsTabSelected(this); |
488 } | 551 } |
489 | 552 |
490 void Tab::SetData(const TabRendererData& data) { | 553 void Tab::SetData(const TabRendererData& data) { |
491 DCHECK(GetWidget()); | 554 DCHECK(GetWidget()); |
492 | 555 |
493 if (data_.Equals(data)) | 556 if (data_.Equals(data)) |
494 return; | 557 return; |
495 | 558 |
496 TabRendererData old(data_); | 559 TabRendererData old(data_); |
560 UpdateLoadingAnimation(data.network_state); | |
tapted
2015/10/09 06:39:02
I noticed the throbber would hang around with some
| |
497 data_ = data; | 561 data_ = data; |
498 | 562 |
499 base::string16 title = data_.title; | 563 base::string16 title = data_.title; |
500 if (title.empty()) { | 564 if (title.empty()) { |
501 title = data_.loading ? | 565 title = data_.loading ? |
502 l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE) : | 566 l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE) : |
503 CoreTabHelper::GetDefaultTitle(); | 567 CoreTabHelper::GetDefaultTitle(); |
504 } else { | 568 } else { |
505 Browser::FormatTitleForDisplay(&title); | 569 Browser::FormatTitleForDisplay(&title); |
506 } | 570 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
545 } | 609 } |
546 | 610 |
547 void Tab::UpdateLoadingAnimation(TabRendererData::NetworkState state) { | 611 void Tab::UpdateLoadingAnimation(TabRendererData::NetworkState state) { |
548 if (state == data_.network_state && | 612 if (state == data_.network_state && |
549 state == TabRendererData::NETWORK_STATE_NONE) { | 613 state == TabRendererData::NETWORK_STATE_NONE) { |
550 // If the network state is none and hasn't changed, do nothing. Otherwise we | 614 // If the network state is none and hasn't changed, do nothing. Otherwise we |
551 // need to advance the animation frame. | 615 // need to advance the animation frame. |
552 return; | 616 return; |
553 } | 617 } |
554 | 618 |
555 TabRendererData::NetworkState old_state = data_.network_state; | |
556 data_.network_state = state; | 619 data_.network_state = state; |
557 AdvanceLoadingAnimation(old_state, state); | 620 AdvanceLoadingAnimation(state); |
558 } | 621 } |
559 | 622 |
560 void Tab::StartPulse() { | 623 void Tab::StartPulse() { |
561 pulse_animation_.reset(new gfx::ThrobAnimation(this)); | 624 pulse_animation_.reset(new gfx::ThrobAnimation(this)); |
562 pulse_animation_->SetSlideDuration(kPulseDurationMs); | 625 pulse_animation_->SetSlideDuration(kPulseDurationMs); |
563 if (animation_container_.get()) | 626 if (animation_container_.get()) |
564 pulse_animation_->SetContainer(animation_container_.get()); | 627 pulse_animation_->SetContainer(animation_container_.get()); |
565 pulse_animation_->StartThrobbing(std::numeric_limits<int>::max()); | 628 pulse_animation_->StartThrobbing(std::numeric_limits<int>::max()); |
566 } | 629 } |
567 | 630 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
780 const int extra_padding = | 843 const int extra_padding = |
781 (controller_->ShouldHideCloseButtonForInactiveTabs() || | 844 (controller_->ShouldHideCloseButtonForInactiveTabs() || |
782 (IconCapacity() < 3)) ? 0 : kExtraLeftPaddingToBalanceCloseButtonPadding; | 845 (IconCapacity() < 3)) ? 0 : kExtraLeftPaddingToBalanceCloseButtonPadding; |
783 const int start = lb.x() + extra_padding; | 846 const int start = lb.x() + extra_padding; |
784 favicon_bounds_.SetRect(start, lb.y(), 0, 0); | 847 favicon_bounds_.SetRect(start, lb.y(), 0, 0); |
785 if (showing_icon_) { | 848 if (showing_icon_) { |
786 favicon_bounds_.set_size(gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize)); | 849 favicon_bounds_.set_size(gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize)); |
787 favicon_bounds_.set_y(lb.y() + (lb.height() - gfx::kFaviconSize + 1) / 2); | 850 favicon_bounds_.set_y(lb.y() + (lb.height() - gfx::kFaviconSize + 1) / 2); |
788 MaybeAdjustLeftForPinnedTab(&favicon_bounds_); | 851 MaybeAdjustLeftForPinnedTab(&favicon_bounds_); |
789 } | 852 } |
853 throbber_->SetBoundsRect(favicon_bounds_); | |
790 | 854 |
791 showing_close_button_ = ShouldShowCloseBox(); | 855 showing_close_button_ = ShouldShowCloseBox(); |
792 if (showing_close_button_) { | 856 if (showing_close_button_) { |
793 // If the ratio of the close button size to tab width exceeds the maximum. | 857 // If the ratio of the close button size to tab width exceeds the maximum. |
794 // The close button should be as large as possible so that there is a larger | 858 // The close button should be as large as possible so that there is a larger |
795 // hit-target for touch events. So the close button bounds extends to the | 859 // hit-target for touch events. So the close button bounds extends to the |
796 // edges of the tab. However, the larger hit-target should be active only | 860 // edges of the tab. However, the larger hit-target should be active only |
797 // for mouse events, and the close-image should show up in the right place. | 861 // for mouse events, and the close-image should show up in the right place. |
798 // So a border is added to the button with necessary padding. The close | 862 // So a border is added to the button with necessary padding. The close |
799 // button (BaseTab::TabCloseButton) makes sure the padding is a hit-target | 863 // button (BaseTab::TabCloseButton) makes sure the padding is a hit-target |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1340 } | 1404 } |
1341 | 1405 |
1342 void Tab::PaintIcon(gfx::Canvas* canvas) { | 1406 void Tab::PaintIcon(gfx::Canvas* canvas) { |
1343 gfx::Rect bounds = favicon_bounds_; | 1407 gfx::Rect bounds = favicon_bounds_; |
1344 if (bounds.IsEmpty()) | 1408 if (bounds.IsEmpty()) |
1345 return; | 1409 return; |
1346 | 1410 |
1347 bounds.set_x(GetMirroredXForRect(bounds)); | 1411 bounds.set_x(GetMirroredXForRect(bounds)); |
1348 | 1412 |
1349 if (data().network_state != TabRendererData::NETWORK_STATE_NONE) { | 1413 if (data().network_state != TabRendererData::NETWORK_STATE_NONE) { |
1350 // Paint network activity (aka throbber) animation frame. | 1414 // Throbber will do its own painting. |
1351 ui::ThemeProvider* tp = GetThemeProvider(); | |
1352 if (data().network_state == TabRendererData::NETWORK_STATE_WAITING) { | |
1353 if (waiting_start_time_ == base::TimeTicks()) | |
1354 waiting_start_time_ = base::TimeTicks::Now(); | |
1355 | |
1356 waiting_state_.elapsed_time = | |
1357 base::TimeTicks::Now() - waiting_start_time_; | |
1358 gfx::PaintThrobberWaiting( | |
1359 canvas, bounds, tp->GetColor(ThemeProperties::COLOR_THROBBER_WAITING), | |
1360 waiting_state_.elapsed_time); | |
1361 } else { | |
1362 if (loading_start_time_ == base::TimeTicks()) | |
1363 loading_start_time_ = base::TimeTicks::Now(); | |
1364 | |
1365 waiting_state_.color = | |
1366 tp->GetColor(ThemeProperties::COLOR_THROBBER_WAITING); | |
1367 gfx::PaintThrobberSpinningAfterWaiting( | |
1368 canvas, bounds, | |
1369 tp->GetColor(ThemeProperties::COLOR_THROBBER_SPINNING), | |
1370 base::TimeTicks::Now() - loading_start_time_, &waiting_state_); | |
1371 } | |
1372 } else if (should_display_crashed_favicon_) { | 1415 } else if (should_display_crashed_favicon_) { |
1373 // Paint crash favicon. | 1416 // Paint crash favicon. |
1374 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 1417 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
1375 gfx::ImageSkia crashed_favicon(*rb.GetImageSkiaNamed(IDR_SAD_FAVICON)); | 1418 gfx::ImageSkia crashed_favicon(*rb.GetImageSkiaNamed(IDR_SAD_FAVICON)); |
1376 bounds.set_y(bounds.y() + favicon_hiding_offset_); | 1419 bounds.set_y(bounds.y() + favicon_hiding_offset_); |
1377 DrawIconCenter(canvas, crashed_favicon, 0, | 1420 DrawIconCenter(canvas, crashed_favicon, 0, |
1378 crashed_favicon.width(), | 1421 crashed_favicon.width(), |
1379 crashed_favicon.height(), | 1422 crashed_favicon.height(), |
1380 bounds, true, SkPaint()); | 1423 bounds, true, SkPaint()); |
1381 } else if (!data().favicon.isNull()) { | 1424 } else if (!data().favicon.isNull()) { |
1382 // Paint the normal favicon. | 1425 // Paint the normal favicon. |
1383 DrawIconCenter(canvas, data().favicon, 0, | 1426 DrawIconCenter(canvas, data().favicon, 0, |
1384 data().favicon.width(), | 1427 data().favicon.width(), |
1385 data().favicon.height(), | 1428 data().favicon.height(), |
1386 bounds, true, SkPaint()); | 1429 bounds, true, SkPaint()); |
1387 } | 1430 } |
1388 } | 1431 } |
1389 | 1432 |
1390 void Tab::AdvanceLoadingAnimation(TabRendererData::NetworkState old_state, | 1433 void Tab::AdvanceLoadingAnimation(TabRendererData::NetworkState state) { |
1391 TabRendererData::NetworkState state) { | 1434 if (controller_->IsImmersiveStyle()) { |
1392 if (state == TabRendererData::NETWORK_STATE_WAITING) { | 1435 if (state == TabRendererData::NETWORK_STATE_WAITING) { |
1393 // Waiting steps backwards. | 1436 // Waiting steps backwards. |
1394 immersive_loading_step_ = | 1437 immersive_loading_step_ = |
1395 (immersive_loading_step_ - 1 + kImmersiveLoadingStepCount) % | 1438 (immersive_loading_step_ - 1 + kImmersiveLoadingStepCount) % |
1396 kImmersiveLoadingStepCount; | 1439 kImmersiveLoadingStepCount; |
1397 } else if (state == TabRendererData::NETWORK_STATE_LOADING) { | 1440 } else if (state == TabRendererData::NETWORK_STATE_LOADING) { |
1398 immersive_loading_step_ = (immersive_loading_step_ + 1) % | 1441 immersive_loading_step_ = |
1399 kImmersiveLoadingStepCount; | 1442 (immersive_loading_step_ + 1) % kImmersiveLoadingStepCount; |
1400 } else { | 1443 } else { |
1401 waiting_start_time_ = base::TimeTicks(); | 1444 immersive_loading_step_ = 0; |
1402 loading_start_time_ = base::TimeTicks(); | 1445 } |
1403 waiting_state_ = gfx::ThrobberWaitingState(); | 1446 |
1404 immersive_loading_step_ = 0; | 1447 SchedulePaintInRect(GetImmersiveBarRect()); |
1448 return; | |
1405 } | 1449 } |
1406 if (controller_->IsImmersiveStyle()) { | 1450 |
1407 SchedulePaintInRect(GetImmersiveBarRect()); | 1451 // To ensure the throbber layer does not paint over stacked or dragged tabs, |
1408 } else { | 1452 // hide it when the favicon would be clipped out. Check for any clipping on |
1409 ScheduleIconPaint(); | 1453 // the left since the shoulder of a dragged tab can still paint over the icon. |
1454 gfx::Rect clip = GetLocalBounds(); | |
1455 const bool needs_throbber = state != TabRendererData::NETWORK_STATE_NONE && | |
1456 controller_->ShouldPaintTab(this, &clip) && | |
1457 clip.x() == 0 && clip.Contains(favicon_bounds_); | |
1458 | |
1459 if (needs_throbber != throbber_->visible()) { | |
1460 ScheduleIconPaint(); // Repaint the icon area to update favicon visibility. | |
1461 throbber_->SetVisible(needs_throbber); | |
Peter Kasting
2015/10/09 08:03:23
Nit: For clarity, you might want to reverse these
tapted
2015/10/09 11:00:31
Done.
| |
1410 } | 1462 } |
1463 throbber_->SchedulePaint(); | |
1411 } | 1464 } |
1412 | 1465 |
1413 int Tab::IconCapacity() const { | 1466 int Tab::IconCapacity() const { |
1414 const gfx::Size min_size(GetMinimumUnselectedSize()); | 1467 const gfx::Size min_size(GetMinimumUnselectedSize()); |
1415 if (height() < min_size.height()) | 1468 if (height() < min_size.height()) |
1416 return 0; | 1469 return 0; |
1417 const int available_width = std::max(0, width() - min_size.width()); | 1470 const int available_width = std::max(0, width() - min_size.width()); |
1418 // All icons are the same size as the favicon. | 1471 // All icons are the same size as the favicon. |
1419 const int icon_width = gfx::kFaviconSize; | 1472 const int icon_width = gfx::kFaviconSize; |
1420 // We need enough space to display the icons flush against each other. | 1473 // We need enough space to display the icons flush against each other. |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1679 const gfx::ImageSkia& image) { | 1732 const gfx::ImageSkia& image) { |
1680 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1733 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
1681 ImageCacheEntry entry; | 1734 ImageCacheEntry entry; |
1682 entry.resource_id = resource_id; | 1735 entry.resource_id = resource_id; |
1683 entry.scale_factor = scale_factor; | 1736 entry.scale_factor = scale_factor; |
1684 entry.image = image; | 1737 entry.image = image; |
1685 image_cache_->push_front(entry); | 1738 image_cache_->push_front(entry); |
1686 if (image_cache_->size() > kMaxImageCacheSize) | 1739 if (image_cache_->size() > kMaxImageCacheSize) |
1687 image_cache_->pop_back(); | 1740 image_cache_->pop_back(); |
1688 } | 1741 } |
OLD | NEW |