Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3023)

Unified Diff: chrome/browser/ui/views/website_settings/website_settings_popup_view.cc

Issue 2397273002: Show a custom page info bubble for chrome-devtools:// URLs (Closed)
Patch Set: Fix mac build Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
diff --git a/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc b/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
index 2d848a1d49e9ac38f158263bd431d2874a77640f..8afd9efd267a5d2e89018c1f3aa07eba53afe583 100644
--- a/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
+++ b/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
@@ -70,7 +70,8 @@ namespace {
// 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.
-bool is_popup_showing = false;
+WebsiteSettingsPopupView::PopupType shown_popup_type =
+ WebsiteSettingsPopupView::POPUP_NONE;
// Left icon margin.
const int kIconMarginLeft = 6;
@@ -343,6 +344,7 @@ InternalPageInfoPopupView::InternalPageInfoPopupView(
gfx::NativeView parent_window,
const GURL& url)
: BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT) {
+ shown_popup_type = WebsiteSettingsPopupView::POPUP_INTERNAL_PAGE;
set_parent_window(parent_window);
int text = IDS_PAGE_INFO_INTERNAL_PAGE;
@@ -354,7 +356,8 @@ InternalPageInfoPopupView::InternalPageInfoPopupView(
text = IDS_PAGE_INFO_VIEW_SOURCE_PAGE;
// view-source scheme uses the same icon as chrome:// pages.
icon = IDR_PRODUCT_LOGO_16;
- } else if (!url.SchemeIs(content::kChromeUIScheme)) {
+ } else if (!url.SchemeIs(content::kChromeUIScheme) &&
+ !url.SchemeIs(content::kChromeDevToolsScheme)) {
NOTREACHED();
}
@@ -394,7 +397,7 @@ views::NonClientFrameView* InternalPageInfoPopupView::CreateNonClientFrameView(
}
void InternalPageInfoPopupView::OnWidgetDestroying(views::Widget* widget) {
- is_popup_showing = false;
+ shown_popup_type = WebsiteSettingsPopupView::POPUP_NONE;
}
int InternalPageInfoPopupView::GetDialogButtons() const {
@@ -416,10 +419,10 @@ void WebsiteSettingsPopupView::ShowPopup(
content::WebContents* web_contents,
const GURL& url,
const security_state::SecurityStateModel::SecurityInfo& security_info) {
- is_popup_showing = true;
gfx::NativeView parent_window =
anchor_view ? nullptr : web_contents->GetNativeView();
if (url.SchemeIs(content::kChromeUIScheme) ||
+ url.SchemeIs(content::kChromeDevToolsScheme) ||
url.SchemeIs(extensions::kExtensionScheme) ||
url.SchemeIs(content::kViewSourceScheme)) {
// Use the concrete type so that |SetAnchorRect| can be called as a friend.
@@ -438,8 +441,9 @@ void WebsiteSettingsPopupView::ShowPopup(
}
// static
-bool WebsiteSettingsPopupView::IsPopupShowing() {
elawrence 2016/10/07 21:04:01 Given the calling patterns, does it make sense to
meacer 2016/10/10 18:09:18 I thought about doing that, but it seemed a bit re
- return is_popup_showing;
+WebsiteSettingsPopupView::PopupType
+WebsiteSettingsPopupView::GetShownPopupType() {
+ return shown_popup_type;
}
WebsiteSettingsPopupView::WebsiteSettingsPopupView(
@@ -459,8 +463,8 @@ WebsiteSettingsPopupView::WebsiteSettingsPopupView(
permissions_content_(nullptr),
site_settings_link_(nullptr),
weak_factory_(this) {
+ shown_popup_type = POPUP_WEBSITE_SETTINGS;
set_parent_window(parent_window);
-
is_devtools_disabled_ =
profile->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled);
@@ -524,7 +528,7 @@ void WebsiteSettingsPopupView::OnChosenObjectDeleted(
}
void WebsiteSettingsPopupView::OnWidgetDestroying(views::Widget* widget) {
- is_popup_showing = false;
+ shown_popup_type = POPUP_NONE;
presenter_->OnUIClosing();
}

Powered by Google App Engine
This is Rietveld 408576698