Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/utility/chrome_content_utility_client.h" | 5 #include "chrome/utility/chrome_content_utility_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_AnalyzeDmgFileForDownloadProtection, | 168 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_AnalyzeDmgFileForDownloadProtection, |
| 169 OnAnalyzeDmgFileForDownloadProtection) | 169 OnAnalyzeDmgFileForDownloadProtection) |
| 170 #endif // defined(OS_MACOSX) | 170 #endif // defined(OS_MACOSX) |
| 171 #endif // defined(FULL_SAFE_BROWSING) | 171 #endif // defined(FULL_SAFE_BROWSING) |
| 172 #if defined(OS_CHROMEOS) | 172 #if defined(OS_CHROMEOS) |
| 173 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_CreateZipFile, OnCreateZipFile) | 173 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_CreateZipFile, OnCreateZipFile) |
| 174 #endif | 174 #endif |
| 175 IPC_MESSAGE_UNHANDLED(handled = false) | 175 IPC_MESSAGE_UNHANDLED(handled = false) |
| 176 IPC_END_MESSAGE_MAP() | 176 IPC_END_MESSAGE_MAP() |
| 177 | 177 |
| 178 for (Handlers::iterator it = handlers_.begin(); | 178 for (Handlers::iterator it = handlers_.begin(); |
|
jochen (gone - plz use gerrit)
2016/05/06 10:32:30
why not:
if (handled) return true;
for (auto& ha
Anand Mistry (off Chromium)
2016/05/09 02:32:14
I was just trying to minimise the change. I've cha
| |
| 179 !handled && it != handlers_.end(); ++it) { | 179 !handled && it != handlers_.end(); ++it) { |
| 180 handled = (*it)->OnMessageReceived(message); | 180 handled = (*it)->OnMessageReceived(message); |
| 181 | |
| 182 // Warning, this is a hack! At least one of the utility process handlers | |
| 183 // adds a new handler to |handlers_| when it handles a message. This causes | |
| 184 // |it| to become invalid and hence the increment, which happens before | |
| 185 // checking the loop condition, is an invalid operation. For now, just | |
| 186 // early-out of this loop and avoid incrementing the iterator. Eventually, | |
| 187 // this will be fixed by moving everything to Mojo. | |
| 188 if (handled) | |
| 189 return true; | |
| 181 } | 190 } |
| 182 | 191 |
| 183 return handled; | 192 return handled; |
| 184 } | 193 } |
| 185 | 194 |
| 186 void ChromeContentUtilityClient::RegisterMojoServices( | 195 void ChromeContentUtilityClient::RegisterMojoServices( |
| 187 content::ServiceRegistry* registry) { | 196 content::ServiceRegistry* registry) { |
| 188 // When the utility process is running with elevated privileges, we need to | 197 // When the utility process is running with elevated privileges, we need to |
| 189 // filter messages so that only a whitelist of IPCs can run. In Mojo, there's | 198 // filter messages so that only a whitelist of IPCs can run. In Mojo, there's |
| 190 // no way of filtering individual messages. Instead, we can avoid adding | 199 // no way of filtering individual messages. Instead, we can avoid adding |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 safe_browsing::zip_analyzer::Results results; | 305 safe_browsing::zip_analyzer::Results results; |
| 297 safe_browsing::dmg::AnalyzeDMGFile( | 306 safe_browsing::dmg::AnalyzeDMGFile( |
| 298 IPC::PlatformFileForTransitToFile(dmg_file), &results); | 307 IPC::PlatformFileForTransitToFile(dmg_file), &results); |
| 299 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished( | 308 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished( |
| 300 results)); | 309 results)); |
| 301 ReleaseProcessIfNeeded(); | 310 ReleaseProcessIfNeeded(); |
| 302 } | 311 } |
| 303 #endif // defined(OS_MACOSX) | 312 #endif // defined(OS_MACOSX) |
| 304 | 313 |
| 305 #endif // defined(FULL_SAFE_BROWSING) | 314 #endif // defined(FULL_SAFE_BROWSING) |
| OLD | NEW |