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 "chrome/renderer/chrome_render_view_observer.h" | 5 #include "chrome/renderer/chrome_render_view_observer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 #endif | 249 #endif |
250 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetWindowFeatures, OnSetWindowFeatures) | 250 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetWindowFeatures, OnSetWindowFeatures) |
251 IPC_MESSAGE_UNHANDLED(handled = false) | 251 IPC_MESSAGE_UNHANDLED(handled = false) |
252 IPC_END_MESSAGE_MAP() | 252 IPC_END_MESSAGE_MAP() |
253 | 253 |
254 return handled; | 254 return handled; |
255 } | 255 } |
256 | 256 |
257 void ChromeRenderViewObserver::OnWebUIJavaScript( | 257 void ChromeRenderViewObserver::OnWebUIJavaScript( |
258 const base::string16& javascript) { | 258 const base::string16& javascript) { |
259 webui_javascript_ = javascript; | 259 webui_javascript_.push_back(javascript); |
260 } | 260 } |
261 | 261 |
262 #if defined(OS_ANDROID) | 262 #if defined(OS_ANDROID) |
263 void ChromeRenderViewObserver::OnUpdateTopControlsState( | 263 void ChromeRenderViewObserver::OnUpdateTopControlsState( |
264 content::TopControlsState constraints, | 264 content::TopControlsState constraints, |
265 content::TopControlsState current, | 265 content::TopControlsState current, |
266 bool animate) { | 266 bool animate) { |
267 render_view()->UpdateTopControlsState(constraints, current, animate); | 267 render_view()->UpdateTopControlsState(constraints, current, animate); |
268 } | 268 } |
269 | 269 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 383 |
384 void ChromeRenderViewObserver::OnGetFPS() { | 384 void ChromeRenderViewObserver::OnGetFPS() { |
385 float fps = (render_view()->GetFilteredTimePerFrame() > 0.0f)? | 385 float fps = (render_view()->GetFilteredTimePerFrame() > 0.0f)? |
386 1.0f / render_view()->GetFilteredTimePerFrame() : 0.0f; | 386 1.0f / render_view()->GetFilteredTimePerFrame() : 0.0f; |
387 Send(new ChromeViewHostMsg_FPS(routing_id(), fps)); | 387 Send(new ChromeViewHostMsg_FPS(routing_id(), fps)); |
388 } | 388 } |
389 | 389 |
390 void ChromeRenderViewObserver::DidStartLoading() { | 390 void ChromeRenderViewObserver::DidStartLoading() { |
391 if ((render_view()->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI) && | 391 if ((render_view()->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI) && |
392 !webui_javascript_.empty()) { | 392 !webui_javascript_.empty()) { |
393 render_view()->GetMainRenderFrame()->ExecuteJavaScript(webui_javascript_); | 393 for (size_t i = 0; i < webui_javascript_.size(); ++i) { |
| 394 render_view()->GetMainRenderFrame()->ExecuteJavaScript( |
| 395 webui_javascript_[i]); |
| 396 } |
394 webui_javascript_.clear(); | 397 webui_javascript_.clear(); |
395 } | 398 } |
396 } | 399 } |
397 | 400 |
398 void ChromeRenderViewObserver::DidStopLoading() { | 401 void ChromeRenderViewObserver::DidStopLoading() { |
399 WebFrame* main_frame = render_view()->GetWebView()->mainFrame(); | 402 WebFrame* main_frame = render_view()->GetWebView()->mainFrame(); |
400 GURL osdd_url = main_frame->document().openSearchDescriptionURL(); | 403 GURL osdd_url = main_frame->document().openSearchDescriptionURL(); |
401 if (!osdd_url.is_empty()) { | 404 if (!osdd_url.is_empty()) { |
402 Send(new ChromeViewHostMsg_PageHasOSDD( | 405 Send(new ChromeViewHostMsg_PageHasOSDD( |
403 routing_id(), main_frame->document().url(), osdd_url, | 406 routing_id(), main_frame->document().url(), osdd_url, |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 WebElement element = node.to<WebElement>(); | 593 WebElement element = node.to<WebElement>(); |
591 if (!element.hasTagName(tag_name)) | 594 if (!element.hasTagName(tag_name)) |
592 continue; | 595 continue; |
593 WebString value = element.getAttribute(attribute_name); | 596 WebString value = element.getAttribute(attribute_name); |
594 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) | 597 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) |
595 continue; | 598 continue; |
596 return true; | 599 return true; |
597 } | 600 } |
598 return false; | 601 return false; |
599 } | 602 } |
OLD | NEW |