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

Side by Side Diff: chrome/browser/ui/webui/constrained_html_ui.h

Issue 7860008: content: Move constrained html windows to TabContentsWrapper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: views fix Created 9 years, 3 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) 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_WEBUI_CONSTRAINED_HTML_UI_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_CONSTRAINED_HTML_UI_H_
6 #define CHROME_BROWSER_UI_WEBUI_CONSTRAINED_HTML_UI_H_ 6 #define CHROME_BROWSER_UI_WEBUI_CONSTRAINED_HTML_UI_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "chrome/browser/ui/webui/chrome_web_ui.h" 11 #include "chrome/browser/ui/webui/chrome_web_ui.h"
12 #include "content/browser/tab_contents/constrained_window.h" 12 #include "content/browser/tab_contents/constrained_window.h"
13 #include "content/common/property_bag.h" 13 #include "content/common/property_bag.h"
14 14
15 class HtmlDialogUIDelegate; 15 class HtmlDialogUIDelegate;
16 class Profile; 16 class Profile;
17 class RenderViewHost; 17 class RenderViewHost;
18 class TabContents; 18 class TabContents;
19 class TabContentsWrapper;
19 20
20 class ConstrainedHtmlUIDelegate { 21 class ConstrainedHtmlUIDelegate {
21 public: 22 public:
22 virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate() = 0; 23 virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate() = 0;
23 24
24 // Called when the dialog is being closed in response to a "DialogClose" 25 // Called when the dialog is being closed in response to a "DialogClose"
25 // message from WebUI. 26 // message from WebUI.
26 virtual void OnDialogCloseFromWebUI() = 0; 27 virtual void OnDialogCloseFromWebUI() = 0;
27 }; 28 };
28 29
29 // ConstrainedHtmlUI is a facility to show HTML WebUI content 30 // ConstrainedHtmlUI is a facility to show HTML WebUI content
30 // in a tab-modal constrained dialog. It is implemented as an adapter 31 // in a tab-modal constrained dialog. It is implemented as an adapter
31 // between an HtmlDialogUI object and a ConstrainedWindow object. 32 // between an HtmlDialogUI object and a ConstrainedWindow object.
32 // 33 //
33 // Since ConstrainedWindow requires platform-specific delegate 34 // Since ConstrainedWindow requires platform-specific delegate
34 // implementations, this class is just a factory stub. 35 // implementations, this class is just a factory stub.
35 class ConstrainedHtmlUI : public ChromeWebUI { 36 class ConstrainedHtmlUI : public ChromeWebUI {
36 public: 37 public:
37 explicit ConstrainedHtmlUI(TabContents* contents); 38 explicit ConstrainedHtmlUI(TabContents* contents);
38 virtual ~ConstrainedHtmlUI(); 39 virtual ~ConstrainedHtmlUI();
39 40
40 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; 41 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
41 42
42 // Create a constrained HTML dialog. The actual object that gets created 43 // Create a constrained HTML dialog. The actual object that gets created
43 // is a ConstrainedHtmlUIDelegate, which later triggers construction of a 44 // is a ConstrainedHtmlUIDelegate, which later triggers construction of a
44 // ConstrainedHtmlUI object. 45 // ConstrainedHtmlUI object.
45 static ConstrainedWindow* CreateConstrainedHtmlDialog( 46 static ConstrainedWindow* CreateConstrainedHtmlDialog(
46 Profile* profile, 47 Profile* profile,
47 HtmlDialogUIDelegate* delegate, 48 HtmlDialogUIDelegate* delegate,
48 TabContents* overshadowed); 49 TabContentsWrapper* overshadowed);
49 50
50 // Returns a property accessor that can be used to set the 51 // Returns a property accessor that can be used to set the
51 // ConstrainedHtmlUIDelegate property on a TabContents. 52 // ConstrainedHtmlUIDelegate property on a TabContents.
52 static PropertyAccessor<ConstrainedHtmlUIDelegate*>& 53 static PropertyAccessor<ConstrainedHtmlUIDelegate*>&
53 GetPropertyAccessor(); 54 GetPropertyAccessor();
54 55
55 private: 56 private:
56 // Returns the TabContents' PropertyBag's ConstrainedHtmlUIDelegate. 57 // Returns the TabContents' PropertyBag's ConstrainedHtmlUIDelegate.
57 // Returns NULL if that property is not set. 58 // Returns NULL if that property is not set.
58 ConstrainedHtmlUIDelegate* GetConstrainedDelegate(); 59 ConstrainedHtmlUIDelegate* GetConstrainedDelegate();
59 60
60 // JS Message Handler 61 // JS Message Handler
61 void OnDialogCloseMessage(const base::ListValue* args); 62 void OnDialogCloseMessage(const base::ListValue* args);
62 63
63 DISALLOW_COPY_AND_ASSIGN(ConstrainedHtmlUI); 64 DISALLOW_COPY_AND_ASSIGN(ConstrainedHtmlUI);
64 }; 65 };
65 66
66 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_HTML_UI_H_ 67 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_HTML_UI_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/collected_cookies_ui_delegate.cc ('k') | chrome/browser/ui/webui/constrained_html_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698