| 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 "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 parameters += UTF8ToUTF16(json); | 41 parameters += UTF8ToUTF16(json); |
| 42 } | 42 } |
| 43 return ASCIIToUTF16(function_name) + | 43 return ASCIIToUTF16(function_name) + |
| 44 char16('(') + parameters + char16(')') + char16(';'); | 44 char16('(') + parameters + char16(')') + char16(';'); |
| 45 } | 45 } |
| 46 | 46 |
| 47 WebUIImpl::WebUIImpl(WebContents* contents) | 47 WebUIImpl::WebUIImpl(WebContents* contents) |
| 48 : hide_favicon_(false), | 48 : hide_favicon_(false), |
| 49 focus_location_bar_by_default_(false), | 49 focus_location_bar_by_default_(false), |
| 50 should_hide_url_(false), | 50 should_hide_url_(false), |
| 51 should_not_emphasize_host_(false), |
| 51 link_transition_type_(PAGE_TRANSITION_LINK), | 52 link_transition_type_(PAGE_TRANSITION_LINK), |
| 52 bindings_(BINDINGS_POLICY_WEB_UI), | 53 bindings_(BINDINGS_POLICY_WEB_UI), |
| 53 web_contents_(contents) { | 54 web_contents_(contents) { |
| 54 DCHECK(contents); | 55 DCHECK(contents); |
| 55 } | 56 } |
| 56 | 57 |
| 57 WebUIImpl::~WebUIImpl() { | 58 WebUIImpl::~WebUIImpl() { |
| 58 // Delete the controller first, since it may also be keeping a pointer to some | 59 // Delete the controller first, since it may also be keeping a pointer to some |
| 59 // of the handlers and can call them at destruction. | 60 // of the handlers and can call them at destruction. |
| 60 controller_.reset(); | 61 controller_.reset(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 129 } |
| 129 | 130 |
| 130 bool WebUIImpl::ShouldHideURL() const { | 131 bool WebUIImpl::ShouldHideURL() const { |
| 131 return should_hide_url_; | 132 return should_hide_url_; |
| 132 } | 133 } |
| 133 | 134 |
| 134 void WebUIImpl::HideURL() { | 135 void WebUIImpl::HideURL() { |
| 135 should_hide_url_ = true; | 136 should_hide_url_ = true; |
| 136 } | 137 } |
| 137 | 138 |
| 139 bool WebUIImpl::ShouldNotEmphasizeHost() const { |
| 140 return should_not_emphasize_host_; |
| 141 } |
| 142 |
| 143 void WebUIImpl::DontEmphasizeHost() { |
| 144 should_not_emphasize_host_ = true; |
| 145 } |
| 146 |
| 138 const string16& WebUIImpl::GetOverriddenTitle() const { | 147 const string16& WebUIImpl::GetOverriddenTitle() const { |
| 139 return overridden_title_; | 148 return overridden_title_; |
| 140 } | 149 } |
| 141 | 150 |
| 142 void WebUIImpl::OverrideTitle(const string16& title) { | 151 void WebUIImpl::OverrideTitle(const string16& title) { |
| 143 overridden_title_ = title; | 152 overridden_title_ = title; |
| 144 } | 153 } |
| 145 | 154 |
| 146 PageTransition WebUIImpl::GetLinkTransitionType() const { | 155 PageTransition WebUIImpl::GetLinkTransitionType() const { |
| 147 return link_transition_type_; | 156 return link_transition_type_; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 handlers_.push_back(handler); | 266 handlers_.push_back(handler); |
| 258 } | 267 } |
| 259 | 268 |
| 260 void WebUIImpl::ExecuteJavascript(const string16& javascript) { | 269 void WebUIImpl::ExecuteJavascript(const string16& javascript) { |
| 261 static_cast<RenderViewHostImpl*>( | 270 static_cast<RenderViewHostImpl*>( |
| 262 web_contents_->GetRenderViewHost())->ExecuteJavascriptInWebFrame( | 271 web_contents_->GetRenderViewHost())->ExecuteJavascriptInWebFrame( |
| 263 ASCIIToUTF16(frame_xpath_), javascript); | 272 ASCIIToUTF16(frame_xpath_), javascript); |
| 264 } | 273 } |
| 265 | 274 |
| 266 } // namespace content | 275 } // namespace content |
| OLD | NEW |