| 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" |
| 11 #include "base/metrics/stats_counters.h" | 11 #include "base/metrics/stats_counters.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "content/browser/child_process_security_policy_impl.h" | 16 #include "content/browser/child_process_security_policy_impl.h" |
| 17 #include "content/browser/debugger/devtools_manager_impl.h" | 17 #include "content/browser/debugger/devtools_manager_impl.h" |
| 18 #include "content/browser/download/download_stats.h" | 18 #include "content/browser/download/download_stats.h" |
| 19 #include "content/browser/download/mhtml_generation_manager.h" |
| 19 #include "content/browser/download/save_package.h" | 20 #include "content/browser/download/save_package.h" |
| 20 #include "content/browser/gpu/gpu_data_manager_impl.h" | 21 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 21 #include "content/browser/gpu/gpu_process_host.h" | 22 #include "content/browser/gpu/gpu_process_host.h" |
| 22 #include "content/browser/host_zoom_map_impl.h" | 23 #include "content/browser/host_zoom_map_impl.h" |
| 23 #include "content/browser/intents/web_intents_dispatcher_impl.h" | 24 #include "content/browser/intents/web_intents_dispatcher_impl.h" |
| 24 #include "content/browser/load_from_memory_cache_details.h" | 25 #include "content/browser/load_from_memory_cache_details.h" |
| 25 #include "content/browser/load_notification_details.h" | 26 #include "content/browser/load_notification_details.h" |
| 26 #include "content/browser/renderer_host/render_process_host_impl.h" | 27 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 27 #include "content/browser/renderer_host/render_view_host.h" | 28 #include "content/browser/renderer_host/render_view_host.h" |
| 28 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 29 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| (...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 // file name sanitation and extension / mime checking. | 1122 // file name sanitation and extension / mime checking. |
| 1122 bool TabContents::SavePage(const FilePath& main_file, const FilePath& dir_path, | 1123 bool TabContents::SavePage(const FilePath& main_file, const FilePath& dir_path, |
| 1123 content::SavePageType save_type) { | 1124 content::SavePageType save_type) { |
| 1124 // Stop the page from navigating. | 1125 // Stop the page from navigating. |
| 1125 Stop(); | 1126 Stop(); |
| 1126 | 1127 |
| 1127 save_package_ = new SavePackage(this, save_type, main_file, dir_path); | 1128 save_package_ = new SavePackage(this, save_type, main_file, dir_path); |
| 1128 return save_package_->Init(); | 1129 return save_package_->Init(); |
| 1129 } | 1130 } |
| 1130 | 1131 |
| 1132 void TabContents::GenerateMHTML( |
| 1133 const FilePath& file, |
| 1134 const base::Callback<void(const FilePath&, int64)>& callback) { |
| 1135 MHTMLGenerationManager::GetInstance()->GenerateMHTML(this, file, callback); |
| 1136 } |
| 1137 |
| 1131 bool TabContents::IsActiveEntry(int32 page_id) { | 1138 bool TabContents::IsActiveEntry(int32 page_id) { |
| 1132 NavigationEntryImpl* active_entry = | 1139 NavigationEntryImpl* active_entry = |
| 1133 NavigationEntryImpl::FromNavigationEntry(controller_.GetActiveEntry()); | 1140 NavigationEntryImpl::FromNavigationEntry(controller_.GetActiveEntry()); |
| 1134 return (active_entry != NULL && | 1141 return (active_entry != NULL && |
| 1135 active_entry->site_instance() == GetSiteInstance() && | 1142 active_entry->site_instance() == GetSiteInstance() && |
| 1136 active_entry->GetPageID() == page_id); | 1143 active_entry->GetPageID() == page_id); |
| 1137 } | 1144 } |
| 1138 | 1145 |
| 1139 const std::string& TabContents::GetContentsMimeType() const { | 1146 const std::string& TabContents::GetContentsMimeType() const { |
| 1140 return contents_mime_type_; | 1147 return contents_mime_type_; |
| (...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2465 save_info, | 2472 save_info, |
| 2466 this); | 2473 this); |
| 2467 } | 2474 } |
| 2468 | 2475 |
| 2469 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2476 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 2470 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2477 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
| 2471 // Can be NULL during tests. | 2478 // Can be NULL during tests. |
| 2472 if (rwh_view) | 2479 if (rwh_view) |
| 2473 rwh_view->SetSize(GetView()->GetContainerSize()); | 2480 rwh_view->SetSize(GetView()->GetContainerSize()); |
| 2474 } | 2481 } |
| OLD | NEW |