| OLD | NEW |
| 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/dom_ui/constrained_html_ui.h" | 5 #include "chrome/browser/dom_ui/constrained_html_ui.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "chrome/browser/dom_ui/html_dialog_ui.h" | 8 #include "chrome/browser/dom_ui/html_dialog_ui.h" |
| 9 #include "chrome/browser/dom_ui/web_ui_util.h" | 9 #include "chrome/browser/dom_ui/web_ui_util.h" |
| 10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 void ConstrainedHtmlUI::RenderViewCreated( | 24 void ConstrainedHtmlUI::RenderViewCreated( |
| 25 RenderViewHost* render_view_host) { | 25 RenderViewHost* render_view_host) { |
| 26 ConstrainedHtmlUIDelegate* delegate = GetConstrainedDelegate(); | 26 ConstrainedHtmlUIDelegate* delegate = GetConstrainedDelegate(); |
| 27 if (!delegate) | 27 if (!delegate) |
| 28 return; | 28 return; |
| 29 | 29 |
| 30 HtmlDialogUIDelegate* dialog_delegate = delegate->GetHtmlDialogUIDelegate(); | 30 HtmlDialogUIDelegate* dialog_delegate = delegate->GetHtmlDialogUIDelegate(); |
| 31 std::vector<WebUIMessageHandler*> handlers; | 31 std::vector<WebUIMessageHandler*> handlers; |
| 32 dialog_delegate->GetWebUIMessageHandlers(&handlers); | 32 dialog_delegate->GetWebUIMessageHandlers(&handlers); |
| 33 render_view_host->SetDOMUIProperty("dialogArguments", | 33 render_view_host->SetWebUIProperty("dialogArguments", |
| 34 dialog_delegate->GetDialogArgs()); | 34 dialog_delegate->GetDialogArgs()); |
| 35 for (std::vector<WebUIMessageHandler*>::iterator it = handlers.begin(); | 35 for (std::vector<WebUIMessageHandler*>::iterator it = handlers.begin(); |
| 36 it != handlers.end(); ++it) { | 36 it != handlers.end(); ++it) { |
| 37 (*it)->Attach(this); | 37 (*it)->Attach(this); |
| 38 AddMessageHandler(*it); | 38 AddMessageHandler(*it); |
| 39 } | 39 } |
| 40 | 40 |
| 41 // Add a "DialogClose" callback which matches HTMLDialogUI behavior. | 41 // Add a "DialogClose" callback which matches HTMLDialogUI behavior. |
| 42 RegisterMessageCallback("DialogClose", | 42 RegisterMessageCallback("DialogClose", |
| 43 NewCallback(this, &ConstrainedHtmlUI::OnDialogClose)); | 43 NewCallback(this, &ConstrainedHtmlUI::OnDialogClose)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 58 ConstrainedHtmlUIDelegate** property = | 58 ConstrainedHtmlUIDelegate** property = |
| 59 GetPropertyAccessor().GetProperty(tab_contents()->property_bag()); | 59 GetPropertyAccessor().GetProperty(tab_contents()->property_bag()); |
| 60 return property ? *property : NULL; | 60 return property ? *property : NULL; |
| 61 } | 61 } |
| 62 | 62 |
| 63 // static | 63 // static |
| 64 PropertyAccessor<ConstrainedHtmlUIDelegate*>& | 64 PropertyAccessor<ConstrainedHtmlUIDelegate*>& |
| 65 ConstrainedHtmlUI::GetPropertyAccessor() { | 65 ConstrainedHtmlUI::GetPropertyAccessor() { |
| 66 return g_constrained_html_ui_property_accessor.Get(); | 66 return g_constrained_html_ui_property_accessor.Get(); |
| 67 } | 67 } |
| OLD | NEW |