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