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 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_process_id, |
1604 int opener_render_frame_id, | 1604 int opener_render_frame_id, |
1605 const std::string& frame_name, | 1605 const std::string& frame_name, |
1606 const GURL& target_url, | 1606 const GURL& target_url, |
1607 WebContents* new_contents) { | 1607 WebContents* new_contents) { |
| 1608 LOG(ERROR) << "Browser::WebContentsCreated: " |
| 1609 << " source_contents:" << source_contents |
| 1610 << " opener_frame:" << opener_render_frame_id |
| 1611 << " target_url:" << target_url |
| 1612 << " new contents:" << new_contents; |
| 1613 |
1608 // Adopt the WebContents now, so all observers are in place, as the network | 1614 // Adopt the WebContents now, so all observers are in place, as the network |
1609 // requests for its initial navigation will start immediately. The WebContents | 1615 // requests for its initial navigation will start immediately. The WebContents |
1610 // will later be inserted into this browser using Browser::Navigate via | 1616 // will later be inserted into this browser using Browser::Navigate via |
1611 // AddNewContents. | 1617 // AddNewContents. |
1612 TabHelpers::AttachTabHelpers(new_contents); | 1618 TabHelpers::AttachTabHelpers(new_contents); |
1613 | 1619 |
1614 // Make the tab show up in the task manager. | 1620 // Make the tab show up in the task manager. |
1615 task_manager::WebContentsTags::CreateForTabContents(new_contents); | 1621 task_manager::WebContentsTags::CreateForTabContents(new_contents); |
1616 | 1622 |
| 1623 /* |
1617 // Notify. | 1624 // Notify. |
1618 RetargetingDetails details; | 1625 RetargetingDetails details; |
1619 details.source_web_contents = source_contents; | 1626 details.source_web_contents = source_contents; |
1620 details.source_render_process_id = opener_render_process_id; | 1627 details.source_render_process_id = opener_render_process_id; |
1621 details.source_render_frame_id = opener_render_frame_id; | 1628 details.source_render_frame_id = opener_render_frame_id; |
1622 details.target_url = target_url; | 1629 details.target_url = target_url; |
1623 details.target_web_contents = new_contents; | 1630 details.target_web_contents = new_contents; |
1624 details.not_yet_in_tabstrip = true; | 1631 details.not_yet_in_tabstrip = true; |
| 1632 LOG(ERROR) << "Browser::WebContentsCreated: dispatch RETARGETING"; |
1625 content::NotificationService::current()->Notify( | 1633 content::NotificationService::current()->Notify( |
1626 chrome::NOTIFICATION_RETARGETING, | 1634 chrome::NOTIFICATION_RETARGETING, |
1627 content::Source<Profile>(profile_), | 1635 content::Source<Profile>(profile_), |
1628 content::Details<RetargetingDetails>(&details)); | 1636 content::Details<RetargetingDetails>(&details)); |
| 1637 */ |
1629 } | 1638 } |
1630 | 1639 |
1631 void Browser::RendererUnresponsive( | 1640 void Browser::RendererUnresponsive( |
1632 WebContents* source, | 1641 WebContents* source, |
1633 const content::WebContentsUnresponsiveState& unresponsive_state) { | 1642 const content::WebContentsUnresponsiveState& unresponsive_state) { |
1634 // Ignore hangs if a tab is blocked. | 1643 // Ignore hangs if a tab is blocked. |
1635 int index = tab_strip_model_->GetIndexOfWebContents(source); | 1644 int index = tab_strip_model_->GetIndexOfWebContents(source); |
1636 DCHECK_NE(TabStripModel::kNoTab, index); | 1645 DCHECK_NE(TabStripModel::kNoTab, index); |
1637 if (tab_strip_model_->IsTabBlocked(index)) | 1646 if (tab_strip_model_->IsTabBlocked(index)) |
1638 return; | 1647 return; |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2577 if (contents && !allow_js_access) { | 2586 if (contents && !allow_js_access) { |
2578 contents->web_contents()->GetController().LoadURL( | 2587 contents->web_contents()->GetController().LoadURL( |
2579 target_url, | 2588 target_url, |
2580 content::Referrer(), | 2589 content::Referrer(), |
2581 ui::PAGE_TRANSITION_LINK, | 2590 ui::PAGE_TRANSITION_LINK, |
2582 std::string()); // No extra headers. | 2591 std::string()); // No extra headers. |
2583 } | 2592 } |
2584 | 2593 |
2585 return contents != NULL; | 2594 return contents != NULL; |
2586 } | 2595 } |
OLD | NEW |