OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 #include "app/animation.h" | 7 #include "app/animation.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 if (!find_bar_controller_.get()) { | 264 if (!find_bar_controller_.get()) { |
265 FindBar* find_bar = BrowserWindow::CreateFindBar(this); | 265 FindBar* find_bar = BrowserWindow::CreateFindBar(this); |
266 find_bar_controller_.reset(new FindBarController(find_bar)); | 266 find_bar_controller_.reset(new FindBarController(find_bar)); |
267 find_bar->SetFindBarController(find_bar_controller_.get()); | 267 find_bar->SetFindBarController(find_bar_controller_.get()); |
268 find_bar_controller_->ChangeTabContents(GetSelectedTabContents()); | 268 find_bar_controller_->ChangeTabContents(GetSelectedTabContents()); |
269 find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect(), true); | 269 find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect(), true); |
270 } | 270 } |
271 return find_bar_controller_.get(); | 271 return find_bar_controller_.get(); |
272 } | 272 } |
273 | 273 |
| 274 bool Browser::HasFindBarController() const { |
| 275 return find_bar_controller_.get() != NULL; |
| 276 } |
| 277 |
274 /////////////////////////////////////////////////////////////////////////////// | 278 /////////////////////////////////////////////////////////////////////////////// |
275 // Browser, Creation Helpers: | 279 // Browser, Creation Helpers: |
276 | 280 |
277 // static | 281 // static |
278 void Browser::OpenEmptyWindow(Profile* profile) { | 282 void Browser::OpenEmptyWindow(Profile* profile) { |
279 Browser* browser = Browser::Create(profile); | 283 Browser* browser = Browser::Create(profile); |
280 browser->AddBlankTab(true); | 284 browser->AddBlankTab(true); |
281 browser->window()->Show(); | 285 browser->window()->Show(); |
282 } | 286 } |
283 | 287 |
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1770 | 1774 |
1771 // Reset the status bubble. | 1775 // Reset the status bubble. |
1772 StatusBubble* status_bubble = GetStatusBubble(); | 1776 StatusBubble* status_bubble = GetStatusBubble(); |
1773 if (status_bubble) { | 1777 if (status_bubble) { |
1774 status_bubble->Hide(); | 1778 status_bubble->Hide(); |
1775 | 1779 |
1776 // Show the loading state (if any). | 1780 // Show the loading state (if any). |
1777 status_bubble->SetStatus(GetSelectedTabContents()->GetStatusText()); | 1781 status_bubble->SetStatus(GetSelectedTabContents()->GetStatusText()); |
1778 } | 1782 } |
1779 | 1783 |
1780 if (find_bar_controller_.get()) { | 1784 if (HasFindBarController()) { |
1781 find_bar_controller_->ChangeTabContents(new_contents); | 1785 find_bar_controller_->ChangeTabContents(new_contents); |
1782 find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect(), true); | 1786 find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect(), true); |
1783 } | 1787 } |
1784 | 1788 |
1785 // Update sessions. Don't force creation of sessions. If sessions doesn't | 1789 // Update sessions. Don't force creation of sessions. If sessions doesn't |
1786 // exist, the change will be picked up by sessions when created. | 1790 // exist, the change will be picked up by sessions when created. |
1787 if (profile_->HasSessionService()) { | 1791 if (profile_->HasSessionService()) { |
1788 SessionService* session_service = profile_->GetSessionService(); | 1792 SessionService* session_service = profile_->GetSessionService(); |
1789 if (session_service && !tabstrip_model_.closing_all()) { | 1793 if (session_service && !tabstrip_model_.closing_all()) { |
1790 session_service->SetSelectedTabInWindow( | 1794 session_service->SetSelectedTabInWindow( |
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2975 /////////////////////////////////////////////////////////////////////////////// | 2979 /////////////////////////////////////////////////////////////////////////////// |
2976 // BrowserToolbarModel (private): | 2980 // BrowserToolbarModel (private): |
2977 | 2981 |
2978 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 2982 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
2979 // This |current_tab| can be NULL during the initialization of the | 2983 // This |current_tab| can be NULL during the initialization of the |
2980 // toolbar during window creation (i.e. before any tabs have been added | 2984 // toolbar during window creation (i.e. before any tabs have been added |
2981 // to the window). | 2985 // to the window). |
2982 TabContents* current_tab = browser_->GetSelectedTabContents(); | 2986 TabContents* current_tab = browser_->GetSelectedTabContents(); |
2983 return current_tab ? ¤t_tab->controller() : NULL; | 2987 return current_tab ? ¤t_tab->controller() : NULL; |
2984 } | 2988 } |
OLD | NEW |