| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/status_bubble_views.h" | 5 #include "chrome/browser/views/status_bubble_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/gfx/chrome_canvas.h" | 9 #include "app/gfx/canvas.h" |
| 10 #include "app/gfx/text_elider.h" | 10 #include "app/gfx/text_elider.h" |
| 11 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
| 12 #include "app/l10n_util_win.h" | 12 #include "app/l10n_util_win.h" |
| 13 #include "app/animation.h" | 13 #include "app/animation.h" |
| 14 #include "app/resource_bundle.h" | 14 #include "app/resource_bundle.h" |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
| 18 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
| 19 #include "net/base/net_util.h" | 19 #include "net/base/net_util.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 void StartFade(double start, double end, int duration); | 135 void StartFade(double start, double end, int duration); |
| 136 void StartHiding(); | 136 void StartHiding(); |
| 137 void StartShowing(); | 137 void StartShowing(); |
| 138 | 138 |
| 139 // Animation functions. | 139 // Animation functions. |
| 140 double GetCurrentOpacity(); | 140 double GetCurrentOpacity(); |
| 141 void SetOpacity(double opacity); | 141 void SetOpacity(double opacity); |
| 142 void AnimateToState(double state); | 142 void AnimateToState(double state); |
| 143 void AnimationEnded(const Animation* animation); | 143 void AnimationEnded(const Animation* animation); |
| 144 | 144 |
| 145 virtual void Paint(ChromeCanvas* canvas); | 145 virtual void Paint(gfx::Canvas* canvas); |
| 146 | 146 |
| 147 BubbleStage stage_; | 147 BubbleStage stage_; |
| 148 BubbleStyle style_; | 148 BubbleStyle style_; |
| 149 | 149 |
| 150 ScopedRunnableMethodFactory<StatusBubbleViews::StatusView> timer_factory_; | 150 ScopedRunnableMethodFactory<StatusBubbleViews::StatusView> timer_factory_; |
| 151 | 151 |
| 152 // Manager, owns us. | 152 // Manager, owns us. |
| 153 StatusBubble* status_bubble_; | 153 StatusBubble* status_bubble_; |
| 154 | 154 |
| 155 // Handle to the HWND that contains us. | 155 // Handle to the HWND that contains us. |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 } | 311 } |
| 312 } | 312 } |
| 313 | 313 |
| 314 void StatusBubbleViews::StatusView::SetStyle(BubbleStyle style) { | 314 void StatusBubbleViews::StatusView::SetStyle(BubbleStyle style) { |
| 315 if (style_ != style) { | 315 if (style_ != style) { |
| 316 style_ = style; | 316 style_ = style; |
| 317 SchedulePaint(); | 317 SchedulePaint(); |
| 318 } | 318 } |
| 319 } | 319 } |
| 320 | 320 |
| 321 void StatusBubbleViews::StatusView::Paint(ChromeCanvas* canvas) { | 321 void StatusBubbleViews::StatusView::Paint(gfx::Canvas* canvas) { |
| 322 SkPaint paint; | 322 SkPaint paint; |
| 323 paint.setStyle(SkPaint::kFill_Style); | 323 paint.setStyle(SkPaint::kFill_Style); |
| 324 paint.setFlags(SkPaint::kAntiAlias_Flag); | 324 paint.setFlags(SkPaint::kAntiAlias_Flag); |
| 325 paint.setColor(kBubbleColor); | 325 paint.setColor(kBubbleColor); |
| 326 | 326 |
| 327 RECT parent_rect; | 327 RECT parent_rect; |
| 328 ::GetWindowRect(popup_->GetNativeView(), &parent_rect); | 328 ::GetWindowRect(popup_->GetNativeView(), &parent_rect); |
| 329 | 329 |
| 330 // Figure out how to round the bubble's four corners. | 330 // Figure out how to round the bubble's four corners. |
| 331 SkScalar rad[8]; | 331 SkScalar rad[8]; |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 frame_->GetBounds(&frame_bounds, false); | 622 frame_->GetBounds(&frame_bounds, false); |
| 623 int mirrored_x = frame_bounds.width() - x - w; | 623 int mirrored_x = frame_bounds.width() - x - w; |
| 624 position_.SetPoint(mirrored_x, y); | 624 position_.SetPoint(mirrored_x, y); |
| 625 } else { | 625 } else { |
| 626 position_.SetPoint(x, y); | 626 position_.SetPoint(x, y); |
| 627 } | 627 } |
| 628 | 628 |
| 629 size_.SetSize(w, h); | 629 size_.SetSize(w, h); |
| 630 Reposition(); | 630 Reposition(); |
| 631 } | 631 } |
| OLD | NEW |