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