Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(633)

Side by Side Diff: chrome/browser/ui/views/extensions/extension_dialog.h

Issue 14830005: Remove the extension dialog extra border. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused fullscreen dialog codepath. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/views/extensions/extension_dialog.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7
8 #include "base/logging.h" 8 #include "base/logging.h"
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"
11 #include "content/public/browser/notification_registrar.h" 11 #include "content/public/browser/notification_registrar.h"
12 #include "ui/views/widget/widget_delegate.h" 12 #include "ui/views/window/dialog_delegate.h"
13 13
14 class BaseWindow; 14 class BaseWindow;
15 class ExtensionDialogObserver; 15 class ExtensionDialogObserver;
16 class GURL; 16 class GURL;
17 class Profile; 17 class Profile;
18 18
19 namespace content { 19 namespace content {
20 class WebContents; 20 class WebContents;
21 } 21 }
22 22
23 namespace extensions { 23 namespace extensions {
24 class ExtensionHost; 24 class ExtensionHost;
25 } 25 }
26 26
27 // Modal dialog containing contents provided by an extension. 27 // Modal dialog containing contents provided by an extension.
28 // Dialog is automatically centered in the owning window and has fixed size. 28 // Dialog is automatically centered in the owning window and has fixed size.
29 // For example, used by the Chrome OS file browser. 29 // For example, used by the Chrome OS file browser.
30 class ExtensionDialog : public views::WidgetDelegate, 30 class ExtensionDialog : public views::DialogDelegate,
31 public content::NotificationObserver, 31 public content::NotificationObserver,
32 public base::RefCounted<ExtensionDialog> { 32 public base::RefCounted<ExtensionDialog> {
33 public: 33 public:
34 // Create and show a dialog with |url| centered over the provided window. 34 // Create and show a dialog with |url| centered over the provided window.
35 // |base_window| is the window to which the pop-up will be attached. 35 // |base_window| is the window to which the pop-up will be attached.
36 // |profile| is the profile that the extension is registered with. 36 // |profile| is the profile that the extension is registered with.
37 // |web_contents| is the tab that spawned the dialog. 37 // |web_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, 39 static ExtensionDialog* Show(const GURL& url,
40 BaseWindow* base_window, 40 BaseWindow* base_window,
41 Profile* profile, 41 Profile* profile,
42 content::WebContents* web_contents, 42 content::WebContents* web_contents,
43 int width, 43 int width,
44 int height, 44 int height,
45 const string16& title, 45 const string16& title,
46 ExtensionDialogObserver* observer); 46 ExtensionDialogObserver* observer);
47 47
48 #if defined(USE_AURA)
49 // Create and show a fullscreen dialog with |url|.
50 // |profile| is the profile that the extension is registered with.
51 // |web_contents| is the tab that spawned the dialog.
52 static ExtensionDialog* ShowFullscreen(const GURL& url,
53 Profile* profile,
54 const string16& title,
55 ExtensionDialogObserver* observer);
56 #else
57 static ExtensionDialog* ShowFullscreen(const GURL& url,
58 Profile* profile,
59 const string16& title,
60 ExtensionDialogObserver* observer) {
61 NOTIMPLEMENTED();
62 return NULL;
63 }
64 #endif
65
66 // 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
67 // be sent notifications. 49 // be sent notifications.
68 void ObserverDestroyed(); 50 void ObserverDestroyed();
69 51
70 // Closes the ExtensionDialog. 52 // Closes the ExtensionDialog.
71 void Close(); 53 void Close();
72 54
73 // Focus to the render view if possible. 55 // Focus to the render view if possible.
74 void MaybeFocusRenderView(); 56 void MaybeFocusRenderView();
75 57
76 // Sets the window title. 58 // Sets the window title.
77 void set_title(const string16& title) { window_title_ = title; } 59 void set_title(const string16& title) { window_title_ = title; }
78 60
79 // Sets minimum contents size in pixels and makes the window resizable. 61 // Sets minimum contents size in pixels and makes the window resizable.
80 void SetMinimumContentsSize(int width, int height); 62 void SetMinimumContentsSize(int width, int height);
81 63
82 extensions::ExtensionHost* host() const { return extension_host_.get(); } 64 extensions::ExtensionHost* host() const { return extension_host_.get(); }
83 65
84 // views::WidgetDelegate overrides. 66 // views::DialogDelegate override.
67 virtual int GetDialogButtons() const OVERRIDE;
85 virtual bool CanResize() const OVERRIDE; 68 virtual bool CanResize() const OVERRIDE;
86 virtual ui::ModalType GetModalType() const OVERRIDE; 69 virtual ui::ModalType GetModalType() const OVERRIDE;
87 virtual bool ShouldShowWindowTitle() const OVERRIDE; 70 virtual bool ShouldShowWindowTitle() const OVERRIDE;
88 virtual string16 GetWindowTitle() const OVERRIDE; 71 virtual string16 GetWindowTitle() const OVERRIDE;
89 virtual void WindowClosing() OVERRIDE; 72 virtual void WindowClosing() OVERRIDE;
90 virtual void DeleteDelegate() OVERRIDE; 73 virtual void DeleteDelegate() OVERRIDE;
91 virtual views::Widget* GetWidget() OVERRIDE; 74 virtual views::Widget* GetWidget() OVERRIDE;
92 virtual const views::Widget* GetWidget() const OVERRIDE; 75 virtual const views::Widget* GetWidget() const OVERRIDE;
93 virtual views::View* GetContentsView() OVERRIDE; 76 virtual views::View* GetContentsView() OVERRIDE;
94 77
(...skipping 10 matching lines...) Expand all
105 88
106 // Use Show() to create instances. 89 // Use Show() to create instances.
107 ExtensionDialog(extensions::ExtensionHost* host, 90 ExtensionDialog(extensions::ExtensionHost* host,
108 ExtensionDialogObserver* observer); 91 ExtensionDialogObserver* observer);
109 92
110 static ExtensionDialog* ShowInternal(const GURL& url, 93 static ExtensionDialog* ShowInternal(const GURL& url,
111 BaseWindow* base_window, 94 BaseWindow* base_window,
112 extensions::ExtensionHost* host, 95 extensions::ExtensionHost* host,
113 int width, 96 int width,
114 int height, 97 int height,
115 bool fullscreen,
116 const string16& title, 98 const string16& title,
117 ExtensionDialogObserver* observer); 99 ExtensionDialogObserver* observer);
118 100
119 static extensions::ExtensionHost* CreateExtensionHost(const GURL& url, 101 static extensions::ExtensionHost* CreateExtensionHost(const GURL& url,
120 Profile* profile); 102 Profile* profile);
121 103
122 void InitWindow(BaseWindow* base_window, int width, int height); 104 void InitWindow(BaseWindow* base_window, int width, int height);
123 void InitWindowFullscreen();
124 105
125 // Window that holds the extension host view. 106 // Window that holds the extension host view.
126 views::Widget* window_; 107 views::Widget* window_;
127 108
128 // Window Title 109 // Window Title
129 string16 window_title_; 110 string16 window_title_;
130 111
131 // The contained host for the view. 112 // The contained host for the view.
132 scoped_ptr<extensions::ExtensionHost> extension_host_; 113 scoped_ptr<extensions::ExtensionHost> extension_host_;
133 114
134 content::NotificationRegistrar registrar_; 115 content::NotificationRegistrar registrar_;
135 116
136 // The observer of this popup. 117 // The observer of this popup.
137 ExtensionDialogObserver* observer_; 118 ExtensionDialogObserver* observer_;
138 119
139 DISALLOW_COPY_AND_ASSIGN(ExtensionDialog); 120 DISALLOW_COPY_AND_ASSIGN(ExtensionDialog);
140 }; 121 };
141 122
142 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_DIALOG_H_ 123 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_DIALOG_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/extensions/extension_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698