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 #import "base/mac/sdk_forward_declarations.h" | 7 #import "base/mac/sdk_forward_declarations.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "chrome/browser/extensions/extension_install_prompt_show_params.h" |
10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
11 #import "chrome/browser/ui/cocoa/extensions/extension_install_view_controller.h" | 12 #import "chrome/browser/ui/cocoa/extensions/extension_install_view_controller.h" |
12 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
13 #include "ui/base/cocoa/window_size_constants.h" | 14 #include "ui/base/cocoa/window_size_constants.h" |
14 | 15 |
15 @interface WindowedInstallController | 16 @interface WindowedInstallController |
16 : NSWindowController<NSWindowDelegate> { | 17 : NSWindowController<NSWindowDelegate> { |
17 @private | 18 @private |
18 base::scoped_nsobject<ExtensionInstallViewController> installViewController_; | 19 base::scoped_nsobject<ExtensionInstallViewController> installViewController_; |
19 WindowedInstallDialogController* dialogController_; // Weak. Owns us. | 20 WindowedInstallDialogController* dialogController_; // Weak. Owns us. |
20 } | 21 } |
21 | 22 |
22 @property(readonly, nonatomic) ExtensionInstallViewController* viewController; | 23 @property(readonly, nonatomic) ExtensionInstallViewController* viewController; |
23 | 24 |
24 - (id)initWithProfile:(Profile*)profile | 25 - (id)initWithProfile:(Profile*)profile |
25 navigator:(content::PageNavigator*)navigator | 26 navigator:(content::PageNavigator*)navigator |
26 delegate:(WindowedInstallDialogController*)delegate | 27 delegate:(WindowedInstallDialogController*)delegate |
27 prompt:(scoped_refptr<ExtensionInstallPrompt::Prompt>)prompt; | 28 prompt:(scoped_refptr<ExtensionInstallPrompt::Prompt>)prompt; |
28 | 29 |
29 @end | 30 @end |
30 | 31 |
31 WindowedInstallDialogController::WindowedInstallDialogController( | 32 WindowedInstallDialogController::WindowedInstallDialogController( |
32 const ExtensionInstallPrompt::ShowParams& show_params, | 33 ExtensionInstallPromptShowParams* show_params, |
33 ExtensionInstallPrompt::Delegate* delegate, | 34 ExtensionInstallPrompt::Delegate* delegate, |
34 scoped_refptr<ExtensionInstallPrompt::Prompt> prompt) | 35 scoped_refptr<ExtensionInstallPrompt::Prompt> prompt) |
35 : delegate_(delegate) { | 36 : delegate_(delegate) { |
36 install_controller_.reset([[WindowedInstallController alloc] | 37 install_controller_.reset([[WindowedInstallController alloc] |
37 initWithProfile:show_params.profile | 38 initWithProfile:show_params->profile() |
38 navigator:show_params.parent_web_contents | 39 navigator:show_params->GetParentWebContents() |
39 delegate:this | 40 delegate:this |
40 prompt:prompt]); | 41 prompt:prompt]); |
41 [[install_controller_ window] makeKeyAndOrderFront:nil]; | 42 [[install_controller_ window] makeKeyAndOrderFront:nil]; |
42 } | 43 } |
43 | 44 |
44 WindowedInstallDialogController::~WindowedInstallDialogController() { | 45 WindowedInstallDialogController::~WindowedInstallDialogController() { |
45 DCHECK(!install_controller_); | 46 DCHECK(!install_controller_); |
46 DCHECK(!delegate_); | 47 DCHECK(!delegate_); |
47 } | 48 } |
48 | 49 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 - (ExtensionInstallViewController*)viewController { | 115 - (ExtensionInstallViewController*)viewController { |
115 return installViewController_; | 116 return installViewController_; |
116 } | 117 } |
117 | 118 |
118 - (void)windowWillClose:(NSNotification*)notification { | 119 - (void)windowWillClose:(NSNotification*)notification { |
119 [[self window] setDelegate:nil]; | 120 [[self window] setDelegate:nil]; |
120 dialogController_->OnWindowClosing(); | 121 dialogController_->OnWindowClosing(); |
121 } | 122 } |
122 | 123 |
123 @end | 124 @end |
OLD | NEW |