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

Unified Diff: chrome/browser/ui/browser_dialogs_mac.cc

Issue 1280673003: [Mac] Enable MacViews site settings bubble behind --enable-mac-views-dialogs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@enabledialogs
Patch Set: Created 5 years, 4 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/browser_dialogs_mac.cc
diff --git a/chrome/browser/ui/browser_dialogs_mac.cc b/chrome/browser/ui/browser_dialogs_mac.cc
index 1d67a323e947e837dfb2273435149ae864c0a14e..c8d6a08049b5490187fcd123342b1807f1e50d49 100644
--- a/chrome/browser/ui/browser_dialogs_mac.cc
+++ b/chrome/browser/ui/browser_dialogs_mac.cc
@@ -6,6 +6,8 @@
#include "base/command_line.h"
#include "chrome/common/chrome_switches.cc"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/views/view.h"
tapted 2015/08/10 05:44:23 this include shouldn't be allowed here, but I thin
jackhou1 2015/08/10 09:11:09 Done.
namespace chrome {
@@ -14,4 +16,25 @@ bool ToolkitViewsDialogsEnabled() {
switches::kEnableMacViewsDialogs);
}
+void ShowWebsiteSettingsBubbleViewsAtPoint(const gfx::Point& anchor_point,
+ Profile* profile,
+ content::WebContents* web_contents,
+ const GURL& url,
+ const content::SSLStatus& ssl,
+ Browser* browser) {
+ // The views bubble requires an anchor views::View. Create one using the
+ // anchor point. Since the view doesn't have a container Widget,
+ // View::ConvertPointToScreen will assume it's origin is 0,0. Create a rect
+ // where the midpoint of the bottom edge is at the anchor point.
+ gfx::Rect anchor_view_rect(0, 0, anchor_point.x() * 2, anchor_point.y());
+ // WebsiteSettingsPopupView assumes a margin of
+ // WebsiteSettingsPopupView::kLocationIconVerticalMargin.
+ anchor_view_rect.Inset(0, 0, 0, -5);
+
+ views::View* anchor_view = new views::View();
tapted 2015/08/10 05:44:23 memory leak? This is going to be the hardest thin
jackhou1 2015/08/10 09:11:09 We'd have to make InternalPageInfoPopupView public
+ anchor_view->SetBoundsRect(anchor_view_rect);
+ chrome::ShowWebsiteSettingsBubbleViews(anchor_view, profile, web_contents,
+ url, ssl, browser);
+}
+
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698