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

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

Issue 1534123002: [Extensions] Migrate ExtensionInstallPrompt::Delegate to be a callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_WINDOWED_INSTALL_DIALOG_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_WINDOWED_INSTALL_DIALOG_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_WINDOWED_INSTALL_DIALOG_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_WINDOWED_INSTALL_DIALOG_CONTROLLER_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/mac/scoped_nsobject.h" 11 #include "base/mac/scoped_nsobject.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "chrome/browser/extensions/extension_install_prompt.h" 13 #include "chrome/browser/extensions/extension_install_prompt.h"
14 #import "chrome/browser/ui/cocoa/extensions/extension_install_view_controller.h"
14 15
15 class ExtensionInstallPromptShowParams; 16 class ExtensionInstallPromptShowParams;
16 @class ExtensionInstallViewController; 17 @class ExtensionInstallViewController;
17 @class WindowedInstallController; 18 @class WindowedInstallController;
18 19
19 // Displays an app or extension install or permissions prompt as a standalone 20 // Displays an app or extension install or permissions prompt as a standalone
20 // NSPanel. 21 // NSPanel.
21 class WindowedInstallDialogController 22 class WindowedInstallDialogController : public ExtensionInstallViewDelegate {
22 : public ExtensionInstallPrompt::Delegate {
23 public: 23 public:
24 // Initializes the ExtensionInstallViewController and shows the window. This 24 // Initializes the ExtensionInstallViewController and shows the window. This
25 // object will delete itself when the window is closed. 25 // object will delete itself when the window is closed.
26 WindowedInstallDialogController( 26 WindowedInstallDialogController(
27 ExtensionInstallPromptShowParams* show_params, 27 ExtensionInstallPromptShowParams* show_params,
28 ExtensionInstallPrompt::Delegate* delegate, 28 const ExtensionInstallPrompt::DoneCallback& callback,
29 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt); 29 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt);
30 ~WindowedInstallDialogController() override; 30 ~WindowedInstallDialogController() override;
31 31
32 // Invoked by the -[NSWindow windowWillClose:] notification after a dialog 32 // Invoked by the -[NSWindow windowWillClose:] notification after a dialog
33 // choice is invoked. Releases owned resources, then deletes |this|. 33 // choice is invoked. Releases owned resources, then deletes |this|.
34 void OnWindowClosing(); 34 void OnWindowClosing();
35 35
36 // ExtensionInstallPrompt::Delegate: 36 // ExtensionInstallViewDelegate:
37 void InstallUIProceed() override; 37 void OnOkButtonClicked() override;
38 void InstallUIAbort(bool user_initiated) override; 38 void OnCancelButtonClicked() override;
39 void OnStoreLinkClicked() override;
39 40
40 private: 41 private:
41 FRIEND_TEST_ALL_PREFIXES(WindowedInstallDialogControllerBrowserTest, 42 FRIEND_TEST_ALL_PREFIXES(WindowedInstallDialogControllerBrowserTest,
42 ShowInstallDialog); 43 ShowInstallDialog);
43 ExtensionInstallViewController* GetViewController(); 44 ExtensionInstallViewController* GetViewController();
44 45
45 ExtensionInstallPrompt::Delegate* delegate_; 46 ExtensionInstallPrompt::DoneCallback done_callback_;
46 base::scoped_nsobject<WindowedInstallController> install_controller_; 47 base::scoped_nsobject<WindowedInstallController> install_controller_;
47 48
48 DISALLOW_COPY_AND_ASSIGN(WindowedInstallDialogController); 49 DISALLOW_COPY_AND_ASSIGN(WindowedInstallDialogController);
49 }; 50 };
50 51
51 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_WINDOWED_INSTALL_DIALOG_CONTROLLER _H_ 52 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_WINDOWED_INSTALL_DIALOG_CONTROLLER _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698