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

Side by Side Diff: content/browser/tab_contents/tab_contents.cc

Issue 7664019: Move download UMA functions to their own file in content. Also fire the chrome-only notification ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/download/download_util.h"
17 #include "content/browser/browser_context.h" 16 #include "content/browser/browser_context.h"
18 #include "content/browser/child_process_security_policy.h" 17 #include "content/browser/child_process_security_policy.h"
19 #include "content/browser/content_browser_client.h" 18 #include "content/browser/content_browser_client.h"
20 #include "content/browser/debugger/devtools_manager.h" 19 #include "content/browser/debugger/devtools_manager.h"
21 #include "content/browser/download/download_manager.h" 20 #include "content/browser/download/download_manager.h"
21 #include "content/browser/download/download_stats.h"
22 #include "content/browser/host_zoom_map.h" 22 #include "content/browser/host_zoom_map.h"
23 #include "content/browser/in_process_webkit/session_storage_namespace.h" 23 #include "content/browser/in_process_webkit/session_storage_namespace.h"
24 #include "content/browser/load_from_memory_cache_details.h" 24 #include "content/browser/load_from_memory_cache_details.h"
25 #include "content/browser/load_notification_details.h" 25 #include "content/browser/load_notification_details.h"
26 #include "content/browser/renderer_host/render_process_host.h" 26 #include "content/browser/renderer_host/render_process_host.h"
27 #include "content/browser/renderer_host/render_view_host.h" 27 #include "content/browser/renderer_host/render_view_host.h"
28 #include "content/browser/renderer_host/render_widget_host_view.h" 28 #include "content/browser/renderer_host/render_widget_host_view.h"
29 #include "content/browser/renderer_host/resource_dispatcher_host.h" 29 #include "content/browser/renderer_host/resource_dispatcher_host.h"
30 #include "content/browser/renderer_host/resource_request_details.h" 30 #include "content/browser/renderer_host/resource_request_details.h"
31 #include "content/browser/site_instance.h" 31 #include "content/browser/site_instance.h"
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 } 752 }
753 } 753 }
754 754
755 void TabContents::OnSavePage() { 755 void TabContents::OnSavePage() {
756 // If we can not save the page, try to download it. 756 // If we can not save the page, try to download it.
757 if (!SavePackage::IsSavableContents(contents_mime_type())) { 757 if (!SavePackage::IsSavableContents(contents_mime_type())) {
758 DownloadManager* dlm = browser_context()->GetDownloadManager(); 758 DownloadManager* dlm = browser_context()->GetDownloadManager();
759 const GURL& current_page_url = GetURL(); 759 const GURL& current_page_url = GetURL();
760 if (dlm && current_page_url.is_valid()) { 760 if (dlm && current_page_url.is_valid()) {
761 dlm->DownloadUrl(current_page_url, GURL(), "", this); 761 dlm->DownloadUrl(current_page_url, GURL(), "", this);
762 download_util::RecordDownloadCount( 762 download_stats::RecordDownloadCount(
763 download_util::INITIATED_BY_SAVE_PACKAGE_FAILURE_COUNT); 763 download_stats::INITIATED_BY_SAVE_PACKAGE_FAILURE_COUNT);
764 return; 764 return;
765 } 765 }
766 } 766 }
767 767
768 Stop(); 768 Stop();
769 769
770 // Create the save package and possibly prompt the user for the name to save 770 // Create the save package and possibly prompt the user for the name to save
771 // the page as. The user prompt is an asynchronous operation that runs on 771 // the page as. The user prompt is an asynchronous operation that runs on
772 // another thread. 772 // another thread.
773 save_package_ = new SavePackage(this); 773 save_package_ = new SavePackage(this);
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 } 1934 }
1935 1935
1936 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { 1936 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) {
1937 render_manager_.SwapInRenderViewHost(rvh); 1937 render_manager_.SwapInRenderViewHost(rvh);
1938 } 1938 }
1939 1939
1940 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 1940 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
1941 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); 1941 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
1942 rwh_view->SetSize(view()->GetContainerSize()); 1942 rwh_view->SetSize(view()->GetContainerSize());
1943 } 1943 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698