1 // Copyright 2014 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_SIGNED_CERTIFICATE_TIMESTAMP_INFO_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_SIGNED_CERTIFICATE_TIMESTAMP_INFO_VIEW_H_ 7 8 #include <vector> 9 10 #include "net/cert/sct_status_flags.h" 11 #include "ui/views/view.h" 12 13 namespace views { 14 class GridLayout; 15 class Label; 16 } 17 18 namespace net { 19 namespace ct { 20 struct SignedCertificateTimestamp; 21 } 22 } 23 24 namespace chrome { 25 namespace ct { 26 27 // Utility function to translate an SCT status to resource ID. 28 int StatusToResourceID(net::ct::SCTVerifyStatus status); 29 int SCTOriginToResourceID(const net::ct::SignedCertificateTimestamp& sct); 30 31 } // namespace ct 32 } // namespace chrome 33 34 // Responsible for displaying a tabular grid of SCT information. 35 // Only displays information about one SCT at a time. 36 class SignedCertificateTimestampInfoView : public views::View { 37 public: 38 SignedCertificateTimestampInfoView(); 39 virtual ~SignedCertificateTimestampInfoView(); 40 41 // Updates the display to show information for the given SCT. 42 void SetSignedCertificateTimestamp( 43 const net::ct::SignedCertificateTimestamp& sct, 44 net::ct::SCTVerifyStatus status); 45 46 // Clears the SCT display to indicate that no SCT is selected. 47 void ClearDisplay(); 48 49 private: 50 // views::View implementation 51 virtual void ViewHierarchyChanged(const ViewHierarchyChangedDetails& details) 52 OVERRIDE; 53 54 // Layout helper routines. 55 void AddLabelRow(int layout_id, 56 views::GridLayout* layout, 57 int label_message_id, 58 views::Label* data_label); 59 60 // Sets up the view layout. 61 void Init(); 62 63 // Individual property labels 64 views::Label* status_value_field_; 65 views::Label* origin_value_field_; 66 views::Label* version_value_field_; 67 views::Label* log_description_value_field_; 68 views::Label* log_id_value_field_; 69 views::Label* timestamp_value_field_; 70 views::Label* hash_algorithm_value_field_; 71 views::Label* signature_algorithm_value_field_; 72 views::Label* signature_data_value_field_; 73 74 DISALLOW_COPY_AND_ASSIGN(SignedCertificateTimestampInfoView); 75 }; 76 77 #endif // CHROME_BROWSER_UI_VIEWS_SIGNED_CERTIFICATE_TIMESTAMP_INFO_VIEW_H_ 78