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

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: Merge with ToT 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 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"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 return false; 413 return false;
414 return damage_buffer_sequence_id_ == params.damage_buffer_sequence_id; 414 return damage_buffer_sequence_id_ == params.damage_buffer_sequence_id;
415 } 415 }
416 416
417 void BrowserPlugin::Attach(int guest_instance_id) { 417 void BrowserPlugin::Attach(int guest_instance_id) {
418 CHECK(guest_instance_id != browser_plugin::kInstanceIDNone); 418 CHECK(guest_instance_id != browser_plugin::kInstanceIDNone);
419 before_first_navigation_ = false; 419 before_first_navigation_ = false;
420 guest_instance_id_ = guest_instance_id; 420 guest_instance_id_ = guest_instance_id;
421 browser_plugin_manager()->AddBrowserPlugin(guest_instance_id, this); 421 browser_plugin_manager()->AddBrowserPlugin(guest_instance_id, this);
422 422
423 std::map<std::string, base::Value*> props;
424 props[browser_plugin::kWindowID] =
425 new base::FundamentalValue(guest_instance_id);
426 TriggerEvent(browser_plugin::kEventInternalAttached, &props);
427
423 BrowserPluginHostMsg_Attach_Params attach_params; 428 BrowserPluginHostMsg_Attach_Params attach_params;
424 attach_params.browser_plugin_instance_id = instance_id_; 429 attach_params.browser_plugin_instance_id = instance_id_;
425 attach_params.focused = ShouldGuestBeFocused(); 430 attach_params.focused = ShouldGuestBeFocused();
426 attach_params.visible = visible_; 431 attach_params.visible = visible_;
427 attach_params.name = GetNameAttribute(); 432 attach_params.name = GetNameAttribute();
428 attach_params.storage_partition_id = storage_partition_id_; 433 attach_params.storage_partition_id = storage_partition_id_;
429 attach_params.persist_storage = persist_storage_; 434 attach_params.persist_storage = persist_storage_;
430 attach_params.src = GetSrcAttribute(); 435 attach_params.src = GetSrcAttribute();
431 GetDamageBufferWithSizeParams(&attach_params.auto_size_params, 436 GetDamageBufferWithSizeParams(&attach_params.auto_size_params,
432 &attach_params.resize_guest_params); 437 &attach_params.resize_guest_params);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 int guest_instance_id, 581 int guest_instance_id,
577 const BrowserPluginMsg_LoadCommit_Params& params) { 582 const BrowserPluginMsg_LoadCommit_Params& params) {
578 // If the guest has just committed a new navigation then it is no longer 583 // If the guest has just committed a new navigation then it is no longer
579 // crashed. 584 // crashed.
580 guest_crashed_ = false; 585 guest_crashed_ = false;
581 if (params.is_top_level) 586 if (params.is_top_level)
582 UpdateDOMAttribute(browser_plugin::kAttributeSrc, params.url.spec()); 587 UpdateDOMAttribute(browser_plugin::kAttributeSrc, params.url.spec());
583 588
584 current_nav_entry_index_ = params.current_entry_index; 589 current_nav_entry_index_ = params.current_entry_index;
585 nav_entry_count_ = params.entry_count; 590 nav_entry_count_ = params.entry_count;
586
587 std::map<std::string, base::Value*> props;
588 props[browser_plugin::kURL] = new base::StringValue(params.url.spec());
589 props[browser_plugin::kIsTopLevel] =
590 new base::FundamentalValue(params.is_top_level);
591 TriggerEvent(browser_plugin::kEventLoadCommit, &props);
592 } 591 }
593 592
594 void BrowserPlugin::OnLoadHandlerCalled(int guest_instance_id) { 593 void BrowserPlugin::OnLoadHandlerCalled(int guest_instance_id) {
595 TriggerEvent(browser_plugin::kEventContentLoad, NULL); 594 TriggerEvent(browser_plugin::kEventContentLoad, NULL);
596 } 595 }
597 596
598 void BrowserPlugin::OnLoadRedirect(int guest_instance_id, 597 void BrowserPlugin::OnLoadRedirect(int guest_instance_id,
599 const GURL& old_url, 598 const GURL& old_url,
600 const GURL& new_url, 599 const GURL& new_url,
601 bool is_top_level) { 600 bool is_top_level) {
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 const WebKit::WebMouseEvent& event) { 1637 const WebKit::WebMouseEvent& event) {
1639 browser_plugin_manager()->Send( 1638 browser_plugin_manager()->Send(
1640 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, 1639 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_,
1641 guest_instance_id_, 1640 guest_instance_id_,
1642 plugin_rect_, 1641 plugin_rect_,
1643 &event)); 1642 &event));
1644 return true; 1643 return true;
1645 } 1644 }
1646 1645
1647 } // namespace content 1646 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin.h ('k') | content/renderer/browser_plugin/browser_plugin_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698