OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Implementation of the SafeBrowsingBlockingPage class. | 5 // Implementation of the SafeBrowsingBlockingPage class. |
6 | 6 |
7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" | 7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 namespace { | 63 namespace { |
64 | 64 |
65 enum SafeBrowsingBlockingPageEvent { | 65 enum SafeBrowsingBlockingPageEvent { |
66 SHOW, | 66 SHOW, |
67 PROCEED, | 67 PROCEED, |
68 DONT_PROCEED, | 68 DONT_PROCEED, |
69 }; | 69 }; |
70 | 70 |
71 void RecordSafeBrowsingBlockingPageStats(SafeBrowsingBlockingPageEvent event) { | 71 void RecordSafeBrowsingBlockingPageStats(SafeBrowsingBlockingPageEvent event) { |
72 static LinearHistogram histogram("interstial.safe_browsing", 0, 2, 3); | 72 static scoped_refptr<Histogram> histogram = |
73 histogram.SetFlags(kUmaTargetedHistogramFlag); | 73 LinearHistogram::LinearHistogramFactoryGet("interstial.safe_browsing", |
74 histogram.Add(event); | 74 1, 2, 3); |
| 75 histogram->SetFlags(kUmaTargetedHistogramFlag); |
| 76 histogram->Add(event); |
75 } | 77 } |
76 | 78 |
77 } // namespace | 79 } // namespace |
78 // static | 80 // static |
79 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; | 81 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; |
80 | 82 |
81 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we | 83 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we |
82 // don't leak it. | 84 // don't leak it. |
83 class SafeBrowsingBlockingPageFactoryImpl | 85 class SafeBrowsingBlockingPageFactoryImpl |
84 : public SafeBrowsingBlockingPageFactory { | 86 : public SafeBrowsingBlockingPageFactory { |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); | 498 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); |
497 (*unsafe_resource_map)[tab_contents].push_back(unsafe_resource); | 499 (*unsafe_resource_map)[tab_contents].push_back(unsafe_resource); |
498 } | 500 } |
499 | 501 |
500 // static | 502 // static |
501 bool SafeBrowsingBlockingPage::IsMainPage( | 503 bool SafeBrowsingBlockingPage::IsMainPage( |
502 const UnsafeResourceList& unsafe_resources) { | 504 const UnsafeResourceList& unsafe_resources) { |
503 return unsafe_resources.size() == 1 && | 505 return unsafe_resources.size() == 1 && |
504 unsafe_resources[0].resource_type == ResourceType::MAIN_FRAME; | 506 unsafe_resources[0].resource_type == ResourceType::MAIN_FRAME; |
505 } | 507 } |
OLD | NEW |