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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 #include "chrome/browser/lifetime/application_lifetime.h" | 63 #include "chrome/browser/lifetime/application_lifetime.h" |
64 #include "chrome/browser/notifications/notification_ui_manager.h" | 64 #include "chrome/browser/notifications/notification_ui_manager.h" |
65 #include "chrome/browser/pepper_broker_infobar_delegate.h" | 65 #include "chrome/browser/pepper_broker_infobar_delegate.h" |
66 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 66 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
67 #include "chrome/browser/profiles/profile.h" | 67 #include "chrome/browser/profiles/profile.h" |
68 #include "chrome/browser/profiles/profile_destroyer.h" | 68 #include "chrome/browser/profiles/profile_destroyer.h" |
69 #include "chrome/browser/profiles/profile_metrics.h" | 69 #include "chrome/browser/profiles/profile_metrics.h" |
70 #include "chrome/browser/profiles/profiles_state.h" | 70 #include "chrome/browser/profiles/profiles_state.h" |
71 #include "chrome/browser/repost_form_warning_controller.h" | 71 #include "chrome/browser/repost_form_warning_controller.h" |
72 #include "chrome/browser/search/search.h" | 72 #include "chrome/browser/search/search.h" |
| 73 #include "chrome/browser/sessions/session_restore.h" |
73 #include "chrome/browser/sessions/session_service.h" | 74 #include "chrome/browser/sessions/session_service.h" |
74 #include "chrome/browser/sessions/session_service_factory.h" | 75 #include "chrome/browser/sessions/session_service_factory.h" |
75 #include "chrome/browser/sessions/session_tab_helper.h" | 76 #include "chrome/browser/sessions/session_tab_helper.h" |
76 #include "chrome/browser/sessions/tab_restore_service.h" | 77 #include "chrome/browser/sessions/tab_restore_service.h" |
77 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 78 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
78 #include "chrome/browser/sync/profile_sync_service.h" | 79 #include "chrome/browser/sync/profile_sync_service.h" |
79 #include "chrome/browser/sync/profile_sync_service_factory.h" | 80 #include "chrome/browser/sync/profile_sync_service_factory.h" |
80 #include "chrome/browser/sync/sync_ui_util.h" | 81 #include "chrome/browser/sync/sync_ui_util.h" |
81 #include "chrome/browser/tab_contents/retargeting_details.h" | 82 #include "chrome/browser/tab_contents/retargeting_details.h" |
82 #include "chrome/browser/tab_contents/tab_util.h" | 83 #include "chrome/browser/tab_contents/tab_util.h" |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 // Show the loading state (if any). | 1065 // Show the loading state (if any). |
1065 status_bubble->SetStatus(CoreTabHelper::FromWebContents( | 1066 status_bubble->SetStatus(CoreTabHelper::FromWebContents( |
1066 tab_strip_model_->GetActiveWebContents())->GetStatusText()); | 1067 tab_strip_model_->GetActiveWebContents())->GetStatusText()); |
1067 } | 1068 } |
1068 | 1069 |
1069 if (HasFindBarController()) { | 1070 if (HasFindBarController()) { |
1070 find_bar_controller_->ChangeWebContents(new_contents); | 1071 find_bar_controller_->ChangeWebContents(new_contents); |
1071 find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect()); | 1072 find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect()); |
1072 } | 1073 } |
1073 | 1074 |
1074 // Update sessions. Don't force creation of sessions. If sessions doesn't | 1075 // Update sessions (selected tab index and last active time). Don't force |
1075 // exist, the change will be picked up by sessions when created. | 1076 // creation of sessions. If sessions doesn't exist, the change will be picked |
| 1077 // up by sessions when created. |
1076 SessionService* session_service = | 1078 SessionService* session_service = |
1077 SessionServiceFactory::GetForProfileIfExisting(profile_); | 1079 SessionServiceFactory::GetForProfileIfExisting(profile_); |
1078 if (session_service && !tab_strip_model_->closing_all()) { | 1080 if (session_service && !tab_strip_model_->closing_all()) { |
1079 session_service->SetSelectedTabInWindow(session_id(), | 1081 session_service->SetSelectedTabInWindow(session_id(), |
1080 tab_strip_model_->active_index()); | 1082 tab_strip_model_->active_index()); |
| 1083 if (SessionRestore::GetSmartRestoreMode() == |
| 1084 SessionRestore::SMART_RESTORE_MODE_MRU) { |
| 1085 SessionTabHelper* session_tab_helper = |
| 1086 SessionTabHelper::FromWebContents(new_contents); |
| 1087 session_service->SetLastActiveTime(session_id(), |
| 1088 session_tab_helper->session_id(), |
| 1089 base::TimeTicks::Now()); |
| 1090 } |
1081 } | 1091 } |
1082 | 1092 |
1083 // This needs to be called after notifying SearchDelegate. | 1093 // This needs to be called after notifying SearchDelegate. |
1084 if (instant_controller_) | 1094 if (instant_controller_) |
1085 instant_controller_->ActiveTabChanged(); | 1095 instant_controller_->ActiveTabChanged(); |
1086 | 1096 |
1087 autofill::ChromeAutofillClient::FromWebContents(new_contents)->TabActivated(); | 1097 autofill::ChromeAutofillClient::FromWebContents(new_contents)->TabActivated(); |
1088 SearchTabHelper::FromWebContents(new_contents)->OnTabActivated(); | 1098 SearchTabHelper::FromWebContents(new_contents)->OnTabActivated(); |
1089 } | 1099 } |
1090 | 1100 |
(...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2603 if (contents && !allow_js_access) { | 2613 if (contents && !allow_js_access) { |
2604 contents->web_contents()->GetController().LoadURL( | 2614 contents->web_contents()->GetController().LoadURL( |
2605 target_url, | 2615 target_url, |
2606 content::Referrer(), | 2616 content::Referrer(), |
2607 ui::PAGE_TRANSITION_LINK, | 2617 ui::PAGE_TRANSITION_LINK, |
2608 std::string()); // No extra headers. | 2618 std::string()); // No extra headers. |
2609 } | 2619 } |
2610 | 2620 |
2611 return contents != NULL; | 2621 return contents != NULL; |
2612 } | 2622 } |
OLD | NEW |