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

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

Issue 9188056: Start splitting out WebUI into an implementation class and an interface that each page implements... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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 | « chrome/browser/ui/webui/constrained_html_ui.h ('k') | chrome/browser/ui/webui/crashes_ui.h » ('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) 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 #include "chrome/browser/ui/webui/constrained_html_ui.h" 5 #include "chrome/browser/ui/webui/constrained_html_ui.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/property_bag.h" 13 #include "base/property_bag.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/ui/webui/html_dialog_ui.h" 15 #include "chrome/browser/ui/webui/html_dialog_ui.h"
16 #include "chrome/common/chrome_notification_types.h" 16 #include "chrome/common/chrome_notification_types.h"
17 #include "content/browser/renderer_host/render_view_host.h" 17 #include "content/browser/renderer_host/render_view_host.h"
18 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
19 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
20 20
21 using content::WebContents; 21 using content::WebContents;
22 using content::WebUIMessageHandler; 22 using content::WebUIMessageHandler;
23 23
24 static base::LazyInstance<base::PropertyAccessor<ConstrainedHtmlUIDelegate*> > 24 static base::LazyInstance<base::PropertyAccessor<ConstrainedHtmlUIDelegate*> >
25 g_constrained_html_ui_property_accessor = LAZY_INSTANCE_INITIALIZER; 25 g_constrained_html_ui_property_accessor = LAZY_INSTANCE_INITIALIZER;
26 26
27 ConstrainedHtmlUI::ConstrainedHtmlUI(WebContents* contents) 27 ConstrainedHtmlUI::ConstrainedHtmlUI(WebContents* contents)
28 : WebUI(contents) { 28 : WebUI(contents, this) {
29 } 29 }
30 30
31 ConstrainedHtmlUI::~ConstrainedHtmlUI() { 31 ConstrainedHtmlUI::~ConstrainedHtmlUI() {
32 } 32 }
33 33
34 void ConstrainedHtmlUI::RenderViewCreated(RenderViewHost* render_view_host) { 34 void ConstrainedHtmlUI::RenderViewCreated(RenderViewHost* render_view_host) {
35 WebUI::RenderViewCreated(render_view_host);
36
37 ConstrainedHtmlUIDelegate* delegate = GetConstrainedDelegate(); 35 ConstrainedHtmlUIDelegate* delegate = GetConstrainedDelegate();
38 if (!delegate) 36 if (!delegate)
39 return; 37 return;
40 38
41 HtmlDialogUIDelegate* dialog_delegate = delegate->GetHtmlDialogUIDelegate(); 39 HtmlDialogUIDelegate* dialog_delegate = delegate->GetHtmlDialogUIDelegate();
42 std::vector<WebUIMessageHandler*> handlers; 40 std::vector<WebUIMessageHandler*> handlers;
43 dialog_delegate->GetWebUIMessageHandlers(&handlers); 41 dialog_delegate->GetWebUIMessageHandlers(&handlers);
44 render_view_host->SetWebUIProperty("dialogArguments", 42 render_view_host->SetWebUIProperty("dialogArguments",
45 dialog_delegate->GetDialogArgs()); 43 dialog_delegate->GetDialogArgs());
46 for (std::vector<WebUIMessageHandler*>::iterator it = handlers.begin(); 44 for (std::vector<WebUIMessageHandler*>::iterator it = handlers.begin();
(...skipping 28 matching lines...) Expand all
75 ConstrainedHtmlUIDelegate** property = 73 ConstrainedHtmlUIDelegate** property =
76 GetPropertyAccessor().GetProperty(web_contents()->GetPropertyBag()); 74 GetPropertyAccessor().GetProperty(web_contents()->GetPropertyBag());
77 return property ? *property : NULL; 75 return property ? *property : NULL;
78 } 76 }
79 77
80 // static 78 // static
81 base::PropertyAccessor<ConstrainedHtmlUIDelegate*>& 79 base::PropertyAccessor<ConstrainedHtmlUIDelegate*>&
82 ConstrainedHtmlUI::GetPropertyAccessor() { 80 ConstrainedHtmlUI::GetPropertyAccessor() {
83 return g_constrained_html_ui_property_accessor.Get(); 81 return g_constrained_html_ui_property_accessor.Get();
84 } 82 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/constrained_html_ui.h ('k') | chrome/browser/ui/webui/crashes_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698