Rename WebsiteSettings code to PageInfo.
This was automated using a script [1] that does the following: - Rename relevant files in the following folders from website_settings* to page_info*: - chrome/browser/ui/page_info - chrome/browser/ui/cocoa/page_info - chrome/browser/ui/views/page_info - chrome/browser/ui/android/page_info - chrome/android/java/res/layout - Run `./tools/git/mass-rename.py` to update e.g. includes, build files, header guards. - mass-rename.py does not handle test files (https://crbug.com/701529) or Java, so those are handled separately, either in an early step are as part of the later renames. - `page_info_bubble_controller.h` needs a separate header guard fix. - Use `sed` to rename classes, enums, non-UMA strings, and comments *WebsiteSettings* to *PageInfo* across the entire Chromium project. - Since several content settings classes are also called "WebsiteSettings", this is done by taking a full list of all occurrences of full tokens containing "WebsiteSettings", "website_settings", or "website settings" and whitelisting individual replacements. - To avoid modifying strings, all lines containing the relevant tokens *following at least one quote mark on the same line* are preserved, except two individually handled cases. There do not appear to be any affected multi-line strings. - `git cl format` - Remove two long-standing TODO comments about this rename, in: - PageInfoPopup.java - page_info_bubble_controller.h This CL does not attempt to reflow comments; all changes stay within 80 lines, though. [1] https://github.com/lgarron/website-settings-to-page-info/blob/master/page_info.fish BUG=571506 TBR=jochen@chromium.org Review-Url: https://codereview.chromium.org/2754383004 Cr-Commit-Position: refs/heads/master@{#459562}
This commit is contained in:
build/android/pylib/gtest/filter
chrome
BUILD.gn
android
BUILD.gn
java
java_sources.gniapp
browser
BUILD.gn
android
chromeos
ui
BUILD.gn
android
page_info
autofill
browser_commands.ccbrowser_commands.hbrowser_dialogs.hbrowser_window.hcocoa
browser_window_cocoa.hbrowser_window_cocoa.mm
location_bar
page_info
page_info_bubble_controller.hpage_info_bubble_controller.mmpage_info_bubble_controller_unittest.mmpage_info_utils_cocoa.hpage_info_utils_cocoa.mmpermission_selector_button.hpermission_selector_button.mmpermission_selector_button_unittest.mmwebsite_settings_utils_cocoa.h
permission_bubble
login
page_info
page_info.ccpage_info.hpage_info_infobar_delegate.ccpage_info_infobar_delegate.hpage_info_ui.ccpage_info_ui.hpage_info_unittest.ccpermission_menu_model.ccpermission_menu_model.hpermission_menu_model_unittest.cc
views
browser_dialogs_views_mac.cc
frame
location_bar
page_info
chosen_object_row.ccchosen_object_row.hchosen_object_row_observer.hpage_info_popup_view.ccpage_info_popup_view.hpage_info_popup_view_interactive_uitest.ccpage_info_popup_view_unittest.ccpermission_selector_row.ccpermission_selector_row.hpermission_selector_row_observer.h
permission_bubble
toolbar
webui
vr_shell
test
components
docs/ui/views
ios/chrome/browser/ui/dialogs
tools/metrics
@ -26,7 +26,7 @@ DownloadItemModelTest.InterruptTooltip
|
||||
# l10n_util.cc(655)] Check failed: std::string::npos != pos
|
||||
DownloadItemModelTest.InterruptStatus
|
||||
# l10n_util.cc(655)] Check failed: std::string::npos != pos
|
||||
WebsiteSettingsTest.OnSiteDataAccessed
|
||||
PageInfoTest.OnSiteDataAccessed
|
||||
|
||||
# crbug.com/139423
|
||||
ValueStoreFrontendTest.GetExistingData
|
||||
|
@ -1548,13 +1548,13 @@ if (is_android) {
|
||||
|
||||
java_cpp_enum("page_info_connection_type_javagen") {
|
||||
sources = [
|
||||
"browser/ui/android/page_info/website_settings_popup_android.h",
|
||||
"browser/ui/android/page_info/page_info_popup_android.h",
|
||||
]
|
||||
}
|
||||
|
||||
java_cpp_enum("website_settings_action_javagen") {
|
||||
java_cpp_enum("page_info_action_javagen") {
|
||||
sources = [
|
||||
"browser/ui/page_info/website_settings.h",
|
||||
"browser/ui/page_info/page_info.h",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ android_library("chrome_java") {
|
||||
"//chrome:signin_metrics_enum_javagen",
|
||||
"//chrome:quick_action_category_enum_javagen",
|
||||
"//chrome:page_info_connection_type_javagen",
|
||||
"//chrome:website_settings_action_javagen",
|
||||
"//chrome:page_info_action_javagen",
|
||||
"//components/browsing_data/core:browsing_data_utils_java",
|
||||
"//components/browsing_data/core:clear_browsing_data_tab_java",
|
||||
"//components/infobars/core:infobar_enums_java",
|
||||
|
54
chrome/android/java/res/layout/website_settings.xml → chrome/android/java/res/layout/page_info.xml
54
chrome/android/java/res/layout/website_settings.xml → chrome/android/java/res/layout/page_info.xml
@ -19,11 +19,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="12dp"
|
||||
android:paddingEnd="@dimen/website_settings_popup_padding_sides"
|
||||
android:paddingStart="@dimen/website_settings_popup_padding_sides" >
|
||||
android:paddingEnd="@dimen/page_info_popup_padding_sides"
|
||||
android:paddingStart="@dimen/page_info_popup_padding_sides" >
|
||||
|
||||
<view class="org.chromium.chrome.browser.page_info.WebsiteSettingsPopup$ElidedUrlTextView"
|
||||
android:id="@+id/website_settings_url"
|
||||
android:id="@+id/page_info_url"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
@ -34,36 +34,36 @@
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/website_settings_connection_summary"
|
||||
android:id="@+id/page_info_connection_summary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:lineSpacingExtra="3dp"
|
||||
android:paddingTop="16dp"
|
||||
android:textColor="@color/website_settings_popup_text"
|
||||
android:textColor="@color/page_info_popup_text"
|
||||
android:textSize="16sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/website_settings_connection_message"
|
||||
android:id="@+id/page_info_connection_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:lineSpacingExtra="3dp"
|
||||
android:paddingTop="8dp"
|
||||
android:textColor="@color/website_settings_popup_text"
|
||||
android:textColor="@color/page_info_popup_text"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<org.chromium.ui.widget.ButtonCompat
|
||||
android:id="@+id/website_settings_instant_app_button"
|
||||
android:id="@+id/page_info_instant_app_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:layout_marginEnd="@dimen/website_settings_popup_padding_sides"
|
||||
android:layout_marginStart="@dimen/website_settings_popup_padding_sides"
|
||||
android:layout_marginEnd="@dimen/page_info_popup_padding_sides"
|
||||
android:layout_marginStart="@dimen/page_info_popup_padding_sides"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:paddingEnd="@dimen/website_settings_popup_button_padding_sides"
|
||||
android:paddingStart="@dimen/website_settings_popup_button_padding_sides"
|
||||
android:paddingEnd="@dimen/page_info_popup_button_padding_sides"
|
||||
android:paddingStart="@dimen/page_info_popup_button_padding_sides"
|
||||
android:text="@string/page_info_instant_app_button"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@android:color/white"
|
||||
@ -71,38 +71,38 @@
|
||||
chrome:buttonColor="@color/app_banner_install_button_bg" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/website_settings_permissions_list"
|
||||
android:id="@+id/page_info_permissions_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/website_settings_popup_padding_sides"
|
||||
android:paddingEnd="@dimen/website_settings_popup_padding_sides" >
|
||||
android:paddingStart="@dimen/page_info_popup_padding_sides"
|
||||
android:paddingEnd="@dimen/page_info_popup_padding_sides" >
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/website_settings_site_settings_button"
|
||||
android:id="@+id/page_info_site_settings_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/website_settings_popup_button_height"
|
||||
android:layout_height="@dimen/page_info_popup_button_height"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginEnd="@dimen/website_settings_popup_padding_sides"
|
||||
android:layout_marginStart="@dimen/website_settings_popup_padding_sides"
|
||||
android:layout_marginEnd="@dimen/page_info_popup_padding_sides"
|
||||
android:layout_marginStart="@dimen/page_info_popup_padding_sides"
|
||||
android:layout_marginTop="8dp"
|
||||
android:paddingEnd="@dimen/website_settings_popup_button_padding_sides"
|
||||
android:paddingStart="@dimen/website_settings_popup_button_padding_sides"
|
||||
android:paddingEnd="@dimen/page_info_popup_button_padding_sides"
|
||||
android:paddingStart="@dimen/page_info_popup_button_padding_sides"
|
||||
android:text="@string/page_info_site_settings_button"
|
||||
android:textColor="@color/light_active_color"
|
||||
style="@style/ButtonCompatBorderless" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/website_settings_open_online_button"
|
||||
android:id="@+id/page_info_open_online_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/website_settings_popup_button_height"
|
||||
android:layout_height="@dimen/page_info_popup_button_height"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginEnd="@dimen/website_settings_popup_padding_sides"
|
||||
android:layout_marginStart="@dimen/website_settings_popup_padding_sides"
|
||||
android:layout_marginEnd="@dimen/page_info_popup_padding_sides"
|
||||
android:layout_marginStart="@dimen/page_info_popup_padding_sides"
|
||||
android:layout_marginTop="8dp"
|
||||
android:paddingEnd="@dimen/website_settings_popup_button_padding_sides"
|
||||
android:paddingStart="@dimen/website_settings_popup_button_padding_sides"
|
||||
android:paddingEnd="@dimen/page_info_popup_button_padding_sides"
|
||||
android:paddingStart="@dimen/page_info_popup_button_padding_sides"
|
||||
android:text="@string/page_info_open_online_button"
|
||||
android:textColor="@color/light_active_color"
|
||||
style="@style/ButtonCompatBorderless" />
|
@ -4,34 +4,34 @@
|
||||
found in the LICENSE file. -->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/website_settings_permission_row"
|
||||
android:id="@+id/page_info_permission_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="12dp" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/website_settings_permission_icon"
|
||||
android:layout_width="@dimen/website_settings_popup_permission_icon_size"
|
||||
android:layout_height="@dimen/website_settings_popup_permission_icon_size"
|
||||
android:id="@+id/page_info_permission_icon"
|
||||
android:layout_width="@dimen/page_info_popup_permission_icon_size"
|
||||
android:layout_height="@dimen/page_info_popup_permission_icon_size"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/website_settings_permission_status"
|
||||
android:id="@+id/page_info_permission_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toEndOf="@id/website_settings_permission_icon"
|
||||
android:textColor="@color/website_settings_popup_text"
|
||||
android:layout_toEndOf="@id/page_info_permission_icon"
|
||||
android:textColor="@color/page_info_popup_text"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/website_settings_permission_unavailable_message"
|
||||
android:id="@+id/page_info_permission_unavailable_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/website_settings_permission_status"
|
||||
android:layout_toEndOf="@id/website_settings_permission_icon"
|
||||
android:layout_below="@id/page_info_permission_status"
|
||||
android:layout_toEndOf="@id/page_info_permission_icon"
|
||||
android:lineSpacingExtra="6dp"
|
||||
android:textColor="@color/website_settings_popup_text_link"
|
||||
android:textColor="@color/page_info_popup_text_link"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
@ -53,9 +53,9 @@
|
||||
<color name="connection_info_popup_reset_cert_decisions_button">#000000</color>
|
||||
<color name="connection_info_popup_text">#444444</color>
|
||||
|
||||
<!-- Website Settings Popup colors -->
|
||||
<color name="website_settings_popup_text">#444444</color>
|
||||
<color name="website_settings_popup_text_link">#4285f4</color>
|
||||
<!-- Page Info Popup colors -->
|
||||
<color name="page_info_popup_text">#444444</color>
|
||||
<color name="page_info_popup_text_link">#4285f4</color>
|
||||
|
||||
<!-- URL Emphasizer colors -->
|
||||
<color name="url_emphasis_non_emphasized_text">#80333333</color>
|
||||
|
@ -8,11 +8,11 @@
|
||||
<dimen name="connection_info_padding_wide">24dp</dimen>
|
||||
<dimen name="connection_info_padding_thin">16dp</dimen>
|
||||
|
||||
<!-- Website Settings Popup Dimensions -->
|
||||
<dimen name="website_settings_popup_padding_sides">16dp</dimen>
|
||||
<dimen name="website_settings_popup_button_height">36dp</dimen>
|
||||
<dimen name="website_settings_popup_button_padding_sides">8dp</dimen>
|
||||
<dimen name="website_settings_popup_permission_icon_size">24dp</dimen>
|
||||
<!-- Page Info Popup Dimensions -->
|
||||
<dimen name="page_info_popup_padding_sides">16dp</dimen>
|
||||
<dimen name="page_info_popup_button_height">36dp</dimen>
|
||||
<dimen name="page_info_popup_button_padding_sides">8dp</dimen>
|
||||
<dimen name="page_info_popup_permission_icon_size">24dp</dimen>
|
||||
|
||||
<!-- Accessibility tab switcher -->
|
||||
<dimen name="accessibility_tab_height">65dp</dimen>
|
||||
|
@ -100,7 +100,7 @@ import org.chromium.chrome.browser.ntp.NewTabPageUma;
|
||||
import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
|
||||
import org.chromium.chrome.browser.offlinepages.OfflinePageUtils;
|
||||
import org.chromium.chrome.browser.omaha.UpdateMenuItemHelper;
|
||||
import org.chromium.chrome.browser.page_info.WebsiteSettingsPopup;
|
||||
import org.chromium.chrome.browser.page_info.PageInfoPopup;
|
||||
import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomizations;
|
||||
import org.chromium.chrome.browser.physicalweb.PhysicalWebShareActivity;
|
||||
import org.chromium.chrome.browser.preferences.ChromePreferenceManager;
|
||||
@ -1837,8 +1837,7 @@ public abstract class ChromeActivity extends AsyncInitializationActivity
|
||||
RecordUserAction.record("MobileMenuReload");
|
||||
}
|
||||
} else if (id == R.id.info_menu_id) {
|
||||
WebsiteSettingsPopup.show(
|
||||
this, currentTab, null, WebsiteSettingsPopup.OPENED_FROM_MENU);
|
||||
PageInfoPopup.show(this, currentTab, null, PageInfoPopup.OPENED_FROM_MENU);
|
||||
} else if (id == R.id.open_history_menu_id) {
|
||||
if (NewTabPage.isNTPUrl(currentTab.getUrl())) {
|
||||
NewTabPageUma.recordAction(NewTabPageUma.ACTION_OPENED_HISTORY_MANAGER);
|
||||
|
@ -58,7 +58,7 @@ import org.chromium.chrome.browser.fullscreen.BrowserStateBrowserControlsVisibil
|
||||
import org.chromium.chrome.browser.gsa.GSAState;
|
||||
import org.chromium.chrome.browser.metrics.PageLoadMetrics;
|
||||
import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings;
|
||||
import org.chromium.chrome.browser.page_info.WebsiteSettingsPopup;
|
||||
import org.chromium.chrome.browser.page_info.PageInfoPopup;
|
||||
import org.chromium.chrome.browser.rappor.RapporServiceBridge;
|
||||
import org.chromium.chrome.browser.tab.EmptyTabObserver;
|
||||
import org.chromium.chrome.browser.tab.Tab;
|
||||
@ -902,10 +902,8 @@ public class CustomTabActivity extends ChromeActivity {
|
||||
return true;
|
||||
} else if (id == R.id.info_menu_id) {
|
||||
if (getTabModelSelector().getCurrentTab() == null) return false;
|
||||
WebsiteSettingsPopup.show(
|
||||
this, getTabModelSelector().getCurrentTab(),
|
||||
getToolbarManager().getContentPublisher(),
|
||||
WebsiteSettingsPopup.OPENED_FROM_MENU);
|
||||
PageInfoPopup.show(this, getTabModelSelector().getCurrentTab(),
|
||||
getToolbarManager().getContentPublisher(), PageInfoPopup.OPENED_FROM_MENU);
|
||||
return true;
|
||||
}
|
||||
return super.onMenuOrKeyboardAction(id, fromMenu);
|
||||
|
@ -66,7 +66,7 @@ import org.chromium.chrome.browser.omnibox.OmniboxResultsAdapter.OmniboxSuggesti
|
||||
import org.chromium.chrome.browser.omnibox.VoiceSuggestionProvider.VoiceResult;
|
||||
import org.chromium.chrome.browser.omnibox.geo.GeolocationHeader;
|
||||
import org.chromium.chrome.browser.omnibox.geo.GeolocationSnackbarController;
|
||||
import org.chromium.chrome.browser.page_info.WebsiteSettingsPopup;
|
||||
import org.chromium.chrome.browser.page_info.PageInfoPopup;
|
||||
import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager;
|
||||
import org.chromium.chrome.browser.profiles.Profile;
|
||||
import org.chromium.chrome.browser.search_engines.TemplateUrlService;
|
||||
@ -1895,8 +1895,8 @@ public class LocationBarLayout extends FrameLayout
|
||||
if (currentTab != null && currentTab.getWebContents() != null) {
|
||||
Activity activity = currentTab.getWindowAndroid().getActivity().get();
|
||||
if (activity != null) {
|
||||
WebsiteSettingsPopup.show(
|
||||
activity, currentTab, null, WebsiteSettingsPopup.OPENED_FROM_TOOLBAR);
|
||||
PageInfoPopup.show(
|
||||
activity, currentTab, null, PageInfoPopup.OPENED_FROM_TOOLBAR);
|
||||
}
|
||||
}
|
||||
} else if (v == mMicButton) {
|
||||
|
@ -31,7 +31,7 @@ import org.chromium.content_public.browser.WebContents;
|
||||
import org.chromium.content_public.browser.WebContentsObserver;
|
||||
|
||||
/**
|
||||
* Java side of Android implementation of the website settings UI.
|
||||
* Java side of Android implementation of the page info UI.
|
||||
*/
|
||||
public class ConnectionInfoPopup implements OnClickListener {
|
||||
private static final String TAG = "ConnectionInfoPopup";
|
||||
@ -145,7 +145,7 @@ public class ConnectionInfoPopup implements OnClickListener {
|
||||
mCertificateViewer = new TextView(mContext);
|
||||
mCertificateViewer.setText(label);
|
||||
mCertificateViewer.setTextColor(ApiCompatibilityUtils.getColor(
|
||||
mContext.getResources(), R.color.website_settings_popup_text_link));
|
||||
mContext.getResources(), R.color.page_info_popup_text_link));
|
||||
mCertificateViewer.setTextSize(DESCRIPTION_TEXT_SIZE_SP);
|
||||
mCertificateViewer.setOnClickListener(this);
|
||||
mCertificateViewer.setPadding(0, mPaddingThin, 0, 0);
|
||||
@ -180,7 +180,7 @@ public class ConnectionInfoPopup implements OnClickListener {
|
||||
mLinkUrl = HELP_URL;
|
||||
mMoreInfoLink.setText(linkText);
|
||||
mMoreInfoLink.setTextColor(ApiCompatibilityUtils.getColor(
|
||||
mContext.getResources(), R.color.website_settings_popup_text_link));
|
||||
mContext.getResources(), R.color.page_info_popup_text_link));
|
||||
mMoreInfoLink.setTextSize(DESCRIPTION_TEXT_SIZE_SP);
|
||||
mMoreInfoLink.setPadding(0, mPaddingThin, 0, 0);
|
||||
mMoreInfoLink.setOnClickListener(this);
|
||||
|
@ -86,11 +86,9 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Java side of Android implementation of the website settings UI.
|
||||
* TODO(sashab): Rename this, and all its resources, to PageInfo* and page_info_* instead of
|
||||
* WebsiteSettings* and website_settings_*. Do this on the C++ side as well.
|
||||
* Java side of Android implementation of the page info UI.
|
||||
*/
|
||||
public class WebsiteSettingsPopup implements OnClickListener {
|
||||
public class PageInfoPopup implements OnClickListener {
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({OPENED_FROM_MENU, OPENED_FROM_TOOLBAR})
|
||||
private @interface OpenedFromSource {}
|
||||
@ -247,9 +245,9 @@ public class WebsiteSettingsPopup implements OnClickListener {
|
||||
private final Tab mTab;
|
||||
|
||||
// A pointer to the C++ object for this UI.
|
||||
private long mNativeWebsiteSettingsPopup;
|
||||
private long mNativePageInfoPopup;
|
||||
|
||||
// The outer container, filled with the layout from website_settings.xml.
|
||||
// The outer container, filled with the layout from page_info.xml.
|
||||
private final LinearLayout mContainer;
|
||||
|
||||
// UI elements in the dialog.
|
||||
@ -297,14 +295,14 @@ public class WebsiteSettingsPopup implements OnClickListener {
|
||||
private Intent mInstantAppIntent;
|
||||
|
||||
/**
|
||||
* Creates the WebsiteSettingsPopup, but does not display it. Also initializes the corresponding
|
||||
* Creates the PageInfoPopup, but does not display it. Also initializes the corresponding
|
||||
* C++ object and saves a pointer to it.
|
||||
* @param activity Activity which is used for showing a popup.
|
||||
* @param tab Tab for which the pop up is shown.
|
||||
* @param offlinePageCreationDate Date when the offline page was created.
|
||||
* @param publisher The name of the content publisher, if any.
|
||||
*/
|
||||
private WebsiteSettingsPopup(Activity activity, Tab tab, String offlinePageCreationDate,
|
||||
private PageInfoPopup(Activity activity, Tab tab, String offlinePageCreationDate,
|
||||
String publisher) {
|
||||
mContext = activity;
|
||||
mTab = tab;
|
||||
@ -316,7 +314,7 @@ public class WebsiteSettingsPopup implements OnClickListener {
|
||||
|
||||
// Find the container and all it's important subviews.
|
||||
mContainer = (LinearLayout) LayoutInflater.from(mContext).inflate(
|
||||
R.layout.website_settings, null);
|
||||
R.layout.page_info, null);
|
||||
mContainer.setVisibility(View.INVISIBLE);
|
||||
mContainer.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
|
||||
@Override
|
||||
@ -330,7 +328,7 @@ public class WebsiteSettingsPopup implements OnClickListener {
|
||||
}
|
||||
});
|
||||
|
||||
mUrlTitle = (ElidedUrlTextView) mContainer.findViewById(R.id.website_settings_url);
|
||||
mUrlTitle = (ElidedUrlTextView) mContainer.findViewById(R.id.page_info_url);
|
||||
mUrlTitle.setProfile(mTab.getProfile());
|
||||
mUrlTitle.setOnClickListener(this);
|
||||
// Long press the url text to copy it to the clipboard.
|
||||
@ -347,22 +345,22 @@ public class WebsiteSettingsPopup implements OnClickListener {
|
||||
});
|
||||
|
||||
mConnectionSummary = (TextView) mContainer
|
||||
.findViewById(R.id.website_settings_connection_summary);
|
||||
.findViewById(R.id.page_info_connection_summary);
|
||||
mConnectionMessage = (TextView) mContainer
|
||||
.findViewById(R.id.website_settings_connection_message);
|
||||
.findViewById(R.id.page_info_connection_message);
|
||||
mPermissionsList = (LinearLayout) mContainer
|
||||
.findViewById(R.id.website_settings_permissions_list);
|
||||
.findViewById(R.id.page_info_permissions_list);
|
||||
|
||||
mInstantAppButton =
|
||||
(Button) mContainer.findViewById(R.id.website_settings_instant_app_button);
|
||||
(Button) mContainer.findViewById(R.id.page_info_instant_app_button);
|
||||
mInstantAppButton.setOnClickListener(this);
|
||||
|
||||
mSiteSettingsButton =
|
||||
(Button) mContainer.findViewById(R.id.website_settings_site_settings_button);
|
||||
(Button) mContainer.findViewById(R.id.page_info_site_settings_button);
|
||||
mSiteSettingsButton.setOnClickListener(this);
|
||||
|
||||
mOpenOnlineButton =
|
||||
(Button) mContainer.findViewById(R.id.website_settings_open_online_button);
|
||||
(Button) mContainer.findViewById(R.id.page_info_open_online_button);
|
||||
mOpenOnlineButton.setOnClickListener(this);
|
||||
|
||||
mDisplayedPermissions = new ArrayList<PageInfoPermissionEntry>();
|
||||
@ -451,7 +449,7 @@ public class WebsiteSettingsPopup implements OnClickListener {
|
||||
}
|
||||
|
||||
// This needs to come after other member initialization.
|
||||
mNativeWebsiteSettingsPopup = nativeInit(this, mTab.getWebContents());
|
||||
mNativePageInfoPopup = nativeInit(this, mTab.getWebContents());
|
||||
final WebContentsObserver webContentsObserver =
|
||||
new WebContentsObserver(mTab.getWebContents()) {
|
||||
@Override
|
||||
@ -480,10 +478,10 @@ public class WebsiteSettingsPopup implements OnClickListener {
|
||||
mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
assert mNativeWebsiteSettingsPopup != 0;
|
||||
assert mNativePageInfoPopup != 0;
|
||||
webContentsObserver.destroy();
|
||||
nativeDestroy(mNativeWebsiteSettingsPopup);
|
||||
mNativeWebsiteSettingsPopup = 0;
|
||||
nativeDestroy(mNativePageInfoPopup);
|
||||
mNativePageInfoPopup = 0;
|
||||
}
|
||||
});
|
||||
|
||||
@ -564,10 +562,10 @@ public class WebsiteSettingsPopup implements OnClickListener {
|
||||
|
||||
private void addReadOnlyPermissionSection(PageInfoPermissionEntry permission) {
|
||||
View permissionRow = LayoutInflater.from(mContext).inflate(
|
||||
R.layout.website_settings_permission_row, null);
|
||||
R.layout.page_info_permission_row, null);
|
||||
|
||||
ImageView permissionIcon = (ImageView) permissionRow.findViewById(
|
||||
R.id.website_settings_permission_icon);
|
||||
R.id.page_info_permission_icon);
|
||||
permissionIcon.setImageResource(getImageResourceForPermission(permission.type));
|
||||
|
||||
if (permission.setting == ContentSetting.ALLOW) {
|
||||
@ -589,20 +587,20 @@ public class WebsiteSettingsPopup implements OnClickListener {
|
||||
|
||||
if (warningTextResource != 0) {
|
||||
TextView permissionUnavailable = (TextView) permissionRow.findViewById(
|
||||
R.id.website_settings_permission_unavailable_message);
|
||||
R.id.page_info_permission_unavailable_message);
|
||||
permissionUnavailable.setVisibility(View.VISIBLE);
|
||||
permissionUnavailable.setText(warningTextResource);
|
||||
|
||||
permissionIcon.setImageResource(R.drawable.exclamation_triangle);
|
||||
permissionIcon.setColorFilter(ApiCompatibilityUtils.getColor(
|
||||
mContext.getResources(), R.color.website_settings_popup_text_link));
|
||||
mContext.getResources(), R.color.page_info_popup_text_link));
|
||||
|
||||
permissionRow.setOnClickListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
TextView permissionStatus = (TextView) permissionRow.findViewById(
|
||||
R.id.website_settings_permission_status);
|
||||
R.id.page_info_permission_status);
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||
SpannableString nameString = new SpannableString(permission.name);
|
||||
final StyleSpan boldSpan = new StyleSpan(android.graphics.Typeface.BOLD);
|
||||
@ -671,7 +669,7 @@ public class WebsiteSettingsPopup implements OnClickListener {
|
||||
mContext.getString(R.string.page_info_details_link));
|
||||
final ForegroundColorSpan blueSpan = new ForegroundColorSpan(
|
||||
ApiCompatibilityUtils.getColor(mContext.getResources(),
|
||||
R.color.website_settings_popup_text_link));
|
||||
R.color.page_info_popup_text_link));
|
||||
detailsText.setSpan(
|
||||
blueSpan, 0, detailsText.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
messageBuilder.append(detailsText);
|
||||
@ -681,7 +679,7 @@ public class WebsiteSettingsPopup implements OnClickListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the WebsiteSettingsPopup.
|
||||
* Displays the PageInfoPopup.
|
||||
*/
|
||||
private void showDialog() {
|
||||
if (!DeviceFormFactor.isTablet(mContext)) {
|
||||
@ -735,11 +733,11 @@ public class WebsiteSettingsPopup implements OnClickListener {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (view == mSiteSettingsButton) {
|
||||
// Delay while the WebsiteSettingsPopup closes.
|
||||
// Delay while the PageInfoPopup closes.
|
||||
runAfterDismiss(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
recordAction(WebsiteSettingsAction.WEBSITE_SETTINGS_SITE_SETTINGS_OPENED);
|
||||
recordAction(PageInfoAction.PAGE_INFO_SITE_SETTINGS_OPENED);
|
||||
Bundle fragmentArguments =
|
||||
SingleWebsitePreferences.createFragmentArgsForSite(mFullUrl);
|
||||
fragmentArguments.putParcelable(SingleWebsitePreferences.EXTRA_WEB_CONTENTS,
|
||||
@ -767,12 +765,12 @@ public class WebsiteSettingsPopup implements OnClickListener {
|
||||
public void run() {
|
||||
if (!mTab.getWebContents().isDestroyed()) {
|
||||
recordAction(
|
||||
WebsiteSettingsAction.WEBSITE_SETTINGS_SECURITY_DETAILS_OPENED);
|
||||
PageInfoAction.PAGE_INFO_SECURITY_DETAILS_OPENED);
|
||||
ConnectionInfoPopup.show(mContext, mTab.getWebContents());
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (view.getId() == R.id.website_settings_permission_row) {
|
||||
} else if (view.getId() == R.id.page_info_permission_row) {
|
||||
final Object intentOverride = view.getTag(R.id.permission_intent_override);
|
||||
|
||||
if (intentOverride == null && mWindowAndroid != null) {
|
||||
@ -926,8 +924,8 @@ public class WebsiteSettingsPopup implements OnClickListener {
|
||||
}
|
||||
|
||||
private void recordAction(int action) {
|
||||
if (mNativeWebsiteSettingsPopup != 0) {
|
||||
nativeRecordWebsiteSettingsAction(mNativeWebsiteSettingsPopup, action);
|
||||
if (mNativePageInfoPopup != 0) {
|
||||
nativeRecordPageInfoAction(mNativePageInfoPopup, action);
|
||||
}
|
||||
}
|
||||
|
||||
@ -939,7 +937,7 @@ public class WebsiteSettingsPopup implements OnClickListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a WebsiteSettings dialog for the provided Tab. The popup adds itself to the view
|
||||
* Shows a PageInfo dialog for the provided Tab. The popup adds itself to the view
|
||||
* hierarchy which owns the reference while it's visible.
|
||||
*
|
||||
* @param activity Activity which is used for launching a dialog.
|
||||
@ -968,13 +966,13 @@ public class WebsiteSettingsPopup implements OnClickListener {
|
||||
offlinePageCreationDate = df.format(creationDate);
|
||||
}
|
||||
|
||||
new WebsiteSettingsPopup(activity, tab, offlinePageCreationDate, contentPublisher);
|
||||
new PageInfoPopup(activity, tab, offlinePageCreationDate, contentPublisher);
|
||||
}
|
||||
|
||||
private static native long nativeInit(WebsiteSettingsPopup popup, WebContents webContents);
|
||||
private static native long nativeInit(PageInfoPopup popup, WebContents webContents);
|
||||
|
||||
private native void nativeDestroy(long nativeWebsiteSettingsPopupAndroid);
|
||||
private native void nativeDestroy(long nativePageInfoPopupAndroid);
|
||||
|
||||
private native void nativeRecordWebsiteSettingsAction(
|
||||
long nativeWebsiteSettingsPopupAndroid, int action);
|
||||
private native void nativeRecordPageInfoAction(
|
||||
long nativePageInfoPopupAndroid, int action);
|
||||
}
|
@ -46,7 +46,7 @@ import org.chromium.chrome.browser.omnibox.LocationBar;
|
||||
import org.chromium.chrome.browser.omnibox.LocationBarLayout;
|
||||
import org.chromium.chrome.browser.omnibox.UrlBar;
|
||||
import org.chromium.chrome.browser.omnibox.UrlFocusChangeListener;
|
||||
import org.chromium.chrome.browser.page_info.WebsiteSettingsPopup;
|
||||
import org.chromium.chrome.browser.page_info.PageInfoPopup;
|
||||
import org.chromium.chrome.browser.profiles.Profile;
|
||||
import org.chromium.chrome.browser.tab.Tab;
|
||||
import org.chromium.chrome.browser.util.ColorUtils;
|
||||
@ -183,8 +183,8 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
|
||||
if (activity == null) return;
|
||||
String publisherName = mState == STATE_TITLE_ONLY
|
||||
? parsePublisherNameFromUrl(currentTab.getUrl()) : null;
|
||||
WebsiteSettingsPopup.show(activity, currentTab, publisherName,
|
||||
WebsiteSettingsPopup.OPENED_FROM_TOOLBAR);
|
||||
PageInfoPopup.show(
|
||||
activity, currentTab, publisherName, PageInfoPopup.OPENED_FROM_TOOLBAR);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1623,7 +1623,7 @@ To obtain new licenses, connect to the internet and play your downloaded content
|
||||
Still adding previous site
|
||||
</message>
|
||||
|
||||
<!-- WebsiteSettingsPopup (PageInfo dialog) -->
|
||||
<!-- PageInfoPopup (PageInfo dialog) -->
|
||||
<message name="IDS_PAGE_INFO_SITE_SETTINGS_BUTTON" desc="Text in the button that opens a website's Site Settings from the Page Info dialog.">
|
||||
Site Settings
|
||||
</message>
|
||||
|
@ -696,7 +696,7 @@ chrome_java_sources = [
|
||||
"java/src/org/chromium/chrome/browser/page_info/CertificateChainHelper.java",
|
||||
"java/src/org/chromium/chrome/browser/page_info/CertificateViewer.java",
|
||||
"java/src/org/chromium/chrome/browser/page_info/ConnectionInfoPopup.java",
|
||||
"java/src/org/chromium/chrome/browser/page_info/WebsiteSettingsPopup.java",
|
||||
"java/src/org/chromium/chrome/browser/page_info/PageInfoPopup.java",
|
||||
"java/src/org/chromium/chrome/browser/partnerbookmarks/PartnerBookmarksProviderIterator.java",
|
||||
"java/src/org/chromium/chrome/browser/partnerbookmarks/PartnerBookmarksReader.java",
|
||||
"java/src/org/chromium/chrome/browser/partnerbookmarks/PartnerBookmarksShim.java",
|
||||
|
@ -223,137 +223,137 @@ are declared in build/common.gypi.
|
||||
</message>
|
||||
</if>
|
||||
|
||||
<!-- Website Settings UI -->
|
||||
<message name="IDS_WEBSITE_SETTINGS_TITLE" desc="Title for Website Settings dialog.">
|
||||
<!-- Page Info UI -->
|
||||
<message name="IDS_PAGE_INFO_TITLE" desc="Title for Page Info dialog.">
|
||||
Manage sites
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_INFOBAR_TEXT" desc="The string shown in the infobar after the user has changed site permissions settings, reminding them to reload the page in order for the new settings to take effect.">
|
||||
<message name="IDS_PAGE_INFO_INFOBAR_TEXT" desc="The string shown in the infobar after the user has changed site permissions settings, reminding them to reload the page in order for the new settings to take effect.">
|
||||
New site permissions settings will take effect after reloading the page.
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_INFOBAR_BUTTON" desc="The string used in the infobar button allowing the user to reload the page directly from the infobar.">
|
||||
<message name="IDS_PAGE_INFO_INFOBAR_BUTTON" desc="The string used in the infobar button allowing the user to reload the page directly from the infobar.">
|
||||
Reload
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ALLOWED_BY_POLICY" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to allow and managed by policy.">
|
||||
<message name="IDS_PAGE_INFO_BUTTON_TEXT_ALLOWED_BY_POLICY" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to allow and managed by policy.">
|
||||
Allow (by policy)
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_BUTTON_TEXT_BLOCKED_BY_POLICY" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to block and managed by policy.">
|
||||
<message name="IDS_PAGE_INFO_BUTTON_TEXT_BLOCKED_BY_POLICY" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to block and managed by policy.">
|
||||
Block (by policy)
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ASK_BY_POLICY" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to ask and managed by policy.">
|
||||
<message name="IDS_PAGE_INFO_BUTTON_TEXT_ASK_BY_POLICY" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to ask and managed by policy.">
|
||||
Ask (by policy)
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ALLOWED_BY_EXTENSION" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to allow and managed by an extension.">
|
||||
<message name="IDS_PAGE_INFO_BUTTON_TEXT_ALLOWED_BY_EXTENSION" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to allow and managed by an extension.">
|
||||
Allow (by extension)
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_BUTTON_TEXT_BLOCKED_BY_EXTENSION" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to block and managed by an extension.">
|
||||
<message name="IDS_PAGE_INFO_BUTTON_TEXT_BLOCKED_BY_EXTENSION" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to block and managed by an extension.">
|
||||
Block (by extension)
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ALLOWED_BY_USER" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button was explicitly set to allow by the user.">
|
||||
<message name="IDS_PAGE_INFO_BUTTON_TEXT_ALLOWED_BY_USER" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button was explicitly set to allow by the user.">
|
||||
Allow
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_BUTTON_TEXT_BLOCKED_BY_USER" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button was explicitly set to block by the user.">
|
||||
<message name="IDS_PAGE_INFO_BUTTON_TEXT_BLOCKED_BY_USER" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button was explicitly set to block by the user.">
|
||||
Block
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ASK_BY_USER" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button was explicitly set to ask by the user.">
|
||||
<message name="IDS_PAGE_INFO_BUTTON_TEXT_ASK_BY_USER" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button was explicitly set to ask by the user.">
|
||||
Ask
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_BUTTON_TEXT_DETECT_IMPORTANT_CONTENT_BY_USER" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button was explicitly set to detect important content by the user.">
|
||||
<message name="IDS_PAGE_INFO_BUTTON_TEXT_DETECT_IMPORTANT_CONTENT_BY_USER" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button was explicitly set to detect important content by the user.">
|
||||
Detect
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ALLOWED_BY_DEFAULT" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to the default setting and the default settings is allow.">
|
||||
<message name="IDS_PAGE_INFO_BUTTON_TEXT_ALLOWED_BY_DEFAULT" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to the default setting and the default settings is allow.">
|
||||
Allow (default)
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_BUTTON_TEXT_BLOCKED_BY_DEFAULT" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to the default setting and the default settings is block.">
|
||||
<message name="IDS_PAGE_INFO_BUTTON_TEXT_BLOCKED_BY_DEFAULT" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to the default setting and the default settings is block.">
|
||||
Block (default)
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ASK_BY_DEFAULT" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to the default setting and the default settings is ask.">
|
||||
<message name="IDS_PAGE_INFO_BUTTON_TEXT_ASK_BY_DEFAULT" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to the default setting and the default settings is ask.">
|
||||
Ask (default)
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_BUTTON_TEXT_DETECT_IMPORTANT_CONTENT_BY_DEFAULT" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to the default setting and the default settings is detect important content.">
|
||||
<message name="IDS_PAGE_INFO_BUTTON_TEXT_DETECT_IMPORTANT_CONTENT_BY_DEFAULT" desc="The Website Settings popup contains several buttons for opening dropdown menus and changing site permissions. This is the text of such a button if the permission controlled by the button is set to the default setting and the default settings is detect important content.">
|
||||
Detect (default)
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_USB_DEVICE_LABEL" desc="The label used to describe a USB device that the user has granted the site permission to access.">
|
||||
<message name="IDS_PAGE_INFO_USB_DEVICE_LABEL" desc="The label used to describe a USB device that the user has granted the site permission to access.">
|
||||
<ph name="DEVICE_NAME">$1<ex>Android Phone</ex></ph>
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_DELETE_USB_DEVICE" desc="The tooltip displayed when hovering over the button that will remove permission to access a USB device that the user previously granted to the site.">
|
||||
<message name="IDS_PAGE_INFO_DELETE_USB_DEVICE" desc="The tooltip displayed when hovering over the button that will remove permission to access a USB device that the user previously granted to the site.">
|
||||
Revoke access
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_TITLE_SITE_PERMISSIONS" desc="Title of the permissions section of the website settings popup.">
|
||||
<message name="IDS_PAGE_INFO_TITLE_SITE_PERMISSIONS" desc="Title of the permissions section of the page info popup.">
|
||||
Permissions
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_TITLE_SITE_DATA" desc="Title of the site data section of the website settings popup.">
|
||||
<message name="IDS_PAGE_INFO_TITLE_SITE_DATA" desc="Title of the site data section of the page info popup.">
|
||||
Cookies
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_PERMISSION_ALLOW" desc="The label used in the permissions dropdowns for the option that grants a permissions.">
|
||||
<message name="IDS_PAGE_INFO_PERMISSION_ALLOW" desc="The label used in the permissions dropdowns for the option that grants a permissions.">
|
||||
allow
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_PERMISSION_BLOCK" desc="The label used in the permissions dropdowns for the option that denies a permissions. ">
|
||||
<message name="IDS_PAGE_INFO_PERMISSION_BLOCK" desc="The label used in the permissions dropdowns for the option that denies a permissions. ">
|
||||
block
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_PERMISSION_ASK" desc="The label used in the permissions dropdowns for the option that makes the browser asks for permission. ">
|
||||
<message name="IDS_PAGE_INFO_PERMISSION_ASK" desc="The label used in the permissions dropdowns for the option that makes the browser asks for permission. ">
|
||||
ask
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_TYPE_AUTOPLAY" desc="The label used for the autoplay permission controls in the Website Settings popup.">
|
||||
<message name="IDS_PAGE_INFO_TYPE_AUTOPLAY" desc="The label used for the autoplay permission controls in the Website Settings popup.">
|
||||
Autoplay
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_TYPE_BACKGROUND_SYNC" desc="The label used for the background sync permission controls in the Website Settings popup.">
|
||||
<message name="IDS_PAGE_INFO_TYPE_BACKGROUND_SYNC" desc="The label used for the background sync permission controls in the Website Settings popup.">
|
||||
Background Sync
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_TYPE_IMAGES" desc="The label used for images permission controls in the Website Settings popup.">
|
||||
<message name="IDS_PAGE_INFO_TYPE_IMAGES" desc="The label used for images permission controls in the Website Settings popup.">
|
||||
Images
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_TYPE_JAVASCRIPT" desc="The label used for JavaScript permission controls in the Website Settings popup.">
|
||||
<message name="IDS_PAGE_INFO_TYPE_JAVASCRIPT" desc="The label used for JavaScript permission controls in the Website Settings popup.">
|
||||
JavaScript
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_TYPE_POPUPS" desc="The label used for popups permission controls in the Website Settings popup.">
|
||||
<message name="IDS_PAGE_INFO_TYPE_POPUPS" desc="The label used for popups permission controls in the Website Settings popup.">
|
||||
Popups
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_TYPE_FLASH" desc="The label used for Flash permissions in the Website Settings popup.">
|
||||
<message name="IDS_PAGE_INFO_TYPE_FLASH" desc="The label used for Flash permissions in the Website Settings popup.">
|
||||
Flash
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_TYPE_LOCATION" desc="The label used for location permission controls in the Website Settings popup.">
|
||||
<message name="IDS_PAGE_INFO_TYPE_LOCATION" desc="The label used for location permission controls in the Website Settings popup.">
|
||||
Location
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_TYPE_NOTIFICATIONS" desc="The label used for notifications permission controls in the Website Settings popup.">
|
||||
<message name="IDS_PAGE_INFO_TYPE_NOTIFICATIONS" desc="The label used for notifications permission controls in the Website Settings popup.">
|
||||
Notifications
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_TYPE_MIC" desc="The label used for the microphone permission controls in the Website Settings popup.">
|
||||
<message name="IDS_PAGE_INFO_TYPE_MIC" desc="The label used for the microphone permission controls in the Website Settings popup.">
|
||||
Microphone
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_TYPE_CAMERA" desc="The label used for the camera permission controls in the Website Settings popup.">
|
||||
<message name="IDS_PAGE_INFO_TYPE_CAMERA" desc="The label used for the camera permission controls in the Website Settings popup.">
|
||||
Camera
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_TYPE_MIDI_SYSEX" desc="The label used for MIDI system exclusive message permission controls in the Website Settings popup.">
|
||||
<message name="IDS_PAGE_INFO_TYPE_MIDI_SYSEX" desc="The label used for MIDI system exclusive message permission controls in the Website Settings popup.">
|
||||
MIDI devices full control
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_TRANSIENT" desc="Text that is displayed temporarily as a large toast on first entering a WebVR page over non-secure transport.">
|
||||
<message name="IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_TRANSIENT" desc="Text that is displayed temporarily as a large toast on first entering a WebVR page over non-secure transport.">
|
||||
Your connection to this site is not private. To exit VR mode at any time, remove headset and press back.
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_PERMANENT" desc="Text that is displayed in a small permanent notification on a WebVR page loaded over non-secure transport. (Should be short, does not need to be a complete sentence.)">
|
||||
<message name="IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_PERMANENT" desc="Text that is displayed in a small permanent notification on a WebVR page loaded over non-secure transport. (Should be short, does not need to be a complete sentence.)">
|
||||
Not secure
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_NUM_COOKIES" desc="The label of the counts for allowed cookies that are in use on the page.">
|
||||
<message name="IDS_PAGE_INFO_NUM_COOKIES" desc="The label of the counts for allowed cookies that are in use on the page.">
|
||||
{NUM_COOKIES, plural, =1 {1 in use} other {# in use}}
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ALLOW" desc="The text of the menu item of a permissions menu on the Website Settings UI that resets the setting to the default setting which is allow.">
|
||||
<message name="IDS_PAGE_INFO_MENU_ITEM_DEFAULT_ALLOW" desc="The text of the menu item of a permissions menu on the Page Info UI that resets the setting to the default setting which is allow.">
|
||||
Use global default (Allow)
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_BLOCK" desc="The text of the menu item of a permissions menu on the Website Settings UI that resets the setting to the default setting which is block.">
|
||||
<message name="IDS_PAGE_INFO_MENU_ITEM_DEFAULT_BLOCK" desc="The text of the menu item of a permissions menu on the Page Info UI that resets the setting to the default setting which is block.">
|
||||
Use global default (Block)
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ASK" desc="The text of the menu item of a permissions menu on the Website Settings UI that reset the setting to the default setting which is ask.">
|
||||
<message name="IDS_PAGE_INFO_MENU_ITEM_DEFAULT_ASK" desc="The text of the menu item of a permissions menu on the Page Info UI that reset the setting to the default setting which is ask.">
|
||||
Use global default (Ask)
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_DETECT_IMPORTANT_CONTENT" desc="The text of the menu item of a permissions menu on the Website Settings UI that reset the setting to the default setting which is detect important content.">
|
||||
<message name="IDS_PAGE_INFO_MENU_ITEM_DEFAULT_DETECT_IMPORTANT_CONTENT" desc="The text of the menu item of a permissions menu on the Page Info UI that reset the setting to the default setting which is detect important content.">
|
||||
Use global default (Detect)
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_MENU_ITEM_ALLOW" desc="The text of the menu item of a permissions menu on the Website Settings UI that sets the setting to allow.">
|
||||
<message name="IDS_PAGE_INFO_MENU_ITEM_ALLOW" desc="The text of the menu item of a permissions menu on the Page Info UI that sets the setting to allow.">
|
||||
Always allow on this site
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_MENU_ITEM_BLOCK" desc="The text of the menu item of a permissions menu on the Website Settings UI that sets the setting to allow.">
|
||||
<message name="IDS_PAGE_INFO_MENU_ITEM_BLOCK" desc="The text of the menu item of a permissions menu on the Page Info UI that sets the setting to allow.">
|
||||
Always block on this site
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_MENU_ITEM_DETECT_IMPORTANT_CONTENT" desc="The text of the menu item of a permissions menu on the Website Settings UI that sets the setting to detect important content.">
|
||||
<message name="IDS_PAGE_INFO_MENU_ITEM_DETECT_IMPORTANT_CONTENT" desc="The text of the menu item of a permissions menu on the Page Info UI that sets the setting to detect important content.">
|
||||
Always detect important content on this site
|
||||
</message>
|
||||
|
||||
|
@ -4113,7 +4113,7 @@ if (is_android) {
|
||||
"../android/java/src/org/chromium/chrome/browser/page_info/CertificateChainHelper.java",
|
||||
"../android/java/src/org/chromium/chrome/browser/page_info/CertificateViewer.java",
|
||||
"../android/java/src/org/chromium/chrome/browser/page_info/ConnectionInfoPopup.java",
|
||||
"../android/java/src/org/chromium/chrome/browser/page_info/WebsiteSettingsPopup.java",
|
||||
"../android/java/src/org/chromium/chrome/browser/page_info/PageInfoPopup.java",
|
||||
"../android/java/src/org/chromium/chrome/browser/partnerbookmarks/PartnerBookmarksReader.java",
|
||||
"../android/java/src/org/chromium/chrome/browser/password_manager/AccountChooserDialog.java",
|
||||
"../android/java/src/org/chromium/chrome/browser/password_manager/AutoSigninFirstRunDialog.java",
|
||||
|
@ -161,7 +161,7 @@
|
||||
#include "chrome/browser/ui/android/page_info/certificate_chain_helper.h"
|
||||
#include "chrome/browser/ui/android/page_info/certificate_viewer_android.h"
|
||||
#include "chrome/browser/ui/android/page_info/connection_info_popup_android.h"
|
||||
#include "chrome/browser/ui/android/page_info/website_settings_popup_android.h"
|
||||
#include "chrome/browser/ui/android/page_info/page_info_popup_android.h"
|
||||
#include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h"
|
||||
#include "chrome/browser/ui/android/ssl_client_certificate_request.h"
|
||||
#include "chrome/browser/ui/android/tab_model/single_tab_model.h"
|
||||
@ -441,8 +441,8 @@ static base::android::RegistrationMethod kChromeRegisteredMethods[] = {
|
||||
{"WebApkUpdateDataFetcher", WebApkUpdateDataFetcher::Register},
|
||||
{"WebContentsFactory", RegisterWebContentsFactory},
|
||||
{"WebsitePreferenceBridge", RegisterWebsitePreferenceBridge},
|
||||
{"WebsiteSettingsPopupAndroid",
|
||||
WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid},
|
||||
{"PageInfoPopupAndroid",
|
||||
PageInfoPopupAndroid::RegisterPageInfoPopupAndroid},
|
||||
#if BUILDFLAG(ENABLE_PRINTING) && !BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
||||
{"PrintingContext",
|
||||
printing::PrintingContextAndroid::RegisterPrintingContext},
|
||||
|
@ -45,7 +45,7 @@ DECLARE_RESOURCE_ID(IDR_ANDROID_INFOBAR_SUBRESOURCE_FILTERING,
|
||||
R.drawable.infobar_subresource_filtering)
|
||||
DECLARE_RESOURCE_ID(IDR_ANDROID_INFOBAR_WARNING, R.drawable.infobar_warning)
|
||||
|
||||
// WebsiteSettingsUI images, used in ConnectionInfoPopup
|
||||
// PageInfoUI images, used in ConnectionInfoPopup
|
||||
// Good:
|
||||
LINK_RESOURCE_ID(IDR_PAGEINFO_GOOD, R.drawable.pageinfo_good)
|
||||
// Warnings:
|
||||
|
@ -295,8 +295,7 @@ SimpleWebViewDialog::GetContentSettingBubbleModelDelegate() {
|
||||
return bubble_model_delegate_.get();
|
||||
}
|
||||
|
||||
void SimpleWebViewDialog::ShowWebsiteSettings(
|
||||
content::WebContents* web_contents) {
|
||||
void SimpleWebViewDialog::ShowPageInfo(content::WebContents* web_contents) {
|
||||
NOTIMPLEMENTED();
|
||||
// TODO (markusheintz@): implement this
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ class SimpleWebViewDialog : public views::ButtonListener,
|
||||
const ToolbarModel* GetToolbarModel() const override;
|
||||
ContentSettingBubbleModelDelegate* GetContentSettingBubbleModelDelegate()
|
||||
override;
|
||||
void ShowWebsiteSettings(content::WebContents* web_contents) override;
|
||||
void ShowPageInfo(content::WebContents* web_contents) override;
|
||||
|
||||
// Implements ChromeToolbarModelDelegate:
|
||||
content::WebContents* GetActiveWebContents() const override;
|
||||
|
@ -116,10 +116,10 @@ split_static_library("ui") {
|
||||
"login/login_interstitial_delegate.h",
|
||||
"navigation_correction_tab_observer.cc",
|
||||
"navigation_correction_tab_observer.h",
|
||||
"page_info/website_settings.cc",
|
||||
"page_info/website_settings.h",
|
||||
"page_info/website_settings_ui.cc",
|
||||
"page_info/website_settings_ui.h",
|
||||
"page_info/page_info.cc",
|
||||
"page_info/page_info.h",
|
||||
"page_info/page_info_ui.cc",
|
||||
"page_info/page_info_ui.h",
|
||||
"passwords/account_avatar_fetcher.cc",
|
||||
"passwords/account_avatar_fetcher.h",
|
||||
"passwords/manage_passwords_state.cc",
|
||||
@ -774,10 +774,10 @@ split_static_library("ui") {
|
||||
"omnibox/chrome_omnibox_navigation_observer.h",
|
||||
"omnibox/clipboard_utils.cc",
|
||||
"omnibox/clipboard_utils.h",
|
||||
"page_info/page_info_infobar_delegate.cc",
|
||||
"page_info/page_info_infobar_delegate.h",
|
||||
"page_info/permission_menu_model.cc",
|
||||
"page_info/permission_menu_model.h",
|
||||
"page_info/website_settings_infobar_delegate.cc",
|
||||
"page_info/website_settings_infobar_delegate.h",
|
||||
"passwords/manage_passwords_bubble_model.cc",
|
||||
"passwords/manage_passwords_bubble_model.h",
|
||||
"passwords/manage_passwords_icon_view.h",
|
||||
@ -1513,11 +1513,11 @@ split_static_library("ui") {
|
||||
"views/page_info/chosen_object_row_observer.h",
|
||||
"views/page_info/non_accessible_image_view.cc",
|
||||
"views/page_info/non_accessible_image_view.h",
|
||||
"views/page_info/page_info_popup_view.cc",
|
||||
"views/page_info/page_info_popup_view.h",
|
||||
"views/page_info/permission_selector_row.cc",
|
||||
"views/page_info/permission_selector_row.h",
|
||||
"views/page_info/permission_selector_row_observer.h",
|
||||
"views/page_info/website_settings_popup_view.cc",
|
||||
"views/page_info/website_settings_popup_view.h",
|
||||
"views/payments/credit_card_editor_view_controller.cc",
|
||||
"views/payments/credit_card_editor_view_controller.h",
|
||||
"views/payments/editor_view_controller.cc",
|
||||
@ -2249,8 +2249,8 @@ split_static_library("ui") {
|
||||
"android/page_info/certificate_viewer_android.h",
|
||||
"android/page_info/connection_info_popup_android.cc",
|
||||
"android/page_info/connection_info_popup_android.h",
|
||||
"android/page_info/website_settings_popup_android.cc",
|
||||
"android/page_info/website_settings_popup_android.h",
|
||||
"android/page_info/page_info_popup_android.cc",
|
||||
"android/page_info/page_info_popup_android.h",
|
||||
"android/simple_message_box_android.cc",
|
||||
"android/snackbars/auto_signin_prompt_controller.cc",
|
||||
"android/snackbars/auto_signin_prompt_controller.h",
|
||||
@ -2847,14 +2847,14 @@ split_static_library("ui") {
|
||||
"cocoa/one_click_signin_dialog_controller.mm",
|
||||
"cocoa/one_click_signin_view_controller.h",
|
||||
"cocoa/one_click_signin_view_controller.mm",
|
||||
"cocoa/page_info/page_info_bubble_controller.h",
|
||||
"cocoa/page_info/page_info_bubble_controller.mm",
|
||||
"cocoa/page_info/page_info_utils_cocoa.h",
|
||||
"cocoa/page_info/page_info_utils_cocoa.mm",
|
||||
"cocoa/page_info/permission_selector_button.h",
|
||||
"cocoa/page_info/permission_selector_button.mm",
|
||||
"cocoa/page_info/split_block_button.h",
|
||||
"cocoa/page_info/split_block_button.mm",
|
||||
"cocoa/page_info/website_settings_bubble_controller.h",
|
||||
"cocoa/page_info/website_settings_bubble_controller.mm",
|
||||
"cocoa/page_info/website_settings_utils_cocoa.h",
|
||||
"cocoa/page_info/website_settings_utils_cocoa.mm",
|
||||
"cocoa/passwords/account_avatar_fetcher_manager.h",
|
||||
"cocoa/passwords/account_avatar_fetcher_manager.mm",
|
||||
"cocoa/passwords/account_chooser_view_controller.h",
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "chrome/browser/infobars/infobar_service.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/ssl/security_state_tab_helper.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings.h"
|
||||
#include "chrome/browser/ui/page_info/page_info.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "components/security_state/core/security_state.h"
|
||||
#include "components/strings/grit/components_strings.h"
|
||||
@ -46,7 +46,7 @@ static jlong Init(JNIEnv* env,
|
||||
|
||||
ConnectionInfoPopupAndroid::ConnectionInfoPopupAndroid(
|
||||
JNIEnv* env,
|
||||
jobject java_website_settings_pop,
|
||||
jobject java_page_info_pop,
|
||||
WebContents* web_contents) {
|
||||
// Important to use GetVisibleEntry to match what's showing in the omnibox.
|
||||
content::NavigationEntry* nav_entry =
|
||||
@ -54,7 +54,7 @@ ConnectionInfoPopupAndroid::ConnectionInfoPopupAndroid(
|
||||
if (nav_entry == nullptr)
|
||||
return;
|
||||
|
||||
popup_jobject_.Reset(env, java_website_settings_pop);
|
||||
popup_jobject_.Reset(env, java_page_info_pop);
|
||||
|
||||
SecurityStateTabHelper* helper =
|
||||
SecurityStateTabHelper::FromWebContents(web_contents);
|
||||
@ -63,7 +63,7 @@ ConnectionInfoPopupAndroid::ConnectionInfoPopupAndroid(
|
||||
security_state::SecurityInfo security_info;
|
||||
helper->GetSecurityInfo(&security_info);
|
||||
|
||||
presenter_.reset(new WebsiteSettings(
|
||||
presenter_.reset(new PageInfo(
|
||||
this, Profile::FromBrowserContext(web_contents->GetBrowserContext()),
|
||||
TabSpecificContentSettings::FromWebContents(web_contents), web_contents,
|
||||
nav_entry->GetURL(), security_info));
|
||||
@ -90,7 +90,7 @@ void ConnectionInfoPopupAndroid::SetIdentityInfo(
|
||||
|
||||
{
|
||||
int icon_id = ResourceMapper::MapFromChromiumId(
|
||||
WebsiteSettingsUI::GetIdentityIconID(identity_info.identity_status));
|
||||
PageInfoUI::GetIdentityIconID(identity_info.identity_status));
|
||||
|
||||
// The headline and the certificate dialog link of the site's identity
|
||||
// section is only displayed if the site's identity was verified. If the
|
||||
@ -109,7 +109,7 @@ void ConnectionInfoPopupAndroid::SetIdentityInfo(
|
||||
// Only show the certificate viewer link if the connection actually used a
|
||||
// certificate.
|
||||
if (identity_info.identity_status !=
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_NO_CERT) {
|
||||
PageInfo::SITE_IDENTITY_STATUS_NO_CERT) {
|
||||
certificate_label =
|
||||
l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON);
|
||||
}
|
||||
@ -129,8 +129,7 @@ void ConnectionInfoPopupAndroid::SetIdentityInfo(
|
||||
|
||||
{
|
||||
int icon_id = ResourceMapper::MapFromChromiumId(
|
||||
WebsiteSettingsUI::GetConnectionIconID(
|
||||
identity_info.connection_status));
|
||||
PageInfoUI::GetConnectionIconID(identity_info.connection_status));
|
||||
|
||||
ScopedJavaLocalRef<jstring> description = ConvertUTF8ToJavaString(
|
||||
env, identity_info.connection_status_description);
|
||||
|
@ -11,18 +11,18 @@
|
||||
|
||||
#include "base/android/scoped_java_ref.h"
|
||||
#include "base/macros.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings_ui.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_ui.h"
|
||||
|
||||
namespace content {
|
||||
class WebContents;
|
||||
}
|
||||
|
||||
// Android implementation of the website settings UI which displays detailed
|
||||
// Android implementation of the page info UI which displays detailed
|
||||
// connection and certificate information for the website.
|
||||
class ConnectionInfoPopupAndroid : public WebsiteSettingsUI {
|
||||
class ConnectionInfoPopupAndroid : public PageInfoUI {
|
||||
public:
|
||||
ConnectionInfoPopupAndroid(JNIEnv* env,
|
||||
jobject java_website_settings,
|
||||
jobject java_page_info,
|
||||
content::WebContents* web_contents);
|
||||
~ConnectionInfoPopupAndroid() override;
|
||||
void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
|
||||
@ -34,7 +34,7 @@ class ConnectionInfoPopupAndroid : public WebsiteSettingsUI {
|
||||
const base::android::JavaParamRef<jobject>& obj,
|
||||
const base::android::JavaParamRef<jobject>& java_web_contents);
|
||||
|
||||
// WebsiteSettingsUI implementations.
|
||||
// PageInfoUI implementations.
|
||||
void SetCookieInfo(const CookieInfoList& cookie_info_list) override;
|
||||
void SetPermissionInfo(const PermissionInfoList& permission_info_list,
|
||||
ChosenObjectInfoList chosen_object_info_list) override;
|
||||
@ -43,8 +43,8 @@ class ConnectionInfoPopupAndroid : public WebsiteSettingsUI {
|
||||
static bool RegisterConnectionInfoPopupAndroid(JNIEnv* env);
|
||||
|
||||
private:
|
||||
// The presenter that controls the Website Settings UI.
|
||||
std::unique_ptr<WebsiteSettings> presenter_;
|
||||
// The presenter that controls the Page Info UI.
|
||||
std::unique_ptr<PageInfo> presenter_;
|
||||
|
||||
// The java prompt implementation.
|
||||
base::android::ScopedJavaGlobalRef<jobject> popup_jobject_;
|
||||
|
@ -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/ui/android/page_info/website_settings_popup_android.h"
|
||||
#include "chrome/browser/ui/android/page_info/page_info_popup_android.h"
|
||||
|
||||
#include "base/android/jni_android.h"
|
||||
#include "base/android/jni_array.h"
|
||||
@ -12,8 +12,8 @@
|
||||
#include "chrome/browser/infobars/infobar_service.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/ssl/security_state_tab_helper.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings_ui.h"
|
||||
#include "chrome/browser/ui/page_info/page_info.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_ui.h"
|
||||
#include "components/content_settings/core/common/content_settings.h"
|
||||
#include "components/content_settings/core/common/content_settings_types.h"
|
||||
#include "components/security_state/core/security_state.h"
|
||||
@ -21,7 +21,7 @@
|
||||
#include "content/public/browser/navigation_controller.h"
|
||||
#include "content/public/browser/navigation_entry.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "jni/WebsiteSettingsPopup_jni.h"
|
||||
#include "jni/PageInfoPopup_jni.h"
|
||||
#include "url/origin.h"
|
||||
|
||||
using base::android::ConvertUTF16ToJavaString;
|
||||
@ -37,13 +37,12 @@ static jlong Init(JNIEnv* env,
|
||||
content::WebContents::FromJavaWebContents(java_web_contents);
|
||||
|
||||
return reinterpret_cast<intptr_t>(
|
||||
new WebsiteSettingsPopupAndroid(env, obj, web_contents));
|
||||
new PageInfoPopupAndroid(env, obj, web_contents));
|
||||
}
|
||||
|
||||
WebsiteSettingsPopupAndroid::WebsiteSettingsPopupAndroid(
|
||||
JNIEnv* env,
|
||||
jobject java_website_settings_pop,
|
||||
content::WebContents* web_contents)
|
||||
PageInfoPopupAndroid::PageInfoPopupAndroid(JNIEnv* env,
|
||||
jobject java_page_info_pop,
|
||||
content::WebContents* web_contents)
|
||||
: search_geolocation_service_(nullptr) {
|
||||
// Important to use GetVisibleEntry to match what's showing in the omnibox.
|
||||
content::NavigationEntry* nav_entry =
|
||||
@ -53,7 +52,7 @@ WebsiteSettingsPopupAndroid::WebsiteSettingsPopupAndroid(
|
||||
|
||||
url_ = nav_entry->GetURL();
|
||||
|
||||
popup_jobject_.Reset(env, java_website_settings_pop);
|
||||
popup_jobject_.Reset(env, java_page_info_pop);
|
||||
|
||||
SecurityStateTabHelper* helper =
|
||||
SecurityStateTabHelper::FromWebContents(web_contents);
|
||||
@ -65,45 +64,44 @@ WebsiteSettingsPopupAndroid::WebsiteSettingsPopupAndroid(
|
||||
SearchGeolocationService::Factory::GetForBrowserContext(
|
||||
web_contents->GetBrowserContext());
|
||||
|
||||
presenter_.reset(new WebsiteSettings(
|
||||
presenter_.reset(new PageInfo(
|
||||
this, Profile::FromBrowserContext(web_contents->GetBrowserContext()),
|
||||
TabSpecificContentSettings::FromWebContents(web_contents), web_contents,
|
||||
nav_entry->GetURL(), security_info));
|
||||
}
|
||||
|
||||
WebsiteSettingsPopupAndroid::~WebsiteSettingsPopupAndroid() {}
|
||||
PageInfoPopupAndroid::~PageInfoPopupAndroid() {}
|
||||
|
||||
void WebsiteSettingsPopupAndroid::Destroy(JNIEnv* env,
|
||||
const JavaParamRef<jobject>& obj) {
|
||||
void PageInfoPopupAndroid::Destroy(JNIEnv* env,
|
||||
const JavaParamRef<jobject>& obj) {
|
||||
delete this;
|
||||
}
|
||||
|
||||
void WebsiteSettingsPopupAndroid::RecordWebsiteSettingsAction(
|
||||
void PageInfoPopupAndroid::RecordPageInfoAction(
|
||||
JNIEnv* env,
|
||||
const JavaParamRef<jobject>& obj,
|
||||
jint action) {
|
||||
presenter_->RecordWebsiteSettingsAction(
|
||||
static_cast<WebsiteSettings::WebsiteSettingsAction>(action));
|
||||
presenter_->RecordPageInfoAction(
|
||||
static_cast<PageInfo::PageInfoAction>(action));
|
||||
}
|
||||
|
||||
void WebsiteSettingsPopupAndroid::SetIdentityInfo(
|
||||
const IdentityInfo& identity_info) {
|
||||
void PageInfoPopupAndroid::SetIdentityInfo(const IdentityInfo& identity_info) {
|
||||
JNIEnv* env = base::android::AttachCurrentThread();
|
||||
std::unique_ptr<WebsiteSettingsUI::SecurityDescription> security_description =
|
||||
std::unique_ptr<PageInfoUI::SecurityDescription> security_description =
|
||||
identity_info.GetSecurityDescription();
|
||||
|
||||
Java_WebsiteSettingsPopup_setSecurityDescription(
|
||||
Java_PageInfoPopup_setSecurityDescription(
|
||||
env, popup_jobject_,
|
||||
ConvertUTF16ToJavaString(env, security_description->summary),
|
||||
ConvertUTF16ToJavaString(env, security_description->details));
|
||||
}
|
||||
|
||||
void WebsiteSettingsPopupAndroid::SetCookieInfo(
|
||||
void PageInfoPopupAndroid::SetCookieInfo(
|
||||
const CookieInfoList& cookie_info_list) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void WebsiteSettingsPopupAndroid::SetPermissionInfo(
|
||||
void PageInfoPopupAndroid::SetPermissionInfo(
|
||||
const PermissionInfoList& permission_info_list,
|
||||
ChosenObjectInfoList chosen_object_info_list) {
|
||||
JNIEnv* env = base::android::AttachCurrentThread();
|
||||
@ -144,9 +142,9 @@ void WebsiteSettingsPopupAndroid::SetPermissionInfo(
|
||||
for (const auto& permission : permissions_to_display) {
|
||||
if (base::ContainsKey(user_specified_settings_to_display, permission)) {
|
||||
base::string16 setting_title =
|
||||
WebsiteSettingsUI::PermissionTypeToUIString(permission);
|
||||
PageInfoUI::PermissionTypeToUIString(permission);
|
||||
|
||||
Java_WebsiteSettingsPopup_addPermissionSection(
|
||||
Java_PageInfoPopup_addPermissionSection(
|
||||
env, popup_jobject_, ConvertUTF16ToJavaString(env, setting_title),
|
||||
static_cast<jint>(permission),
|
||||
static_cast<jint>(user_specified_settings_to_display[permission]));
|
||||
@ -155,19 +153,18 @@ void WebsiteSettingsPopupAndroid::SetPermissionInfo(
|
||||
|
||||
for (const auto& chosen_object : chosen_object_info_list) {
|
||||
base::string16 object_title =
|
||||
WebsiteSettingsUI::ChosenObjectToUIString(*chosen_object);
|
||||
PageInfoUI::ChosenObjectToUIString(*chosen_object);
|
||||
|
||||
Java_WebsiteSettingsPopup_addPermissionSection(
|
||||
Java_PageInfoPopup_addPermissionSection(
|
||||
env, popup_jobject_, ConvertUTF16ToJavaString(env, object_title),
|
||||
static_cast<jint>(chosen_object->ui_info.content_settings_type),
|
||||
static_cast<jint>(CONTENT_SETTING_ALLOW));
|
||||
}
|
||||
|
||||
Java_WebsiteSettingsPopup_updatePermissionDisplay(env, popup_jobject_);
|
||||
Java_PageInfoPopup_updatePermissionDisplay(env, popup_jobject_);
|
||||
}
|
||||
|
||||
// static
|
||||
bool WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid(
|
||||
JNIEnv* env) {
|
||||
bool PageInfoPopupAndroid::RegisterPageInfoPopupAndroid(JNIEnv* env) {
|
||||
return RegisterNativesImpl(env);
|
||||
}
|
@ -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_UI_ANDROID_PAGE_INFO_WEBSITE_SETTINGS_POPUP_ANDROID_H_
|
||||
#define CHROME_BROWSER_UI_ANDROID_PAGE_INFO_WEBSITE_SETTINGS_POPUP_ANDROID_H_
|
||||
#ifndef CHROME_BROWSER_UI_ANDROID_PAGE_INFO_PAGE_INFO_POPUP_ANDROID_H_
|
||||
#define CHROME_BROWSER_UI_ANDROID_PAGE_INFO_PAGE_INFO_POPUP_ANDROID_H_
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
#include "base/android/scoped_java_ref.h"
|
||||
#include "base/macros.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings_ui.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_ui.h"
|
||||
|
||||
namespace content {
|
||||
class WebContents;
|
||||
@ -30,30 +30,29 @@ enum PageInfoConnectionType {
|
||||
CONNECTION_INTERNAL_PAGE,
|
||||
};
|
||||
|
||||
// Android implementation of the website settings UI.
|
||||
class WebsiteSettingsPopupAndroid : public WebsiteSettingsUI {
|
||||
// Android implementation of the page info UI.
|
||||
class PageInfoPopupAndroid : public PageInfoUI {
|
||||
public:
|
||||
WebsiteSettingsPopupAndroid(JNIEnv* env,
|
||||
jobject java_website_settings,
|
||||
content::WebContents* web_contents);
|
||||
~WebsiteSettingsPopupAndroid() override;
|
||||
PageInfoPopupAndroid(JNIEnv* env,
|
||||
jobject java_page_info,
|
||||
content::WebContents* web_contents);
|
||||
~PageInfoPopupAndroid() override;
|
||||
void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
|
||||
void RecordWebsiteSettingsAction(
|
||||
JNIEnv* env,
|
||||
const base::android::JavaParamRef<jobject>& obj,
|
||||
jint action);
|
||||
void RecordPageInfoAction(JNIEnv* env,
|
||||
const base::android::JavaParamRef<jobject>& obj,
|
||||
jint action);
|
||||
|
||||
// WebsiteSettingsUI implementations.
|
||||
// PageInfoUI implementations.
|
||||
void SetCookieInfo(const CookieInfoList& cookie_info_list) override;
|
||||
void SetPermissionInfo(const PermissionInfoList& permission_info_list,
|
||||
ChosenObjectInfoList chosen_object_info_list) override;
|
||||
void SetIdentityInfo(const IdentityInfo& identity_info) override;
|
||||
|
||||
static bool RegisterWebsiteSettingsPopupAndroid(JNIEnv* env);
|
||||
static bool RegisterPageInfoPopupAndroid(JNIEnv* env);
|
||||
|
||||
private:
|
||||
// The presenter that controlls the Website Settings UI.
|
||||
std::unique_ptr<WebsiteSettings> presenter_;
|
||||
// The presenter that controlls the Page Info UI.
|
||||
std::unique_ptr<PageInfo> presenter_;
|
||||
|
||||
// The java prompt implementation.
|
||||
base::android::ScopedJavaGlobalRef<jobject> popup_jobject_;
|
||||
@ -63,7 +62,7 @@ class WebsiteSettingsPopupAndroid : public WebsiteSettingsUI {
|
||||
|
||||
GURL url_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupAndroid);
|
||||
DISALLOW_COPY_AND_ASSIGN(PageInfoPopupAndroid);
|
||||
};
|
||||
|
||||
#endif // CHROME_BROWSER_UI_ANDROID_PAGE_INFO_WEBSITE_SETTINGS_POPUP_ANDROID_H_
|
||||
#endif // CHROME_BROWSER_UI_ANDROID_PAGE_INFO_PAGE_INFO_POPUP_ANDROID_H_
|
@ -378,7 +378,7 @@ void ChromeAutofillClient::ShowHttpNotSecureExplanation() {
|
||||
// On desktop platforms, open Page Info, which briefly explains the HTTP
|
||||
// warning message and provides a link to the Help Center for more details.
|
||||
Browser* browser = chrome::FindBrowserWithWebContents(web_contents());
|
||||
if (browser && chrome::ShowWebsiteSettings(browser, web_contents()))
|
||||
if (browser && chrome::ShowPageInfo(browser, web_contents()))
|
||||
return;
|
||||
// Otherwise fall through to the section below that opens the URL directly.
|
||||
#endif
|
||||
|
@ -897,7 +897,7 @@ void ShowFindBar(Browser* browser) {
|
||||
browser->GetFindBarController()->Show();
|
||||
}
|
||||
|
||||
bool ShowWebsiteSettings(Browser* browser, content::WebContents* web_contents) {
|
||||
bool ShowPageInfo(Browser* browser, content::WebContents* web_contents) {
|
||||
content::NavigationEntry* entry =
|
||||
web_contents->GetController().GetVisibleEntry();
|
||||
if (!entry)
|
||||
@ -908,7 +908,7 @@ bool ShowWebsiteSettings(Browser* browser, content::WebContents* web_contents) {
|
||||
security_state::SecurityInfo security_info;
|
||||
helper->GetSecurityInfo(&security_info);
|
||||
|
||||
browser->window()->ShowWebsiteSettings(
|
||||
browser->window()->ShowPageInfo(
|
||||
Profile::FromBrowserContext(web_contents->GetBrowserContext()),
|
||||
web_contents, entry->GetVirtualURL(), security_info);
|
||||
return true;
|
||||
|
@ -102,7 +102,7 @@ void ManagePasswordsForPage(Browser* browser);
|
||||
void SavePage(Browser* browser);
|
||||
bool CanSavePage(const Browser* browser);
|
||||
void ShowFindBar(Browser* browser);
|
||||
bool ShowWebsiteSettings(Browser* browser, content::WebContents* web_contents);
|
||||
bool ShowPageInfo(Browser* browser, content::WebContents* web_contents);
|
||||
void Print(Browser* browser);
|
||||
bool CanPrint(Browser* browser);
|
||||
#if BUILDFLAG(ENABLE_BASIC_PRINTING)
|
||||
|
@ -117,8 +117,8 @@ content::ColorChooser* ShowColorChooser(content::WebContents* web_contents,
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
|
||||
// Shows a Views website settings bubble at the given anchor point.
|
||||
void ShowWebsiteSettingsBubbleViewsAtPoint(
|
||||
// Shows a Views page info bubble at the given anchor point.
|
||||
void ShowPageInfoBubbleViewsAtPoint(
|
||||
const gfx::Point& anchor_point,
|
||||
Profile* profile,
|
||||
content::WebContents* web_contents,
|
||||
|
@ -294,11 +294,11 @@ class BrowserWindow : public ui::BaseWindow {
|
||||
// that it's time to redraw everything.
|
||||
virtual void UserChangedTheme() = 0;
|
||||
|
||||
// Shows the website settings using the specified information. |virtual_url|
|
||||
// Shows Page Info using the specified information. |virtual_url|
|
||||
// is the virtual url of the page/frame the info applies to, |ssl| is the SSL
|
||||
// information for that page/frame. If |show_history| is true, a section
|
||||
// showing how many times that URL has been visited is added to the page info.
|
||||
virtual void ShowWebsiteSettings(
|
||||
virtual void ShowPageInfo(
|
||||
Profile* profile,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& virtual_url,
|
||||
|
@ -129,11 +129,10 @@ class BrowserWindowCocoa
|
||||
bool app_modal,
|
||||
const base::Callback<void(bool)>& callback) override;
|
||||
void UserChangedTheme() override;
|
||||
void ShowWebsiteSettings(
|
||||
Profile* profile,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& virtual_url,
|
||||
const security_state::SecurityInfo& security_info) override;
|
||||
void ShowPageInfo(Profile* profile,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& virtual_url,
|
||||
const security_state::SecurityInfo& security_info) override;
|
||||
void ShowAppMenu() override;
|
||||
content::KeyboardEventProcessingResult PreHandleKeyboardEvent(
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "chrome/browser/ui/cocoa/key_equivalent_constants.h"
|
||||
#import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
|
||||
#import "chrome/browser/ui/cocoa/nsmenuitem_additions.h"
|
||||
#import "chrome/browser/ui/cocoa/page_info/website_settings_bubble_controller.h"
|
||||
#import "chrome/browser/ui/cocoa/page_info/page_info_bubble_controller.h"
|
||||
#import "chrome/browser/ui/cocoa/profiles/avatar_base_controller.h"
|
||||
#include "chrome/browser/ui/cocoa/restart_browser.h"
|
||||
#include "chrome/browser/ui/cocoa/status_bubble_mac.h"
|
||||
@ -436,7 +436,7 @@ bool BrowserWindowCocoa::IsFullscreen() const {
|
||||
}
|
||||
|
||||
bool BrowserWindowCocoa::IsFullscreenBubbleVisible() const {
|
||||
return false; // Currently only called from toolkit-views website_settings.
|
||||
return false; // Currently only called from toolkit-views page_info.
|
||||
}
|
||||
|
||||
void BrowserWindowCocoa::MaybeShowNewBackShortcutBubble(bool forward) {
|
||||
@ -682,13 +682,13 @@ void BrowserWindowCocoa::UserChangedTheme() {
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWindowCocoa::ShowWebsiteSettings(
|
||||
void BrowserWindowCocoa::ShowPageInfo(
|
||||
Profile* profile,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& virtual_url,
|
||||
const security_state::SecurityInfo& security_info) {
|
||||
WebsiteSettingsUIBridge::Show(window(), profile, web_contents, virtual_url,
|
||||
security_info);
|
||||
PageInfoUIBridge::Show(window(), profile, web_contents, virtual_url,
|
||||
security_info);
|
||||
}
|
||||
|
||||
void BrowserWindowCocoa::ShowAppMenu() {
|
||||
|
@ -123,7 +123,7 @@ bool LocationIconDecoration::OnMousePressed(NSRect frame, NSPoint location) {
|
||||
|
||||
WebContents* tab = owner_->GetWebContents();
|
||||
Browser* browser = chrome::FindBrowserWithWebContents(tab);
|
||||
chrome::ShowWebsiteSettings(browser, tab);
|
||||
chrome::ShowPageInfo(browser, tab);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -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_UI_COCOA_WEBSITE_SETTINGS_WEBSITE_SETTINGS_BUBBLE_CONTROLLER_H_
|
||||
#define CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_WEBSITE_SETTINGS_BUBBLE_CONTROLLER_H_
|
||||
#ifndef CHROME_BROWSER_UI_COCOA_PAGE_INFO_PAGE_INFO_BUBBLE_CONTROLLER_H_
|
||||
#define CHROME_BROWSER_UI_COCOA_PAGE_INFO_PAGE_INFO_BUBBLE_CONTROLLER_H_
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@ -12,10 +12,10 @@
|
||||
#include "base/mac/scoped_nsobject.h"
|
||||
#include "base/macros.h"
|
||||
#import "chrome/browser/ui/cocoa/omnibox_decoration_bubble_controller.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings_ui.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_ui.h"
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
|
||||
class WebsiteSettingsUIBridge;
|
||||
class PageInfoUIBridge;
|
||||
|
||||
namespace content {
|
||||
class WebContents;
|
||||
@ -31,10 +31,7 @@ struct SecurityInfo;
|
||||
|
||||
// This NSWindowController subclass manages the InfoBubbleWindow and view that
|
||||
// are displayed when the user clicks the favicon or security lock icon.
|
||||
//
|
||||
// TODO(palmer): Normalize all WebsiteSettings*, SiteSettings*, PageInfo*, et c.
|
||||
// to OriginInfo*.
|
||||
@interface WebsiteSettingsBubbleController : OmniboxDecorationBubbleController {
|
||||
@interface PageInfoBubbleController : OmniboxDecorationBubbleController {
|
||||
@private
|
||||
content::WebContents* webContents_;
|
||||
|
||||
@ -92,20 +89,20 @@ struct SecurityInfo;
|
||||
|
||||
// The UI translates user actions to specific events and forwards them to the
|
||||
// |presenter_|. The |presenter_| handles these events and updates the UI.
|
||||
std::unique_ptr<WebsiteSettings> presenter_;
|
||||
std::unique_ptr<PageInfo> presenter_;
|
||||
|
||||
// Bridge which implements the WebsiteSettingsUI interface and forwards
|
||||
// Bridge which implements the PageInfoUI interface and forwards
|
||||
// methods on to this class.
|
||||
std::unique_ptr<WebsiteSettingsUIBridge> bridge_;
|
||||
std::unique_ptr<PageInfoUIBridge> bridge_;
|
||||
}
|
||||
|
||||
// Designated initializer. The controller will release itself when the bubble
|
||||
// is closed. |parentWindow| cannot be nil. |webContents| may be nil for
|
||||
// testing purposes.
|
||||
- (id)initWithParentWindow:(NSWindow*)parentWindow
|
||||
websiteSettingsUIBridge:(WebsiteSettingsUIBridge*)bridge
|
||||
webContents:(content::WebContents*)webContents
|
||||
url:(const GURL&)url;
|
||||
pageInfoUIBridge:(PageInfoUIBridge*)bridge
|
||||
webContents:(content::WebContents*)webContents
|
||||
url:(const GURL&)url;
|
||||
|
||||
// Return the default width of the window. It may be wider to fit the content.
|
||||
// This may be overriden by a subclass for testing purposes.
|
||||
@ -113,15 +110,15 @@ struct SecurityInfo;
|
||||
|
||||
@end
|
||||
|
||||
// Provides a bridge between the WebSettingsUI C++ interface and the Cocoa
|
||||
// implementation in WebsiteSettingsBubbleController.
|
||||
class WebsiteSettingsUIBridge : public content::WebContentsObserver,
|
||||
public WebsiteSettingsUI {
|
||||
// Provides a bridge between the PageInfoUI C++ interface and the Cocoa
|
||||
// implementation in PageInfoBubbleController.
|
||||
class PageInfoUIBridge : public content::WebContentsObserver,
|
||||
public PageInfoUI {
|
||||
public:
|
||||
explicit WebsiteSettingsUIBridge(content::WebContents* web_contents);
|
||||
~WebsiteSettingsUIBridge() override;
|
||||
explicit PageInfoUIBridge(content::WebContents* web_contents);
|
||||
~PageInfoUIBridge() override;
|
||||
|
||||
// Creates a |WebsiteSettingsBubbleController| and displays the UI. |parent|
|
||||
// Creates a |PageInfoBubbleController| and displays the UI. |parent|
|
||||
// is the currently active window. |profile| points to the currently active
|
||||
// profile. |web_contents| points to the WebContents that wraps the currently
|
||||
// active tab. |virtual_url| is the virtual GURL of the currently active
|
||||
@ -133,13 +130,12 @@ class WebsiteSettingsUIBridge : public content::WebContentsObserver,
|
||||
const GURL& virtual_url,
|
||||
const security_state::SecurityInfo& security_info);
|
||||
|
||||
void set_bubble_controller(
|
||||
WebsiteSettingsBubbleController* bubble_controller);
|
||||
void set_bubble_controller(PageInfoBubbleController* bubble_controller);
|
||||
|
||||
// WebContentsObserver implementation.
|
||||
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
|
||||
|
||||
// WebsiteSettingsUI implementations.
|
||||
// PageInfoUI implementations.
|
||||
void SetCookieInfo(const CookieInfoList& cookie_info_list) override;
|
||||
void SetPermissionInfo(const PermissionInfoList& permission_info_list,
|
||||
ChosenObjectInfoList chosen_object_info_list) override;
|
||||
@ -150,9 +146,9 @@ class WebsiteSettingsUIBridge : public content::WebContentsObserver,
|
||||
content::WebContents* web_contents_;
|
||||
|
||||
// The Cocoa controller for the bubble UI.
|
||||
WebsiteSettingsBubbleController* bubble_controller_;
|
||||
PageInfoBubbleController* bubble_controller_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsUIBridge);
|
||||
DISALLOW_COPY_AND_ASSIGN(PageInfoUIBridge);
|
||||
};
|
||||
|
||||
#endif // CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_WEBSITE_SETTINGS_BUBBLE_CONTROLLER_H_
|
||||
#endif // CHROME_BROWSER_UI_COCOA_PAGE_INFO_PAGE_INFO_BUBBLE_CONTROLLER_H_
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import "chrome/browser/ui/cocoa/page_info/website_settings_bubble_controller.h"
|
||||
#import "chrome/browser/ui/cocoa/page_info/page_info_bubble_controller.h"
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
@ -49,10 +49,9 @@
|
||||
#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
|
||||
#include "ui/resources/grit/ui_resources.h"
|
||||
|
||||
using ChosenObjectInfoPtr =
|
||||
std::unique_ptr<WebsiteSettingsUI::ChosenObjectInfo>;
|
||||
using ChosenObjectInfoPtr = std::unique_ptr<PageInfoUI::ChosenObjectInfo>;
|
||||
using ChosenObjectDeleteCallback =
|
||||
base::Callback<void(const WebsiteSettingsUI::ChosenObjectInfo&)>;
|
||||
base::Callback<void(const PageInfoUI::ChosenObjectInfo&)>;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -113,9 +112,9 @@ const CGFloat kInternalPageImageSpacing = 10;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// NOTE: This assumes that there will never be more than one website settings
|
||||
// NOTE: This assumes that there will never be more than one page info
|
||||
// popup shown, and that the one that is shown is associated with the current
|
||||
// window. This matches the behaviour in views: see WebsiteSettingsPopupView.
|
||||
// window. This matches the behaviour in views: see PageInfoPopupView.
|
||||
bool g_is_popup_showing = false;
|
||||
|
||||
// Takes in the parent window, which should be a BrowserWindow, and gets the
|
||||
@ -181,7 +180,7 @@ NSPoint AnchorPointForWindow(NSWindow* parent) {
|
||||
|
||||
@end
|
||||
|
||||
@implementation WebsiteSettingsBubbleController
|
||||
@implementation PageInfoBubbleController
|
||||
|
||||
- (CGFloat)defaultWindowWidth {
|
||||
return kDefaultWindowWidth;
|
||||
@ -195,9 +194,9 @@ bool IsInternalURL(const GURL& url) {
|
||||
}
|
||||
|
||||
- (id)initWithParentWindow:(NSWindow*)parentWindow
|
||||
websiteSettingsUIBridge:(WebsiteSettingsUIBridge*)bridge
|
||||
webContents:(content::WebContents*)webContents
|
||||
url:(const GURL&)url {
|
||||
pageInfoUIBridge:(PageInfoUIBridge*)bridge
|
||||
webContents:(content::WebContents*)webContents
|
||||
url:(const GURL&)url {
|
||||
DCHECK(parentWindow);
|
||||
|
||||
webContents_ = webContents;
|
||||
@ -255,7 +254,7 @@ bool IsInternalURL(const GURL& url) {
|
||||
[super windowWillClose:notification];
|
||||
}
|
||||
|
||||
- (void)setPresenter:(WebsiteSettings*)presenter {
|
||||
- (void)setPresenter:(PageInfo*)presenter {
|
||||
presenter_.reset(presenter);
|
||||
}
|
||||
|
||||
@ -311,7 +310,7 @@ bool IsInternalURL(const GURL& url) {
|
||||
[self sizeAndPositionWindow];
|
||||
}
|
||||
|
||||
// Create the subviews for the website settings bubble.
|
||||
// Create the subviews for the page info bubble.
|
||||
- (void)initializeContents {
|
||||
securitySectionView_ = [self addSecuritySectionToView:contentView_];
|
||||
separatorAfterSecuritySection_ = [self addSeparatorToView:contentView_];
|
||||
@ -393,8 +392,7 @@ bool IsInternalURL(const GURL& url) {
|
||||
- (void)showCookiesAndSiteData:(id)sender {
|
||||
DCHECK(webContents_);
|
||||
DCHECK(presenter_);
|
||||
presenter_->RecordWebsiteSettingsAction(
|
||||
WebsiteSettings::WEBSITE_SETTINGS_COOKIES_DIALOG_OPENED);
|
||||
presenter_->RecordPageInfoAction(PageInfo::PAGE_INFO_COOKIES_DIALOG_OPENED);
|
||||
TabDialogs::FromWebContents(webContents_)->ShowCollectedCookies();
|
||||
}
|
||||
|
||||
@ -402,8 +400,7 @@ bool IsInternalURL(const GURL& url) {
|
||||
- (void)showSiteSettingsData:(id)sender {
|
||||
DCHECK(webContents_);
|
||||
DCHECK(presenter_);
|
||||
presenter_->RecordWebsiteSettingsAction(
|
||||
WebsiteSettings::WEBSITE_SETTINGS_SITE_SETTINGS_OPENED);
|
||||
presenter_->RecordPageInfoAction(PageInfo::PAGE_INFO_SITE_SETTINGS_OPENED);
|
||||
webContents_->OpenURL(content::OpenURLParams(
|
||||
GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(),
|
||||
WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK,
|
||||
@ -415,8 +412,7 @@ bool IsInternalURL(const GURL& url) {
|
||||
- (void)openConnectionHelp:(id)sender {
|
||||
DCHECK(webContents_);
|
||||
DCHECK(presenter_);
|
||||
presenter_->RecordWebsiteSettingsAction(
|
||||
WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED);
|
||||
presenter_->RecordPageInfoAction(PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED);
|
||||
webContents_->OpenURL(content::OpenURLParams(
|
||||
GURL(chrome::kPageInfoHelpCenterURL), content::Referrer(),
|
||||
WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK,
|
||||
@ -427,8 +423,8 @@ bool IsInternalURL(const GURL& url) {
|
||||
- (void)showCertificateInfo:(id)sender {
|
||||
DCHECK(certificate_.get());
|
||||
DCHECK(presenter_);
|
||||
presenter_->RecordWebsiteSettingsAction(
|
||||
WebsiteSettings::WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED);
|
||||
presenter_->RecordPageInfoAction(
|
||||
PageInfo::PAGE_INFO_CERTIFICATE_DIALOG_OPENED);
|
||||
ShowCertificateViewer(webContents_, [self parentWindow], certificate_.get());
|
||||
}
|
||||
|
||||
@ -687,8 +683,8 @@ bool IsInternalURL(const GURL& url) {
|
||||
}
|
||||
|
||||
// Set the content of the identity and identity status fields.
|
||||
- (void)setIdentityInfo:(const WebsiteSettingsUI::IdentityInfo&)identityInfo {
|
||||
std::unique_ptr<WebsiteSettingsUI::SecurityDescription> security_description =
|
||||
- (void)setIdentityInfo:(const PageInfoUI::IdentityInfo&)identityInfo {
|
||||
std::unique_ptr<PageInfoUI::SecurityDescription> security_description =
|
||||
identityInfo.GetSecurityDescription();
|
||||
[securitySummaryField_
|
||||
setStringValue:base::SysUTF16ToNSString(security_description->summary)];
|
||||
@ -724,13 +720,13 @@ bool IsInternalURL(const GURL& url) {
|
||||
|
||||
// Add a pop-up button for |permissionInfo| to the given view.
|
||||
- (NSPopUpButton*)addPopUpButtonForPermission:
|
||||
(const WebsiteSettingsUI::PermissionInfo&)permissionInfo
|
||||
(const PageInfoUI::PermissionInfo&)permissionInfo
|
||||
toView:(NSView*)view
|
||||
atPoint:(NSPoint)point {
|
||||
GURL url = webContents_ ? webContents_->GetURL() : GURL();
|
||||
__block WebsiteSettingsBubbleController* weakSelf = self;
|
||||
__block PageInfoBubbleController* weakSelf = self;
|
||||
PermissionMenuModel::ChangeCallback callback =
|
||||
base::BindBlock(^(const WebsiteSettingsUI::PermissionInfo& permission) {
|
||||
base::BindBlock(^(const PageInfoUI::PermissionInfo& permission) {
|
||||
[weakSelf onPermissionChanged:permission.type to:permission.setting];
|
||||
});
|
||||
base::scoped_nsobject<PermissionSelectorButton> button(
|
||||
@ -760,9 +756,9 @@ bool IsInternalURL(const GURL& url) {
|
||||
- (NSButton*)addDeleteButtonForChosenObject:(ChosenObjectInfoPtr)objectInfo
|
||||
toView:(NSView*)view
|
||||
atPoint:(NSPoint)point {
|
||||
__block WebsiteSettingsBubbleController* weakSelf = self;
|
||||
__block PageInfoBubbleController* weakSelf = self;
|
||||
auto callback =
|
||||
base::BindBlock(^(const WebsiteSettingsUI::ChosenObjectInfo& objectInfo) {
|
||||
base::BindBlock(^(const PageInfoUI::ChosenObjectInfo& objectInfo) {
|
||||
[weakSelf onChosenObjectDeleted:objectInfo];
|
||||
});
|
||||
base::scoped_nsobject<ChosenObjectDeleteButton> button(
|
||||
@ -789,7 +785,7 @@ bool IsInternalURL(const GURL& url) {
|
||||
}
|
||||
|
||||
// Called when the user revokes permission for a previously chosen object.
|
||||
- (void)onChosenObjectDeleted:(const WebsiteSettingsUI::ChosenObjectInfo&)info {
|
||||
- (void)onChosenObjectDeleted:(const PageInfoUI::ChosenObjectInfo&)info {
|
||||
if (presenter_)
|
||||
presenter_->OnSiteChosenObjectDeleted(info.ui_info, *info.object);
|
||||
}
|
||||
@ -797,16 +793,14 @@ bool IsInternalURL(const GURL& url) {
|
||||
// Adds a new row to the UI listing the permissions. Returns the NSPoint of the
|
||||
// last UI element added (either the permission button, in LTR, or the text
|
||||
// label, in RTL).
|
||||
- (NSPoint)addPermission:
|
||||
(const WebsiteSettingsUI::PermissionInfo&)permissionInfo
|
||||
- (NSPoint)addPermission:(const PageInfoUI::PermissionInfo&)permissionInfo
|
||||
toView:(NSView*)view
|
||||
atPoint:(NSPoint)point {
|
||||
base::string16 labelText =
|
||||
WebsiteSettingsUI::PermissionTypeToUIString(permissionInfo.type);
|
||||
PageInfoUI::PermissionTypeToUIString(permissionInfo.type);
|
||||
bool isRTL = base::i18n::IsRTL();
|
||||
base::scoped_nsobject<NSImage> image(
|
||||
[WebsiteSettingsUI::GetPermissionIcon(permissionInfo)
|
||||
.ToNSImage() retain]);
|
||||
[PageInfoUI::GetPermissionIcon(permissionInfo).ToNSImage() retain]);
|
||||
|
||||
NSPoint position;
|
||||
NSImageView* imageView;
|
||||
@ -918,11 +912,10 @@ bool IsInternalURL(const GURL& url) {
|
||||
atPoint:(NSPoint)point {
|
||||
base::string16 labelText = l10n_util::GetStringFUTF16(
|
||||
objectInfo->ui_info.label_string_id,
|
||||
WebsiteSettingsUI::ChosenObjectToUIString(*objectInfo));
|
||||
PageInfoUI::ChosenObjectToUIString(*objectInfo));
|
||||
bool isRTL = base::i18n::IsRTL();
|
||||
base::scoped_nsobject<NSImage> image(
|
||||
[WebsiteSettingsUI::GetChosenObjectIcon(*objectInfo, false)
|
||||
.ToNSImage() retain]);
|
||||
[PageInfoUI::GetChosenObjectIcon(*objectInfo, false).ToNSImage() retain]);
|
||||
|
||||
NSPoint position;
|
||||
NSImageView* imageView;
|
||||
@ -1010,11 +1003,11 @@ bool IsInternalURL(const GURL& url) {
|
||||
for (const auto& i : cookieInfoList) {
|
||||
totalAllowed += i.allowed;
|
||||
}
|
||||
base::string16 label_text = l10n_util::GetPluralStringFUTF16(
|
||||
IDS_WEBSITE_SETTINGS_NUM_COOKIES, totalAllowed);
|
||||
base::string16 label_text =
|
||||
l10n_util::GetPluralStringFUTF16(IDS_PAGE_INFO_NUM_COOKIES, totalAllowed);
|
||||
|
||||
base::string16 sectionTitle =
|
||||
l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TITLE_SITE_DATA);
|
||||
l10n_util::GetStringUTF16(IDS_PAGE_INFO_TITLE_SITE_DATA);
|
||||
bool isRTL = base::i18n::IsRTL();
|
||||
|
||||
[cookiesView_ setSubviews:[NSArray array]];
|
||||
@ -1028,12 +1021,12 @@ bool IsInternalURL(const GURL& url) {
|
||||
kPermissionImageSpacing - kSectionHorizontalPadding;
|
||||
}
|
||||
|
||||
WebsiteSettingsUI::PermissionInfo info;
|
||||
PageInfoUI::PermissionInfo info;
|
||||
info.type = CONTENT_SETTINGS_TYPE_COOKIES;
|
||||
info.setting = CONTENT_SETTING_ALLOW;
|
||||
// info.default_setting, info.source, and info.is_incognito have not been set,
|
||||
// but GetPermissionIcon doesn't use any of those.
|
||||
NSImage* image = WebsiteSettingsUI::GetPermissionIcon(info).ToNSImage();
|
||||
NSImage* image = PageInfoUI::GetPermissionIcon(info).ToNSImage();
|
||||
NSImageView* imageView = [self addImageWithSize:[image size]
|
||||
toView:cookiesView_
|
||||
atPoint:controlOrigin];
|
||||
@ -1099,7 +1092,7 @@ bool IsInternalURL(const GURL& url) {
|
||||
|
||||
if (permissionInfoList.size() > 0 || chosenObjectInfoList.size() > 0) {
|
||||
base::string16 sectionTitle =
|
||||
l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TITLE_SITE_PERMISSIONS);
|
||||
l10n_util::GetStringUTF16(IDS_PAGE_INFO_TITLE_SITE_PERMISSIONS);
|
||||
|
||||
for (const auto& permission : permissionInfoList) {
|
||||
controlOrigin.y += kPermissionsVerticalSpacing;
|
||||
@ -1127,8 +1120,7 @@ bool IsInternalURL(const GURL& url) {
|
||||
|
||||
@end
|
||||
|
||||
WebsiteSettingsUIBridge::WebsiteSettingsUIBridge(
|
||||
content::WebContents* web_contents)
|
||||
PageInfoUIBridge::PageInfoUIBridge(content::WebContents* web_contents)
|
||||
: content::WebContentsObserver(web_contents),
|
||||
web_contents_(web_contents),
|
||||
bubble_controller_(nil) {
|
||||
@ -1136,24 +1128,23 @@ WebsiteSettingsUIBridge::WebsiteSettingsUIBridge(
|
||||
g_is_popup_showing = true;
|
||||
}
|
||||
|
||||
WebsiteSettingsUIBridge::~WebsiteSettingsUIBridge() {
|
||||
PageInfoUIBridge::~PageInfoUIBridge() {
|
||||
DCHECK(g_is_popup_showing);
|
||||
g_is_popup_showing = false;
|
||||
}
|
||||
|
||||
void WebsiteSettingsUIBridge::set_bubble_controller(
|
||||
WebsiteSettingsBubbleController* controller) {
|
||||
void PageInfoUIBridge::set_bubble_controller(
|
||||
PageInfoBubbleController* controller) {
|
||||
bubble_controller_ = controller;
|
||||
}
|
||||
|
||||
void WebsiteSettingsUIBridge::Show(
|
||||
gfx::NativeWindow parent,
|
||||
Profile* profile,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& virtual_url,
|
||||
const security_state::SecurityInfo& security_info) {
|
||||
void PageInfoUIBridge::Show(gfx::NativeWindow parent,
|
||||
Profile* profile,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& virtual_url,
|
||||
const security_state::SecurityInfo& security_info) {
|
||||
if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
|
||||
chrome::ShowWebsiteSettingsBubbleViewsAtPoint(
|
||||
chrome::ShowPageInfoBubbleViewsAtPoint(
|
||||
gfx::ScreenPointFromNSPoint(AnchorPointForWindow(parent)), profile,
|
||||
web_contents, virtual_url, security_info);
|
||||
return;
|
||||
@ -1166,47 +1157,46 @@ void WebsiteSettingsUIBridge::Show(
|
||||
return;
|
||||
|
||||
// Create the bridge. This will be owned by the bubble controller.
|
||||
WebsiteSettingsUIBridge* bridge = new WebsiteSettingsUIBridge(web_contents);
|
||||
PageInfoUIBridge* bridge = new PageInfoUIBridge(web_contents);
|
||||
|
||||
// Create the bubble controller. It will dealloc itself when it closes,
|
||||
// resetting |g_is_popup_showing|.
|
||||
WebsiteSettingsBubbleController* bubble_controller = [
|
||||
[WebsiteSettingsBubbleController alloc] initWithParentWindow:parent
|
||||
websiteSettingsUIBridge:bridge
|
||||
webContents:web_contents
|
||||
url:virtual_url];
|
||||
PageInfoBubbleController* bubble_controller =
|
||||
[[PageInfoBubbleController alloc] initWithParentWindow:parent
|
||||
pageInfoUIBridge:bridge
|
||||
webContents:web_contents
|
||||
url:virtual_url];
|
||||
|
||||
if (!IsInternalURL(virtual_url)) {
|
||||
// Initialize the presenter, which holds the model and controls the UI.
|
||||
// This is also owned by the bubble controller.
|
||||
WebsiteSettings* presenter = new WebsiteSettings(
|
||||
bridge, profile,
|
||||
TabSpecificContentSettings::FromWebContents(web_contents), web_contents,
|
||||
virtual_url, security_info);
|
||||
PageInfo* presenter =
|
||||
new PageInfo(bridge, profile,
|
||||
TabSpecificContentSettings::FromWebContents(web_contents),
|
||||
web_contents, virtual_url, security_info);
|
||||
[bubble_controller setPresenter:presenter];
|
||||
}
|
||||
|
||||
[bubble_controller showWindow:nil];
|
||||
}
|
||||
|
||||
void WebsiteSettingsUIBridge::SetIdentityInfo(
|
||||
const WebsiteSettingsUI::IdentityInfo& identity_info) {
|
||||
void PageInfoUIBridge::SetIdentityInfo(
|
||||
const PageInfoUI::IdentityInfo& identity_info) {
|
||||
[bubble_controller_ setIdentityInfo:identity_info];
|
||||
}
|
||||
|
||||
void WebsiteSettingsUIBridge::RenderFrameDeleted(
|
||||
void PageInfoUIBridge::RenderFrameDeleted(
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
if (render_frame_host == web_contents_->GetMainFrame()) {
|
||||
[bubble_controller_ close];
|
||||
}
|
||||
}
|
||||
|
||||
void WebsiteSettingsUIBridge::SetCookieInfo(
|
||||
const CookieInfoList& cookie_info_list) {
|
||||
void PageInfoUIBridge::SetCookieInfo(const CookieInfoList& cookie_info_list) {
|
||||
[bubble_controller_ setCookieInfo:cookie_info_list];
|
||||
}
|
||||
|
||||
void WebsiteSettingsUIBridge::SetPermissionInfo(
|
||||
void PageInfoUIBridge::SetPermissionInfo(
|
||||
const PermissionInfoList& permission_info_list,
|
||||
ChosenObjectInfoList chosen_object_info_list) {
|
||||
[bubble_controller_ setPermissionInfo:permission_info_list
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import "chrome/browser/ui/cocoa/page_info/website_settings_bubble_controller.h"
|
||||
#import "chrome/browser/ui/cocoa/page_info/page_info_bubble_controller.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
@ -16,13 +16,13 @@
|
||||
#include "net/test/test_certificate_data.h"
|
||||
#include "testing/gtest_mac.h"
|
||||
|
||||
@interface WebsiteSettingsBubbleController (ExposedForTesting)
|
||||
@interface PageInfoBubbleController (ExposedForTesting)
|
||||
- (NSView*)permissionsView;
|
||||
- (NSButton*)resetDecisionsButton;
|
||||
- (NSButton*)connectionHelpButton;
|
||||
@end
|
||||
|
||||
@implementation WebsiteSettingsBubbleController (ExposedForTesting)
|
||||
@implementation PageInfoBubbleController (ExposedForTesting)
|
||||
- (NSView*)permissionsView {
|
||||
return permissionsView_;
|
||||
}
|
||||
@ -34,14 +34,13 @@
|
||||
}
|
||||
@end
|
||||
|
||||
@interface WebsiteSettingsBubbleControllerForTesting
|
||||
: WebsiteSettingsBubbleController {
|
||||
@interface PageInfoBubbleControllerForTesting : PageInfoBubbleController {
|
||||
@private
|
||||
CGFloat defaultWindowWidth_;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation WebsiteSettingsBubbleControllerForTesting
|
||||
@implementation PageInfoBubbleControllerForTesting
|
||||
- (void)setDefaultWindowWidth:(CGFloat)width {
|
||||
defaultWindowWidth_ = width;
|
||||
}
|
||||
@ -83,9 +82,9 @@ const content_settings::SettingSource kTestSettingSources[] = {
|
||||
content_settings::SETTING_SOURCE_POLICY,
|
||||
content_settings::SETTING_SOURCE_EXTENSION};
|
||||
|
||||
class WebsiteSettingsBubbleControllerTest : public CocoaTest {
|
||||
class PageInfoBubbleControllerTest : public CocoaTest {
|
||||
public:
|
||||
WebsiteSettingsBubbleControllerTest() { controller_ = nil; }
|
||||
PageInfoBubbleControllerTest() { controller_ = nil; }
|
||||
|
||||
void TearDown() override {
|
||||
[controller_ close];
|
||||
@ -93,23 +92,23 @@ class WebsiteSettingsBubbleControllerTest : public CocoaTest {
|
||||
}
|
||||
|
||||
protected:
|
||||
WebsiteSettingsUIBridge* bridge_; // Weak, owned by controller.
|
||||
PageInfoUIBridge* bridge_; // Weak, owned by controller.
|
||||
|
||||
enum MatchType { TEXT_EQUAL = 0, TEXT_NOT_EQUAL };
|
||||
|
||||
// Creates a new website settings bubble, with the given default width.
|
||||
// Creates a new page info bubble, with the given default width.
|
||||
// If |default_width| is 0, the *default* default width will be used.
|
||||
void CreateBubbleWithWidth(CGFloat default_width) {
|
||||
bridge_ = new WebsiteSettingsUIBridge(nullptr);
|
||||
bridge_ = new PageInfoUIBridge(nullptr);
|
||||
|
||||
// The controller cleans up after itself when the window closes.
|
||||
controller_ = [WebsiteSettingsBubbleControllerForTesting alloc];
|
||||
controller_ = [PageInfoBubbleControllerForTesting alloc];
|
||||
[controller_ setDefaultWindowWidth:default_width];
|
||||
[controller_ initWithParentWindow:test_window()
|
||||
websiteSettingsUIBridge:bridge_
|
||||
webContents:web_contents_factory_.CreateWebContents(
|
||||
&profile_)
|
||||
url:GURL("https://www.google.com")];
|
||||
[controller_
|
||||
initWithParentWindow:test_window()
|
||||
pageInfoUIBridge:bridge_
|
||||
webContents:web_contents_factory_.CreateWebContents(&profile_)
|
||||
url:GURL("https://www.google.com")];
|
||||
window_ = [controller_ window];
|
||||
[controller_ showWindow:nil];
|
||||
}
|
||||
@ -162,7 +161,7 @@ class WebsiteSettingsBubbleControllerTest : public CocoaTest {
|
||||
// - [allow, block, ask] by default
|
||||
// - [block, allow] * [by user, by policy, by extension]
|
||||
PermissionInfoList permission_info_list;
|
||||
WebsiteSettingsUI::PermissionInfo info;
|
||||
PageInfoUI::PermissionInfo info;
|
||||
for (size_t i = 0; i < arraysize(kTestPermissionTypes); ++i) {
|
||||
info.type = kTestPermissionTypes[i];
|
||||
info.setting = kTestSettings[i];
|
||||
@ -181,33 +180,33 @@ class WebsiteSettingsBubbleControllerTest : public CocoaTest {
|
||||
TestingProfile profile_;
|
||||
content::TestWebContentsFactory web_contents_factory_;
|
||||
|
||||
WebsiteSettingsBubbleControllerForTesting* controller_; // Weak, owns self.
|
||||
PageInfoBubbleControllerForTesting* controller_; // Weak, owns self.
|
||||
NSWindow* window_; // Weak, owned by controller.
|
||||
};
|
||||
|
||||
TEST_F(WebsiteSettingsBubbleControllerTest, ConnectionHelpButton) {
|
||||
WebsiteSettingsUI::IdentityInfo info;
|
||||
TEST_F(PageInfoBubbleControllerTest, ConnectionHelpButton) {
|
||||
PageInfoUI::IdentityInfo info;
|
||||
info.site_identity = std::string("example.com");
|
||||
info.identity_status = WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN;
|
||||
info.identity_status = PageInfo::SITE_IDENTITY_STATUS_UNKNOWN;
|
||||
|
||||
CreateBubble();
|
||||
|
||||
bridge_->SetIdentityInfo(const_cast<WebsiteSettingsUI::IdentityInfo&>(info));
|
||||
bridge_->SetIdentityInfo(const_cast<PageInfoUI::IdentityInfo&>(info));
|
||||
|
||||
EXPECT_EQ([[controller_ connectionHelpButton] action],
|
||||
@selector(openConnectionHelp:));
|
||||
}
|
||||
|
||||
TEST_F(WebsiteSettingsBubbleControllerTest, ResetDecisionsButton) {
|
||||
WebsiteSettingsUI::IdentityInfo info;
|
||||
TEST_F(PageInfoBubbleControllerTest, ResetDecisionsButton) {
|
||||
PageInfoUI::IdentityInfo info;
|
||||
info.site_identity = std::string("example.com");
|
||||
info.identity_status = WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN;
|
||||
info.identity_status = PageInfo::SITE_IDENTITY_STATUS_UNKNOWN;
|
||||
|
||||
CreateBubble();
|
||||
|
||||
// Set identity info, specifying that the button should not be shown.
|
||||
info.show_ssl_decision_revoke_button = false;
|
||||
bridge_->SetIdentityInfo(const_cast<WebsiteSettingsUI::IdentityInfo&>(info));
|
||||
bridge_->SetIdentityInfo(const_cast<PageInfoUI::IdentityInfo&>(info));
|
||||
EXPECT_EQ([controller_ resetDecisionsButton], nil);
|
||||
|
||||
// Set identity info, specifying that the button should be shown.
|
||||
@ -215,7 +214,7 @@ TEST_F(WebsiteSettingsBubbleControllerTest, ResetDecisionsButton) {
|
||||
reinterpret_cast<const char*>(google_der), sizeof(google_der));
|
||||
ASSERT_TRUE(info.certificate);
|
||||
info.show_ssl_decision_revoke_button = true;
|
||||
bridge_->SetIdentityInfo(const_cast<WebsiteSettingsUI::IdentityInfo&>(info));
|
||||
bridge_->SetIdentityInfo(const_cast<PageInfoUI::IdentityInfo&>(info));
|
||||
EXPECT_NE([controller_ resetDecisionsButton], nil);
|
||||
|
||||
// Check that clicking the button calls the right selector.
|
||||
@ -228,7 +227,7 @@ TEST_F(WebsiteSettingsBubbleControllerTest, ResetDecisionsButton) {
|
||||
// again.
|
||||
}
|
||||
|
||||
TEST_F(WebsiteSettingsBubbleControllerTest, SetPermissionInfo) {
|
||||
TEST_F(PageInfoBubbleControllerTest, SetPermissionInfo) {
|
||||
CreateBubble();
|
||||
SetTestPermissions();
|
||||
|
||||
@ -264,7 +263,7 @@ TEST_F(WebsiteSettingsBubbleControllerTest, SetPermissionInfo) {
|
||||
EXPECT_EQ(3, disabled_count);
|
||||
}
|
||||
|
||||
TEST_F(WebsiteSettingsBubbleControllerTest, WindowWidth) {
|
||||
TEST_F(PageInfoBubbleControllerTest, WindowWidth) {
|
||||
const CGFloat kBigEnoughBubbleWidth = 310;
|
||||
// Creating a window that should fit everything.
|
||||
CreateBubbleWithWidth(kBigEnoughBubbleWidth);
|
12
chrome/browser/ui/cocoa/page_info/page_info_utils_cocoa.h
Normal file
12
chrome/browser/ui/cocoa/page_info/page_info_utils_cocoa.h
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright 2014 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 CHROME_BROWSER_UI_COCOA_PAGE_INFO_PAGE_INFO_UTILS_COCOA_H_
|
||||
#define CHROME_BROWSER_UI_COCOA_PAGE_INFO_PAGE_INFO_UTILS_COCOA_H_
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
NSSize SizeForPageInfoButtonTitle(NSPopUpButton* button, NSString* title);
|
||||
|
||||
#endif // CHROME_BROWSER_UI_COCOA_PAGE_INFO_PAGE_INFO_UTILS_COCOA_H_
|
@ -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/ui/cocoa/page_info/website_settings_utils_cocoa.h"
|
||||
#include "chrome/browser/ui/cocoa/page_info/page_info_utils_cocoa.h"
|
||||
|
||||
namespace {
|
||||
// The amount of horizontal space between the button's title and its arrow icon.
|
||||
@ -10,8 +10,7 @@ const CGFloat kButtonTitleRightPadding = 4.0f;
|
||||
}
|
||||
|
||||
// Determine the size of a popup button with the given title.
|
||||
NSSize SizeForWebsiteSettingsButtonTitle(NSPopUpButton* button,
|
||||
NSString* title) {
|
||||
NSSize SizeForPageInfoButtonTitle(NSPopUpButton* button, NSString* title) {
|
||||
NSDictionary* textAttributes =
|
||||
[[button attributedTitle] attributesAtIndex:0 effectiveRange:NULL];
|
||||
NSSize titleSize = [title sizeWithAttributes:textAttributes];
|
@ -24,8 +24,7 @@ class Profile;
|
||||
}
|
||||
|
||||
// Designated initializer.
|
||||
- (id)initWithPermissionInfo:
|
||||
(const WebsiteSettingsUI::PermissionInfo&)permissionInfo
|
||||
- (id)initWithPermissionInfo:(const PageInfoUI::PermissionInfo&)permissionInfo
|
||||
forURL:(const GURL&)url
|
||||
withCallback:(PermissionMenuModel::ChangeCallback)callback
|
||||
profile:(Profile*)profile;
|
||||
|
@ -5,14 +5,13 @@
|
||||
#import "chrome/browser/ui/cocoa/page_info/permission_selector_button.h"
|
||||
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "chrome/browser/ui/cocoa/page_info/website_settings_utils_cocoa.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings_ui.h"
|
||||
#include "chrome/browser/ui/cocoa/page_info/page_info_utils_cocoa.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_ui.h"
|
||||
#import "ui/base/cocoa/menu_controller.h"
|
||||
|
||||
@implementation PermissionSelectorButton
|
||||
|
||||
- (id)initWithPermissionInfo:
|
||||
(const WebsiteSettingsUI::PermissionInfo&)permissionInfo
|
||||
- (id)initWithPermissionInfo:(const PageInfoUI::PermissionInfo&)permissionInfo
|
||||
forURL:(const GURL&)url
|
||||
withCallback:(PermissionMenuModel::ChangeCallback)callback
|
||||
profile:(Profile*)profile {
|
||||
@ -31,7 +30,7 @@
|
||||
|
||||
// Set the button title.
|
||||
base::scoped_nsobject<NSMenuItem> titleItem([[NSMenuItem alloc] init]);
|
||||
base::string16 buttonTitle = WebsiteSettingsUI::PermissionActionToUIString(
|
||||
base::string16 buttonTitle = PageInfoUI::PermissionActionToUIString(
|
||||
profile, permissionInfo.type, permissionInfo.setting,
|
||||
permissionInfo.default_setting, permissionInfo.source);
|
||||
[titleItem setTitle:base::SysUTF16ToNSString(buttonTitle)];
|
||||
@ -41,7 +40,7 @@
|
||||
[self sizeToFit];
|
||||
|
||||
// Size the button to just fit the visible title - not all of its items.
|
||||
[self setFrameSize:SizeForWebsiteSettingsButtonTitle(self, [self title])];
|
||||
[self setFrameSize:SizeForPageInfoButtonTitle(self, [self title])];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -53,10 +52,10 @@
|
||||
CGFloat maxTitleWidth = 0;
|
||||
for (NSMenuItem* item in [self itemArray]) {
|
||||
NSString* title =
|
||||
base::SysUTF16ToNSString(WebsiteSettingsUI::PermissionActionToUIString(
|
||||
base::SysUTF16ToNSString(PageInfoUI::PermissionActionToUIString(
|
||||
profile, type, static_cast<ContentSetting>([item tag]),
|
||||
defaultSetting, content_settings::SETTING_SOURCE_USER));
|
||||
NSSize size = SizeForWebsiteSettingsButtonTitle(self, title);
|
||||
NSSize size = SizeForPageInfoButtonTitle(self, title);
|
||||
maxTitleWidth = std::max(maxTitleWidth, size.width);
|
||||
}
|
||||
return maxTitleWidth;
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "base/mac/scoped_nsobject.h"
|
||||
#import "chrome/browser/ui/cocoa/test/cocoa_test_helper.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings_ui.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_ui.h"
|
||||
#include "chrome/test/base/testing_profile.h"
|
||||
#include "content/public/test/test_browser_thread_bundle.h"
|
||||
|
||||
@ -23,7 +23,7 @@ class PermissionSelectorButtonTest : public CocoaTest {
|
||||
public:
|
||||
PermissionSelectorButtonTest() {
|
||||
got_callback_ = false;
|
||||
WebsiteSettingsUI::PermissionInfo test_info;
|
||||
PageInfoUI::PermissionInfo test_info;
|
||||
test_info.type = kTestPermissionType;
|
||||
test_info.setting = CONTENT_SETTING_BLOCK;
|
||||
test_info.source = content_settings::SETTING_SOURCE_USER;
|
||||
@ -39,7 +39,7 @@ class PermissionSelectorButtonTest : public CocoaTest {
|
||||
[[test_window() contentView] addSubview:view_];
|
||||
}
|
||||
|
||||
void Callback(const WebsiteSettingsUI::PermissionInfo& permission) {
|
||||
void Callback(const PageInfoUI::PermissionInfo& permission) {
|
||||
EXPECT_TRUE(permission.type == kTestPermissionType);
|
||||
got_callback_ = true;
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2014 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 CHROME_BROWSER_UI_COCOA_PAGE_INFO_WEBSITE_SETTINGS_UTILS_COCOA_H_
|
||||
#define CHROME_BROWSER_UI_COCOA_PAGE_INFO_WEBSITE_SETTINGS_UTILS_COCOA_H_
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
NSSize SizeForWebsiteSettingsButtonTitle(NSPopUpButton* button,
|
||||
NSString* title);
|
||||
|
||||
#endif // CHROME_BROWSER_UI_COCOA_PAGE_INFO_WEBSITE_SETTINGS_UTILS_COCOA_H_
|
@ -23,9 +23,9 @@
|
||||
#import "chrome/browser/ui/cocoa/info_bubble_window.h"
|
||||
#import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h"
|
||||
#import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
|
||||
#include "chrome/browser/ui/cocoa/page_info/page_info_utils_cocoa.h"
|
||||
#include "chrome/browser/ui/cocoa/page_info/permission_selector_button.h"
|
||||
#include "chrome/browser/ui/cocoa/page_info/split_block_button.h"
|
||||
#include "chrome/browser/ui/cocoa/page_info/website_settings_utils_cocoa.h"
|
||||
#include "chrome/browser/ui/cocoa/permission_bubble/permission_bubble_cocoa.h"
|
||||
#include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
|
||||
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
|
||||
@ -109,12 +109,11 @@ const NSInteger kFullscreenLeftOffset = 40;
|
||||
__block PermissionPrompt::Delegate* blockDelegate = delegate;
|
||||
__block AllowBlockMenuButton* blockSelf = self;
|
||||
PermissionMenuModel::ChangeCallback changeCallback =
|
||||
base::BindBlock(^(const WebsiteSettingsUI::PermissionInfo& permission) {
|
||||
blockDelegate->ToggleAccept(
|
||||
index, permission.setting == CONTENT_SETTING_ALLOW);
|
||||
[blockSelf setFrameSize:
|
||||
SizeForWebsiteSettingsButtonTitle(blockSelf,
|
||||
[blockSelf title])];
|
||||
base::BindBlock(^(const PageInfoUI::PermissionInfo& permission) {
|
||||
blockDelegate->ToggleAccept(
|
||||
index, permission.setting == CONTENT_SETTING_ALLOW);
|
||||
[blockSelf setFrameSize:SizeForPageInfoButtonTitle(
|
||||
blockSelf, [blockSelf title])];
|
||||
});
|
||||
|
||||
menuModel_.reset(
|
||||
@ -128,7 +127,7 @@ const NSInteger kFullscreenLeftOffset = 40;
|
||||
// Adjust the size to fit the current title. Using only -sizeToFit leaves
|
||||
// an ugly amount of whitespace between the title and the arrows because it
|
||||
// will fit to the largest element in the menu, not just the selected item.
|
||||
[self setFrameSize:SizeForWebsiteSettingsButtonTitle(self, [self title])];
|
||||
[self setFrameSize:SizeForPageInfoButtonTitle(self, [self title])];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -136,7 +135,7 @@ const NSInteger kFullscreenLeftOffset = 40;
|
||||
- (CGFloat)maximumTitleWidth {
|
||||
CGFloat maxTitleWidth = 0;
|
||||
for (NSMenuItem* item in [self itemArray]) {
|
||||
NSSize size = SizeForWebsiteSettingsButtonTitle(self, [item title]);
|
||||
NSSize size = SizeForPageInfoButtonTitle(self, [item title]);
|
||||
maxTitleWidth = std::max(maxTitleWidth, size.width);
|
||||
}
|
||||
return maxTitleWidth;
|
||||
|
@ -519,7 +519,7 @@ void LoginHandler::GetDialogStrings(const GURL& request_url,
|
||||
// TODO(asanka): The string should be different for proxies and servers.
|
||||
// http://crbug.com/620756
|
||||
*explanation =
|
||||
l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_NON_SECURE_TRANSPORT);
|
||||
l10n_util::GetStringUTF16(IDS_PAGE_INFO_NON_SECURE_TRANSPORT);
|
||||
} else {
|
||||
explanation->clear();
|
||||
}
|
||||
|
@ -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/ui/page_info/website_settings.h"
|
||||
#include "chrome/browser/ui/page_info/page_info.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
@ -39,7 +39,7 @@
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h"
|
||||
#include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings_ui.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_ui.h"
|
||||
#include "chrome/browser/usb/usb_chooser_context.h"
|
||||
#include "chrome/browser/usb/usb_chooser_context_factory.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
@ -75,7 +75,7 @@
|
||||
|
||||
#if !defined(OS_ANDROID)
|
||||
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings_infobar_delegate.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_infobar_delegate.h"
|
||||
#endif
|
||||
|
||||
using base::ASCIIToUTF16;
|
||||
@ -92,7 +92,7 @@ enum SSLCertificateDecisionsDidRevoke {
|
||||
END_OF_SSL_CERTIFICATE_DECISIONS_DID_REVOKE_ENUM
|
||||
};
|
||||
|
||||
// The list of content settings types to display on the Website Settings UI. THE
|
||||
// The list of content settings types to display on the Page Info UI. THE
|
||||
// ORDER OF THESE ITEMS IS IMPORTANT. To propose changing it, email
|
||||
// security-dev@chromium.org.
|
||||
ContentSettingsType kPermissionType[] = {
|
||||
@ -112,7 +112,7 @@ ContentSettingsType kPermissionType[] = {
|
||||
CONTENT_SETTINGS_TYPE_MIDI_SYSEX,
|
||||
};
|
||||
|
||||
// Determines whether to show permission |type| in the Website Settings UI. Only
|
||||
// Determines whether to show permission |type| in the Page Info UI. Only
|
||||
// applies to permissions listed in |kPermissionType|.
|
||||
bool ShouldShowPermission(ContentSettingsType type) {
|
||||
#if !defined(OS_ANDROID)
|
||||
@ -163,23 +163,23 @@ void CheckForInsecureContent(const security_state::SecurityInfo& security_info,
|
||||
|
||||
void GetSiteIdentityByMaliciousContentStatus(
|
||||
security_state::MaliciousContentStatus malicious_content_status,
|
||||
WebsiteSettings::SiteIdentityStatus* status,
|
||||
PageInfo::SiteIdentityStatus* status,
|
||||
base::string16* details) {
|
||||
switch (malicious_content_status) {
|
||||
case security_state::MALICIOUS_CONTENT_STATUS_NONE:
|
||||
NOTREACHED();
|
||||
break;
|
||||
case security_state::MALICIOUS_CONTENT_STATUS_MALWARE:
|
||||
*status = WebsiteSettings::SITE_IDENTITY_STATUS_MALWARE;
|
||||
*status = PageInfo::SITE_IDENTITY_STATUS_MALWARE;
|
||||
*details = l10n_util::GetStringUTF16(IDS_PAGEINFO_MALWARE_DETAILS);
|
||||
break;
|
||||
case security_state::MALICIOUS_CONTENT_STATUS_SOCIAL_ENGINEERING:
|
||||
*status = WebsiteSettings::SITE_IDENTITY_STATUS_SOCIAL_ENGINEERING;
|
||||
*status = PageInfo::SITE_IDENTITY_STATUS_SOCIAL_ENGINEERING;
|
||||
*details =
|
||||
l10n_util::GetStringUTF16(IDS_PAGEINFO_SOCIAL_ENGINEERING_DETAILS);
|
||||
break;
|
||||
case security_state::MALICIOUS_CONTENT_STATUS_UNWANTED_SOFTWARE:
|
||||
*status = WebsiteSettings::SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE;
|
||||
*status = PageInfo::SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE;
|
||||
*details =
|
||||
l10n_util::GetStringUTF16(IDS_PAGEINFO_UNWANTED_SOFTWARE_DETAILS);
|
||||
break;
|
||||
@ -198,21 +198,20 @@ ChooserContextBase* GetUsbChooserContext(Profile* profile) {
|
||||
// The list of chooser types that need to display entries in the Website
|
||||
// Settings UI. THE ORDER OF THESE ITEMS IS IMPORTANT. To propose changing it,
|
||||
// email security-dev@chromium.org.
|
||||
WebsiteSettings::ChooserUIInfo kChooserUIInfo[] = {
|
||||
PageInfo::ChooserUIInfo kChooserUIInfo[] = {
|
||||
{CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA, &GetUsbChooserContext,
|
||||
IDR_BLOCKED_USB, IDR_ALLOWED_USB, IDS_WEBSITE_SETTINGS_USB_DEVICE_LABEL,
|
||||
IDS_WEBSITE_SETTINGS_DELETE_USB_DEVICE, "name"},
|
||||
IDR_BLOCKED_USB, IDR_ALLOWED_USB, IDS_PAGE_INFO_USB_DEVICE_LABEL,
|
||||
IDS_PAGE_INFO_DELETE_USB_DEVICE, "name"},
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
WebsiteSettings::WebsiteSettings(
|
||||
WebsiteSettingsUI* ui,
|
||||
Profile* profile,
|
||||
TabSpecificContentSettings* tab_specific_content_settings,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& url,
|
||||
const security_state::SecurityInfo& security_info)
|
||||
PageInfo::PageInfo(PageInfoUI* ui,
|
||||
Profile* profile,
|
||||
TabSpecificContentSettings* tab_specific_content_settings,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& url,
|
||||
const security_state::SecurityInfo& security_info)
|
||||
: TabSpecificContentSettings::SiteDataObserver(
|
||||
tab_specific_content_settings),
|
||||
content::WebContentsObserver(web_contents),
|
||||
@ -234,17 +233,15 @@ WebsiteSettings::WebsiteSettings(
|
||||
PresentSiteData();
|
||||
PresentSiteIdentity();
|
||||
|
||||
// Every time the Website Settings UI is opened a |WebsiteSettings| object is
|
||||
// created. So this counts how ofter the Website Settings UI is opened.
|
||||
RecordWebsiteSettingsAction(WEBSITE_SETTINGS_OPENED);
|
||||
// Every time the Page Info UI is opened a |PageInfo| object is
|
||||
// created. So this counts how ofter the Page Info UI is opened.
|
||||
RecordPageInfoAction(PAGE_INFO_OPENED);
|
||||
}
|
||||
|
||||
WebsiteSettings::~WebsiteSettings() {}
|
||||
PageInfo::~PageInfo() {}
|
||||
|
||||
void WebsiteSettings::RecordWebsiteSettingsAction(
|
||||
WebsiteSettingsAction action) {
|
||||
UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Action", action,
|
||||
WEBSITE_SETTINGS_COUNT);
|
||||
void PageInfo::RecordPageInfoAction(PageInfoAction action) {
|
||||
UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Action", action, PAGE_INFO_COUNT);
|
||||
|
||||
std::string histogram_name;
|
||||
|
||||
@ -252,33 +249,33 @@ void WebsiteSettings::RecordWebsiteSettingsAction(
|
||||
if (security_level_ == security_state::SECURE ||
|
||||
security_level_ == security_state::EV_SECURE) {
|
||||
UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpsUrl.Valid",
|
||||
action, WEBSITE_SETTINGS_COUNT);
|
||||
action, PAGE_INFO_COUNT);
|
||||
} else if (security_level_ == security_state::NONE) {
|
||||
UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpsUrl.Downgraded",
|
||||
action, WEBSITE_SETTINGS_COUNT);
|
||||
action, PAGE_INFO_COUNT);
|
||||
} else if (security_level_ == security_state::DANGEROUS) {
|
||||
UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpsUrl.Dangerous",
|
||||
action, WEBSITE_SETTINGS_COUNT);
|
||||
action, PAGE_INFO_COUNT);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (security_level_ == security_state::HTTP_SHOW_WARNING) {
|
||||
UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpUrl.Warning",
|
||||
action, WEBSITE_SETTINGS_COUNT);
|
||||
action, PAGE_INFO_COUNT);
|
||||
} else if (security_level_ == security_state::DANGEROUS) {
|
||||
UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpUrl.Dangerous",
|
||||
action, WEBSITE_SETTINGS_COUNT);
|
||||
action, PAGE_INFO_COUNT);
|
||||
} else {
|
||||
UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpUrl.Neutral",
|
||||
action, WEBSITE_SETTINGS_COUNT);
|
||||
action, PAGE_INFO_COUNT);
|
||||
}
|
||||
}
|
||||
|
||||
void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type,
|
||||
ContentSetting setting) {
|
||||
void PageInfo::OnSitePermissionChanged(ContentSettingsType type,
|
||||
ContentSetting setting) {
|
||||
// Count how often a permission for a specific content type is changed using
|
||||
// the Website Settings UI.
|
||||
// the Page Info UI.
|
||||
size_t num_values;
|
||||
int histogram_value = ContentSettingTypeToHistogramValue(type, &num_values);
|
||||
UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.OriginInfo.PermissionChanged",
|
||||
@ -302,8 +299,8 @@ void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type,
|
||||
|
||||
// This is technically redundant given the histogram above, but putting the
|
||||
// total count of permission changes in another histogram makes it easier to
|
||||
// compare it against other kinds of actions in WebsiteSettings[PopupView].
|
||||
RecordWebsiteSettingsAction(WEBSITE_SETTINGS_CHANGED_PERMISSION);
|
||||
// compare it against other kinds of actions in PageInfo[PopupView].
|
||||
RecordPageInfoAction(PAGE_INFO_CHANGED_PERMISSION);
|
||||
|
||||
PermissionUtil::ScopedRevocationReporter scoped_revocation_reporter(
|
||||
this->profile_, this->site_url_, this->site_url_, type,
|
||||
@ -318,9 +315,8 @@ void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type,
|
||||
PresentSitePermissions();
|
||||
}
|
||||
|
||||
void WebsiteSettings::OnSiteChosenObjectDeleted(
|
||||
const ChooserUIInfo& ui_info,
|
||||
const base::DictionaryValue& object) {
|
||||
void PageInfo::OnSiteChosenObjectDeleted(const ChooserUIInfo& ui_info,
|
||||
const base::DictionaryValue& object) {
|
||||
// TODO(reillyg): Create metrics for revocations. crbug.com/556845
|
||||
ChooserContextBase* context = ui_info.get_context(profile_);
|
||||
const GURL origin = site_url_.GetOrigin();
|
||||
@ -332,11 +328,11 @@ void WebsiteSettings::OnSiteChosenObjectDeleted(
|
||||
PresentSitePermissions();
|
||||
}
|
||||
|
||||
void WebsiteSettings::OnSiteDataAccessed() {
|
||||
void PageInfo::OnSiteDataAccessed() {
|
||||
PresentSiteData();
|
||||
}
|
||||
|
||||
void WebsiteSettings::OnUIClosing() {
|
||||
void PageInfo::OnUIClosing() {
|
||||
#if defined(OS_ANDROID)
|
||||
NOTREACHED();
|
||||
#else
|
||||
@ -344,7 +340,7 @@ void WebsiteSettings::OnUIClosing() {
|
||||
InfoBarService* infobar_service =
|
||||
InfoBarService::FromWebContents(web_contents());
|
||||
if (infobar_service)
|
||||
WebsiteSettingsInfoBarDelegate::Create(infobar_service);
|
||||
PageInfoInfoBarDelegate::Create(infobar_service);
|
||||
}
|
||||
|
||||
SSLCertificateDecisionsDidRevoke user_decision =
|
||||
@ -357,15 +353,15 @@ void WebsiteSettings::OnUIClosing() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void WebsiteSettings::OnRevokeSSLErrorBypassButtonPressed() {
|
||||
void PageInfo::OnRevokeSSLErrorBypassButtonPressed() {
|
||||
DCHECK(chrome_ssl_host_state_delegate_);
|
||||
chrome_ssl_host_state_delegate_->RevokeUserAllowExceptionsHard(
|
||||
site_url().host());
|
||||
did_revoke_user_ssl_decisions_ = true;
|
||||
}
|
||||
|
||||
void WebsiteSettings::Init(const GURL& url,
|
||||
const security_state::SecurityInfo& security_info) {
|
||||
void PageInfo::Init(const GURL& url,
|
||||
const security_state::SecurityInfo& security_info) {
|
||||
#if !defined(OS_ANDROID) && !defined(OS_IOS)
|
||||
// On desktop, internal URLs aren't handled by this class. Instead, a
|
||||
// custom and simpler popup is shown.
|
||||
@ -635,11 +631,11 @@ void WebsiteSettings::Init(const GURL& url,
|
||||
show_ssl_decision_revoke_button_ = delegate->HasAllowException(url.host());
|
||||
}
|
||||
|
||||
void WebsiteSettings::PresentSitePermissions() {
|
||||
void PageInfo::PresentSitePermissions() {
|
||||
PermissionInfoList permission_info_list;
|
||||
ChosenObjectInfoList chosen_object_info_list;
|
||||
|
||||
WebsiteSettingsUI::PermissionInfo permission_info;
|
||||
PageInfoUI::PermissionInfo permission_info;
|
||||
for (size_t i = 0; i < arraysize(kPermissionType); ++i) {
|
||||
permission_info.type = kPermissionType[i];
|
||||
|
||||
@ -701,8 +697,8 @@ void WebsiteSettings::PresentSitePermissions() {
|
||||
auto chosen_objects = context->GetGrantedObjects(origin, origin);
|
||||
for (std::unique_ptr<base::DictionaryValue>& object : chosen_objects) {
|
||||
chosen_object_info_list.push_back(
|
||||
base::MakeUnique<WebsiteSettingsUI::ChosenObjectInfo>(
|
||||
ui_info, std::move(object)));
|
||||
base::MakeUnique<PageInfoUI::ChosenObjectInfo>(ui_info,
|
||||
std::move(object)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -710,7 +706,7 @@ void WebsiteSettings::PresentSitePermissions() {
|
||||
std::move(chosen_object_info_list));
|
||||
}
|
||||
|
||||
void WebsiteSettings::PresentSiteData() {
|
||||
void PageInfo::PresentSiteData() {
|
||||
CookieInfoList cookie_info_list;
|
||||
const LocalSharedObjectsContainer& allowed_objects =
|
||||
tab_specific_content_settings()->allowed_local_shared_objects();
|
||||
@ -718,7 +714,7 @@ void WebsiteSettings::PresentSiteData() {
|
||||
tab_specific_content_settings()->blocked_local_shared_objects();
|
||||
|
||||
// Add first party cookie and site data counts.
|
||||
WebsiteSettingsUI::CookieInfo cookie_info;
|
||||
PageInfoUI::CookieInfo cookie_info;
|
||||
cookie_info.allowed = allowed_objects.GetObjectCountForDomain(site_url_);
|
||||
cookie_info.blocked = blocked_objects.GetObjectCountForDomain(site_url_);
|
||||
cookie_info.is_first_party = true;
|
||||
@ -733,12 +729,12 @@ void WebsiteSettings::PresentSiteData() {
|
||||
ui_->SetCookieInfo(cookie_info_list);
|
||||
}
|
||||
|
||||
void WebsiteSettings::PresentSiteIdentity() {
|
||||
void PageInfo::PresentSiteIdentity() {
|
||||
// After initialization the status about the site's connection and its
|
||||
// identity must be available.
|
||||
DCHECK_NE(site_identity_status_, SITE_IDENTITY_STATUS_UNKNOWN);
|
||||
DCHECK_NE(site_connection_status_, SITE_CONNECTION_STATUS_UNKNOWN);
|
||||
WebsiteSettingsUI::IdentityInfo info;
|
||||
PageInfoUI::IdentityInfo info;
|
||||
if (site_identity_status_ == SITE_IDENTITY_STATUS_EV_CERT)
|
||||
info.site_identity = UTF16ToUTF8(organization_name());
|
||||
else
|
@ -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_UI_PAGE_INFO_WEBSITE_SETTINGS_H_
|
||||
#define CHROME_BROWSER_UI_PAGE_INFO_WEBSITE_SETTINGS_H_
|
||||
#ifndef CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_H_
|
||||
#define CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/strings/string16.h"
|
||||
@ -26,15 +26,15 @@ class ChromeSSLHostStateDelegate;
|
||||
class ChooserContextBase;
|
||||
class HostContentSettingsMap;
|
||||
class Profile;
|
||||
class WebsiteSettingsUI;
|
||||
class PageInfoUI;
|
||||
|
||||
// The |WebsiteSettings| provides information about a website's permissions,
|
||||
// The |PageInfo| provides information about a website's permissions,
|
||||
// connection state and its identity. It owns a UI that displays the
|
||||
// information and allows users to change the permissions. |WebsiteSettings|
|
||||
// information and allows users to change the permissions. |PageInfo|
|
||||
// objects must be created on the heap. They destroy themselves after the UI is
|
||||
// closed.
|
||||
class WebsiteSettings : public TabSpecificContentSettings::SiteDataObserver,
|
||||
public content::WebContentsObserver {
|
||||
class PageInfo : public TabSpecificContentSettings::SiteDataObserver,
|
||||
public content::WebContentsObserver {
|
||||
public:
|
||||
// TODO(palmer): Figure out if it is possible to unify SiteConnectionStatus
|
||||
// and SiteIdentityStatus.
|
||||
@ -83,25 +83,25 @@ class WebsiteSettings : public TabSpecificContentSettings::SiteDataObserver,
|
||||
SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE,
|
||||
};
|
||||
|
||||
// UMA statistics for WebsiteSettings. Do not reorder or remove existing
|
||||
// UMA statistics for PageInfo. Do not reorder or remove existing
|
||||
// fields. A Java counterpart will be generated for this enum.
|
||||
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.page_info
|
||||
enum WebsiteSettingsAction {
|
||||
WEBSITE_SETTINGS_OPENED = 0,
|
||||
enum PageInfoAction {
|
||||
PAGE_INFO_OPENED = 0,
|
||||
// No longer used; indicated actions for the old version of Page Info that
|
||||
// had a "Permissions" tab and a "Connection" tab.
|
||||
// WEBSITE_SETTINGS_PERMISSIONS_TAB_SELECTED = 1,
|
||||
// WEBSITE_SETTINGS_CONNECTION_TAB_SELECTED = 2,
|
||||
// WEBSITE_SETTINGS_CONNECTION_TAB_SHOWN_IMMEDIATELY = 3,
|
||||
WEBSITE_SETTINGS_COOKIES_DIALOG_OPENED = 4,
|
||||
WEBSITE_SETTINGS_CHANGED_PERMISSION = 5,
|
||||
WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED = 6,
|
||||
// PAGE_INFO_PERMISSIONS_TAB_SELECTED = 1,
|
||||
// PAGE_INFO_CONNECTION_TAB_SELECTED = 2,
|
||||
// PAGE_INFO_CONNECTION_TAB_SHOWN_IMMEDIATELY = 3,
|
||||
PAGE_INFO_COOKIES_DIALOG_OPENED = 4,
|
||||
PAGE_INFO_CHANGED_PERMISSION = 5,
|
||||
PAGE_INFO_CERTIFICATE_DIALOG_OPENED = 6,
|
||||
// No longer used; indicated a UI viewer for SCTs.
|
||||
// WEBSITE_SETTINGS_TRANSPARENCY_VIEWER_OPENED = 7,
|
||||
WEBSITE_SETTINGS_CONNECTION_HELP_OPENED = 8,
|
||||
WEBSITE_SETTINGS_SITE_SETTINGS_OPENED = 9,
|
||||
WEBSITE_SETTINGS_SECURITY_DETAILS_OPENED = 10,
|
||||
WEBSITE_SETTINGS_COUNT
|
||||
// PAGE_INFO_TRANSPARENCY_VIEWER_OPENED = 7,
|
||||
PAGE_INFO_CONNECTION_HELP_OPENED = 8,
|
||||
PAGE_INFO_SITE_SETTINGS_OPENED = 9,
|
||||
PAGE_INFO_SECURITY_DETAILS_OPENED = 10,
|
||||
PAGE_INFO_COUNT
|
||||
};
|
||||
|
||||
struct ChooserUIInfo {
|
||||
@ -114,18 +114,18 @@ class WebsiteSettings : public TabSpecificContentSettings::SiteDataObserver,
|
||||
const char* ui_name_key;
|
||||
};
|
||||
|
||||
// Creates a WebsiteSettings for the passed |url| using the given |ssl| status
|
||||
// Creates a PageInfo 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 security_state::SecurityInfo& security_info);
|
||||
~WebsiteSettings() override;
|
||||
// |PageInfo| takes ownership of the |ui|.
|
||||
PageInfo(PageInfoUI* ui,
|
||||
Profile* profile,
|
||||
TabSpecificContentSettings* tab_specific_content_settings,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& url,
|
||||
const security_state::SecurityInfo& security_info);
|
||||
~PageInfo() override;
|
||||
|
||||
void RecordWebsiteSettingsAction(WebsiteSettingsAction action);
|
||||
void RecordPageInfoAction(PageInfoAction action);
|
||||
|
||||
// This method is called when ever a permission setting is changed.
|
||||
void OnSitePermissionChanged(ContentSettingsType type, ContentSetting value);
|
||||
@ -157,7 +157,7 @@ class WebsiteSettings : public TabSpecificContentSettings::SiteDataObserver,
|
||||
void OnSiteDataAccessed() override;
|
||||
|
||||
private:
|
||||
// Initializes the |WebsiteSettings|.
|
||||
// Initializes the |PageInfo|.
|
||||
void Init(const GURL& url, const security_state::SecurityInfo& security_info);
|
||||
|
||||
// Sets (presents) the information about the site's permissions in the |ui_|.
|
||||
@ -170,11 +170,11 @@ class WebsiteSettings : public TabSpecificContentSettings::SiteDataObserver,
|
||||
// in the |ui_|.
|
||||
void PresentSiteIdentity();
|
||||
|
||||
// The website settings UI displays information and controls for site-
|
||||
// The page info UI displays information and controls for site-
|
||||
// specific data (local stored objects like cookies), site-specific
|
||||
// permissions (location, pop-up, plugin, etc. permissions) and site-specific
|
||||
// information (identity, connection status, etc.).
|
||||
WebsiteSettingsUI* ui_;
|
||||
PageInfoUI* ui_;
|
||||
|
||||
// The flag that controls whether an infobar is displayed after the website
|
||||
// settings UI is closed or not.
|
||||
@ -235,7 +235,7 @@ class WebsiteSettings : public TabSpecificContentSettings::SiteDataObserver,
|
||||
|
||||
security_state::SecurityLevel security_level_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WebsiteSettings);
|
||||
DISALLOW_COPY_AND_ASSIGN(PageInfo);
|
||||
};
|
||||
|
||||
#endif // CHROME_BROWSER_UI_PAGE_INFO_WEBSITE_SETTINGS_H_
|
||||
#endif // CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_H_
|
@ -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/ui/page_info/website_settings_infobar_delegate.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_infobar_delegate.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
@ -16,46 +16,44 @@
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
|
||||
// static
|
||||
void WebsiteSettingsInfoBarDelegate::Create(InfoBarService* infobar_service) {
|
||||
void PageInfoInfoBarDelegate::Create(InfoBarService* infobar_service) {
|
||||
infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar(
|
||||
std::unique_ptr<ConfirmInfoBarDelegate>(
|
||||
new WebsiteSettingsInfoBarDelegate())));
|
||||
std::unique_ptr<ConfirmInfoBarDelegate>(new PageInfoInfoBarDelegate())));
|
||||
}
|
||||
|
||||
WebsiteSettingsInfoBarDelegate::WebsiteSettingsInfoBarDelegate()
|
||||
: ConfirmInfoBarDelegate() {}
|
||||
PageInfoInfoBarDelegate::PageInfoInfoBarDelegate() : ConfirmInfoBarDelegate() {}
|
||||
|
||||
WebsiteSettingsInfoBarDelegate::~WebsiteSettingsInfoBarDelegate() {}
|
||||
PageInfoInfoBarDelegate::~PageInfoInfoBarDelegate() {}
|
||||
|
||||
infobars::InfoBarDelegate::Type WebsiteSettingsInfoBarDelegate::GetInfoBarType()
|
||||
infobars::InfoBarDelegate::Type PageInfoInfoBarDelegate::GetInfoBarType()
|
||||
const {
|
||||
return PAGE_ACTION_TYPE;
|
||||
}
|
||||
|
||||
infobars::InfoBarDelegate::InfoBarIdentifier
|
||||
WebsiteSettingsInfoBarDelegate::GetIdentifier() const {
|
||||
return WEBSITE_SETTINGS_INFOBAR_DELEGATE;
|
||||
PageInfoInfoBarDelegate::GetIdentifier() const {
|
||||
return PAGE_INFO_INFOBAR_DELEGATE;
|
||||
}
|
||||
|
||||
const gfx::VectorIcon& WebsiteSettingsInfoBarDelegate::GetVectorIcon() const {
|
||||
const gfx::VectorIcon& PageInfoInfoBarDelegate::GetVectorIcon() const {
|
||||
return kGlobeIcon;
|
||||
}
|
||||
|
||||
base::string16 WebsiteSettingsInfoBarDelegate::GetMessageText() const {
|
||||
return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_INFOBAR_TEXT);
|
||||
base::string16 PageInfoInfoBarDelegate::GetMessageText() const {
|
||||
return l10n_util::GetStringUTF16(IDS_PAGE_INFO_INFOBAR_TEXT);
|
||||
}
|
||||
|
||||
int WebsiteSettingsInfoBarDelegate::GetButtons() const {
|
||||
int PageInfoInfoBarDelegate::GetButtons() const {
|
||||
return BUTTON_OK;
|
||||
}
|
||||
|
||||
base::string16 WebsiteSettingsInfoBarDelegate::GetButtonLabel(
|
||||
base::string16 PageInfoInfoBarDelegate::GetButtonLabel(
|
||||
InfoBarButton button) const {
|
||||
DCHECK_EQ(BUTTON_OK, button);
|
||||
return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_INFOBAR_BUTTON);
|
||||
return l10n_util::GetStringUTF16(IDS_PAGE_INFO_INFOBAR_BUTTON);
|
||||
}
|
||||
|
||||
bool WebsiteSettingsInfoBarDelegate::Accept() {
|
||||
bool PageInfoInfoBarDelegate::Accept() {
|
||||
content::WebContents* web_contents =
|
||||
InfoBarService::WebContentsFromInfoBar(infobar());
|
||||
web_contents->GetController().Reload(content::ReloadType::NORMAL, true);
|
@ -2,28 +2,28 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CHROME_BROWSER_UI_PAGE_INFO_WEBSITE_SETTINGS_INFOBAR_DELEGATE_H_
|
||||
#define CHROME_BROWSER_UI_PAGE_INFO_WEBSITE_SETTINGS_INFOBAR_DELEGATE_H_
|
||||
#ifndef CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_INFOBAR_DELEGATE_H_
|
||||
#define CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_INFOBAR_DELEGATE_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "components/infobars/core/confirm_infobar_delegate.h"
|
||||
|
||||
class InfoBarService;
|
||||
|
||||
// This class configures an infobar that is shown when the website settings UI
|
||||
// This class configures an infobar that is shown when the page info UI
|
||||
// is closed and the settings for one or more site permissions have been
|
||||
// changed. The user is shown a message indicating that a reload of the page is
|
||||
// required for the changes to take effect, and presented a button to perform
|
||||
// the reload right from the infobar.
|
||||
class WebsiteSettingsInfoBarDelegate : public ConfirmInfoBarDelegate {
|
||||
class PageInfoInfoBarDelegate : public ConfirmInfoBarDelegate {
|
||||
public:
|
||||
// Creates a website settings infobar and delegate and adds the infobar to
|
||||
// Creates a page info infobar and delegate and adds the infobar to
|
||||
// |infobar_service|.
|
||||
static void Create(InfoBarService* infobar_service);
|
||||
|
||||
private:
|
||||
WebsiteSettingsInfoBarDelegate();
|
||||
~WebsiteSettingsInfoBarDelegate() override;
|
||||
PageInfoInfoBarDelegate();
|
||||
~PageInfoInfoBarDelegate() override;
|
||||
|
||||
// ConfirmInfoBarDelegate:
|
||||
Type GetInfoBarType() const override;
|
||||
@ -34,7 +34,7 @@ class WebsiteSettingsInfoBarDelegate : public ConfirmInfoBarDelegate {
|
||||
base::string16 GetButtonLabel(InfoBarButton button) const override;
|
||||
bool Accept() override;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsInfoBarDelegate);
|
||||
DISALLOW_COPY_AND_ASSIGN(PageInfoInfoBarDelegate);
|
||||
};
|
||||
|
||||
#endif // CHROME_BROWSER_UI_PAGE_INFO_WEBSITE_SETTINGS_INFOBAR_DELEGATE_H_
|
||||
#endif // CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_INFOBAR_DELEGATE_H_
|
192
chrome/browser/ui/page_info/website_settings_ui.cc → chrome/browser/ui/page_info/page_info_ui.cc
192
chrome/browser/ui/page_info/website_settings_ui.cc → chrome/browser/ui/page_info/page_info_ui.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/ui/page_info/website_settings_ui.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_ui.h"
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
||||
@ -26,9 +26,9 @@ const int kInvalidResourceID = -1;
|
||||
// button if the permission setting is managed by policy.
|
||||
const int kPermissionButtonTextIDPolicyManaged[] = {
|
||||
kInvalidResourceID,
|
||||
IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ALLOWED_BY_POLICY,
|
||||
IDS_WEBSITE_SETTINGS_BUTTON_TEXT_BLOCKED_BY_POLICY,
|
||||
IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ASK_BY_POLICY,
|
||||
IDS_PAGE_INFO_BUTTON_TEXT_ALLOWED_BY_POLICY,
|
||||
IDS_PAGE_INFO_BUTTON_TEXT_BLOCKED_BY_POLICY,
|
||||
IDS_PAGE_INFO_BUTTON_TEXT_ASK_BY_POLICY,
|
||||
kInvalidResourceID,
|
||||
kInvalidResourceID};
|
||||
static_assert(arraysize(kPermissionButtonTextIDPolicyManaged) ==
|
||||
@ -39,8 +39,8 @@ static_assert(arraysize(kPermissionButtonTextIDPolicyManaged) ==
|
||||
// button if the permission setting is managed by an extension.
|
||||
const int kPermissionButtonTextIDExtensionManaged[] = {
|
||||
kInvalidResourceID,
|
||||
IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ALLOWED_BY_EXTENSION,
|
||||
IDS_WEBSITE_SETTINGS_BUTTON_TEXT_BLOCKED_BY_EXTENSION,
|
||||
IDS_PAGE_INFO_BUTTON_TEXT_ALLOWED_BY_EXTENSION,
|
||||
IDS_PAGE_INFO_BUTTON_TEXT_BLOCKED_BY_EXTENSION,
|
||||
kInvalidResourceID,
|
||||
kInvalidResourceID,
|
||||
kInvalidResourceID};
|
||||
@ -53,11 +53,11 @@ static_assert(arraysize(kPermissionButtonTextIDExtensionManaged) ==
|
||||
// button if the permission setting is managed by the user.
|
||||
const int kPermissionButtonTextIDUserManaged[] = {
|
||||
kInvalidResourceID,
|
||||
IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ALLOWED_BY_USER,
|
||||
IDS_WEBSITE_SETTINGS_BUTTON_TEXT_BLOCKED_BY_USER,
|
||||
IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ASK_BY_USER,
|
||||
IDS_PAGE_INFO_BUTTON_TEXT_ALLOWED_BY_USER,
|
||||
IDS_PAGE_INFO_BUTTON_TEXT_BLOCKED_BY_USER,
|
||||
IDS_PAGE_INFO_BUTTON_TEXT_ASK_BY_USER,
|
||||
kInvalidResourceID,
|
||||
IDS_WEBSITE_SETTINGS_BUTTON_TEXT_DETECT_IMPORTANT_CONTENT_BY_USER};
|
||||
IDS_PAGE_INFO_BUTTON_TEXT_DETECT_IMPORTANT_CONTENT_BY_USER};
|
||||
static_assert(arraysize(kPermissionButtonTextIDUserManaged) ==
|
||||
CONTENT_SETTING_NUM_SETTINGS,
|
||||
"kPermissionButtonTextIDUserManaged array size is incorrect");
|
||||
@ -66,11 +66,11 @@ static_assert(arraysize(kPermissionButtonTextIDUserManaged) ==
|
||||
// button if the permission setting is the global default setting.
|
||||
const int kPermissionButtonTextIDDefaultSetting[] = {
|
||||
kInvalidResourceID,
|
||||
IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ALLOWED_BY_DEFAULT,
|
||||
IDS_WEBSITE_SETTINGS_BUTTON_TEXT_BLOCKED_BY_DEFAULT,
|
||||
IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ASK_BY_DEFAULT,
|
||||
IDS_PAGE_INFO_BUTTON_TEXT_ALLOWED_BY_DEFAULT,
|
||||
IDS_PAGE_INFO_BUTTON_TEXT_BLOCKED_BY_DEFAULT,
|
||||
IDS_PAGE_INFO_BUTTON_TEXT_ASK_BY_DEFAULT,
|
||||
kInvalidResourceID,
|
||||
IDS_WEBSITE_SETTINGS_BUTTON_TEXT_DETECT_IMPORTANT_CONTENT_BY_DEFAULT};
|
||||
IDS_PAGE_INFO_BUTTON_TEXT_DETECT_IMPORTANT_CONTENT_BY_DEFAULT};
|
||||
static_assert(arraysize(kPermissionButtonTextIDDefaultSetting) ==
|
||||
CONTENT_SETTING_NUM_SETTINGS,
|
||||
"kPermissionButtonTextIDDefaultSetting array size is incorrect");
|
||||
@ -85,121 +85,117 @@ struct PermissionsUIInfo {
|
||||
const PermissionsUIInfo kPermissionsUIInfo[] = {
|
||||
{CONTENT_SETTINGS_TYPE_COOKIES, 0, IDR_BLOCKED_COOKIES,
|
||||
IDR_ACCESSED_COOKIES},
|
||||
{CONTENT_SETTINGS_TYPE_IMAGES, IDS_WEBSITE_SETTINGS_TYPE_IMAGES,
|
||||
{CONTENT_SETTINGS_TYPE_IMAGES, IDS_PAGE_INFO_TYPE_IMAGES,
|
||||
IDR_BLOCKED_IMAGES, IDR_ALLOWED_IMAGES},
|
||||
{CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_WEBSITE_SETTINGS_TYPE_JAVASCRIPT,
|
||||
{CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_PAGE_INFO_TYPE_JAVASCRIPT,
|
||||
IDR_BLOCKED_JAVASCRIPT, IDR_ALLOWED_JAVASCRIPT},
|
||||
{CONTENT_SETTINGS_TYPE_POPUPS, IDS_WEBSITE_SETTINGS_TYPE_POPUPS,
|
||||
{CONTENT_SETTINGS_TYPE_POPUPS, IDS_PAGE_INFO_TYPE_POPUPS,
|
||||
IDR_BLOCKED_POPUPS, IDR_ALLOWED_POPUPS},
|
||||
#if BUILDFLAG(ENABLE_PLUGINS)
|
||||
{CONTENT_SETTINGS_TYPE_PLUGINS, IDS_WEBSITE_SETTINGS_TYPE_FLASH,
|
||||
{CONTENT_SETTINGS_TYPE_PLUGINS, IDS_PAGE_INFO_TYPE_FLASH,
|
||||
IDR_BLOCKED_PLUGINS, IDR_ALLOWED_PLUGINS},
|
||||
#endif
|
||||
{CONTENT_SETTINGS_TYPE_GEOLOCATION, IDS_WEBSITE_SETTINGS_TYPE_LOCATION,
|
||||
{CONTENT_SETTINGS_TYPE_GEOLOCATION, IDS_PAGE_INFO_TYPE_LOCATION,
|
||||
IDR_BLOCKED_LOCATION, IDR_ALLOWED_LOCATION},
|
||||
{CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
|
||||
IDS_WEBSITE_SETTINGS_TYPE_NOTIFICATIONS, IDR_BLOCKED_NOTIFICATION,
|
||||
IDR_ALLOWED_NOTIFICATION},
|
||||
{CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, IDS_WEBSITE_SETTINGS_TYPE_MIC,
|
||||
{CONTENT_SETTINGS_TYPE_NOTIFICATIONS, IDS_PAGE_INFO_TYPE_NOTIFICATIONS,
|
||||
IDR_BLOCKED_NOTIFICATION, IDR_ALLOWED_NOTIFICATION},
|
||||
{CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, IDS_PAGE_INFO_TYPE_MIC,
|
||||
IDR_BLOCKED_MIC, IDR_ALLOWED_MIC},
|
||||
{CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, IDS_WEBSITE_SETTINGS_TYPE_CAMERA,
|
||||
{CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, IDS_PAGE_INFO_TYPE_CAMERA,
|
||||
IDR_BLOCKED_CAMERA, IDR_ALLOWED_CAMERA},
|
||||
{CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS,
|
||||
IDS_AUTOMATIC_DOWNLOADS_TAB_LABEL, IDR_BLOCKED_DOWNLOADS,
|
||||
IDR_ALLOWED_DOWNLOADS},
|
||||
{CONTENT_SETTINGS_TYPE_MIDI_SYSEX, IDS_WEBSITE_SETTINGS_TYPE_MIDI_SYSEX,
|
||||
{CONTENT_SETTINGS_TYPE_MIDI_SYSEX, IDS_PAGE_INFO_TYPE_MIDI_SYSEX,
|
||||
IDR_BLOCKED_MIDI_SYSEX, IDR_ALLOWED_MIDI_SYSEX},
|
||||
{CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC,
|
||||
IDS_WEBSITE_SETTINGS_TYPE_BACKGROUND_SYNC, IDR_BLOCKED_BACKGROUND_SYNC,
|
||||
IDR_ALLOWED_BACKGROUND_SYNC},
|
||||
{CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC, IDS_PAGE_INFO_TYPE_BACKGROUND_SYNC,
|
||||
IDR_BLOCKED_BACKGROUND_SYNC, IDR_ALLOWED_BACKGROUND_SYNC},
|
||||
// Autoplay is Android-only at the moment, and the Origin Info bubble in
|
||||
// Android ignores these block/allow icon pairs, so we can specify 0 there.
|
||||
{CONTENT_SETTINGS_TYPE_AUTOPLAY, IDS_WEBSITE_SETTINGS_TYPE_AUTOPLAY, 0, 0},
|
||||
{CONTENT_SETTINGS_TYPE_AUTOPLAY, IDS_PAGE_INFO_TYPE_AUTOPLAY, 0, 0},
|
||||
};
|
||||
|
||||
std::unique_ptr<WebsiteSettingsUI::SecurityDescription>
|
||||
CreateSecurityDescription(int summary_id, int details_id) {
|
||||
std::unique_ptr<WebsiteSettingsUI::SecurityDescription> security_description(
|
||||
new WebsiteSettingsUI::SecurityDescription());
|
||||
std::unique_ptr<PageInfoUI::SecurityDescription> CreateSecurityDescription(
|
||||
int summary_id,
|
||||
int details_id) {
|
||||
std::unique_ptr<PageInfoUI::SecurityDescription> security_description(
|
||||
new PageInfoUI::SecurityDescription());
|
||||
security_description->summary = l10n_util::GetStringUTF16(summary_id);
|
||||
security_description->details = l10n_util::GetStringUTF16(details_id);
|
||||
return security_description;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
WebsiteSettingsUI::CookieInfo::CookieInfo() : allowed(-1), blocked(-1) {}
|
||||
PageInfoUI::CookieInfo::CookieInfo() : allowed(-1), blocked(-1) {}
|
||||
|
||||
WebsiteSettingsUI::PermissionInfo::PermissionInfo()
|
||||
PageInfoUI::PermissionInfo::PermissionInfo()
|
||||
: type(CONTENT_SETTINGS_TYPE_DEFAULT),
|
||||
setting(CONTENT_SETTING_DEFAULT),
|
||||
default_setting(CONTENT_SETTING_DEFAULT),
|
||||
source(content_settings::SETTING_SOURCE_NONE),
|
||||
is_incognito(false) {}
|
||||
|
||||
WebsiteSettingsUI::ChosenObjectInfo::ChosenObjectInfo(
|
||||
const WebsiteSettings::ChooserUIInfo& ui_info,
|
||||
PageInfoUI::ChosenObjectInfo::ChosenObjectInfo(
|
||||
const PageInfo::ChooserUIInfo& ui_info,
|
||||
std::unique_ptr<base::DictionaryValue> object)
|
||||
: ui_info(ui_info), object(std::move(object)) {}
|
||||
|
||||
WebsiteSettingsUI::ChosenObjectInfo::~ChosenObjectInfo() {}
|
||||
PageInfoUI::ChosenObjectInfo::~ChosenObjectInfo() {}
|
||||
|
||||
WebsiteSettingsUI::IdentityInfo::IdentityInfo()
|
||||
: identity_status(WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN),
|
||||
connection_status(WebsiteSettings::SITE_CONNECTION_STATUS_UNKNOWN),
|
||||
PageInfoUI::IdentityInfo::IdentityInfo()
|
||||
: identity_status(PageInfo::SITE_IDENTITY_STATUS_UNKNOWN),
|
||||
connection_status(PageInfo::SITE_CONNECTION_STATUS_UNKNOWN),
|
||||
show_ssl_decision_revoke_button(false) {}
|
||||
|
||||
WebsiteSettingsUI::IdentityInfo::~IdentityInfo() {}
|
||||
PageInfoUI::IdentityInfo::~IdentityInfo() {}
|
||||
|
||||
std::unique_ptr<WebsiteSettingsUI::SecurityDescription>
|
||||
WebsiteSettingsUI::IdentityInfo::GetSecurityDescription() const {
|
||||
std::unique_ptr<WebsiteSettingsUI::SecurityDescription> security_description(
|
||||
new WebsiteSettingsUI::SecurityDescription());
|
||||
std::unique_ptr<PageInfoUI::SecurityDescription>
|
||||
PageInfoUI::IdentityInfo::GetSecurityDescription() const {
|
||||
std::unique_ptr<PageInfoUI::SecurityDescription> security_description(
|
||||
new PageInfoUI::SecurityDescription());
|
||||
|
||||
switch (identity_status) {
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_INTERNAL_PAGE:
|
||||
// Internal pages have their own UI implementations which should never
|
||||
// call this function.
|
||||
NOTREACHED();
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_CERT:
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT:
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN:
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_CERT:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_EV_CERT:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT:
|
||||
switch (connection_status) {
|
||||
case WebsiteSettings::
|
||||
SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE:
|
||||
case PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE:
|
||||
return CreateSecurityDescription(IDS_PAGEINFO_NOT_SECURE_SUMMARY,
|
||||
IDS_PAGEINFO_NOT_SECURE_DETAILS);
|
||||
case WebsiteSettings::
|
||||
SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE:
|
||||
case PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE:
|
||||
return CreateSecurityDescription(IDS_PAGEINFO_MIXED_CONTENT_SUMMARY,
|
||||
IDS_PAGEINFO_MIXED_CONTENT_DETAILS);
|
||||
default:
|
||||
return CreateSecurityDescription(IDS_PAGEINFO_SECURE_SUMMARY,
|
||||
IDS_PAGEINFO_SECURE_DETAILS);
|
||||
}
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_MALWARE:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_MALWARE:
|
||||
return CreateSecurityDescription(IDS_PAGEINFO_MALWARE_SUMMARY,
|
||||
IDS_PAGEINFO_MALWARE_DETAILS);
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_SOCIAL_ENGINEERING:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_SOCIAL_ENGINEERING:
|
||||
return CreateSecurityDescription(IDS_PAGEINFO_SOCIAL_ENGINEERING_SUMMARY,
|
||||
IDS_PAGEINFO_SOCIAL_ENGINEERING_DETAILS);
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE:
|
||||
return CreateSecurityDescription(IDS_PAGEINFO_UNWANTED_SOFTWARE_SUMMARY,
|
||||
IDS_PAGEINFO_UNWANTED_SOFTWARE_DETAILS);
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM:
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN:
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_NO_CERT:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_UNKNOWN:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_NO_CERT:
|
||||
default:
|
||||
return CreateSecurityDescription(IDS_PAGEINFO_NOT_SECURE_SUMMARY,
|
||||
IDS_PAGEINFO_NOT_SECURE_DETAILS);
|
||||
}
|
||||
}
|
||||
|
||||
WebsiteSettingsUI::~WebsiteSettingsUI() {}
|
||||
PageInfoUI::~PageInfoUI() {}
|
||||
|
||||
// static
|
||||
base::string16 WebsiteSettingsUI::PermissionTypeToUIString(
|
||||
ContentSettingsType type) {
|
||||
base::string16 PageInfoUI::PermissionTypeToUIString(ContentSettingsType type) {
|
||||
for (const PermissionsUIInfo& info : kPermissionsUIInfo) {
|
||||
if (info.type == type)
|
||||
return l10n_util::GetStringUTF16(info.string_id);
|
||||
@ -209,15 +205,14 @@ base::string16 WebsiteSettingsUI::PermissionTypeToUIString(
|
||||
}
|
||||
|
||||
// static
|
||||
base::string16 WebsiteSettingsUI::PermissionValueToUIString(
|
||||
ContentSetting value) {
|
||||
base::string16 PageInfoUI::PermissionValueToUIString(ContentSetting value) {
|
||||
switch (value) {
|
||||
case CONTENT_SETTING_ALLOW:
|
||||
return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_PERMISSION_ALLOW);
|
||||
return l10n_util::GetStringUTF16(IDS_PAGE_INFO_PERMISSION_ALLOW);
|
||||
case CONTENT_SETTING_BLOCK:
|
||||
return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_PERMISSION_BLOCK);
|
||||
return l10n_util::GetStringUTF16(IDS_PAGE_INFO_PERMISSION_BLOCK);
|
||||
case CONTENT_SETTING_ASK:
|
||||
return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_PERMISSION_ASK);
|
||||
return l10n_util::GetStringUTF16(IDS_PAGE_INFO_PERMISSION_ASK);
|
||||
default:
|
||||
NOTREACHED();
|
||||
return base::string16();
|
||||
@ -225,7 +220,7 @@ base::string16 WebsiteSettingsUI::PermissionValueToUIString(
|
||||
}
|
||||
|
||||
// static
|
||||
base::string16 WebsiteSettingsUI::PermissionActionToUIString(
|
||||
base::string16 PageInfoUI::PermissionActionToUIString(
|
||||
Profile* profile,
|
||||
ContentSettingsType type,
|
||||
ContentSetting setting,
|
||||
@ -276,8 +271,8 @@ base::string16 WebsiteSettingsUI::PermissionActionToUIString(
|
||||
}
|
||||
|
||||
// static
|
||||
int WebsiteSettingsUI::GetPermissionIconID(ContentSettingsType type,
|
||||
ContentSetting setting) {
|
||||
int PageInfoUI::GetPermissionIconID(ContentSettingsType type,
|
||||
ContentSetting setting) {
|
||||
bool use_blocked = (setting == CONTENT_SETTING_BLOCK);
|
||||
for (const PermissionsUIInfo& info : kPermissionsUIInfo) {
|
||||
if (info.type == type)
|
||||
@ -288,8 +283,7 @@ int WebsiteSettingsUI::GetPermissionIconID(ContentSettingsType type,
|
||||
}
|
||||
|
||||
// static
|
||||
const gfx::Image& WebsiteSettingsUI::GetPermissionIcon(
|
||||
const PermissionInfo& info) {
|
||||
const gfx::Image& PageInfoUI::GetPermissionIcon(const PermissionInfo& info) {
|
||||
ContentSetting setting = info.setting;
|
||||
if (setting == CONTENT_SETTING_DEFAULT)
|
||||
setting = info.default_setting;
|
||||
@ -298,7 +292,7 @@ const gfx::Image& WebsiteSettingsUI::GetPermissionIcon(
|
||||
}
|
||||
|
||||
// static
|
||||
base::string16 WebsiteSettingsUI::ChosenObjectToUIString(
|
||||
base::string16 PageInfoUI::ChosenObjectToUIString(
|
||||
const ChosenObjectInfo& object) {
|
||||
base::string16 name;
|
||||
object.object->GetString(object.ui_info.ui_name_key, &name);
|
||||
@ -306,7 +300,7 @@ base::string16 WebsiteSettingsUI::ChosenObjectToUIString(
|
||||
}
|
||||
|
||||
// static
|
||||
const gfx::Image& WebsiteSettingsUI::GetChosenObjectIcon(
|
||||
const gfx::Image& PageInfoUI::GetChosenObjectIcon(
|
||||
const ChosenObjectInfo& object,
|
||||
bool deleted) {
|
||||
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
|
||||
@ -315,30 +309,29 @@ const gfx::Image& WebsiteSettingsUI::GetChosenObjectIcon(
|
||||
}
|
||||
|
||||
// static
|
||||
int WebsiteSettingsUI::GetIdentityIconID(
|
||||
WebsiteSettings::SiteIdentityStatus status) {
|
||||
int PageInfoUI::GetIdentityIconID(PageInfo::SiteIdentityStatus status) {
|
||||
int resource_id = IDR_PAGEINFO_INFO;
|
||||
switch (status) {
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN:
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_UNKNOWN:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_INTERNAL_PAGE:
|
||||
break;
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_CERT:
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_CERT:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_EV_CERT:
|
||||
resource_id = IDR_PAGEINFO_GOOD;
|
||||
break;
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN:
|
||||
resource_id = IDR_PAGEINFO_WARNING_MINOR;
|
||||
break;
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_NO_CERT:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_NO_CERT:
|
||||
resource_id = IDR_PAGEINFO_WARNING_MAJOR;
|
||||
break;
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_ERROR:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_ERROR:
|
||||
resource_id = IDR_PAGEINFO_BAD;
|
||||
break;
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT:
|
||||
resource_id = IDR_PAGEINFO_ENTERPRISE_MANAGED;
|
||||
break;
|
||||
case WebsiteSettings::SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM:
|
||||
case PageInfo::SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM:
|
||||
resource_id = IDR_PAGEINFO_WARNING_MINOR;
|
||||
break;
|
||||
default:
|
||||
@ -349,31 +342,30 @@ int WebsiteSettingsUI::GetIdentityIconID(
|
||||
}
|
||||
|
||||
// static
|
||||
const gfx::Image& WebsiteSettingsUI::GetIdentityIcon(
|
||||
WebsiteSettings::SiteIdentityStatus status) {
|
||||
const gfx::Image& PageInfoUI::GetIdentityIcon(
|
||||
PageInfo::SiteIdentityStatus status) {
|
||||
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
|
||||
return rb.GetNativeImageNamed(GetIdentityIconID(status));
|
||||
}
|
||||
|
||||
// static
|
||||
int WebsiteSettingsUI::GetConnectionIconID(
|
||||
WebsiteSettings::SiteConnectionStatus status) {
|
||||
int PageInfoUI::GetConnectionIconID(PageInfo::SiteConnectionStatus status) {
|
||||
int resource_id = IDR_PAGEINFO_INFO;
|
||||
switch (status) {
|
||||
case WebsiteSettings::SITE_CONNECTION_STATUS_UNKNOWN:
|
||||
case WebsiteSettings::SITE_CONNECTION_STATUS_INTERNAL_PAGE:
|
||||
case PageInfo::SITE_CONNECTION_STATUS_UNKNOWN:
|
||||
case PageInfo::SITE_CONNECTION_STATUS_INTERNAL_PAGE:
|
||||
break;
|
||||
case WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED:
|
||||
case PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED:
|
||||
resource_id = IDR_PAGEINFO_GOOD;
|
||||
break;
|
||||
case WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE:
|
||||
case PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE:
|
||||
resource_id = IDR_PAGEINFO_WARNING_MINOR;
|
||||
break;
|
||||
case WebsiteSettings::SITE_CONNECTION_STATUS_UNENCRYPTED:
|
||||
case PageInfo::SITE_CONNECTION_STATUS_UNENCRYPTED:
|
||||
resource_id = IDR_PAGEINFO_WARNING_MAJOR;
|
||||
break;
|
||||
case WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE:
|
||||
case WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED_ERROR:
|
||||
case PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE:
|
||||
case PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED_ERROR:
|
||||
resource_id = IDR_PAGEINFO_BAD;
|
||||
break;
|
||||
}
|
||||
@ -381,8 +373,8 @@ int WebsiteSettingsUI::GetConnectionIconID(
|
||||
}
|
||||
|
||||
// static
|
||||
const gfx::Image& WebsiteSettingsUI::GetConnectionIcon(
|
||||
WebsiteSettings::SiteConnectionStatus status) {
|
||||
const gfx::Image& PageInfoUI::GetConnectionIcon(
|
||||
PageInfo::SiteConnectionStatus status) {
|
||||
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
|
||||
return rb.GetNativeImageNamed(GetConnectionIconID(status));
|
||||
}
|
@ -2,21 +2,21 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CHROME_BROWSER_UI_PAGE_INFO_WEBSITE_SETTINGS_UI_H_
|
||||
#define CHROME_BROWSER_UI_PAGE_INFO_WEBSITE_SETTINGS_UI_H_
|
||||
#ifndef CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_UI_H_
|
||||
#define CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_UI_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/strings/string16.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings.h"
|
||||
#include "chrome/browser/ui/page_info/page_info.h"
|
||||
#include "components/content_settings/core/common/content_settings.h"
|
||||
#include "components/content_settings/core/common/content_settings_types.h"
|
||||
#include "ui/gfx/native_widget_types.h"
|
||||
|
||||
class Profile;
|
||||
class WebsiteSettings;
|
||||
class PageInfo;
|
||||
|
||||
namespace gfx {
|
||||
class Image;
|
||||
@ -26,15 +26,15 @@ namespace net {
|
||||
class X509Certificate;
|
||||
}
|
||||
|
||||
// The class |WebsiteSettingsUI| specifies the platform independent
|
||||
// interface of the website settings UI. The website settings UI displays
|
||||
// The class |PageInfoUI| specifies the platform independent
|
||||
// interface of the page info UI. The page info UI displays
|
||||
// information and controls for site specific data (local stored objects like
|
||||
// cookies), site specific permissions (location, popup, plugin, etc.
|
||||
// permissions) and site specific information (identity, connection status,
|
||||
// etc.).
|
||||
class WebsiteSettingsUI {
|
||||
class PageInfoUI {
|
||||
public:
|
||||
// The Website Settings UI contains several tabs. Each tab is associated with
|
||||
// The Page Info UI contains several tabs. Each tab is associated with
|
||||
// a unique tab id. The enum |TabId| contains all the ids for the tabs.
|
||||
enum TabId {
|
||||
TAB_ID_PERMISSIONS = 0,
|
||||
@ -89,11 +89,11 @@ class WebsiteSettingsUI {
|
||||
// |ChosenObjectInfo| contains information about a single |object| of a
|
||||
// chooser |type| that the current website has been granted access to.
|
||||
struct ChosenObjectInfo {
|
||||
ChosenObjectInfo(const WebsiteSettings::ChooserUIInfo& ui_info,
|
||||
ChosenObjectInfo(const PageInfo::ChooserUIInfo& ui_info,
|
||||
std::unique_ptr<base::DictionaryValue> object);
|
||||
~ChosenObjectInfo();
|
||||
// |ui_info| for this chosen object type.
|
||||
const WebsiteSettings::ChooserUIInfo& ui_info;
|
||||
const PageInfo::ChooserUIInfo& ui_info;
|
||||
// The opaque |object| representing the thing the user selected.
|
||||
std::unique_ptr<base::DictionaryValue> object;
|
||||
};
|
||||
@ -109,7 +109,7 @@ class WebsiteSettingsUI {
|
||||
// sites.
|
||||
std::string site_identity;
|
||||
// Status of the site's identity.
|
||||
WebsiteSettings::SiteIdentityStatus identity_status;
|
||||
PageInfo::SiteIdentityStatus identity_status;
|
||||
// Helper to get security description info to display to the user.
|
||||
std::unique_ptr<SecurityDescription> GetSecurityDescription() const;
|
||||
// Textual description of the site's identity status that is displayed to
|
||||
@ -118,7 +118,7 @@ class WebsiteSettingsUI {
|
||||
// The server certificate if a secure connection.
|
||||
scoped_refptr<net::X509Certificate> certificate;
|
||||
// Status of the site's connection.
|
||||
WebsiteSettings::SiteConnectionStatus connection_status;
|
||||
PageInfo::SiteConnectionStatus connection_status;
|
||||
// Textual description of the site's connection status that is displayed to
|
||||
// the user.
|
||||
std::string connection_status_description;
|
||||
@ -134,7 +134,7 @@ class WebsiteSettingsUI {
|
||||
using PermissionInfoList = std::vector<PermissionInfo>;
|
||||
using ChosenObjectInfoList = std::vector<std::unique_ptr<ChosenObjectInfo>>;
|
||||
|
||||
virtual ~WebsiteSettingsUI();
|
||||
virtual ~PageInfoUI();
|
||||
|
||||
// Returns the UI string for the given permission |type|.
|
||||
static base::string16 PermissionTypeToUIString(ContentSettingsType type);
|
||||
@ -172,18 +172,17 @@ class WebsiteSettingsUI {
|
||||
bool deleted);
|
||||
|
||||
// Returns the identity icon ID for the given identity |status|.
|
||||
static int GetIdentityIconID(WebsiteSettings::SiteIdentityStatus status);
|
||||
static int GetIdentityIconID(PageInfo::SiteIdentityStatus status);
|
||||
|
||||
// Returns the identity icon for the given identity |status|.
|
||||
static const gfx::Image& GetIdentityIcon(
|
||||
WebsiteSettings::SiteIdentityStatus status);
|
||||
static const gfx::Image& GetIdentityIcon(PageInfo::SiteIdentityStatus status);
|
||||
|
||||
// Returns the connection icon ID for the given connection |status|.
|
||||
static int GetConnectionIconID(WebsiteSettings::SiteConnectionStatus status);
|
||||
static int GetConnectionIconID(PageInfo::SiteConnectionStatus status);
|
||||
|
||||
// Returns the connection icon for the given connection |status|.
|
||||
static const gfx::Image& GetConnectionIcon(
|
||||
WebsiteSettings::SiteConnectionStatus status);
|
||||
PageInfo::SiteConnectionStatus status);
|
||||
|
||||
// Sets cookie information.
|
||||
virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) = 0;
|
||||
@ -197,8 +196,8 @@ class WebsiteSettingsUI {
|
||||
virtual void SetIdentityInfo(const IdentityInfo& identity_info) = 0;
|
||||
};
|
||||
|
||||
typedef WebsiteSettingsUI::CookieInfoList CookieInfoList;
|
||||
typedef WebsiteSettingsUI::PermissionInfoList PermissionInfoList;
|
||||
typedef WebsiteSettingsUI::ChosenObjectInfoList ChosenObjectInfoList;
|
||||
typedef PageInfoUI::CookieInfoList CookieInfoList;
|
||||
typedef PageInfoUI::PermissionInfoList PermissionInfoList;
|
||||
typedef PageInfoUI::ChosenObjectInfoList ChosenObjectInfoList;
|
||||
|
||||
#endif // CHROME_BROWSER_UI_PAGE_INFO_WEBSITE_SETTINGS_UI_H_
|
||||
#endif // CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_UI_H_
|
@ -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/ui/page_info/website_settings.h"
|
||||
#include "chrome/browser/ui/page_info/page_info.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -17,7 +17,7 @@
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
||||
#include "chrome/browser/infobars/infobar_service.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings_ui.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_ui.h"
|
||||
#include "chrome/browser/usb/usb_chooser_context.h"
|
||||
#include "chrome/browser/usb/usb_chooser_context_factory.h"
|
||||
#include "chrome/grit/theme_resources.h"
|
||||
@ -68,9 +68,9 @@ int SetSSLCipherSuite(int connection_status, int cipher_suite) {
|
||||
return cipher_suite | connection_status;
|
||||
}
|
||||
|
||||
class MockWebsiteSettingsUI : public WebsiteSettingsUI {
|
||||
class MockPageInfoUI : public PageInfoUI {
|
||||
public:
|
||||
virtual ~MockWebsiteSettingsUI() {}
|
||||
virtual ~MockPageInfoUI() {}
|
||||
MOCK_METHOD1(SetCookieInfo, void(const CookieInfoList& cookie_info_list));
|
||||
MOCK_METHOD0(SetPermissionInfoStub, void());
|
||||
MOCK_METHOD1(SetIdentityInfo, void(const IdentityInfo& identity_info));
|
||||
@ -90,11 +90,11 @@ class MockWebsiteSettingsUI : public WebsiteSettingsUI {
|
||||
set_permission_info_callback_;
|
||||
};
|
||||
|
||||
class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness {
|
||||
class PageInfoTest : public ChromeRenderViewHostTestHarness {
|
||||
public:
|
||||
WebsiteSettingsTest() : url_("http://www.example.com") {}
|
||||
PageInfoTest() : url_("http://www.example.com") {}
|
||||
|
||||
~WebsiteSettingsTest() override {}
|
||||
~PageInfoTest() override {}
|
||||
|
||||
void SetUp() override {
|
||||
ChromeRenderViewHostTestHarness::SetUp();
|
||||
@ -111,22 +111,21 @@ class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness {
|
||||
InfoBarService::CreateForWebContents(web_contents());
|
||||
|
||||
// Setup mock ui.
|
||||
mock_ui_.reset(new MockWebsiteSettingsUI());
|
||||
mock_ui_.reset(new MockPageInfoUI());
|
||||
// Use this rather than gmock's ON_CALL.WillByDefault(Invoke(... because
|
||||
// gmock doesn't handle move-only types well.
|
||||
mock_ui_->set_permission_info_callback_ = base::Bind(
|
||||
&WebsiteSettingsTest::SetPermissionInfo, base::Unretained(this));
|
||||
mock_ui_->set_permission_info_callback_ =
|
||||
base::Bind(&PageInfoTest::SetPermissionInfo, base::Unretained(this));
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
ASSERT_TRUE(website_settings_.get())
|
||||
<< "No WebsiteSettings instance created.";
|
||||
ASSERT_TRUE(page_info_.get()) << "No PageInfo instance created.";
|
||||
RenderViewHostTestHarness::TearDown();
|
||||
website_settings_.reset();
|
||||
page_info_.reset();
|
||||
}
|
||||
|
||||
void SetDefaultUIExpectations(MockWebsiteSettingsUI* mock_ui) {
|
||||
// During creation |WebsiteSettings| makes the following calls to the ui.
|
||||
void SetDefaultUIExpectations(MockPageInfoUI* mock_ui) {
|
||||
// During creation |PageInfo| makes the following calls to the ui.
|
||||
EXPECT_CALL(*mock_ui, SetPermissionInfoStub());
|
||||
EXPECT_CALL(*mock_ui, SetIdentityInfo(_));
|
||||
EXPECT_CALL(*mock_ui, SetCookieInfo(_));
|
||||
@ -141,15 +140,15 @@ class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness {
|
||||
last_chosen_object_info_.push_back(std::move(chosen_object_info));
|
||||
}
|
||||
|
||||
void ResetMockUI() { mock_ui_.reset(new MockWebsiteSettingsUI()); }
|
||||
void ResetMockUI() { mock_ui_.reset(new MockPageInfoUI()); }
|
||||
|
||||
void ClearWebsiteSettings() { website_settings_.reset(nullptr); }
|
||||
void ClearPageInfo() { page_info_.reset(nullptr); }
|
||||
|
||||
const GURL& url() const { return url_; }
|
||||
scoped_refptr<net::X509Certificate> cert() { return cert_; }
|
||||
MockWebsiteSettingsUI* mock_ui() { return mock_ui_.get(); }
|
||||
MockPageInfoUI* mock_ui() { return mock_ui_.get(); }
|
||||
const security_state::SecurityInfo& security_info() { return security_info_; }
|
||||
const std::vector<std::unique_ptr<WebsiteSettingsUI::ChosenObjectInfo>>&
|
||||
const std::vector<std::unique_ptr<PageInfoUI::ChosenObjectInfo>>&
|
||||
last_chosen_object_info() {
|
||||
return last_chosen_object_info_;
|
||||
}
|
||||
@ -160,13 +159,13 @@ class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness {
|
||||
return InfoBarService::FromWebContents(web_contents());
|
||||
}
|
||||
|
||||
WebsiteSettings* website_settings() {
|
||||
if (!website_settings_.get()) {
|
||||
website_settings_.reset(new WebsiteSettings(
|
||||
mock_ui(), profile(), tab_specific_content_settings(), web_contents(),
|
||||
url(), security_info()));
|
||||
PageInfo* page_info() {
|
||||
if (!page_info_.get()) {
|
||||
page_info_.reset(new PageInfo(mock_ui(), profile(),
|
||||
tab_specific_content_settings(),
|
||||
web_contents(), url(), security_info()));
|
||||
}
|
||||
return website_settings_.get();
|
||||
return page_info_.get();
|
||||
}
|
||||
|
||||
device::MockUsbService& usb_service() {
|
||||
@ -177,17 +176,17 @@ class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness {
|
||||
|
||||
private:
|
||||
device::MockDeviceClient device_client_;
|
||||
std::unique_ptr<WebsiteSettings> website_settings_;
|
||||
std::unique_ptr<MockWebsiteSettingsUI> mock_ui_;
|
||||
std::unique_ptr<PageInfo> page_info_;
|
||||
std::unique_ptr<MockPageInfoUI> mock_ui_;
|
||||
scoped_refptr<net::X509Certificate> cert_;
|
||||
GURL url_;
|
||||
std::vector<std::unique_ptr<WebsiteSettingsUI::ChosenObjectInfo>>
|
||||
std::vector<std::unique_ptr<PageInfoUI::ChosenObjectInfo>>
|
||||
last_chosen_object_info_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_F(WebsiteSettingsTest, OnPermissionsChanged) {
|
||||
TEST_F(PageInfoTest, OnPermissionsChanged) {
|
||||
// Setup site permissions.
|
||||
HostContentSettingsMap* content_settings =
|
||||
HostContentSettingsMapFactory::GetForProfile(profile());
|
||||
@ -225,20 +224,20 @@ TEST_F(WebsiteSettingsTest, OnPermissionsChanged) {
|
||||
#endif
|
||||
|
||||
// Execute code under tests.
|
||||
website_settings()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_POPUPS,
|
||||
CONTENT_SETTING_ALLOW);
|
||||
page_info()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_POPUPS,
|
||||
CONTENT_SETTING_ALLOW);
|
||||
#if BUILDFLAG(ENABLE_PLUGINS)
|
||||
website_settings()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_PLUGINS,
|
||||
CONTENT_SETTING_BLOCK);
|
||||
page_info()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_PLUGINS,
|
||||
CONTENT_SETTING_BLOCK);
|
||||
#endif
|
||||
website_settings()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_GEOLOCATION,
|
||||
CONTENT_SETTING_ALLOW);
|
||||
website_settings()->OnSitePermissionChanged(
|
||||
CONTENT_SETTINGS_TYPE_NOTIFICATIONS, CONTENT_SETTING_ALLOW);
|
||||
website_settings()->OnSitePermissionChanged(
|
||||
CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, CONTENT_SETTING_ALLOW);
|
||||
website_settings()->OnSitePermissionChanged(
|
||||
CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, CONTENT_SETTING_ALLOW);
|
||||
page_info()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_GEOLOCATION,
|
||||
CONTENT_SETTING_ALLOW);
|
||||
page_info()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
|
||||
CONTENT_SETTING_ALLOW);
|
||||
page_info()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
|
||||
CONTENT_SETTING_ALLOW);
|
||||
page_info()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA,
|
||||
CONTENT_SETTING_ALLOW);
|
||||
|
||||
// Verify that the site permissions were changed correctly.
|
||||
setting = content_settings->GetContentSetting(
|
||||
@ -263,15 +262,15 @@ TEST_F(WebsiteSettingsTest, OnPermissionsChanged) {
|
||||
EXPECT_EQ(setting, CONTENT_SETTING_ALLOW);
|
||||
}
|
||||
|
||||
TEST_F(WebsiteSettingsTest, OnSiteDataAccessed) {
|
||||
TEST_F(PageInfoTest, OnSiteDataAccessed) {
|
||||
EXPECT_CALL(*mock_ui(), SetPermissionInfoStub());
|
||||
EXPECT_CALL(*mock_ui(), SetIdentityInfo(_));
|
||||
EXPECT_CALL(*mock_ui(), SetCookieInfo(_)).Times(2);
|
||||
|
||||
website_settings()->OnSiteDataAccessed();
|
||||
page_info()->OnSiteDataAccessed();
|
||||
}
|
||||
|
||||
TEST_F(WebsiteSettingsTest, OnChosenObjectDeleted) {
|
||||
TEST_F(PageInfoTest, OnChosenObjectDeleted) {
|
||||
scoped_refptr<device::UsbDevice> device =
|
||||
new device::MockUsbDevice(0, 0, "Google", "Gizmo", "1234567890");
|
||||
usb_service().AddDevice(device);
|
||||
@ -281,67 +280,66 @@ TEST_F(WebsiteSettingsTest, OnChosenObjectDeleted) {
|
||||
EXPECT_CALL(*mock_ui(), SetIdentityInfo(_));
|
||||
EXPECT_CALL(*mock_ui(), SetCookieInfo(_));
|
||||
|
||||
// Access WebsiteSettings so that SetPermissionInfo is called once to populate
|
||||
// Access PageInfo so that SetPermissionInfo is called once to populate
|
||||
// |last_chosen_object_info_|. It will be called again by
|
||||
// OnSiteChosenObjectDeleted.
|
||||
EXPECT_CALL(*mock_ui(), SetPermissionInfoStub()).Times(2);
|
||||
website_settings();
|
||||
page_info();
|
||||
|
||||
ASSERT_EQ(1u, last_chosen_object_info().size());
|
||||
const WebsiteSettingsUI::ChosenObjectInfo* info =
|
||||
last_chosen_object_info()[0].get();
|
||||
website_settings()->OnSiteChosenObjectDeleted(info->ui_info, *info->object);
|
||||
const PageInfoUI::ChosenObjectInfo* info = last_chosen_object_info()[0].get();
|
||||
page_info()->OnSiteChosenObjectDeleted(info->ui_info, *info->object);
|
||||
|
||||
EXPECT_FALSE(store->HasDevicePermission(url(), url(), device));
|
||||
EXPECT_EQ(0u, last_chosen_object_info().size());
|
||||
}
|
||||
|
||||
TEST_F(WebsiteSettingsTest, Malware) {
|
||||
TEST_F(PageInfoTest, Malware) {
|
||||
security_info_.security_level = security_state::DANGEROUS;
|
||||
security_info_.malicious_content_status =
|
||||
security_state::MALICIOUS_CONTENT_STATUS_MALWARE;
|
||||
SetDefaultUIExpectations(mock_ui());
|
||||
|
||||
EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_UNENCRYPTED,
|
||||
website_settings()->site_connection_status());
|
||||
EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_MALWARE,
|
||||
website_settings()->site_identity_status());
|
||||
EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_UNENCRYPTED,
|
||||
page_info()->site_connection_status());
|
||||
EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_MALWARE,
|
||||
page_info()->site_identity_status());
|
||||
}
|
||||
|
||||
TEST_F(WebsiteSettingsTest, SocialEngineering) {
|
||||
TEST_F(PageInfoTest, SocialEngineering) {
|
||||
security_info_.security_level = security_state::DANGEROUS;
|
||||
security_info_.malicious_content_status =
|
||||
security_state::MALICIOUS_CONTENT_STATUS_SOCIAL_ENGINEERING;
|
||||
SetDefaultUIExpectations(mock_ui());
|
||||
|
||||
EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_UNENCRYPTED,
|
||||
website_settings()->site_connection_status());
|
||||
EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_SOCIAL_ENGINEERING,
|
||||
website_settings()->site_identity_status());
|
||||
EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_UNENCRYPTED,
|
||||
page_info()->site_connection_status());
|
||||
EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_SOCIAL_ENGINEERING,
|
||||
page_info()->site_identity_status());
|
||||
}
|
||||
|
||||
TEST_F(WebsiteSettingsTest, UnwantedSoftware) {
|
||||
TEST_F(PageInfoTest, UnwantedSoftware) {
|
||||
security_info_.security_level = security_state::DANGEROUS;
|
||||
security_info_.malicious_content_status =
|
||||
security_state::MALICIOUS_CONTENT_STATUS_UNWANTED_SOFTWARE;
|
||||
SetDefaultUIExpectations(mock_ui());
|
||||
|
||||
EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_UNENCRYPTED,
|
||||
website_settings()->site_connection_status());
|
||||
EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE,
|
||||
website_settings()->site_identity_status());
|
||||
EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_UNENCRYPTED,
|
||||
page_info()->site_connection_status());
|
||||
EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE,
|
||||
page_info()->site_identity_status());
|
||||
}
|
||||
|
||||
TEST_F(WebsiteSettingsTest, HTTPConnection) {
|
||||
TEST_F(PageInfoTest, HTTPConnection) {
|
||||
SetDefaultUIExpectations(mock_ui());
|
||||
EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_UNENCRYPTED,
|
||||
website_settings()->site_connection_status());
|
||||
EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_NO_CERT,
|
||||
website_settings()->site_identity_status());
|
||||
EXPECT_EQ(base::string16(), website_settings()->organization_name());
|
||||
EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_UNENCRYPTED,
|
||||
page_info()->site_connection_status());
|
||||
EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_NO_CERT,
|
||||
page_info()->site_identity_status());
|
||||
EXPECT_EQ(base::string16(), page_info()->organization_name());
|
||||
}
|
||||
|
||||
TEST_F(WebsiteSettingsTest, HTTPSConnection) {
|
||||
TEST_F(PageInfoTest, HTTPSConnection) {
|
||||
security_info_.security_level = security_state::SECURE;
|
||||
security_info_.scheme_is_cryptographic = true;
|
||||
security_info_.certificate = cert();
|
||||
@ -354,21 +352,21 @@ TEST_F(WebsiteSettingsTest, HTTPSConnection) {
|
||||
|
||||
SetDefaultUIExpectations(mock_ui());
|
||||
|
||||
EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED,
|
||||
website_settings()->site_connection_status());
|
||||
EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_CERT,
|
||||
website_settings()->site_identity_status());
|
||||
EXPECT_EQ(base::string16(), website_settings()->organization_name());
|
||||
EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED,
|
||||
page_info()->site_connection_status());
|
||||
EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_CERT,
|
||||
page_info()->site_identity_status());
|
||||
EXPECT_EQ(base::string16(), page_info()->organization_name());
|
||||
}
|
||||
|
||||
TEST_F(WebsiteSettingsTest, InsecureContent) {
|
||||
TEST_F(PageInfoTest, InsecureContent) {
|
||||
struct TestCase {
|
||||
security_state::SecurityLevel security_level;
|
||||
net::CertStatus cert_status;
|
||||
security_state::ContentStatus mixed_content_status;
|
||||
security_state::ContentStatus content_with_cert_errors_status;
|
||||
WebsiteSettings::SiteConnectionStatus expected_site_connection_status;
|
||||
WebsiteSettings::SiteIdentityStatus expected_site_identity_status;
|
||||
PageInfo::SiteConnectionStatus expected_site_connection_status;
|
||||
PageInfo::SiteIdentityStatus expected_site_identity_status;
|
||||
int expected_connection_icon_id;
|
||||
};
|
||||
|
||||
@ -376,43 +374,43 @@ TEST_F(WebsiteSettingsTest, InsecureContent) {
|
||||
// Passive mixed content.
|
||||
{security_state::NONE, 0, security_state::CONTENT_STATUS_DISPLAYED,
|
||||
security_state::CONTENT_STATUS_NONE,
|
||||
WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE,
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_WARNING_MINOR},
|
||||
PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE,
|
||||
PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_WARNING_MINOR},
|
||||
// Passive mixed content with a cert error on the main resource.
|
||||
{security_state::DANGEROUS, net::CERT_STATUS_DATE_INVALID,
|
||||
security_state::CONTENT_STATUS_DISPLAYED,
|
||||
security_state::CONTENT_STATUS_NONE,
|
||||
WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE,
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_WARNING_MINOR},
|
||||
PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE,
|
||||
PageInfo::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_WARNING_MINOR},
|
||||
// Active and passive mixed content.
|
||||
{security_state::DANGEROUS, 0,
|
||||
security_state::CONTENT_STATUS_DISPLAYED_AND_RAN,
|
||||
security_state::CONTENT_STATUS_NONE,
|
||||
WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE,
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD},
|
||||
PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE,
|
||||
PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD},
|
||||
// Active and passive mixed content with a cert error on the main
|
||||
// resource.
|
||||
{security_state::DANGEROUS, net::CERT_STATUS_DATE_INVALID,
|
||||
security_state::CONTENT_STATUS_DISPLAYED_AND_RAN,
|
||||
security_state::CONTENT_STATUS_NONE,
|
||||
WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE,
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_BAD},
|
||||
PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE,
|
||||
PageInfo::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_BAD},
|
||||
// Active mixed content.
|
||||
{security_state::DANGEROUS, 0, security_state::CONTENT_STATUS_RAN,
|
||||
security_state::CONTENT_STATUS_NONE,
|
||||
WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE,
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD},
|
||||
PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE,
|
||||
PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD},
|
||||
// Active mixed content with a cert error on the main resource.
|
||||
{security_state::DANGEROUS, net::CERT_STATUS_DATE_INVALID,
|
||||
security_state::CONTENT_STATUS_RAN, security_state::CONTENT_STATUS_NONE,
|
||||
WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE,
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_BAD},
|
||||
PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE,
|
||||
PageInfo::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_BAD},
|
||||
|
||||
// Passive subresources with cert errors.
|
||||
{security_state::NONE, 0, security_state::CONTENT_STATUS_NONE,
|
||||
security_state::CONTENT_STATUS_DISPLAYED,
|
||||
WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE,
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_WARNING_MINOR},
|
||||
PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE,
|
||||
PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_WARNING_MINOR},
|
||||
// Passive subresources with cert errors, with a cert error on the
|
||||
// main resource also. In this case, the subresources with
|
||||
// certificate errors are ignored: if the main resource had a cert
|
||||
@ -421,59 +419,59 @@ TEST_F(WebsiteSettingsTest, InsecureContent) {
|
||||
{security_state::DANGEROUS, net::CERT_STATUS_DATE_INVALID,
|
||||
security_state::CONTENT_STATUS_NONE,
|
||||
security_state::CONTENT_STATUS_DISPLAYED,
|
||||
WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED,
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_GOOD},
|
||||
PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED,
|
||||
PageInfo::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_GOOD},
|
||||
// Passive and active subresources with cert errors.
|
||||
{security_state::DANGEROUS, 0, security_state::CONTENT_STATUS_NONE,
|
||||
security_state::CONTENT_STATUS_DISPLAYED_AND_RAN,
|
||||
WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE,
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD},
|
||||
PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE,
|
||||
PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD},
|
||||
// Passive and active subresources with cert errors, with a cert
|
||||
// error on the main resource also.
|
||||
{security_state::DANGEROUS, net::CERT_STATUS_DATE_INVALID,
|
||||
security_state::CONTENT_STATUS_NONE,
|
||||
security_state::CONTENT_STATUS_DISPLAYED_AND_RAN,
|
||||
WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED,
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_GOOD},
|
||||
PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED,
|
||||
PageInfo::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_GOOD},
|
||||
// Active subresources with cert errors.
|
||||
{security_state::DANGEROUS, 0, security_state::CONTENT_STATUS_NONE,
|
||||
security_state::CONTENT_STATUS_RAN,
|
||||
WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE,
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD},
|
||||
PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE,
|
||||
PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD},
|
||||
// Active subresources with cert errors, with a cert error on the main
|
||||
// resource also.
|
||||
{security_state::DANGEROUS, net::CERT_STATUS_DATE_INVALID,
|
||||
security_state::CONTENT_STATUS_NONE, security_state::CONTENT_STATUS_RAN,
|
||||
WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED,
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_GOOD},
|
||||
PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED,
|
||||
PageInfo::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_GOOD},
|
||||
|
||||
// Passive mixed content and subresources with cert errors.
|
||||
{security_state::NONE, 0, security_state::CONTENT_STATUS_DISPLAYED,
|
||||
security_state::CONTENT_STATUS_DISPLAYED,
|
||||
WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE,
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_WARNING_MINOR},
|
||||
PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE,
|
||||
PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_WARNING_MINOR},
|
||||
// Passive mixed content and active subresources with cert errors.
|
||||
{security_state::DANGEROUS, 0, security_state::CONTENT_STATUS_DISPLAYED,
|
||||
security_state::CONTENT_STATUS_RAN,
|
||||
WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE,
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD},
|
||||
PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE,
|
||||
PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD},
|
||||
// Active mixed content and passive subresources with cert errors.
|
||||
{security_state::DANGEROUS, 0, security_state::CONTENT_STATUS_RAN,
|
||||
security_state::CONTENT_STATUS_DISPLAYED,
|
||||
WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE,
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD},
|
||||
PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE,
|
||||
PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD},
|
||||
// Passive mixed content, active subresources with cert errors, and a cert
|
||||
// error on the main resource.
|
||||
{security_state::DANGEROUS, net::CERT_STATUS_DATE_INVALID,
|
||||
security_state::CONTENT_STATUS_DISPLAYED,
|
||||
security_state::CONTENT_STATUS_RAN,
|
||||
WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE,
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_WARNING_MINOR},
|
||||
PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE,
|
||||
PageInfo::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_WARNING_MINOR},
|
||||
};
|
||||
|
||||
for (const auto& test : kTestCases) {
|
||||
ResetMockUI();
|
||||
ClearWebsiteSettings();
|
||||
ClearPageInfo();
|
||||
security_info_ = security_state::SecurityInfo();
|
||||
security_info_.security_level = test.security_level;
|
||||
security_info_.scheme_is_cryptographic = true;
|
||||
@ -491,17 +489,17 @@ TEST_F(WebsiteSettingsTest, InsecureContent) {
|
||||
SetDefaultUIExpectations(mock_ui());
|
||||
|
||||
EXPECT_EQ(test.expected_site_connection_status,
|
||||
website_settings()->site_connection_status());
|
||||
page_info()->site_connection_status());
|
||||
EXPECT_EQ(test.expected_site_identity_status,
|
||||
website_settings()->site_identity_status());
|
||||
EXPECT_EQ(test.expected_connection_icon_id,
|
||||
WebsiteSettingsUI::GetConnectionIconID(
|
||||
website_settings()->site_connection_status()));
|
||||
EXPECT_EQ(base::string16(), website_settings()->organization_name());
|
||||
page_info()->site_identity_status());
|
||||
EXPECT_EQ(
|
||||
test.expected_connection_icon_id,
|
||||
PageInfoUI::GetConnectionIconID(page_info()->site_connection_status()));
|
||||
EXPECT_EQ(base::string16(), page_info()->organization_name());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(WebsiteSettingsTest, HTTPSEVCert) {
|
||||
TEST_F(PageInfoTest, HTTPSEVCert) {
|
||||
scoped_refptr<net::X509Certificate> ev_cert =
|
||||
net::X509Certificate::CreateFromBytes(
|
||||
reinterpret_cast<const char*>(google_der), sizeof(google_der));
|
||||
@ -521,16 +519,14 @@ TEST_F(WebsiteSettingsTest, HTTPSEVCert) {
|
||||
|
||||
SetDefaultUIExpectations(mock_ui());
|
||||
|
||||
EXPECT_EQ(
|
||||
WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE,
|
||||
website_settings()->site_connection_status());
|
||||
EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT,
|
||||
website_settings()->site_identity_status());
|
||||
EXPECT_EQ(base::UTF8ToUTF16("Google Inc"),
|
||||
website_settings()->organization_name());
|
||||
EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE,
|
||||
page_info()->site_connection_status());
|
||||
EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_EV_CERT,
|
||||
page_info()->site_identity_status());
|
||||
EXPECT_EQ(base::UTF8ToUTF16("Google Inc"), page_info()->organization_name());
|
||||
}
|
||||
|
||||
TEST_F(WebsiteSettingsTest, HTTPSRevocationError) {
|
||||
TEST_F(PageInfoTest, HTTPSRevocationError) {
|
||||
security_info_.security_level = security_state::SECURE;
|
||||
security_info_.scheme_is_cryptographic = true;
|
||||
security_info_.certificate = cert();
|
||||
@ -543,14 +539,14 @@ TEST_F(WebsiteSettingsTest, HTTPSRevocationError) {
|
||||
|
||||
SetDefaultUIExpectations(mock_ui());
|
||||
|
||||
EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED,
|
||||
website_settings()->site_connection_status());
|
||||
EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN,
|
||||
website_settings()->site_identity_status());
|
||||
EXPECT_EQ(base::string16(), website_settings()->organization_name());
|
||||
EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED,
|
||||
page_info()->site_connection_status());
|
||||
EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN,
|
||||
page_info()->site_identity_status());
|
||||
EXPECT_EQ(base::string16(), page_info()->organization_name());
|
||||
}
|
||||
|
||||
TEST_F(WebsiteSettingsTest, HTTPSConnectionError) {
|
||||
TEST_F(PageInfoTest, HTTPSConnectionError) {
|
||||
security_info_.security_level = security_state::SECURE;
|
||||
security_info_.scheme_is_cryptographic = true;
|
||||
security_info_.certificate = cert();
|
||||
@ -563,14 +559,14 @@ TEST_F(WebsiteSettingsTest, HTTPSConnectionError) {
|
||||
|
||||
SetDefaultUIExpectations(mock_ui());
|
||||
|
||||
EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED_ERROR,
|
||||
website_settings()->site_connection_status());
|
||||
EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_CERT,
|
||||
website_settings()->site_identity_status());
|
||||
EXPECT_EQ(base::string16(), website_settings()->organization_name());
|
||||
EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED_ERROR,
|
||||
page_info()->site_connection_status());
|
||||
EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_CERT,
|
||||
page_info()->site_identity_status());
|
||||
EXPECT_EQ(base::string16(), page_info()->organization_name());
|
||||
}
|
||||
|
||||
TEST_F(WebsiteSettingsTest, HTTPSPolicyCertConnection) {
|
||||
TEST_F(PageInfoTest, HTTPSPolicyCertConnection) {
|
||||
security_info_.security_level =
|
||||
security_state::SECURE_WITH_POLICY_INSTALLED_CERT;
|
||||
security_info_.scheme_is_cryptographic = true;
|
||||
@ -584,14 +580,14 @@ TEST_F(WebsiteSettingsTest, HTTPSPolicyCertConnection) {
|
||||
|
||||
SetDefaultUIExpectations(mock_ui());
|
||||
|
||||
EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED,
|
||||
website_settings()->site_connection_status());
|
||||
EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT,
|
||||
website_settings()->site_identity_status());
|
||||
EXPECT_EQ(base::string16(), website_settings()->organization_name());
|
||||
EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED,
|
||||
page_info()->site_connection_status());
|
||||
EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT,
|
||||
page_info()->site_identity_status());
|
||||
EXPECT_EQ(base::string16(), page_info()->organization_name());
|
||||
}
|
||||
|
||||
TEST_F(WebsiteSettingsTest, HTTPSSHA1) {
|
||||
TEST_F(PageInfoTest, HTTPSSHA1) {
|
||||
security_info_.security_level = security_state::NONE;
|
||||
security_info_.scheme_is_cryptographic = true;
|
||||
security_info_.certificate = cert();
|
||||
@ -605,68 +601,66 @@ TEST_F(WebsiteSettingsTest, HTTPSSHA1) {
|
||||
|
||||
SetDefaultUIExpectations(mock_ui());
|
||||
|
||||
EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED,
|
||||
website_settings()->site_connection_status());
|
||||
EXPECT_EQ(
|
||||
WebsiteSettings::SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM,
|
||||
website_settings()->site_identity_status());
|
||||
EXPECT_EQ(base::string16(), website_settings()->organization_name());
|
||||
EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED,
|
||||
page_info()->site_connection_status());
|
||||
EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM,
|
||||
page_info()->site_identity_status());
|
||||
EXPECT_EQ(base::string16(), page_info()->organization_name());
|
||||
EXPECT_EQ(IDR_PAGEINFO_WARNING_MINOR,
|
||||
WebsiteSettingsUI::GetIdentityIconID(
|
||||
website_settings()->site_identity_status()));
|
||||
PageInfoUI::GetIdentityIconID(page_info()->site_identity_status()));
|
||||
}
|
||||
|
||||
#if !defined(OS_ANDROID)
|
||||
TEST_F(WebsiteSettingsTest, NoInfoBar) {
|
||||
TEST_F(PageInfoTest, NoInfoBar) {
|
||||
SetDefaultUIExpectations(mock_ui());
|
||||
EXPECT_EQ(0u, infobar_service()->infobar_count());
|
||||
website_settings()->OnUIClosing();
|
||||
page_info()->OnUIClosing();
|
||||
EXPECT_EQ(0u, infobar_service()->infobar_count());
|
||||
}
|
||||
|
||||
TEST_F(WebsiteSettingsTest, ShowInfoBar) {
|
||||
TEST_F(PageInfoTest, ShowInfoBar) {
|
||||
EXPECT_CALL(*mock_ui(), SetIdentityInfo(_));
|
||||
EXPECT_CALL(*mock_ui(), SetCookieInfo(_));
|
||||
|
||||
EXPECT_CALL(*mock_ui(), SetPermissionInfoStub()).Times(2);
|
||||
|
||||
EXPECT_EQ(0u, infobar_service()->infobar_count());
|
||||
website_settings()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_GEOLOCATION,
|
||||
CONTENT_SETTING_ALLOW);
|
||||
website_settings()->OnUIClosing();
|
||||
page_info()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_GEOLOCATION,
|
||||
CONTENT_SETTING_ALLOW);
|
||||
page_info()->OnUIClosing();
|
||||
ASSERT_EQ(1u, infobar_service()->infobar_count());
|
||||
|
||||
infobar_service()->RemoveInfoBar(infobar_service()->infobar_at(0));
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_F(WebsiteSettingsTest, AboutBlankPage) {
|
||||
TEST_F(PageInfoTest, AboutBlankPage) {
|
||||
SetURL("about:blank");
|
||||
SetDefaultUIExpectations(mock_ui());
|
||||
EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_UNENCRYPTED,
|
||||
website_settings()->site_connection_status());
|
||||
EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_NO_CERT,
|
||||
website_settings()->site_identity_status());
|
||||
EXPECT_EQ(base::string16(), website_settings()->organization_name());
|
||||
EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_UNENCRYPTED,
|
||||
page_info()->site_connection_status());
|
||||
EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_NO_CERT,
|
||||
page_info()->site_identity_status());
|
||||
EXPECT_EQ(base::string16(), page_info()->organization_name());
|
||||
}
|
||||
|
||||
// On desktop, internal URLs aren't handled by WebsiteSettings class. Instead, a
|
||||
// On desktop, internal URLs aren't handled by PageInfo class. Instead, a
|
||||
// custom and simpler popup is shown, so no need to test.
|
||||
#if defined(OS_ANDROID) || defined(OS_IOS)
|
||||
TEST_F(WebsiteSettingsTest, InternalPage) {
|
||||
TEST_F(PageInfoTest, InternalPage) {
|
||||
SetURL("chrome://bookmarks");
|
||||
SetDefaultUIExpectations(mock_ui());
|
||||
EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_INTERNAL_PAGE,
|
||||
website_settings()->site_connection_status());
|
||||
EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE,
|
||||
website_settings()->site_identity_status());
|
||||
EXPECT_EQ(base::string16(), website_settings()->organization_name());
|
||||
EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_INTERNAL_PAGE,
|
||||
page_info()->site_connection_status());
|
||||
EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_INTERNAL_PAGE,
|
||||
page_info()->site_identity_status());
|
||||
EXPECT_EQ(base::string16(), page_info()->organization_name());
|
||||
}
|
||||
#endif
|
||||
|
||||
// Tests that metrics are recorded on a WebsiteSettings for pages with
|
||||
// Tests that metrics are recorded on a PageInfo for pages with
|
||||
// various security levels.
|
||||
TEST_F(WebsiteSettingsTest, SecurityLevelMetrics) {
|
||||
TEST_F(PageInfoTest, SecurityLevelMetrics) {
|
||||
struct TestCase {
|
||||
const std::string url;
|
||||
const security_state::SecurityLevel security_level;
|
||||
@ -696,26 +690,24 @@ TEST_F(WebsiteSettingsTest, SecurityLevelMetrics) {
|
||||
SetURL(test.url);
|
||||
security_info_.security_level = test.security_level;
|
||||
ResetMockUI();
|
||||
ClearWebsiteSettings();
|
||||
ClearPageInfo();
|
||||
SetDefaultUIExpectations(mock_ui());
|
||||
|
||||
histograms.ExpectTotalCount(kGenericHistogram, 0);
|
||||
histograms.ExpectTotalCount(test.histogram_name, 0);
|
||||
|
||||
website_settings()->RecordWebsiteSettingsAction(
|
||||
WebsiteSettings::WebsiteSettingsAction::WEBSITE_SETTINGS_OPENED);
|
||||
page_info()->RecordPageInfoAction(
|
||||
PageInfo::PageInfoAction::PAGE_INFO_OPENED);
|
||||
|
||||
// RecordWebsiteSettingsAction() is called during WebsiteSettings
|
||||
// creation in addition to the explicit RecordWebsiteSettingsAction()
|
||||
// RecordPageInfoAction() is called during PageInfo
|
||||
// creation in addition to the explicit RecordPageInfoAction()
|
||||
// call, so it is called twice in total.
|
||||
histograms.ExpectTotalCount(kGenericHistogram, 2);
|
||||
histograms.ExpectBucketCount(
|
||||
kGenericHistogram,
|
||||
WebsiteSettings::WebsiteSettingsAction::WEBSITE_SETTINGS_OPENED, 2);
|
||||
histograms.ExpectBucketCount(kGenericHistogram,
|
||||
PageInfo::PageInfoAction::PAGE_INFO_OPENED, 2);
|
||||
|
||||
histograms.ExpectTotalCount(test.histogram_name, 2);
|
||||
histograms.ExpectBucketCount(
|
||||
test.histogram_name,
|
||||
WebsiteSettings::WebsiteSettingsAction::WEBSITE_SETTINGS_OPENED, 2);
|
||||
histograms.ExpectBucketCount(test.histogram_name,
|
||||
PageInfo::PageInfoAction::PAGE_INFO_OPENED, 2);
|
||||
}
|
||||
}
|
@ -14,11 +14,10 @@
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/material_design/material_design_controller.h"
|
||||
|
||||
PermissionMenuModel::PermissionMenuModel(
|
||||
Profile* profile,
|
||||
const GURL& url,
|
||||
const WebsiteSettingsUI::PermissionInfo& info,
|
||||
const ChangeCallback& callback)
|
||||
PermissionMenuModel::PermissionMenuModel(Profile* profile,
|
||||
const GURL& url,
|
||||
const PageInfoUI::PermissionInfo& info,
|
||||
const ChangeCallback& callback)
|
||||
: ui::SimpleMenuModel(this),
|
||||
host_content_settings_map_(
|
||||
HostContentSettingsMapFactory::GetForProfile(profile)),
|
||||
@ -38,16 +37,13 @@ PermissionMenuModel::PermissionMenuModel(
|
||||
|
||||
switch (effective_default_setting) {
|
||||
case CONTENT_SETTING_ALLOW:
|
||||
label = l10n_util::GetStringUTF16(
|
||||
IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ALLOW);
|
||||
label = l10n_util::GetStringUTF16(IDS_PAGE_INFO_MENU_ITEM_DEFAULT_ALLOW);
|
||||
break;
|
||||
case CONTENT_SETTING_BLOCK:
|
||||
label = l10n_util::GetStringUTF16(
|
||||
IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_BLOCK);
|
||||
label = l10n_util::GetStringUTF16(IDS_PAGE_INFO_MENU_ITEM_DEFAULT_BLOCK);
|
||||
break;
|
||||
case CONTENT_SETTING_ASK:
|
||||
label =
|
||||
l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ASK);
|
||||
label = l10n_util::GetStringUTF16(IDS_PAGE_INFO_MENU_ITEM_DEFAULT_ASK);
|
||||
break;
|
||||
case CONTENT_SETTING_DETECT_IMPORTANT_CONTENT:
|
||||
// TODO(tommycli): We display the ASK string for DETECT because with
|
||||
@ -55,8 +51,8 @@ PermissionMenuModel::PermissionMenuModel(
|
||||
// Once the feature flag is gone, migrate the actual setting to ASK.
|
||||
label = l10n_util::GetStringUTF16(
|
||||
PluginUtils::ShouldPreferHtmlOverPlugins(host_content_settings_map_)
|
||||
? IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ASK
|
||||
: IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_DETECT_IMPORTANT_CONTENT);
|
||||
? IDS_PAGE_INFO_MENU_ITEM_DEFAULT_ASK
|
||||
: IDS_PAGE_INFO_MENU_ITEM_DEFAULT_DETECT_IMPORTANT_CONTENT);
|
||||
break;
|
||||
case CONTENT_SETTING_NUM_SETTINGS:
|
||||
NOTREACHED();
|
||||
@ -68,7 +64,7 @@ PermissionMenuModel::PermissionMenuModel(
|
||||
// which means the elements of the menu themselves have to be shorter, instead
|
||||
// of simply setting a shorter label on the menubutton.
|
||||
if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
|
||||
label = WebsiteSettingsUI::PermissionActionToUIString(
|
||||
label = PageInfoUI::PermissionActionToUIString(
|
||||
profile, permission_.type, CONTENT_SETTING_DEFAULT,
|
||||
effective_default_setting, permission_.source);
|
||||
}
|
||||
@ -86,9 +82,9 @@ PermissionMenuModel::PermissionMenuModel(
|
||||
permission_.type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA;
|
||||
if (!allow_disabled_for_notifications &&
|
||||
(!is_media_permission || content::IsOriginSecure(url))) {
|
||||
label = l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_MENU_ITEM_ALLOW);
|
||||
label = l10n_util::GetStringUTF16(IDS_PAGE_INFO_MENU_ITEM_ALLOW);
|
||||
if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
|
||||
label = WebsiteSettingsUI::PermissionActionToUIString(
|
||||
label = PageInfoUI::PermissionActionToUIString(
|
||||
profile, permission_.type, CONTENT_SETTING_ALLOW,
|
||||
effective_default_setting, permission_.source);
|
||||
}
|
||||
@ -101,14 +97,14 @@ PermissionMenuModel::PermissionMenuModel(
|
||||
if (permission_.type == CONTENT_SETTINGS_TYPE_PLUGINS &&
|
||||
!PluginUtils::ShouldPreferHtmlOverPlugins(host_content_settings_map_)) {
|
||||
label = l10n_util::GetStringUTF16(
|
||||
IDS_WEBSITE_SETTINGS_MENU_ITEM_DETECT_IMPORTANT_CONTENT);
|
||||
IDS_PAGE_INFO_MENU_ITEM_DETECT_IMPORTANT_CONTENT);
|
||||
AddCheckItem(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, label);
|
||||
}
|
||||
|
||||
// Retrieve the string to show for blocking the permission.
|
||||
label = l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_MENU_ITEM_BLOCK);
|
||||
label = l10n_util::GetStringUTF16(IDS_PAGE_INFO_MENU_ITEM_BLOCK);
|
||||
if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
|
||||
label = WebsiteSettingsUI::PermissionActionToUIString(
|
||||
label = PageInfoUI::PermissionActionToUIString(
|
||||
profile, info.type, CONTENT_SETTING_BLOCK, effective_default_setting,
|
||||
info.source);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
#define CHROME_BROWSER_UI_PAGE_INFO_PERMISSION_MENU_MODEL_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings_ui.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_ui.h"
|
||||
#include "components/content_settings/core/common/content_settings.h"
|
||||
#include "components/content_settings/core/common/content_settings_types.h"
|
||||
#include "ui/base/models/simple_menu_model.h"
|
||||
@ -18,13 +18,13 @@ class Profile;
|
||||
class PermissionMenuModel : public ui::SimpleMenuModel,
|
||||
public ui::SimpleMenuModel::Delegate {
|
||||
public:
|
||||
typedef base::Callback<void(const WebsiteSettingsUI::PermissionInfo&)>
|
||||
typedef base::Callback<void(const PageInfoUI::PermissionInfo&)>
|
||||
ChangeCallback;
|
||||
|
||||
// Create a new menu model for permission settings.
|
||||
PermissionMenuModel(Profile* profile,
|
||||
const GURL& url,
|
||||
const WebsiteSettingsUI::PermissionInfo& info,
|
||||
const PageInfoUI::PermissionInfo& info,
|
||||
const ChangeCallback& callback);
|
||||
// Creates a special-case menu model that only has the allow and block
|
||||
// options. It does not track a permission type. |setting| is the
|
||||
@ -45,7 +45,7 @@ class PermissionMenuModel : public ui::SimpleMenuModel,
|
||||
HostContentSettingsMap* host_content_settings_map_;
|
||||
|
||||
// The permission info represented by the menu model.
|
||||
WebsiteSettingsUI::PermissionInfo permission_;
|
||||
PageInfoUI::PermissionInfo permission_;
|
||||
|
||||
// Callback to be called when the permission's setting is changed.
|
||||
ChangeCallback callback_;
|
||||
|
@ -18,7 +18,7 @@ class TestCallback {
|
||||
PermissionMenuModel::ChangeCallback callback() {
|
||||
return base::Bind(&TestCallback::PermissionChanged, base::Unretained(this));
|
||||
}
|
||||
void PermissionChanged(const WebsiteSettingsUI::PermissionInfo& permission) {
|
||||
void PermissionChanged(const PageInfoUI::PermissionInfo& permission) {
|
||||
current_ = permission.setting;
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ class PermissionMenuModelTest : public testing::Test {
|
||||
|
||||
TEST_F(PermissionMenuModelTest, TestDefault) {
|
||||
TestCallback callback;
|
||||
WebsiteSettingsUI::PermissionInfo permission;
|
||||
PageInfoUI::PermissionInfo permission;
|
||||
permission.type = CONTENT_SETTINGS_TYPE_COOKIES;
|
||||
permission.setting = CONTENT_SETTING_ALLOW;
|
||||
permission.default_setting = CONTENT_SETTING_ALLOW;
|
||||
@ -53,7 +53,7 @@ TEST_F(PermissionMenuModelTest, TestDefaultMediaHttp) {
|
||||
ContentSettingsType type = i ? CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC
|
||||
: CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA;
|
||||
TestCallback callback;
|
||||
WebsiteSettingsUI::PermissionInfo permission;
|
||||
PageInfoUI::PermissionInfo permission;
|
||||
permission.type = type;
|
||||
permission.setting = CONTENT_SETTING_ALLOW;
|
||||
permission.default_setting = CONTENT_SETTING_ALLOW;
|
||||
@ -73,7 +73,7 @@ TEST_F(PermissionMenuModelTest, TestAllowBlock) {
|
||||
|
||||
TEST_F(PermissionMenuModelTest, TestIncognitoNotifications) {
|
||||
TestCallback callback;
|
||||
WebsiteSettingsUI::PermissionInfo permission;
|
||||
PageInfoUI::PermissionInfo permission;
|
||||
permission.type = CONTENT_SETTINGS_TYPE_NOTIFICATIONS;
|
||||
permission.setting = CONTENT_SETTING_ASK;
|
||||
permission.default_setting = CONTENT_SETTING_ASK;
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "chrome/browser/ui/browser_dialogs.h"
|
||||
#include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h"
|
||||
#include "chrome/browser/ui/views/content_setting_bubble_contents.h"
|
||||
#include "chrome/browser/ui/views/page_info/website_settings_popup_view.h"
|
||||
#include "chrome/browser/ui/views/page_info/page_info_popup_view.h"
|
||||
#include "chrome/browser/ui/views/task_manager_view.h"
|
||||
#include "chrome/browser/ui/views/update_recommended_message_box.h"
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
namespace chrome {
|
||||
|
||||
void ShowWebsiteSettingsBubbleViewsAtPoint(
|
||||
void ShowPageInfoBubbleViewsAtPoint(
|
||||
const gfx::Point& anchor_point,
|
||||
Profile* profile,
|
||||
content::WebContents* web_contents,
|
||||
@ -34,14 +34,13 @@ void ShowWebsiteSettingsBubbleViewsAtPoint(
|
||||
// earlier because the popup is shown on mouse release (but dismissed on
|
||||
// mouse pressed). A Cocoa browser does both on mouse pressed, so a check
|
||||
// when showing is sufficient.
|
||||
if (WebsiteSettingsPopupView::GetShownPopupType() !=
|
||||
WebsiteSettingsPopupView::POPUP_NONE) {
|
||||
if (PageInfoPopupView::GetShownPopupType() != PageInfoPopupView::POPUP_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
WebsiteSettingsPopupView::ShowPopup(
|
||||
nullptr, gfx::Rect(anchor_point, gfx::Size()), profile, web_contents,
|
||||
virtual_url, security_info);
|
||||
PageInfoPopupView::ShowPopup(nullptr, gfx::Rect(anchor_point, gfx::Size()),
|
||||
profile, web_contents, virtual_url,
|
||||
security_info);
|
||||
}
|
||||
|
||||
void ShowBookmarkBubbleViewsAtPoint(const gfx::Point& anchor_point,
|
||||
|
@ -80,7 +80,7 @@
|
||||
#include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h"
|
||||
#include "chrome/browser/ui/views/new_back_shortcut_bubble.h"
|
||||
#include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
|
||||
#include "chrome/browser/ui/views/page_info/website_settings_popup_view.h"
|
||||
#include "chrome/browser/ui/views/page_info/page_info_popup_view.h"
|
||||
#include "chrome/browser/ui/views/profiles/profile_indicator_icon.h"
|
||||
#include "chrome/browser/ui/views/status_bubble_views.h"
|
||||
#include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h"
|
||||
@ -1285,12 +1285,12 @@ void BrowserView::UserChangedTheme() {
|
||||
frame_->FrameTypeChanged();
|
||||
}
|
||||
|
||||
void BrowserView::ShowWebsiteSettings(
|
||||
void BrowserView::ShowPageInfo(
|
||||
Profile* profile,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& virtual_url,
|
||||
const security_state::SecurityInfo& security_info) {
|
||||
WebsiteSettingsPopupView::ShowPopup(
|
||||
PageInfoPopupView::ShowPopup(
|
||||
GetLocationBarView()->GetSecurityBubbleAnchorView(), gfx::Rect(), profile,
|
||||
web_contents, virtual_url, security_info);
|
||||
}
|
||||
|
@ -341,11 +341,10 @@ class BrowserView : public BrowserWindow,
|
||||
bool app_modal,
|
||||
const base::Callback<void(bool)>& callback) override;
|
||||
void UserChangedTheme() override;
|
||||
void ShowWebsiteSettings(
|
||||
Profile* profile,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& virtual_url,
|
||||
const security_state::SecurityInfo& security_info) override;
|
||||
void ShowPageInfo(Profile* profile,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& virtual_url,
|
||||
const security_state::SecurityInfo& security_info) override;
|
||||
void ShowAppMenu() override;
|
||||
content::KeyboardEventProcessingResult PreHandleKeyboardEvent(
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
|
@ -82,7 +82,7 @@ class LocationBarView : public LocationBar,
|
||||
GetContentSettingBubbleModelDelegate() = 0;
|
||||
|
||||
// Shows permissions and settings for the given web contents.
|
||||
virtual void ShowWebsiteSettings(content::WebContents* web_contents) = 0;
|
||||
virtual void ShowPageInfo(content::WebContents* web_contents) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~Delegate() {}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "chrome/browser/ui/view_ids.h"
|
||||
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
|
||||
#include "chrome/browser/ui/views/page_info/website_settings_popup_view.h"
|
||||
#include "chrome/browser/ui/views/page_info/page_info_popup_view.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "chrome/grit/theme_resources.h"
|
||||
#include "components/grit/components_scaled_resources.h"
|
||||
@ -55,8 +55,7 @@ bool LocationIconView::OnMousePressed(const ui::MouseEvent& event) {
|
||||
}
|
||||
|
||||
suppress_mouse_released_action_ =
|
||||
WebsiteSettingsPopupView::GetShownPopupType() !=
|
||||
WebsiteSettingsPopupView::POPUP_NONE;
|
||||
PageInfoPopupView::GetShownPopupType() != PageInfoPopupView::POPUP_NONE;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -102,7 +101,7 @@ bool LocationIconView::OnActivate(const ui::Event& event) {
|
||||
WebContents* contents = location_bar_->GetWebContents();
|
||||
if (!contents)
|
||||
return false;
|
||||
location_bar_->delegate()->ShowWebsiteSettings(contents);
|
||||
location_bar_->delegate()->ShowPageInfo(contents);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "chrome/browser/ui/views/frame/browser_view.h"
|
||||
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
|
||||
#include "chrome/browser/ui/views/page_info/website_settings_popup_view.h"
|
||||
#include "chrome/browser/ui/views/page_info/page_info_popup_view.h"
|
||||
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
|
||||
#include "chrome/test/base/in_process_browser_test.h"
|
||||
#include "chrome/test/base/interactive_test_utils.h"
|
||||
@ -32,8 +32,8 @@ IN_PROC_BROWSER_TEST_F(LocationIconViewTest, HideOnSecondClick) {
|
||||
runner1->QuitClosure());
|
||||
runner1->Run();
|
||||
|
||||
EXPECT_EQ(WebsiteSettingsPopupView::POPUP_WEBSITE_SETTINGS,
|
||||
WebsiteSettingsPopupView::GetShownPopupType());
|
||||
EXPECT_EQ(PageInfoPopupView::POPUP_PAGE_INFO,
|
||||
PageInfoPopupView::GetShownPopupType());
|
||||
|
||||
// Verify that clicking again doesn't reshow it.
|
||||
scoped_refptr<content::MessageLoopRunner> runner2 =
|
||||
@ -45,8 +45,8 @@ IN_PROC_BROWSER_TEST_F(LocationIconViewTest, HideOnSecondClick) {
|
||||
runner2->QuitClosure());
|
||||
runner2->Run();
|
||||
|
||||
EXPECT_EQ(WebsiteSettingsPopupView::POPUP_NONE,
|
||||
WebsiteSettingsPopupView::GetShownPopupType());
|
||||
EXPECT_EQ(PageInfoPopupView::POPUP_NONE,
|
||||
PageInfoPopupView::GetShownPopupType());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "chrome/browser/ui/views/page_info/chosen_object_row.h"
|
||||
|
||||
#include "chrome/browser/ui/views/page_info/chosen_object_row_observer.h"
|
||||
#include "chrome/browser/ui/views/page_info/website_settings_popup_view.h"
|
||||
#include "chrome/browser/ui/views/page_info/page_info_popup_view.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "ui/resources/grit/ui_resources.h"
|
||||
@ -15,7 +15,7 @@
|
||||
#include "ui/views/layout/grid_layout.h"
|
||||
|
||||
ChosenObjectRow::ChosenObjectRow(
|
||||
std::unique_ptr<WebsiteSettingsUI::ChosenObjectInfo> info)
|
||||
std::unique_ptr<PageInfoUI::ChosenObjectInfo> info)
|
||||
: info_(std::move(info)) {
|
||||
views::GridLayout* layout = new views::GridLayout(this);
|
||||
SetLayoutManager(layout);
|
||||
@ -33,15 +33,14 @@ ChosenObjectRow::ChosenObjectRow(
|
||||
layout->StartRow(1, column_set_id);
|
||||
// Create the permission icon.
|
||||
icon_ = new views::ImageView();
|
||||
const gfx::Image& image =
|
||||
WebsiteSettingsUI::GetChosenObjectIcon(*info_, false);
|
||||
const gfx::Image& image = PageInfoUI::GetChosenObjectIcon(*info_, false);
|
||||
icon_->SetImage(image.ToImageSkia());
|
||||
layout->AddView(icon_, 1, 1, views::GridLayout::CENTER,
|
||||
views::GridLayout::CENTER);
|
||||
// Create the label that displays the permission type.
|
||||
views::Label* label = new views::Label(l10n_util::GetStringFUTF16(
|
||||
info_->ui_info.label_string_id,
|
||||
WebsiteSettingsUI::ChosenObjectToUIString(*info_)));
|
||||
views::Label* label = new views::Label(
|
||||
l10n_util::GetStringFUTF16(info_->ui_info.label_string_id,
|
||||
PageInfoUI::ChosenObjectToUIString(*info_)));
|
||||
layout->AddView(label, 1, 1, views::GridLayout::LEADING,
|
||||
views::GridLayout::CENTER);
|
||||
// Create the delete button.
|
||||
@ -70,8 +69,7 @@ ChosenObjectRow::~ChosenObjectRow() {}
|
||||
void ChosenObjectRow::ButtonPressed(views::Button* sender,
|
||||
const ui::Event& event) {
|
||||
// Change the icon to reflect the selected setting.
|
||||
const gfx::Image& image =
|
||||
WebsiteSettingsUI::GetChosenObjectIcon(*info_, true);
|
||||
const gfx::Image& image = PageInfoUI::GetChosenObjectIcon(*info_, true);
|
||||
icon_->SetImage(image.ToImageSkia());
|
||||
|
||||
RemoveChildView(delete_button_);
|
||||
|
@ -6,7 +6,7 @@
|
||||
#define CHROME_BROWSER_UI_VIEWS_PAGE_INFO_CHOSEN_OBJECT_ROW_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings_ui.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_ui.h"
|
||||
#include "ui/views/controls/button/button.h"
|
||||
#include "ui/views/view.h"
|
||||
|
||||
@ -22,8 +22,7 @@ class ChosenObjectRowObserver;
|
||||
// access to.
|
||||
class ChosenObjectRow : public views::View, public views::ButtonListener {
|
||||
public:
|
||||
explicit ChosenObjectRow(
|
||||
std::unique_ptr<WebsiteSettingsUI::ChosenObjectInfo> info);
|
||||
explicit ChosenObjectRow(std::unique_ptr<PageInfoUI::ChosenObjectInfo> info);
|
||||
|
||||
void AddObserver(ChosenObjectRowObserver* observer);
|
||||
|
||||
@ -37,7 +36,7 @@ class ChosenObjectRow : public views::View, public views::ButtonListener {
|
||||
views::ImageButton* delete_button_; // Owned by the views hierarchy.
|
||||
|
||||
base::ObserverList<ChosenObjectRowObserver> observer_list_;
|
||||
std::unique_ptr<WebsiteSettingsUI::ChosenObjectInfo> info_;
|
||||
std::unique_ptr<PageInfoUI::ChosenObjectInfo> info_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ChosenObjectRow);
|
||||
};
|
||||
|
@ -5,13 +5,13 @@
|
||||
#ifndef CHROME_BROWSER_UI_VIEWS_PAGE_INFO_CHOSEN_OBJECT_ROW_OBSERVER_H_
|
||||
#define CHROME_BROWSER_UI_VIEWS_PAGE_INFO_CHOSEN_OBJECT_ROW_OBSERVER_H_
|
||||
|
||||
#include "chrome/browser/ui/page_info/website_settings_ui.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_ui.h"
|
||||
|
||||
class ChosenObjectRowObserver {
|
||||
public:
|
||||
// This method is called when permission for the object is revoked.
|
||||
virtual void OnChosenObjectDeleted(
|
||||
const WebsiteSettingsUI::ChosenObjectInfo& info) = 0;
|
||||
const PageInfoUI::ChosenObjectInfo& info) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~ChosenObjectRowObserver() {}
|
||||
|
@ -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/ui/views/page_info/website_settings_popup_view.h"
|
||||
#include "chrome/browser/ui/views/page_info/page_info_popup_view.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "chrome/browser/ui/browser_dialogs.h"
|
||||
#include "chrome/browser/ui/layout_constants.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings.h"
|
||||
#include "chrome/browser/ui/page_info/page_info.h"
|
||||
#include "chrome/browser/ui/views/collected_cookies_views.h"
|
||||
#include "chrome/browser/ui/views/harmony/chrome_typography.h"
|
||||
#include "chrome/browser/ui/views/harmony/layout_delegate.h"
|
||||
@ -64,13 +64,12 @@
|
||||
namespace {
|
||||
|
||||
// NOTE(jdonnelly): This use of this process-wide variable assumes that there's
|
||||
// never more than one website settings popup shown and that it's associated
|
||||
// never more than one page info popup shown and that it's associated
|
||||
// with the current window. If this assumption fails in the future, we'll need
|
||||
// to return a weak pointer from ShowPopup so callers can associate it with the
|
||||
// current window (or other context) and check if the popup they care about is
|
||||
// showing.
|
||||
WebsiteSettingsPopupView::PopupType g_shown_popup_type =
|
||||
WebsiteSettingsPopupView::POPUP_NONE;
|
||||
PageInfoPopupView::PopupType g_shown_popup_type = PageInfoPopupView::POPUP_NONE;
|
||||
|
||||
// General constants -----------------------------------------------------------
|
||||
|
||||
@ -108,7 +107,7 @@ const int STYLED_LABEL_RESET_CERTIFICATE_DECISIONS = 1339;
|
||||
const int LINK_COOKIE_DIALOG = 1340;
|
||||
const int LINK_SITE_SETTINGS = 1341;
|
||||
|
||||
// The default, ui::kTitleFontSizeDelta, is too large for the website settings
|
||||
// The default, ui::kTitleFontSizeDelta, is too large for the page info
|
||||
// bubble (e.g. +3). Use +1 to obtain a smaller font.
|
||||
constexpr int kSummaryFontSizeDelta = 1;
|
||||
|
||||
@ -125,7 +124,7 @@ void AddColumnWithSideMargin(views::GridLayout* layout, int margin, int id) {
|
||||
} // namespace
|
||||
|
||||
// |PopupHeaderView| is the UI element (view) that represents the header of the
|
||||
// |WebsiteSettingsPopupView|. The header shows the status of the site's
|
||||
// |PageInfoPopupView|. The header shows the status of the site's
|
||||
// identity check and the name of the site's identity.
|
||||
class PopupHeaderView : public views::View {
|
||||
public:
|
||||
@ -160,8 +159,8 @@ class PopupHeaderView : public views::View {
|
||||
DISALLOW_COPY_AND_ASSIGN(PopupHeaderView);
|
||||
};
|
||||
|
||||
// Website Settings are not supported for internal Chrome pages and extension
|
||||
// pages. Instead of the |WebsiteSettingsPopupView|, the
|
||||
// The regular PageInfoPopupView is not supported for internal Chrome pages and
|
||||
// extension pages. Instead of the |PageInfoPopupView|, the
|
||||
// |InternalPageInfoPopupView| is displayed.
|
||||
class InternalPageInfoPopupView : public views::BubbleDialogDelegateView {
|
||||
public:
|
||||
@ -177,7 +176,7 @@ class InternalPageInfoPopupView : public views::BubbleDialogDelegateView {
|
||||
int GetDialogButtons() const override;
|
||||
|
||||
private:
|
||||
friend class WebsiteSettingsPopupView;
|
||||
friend class PageInfoPopupView;
|
||||
|
||||
// Used around icon and inside bubble border.
|
||||
static constexpr int kSpacing = 12;
|
||||
@ -286,7 +285,7 @@ InternalPageInfoPopupView::InternalPageInfoPopupView(
|
||||
gfx::NativeView parent_window,
|
||||
const GURL& url)
|
||||
: BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT) {
|
||||
g_shown_popup_type = WebsiteSettingsPopupView::POPUP_INTERNAL_PAGE;
|
||||
g_shown_popup_type = PageInfoPopupView::POPUP_INTERNAL_PAGE;
|
||||
set_parent_window(parent_window);
|
||||
|
||||
int text = IDS_PAGE_INFO_INTERNAL_PAGE;
|
||||
@ -329,7 +328,7 @@ InternalPageInfoPopupView::InternalPageInfoPopupView(
|
||||
InternalPageInfoPopupView::~InternalPageInfoPopupView() {}
|
||||
|
||||
void InternalPageInfoPopupView::OnWidgetDestroying(views::Widget* widget) {
|
||||
g_shown_popup_type = WebsiteSettingsPopupView::POPUP_NONE;
|
||||
g_shown_popup_type = PageInfoPopupView::POPUP_NONE;
|
||||
}
|
||||
|
||||
int InternalPageInfoPopupView::GetDialogButtons() const {
|
||||
@ -337,13 +336,13 @@ int InternalPageInfoPopupView::GetDialogButtons() const {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// WebsiteSettingsPopupView
|
||||
// PageInfoPopupView
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
WebsiteSettingsPopupView::~WebsiteSettingsPopupView() {}
|
||||
PageInfoPopupView::~PageInfoPopupView() {}
|
||||
|
||||
// static
|
||||
void WebsiteSettingsPopupView::ShowPopup(
|
||||
void PageInfoPopupView::ShowPopup(
|
||||
views::View* anchor_view,
|
||||
const gfx::Rect& anchor_rect,
|
||||
Profile* profile,
|
||||
@ -364,7 +363,7 @@ void WebsiteSettingsPopupView::ShowPopup(
|
||||
popup->GetWidget()->Show();
|
||||
return;
|
||||
}
|
||||
WebsiteSettingsPopupView* popup = new WebsiteSettingsPopupView(
|
||||
PageInfoPopupView* popup = new PageInfoPopupView(
|
||||
anchor_view, parent_window, profile, web_contents, url, security_info);
|
||||
if (!anchor_view)
|
||||
popup->SetAnchorRect(anchor_rect);
|
||||
@ -372,12 +371,11 @@ void WebsiteSettingsPopupView::ShowPopup(
|
||||
}
|
||||
|
||||
// static
|
||||
WebsiteSettingsPopupView::PopupType
|
||||
WebsiteSettingsPopupView::GetShownPopupType() {
|
||||
PageInfoPopupView::PopupType PageInfoPopupView::GetShownPopupType() {
|
||||
return g_shown_popup_type;
|
||||
}
|
||||
|
||||
WebsiteSettingsPopupView::WebsiteSettingsPopupView(
|
||||
PageInfoPopupView::PageInfoPopupView(
|
||||
views::View* anchor_view,
|
||||
gfx::NativeView parent_window,
|
||||
Profile* profile,
|
||||
@ -394,7 +392,7 @@ WebsiteSettingsPopupView::WebsiteSettingsPopupView(
|
||||
cookie_dialog_link_(nullptr),
|
||||
permissions_view_(nullptr),
|
||||
weak_factory_(this) {
|
||||
g_shown_popup_type = POPUP_WEBSITE_SETTINGS;
|
||||
g_shown_popup_type = POPUP_PAGE_INFO;
|
||||
set_parent_window(parent_window);
|
||||
|
||||
// Compensate for built-in vertical padding in the anchor view's image.
|
||||
@ -445,23 +443,23 @@ WebsiteSettingsPopupView::WebsiteSettingsPopupView(
|
||||
}
|
||||
views::BubbleDialogDelegateView::CreateBubble(this);
|
||||
|
||||
presenter_.reset(new WebsiteSettings(
|
||||
presenter_.reset(new PageInfo(
|
||||
this, profile, TabSpecificContentSettings::FromWebContents(web_contents),
|
||||
web_contents, url, security_info));
|
||||
}
|
||||
|
||||
void WebsiteSettingsPopupView::RenderFrameDeleted(
|
||||
void PageInfoPopupView::RenderFrameDeleted(
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
if (render_frame_host == web_contents()->GetMainFrame())
|
||||
GetWidget()->Close();
|
||||
}
|
||||
|
||||
void WebsiteSettingsPopupView::WebContentsDestroyed() {
|
||||
void PageInfoPopupView::WebContentsDestroyed() {
|
||||
weak_factory_.InvalidateWeakPtrs();
|
||||
}
|
||||
|
||||
void WebsiteSettingsPopupView::OnPermissionChanged(
|
||||
const WebsiteSettingsUI::PermissionInfo& permission) {
|
||||
void PageInfoPopupView::OnPermissionChanged(
|
||||
const PageInfoUI::PermissionInfo& permission) {
|
||||
presenter_->OnSitePermissionChanged(permission.type, permission.setting);
|
||||
// The menu buttons for the permissions might have longer strings now, so we
|
||||
// need to layout and size the whole bubble.
|
||||
@ -469,51 +467,50 @@ void WebsiteSettingsPopupView::OnPermissionChanged(
|
||||
SizeToContents();
|
||||
}
|
||||
|
||||
void WebsiteSettingsPopupView::OnChosenObjectDeleted(
|
||||
const WebsiteSettingsUI::ChosenObjectInfo& info) {
|
||||
void PageInfoPopupView::OnChosenObjectDeleted(
|
||||
const PageInfoUI::ChosenObjectInfo& info) {
|
||||
presenter_->OnSiteChosenObjectDeleted(info.ui_info, *info.object);
|
||||
}
|
||||
|
||||
base::string16 WebsiteSettingsPopupView::GetWindowTitle() const {
|
||||
base::string16 PageInfoPopupView::GetWindowTitle() const {
|
||||
return summary_text_;
|
||||
}
|
||||
|
||||
bool WebsiteSettingsPopupView::ShouldShowCloseButton() const {
|
||||
bool PageInfoPopupView::ShouldShowCloseButton() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void WebsiteSettingsPopupView::OnWidgetDestroying(views::Widget* widget) {
|
||||
void PageInfoPopupView::OnWidgetDestroying(views::Widget* widget) {
|
||||
g_shown_popup_type = POPUP_NONE;
|
||||
presenter_->OnUIClosing();
|
||||
}
|
||||
|
||||
int WebsiteSettingsPopupView::GetDialogButtons() const {
|
||||
int PageInfoPopupView::GetDialogButtons() const {
|
||||
return ui::DIALOG_BUTTON_NONE;
|
||||
}
|
||||
|
||||
const gfx::FontList& WebsiteSettingsPopupView::GetTitleFontList() const {
|
||||
const gfx::FontList& PageInfoPopupView::GetTitleFontList() const {
|
||||
return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta(
|
||||
kSummaryFontSizeDelta);
|
||||
}
|
||||
|
||||
void WebsiteSettingsPopupView::ButtonPressed(views::Button* button,
|
||||
const ui::Event& event) {
|
||||
void PageInfoPopupView::ButtonPressed(views::Button* button,
|
||||
const ui::Event& event) {
|
||||
DCHECK_EQ(BUTTON_CLOSE, button->id());
|
||||
GetWidget()->Close();
|
||||
}
|
||||
|
||||
void WebsiteSettingsPopupView::LinkClicked(views::Link* source,
|
||||
int event_flags) {
|
||||
void PageInfoPopupView::LinkClicked(views::Link* source, int event_flags) {
|
||||
// The popup closes automatically when the collected cookies dialog or the
|
||||
// certificate viewer opens. So delay handling of the link clicked to avoid
|
||||
// a crash in the base class which needs to complete the mouse event handling.
|
||||
content::BrowserThread::PostTask(
|
||||
content::BrowserThread::UI, FROM_HERE,
|
||||
base::Bind(&WebsiteSettingsPopupView::HandleLinkClickedAsync,
|
||||
base::Bind(&PageInfoPopupView::HandleLinkClickedAsync,
|
||||
weak_factory_.GetWeakPtr(), source));
|
||||
}
|
||||
|
||||
gfx::Size WebsiteSettingsPopupView::GetPreferredSize() const {
|
||||
gfx::Size PageInfoPopupView::GetPreferredSize() const {
|
||||
if (header_ == nullptr && site_settings_view_ == nullptr)
|
||||
return views::View::GetPreferredSize();
|
||||
|
||||
@ -533,8 +530,7 @@ gfx::Size WebsiteSettingsPopupView::GetPreferredSize() const {
|
||||
return gfx::Size(width, height);
|
||||
}
|
||||
|
||||
void WebsiteSettingsPopupView::SetCookieInfo(
|
||||
const CookieInfoList& cookie_info_list) {
|
||||
void PageInfoPopupView::SetCookieInfo(const CookieInfoList& cookie_info_list) {
|
||||
// |cookie_info_list| should only ever have 2 items: first- and third-party
|
||||
// cookies.
|
||||
DCHECK_EQ(cookie_info_list.size(), 2u);
|
||||
@ -542,7 +538,7 @@ void WebsiteSettingsPopupView::SetCookieInfo(
|
||||
for (const auto& i : cookie_info_list)
|
||||
total_allowed += i.allowed;
|
||||
base::string16 label_text = l10n_util::GetPluralStringFUTF16(
|
||||
IDS_WEBSITE_SETTINGS_NUM_COOKIES, total_allowed);
|
||||
IDS_PAGE_INFO_NUM_COOKIES, total_allowed);
|
||||
|
||||
if (!cookie_dialog_link_) {
|
||||
cookie_dialog_link_ = new views::Link(label_text);
|
||||
@ -570,14 +566,14 @@ void WebsiteSettingsPopupView::SetCookieInfo(
|
||||
layout->AddPaddingRow(0, kCookiesViewVerticalPadding);
|
||||
|
||||
layout->StartRow(1, cookies_view_column);
|
||||
WebsiteSettingsUI::PermissionInfo info;
|
||||
PageInfoUI::PermissionInfo info;
|
||||
info.type = CONTENT_SETTINGS_TYPE_COOKIES;
|
||||
info.setting = CONTENT_SETTING_ALLOW;
|
||||
info.is_incognito =
|
||||
Profile::FromBrowserContext(web_contents()->GetBrowserContext())
|
||||
->IsOffTheRecord();
|
||||
views::ImageView* icon = new NonAccessibleImageView();
|
||||
const gfx::Image& image = WebsiteSettingsUI::GetPermissionIcon(info);
|
||||
const gfx::Image& image = PageInfoUI::GetPermissionIcon(info);
|
||||
icon->SetImage(image.ToImageSkia());
|
||||
layout->AddView(
|
||||
icon, 1, 2, views::GridLayout::FILL,
|
||||
@ -586,7 +582,7 @@ void WebsiteSettingsPopupView::SetCookieInfo(
|
||||
views::GridLayout::LEADING);
|
||||
|
||||
views::Label* cookies_label = new views::Label(
|
||||
l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TITLE_SITE_DATA),
|
||||
l10n_util::GetStringUTF16(IDS_PAGE_INFO_TITLE_SITE_DATA),
|
||||
CONTEXT_BODY_TEXT_LARGE);
|
||||
layout->AddView(cookies_label);
|
||||
layout->StartRow(1, cookies_view_column);
|
||||
@ -601,13 +597,13 @@ void WebsiteSettingsPopupView::SetCookieInfo(
|
||||
SizeToContents();
|
||||
}
|
||||
|
||||
void WebsiteSettingsPopupView::SetPermissionInfo(
|
||||
void PageInfoPopupView::SetPermissionInfo(
|
||||
const PermissionInfoList& permission_info_list,
|
||||
ChosenObjectInfoList chosen_object_info_list) {
|
||||
// When a permission is changed, WebsiteSettings::OnSitePermissionChanged()
|
||||
// When a permission is changed, PageInfo::OnSitePermissionChanged()
|
||||
// calls this method with updated permissions. However, PermissionSelectorRow
|
||||
// will have already updated its state, so it's already reflected in the UI.
|
||||
// In addition, if a permission is set to the default setting, WebsiteSettings
|
||||
// In addition, if a permission is set to the default setting, PageInfo
|
||||
// removes it from |permission_info_list|, but the button should remain.
|
||||
if (permissions_view_)
|
||||
return;
|
||||
@ -674,9 +670,8 @@ void WebsiteSettingsPopupView::SetPermissionInfo(
|
||||
SizeToContents();
|
||||
}
|
||||
|
||||
void WebsiteSettingsPopupView::SetIdentityInfo(
|
||||
const IdentityInfo& identity_info) {
|
||||
std::unique_ptr<WebsiteSettingsUI::SecurityDescription> security_description =
|
||||
void PageInfoPopupView::SetIdentityInfo(const IdentityInfo& identity_info) {
|
||||
std::unique_ptr<PageInfoUI::SecurityDescription> security_description =
|
||||
identity_info.GetSecurityDescription();
|
||||
|
||||
summary_text_ = security_description->summary;
|
||||
@ -695,7 +690,7 @@ void WebsiteSettingsPopupView::SetIdentityInfo(
|
||||
SizeToContents();
|
||||
}
|
||||
|
||||
views::View* WebsiteSettingsPopupView::CreateSiteSettingsView(int side_margin) {
|
||||
views::View* PageInfoPopupView::CreateSiteSettingsView(int side_margin) {
|
||||
views::View* site_settings_view = new views::View();
|
||||
views::BoxLayout* box_layout =
|
||||
new views::BoxLayout(views::BoxLayout::kVertical, side_margin, 0, 0);
|
||||
@ -710,7 +705,7 @@ views::View* WebsiteSettingsPopupView::CreateSiteSettingsView(int side_margin) {
|
||||
return site_settings_view;
|
||||
}
|
||||
|
||||
void WebsiteSettingsPopupView::HandleLinkClickedAsync(views::Link* source) {
|
||||
void PageInfoPopupView::HandleLinkClickedAsync(views::Link* source) {
|
||||
// Both switch cases require accessing web_contents(), so we check it here.
|
||||
if (web_contents() == nullptr || web_contents()->IsBeingDestroyed())
|
||||
return;
|
||||
@ -724,13 +719,13 @@ void WebsiteSettingsPopupView::HandleLinkClickedAsync(views::Link* source) {
|
||||
GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(),
|
||||
WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK,
|
||||
false));
|
||||
presenter_->RecordWebsiteSettingsAction(
|
||||
WebsiteSettings::WEBSITE_SETTINGS_SITE_SETTINGS_OPENED);
|
||||
presenter_->RecordPageInfoAction(
|
||||
PageInfo::PAGE_INFO_SITE_SETTINGS_OPENED);
|
||||
break;
|
||||
case LINK_COOKIE_DIALOG:
|
||||
// Count how often the Collected Cookies dialog is opened.
|
||||
presenter_->RecordWebsiteSettingsAction(
|
||||
WebsiteSettings::WEBSITE_SETTINGS_COOKIES_DIALOG_OPENED);
|
||||
presenter_->RecordPageInfoAction(
|
||||
PageInfo::PAGE_INFO_COOKIES_DIALOG_OPENED);
|
||||
new CollectedCookiesViews(web_contents());
|
||||
break;
|
||||
default:
|
||||
@ -738,17 +733,17 @@ void WebsiteSettingsPopupView::HandleLinkClickedAsync(views::Link* source) {
|
||||
}
|
||||
}
|
||||
|
||||
void WebsiteSettingsPopupView::StyledLabelLinkClicked(views::StyledLabel* label,
|
||||
const gfx::Range& range,
|
||||
int event_flags) {
|
||||
void PageInfoPopupView::StyledLabelLinkClicked(views::StyledLabel* label,
|
||||
const gfx::Range& range,
|
||||
int event_flags) {
|
||||
switch (label->id()) {
|
||||
case STYLED_LABEL_SECURITY_DETAILS:
|
||||
web_contents()->OpenURL(content::OpenURLParams(
|
||||
GURL(chrome::kPageInfoHelpCenterURL), content::Referrer(),
|
||||
WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK,
|
||||
false));
|
||||
presenter_->RecordWebsiteSettingsAction(
|
||||
WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED);
|
||||
presenter_->RecordPageInfoAction(
|
||||
PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED);
|
||||
break;
|
||||
case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS:
|
||||
presenter_->OnRevokeSSLErrorBypassButtonPressed();
|
@ -2,15 +2,15 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CHROME_BROWSER_UI_VIEWS_PAGE_INFO_WEBSITE_SETTINGS_POPUP_VIEW_H_
|
||||
#define CHROME_BROWSER_UI_VIEWS_PAGE_INFO_WEBSITE_SETTINGS_POPUP_VIEW_H_
|
||||
#ifndef CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_POPUP_VIEW_H_
|
||||
#define CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_POPUP_VIEW_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings_ui.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_ui.h"
|
||||
#include "chrome/browser/ui/views/page_info/chosen_object_row_observer.h"
|
||||
#include "chrome/browser/ui/views/page_info/permission_selector_row.h"
|
||||
#include "chrome/browser/ui/views/page_info/permission_selector_row_observer.h"
|
||||
@ -38,7 +38,7 @@ struct SecurityInfo;
|
||||
} // namespace security_state
|
||||
|
||||
namespace test {
|
||||
class WebsiteSettingsPopupViewTestApi;
|
||||
class PageInfoPopupViewTestApi;
|
||||
}
|
||||
|
||||
namespace views {
|
||||
@ -53,23 +53,23 @@ enum : int {
|
||||
kPermissionIconColumnWidth = 16,
|
||||
};
|
||||
|
||||
// The views implementation of the website settings UI.
|
||||
class WebsiteSettingsPopupView : public content::WebContentsObserver,
|
||||
public PermissionSelectorRowObserver,
|
||||
public ChosenObjectRowObserver,
|
||||
public views::BubbleDialogDelegateView,
|
||||
public views::ButtonListener,
|
||||
public views::LinkListener,
|
||||
public views::StyledLabelListener,
|
||||
public WebsiteSettingsUI {
|
||||
// The views implementation of the page info UI.
|
||||
class PageInfoPopupView : public content::WebContentsObserver,
|
||||
public PermissionSelectorRowObserver,
|
||||
public ChosenObjectRowObserver,
|
||||
public views::BubbleDialogDelegateView,
|
||||
public views::ButtonListener,
|
||||
public views::LinkListener,
|
||||
public views::StyledLabelListener,
|
||||
public PageInfoUI {
|
||||
public:
|
||||
~WebsiteSettingsPopupView() override;
|
||||
~PageInfoPopupView() override;
|
||||
|
||||
// Type of the popup being displayed.
|
||||
enum PopupType {
|
||||
POPUP_NONE,
|
||||
// Usual page info bubble for websites.
|
||||
POPUP_WEBSITE_SETTINGS,
|
||||
POPUP_PAGE_INFO,
|
||||
// Custom bubble for internal pages like chrome:// and chrome-extensions://.
|
||||
POPUP_INTERNAL_PAGE
|
||||
};
|
||||
@ -86,14 +86,14 @@ class WebsiteSettingsPopupView : public content::WebContentsObserver,
|
||||
static PopupType GetShownPopupType();
|
||||
|
||||
private:
|
||||
friend class test::WebsiteSettingsPopupViewTestApi;
|
||||
friend class test::PageInfoPopupViewTestApi;
|
||||
|
||||
WebsiteSettingsPopupView(views::View* anchor_view,
|
||||
gfx::NativeView parent_window,
|
||||
Profile* profile,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& url,
|
||||
const security_state::SecurityInfo& security_info);
|
||||
PageInfoPopupView(views::View* anchor_view,
|
||||
gfx::NativeView parent_window,
|
||||
Profile* profile,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& url,
|
||||
const security_state::SecurityInfo& security_info);
|
||||
|
||||
// WebContentsObserver implementation.
|
||||
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
|
||||
@ -101,11 +101,10 @@ class WebsiteSettingsPopupView : public content::WebContentsObserver,
|
||||
|
||||
// PermissionSelectorRowObserver implementation.
|
||||
void OnPermissionChanged(
|
||||
const WebsiteSettingsUI::PermissionInfo& permission) override;
|
||||
const PageInfoUI::PermissionInfo& permission) override;
|
||||
|
||||
// ChosenObjectRowObserver implementation.
|
||||
void OnChosenObjectDeleted(
|
||||
const WebsiteSettingsUI::ChosenObjectInfo& info) override;
|
||||
void OnChosenObjectDeleted(const PageInfoUI::ChosenObjectInfo& info) override;
|
||||
|
||||
// views::BubbleDialogDelegateView implementation.
|
||||
base::string16 GetWindowTitle() const override;
|
||||
@ -128,7 +127,7 @@ class WebsiteSettingsPopupView : public content::WebContentsObserver,
|
||||
// views::View implementation.
|
||||
gfx::Size GetPreferredSize() const override;
|
||||
|
||||
// WebsiteSettingsUI implementations.
|
||||
// PageInfoUI implementations.
|
||||
void SetCookieInfo(const CookieInfoList& cookie_info_list) override;
|
||||
void SetPermissionInfo(const PermissionInfoList& permission_info_list,
|
||||
ChosenObjectInfoList chosen_object_info_list) override;
|
||||
@ -146,8 +145,8 @@ class WebsiteSettingsPopupView : public content::WebContentsObserver,
|
||||
// Whether DevTools is disabled for the relevant profile.
|
||||
bool is_devtools_disabled_;
|
||||
|
||||
// The presenter that controls the Website Settings UI.
|
||||
std::unique_ptr<WebsiteSettings> presenter_;
|
||||
// The presenter that controls the Page Info UI.
|
||||
std::unique_ptr<PageInfo> presenter_;
|
||||
|
||||
Profile* profile_;
|
||||
|
||||
@ -178,9 +177,9 @@ class WebsiteSettingsPopupView : public content::WebContentsObserver,
|
||||
// |Permission| changes.
|
||||
std::vector<std::unique_ptr<PermissionSelectorRow>> selector_rows_;
|
||||
|
||||
base::WeakPtrFactory<WebsiteSettingsPopupView> weak_factory_;
|
||||
base::WeakPtrFactory<PageInfoPopupView> weak_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupView);
|
||||
DISALLOW_COPY_AND_ASSIGN(PageInfoPopupView);
|
||||
};
|
||||
|
||||
#endif // CHROME_BROWSER_UI_VIEWS_PAGE_INFO_WEBSITE_SETTINGS_POPUP_VIEW_H_
|
||||
#endif // CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_POPUP_VIEW_H_
|
@ -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/ui/views/page_info/website_settings_popup_view.h"
|
||||
#include "chrome/browser/ui/views/page_info/page_info_popup_view.h"
|
||||
|
||||
#include "chrome/browser/ui/browser_commands.h"
|
||||
#include "chrome/browser/ui/views/frame/browser_view.h"
|
||||
@ -33,15 +33,15 @@ void ClickAndWait(Browser* browser) {
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(WebSiteSettingsPopupViewBrowserTest, ShowPopup) {
|
||||
ClickAndWait(browser());
|
||||
EXPECT_EQ(WebsiteSettingsPopupView::POPUP_WEBSITE_SETTINGS,
|
||||
WebsiteSettingsPopupView::GetShownPopupType());
|
||||
EXPECT_EQ(PageInfoPopupView::POPUP_PAGE_INFO,
|
||||
PageInfoPopupView::GetShownPopupType());
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(WebSiteSettingsPopupViewBrowserTest, ChromeURL) {
|
||||
ui_test_utils::NavigateToURL(browser(), GURL("chrome://settings"));
|
||||
ClickAndWait(browser());
|
||||
EXPECT_EQ(WebsiteSettingsPopupView::POPUP_INTERNAL_PAGE,
|
||||
WebsiteSettingsPopupView::GetShownPopupType());
|
||||
EXPECT_EQ(PageInfoPopupView::POPUP_INTERNAL_PAGE,
|
||||
PageInfoPopupView::GetShownPopupType());
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(WebSiteSettingsPopupViewBrowserTest,
|
||||
@ -49,24 +49,24 @@ IN_PROC_BROWSER_TEST_F(WebSiteSettingsPopupViewBrowserTest,
|
||||
ui_test_utils::NavigateToURL(
|
||||
browser(), GURL("chrome-extension://extension-id/options.html"));
|
||||
ClickAndWait(browser());
|
||||
EXPECT_EQ(WebsiteSettingsPopupView::POPUP_INTERNAL_PAGE,
|
||||
WebsiteSettingsPopupView::GetShownPopupType());
|
||||
EXPECT_EQ(PageInfoPopupView::POPUP_INTERNAL_PAGE,
|
||||
PageInfoPopupView::GetShownPopupType());
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(WebSiteSettingsPopupViewBrowserTest, ChromeDevtoolsURL) {
|
||||
ui_test_utils::NavigateToURL(
|
||||
browser(), GURL("chrome-devtools://devtools/bundled/inspector.html"));
|
||||
ClickAndWait(browser());
|
||||
EXPECT_EQ(WebsiteSettingsPopupView::POPUP_INTERNAL_PAGE,
|
||||
WebsiteSettingsPopupView::GetShownPopupType());
|
||||
EXPECT_EQ(PageInfoPopupView::POPUP_INTERNAL_PAGE,
|
||||
PageInfoPopupView::GetShownPopupType());
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(WebSiteSettingsPopupViewBrowserTest, ViewSourceURL) {
|
||||
ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
|
||||
chrome::ViewSelectedSource(browser());
|
||||
ClickAndWait(browser());
|
||||
EXPECT_EQ(WebsiteSettingsPopupView::POPUP_INTERNAL_PAGE,
|
||||
WebsiteSettingsPopupView::GetShownPopupType());
|
||||
EXPECT_EQ(PageInfoPopupView::POPUP_INTERNAL_PAGE,
|
||||
PageInfoPopupView::GetShownPopupType());
|
||||
}
|
||||
|
||||
} // namespace
|
@ -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/ui/views/page_info/website_settings_popup_view.h"
|
||||
#include "chrome/browser/ui/views/page_info/page_info_popup_view.h"
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
@ -29,11 +29,11 @@ const char* kUrl = "http://www.example.com/index.html";
|
||||
|
||||
namespace test {
|
||||
|
||||
class WebsiteSettingsPopupViewTestApi {
|
||||
class PageInfoPopupViewTestApi {
|
||||
public:
|
||||
WebsiteSettingsPopupViewTestApi(gfx::NativeView parent,
|
||||
Profile* profile,
|
||||
content::WebContents* web_contents)
|
||||
PageInfoPopupViewTestApi(gfx::NativeView parent,
|
||||
Profile* profile,
|
||||
content::WebContents* web_contents)
|
||||
: view_(nullptr),
|
||||
parent_(parent),
|
||||
profile_(profile),
|
||||
@ -47,12 +47,11 @@ class WebsiteSettingsPopupViewTestApi {
|
||||
|
||||
security_state::SecurityInfo security_info;
|
||||
views::View* anchor_view = nullptr;
|
||||
view_ =
|
||||
new WebsiteSettingsPopupView(anchor_view, parent_, profile_,
|
||||
web_contents_, GURL(kUrl), security_info);
|
||||
view_ = new PageInfoPopupView(anchor_view, parent_, profile_, web_contents_,
|
||||
GURL(kUrl), security_info);
|
||||
}
|
||||
|
||||
WebsiteSettingsPopupView* view() { return view_; }
|
||||
PageInfoPopupView* view() { return view_; }
|
||||
views::View* permissions_view() { return view_->permissions_view_; }
|
||||
|
||||
PermissionSelectorRow* GetPermissionSelectorAt(int index) {
|
||||
@ -84,20 +83,20 @@ class WebsiteSettingsPopupViewTestApi {
|
||||
|
||||
// Simulates recreating the dialog with a new PermissionInfoList.
|
||||
void SetPermissionInfo(const PermissionInfoList& list) {
|
||||
for (const WebsiteSettingsPopupView::PermissionInfo& info : list)
|
||||
for (const PageInfoPopupView::PermissionInfo& info : list)
|
||||
view_->presenter_->OnSitePermissionChanged(info.type, info.setting);
|
||||
CreateView();
|
||||
}
|
||||
|
||||
private:
|
||||
WebsiteSettingsPopupView* view_; // Weak. Owned by its Widget.
|
||||
PageInfoPopupView* view_; // Weak. Owned by its Widget.
|
||||
|
||||
// For recreating the view.
|
||||
gfx::NativeView parent_;
|
||||
Profile* profile_;
|
||||
content::WebContents* web_contents_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupViewTestApi);
|
||||
DISALLOW_COPY_AND_ASSIGN(PageInfoPopupViewTestApi);
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
@ -125,9 +124,9 @@ class ScopedWebContentsTestHelper {
|
||||
DISALLOW_COPY_AND_ASSIGN(ScopedWebContentsTestHelper);
|
||||
};
|
||||
|
||||
class WebsiteSettingsPopupViewTest : public testing::Test {
|
||||
class PageInfoPopupViewTest : public testing::Test {
|
||||
public:
|
||||
WebsiteSettingsPopupViewTest() {}
|
||||
PageInfoPopupViewTest() {}
|
||||
|
||||
// testing::Test:
|
||||
void SetUp() override {
|
||||
@ -138,7 +137,7 @@ class WebsiteSettingsPopupViewTest : public testing::Test {
|
||||
|
||||
content::WebContents* web_contents = web_contents_helper_.web_contents();
|
||||
TabSpecificContentSettings::CreateForWebContents(web_contents);
|
||||
api_.reset(new test::WebsiteSettingsPopupViewTestApi(
|
||||
api_.reset(new test::PageInfoPopupViewTestApi(
|
||||
parent_window_->GetNativeView(), web_contents_helper_.profile(),
|
||||
web_contents));
|
||||
}
|
||||
@ -151,10 +150,10 @@ class WebsiteSettingsPopupViewTest : public testing::Test {
|
||||
views::ScopedViewsTestHelper views_helper_;
|
||||
|
||||
views::Widget* parent_window_ = nullptr; // Weak. Owned by the NativeWidget.
|
||||
std::unique_ptr<test::WebsiteSettingsPopupViewTestApi> api_;
|
||||
std::unique_ptr<test::PageInfoPopupViewTestApi> api_;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupViewTest);
|
||||
DISALLOW_COPY_AND_ASSIGN(PageInfoPopupViewTest);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
@ -177,8 +176,8 @@ class WebsiteSettingsPopupViewTest : public testing::Test {
|
||||
constexpr int kViewsPerPermissionRow = 3;
|
||||
|
||||
// Test UI construction and reconstruction via
|
||||
// WebsiteSettingsPopupView::SetPermissionInfo().
|
||||
TEST_F(WebsiteSettingsPopupViewTest, MAYBE_SetPermissionInfo) {
|
||||
// PageInfoPopupView::SetPermissionInfo().
|
||||
TEST_F(PageInfoPopupViewTest, MAYBE_SetPermissionInfo) {
|
||||
PermissionInfoList list(1);
|
||||
list.back().type = CONTENT_SETTINGS_TYPE_GEOLOCATION;
|
||||
list.back().source = content_settings::SETTING_SOURCE_USER;
|
||||
@ -207,7 +206,7 @@ TEST_F(WebsiteSettingsPopupViewTest, MAYBE_SetPermissionInfo) {
|
||||
EXPECT_EQ(base::ASCIIToUTF16("Block"), api_->GetPermissionButtonTextAt(0));
|
||||
|
||||
// Simulate a user selection via the UI. Note this will also cover logic in
|
||||
// WebsiteSettings to update the pref.
|
||||
// PageInfo to update the pref.
|
||||
list.back().setting = CONTENT_SETTING_ALLOW;
|
||||
api_->GetPermissionSelectorAt(0)->PermissionChanged(list.back());
|
||||
EXPECT_EQ(kExpectedChildren, api_->permissions_view()->child_count());
|
||||
@ -226,7 +225,7 @@ TEST_F(WebsiteSettingsPopupViewTest, MAYBE_SetPermissionInfo) {
|
||||
}
|
||||
|
||||
// Test UI construction and reconstruction with USB devices.
|
||||
TEST_F(WebsiteSettingsPopupViewTest, SetPermissionInfoWithUsbDevice) {
|
||||
TEST_F(PageInfoPopupViewTest, SetPermissionInfoWithUsbDevice) {
|
||||
const int kExpectedChildren =
|
||||
kViewsPerPermissionRow *
|
||||
(ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() ? 11 : 13);
|
@ -7,10 +7,10 @@
|
||||
#include "base/i18n/rtl.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_ui.h"
|
||||
#include "chrome/browser/ui/page_info/permission_menu_model.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings_ui.h"
|
||||
#include "chrome/browser/ui/views/page_info/non_accessible_image_view.h"
|
||||
#include "chrome/browser/ui/views/page_info/website_settings_popup_view.h"
|
||||
#include "chrome/browser/ui/views/page_info/page_info_popup_view.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "ui/accessibility/ax_node_data.h"
|
||||
#include "ui/base/material_design/material_design_controller.h"
|
||||
@ -235,18 +235,18 @@ void PermissionCombobox::OnPerformAction(Combobox* combobox) {
|
||||
PermissionSelectorRow::PermissionSelectorRow(
|
||||
Profile* profile,
|
||||
const GURL& url,
|
||||
const WebsiteSettingsUI::PermissionInfo& permission,
|
||||
const PageInfoUI::PermissionInfo& permission,
|
||||
views::GridLayout* layout)
|
||||
: profile_(profile), icon_(NULL), menu_button_(NULL), combobox_(NULL) {
|
||||
// Create the permission icon.
|
||||
icon_ = new NonAccessibleImageView();
|
||||
const gfx::Image& image = WebsiteSettingsUI::GetPermissionIcon(permission);
|
||||
const gfx::Image& image = PageInfoUI::GetPermissionIcon(permission);
|
||||
icon_->SetImage(image.ToImageSkia());
|
||||
layout->AddView(icon_, 1, 1, views::GridLayout::CENTER,
|
||||
views::GridLayout::CENTER);
|
||||
// Create the label that displays the permission type.
|
||||
label_ = new views::Label(
|
||||
WebsiteSettingsUI::PermissionTypeToUIString(permission.type));
|
||||
label_ =
|
||||
new views::Label(PageInfoUI::PermissionTypeToUIString(permission.type));
|
||||
layout->AddView(label_, 1, 1, views::GridLayout::LEADING,
|
||||
views::GridLayout::CENTER);
|
||||
// Create the menu model.
|
||||
@ -290,23 +290,23 @@ PermissionSelectorRow::~PermissionSelectorRow() {
|
||||
|
||||
void PermissionSelectorRow::InitializeMenuButtonView(
|
||||
views::GridLayout* layout,
|
||||
const WebsiteSettingsUI::PermissionInfo& permission) {
|
||||
const PageInfoUI::PermissionInfo& permission) {
|
||||
bool button_enabled =
|
||||
permission.source == content_settings::SETTING_SOURCE_USER;
|
||||
menu_button_ = new internal::PermissionMenuButton(
|
||||
WebsiteSettingsUI::PermissionActionToUIString(
|
||||
PageInfoUI::PermissionActionToUIString(
|
||||
profile_, permission.type, permission.setting,
|
||||
permission.default_setting, permission.source),
|
||||
menu_model_.get(), button_enabled);
|
||||
menu_button_->SetEnabled(button_enabled);
|
||||
menu_button_->SetAccessibleName(
|
||||
WebsiteSettingsUI::PermissionTypeToUIString(permission.type));
|
||||
PageInfoUI::PermissionTypeToUIString(permission.type));
|
||||
layout->AddView(menu_button_);
|
||||
}
|
||||
|
||||
void PermissionSelectorRow::InitializeComboboxView(
|
||||
views::GridLayout* layout,
|
||||
const WebsiteSettingsUI::PermissionInfo& permission) {
|
||||
const PageInfoUI::PermissionInfo& permission) {
|
||||
bool button_enabled =
|
||||
permission.source == content_settings::SETTING_SOURCE_USER;
|
||||
combobox_model_adapter_.reset(
|
||||
@ -315,23 +315,23 @@ void PermissionSelectorRow::InitializeComboboxView(
|
||||
button_enabled, true);
|
||||
combobox_->SetEnabled(button_enabled);
|
||||
combobox_->SetAccessibleName(
|
||||
WebsiteSettingsUI::PermissionTypeToUIString(permission.type));
|
||||
PageInfoUI::PermissionTypeToUIString(permission.type));
|
||||
layout->AddView(combobox_);
|
||||
}
|
||||
|
||||
void PermissionSelectorRow::PermissionChanged(
|
||||
const WebsiteSettingsUI::PermissionInfo& permission) {
|
||||
const PageInfoUI::PermissionInfo& permission) {
|
||||
// Change the permission icon to reflect the selected setting.
|
||||
const gfx::Image& image = WebsiteSettingsUI::GetPermissionIcon(permission);
|
||||
const gfx::Image& image = PageInfoUI::GetPermissionIcon(permission);
|
||||
icon_->SetImage(image.ToImageSkia());
|
||||
|
||||
// Update the menu button text to reflect the new setting.
|
||||
if (menu_button_) {
|
||||
menu_button_->SetText(WebsiteSettingsUI::PermissionActionToUIString(
|
||||
menu_button_->SetText(PageInfoUI::PermissionActionToUIString(
|
||||
profile_, permission.type, permission.setting,
|
||||
permission.default_setting, content_settings::SETTING_SOURCE_USER));
|
||||
menu_button_->SizeToPreferredSize();
|
||||
// Re-layout will be done at the |WebsiteSettingsPopupView| level, since
|
||||
// Re-layout will be done at the |PageInfoPopupView| level, since
|
||||
// that view may need to resize itself to accomodate the new sizes of its
|
||||
// contents.
|
||||
menu_button_->InvalidateLayout();
|
||||
|
@ -10,8 +10,8 @@
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_ui.h"
|
||||
#include "chrome/browser/ui/page_info/permission_menu_model.h"
|
||||
#include "chrome/browser/ui/page_info/website_settings_ui.h"
|
||||
#include "chrome/browser/ui/views/page_info/permission_selector_row_observer.h"
|
||||
#include "components/content_settings/core/common/content_settings.h"
|
||||
#include "components/content_settings/core/common/content_settings_types.h"
|
||||
@ -26,7 +26,7 @@ class PermissionMenuButton;
|
||||
}
|
||||
|
||||
namespace test {
|
||||
class WebsiteSettingsPopupViewTestApi;
|
||||
class PageInfoPopupViewTestApi;
|
||||
}
|
||||
|
||||
namespace views {
|
||||
@ -46,23 +46,21 @@ class PermissionSelectorRow {
|
||||
// The |PermissionSelectorRow|'s constituent views are added to |layout|.
|
||||
PermissionSelectorRow(Profile* profile,
|
||||
const GURL& url,
|
||||
const WebsiteSettingsUI::PermissionInfo& permission,
|
||||
const PageInfoUI::PermissionInfo& permission,
|
||||
views::GridLayout* layout);
|
||||
virtual ~PermissionSelectorRow();
|
||||
|
||||
void AddObserver(PermissionSelectorRowObserver* observer);
|
||||
|
||||
void PermissionChanged(const WebsiteSettingsUI::PermissionInfo& permission);
|
||||
void PermissionChanged(const PageInfoUI::PermissionInfo& permission);
|
||||
|
||||
private:
|
||||
friend class test::WebsiteSettingsPopupViewTestApi;
|
||||
friend class test::PageInfoPopupViewTestApi;
|
||||
|
||||
void InitializeMenuButtonView(
|
||||
views::GridLayout* layout,
|
||||
const WebsiteSettingsUI::PermissionInfo& permission);
|
||||
void InitializeComboboxView(
|
||||
views::GridLayout* layout,
|
||||
const WebsiteSettingsUI::PermissionInfo& permission);
|
||||
void InitializeMenuButtonView(views::GridLayout* layout,
|
||||
const PageInfoUI::PermissionInfo& permission);
|
||||
void InitializeComboboxView(views::GridLayout* layout,
|
||||
const PageInfoUI::PermissionInfo& permission);
|
||||
|
||||
// Returns the "button" for this row, which is the control used to change the
|
||||
// permission's value. This is either a |MenuButton| or a |Combobox|.
|
||||
|
@ -5,13 +5,13 @@
|
||||
#ifndef CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PERMISSION_SELECTOR_ROW_OBSERVER_H_
|
||||
#define CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PERMISSION_SELECTOR_ROW_OBSERVER_H_
|
||||
|
||||
#include "chrome/browser/ui/page_info/website_settings_ui.h"
|
||||
#include "chrome/browser/ui/page_info/page_info_ui.h"
|
||||
|
||||
class PermissionSelectorRowObserver {
|
||||
public:
|
||||
// This method is called whenever the permission setting is changed.
|
||||
virtual void OnPermissionChanged(
|
||||
const WebsiteSettingsUI::PermissionInfo& permission) = 0;
|
||||
const PageInfoUI::PermissionInfo& permission) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~PermissionSelectorRowObserver() {}
|
||||
|
@ -80,7 +80,7 @@ class PermissionCombobox : public views::MenuButton,
|
||||
const ui::Event* event) override;
|
||||
|
||||
// Callback when a permission's setting is changed.
|
||||
void PermissionChanged(const WebsiteSettingsUI::PermissionInfo& permission);
|
||||
void PermissionChanged(const PageInfoUI::PermissionInfo& permission);
|
||||
|
||||
private:
|
||||
int index_;
|
||||
@ -129,7 +129,7 @@ void PermissionCombobox::OnMenuButtonClicked(views::MenuButton* source,
|
||||
}
|
||||
|
||||
void PermissionCombobox::PermissionChanged(
|
||||
const WebsiteSettingsUI::PermissionInfo& permission) {
|
||||
const PageInfoUI::PermissionInfo& permission) {
|
||||
SetText(model_->GetLabelAt(model_->GetIndexOfCommandId(permission.setting)));
|
||||
SizeToPreferredSize();
|
||||
|
||||
|
@ -421,8 +421,8 @@ ToolbarView::GetContentSettingBubbleModelDelegate() {
|
||||
return browser_->content_setting_bubble_model_delegate();
|
||||
}
|
||||
|
||||
void ToolbarView::ShowWebsiteSettings(content::WebContents* web_contents) {
|
||||
chrome::ShowWebsiteSettings(browser_, web_contents);
|
||||
void ToolbarView::ShowPageInfo(content::WebContents* web_contents) {
|
||||
chrome::ShowPageInfo(browser_, web_contents);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -123,7 +123,7 @@ class ToolbarView : public views::AccessiblePaneView,
|
||||
const ToolbarModel* GetToolbarModel() const override;
|
||||
ContentSettingBubbleModelDelegate* GetContentSettingBubbleModelDelegate()
|
||||
override;
|
||||
void ShowWebsiteSettings(content::WebContents* web_contents) override;
|
||||
void ShowPageInfo(content::WebContents* web_contents) override;
|
||||
|
||||
// CommandObserver:
|
||||
void EnabledStateChangedForCommand(int id, bool enabled) override;
|
||||
|
@ -194,12 +194,10 @@ content::WebUIDataSource* CreateVrShellUIHTMLSource() {
|
||||
source->AddResourcePath("vk.css", IDR_VR_SHELL_UI_VK_CSS);
|
||||
source->AddResourcePath("vk.js", IDR_VR_SHELL_UI_VK_JS);
|
||||
source->SetDefaultResource(IDR_VR_SHELL_UI_HTML);
|
||||
source->AddLocalizedString(
|
||||
"insecureWebVrContentPermanent",
|
||||
IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_PERMANENT);
|
||||
source->AddLocalizedString(
|
||||
"insecureWebVrContentTransient",
|
||||
IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_TRANSIENT);
|
||||
source->AddLocalizedString("insecureWebVrContentPermanent",
|
||||
IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_PERMANENT);
|
||||
source->AddLocalizedString("insecureWebVrContentTransient",
|
||||
IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_TRANSIENT);
|
||||
source->AddLocalizedString("back", IDS_VR_SHELL_UI_BACK_BUTTON);
|
||||
source->AddLocalizedString("forward", IDS_VR_SHELL_UI_FORWARD_BUTTON);
|
||||
source->AddLocalizedString("reload", IDS_VR_SHELL_UI_RELOAD_BUTTON);
|
||||
|
@ -559,7 +559,7 @@ if (!is_android) {
|
||||
"../browser/ui/views/location_bar/location_icon_view_interactive_uitest.cc",
|
||||
"../browser/ui/views/location_bar/star_view_browsertest.cc",
|
||||
"../browser/ui/views/omnibox/omnibox_view_views_browsertest.cc",
|
||||
"../browser/ui/views/page_info/website_settings_popup_view_interactive_uitest.cc",
|
||||
"../browser/ui/views/page_info/page_info_popup_view_interactive_uitest.cc",
|
||||
"../browser/ui/views/passwords/manage_passwords_bubble_view_interactive_uitest.cc",
|
||||
"../browser/ui/views/passwords/manage_passwords_icon_view_interactive_uitest.cc",
|
||||
"../browser/ui/views/ssl_client_certificate_selector_browsertest.cc",
|
||||
@ -3393,7 +3393,7 @@ test("unit_tests") {
|
||||
"../browser/ui/chrome_select_file_policy_unittest.cc",
|
||||
"../browser/ui/find_bar/find_backend_unittest.cc",
|
||||
"../browser/ui/login/login_handler_unittest.cc",
|
||||
"../browser/ui/page_info/website_settings_unittest.cc",
|
||||
"../browser/ui/page_info/page_info_unittest.cc",
|
||||
"../browser/ui/passwords/manage_passwords_state_unittest.cc",
|
||||
"../browser/ui/passwords/manage_passwords_view_utils_unittest.cc",
|
||||
"../browser/ui/passwords/password_manager_presenter_unittest.cc",
|
||||
@ -4678,8 +4678,8 @@ test("unit_tests") {
|
||||
"../browser/ui/cocoa/omnibox/omnibox_popup_separator_view_unittest.mm",
|
||||
"../browser/ui/cocoa/omnibox/omnibox_popup_view_mac_unittest.mm",
|
||||
"../browser/ui/cocoa/omnibox/omnibox_view_mac_unittest.mm",
|
||||
"../browser/ui/cocoa/page_info/page_info_bubble_controller_unittest.mm",
|
||||
"../browser/ui/cocoa/page_info/permission_selector_button_unittest.mm",
|
||||
"../browser/ui/cocoa/page_info/website_settings_bubble_controller_unittest.mm",
|
||||
"../browser/ui/cocoa/passwords/account_chooser_view_controller_unittest.mm",
|
||||
"../browser/ui/cocoa/passwords/autosignin_prompt_view_controller_unittest.mm",
|
||||
"../browser/ui/cocoa/passwords/base_passwords_controller_test.h",
|
||||
@ -4838,7 +4838,7 @@ test("unit_tests") {
|
||||
"../browser/ui/views/confirm_bubble_views_unittest.cc",
|
||||
"../browser/ui/views/global_error_bubble_view_unittest.cc",
|
||||
"../browser/ui/views/harmony/layout_delegate_unittest.cc",
|
||||
"../browser/ui/views/page_info/website_settings_popup_view_unittest.cc",
|
||||
"../browser/ui/views/page_info/page_info_popup_view_unittest.cc",
|
||||
"../browser/ui/views/payments/credit_card_editor_view_controller_unittest.cc",
|
||||
"../browser/ui/views/payments/payment_request_item_list_unittest.cc",
|
||||
"../browser/ui/views/payments/validating_textfield_unittest.cc",
|
||||
|
@ -115,7 +115,7 @@ class TestBrowserWindow : public BrowserWindow {
|
||||
bool app_modal,
|
||||
const base::Callback<void(bool)>& callback) override {}
|
||||
void UserChangedTheme() override {}
|
||||
void ShowWebsiteSettings(
|
||||
void ShowPageInfo(
|
||||
Profile* profile,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& virtual_url,
|
||||
|
@ -313,8 +313,8 @@
|
||||
Open startup pages
|
||||
</message>
|
||||
|
||||
<!-- Website Settings UI -->
|
||||
<message name="IDS_WEBSITE_SETTINGS_NON_SECURE_TRANSPORT" desc="Text that is displayed in the header of the Website Settings popup if the website uses non-secure transport.">
|
||||
<!-- Page Info UI -->
|
||||
<message name="IDS_PAGE_INFO_NON_SECURE_TRANSPORT" desc="Text that is displayed in the header of the Website Settings popup if the website uses non-secure transport.">
|
||||
Your connection to this site is not private.
|
||||
</message>
|
||||
|
||||
|
@ -119,7 +119,7 @@ class InfoBarDelegate {
|
||||
GOOGLE_API_KEYS_INFOBAR_DELEGATE = 45,
|
||||
OBSOLETE_SYSTEM_INFOBAR_DELEGATE = 46,
|
||||
SESSION_CRASHED_INFOBAR_DELEGATE = 47,
|
||||
WEBSITE_SETTINGS_INFOBAR_DELEGATE = 48,
|
||||
PAGE_INFO_INFOBAR_DELEGATE = 48,
|
||||
AUTOFILL_CC_INFOBAR_DELEGATE = 49,
|
||||
TRANSLATE_INFOBAR_DELEGATE = 50,
|
||||
IOS_CHROME_SAVE_PASSWORD_INFOBAR_DELEGATE = 51,
|
||||
|
@ -35,7 +35,7 @@ dialogs are:
|
||||
5. One-click signin
|
||||
6. Site permissions bubble
|
||||
7. "Card unmask prompt" (TODO(ellyjones): what is this?)
|
||||
8. Website settings dialog
|
||||
8. Page info dialog
|
||||
|
||||
Once all of these dialogs are converted and tested behind the feature, we can
|
||||
ship to canary and dev channels and watch for any performance or crash rate
|
||||
|
@ -23,7 +23,7 @@ NSString* MessageForHTTPAuth(NSURLProtectionSpace* protectionSpace) {
|
||||
return RequesterIdentity(protectionSpace);
|
||||
|
||||
NSString* securityWarning =
|
||||
l10n_util::GetNSString(IDS_WEBSITE_SETTINGS_NON_SECURE_TRANSPORT);
|
||||
l10n_util::GetNSString(IDS_PAGE_INFO_NON_SECURE_TRANSPORT);
|
||||
return
|
||||
[NSString stringWithFormat:@"%@ %@", RequesterIdentity(protectionSpace),
|
||||
securityWarning];
|
||||
|
@ -81,12 +81,13 @@ TEST(NSURLProtectionSpaceUtilTest, ShowForSocksProxy) {
|
||||
// Expecting the following text:
|
||||
// The proxy chromium.org requires a username and password.
|
||||
// Your connection to this site is not private.
|
||||
NSString* expectedText = [NSString
|
||||
stringWithFormat:@"%@ %@", l10n_util::GetNSStringF(
|
||||
NSString* expectedText =
|
||||
[NSString stringWithFormat:@"%@ %@",
|
||||
l10n_util::GetNSStringF(
|
||||
IDS_LOGIN_DIALOG_PROXY_AUTHORITY,
|
||||
base::SysNSStringToUTF16(kTestHost)),
|
||||
l10n_util::GetNSString(
|
||||
IDS_WEBSITE_SETTINGS_NON_SECURE_TRANSPORT)];
|
||||
l10n_util::GetNSString(
|
||||
IDS_PAGE_INFO_NON_SECURE_TRANSPORT)];
|
||||
|
||||
EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace));
|
||||
}
|
||||
@ -101,12 +102,13 @@ TEST(NSURLProtectionSpaceUtilTest, ShowForHttpProxy) {
|
||||
// Expecting the following text:
|
||||
// The proxy http://chromium.org requires a username and password.
|
||||
// Your connection to this site is not private.
|
||||
NSString* expectedText = [NSString
|
||||
stringWithFormat:@"%@ %@", l10n_util::GetNSStringF(
|
||||
NSString* expectedText =
|
||||
[NSString stringWithFormat:@"%@ %@",
|
||||
l10n_util::GetNSStringF(
|
||||
IDS_LOGIN_DIALOG_PROXY_AUTHORITY,
|
||||
base::SysNSStringToUTF16(kTestHttpOrigin)),
|
||||
l10n_util::GetNSString(
|
||||
IDS_WEBSITE_SETTINGS_NON_SECURE_TRANSPORT)];
|
||||
l10n_util::GetNSString(
|
||||
IDS_PAGE_INFO_NON_SECURE_TRANSPORT)];
|
||||
EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace));
|
||||
}
|
||||
|
||||
@ -130,7 +132,7 @@ TEST(NSURLProtectionSpaceUtilTest, ShowForHttpsProxy) {
|
||||
IDS_LOGIN_DIALOG_PROXY_AUTHORITY,
|
||||
base::SysNSStringToUTF16(kTestHttpsOrigin)),
|
||||
l10n_util::GetNSString(
|
||||
IDS_WEBSITE_SETTINGS_NON_SECURE_TRANSPORT)];
|
||||
IDS_PAGE_INFO_NON_SECURE_TRANSPORT)];
|
||||
} else {
|
||||
// Expecting the following text:
|
||||
// The proxy https://chromium.org:80 requires a username and password.
|
||||
@ -150,12 +152,13 @@ TEST(NSURLProtectionSpaceUtilTest, ShowForHttpServer) {
|
||||
|
||||
// Expecting the following text:
|
||||
// http://chromium.org requires a username and password.
|
||||
NSString* expectedText = [NSString
|
||||
stringWithFormat:@"%@ %@", l10n_util::GetNSStringF(
|
||||
NSString* expectedText =
|
||||
[NSString stringWithFormat:@"%@ %@",
|
||||
l10n_util::GetNSStringF(
|
||||
IDS_LOGIN_DIALOG_AUTHORITY,
|
||||
base::SysNSStringToUTF16(kTestHttpOrigin)),
|
||||
l10n_util::GetNSString(
|
||||
IDS_WEBSITE_SETTINGS_NON_SECURE_TRANSPORT)];
|
||||
l10n_util::GetNSString(
|
||||
IDS_PAGE_INFO_NON_SECURE_TRANSPORT)];
|
||||
EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace));
|
||||
}
|
||||
|
||||
|
@ -1409,7 +1409,7 @@ should be able to be added at any place in this file.
|
||||
<owner>mariakhomenko@chromium.org</owner>
|
||||
<owner>tedchoc@chromium.org</owner>
|
||||
<description>
|
||||
An instant app was launched from the website settings popup.
|
||||
An instant app was launched from the page info popup.
|
||||
</description>
|
||||
</action>
|
||||
|
||||
@ -10518,13 +10518,13 @@ should be able to be added at any place in this file.
|
||||
|
||||
<action name="MobileWebsiteSettingsOpenedFromMenu">
|
||||
<owner>tedchoc@chromium.org</owner>
|
||||
<description>Website Settings opened via the menu.</description>
|
||||
<description>Page Info opened via the menu.</description>
|
||||
</action>
|
||||
|
||||
<action name="MobileWebsiteSettingsOpenedFromToolbar">
|
||||
<owner>tedchoc@chromium.org</owner>
|
||||
<description>
|
||||
Website Settings opened via the toolbar page info (i.e. https lock) icon.
|
||||
Page Info opened via the toolbar page info (i.e. https lock) icon.
|
||||
</description>
|
||||
</action>
|
||||
|
||||
|
@ -80093,7 +80093,7 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
|
||||
<owner>sashab@chromium.org</owner>
|
||||
<summary>
|
||||
Count of how often a specific content type (permission) is changed using the
|
||||
Website Settings UI.
|
||||
Page Info UI.
|
||||
</summary>
|
||||
</histogram>
|
||||
|
||||
@ -97435,7 +97435,7 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
|
||||
<int value="45" label="GOOGLE_API_KEYS_INFOBAR_DELEGATE"/>
|
||||
<int value="46" label="OBSOLETE_SYSTEM_INFOBAR_DELEGATE"/>
|
||||
<int value="47" label="SESSION_CRASHED_INFOBAR_DELEGATE"/>
|
||||
<int value="48" label="WEBSITE_SETTINGS_INFOBAR_DELEGATE"/>
|
||||
<int value="48" label="PAGE_INFO_INFOBAR_DELEGATE"/>
|
||||
<int value="49" label="AUTOFILL_CC_INFOBAR_DELEGATE"/>
|
||||
<int value="50" label="TRANSLATE_INFOBAR_DELEGATE"/>
|
||||
<int value="51" label="IOS_CHROME_SAVE_PASSWORD_INFOBAR_DELEGATE"/>
|
||||
|
Reference in New Issue
Block a user