OLD | NEW |
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/profiles/off_the_record_profile_impl.h" | 5 #include "chrome/browser/profiles/off_the_record_profile_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 237 } |
238 | 238 |
239 SSLHostState* OffTheRecordProfileImpl::GetSSLHostState() { | 239 SSLHostState* OffTheRecordProfileImpl::GetSSLHostState() { |
240 if (!ssl_host_state_.get()) | 240 if (!ssl_host_state_.get()) |
241 ssl_host_state_.reset(new SSLHostState()); | 241 ssl_host_state_.reset(new SSLHostState()); |
242 | 242 |
243 DCHECK(ssl_host_state_->CalledOnValidThread()); | 243 DCHECK(ssl_host_state_->CalledOnValidThread()); |
244 return ssl_host_state_.get(); | 244 return ssl_host_state_.get(); |
245 } | 245 } |
246 | 246 |
247 net::TransportSecurityState* | |
248 OffTheRecordProfileImpl::GetTransportSecurityState() { | |
249 if (!transport_security_state_.get()) { | |
250 transport_security_state_ = new net::TransportSecurityState( | |
251 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
252 switches::kHstsHosts)); | |
253 transport_security_loader_ = | |
254 new TransportSecurityPersister(transport_security_state_.get(), | |
255 GetPath(), | |
256 true /* readonly */); | |
257 transport_security_loader_->Init(); | |
258 } | |
259 | |
260 return transport_security_state_.get(); | |
261 } | |
262 | |
263 HistoryService* OffTheRecordProfileImpl::GetHistoryService( | 247 HistoryService* OffTheRecordProfileImpl::GetHistoryService( |
264 ServiceAccessType sat) { | 248 ServiceAccessType sat) { |
265 if (sat == EXPLICIT_ACCESS) | 249 if (sat == EXPLICIT_ACCESS) |
266 return profile_->GetHistoryService(sat); | 250 return profile_->GetHistoryService(sat); |
267 | 251 |
268 NOTREACHED() << "This profile is OffTheRecord"; | 252 NOTREACHED() << "This profile is OffTheRecord"; |
269 return NULL; | 253 return NULL; |
270 } | 254 } |
271 | 255 |
272 HistoryService* OffTheRecordProfileImpl::GetHistoryServiceWithoutCreating() { | 256 HistoryService* OffTheRecordProfileImpl::GetHistoryServiceWithoutCreating() { |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 // point in the future. | 589 // point in the future. |
606 return NULL; | 590 return NULL; |
607 } | 591 } |
608 | 592 |
609 chrome_browser_net::Predictor* OffTheRecordProfileImpl::GetNetworkPredictor() { | 593 chrome_browser_net::Predictor* OffTheRecordProfileImpl::GetNetworkPredictor() { |
610 // We do not store information about websites visited in OTR profiles which | 594 // We do not store information about websites visited in OTR profiles which |
611 // is necessary for a Predictor, so we do not have a Predictor at all. | 595 // is necessary for a Predictor, so we do not have a Predictor at all. |
612 return NULL; | 596 return NULL; |
613 } | 597 } |
614 | 598 |
| 599 void OffTheRecordProfileImpl::DeleteTransportSecurityStateSince( |
| 600 base::Time time) { |
| 601 // No need to do anything here, our transport security state is read-only. |
| 602 } |
| 603 |
615 void OffTheRecordProfileImpl::Observe(int type, | 604 void OffTheRecordProfileImpl::Observe(int type, |
616 const NotificationSource& source, | 605 const NotificationSource& source, |
617 const NotificationDetails& details) { | 606 const NotificationDetails& details) { |
618 if (type == content::NOTIFICATION_ZOOM_LEVEL_CHANGED) { | 607 if (type == content::NOTIFICATION_ZOOM_LEVEL_CHANGED) { |
619 const std::string& host = *(Details<const std::string>(details).ptr()); | 608 const std::string& host = *(Details<const std::string>(details).ptr()); |
620 if (!host.empty()) { | 609 if (!host.empty()) { |
621 double level = profile_->GetHostZoomMap()->GetZoomLevel(host); | 610 double level = profile_->GetHostZoomMap()->GetZoomLevel(host); |
622 GetHostZoomMap()->SetZoomLevel(host, level); | 611 GetHostZoomMap()->SetZoomLevel(host, level); |
623 } | 612 } |
624 } | 613 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 OffTheRecordProfileImpl* profile = NULL; | 691 OffTheRecordProfileImpl* profile = NULL; |
703 #if defined(OS_CHROMEOS) | 692 #if defined(OS_CHROMEOS) |
704 if (Profile::IsGuestSession()) | 693 if (Profile::IsGuestSession()) |
705 profile = new GuestSessionProfile(this); | 694 profile = new GuestSessionProfile(this); |
706 #endif | 695 #endif |
707 if (!profile) | 696 if (!profile) |
708 profile = new OffTheRecordProfileImpl(this); | 697 profile = new OffTheRecordProfileImpl(this); |
709 profile->Init(); | 698 profile->Init(); |
710 return profile; | 699 return profile; |
711 } | 700 } |
OLD | NEW |