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

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

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months 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 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"
(...skipping 10 matching lines...) Expand all
21 @private 21 @private
22 base::scoped_nsobject<ExtensionInstallViewController> installViewController_; 22 base::scoped_nsobject<ExtensionInstallViewController> installViewController_;
23 WindowedInstallDialogController* dialogController_; // Weak. Owns us. 23 WindowedInstallDialogController* dialogController_; // Weak. Owns us.
24 } 24 }
25 25
26 @property(readonly, nonatomic) ExtensionInstallViewController* viewController; 26 @property(readonly, nonatomic) ExtensionInstallViewController* viewController;
27 27
28 - (id)initWithProfile:(Profile*)profile 28 - (id)initWithProfile:(Profile*)profile
29 navigator:(content::PageNavigator*)navigator 29 navigator:(content::PageNavigator*)navigator
30 delegate:(WindowedInstallDialogController*)delegate 30 delegate:(WindowedInstallDialogController*)delegate
31 prompt:(scoped_ptr<ExtensionInstallPrompt::Prompt>)prompt; 31 prompt:(std::unique_ptr<ExtensionInstallPrompt::Prompt>)prompt;
32 32
33 @end 33 @end
34 34
35 WindowedInstallDialogController::WindowedInstallDialogController( 35 WindowedInstallDialogController::WindowedInstallDialogController(
36 ExtensionInstallPromptShowParams* show_params, 36 ExtensionInstallPromptShowParams* show_params,
37 const ExtensionInstallPrompt::DoneCallback& done_callback, 37 const ExtensionInstallPrompt::DoneCallback& done_callback,
38 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt) 38 std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt)
39 : done_callback_(done_callback) { 39 : done_callback_(done_callback) {
40 install_controller_.reset([[WindowedInstallController alloc] 40 install_controller_.reset([[WindowedInstallController alloc]
41 initWithProfile:show_params->profile() 41 initWithProfile:show_params->profile()
42 navigator:show_params->GetParentWebContents() 42 navigator:show_params->GetParentWebContents()
43 delegate:this 43 delegate:this
44 prompt:std::move(prompt)]); 44 prompt:std::move(prompt)]);
45 [[install_controller_ window] makeKeyAndOrderFront:nil]; 45 [[install_controller_ window] makeKeyAndOrderFront:nil];
46 } 46 }
47 47
48 WindowedInstallDialogController::~WindowedInstallDialogController() { 48 WindowedInstallDialogController::~WindowedInstallDialogController() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 base::ResetAndReturn(&done_callback_).Run( 80 base::ResetAndReturn(&done_callback_).Run(
81 ExtensionInstallPrompt::Result::USER_CANCELED); 81 ExtensionInstallPrompt::Result::USER_CANCELED);
82 [[install_controller_ window] close]; 82 [[install_controller_ window] close];
83 } 83 }
84 84
85 @implementation WindowedInstallController 85 @implementation WindowedInstallController
86 86
87 - (id)initWithProfile:(Profile*)profile 87 - (id)initWithProfile:(Profile*)profile
88 navigator:(content::PageNavigator*)navigator 88 navigator:(content::PageNavigator*)navigator
89 delegate:(WindowedInstallDialogController*)delegate 89 delegate:(WindowedInstallDialogController*)delegate
90 prompt:(scoped_ptr<ExtensionInstallPrompt::Prompt>)prompt { 90 prompt:(std::unique_ptr<ExtensionInstallPrompt::Prompt>)prompt {
91 base::scoped_nsobject<NSWindow> controlledPanel( 91 base::scoped_nsobject<NSWindow> controlledPanel(
92 [[NSPanel alloc] initWithContentRect:ui::kWindowSizeDeterminedLater 92 [[NSPanel alloc] initWithContentRect:ui::kWindowSizeDeterminedLater
93 styleMask:NSTitledWindowMask 93 styleMask:NSTitledWindowMask
94 backing:NSBackingStoreBuffered 94 backing:NSBackingStoreBuffered
95 defer:NO]); 95 defer:NO]);
96 if ((self = [super initWithWindow:controlledPanel])) { 96 if ((self = [super initWithWindow:controlledPanel])) {
97 dialogController_ = delegate; 97 dialogController_ = delegate;
98 ExtensionInstallPrompt::Prompt* weakPrompt = prompt.get(); 98 ExtensionInstallPrompt::Prompt* weakPrompt = prompt.get();
99 installViewController_.reset([[ExtensionInstallViewController alloc] 99 installViewController_.reset([[ExtensionInstallViewController alloc]
100 initWithProfile:profile 100 initWithProfile:profile
(...skipping 24 matching lines...) Expand all
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698