Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/browser_dialogs.h" | 5 #include "chrome/browser/ui/browser_dialogs.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/common/chrome_switches.cc" | 8 #include "chrome/common/chrome_switches.cc" |
| 9 #include "ui/gfx/geometry/rect.h" | |
| 10 #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.
| |
| 9 | 11 |
| 10 namespace chrome { | 12 namespace chrome { |
| 11 | 13 |
| 12 bool ToolkitViewsDialogsEnabled() { | 14 bool ToolkitViewsDialogsEnabled() { |
| 13 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 15 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 14 switches::kEnableMacViewsDialogs); | 16 switches::kEnableMacViewsDialogs); |
| 15 } | 17 } |
| 16 | 18 |
| 19 void ShowWebsiteSettingsBubbleViewsAtPoint(const gfx::Point& anchor_point, | |
| 20 Profile* profile, | |
| 21 content::WebContents* web_contents, | |
| 22 const GURL& url, | |
| 23 const content::SSLStatus& ssl, | |
| 24 Browser* browser) { | |
| 25 // The views bubble requires an anchor views::View. Create one using the | |
| 26 // anchor point. Since the view doesn't have a container Widget, | |
| 27 // View::ConvertPointToScreen will assume it's origin is 0,0. Create a rect | |
| 28 // where the midpoint of the bottom edge is at the anchor point. | |
| 29 gfx::Rect anchor_view_rect(0, 0, anchor_point.x() * 2, anchor_point.y()); | |
| 30 // WebsiteSettingsPopupView assumes a margin of | |
| 31 // WebsiteSettingsPopupView::kLocationIconVerticalMargin. | |
| 32 anchor_view_rect.Inset(0, 0, 0, -5); | |
| 33 | |
| 34 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
| |
| 35 anchor_view->SetBoundsRect(anchor_view_rect); | |
| 36 chrome::ShowWebsiteSettingsBubbleViews(anchor_view, profile, web_contents, | |
| 37 url, ssl, browser); | |
| 38 } | |
| 39 | |
| 17 } // namespace chrome | 40 } // namespace chrome |
| OLD | NEW |