signed_certificate_timestamps_views.h revision a1401311d1ab56c4ed0a474bd38c108f75cb0cd9
1a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch// Copyright 2014 The Chromium Authors. All rights reserved. 2a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch// Use of this source code is governed by a BSD-style license that can be 3a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch// found in the LICENSE file. 4a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch 5a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch#ifndef CHROME_BROWSER_UI_VIEWS_SIGNED_CERTIFICATE_TIMESTAMPS_VIEWS_H_ 6a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch#define CHROME_BROWSER_UI_VIEWS_SIGNED_CERTIFICATE_TIMESTAMPS_VIEWS_H_ 7a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch 8a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch#include "base/memory/scoped_ptr.h" 9a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch#include "content/public/browser/notification_observer.h" 10a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch#include "net/cert/signed_certificate_timestamp.h" 11a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch#include "net/ssl/signed_certificate_timestamp_and_status.h" 12a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch#include "ui/views/controls/combobox/combobox_listener.h" 13a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch#include "ui/views/window/dialog_delegate.h" 14a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch 15a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdochnamespace content { 16a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdochclass WebContents; 17a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch} 18a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch 19a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdochnamespace views { 20a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdochclass Combobox; 21a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdochclass Widget; 22a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch} 23a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch 24a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdochclass SignedCertificateTimestampInfoView; 25a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdochclass SCTListModel; 26a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch 27a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch// The Views implementation of the signed certificate timestamps viewer. 28a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdochclass SignedCertificateTimestampsViews : public views::DialogDelegateView, 29a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch public content::NotificationObserver, 30a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch public views::ComboboxListener { 31a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch public: 32a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch // Use ShowSignedCertificateTimestampsViewer to show. 33a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch SignedCertificateTimestampsViews( 34a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch content::WebContents* web_contents, 35a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch const net::SignedCertificateTimestampAndStatusList& sct_list); 36a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch virtual ~SignedCertificateTimestampsViews(); 375d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles) 38a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch // views::DialogDelegate: 39a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch virtual base::string16 GetWindowTitle() const OVERRIDE; 40a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch virtual int GetDialogButtons() const OVERRIDE; 41a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch virtual ui::ModalType GetModalType() const OVERRIDE; 42a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch 43a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch // views::View: 44a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch virtual void ViewHierarchyChanged(const ViewHierarchyChangedDetails& details) 45a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch OVERRIDE; 46a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch 47a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch private: 48f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu void Init(); 49f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu 50f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu void ShowSCTInfo(int sct_index); 51f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu 52f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu // views::ComboboxListener: 53f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu virtual void OnPerformAction(views::Combobox* combobox) OVERRIDE; 54f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu 55f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu // content::NotificationObserver: 56f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu virtual void Observe(int type, 57f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu const content::NotificationSource& source, 58f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu const content::NotificationDetails& details) OVERRIDE; 59f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu 60f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu content::WebContents* web_contents_; 61f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu 62f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu SignedCertificateTimestampInfoView* sct_info_view_; 63f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu 64f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu scoped_ptr<SCTListModel> sct_list_model_; 65f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu // The Combobox used to select the SCT to display. This class owns the pointer 66f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu // as it has to be deleted explicitly before the views c'tor is called: 67f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu // The Combobox d'tor refers to the model it holds, which will be destructed 68f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu // as part of tearing down this class. So it will not be available when the 69f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu // Views d'tor destroys the Combobox, leading to a crash. 70f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu // Must be deleted before the model. 71f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu scoped_ptr<views::Combobox> sct_selector_box_; 725d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles) net::SignedCertificateTimestampAndStatusList sct_list_; 735d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles) 74197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch DISALLOW_COPY_AND_ASSIGN(SignedCertificateTimestampsViews); 75197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch}; 76197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch 77197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#endif // CHROME_BROWSER_UI_VIEWS_SIGNED_CERTIFICATE_TIMESTAMPS_VIEWS_H_ 78197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch