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