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

Side by Side Diff: chrome/browser/ui/cocoa/confirm_bubble_views_mac.mm

Issue 2650583012: MacViews: Enable views based Ask Google For Suggestions dialog behind secondary-ui-md flag. (Closed)
Patch Set: Rebase. Created 3 years, 10 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/ui/confirm_bubble.h"
6
7 #import "chrome/browser/ui/cocoa/confirm_bubble_controller.h"
8 #include "chrome/browser/ui/confirm_bubble_model.h"
9 #include "chrome/browser/ui/views/confirm_bubble_views.h"
10 #include "components/constrained_window/constrained_window_views.h"
11 #include "ui/base/material_design/material_design_controller.h"
12
13 namespace {
14
15 void ShowConfirmBubbleViews(gfx::NativeWindow window,
16 std::unique_ptr<ConfirmBubbleModel> model) {
17 constrained_window::CreateBrowserModalDialogViews(
18 new ConfirmBubbleViews(std::move(model)), window)
19 ->Show();
20 }
21
22 } // namespace
23
24 namespace chrome {
25
26 void ShowConfirmBubble(gfx::NativeWindow window,
27 gfx::NativeView anchor_view,
28 const gfx::Point& origin,
29 std::unique_ptr<ConfirmBubbleModel> model) {
30 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
31 ShowConfirmBubbleViews(window, std::move(model));
32 return;
33 }
34
35 // Create a custom NSViewController that manages a bubble view, and add it to
36 // a child to the specified |anchor_view|. This controller will be
37 // automatically deleted when it loses first-responder status.
38 ConfirmBubbleController* controller =
39 [[ConfirmBubbleController alloc] initWithParent:anchor_view
40 origin:origin.ToCGPoint()
41 model:std::move(model)];
42 [anchor_view addSubview:[controller view]
43 positioned:NSWindowAbove
44 relativeTo:nil];
45 [[anchor_view window] makeFirstResponder:[controller view]];
46 }
47
48 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/confirm_bubble_cocoa.mm ('k') | chrome/browser/ui/views/confirm_bubble_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698