OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <shellapi.h> | 8 #include <shellapi.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 2646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2657 | 2657 |
2658 // Update commands to reflect current state. | 2658 // Update commands to reflect current state. |
2659 UpdateCommandsForTabState(); | 2659 UpdateCommandsForTabState(); |
2660 | 2660 |
2661 // Reset the status bubble. | 2661 // Reset the status bubble. |
2662 StatusBubble* status_bubble = GetStatusBubble(); | 2662 StatusBubble* status_bubble = GetStatusBubble(); |
2663 if (status_bubble) { | 2663 if (status_bubble) { |
2664 status_bubble->Hide(); | 2664 status_bubble->Hide(); |
2665 | 2665 |
2666 // Show the loading state (if any). | 2666 // Show the loading state (if any). |
2667 status_bubble->SetStatus(WideToUTF16Hack( | 2667 status_bubble->SetStatus(GetSelectedTabContents()->GetStatusText()); |
2668 GetSelectedTabContents()->GetStatusText())); | |
2669 } | 2668 } |
2670 | 2669 |
2671 if (HasFindBarController()) { | 2670 if (HasFindBarController()) { |
2672 find_bar_controller_->ChangeTabContents(new_contents->tab_contents()); | 2671 find_bar_controller_->ChangeTabContents(new_contents->tab_contents()); |
2673 find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect(), true); | 2672 find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect(), true); |
2674 } | 2673 } |
2675 | 2674 |
2676 // Update sessions. Don't force creation of sessions. If sessions doesn't | 2675 // Update sessions. Don't force creation of sessions. If sessions doesn't |
2677 // exist, the change will be picked up by sessions when created. | 2676 // exist, the change will be picked up by sessions when created. |
2678 if (profile_->HasSessionService()) { | 2677 if (profile_->HasSessionService()) { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2824 | 2823 |
2825 void Browser::LoadingStateChanged(TabContents* source) { | 2824 void Browser::LoadingStateChanged(TabContents* source) { |
2826 window_->UpdateLoadingAnimations( | 2825 window_->UpdateLoadingAnimations( |
2827 tab_handler_->GetTabStripModel()->TabsAreLoading()); | 2826 tab_handler_->GetTabStripModel()->TabsAreLoading()); |
2828 window_->UpdateTitleBar(); | 2827 window_->UpdateTitleBar(); |
2829 | 2828 |
2830 TabContents* selected_contents = GetSelectedTabContents(); | 2829 TabContents* selected_contents = GetSelectedTabContents(); |
2831 if (source == selected_contents) { | 2830 if (source == selected_contents) { |
2832 UpdateReloadStopState(source->is_loading(), false); | 2831 UpdateReloadStopState(source->is_loading(), false); |
2833 if (GetStatusBubble()) { | 2832 if (GetStatusBubble()) { |
2834 GetStatusBubble()->SetStatus(WideToUTF16( | 2833 GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText()); |
2835 GetSelectedTabContents()->GetStatusText())); | |
2836 } | 2834 } |
2837 | 2835 |
2838 if (!source->is_loading() && | 2836 if (!source->is_loading() && |
2839 pending_web_app_action_ == UPDATE_SHORTCUT) { | 2837 pending_web_app_action_ == UPDATE_SHORTCUT) { |
2840 // Schedule a shortcut update when web application info is available if | 2838 // Schedule a shortcut update when web application info is available if |
2841 // last committed entry is not NULL. Last committed entry could be NULL | 2839 // last committed entry is not NULL. Last committed entry could be NULL |
2842 // when an interstitial page is injected (e.g. bad https certificate, | 2840 // when an interstitial page is injected (e.g. bad https certificate, |
2843 // malware site etc). When this happens, we abort the shortcut update. | 2841 // malware site etc). When this happens, we abort the shortcut update. |
2844 NavigationEntry* entry = source->controller().GetLastCommittedEntry(); | 2842 NavigationEntry* entry = source->controller().GetLastCommittedEntry(); |
2845 if (entry) { | 2843 if (entry) { |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3780 unsigned flags = i->second; | 3778 unsigned flags = i->second; |
3781 | 3779 |
3782 if (contents == GetSelectedTabContents()) { | 3780 if (contents == GetSelectedTabContents()) { |
3783 // Updates that only matter when the tab is selected go here. | 3781 // Updates that only matter when the tab is selected go here. |
3784 | 3782 |
3785 if (flags & TabContents::INVALIDATE_PAGE_ACTIONS) | 3783 if (flags & TabContents::INVALIDATE_PAGE_ACTIONS) |
3786 window()->GetLocationBar()->UpdatePageActions(); | 3784 window()->GetLocationBar()->UpdatePageActions(); |
3787 | 3785 |
3788 // Updating the URL happens synchronously in ScheduleUIUpdate. | 3786 // Updating the URL happens synchronously in ScheduleUIUpdate. |
3789 if (flags & TabContents::INVALIDATE_LOAD && GetStatusBubble()) | 3787 if (flags & TabContents::INVALIDATE_LOAD && GetStatusBubble()) |
3790 GetStatusBubble()->SetStatus(WideToUTF16(contents->GetStatusText())); | 3788 GetStatusBubble()->SetStatus(contents->GetStatusText()); |
3791 | 3789 |
3792 if (flags & (TabContents::INVALIDATE_TAB | | 3790 if (flags & (TabContents::INVALIDATE_TAB | |
3793 TabContents::INVALIDATE_TITLE)) { | 3791 TabContents::INVALIDATE_TITLE)) { |
3794 // TODO(pinkerton): Disable app-mode in the model until we implement it | 3792 // TODO(pinkerton): Disable app-mode in the model until we implement it |
3795 // on the Mac. Be sure to remove both ifdefs. http://crbug.com/13148 | 3793 // on the Mac. Be sure to remove both ifdefs. http://crbug.com/13148 |
3796 #if !defined(OS_MACOSX) | 3794 #if !defined(OS_MACOSX) |
3797 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, | 3795 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, |
3798 web_app::IsValidUrl(contents->GetURL())); | 3796 web_app::IsValidUrl(contents->GetURL())); |
3799 #endif | 3797 #endif |
3800 window_->UpdateTitleBar(); | 3798 window_->UpdateTitleBar(); |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4250 // The page transition below is only for the purpose of inserting the tab. | 4248 // The page transition below is only for the purpose of inserting the tab. |
4251 browser->AddTab(view_source_contents, PageTransition::LINK); | 4249 browser->AddTab(view_source_contents, PageTransition::LINK); |
4252 } | 4250 } |
4253 | 4251 |
4254 if (profile_->HasSessionService()) { | 4252 if (profile_->HasSessionService()) { |
4255 SessionService* session_service = profile_->GetSessionService(); | 4253 SessionService* session_service = profile_->GetSessionService(); |
4256 if (session_service) | 4254 if (session_service) |
4257 session_service->TabRestored(&view_source_contents->controller(), false); | 4255 session_service->TabRestored(&view_source_contents->controller(), false); |
4258 } | 4256 } |
4259 } | 4257 } |
OLD | NEW |