| 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/tab_contents/tab_contents.h" | 5 #include "content/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 contents_mime_type_ == "text/xml" || | 1079 contents_mime_type_ == "text/xml" || |
| 1080 contents_mime_type_ == "application/xhtml+xml" || | 1080 contents_mime_type_ == "application/xhtml+xml" || |
| 1081 contents_mime_type_ == "text/plain" || | 1081 contents_mime_type_ == "text/plain" || |
| 1082 contents_mime_type_ == "text/css" || | 1082 contents_mime_type_ == "text/css" || |
| 1083 net::IsSupportedJavascriptMimeType(contents_mime_type_.c_str()); | 1083 net::IsSupportedJavascriptMimeType(contents_mime_type_.c_str()); |
| 1084 } | 1084 } |
| 1085 | 1085 |
| 1086 void TabContents::OnSavePage() { | 1086 void TabContents::OnSavePage() { |
| 1087 // If we can not save the page, try to download it. | 1087 // If we can not save the page, try to download it. |
| 1088 if (!IsSavable()) { | 1088 if (!IsSavable()) { |
| 1089 download_stats::RecordDownloadSource( |
| 1090 download_stats::INITIATED_BY_SAVE_PACKAGE_ON_NON_HTML); |
| 1089 SaveURL(GetURL(), GURL()); | 1091 SaveURL(GetURL(), GURL()); |
| 1090 download_stats::RecordDownloadCount( | |
| 1091 download_stats::INITIATED_BY_SAVE_PACKAGE_FAILURE_COUNT); | |
| 1092 return; | |
| 1093 } | 1092 } |
| 1094 | 1093 |
| 1095 Stop(); | 1094 Stop(); |
| 1096 | 1095 |
| 1097 // Create the save package and possibly prompt the user for the name to save | 1096 // Create the save package and possibly prompt the user for the name to save |
| 1098 // the page as. The user prompt is an asynchronous operation that runs on | 1097 // the page as. The user prompt is an asynchronous operation that runs on |
| 1099 // another thread. | 1098 // another thread. |
| 1100 save_package_ = new SavePackage(this); | 1099 save_package_ = new SavePackage(this); |
| 1101 save_package_->GetSaveInfo(); | 1100 save_package_->GetSaveInfo(); |
| 1102 } | 1101 } |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 | 1558 |
| 1560 void TabContents::OnUpdateZoomLimits(int minimum_percent, | 1559 void TabContents::OnUpdateZoomLimits(int minimum_percent, |
| 1561 int maximum_percent, | 1560 int maximum_percent, |
| 1562 bool remember) { | 1561 bool remember) { |
| 1563 minimum_zoom_percent_ = minimum_percent; | 1562 minimum_zoom_percent_ = minimum_percent; |
| 1564 maximum_zoom_percent_ = maximum_percent; | 1563 maximum_zoom_percent_ = maximum_percent; |
| 1565 temporary_zoom_settings_ = !remember; | 1564 temporary_zoom_settings_ = !remember; |
| 1566 } | 1565 } |
| 1567 | 1566 |
| 1568 void TabContents::OnSaveURL(const GURL& url) { | 1567 void TabContents::OnSaveURL(const GURL& url) { |
| 1568 download_stats::RecordDownloadSource( |
| 1569 download_stats::INITIATED_BY_PEPPER_SAVE); |
| 1569 SaveURL(url, GetURL()); | 1570 SaveURL(url, GetURL()); |
| 1570 } | 1571 } |
| 1571 | 1572 |
| 1572 void TabContents::OnEnumerateDirectory(int request_id, | 1573 void TabContents::OnEnumerateDirectory(int request_id, |
| 1573 const FilePath& path) { | 1574 const FilePath& path) { |
| 1574 delegate_->EnumerateDirectory(this, request_id, path); | 1575 delegate_->EnumerateDirectory(this, request_id, path); |
| 1575 } | 1576 } |
| 1576 | 1577 |
| 1577 void TabContents::OnJSOutOfMemory() { | 1578 void TabContents::OnJSOutOfMemory() { |
| 1578 delegate_->JSOutOfMemory(this); | 1579 delegate_->JSOutOfMemory(this); |
| (...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2437 save_info, | 2438 save_info, |
| 2438 this); | 2439 this); |
| 2439 } | 2440 } |
| 2440 | 2441 |
| 2441 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2442 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 2442 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2443 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
| 2443 // Can be NULL during tests. | 2444 // Can be NULL during tests. |
| 2444 if (rwh_view) | 2445 if (rwh_view) |
| 2445 rwh_view->SetSize(GetView()->GetContainerSize()); | 2446 rwh_view->SetSize(GetView()->GetContainerSize()); |
| 2446 } | 2447 } |
| OLD | NEW |