OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/tabs/side_tab.h" | 5 #include "chrome/browser/views/tabs/side_tab.h" |
6 | 6 |
7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "app/theme_provider.h" | 8 #include "app/theme_provider.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 canvas->DrawStringInt(UTF16ToWideHack(model_->GetTitle(this)), *font_, | 158 canvas->DrawStringInt(UTF16ToWideHack(model_->GetTitle(this)), *font_, |
159 SK_ColorBLACK, title_bounds_.x(), title_bounds_.y(), | 159 SK_ColorBLACK, title_bounds_.x(), title_bounds_.y(), |
160 title_bounds_.width(), title_bounds_.height()); | 160 title_bounds_.width(), title_bounds_.height()); |
161 | 161 |
162 if (!model_->IsSelected(this) && | 162 if (!model_->IsSelected(this) && |
163 GetThemeProvider()->ShouldUseNativeFrame()) { | 163 GetThemeProvider()->ShouldUseNativeFrame()) { |
164 // Make sure un-selected tabs are somewhat transparent. | 164 // Make sure un-selected tabs are somewhat transparent. |
165 SkPaint paint; | 165 SkPaint paint; |
166 | 166 |
167 SkAlpha opacity = kBackgroundTabAlpha; | 167 SkAlpha opacity = kBackgroundTabAlpha; |
168 if (hover_animation_->IsAnimating()) | 168 if (hover_animation_->is_animating()) |
169 opacity = static_cast<SkAlpha>(hover_animation_->GetCurrentValue() * 255); | 169 opacity = static_cast<SkAlpha>(hover_animation_->GetCurrentValue() * 255); |
170 | 170 |
171 paint.setColor(SkColorSetARGB(kBackgroundTabAlpha, 255, 255, 255)); | 171 paint.setColor(SkColorSetARGB(kBackgroundTabAlpha, 255, 255, 255)); |
172 paint.setXfermodeMode(SkXfermode::kDstIn_Mode); | 172 paint.setXfermodeMode(SkXfermode::kDstIn_Mode); |
173 paint.setStyle(SkPaint::kFill_Style); | 173 paint.setStyle(SkPaint::kFill_Style); |
174 paint.setAntiAlias(true); | 174 paint.setAntiAlias(true); |
175 canvas->FillRectInt(0, 0, width(), height(), paint); | 175 canvas->FillRectInt(0, 0, width(), height(), paint); |
176 } | 176 } |
177 } | 177 } |
178 | 178 |
179 gfx::Size SideTab::GetPreferredSize() { | 179 gfx::Size SideTab::GetPreferredSize() { |
180 return gfx::Size(0, 27); | 180 return gfx::Size(0, 27); |
181 } | 181 } |
182 | 182 |
183 void SideTab::OnMouseEntered(const views::MouseEvent& event) { | 183 void SideTab::OnMouseEntered(const views::MouseEvent& event) { |
184 hover_animation_->SetTweenType(SlideAnimation::EASE_OUT); | 184 hover_animation_->SetTweenType(Tween::EASE_OUT); |
185 hover_animation_->Show(); | 185 hover_animation_->Show(); |
186 } | 186 } |
187 | 187 |
188 void SideTab::OnMouseExited(const views::MouseEvent& event) { | 188 void SideTab::OnMouseExited(const views::MouseEvent& event) { |
189 hover_animation_->SetTweenType(SlideAnimation::EASE_IN); | 189 hover_animation_->SetTweenType(Tween::EASE_IN); |
190 hover_animation_->Hide(); | 190 hover_animation_->Hide(); |
191 } | 191 } |
192 | 192 |
193 bool SideTab::OnMousePressed(const views::MouseEvent& event) { | 193 bool SideTab::OnMousePressed(const views::MouseEvent& event) { |
194 if (event.IsOnlyLeftMouseButton()) | 194 if (event.IsOnlyLeftMouseButton()) |
195 model_->SelectTab(this); | 195 model_->SelectTab(this); |
196 return true; | 196 return true; |
197 } | 197 } |
198 | 198 |
199 //////////////////////////////////////////////////////////////////////////////// | 199 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 waiting_animation_frame_count = | 267 waiting_animation_frame_count = |
268 waiting_animation_frames->width() / waiting_animation_frames->height(); | 268 waiting_animation_frames->width() / waiting_animation_frames->height(); |
269 | 269 |
270 waiting_to_loading_frame_count_ratio = | 270 waiting_to_loading_frame_count_ratio = |
271 waiting_animation_frame_count / loading_animation_frame_count; | 271 waiting_animation_frame_count / loading_animation_frame_count; |
272 | 272 |
273 initialized = true; | 273 initialized = true; |
274 } | 274 } |
275 } | 275 } |
276 | 276 |
OLD | NEW |