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/page_info_bubble_view.h" | 5 #include "chrome/browser/ui/views/page_info_bubble_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/certificate_viewer.h" | 10 #include "chrome/browser/certificate_viewer.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 const int kVGapToHeadline = 5; | 42 const int kVGapToHeadline = 5; |
43 const int kHGapImageToDescription = 6; | 43 const int kHGapImageToDescription = 6; |
44 const int kTextPaddingRight = 10; | 44 const int kTextPaddingRight = 10; |
45 const int kPaddingBelowSeparator = 6; | 45 const int kPaddingBelowSeparator = 6; |
46 const int kPaddingAboveSeparator = 4; | 46 const int kPaddingAboveSeparator = 4; |
47 const int kIconHorizontalOffset = 27; | 47 const int kIconHorizontalOffset = 27; |
48 const int kIconVerticalOffset = -7; | 48 const int kIconVerticalOffset = -7; |
49 | 49 |
50 // The duration of the animation that resizes the bubble once the async | 50 // The duration of the animation that resizes the bubble once the async |
51 // information is provided through the ModelChanged event. | 51 // information is provided through the ModelChanged event. |
52 const int kPageInfoSlideDuration = 1450; | 52 const int kPageInfoSlideDuration = 250; |
53 | 53 |
54 // A section contains an image that shows a status (good or bad), a title, an | 54 // A section contains an image that shows a status (good or bad), a title, an |
55 // optional head-line (in bold) and a description. | 55 // optional head-line (in bold) and a description. |
56 class Section : public views::View, | 56 class Section : public views::View, |
57 public views::LinkListener { | 57 public views::LinkListener { |
58 public: | 58 public: |
59 Section(PageInfoBubbleView* owner, | 59 Section(PageInfoBubbleView* owner, |
60 const PageInfoModel::SectionInfo& section_info, | 60 const PageInfoModel::SectionInfo& section_info, |
61 const gfx::ImageSkia* status_icon, | 61 const gfx::ImageSkia* status_icon, |
62 bool show_cert); | 62 bool show_cert); |
63 virtual ~Section(); | 63 virtual ~Section(); |
64 | 64 |
65 // Notify the section how far along in the animation we are. This is used | 65 // Notify the section how far along in the animation we are. This is used |
66 // to draw the section opaquely onto the canvas, to animate the section into | 66 // to draw the section opaquely onto the canvas, to animate the section into |
67 // view. | 67 // view. |
68 void SetAnimationStage(double animation_stage); | 68 void SetAnimationStage(double animation_stage); |
69 | 69 |
70 // views::View methods: | 70 // views::View methods: |
71 virtual int GetHeightForWidth(int w); | 71 virtual int GetHeightForWidth(int w) OVERRIDE; |
72 virtual void Layout(); | 72 virtual void Layout() OVERRIDE; |
73 virtual void Paint(gfx::Canvas* canvas); | 73 virtual void Paint(gfx::Canvas* canvas) OVERRIDE; |
74 | 74 |
75 // views::LinkListener methods: | 75 // views::LinkListener methods: |
76 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | 76 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
77 | 77 |
78 private: | 78 private: |
79 // Calculate the animation value to use for setting the opacity. | 79 // Calculate the animation value to use for setting the opacity. |
80 double OpacityAnimationValue(); | 80 double OpacityAnimationValue(); |
81 | 81 |
82 // Calculate the layout if |compute_bounds_only|, otherwise does Layout also. | 82 // Calculate the layout if |compute_bounds_only|, otherwise does Layout also. |
83 gfx::Size LayoutItems(bool compute_bounds_only, int width); | 83 gfx::Size LayoutItems(bool compute_bounds_only, int width); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 web_contents, | 466 web_contents, |
467 url, | 467 url, |
468 ssl, | 468 ssl, |
469 show_history, | 469 show_history, |
470 navigator); | 470 navigator); |
471 views::BubbleDelegateView::CreateBubble(page_info_bubble); | 471 views::BubbleDelegateView::CreateBubble(page_info_bubble); |
472 page_info_bubble->Show(); | 472 page_info_bubble->Show(); |
473 } | 473 } |
474 | 474 |
475 } // namespace chrome | 475 } // namespace chrome |
OLD | NEW |