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