| 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/protector/protector.h" | 5 #include "chrome/browser/protector/protector.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/protector/settings_change_global_error.h" | 10 #include "chrome/browser/protector/settings_change_global_error.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 DVLOG(1) << "Apply change"; | 59 DVLOG(1) << "Apply change"; |
| 60 change_->Apply(); | 60 change_->Apply(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void Protector::OnDiscardChange() { | 63 void Protector::OnDiscardChange() { |
| 64 DVLOG(1) << "Discard change"; | 64 DVLOG(1) << "Discard change"; |
| 65 change_->Discard(); | 65 change_->Discard(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void Protector::OnDecisionTimeout() { | 68 void Protector::OnDecisionTimeout() { |
| 69 // TODO(ivankr): Add histogram. | |
| 70 DVLOG(1) << "Timeout"; | 69 DVLOG(1) << "Timeout"; |
| 70 change_->Timeout(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void Protector::OnRemovedFromProfile() { | 73 void Protector::OnRemovedFromProfile() { |
| 74 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); | 74 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void Protector::InitAndShowChange(BaseSettingChange* change) { | 77 void Protector::InitAndShowChange(BaseSettingChange* change) { |
| 78 DVLOG(1) << "Init change"; | 78 DVLOG(1) << "Init change"; |
| 79 if (!change->Init(this)) { | 79 if (!change->Init(this)) { |
| 80 LOG(WARNING) << "Error while initializing, removing ourselves"; | 80 LOG(WARNING) << "Error while initializing, removing ourselves"; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 108 bool IsSettingValid(const std::string& value, const std::string& signature) { | 108 bool IsSettingValid(const std::string& value, const std::string& signature) { |
| 109 crypto::HMAC hmac(crypto::HMAC::SHA256); | 109 crypto::HMAC hmac(crypto::HMAC::SHA256); |
| 110 if (!hmac.Init(kProtectorSigningKey)) { | 110 if (!hmac.Init(kProtectorSigningKey)) { |
| 111 LOG(WARNING) << "Failed to initialize HMAC algorithm for verification."; | 111 LOG(WARNING) << "Failed to initialize HMAC algorithm for verification."; |
| 112 return false; | 112 return false; |
| 113 } | 113 } |
| 114 return hmac.Verify(value, signature); | 114 return hmac.Verify(value, signature); |
| 115 } | 115 } |
| 116 | 116 |
| 117 } // namespace protector | 117 } // namespace protector |
| OLD | NEW |