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/ui/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" |
| 11 #include "chrome/browser/browser_window.h" | 11 #include "chrome/browser/browser_window.h" |
| 12 #include "chrome/browser/location_bar.h" | 12 #include "chrome/browser/location_bar.h" |
| 13 #include "chrome/browser/profile.h" | 13 #include "chrome/browser/profile.h" |
| 14 #include "chrome/browser/renderer_host/site_instance.h" | 14 #include "chrome/browser/renderer_host/site_instance.h" |
| 15 #include "chrome/browser/status_bubble.h" | 15 #include "chrome/browser/status_bubble.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 } | 181 } |
| 182 | 182 |
| 183 // Disposition trumps add types. ADD_SELECTED is a default, so we need to | 183 switch (params->disposition) { |
| 184 // remove it if disposition implies the tab is going to open in the | 184 case NEW_BACKGROUND_TAB: |
| 185 // background. | 185 // Disposition trumps add types. ADD_SELECTED is a default, so we need to |
| 186 if (params->disposition == NEW_BACKGROUND_TAB) | 186 // remove it if disposition implies the tab is going to open in the |
| 187 params->tabstrip_add_types &= ~TabStripModel::ADD_SELECTED; | 187 // background. |
| 188 params->tabstrip_add_types &= ~TabStripModel::ADD_SELECTED; | |
| 189 break; | |
| 188 | 190 |
| 189 // Code that wants to open a new window typically expects it to be shown | 191 case NEW_WINDOW: |
| 190 // automatically. | 192 case NEW_POPUP: |
| 191 if (params->disposition == NEW_WINDOW || params->disposition == NEW_POPUP) { | 193 case NEW_FOREGROUND_TAB: |
|
Ben Goodger (Google)
2010/11/10 18:43:38
What are the other implications of this? There are
sadrul
2010/11/10 18:50:31
Are there tests/scenarios I could try to reproduce
| |
| 192 params->show_window = true; | 194 case SINGLETON_TAB: |
| 193 params->tabstrip_add_types |= TabStripModel::ADD_SELECTED; | 195 // Code that wants to open a new window typically expects it to be shown |
| 196 // automatically. | |
| 197 params->show_window = true; | |
| 198 params->tabstrip_add_types |= TabStripModel::ADD_SELECTED; | |
| 199 break; | |
| 200 | |
| 201 default: | |
|
sky
2010/11/10 19:18:47
Can you deal with OFF_THE_RECORD mode too? I was g
sadrul
2010/11/10 19:25:08
I think you are referring to bug 62022? In which c
sky
2010/11/10 19:30:12
2010/11/10 19:25:08, sadrul wrote:
| |
| 202 break; | |
| 194 } | 203 } |
| 195 } | 204 } |
| 196 | 205 |
| 197 // This class makes sure the Browser object held in |params| is made visible | 206 // This class makes sure the Browser object held in |params| is made visible |
| 198 // by the time it goes out of scope, provided |params| wants it to be shown. | 207 // by the time it goes out of scope, provided |params| wants it to be shown. |
| 199 class ScopedBrowserDisplayer { | 208 class ScopedBrowserDisplayer { |
| 200 public: | 209 public: |
| 201 explicit ScopedBrowserDisplayer(browser::NavigateParams* params) | 210 explicit ScopedBrowserDisplayer(browser::NavigateParams* params) |
| 202 : params_(params) { | 211 : params_(params) { |
| 203 } | 212 } |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 params->transition, | 382 params->transition, |
| 374 params->tabstrip_add_types); | 383 params->tabstrip_add_types); |
| 375 // Now that the |params->target_contents| is safely owned by the target | 384 // Now that the |params->target_contents| is safely owned by the target |
| 376 // Browser's TabStripModel, we can release ownership. | 385 // Browser's TabStripModel, we can release ownership. |
| 377 target_contents_owner.ReleaseOwnership(); | 386 target_contents_owner.ReleaseOwnership(); |
| 378 } | 387 } |
| 379 } | 388 } |
| 380 } | 389 } |
| 381 | 390 |
| 382 } // namespace browser | 391 } // namespace browser |
| OLD | NEW |