| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 if (model_file_ == base::kInvalidPlatformFileValue) | 185 if (model_file_ == base::kInvalidPlatformFileValue) |
| 186 return; | 186 return; |
| 187 | 187 |
| 188 IPC::PlatformFileForTransit file; | 188 IPC::PlatformFileForTransit file; |
| 189 #if defined(OS_POSIX) | 189 #if defined(OS_POSIX) |
| 190 file = base::FileDescriptor(model_file_, false); | 190 file = base::FileDescriptor(model_file_, false); |
| 191 #elif defined(OS_WIN) | 191 #elif defined(OS_WIN) |
| 192 ::DuplicateHandle(::GetCurrentProcess(), model_file_, process->GetHandle(), | 192 ::DuplicateHandle(::GetCurrentProcess(), model_file_, process->GetHandle(), |
| 193 &file, 0, false, DUPLICATE_SAME_ACCESS); | 193 &file, 0, false, DUPLICATE_SAME_ACCESS); |
| 194 #endif | 194 #endif |
| 195 VLOG(2) << "Sending phishing model to renderer"; |
| 195 process->Send(new SafeBrowsingMsg_SetPhishingModel(file)); | 196 process->Send(new SafeBrowsingMsg_SetPhishingModel(file)); |
| 196 } | 197 } |
| 197 | 198 |
| 198 void ClientSideDetectionService::SetModelStatus(ModelStatus status) { | 199 void ClientSideDetectionService::SetModelStatus(ModelStatus status) { |
| 199 DCHECK_NE(READY_STATUS, model_status_); | 200 DCHECK_NE(READY_STATUS, model_status_); |
| 200 model_status_ = status; | 201 model_status_ = status; |
| 201 | 202 |
| 202 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); | 203 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); |
| 203 !i.IsAtEnd(); i.Advance()) { | 204 !i.IsAtEnd(); i.Advance()) { |
| 204 RenderProcessHost* process = i.GetCurrentValue(); | 205 RenderProcessHost* process = i.GetCurrentValue(); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 } else { | 465 } else { |
| 465 DLOG(FATAL) << "Unable to parse IP address range: " | 466 DLOG(FATAL) << "Unable to parse IP address range: " |
| 466 << kPrivateNetworks[i]; | 467 << kPrivateNetworks[i]; |
| 467 return false; | 468 return false; |
| 468 } | 469 } |
| 469 } | 470 } |
| 470 return true; | 471 return true; |
| 471 } | 472 } |
| 472 | 473 |
| 473 } // namespace safe_browsing | 474 } // namespace safe_browsing |
| OLD | NEW |