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