OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_WEBUI_HTML_DIALOG_CONTROLLER_H_ | |
6 #define CHROME_BROWSER_UI_WEBUI_HTML_DIALOG_CONTROLLER_H_ | |
7 #pragma once | |
8 | |
9 #include "chrome/browser/ui/webui/html_dialog_ui.h" | |
10 #include "content/public/browser/notification_observer.h" | |
11 #include "content/public/browser/notification_registrar.h" | |
12 | |
13 class Browser; | |
14 class Profile; | |
15 | |
16 // This provides the common functionality for HtmlDialogs of notifying the | |
17 // dialog that it should close when the browser that created it has closed to | |
18 // avoid using an old Profile object. | |
19 class HtmlDialogController : public content::NotificationObserver { | |
20 public: | |
21 HtmlDialogController(HtmlDialogUIDelegate* delegate, | |
22 Profile* profile, | |
23 Browser* browser); | |
24 | |
25 // content::NotificationObserver implementation. | |
26 virtual void Observe(int type, | |
27 const content::NotificationSource& source, | |
28 const content::NotificationDetails& details) OVERRIDE; | |
29 | |
30 private: | |
31 // The delegate controlled by this instance. This class is owned by the | |
32 // delegate. | |
33 HtmlDialogUIDelegate* dialog_delegate_; | |
34 | |
35 // Used for notification of parent browser closing. | |
36 content::NotificationRegistrar registrar_; | |
37 | |
38 DISALLOW_COPY_AND_ASSIGN(HtmlDialogController); | |
39 }; | |
40 | |
41 #endif // CHROME_BROWSER_UI_WEBUI_HTML_DIALOG_CONTROLLER_H_ | |
OLD | NEW |