OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/windowed_install_dialog_controller.h
" | 5 #import "chrome/browser/ui/cocoa/extensions/windowed_install_dialog_controller.h
" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #import "base/callback_helpers.h" | 9 #import "base/callback_helpers.h" |
10 #import "base/mac/sdk_forward_declarations.h" | 10 #import "base/mac/sdk_forward_declarations.h" |
11 #include "base/message_loop/message_loop.h" | |
12 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 12 #include "base/threading/thread_task_runner_handle.h" |
13 #include "chrome/browser/extensions/extension_install_prompt_show_params.h" | 13 #include "chrome/browser/extensions/extension_install_prompt_show_params.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #import "chrome/browser/ui/cocoa/extensions/extension_install_view_controller.h" | 15 #import "chrome/browser/ui/cocoa/extensions/extension_install_view_controller.h" |
16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
17 #include "ui/base/cocoa/window_size_constants.h" | 17 #include "ui/base/cocoa/window_size_constants.h" |
18 | 18 |
19 @interface WindowedInstallController | 19 @interface WindowedInstallController |
20 : NSWindowController<NSWindowDelegate> { | 20 : NSWindowController<NSWindowDelegate> { |
21 @private | 21 @private |
22 base::scoped_nsobject<ExtensionInstallViewController> installViewController_; | 22 base::scoped_nsobject<ExtensionInstallViewController> installViewController_; |
(...skipping 26 matching lines...) Expand all Loading... |
49 DCHECK(!install_controller_); | 49 DCHECK(!install_controller_); |
50 DCHECK(done_callback_.is_null()); | 50 DCHECK(done_callback_.is_null()); |
51 } | 51 } |
52 | 52 |
53 void WindowedInstallDialogController::OnWindowClosing() { | 53 void WindowedInstallDialogController::OnWindowClosing() { |
54 install_controller_.reset(); | 54 install_controller_.reset(); |
55 if (!done_callback_.is_null()) { | 55 if (!done_callback_.is_null()) { |
56 base::ResetAndReturn(&done_callback_).Run( | 56 base::ResetAndReturn(&done_callback_).Run( |
57 ExtensionInstallPrompt::Result::ABORTED); | 57 ExtensionInstallPrompt::Result::ABORTED); |
58 } | 58 } |
59 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 59 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); |
60 } | 60 } |
61 | 61 |
62 ExtensionInstallViewController* | 62 ExtensionInstallViewController* |
63 WindowedInstallDialogController::GetViewController() { | 63 WindowedInstallDialogController::GetViewController() { |
64 return [install_controller_ viewController]; | 64 return [install_controller_ viewController]; |
65 } | 65 } |
66 | 66 |
67 void WindowedInstallDialogController::OnOkButtonClicked() { | 67 void WindowedInstallDialogController::OnOkButtonClicked() { |
68 base::ResetAndReturn(&done_callback_).Run( | 68 base::ResetAndReturn(&done_callback_).Run( |
69 ExtensionInstallPrompt::Result::ACCEPTED); | 69 ExtensionInstallPrompt::Result::ACCEPTED); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 - (ExtensionInstallViewController*)viewController { | 125 - (ExtensionInstallViewController*)viewController { |
126 return installViewController_; | 126 return installViewController_; |
127 } | 127 } |
128 | 128 |
129 - (void)windowWillClose:(NSNotification*)notification { | 129 - (void)windowWillClose:(NSNotification*)notification { |
130 [[self window] setDelegate:nil]; | 130 [[self window] setDelegate:nil]; |
131 dialogController_->OnWindowClosing(); | 131 dialogController_->OnWindowClosing(); |
132 } | 132 } |
133 | 133 |
134 @end | 134 @end |
OLD | NEW |