| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // OS_WIN | 10 #endif // OS_WIN |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 // Sever the WebContents' connection back to us. | 1038 // Sever the WebContents' connection back to us. |
| 1039 SetAsDelegate(contents->web_contents(), NULL); | 1039 SetAsDelegate(contents->web_contents(), NULL); |
| 1040 } | 1040 } |
| 1041 | 1041 |
| 1042 void Browser::TabDetachedAt(TabContents* contents, int index) { | 1042 void Browser::TabDetachedAt(TabContents* contents, int index) { |
| 1043 TabDetachedAtImpl(contents, index, DETACH_TYPE_DETACH); | 1043 TabDetachedAtImpl(contents, index, DETACH_TYPE_DETACH); |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 void Browser::TabDeactivated(TabContents* contents) { | 1046 void Browser::TabDeactivated(TabContents* contents) { |
| 1047 fullscreen_controller_->OnTabDeactivated(contents); | 1047 fullscreen_controller_->OnTabDeactivated(contents); |
| 1048 search_delegate_->OnTabDeactivated(contents); | 1048 search_delegate_->OnTabDeactivated(contents->web_contents()); |
| 1049 | 1049 |
| 1050 // Save what the user's currently typing, so it can be restored when we | 1050 // Save what the user's currently typing, so it can be restored when we |
| 1051 // switch back to this tab. | 1051 // switch back to this tab. |
| 1052 window_->GetLocationBar()->SaveStateToContents(contents->web_contents()); | 1052 window_->GetLocationBar()->SaveStateToContents(contents->web_contents()); |
| 1053 } | 1053 } |
| 1054 | 1054 |
| 1055 void Browser::ActiveTabChanged(TabContents* old_contents, | 1055 void Browser::ActiveTabChanged(TabContents* old_contents, |
| 1056 TabContents* new_contents, | 1056 TabContents* new_contents, |
| 1057 int index, | 1057 int index, |
| 1058 bool user_gesture) { | 1058 bool user_gesture) { |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1906 /////////////////////////////////////////////////////////////////////////////// | 1906 /////////////////////////////////////////////////////////////////////////////// |
| 1907 // Browser, UI update coalescing and handling (private): | 1907 // Browser, UI update coalescing and handling (private): |
| 1908 | 1908 |
| 1909 void Browser::UpdateToolbar(bool should_restore_state) { | 1909 void Browser::UpdateToolbar(bool should_restore_state) { |
| 1910 window_->UpdateToolbar(chrome::GetActiveTabContents(this), | 1910 window_->UpdateToolbar(chrome::GetActiveTabContents(this), |
| 1911 should_restore_state); | 1911 should_restore_state); |
| 1912 } | 1912 } |
| 1913 | 1913 |
| 1914 void Browser::UpdateSearchState(TabContents* contents) { | 1914 void Browser::UpdateSearchState(TabContents* contents) { |
| 1915 if (chrome::search::IsInstantExtendedAPIEnabled(profile_)) | 1915 if (chrome::search::IsInstantExtendedAPIEnabled(profile_)) |
| 1916 search_delegate_->OnTabActivated(contents); | 1916 search_delegate_->OnTabActivated(contents->web_contents()); |
| 1917 } | 1917 } |
| 1918 | 1918 |
| 1919 void Browser::ScheduleUIUpdate(const WebContents* source, | 1919 void Browser::ScheduleUIUpdate(const WebContents* source, |
| 1920 unsigned changed_flags) { | 1920 unsigned changed_flags) { |
| 1921 if (!source) | 1921 if (!source) |
| 1922 return; | 1922 return; |
| 1923 | 1923 |
| 1924 // Do some synchronous updates. | 1924 // Do some synchronous updates. |
| 1925 if (changed_flags & content::INVALIDATE_TYPE_URL && | 1925 if (changed_flags & content::INVALIDATE_TYPE_URL && |
| 1926 source == chrome::GetActiveWebContents(this)) { | 1926 source == chrome::GetActiveWebContents(this)) { |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2121 } | 2121 } |
| 2122 | 2122 |
| 2123 SetAsDelegate(contents->web_contents(), NULL); | 2123 SetAsDelegate(contents->web_contents(), NULL); |
| 2124 RemoveScheduledUpdatesFor(contents->web_contents()); | 2124 RemoveScheduledUpdatesFor(contents->web_contents()); |
| 2125 | 2125 |
| 2126 if (find_bar_controller_.get() && index == active_index()) { | 2126 if (find_bar_controller_.get() && index == active_index()) { |
| 2127 find_bar_controller_->ChangeTabContents(NULL); | 2127 find_bar_controller_->ChangeTabContents(NULL); |
| 2128 } | 2128 } |
| 2129 | 2129 |
| 2130 // Stop observing search model changes for this tab. | 2130 // Stop observing search model changes for this tab. |
| 2131 search_delegate_->OnTabDetached(contents); | 2131 search_delegate_->OnTabDetached(contents->web_contents()); |
| 2132 | 2132 |
| 2133 registrar_.Remove(this, content::NOTIFICATION_INTERSTITIAL_ATTACHED, | 2133 registrar_.Remove(this, content::NOTIFICATION_INTERSTITIAL_ATTACHED, |
| 2134 content::Source<WebContents>(contents->web_contents())); | 2134 content::Source<WebContents>(contents->web_contents())); |
| 2135 registrar_.Remove(this, content::NOTIFICATION_INTERSTITIAL_DETACHED, | 2135 registrar_.Remove(this, content::NOTIFICATION_INTERSTITIAL_DETACHED, |
| 2136 content::Source<WebContents>(contents->web_contents())); | 2136 content::Source<WebContents>(contents->web_contents())); |
| 2137 } | 2137 } |
| 2138 | 2138 |
| 2139 bool Browser::SupportsWindowFeatureImpl(WindowFeature feature, | 2139 bool Browser::SupportsWindowFeatureImpl(WindowFeature feature, |
| 2140 bool check_fullscreen) const { | 2140 bool check_fullscreen) const { |
| 2141 // On Mac, fullscreen mode has most normal things (in a slide-down panel). On | 2141 // On Mac, fullscreen mode has most normal things (in a slide-down panel). On |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2281 if (contents && !allow_js_access) { | 2281 if (contents && !allow_js_access) { |
| 2282 contents->web_contents()->GetController().LoadURL( | 2282 contents->web_contents()->GetController().LoadURL( |
| 2283 target_url, | 2283 target_url, |
| 2284 content::Referrer(), | 2284 content::Referrer(), |
| 2285 content::PAGE_TRANSITION_LINK, | 2285 content::PAGE_TRANSITION_LINK, |
| 2286 std::string()); // No extra headers. | 2286 std::string()); // No extra headers. |
| 2287 } | 2287 } |
| 2288 | 2288 |
| 2289 return contents != NULL; | 2289 return contents != NULL; |
| 2290 } | 2290 } |
| OLD | NEW |