| 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" |
| 11 #include "base/profiler/scoped_tracker.h" | 11 #include "base/profiler/scoped_tracker.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.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_utils.h" | 16 #include "chrome/browser/ui/tabs/tab_utils.h" |
| 17 #include "chrome/browser/ui/view_ids.h" | 17 #include "chrome/browser/ui/view_ids.h" |
| 18 #include "chrome/browser/ui/views/layout_constants.h" | 18 #include "chrome/browser/ui/views/layout_constants.h" |
| 19 #include "chrome/browser/ui/views/tabs/media_indicator_button.h" | 19 #include "chrome/browser/ui/views/tabs/media_indicator_button.h" |
| 20 #include "chrome/browser/ui/views/tabs/tab_controller.h" | 20 #include "chrome/browser/ui/views/tabs/tab_controller.h" |
| 21 #include "chrome/browser/ui/views/theme_image_mapper.h" | 21 #include "chrome/browser/ui/views/theme_image_mapper.h" |
| 22 #include "chrome/browser/ui/views/touch_uma/touch_uma.h" | 22 #include "chrome/browser/ui/views/touch_uma/touch_uma.h" |
| 23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/grit/generated_resources.h" | 24 #include "chrome/grit/generated_resources.h" |
| 25 #include "content/public/browser/user_metrics.h" | 25 #include "content/public/browser/user_metrics.h" |
| 26 #include "grit/components_scaled_resources.h" |
| 26 #include "grit/theme_resources.h" | 27 #include "grit/theme_resources.h" |
| 27 #include "third_party/skia/include/effects/SkGradientShader.h" | 28 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 28 #include "ui/accessibility/ax_view_state.h" | 29 #include "ui/accessibility/ax_view_state.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "ui/base/models/list_selection_model.h" | 31 #include "ui/base/models/list_selection_model.h" |
| 31 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
| 32 #include "ui/base/theme_provider.h" | 33 #include "ui/base/theme_provider.h" |
| 33 #include "ui/gfx/animation/animation_container.h" | 34 #include "ui/gfx/animation/animation_container.h" |
| 34 #include "ui/gfx/animation/multi_animation.h" | 35 #include "ui/gfx/animation/multi_animation.h" |
| 35 #include "ui/gfx/animation/throb_animation.h" | 36 #include "ui/gfx/animation/throb_animation.h" |
| (...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 waiting_state_.color = | 1366 waiting_state_.color = |
| 1366 tp->GetColor(ThemeProperties::COLOR_THROBBER_WAITING); | 1367 tp->GetColor(ThemeProperties::COLOR_THROBBER_WAITING); |
| 1367 gfx::PaintThrobberSpinningAfterWaiting( | 1368 gfx::PaintThrobberSpinningAfterWaiting( |
| 1368 canvas, bounds, | 1369 canvas, bounds, |
| 1369 tp->GetColor(ThemeProperties::COLOR_THROBBER_SPINNING), | 1370 tp->GetColor(ThemeProperties::COLOR_THROBBER_SPINNING), |
| 1370 base::TimeTicks::Now() - loading_start_time_, &waiting_state_); | 1371 base::TimeTicks::Now() - loading_start_time_, &waiting_state_); |
| 1371 } | 1372 } |
| 1372 } else if (should_display_crashed_favicon_) { | 1373 } else if (should_display_crashed_favicon_) { |
| 1373 // Paint crash favicon. | 1374 // Paint crash favicon. |
| 1374 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 1375 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 1375 gfx::ImageSkia crashed_favicon(*rb.GetImageSkiaNamed(IDR_SAD_FAVICON)); | 1376 gfx::ImageSkia crashed_favicon( |
| 1377 *rb.GetImageSkiaNamed(IDR_CRASH_SAD_FAVICON)); |
| 1376 bounds.set_y(bounds.y() + favicon_hiding_offset_); | 1378 bounds.set_y(bounds.y() + favicon_hiding_offset_); |
| 1377 DrawIconCenter(canvas, crashed_favicon, 0, | 1379 DrawIconCenter(canvas, crashed_favicon, 0, |
| 1378 crashed_favicon.width(), | 1380 crashed_favicon.width(), |
| 1379 crashed_favicon.height(), | 1381 crashed_favicon.height(), |
| 1380 bounds, true, SkPaint()); | 1382 bounds, true, SkPaint()); |
| 1381 } else if (!data().favicon.isNull()) { | 1383 } else if (!data().favicon.isNull()) { |
| 1382 // Paint the normal favicon. | 1384 // Paint the normal favicon. |
| 1383 DrawIconCenter(canvas, data().favicon, 0, | 1385 DrawIconCenter(canvas, data().favicon, 0, |
| 1384 data().favicon.width(), | 1386 data().favicon.width(), |
| 1385 data().favicon.height(), | 1387 data().favicon.height(), |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1679 const gfx::ImageSkia& image) { | 1681 const gfx::ImageSkia& image) { |
| 1680 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1682 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
| 1681 ImageCacheEntry entry; | 1683 ImageCacheEntry entry; |
| 1682 entry.resource_id = resource_id; | 1684 entry.resource_id = resource_id; |
| 1683 entry.scale_factor = scale_factor; | 1685 entry.scale_factor = scale_factor; |
| 1684 entry.image = image; | 1686 entry.image = image; |
| 1685 image_cache_->push_front(entry); | 1687 image_cache_->push_front(entry); |
| 1686 if (image_cache_->size() > kMaxImageCacheSize) | 1688 if (image_cache_->size() > kMaxImageCacheSize) |
| 1687 image_cache_->pop_back(); | 1689 image_cache_->pop_back(); |
| 1688 } | 1690 } |
| OLD | NEW |