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

Side by Side Diff: components/dom_distiller/core/viewer.cc

Issue 607013003: add UMA for no. of pages with no distilled data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/dom_distiller/core/viewer.h" 5 #include "components/dom_distiller/core/viewer.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/metrics/histogram.h"
12 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
13 #include "components/dom_distiller/core/distilled_page_prefs.h" 14 #include "components/dom_distiller/core/distilled_page_prefs.h"
14 #include "components/dom_distiller/core/dom_distiller_service.h" 15 #include "components/dom_distiller/core/dom_distiller_service.h"
15 #include "components/dom_distiller/core/proto/distilled_article.pb.h" 16 #include "components/dom_distiller/core/proto/distilled_article.pb.h"
16 #include "components/dom_distiller/core/proto/distilled_page.pb.h" 17 #include "components/dom_distiller/core/proto/distilled_page.pb.h"
17 #include "components/dom_distiller/core/task_tracker.h" 18 #include "components/dom_distiller/core/task_tracker.h"
18 #include "components/dom_distiller/core/url_constants.h" 19 #include "components/dom_distiller/core/url_constants.h"
19 #include "components/dom_distiller/core/url_utils.h" 20 #include "components/dom_distiller/core/url_utils.h"
20 #include "grit/components_resources.h" 21 #include "grit/components_resources.h"
21 #include "grit/components_strings.h" 22 #include "grit/components_strings.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 89 }
89 return kSansSerifCssClass; 90 return kSansSerifCssClass;
90 } 91 }
91 92
92 void EnsureNonEmptyTitleAndContent(std::string* title, std::string* content) { 93 void EnsureNonEmptyTitleAndContent(std::string* title, std::string* content) {
93 if (title->empty()) 94 if (title->empty())
94 *title = l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_NO_DATA_TITLE); 95 *title = l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_NO_DATA_TITLE);
95 if (content->empty()) { 96 if (content->empty()) {
96 *content = l10n_util::GetStringUTF8( 97 *content = l10n_util::GetStringUTF8(
97 IDS_DOM_DISTILLER_VIEWER_NO_DATA_CONTENT); 98 IDS_DOM_DISTILLER_VIEWER_NO_DATA_CONTENT);
99 UMA_HISTOGRAM_COUNTS("DomDistiller.Statistics.NoDistilledDataCount", 1);
nyquist 2014/09/26 21:52:54 It doesn't feel right to do this as a histogram to
kuan 2014/09/26 22:46:55 Done.
98 } 100 }
99 } 101 }
100 102
101 std::string ReplaceHtmlTemplateValues( 103 std::string ReplaceHtmlTemplateValues(
102 const std::string& title, 104 const std::string& title,
103 const std::string& content, 105 const std::string& content,
104 const std::string& loading_indicator_class, 106 const std::string& loading_indicator_class,
105 const std::string& original_url, 107 const std::string& original_url,
106 const DistilledPagePrefs::Theme theme, 108 const DistilledPagePrefs::Theme theme,
107 const DistilledPagePrefs::FontFamily font_family) { 109 const DistilledPagePrefs::FontFamily font_family) {
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 255 }
254 256
255 const std::string GetDistilledPageFontFamilyJs( 257 const std::string GetDistilledPageFontFamilyJs(
256 DistilledPagePrefs::FontFamily font_family) { 258 DistilledPagePrefs::FontFamily font_family) {
257 return "useFontFamily('" + GetJsFontFamily(font_family) + "');"; 259 return "useFontFamily('" + GetJsFontFamily(font_family) + "');";
258 } 260 }
259 261
260 } // namespace viewer 262 } // namespace viewer
261 263
262 } // namespace dom_distiller 264 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698