Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: chrome/browser/ui/views/tabs/tab.cc

Issue 18486007: Fix the misalignment on CrOS of the tab background images (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/defaults.h" 12 #include "chrome/browser/defaults.h"
13 #include "chrome/browser/themes/theme_properties.h" 13 #include "chrome/browser/themes/theme_properties.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 15 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
16 #include "chrome/browser/ui/tabs/tab_resources.h" 16 #include "chrome/browser/ui/tabs/tab_resources.h"
17 #include "chrome/browser/ui/view_ids.h" 17 #include "chrome/browser/ui/view_ids.h"
18 #include "chrome/browser/ui/views/tabs/tab_controller.h" 18 #include "chrome/browser/ui/views/tabs/tab_controller.h"
19 #include "chrome/browser/ui/views/tabs/tab_util.h"
19 #include "chrome/browser/ui/views/theme_image_mapper.h" 20 #include "chrome/browser/ui/views/theme_image_mapper.h"
20 #include "chrome/browser/ui/views/touch_uma/touch_uma.h" 21 #include "chrome/browser/ui/views/touch_uma/touch_uma.h"
21 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
22 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
23 #include "grit/theme_resources.h" 24 #include "grit/theme_resources.h"
24 #include "grit/ui_resources.h" 25 #include "grit/ui_resources.h"
25 #include "third_party/skia/include/effects/SkGradientShader.h" 26 #include "third_party/skia/include/effects/SkGradientShader.h"
26 #include "ui/base/accessibility/accessible_view_state.h" 27 #include "ui/base/accessibility/accessible_view_state.h"
27 #include "ui/base/animation/animation_container.h" 28 #include "ui/base/animation/animation_container.h"
28 #include "ui/base/animation/multi_animation.h" 29 #include "ui/base/animation/multi_animation.h"
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 // And then the gradient on top of that. 1226 // And then the gradient on top of that.
1226 if (animation->current_part_index() == 2) { 1227 if (animation->current_part_index() == 2) {
1227 uint8 alpha = animation->CurrentValueBetween(255, 0); 1228 uint8 alpha = animation->CurrentValueBetween(255, 0);
1228 canvas->DrawImageInt(hover_image, 0, 0, alpha); 1229 canvas->DrawImageInt(hover_image, 0, 0, alpha);
1229 } else { 1230 } else {
1230 canvas->DrawImageInt(hover_image, 0, 0); 1231 canvas->DrawImageInt(hover_image, 0, 0);
1231 } 1232 }
1232 } 1233 }
1233 1234
1234 void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) { 1235 void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) {
1235 int tab_id; 1236 int background_id;
1236 int frame_id; 1237 int background_overlay_id;
1237 views::Widget* widget = GetWidget(); 1238 views::Widget* widget = GetWidget();
1238 GetTabIdAndFrameId(widget, &tab_id, &frame_id); 1239 GetInactiveBackgroundIdAndOverlayId(widget, &background_id,
1240 &background_overlay_id);
1239 1241
1240 // Explicitly map the id so we cache correctly. 1242 // Explicitly map the id so we cache correctly.
1241 const chrome::HostDesktopType host_desktop_type = GetHostDesktopType(this); 1243 const chrome::HostDesktopType host_desktop_type = GetHostDesktopType(this);
1242 tab_id = chrome::MapThemeImage(host_desktop_type, tab_id); 1244 background_id = chrome::MapThemeImage(host_desktop_type, background_id);
1243 1245
1244 // HasCustomImage() is only true if the theme provides the image. However, 1246 // HasCustomImage() is only true if the theme provides the image. However,
1245 // even if the theme does not provide a tab background, the theme machinery 1247 // even if the theme does not provide a tab background, the theme machinery
1246 // will make one if given a frame image. 1248 // will make one if given a frame image.
1247 ui::ThemeProvider* theme_provider = GetThemeProvider(); 1249 ui::ThemeProvider* theme_provider = GetThemeProvider();
1248 const bool theme_provided_image = theme_provider->HasCustomImage(tab_id) || 1250 const bool theme_provided_image =
1249 (frame_id != 0 && theme_provider->HasCustomImage(frame_id)); 1251 theme_provider->HasCustomImage(IDR_THEME_FRAME) ||
1252 theme_provider->HasCustomImage(background_id) ||
1253 theme_provider->HasCustomImage(background_overlay_id);
1250 1254
1251 const bool can_cache = !theme_provided_image && 1255 const bool can_cache = !theme_provided_image &&
1252 !hover_controller_.ShouldDraw(); 1256 !hover_controller_.ShouldDraw();
1253 1257
1254 if (can_cache) { 1258 if (can_cache) {
1259 // The default theme does not provide background overlay images.
1255 gfx::ImageSkia cached_image( 1260 gfx::ImageSkia cached_image(
1256 GetCachedImage(tab_id, size(), canvas->scale_factor())); 1261 GetCachedImage(background_id, size(), canvas->scale_factor()));
1257 if (cached_image.width() == 0) { 1262 if (cached_image.width() == 0) {
1258 gfx::Canvas tmp_canvas(size(), canvas->scale_factor(), false); 1263 gfx::Canvas tmp_canvas(size(), canvas->scale_factor(), false);
1259 PaintInactiveTabBackgroundUsingResourceId(&tmp_canvas, tab_id); 1264 PaintInactiveTabBackgroundUsingResourceIds(&tmp_canvas, background_id,
1265 background_overlay_id);
1260 cached_image = gfx::ImageSkia(tmp_canvas.ExtractImageRep()); 1266 cached_image = gfx::ImageSkia(tmp_canvas.ExtractImageRep());
1261 SetCachedImage(tab_id, canvas->scale_factor(), cached_image); 1267 SetCachedImage(background_id, canvas->scale_factor(), cached_image);
1262 } 1268 }
1263 canvas->DrawImageInt(cached_image, 0, 0); 1269 canvas->DrawImageInt(cached_image, 0, 0);
1264 } else { 1270 } else {
1265 PaintInactiveTabBackgroundUsingResourceId(canvas, tab_id); 1271 PaintInactiveTabBackgroundUsingResourceIds(canvas, background_id,
1272 background_overlay_id);
1266 } 1273 }
1267 } 1274 }
1268 1275
1269 void Tab::PaintInactiveTabBackgroundUsingResourceId(gfx::Canvas* canvas, 1276 void Tab::PaintInactiveTabBackgroundUsingResourceIds(
1270 int tab_id) { 1277 gfx::Canvas* canvas,
1278 int background_id,
1279 int background_overlay_id) {
1271 // WARNING: the inactive tab background may be cached. If you change what it 1280 // WARNING: the inactive tab background may be cached. If you change what it
1272 // is drawn from you may need to update whether it can be cached. 1281 // is drawn from you may need to update whether it can be cached.
1273 1282
1274 // The tab image needs to be lined up with the background image 1283 // The tab image needs to be lined up with the background image
1275 // so that it feels partially transparent. These offsets represent the tab 1284 // so that it feels partially transparent. This offset represents the tab
1276 // position within the frame background image. 1285 // position within the frame background image.
1277 int offset = GetMirroredX() + background_offset_.x(); 1286 int offset = GetMirroredX() + background_offset_.x();
1278 1287
1279 gfx::ImageSkia* tab_bg = GetThemeProvider()->GetImageSkiaNamed(tab_id); 1288 ui::ThemeProvider* tp = GetThemeProvider();
1280
1281 TabImage* tab_image = &tab_active_; 1289 TabImage* tab_image = &tab_active_;
1282 TabImage* tab_inactive_image = &tab_inactive_; 1290 TabImage* tab_inactive_image = &tab_inactive_;
1283 TabImage* alpha = &tab_alpha_; 1291 TabImage* alpha = &tab_alpha_;
1284 1292
1285 // If the theme is providing a custom background image, then its top edge
1286 // should be at the top of the tab. Otherwise, we assume that the background
1287 // image is a composited foreground + frame image.
1288 int bg_offset_y = GetThemeProvider()->HasCustomImage(tab_id) ?
1289 0 : background_offset_.y();
1290
1291 // We need a gfx::Canvas object to be able to extract the image from. 1293 // We need a gfx::Canvas object to be able to extract the image from.
1292 // We draw everything to this canvas and then output it to the canvas 1294 // We draw everything to this canvas and then output it to the canvas
1293 // parameter in addition to using it to mask the hover glow if needed. 1295 // parameter in addition to using it to mask the hover glow if needed.
1294 gfx::Canvas background_canvas(size(), canvas->scale_factor(), false); 1296 gfx::Canvas background_canvas(size(), canvas->scale_factor(), false);
1295 1297
1296 // Draw left edge. Don't draw over the toolbar, as we're not the foreground 1298 // Draw left edge. Don't draw over the toolbar, as we're not the foreground
1297 // tab. 1299 // tab.
1298 gfx::ImageSkia tab_l = gfx::ImageSkiaOperations::CreateTiledImage( 1300 gfx::ImageSkia tab_l = TabUtil::CreateTiledInactiveBackground(tp,
1299 *tab_bg, offset, bg_offset_y, tab_image->l_width, height()); 1301 background_id, background_overlay_id, background_offset_.y(), offset, 0,
1302 tab_image->l_width, height());
1300 gfx::ImageSkia theme_l = 1303 gfx::ImageSkia theme_l =
1301 gfx::ImageSkiaOperations::CreateMaskedImage(tab_l, *alpha->image_l); 1304 gfx::ImageSkiaOperations::CreateMaskedImage(tab_l, *alpha->image_l);
1302 background_canvas.DrawImageInt(theme_l, 1305 background_canvas.DrawImageInt(theme_l,
1303 0, 0, theme_l.width(), theme_l.height() - kToolbarOverlap, 1306 0, 0, theme_l.width(), theme_l.height() - kToolbarOverlap,
1304 0, 0, theme_l.width(), theme_l.height() - kToolbarOverlap, 1307 0, 0, theme_l.width(), theme_l.height() - kToolbarOverlap,
1305 false); 1308 false);
1306 1309
1307 // Draw right edge. Again, don't draw over the toolbar. 1310 // Draw right edge. Again, don't draw over the toolbar.
1308 gfx::ImageSkia tab_r = gfx::ImageSkiaOperations::CreateTiledImage(*tab_bg, 1311 gfx::ImageSkia tab_r = TabUtil::CreateTiledInactiveBackground(tp,
1309 offset + width() - tab_image->r_width, bg_offset_y, 1312 background_id, background_overlay_id, background_offset_.y(),
1310 tab_image->r_width, height()); 1313 offset + width() - tab_image->r_width, 0, tab_image->r_width, height());
1311 gfx::ImageSkia theme_r = 1314 gfx::ImageSkia theme_r =
1312 gfx::ImageSkiaOperations::CreateMaskedImage(tab_r, *alpha->image_r); 1315 gfx::ImageSkiaOperations::CreateMaskedImage(tab_r, *alpha->image_r);
1313 background_canvas.DrawImageInt(theme_r, 1316 background_canvas.DrawImageInt(theme_r,
1314 0, 0, theme_r.width(), theme_r.height() - kToolbarOverlap, 1317 0, 0, theme_r.width(), theme_r.height() - kToolbarOverlap,
1315 width() - theme_r.width(), 0, theme_r.width(), 1318 width() - theme_r.width(), 0, theme_r.width(),
1316 theme_r.height() - kToolbarOverlap, false); 1319 theme_r.height() - kToolbarOverlap, false);
1317 1320
1318 // Draw center. Instead of masking out the top portion we simply skip over 1321 // Draw center. Instead of masking out the top portion we simply skip over
1319 // it by incrementing by GetDropShadowHeight(), since it's a simple 1322 // it by incrementing by drop_shadow_height(), since it's a simple
1320 // rectangle. And again, don't draw over the toolbar. 1323 // rectangle. And again, don't draw over the toolbar.
1321 background_canvas.TileImageInt(*tab_bg, 1324 gfx::ImageSkia tab_c = TabUtil::CreateTiledInactiveBackground(tp,
1322 offset + tab_image->l_width, 1325 background_id,
1323 bg_offset_y + drop_shadow_height(), 1326 background_overlay_id,
1324 tab_image->l_width, 1327 background_offset_.y(),
1325 drop_shadow_height(), 1328 offset + tab_image->l_width,
1326 width() - tab_image->l_width - tab_image->r_width, 1329 drop_shadow_height(),
1327 height() - drop_shadow_height() - kToolbarOverlap); 1330 width() - tab_image->l_width - tab_image->r_width,
1331 height() - drop_shadow_height() - kToolbarOverlap);
1332 background_canvas.DrawImageInt(tab_c, tab_image->l_width,
1333 drop_shadow_height());
1328 1334
1329 canvas->DrawImageInt( 1335 canvas->DrawImageInt(
1330 gfx::ImageSkia(background_canvas.ExtractImageRep()), 0, 0); 1336 gfx::ImageSkia(background_canvas.ExtractImageRep()), 0, 0);
1331 1337
1332 if (!GetThemeProvider()->HasCustomImage(tab_id) && 1338 if (!tp->HasCustomImage(background_overlay_id) &&
1333 hover_controller_.ShouldDraw()) { 1339 hover_controller_.ShouldDraw()) {
1334 hover_controller_.Draw(canvas, gfx::ImageSkia( 1340 hover_controller_.Draw(canvas, gfx::ImageSkia(
1335 background_canvas.ExtractImageRep())); 1341 background_canvas.ExtractImageRep()));
1336 } 1342 }
1337 1343
1338 // Now draw the highlights/shadows around the tab edge. 1344 // Now draw the highlights/shadows around the tab edge.
1339 canvas->DrawImageInt(*tab_inactive_image->image_l, 0, 0); 1345 canvas->DrawImageInt(*tab_inactive_image->image_l, 0, 0);
1340 canvas->TileImageInt(*tab_inactive_image->image_c, 1346 canvas->TileImageInt(*tab_inactive_image->image_c,
1341 tab_inactive_image->l_width, 0, 1347 tab_inactive_image->l_width, 0,
1342 width() - tab_inactive_image->l_width - 1348 width() - tab_inactive_image->l_width -
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 gfx::ImageSkia projection_glow( 1495 gfx::ImageSkia projection_glow(
1490 *tp->GetImageSkiaNamed(IDR_TAB_CAPTURE_GLOW)); 1496 *tp->GetImageSkiaNamed(IDR_TAB_CAPTURE_GLOW));
1491 DrawIconCenter(canvas, projection_glow, 0, projection_glow.width(), 1497 DrawIconCenter(canvas, projection_glow, 0, projection_glow.width(),
1492 projection_glow.height(), glow_bounds, false, paint); 1498 projection_glow.height(), glow_bounds, false, paint);
1493 } else if (data().capture_state == TabRendererData::CAPTURE_STATE_RECORDING) { 1499 } else if (data().capture_state == TabRendererData::CAPTURE_STATE_RECORDING) {
1494 // If recording, fade the recording icon on top of the favicon with a mask 1500 // If recording, fade the recording icon on top of the favicon with a mask
1495 // around/behind it. 1501 // around/behind it.
1496 gfx::ImageSkia recording_dot(*tp->GetImageSkiaNamed(IDR_TAB_RECORDING)); 1502 gfx::ImageSkia recording_dot(*tp->GetImageSkiaNamed(IDR_TAB_RECORDING));
1497 gfx::ImageSkia recording_dot_mask( 1503 gfx::ImageSkia recording_dot_mask(
1498 *tp->GetImageSkiaNamed(IDR_TAB_RECORDING_MASK)); 1504 *tp->GetImageSkiaNamed(IDR_TAB_RECORDING_MASK));
1499 gfx::ImageSkia tab_background;
1500 if (IsActive()) {
1501 tab_background = *tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR);
1502 } else {
1503 int tab_id;
1504 int frame_id_dummy;
1505 views::Widget* widget = GetWidget();
1506 GetTabIdAndFrameId(widget, &tab_id, &frame_id_dummy);
1507 tab_background = *tp->GetImageSkiaNamed(tab_id);
1508 }
1509 1505
1510 // This is the offset from the favicon bottom right corner for the mask, 1506 // This is the offset from the favicon bottom right corner for the mask,
1511 // given that the recording dot is drawn in the bottom right corner. 1507 // given that the recording dot is drawn in the bottom right corner.
1512 int mask_offset_from_right = recording_dot.width() + 1508 int mask_offset_from_right = recording_dot.width() +
1513 (recording_dot_mask.width() - recording_dot.width()) / 2; 1509 (recording_dot_mask.width() - recording_dot.width()) / 2;
1514 int mask_offset_from_bottom = recording_dot.height() + 1510 int mask_offset_from_bottom = recording_dot.height() +
1515 (recording_dot_mask.height() - recording_dot.height()) / 2; 1511 (recording_dot_mask.height() - recording_dot.height()) / 2;
1516 1512
1517 int mask_dst_x = bounds.x() + bounds.width() - mask_offset_from_right; 1513 int mask_dst_x = bounds.x() + bounds.width() - mask_offset_from_right;
1518 int mask_dst_y = bounds.y() + bounds.height() - mask_offset_from_bottom; 1514 int mask_dst_y = bounds.y() + bounds.height() - mask_offset_from_bottom;
1519 1515
1520 // Crop the background image at the correct position and create a mask 1516 // Crop the background image at the correct position and create a mask
1521 // from the background. 1517 // from the background.
1522 int offset_x = GetMirroredX() + background_offset_.x() + mask_dst_x; 1518 int offset_x = GetMirroredX() + background_offset_.x() + mask_dst_x;
1523 int offset_y = mask_dst_y; 1519 int offset_y = mask_dst_y;
1524 gfx::ImageSkia tab_background_cropped = 1520 gfx::ImageSkia tab_background_cropped;
1525 gfx::ImageSkiaOperations::CreateTiledImage( 1521 if (IsActive()) {
1526 tab_background, offset_x, offset_y, 1522 gfx::ImageSkia tab_background = *tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR);
1527 recording_dot_mask.width(), recording_dot_mask.height()); 1523 tab_background_cropped =
1524 gfx::ImageSkiaOperations::CreateTiledImage(
1525 tab_background, offset_x, offset_y,
1526 recording_dot_mask.width(), recording_dot_mask.height());
1527 } else {
1528 int background_id;
1529 int background_overlay_id;
1530 views::Widget* widget = GetWidget();
1531 GetInactiveBackgroundIdAndOverlayId(widget, &background_id,
1532 &background_overlay_id);
1533
1534 tab_background_cropped = TabUtil::CreateTiledInactiveBackground(tp,
1535 background_id, background_overlay_id, background_offset_.y(),
1536 offset_x, offset_y, recording_dot_mask.width(),
1537 recording_dot_mask.height());
1538 }
1528 gfx::ImageSkia recording_dot_mask_with_bg = 1539 gfx::ImageSkia recording_dot_mask_with_bg =
1529 gfx::ImageSkiaOperations::CreateMaskedImage(tab_background_cropped, 1540 gfx::ImageSkiaOperations::CreateMaskedImage(tab_background_cropped,
1530 recording_dot_mask); 1541 recording_dot_mask);
1531 1542
1532 // Draw the mask. 1543 // Draw the mask.
1533 DrawIconAtLocation(canvas, recording_dot_mask_with_bg, 0, 1544 DrawIconAtLocation(canvas, recording_dot_mask_with_bg, 0,
1534 mask_dst_x, mask_dst_y, 1545 mask_dst_x, mask_dst_y,
1535 recording_dot_mask.width(), 1546 recording_dot_mask.width(),
1536 recording_dot_mask.height(), 1547 recording_dot_mask.height(),
1537 false, SkPaint()); 1548 false, SkPaint());
1538 1549
1539 // Potentially draw an alpha of the active bg image. 1550 // Potentially draw an alpha of the active bg image.
1540 double throb_value = GetThrobValue(); 1551 double throb_value = GetThrobValue();
1541 if (!IsActive() && throb_value > 0) { 1552 if (!IsActive() && throb_value > 0) {
1542 tab_background = *tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR); 1553 gfx::ImageSkia tab_background =
1554 *tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR);
1543 tab_background_cropped = gfx::ImageSkiaOperations::CreateTiledImage( 1555 tab_background_cropped = gfx::ImageSkiaOperations::CreateTiledImage(
1544 tab_background, offset_x, offset_y, 1556 tab_background, offset_x, offset_y,
1545 recording_dot_mask.width(), recording_dot_mask.height()); 1557 recording_dot_mask.width(), recording_dot_mask.height());
1546 recording_dot_mask_with_bg = gfx::ImageSkiaOperations::CreateMaskedImage( 1558 recording_dot_mask_with_bg = gfx::ImageSkiaOperations::CreateMaskedImage(
1547 tab_background_cropped, recording_dot_mask); 1559 tab_background_cropped, recording_dot_mask);
1548 1560
1549 canvas->SaveLayerAlpha(static_cast<int>(throb_value * 0xff), 1561 canvas->SaveLayerAlpha(static_cast<int>(throb_value * 0xff),
1550 GetLocalBounds()); 1562 GetLocalBounds());
1551 DrawIconAtLocation(canvas, recording_dot_mask_with_bg, 0, 1563 DrawIconAtLocation(canvas, recording_dot_mask_with_bg, 0,
1552 mask_dst_x, mask_dst_y, 1564 mask_dst_x, mask_dst_y,
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 // The main bar is as wide as the normal tab's horizontal top line. 1749 // The main bar is as wide as the normal tab's horizontal top line.
1738 // This top line of the tab extends a few pixels left and right of the 1750 // This top line of the tab extends a few pixels left and right of the
1739 // center image due to pixels in the rounded corner images. 1751 // center image due to pixels in the rounded corner images.
1740 const int kBarPadding = 1; 1752 const int kBarPadding = 1;
1741 int main_bar_left = tab_active_.l_width - kBarPadding; 1753 int main_bar_left = tab_active_.l_width - kBarPadding;
1742 int main_bar_right = width() - tab_active_.r_width + kBarPadding; 1754 int main_bar_right = width() - tab_active_.r_width + kBarPadding;
1743 return gfx::Rect( 1755 return gfx::Rect(
1744 main_bar_left, 0, main_bar_right - main_bar_left, kImmersiveBarHeight); 1756 main_bar_left, 0, main_bar_right - main_bar_left, kImmersiveBarHeight);
1745 } 1757 }
1746 1758
1747 void Tab::GetTabIdAndFrameId(views::Widget* widget, 1759 void Tab::GetInactiveBackgroundIdAndOverlayId(
1748 int* tab_id, 1760 views::Widget* widget,
1749 int* frame_id) const { 1761 int* background_id,
1762 int* background_overlay_id) const {
1750 if (widget && widget->GetTopLevelWidget()->ShouldUseNativeFrame()) { 1763 if (widget && widget->GetTopLevelWidget()->ShouldUseNativeFrame()) {
1751 *tab_id = IDR_THEME_TAB_BACKGROUND_V; 1764 *background_id = IDR_THEME_TAB_BACKGROUND_V;
1752 *frame_id = 0; 1765 *background_overlay_id = IDR_THEME_TAB_BACKGROUND_V_OVERLAY;
1753 } else if (data().incognito) { 1766 } else if (data().incognito) {
1754 *tab_id = IDR_THEME_TAB_BACKGROUND_INCOGNITO; 1767 *background_id = IDR_THEME_TAB_BACKGROUND_INCOGNITO;
1755 *frame_id = IDR_THEME_FRAME_INCOGNITO; 1768 *background_overlay_id = IDR_THEME_TAB_BACKGROUND_INCOGNITO_OVERLAY;
1756 #if defined(OS_WIN) 1769 #if defined(OS_WIN)
1757 } else if (win8::IsSingleWindowMetroMode()) { 1770 } else if (win8::IsSingleWindowMetroMode()) {
1758 *tab_id = IDR_THEME_TAB_BACKGROUND_V; 1771 *background_id = IDR_THEME_TAB_BACKGROUND_V;
1759 *frame_id = 0; 1772 *background_overlay_id = IDR_THEME_TAB_BACKGROUND_V_OVERLAY;
1760 #endif 1773 #endif
1761 } else { 1774 } else {
1762 *tab_id = IDR_THEME_TAB_BACKGROUND; 1775 *background_id = IDR_THEME_TAB_BACKGROUND;
1763 *frame_id = IDR_THEME_FRAME; 1776 *background_overlay_id = IDR_THEME_TAB_BACKGROUND_OVERLAY;
1764 } 1777 }
1765 } 1778 }
1766 1779
1767 //////////////////////////////////////////////////////////////////////////////// 1780 ////////////////////////////////////////////////////////////////////////////////
1768 // Tab, private static: 1781 // Tab, private static:
1769 1782
1770 // static 1783 // static
1771 void Tab::InitTabResources() { 1784 void Tab::InitTabResources() {
1772 static bool initialized = false; 1785 static bool initialized = false;
1773 if (initialized) 1786 if (initialized)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 const gfx::ImageSkia& image) { 1839 const gfx::ImageSkia& image) {
1827 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); 1840 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE);
1828 ImageCacheEntry entry; 1841 ImageCacheEntry entry;
1829 entry.resource_id = resource_id; 1842 entry.resource_id = resource_id;
1830 entry.scale_factor = scale_factor; 1843 entry.scale_factor = scale_factor;
1831 entry.image = image; 1844 entry.image = image;
1832 image_cache_->push_front(entry); 1845 image_cache_->push_front(entry);
1833 if (image_cache_->size() > kMaxImageCacheSize) 1846 if (image_cache_->size() > kMaxImageCacheSize)
1834 image_cache_->pop_back(); 1847 image_cache_->pop_back();
1835 } 1848 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698