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

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

Issue 9316116: Isolate initiation counts for downloads to their own histograms and improve (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to LKGR. Created 8 years, 10 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
« no previous file with comments | « content/browser/renderer_host/render_message_filter.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 contents_mime_type_ == "text/xml" || 1086 contents_mime_type_ == "text/xml" ||
1087 contents_mime_type_ == "application/xhtml+xml" || 1087 contents_mime_type_ == "application/xhtml+xml" ||
1088 contents_mime_type_ == "text/plain" || 1088 contents_mime_type_ == "text/plain" ||
1089 contents_mime_type_ == "text/css" || 1089 contents_mime_type_ == "text/css" ||
1090 net::IsSupportedJavascriptMimeType(contents_mime_type_.c_str()); 1090 net::IsSupportedJavascriptMimeType(contents_mime_type_.c_str());
1091 } 1091 }
1092 1092
1093 void TabContents::OnSavePage() { 1093 void TabContents::OnSavePage() {
1094 // If we can not save the page, try to download it. 1094 // If we can not save the page, try to download it.
1095 if (!IsSavable()) { 1095 if (!IsSavable()) {
1096 download_stats::RecordDownloadSource(
1097 download_stats::INITIATED_BY_SAVE_PACKAGE_ON_NON_HTML);
1096 SaveURL(GetURL(), GURL(), true); 1098 SaveURL(GetURL(), GURL(), true);
1097 download_stats::RecordDownloadCount(
1098 download_stats::INITIATED_BY_SAVE_PACKAGE_FAILURE_COUNT);
1099 return; 1099 return;
1100 } 1100 }
1101 1101
1102 Stop(); 1102 Stop();
1103 1103
1104 // Create the save package and possibly prompt the user for the name to save 1104 // Create the save package and possibly prompt the user for the name to save
1105 // the page as. The user prompt is an asynchronous operation that runs on 1105 // the page as. The user prompt is an asynchronous operation that runs on
1106 // another thread. 1106 // another thread.
1107 save_package_ = new SavePackage(this); 1107 save_package_ = new SavePackage(this);
1108 save_package_->GetSaveInfo(); 1108 save_package_->GetSaveInfo();
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 1564
1565 void TabContents::OnUpdateZoomLimits(int minimum_percent, 1565 void TabContents::OnUpdateZoomLimits(int minimum_percent,
1566 int maximum_percent, 1566 int maximum_percent,
1567 bool remember) { 1567 bool remember) {
1568 minimum_zoom_percent_ = minimum_percent; 1568 minimum_zoom_percent_ = minimum_percent;
1569 maximum_zoom_percent_ = maximum_percent; 1569 maximum_zoom_percent_ = maximum_percent;
1570 temporary_zoom_settings_ = !remember; 1570 temporary_zoom_settings_ = !remember;
1571 } 1571 }
1572 1572
1573 void TabContents::OnSaveURL(const GURL& url) { 1573 void TabContents::OnSaveURL(const GURL& url) {
1574 download_stats::RecordDownloadSource(
1575 download_stats::INITIATED_BY_PEPPER_SAVE);
1574 // Check if the URL to save matches the URL of the main frame. Since this 1576 // Check if the URL to save matches the URL of the main frame. Since this
1575 // message originates from Pepper plugins, it may not be the case if the 1577 // message originates from Pepper plugins, it may not be the case if the
1576 // plugin is an embedded element. 1578 // plugin is an embedded element.
1577 GURL main_frame_url = GetURL(); 1579 GURL main_frame_url = GetURL();
1578 if (!main_frame_url.is_valid()) 1580 if (!main_frame_url.is_valid())
1579 return; 1581 return;
1580 bool is_main_frame = (url == main_frame_url); 1582 bool is_main_frame = (url == main_frame_url);
1581 SaveURL(url, main_frame_url, is_main_frame); 1583 SaveURL(url, main_frame_url, is_main_frame);
1582 } 1584 }
1583 1585
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
2461 save_info, 2463 save_info,
2462 this); 2464 this);
2463 } 2465 }
2464 2466
2465 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2467 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2466 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); 2468 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh);
2467 // Can be NULL during tests. 2469 // Can be NULL during tests.
2468 if (rwh_view) 2470 if (rwh_view)
2469 rwh_view->SetSize(GetView()->GetContainerSize()); 2471 rwh_view->SetSize(GetView()->GetContainerSize());
2470 } 2472 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_message_filter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698