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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 #include "content/public/browser/web_contents_delegate.h" | 85 #include "content/public/browser/web_contents_delegate.h" |
85 #include "content/public/browser/web_contents_observer.h" | 86 #include "content/public/browser/web_contents_observer.h" |
86 #include "content/public/common/bindings_policy.h" | 87 #include "content/public/common/bindings_policy.h" |
87 #include "content/public/common/content_constants.h" | 88 #include "content/public/common/content_constants.h" |
88 #include "content/public/common/content_switches.h" | 89 #include "content/public/common/content_switches.h" |
89 #include "content/public/common/page_zoom.h" | 90 #include "content/public/common/page_zoom.h" |
90 #include "content/public/common/result_codes.h" | 91 #include "content/public/common/result_codes.h" |
91 #include "content/public/common/url_constants.h" | 92 #include "content/public/common/url_constants.h" |
92 #include "content/public/common/url_utils.h" | 93 #include "content/public/common/url_utils.h" |
93 #include "content/public/common/web_preferences.h" | 94 #include "content/public/common/web_preferences.h" |
94 #include "net/base/mime_util.h" | |
95 #include "net/base/net_util.h" | 95 #include "net/base/net_util.h" |
96 #include "net/http/http_cache.h" | 96 #include "net/http/http_cache.h" |
97 #include "net/http/http_transaction_factory.h" | 97 #include "net/http/http_transaction_factory.h" |
98 #include "net/url_request/url_request_context.h" | 98 #include "net/url_request/url_request_context.h" |
99 #include "net/url_request/url_request_context_getter.h" | 99 #include "net/url_request/url_request_context_getter.h" |
100 #include "ui/base/layout.h" | 100 #include "ui/base/layout.h" |
101 #include "ui/gfx/display.h" | 101 #include "ui/gfx/display.h" |
102 #include "ui/gfx/screen.h" | 102 #include "ui/gfx/screen.h" |
103 #include "ui/gl/gl_switches.h" | 103 #include "ui/gl/gl_switches.h" |
104 | 104 |
(...skipping 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2217 } | 2217 } |
2218 | 2218 |
2219 bool WebContentsImpl::IsSavable() { | 2219 bool WebContentsImpl::IsSavable() { |
2220 // WebKit creates Document object when MIME type is application/xhtml+xml, | 2220 // WebKit creates Document object when MIME type is application/xhtml+xml, |
2221 // so we also support this MIME type. | 2221 // so we also support this MIME type. |
2222 return contents_mime_type_ == "text/html" || | 2222 return contents_mime_type_ == "text/html" || |
2223 contents_mime_type_ == "text/xml" || | 2223 contents_mime_type_ == "text/xml" || |
2224 contents_mime_type_ == "application/xhtml+xml" || | 2224 contents_mime_type_ == "application/xhtml+xml" || |
2225 contents_mime_type_ == "text/plain" || | 2225 contents_mime_type_ == "text/plain" || |
2226 contents_mime_type_ == "text/css" || | 2226 contents_mime_type_ == "text/css" || |
2227 net::IsSupportedJavascriptMimeType(contents_mime_type_.c_str()); | 2227 mime_util::IsSupportedJavascriptMimeType(contents_mime_type_); |
2228 } | 2228 } |
2229 | 2229 |
2230 void WebContentsImpl::OnSavePage() { | 2230 void WebContentsImpl::OnSavePage() { |
2231 // If we can not save the page, try to download it. | 2231 // If we can not save the page, try to download it. |
2232 if (!IsSavable()) { | 2232 if (!IsSavable()) { |
2233 RecordDownloadSource(INITIATED_BY_SAVE_PACKAGE_ON_NON_HTML); | 2233 RecordDownloadSource(INITIATED_BY_SAVE_PACKAGE_ON_NON_HTML); |
2234 SaveFrame(GetLastCommittedURL(), Referrer()); | 2234 SaveFrame(GetLastCommittedURL(), Referrer()); |
2235 return; | 2235 return; |
2236 } | 2236 } |
2237 | 2237 |
(...skipping 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4427 node->render_manager()->ResumeResponseDeferredAtStart(); | 4427 node->render_manager()->ResumeResponseDeferredAtStart(); |
4428 } | 4428 } |
4429 | 4429 |
4430 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4430 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4431 force_disable_overscroll_content_ = force_disable; | 4431 force_disable_overscroll_content_ = force_disable; |
4432 if (view_) | 4432 if (view_) |
4433 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4433 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4434 } | 4434 } |
4435 | 4435 |
4436 } // namespace content | 4436 } // namespace content |
OLD | NEW |