OLD | NEW |
1 // Copyright 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 "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 // If a BackgroundContents is created, suppress the normal WebContents. | 1593 // If a BackgroundContents is created, suppress the normal WebContents. |
1594 return !MaybeCreateBackgroundContents( | 1594 return !MaybeCreateBackgroundContents( |
1595 route_id, main_frame_route_id, main_frame_widget_route_id, web_contents, | 1595 route_id, main_frame_route_id, main_frame_widget_route_id, web_contents, |
1596 frame_name, target_url, partition_id, session_storage_namespace); | 1596 frame_name, target_url, partition_id, session_storage_namespace); |
1597 } | 1597 } |
1598 | 1598 |
1599 return true; | 1599 return true; |
1600 } | 1600 } |
1601 | 1601 |
1602 void Browser::WebContentsCreated(WebContents* source_contents, | 1602 void Browser::WebContentsCreated(WebContents* source_contents, |
| 1603 int opener_render_process_id, |
1603 int opener_render_frame_id, | 1604 int opener_render_frame_id, |
1604 const std::string& frame_name, | 1605 const std::string& frame_name, |
1605 const GURL& target_url, | 1606 const GURL& target_url, |
1606 WebContents* new_contents) { | 1607 WebContents* new_contents) { |
1607 // Adopt the WebContents now, so all observers are in place, as the network | 1608 // Adopt the WebContents now, so all observers are in place, as the network |
1608 // requests for its initial navigation will start immediately. The WebContents | 1609 // requests for its initial navigation will start immediately. The WebContents |
1609 // will later be inserted into this browser using Browser::Navigate via | 1610 // will later be inserted into this browser using Browser::Navigate via |
1610 // AddNewContents. | 1611 // AddNewContents. |
1611 TabHelpers::AttachTabHelpers(new_contents); | 1612 TabHelpers::AttachTabHelpers(new_contents); |
1612 | 1613 |
1613 // Make the tab show up in the task manager. | 1614 // Make the tab show up in the task manager. |
1614 task_manager::WebContentsTags::CreateForTabContents(new_contents); | 1615 task_manager::WebContentsTags::CreateForTabContents(new_contents); |
1615 | 1616 |
1616 // Notify. | 1617 // Notify. |
1617 RetargetingDetails details; | 1618 RetargetingDetails details; |
1618 details.source_web_contents = source_contents; | 1619 details.source_web_contents = source_contents; |
| 1620 details.source_render_process_id = opener_render_process_id; |
1619 details.source_render_frame_id = opener_render_frame_id; | 1621 details.source_render_frame_id = opener_render_frame_id; |
1620 details.target_url = target_url; | 1622 details.target_url = target_url; |
1621 details.target_web_contents = new_contents; | 1623 details.target_web_contents = new_contents; |
1622 details.not_yet_in_tabstrip = true; | 1624 details.not_yet_in_tabstrip = true; |
1623 content::NotificationService::current()->Notify( | 1625 content::NotificationService::current()->Notify( |
1624 chrome::NOTIFICATION_RETARGETING, | 1626 chrome::NOTIFICATION_RETARGETING, |
1625 content::Source<Profile>(profile_), | 1627 content::Source<Profile>(profile_), |
1626 content::Details<RetargetingDetails>(&details)); | 1628 content::Details<RetargetingDetails>(&details)); |
1627 } | 1629 } |
1628 | 1630 |
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2572 if (contents && !allow_js_access) { | 2574 if (contents && !allow_js_access) { |
2573 contents->web_contents()->GetController().LoadURL( | 2575 contents->web_contents()->GetController().LoadURL( |
2574 target_url, | 2576 target_url, |
2575 content::Referrer(), | 2577 content::Referrer(), |
2576 ui::PAGE_TRANSITION_LINK, | 2578 ui::PAGE_TRANSITION_LINK, |
2577 std::string()); // No extra headers. | 2579 std::string()); // No extra headers. |
2578 } | 2580 } |
2579 | 2581 |
2580 return contents != NULL; | 2582 return contents != NULL; |
2581 } | 2583 } |
OLD | NEW |