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/browser.h" | 5 #include "chrome/browser/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 2641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2652 TabStripModel::ADD_NONE); | 2652 TabStripModel::ADD_NONE); |
2653 } | 2653 } |
2654 } | 2654 } |
2655 | 2655 |
2656 void Browser::ActivateContents(TabContents* contents) { | 2656 void Browser::ActivateContents(TabContents* contents) { |
2657 tabstrip_model_.SelectTabContentsAt( | 2657 tabstrip_model_.SelectTabContentsAt( |
2658 tabstrip_model_.GetIndexOfTabContents(contents), false); | 2658 tabstrip_model_.GetIndexOfTabContents(contents), false); |
2659 window_->Activate(); | 2659 window_->Activate(); |
2660 } | 2660 } |
2661 | 2661 |
| 2662 void Browser::DeactivateContents(TabContents* contents) { |
| 2663 window_->Deactivate(); |
| 2664 } |
| 2665 |
2662 void Browser::LoadingStateChanged(TabContents* source) { | 2666 void Browser::LoadingStateChanged(TabContents* source) { |
2663 window_->UpdateLoadingAnimations(tabstrip_model_.TabsAreLoading()); | 2667 window_->UpdateLoadingAnimations(tabstrip_model_.TabsAreLoading()); |
2664 window_->UpdateTitleBar(); | 2668 window_->UpdateTitleBar(); |
2665 | 2669 |
2666 if (source == GetSelectedTabContents()) { | 2670 if (source == GetSelectedTabContents()) { |
2667 UpdateReloadStopState(source->is_loading(), false); | 2671 UpdateReloadStopState(source->is_loading(), false); |
2668 if (GetStatusBubble()) | 2672 if (GetStatusBubble()) |
2669 GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText()); | 2673 GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText()); |
2670 | 2674 |
2671 if (source->is_loading()) | 2675 if (source->is_loading()) |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2795 } | 2799 } |
2796 | 2800 |
2797 bool Browser::TakeFocus(bool reverse) { | 2801 bool Browser::TakeFocus(bool reverse) { |
2798 NotificationService::current()->Notify( | 2802 NotificationService::current()->Notify( |
2799 NotificationType::FOCUS_RETURNED_TO_BROWSER, | 2803 NotificationType::FOCUS_RETURNED_TO_BROWSER, |
2800 Source<Browser>(this), | 2804 Source<Browser>(this), |
2801 NotificationService::NoDetails()); | 2805 NotificationService::NoDetails()); |
2802 return false; | 2806 return false; |
2803 } | 2807 } |
2804 | 2808 |
2805 void Browser::Activate() { | |
2806 window_->Activate(); | |
2807 } | |
2808 | |
2809 void Browser::Deactivate() { | |
2810 window_->Deactivate(); | |
2811 } | |
2812 | |
2813 bool Browser::IsApplication() const { | 2809 bool Browser::IsApplication() const { |
2814 return (type_ & TYPE_APP) != 0; | 2810 return (type_ & TYPE_APP) != 0; |
2815 } | 2811 } |
2816 | 2812 |
2817 void Browser::ConvertContentsToApplication(TabContents* contents) { | 2813 void Browser::ConvertContentsToApplication(TabContents* contents) { |
2818 const GURL& url = contents->controller().GetActiveEntry()->url(); | 2814 const GURL& url = contents->controller().GetActiveEntry()->url(); |
2819 std::string app_name = web_app::GenerateApplicationNameFromURL(url); | 2815 std::string app_name = web_app::GenerateApplicationNameFromURL(url); |
2820 RegisterAppPrefs(app_name); | 2816 RegisterAppPrefs(app_name); |
2821 | 2817 |
2822 DetachContents(contents); | 2818 DetachContents(contents); |
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4027 } | 4023 } |
4028 | 4024 |
4029 void Browser::TabRestoreServiceDestroyed(TabRestoreService* service) { | 4025 void Browser::TabRestoreServiceDestroyed(TabRestoreService* service) { |
4030 if (!tab_restore_service_) | 4026 if (!tab_restore_service_) |
4031 return; | 4027 return; |
4032 | 4028 |
4033 DCHECK_EQ(tab_restore_service_, service); | 4029 DCHECK_EQ(tab_restore_service_, service); |
4034 tab_restore_service_->RemoveObserver(this); | 4030 tab_restore_service_->RemoveObserver(this); |
4035 tab_restore_service_ = NULL; | 4031 tab_restore_service_ = NULL; |
4036 } | 4032 } |
OLD | NEW |