| 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 "webkit/tools/test_shell/simple_file_system.h" |    5 #include "webkit/tools/test_shell/simple_file_system.h" | 
|    6  |    6  | 
|    7 #include "base/file_path.h" |    7 #include "base/file_path.h" | 
|    8 #include "base/memory/scoped_callback_factory.h" |    8 #include "base/memory/scoped_callback_factory.h" | 
|    9 #include "base/message_loop.h" |    9 #include "base/message_loop.h" | 
|   10 #include "base/message_loop_proxy.h" |   10 #include "base/message_loop_proxy.h" | 
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   57   } |   57   } | 
|   58  |   58  | 
|   59   ~SimpleFileSystemCallbackDispatcher() { |   59   ~SimpleFileSystemCallbackDispatcher() { | 
|   60   } |   60   } | 
|   61  |   61  | 
|   62   virtual void DidSucceed() { |   62   virtual void DidSucceed() { | 
|   63     DCHECK(file_system_); |   63     DCHECK(file_system_); | 
|   64     callbacks_->didSucceed(); |   64     callbacks_->didSucceed(); | 
|   65   } |   65   } | 
|   66  |   66  | 
 |   67   // Callback to report information for a file. | 
 |   68   virtual void DidGetLocalPath(const FilePath& local_path) { | 
 |   69     NOTREACHED(); | 
 |   70   } | 
 |   71  | 
|   67   virtual void DidReadMetadata(const base::PlatformFileInfo& info, |   72   virtual void DidReadMetadata(const base::PlatformFileInfo& info, | 
|   68       const FilePath& platform_path) { |   73       const FilePath& platform_path) { | 
|   69     DCHECK(file_system_); |   74     DCHECK(file_system_); | 
|   70     WebFileInfo web_file_info; |   75     WebFileInfo web_file_info; | 
|   71     web_file_info.length = info.size; |   76     web_file_info.length = info.size; | 
|   72     web_file_info.modificationTime = info.last_modified.ToDoubleT(); |   77     web_file_info.modificationTime = info.last_modified.ToDoubleT(); | 
|   73     web_file_info.type = info.is_directory ? |   78     web_file_info.type = info.is_directory ? | 
|   74         WebFileInfo::TypeDirectory : WebFileInfo::TypeFile; |   79         WebFileInfo::TypeDirectory : WebFileInfo::TypeFile; | 
|   75     web_file_info.platformPath = |   80     web_file_info.platformPath = | 
|   76         webkit_glue::FilePathToWebString(platform_path); |   81         webkit_glue::FilePathToWebString(platform_path); | 
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  123  |  128  | 
|  124 SimpleFileSystem::SimpleFileSystem() { |  129 SimpleFileSystem::SimpleFileSystem() { | 
|  125   if (file_system_dir_.CreateUniqueTempDir()) { |  130   if (file_system_dir_.CreateUniqueTempDir()) { | 
|  126     file_system_context_ = new FileSystemContext( |  131     file_system_context_ = new FileSystemContext( | 
|  127         base::MessageLoopProxy::CreateForCurrentThread(), |  132         base::MessageLoopProxy::CreateForCurrentThread(), | 
|  128         base::MessageLoopProxy::CreateForCurrentThread(), |  133         base::MessageLoopProxy::CreateForCurrentThread(), | 
|  129         NULL /* special storage policy */, |  134         NULL /* special storage policy */, | 
|  130         file_system_dir_.path(), |  135         file_system_dir_.path(), | 
|  131         false /* incognito */, |  136         false /* incognito */, | 
|  132         true /* allow_file_access */, |  137         true /* allow_file_access */, | 
|  133         true /* unlimited_quota */); |  138         true /* unlimited_quota */, | 
 |  139         NULL); | 
|  134   } else { |  140   } else { | 
|  135     LOG(WARNING) << "Failed to create a temp dir for the filesystem." |  141     LOG(WARNING) << "Failed to create a temp dir for the filesystem." | 
|  136                     "FileSystem feature will be disabled."; |  142                     "FileSystem feature will be disabled."; | 
|  137   } |  143   } | 
|  138 } |  144 } | 
|  139  |  145  | 
|  140 SimpleFileSystem::~SimpleFileSystem() { |  146 SimpleFileSystem::~SimpleFileSystem() { | 
|  141 } |  147 } | 
|  142  |  148  | 
|  143 void SimpleFileSystem::OpenFileSystem( |  149 void SimpleFileSystem::OpenFileSystem( | 
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  226  |  232  | 
|  227 FileSystemOperation* SimpleFileSystem::GetNewOperation( |  233 FileSystemOperation* SimpleFileSystem::GetNewOperation( | 
|  228     WebFileSystemCallbacks* callbacks) { |  234     WebFileSystemCallbacks* callbacks) { | 
|  229   SimpleFileSystemCallbackDispatcher* dispatcher = |  235   SimpleFileSystemCallbackDispatcher* dispatcher = | 
|  230       new SimpleFileSystemCallbackDispatcher(AsWeakPtr(), callbacks); |  236       new SimpleFileSystemCallbackDispatcher(AsWeakPtr(), callbacks); | 
|  231   FileSystemOperation* operation = new FileSystemOperation( |  237   FileSystemOperation* operation = new FileSystemOperation( | 
|  232       dispatcher, base::MessageLoopProxy::CreateForCurrentThread(), |  238       dispatcher, base::MessageLoopProxy::CreateForCurrentThread(), | 
|  233       file_system_context_.get(), NULL); |  239       file_system_context_.get(), NULL); | 
|  234   return operation; |  240   return operation; | 
|  235 } |  241 } | 
| OLD | NEW |