| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 static const char* const kLearnMoreCommand = "learnMore"; | 59 static const char* const kLearnMoreCommand = "learnMore"; |
| 60 static const char* const kProceedCommand = "proceed"; | 60 static const char* const kProceedCommand = "proceed"; |
| 61 static const char* const kTakeMeBackCommand = "takeMeBack"; | 61 static const char* const kTakeMeBackCommand = "takeMeBack"; |
| 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 UNUSED_ENUM, |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 void RecordSafeBrowsingBlockingPageStats(SafeBrowsingBlockingPageEvent event) { | 72 void RecordSafeBrowsingBlockingPageStats(SafeBrowsingBlockingPageEvent event) { |
| 72 static scoped_refptr<Histogram> histogram = | 73 UMA_HISTOGRAM_ENUMERATION("interstial.safe_browsing", event, UNUSED_ENUM); |
| 73 LinearHistogram::LinearHistogramFactoryGet("interstial.safe_browsing", | |
| 74 1, 2, 3); | |
| 75 histogram->SetFlags(kUmaTargetedHistogramFlag); | |
| 76 histogram->Add(event); | |
| 77 } | 74 } |
| 78 | 75 |
| 79 } // namespace | 76 } // namespace |
| 80 // static | 77 // static |
| 81 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; | 78 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; |
| 82 | 79 |
| 83 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we | 80 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we |
| 84 // don't leak it. | 81 // don't leak it. |
| 85 class SafeBrowsingBlockingPageFactoryImpl | 82 class SafeBrowsingBlockingPageFactoryImpl |
| 86 : public SafeBrowsingBlockingPageFactory { | 83 : public SafeBrowsingBlockingPageFactory { |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); | 495 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); |
| 499 (*unsafe_resource_map)[tab_contents].push_back(unsafe_resource); | 496 (*unsafe_resource_map)[tab_contents].push_back(unsafe_resource); |
| 500 } | 497 } |
| 501 | 498 |
| 502 // static | 499 // static |
| 503 bool SafeBrowsingBlockingPage::IsMainPage( | 500 bool SafeBrowsingBlockingPage::IsMainPage( |
| 504 const UnsafeResourceList& unsafe_resources) { | 501 const UnsafeResourceList& unsafe_resources) { |
| 505 return unsafe_resources.size() == 1 && | 502 return unsafe_resources.size() == 1 && |
| 506 unsafe_resources[0].resource_type == ResourceType::MAIN_FRAME; | 503 unsafe_resources[0].resource_type == ResourceType::MAIN_FRAME; |
| 507 } | 504 } |
| OLD | NEW |