| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/dom_ui_host.h" | 5 #include "chrome/browser/dom_ui/dom_ui_host.h" |
| 6 | 6 |
| 7 #include "base/json_reader.h" | 7 #include "base/json_reader.h" |
| 8 #include "base/json_writer.h" | 8 #include "base/json_writer.h" |
| 9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
| 10 #include "chrome/browser/navigation_entry.h" | 10 #include "chrome/browser/navigation_entry.h" |
| 11 #include "chrome/browser/tab_contents_type.h" | 11 #include "chrome/browser/tab_contents_type.h" |
| 12 #include "chrome/browser/render_view_host.h" | 12 #include "chrome/browser/render_view_host.h" |
| 13 | 13 |
| 14 DOMUIHost::DOMUIHost(Profile* profile, | 14 DOMUIHost::DOMUIHost(Profile* profile, |
| 15 SiteInstance* instance, | 15 SiteInstance* instance, |
| 16 RenderViewHostFactory* render_view_factory) | 16 RenderViewHostFactory* render_view_factory) |
| 17 : WebContents(profile, | 17 : WebContents(profile, |
| 18 instance, | 18 instance, |
| 19 render_view_factory, | 19 render_view_factory, |
| 20 MSG_ROUTING_NONE, | 20 MSG_ROUTING_NONE, |
| 21 NULL) { | 21 NULL) { |
| 22 // Implementors of this class will have a specific tab contents type. | 22 // Implementors of this class will have a specific tab contents type. |
| 23 type_ = TAB_CONTENTS_UNKNOWN_TYPE; | 23 set_type(TAB_CONTENTS_UNKNOWN_TYPE); |
| 24 } | 24 } |
| 25 | 25 |
| 26 DOMUIHost::~DOMUIHost() { | 26 DOMUIHost::~DOMUIHost() { |
| 27 STLDeleteContainerPairSecondPointers(message_callbacks_.begin(), | 27 STLDeleteContainerPairSecondPointers(message_callbacks_.begin(), |
| 28 message_callbacks_.end()); | 28 message_callbacks_.end()); |
| 29 STLDeleteContainerPointers(handlers_.begin(), handlers_.end()); | 29 STLDeleteContainerPointers(handlers_.begin(), handlers_.end()); |
| 30 } | 30 } |
| 31 | 31 |
| 32 bool DOMUIHost::CreateRenderViewForRenderManager( | 32 bool DOMUIHost::CreateRenderViewForRenderManager( |
| 33 RenderViewHost* render_view_host) { | 33 RenderViewHost* render_view_host) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // we want to preserve them literally. | 108 // we want to preserve them literally. |
| 109 // | 109 // |
| 110 // We just escape all the percents to avoid this, since when this javascript | 110 // We just escape all the percents to avoid this, since when this javascript |
| 111 // URL is interpreted, it will be unescaped. | 111 // URL is interpreted, it will be unescaped. |
| 112 std::wstring escaped_js(javascript); | 112 std::wstring escaped_js(javascript); |
| 113 ReplaceSubstringsAfterOffset(&escaped_js, 0, L"%", L"%25"); | 113 ReplaceSubstringsAfterOffset(&escaped_js, 0, L"%", L"%25"); |
| 114 render_view_host()->ExecuteJavascriptInWebFrame(std::wstring(), | 114 render_view_host()->ExecuteJavascriptInWebFrame(std::wstring(), |
| 115 L"javascript:" + escaped_js); | 115 L"javascript:" + escaped_js); |
| 116 } | 116 } |
| 117 | 117 |
| OLD | NEW |