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

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

Issue 1430023002: Enable AutoResize for Constrained Web Dialogs for Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/device_permissions_dialog_controller .h" 5 #import "chrome/browser/ui/cocoa/extensions/device_permissions_dialog_controller .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/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 15 matching lines...) Expand all
26 prompt:prompt]); 26 prompt:prompt]);
27 27
28 prompt_->SetObserver(this); 28 prompt_->SetObserver(this);
29 29
30 base::scoped_nsobject<NSWindow> window([[ConstrainedWindowCustomWindow alloc] 30 base::scoped_nsobject<NSWindow> window([[ConstrainedWindowCustomWindow alloc]
31 initWithContentRect:[[view_controller_ view] bounds]]); 31 initWithContentRect:[[view_controller_ view] bounds]]);
32 [[window contentView] addSubview:[view_controller_ view]]; 32 [[window contentView] addSubview:[view_controller_ view]];
33 33
34 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( 34 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet(
35 [[CustomConstrainedWindowSheet alloc] initWithCustomWindow:window]); 35 [[CustomConstrainedWindowSheet alloc] initWithCustomWindow:window]);
36 constrained_window_.reset( 36 constrained_window_.reset(ShowWebModalDialogMac(this, web_contents, sheet));
37 new ConstrainedWindowMac(this, web_contents, sheet));
38 } 37 }
39 38
40 DevicePermissionsDialogController::~DevicePermissionsDialogController() { 39 DevicePermissionsDialogController::~DevicePermissionsDialogController() {
41 prompt_->SetObserver(nullptr); 40 prompt_->SetObserver(nullptr);
42 } 41 }
43 42
44 void DevicePermissionsDialogController::Dismissed() { 43 void DevicePermissionsDialogController::Dismissed() {
45 constrained_window_->CloseWebContentsModalDialog(); 44 constrained_window_->CloseWebContentsModalDialog();
46 } 45 }
47 46
(...skipping 12 matching lines...) Expand all
60 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents()); 59 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents());
61 if (manager) { 60 if (manager) {
62 // These objects will delete themselves when the dialog closes. 61 // These objects will delete themselves when the dialog closes.
63 new DevicePermissionsDialogController(web_contents(), prompt()); 62 new DevicePermissionsDialogController(web_contents(), prompt());
64 } else { 63 } else {
65 base::ThreadTaskRunnerHandle::Get()->PostTask( 64 base::ThreadTaskRunnerHandle::Get()->PostTask(
66 FROM_HERE, 65 FROM_HERE,
67 base::Bind(&DevicePermissionsPrompt::Prompt::Dismissed, prompt())); 66 base::Bind(&DevicePermissionsPrompt::Prompt::Dismissed, prompt()));
68 } 67 }
69 } 68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698