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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa.mm

Issue 2524213002: MacViews: Consolidate flags. Just use --secondary-ui-md to enable MacViews. (Closed)
Patch Set: remove obsolete comment from r409593 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 #import "chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa.h" 5 #import "chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
11 #include "chrome/browser/chooser_controller/chooser_controller.h" 11 #include "chrome/browser/chooser_controller/chooser_controller.h"
12 #include "chrome/browser/extensions/chrome_extension_chooser_dialog.h" 12 #include "chrome/browser/extensions/chrome_extension_chooser_dialog.h"
13 #include "chrome/browser/ui/browser_dialogs.h"
14 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" 13 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h"
15 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h" 14 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h"
16 #import "chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa_controller.h" 15 #import "chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa_controller.h"
17 #include "components/web_modal/web_contents_modal_dialog_manager.h" 16 #include "components/web_modal/web_contents_modal_dialog_manager.h"
17 #include "ui/base/material_design/material_design_controller.h"
18 18
19 ChooserDialogCocoa::ChooserDialogCocoa( 19 ChooserDialogCocoa::ChooserDialogCocoa(
20 content::WebContents* web_contents, 20 content::WebContents* web_contents,
21 std::unique_ptr<ChooserController> chooser_controller) 21 std::unique_ptr<ChooserController> chooser_controller)
22 : web_contents_(web_contents) { 22 : web_contents_(web_contents) {
23 DCHECK(web_contents_); 23 DCHECK(web_contents_);
24 DCHECK(chooser_controller); 24 DCHECK(chooser_controller);
25 chooser_dialog_cocoa_controller_.reset([[ChooserDialogCocoaController alloc] 25 chooser_dialog_cocoa_controller_.reset([[ChooserDialogCocoaController alloc]
26 initWithChooserDialogCocoa:this 26 initWithChooserDialogCocoa:this
27 chooserController:std::move(chooser_controller)]); 27 chooserController:std::move(chooser_controller)]);
(...skipping 16 matching lines...) Expand all
44 CreateAndShowWebModalDialogMac(this, web_contents_, sheet); 44 CreateAndShowWebModalDialogMac(this, web_contents_, sheet);
45 } 45 }
46 46
47 void ChooserDialogCocoa::Dismissed() { 47 void ChooserDialogCocoa::Dismissed() {
48 if (constrained_window_) 48 if (constrained_window_)
49 constrained_window_->CloseWebContentsModalDialog(); 49 constrained_window_->CloseWebContentsModalDialog();
50 } 50 }
51 51
52 void ChromeExtensionChooserDialog::ShowDialog( 52 void ChromeExtensionChooserDialog::ShowDialog(
53 std::unique_ptr<ChooserController> chooser_controller) const { 53 std::unique_ptr<ChooserController> chooser_controller) const {
54 if (chrome::ToolkitViewsWebUIDialogsEnabled()) 54 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
55 return ChromeExtensionChooserDialog::ShowDialogImpl( 55 return ChromeExtensionChooserDialog::ShowDialogImpl(
56 std::move(chooser_controller)); 56 std::move(chooser_controller));
57 }
57 58
58 web_modal::WebContentsModalDialogManager* manager = 59 web_modal::WebContentsModalDialogManager* manager =
59 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents_); 60 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents_);
60 if (manager) { 61 if (manager) {
61 // These objects will delete themselves when the dialog closes. 62 // These objects will delete themselves when the dialog closes.
62 ChooserDialogCocoa* chooser_dialog = 63 ChooserDialogCocoa* chooser_dialog =
63 new ChooserDialogCocoa(web_contents_, std::move(chooser_controller)); 64 new ChooserDialogCocoa(web_contents_, std::move(chooser_controller));
64 chooser_dialog->ShowDialog(); 65 chooser_dialog->ShowDialog();
65 } 66 }
66 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698