OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/download/save_package.h" | 5 #include "chrome/browser/download/save_package.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
31 #include "chrome/common/pref_service.h" | 31 #include "chrome/common/pref_service.h" |
32 #include "chrome/common/stl_util-inl.h" | 32 #include "chrome/common/stl_util-inl.h" |
33 #include "chrome/common/win_util.h" | 33 #include "chrome/common/win_util.h" |
34 #include "net/base/net_util.h" | 34 #include "net/base/net_util.h" |
35 #include "net/url_request/url_request_context.h" | 35 #include "net/url_request/url_request_context.h" |
36 #include "webkit/glue/dom_serializer_delegate.h" | 36 #include "webkit/glue/dom_serializer_delegate.h" |
37 | 37 |
38 #include "generated_resources.h" | 38 #include "generated_resources.h" |
39 | 39 |
| 40 using base::Time; |
| 41 |
40 // Default name which will be used when we can not get proper name from | 42 // Default name which will be used when we can not get proper name from |
41 // resource URL. | 43 // resource URL. |
42 static const wchar_t kDefaultSaveName[] = L"saved_resource"; | 44 static const wchar_t kDefaultSaveName[] = L"saved_resource"; |
43 | 45 |
44 // Maximum number of file ordinal number. I think it's big enough for resolving | 46 // Maximum number of file ordinal number. I think it's big enough for resolving |
45 // name-conflict files which has same base file name. | 47 // name-conflict files which has same base file name. |
46 static const int32 kMaxFileOrdinalNumber = 9999; | 48 static const int32 kMaxFileOrdinalNumber = 9999; |
47 | 49 |
48 // Maximum length for file path. Since Windows have MAX_PATH limitation for | 50 // Maximum length for file path. Since Windows have MAX_PATH limitation for |
49 // file path, we need to make sure length of file path of every saved file | 51 // file path, we need to make sure length of file path of every saved file |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 | 1055 |
1054 if (available_length > dir_path_length) { | 1056 if (available_length > dir_path_length) { |
1055 *pure_file_name = | 1057 *pure_file_name = |
1056 pure_file_name->substr(0, available_length - dir_path_length); | 1058 pure_file_name->substr(0, available_length - dir_path_length); |
1057 return true; | 1059 return true; |
1058 } else { | 1060 } else { |
1059 pure_file_name->clear(); | 1061 pure_file_name->clear(); |
1060 return false; | 1062 return false; |
1061 } | 1063 } |
1062 } | 1064 } |
1063 | |
OLD | NEW |