| 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 #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 "app/animation_delegate.h" | |
| 10 #include "app/slide_animation.h" | |
| 11 #include "chrome/browser/page_info_model.h" | 9 #include "chrome/browser/page_info_model.h" |
| 12 #include "chrome/browser/views/info_bubble.h" | 10 #include "chrome/browser/views/info_bubble.h" |
| 11 #include "ui/base/animation/animation_delegate.h" |
| 12 #include "ui/base/animation/slide_animation.h" |
| 13 #include "views/controls/link.h" | 13 #include "views/controls/link.h" |
| 14 #include "views/view.h" | 14 #include "views/view.h" |
| 15 | 15 |
| 16 namespace views { | 16 namespace views { |
| 17 class Label; | 17 class Label; |
| 18 } | 18 } |
| 19 | 19 |
| 20 class PageInfoBubbleView : public views::View, | 20 class PageInfoBubbleView : public views::View, |
| 21 public PageInfoModel::PageInfoModelObserver, | 21 public PageInfoModel::PageInfoModelObserver, |
| 22 public InfoBubbleDelegate, | 22 public InfoBubbleDelegate, |
| 23 public views::LinkController, | 23 public views::LinkController, |
| 24 public AnimationDelegate { | 24 public ui::AnimationDelegate { |
| 25 public: | 25 public: |
| 26 PageInfoBubbleView(gfx::NativeWindow parent_window, | 26 PageInfoBubbleView(gfx::NativeWindow parent_window, |
| 27 Profile* profile, | 27 Profile* profile, |
| 28 const GURL& url, | 28 const GURL& url, |
| 29 const NavigationEntry::SSLStatus& ssl, | 29 const NavigationEntry::SSLStatus& ssl, |
| 30 bool show_history); | 30 bool show_history); |
| 31 virtual ~PageInfoBubbleView(); | 31 virtual ~PageInfoBubbleView(); |
| 32 | 32 |
| 33 // Show the certificate dialog. | 33 // Show the certificate dialog. |
| 34 void ShowCertDialog(); | 34 void ShowCertDialog(); |
| 35 | 35 |
| 36 void set_info_bubble(InfoBubble* info_bubble) { info_bubble_ = info_bubble; } | 36 void set_info_bubble(InfoBubble* info_bubble) { info_bubble_ = info_bubble; } |
| 37 | 37 |
| 38 // View methods: | 38 // View methods: |
| 39 virtual gfx::Size GetPreferredSize(); | 39 virtual gfx::Size GetPreferredSize(); |
| 40 | 40 |
| 41 // PageInfoModel::PageInfoModelObserver methods: | 41 // PageInfoModel::PageInfoModelObserver methods: |
| 42 virtual void ModelChanged(); | 42 virtual void ModelChanged(); |
| 43 | 43 |
| 44 // InfoBubbleDelegate methods: | 44 // InfoBubbleDelegate methods: |
| 45 virtual void InfoBubbleClosing(InfoBubble* info_bubble, | 45 virtual void InfoBubbleClosing(InfoBubble* info_bubble, |
| 46 bool closed_by_escape) {} | 46 bool closed_by_escape) {} |
| 47 virtual bool CloseOnEscape() { return true; } | 47 virtual bool CloseOnEscape() { return true; } |
| 48 virtual bool FadeInOnShow() { return false; } | 48 virtual bool FadeInOnShow() { return false; } |
| 49 virtual std::wstring accessible_name() { return L"PageInfoBubble"; } | 49 virtual std::wstring accessible_name() { return L"PageInfoBubble"; } |
| 50 | 50 |
| 51 // LinkController methods: | 51 // LinkController methods: |
| 52 virtual void LinkActivated(views::Link* source, int event_flags); | 52 virtual void LinkActivated(views::Link* source, int event_flags); |
| 53 | 53 |
| 54 // Overridden from AnimationDelegate. | 54 // Overridden from ui::AnimationDelegate. |
| 55 virtual void AnimationEnded(const Animation* animation); | 55 virtual void AnimationEnded(const ui::Animation* animation); |
| 56 virtual void AnimationProgressed(const Animation* animation); | 56 virtual void AnimationProgressed(const ui::Animation* animation); |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 // Layout the sections within the bubble. | 59 // Layout the sections within the bubble. |
| 60 void LayoutSections(); | 60 void LayoutSections(); |
| 61 | 61 |
| 62 // The model providing the various section info. | 62 // The model providing the various section info. |
| 63 PageInfoModel model_; | 63 PageInfoModel model_; |
| 64 | 64 |
| 65 // The parent window of the InfoBubble showing this view. | 65 // The parent window of the InfoBubble showing this view. |
| 66 gfx::NativeWindow parent_window_; | 66 gfx::NativeWindow parent_window_; |
| 67 | 67 |
| 68 // The id of the certificate for this page. | 68 // The id of the certificate for this page. |
| 69 int cert_id_; | 69 int cert_id_; |
| 70 | 70 |
| 71 InfoBubble* info_bubble_; | 71 InfoBubble* info_bubble_; |
| 72 | 72 |
| 73 // The Help Center link at the bottom of the bubble. | 73 // The Help Center link at the bottom of the bubble. |
| 74 views::Link* help_center_link_; | 74 views::Link* help_center_link_; |
| 75 | 75 |
| 76 // Animation that helps us change size smoothly as more data comes in. | 76 // Animation that helps us change size smoothly as more data comes in. |
| 77 SlideAnimation resize_animation_; | 77 ui::SlideAnimation resize_animation_; |
| 78 | 78 |
| 79 // The height of the info bubble at the start of the resize animation. | 79 // The height of the info bubble at the start of the resize animation. |
| 80 int animation_start_height_; | 80 int animation_start_height_; |
| 81 | 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleView); | 82 DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleView); |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 #endif // CHROME_BROWSER_UI_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_ | 85 #endif // CHROME_BROWSER_UI_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_ |
| OLD | NEW |