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

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: Restored curlies to original. 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
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 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 contents_mime_type_ == "text/xml" || 1094 contents_mime_type_ == "text/xml" ||
1095 contents_mime_type_ == "application/xhtml+xml" || 1095 contents_mime_type_ == "application/xhtml+xml" ||
1096 contents_mime_type_ == "text/plain" || 1096 contents_mime_type_ == "text/plain" ||
1097 contents_mime_type_ == "text/css" || 1097 contents_mime_type_ == "text/css" ||
1098 net::IsSupportedJavascriptMimeType(contents_mime_type_.c_str()); 1098 net::IsSupportedJavascriptMimeType(contents_mime_type_.c_str());
1099 } 1099 }
1100 1100
1101 void TabContents::OnSavePage() { 1101 void TabContents::OnSavePage() {
1102 // If we can not save the page, try to download it. 1102 // If we can not save the page, try to download it.
1103 if (!IsSavable()) { 1103 if (!IsSavable()) {
1104 download_stats::RecordDownloadSource(
1105 download_stats::INITIATED_BY_SAVE_PACKAGE_ON_NON_HTML);
1104 SaveURL(GetURL(), GURL(), true); 1106 SaveURL(GetURL(), GURL(), true);
1105 download_stats::RecordDownloadCount(
1106 download_stats::INITIATED_BY_SAVE_PACKAGE_FAILURE_COUNT);
1107 return; 1107 return;
1108 } 1108 }
1109 1109
1110 Stop(); 1110 Stop();
1111 1111
1112 // Create the save package and possibly prompt the user for the name to save 1112 // Create the save package and possibly prompt the user for the name to save
1113 // the page as. The user prompt is an asynchronous operation that runs on 1113 // the page as. The user prompt is an asynchronous operation that runs on
1114 // another thread. 1114 // another thread.
1115 save_package_ = new SavePackage(this); 1115 save_package_ = new SavePackage(this);
1116 save_package_->GetSaveInfo(); 1116 save_package_->GetSaveInfo();
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 1574
1575 void TabContents::OnUpdateZoomLimits(int minimum_percent, 1575 void TabContents::OnUpdateZoomLimits(int minimum_percent,
1576 int maximum_percent, 1576 int maximum_percent,
1577 bool remember) { 1577 bool remember) {
1578 minimum_zoom_percent_ = minimum_percent; 1578 minimum_zoom_percent_ = minimum_percent;
1579 maximum_zoom_percent_ = maximum_percent; 1579 maximum_zoom_percent_ = maximum_percent;
1580 temporary_zoom_settings_ = !remember; 1580 temporary_zoom_settings_ = !remember;
1581 } 1581 }
1582 1582
1583 void TabContents::OnSaveURL(const GURL& url) { 1583 void TabContents::OnSaveURL(const GURL& url) {
1584 download_stats::RecordDownloadSource(
1585 download_stats::INITIATED_BY_PEPPER_SAVE);
1584 // Check if the URL to save matches the URL of the main frame. Since this 1586 // Check if the URL to save matches the URL of the main frame. Since this
1585 // message originates from Pepper plugins, it may not be the case if the 1587 // message originates from Pepper plugins, it may not be the case if the
1586 // plugin is an embedded element. 1588 // plugin is an embedded element.
1587 GURL main_frame_url = GetURL(); 1589 GURL main_frame_url = GetURL();
1588 if (!main_frame_url.is_valid()) 1590 if (!main_frame_url.is_valid())
1589 return; 1591 return;
1590 bool is_main_frame = (url == main_frame_url); 1592 bool is_main_frame = (url == main_frame_url);
1591 SaveURL(url, main_frame_url, is_main_frame); 1593 SaveURL(url, main_frame_url, is_main_frame);
1592 } 1594 }
1593 1595
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
2471 save_info, 2473 save_info,
2472 this); 2474 this);
2473 } 2475 }
2474 2476
2475 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2477 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2476 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); 2478 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh);
2477 // Can be NULL during tests. 2479 // Can be NULL during tests.
2478 if (rwh_view) 2480 if (rwh_view)
2479 rwh_view->SetSize(GetView()->GetContainerSize()); 2481 rwh_view->SetSize(GetView()->GetContainerSize());
2480 } 2482 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698