Chromium Code Reviews| 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_navigator.h" | 5 #include "chrome/browser/browser_navigator.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/browser.h" | 8 #include "chrome/browser/browser.h" |
| 9 #include "chrome/browser/browser_list.h" | 9 #include "chrome/browser/browser_list.h" |
| 10 #include "chrome/browser/browser_url_handler.h" | 10 #include "chrome/browser/browser_url_handler.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 // Calculate the WindowOpenDisposition if necessary. | 171 // Calculate the WindowOpenDisposition if necessary. |
| 172 if (params->browser->tabstrip_model()->empty() && | 172 if (params->browser->tabstrip_model()->empty() && |
| 173 (params->disposition == NEW_BACKGROUND_TAB || | 173 (params->disposition == NEW_BACKGROUND_TAB || |
| 174 params->disposition == CURRENT_TAB || | 174 params->disposition == CURRENT_TAB || |
| 175 params->disposition == SINGLETON_TAB)) { | 175 params->disposition == SINGLETON_TAB)) { |
| 176 params->disposition = NEW_FOREGROUND_TAB; | 176 params->disposition = NEW_FOREGROUND_TAB; |
| 177 } | 177 } |
| 178 if (params->browser->profile()->IsOffTheRecord() && | 178 if (params->browser->profile()->IsOffTheRecord() && |
| 179 params->disposition == OFF_THE_RECORD) { | 179 params->disposition == OFF_THE_RECORD) { |
| 180 params->disposition = NEW_FOREGROUND_TAB; | 180 params->disposition = NEW_FOREGROUND_TAB; |
| 181 params->show_window = true; | |
| 181 } | 182 } |
| 182 | 183 |
| 183 // Disposition trumps add types. ADD_SELECTED is a default, so we need to | 184 // Disposition trumps add types. ADD_SELECTED is a default, so we need to |
| 184 // remove it if disposition implies the tab is going to open in the | 185 // remove it if disposition implies the tab is going to open in the |
| 185 // background. | 186 // background. |
| 186 if (params->disposition == NEW_BACKGROUND_TAB) | 187 if (params->disposition == NEW_BACKGROUND_TAB) |
| 187 params->tabstrip_add_types &= ~TabStripModel::ADD_SELECTED; | 188 params->tabstrip_add_types &= ~TabStripModel::ADD_SELECTED; |
| 189 else if (params->disposition == NEW_FOREGROUND_TAB) | |
|
Evan Stade
2010/11/09 20:29:23
maybe NEW_FOREGROUND_TAB can be added to the dispo
sadrul
2010/11/09 20:50:54
I thought about doing a fallthrough switch-case on
Evan Stade
2010/11/09 20:56:18
what's wrong with showing the window for NEW_FOREG
sadrul
2010/11/09 21:06:39
[snip]
sadrul
2010/11/10 05:07:57
I have gone ahead and made this change. This essen
| |
| 190 params->tabstrip_add_types |= TabStripModel::ADD_SELECTED; | |
| 188 | 191 |
| 189 // Code that wants to open a new window typically expects it to be shown | 192 // Code that wants to open a new window typically expects it to be shown |
| 190 // automatically. | 193 // automatically. |
| 191 if (params->disposition == NEW_WINDOW || params->disposition == NEW_POPUP) { | 194 if (params->disposition == NEW_WINDOW || params->disposition == NEW_POPUP) { |
| 192 params->show_window = true; | 195 params->show_window = true; |
| 193 params->tabstrip_add_types |= TabStripModel::ADD_SELECTED; | 196 params->tabstrip_add_types |= TabStripModel::ADD_SELECTED; |
| 194 } | 197 } |
| 195 } | 198 } |
| 196 | 199 |
| 197 // This class makes sure the Browser object held in |params| is made visible | 200 // This class makes sure the Browser object held in |params| is made visible |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 params->transition, | 376 params->transition, |
| 374 params->tabstrip_add_types); | 377 params->tabstrip_add_types); |
| 375 // Now that the |params->target_contents| is safely owned by the target | 378 // Now that the |params->target_contents| is safely owned by the target |
| 376 // Browser's TabStripModel, we can release ownership. | 379 // Browser's TabStripModel, we can release ownership. |
| 377 target_contents_owner.ReleaseOwnership(); | 380 target_contents_owner.ReleaseOwnership(); |
| 378 } | 381 } |
| 379 } | 382 } |
| 380 } | 383 } |
| 381 | 384 |
| 382 } // namespace browser | 385 } // namespace browser |
| OLD | NEW |