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

Side by Side Diff: chrome/renderer/chrome_render_view_observer.cc

Issue 292313004: Port aria_util_test.js to run as a WebUI test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add source filename hack Created 6 years, 7 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
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 "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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 #endif 248 #endif
249 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetWindowFeatures, OnSetWindowFeatures) 249 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetWindowFeatures, OnSetWindowFeatures)
250 IPC_MESSAGE_UNHANDLED(handled = false) 250 IPC_MESSAGE_UNHANDLED(handled = false)
251 IPC_END_MESSAGE_MAP() 251 IPC_END_MESSAGE_MAP()
252 252
253 return handled; 253 return handled;
254 } 254 }
255 255
256 void ChromeRenderViewObserver::OnWebUIJavaScript( 256 void ChromeRenderViewObserver::OnWebUIJavaScript(
257 const base::string16& javascript) { 257 const base::string16& javascript) {
258 webui_javascript_ = javascript; 258 webui_javascript_.push_back(javascript);
259 } 259 }
260 260
261 #if defined(OS_ANDROID) 261 #if defined(OS_ANDROID)
262 void ChromeRenderViewObserver::OnUpdateTopControlsState( 262 void ChromeRenderViewObserver::OnUpdateTopControlsState(
263 content::TopControlsState constraints, 263 content::TopControlsState constraints,
264 content::TopControlsState current, 264 content::TopControlsState current,
265 bool animate) { 265 bool animate) {
266 render_view()->UpdateTopControlsState(constraints, current, animate); 266 render_view()->UpdateTopControlsState(constraints, current, animate);
267 } 267 }
268 268
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 375
376 void ChromeRenderViewObserver::OnGetFPS() { 376 void ChromeRenderViewObserver::OnGetFPS() {
377 float fps = (render_view()->GetFilteredTimePerFrame() > 0.0f)? 377 float fps = (render_view()->GetFilteredTimePerFrame() > 0.0f)?
378 1.0f / render_view()->GetFilteredTimePerFrame() : 0.0f; 378 1.0f / render_view()->GetFilteredTimePerFrame() : 0.0f;
379 Send(new ChromeViewHostMsg_FPS(routing_id(), fps)); 379 Send(new ChromeViewHostMsg_FPS(routing_id(), fps));
380 } 380 }
381 381
382 void ChromeRenderViewObserver::DidStartLoading() { 382 void ChromeRenderViewObserver::DidStartLoading() {
383 if ((render_view()->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI) && 383 if ((render_view()->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI) &&
384 !webui_javascript_.empty()) { 384 !webui_javascript_.empty()) {
385 render_view()->GetMainRenderFrame()->ExecuteJavaScript(webui_javascript_); 385 for (size_t i = 0; i < webui_javascript_.size(); ++i) {
386 render_view()->GetMainRenderFrame()->ExecuteJavaScript(
387 webui_javascript_[i]);
388 }
386 webui_javascript_.clear(); 389 webui_javascript_.clear();
387 } 390 }
388 } 391 }
389 392
390 void ChromeRenderViewObserver::DidStopLoading() { 393 void ChromeRenderViewObserver::DidStopLoading() {
391 WebFrame* main_frame = render_view()->GetWebView()->mainFrame(); 394 WebFrame* main_frame = render_view()->GetWebView()->mainFrame();
392 GURL osd_url = main_frame->document().openSearchDescriptionURL(); 395 GURL osd_url = main_frame->document().openSearchDescriptionURL();
393 if (!osd_url.is_empty()) { 396 if (!osd_url.is_empty()) {
394 Send(new ChromeViewHostMsg_PageHasOSDD( 397 Send(new ChromeViewHostMsg_PageHasOSDD(
395 routing_id(), render_view()->GetPageId(), osd_url, 398 routing_id(), render_view()->GetPageId(), osd_url,
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 WebElement element = node.to<WebElement>(); 585 WebElement element = node.to<WebElement>();
583 if (!element.hasTagName(tag_name)) 586 if (!element.hasTagName(tag_name))
584 continue; 587 continue;
585 WebString value = element.getAttribute(attribute_name); 588 WebString value = element.getAttribute(attribute_name);
586 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) 589 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh"))
587 continue; 590 continue;
588 return true; 591 return true;
589 } 592 }
590 return false; 593 return false;
591 } 594 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698