Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: chrome/browser/tab_contents/tab_contents_ssl_helper.cc

Issue 10535088: TabContentsWrapper -> TabContents, part 30. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" 5 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/certificate_viewer.h" 15 #include "chrome/browser/certificate_viewer.h"
16 #include "chrome/browser/content_settings/host_content_settings_map.h" 16 #include "chrome/browser/content_settings/host_content_settings_map.h"
17 #include "chrome/browser/infobars/infobar.h" 17 #include "chrome/browser/infobars/infobar.h"
18 #include "chrome/browser/infobars/infobar_tab_helper.h" 18 #include "chrome/browser/infobars/infobar_tab_helper.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/ssl/ssl_add_cert_handler.h" 20 #include "chrome/browser/ssl/ssl_add_cert_handler.h"
21 #include "chrome/browser/ssl_client_certificate_selector.h" 21 #include "chrome/browser/ssl_client_certificate_selector.h"
22 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" 22 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
23 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" 23 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h"
24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 24 #include "chrome/browser/ui/tab_contents/tab_contents.h"
25 #include "chrome/common/chrome_notification_types.h" 25 #include "chrome/common/chrome_notification_types.h"
26 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
27 #include "content/public/browser/notification_details.h" 27 #include "content/public/browser/notification_details.h"
28 #include "content/public/browser/notification_source.h" 28 #include "content/public/browser/notification_source.h"
29 #include "content/public/browser/web_contents.h" 29 #include "content/public/browser/web_contents.h"
30 #include "content/public/browser/web_contents_view.h" 30 #include "content/public/browser/web_contents_view.h"
31 #include "grit/generated_resources.h" 31 #include "grit/generated_resources.h"
32 #include "grit/theme_resources_standard.h" 32 #include "grit/theme_resources_standard.h"
33 #include "net/base/net_errors.h" 33 #include "net/base/net_errors.h"
34 #include "net/base/x509_certificate.h" 34 #include "net/base/x509_certificate.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 106
107 } // namespace 107 } // namespace
108 108
109 109
110 // TabContentsSSLHelper::SSLAddCertData --------------------------------------- 110 // TabContentsSSLHelper::SSLAddCertData ---------------------------------------
111 111
112 class TabContentsSSLHelper::SSLAddCertData 112 class TabContentsSSLHelper::SSLAddCertData
113 : public content::NotificationObserver { 113 : public content::NotificationObserver {
114 public: 114 public:
115 explicit SSLAddCertData(TabContentsWrapper* tab_contents); 115 explicit SSLAddCertData(TabContents* tab_contents);
116 virtual ~SSLAddCertData(); 116 virtual ~SSLAddCertData();
117 117
118 // Displays |delegate| as an infobar in |tab_|, replacing our current one if 118 // Displays |delegate| as an infobar in |tab_|, replacing our current one if
119 // still active. 119 // still active.
120 void ShowInfoBar(InfoBarDelegate* delegate); 120 void ShowInfoBar(InfoBarDelegate* delegate);
121 121
122 // Same as above, for the common case of wanting to show a simple alert 122 // Same as above, for the common case of wanting to show a simple alert
123 // message. 123 // message.
124 void ShowErrorInfoBar(const string16& message); 124 void ShowErrorInfoBar(const string16& message);
125 125
126 private: 126 private:
127 // content::NotificationObserver: 127 // content::NotificationObserver:
128 virtual void Observe(int type, 128 virtual void Observe(int type,
129 const content::NotificationSource& source, 129 const content::NotificationSource& source,
130 const content::NotificationDetails& details); 130 const content::NotificationDetails& details);
131 131
132 TabContentsWrapper* tab_contents_; 132 TabContents* tab_contents_;
133 InfoBarDelegate* infobar_delegate_; 133 InfoBarDelegate* infobar_delegate_;
134 content::NotificationRegistrar registrar_; 134 content::NotificationRegistrar registrar_;
135 135
136 DISALLOW_COPY_AND_ASSIGN(SSLAddCertData); 136 DISALLOW_COPY_AND_ASSIGN(SSLAddCertData);
137 }; 137 };
138 138
139 TabContentsSSLHelper::SSLAddCertData::SSLAddCertData( 139 TabContentsSSLHelper::SSLAddCertData::SSLAddCertData(
140 TabContentsWrapper* tab_contents) 140 TabContents* tab_contents)
141 : tab_contents_(tab_contents), 141 : tab_contents_(tab_contents),
142 infobar_delegate_(NULL) { 142 infobar_delegate_(NULL) {
143 content::Source<InfoBarTabHelper> source(tab_contents_->infobar_tab_helper()); 143 content::Source<InfoBarTabHelper> source(tab_contents_->infobar_tab_helper());
144 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, 144 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED,
145 source); 145 source);
146 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED, 146 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED,
147 source); 147 source);
148 } 148 }
149 149
150 TabContentsSSLHelper::SSLAddCertData::~SSLAddCertData() { 150 TabContentsSSLHelper::SSLAddCertData::~SSLAddCertData() {
(...skipping 24 matching lines...) Expand all
175 if (infobar_delegate_ == 175 if (infobar_delegate_ ==
176 ((type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED) ? 176 ((type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED) ?
177 content::Details<InfoBarRemovedDetails>(details)->first : 177 content::Details<InfoBarRemovedDetails>(details)->first :
178 content::Details<InfoBarReplacedDetails>(details)->first)) 178 content::Details<InfoBarReplacedDetails>(details)->first))
179 infobar_delegate_ = NULL; 179 infobar_delegate_ = NULL;
180 } 180 }
181 181
182 182
183 // TabContentsSSLHelper ------------------------------------------------------- 183 // TabContentsSSLHelper -------------------------------------------------------
184 184
185 TabContentsSSLHelper::TabContentsSSLHelper(TabContentsWrapper* tab_contents) 185 TabContentsSSLHelper::TabContentsSSLHelper(TabContents* tab_contents)
186 : tab_contents_(tab_contents) { 186 : tab_contents_(tab_contents) {
187 } 187 }
188 188
189 TabContentsSSLHelper::~TabContentsSSLHelper() { 189 TabContentsSSLHelper::~TabContentsSSLHelper() {
190 } 190 }
191 191
192 void TabContentsSSLHelper::ShowClientCertificateRequestDialog( 192 void TabContentsSSLHelper::ShowClientCertificateRequestDialog(
193 const net::HttpNetworkSession* network_session, 193 const net::HttpNetworkSession* network_session,
194 net::SSLCertRequestInfo* cert_request_info, 194 net::SSLCertRequestInfo* cert_request_info,
195 const base::Callback<void(net::X509Certificate*)>& callback) { 195 const base::Callback<void(net::X509Certificate*)>& callback) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 TabContentsSSLHelper::SSLAddCertData* TabContentsSSLHelper::GetAddCertData( 241 TabContentsSSLHelper::SSLAddCertData* TabContentsSSLHelper::GetAddCertData(
242 SSLAddCertHandler* handler) { 242 SSLAddCertHandler* handler) {
243 // Find/create the slot. 243 // Find/create the slot.
244 linked_ptr<SSLAddCertData>& ptr_ref = 244 linked_ptr<SSLAddCertData>& ptr_ref =
245 request_id_to_add_cert_data_[handler->network_request_id()]; 245 request_id_to_add_cert_data_[handler->network_request_id()];
246 // Fill it if necessary. 246 // Fill it if necessary.
247 if (!ptr_ref.get()) 247 if (!ptr_ref.get())
248 ptr_ref.reset(new SSLAddCertData(tab_contents_)); 248 ptr_ref.reset(new SSLAddCertData(tab_contents_));
249 return ptr_ref.get(); 249 return ptr_ref.get();
250 } 250 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/tab_contents_ssl_helper.h ('k') | chrome/browser/tab_contents/view_source_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698