| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/renderer/renderer_webkitclient_impl.h" | 5 #include "chrome/renderer/renderer_webkitclient_impl.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/platform_file.h" | 9 #include "base/platform_file.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 | 42 |
| 43 WebKit::WebSandboxSupport* RendererWebKitClientImpl::sandboxSupport() { | 43 WebKit::WebSandboxSupport* RendererWebKitClientImpl::sandboxSupport() { |
| 44 #if defined(OS_WIN) || defined(OS_LINUX) | 44 #if defined(OS_WIN) || defined(OS_LINUX) |
| 45 return &sandbox_support_; | 45 return &sandbox_support_; |
| 46 #else | 46 #else |
| 47 return NULL; | 47 return NULL; |
| 48 #endif | 48 #endif |
| 49 } | 49 } |
| 50 | 50 |
| 51 bool RendererWebKitClientImpl::sandboxEnabled() { |
| 52 // As explained in WebKitClient.h, this function is used to decide whether to |
| 53 // allow file system operations to come out of WebKit or not. Even if the |
| 54 // sandbox is disabled, there's no reason why the code should act any |
| 55 // differently...unless we're in single process mode. In which case, we have |
| 56 // no other choice. WebKitClient.h discourages using this switch unless |
| 57 // absolutely necessary, so hopefully we won't end up with too many code paths |
| 58 // being different in single-process mode. |
| 59 return !CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); |
| 60 } |
| 61 |
| 51 bool RendererWebKitClientImpl::getFileSize(const WebString& path, | 62 bool RendererWebKitClientImpl::getFileSize(const WebString& path, |
| 52 long long& result) { | 63 long long& result) { |
| 53 if (RenderThread::current()->Send(new ViewHostMsg_GetFileSize( | 64 if (RenderThread::current()->Send(new ViewHostMsg_GetFileSize( |
| 54 FilePath(webkit_glue::WebStringToFilePathString(path)), | 65 FilePath(webkit_glue::WebStringToFilePathString(path)), |
| 55 reinterpret_cast<int64*>(&result)))) { | 66 reinterpret_cast<int64*>(&result)))) { |
| 56 return result >= 0; | 67 return result >= 0; |
| 57 } else { | 68 } else { |
| 58 result = -1; | 69 result = -1; |
| 59 return false; | 70 return false; |
| 60 } | 71 } |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 long long RendererWebKitClientImpl::databaseGetFileSize( | 250 long long RendererWebKitClientImpl::databaseGetFileSize( |
| 240 const WebString& file_name) { | 251 const WebString& file_name) { |
| 241 DBMessageFilter* db_message_filter = DBMessageFilter::GetInstance(); | 252 DBMessageFilter* db_message_filter = DBMessageFilter::GetInstance(); |
| 242 int message_id = db_message_filter->GetUniqueID(); | 253 int message_id = db_message_filter->GetUniqueID(); |
| 243 return db_message_filter->SendAndWait( | 254 return db_message_filter->SendAndWait( |
| 244 new ViewHostMsg_DatabaseGetFileSize( | 255 new ViewHostMsg_DatabaseGetFileSize( |
| 245 FilePath(webkit_glue::WebStringToFilePathString(file_name)), | 256 FilePath(webkit_glue::WebStringToFilePathString(file_name)), |
| 246 message_id), | 257 message_id), |
| 247 message_id, 0LL); | 258 message_id, 0LL); |
| 248 } | 259 } |
| OLD | NEW |