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 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 // the wrong location. | 1609 // the wrong location. |
1610 tabstrip_model_.AddTabContents(new_contents, index + 1, true, | 1610 tabstrip_model_.AddTabContents(new_contents, index + 1, true, |
1611 PageTransition::LINK, true); | 1611 PageTransition::LINK, true); |
1612 if (tabstrip_model_.IsTabPinned(index)) { | 1612 if (tabstrip_model_.IsTabPinned(index)) { |
1613 pinned = true; | 1613 pinned = true; |
1614 tabstrip_model_.SetTabPinned(index + 1, true); | 1614 tabstrip_model_.SetTabPinned(index + 1, true); |
1615 } | 1615 } |
1616 } else { | 1616 } else { |
1617 Browser* browser = NULL; | 1617 Browser* browser = NULL; |
1618 if (type_ & TYPE_APP) { | 1618 if (type_ & TYPE_APP) { |
1619 browser = Browser::CreateForApp(app_name_, profile_, type_ & TYPE_POPUP); | 1619 browser = Browser::CreateForApp(app_name_, profile_, |
| 1620 !!(type_ & TYPE_POPUP)); |
1620 } else if (type_ == TYPE_POPUP) { | 1621 } else if (type_ == TYPE_POPUP) { |
1621 browser = Browser::CreateForPopup(profile_); | 1622 browser = Browser::CreateForPopup(profile_); |
1622 } | 1623 } |
1623 | 1624 |
1624 // Preserve the size of the original window. The new window has already | 1625 // Preserve the size of the original window. The new window has already |
1625 // been given an offset by the OS, so we shouldn't copy the old bounds. | 1626 // been given an offset by the OS, so we shouldn't copy the old bounds. |
1626 BrowserWindow* new_window = browser->window(); | 1627 BrowserWindow* new_window = browser->window(); |
1627 new_window->SetBounds(gfx::Rect(new_window->GetRestoredBounds().origin(), | 1628 new_window->SetBounds(gfx::Rect(new_window->GetRestoredBounds().origin(), |
1628 window()->GetRestoredBounds().size())); | 1629 window()->GetRestoredBounds().size())); |
1629 | 1630 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1966 } | 1967 } |
1967 | 1968 |
1968 void Browser::DetachContents(TabContents* source) { | 1969 void Browser::DetachContents(TabContents* source) { |
1969 int index = tabstrip_model_.GetIndexOfTabContents(source); | 1970 int index = tabstrip_model_.GetIndexOfTabContents(source); |
1970 if (index >= 0) | 1971 if (index >= 0) |
1971 tabstrip_model_.DetachTabContentsAt(index); | 1972 tabstrip_model_.DetachTabContentsAt(index); |
1972 } | 1973 } |
1973 | 1974 |
1974 bool Browser::IsPopup(TabContents* source) { | 1975 bool Browser::IsPopup(TabContents* source) { |
1975 // A non-tabbed BROWSER is an unconstrained popup. | 1976 // A non-tabbed BROWSER is an unconstrained popup. |
1976 return (type() & TYPE_POPUP); | 1977 return !!(type() & TYPE_POPUP); |
1977 } | 1978 } |
1978 | 1979 |
1979 void Browser::ToolbarSizeChanged(TabContents* source, bool is_animating) { | 1980 void Browser::ToolbarSizeChanged(TabContents* source, bool is_animating) { |
1980 if (source == GetSelectedTabContents() || source == NULL) { | 1981 if (source == GetSelectedTabContents() || source == NULL) { |
1981 // This will refresh the shelf if needed. | 1982 // This will refresh the shelf if needed. |
1982 window_->SelectedTabToolbarSizeChanged(is_animating); | 1983 window_->SelectedTabToolbarSizeChanged(is_animating); |
1983 } | 1984 } |
1984 } | 1985 } |
1985 | 1986 |
1986 void Browser::ExtensionShelfSizeChanged() { | 1987 void Browser::ExtensionShelfSizeChanged() { |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2996 /////////////////////////////////////////////////////////////////////////////// | 2997 /////////////////////////////////////////////////////////////////////////////// |
2997 // BrowserToolbarModel (private): | 2998 // BrowserToolbarModel (private): |
2998 | 2999 |
2999 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 3000 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
3000 // This |current_tab| can be NULL during the initialization of the | 3001 // This |current_tab| can be NULL during the initialization of the |
3001 // toolbar during window creation (i.e. before any tabs have been added | 3002 // toolbar during window creation (i.e. before any tabs have been added |
3002 // to the window). | 3003 // to the window). |
3003 TabContents* current_tab = browser_->GetSelectedTabContents(); | 3004 TabContents* current_tab = browser_->GetSelectedTabContents(); |
3004 return current_tab ? ¤t_tab->controller() : NULL; | 3005 return current_tab ? ¤t_tab->controller() : NULL; |
3005 } | 3006 } |
OLD | NEW |