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

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

Issue 17165004: <webview>: Partially migrate loadcommit event from content to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nit Created 7 years, 6 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
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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_string_value_serializer.h" 8 #include "base/json/json_string_value_serializer.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 return false; 409 return false;
410 return damage_buffer_sequence_id_ == params.damage_buffer_sequence_id; 410 return damage_buffer_sequence_id_ == params.damage_buffer_sequence_id;
411 } 411 }
412 412
413 void BrowserPlugin::Attach(int guest_instance_id) { 413 void BrowserPlugin::Attach(int guest_instance_id) {
414 CHECK(guest_instance_id != browser_plugin::kInstanceIDNone); 414 CHECK(guest_instance_id != browser_plugin::kInstanceIDNone);
415 before_first_navigation_ = false; 415 before_first_navigation_ = false;
416 guest_instance_id_ = guest_instance_id; 416 guest_instance_id_ = guest_instance_id;
417 browser_plugin_manager()->AddBrowserPlugin(guest_instance_id, this); 417 browser_plugin_manager()->AddBrowserPlugin(guest_instance_id, this);
418 418
419 std::map<std::string, base::Value*> props;
420 props[browser_plugin::kWindowID] =
421 new base::FundamentalValue(guest_instance_id);
422 TriggerEvent(browser_plugin::kEventInternalAttached, &props);
423
419 BrowserPluginHostMsg_Attach_Params create_guest_params; 424 BrowserPluginHostMsg_Attach_Params create_guest_params;
420 create_guest_params.browser_plugin_instance_id = instance_id_; 425 create_guest_params.browser_plugin_instance_id = instance_id_;
421 create_guest_params.focused = ShouldGuestBeFocused(); 426 create_guest_params.focused = ShouldGuestBeFocused();
422 create_guest_params.visible = visible_; 427 create_guest_params.visible = visible_;
423 create_guest_params.name = GetNameAttribute(); 428 create_guest_params.name = GetNameAttribute();
424 create_guest_params.storage_partition_id = storage_partition_id_; 429 create_guest_params.storage_partition_id = storage_partition_id_;
425 create_guest_params.persist_storage = persist_storage_; 430 create_guest_params.persist_storage = persist_storage_;
426 create_guest_params.src = GetSrcAttribute(); 431 create_guest_params.src = GetSrcAttribute();
427 GetDamageBufferWithSizeParams(&create_guest_params.auto_size_params, 432 GetDamageBufferWithSizeParams(&create_guest_params.auto_size_params,
428 &create_guest_params.resize_guest_params); 433 &create_guest_params.resize_guest_params);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 int guest_instance_id, 570 int guest_instance_id,
566 const BrowserPluginMsg_LoadCommit_Params& params) { 571 const BrowserPluginMsg_LoadCommit_Params& params) {
567 // If the guest has just committed a new navigation then it is no longer 572 // If the guest has just committed a new navigation then it is no longer
568 // crashed. 573 // crashed.
569 guest_crashed_ = false; 574 guest_crashed_ = false;
570 if (params.is_top_level) 575 if (params.is_top_level)
571 UpdateDOMAttribute(browser_plugin::kAttributeSrc, params.url.spec()); 576 UpdateDOMAttribute(browser_plugin::kAttributeSrc, params.url.spec());
572 577
573 current_nav_entry_index_ = params.current_entry_index; 578 current_nav_entry_index_ = params.current_entry_index;
574 nav_entry_count_ = params.entry_count; 579 nav_entry_count_ = params.entry_count;
575
576 std::map<std::string, base::Value*> props;
577 props[browser_plugin::kURL] = new base::StringValue(params.url.spec());
578 props[browser_plugin::kIsTopLevel] =
579 new base::FundamentalValue(params.is_top_level);
580 TriggerEvent(browser_plugin::kEventLoadCommit, &props);
581 } 580 }
582 581
583 void BrowserPlugin::OnLoadHandlerCalled(int guest_instance_id) { 582 void BrowserPlugin::OnLoadHandlerCalled(int guest_instance_id) {
584 TriggerEvent(browser_plugin::kEventContentLoad, NULL); 583 TriggerEvent(browser_plugin::kEventContentLoad, NULL);
585 } 584 }
586 585
587 void BrowserPlugin::OnLoadRedirect(int guest_instance_id, 586 void BrowserPlugin::OnLoadRedirect(int guest_instance_id,
588 const GURL& old_url, 587 const GURL& old_url,
589 const GURL& new_url, 588 const GURL& new_url,
590 bool is_top_level) { 589 bool is_top_level) {
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 const WebKit::WebMouseEvent& event) { 1626 const WebKit::WebMouseEvent& event) {
1628 browser_plugin_manager()->Send( 1627 browser_plugin_manager()->Send(
1629 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, 1628 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_,
1630 guest_instance_id_, 1629 guest_instance_id_,
1631 plugin_rect_, 1630 plugin_rect_,
1632 &event)); 1631 &event));
1633 return true; 1632 return true;
1634 } 1633 }
1635 1634
1636 } // namespace content 1635 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698