| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/ui/browser_commands.h" | 5 #include "chrome/browser/ui/browser_commands.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // appropriate tab to navigate. If that tab is the current tab, reverts the | 181 // appropriate tab to navigate. If that tab is the current tab, reverts the |
| 182 // location bar contents, since all browser-UI-triggered navigations should | 182 // location bar contents, since all browser-UI-triggered navigations should |
| 183 // revert any omnibox edits in the current tab. | 183 // revert any omnibox edits in the current tab. |
| 184 WebContents* GetTabAndRevertIfNecessary(Browser* browser, | 184 WebContents* GetTabAndRevertIfNecessary(Browser* browser, |
| 185 WindowOpenDisposition disposition) { | 185 WindowOpenDisposition disposition) { |
| 186 WebContents* current_tab = browser->tab_strip_model()->GetActiveWebContents(); | 186 WebContents* current_tab = browser->tab_strip_model()->GetActiveWebContents(); |
| 187 switch (disposition) { | 187 switch (disposition) { |
| 188 case NEW_FOREGROUND_TAB: | 188 case NEW_FOREGROUND_TAB: |
| 189 case NEW_BACKGROUND_TAB: { | 189 case NEW_BACKGROUND_TAB: { |
| 190 WebContents* new_tab = current_tab->Clone(); | 190 WebContents* new_tab = current_tab->Clone(); |
| 191 if (disposition == NEW_BACKGROUND_TAB) | 191 if (disposition == NEW_BACKGROUND_TAB) { |
| 192 new_tab->WasHidden(); | 192 // TODO(tapted): WebContents::Clone() should be able to take a value for |
| 193 // CreateParams::initially_hidden. Currently, it always uses |false|. |
| 194 new_tab->MarkBackgrounded(); |
| 195 } |
| 193 browser->tab_strip_model()->AddWebContents( | 196 browser->tab_strip_model()->AddWebContents( |
| 194 new_tab, -1, ui::PAGE_TRANSITION_LINK, | 197 new_tab, -1, ui::PAGE_TRANSITION_LINK, |
| 195 (disposition == NEW_FOREGROUND_TAB) ? | 198 (disposition == NEW_FOREGROUND_TAB) ? |
| 196 TabStripModel::ADD_ACTIVE : TabStripModel::ADD_NONE); | 199 TabStripModel::ADD_ACTIVE : TabStripModel::ADD_NONE); |
| 197 return new_tab; | 200 return new_tab; |
| 198 } | 201 } |
| 199 case NEW_WINDOW: { | 202 case NEW_WINDOW: { |
| 200 WebContents* new_tab = current_tab->Clone(); | 203 WebContents* new_tab = current_tab->Clone(); |
| 201 Browser* new_browser = | 204 Browser* new_browser = |
| 202 new Browser(Browser::CreateParams(browser->profile())); | 205 new Browser(Browser::CreateParams(browser->profile())); |
| (...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); | 1296 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); |
| 1294 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1297 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1295 | 1298 |
| 1296 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1299 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1297 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1300 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1298 app_browser->window()->Show(); | 1301 app_browser->window()->Show(); |
| 1299 } | 1302 } |
| 1300 #endif // defined(ENABLE_EXTENSIONS) | 1303 #endif // defined(ENABLE_EXTENSIONS) |
| 1301 | 1304 |
| 1302 } // namespace chrome | 1305 } // namespace chrome |
| OLD | NEW |