diff options
author | estark <estark@chromium.org> | 2016-01-11 11:37:12 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-11 19:38:17 +0000 |
commit | d9e54fb05c6c0a2d780d5db406ce2cd47da61ab3 (patch) | |
tree | 573ccd50d3bd81354a84a68702925b21288944b3 | |
parent | f4b29d77d077c54c05f09031aa2ab16d5249809d (diff) | |
download | chromium_src-d9e54fb05c6c0a2d780d5db406ce2cd47da61ab3.zip chromium_src-d9e54fb05c6c0a2d780d5db406ce2cd47da61ab3.tar.gz chromium_src-d9e54fb05c6c0a2d780d5db406ce2cd47da61ab3.tar.bz2 |
Pull SecurityStateModel out into a component
As a component, the SecurityStateModel logic can be reused on iOS, so
that we use consistent logic and definitions to describe a page's
overall security status for UI on all platforms.
BUG=515071
Review URL: https://codereview.chromium.org/1539043002
Cr-Commit-Position: refs/heads/master@{#368636}
81 files changed, 363 insertions, 200 deletions
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index 049ff39..e474623 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn @@ -180,6 +180,7 @@ android_library("chrome_java") { "//components/enhanced_bookmarks:enhanced_bookmarks_java_enums_srcjar", "//components/offline_pages:offline_pages_enums_java", "//components/omnibox/browser:autocomplete_match_type_javagen", + "//components/security_state:security_state_enums_java", ] deps += [ @@ -205,7 +206,6 @@ android_library("chrome_java") { # GYP: //chrome/chrome_browser.gypi:connectivity_check_result_java # GYP: //chrome/chrome_browser.gypi:shortcut_source_java # GYP: //chrome/chrome_browser.gypi:profile_account_management_metrics_java -# GYP: //chrome/chrome_browser.gypi:connection_security_levels_java # GYP: //chrome/chrome_browser.gypi:tab_load_status_java # GYP: //chrome/chrome_browser.gypi:infobar_action_type_java @@ -229,7 +229,6 @@ java_cpp_enum("chrome_android_java_enums_srcjar") { "//chrome/browser/android/shortcut_info.h", "//chrome/browser/android/tab_android.h", "//chrome/browser/profiles/profile_metrics.h", - "//chrome/browser/ssl/security_state_model.h", "//chrome/browser/ui/android/infobars/infobar_android.h", ] } diff --git a/chrome/android/chrome_apk.gyp b/chrome/android/chrome_apk.gyp index a38a52d..9fc4083 100644 --- a/chrome/android/chrome_apk.gyp +++ b/chrome/android/chrome_apk.gyp @@ -293,6 +293,7 @@ '../../components/components.gyp:gcm_driver_java', '../../components/components.gyp:offline_pages_enums_java', '../../components/components.gyp:precache_javatests', + '../../components/components.gyp:security_state_enums_java', '../../components/components.gyp:web_contents_delegate_android_java', '../../content/content_shell_and_tests.gyp:content_java_test_support', '../../net/net.gyp:net_java', diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabObserver.java index 38c1f55..b303b12 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabObserver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabObserver.java @@ -10,10 +10,10 @@ import android.os.SystemClock; import android.support.customtabs.CustomTabsCallback; import org.chromium.base.metrics.RecordHistogram; -import org.chromium.chrome.browser.ssl.ConnectionSecurityLevel; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabObserver; +import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.content_public.browser.LoadUrlParams; import java.util.concurrent.TimeUnit; @@ -114,4 +114,4 @@ class CustomTabObserver extends EmptyTabObserver { mCurrentState = STATE_RESET; mIntentReceivedTimestamp = -1; } -}
\ No newline at end of file +} diff --git a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java index ae69976..36055b9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java @@ -47,7 +47,6 @@ import org.chromium.chrome.browser.preferences.PrefServiceBridge; import org.chromium.chrome.browser.preferences.datareduction.DataReductionPreferences; import org.chromium.chrome.browser.preferences.datareduction.DataReductionPromoScreen; import org.chromium.chrome.browser.signin.SigninPromoScreen; -import org.chromium.chrome.browser.ssl.ConnectionSecurityLevel; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabUma.TabCreationState; @@ -66,6 +65,7 @@ import org.chromium.chrome.browser.util.FeatureUtilities; import org.chromium.chrome.browser.util.IntentUtils; import org.chromium.chrome.browser.util.UrlUtilities; import org.chromium.chrome.browser.widget.findinpage.FindToolbarManager; +import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.components.service_tab_launcher.ServiceTabLauncher; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.content_public.browser.NavigationEntry; diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java index 1de1717..33b0a66 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java @@ -80,7 +80,6 @@ import org.chromium.chrome.browser.pageinfo.WebsiteSettingsPopup; import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.search_engines.TemplateUrlService; -import org.chromium.chrome.browser.ssl.ConnectionSecurityLevel; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.toolbar.ActionModeController; import org.chromium.chrome.browser.toolbar.ActionModeController.ActionBarDelegate; @@ -92,6 +91,7 @@ import org.chromium.chrome.browser.util.FeatureUtilities; import org.chromium.chrome.browser.util.KeyNavigationUtil; import org.chromium.chrome.browser.util.ViewUtils; import org.chromium.chrome.browser.widget.TintedImageButton; +import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.content.browser.ContentViewCore; import org.chromium.content.browser.accessibility.BrowserAccessibilityManager; import org.chromium.content_public.browser.LoadUrlParams; diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizer.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizer.java index 054ae43..986ea13 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizer.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizer.java @@ -13,7 +13,7 @@ import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.VisibleForTesting; import org.chromium.chrome.R; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.browser.ssl.ConnectionSecurityLevel; +import org.chromium.components.security_state.ConnectionSecurityLevel; import java.util.Locale; diff --git a/chrome/android/java/src/org/chromium/chrome/browser/pageinfo/WebsiteSettingsPopup.java b/chrome/android/java/src/org/chromium/chrome/browser/pageinfo/WebsiteSettingsPopup.java index 1e1dfd9..5cc1c75 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/pageinfo/WebsiteSettingsPopup.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/pageinfo/WebsiteSettingsPopup.java @@ -52,9 +52,9 @@ import org.chromium.chrome.browser.preferences.website.ContentSetting; import org.chromium.chrome.browser.preferences.website.ContentSettingsResources; import org.chromium.chrome.browser.preferences.website.SingleWebsitePreferences; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.browser.ssl.ConnectionSecurityLevel; import org.chromium.chrome.browser.ssl.SecurityStateModel; import org.chromium.chrome.browser.util.UrlUtilities; +import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.content.browser.ContentViewCore; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContentsObserver; diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ssl/SecurityStateModel.java b/chrome/android/java/src/org/chromium/chrome/browser/ssl/SecurityStateModel.java index 41ce8fc..b65137e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ssl/SecurityStateModel.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ssl/SecurityStateModel.java @@ -4,6 +4,7 @@ package org.chromium.chrome.browser.ssl; +import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.content_public.browser.WebContents; /** diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java index 93bcd93..6780660 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java @@ -65,7 +65,6 @@ import org.chromium.chrome.browser.rlz.RevenueStats; import org.chromium.chrome.browser.search_engines.TemplateUrlService; import org.chromium.chrome.browser.snackbar.LoFiBarPopupController; import org.chromium.chrome.browser.snackbar.SnackbarManager; -import org.chromium.chrome.browser.ssl.ConnectionSecurityLevel; import org.chromium.chrome.browser.ssl.SecurityStateModel; import org.chromium.chrome.browser.tab.TabUma.TabCreationState; import org.chromium.chrome.browser.tabmodel.SingleTabModelSelector; @@ -75,6 +74,7 @@ import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.chrome.browser.tabmodel.TabModelImpl; import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils; import org.chromium.components.navigation_interception.InterceptNavigationDelegate; +import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.content.browser.ActivityContentVideoViewClient; import org.chromium.content.browser.ContentVideoViewClient; import org.chromium.content.browser.ContentView; diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabWebContentsObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabWebContentsObserver.java index 5865b09..6161445 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabWebContentsObserver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabWebContentsObserver.java @@ -22,7 +22,7 @@ import org.chromium.chrome.browser.metrics.UmaSessionStats; import org.chromium.chrome.browser.metrics.UmaUtils; import org.chromium.chrome.browser.policy.PolicyAuditor; import org.chromium.chrome.browser.policy.PolicyAuditor.AuditEvent; -import org.chromium.chrome.browser.ssl.ConnectionSecurityLevel; +import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContentsObserver; import org.chromium.ui.base.DeviceFormFactor; @@ -343,4 +343,4 @@ public class TabWebContentsObserver extends WebContentsObserver { private static boolean isThemeColorEnabled(Context context) { return !DeviceFormFactor.isTablet(context); } -}
\ No newline at end of file +} diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TopControlsVisibilityDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TopControlsVisibilityDelegate.java index ac0dcdd..471174d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TopControlsVisibilityDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TopControlsVisibilityDelegate.java @@ -6,8 +6,8 @@ package org.chromium.chrome.browser.tab; import org.chromium.chrome.browser.UrlConstants; import org.chromium.chrome.browser.device.DeviceClassManager; -import org.chromium.chrome.browser.ssl.ConnectionSecurityLevel; import org.chromium.chrome.browser.util.AccessibilityUtil; +import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.content.browser.ContentViewCore; import org.chromium.content_public.browser.WebContents; diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java index c4f65d3..0ff5973 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java @@ -37,13 +37,13 @@ import org.chromium.chrome.browser.omnibox.UrlBar; import org.chromium.chrome.browser.omnibox.UrlFocusChangeListener; import org.chromium.chrome.browser.pageinfo.WebsiteSettingsPopup; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.browser.ssl.ConnectionSecurityLevel; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.toolbar.ActionModeController.ActionBarDelegate; import org.chromium.chrome.browser.util.ColorUtils; import org.chromium.chrome.browser.widget.TintedDrawable; import org.chromium.components.dom_distiller.core.DomDistillerService; import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils; +import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.ui.base.WindowAndroid; /** diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java index 06e58a9..7edd53d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java @@ -31,7 +31,6 @@ import org.chromium.chrome.browser.TabState; import org.chromium.chrome.browser.document.DocumentUtils; import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager; import org.chromium.chrome.browser.metrics.WebappUma; -import org.chromium.chrome.browser.ssl.ConnectionSecurityLevel; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabDelegateFactory; @@ -39,6 +38,7 @@ import org.chromium.chrome.browser.tab.TabObserver; import org.chromium.chrome.browser.tab.TopControlsVisibilityDelegate; import org.chromium.chrome.browser.util.ColorUtils; import org.chromium.chrome.browser.util.UrlUtilities; +import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.content.browser.ScreenOrientationProvider; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.net.NetworkChangeNotifier; diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java index 5d4e037..e2475d9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java @@ -9,13 +9,13 @@ import android.test.suitebuilder.annotation.SmallTest; import org.chromium.base.ThreadUtils; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.ssl.ConnectionSecurityLevel; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabObserver; import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.chrome.test.ChromeActivityTestCaseBase; import org.chromium.chrome.test.util.ApplicationTestUtils; +import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.content.browser.test.util.CallbackHelper; import org.chromium.content.browser.test.util.Criteria; import org.chromium.content.browser.test.util.CriteriaHelper; diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizerTest.java index a6efab1..92b1761 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizerTest.java @@ -19,7 +19,7 @@ import org.chromium.chrome.browser.omnibox.OmniboxUrlEmphasizer.UrlEmphasisColor import org.chromium.chrome.browser.omnibox.OmniboxUrlEmphasizer.UrlEmphasisSecurityErrorSpan; import org.chromium.chrome.browser.omnibox.OmniboxUrlEmphasizer.UrlEmphasisSpan; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.browser.ssl.ConnectionSecurityLevel; +import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.content.browser.test.NativeLibraryTestBase; /** diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappUrlBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappUrlBarTest.java index 3c0b6ff..06d8b75 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappUrlBarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappUrlBarTest.java @@ -10,7 +10,7 @@ import android.test.suitebuilder.annotation.MediumTest; import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.ShortcutHelper; import org.chromium.chrome.browser.ShortcutSource; -import org.chromium.chrome.browser.ssl.ConnectionSecurityLevel; +import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.content_public.common.ScreenOrientationValues; /** diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappVisibilityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappVisibilityTest.java index 6527cf2..3b41bb1 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappVisibilityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappVisibilityTest.java @@ -9,7 +9,7 @@ import android.test.suitebuilder.annotation.MediumTest; import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.ShortcutHelper; import org.chromium.chrome.browser.ShortcutSource; -import org.chromium.chrome.browser.ssl.ConnectionSecurityLevel; +import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.content_public.common.ScreenOrientationValues; /** diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 427c725..da52cb6 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn @@ -159,6 +159,7 @@ source_set("browser") { "//components/search_engines", "//components/search_provider_logos", "//components/security_interstitials/core", + "//components/security_state", "//components/signin/core/browser", "//components/ssl_errors", "//components/startup_metric_utils/browser:lib", diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index e8090dd..775d53e 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -94,6 +94,7 @@ include_rules = [ "+components/search_engines", "+components/search_provider_logos", "+components/security_interstitials", + "+components/security_state", "+components/service_tab_launcher", "+components/session_manager", "+components/sessions", diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 0705997..d62fb72 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -48,6 +48,7 @@ #include "components/password_manager/core/common/password_manager_switches.h" #include "components/proximity_auth/switches.h" #include "components/search/search_switches.h" +#include "components/security_state/switches.h" #include "components/signin/core/common/signin_switches.h" #include "components/sync_driver/sync_driver_switches.h" #include "components/tracing/tracing_switches.h" @@ -178,12 +179,12 @@ const FeatureEntry::Choice kNaClDebugMaskChoices[] = { #endif const FeatureEntry::Choice kMarkNonSecureAsChoices[] = { - { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, - { IDS_MARK_NON_SECURE_AS_NEUTRAL, - switches::kMarkNonSecureAs, switches::kMarkNonSecureAsNeutral}, - { IDS_MARK_NON_SECURE_AS_NON_SECURE, - switches::kMarkNonSecureAs, switches::kMarkNonSecureAsNonSecure} -}; + {IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""}, + {IDS_MARK_NON_SECURE_AS_NEUTRAL, security_state::switches::kMarkNonSecureAs, + security_state::switches::kMarkNonSecureAsNeutral}, + {IDS_MARK_NON_SECURE_AS_NON_SECURE, + security_state::switches::kMarkNonSecureAs, + security_state::switches::kMarkNonSecureAsNonSecure}}; const FeatureEntry::Choice kDataReductionProxyLoFiChoices[] = { { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, diff --git a/chrome/browser/chromeos/login/ui/simple_web_view_dialog.cc b/chrome/browser/chromeos/login/ui/simple_web_view_dialog.cc index 0018845..8276902 100644 --- a/chrome/browser/chromeos/login/ui/simple_web_view_dialog.cc +++ b/chrome/browser/chromeos/login/ui/simple_web_view_dialog.cc @@ -16,7 +16,6 @@ #include "chrome/browser/password_manager/chrome_password_manager_client.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ssl/chrome_security_state_model_client.h" -#include "chrome/browser/ssl/security_state_model.h" #include "chrome/browser/ui/autofill/chrome_autofill_client.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/content_settings/content_setting_bubble_model_delegate.h" @@ -26,6 +25,7 @@ #include "chrome/grit/generated_resources.h" #include "chrome/grit/theme_resources.h" #include "components/password_manager/core/browser/password_manager.h" +#include "components/security_state/security_state_model.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" @@ -306,7 +306,7 @@ SimpleWebViewDialog::GetContentSettingBubbleModelDelegate() { void SimpleWebViewDialog::ShowWebsiteSettings( content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info) { + const security_state::SecurityStateModel::SecurityInfo& security_info) { NOTIMPLEMENTED(); // TODO (markusheintz@): implement this } diff --git a/chrome/browser/chromeos/login/ui/simple_web_view_dialog.h b/chrome/browser/chromeos/login/ui/simple_web_view_dialog.h index 1c704b6..17867f0 100644 --- a/chrome/browser/chromeos/login/ui/simple_web_view_dialog.h +++ b/chrome/browser/chromeos/login/ui/simple_web_view_dialog.h @@ -9,9 +9,9 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "chrome/browser/command_updater_delegate.h" -#include "chrome/browser/ssl/security_state_model.h" #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" +#include "components/security_state/security_state_model.h" #include "content/public/browser/page_navigator.h" #include "content/public/browser/web_contents_delegate.h" #include "ui/views/controls/button/image_button.h" @@ -87,7 +87,8 @@ class SimpleWebViewDialog : public views::ButtonListener, void ShowWebsiteSettings( content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info) override; + const security_state::SecurityStateModel::SecurityInfo& security_info) + override; // Implements ToolbarModelDelegate: content::WebContents* GetActiveWebContents() const override; diff --git a/chrome/browser/ssl/chrome_security_state_model_client.cc b/chrome/browser/ssl/chrome_security_state_model_client.cc index c0cbc45..412b89f 100644 --- a/chrome/browser/ssl/chrome_security_state_model_client.cc +++ b/chrome/browser/ssl/chrome_security_state_model_client.cc @@ -20,6 +20,8 @@ DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromeSecurityStateModelClient); +using security_state::SecurityStateModel; + namespace { // Converts a content::SecurityStyle (an indicator of a request's diff --git a/chrome/browser/ssl/chrome_security_state_model_client.h b/chrome/browser/ssl/chrome_security_state_model_client.h index 6e87cfb..6c76403 100644 --- a/chrome/browser/ssl/chrome_security_state_model_client.h +++ b/chrome/browser/ssl/chrome_security_state_model_client.h @@ -6,8 +6,8 @@ #define CHROME_BROWSER_SSL_CHROME_SECURITY_STATE_MODEL_CLIENT_H_ #include "base/macros.h" -#include "chrome/browser/ssl/security_state_model.h" -#include "chrome/browser/ssl/security_state_model_client.h" +#include "components/security_state/security_state_model.h" +#include "components/security_state/security_state_model_client.h" #include "content/public/browser/web_contents_user_data.h" namespace content { @@ -17,16 +17,17 @@ class WebContents; // Uses a WebContents to provide a SecurityStateModel with the // information that it needs to determine the page's security status. class ChromeSecurityStateModelClient - : public SecurityStateModelClient, + : public security_state::SecurityStateModelClient, public content::WebContentsUserData<ChromeSecurityStateModelClient> { public: ~ChromeSecurityStateModelClient() override; - const SecurityStateModel::SecurityInfo& GetSecurityInfo() const; + const security_state::SecurityStateModel::SecurityInfo& GetSecurityInfo() + const; // SecurityStateModelClient: void GetVisibleSecurityState( - SecurityStateModel::VisibleSecurityState* state) override; + security_state::SecurityStateModel::VisibleSecurityState* state) override; bool RetrieveCert(scoped_refptr<net::X509Certificate>* cert) override; bool UsedPolicyInstalledCertificate() override; bool IsOriginSecure(const GURL& url) override; @@ -36,7 +37,7 @@ class ChromeSecurityStateModelClient friend class content::WebContentsUserData<ChromeSecurityStateModelClient>; content::WebContents* web_contents_; - scoped_ptr<SecurityStateModel> security_state_model_; + scoped_ptr<security_state::SecurityStateModel> security_state_model_; DISALLOW_COPY_AND_ASSIGN(ChromeSecurityStateModelClient); }; diff --git a/chrome/browser/ssl/security_state_model_browser_tests.cc b/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc index db228c4..4c712e6 100644 --- a/chrome/browser/ssl/security_state_model_browser_tests.cc +++ b/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ssl/security_state_model.h" +#include "chrome/browser/ssl/chrome_security_state_model_client.h" #include "base/command_line.h" #include "base/files/file_path.h" @@ -38,6 +38,8 @@ #include "net/test/url_request/url_request_failed_job.h" #include "net/url_request/url_request_filter.h" +using security_state::SecurityStateModel; + namespace { const base::FilePath::CharType kDocRoot[] = @@ -90,9 +92,9 @@ void CheckSecurityInfoForNonSecure(content::WebContents* contents) { EXPECT_EQ(0, security_info.cert_id); } -class SecurityStateModelTest : public CertVerifierBrowserTest { +class ChromeSecurityStateModelClientTest : public CertVerifierBrowserTest { public: - SecurityStateModelTest() + ChromeSecurityStateModelClientTest() : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) { https_server_.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot)); } @@ -141,10 +143,10 @@ class SecurityStateModelTest : public CertVerifierBrowserTest { net::EmbeddedTestServer https_server_; private: - DISALLOW_COPY_AND_ASSIGN(SecurityStateModelTest); + DISALLOW_COPY_AND_ASSIGN(ChromeSecurityStateModelClientTest); }; -IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, HttpPage) { +IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, HttpPage) { ASSERT_TRUE(embedded_test_server()->Start()); ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL("/ssl/google.html")); @@ -170,7 +172,7 @@ IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, HttpPage) { EXPECT_EQ(0, security_info.connection_status); } -IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, HttpsPage) { +IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, HttpsPage) { ASSERT_TRUE(https_server_.Start()); SetUpMockCertVerifierForHttpsServer(0, net::OK); @@ -183,7 +185,7 @@ IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, HttpsPage) { false /* expect cert status error */); } -IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, SHA1Broken) { +IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, SHA1Broken) { ASSERT_TRUE(https_server_.Start()); // The test server uses a long-lived cert by default, so a SHA1 // signature in it will register as a "broken" condition rather than @@ -201,7 +203,7 @@ IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, SHA1Broken) { false /* expect cert status error */); } -IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, MixedContent) { +IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, MixedContent) { ASSERT_TRUE(embedded_test_server()->Start()); ASSERT_TRUE(https_server_.Start()); SetUpMockCertVerifierForHttpsServer(0, net::OK); @@ -290,7 +292,8 @@ IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, MixedContent) { } // Same as the test above but with a long-lived SHA1 cert. -IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, MixedContentWithBrokenSHA1) { +IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, + MixedContentWithBrokenSHA1) { ASSERT_TRUE(embedded_test_server()->Start()); ASSERT_TRUE(https_server_.Start()); // The test server uses a long-lived cert by default, so a SHA1 @@ -365,7 +368,7 @@ IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, MixedContentWithBrokenSHA1) { false /* expect cert status error */); } -IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, BrokenHTTPS) { +IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, BrokenHTTPS) { ASSERT_TRUE(embedded_test_server()->Start()); ASSERT_TRUE(https_server_.Start()); SetUpMockCertVerifierForHttpsServer(net::CERT_STATUS_DATE_INVALID, @@ -431,9 +434,10 @@ void InstallLoadingInterceptor(const std::string& host) { scoped_ptr<net::URLRequestInterceptor>(new PendingJobInterceptor())); } -class SecurityStateModelLoadingTest : public SecurityStateModelTest { +class SecurityStateModelLoadingTest + : public ChromeSecurityStateModelClientTest { public: - SecurityStateModelLoadingTest() : SecurityStateModelTest() {} + SecurityStateModelLoadingTest() : ChromeSecurityStateModelClientTest() {} ~SecurityStateModelLoadingTest() override{}; protected: @@ -475,7 +479,7 @@ IN_PROC_BROWSER_TEST_F(SecurityStateModelLoadingTest, NavigationStateChanges) { // Tests that the SecurityStateModel for a WebContents is up-to-date // when the WebContents is inserted into a Browser's TabStripModel. -IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, AddedTab) { +IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, AddedTab) { ASSERT_TRUE(https_server_.Start()); SetUpMockCertVerifierForHttpsServer(0, net::OK); diff --git a/chrome/browser/ssl/security_state_model_android.cc b/chrome/browser/ssl/security_state_model_android.cc index b175664..c7eea43 100644 --- a/chrome/browser/ssl/security_state_model_android.cc +++ b/chrome/browser/ssl/security_state_model_android.cc @@ -41,7 +41,7 @@ jboolean IsDeprecatedSHA1Present(JNIEnv* env, ChromeSecurityStateModelClient::FromWebContents(web_contents); DCHECK(model_client); return model_client->GetSecurityInfo().sha1_deprecation_status != - SecurityStateModel::NO_DEPRECATED_SHA1; + security_state::SecurityStateModel::NO_DEPRECATED_SHA1; } // static @@ -57,7 +57,8 @@ jboolean IsPassiveMixedContentPresent( ChromeSecurityStateModelClient::FromWebContents(web_contents); DCHECK(model_client); return model_client->GetSecurityInfo().mixed_content_status == - SecurityStateModel::DISPLAYED_MIXED_CONTENT || + security_state::SecurityStateModel::DISPLAYED_MIXED_CONTENT || model_client->GetSecurityInfo().mixed_content_status == - SecurityStateModel::RAN_AND_DISPLAYED_MIXED_CONTENT; + security_state::SecurityStateModel:: + RAN_AND_DISPLAYED_MIXED_CONTENT; } diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index 3966bd4..20b8c8b 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -36,7 +36,6 @@ #include "chrome/browser/ssl/chrome_security_state_model_client.h" #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" #include "chrome/browser/ssl/common_name_mismatch_handler.h" -#include "chrome/browser/ssl/security_state_model.h" #include "chrome/browser/ssl/ssl_blocking_page.h" #include "chrome/browser/ssl/ssl_error_handler.h" #include "chrome/browser/ui/browser.h" @@ -53,6 +52,8 @@ #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/security_interstitials/core/controller_client.h" #include "components/security_interstitials/core/metrics_helper.h" +#include "components/security_state/security_state_model.h" +#include "components/security_state/switches.h" #include "components/ssl_errors/error_classification.h" #include "components/variations/variations_associated_data.h" #include "components/web_modal/web_contents_modal_dialog_manager.h" @@ -1122,7 +1123,8 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndGoForward) { IN_PROC_BROWSER_TEST_F(SSLUITest, TestMarkNonSecureAs) { scoped_refptr<base::FieldTrial> trial = base::FieldTrialList::CreateFieldTrial( - "MarkNonSecureAs", switches::kMarkNonSecureAsNonSecure); + "MarkNonSecureAs", + security_state::switches::kMarkNonSecureAsNonSecure); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1133,21 +1135,21 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestMarkNonSecureAs) { ASSERT_TRUE(model_client); ui_test_utils::NavigateToURL(browser(), GURL("file:/")); - EXPECT_EQ(SecurityStateModel::NONE, + EXPECT_EQ(security_state::SecurityStateModel::NONE, model_client->GetSecurityInfo().security_level); ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); - EXPECT_EQ(SecurityStateModel::NONE, + EXPECT_EQ(security_state::SecurityStateModel::NONE, model_client->GetSecurityInfo().security_level); ui_test_utils::NavigateToURL(browser(), GURL("data:text/plain,hello")); - EXPECT_EQ(SecurityStateModel::NONE, + EXPECT_EQ(security_state::SecurityStateModel::NONE, model_client->GetSecurityInfo().security_level); ui_test_utils::NavigateToURL( browser(), GURL("blob:chrome%3A//newtab/49a463bb-fac8-476c-97bf-5d7076c3ea1a")); - EXPECT_EQ(SecurityStateModel::NONE, + EXPECT_EQ(security_state::SecurityStateModel::NONE, model_client->GetSecurityInfo().security_level); } diff --git a/chrome/browser/ui/android/bluetooth_chooser_android.cc b/chrome/browser/ui/android/bluetooth_chooser_android.cc index ddf70f1..04449ae 100644 --- a/chrome/browser/ui/android/bluetooth_chooser_android.cc +++ b/chrome/browser/ui/android/bluetooth_chooser_android.cc @@ -8,7 +8,6 @@ #include "base/android/jni_string.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/ssl/chrome_security_state_model_client.h" -#include "chrome/browser/ssl/security_state_model.h" #include "chrome/browser/ui/android/view_android_helper.h" #include "content/public/browser/android/content_view_core.h" #include "jni/BluetoothChooserDialog_jni.h" diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 60f241c..491252d 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -77,7 +77,6 @@ #include "chrome/browser/sessions/session_tab_helper.h" #include "chrome/browser/sessions/tab_restore_service_factory.h" #include "chrome/browser/ssl/chrome_security_state_model_client.h" -#include "chrome/browser/ssl/security_state_model.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/sync/sync_ui_util.h" #include "chrome/browser/tab_contents/retargeting_details.h" @@ -167,6 +166,7 @@ #include "components/favicon/content/content_favicon_driver.h" #include "components/history/core/browser/top_sites.h" #include "components/search/search.h" +#include "components/security_state/security_state_model.h" #include "components/sessions/core/session_types.h" #include "components/sessions/core/tab_restore_service.h" #include "components/startup_metric_utils/browser/startup_metric_utils.h" @@ -243,6 +243,7 @@ using content::RenderWidgetHostView; using content::SiteInstance; using content::WebContents; using extensions::Extension; +using security_state::SecurityStateModel; using ui::WebDialogDelegate; using web_modal::WebContentsModalDialogManager; using blink::WebWindowFeatures; diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index b04e6c5..2bb48ce 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -38,7 +38,6 @@ #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/search/search.h" #include "chrome/browser/sessions/session_service_factory.h" -#include "chrome/browser/ssl/security_state_model.h" #include "chrome/browser/translate/chrome_translate_client.h" #include "chrome/browser/translate/cld_data_harness.h" #include "chrome/browser/translate/cld_data_harness_factory.h" diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc index d169f7c..3c03397 100644 --- a/chrome/browser/ui/browser_commands.cc +++ b/chrome/browser/ui/browser_commands.cc @@ -882,7 +882,7 @@ void ShowWebsiteSettings( Browser* browser, content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info) { + const security_state::SecurityStateModel::SecurityInfo& security_info) { browser->window()->ShowWebsiteSettings( Profile::FromBrowserContext(web_contents->GetBrowserContext()), web_contents, url, security_info); diff --git a/chrome/browser/ui/browser_commands.h b/chrome/browser/ui/browser_commands.h index 262fc92..81f30e5 100644 --- a/chrome/browser/ui/browser_commands.h +++ b/chrome/browser/ui/browser_commands.h @@ -9,9 +9,9 @@ #include "build/build_config.h" #include "chrome/browser/devtools/devtools_toggle_action.h" -#include "chrome/browser/ssl/security_state_model.h" #include "chrome/browser/ui/host_desktop.h" #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" +#include "components/security_state/security_state_model.h" #include "content/public/common/page_zoom.h" #include "ui/base/window_open_disposition.h" @@ -109,10 +109,11 @@ void TogglePagePinnedToStartScreen(Browser* browser); void SavePage(Browser* browser); bool CanSavePage(const Browser* browser); void ShowFindBar(Browser* browser); -void ShowWebsiteSettings(Browser* browser, - content::WebContents* web_contents, - const GURL& url, - const SecurityStateModel::SecurityInfo& security_info); +void ShowWebsiteSettings( + Browser* browser, + content::WebContents* web_contents, + const GURL& url, + const security_state::SecurityStateModel::SecurityInfo& security_info); void Print(Browser* browser); bool CanPrint(Browser* browser); #if defined(ENABLE_BASIC_PRINTING) diff --git a/chrome/browser/ui/browser_dialogs.h b/chrome/browser/ui/browser_dialogs.h index 8288ff7..ddb7bc0 100644 --- a/chrome/browser/ui/browser_dialogs.h +++ b/chrome/browser/ui/browser_dialogs.h @@ -7,8 +7,8 @@ #include "base/callback.h" #include "build/build_config.h" -#include "chrome/browser/ssl/security_state_model.h" #include "chrome/browser/ui/bookmarks/bookmark_editor.h" +#include "components/security_state/security_state_model.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/gfx/native_widget_types.h" @@ -90,7 +90,7 @@ void ShowWebsiteSettingsBubbleViewsAtPoint( Profile* profile, content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info); + const security_state::SecurityStateModel::SecurityInfo& security_info); // Show a Views bookmark bubble at the given point. This occurs when the // bookmark star is clicked or "Bookmark This Page..." is selected from a menu diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h index 23a1dcf..9b91bc2 100644 --- a/chrome/browser/ui/browser_window.h +++ b/chrome/browser/ui/browser_window.h @@ -9,7 +9,6 @@ #include "build/build_config.h" #include "chrome/browser/lifetime/browser_close_manager.h" #include "chrome/browser/signin/chrome_signin_helper.h" -#include "chrome/browser/ssl/security_state_model.h" #include "chrome/browser/translate/chrome_translate_client.h" #include "chrome/browser/ui/bookmarks/bookmark_bar.h" #include "chrome/browser/ui/browser.h" @@ -17,6 +16,7 @@ #include "chrome/browser/ui/host_desktop.h" #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" #include "components/content_settings/core/common/content_settings_types.h" +#include "components/security_state/security_state_model.h" #include "components/signin/core/browser/signin_header_helper.h" #include "components/translate/core/common/translate_errors.h" #include "ui/base/base_window.h" @@ -311,7 +311,8 @@ class BrowserWindow : public ui::BaseWindow { Profile* profile, content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info) = 0; + const security_state::SecurityStateModel::SecurityInfo& + security_info) = 0; // Shows the app menu (for accessibility). virtual void ShowAppMenu() = 0; diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.h b/chrome/browser/ui/cocoa/browser_window_cocoa.h index 214e45d..4d9d9d2 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.h +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.h @@ -9,12 +9,12 @@ #include "base/memory/weak_ptr.h" #include "chrome/browser/extensions/extension_keybinding_registry.h" #include "chrome/browser/signin/chrome_signin_helper.h" -#include "chrome/browser/ssl/security_state_model.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" #include "chrome/browser/ui/search/search_model_observer.h" #include "chrome/browser/ui/tabs/tab_utils.h" #include "components/bookmarks/browser/bookmark_model.h" +#include "components/security_state/security_state_model.h" #include "ui/base/ui_base_types.h" class Browser; @@ -145,7 +145,8 @@ class BrowserWindowCocoa Profile* profile, content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info) override; + const security_state::SecurityStateModel::SecurityInfo& security_info) + override; void ShowAppMenu() override; bool PreHandleKeyboardEvent(const content::NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) override; diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm index 8dcd442..64b2829 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm @@ -735,7 +735,7 @@ void BrowserWindowCocoa::ShowWebsiteSettings( Profile* profile, content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info) { + const security_state::SecurityStateModel::SecurityInfo& security_info) { WebsiteSettingsUIBridge::Show(window(), profile, web_contents, url, security_info); } diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm index d4a10a9..5fccba5 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm @@ -450,7 +450,7 @@ void LocationBarViewMac::Layout() { selected_keyword_decoration_->SetKeyword(short_name, is_extension_keyword); selected_keyword_decoration_->SetImage(GetKeywordImage(keyword)); } else if (chrome_toolbar_model->GetSecurityLevel(false) == - SecurityStateModel::EV_SECURE) { + security_state::SecurityStateModel::EV_SECURE) { // Switch from location icon to show the EV bubble instead. location_icon_decoration_->SetVisible(false); ev_bubble_decoration_->SetVisible(true); diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm index 5a5f507..8c219df 100644 --- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm @@ -544,23 +544,26 @@ void OmniboxViewMac::ApplyTextAttributes( // TODO(shess): GTK has this as a member var, figure out why. // [Could it be to not change if no change? If so, I'm guessing // AppKit may already handle that.] - const SecurityStateModel::SecurityLevel security_level = + const security_state::SecurityStateModel::SecurityLevel security_level = chrome_toolbar_model->GetSecurityLevel(false); // Emphasize the scheme for security UI display purposes (if necessary). if (!model()->user_input_in_progress() && model()->CurrentTextIsURL() && - scheme.is_nonempty() && (security_level != SecurityStateModel::NONE)) { + scheme.is_nonempty() && + (security_level != security_state::SecurityStateModel::NONE)) { NSColor* color; - if (security_level == SecurityStateModel::EV_SECURE || - security_level == SecurityStateModel::SECURE) { + if (security_level == security_state::SecurityStateModel::EV_SECURE || + security_level == security_state::SecurityStateModel::SECURE) { color = SecureSchemeColor(); - } else if (security_level == SecurityStateModel::SECURITY_ERROR) { + } else if (security_level == + security_state::SecurityStateModel::SECURITY_ERROR) { color = SecurityErrorSchemeColor(); // Add a strikethrough through the scheme. [attributedString addAttribute:NSStrikethroughStyleAttributeName value:[NSNumber numberWithInt:NSUnderlineStyleSingle] range:ComponentToNSRange(scheme)]; - } else if (security_level == SecurityStateModel::SECURITY_WARNING) { + } else if (security_level == + security_state::SecurityStateModel::SECURITY_WARNING) { color = BaseTextColor(); } else { NOTREACHED(); diff --git a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.h b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.h index 2d4f196..3209d35 100644 --- a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.h +++ b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.h @@ -7,9 +7,9 @@ #include "base/mac/scoped_nsobject.h" #include "base/macros.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/ssl/security_state_model.h" #import "chrome/browser/ui/cocoa/base_bubble_controller.h" #include "chrome/browser/ui/website_settings/website_settings_ui.h" +#include "components/security_state/security_state_model.h" #include "content/public/browser/web_contents_observer.h" class WebsiteSettingsUIBridge; @@ -112,13 +112,15 @@ class WebsiteSettingsUIBridge : public content::WebContentsObserver, // is the currently active window. |profile| points to the currently active // profile. |web_contents| points to the WebContents that wraps the currently // active tab. |url| is the GURL of the currently active - // tab. |security_info| is the |SecurityStateModel::SecurityInfo| of + // tab. |security_info| is the + // |security_state::SecurityStateModel::SecurityInfo| of // the connection to the website in the currently active tab. - static void Show(gfx::NativeWindow parent, - Profile* profile, - content::WebContents* web_contents, - const GURL& url, - const SecurityStateModel::SecurityInfo& security_info); + static void Show( + gfx::NativeWindow parent, + Profile* profile, + content::WebContents* web_contents, + const GURL& url, + const security_state::SecurityStateModel::SecurityInfo& security_info); void set_bubble_controller( WebsiteSettingsBubbleController* bubble_controller); diff --git a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm index 6ff61af..a8e299b 100644 --- a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm @@ -1308,7 +1308,7 @@ void WebsiteSettingsUIBridge::Show( Profile* profile, content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info) { + const security_state::SecurityStateModel::SecurityInfo& security_info) { if (chrome::ToolkitViewsDialogsEnabled()) { chrome::ShowWebsiteSettingsBubbleViewsAtPoint( gfx::ScreenPointFromNSPoint(AnchorPointForWindow(parent)), profile, diff --git a/chrome/browser/ui/extensions/hosted_app_browser_controller.cc b/chrome/browser/ui/extensions/hosted_app_browser_controller.cc index 2224299..26cb0b5 100644 --- a/chrome/browser/ui/extensions/hosted_app_browser_controller.cc +++ b/chrome/browser/ui/extensions/hosted_app_browser_controller.cc @@ -7,7 +7,6 @@ #include "base/command_line.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ssl/chrome_security_state_model_client.h" -#include "chrome/browser/ssl/security_state_model.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/host_desktop.h" @@ -16,6 +15,7 @@ #include "chrome/browser/web_applications/web_app.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" +#include "components/security_state/security_state_model.h" #include "content/public/browser/web_contents.h" #include "extensions/browser/extension_registry.h" #include "extensions/common/extension.h" @@ -97,7 +97,7 @@ bool HostedAppBrowserController::ShouldShowLocationBar() const { ChromeSecurityStateModelClient::FromWebContents(web_contents); if (model_client && model_client->GetSecurityInfo().security_level == - SecurityStateModel::SECURITY_ERROR) + security_state::SecurityStateModel::SECURITY_ERROR) return true; GURL launch_url = AppLaunchInfo::GetLaunchWebURL(extension); diff --git a/chrome/browser/ui/toolbar/chrome_toolbar_model.h b/chrome/browser/ui/toolbar/chrome_toolbar_model.h index 5b5f12d..629cf05 100644 --- a/chrome/browser/ui/toolbar/chrome_toolbar_model.h +++ b/chrome/browser/ui/toolbar/chrome_toolbar_model.h @@ -6,11 +6,11 @@ #define CHROME_BROWSER_UI_TOOLBAR_CHROME_TOOLBAR_MODEL_H_ #include "base/macros.h" -#include "chrome/browser/ssl/security_state_model.h" +#include "components/security_state/security_state_model.h" #include "components/toolbar/toolbar_model.h" // This class is a //chrome-specific extension of the ToolbarModel interface. -// TODO(blundell): If SecurityStateModel::SecurityLevel gets componentized, +// TODO(blundell): Now that SecurityStateModel::SecurityLevel is componentized, // GetSecurityLevel() can be folded into ToolbarModel and this class can go // away. crbug.com/515071 class ChromeToolbarModel : public ToolbarModel { @@ -21,7 +21,7 @@ class ChromeToolbarModel : public ToolbarModel { // |ignore_editing| is true, the result reflects the underlying state of the // page without regard to any user edits that may be in progress in the // omnibox. - virtual SecurityStateModel::SecurityLevel GetSecurityLevel( + virtual security_state::SecurityStateModel::SecurityLevel GetSecurityLevel( bool ignore_editing) const = 0; protected: diff --git a/chrome/browser/ui/toolbar/test_toolbar_model.cc b/chrome/browser/ui/toolbar/test_toolbar_model.cc index 729a5bf..a7f544b 100644 --- a/chrome/browser/ui/toolbar/test_toolbar_model.cc +++ b/chrome/browser/ui/toolbar/test_toolbar_model.cc @@ -10,7 +10,7 @@ TestToolbarModel::TestToolbarModel() : ChromeToolbarModel(), perform_search_term_replacement_(false), - security_level_(SecurityStateModel::NONE), + security_level_(security_state::SecurityStateModel::NONE), icon_(gfx::VectorIconId::VECTOR_ICON_NONE), should_display_url_(true) {} @@ -37,8 +37,8 @@ bool TestToolbarModel::WouldPerformSearchTermReplacement( return perform_search_term_replacement_; } -SecurityStateModel::SecurityLevel TestToolbarModel::GetSecurityLevel( - bool ignore_editing) const { +security_state::SecurityStateModel::SecurityLevel +TestToolbarModel::GetSecurityLevel(bool ignore_editing) const { return security_level_; } @@ -52,8 +52,9 @@ gfx::VectorIconId TestToolbarModel::GetVectorIcon() const { } base::string16 TestToolbarModel::GetEVCertName() const { - return (security_level_ == SecurityStateModel::EV_SECURE) ? ev_cert_name_ - : base::string16(); + return (security_level_ == security_state::SecurityStateModel::EV_SECURE) + ? ev_cert_name_ + : base::string16(); } bool TestToolbarModel::ShouldDisplayURL() const { diff --git a/chrome/browser/ui/toolbar/test_toolbar_model.h b/chrome/browser/ui/toolbar/test_toolbar_model.h index c1fbc3a..b29dcc1 100644 --- a/chrome/browser/ui/toolbar/test_toolbar_model.h +++ b/chrome/browser/ui/toolbar/test_toolbar_model.h @@ -28,7 +28,7 @@ class TestToolbarModel : public ChromeToolbarModel { base::string16 GetCorpusNameForMobile() const override; GURL GetURL() const override; bool WouldPerformSearchTermReplacement(bool ignore_editing) const override; - SecurityStateModel::SecurityLevel GetSecurityLevel( + security_state::SecurityStateModel::SecurityLevel GetSecurityLevel( bool ignore_editing) const override; int GetIcon() const override; gfx::VectorIconId GetVectorIcon() const override; @@ -41,7 +41,8 @@ class TestToolbarModel : public ChromeToolbarModel { bool perform_search_term_replacement) { perform_search_term_replacement_ = perform_search_term_replacement; } - void set_security_level(SecurityStateModel::SecurityLevel security_level) { + void set_security_level( + security_state::SecurityStateModel::SecurityLevel security_level) { security_level_ = security_level; } void set_icon(gfx::VectorIconId icon) { icon_ = icon; } @@ -56,7 +57,7 @@ class TestToolbarModel : public ChromeToolbarModel { base::string16 text_; GURL url_; bool perform_search_term_replacement_; - SecurityStateModel::SecurityLevel security_level_; + security_state::SecurityStateModel::SecurityLevel security_level_; gfx::VectorIconId icon_; base::string16 ev_cert_name_; bool should_display_url_; diff --git a/chrome/browser/ui/toolbar/toolbar_model_impl.cc b/chrome/browser/ui/toolbar/toolbar_model_impl.cc index c62ca68..ddfd315a 100644 --- a/chrome/browser/ui/toolbar/toolbar_model_impl.cc +++ b/chrome/browser/ui/toolbar/toolbar_model_impl.cc @@ -12,7 +12,6 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search/search.h" #include "chrome/browser/ssl/chrome_security_state_model_client.h" -#include "chrome/browser/ssl/security_state_model.h" #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" @@ -21,6 +20,7 @@ #include "components/omnibox/browser/autocomplete_classifier.h" #include "components/omnibox/browser/autocomplete_input.h" #include "components/omnibox/browser/autocomplete_match.h" +#include "components/security_state/security_state_model.h" #include "components/url_formatter/elide_url.h" #include "components/url_formatter/url_formatter.h" #include "content/public/browser/cert_store.h" @@ -42,6 +42,7 @@ using content::NavigationController; using content::NavigationEntry; using content::WebContents; +using security_state::SecurityStateModel; ToolbarModelImpl::ToolbarModelImpl(ToolbarModelDelegate* delegate) : delegate_(delegate) { diff --git a/chrome/browser/ui/toolbar/toolbar_model_impl.h b/chrome/browser/ui/toolbar/toolbar_model_impl.h index 32cf5f3..623d6da 100644 --- a/chrome/browser/ui/toolbar/toolbar_model_impl.h +++ b/chrome/browser/ui/toolbar/toolbar_model_impl.h @@ -42,7 +42,7 @@ class ToolbarModelImpl : public ChromeToolbarModel { base::string16 GetCorpusNameForMobile() const override; GURL GetURL() const override; bool WouldPerformSearchTermReplacement(bool ignore_editing) const override; - SecurityStateModel::SecurityLevel GetSecurityLevel( + security_state::SecurityStateModel::SecurityLevel GetSecurityLevel( bool ignore_editing) const override; int GetIcon() const override; gfx::VectorIconId GetVectorIcon() const override; diff --git a/chrome/browser/ui/views/browser_dialogs_views_mac.cc b/chrome/browser/ui/views/browser_dialogs_views_mac.cc index 0f4d665..0cc628a 100644 --- a/chrome/browser/ui/views/browser_dialogs_views_mac.cc +++ b/chrome/browser/ui/views/browser_dialogs_views_mac.cc @@ -22,7 +22,7 @@ void ShowWebsiteSettingsBubbleViewsAtPoint( Profile* profile, content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info) { + const security_state::SecurityStateModel::SecurityInfo& security_info) { WebsiteSettingsPopupView::ShowPopup( nullptr, gfx::Rect(anchor_point, gfx::Size()), profile, web_contents, url, security_info); diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index fcbd890..3959fbc 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -1408,7 +1408,7 @@ void BrowserView::ShowWebsiteSettings( Profile* profile, content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info) { + const security_state::SecurityStateModel::SecurityInfo& security_info) { // Some browser windows have a location icon embedded in the frame. Try to // use that if it exists. If it doesn't exist, use the location icon from // the location bar. diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index 04a9549..ff19911 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -352,7 +352,8 @@ class BrowserView : public BrowserWindow, Profile* profile, content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info) override; + const security_state::SecurityStateModel::SecurityInfo& security_info) + override; void ShowAppMenu() override; bool PreHandleKeyboardEvent(const content::NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) override; diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index a5195bd..95a3003 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -326,22 +326,22 @@ SkColor LocationBarView::GetColor( } SkColor LocationBarView::GetSecureTextColor( - SecurityStateModel::SecurityLevel security_level) const { + security_state::SecurityStateModel::SecurityLevel security_level) const { bool inverted = color_utils::IsDark(GetColor(BACKGROUND)); SkColor color; switch (security_level) { - case SecurityStateModel::EV_SECURE: - case SecurityStateModel::SECURE: + case security_state::SecurityStateModel::EV_SECURE: + case security_state::SecurityStateModel::SECURE: if (ui::MaterialDesignController::IsModeMaterial() && inverted) return GetColor(TEXT); color = GetColor(EV_BUBBLE_TEXT_AND_BORDER); break; - case SecurityStateModel::SECURITY_POLICY_WARNING: + case security_state::SecurityStateModel::SECURITY_POLICY_WARNING: return GetColor(DEEMPHASIZED_TEXT); break; - case SecurityStateModel::SECURITY_ERROR: { + case security_state::SecurityStateModel::SECURITY_ERROR: { bool md = ui::MaterialDesignController::IsModeMaterial(); if (md && inverted) return GetColor(TEXT); @@ -349,7 +349,7 @@ SkColor LocationBarView::GetSecureTextColor( break; } - case SecurityStateModel::SECURITY_WARNING: + case security_state::SecurityStateModel::SECURITY_WARNING: return GetColor(TEXT); break; @@ -1043,7 +1043,7 @@ bool LocationBarView::ShouldShowEVBubble() const { const ChromeToolbarModel* chrome_toolbar_model = static_cast<const ChromeToolbarModel*>(GetToolbarModel()); return (chrome_toolbar_model->GetSecurityLevel(false) == - SecurityStateModel::EV_SECURE); + security_state::SecurityStateModel::EV_SECURE); } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h index 0bf3d44..f71b524 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chrome/browser/ui/views/location_bar/location_bar_view.h @@ -14,7 +14,6 @@ #include "base/macros.h" #include "base/prefs/pref_member.h" #include "chrome/browser/extensions/extension_context_menu_model.h" -#include "chrome/browser/ssl/security_state_model.h" #include "chrome/browser/ui/location_bar/location_bar.h" #include "chrome/browser/ui/omnibox/chrome_omnibox_edit_controller.h" #include "chrome/browser/ui/toolbar/chrome_toolbar_model.h" @@ -23,6 +22,7 @@ #include "chrome/browser/ui/views/extensions/extension_popup.h" #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" #include "components/search_engines/template_url_service_observer.h" +#include "components/security_state/security_state_model.h" #include "components/ui/zoom/zoom_event_manager_observer.h" #include "ui/gfx/animation/animation_delegate.h" #include "ui/gfx/animation/slide_animation.h" @@ -106,7 +106,8 @@ class LocationBarView : public LocationBar, virtual void ShowWebsiteSettings( content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info) = 0; + const security_state::SecurityStateModel::SecurityInfo& + security_info) = 0; protected: virtual ~Delegate() {} @@ -142,7 +143,7 @@ class LocationBarView : public LocationBar, // Returns the color to be used for security text in the context of // |security_level|. SkColor GetSecureTextColor( - SecurityStateModel::SecurityLevel security_level) const; + security_state::SecurityStateModel::SecurityLevel security_level) const; // Returns the delegate. Delegate* delegate() const { return delegate_; } diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc index 814d25b..19bd981 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc @@ -143,7 +143,7 @@ OmniboxViewViews::OmniboxViewViews(OmniboxEditController* controller, make_scoped_ptr(new ChromeOmniboxClient(controller, profile))), profile_(profile), popup_window_mode_(popup_window_mode), - security_level_(SecurityStateModel::NONE), + security_level_(security_state::SecurityStateModel::NONE), saved_selection_for_focus_change_(gfx::Range::InvalidRange()), ime_composing_before_change_(false), delete_at_end_pressed_(false), @@ -228,7 +228,8 @@ void OmniboxViewViews::ResetTabState(content::WebContents* web_contents) { } void OmniboxViewViews::Update() { - const SecurityStateModel::SecurityLevel old_security_level = security_level_; + const security_state::SecurityStateModel::SecurityLevel old_security_level = + security_level_; UpdateSecurityLevel(); if (model()->UpdatePermanentText()) { // Something visibly changed. Re-enable URL replacement. @@ -648,10 +649,12 @@ void OmniboxViewViews::EmphasizeURLComponents() { // may have incorrectly identified a qualifier as a scheme. SetStyle(gfx::DIAGONAL_STRIKE, false); if (!model()->user_input_in_progress() && text_is_url && - scheme.is_nonempty() && (security_level_ != SecurityStateModel::NONE)) { + scheme.is_nonempty() && + (security_level_ != security_state::SecurityStateModel::NONE)) { SkColor security_color = location_bar_view_->GetSecureTextColor(security_level_); - const bool strike = (security_level_ == SecurityStateModel::SECURITY_ERROR); + const bool strike = + (security_level_ == security_state::SecurityStateModel::SECURITY_ERROR); const gfx::Range scheme_range(scheme.begin, scheme.end()); ApplyColor(security_color, scheme_range); ApplyStyle(gfx::DIAGONAL_STRIKE, strike, scheme_range); diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.h b/chrome/browser/ui/views/omnibox/omnibox_view_views.h index 23b5d9b..11564bc 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.h +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.h @@ -213,7 +213,7 @@ class OmniboxViewViews scoped_ptr<OmniboxPopupView> popup_view_; - SecurityStateModel::SecurityLevel security_level_; + security_state::SecurityStateModel::SecurityLevel security_level_; // Selection persisted across temporary text changes, like popup suggestions. gfx::Range saved_temporary_selection_; diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc index ea7d251..4e252b6 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc @@ -398,7 +398,7 @@ ToolbarView::GetContentSettingBubbleModelDelegate() { void ToolbarView::ShowWebsiteSettings( content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info) { + const security_state::SecurityStateModel::SecurityInfo& security_info) { chrome::ShowWebsiteSettings(browser_, web_contents, url, security_info); } diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.h b/chrome/browser/ui/views/toolbar/toolbar_view.h index 3b518bc..c8914bd 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_view.h +++ b/chrome/browser/ui/views/toolbar/toolbar_view.h @@ -121,7 +121,8 @@ class ToolbarView : public views::AccessiblePaneView, void ShowWebsiteSettings( content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info) override; + const security_state::SecurityStateModel::SecurityInfo& security_info) + override; // CommandObserver: void EnabledStateChangedForCommand(int id, bool enabled) override; diff --git a/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc b/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc index ab9eb80..370ff82 100644 --- a/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc +++ b/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc @@ -348,7 +348,7 @@ void WebsiteSettingsPopupView::ShowPopup( Profile* profile, content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info) { + const security_state::SecurityStateModel::SecurityInfo& security_info) { is_popup_showing = true; gfx::NativeView parent_window = anchor_view ? nullptr : web_contents->GetNativeView(); @@ -379,7 +379,7 @@ WebsiteSettingsPopupView::WebsiteSettingsPopupView( Profile* profile, content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info) + const security_state::SecurityStateModel::SecurityInfo& security_info) : content::WebContentsObserver(web_contents), BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), web_contents_(web_contents), diff --git a/chrome/browser/ui/views/website_settings/website_settings_popup_view.h b/chrome/browser/ui/views/website_settings/website_settings_popup_view.h index 3302546..e7a0eda 100644 --- a/chrome/browser/ui/views/website_settings/website_settings_popup_view.h +++ b/chrome/browser/ui/views/website_settings/website_settings_popup_view.h @@ -10,9 +10,9 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/strings/string16.h" -#include "chrome/browser/ssl/security_state_model.h" #include "chrome/browser/ui/views/website_settings/permission_selector_view_observer.h" #include "chrome/browser/ui/website_settings/website_settings_ui.h" +#include "components/security_state/security_state_model.h" #include "content/public/browser/web_contents_observer.h" #include "ui/views/bubble/bubble_delegate.h" #include "ui/views/controls/button/button.h" @@ -52,12 +52,13 @@ class WebsiteSettingsPopupView : public content::WebContentsObserver, ~WebsiteSettingsPopupView() override; // If |anchor_view| is null, |anchor_rect| is used to anchor the bubble. - static void ShowPopup(views::View* anchor_view, - const gfx::Rect& anchor_rect, - Profile* profile, - content::WebContents* web_contents, - const GURL& url, - const SecurityStateModel::SecurityInfo& security_info); + static void ShowPopup( + views::View* anchor_view, + const gfx::Rect& anchor_rect, + Profile* profile, + content::WebContents* web_contents, + const GURL& url, + const security_state::SecurityStateModel::SecurityInfo& security_info); static bool IsPopupShowing(); @@ -70,7 +71,7 @@ class WebsiteSettingsPopupView : public content::WebContentsObserver, Profile* profile, content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info); + const security_state::SecurityStateModel::SecurityInfo& security_info); // WebContentsObserver implementation. void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; diff --git a/chrome/browser/ui/views/website_settings/website_settings_popup_view_unittest.cc b/chrome/browser/ui/views/website_settings/website_settings_popup_view_unittest.cc index 4fabec7..9e90cda6 100644 --- a/chrome/browser/ui/views/website_settings/website_settings_popup_view_unittest.cc +++ b/chrome/browser/ui/views/website_settings/website_settings_popup_view_unittest.cc @@ -34,7 +34,7 @@ class WebsiteSettingsPopupViewTestApi { view_->GetWidget()->CloseNow(); GURL url("http://www.example.com"); - SecurityStateModel::SecurityInfo security_info; + security_state::SecurityStateModel::SecurityInfo security_info; views::View* anchor_view = nullptr; view_ = new WebsiteSettingsPopupView(anchor_view, parent_, profile_, web_contents_, url, security_info); diff --git a/chrome/browser/ui/website_settings/website_settings.cc b/chrome/browser/ui/website_settings/website_settings.cc index 3f76e09..ff21748 100644 --- a/chrome/browser/ui/website_settings/website_settings.cc +++ b/chrome/browser/ui/website_settings/website_settings.cc @@ -72,6 +72,7 @@ using base::ASCIIToUTF16; using base::UTF8ToUTF16; using base::UTF16ToUTF8; using content::BrowserThread; +using security_state::SecurityStateModel; namespace { diff --git a/chrome/browser/ui/website_settings/website_settings.h b/chrome/browser/ui/website_settings/website_settings.h index 19406b4..2e7b0f2 100644 --- a/chrome/browser/ui/website_settings/website_settings.h +++ b/chrome/browser/ui/website_settings/website_settings.h @@ -8,9 +8,9 @@ #include "base/macros.h" #include "base/strings/string16.h" #include "chrome/browser/content_settings/tab_specific_content_settings.h" -#include "chrome/browser/ssl/security_state_model.h" #include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/content_settings_types.h" +#include "components/security_state/security_state_model.h" #include "content/public/common/signed_certificate_timestamp_id_and_status.h" #include "url/gurl.h" @@ -96,13 +96,14 @@ class WebsiteSettings : public TabSpecificContentSettings::SiteDataObserver { // Creates a WebsiteSettings for the passed |url| using the given |ssl| status // object to determine the status of the site's connection. The // |WebsiteSettings| takes ownership of the |ui|. - WebsiteSettings(WebsiteSettingsUI* ui, - Profile* profile, - TabSpecificContentSettings* tab_specific_content_settings, - content::WebContents* web_contents, - const GURL& url, - const SecurityStateModel::SecurityInfo& security_info, - content::CertStore* cert_store); + WebsiteSettings( + WebsiteSettingsUI* ui, + Profile* profile, + TabSpecificContentSettings* tab_specific_content_settings, + content::WebContents* web_contents, + const GURL& url, + const security_state::SecurityStateModel::SecurityInfo& security_info, + content::CertStore* cert_store); ~WebsiteSettings() override; void RecordWebsiteSettingsAction(WebsiteSettingsAction action); @@ -145,8 +146,9 @@ class WebsiteSettings : public TabSpecificContentSettings::SiteDataObserver { private: // Initializes the |WebsiteSettings|. - void Init(const GURL& url, - const SecurityStateModel::SecurityInfo& security_info); + void Init( + const GURL& url, + const security_state::SecurityStateModel::SecurityInfo& security_info); // Sets (presents) the information about the site's permissions in the |ui_|. void PresentSitePermissions(); diff --git a/chrome/browser/ui/website_settings/website_settings_unittest.cc b/chrome/browser/ui/website_settings/website_settings_unittest.cc index 7314512..9775af9 100644 --- a/chrome/browser/ui/website_settings/website_settings_unittest.cc +++ b/chrome/browser/ui/website_settings/website_settings_unittest.cc @@ -29,6 +29,7 @@ #include "testing/gtest/include/gtest/gtest.h" using content::SSLStatus; +using security_state::SecurityStateModel; using testing::_; using testing::AnyNumber; using testing::Return; diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 6beaddd..7354112 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -540,7 +540,6 @@ 'chrome_version_java', 'content_setting_java', 'content_settings_type_java', - 'connection_security_levels_java', 'connectivity_check_result_java', 'document_tab_model_info_proto_java', 'infobar_action_type_java', @@ -563,6 +562,7 @@ '../components/components.gyp:offline_pages_enums_java', '../components/components.gyp:precache_java', '../components/components.gyp:safe_json_java', + '../components/components.gyp:security_state_enums_java', '../components/components.gyp:service_tab_launcher_java', '../components/components.gyp:signin_core_browser_java', '../components/components.gyp:variations_java', diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 68370c5..fc61562 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2826,9 +2826,6 @@ 'browser/ssl/chrome_ssl_host_state_delegate_factory.h', 'browser/ssl/common_name_mismatch_handler.cc', 'browser/ssl/common_name_mismatch_handler.h', - 'browser/ssl/security_state_model.cc', - 'browser/ssl/security_state_model.h', - 'browser/ssl/security_state_model_client.h', 'browser/ssl/ssl_blocking_page.cc', 'browser/ssl/ssl_blocking_page.h', 'browser/ssl/ssl_cert_reporter.h', @@ -3178,6 +3175,7 @@ '../components/components.gyp:search_engines', '../components/components.gyp:search_provider_logos', '../components/components.gyp:security_interstitials_core', + '../components/components.gyp:security_state', '../components/components.gyp:ssl_errors', '../components/components.gyp:suggestions', '../components/components.gyp:signin_core_browser', @@ -3293,6 +3291,7 @@ '../components/components.gyp:proxy_config', '../components/components.gyp:safe_browsing_db', '../components/components.gyp:safe_json', + '../components/components.gyp:security_state', '../components/components.gyp:sessions_content', '../components/components.gyp:storage_monitor', '../components/components.gyp:ssl_config', @@ -3746,6 +3745,7 @@ '../components/components.gyp:offline_pages', '../components/components.gyp:precache_content', '../components/components.gyp:precache_core', + '../components/components.gyp:security_state', '../components/components.gyp:service_tab_launcher', '../components/components.gyp:toolbar', '../components/components.gyp:web_contents_delegate_android', @@ -4082,15 +4082,6 @@ }, { # GN: //chrome/android:chrome_android_java_enums_srcjar - 'target_name': 'connection_security_levels_java', - 'type': 'none', - 'variables': { - 'source_file': 'browser/ssl/security_state_model.h', - }, - 'includes': [ '../build/android/java_cpp_enum.gypi' ], - }, - { - # GN: //chrome/android:chrome_android_java_enums_srcjar 'target_name': 'tab_load_status_java', 'type': 'none', 'variables': { diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index ae0df42..02af418 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -414,7 +414,7 @@ 'browser/ssl/certificate_reporting_test_utils.cc', 'browser/ssl/certificate_reporting_test_utils.h', 'browser/ssl/chrome_ssl_host_state_delegate_test.cc', - 'browser/ssl/security_state_model_browser_tests.cc', + 'browser/ssl/chrome_security_state_model_client_browser_tests.cc', 'browser/ssl/ssl_browser_tests.cc', 'browser/ssl/ssl_client_certificate_selector_test.cc', 'browser/ssl/ssl_client_certificate_selector_test.h', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index c833980..0af6d7a 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -223,7 +223,6 @@ 'browser/signin/signin_status_metrics_provider_chromeos_unittest.cc', 'browser/signin/signin_tracker_unittest.cc', 'browser/signin/test_signin_client_builder.cc', - 'browser/ssl/security_state_model_unittest.cc', 'browser/ssl/ssl_error_handler_unittest.cc', 'browser/status_icons/status_icon_menu_model_unittest.cc', 'browser/status_icons/status_icon_unittest.cc', diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 0ecd648..87b6ea9 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -697,11 +697,6 @@ const char kLocalNtpReload[] = "local-ntp-reload"; // Makes Chrome default browser const char kMakeDefaultBrowser[] = "make-default-browser"; -// Use to opt-in to marking HTTP as non-secure. -const char kMarkNonSecureAs[] = "mark-non-secure-as"; -const char kMarkNonSecureAsNeutral[] = "neutral"; -const char kMarkNonSecureAsNonSecure[] = "non-secure"; - // Forces the maximum disk space to be used by the media cache, in bytes. const char kMediaCacheSize[] = "media-cache-size"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index ff02de7..f53b0be 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -194,9 +194,6 @@ extern const char kLocalNtpReload[]; extern const char kMakeDefaultBrowser[]; extern const char kManualEnhancedBookmarks[]; extern const char kManualEnhancedBookmarksOptout[]; -extern const char kMarkNonSecureAs[]; -extern const char kMarkNonSecureAsNeutral[]; -extern const char kMarkNonSecureAsNonSecure[]; extern const char kMediaCacheSize[]; extern const char kMediaRouter[]; extern const char kMessageLoopHistogrammer[]; diff --git a/chrome/test/base/test_browser_window.h b/chrome/test/base/test_browser_window.h index 75de171..c707b4b 100644 --- a/chrome/test/base/test_browser_window.h +++ b/chrome/test/base/test_browser_window.h @@ -131,7 +131,8 @@ class TestBrowserWindow : public BrowserWindow { Profile* profile, content::WebContents* web_contents, const GURL& url, - const SecurityStateModel::SecurityInfo& security_info) override {} + const security_state::SecurityStateModel::SecurityInfo& security_info) + override {} void CutCopyPaste(int command_id) override {} WindowOpenDisposition GetDispositionForPopupBounds( const gfx::Rect& bounds) override; diff --git a/components/BUILD.gn b/components/BUILD.gn index 4a9a579..18f3ed6 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn @@ -65,6 +65,7 @@ test("components_unittests") { "//components/open_from_clipboard:unit_tests", "//components/os_crypt:unit_tests", "//components/proxy_config:unit_tests", + "//components/security_state:unit_tests", "//components/sessions:unit_tests", "//components/suggestions:unit_tests", "//components/syncable_prefs:unit_tests", diff --git a/components/components.gyp b/components/components.gyp index 8fef224..45389c6 100644 --- a/components/components.gyp +++ b/components/components.gyp @@ -78,6 +78,7 @@ 'search_engines.gypi', 'search_provider_logos.gypi', 'security_interstitials.gypi', + 'security_state.gypi', 'sessions.gypi', 'signin.gypi', 'ssl_config.gypi', diff --git a/components/components_tests.gyp b/components/components_tests.gyp index e1654c9..72cd6bf 100644 --- a/components/components_tests.gyp +++ b/components/components_tests.gyp @@ -661,6 +661,9 @@ 'search_provider_logos/logo_cache_unittest.cc', 'search_provider_logos/logo_tracker_unittest.cc', ], + 'security_state_unittest_sources': [ + 'security_state/security_state_model_unittest.cc', + ], 'sessions_unittest_sources': [ 'sessions/content/content_serialized_navigation_builder_unittest.cc', 'sessions/content/content_serialized_navigation_driver_unittest.cc', @@ -941,6 +944,7 @@ '<@(search_engines_unittest_sources)', '<@(search_provider_logos_unittest_sources)', '<@(search_unittest_sources)', + '<@(security_state_unittest_sources)', '<@(sessions_unittest_sources)', '<@(signin_unittest_sources)', '<@(ssl_config_unittest_sources)', @@ -1070,6 +1074,7 @@ 'components.gyp:search_engines', 'components.gyp:search_engines_test_support', 'components.gyp:search_provider_logos', + 'components.gyp:security_state', 'components.gyp:sessions_test_support', 'components.gyp:signin_core_browser', 'components.gyp:signin_core_browser_test_support', diff --git a/components/security_state.gypi b/components/security_state.gypi new file mode 100644 index 0000000..d1376b4 --- /dev/null +++ b/components/security_state.gypi @@ -0,0 +1,42 @@ +# Copyright 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'security_state', + 'type': 'static_library', + 'dependencies': [ + '../base/base.gyp:base', + '../net/net.gyp:net', + ], + 'include_dirs': [ + '..', + ], + 'sources': [ + 'security_state/security_state_model.cc', + 'security_state/security_state_model.h', + 'security_state/security_state_model_client.h', + 'security_state/switches.cc', + 'security_state/switches.h', + ] + }, + ], + 'conditions' : [ + ['OS=="android"', { + 'targets': [ + { + # GN: //components/security_state:security_state_enums_java + 'target_name': 'security_state_enums_java', + 'type': 'none', + 'variables': { + 'source_file': 'security_state/security_state_model.h', + }, + 'includes': [ '../build/android/java_cpp_enum.gypi' ], + }, + ], + }, + ], + ], +} diff --git a/components/security_state/BUILD.gn b/components/security_state/BUILD.gn new file mode 100644 index 0000000..68cd282 --- /dev/null +++ b/components/security_state/BUILD.gn @@ -0,0 +1,50 @@ +# Copyright 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +if (is_android) { + import("//build/config/android/config.gni") + import("//build/config/android/rules.gni") +} + +# GYP version: components/security_state.gyp +source_set("security_state") { + sources = [ + "security_state_model.cc", + "security_state_model.h", + "security_state_model_client.h", + "switches.cc", + "switches.h", + ] + + deps = [ + "//base", + "//net", + ] +} + +if (is_android) { + # GYP: //components/security_state.gypi:security_state_enums_java + java_cpp_enum("security_state_enums_java") { + sources = [ + "security_state_model.h", + ] + } +} + +source_set("unit_tests") { + testonly = true + sources = [ + "security_state_model_unittest.cc", + ] + + deps = [ + ":security_state", + "//net:test_support", + "//testing/gtest", + ] + + data = [ + "//net/data/", + ] +} diff --git a/components/security_state/DEPS b/components/security_state/DEPS new file mode 100644 index 0000000..b2f6f8e --- /dev/null +++ b/components/security_state/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+net", +]
\ No newline at end of file diff --git a/components/security_state/OWNERS b/components/security_state/OWNERS new file mode 100644 index 0000000..04d0330 --- /dev/null +++ b/components/security_state/OWNERS @@ -0,0 +1,3 @@ +estark@chromium.org +felt@chromium.org +palmer@chromium.org
\ No newline at end of file diff --git a/chrome/browser/ssl/security_state_model.cc b/components/security_state/security_state_model.cc index f0022d6..2efa11c 100644 --- a/chrome/browser/ssl/security_state_model.cc +++ b/components/security_state/security_state_model.cc @@ -2,23 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ssl/security_state_model.h" +#include "components/security_state/security_state_model.h" #include <stdint.h> #include "base/command_line.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram_macros.h" -#include "chrome/browser/ssl/security_state_model_client.h" -#include "chrome/common/chrome_switches.h" +#include "components/security_state/security_state_model_client.h" +#include "components/security_state/switches.h" #include "net/ssl/ssl_cipher_suite_names.h" #include "net/ssl/ssl_connection_status_flags.h" +namespace security_state { + namespace { SecurityStateModel::SecurityLevel GetSecurityLevelForNonSecureFieldTrial() { - // TODO(estark): componentize switches::kMarkNonSecureAs. - // https://crbug.com/515071 std::string choice = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( switches::kMarkNonSecureAs); @@ -278,3 +278,5 @@ bool SecurityStateModel::VisibleSecurityState::operator==( displayed_mixed_content == other.displayed_mixed_content && ran_mixed_content == other.ran_mixed_content); } + +} // namespace security_state diff --git a/chrome/browser/ssl/security_state_model.h b/components/security_state/security_state_model.h index 9d21b2d..26dd220 100644 --- a/chrome/browser/ssl/security_state_model.h +++ b/components/security_state/security_state_model.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_SSL_SECURITY_STATE_MODEL_H_ -#define CHROME_BROWSER_SSL_SECURITY_STATE_MODEL_H_ +#ifndef COMPONENTS_SECURITY_STATE_SECURITY_STATE_MODEL_H_ +#define COMPONENTS_SECURITY_STATE_SECURITY_STATE_MODEL_H_ #include "base/macros.h" #include "net/cert/cert_status_flags.h" @@ -11,7 +11,8 @@ #include "net/cert/x509_certificate.h" #include "url/gurl.h" -class Profile; +namespace security_state { + class SecurityStateModelClient; // SecurityStateModel provides high-level security information about a @@ -30,7 +31,7 @@ class SecurityStateModel { // update the UI icons in ToolbarModelImpl::GetIconForSecurityLevel. // // A Java counterpart will be generated for this enum. - // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.ssl + // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.security_state // GENERATED_JAVA_CLASS_NAME_OVERRIDE: ConnectionSecurityLevel enum SecurityLevel { // HTTP/no URL/HTTPS but with insecure passive content on the page @@ -163,4 +164,6 @@ class SecurityStateModel { DISALLOW_COPY_AND_ASSIGN(SecurityStateModel); }; -#endif // CHROME_BROWSER_SSL_SECURITY_STATE_MODEL_H_ +} // namespace security_state + +#endif // COMPONENTS_SECURITY_STATE_SECURITY_STATE_MODEL_H_ diff --git a/chrome/browser/ssl/security_state_model_client.h b/components/security_state/security_state_model_client.h index 0ada7a1..55ce3eb 100644 --- a/chrome/browser/ssl/security_state_model_client.h +++ b/components/security_state/security_state_model_client.h @@ -2,18 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_SSL_SECURITY_STATE_MODEL_CLIENT_H_ -#define CHROME_BROWSER_SSL_SECURITY_STATE_MODEL_CLIENT_H_ +#ifndef COMPONENTS_SECURITY_STATE_SECURITY_STATE_MODEL_CLIENT_H_ +#define COMPONENTS_SECURITY_STATE_SECURITY_STATE_MODEL_CLIENT_H_ #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "chrome/browser/ssl/security_state_model.h" +#include "components/security_state/security_state_model.h" #include "net/cert/cert_status_flags.h" namespace net { class X509Certificate; } // namespace net +namespace security_state { + // Provides embedder-specific information that a SecurityStateModel // needs to determine the page's security status. class SecurityStateModelClient { @@ -40,4 +42,6 @@ class SecurityStateModelClient { DISALLOW_COPY_AND_ASSIGN(SecurityStateModelClient); }; -#endif // CHROME_BROWSER_SSL_SECURITY_STATE_MODEL_CLIENT_H_ +} // namespace security_state + +#endif // COMPONENTS_SECURITY_STATE_SECURITY_STATE_MODEL_CLIENT_H_ diff --git a/chrome/browser/ssl/security_state_model_unittest.cc b/components/security_state/security_state_model_unittest.cc index 788106c..07d24ff 100644 --- a/chrome/browser/ssl/security_state_model_unittest.cc +++ b/components/security_state/security_state_model_unittest.cc @@ -2,17 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ssl/security_state_model.h" +#include "components/security_state/security_state_model.h" #include <stdint.h> -#include "chrome/browser/ssl/security_state_model_client.h" -#include "chrome/test/base/chrome_render_view_host_test_harness.h" -#include "chrome/test/base/testing_profile.h" -#include "content/public/browser/cert_store.h" -#include "content/public/common/origin_util.h" -#include "content/public/test/mock_render_process_host.h" -#include "content/public/test/test_browser_thread_bundle.h" +#include "components/security_state/security_state_model_client.h" #include "net/base/test_data_directory.h" #include "net/cert/x509_certificate.h" #include "net/ssl/ssl_connection_status_flags.h" @@ -20,6 +14,8 @@ #include "net/test/test_certificate_data.h" #include "testing/gtest/include/gtest/gtest.h" +namespace security_state { + namespace { const char kUrl[] = "https://foo.test"; @@ -79,9 +75,9 @@ class TestSecurityStateModelClient : public SecurityStateModelClient { bool UsedPolicyInstalledCertificate() override { return false; } - bool IsOriginSecure(const GURL& url) override { - return content::IsOriginSecure(url); - } + // Always returns true because all unit tests in this file test + // scenarios in which the origin is secure. + bool IsOriginSecure(const GURL& url) override { return true; } private: SecurityStateModel::SecurityLevel initial_security_level_; @@ -92,11 +88,9 @@ class TestSecurityStateModelClient : public SecurityStateModelClient { bool ran_mixed_content_; }; -class SecurityStateModelTest : public ChromeRenderViewHostTestHarness {}; - // Tests that SHA1-signed certificates expiring in 2016 downgrade the // security state of the page. -TEST_F(SecurityStateModelTest, SHA1Warning) { +TEST(SecurityStateModelTest, SHA1Warning) { TestSecurityStateModelClient client; SecurityStateModel model; model.SetClient(&client); @@ -109,7 +103,7 @@ TEST_F(SecurityStateModelTest, SHA1Warning) { // Tests that SHA1 warnings don't interfere with the handling of mixed // content. -TEST_F(SecurityStateModelTest, SHA1WarningMixedContent) { +TEST(SecurityStateModelTest, SHA1WarningMixedContent) { TestSecurityStateModelClient client; SecurityStateModel model; model.SetClient(&client); @@ -136,7 +130,7 @@ TEST_F(SecurityStateModelTest, SHA1WarningMixedContent) { // Tests that SHA1 warnings don't interfere with the handling of major // cert errors. -TEST_F(SecurityStateModelTest, SHA1WarningBrokenHTTPS) { +TEST(SecurityStateModelTest, SHA1WarningBrokenHTTPS) { TestSecurityStateModelClient client; SecurityStateModel model; model.SetClient(&client); @@ -151,7 +145,7 @@ TEST_F(SecurityStateModelTest, SHA1WarningBrokenHTTPS) { // Tests that |security_info.is_secure_protocol_and_ciphersuite| is // computed correctly. -TEST_F(SecurityStateModelTest, SecureProtocolAndCiphersuite) { +TEST(SecurityStateModelTest, SecureProtocolAndCiphersuite) { TestSecurityStateModelClient client; SecurityStateModel model; model.SetClient(&client); @@ -166,7 +160,7 @@ TEST_F(SecurityStateModelTest, SecureProtocolAndCiphersuite) { EXPECT_TRUE(security_info.is_secure_protocol_and_ciphersuite); } -TEST_F(SecurityStateModelTest, NonsecureProtocol) { +TEST(SecurityStateModelTest, NonsecureProtocol) { TestSecurityStateModelClient client; SecurityStateModel model; model.SetClient(&client); @@ -181,7 +175,7 @@ TEST_F(SecurityStateModelTest, NonsecureProtocol) { EXPECT_FALSE(security_info.is_secure_protocol_and_ciphersuite); } -TEST_F(SecurityStateModelTest, NonsecureCiphersuite) { +TEST(SecurityStateModelTest, NonsecureCiphersuite) { TestSecurityStateModelClient client; SecurityStateModel model; model.SetClient(&client); @@ -197,3 +191,5 @@ TEST_F(SecurityStateModelTest, NonsecureCiphersuite) { } } // namespace + +} // namespace security_state diff --git a/components/security_state/switches.cc b/components/security_state/switches.cc new file mode 100644 index 0000000..13cbe1a --- /dev/null +++ b/components/security_state/switches.cc @@ -0,0 +1,16 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/security_state/switches.h" + +namespace security_state { +namespace switches { + +// Use to opt-in to marking HTTP as non-secure. +const char kMarkNonSecureAs[] = "mark-non-secure-as"; +const char kMarkNonSecureAsNeutral[] = "neutral"; +const char kMarkNonSecureAsNonSecure[] = "non-secure"; + +} // namespace switches +} // namespace security_state diff --git a/components/security_state/switches.h b/components/security_state/switches.h new file mode 100644 index 0000000..b4ed6bf --- /dev/null +++ b/components/security_state/switches.h @@ -0,0 +1,18 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_SECURITY_STATE_SWITCHES_H_ +#define COMPONENTS_SECURITY_STATE_SWITCHES_H_ + +namespace security_state { +namespace switches { + +extern const char kMarkNonSecureAs[]; +extern const char kMarkNonSecureAsNeutral[]; +extern const char kMarkNonSecureAsNonSecure[]; + +} +} // namespace security_state + +#endif // COMPONENTS_SECURITY_STATE_SWITCHES_H_ |