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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/certificate_viewer.h" 10 #include "chrome/browser/certificate_viewer.h"
11 #include "chrome/browser/ssl/ssl_add_cert_handler.h" 11 #include "chrome/browser/ssl/ssl_add_cert_handler.h"
12 #include "chrome/browser/ssl_client_certificate_selector.h" 12 #include "chrome/browser/ssl_client_certificate_selector.h"
13 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" 13 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
14 #include "chrome/browser/tab_contents/infobar.h" 14 #include "chrome/browser/tab_contents/infobar.h"
15 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" 15 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h"
16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
17 #include "chrome/common/chrome_notification_types.h"
17 #include "content/browser/ssl/ssl_client_auth_handler.h" 18 #include "content/browser/ssl/ssl_client_auth_handler.h"
18 #include "content/common/notification_details.h" 19 #include "content/common/notification_details.h"
19 #include "content/common/notification_source.h" 20 #include "content/common/notification_source.h"
20 #include "grit/generated_resources.h" 21 #include "grit/generated_resources.h"
21 #include "grit/theme_resources_standard.h" 22 #include "grit/theme_resources_standard.h"
22 #include "net/base/net_errors.h" 23 #include "net/base/net_errors.h"
23 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
24 #include "ui/base/resource/resource_bundle.h" 25 #include "ui/base/resource/resource_bundle.h"
25 26
26 namespace { 27 namespace {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 NotificationRegistrar registrar_; 124 NotificationRegistrar registrar_;
124 125
125 DISALLOW_COPY_AND_ASSIGN(SSLAddCertData); 126 DISALLOW_COPY_AND_ASSIGN(SSLAddCertData);
126 }; 127 };
127 128
128 TabContentsSSLHelper::SSLAddCertData::SSLAddCertData( 129 TabContentsSSLHelper::SSLAddCertData::SSLAddCertData(
129 TabContentsWrapper* tab_contents) 130 TabContentsWrapper* tab_contents)
130 : tab_contents_(tab_contents), 131 : tab_contents_(tab_contents),
131 infobar_delegate_(NULL) { 132 infobar_delegate_(NULL) {
132 Source<TabContentsWrapper> source(tab_contents_); 133 Source<TabContentsWrapper> source(tab_contents_);
133 registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, source); 134 registrar_.Add(this, chrome::TAB_CONTENTS_INFOBAR_REMOVED, source);
134 registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REPLACED, source); 135 registrar_.Add(this, chrome::TAB_CONTENTS_INFOBAR_REPLACED, source);
135 } 136 }
136 137
137 TabContentsSSLHelper::SSLAddCertData::~SSLAddCertData() { 138 TabContentsSSLHelper::SSLAddCertData::~SSLAddCertData() {
138 } 139 }
139 140
140 void TabContentsSSLHelper::SSLAddCertData::ShowInfoBar( 141 void TabContentsSSLHelper::SSLAddCertData::ShowInfoBar(
141 InfoBarDelegate* delegate) { 142 InfoBarDelegate* delegate) {
142 if (infobar_delegate_) 143 if (infobar_delegate_)
143 tab_contents_->ReplaceInfoBar(infobar_delegate_, delegate); 144 tab_contents_->ReplaceInfoBar(infobar_delegate_, delegate);
144 else 145 else
145 tab_contents_->AddInfoBar(delegate); 146 tab_contents_->AddInfoBar(delegate);
146 infobar_delegate_ = delegate; 147 infobar_delegate_ = delegate;
147 } 148 }
148 149
149 void TabContentsSSLHelper::SSLAddCertData::ShowErrorInfoBar( 150 void TabContentsSSLHelper::SSLAddCertData::ShowErrorInfoBar(
150 const string16& message) { 151 const string16& message) {
151 ShowInfoBar(new SimpleAlertInfoBarDelegate( 152 ShowInfoBar(new SimpleAlertInfoBarDelegate(
152 tab_contents_->tab_contents(), GetCertIcon(), message, true)); 153 tab_contents_->tab_contents(), GetCertIcon(), message, true));
153 } 154 }
154 155
155 void TabContentsSSLHelper::SSLAddCertData::Observe( 156 void TabContentsSSLHelper::SSLAddCertData::Observe(
156 NotificationType type, 157 NotificationType type,
157 const NotificationSource& source, 158 const NotificationSource& source,
158 const NotificationDetails& details) { 159 const NotificationDetails& details) {
159 DCHECK(type.value == NotificationType::TAB_CONTENTS_INFOBAR_REMOVED || 160 DCHECK(type.value == chrome::TAB_CONTENTS_INFOBAR_REMOVED ||
160 type.value == NotificationType::TAB_CONTENTS_INFOBAR_REPLACED); 161 type.value == chrome::TAB_CONTENTS_INFOBAR_REPLACED);
161 if (infobar_delegate_ == 162 if (infobar_delegate_ ==
162 ((type.value == NotificationType::TAB_CONTENTS_INFOBAR_REMOVED) ? 163 ((type.value == chrome::TAB_CONTENTS_INFOBAR_REMOVED) ?
163 Details<InfoBarRemovedDetails>(details)->first : 164 Details<InfoBarRemovedDetails>(details)->first :
164 Details<InfoBarReplacedDetails>(details)->first)) 165 Details<InfoBarReplacedDetails>(details)->first))
165 infobar_delegate_ = NULL; 166 infobar_delegate_ = NULL;
166 } 167 }
167 168
168 169
169 // TabContentsSSLHelper ------------------------------------------------------- 170 // TabContentsSSLHelper -------------------------------------------------------
170 171
171 TabContentsSSLHelper::TabContentsSSLHelper(TabContentsWrapper* tab_contents) 172 TabContentsSSLHelper::TabContentsSSLHelper(TabContentsWrapper* tab_contents)
172 : tab_contents_(tab_contents) { 173 : tab_contents_(tab_contents) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 TabContentsSSLHelper::SSLAddCertData* TabContentsSSLHelper::GetAddCertData( 226 TabContentsSSLHelper::SSLAddCertData* TabContentsSSLHelper::GetAddCertData(
226 SSLAddCertHandler* handler) { 227 SSLAddCertHandler* handler) {
227 // Find/create the slot. 228 // Find/create the slot.
228 linked_ptr<SSLAddCertData>& ptr_ref = 229 linked_ptr<SSLAddCertData>& ptr_ref =
229 request_id_to_add_cert_data_[handler->network_request_id()]; 230 request_id_to_add_cert_data_[handler->network_request_id()];
230 // Fill it if necessary. 231 // Fill it if necessary.
231 if (!ptr_ref.get()) 232 if (!ptr_ref.get())
232 ptr_ref.reset(new SSLAddCertData(tab_contents_)); 233 ptr_ref.reset(new SSLAddCertData(tab_contents_));
233 return ptr_ref.get(); 234 return ptr_ref.get();
234 } 235 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698