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

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: and another build fix.. Created 8 years, 9 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 "base/logging.h"
10 #include "content/public/browser/notification_observer.h" 11 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h" 12 #include "content/public/browser/notification_registrar.h"
12 #include "ui/views/widget/widget_delegate.h" 13 #include "ui/views/widget/widget_delegate.h"
13 14
14 class Browser; 15 class Browser;
15 class ExtensionDialogObserver; 16 class ExtensionDialogObserver;
16 class ExtensionHost; 17 class ExtensionHost;
17 class GURL; 18 class GURL;
19 class Profile;
18 20
19 namespace content { 21 namespace content {
20 class WebContents; 22 class WebContents;
21 } 23 }
22 24
23 // Modal dialog containing contents provided by an extension. 25 // Modal dialog containing contents provided by an extension.
24 // Dialog is automatically centered in the browser window and has fixed size. 26 // Dialog is automatically centered in the browser window and has fixed size.
25 // For example, used by the Chrome OS file browser. 27 // For example, used by the Chrome OS file browser.
26 class ExtensionDialog : public views::WidgetDelegate, 28 class ExtensionDialog : public views::WidgetDelegate,
27 public content::NotificationObserver, 29 public content::NotificationObserver,
28 public base::RefCounted<ExtensionDialog> { 30 public base::RefCounted<ExtensionDialog> {
29 public: 31 public:
30 virtual ~ExtensionDialog(); 32 virtual ~ExtensionDialog();
31 33
32 // 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.
33 // |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.
34 // |web_contents| is the tab that spawned the dialog. 36 // |web_contents| is the tab that spawned the dialog.
35 // |width| and |height| are the size of the dialog in pixels. 37 // |width| and |height| are the size of the dialog in pixels.
36 static ExtensionDialog* Show(const GURL& url, 38 static ExtensionDialog* Show(const GURL& url,
37 Browser* browser, 39 Browser* browser,
38 content::WebContents* web_contents, 40 content::WebContents* web_contents,
39 int width, 41 int width,
40 int height, 42 int height,
41 const string16& title, 43 const string16& title,
42 ExtensionDialogObserver* observer); 44 ExtensionDialogObserver* observer);
43 45
44 #if defined(USE_AURA) 46 #if defined(USE_AURA)
45 // Create and show a fullscreen dialog with |url|. 47 // Create and show a fullscreen dialog with |url|.
46 // |browser| is the browser to which the pop-up will be attached. 48 // |profile| is the profile that the extension is registered with.
47 // |web_contents| is the tab that spawned the dialog. 49 // |web_contents| is the tab that spawned the dialog.
48 static ExtensionDialog* ShowFullscreen(const GURL& url, 50 static ExtensionDialog* ShowFullscreen(const GURL& url,
49 Browser* browser, 51 Profile* profile,
50 content::WebContents* web_contents,
51 const string16& title, 52 const string16& title,
52 ExtensionDialogObserver* observer); 53 ExtensionDialogObserver* observer);
54 #else
55 static ExtensionDialog* ShowFullscreen(const GURL& url,
56 Profile* profile,
57 const string16& title,
58 ExtensionDialogObserver* observer) {
59 NOTIMPLEMENTED();
60 return NULL;
61 }
53 #endif 62 #endif
54 63
55 // Notifies the dialog that the observer has been destroyed and should not 64 // Notifies the dialog that the observer has been destroyed and should not
56 // be sent notifications. 65 // be sent notifications.
57 void ObserverDestroyed(); 66 void ObserverDestroyed();
58 67
59 // Closes the ExtensionDialog. 68 // Closes the ExtensionDialog.
60 void Close(); 69 void Close();
61 70
62 // Sets the window title. 71 // Sets the window title.
(...skipping 16 matching lines...) Expand all
79 virtual void Observe(int type, 88 virtual void Observe(int type,
80 const content::NotificationSource& source, 89 const content::NotificationSource& source,
81 const content::NotificationDetails& details) OVERRIDE; 90 const content::NotificationDetails& details) OVERRIDE;
82 91
83 private: 92 private:
84 // Use Show() to create instances. 93 // Use Show() to create instances.
85 ExtensionDialog(ExtensionHost* host, ExtensionDialogObserver* observer); 94 ExtensionDialog(ExtensionHost* host, ExtensionDialogObserver* observer);
86 95
87 static ExtensionDialog* ShowInternal(const GURL& url, 96 static ExtensionDialog* ShowInternal(const GURL& url,
88 Browser* browser, 97 Browser* browser,
89 content::WebContents* web_contents, 98 ExtensionHost* host,
90 int width, 99 int width,
91 int height, 100 int height,
92 bool fullscreen, 101 bool fullscreen,
93 const string16& title, 102 const string16& title,
94 ExtensionDialogObserver* observer); 103 ExtensionDialogObserver* observer);
95 104
96 static ExtensionHost* CreateExtensionHost(const GURL& url, 105 static ExtensionHost* CreateExtensionHost(const GURL& url,
97 Browser* browser); 106 Browser* browser,
107 Profile* profile);
98 108
99 void InitWindow(Browser* browser, int width, int height); 109 void InitWindow(Browser* browser, int width, int height);
100 void InitWindowFullscreen(Browser* browser); 110 void InitWindowFullscreen();
101 111
102 // Window that holds the extension host view. 112 // Window that holds the extension host view.
103 views::Widget* window_; 113 views::Widget* window_;
104 114
105 // Window Title 115 // Window Title
106 string16 window_title_; 116 string16 window_title_;
107 117
108 // The contained host for the view. 118 // The contained host for the view.
109 scoped_ptr<ExtensionHost> extension_host_; 119 scoped_ptr<ExtensionHost> extension_host_;
110 120
111 content::NotificationRegistrar registrar_; 121 content::NotificationRegistrar registrar_;
112 122
113 // The observer of this popup. 123 // The observer of this popup.
114 ExtensionDialogObserver* observer_; 124 ExtensionDialogObserver* observer_;
115 125
116 DISALLOW_COPY_AND_ASSIGN(ExtensionDialog); 126 DISALLOW_COPY_AND_ASSIGN(ExtensionDialog);
117 }; 127 };
118 128
119 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_DIALOG_H_ 129 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_DIALOG_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/ui/screensaver_extension_dialog.cc ('k') | chrome/browser/ui/views/extensions/extension_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698