OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 virtual ~ExtensionDialog(); | 33 virtual ~ExtensionDialog(); |
34 | 34 |
35 // Create and show a dialog with |url| centered over the browser window. | 35 // Create and show a dialog with |url| centered over the browser window. |
36 // |browser| is the browser to which the pop-up will be attached. | 36 // |browser| is the browser to which the pop-up will be attached. |
37 // |tab_contents| is the tab that spawned the dialog. | 37 // |tab_contents| is the tab that spawned the dialog. |
38 // |width| and |height| are the size of the dialog in pixels. | 38 // |width| and |height| are the size of the dialog in pixels. |
39 static ExtensionDialog* Show(const GURL& url, Browser* browser, | 39 static ExtensionDialog* Show(const GURL& url, Browser* browser, |
40 TabContents* tab_contents, | 40 TabContents* tab_contents, |
41 int width, | 41 int width, |
42 int height, | 42 int height, |
| 43 const string16& title, |
43 ExtensionDialogObserver* observer); | 44 ExtensionDialogObserver* observer); |
44 | 45 |
45 // Notifies the dialog that the observer has been destroyed and should not | 46 // Notifies the dialog that the observer has been destroyed and should not |
46 // be sent notifications. | 47 // be sent notifications. |
47 void ObserverDestroyed(); | 48 void ObserverDestroyed(); |
48 | 49 |
49 // Closes the ExtensionDialog. | 50 // Closes the ExtensionDialog. |
50 void Close(); | 51 void Close(); |
51 | 52 |
| 53 // Sets the window title. |
| 54 void set_title(const string16& title) { window_title_ = title; } |
| 55 |
52 ExtensionHost* host() const { return extension_host_.get(); } | 56 ExtensionHost* host() const { return extension_host_.get(); } |
53 | 57 |
54 // views::WidgetDelegate overrides. | 58 // views::WidgetDelegate overrides. |
55 virtual bool CanResize() const OVERRIDE; | 59 virtual bool CanResize() const OVERRIDE; |
56 virtual bool IsModal() const OVERRIDE; | 60 virtual bool IsModal() const OVERRIDE; |
57 virtual bool ShouldShowWindowTitle() const OVERRIDE; | 61 virtual bool ShouldShowWindowTitle() const OVERRIDE; |
| 62 virtual string16 GetWindowTitle() const OVERRIDE; |
58 virtual void DeleteDelegate() OVERRIDE; | 63 virtual void DeleteDelegate() OVERRIDE; |
59 virtual views::Widget* GetWidget() OVERRIDE; | 64 virtual views::Widget* GetWidget() OVERRIDE; |
60 virtual const views::Widget* GetWidget() const OVERRIDE; | 65 virtual const views::Widget* GetWidget() const OVERRIDE; |
61 virtual views::View* GetContentsView() OVERRIDE; | 66 virtual views::View* GetContentsView() OVERRIDE; |
62 | 67 |
63 // content::NotificationObserver overrides. | 68 // content::NotificationObserver overrides. |
64 virtual void Observe(int type, | 69 virtual void Observe(int type, |
65 const content::NotificationSource& source, | 70 const content::NotificationSource& source, |
66 const content::NotificationDetails& details); | 71 const content::NotificationDetails& details); |
67 | 72 |
68 private: | 73 private: |
69 // Use Show() to create instances. | 74 // Use Show() to create instances. |
70 ExtensionDialog(ExtensionHost* host, ExtensionDialogObserver* observer); | 75 ExtensionDialog(ExtensionHost* host, ExtensionDialogObserver* observer); |
71 | 76 |
72 static ExtensionHost* CreateExtensionHost(const GURL& url, | 77 static ExtensionHost* CreateExtensionHost(const GURL& url, |
73 Browser* browser); | 78 Browser* browser); |
74 | 79 |
75 void InitWindow(Browser* browser, int width, int height); | 80 void InitWindow(Browser* browser, int width, int height); |
76 | 81 |
77 // Window that holds the extension host view. | 82 // Window that holds the extension host view. |
78 views::Widget* window_; | 83 views::Widget* window_; |
79 | 84 |
| 85 // Window Title |
| 86 string16 window_title_; |
| 87 |
80 // The contained host for the view. | 88 // The contained host for the view. |
81 scoped_ptr<ExtensionHost> extension_host_; | 89 scoped_ptr<ExtensionHost> extension_host_; |
82 | 90 |
83 content::NotificationRegistrar registrar_; | 91 content::NotificationRegistrar registrar_; |
84 | 92 |
85 // The observer of this popup. | 93 // The observer of this popup. |
86 ExtensionDialogObserver* observer_; | 94 ExtensionDialogObserver* observer_; |
87 | 95 |
88 DISALLOW_COPY_AND_ASSIGN(ExtensionDialog); | 96 DISALLOW_COPY_AND_ASSIGN(ExtensionDialog); |
89 }; | 97 }; |
90 | 98 |
91 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_DIALOG_H_ | 99 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_DIALOG_H_ |
OLD | NEW |