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/canvas.h" | 9 #include "app/gfx/canvas.h" |
10 #include "app/gfx/text_elider.h" | 10 #include "app/gfx/text_elider.h" |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 | 470 |
471 // StatusViewExpander --------------------------------------------------------- | 471 // StatusViewExpander --------------------------------------------------------- |
472 // StatusViewExpander manages the expansion and contraction of the status | 472 // StatusViewExpander manages the expansion and contraction of the status |
473 // bubble as it accommodates URL's too long to fit in the standard bubble. | 473 // bubble as it accommodates URL's too long to fit in the standard bubble. |
474 // Changes are passed through to the StatusView to paint. | 474 // Changes are passed through to the StatusView to paint. |
475 class StatusBubbleViews::StatusViewExpander : public Animation, | 475 class StatusBubbleViews::StatusViewExpander : public Animation, |
476 public AnimationDelegate { | 476 public AnimationDelegate { |
477 public: | 477 public: |
478 StatusViewExpander(StatusBubble* status_bubble, StatusView* status_view) | 478 StatusViewExpander(StatusBubble* status_bubble, StatusView* status_view) |
479 : Animation(kFramerate, this), | 479 : Animation(kFramerate, this), |
| 480 status_view_(status_view), |
480 status_bubble_(status_bubble), | 481 status_bubble_(status_bubble), |
481 status_view_(status_view), | |
482 expansion_start_(0), | 482 expansion_start_(0), |
483 expansion_end_(0) { | 483 expansion_end_(0) { |
484 } | 484 } |
485 | 485 |
486 // Manage the expansion of the bubble. | 486 // Manage the expansion of the bubble. |
487 void StartExpansion(std::wstring expanded_text, int current_width, | 487 void StartExpansion(std::wstring expanded_text, int current_width, |
488 int expansion_end); | 488 int expansion_end); |
489 | 489 |
490 // Set width of fully expanded bubble. | 490 // Set width of fully expanded bubble. |
491 void SetExpandedWidth(int expanded_width); | 491 void SetExpandedWidth(int expanded_width); |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 | 837 |
838 int StatusBubbleViews::GetStandardStatusBubbleWidth() { | 838 int StatusBubbleViews::GetStandardStatusBubbleWidth() { |
839 gfx::Rect frame_bounds; | 839 gfx::Rect frame_bounds; |
840 frame_->GetBounds(&frame_bounds, false); | 840 frame_->GetBounds(&frame_bounds, false); |
841 return frame_bounds.width() / 3; | 841 return frame_bounds.width() / 3; |
842 } | 842 } |
843 | 843 |
844 int StatusBubbleViews::GetMaxStatusBubbleWidth() { | 844 int StatusBubbleViews::GetMaxStatusBubbleWidth() { |
845 gfx::Rect frame_bounds; | 845 gfx::Rect frame_bounds; |
846 frame_->GetBounds(&frame_bounds, false); | 846 frame_->GetBounds(&frame_bounds, false); |
| 847 #if defined(OS_WIN) |
847 return static_cast<int>(frame_bounds.width() - (kShadowThickness * 2) - | 848 return static_cast<int>(frame_bounds.width() - (kShadowThickness * 2) - |
848 kTextPositionX - kTextHorizPadding - 1 - | 849 kTextPositionX - kTextHorizPadding - 1 - |
849 views::NativeScrollBar::GetVerticalScrollBarWidth()); | 850 views::NativeScrollBar::GetVerticalScrollBarWidth()); |
| 851 #else |
| 852 NOTIMPLEMENTED(); |
| 853 return 10; |
| 854 #endif |
850 } | 855 } |
851 | 856 |
852 void StatusBubbleViews::SetBubbleWidth(int width) { | 857 void StatusBubbleViews::SetBubbleWidth(int width) { |
853 size_.set_width(width); | 858 size_.set_width(width); |
854 SetBounds(position_.x(), position_.y(), size_.width(), size_.height()); | 859 SetBounds(position_.x(), position_.y(), size_.width(), size_.height()); |
855 } | 860 } |
856 | 861 |
857 void StatusBubbleViews::CancelExpandTimer() { | 862 void StatusBubbleViews::CancelExpandTimer() { |
858 if (!expand_timer_factory_.empty()) | 863 if (!expand_timer_factory_.empty()) |
859 expand_timer_factory_.RevokeAll(); | 864 expand_timer_factory_.RevokeAll(); |
860 } | 865 } |
861 | 866 |
OLD | NEW |