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

Side by Side Diff: content/renderer/browser_plugin/browser_plugin.cc

Issue 12207089: Cleanup: Remove deprecated base::Value methods from contents. Use base::Value too. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 10 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/common/font_list_x11.cc ('k') | content/renderer/dom_automation_controller.cc » ('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/renderer/browser_plugin/browser_plugin.h" 5 #include "content/renderer/browser_plugin/browser_plugin.h"
6 6
7 #include "base/json/json_string_value_serializer.h" 7 #include "base/json/json_string_value_serializer.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 instance_id_, 332 instance_id_,
333 auto_size_params, 333 auto_size_params,
334 resize_guest_params)); 334 resize_guest_params));
335 } 335 }
336 336
337 void BrowserPlugin::SizeChangedDueToAutoSize(const gfx::Size& old_view_size) { 337 void BrowserPlugin::SizeChangedDueToAutoSize(const gfx::Size& old_view_size) {
338 size_changed_in_flight_ = false; 338 size_changed_in_flight_ = false;
339 339
340 std::map<std::string, base::Value*> props; 340 std::map<std::string, base::Value*> props;
341 props[browser_plugin::kOldHeight] = 341 props[browser_plugin::kOldHeight] =
342 base::Value::CreateIntegerValue(old_view_size.height()); 342 new base::FundamentalValue(old_view_size.height());
343 props[browser_plugin::kOldWidth] = 343 props[browser_plugin::kOldWidth] =
344 base::Value::CreateIntegerValue(old_view_size.width()); 344 new base::FundamentalValue(old_view_size.width());
345 props[browser_plugin::kNewHeight] = 345 props[browser_plugin::kNewHeight] =
346 base::Value::CreateIntegerValue(last_view_size_.height()); 346 new base::FundamentalValue(last_view_size_.height());
347 props[browser_plugin::kNewWidth] = 347 props[browser_plugin::kNewWidth] =
348 base::Value::CreateIntegerValue(last_view_size_.width()); 348 new base::FundamentalValue(last_view_size_.width());
349 TriggerEvent(browser_plugin::kEventSizeChanged, &props); 349 TriggerEvent(browser_plugin::kEventSizeChanged, &props);
350 } 350 }
351 351
352 // static 352 // static
353 bool BrowserPlugin::UsesDamageBuffer( 353 bool BrowserPlugin::UsesDamageBuffer(
354 const BrowserPluginMsg_UpdateRect_Params& params) { 354 const BrowserPluginMsg_UpdateRect_Params& params) {
355 return params.damage_buffer_sequence_id != 0 || params.needs_ack; 355 return params.damage_buffer_sequence_id != 0 || params.needs_ack;
356 } 356 }
357 357
358 bool BrowserPlugin::UsesPendingDamageBuffer( 358 bool BrowserPlugin::UsesPendingDamageBuffer(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 DCHECK(content_window_routing_id != MSG_ROUTING_NONE); 411 DCHECK(content_window_routing_id != MSG_ROUTING_NONE);
412 content_window_routing_id_ = content_window_routing_id; 412 content_window_routing_id_ = content_window_routing_id;
413 } 413 }
414 414
415 void BrowserPlugin::OnGuestGone(int instance_id, int process_id, int status) { 415 void BrowserPlugin::OnGuestGone(int instance_id, int process_id, int status) {
416 // We fire the event listeners before painting the sad graphic to give the 416 // We fire the event listeners before painting the sad graphic to give the
417 // developer an opportunity to display an alternative overlay image on crash. 417 // developer an opportunity to display an alternative overlay image on crash.
418 std::string termination_status = TerminationStatusToString( 418 std::string termination_status = TerminationStatusToString(
419 static_cast<base::TerminationStatus>(status)); 419 static_cast<base::TerminationStatus>(status));
420 std::map<std::string, base::Value*> props; 420 std::map<std::string, base::Value*> props;
421 props[browser_plugin::kProcessId] = 421 props[browser_plugin::kProcessId] = new base::FundamentalValue(process_id);
422 base::Value::CreateIntegerValue(process_id); 422 props[browser_plugin::kReason] = new base::StringValue(termination_status);
423 props[browser_plugin::kReason] =
424 base::Value::CreateStringValue(termination_status);
425 423
426 // Event listeners may remove the BrowserPlugin from the document. If that 424 // Event listeners may remove the BrowserPlugin from the document. If that
427 // happens, the BrowserPlugin will be scheduled for later deletion (see 425 // happens, the BrowserPlugin will be scheduled for later deletion (see
428 // BrowserPlugin::destroy()). That will clear the container_ reference, 426 // BrowserPlugin::destroy()). That will clear the container_ reference,
429 // but leave other member variables valid below. 427 // but leave other member variables valid below.
430 TriggerEvent(browser_plugin::kEventExit, &props); 428 TriggerEvent(browser_plugin::kEventExit, &props);
431 429
432 guest_crashed_ = true; 430 guest_crashed_ = true;
433 // We won't paint the contents of the current backing store again so we might 431 // We won't paint the contents of the current backing store again so we might
434 // as well toss it out and save memory. 432 // as well toss it out and save memory.
435 backing_store_.reset(); 433 backing_store_.reset();
436 // If the BrowserPlugin is scheduled to be deleted, then container_ will be 434 // If the BrowserPlugin is scheduled to be deleted, then container_ will be
437 // NULL so we shouldn't attempt to access it. 435 // NULL so we shouldn't attempt to access it.
438 if (container_) 436 if (container_)
439 container_->invalidate(); 437 container_->invalidate();
440 // Turn off compositing so we can display the sad graphic. 438 // Turn off compositing so we can display the sad graphic.
441 EnableCompositing(false); 439 EnableCompositing(false);
442 } 440 }
443 441
444 void BrowserPlugin::OnGuestResponsive(int instance_id, int process_id) { 442 void BrowserPlugin::OnGuestResponsive(int instance_id, int process_id) {
445 std::map<std::string, base::Value*> props; 443 std::map<std::string, base::Value*> props;
446 props[browser_plugin::kProcessId] = 444 props[browser_plugin::kProcessId] = new base::FundamentalValue(process_id);
447 base::Value::CreateIntegerValue(process_id);
448 TriggerEvent(browser_plugin::kEventResponsive, &props); 445 TriggerEvent(browser_plugin::kEventResponsive, &props);
449 } 446 }
450 447
451 void BrowserPlugin::OnGuestUnresponsive(int instance_id, int process_id) { 448 void BrowserPlugin::OnGuestUnresponsive(int instance_id, int process_id) {
452 std::map<std::string, base::Value*> props; 449 std::map<std::string, base::Value*> props;
453 props[browser_plugin::kProcessId] = 450 props[browser_plugin::kProcessId] = new base::FundamentalValue(process_id);
454 base::Value::CreateIntegerValue(process_id);
455 TriggerEvent(browser_plugin::kEventUnresponsive, &props); 451 TriggerEvent(browser_plugin::kEventUnresponsive, &props);
456 } 452 }
457 453
458 void BrowserPlugin::OnLoadAbort(int instance_id, 454 void BrowserPlugin::OnLoadAbort(int instance_id,
459 const GURL& url, 455 const GURL& url,
460 bool is_top_level, 456 bool is_top_level,
461 const std::string& type) { 457 const std::string& type) {
462 std::map<std::string, base::Value*> props; 458 std::map<std::string, base::Value*> props;
463 props[browser_plugin::kURL] = base::Value::CreateStringValue(url.spec()); 459 props[browser_plugin::kURL] = new base::StringValue(url.spec());
464 props[browser_plugin::kIsTopLevel] = 460 props[browser_plugin::kIsTopLevel] = new base::FundamentalValue(is_top_level);
465 base::Value::CreateBooleanValue(is_top_level); 461 props[browser_plugin::kReason] = new base::StringValue(type);
466 props[browser_plugin::kReason] = base::Value::CreateStringValue(type);
467 TriggerEvent(browser_plugin::kEventLoadAbort, &props); 462 TriggerEvent(browser_plugin::kEventLoadAbort, &props);
468 } 463 }
469 464
470 void BrowserPlugin::OnLoadCommit( 465 void BrowserPlugin::OnLoadCommit(
471 int instance_id, 466 int instance_id,
472 const BrowserPluginMsg_LoadCommit_Params& params) { 467 const BrowserPluginMsg_LoadCommit_Params& params) {
473 // If the guest has just committed a new navigation then it is no longer 468 // If the guest has just committed a new navigation then it is no longer
474 // crashed. 469 // crashed.
475 guest_crashed_ = false; 470 guest_crashed_ = false;
476 if (params.is_top_level) { 471 if (params.is_top_level) {
477 UpdateDOMAttribute(browser_plugin::kAttributeSrc, params.url.spec()); 472 UpdateDOMAttribute(browser_plugin::kAttributeSrc, params.url.spec());
478 } 473 }
479 guest_process_id_ = params.process_id; 474 guest_process_id_ = params.process_id;
480 guest_route_id_ = params.route_id; 475 guest_route_id_ = params.route_id;
481 current_nav_entry_index_ = params.current_entry_index; 476 current_nav_entry_index_ = params.current_entry_index;
482 nav_entry_count_ = params.entry_count; 477 nav_entry_count_ = params.entry_count;
483 478
484 std::map<std::string, base::Value*> props; 479 std::map<std::string, base::Value*> props;
485 props[browser_plugin::kURL] = 480 props[browser_plugin::kURL] = new base::StringValue(params.url.spec());
486 base::Value::CreateStringValue(params.url.spec());
487 props[browser_plugin::kIsTopLevel] = 481 props[browser_plugin::kIsTopLevel] =
488 base::Value::CreateBooleanValue(params.is_top_level); 482 new base::FundamentalValue(params.is_top_level);
489 TriggerEvent(browser_plugin::kEventLoadCommit, &props); 483 TriggerEvent(browser_plugin::kEventLoadCommit, &props);
490 } 484 }
491 485
492 void BrowserPlugin::OnLoadRedirect(int instance_id, 486 void BrowserPlugin::OnLoadRedirect(int instance_id,
493 const GURL& old_url, 487 const GURL& old_url,
494 const GURL& new_url, 488 const GURL& new_url,
495 bool is_top_level) { 489 bool is_top_level) {
496 std::map<std::string, base::Value*> props; 490 std::map<std::string, base::Value*> props;
497 props[browser_plugin::kOldURL] = 491 props[browser_plugin::kOldURL] = new base::StringValue(old_url.spec());
498 base::Value::CreateStringValue(old_url.spec()); 492 props[browser_plugin::kNewURL] = new base::StringValue(new_url.spec());
499 props[browser_plugin::kNewURL] = 493 props[browser_plugin::kIsTopLevel] = new base::FundamentalValue(is_top_level);
500 base::Value::CreateStringValue(new_url.spec());
501 props[browser_plugin::kIsTopLevel] =
502 base::Value::CreateBooleanValue(is_top_level);
503 TriggerEvent(browser_plugin::kEventLoadRedirect, &props); 494 TriggerEvent(browser_plugin::kEventLoadRedirect, &props);
504 } 495 }
505 496
506 void BrowserPlugin::OnLoadStart(int instance_id, 497 void BrowserPlugin::OnLoadStart(int instance_id,
507 const GURL& url, 498 const GURL& url,
508 bool is_top_level) { 499 bool is_top_level) {
509 std::map<std::string, base::Value*> props; 500 std::map<std::string, base::Value*> props;
510 props[browser_plugin::kURL] = 501 props[browser_plugin::kURL] = new base::StringValue(url.spec());
511 base::Value::CreateStringValue(url.spec()); 502 props[browser_plugin::kIsTopLevel] = new base::FundamentalValue(is_top_level);
512 props[browser_plugin::kIsTopLevel] =
513 base::Value::CreateBooleanValue(is_top_level);
514 503
515 TriggerEvent(browser_plugin::kEventLoadStart, &props); 504 TriggerEvent(browser_plugin::kEventLoadStart, &props);
516 } 505 }
517 506
518 void BrowserPlugin::OnLoadStop(int instance_id) { 507 void BrowserPlugin::OnLoadStop(int instance_id) {
519 TriggerEvent(browser_plugin::kEventLoadStop, NULL); 508 TriggerEvent(browser_plugin::kEventLoadStop, NULL);
520 } 509 }
521 510
522 void BrowserPlugin::OnSetCursor(int instance_id, const WebCursor& cursor) { 511 void BrowserPlugin::OnSetCursor(int instance_id, const WebCursor& cursor) {
523 cursor_ = cursor; 512 cursor_ = cursor;
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 void* notify_data) { 1157 void* notify_data) {
1169 } 1158 }
1170 1159
1171 void BrowserPlugin::didFailLoadingFrameRequest( 1160 void BrowserPlugin::didFailLoadingFrameRequest(
1172 const WebKit::WebURL& url, 1161 const WebKit::WebURL& url,
1173 void* notify_data, 1162 void* notify_data,
1174 const WebKit::WebURLError& error) { 1163 const WebKit::WebURLError& error) {
1175 } 1164 }
1176 1165
1177 } // namespace content 1166 } // namespace content
OLDNEW
« no previous file with comments | « content/common/font_list_x11.cc ('k') | content/renderer/dom_automation_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698