| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   125 const SkColor kImmersiveInactiveTabColor = SkColorSetRGB(190, 190, 190); |   125 const SkColor kImmersiveInactiveTabColor = SkColorSetRGB(190, 190, 190); | 
|   126  |   126  | 
|   127 // The minimum opacity (out of 1) when a tab (either active or inactive) is |   127 // The minimum opacity (out of 1) when a tab (either active or inactive) is | 
|   128 // throbbing in the immersive mode light strip. |   128 // throbbing in the immersive mode light strip. | 
|   129 const double kImmersiveTabMinThrobOpacity = 0.66; |   129 const double kImmersiveTabMinThrobOpacity = 0.66; | 
|   130  |   130  | 
|   131 // Number of steps in the immersive mode loading animation. |   131 // Number of steps in the immersive mode loading animation. | 
|   132 const int kImmersiveLoadingStepCount = 32; |   132 const int kImmersiveLoadingStepCount = 32; | 
|   133  |   133  | 
|   134 const char kTabCloseButtonName[] = "TabCloseButton"; |   134 const char kTabCloseButtonName[] = "TabCloseButton"; | 
|   135 const int kTabCloseButtonSize = 16; |  | 
|   136  |   135  | 
|   137 chrome::HostDesktopType GetHostDesktopType(views::View* view) { |   136 chrome::HostDesktopType GetHostDesktopType(views::View* view) { | 
|   138   // Widget is NULL when tabs are detached. |   137   // Widget is NULL when tabs are detached. | 
|   139   views::Widget* widget = view->GetWidget(); |   138   views::Widget* widget = view->GetWidget(); | 
|   140   return chrome::GetHostDesktopTypeForNativeView( |   139   return chrome::GetHostDesktopTypeForNativeView( | 
|   141       widget ? widget->GetNativeView() : NULL); |   140       widget ? widget->GetNativeView() : NULL); | 
|   142 } |   141 } | 
|   143  |   142  | 
|   144 // Stop()s |animation| and then deletes it. We do this rather than just deleting |   143 // Stop()s |animation| and then deletes it. We do this rather than just deleting | 
|   145 // so that the delegate is notified before the destruction. |   144 // so that the delegate is notified before the destruction. | 
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   402  |   401  | 
|   403   media_indicator_button_ = new MediaIndicatorButton(this); |   402   media_indicator_button_ = new MediaIndicatorButton(this); | 
|   404   AddChildView(media_indicator_button_); |   403   AddChildView(media_indicator_button_); | 
|   405  |   404  | 
|   406   close_button_ = new TabCloseButton(this); |   405   close_button_ = new TabCloseButton(this); | 
|   407   close_button_->SetAccessibleName( |   406   close_button_->SetAccessibleName( | 
|   408       l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); |   407       l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); | 
|   409   // The normal image is set by OnButtonColorMaybeChanged() because it depends |   408   // The normal image is set by OnButtonColorMaybeChanged() because it depends | 
|   410   // on the current theme and active state.  The hovered and pressed images |   409   // on the current theme and active state.  The hovered and pressed images | 
|   411   // don't depend on the these, so we can set them here. |   410   // don't depend on the these, so we can set them here. | 
|   412   const gfx::ImageSkia& hovered = gfx::CreateVectorIcon( |   411   const gfx::ImageSkia& hovered = | 
|   413       gfx::VectorIconId::TAB_CLOSE_HOVERED_PRESSED, kTabCloseButtonSize, |   412       gfx::CreatePrimaryVectorIcon(gfx::VectorIconId::TAB_CLOSE_HOVERED_PRESSED, | 
|   414       SkColorSetARGB(0xFF, 0xDB, 0x44, 0x37)); |   413                                    SkColorSetARGB(0xFF, 0xDB, 0x44, 0x37)); | 
|   415   const gfx::ImageSkia& pressed = gfx::CreateVectorIcon( |   414   const gfx::ImageSkia& pressed = | 
|   416       gfx::VectorIconId::TAB_CLOSE_HOVERED_PRESSED, kTabCloseButtonSize, |   415       gfx::CreatePrimaryVectorIcon(gfx::VectorIconId::TAB_CLOSE_HOVERED_PRESSED, | 
|   417       SkColorSetARGB(0xFF, 0xA8, 0x35, 0x2A)); |   416                                    SkColorSetARGB(0xFF, 0xA8, 0x35, 0x2A)); | 
|   418   close_button_->SetImage(views::CustomButton::STATE_HOVERED, &hovered); |   417   close_button_->SetImage(views::CustomButton::STATE_HOVERED, &hovered); | 
|   419   close_button_->SetImage(views::CustomButton::STATE_PRESSED, &pressed); |   418   close_button_->SetImage(views::CustomButton::STATE_PRESSED, &pressed); | 
|   420  |   419  | 
|   421   // Disable animation so that the red danger sign shows up immediately |   420   // Disable animation so that the red danger sign shows up immediately | 
|   422   // to help avoid mis-clicks. |   421   // to help avoid mis-clicks. | 
|   423   close_button_->SetAnimationDuration(0); |   422   close_button_->SetAnimationDuration(0); | 
|   424   AddChildView(close_button_); |   423   AddChildView(close_button_); | 
|   425  |   424  | 
|   426   set_context_menu_controller(this); |   425   set_context_menu_controller(this); | 
|   427 } |   426 } | 
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1494     return; |  1493     return; | 
|  1495  |  1494  | 
|  1496   const SkColor title_color = theme_provider->GetColor(IsActive() ? |  1495   const SkColor title_color = theme_provider->GetColor(IsActive() ? | 
|  1497       ThemeProperties::COLOR_TAB_TEXT : |  1496       ThemeProperties::COLOR_TAB_TEXT : | 
|  1498       ThemeProperties::COLOR_BACKGROUND_TAB_TEXT); |  1497       ThemeProperties::COLOR_BACKGROUND_TAB_TEXT); | 
|  1499   const SkColor new_button_color = SkColorSetA(title_color, 0xA0); |  1498   const SkColor new_button_color = SkColorSetA(title_color, 0xA0); | 
|  1500   if (button_color_ != new_button_color) { |  1499   if (button_color_ != new_button_color) { | 
|  1501     button_color_ = new_button_color; |  1500     button_color_ = new_button_color; | 
|  1502     title_->SetEnabledColor(title_color); |  1501     title_->SetEnabledColor(title_color); | 
|  1503     media_indicator_button_->OnParentTabButtonColorChanged(); |  1502     media_indicator_button_->OnParentTabButtonColorChanged(); | 
|  1504     const gfx::ImageSkia& close_button_normal_image = gfx::CreateVectorIcon( |  1503     const gfx::ImageSkia& close_button_normal_image = | 
|  1505         gfx::VectorIconId::TAB_CLOSE_NORMAL, kTabCloseButtonSize, |  1504         gfx::CreatePrimaryVectorIcon(gfx::VectorIconId::TAB_CLOSE_NORMAL, | 
|  1506         button_color_); |  1505                                      button_color_); | 
|  1507     close_button_->SetImage(views::CustomButton::STATE_NORMAL, |  1506     close_button_->SetImage(views::CustomButton::STATE_NORMAL, | 
|  1508                             &close_button_normal_image); |  1507                             &close_button_normal_image); | 
|  1509   } |  1508   } | 
|  1510 } |  1509 } | 
|  1511  |  1510  | 
|  1512 void Tab::ScheduleIconPaint() { |  1511 void Tab::ScheduleIconPaint() { | 
|  1513   gfx::Rect bounds = favicon_bounds_; |  1512   gfx::Rect bounds = favicon_bounds_; | 
|  1514   if (bounds.IsEmpty()) |  1513   if (bounds.IsEmpty()) | 
|  1515     return; |  1514     return; | 
|  1516  |  1515  | 
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1611                          const gfx::ImageSkia& image) { |  1610                          const gfx::ImageSkia& image) { | 
|  1612   DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |  1611   DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 
|  1613   ImageCacheEntry entry; |  1612   ImageCacheEntry entry; | 
|  1614   entry.resource_id = resource_id; |  1613   entry.resource_id = resource_id; | 
|  1615   entry.scale_factor = scale_factor; |  1614   entry.scale_factor = scale_factor; | 
|  1616   entry.image = image; |  1615   entry.image = image; | 
|  1617   image_cache_->push_front(entry); |  1616   image_cache_->push_front(entry); | 
|  1618   if (image_cache_->size() > kMaxImageCacheSize) |  1617   if (image_cache_->size() > kMaxImageCacheSize) | 
|  1619     image_cache_->pop_back(); |  1618     image_cache_->pop_back(); | 
|  1620 } |  1619 } | 
| OLD | NEW |