OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_VIEWS_EXTENSIONS_EXTENSION_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_DIALOG_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_DIALOG_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_DIALOG_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class WebContents; | 22 class WebContents; |
23 } | 23 } |
24 | 24 |
25 // Modal dialog containing contents provided by an extension. | 25 // Modal dialog containing contents provided by an extension. |
26 // Dialog is automatically centered in the browser window and has fixed size. | 26 // Dialog is automatically centered in the browser window and has fixed size. |
27 // For example, used by the Chrome OS file browser. | 27 // For example, used by the Chrome OS file browser. |
28 class ExtensionDialog : public views::WidgetDelegate, | 28 class ExtensionDialog : public views::WidgetDelegate, |
29 public content::NotificationObserver, | 29 public content::NotificationObserver, |
30 public base::RefCounted<ExtensionDialog> { | 30 public base::RefCounted<ExtensionDialog> { |
31 public: | 31 public: |
32 virtual ~ExtensionDialog(); | |
33 | |
34 // Create and show a dialog with |url| centered over the browser window. | 32 // Create and show a dialog with |url| centered over the browser window. |
35 // |browser| is the browser to which the pop-up will be attached. | 33 // |browser| is the browser to which the pop-up will be attached. |
36 // |web_contents| is the tab that spawned the dialog. | 34 // |web_contents| is the tab that spawned the dialog. |
37 // |width| and |height| are the size of the dialog in pixels. | 35 // |width| and |height| are the size of the dialog in pixels. |
38 static ExtensionDialog* Show(const GURL& url, | 36 static ExtensionDialog* Show(const GURL& url, |
39 Browser* browser, | 37 Browser* browser, |
40 content::WebContents* web_contents, | 38 content::WebContents* web_contents, |
41 int width, | 39 int width, |
42 int height, | 40 int height, |
43 const string16& title, | 41 const string16& title, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 virtual void DeleteDelegate() OVERRIDE; | 83 virtual void DeleteDelegate() OVERRIDE; |
86 virtual views::Widget* GetWidget() OVERRIDE; | 84 virtual views::Widget* GetWidget() OVERRIDE; |
87 virtual const views::Widget* GetWidget() const OVERRIDE; | 85 virtual const views::Widget* GetWidget() const OVERRIDE; |
88 virtual views::View* GetContentsView() OVERRIDE; | 86 virtual views::View* GetContentsView() OVERRIDE; |
89 | 87 |
90 // content::NotificationObserver overrides. | 88 // content::NotificationObserver overrides. |
91 virtual void Observe(int type, | 89 virtual void Observe(int type, |
92 const content::NotificationSource& source, | 90 const content::NotificationSource& source, |
93 const content::NotificationDetails& details) OVERRIDE; | 91 const content::NotificationDetails& details) OVERRIDE; |
94 | 92 |
| 93 protected: |
| 94 virtual ~ExtensionDialog(); |
| 95 |
95 private: | 96 private: |
| 97 friend class base::RefCounted<ExtensionDialog>; |
| 98 |
96 // Use Show() to create instances. | 99 // Use Show() to create instances. |
97 ExtensionDialog(ExtensionHost* host, ExtensionDialogObserver* observer); | 100 ExtensionDialog(ExtensionHost* host, ExtensionDialogObserver* observer); |
98 | 101 |
99 static ExtensionDialog* ShowInternal(const GURL& url, | 102 static ExtensionDialog* ShowInternal(const GURL& url, |
100 Browser* browser, | 103 Browser* browser, |
101 ExtensionHost* host, | 104 ExtensionHost* host, |
102 int width, | 105 int width, |
103 int height, | 106 int height, |
104 bool fullscreen, | 107 bool fullscreen, |
105 const string16& title, | 108 const string16& title, |
(...skipping 17 matching lines...) Expand all Loading... |
123 | 126 |
124 content::NotificationRegistrar registrar_; | 127 content::NotificationRegistrar registrar_; |
125 | 128 |
126 // The observer of this popup. | 129 // The observer of this popup. |
127 ExtensionDialogObserver* observer_; | 130 ExtensionDialogObserver* observer_; |
128 | 131 |
129 DISALLOW_COPY_AND_ASSIGN(ExtensionDialog); | 132 DISALLOW_COPY_AND_ASSIGN(ExtensionDialog); |
130 }; | 133 }; |
131 | 134 |
132 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_DIALOG_H_ | 135 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_DIALOG_H_ |
OLD | NEW |