| 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/safe_browsing/client_side_detection_service.h" | 5 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util_proxy.h" | 9 #include "base/file_util_proxy.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 if (model_file_ == base::kInvalidPlatformFileValue) | 181 if (model_file_ == base::kInvalidPlatformFileValue) |
| 182 return; | 182 return; |
| 183 | 183 |
| 184 IPC::PlatformFileForTransit file; | 184 IPC::PlatformFileForTransit file; |
| 185 #if defined(OS_POSIX) | 185 #if defined(OS_POSIX) |
| 186 file = base::FileDescriptor(model_file_, false); | 186 file = base::FileDescriptor(model_file_, false); |
| 187 #elif defined(OS_WIN) | 187 #elif defined(OS_WIN) |
| 188 ::DuplicateHandle(::GetCurrentProcess(), model_file_, process->GetHandle(), | 188 ::DuplicateHandle(::GetCurrentProcess(), model_file_, process->GetHandle(), |
| 189 &file, 0, false, DUPLICATE_SAME_ACCESS); | 189 &file, 0, false, DUPLICATE_SAME_ACCESS); |
| 190 #endif | 190 #endif |
| 191 VLOG(2) << "Sending phishing model to renderer"; |
| 191 process->Send(new SafeBrowsingMsg_SetPhishingModel(file)); | 192 process->Send(new SafeBrowsingMsg_SetPhishingModel(file)); |
| 192 } | 193 } |
| 193 | 194 |
| 194 void ClientSideDetectionService::SetModelStatus(ModelStatus status) { | 195 void ClientSideDetectionService::SetModelStatus(ModelStatus status) { |
| 195 DCHECK_NE(READY_STATUS, model_status_); | 196 DCHECK_NE(READY_STATUS, model_status_); |
| 196 model_status_ = status; | 197 model_status_ = status; |
| 197 | 198 |
| 198 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); | 199 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); |
| 199 !i.IsAtEnd(); i.Advance()) { | 200 !i.IsAtEnd(); i.Advance()) { |
| 200 RenderProcessHost* process = i.GetCurrentValue(); | 201 RenderProcessHost* process = i.GetCurrentValue(); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 } else { | 454 } else { |
| 454 DLOG(FATAL) << "Unable to parse IP address range: " | 455 DLOG(FATAL) << "Unable to parse IP address range: " |
| 455 << kPrivateNetworks[i]; | 456 << kPrivateNetworks[i]; |
| 456 return false; | 457 return false; |
| 457 } | 458 } |
| 458 } | 459 } |
| 459 return true; | 460 return true; |
| 460 } | 461 } |
| 461 | 462 |
| 462 } // namespace safe_browsing | 463 } // namespace safe_browsing |
| OLD | NEW |