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

Side by Side Diff: chrome/browser/android/history_report/usage_report_util.cc

Issue 1141283003: Upstream oodles of Chrome for Android code into Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final patch? Created 5 years, 7 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
OLDNEW
(Empty)
1
2 // Copyright 2015 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5
6 #include "chrome/browser/android/history_report/usage_report_util.h"
7
8 #include <iomanip>
9 #include <sstream>
10
11 #include "chrome/browser/android/proto/delta_file.pb.h"
12 #include "net/base/net_util.h"
13 #include "url/gurl.h"
14
15 namespace history_report {
16 namespace usage_report_util {
17
18 // Returns a levelDb key for a report. It's a concatenation of timestamp and id
19 // fields of a report.
20 std::string ReportToKey(const history_report::UsageReport& report) {
21 std::stringstream key;
22 key << std::setfill('0') << std::setw(15) << report.timestamp_ms()
23 << report.id();
24 return key.str();
25 }
26
27 bool IsTypedVisit(ui::PageTransition visit_transition) {
28 ui::PageTransition transition_type =
29 ui::PageTransitionStripQualifier(visit_transition);
30 return transition_type == ui::PAGE_TRANSITION_TYPED &&
31 !ui::PageTransitionIsRedirect(visit_transition);
32 }
33
34 bool ShouldIgnoreUrl(const GURL& url) {
35 if (url.spec().empty())
36 return true;
37
38 // Ignore local file URLs.
39 // TODO(nileshagrawal): Maybe we should ignore content:// urls too.
40 if (url.SchemeIsFile())
41 return true;
42
43 // Ignore localhost URLs.
44 if (net::IsLocalhost(url.host()))
45 return true;
46
47 return false;
48 }
49
50 } // namespace usage_report_util
51 } // namespace history_report
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698