| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 2955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2966 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerTab)) { | 2966 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerTab)) { |
| 2967 if (current_tab) { | 2967 if (current_tab) { |
| 2968 const GURL& current_url = current_tab->GetURL(); | 2968 const GURL& current_url = current_tab->GetURL(); |
| 2969 if (SiteInstance::IsSameWebSite(current_url, url)) | 2969 if (SiteInstance::IsSameWebSite(current_url, url)) |
| 2970 instance = current_tab->GetSiteInstance(); | 2970 instance = current_tab->GetSiteInstance(); |
| 2971 } | 2971 } |
| 2972 } | 2972 } |
| 2973 | 2973 |
| 2974 // If this is not a normal window (such as a popup or an application), we can | 2974 // If this is not a normal window (such as a popup or an application), we can |
| 2975 // only have one tab so a new tab always goes into a tabbed browser window. | 2975 // only have one tab so a new tab always goes into a tabbed browser window. |
| 2976 if (disposition != NEW_WINDOW && type_ != TYPE_NORMAL) { | 2976 if (type_ != TYPE_NORMAL && |
| 2977 disposition != CURRENT_TAB && |
| 2978 disposition != NEW_WINDOW) { |
| 2977 // If the disposition is OFF_THE_RECORD we don't want to create a new | 2979 // If the disposition is OFF_THE_RECORD we don't want to create a new |
| 2978 // browser that will itself create another OTR browser. This will result in | 2980 // browser that will itself create another OTR browser. This will result in |
| 2979 // a browser leak (and crash below because no tab is created or selected). | 2981 // a browser leak (and crash below because no tab is created or selected). |
| 2980 if (disposition == OFF_THE_RECORD) { | 2982 if (disposition == OFF_THE_RECORD) { |
| 2981 OpenURLOffTheRecord(profile_, url); | 2983 OpenURLOffTheRecord(profile_, url); |
| 2982 return; | 2984 return; |
| 2983 } | 2985 } |
| 2984 | 2986 |
| 2985 Browser* b = GetOrCreateTabbedBrowser(profile_); | 2987 Browser* b = GetOrCreateTabbedBrowser(profile_); |
| 2986 DCHECK(b); | 2988 DCHECK(b); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3141 /////////////////////////////////////////////////////////////////////////////// | 3143 /////////////////////////////////////////////////////////////////////////////// |
| 3142 // BrowserToolbarModel (private): | 3144 // BrowserToolbarModel (private): |
| 3143 | 3145 |
| 3144 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 3146 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
| 3145 // This |current_tab| can be NULL during the initialization of the | 3147 // This |current_tab| can be NULL during the initialization of the |
| 3146 // toolbar during window creation (i.e. before any tabs have been added | 3148 // toolbar during window creation (i.e. before any tabs have been added |
| 3147 // to the window). | 3149 // to the window). |
| 3148 TabContents* current_tab = browser_->GetSelectedTabContents(); | 3150 TabContents* current_tab = browser_->GetSelectedTabContents(); |
| 3149 return current_tab ? ¤t_tab->controller() : NULL; | 3151 return current_tab ? ¤t_tab->controller() : NULL; |
| 3150 } | 3152 } |
| OLD | NEW |