OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_SSL_SSL_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SSL_SSL_MANAGER_H_ |
6 #define CHROME_BROWSER_SSL_SSL_MANAGER_H_ | 6 #define CHROME_BROWSER_SSL_SSL_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
15 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 15 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
16 #include "chrome/browser/tab_contents/provisional_load_details.h" | 16 #include "chrome/browser/tab_contents/provisional_load_details.h" |
17 #include "chrome/browser/tab_contents/security_style.h" | 17 #include "chrome/browser/tab_contents/security_style.h" |
18 #include "chrome/common/notification_observer.h" | 18 #include "chrome/common/notification_observer.h" |
19 #include "chrome/common/notification_registrar.h" | 19 #include "chrome/common/notification_registrar.h" |
20 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
21 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
22 #include "net/base/ssl_info.h" | 22 #include "net/base/ssl_info.h" |
23 #include "net/base/x509_certificate.h" | 23 #include "net/base/x509_certificate.h" |
| 24 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" |
24 #include "webkit/glue/resource_type.h" | 25 #include "webkit/glue/resource_type.h" |
25 | 26 |
26 class AutomationProvider; | 27 class AutomationProvider; |
27 class NavigationEntry; | 28 class NavigationEntry; |
28 class LoadFromMemoryCacheDetails; | 29 class LoadFromMemoryCacheDetails; |
29 class LoadNotificationDetails; | 30 class LoadNotificationDetails; |
30 class NavigationController; | 31 class NavigationController; |
31 class PrefService; | 32 class PrefService; |
32 class ResourceRedirectDetails; | 33 class ResourceRedirectDetails; |
33 class ResourceRequestDetails; | 34 class ResourceRequestDetails; |
34 class SSLErrorInfo; | 35 class SSLErrorInfo; |
35 class SSLHostState; | 36 class SSLHostState; |
36 class Task; | 37 class Task; |
37 class URLRequest; | 38 class URLRequest; |
38 class WebContents; | 39 class WebContents; |
39 | 40 |
40 namespace WebKit { | |
41 struct WebConsoleMessage; | |
42 } | |
43 | |
44 // The SSLManager SSLManager controls the SSL UI elements in a TabContents. It | 41 // The SSLManager SSLManager controls the SSL UI elements in a TabContents. It |
45 // listens for various events that influence when these elements should or | 42 // listens for various events that influence when these elements should or |
46 // should not be displayed and adjusts them accordingly. | 43 // should not be displayed and adjusts them accordingly. |
47 // | 44 // |
48 // There is one SSLManager per tab. | 45 // There is one SSLManager per tab. |
49 // The security state (secure/insecure) is stored in the navigation entry. | 46 // The security state (secure/insecure) is stored in the navigation entry. |
50 // Along with it are stored any SSL error code and the associated cert. | 47 // Along with it are stored any SSL error code and the associated cert. |
51 | 48 |
52 class SSLManager : public NotificationObserver { | 49 class SSLManager : public NotificationObserver { |
53 public: | 50 public: |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 // Sets the maximum security style for the page. If the current security | 366 // Sets the maximum security style for the page. If the current security |
370 // style is lower than |style|, this will not have an effect on the security | 367 // style is lower than |style|, this will not have an effect on the security |
371 // indicators. | 368 // indicators. |
372 // | 369 // |
373 // It will return true if the navigation entry was updated or false if | 370 // It will return true if the navigation entry was updated or false if |
374 // nothing changed. The caller is responsible for broadcasting | 371 // nothing changed. The caller is responsible for broadcasting |
375 // NOTIFY_SSY_STATE_CHANGED if it returns true. | 372 // NOTIFY_SSY_STATE_CHANGED if it returns true. |
376 bool SetMaxSecurityStyle(SecurityStyle style); | 373 bool SetMaxSecurityStyle(SecurityStyle style); |
377 | 374 |
378 // Logs a message to the console of the page. | 375 // Logs a message to the console of the page. |
379 void AddMessageToConsole(const WebKit::WebConsoleMessage&); | 376 void AddMessageToConsole(const string16& message, |
| 377 const WebKit::WebConsoleMessage::Level&); |
380 | 378 |
381 // Records that |cert| is permitted to be used for |host| in the future. | 379 // Records that |cert| is permitted to be used for |host| in the future. |
382 void DenyCertForHost(net::X509Certificate* cert, const std::string& host); | 380 void DenyCertForHost(net::X509Certificate* cert, const std::string& host); |
383 | 381 |
384 // Records that |cert| is not permitted to be used for |host| in the future. | 382 // Records that |cert| is not permitted to be used for |host| in the future. |
385 void AllowCertForHost(net::X509Certificate* cert, const std::string& host); | 383 void AllowCertForHost(net::X509Certificate* cert, const std::string& host); |
386 | 384 |
387 // Queries whether |cert| is allowed or denied for |host|. | 385 // Queries whether |cert| is allowed or denied for |host|. |
388 net::X509Certificate::Policy::Judgment QueryPolicy( | 386 net::X509Certificate::Policy::Judgment QueryPolicy( |
389 net::X509Certificate* cert, const std::string& host); | 387 net::X509Certificate* cert, const std::string& host); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 SSLHostState* ssl_host_state_; | 534 SSLHostState* ssl_host_state_; |
537 | 535 |
538 // The list of messages that should be displayed (in info bars) when the page | 536 // The list of messages that should be displayed (in info bars) when the page |
539 // currently loading had loaded. | 537 // currently loading had loaded. |
540 std::vector<SSLMessageInfo> pending_messages_; | 538 std::vector<SSLMessageInfo> pending_messages_; |
541 | 539 |
542 DISALLOW_COPY_AND_ASSIGN(SSLManager); | 540 DISALLOW_COPY_AND_ASSIGN(SSLManager); |
543 }; | 541 }; |
544 | 542 |
545 #endif // CHROME_BROWSER_SSL_SSL_MANAGER_H_ | 543 #endif // CHROME_BROWSER_SSL_SSL_MANAGER_H_ |
OLD | NEW |