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

Unified Diff: chrome/browser/ui/cocoa/extensions/device_permissions_dialog_controller.mm

Issue 2390823005: Update device permissions dialog ui for Chrome apps and extensions (Closed)
Patch Set: address more comments Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/extensions/device_permissions_dialog_controller.mm
diff --git a/chrome/browser/ui/cocoa/extensions/device_permissions_dialog_controller.mm b/chrome/browser/ui/cocoa/extensions/device_permissions_dialog_controller.mm
deleted file mode 100644
index 852fbba7969c8be8e7451cd09e513bb0895e0e97..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/cocoa/extensions/device_permissions_dialog_controller.mm
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "chrome/browser/ui/cocoa/extensions/device_permissions_dialog_controller.h"
-
-#include "base/bind.h"
-#include "base/location.h"
-#include "base/single_thread_task_runner.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "chrome/browser/extensions/api/chrome_device_permissions_prompt.h"
-#include "chrome/browser/ui/browser_dialogs.h"
-#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.h"
-#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h"
-#import "chrome/browser/ui/cocoa/extensions/device_permissions_view_controller.h"
-#include "components/web_modal/web_contents_modal_dialog_manager.h"
-#include "device/usb/usb_device.h"
-
-using extensions::DevicePermissionsPrompt;
-
-DevicePermissionsDialogController::DevicePermissionsDialogController(
- content::WebContents* web_contents,
- scoped_refptr<DevicePermissionsPrompt::Prompt> prompt)
- : prompt_(prompt) {
- view_controller_.reset(
- [[DevicePermissionsViewController alloc] initWithController:this
- prompt:prompt]);
-
- prompt_->SetObserver(this);
-
- base::scoped_nsobject<NSWindow> window([[ConstrainedWindowCustomWindow alloc]
- initWithContentRect:[[view_controller_ view] bounds]]);
- [[window contentView] addSubview:[view_controller_ view]];
-
- base::scoped_nsobject<CustomConstrainedWindowSheet> sheet(
- [[CustomConstrainedWindowSheet alloc] initWithCustomWindow:window]);
- constrained_window_ =
- CreateAndShowWebModalDialogMac(this, web_contents, sheet);
-}
-
-DevicePermissionsDialogController::~DevicePermissionsDialogController() {
- prompt_->SetObserver(nullptr);
-}
-
-void DevicePermissionsDialogController::Dismissed() {
- constrained_window_->CloseWebContentsModalDialog();
-}
-
-void DevicePermissionsDialogController::OnDevicesChanged() {
- [view_controller_ devicesChanged];
-}
-
-void DevicePermissionsDialogController::OnConstrainedWindowClosed(
- ConstrainedWindowMac* window) {
- prompt_->Dismissed();
- base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
-}
-
-void ChromeDevicePermissionsPrompt::ShowDialog() {
- if (chrome::ToolkitViewsWebUIDialogsEnabled())
- return ChromeDevicePermissionsPrompt::ShowDialogViews();
- web_modal::WebContentsModalDialogManager* manager =
- web_modal::WebContentsModalDialogManager::FromWebContents(web_contents());
- if (manager) {
- // These objects will delete themselves when the dialog closes.
- new DevicePermissionsDialogController(web_contents(), prompt());
- } else {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE,
- base::Bind(&DevicePermissionsPrompt::Prompt::Dismissed, prompt()));
- }
-}

Powered by Google App Engine
This is Rietveld 408576698