Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2412)

Side by Side Diff: chrome/browser/download/save_package.cc

Issue 31008: Coalesce more hardcoded schemes to using predefined constants. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/dom_ui/dom_ui_contents.cc ('k') | chrome/browser/extensions/extension.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
21 #include "chrome/browser/renderer_host/render_view_host.h" 21 #include "chrome/browser/renderer_host/render_view_host.h"
22 #include "chrome/browser/renderer_host/render_view_host_delegate.h" 22 #include "chrome/browser/renderer_host/render_view_host_delegate.h"
23 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" 23 #include "chrome/browser/renderer_host/resource_dispatcher_host.h"
24 #include "chrome/browser/tab_contents/tab_util.h" 24 #include "chrome/browser/tab_contents/tab_util.h"
25 #include "chrome/browser/tab_contents/web_contents.h" 25 #include "chrome/browser/tab_contents/web_contents.h"
26 #include "chrome/common/chrome_paths.h" 26 #include "chrome/common/chrome_paths.h"
27 #include "chrome/common/l10n_util.h" 27 #include "chrome/common/l10n_util.h"
28 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
29 #include "chrome/common/pref_service.h" 29 #include "chrome/common/pref_service.h"
30 #include "chrome/common/stl_util-inl.h" 30 #include "chrome/common/stl_util-inl.h"
31 #include "chrome/common/url_constants.h"
31 #include "grit/generated_resources.h" 32 #include "grit/generated_resources.h"
32 #include "net/base/io_buffer.h" 33 #include "net/base/io_buffer.h"
33 #include "net/base/mime_util.h" 34 #include "net/base/mime_util.h"
34 #include "net/base/net_util.h" 35 #include "net/base/net_util.h"
35 #include "net/url_request/url_request_context.h" 36 #include "net/url_request/url_request_context.h"
36 #include "webkit/glue/dom_serializer_delegate.h" 37 #include "webkit/glue/dom_serializer_delegate.h"
37 38
38 #if defined(OS_WIN) 39 #if defined(OS_WIN)
39 #include "base/win_util.h" 40 #include "base/win_util.h"
40 #include "chrome/common/win_util.h" 41 #include "chrome/common/win_util.h"
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 param->dir = param->dir.Append( 1062 param->dir = param->dir.Append(
1062 param->saved_main_file_path.RemoveExtension().BaseName().value() + 1063 param->saved_main_file_path.RemoveExtension().BaseName().value() +
1063 FILE_PATH_LITERAL("_files")); 1064 FILE_PATH_LITERAL("_files"));
1064 } 1065 }
1065 1066
1066 return true; 1067 return true;
1067 } 1068 }
1068 1069
1069 // Static 1070 // Static
1070 bool SavePackage::IsSavableURL(const GURL& url) { 1071 bool SavePackage::IsSavableURL(const GURL& url) {
1071 return url.SchemeIs("http") || url.SchemeIs("https") || 1072 return url.SchemeIs(chrome::kHttpScheme) ||
1072 url.SchemeIs("file") || url.SchemeIs("ftp"); 1073 url.SchemeIs(chrome::kHttpsScheme) ||
1074 url.SchemeIs(chrome::kFileScheme) ||
1075 url.SchemeIs(chrome::kFtpScheme);
1073 } 1076 }
1074 1077
1075 // Static 1078 // Static
1076 bool SavePackage::IsSavableContents(const std::string& contents_mime_type) { 1079 bool SavePackage::IsSavableContents(const std::string& contents_mime_type) {
1077 // WebKit creates Document object when MIME type is application/xhtml+xml, 1080 // WebKit creates Document object when MIME type is application/xhtml+xml,
1078 // so we also support this MIME type. 1081 // so we also support this MIME type.
1079 return contents_mime_type == "text/html" || 1082 return contents_mime_type == "text/html" ||
1080 contents_mime_type == "text/xml" || 1083 contents_mime_type == "text/xml" ||
1081 contents_mime_type == "application/xhtml+xml" || 1084 contents_mime_type == "application/xhtml+xml" ||
1082 contents_mime_type == "text/plain" || 1085 contents_mime_type == "text/plain" ||
(...skipping 27 matching lines...) Expand all
1110 *pure_file_name = 1113 *pure_file_name =
1111 pure_file_name->substr(0, available_length); 1114 pure_file_name->substr(0, available_length);
1112 return true; 1115 return true;
1113 } 1116 }
1114 1117
1115 // Not enough room to even use a shortened |pure_file_name|. 1118 // Not enough room to even use a shortened |pure_file_name|.
1116 pure_file_name->clear(); 1119 pure_file_name->clear();
1117 return false; 1120 return false;
1118 } 1121 }
1119 1122
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/dom_ui_contents.cc ('k') | chrome/browser/extensions/extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698