| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "chrome/browser/page_info_model.h" | 9 #include "chrome/browser/page_info_model.h" |
| 11 #include "chrome/browser/page_info_model_observer.h" | 10 #include "chrome/browser/page_info_model_observer.h" |
| 12 #include "chrome/browser/ui/views/bubble/bubble.h" | |
| 13 #include "ui/base/animation/animation_delegate.h" | |
| 14 #include "ui/base/animation/slide_animation.h" | 11 #include "ui/base/animation/slide_animation.h" |
| 12 #include "views/bubble/bubble_delegate.h" |
| 15 #include "views/controls/link_listener.h" | 13 #include "views/controls/link_listener.h" |
| 16 #include "views/view.h" | |
| 17 | 14 |
| 18 namespace views { | 15 class PageInfoBubbleView : public views::BubbleDelegateView, |
| 19 class Label; | |
| 20 } | |
| 21 | |
| 22 class PageInfoBubbleView : public views::View, | |
| 23 public PageInfoModelObserver, | 16 public PageInfoModelObserver, |
| 24 public BubbleDelegate, | 17 public views::LinkListener { |
| 25 public views::LinkListener, | |
| 26 public ui::AnimationDelegate { | |
| 27 public: | 18 public: |
| 28 PageInfoBubbleView(gfx::NativeWindow parent_window, | 19 PageInfoBubbleView(const views::View* anchor_view, |
| 29 Profile* profile, | 20 Profile* profile, |
| 30 const GURL& url, | 21 const GURL& url, |
| 31 const NavigationEntry::SSLStatus& ssl, | 22 const NavigationEntry::SSLStatus& ssl, |
| 32 bool show_history); | 23 bool show_history); |
| 33 virtual ~PageInfoBubbleView(); | 24 virtual ~PageInfoBubbleView(); |
| 34 | 25 |
| 35 // Show the certificate dialog. | 26 // Show the certificate dialog. |
| 36 void ShowCertDialog(); | 27 void ShowCertDialog(); |
| 37 | 28 |
| 38 void set_bubble(Bubble* bubble) { bubble_ = bubble; } | |
| 39 | |
| 40 // views::View methods: | 29 // views::View methods: |
| 41 virtual gfx::Size GetPreferredSize(); | 30 virtual gfx::Size GetPreferredSize(); |
| 42 | 31 |
| 43 // PageInfoModelObserver methods: | 32 // PageInfoModelObserver methods: |
| 44 virtual void OnPageInfoModelChanged() OVERRIDE; | 33 virtual void OnPageInfoModelChanged() OVERRIDE; |
| 45 | 34 |
| 46 // BubbleDelegate methods: | 35 // views::BubbleDelegate methods: |
| 47 virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape) OVERRIDE; | 36 virtual gfx::Point GetAnchorPoint() OVERRIDE; |
| 48 virtual bool CloseOnEscape() OVERRIDE; | |
| 49 virtual bool FadeInOnShow() OVERRIDE; | |
| 50 virtual string16 GetAccessibleName() OVERRIDE; | |
| 51 | 37 |
| 52 // views::LinkListener methods: | 38 // views::LinkListener methods: |
| 53 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | 39 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
| 54 | 40 |
| 55 // ui::AnimationDelegate methods: | 41 // ui::AnimationDelegate methods: |
| 56 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 42 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 57 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 43 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 58 | 44 |
| 59 private: | 45 private: |
| 60 // Gets the size of the separator, including padding. | 46 // Gets the size of the separator, including padding. |
| 61 gfx::Size GetSeparatorSize(); | 47 gfx::Size GetSeparatorSize(); |
| 62 | 48 |
| 63 // Get the current value of |resize_animation_| (in [0.0, 1.0]). | 49 // Get the current value of |resize_animation_| (in [0.0, 1.0]). |
| 64 double GetResizeAnimationCurrentValue(); | 50 double GetResizeAnimationCurrentValue(); |
| 65 | 51 |
| 66 // Gets the animation value to use for setting the height. | 52 // Gets the animation value to use for setting the height. |
| 67 double HeightAnimationValue(); | 53 double HeightAnimationValue(); |
| 68 | 54 |
| 69 // Layout the sections within the bubble. | 55 // Layout the sections within the bubble. |
| 70 void LayoutSections(); | 56 void LayoutSections(); |
| 71 | 57 |
| 72 // Global pointer to the bubble that is hosting our view. | |
| 73 static Bubble* bubble_; | |
| 74 | |
| 75 // The model providing the various section info. | 58 // The model providing the various section info. |
| 76 PageInfoModel model_; | 59 PageInfoModel model_; |
| 77 | 60 |
| 78 // The parent window of the Bubble showing this view. | |
| 79 gfx::NativeWindow parent_window_; | |
| 80 | |
| 81 // The id of the certificate for this page. | 61 // The id of the certificate for this page. |
| 82 int cert_id_; | 62 int cert_id_; |
| 83 | 63 |
| 84 // The Help Center link at the bottom of the bubble. | 64 // The Help Center link at the bottom of the bubble. |
| 85 views::Link* help_center_link_; | 65 views::Link* help_center_link_; |
| 86 | 66 |
| 87 // Animation that helps us change size smoothly as more data comes in. | 67 // Animation that helps us change size smoothly as more data comes in. |
| 88 ui::SlideAnimation resize_animation_; | 68 ui::SlideAnimation resize_animation_; |
| 89 | 69 |
| 90 // The height of the info bubble at the start of the resize animation. | 70 // The height of the info bubble at the start of the resize animation. |
| 91 int animation_start_height_; | 71 int animation_start_height_; |
| 92 | 72 |
| 93 DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleView); | 73 DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleView); |
| 94 }; | 74 }; |
| 95 | 75 |
| 96 #endif // CHROME_BROWSER_UI_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_ | 76 #endif // CHROME_BROWSER_UI_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_ |
| OLD | NEW |