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

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

Issue 2390823005: Update device permissions dialog ui for Chrome apps and extensions (Closed)
Patch Set: address more comments 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/api/chrome_device_permissions_prompt.h"
12 #include "chrome/browser/extensions/chrome_extension_chooser_dialog.h" 13 #include "chrome/browser/extensions/chrome_extension_chooser_dialog.h"
14 #include "chrome/browser/extensions/device_permissions_dialog_controller.h"
13 #include "chrome/browser/ui/browser_dialogs.h" 15 #include "chrome/browser/ui/browser_dialogs.h"
14 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" 16 #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" 17 #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" 18 #import "chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa_controller.h"
17 #include "components/web_modal/web_contents_modal_dialog_manager.h" 19 #include "components/web_modal/web_contents_modal_dialog_manager.h"
18 20
19 ChooserDialogCocoa::ChooserDialogCocoa( 21 ChooserDialogCocoa::ChooserDialogCocoa(
20 content::WebContents* web_contents, 22 content::WebContents* web_contents,
21 std::unique_ptr<ChooserController> chooser_controller) 23 std::unique_ptr<ChooserController> chooser_controller)
22 : web_contents_(web_contents) { 24 : web_contents_(web_contents) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 59
58 web_modal::WebContentsModalDialogManager* manager = 60 web_modal::WebContentsModalDialogManager* manager =
59 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents_); 61 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents_);
60 if (manager) { 62 if (manager) {
61 // These objects will delete themselves when the dialog closes. 63 // These objects will delete themselves when the dialog closes.
62 ChooserDialogCocoa* chooser_dialog = 64 ChooserDialogCocoa* chooser_dialog =
63 new ChooserDialogCocoa(web_contents_, std::move(chooser_controller)); 65 new ChooserDialogCocoa(web_contents_, std::move(chooser_controller));
64 chooser_dialog->ShowDialog(); 66 chooser_dialog->ShowDialog();
65 } 67 }
66 } 68 }
69
70 void ChromeDevicePermissionsPrompt::ShowDialog() {
71 if (chrome::ToolkitViewsWebUIDialogsEnabled())
72 return ChromeDevicePermissionsPrompt::ShowDialogViews();
73
74 std::unique_ptr<ChooserController> chooser_controller(
75 new DevicePermissionsDialogController(web_contents()->GetMainFrame(),
76 prompt()));
77
78 // These objects will delete themselves when the dialog closes.
79 ChooserDialogCocoa* chooser_dialog =
80 new ChooserDialogCocoa(web_contents(), std::move(chooser_controller));
81 chooser_dialog->ShowDialog();
82 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698