| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 #include "chrome/browser/repost_form_warning_controller.h" | 75 #include "chrome/browser/repost_form_warning_controller.h" |
| 76 #include "chrome/browser/search/search.h" | 76 #include "chrome/browser/search/search.h" |
| 77 #include "chrome/browser/sessions/session_restore.h" | 77 #include "chrome/browser/sessions/session_restore.h" |
| 78 #include "chrome/browser/sessions/session_service.h" | 78 #include "chrome/browser/sessions/session_service.h" |
| 79 #include "chrome/browser/sessions/session_service_factory.h" | 79 #include "chrome/browser/sessions/session_service_factory.h" |
| 80 #include "chrome/browser/sessions/session_tab_helper.h" | 80 #include "chrome/browser/sessions/session_tab_helper.h" |
| 81 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 81 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 82 #include "chrome/browser/ssl/security_state_tab_helper.h" | 82 #include "chrome/browser/ssl/security_state_tab_helper.h" |
| 83 #include "chrome/browser/sync/profile_sync_service_factory.h" | 83 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 84 #include "chrome/browser/sync/sync_ui_util.h" | 84 #include "chrome/browser/sync/sync_ui_util.h" |
| 85 #include "chrome/browser/tab_contents/retargeting_details.h" | |
| 86 #include "chrome/browser/tab_contents/tab_util.h" | 85 #include "chrome/browser/tab_contents/tab_util.h" |
| 87 #include "chrome/browser/task_manager/web_contents_tags.h" | 86 #include "chrome/browser/task_manager/web_contents_tags.h" |
| 88 #include "chrome/browser/themes/theme_service.h" | 87 #include "chrome/browser/themes/theme_service.h" |
| 89 #include "chrome/browser/themes/theme_service_factory.h" | 88 #include "chrome/browser/themes/theme_service_factory.h" |
| 90 #include "chrome/browser/translate/chrome_translate_client.h" | 89 #include "chrome/browser/translate/chrome_translate_client.h" |
| 91 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" | 90 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" |
| 92 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | 91 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
| 93 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h" | 92 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h" |
| 94 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h" | 93 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h" |
| 95 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 94 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| (...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1693 const GURL& target_url, | 1692 const GURL& target_url, |
| 1694 WebContents* new_contents) { | 1693 WebContents* new_contents) { |
| 1695 // Adopt the WebContents now, so all observers are in place, as the network | 1694 // Adopt the WebContents now, so all observers are in place, as the network |
| 1696 // requests for its initial navigation will start immediately. The WebContents | 1695 // requests for its initial navigation will start immediately. The WebContents |
| 1697 // will later be inserted into this browser using Browser::Navigate via | 1696 // will later be inserted into this browser using Browser::Navigate via |
| 1698 // AddNewContents. | 1697 // AddNewContents. |
| 1699 TabHelpers::AttachTabHelpers(new_contents); | 1698 TabHelpers::AttachTabHelpers(new_contents); |
| 1700 | 1699 |
| 1701 // Make the tab show up in the task manager. | 1700 // Make the tab show up in the task manager. |
| 1702 task_manager::WebContentsTags::CreateForTabContents(new_contents); | 1701 task_manager::WebContentsTags::CreateForTabContents(new_contents); |
| 1703 | |
| 1704 // Notify. | |
| 1705 RetargetingDetails details; | |
| 1706 details.source_web_contents = source_contents; | |
| 1707 details.source_render_process_id = opener_render_process_id; | |
| 1708 details.source_render_frame_id = opener_render_frame_id; | |
| 1709 details.target_url = target_url; | |
| 1710 details.target_web_contents = new_contents; | |
| 1711 details.not_yet_in_tabstrip = true; | |
| 1712 content::NotificationService::current()->Notify( | |
| 1713 chrome::NOTIFICATION_RETARGETING, | |
| 1714 content::Source<Profile>(profile_), | |
| 1715 content::Details<RetargetingDetails>(&details)); | |
| 1716 } | 1702 } |
| 1717 | 1703 |
| 1718 void Browser::RendererUnresponsive( | 1704 void Browser::RendererUnresponsive( |
| 1719 WebContents* source, | 1705 WebContents* source, |
| 1720 const content::WebContentsUnresponsiveState& unresponsive_state) { | 1706 const content::WebContentsUnresponsiveState& unresponsive_state) { |
| 1721 // Ignore hangs if a tab is blocked. | 1707 // Ignore hangs if a tab is blocked. |
| 1722 int index = tab_strip_model_->GetIndexOfWebContents(source); | 1708 int index = tab_strip_model_->GetIndexOfWebContents(source); |
| 1723 DCHECK_NE(TabStripModel::kNoTab, index); | 1709 DCHECK_NE(TabStripModel::kNoTab, index); |
| 1724 if (tab_strip_model_->IsTabBlocked(index)) | 1710 if (tab_strip_model_->IsTabBlocked(index)) |
| 1725 return; | 1711 return; |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2676 // new window later, thus we need to navigate the window now. | 2662 // new window later, thus we need to navigate the window now. |
| 2677 if (contents) { | 2663 if (contents) { |
| 2678 contents->web_contents()->GetController().LoadURL( | 2664 contents->web_contents()->GetController().LoadURL( |
| 2679 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, | 2665 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, |
| 2680 std::string()); // No extra headers. | 2666 std::string()); // No extra headers. |
| 2681 } | 2667 } |
| 2682 } | 2668 } |
| 2683 | 2669 |
| 2684 return contents != NULL; | 2670 return contents != NULL; |
| 2685 } | 2671 } |
| OLD | NEW |