| OLD | NEW |
| 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 #include "content/browser/webui/web_ui_impl.h" | 5 #include "content/browser/webui/web_ui_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/debug/dump_without_crashing.h" | 9 #include "base/debug/dump_without_crashing.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 parameters += base::char16(','); | 62 parameters += base::char16(','); |
| 63 | 63 |
| 64 base::JSONWriter::Write(*arg_list[i], &json); | 64 base::JSONWriter::Write(*arg_list[i], &json); |
| 65 parameters += base::UTF8ToUTF16(json); | 65 parameters += base::UTF8ToUTF16(json); |
| 66 } | 66 } |
| 67 return base::ASCIIToUTF16(function_name) + | 67 return base::ASCIIToUTF16(function_name) + |
| 68 base::char16('(') + parameters + base::char16(')') + base::char16(';'); | 68 base::char16('(') + parameters + base::char16(')') + base::char16(';'); |
| 69 } | 69 } |
| 70 | 70 |
| 71 WebUIImpl::WebUIImpl(WebContents* contents, const std::string& frame_name) | 71 WebUIImpl::WebUIImpl(WebContents* contents, const std::string& frame_name) |
| 72 : link_transition_type_(ui::PAGE_TRANSITION_LINK), | 72 : bindings_(BINDINGS_POLICY_WEB_UI), |
| 73 bindings_(BINDINGS_POLICY_WEB_UI), | |
| 74 web_contents_(contents), | 73 web_contents_(contents), |
| 75 web_contents_observer_(new MainFrameNavigationObserver(this, contents)), | 74 web_contents_observer_(new MainFrameNavigationObserver(this, contents)), |
| 76 frame_name_(frame_name) { | 75 frame_name_(frame_name) { |
| 77 DCHECK(contents); | 76 DCHECK(contents); |
| 78 } | 77 } |
| 79 | 78 |
| 80 WebUIImpl::~WebUIImpl() { | 79 WebUIImpl::~WebUIImpl() { |
| 81 // Delete the controller first, since it may also be keeping a pointer to some | 80 // Delete the controller first, since it may also be keeping a pointer to some |
| 82 // of the handlers and can call them at destruction. | 81 // of the handlers and can call them at destruction. |
| 83 controller_.reset(); | 82 controller_.reset(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 132 } |
| 134 | 133 |
| 135 const base::string16& WebUIImpl::GetOverriddenTitle() const { | 134 const base::string16& WebUIImpl::GetOverriddenTitle() const { |
| 136 return overridden_title_; | 135 return overridden_title_; |
| 137 } | 136 } |
| 138 | 137 |
| 139 void WebUIImpl::OverrideTitle(const base::string16& title) { | 138 void WebUIImpl::OverrideTitle(const base::string16& title) { |
| 140 overridden_title_ = title; | 139 overridden_title_ = title; |
| 141 } | 140 } |
| 142 | 141 |
| 143 ui::PageTransition WebUIImpl::GetLinkTransitionType() const { | |
| 144 return link_transition_type_; | |
| 145 } | |
| 146 | |
| 147 void WebUIImpl::SetLinkTransitionType(ui::PageTransition type) { | |
| 148 link_transition_type_ = type; | |
| 149 } | |
| 150 | |
| 151 int WebUIImpl::GetBindings() const { | 142 int WebUIImpl::GetBindings() const { |
| 152 return bindings_; | 143 return bindings_; |
| 153 } | 144 } |
| 154 | 145 |
| 155 void WebUIImpl::SetBindings(int bindings) { | 146 void WebUIImpl::SetBindings(int bindings) { |
| 156 bindings_ = bindings; | 147 bindings_ = bindings; |
| 157 } | 148 } |
| 158 | 149 |
| 159 bool WebUIImpl::HasRenderFrame() { | 150 bool WebUIImpl::HasRenderFrame() { |
| 160 return TargetFrame() != nullptr; | 151 return TargetFrame() != nullptr; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 if (host->GetFrameName() == frame_name_) | 293 if (host->GetFrameName() == frame_name_) |
| 303 frame_set->insert(host); | 294 frame_set->insert(host); |
| 304 } | 295 } |
| 305 | 296 |
| 306 void WebUIImpl::DisallowJavascriptOnAllHandlers() { | 297 void WebUIImpl::DisallowJavascriptOnAllHandlers() { |
| 307 for (WebUIMessageHandler* handler : handlers_) | 298 for (WebUIMessageHandler* handler : handlers_) |
| 308 handler->DisallowJavascript(); | 299 handler->DisallowJavascript(); |
| 309 } | 300 } |
| 310 | 301 |
| 311 } // namespace content | 302 } // namespace content |
| OLD | NEW |