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 2617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2628 TabStripModel::ADD_NONE); | 2628 TabStripModel::ADD_NONE); |
2629 } | 2629 } |
2630 } | 2630 } |
2631 | 2631 |
2632 void Browser::ActivateContents(TabContents* contents) { | 2632 void Browser::ActivateContents(TabContents* contents) { |
2633 tabstrip_model_.SelectTabContentsAt( | 2633 tabstrip_model_.SelectTabContentsAt( |
2634 tabstrip_model_.GetIndexOfTabContents(contents), false); | 2634 tabstrip_model_.GetIndexOfTabContents(contents), false); |
2635 window_->Activate(); | 2635 window_->Activate(); |
2636 } | 2636 } |
2637 | 2637 |
| 2638 void Browser::DeactivateContents(TabContents* contents) { |
| 2639 window_->Deactivate(); |
| 2640 } |
| 2641 |
2638 void Browser::LoadingStateChanged(TabContents* source) { | 2642 void Browser::LoadingStateChanged(TabContents* source) { |
2639 window_->UpdateLoadingAnimations(tabstrip_model_.TabsAreLoading()); | 2643 window_->UpdateLoadingAnimations(tabstrip_model_.TabsAreLoading()); |
2640 window_->UpdateTitleBar(); | 2644 window_->UpdateTitleBar(); |
2641 | 2645 |
2642 if (source == GetSelectedTabContents()) { | 2646 if (source == GetSelectedTabContents()) { |
2643 UpdateReloadStopState(source->is_loading(), false); | 2647 UpdateReloadStopState(source->is_loading(), false); |
2644 if (GetStatusBubble()) | 2648 if (GetStatusBubble()) |
2645 GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText()); | 2649 GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText()); |
2646 | 2650 |
2647 if (source->is_loading()) | 2651 if (source->is_loading()) |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2771 } | 2775 } |
2772 | 2776 |
2773 bool Browser::TakeFocus(bool reverse) { | 2777 bool Browser::TakeFocus(bool reverse) { |
2774 NotificationService::current()->Notify( | 2778 NotificationService::current()->Notify( |
2775 NotificationType::FOCUS_RETURNED_TO_BROWSER, | 2779 NotificationType::FOCUS_RETURNED_TO_BROWSER, |
2776 Source<Browser>(this), | 2780 Source<Browser>(this), |
2777 NotificationService::NoDetails()); | 2781 NotificationService::NoDetails()); |
2778 return false; | 2782 return false; |
2779 } | 2783 } |
2780 | 2784 |
2781 void Browser::Activate() { | |
2782 window_->Activate(); | |
2783 } | |
2784 | |
2785 void Browser::Deactivate() { | |
2786 window_->Deactivate(); | |
2787 } | |
2788 | |
2789 bool Browser::IsApplication() const { | 2785 bool Browser::IsApplication() const { |
2790 return (type_ & TYPE_APP) != 0; | 2786 return (type_ & TYPE_APP) != 0; |
2791 } | 2787 } |
2792 | 2788 |
2793 void Browser::ConvertContentsToApplication(TabContents* contents) { | 2789 void Browser::ConvertContentsToApplication(TabContents* contents) { |
2794 const GURL& url = contents->controller().GetActiveEntry()->url(); | 2790 const GURL& url = contents->controller().GetActiveEntry()->url(); |
2795 std::string app_name = web_app::GenerateApplicationNameFromURL(url); | 2791 std::string app_name = web_app::GenerateApplicationNameFromURL(url); |
2796 RegisterAppPrefs(app_name); | 2792 RegisterAppPrefs(app_name); |
2797 | 2793 |
2798 DetachContents(contents); | 2794 DetachContents(contents); |
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4135 } | 4131 } |
4136 | 4132 |
4137 bool Browser::IsPinned(TabContents* source) { | 4133 bool Browser::IsPinned(TabContents* source) { |
4138 int index = tabstrip_model_.GetIndexOfTabContents(source); | 4134 int index = tabstrip_model_.GetIndexOfTabContents(source); |
4139 if (index == TabStripModel::kNoTab) { | 4135 if (index == TabStripModel::kNoTab) { |
4140 NOTREACHED() << "IsPinned called for tab not in our strip"; | 4136 NOTREACHED() << "IsPinned called for tab not in our strip"; |
4141 return false; | 4137 return false; |
4142 } | 4138 } |
4143 return tabstrip_model_.IsTabPinned(index); | 4139 return tabstrip_model_.IsTabPinned(index); |
4144 } | 4140 } |
OLD | NEW |