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

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

Issue 9455038: Screensaver at login screen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review changes. Created 8 years, 10 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
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 #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"
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/widget/widget_delegate.h"
13 13
14 class Browser; 14 class Browser;
15 class ExtensionDialogObserver; 15 class ExtensionDialogObserver;
16 class ExtensionHost; 16 class ExtensionHost;
17 class GURL; 17 class GURL;
18 class Profile;
18 19
19 namespace content { 20 namespace content {
20 class WebContents; 21 class WebContents;
21 } 22 }
22 23
23 // Modal dialog containing contents provided by an extension. 24 // Modal dialog containing contents provided by an extension.
24 // Dialog is automatically centered in the browser window and has fixed size. 25 // Dialog is automatically centered in the browser window and has fixed size.
25 // For example, used by the Chrome OS file browser. 26 // For example, used by the Chrome OS file browser.
26 class ExtensionDialog : public views::WidgetDelegate, 27 class ExtensionDialog : public views::WidgetDelegate,
27 public content::NotificationObserver, 28 public content::NotificationObserver,
28 public base::RefCounted<ExtensionDialog> { 29 public base::RefCounted<ExtensionDialog> {
29 public: 30 public:
30 virtual ~ExtensionDialog(); 31 virtual ~ExtensionDialog();
31 32
32 // Create and show a dialog with |url| centered over the browser window. 33 // Create and show a dialog with |url| centered over the browser window.
33 // |browser| is the browser to which the pop-up will be attached. 34 // |browser| is the browser to which the pop-up will be attached.
34 // |web_contents| is the tab that spawned the dialog. 35 // |web_contents| is the tab that spawned the dialog.
35 // |width| and |height| are the size of the dialog in pixels. 36 // |width| and |height| are the size of the dialog in pixels.
36 static ExtensionDialog* Show(const GURL& url, 37 static ExtensionDialog* Show(const GURL& url,
37 Browser* browser, 38 Browser* browser,
38 content::WebContents* web_contents, 39 content::WebContents* web_contents,
39 int width, 40 int width,
40 int height, 41 int height,
41 const string16& title, 42 const string16& title,
42 ExtensionDialogObserver* observer); 43 ExtensionDialogObserver* observer);
43 44
44 #if defined(USE_AURA) 45 #if defined(USE_AURA)
45 // Create and show a fullscreen dialog with |url|. 46 // Create and show a fullscreen dialog with |url|.
46 // |browser| is the browser to which the pop-up will be attached. 47 // |profile| is the profile that the extension is registered with.
47 // |web_contents| is the tab that spawned the dialog. 48 // |web_contents| is the tab that spawned the dialog.
48 static ExtensionDialog* ShowFullscreen(const GURL& url, 49 static ExtensionDialog* ShowFullscreen(const GURL& url,
49 Browser* browser, 50 Profile* profile,
50 content::WebContents* web_contents,
51 const string16& title, 51 const string16& title,
52 ExtensionDialogObserver* observer); 52 ExtensionDialogObserver* observer);
53 #endif 53 #endif
54 54
55 // Notifies the dialog that the observer has been destroyed and should not 55 // Notifies the dialog that the observer has been destroyed and should not
56 // be sent notifications. 56 // be sent notifications.
57 void ObserverDestroyed(); 57 void ObserverDestroyed();
58 58
59 // Closes the ExtensionDialog. 59 // Closes the ExtensionDialog.
60 void Close(); 60 void Close();
(...skipping 18 matching lines...) Expand all
79 virtual void Observe(int type, 79 virtual void Observe(int type,
80 const content::NotificationSource& source, 80 const content::NotificationSource& source,
81 const content::NotificationDetails& details) OVERRIDE; 81 const content::NotificationDetails& details) OVERRIDE;
82 82
83 private: 83 private:
84 // Use Show() to create instances. 84 // Use Show() to create instances.
85 ExtensionDialog(ExtensionHost* host, ExtensionDialogObserver* observer); 85 ExtensionDialog(ExtensionHost* host, ExtensionDialogObserver* observer);
86 86
87 static ExtensionDialog* ShowInternal(const GURL& url, 87 static ExtensionDialog* ShowInternal(const GURL& url,
88 Browser* browser, 88 Browser* browser,
89 content::WebContents* web_contents, 89 ExtensionHost* host,
90 int width, 90 int width,
91 int height, 91 int height,
92 bool fullscreen, 92 bool fullscreen,
93 const string16& title, 93 const string16& title,
94 ExtensionDialogObserver* observer); 94 ExtensionDialogObserver* observer);
95 95
96 static ExtensionHost* CreateExtensionHost(const GURL& url, 96 static ExtensionHost* CreateExtensionHost(const GURL& url,
97 Browser* browser); 97 Browser* browser,
98 Profile* profile);
98 99
99 void InitWindow(Browser* browser, int width, int height); 100 void InitWindow(Browser* browser, int width, int height);
100 void InitWindowFullscreen(Browser* browser); 101 void InitWindowFullscreen();
101 102
102 // Window that holds the extension host view. 103 // Window that holds the extension host view.
103 views::Widget* window_; 104 views::Widget* window_;
104 105
105 // Window Title 106 // Window Title
106 string16 window_title_; 107 string16 window_title_;
107 108
108 // The contained host for the view. 109 // The contained host for the view.
109 scoped_ptr<ExtensionHost> extension_host_; 110 scoped_ptr<ExtensionHost> extension_host_;
110 111
111 content::NotificationRegistrar registrar_; 112 content::NotificationRegistrar registrar_;
112 113
113 // The observer of this popup. 114 // The observer of this popup.
114 ExtensionDialogObserver* observer_; 115 ExtensionDialogObserver* observer_;
115 116
116 DISALLOW_COPY_AND_ASSIGN(ExtensionDialog); 117 DISALLOW_COPY_AND_ASSIGN(ExtensionDialog);
117 }; 118 };
118 119
119 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_DIALOG_H_ 120 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_DIALOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698