| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_PAGE_INFO_WINDOW_H__ | 5 #ifndef CHROME_BROWSER_PAGE_INFO_WINDOW_H_ |
| 6 #define CHROME_BROWSER_PAGE_INFO_WINDOW_H__ | 6 #define CHROME_BROWSER_PAGE_INFO_WINDOW_H_ |
| 7 | 7 |
| 8 #include "base/gfx/native_widget_types.h" | 8 #include "base/gfx/native_widget_types.h" |
| 9 #include "chrome/browser/tab_contents/navigation_entry.h" | 9 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 10 #include "googleurl/src/gurl.h" | |
| 11 #include "net/base/x509_certificate.h" | |
| 12 | 10 |
| 13 // The page info window displays information regarding the current page, | 11 class Profile; |
| 14 // including security information. | 12 class GURL; |
| 15 | 13 |
| 16 class NavigationEntry; | 14 namespace browser { |
| 17 class PageInfoContentView; | |
| 18 class PrefService; | |
| 19 class Profile; | |
| 20 | 15 |
| 21 class PageInfoWindow { | 16 // Shows the page info using the specified information. |
| 22 public: | 17 // |url| is the url of the page/frame the info applies to, |ssl| is the SSL |
| 23 enum TabID { | 18 // information for that page/frame. If |show_history| is true, a section |
| 24 GENERAL = 0, | 19 // showing how many times that URL has been visited is added to the page info. |
| 25 SECURITY, | 20 void ShowPageInfo(gfx::NativeWindow parent, |
| 26 }; | 21 Profile* profile, |
| 22 const GURL& url, |
| 23 const NavigationEntry::SSLStatus& ssl, |
| 24 bool show_history); |
| 27 | 25 |
| 28 // Factory method to get a new platform impl of PageInfoWindow | 26 } // namespace browser |
| 29 static PageInfoWindow* Factory(); | |
| 30 | 27 |
| 31 // Creates and shows a new page info window for the main page. | 28 #endif // CHROME_BROWSER_PAGE_INFO_WINDOW_H_ |
| 32 static void CreatePageInfo(Profile* profile, | |
| 33 NavigationEntry* nav_entry, | |
| 34 gfx::NativeView parent, | |
| 35 TabID tab); | |
| 36 | |
| 37 // Creates and shows a new page info window for the frame at |url| with the | |
| 38 // specified SSL information. | |
| 39 static void CreateFrameInfo(Profile* profile, | |
| 40 const GURL& url, | |
| 41 const NavigationEntry::SSLStatus& ssl, | |
| 42 gfx::NativeView parent, | |
| 43 TabID tab); | |
| 44 | |
| 45 static void RegisterPrefs(PrefService* prefs); | |
| 46 | |
| 47 PageInfoWindow(); | |
| 48 virtual ~PageInfoWindow(); | |
| 49 | |
| 50 // This is the main initializer that creates the window. | |
| 51 virtual void Init(Profile* profile, | |
| 52 const GURL& url, | |
| 53 const NavigationEntry::SSLStatus& ssl, | |
| 54 NavigationEntry::PageType page_type, | |
| 55 bool show_history, | |
| 56 gfx::NativeView parent) = 0; | |
| 57 | |
| 58 // Brings the page info window to the foreground. | |
| 59 virtual void Show() = 0; | |
| 60 | |
| 61 // Shows various information for the specified certificate in a new dialog. | |
| 62 // This can be implemented as an individual window (like on Windows), or as | |
| 63 // a modal dialog/sheet (on Mac). Either will work since we're only expecting | |
| 64 // one certificate per page. | |
| 65 virtual void ShowCertDialog(int cert_id) = 0; | |
| 66 | |
| 67 protected: | |
| 68 // Returns a name that can be used to represent the issuer. It tries in this | |
| 69 // order CN, O and OU and returns the first non-empty one found. | |
| 70 static std::string GetIssuerName( | |
| 71 const net::X509Certificate::Principal& issuer); | |
| 72 | |
| 73 // The id of the server cert for this page (0 means no cert). | |
| 74 int cert_id_; | |
| 75 | |
| 76 private: | |
| 77 DISALLOW_COPY_AND_ASSIGN(PageInfoWindow); | |
| 78 }; | |
| 79 | |
| 80 #endif // #define CHROME_BROWSER_PAGE_INFO_WINDOW_H__ | |
| OLD | NEW |