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