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

Side by Side Diff: chrome/browser/ui/cocoa/passwords/passwords_bubble_controller_views.mm

Issue 2808823002: MacViews: Allows the toolkit-views Manage Passwords Dialog to be used (Closed)
Patch Set: MacViews: Allows the toolkit-views Manage Passwords Dialog to be used (tests compile) Created 3 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/platform_util.h"
6 #include "chrome/browser/ui/browser.h"
7 #include "chrome/browser/ui/browser_finder.h"
8 #include "chrome/browser/ui/browser_window.h"
9 #import "chrome/browser/ui/cocoa/bubble_anchor_helper_views.h"
10 #import "chrome/browser/ui/cocoa/passwords/passwords_bubble_controller.h"
11 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h"
12 #import "ui/base/cocoa/cocoa_base_utils.h"
13 #import "ui/gfx/mac/coordinate_conversion.h"
14
15 void ShowViewsManagePasswordsBubbleOnCocoaBrowser(
16 NSPoint anchor,
17 content::WebContents* web_contents,
18 bool user_action) {
19 // Don't show the bubble again if it's already showing. A second click on the
20 // location icon in the omnibox will dismiss an open bubble. This behaviour is
21 // consistent with the non-Mac views implementation.
22 // Note that when the browser is toolkit-views, IsBubbleShown() is checked
23 // earlier because the bubble is shown on mouse release (but dismissed on
24 // mouse pressed). A Cocoa browser does both on mouse pressed, so a check
25 // when showing is sufficient.
26 if (ManagePasswordsBubbleView::IsBubbleShown())
tapted 2017/04/12 05:08:42 Can we get into a situation where this does someth
varkha 2017/04/12 09:16:43 There shouldn't be non-interactive login, right? A
27 return;
28
29 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
30 gfx::Point anchor_point =
31 gfx::ScreenPointFromNSPoint(ui::ConvertPointFromWindowToScreen(
32 browser->window()->GetNativeWindow(), anchor));
33 gfx::NativeView parent =
34 platform_util::GetViewForWindow(browser->window()->GetNativeWindow());
35 DCHECK(parent);
36
37 ManagePasswordsBubbleView* bubble_view = new ManagePasswordsBubbleView(
38 web_contents, nullptr, anchor_point,
39 user_action ? LocationBarBubbleDelegateView::USER_GESTURE
40 : LocationBarBubbleDelegateView::AUTOMATIC);
41 bubble_view->set_parent_window(parent);
42 views::BubbleDialogDelegateView::CreateBubble(bubble_view);
43 bubble_view->GetWidget()->Show();
44 KeepBubbleAnchored(bubble_view);
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698