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

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

Issue 7810002: Move infobar handling to a tab helper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/certificate_viewer.h" 13 #include "chrome/browser/certificate_viewer.h"
14 #include "chrome/browser/content_settings/host_content_settings_map.h" 14 #include "chrome/browser/content_settings/host_content_settings_map.h"
15 #include "chrome/browser/infobars/infobar_tab_helper.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ssl/ssl_add_cert_handler.h" 17 #include "chrome/browser/ssl/ssl_add_cert_handler.h"
17 #include "chrome/browser/ssl_client_certificate_selector.h" 18 #include "chrome/browser/ssl_client_certificate_selector.h"
18 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" 19 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
19 #include "chrome/browser/tab_contents/infobar.h" 20 #include "chrome/browser/tab_contents/infobar.h"
20 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" 21 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h"
21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 22 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
22 #include "chrome/common/chrome_notification_types.h" 23 #include "chrome/common/chrome_notification_types.h"
23 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/content_settings.h" 25 #include "chrome/common/content_settings.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED, 144 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED,
144 source); 145 source);
145 } 146 }
146 147
147 TabContentsSSLHelper::SSLAddCertData::~SSLAddCertData() { 148 TabContentsSSLHelper::SSLAddCertData::~SSLAddCertData() {
148 } 149 }
149 150
150 void TabContentsSSLHelper::SSLAddCertData::ShowInfoBar( 151 void TabContentsSSLHelper::SSLAddCertData::ShowInfoBar(
151 InfoBarDelegate* delegate) { 152 InfoBarDelegate* delegate) {
152 if (infobar_delegate_) 153 if (infobar_delegate_)
153 tab_contents_->ReplaceInfoBar(infobar_delegate_, delegate); 154 tab_contents_->infobar_tab_helper()->ReplaceInfoBar(infobar_delegate_,
155 delegate);
154 else 156 else
155 tab_contents_->AddInfoBar(delegate); 157 tab_contents_->infobar_tab_helper()->AddInfoBar(delegate);
156 infobar_delegate_ = delegate; 158 infobar_delegate_ = delegate;
157 } 159 }
158 160
159 void TabContentsSSLHelper::SSLAddCertData::ShowErrorInfoBar( 161 void TabContentsSSLHelper::SSLAddCertData::ShowErrorInfoBar(
160 const string16& message) { 162 const string16& message) {
161 ShowInfoBar(new SimpleAlertInfoBarDelegate( 163 ShowInfoBar(new SimpleAlertInfoBarDelegate(
162 tab_contents_->tab_contents(), GetCertIcon(), message, true)); 164 tab_contents_->tab_contents(), GetCertIcon(), message, true));
163 } 165 }
164 166
165 void TabContentsSSLHelper::SSLAddCertData::Observe( 167 void TabContentsSSLHelper::SSLAddCertData::Observe(
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 TabContentsSSLHelper::SSLAddCertData* TabContentsSSLHelper::GetAddCertData( 267 TabContentsSSLHelper::SSLAddCertData* TabContentsSSLHelper::GetAddCertData(
266 SSLAddCertHandler* handler) { 268 SSLAddCertHandler* handler) {
267 // Find/create the slot. 269 // Find/create the slot.
268 linked_ptr<SSLAddCertData>& ptr_ref = 270 linked_ptr<SSLAddCertData>& ptr_ref =
269 request_id_to_add_cert_data_[handler->network_request_id()]; 271 request_id_to_add_cert_data_[handler->network_request_id()];
270 // Fill it if necessary. 272 // Fill it if necessary.
271 if (!ptr_ref.get()) 273 if (!ptr_ref.get())
272 ptr_ref.reset(new SSLAddCertData(tab_contents_)); 274 ptr_ref.reset(new SSLAddCertData(tab_contents_));
273 return ptr_ref.get(); 275 return ptr_ref.get();
274 } 276 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/infobar_delegate.cc ('k') | chrome/browser/task_manager/task_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698