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

Side by Side Diff: content/browser/webui/web_ui_impl.cc

Issue 14080004: Remove some chrome-specific methods from content::WebUI. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix browser_test Created 7 years, 8 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 | « content/browser/webui/web_ui_impl.h ('k') | content/public/browser/web_contents.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) 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 27 matching lines...) Expand all
38 parameters += char16(','); 38 parameters += char16(',');
39 39
40 base::JSONWriter::Write(arg_list[i], &json); 40 base::JSONWriter::Write(arg_list[i], &json);
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 : link_transition_type_(PAGE_TRANSITION_LINK),
49 focus_location_bar_by_default_(false),
50 should_hide_url_(false),
51 link_transition_type_(PAGE_TRANSITION_LINK),
52 bindings_(BINDINGS_POLICY_WEB_UI), 49 bindings_(BINDINGS_POLICY_WEB_UI),
53 web_contents_(contents) { 50 web_contents_(contents) {
54 DCHECK(contents); 51 DCHECK(contents);
55 } 52 }
56 53
57 WebUIImpl::~WebUIImpl() { 54 WebUIImpl::~WebUIImpl() {
58 // Delete the controller first, since it may also be keeping a pointer to some 55 // Delete the controller first, since it may also be keeping a pointer to some
59 // of the handlers and can call them at destruction. 56 // of the handlers and can call them at destruction.
60 controller_.reset(); 57 controller_.reset();
61 STLDeleteContainerPointers(handlers_.begin(), handlers_.end()); 58 STLDeleteContainerPointers(handlers_.begin(), handlers_.end());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 101 }
105 102
106 WebContents* WebUIImpl::GetWebContents() const { 103 WebContents* WebUIImpl::GetWebContents() const {
107 return web_contents_; 104 return web_contents_;
108 } 105 }
109 106
110 ui::ScaleFactor WebUIImpl::GetDeviceScaleFactor() const { 107 ui::ScaleFactor WebUIImpl::GetDeviceScaleFactor() const {
111 return GetScaleFactorForView(web_contents_->GetRenderWidgetHostView()); 108 return GetScaleFactorForView(web_contents_->GetRenderWidgetHostView());
112 } 109 }
113 110
114 bool WebUIImpl::ShouldHideFavicon() const {
115 return hide_favicon_;
116 }
117
118 void WebUIImpl::HideFavicon() {
119 hide_favicon_ = true;
120 }
121
122 bool WebUIImpl::ShouldFocusLocationBarByDefault() const {
123 return focus_location_bar_by_default_;
124 }
125
126 void WebUIImpl::FocusLocationBarByDefault() {
127 focus_location_bar_by_default_ = true;
128 }
129
130 bool WebUIImpl::ShouldHideURL() const {
131 return should_hide_url_;
132 }
133
134 void WebUIImpl::HideURL() {
135 should_hide_url_ = true;
136 }
137
138 const string16& WebUIImpl::GetOverriddenTitle() const { 111 const string16& WebUIImpl::GetOverriddenTitle() const {
139 return overridden_title_; 112 return overridden_title_;
140 } 113 }
141 114
142 void WebUIImpl::OverrideTitle(const string16& title) { 115 void WebUIImpl::OverrideTitle(const string16& title) {
143 overridden_title_ = title; 116 overridden_title_ = title;
144 } 117 }
145 118
146 PageTransition WebUIImpl::GetLinkTransitionType() const { 119 PageTransition WebUIImpl::GetLinkTransitionType() const {
147 return link_transition_type_; 120 return link_transition_type_;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 handlers_.push_back(handler); 230 handlers_.push_back(handler);
258 } 231 }
259 232
260 void WebUIImpl::ExecuteJavascript(const string16& javascript) { 233 void WebUIImpl::ExecuteJavascript(const string16& javascript) {
261 static_cast<RenderViewHostImpl*>( 234 static_cast<RenderViewHostImpl*>(
262 web_contents_->GetRenderViewHost())->ExecuteJavascriptInWebFrame( 235 web_contents_->GetRenderViewHost())->ExecuteJavascriptInWebFrame(
263 ASCIIToUTF16(frame_xpath_), javascript); 236 ASCIIToUTF16(frame_xpath_), javascript);
264 } 237 }
265 238
266 } // namespace content 239 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/webui/web_ui_impl.h ('k') | content/public/browser/web_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698