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 "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/process/process.h" | 13 #include "base/process/process.h" |
14 #include "base/profiler/scoped_tracker.h" | 14 #include "base/profiler/scoped_tracker.h" |
15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "base/trace_event/trace_event.h" | 20 #include "base/trace_event/trace_event.h" |
| 21 #include "components/mime_util/mime_util.h" |
21 #include "content/browser/accessibility/accessibility_mode_helper.h" | 22 #include "content/browser/accessibility/accessibility_mode_helper.h" |
22 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 23 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
23 #include "content/browser/bad_message.h" | 24 #include "content/browser/bad_message.h" |
24 #include "content/browser/browser_plugin/browser_plugin_embedder.h" | 25 #include "content/browser/browser_plugin/browser_plugin_embedder.h" |
25 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 26 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
26 #include "content/browser/child_process_security_policy_impl.h" | 27 #include "content/browser/child_process_security_policy_impl.h" |
27 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 28 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
28 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 29 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
29 #include "content/browser/download/download_stats.h" | 30 #include "content/browser/download/download_stats.h" |
30 #include "content/browser/download/mhtml_generation_manager.h" | 31 #include "content/browser/download/mhtml_generation_manager.h" |
(...skipping 2188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2219 } | 2220 } |
2220 | 2221 |
2221 bool WebContentsImpl::IsSavable() { | 2222 bool WebContentsImpl::IsSavable() { |
2222 // WebKit creates Document object when MIME type is application/xhtml+xml, | 2223 // WebKit creates Document object when MIME type is application/xhtml+xml, |
2223 // so we also support this MIME type. | 2224 // so we also support this MIME type. |
2224 return contents_mime_type_ == "text/html" || | 2225 return contents_mime_type_ == "text/html" || |
2225 contents_mime_type_ == "text/xml" || | 2226 contents_mime_type_ == "text/xml" || |
2226 contents_mime_type_ == "application/xhtml+xml" || | 2227 contents_mime_type_ == "application/xhtml+xml" || |
2227 contents_mime_type_ == "text/plain" || | 2228 contents_mime_type_ == "text/plain" || |
2228 contents_mime_type_ == "text/css" || | 2229 contents_mime_type_ == "text/css" || |
2229 net::IsSupportedJavascriptMimeType(contents_mime_type_.c_str()); | 2230 mime_util::IsSupportedJavascriptMimeType(contents_mime_type_); |
2230 } | 2231 } |
2231 | 2232 |
2232 void WebContentsImpl::OnSavePage() { | 2233 void WebContentsImpl::OnSavePage() { |
2233 // If we can not save the page, try to download it. | 2234 // If we can not save the page, try to download it. |
2234 if (!IsSavable()) { | 2235 if (!IsSavable()) { |
2235 RecordDownloadSource(INITIATED_BY_SAVE_PACKAGE_ON_NON_HTML); | 2236 RecordDownloadSource(INITIATED_BY_SAVE_PACKAGE_ON_NON_HTML); |
2236 SaveFrame(GetLastCommittedURL(), Referrer()); | 2237 SaveFrame(GetLastCommittedURL(), Referrer()); |
2237 return; | 2238 return; |
2238 } | 2239 } |
2239 | 2240 |
(...skipping 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4422 node->render_manager()->ResumeResponseDeferredAtStart(); | 4423 node->render_manager()->ResumeResponseDeferredAtStart(); |
4423 } | 4424 } |
4424 | 4425 |
4425 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4426 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4426 force_disable_overscroll_content_ = force_disable; | 4427 force_disable_overscroll_content_ = force_disable; |
4427 if (view_) | 4428 if (view_) |
4428 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4429 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4429 } | 4430 } |
4430 | 4431 |
4431 } // namespace content | 4432 } // namespace content |
OLD | NEW |