| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
| 12 #include "app/resource_bundle.h" | |
| 13 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
| 14 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 15 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 16 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 17 #include "base/values.h" | 16 #include "base/values.h" |
| 18 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/browser_thread.h" | 18 #include "chrome/browser/browser_thread.h" |
| 20 #include "chrome/browser/dom_operation_notification_details.h" | 19 #include "chrome/browser/dom_operation_notification_details.h" |
| 21 #include "chrome/browser/dom_ui/new_tab_ui.h" | 20 #include "chrome/browser/dom_ui/new_tab_ui.h" |
| 22 #include "chrome/browser/google/google_util.h" | 21 #include "chrome/browser/google/google_util.h" |
| 23 #include "chrome/browser/metrics/user_metrics.h" | 22 #include "chrome/browser/metrics/user_metrics.h" |
| 24 #include "chrome/browser/prefs/pref_service.h" | 23 #include "chrome/browser/prefs/pref_service.h" |
| 25 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 26 #include "chrome/browser/safe_browsing/malware_details.h" | 25 #include "chrome/browser/safe_browsing/malware_details.h" |
| 27 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 26 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 28 #include "chrome/browser/tab_contents/navigation_controller.h" | 27 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 29 #include "chrome/browser/tab_contents/navigation_entry.h" | 28 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 30 #include "chrome/browser/tab_contents/tab_util.h" | 29 #include "chrome/browser/tab_contents/tab_util.h" |
| 31 #include "chrome/browser/tab_contents/tab_contents.h" | 30 #include "chrome/browser/tab_contents/tab_contents.h" |
| 32 #include "chrome/common/jstemplate_builder.h" | 31 #include "chrome/common/jstemplate_builder.h" |
| 33 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
| 34 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
| 35 #include "grit/browser_resources.h" | 34 #include "grit/browser_resources.h" |
| 36 #include "grit/generated_resources.h" | 35 #include "grit/generated_resources.h" |
| 37 #include "grit/locale_settings.h" | 36 #include "grit/locale_settings.h" |
| 38 #include "net/base/escape.h" | 37 #include "net/base/escape.h" |
| 38 #include "ui/base/resource/resource_bundle.h" |
| 39 | 39 |
| 40 // For malware interstitial pages, we link the problematic URL to Google's | 40 // For malware interstitial pages, we link the problematic URL to Google's |
| 41 // diagnostic page. | 41 // diagnostic page. |
| 42 #if defined(GOOGLE_CHROME_BUILD) | 42 #if defined(GOOGLE_CHROME_BUILD) |
| 43 static const char* const kSbDiagnosticUrl = | 43 static const char* const kSbDiagnosticUrl = |
| 44 "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=%s&clie
nt=googlechrome"; | 44 "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=%s&clie
nt=googlechrome"; |
| 45 #else | 45 #else |
| 46 static const char* const kSbDiagnosticUrl = | 46 static const char* const kSbDiagnosticUrl = |
| 47 "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=%s&clie
nt=chromium"; | 47 "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=%s&clie
nt=chromium"; |
| 48 #endif | 48 #endif |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); | 669 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); |
| 670 (*unsafe_resource_map)[tab_contents].push_back(unsafe_resource); | 670 (*unsafe_resource_map)[tab_contents].push_back(unsafe_resource); |
| 671 } | 671 } |
| 672 | 672 |
| 673 // static | 673 // static |
| 674 bool SafeBrowsingBlockingPage::IsMainPage( | 674 bool SafeBrowsingBlockingPage::IsMainPage( |
| 675 const UnsafeResourceList& unsafe_resources) { | 675 const UnsafeResourceList& unsafe_resources) { |
| 676 return unsafe_resources.size() == 1 && | 676 return unsafe_resources.size() == 1 && |
| 677 unsafe_resources[0].resource_type == ResourceType::MAIN_FRAME; | 677 unsafe_resources[0].resource_type == ResourceType::MAIN_FRAME; |
| 678 } | 678 } |
| OLD | NEW |