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

Side by Side Diff: components/constrained_window/show_modal_dialog_cocoa.cc

Issue 2172363002: Created min size for print preview dialog and modified to allow the Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge ConstrainedWebDialog functions Created 4 years 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <memory> 5 #include <memory>
6 6
7 #include "components/constrained_window/constrained_window_views.h" 7 #include "components/constrained_window/constrained_window_views.h"
8 #include "components/web_modal/single_web_contents_dialog_manager.h" 8 #include "components/web_modal/single_web_contents_dialog_manager.h"
9 #include "components/web_modal/web_contents_modal_dialog_manager.h" 9 #include "components/web_modal/web_contents_modal_dialog_manager.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
11 #include "ui/base/accelerators/accelerator.h"
11 #include "ui/gfx/native_widget_types.h" 12 #include "ui/gfx/native_widget_types.h"
12 13
13 // TODO(patricialor): This is a layering violation and should be deleted. 14 // TODO(patricialor): This is a layering violation and should be deleted.
14 // Currently it's needed because on Cocoa, the dialog needs to be shown with a 15 // Currently it's needed because on Cocoa, the dialog needs to be shown with a
15 // SingleWebContentsDialogManagerViewsMac, which depends on things inside 16 // SingleWebContentsDialogManagerViewsMac, which depends on things inside
16 // chrome/browser/ui/cocoa/constrained_window/* and thus can't be moved out into 17 // chrome/browser/ui/cocoa/constrained_window/* and thus can't be moved out into
17 // components/constrained_window/*. Instead, to get this to work, the 18 // components/constrained_window/*. Instead, to get this to work, the
18 // CreateNativeWebModalManager() method is declared in the web_modal component, 19 // CreateNativeWebModalManager() method is declared in the web_modal component,
19 // but defined outside of that in c/b/u/cocoa/. 20 // but defined outside of that in c/b/u/cocoa/.
20 21
21 namespace constrained_window { 22 namespace constrained_window {
22 23
23 void ShowModalDialog(gfx::NativeWindow dialog, 24 void ShowModalDialog(gfx::NativeWindow dialog,
24 content::WebContents* initiator_web_contents) { 25 content::WebContents* initiator_web_contents) {
25 web_modal::WebContentsModalDialogManager* manager = 26 web_modal::WebContentsModalDialogManager* manager =
26 web_modal::WebContentsModalDialogManager::FromWebContents( 27 web_modal::WebContentsModalDialogManager::FromWebContents(
27 initiator_web_contents); 28 initiator_web_contents);
28 std::unique_ptr<web_modal::SingleWebContentsDialogManager> dialog_manager( 29 std::unique_ptr<web_modal::SingleWebContentsDialogManager> dialog_manager(
29 web_modal::WebContentsModalDialogManager::CreateNativeWebModalManager( 30 web_modal::WebContentsModalDialogManager::CreateNativeWebModalManager(
30 dialog, manager)); 31 dialog, manager));
31 manager->ShowDialogWithManager(dialog, std::move(dialog_manager)); 32 manager->ShowDialogWithManager(dialog, std::move(dialog_manager));
32 } 33 }
33 34
35 void ShowTopLevelModalDialog(gfx::NativeWindow dialog,
36 content::WebContents* initiator_web_contents,
37 ui::AcceleratorTarget* target) {
38 // Mac uses sheets, so just call the normal show modal dialog, and the dialog
39 // will not be clipped.
40 ShowModalDialog(dialog, initiator_web_contents);
41 }
42
34 } // namespace constrained_window 43 } // namespace constrained_window
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698