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_macros.h" | 8 #include "base/metrics/histogram_macros.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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 // open URLs with instant_controller since in some cases it disregards it | 500 // open URLs with instant_controller since in some cases it disregards it |
501 // and performs a search instead. For example, when using CTRL-Enter, the | 501 // and performs a search instead. For example, when using CTRL-Enter, the |
502 // location_bar is aware of the URL but instant is not. | 502 // location_bar is aware of the URL but instant is not. |
503 // Instant should also not handle PAGE_TRANSITION_RELOAD because its knowledge | 503 // Instant should also not handle PAGE_TRANSITION_RELOAD because its knowledge |
504 // of the omnibox text may be stale if the user focuses in the omnibox and | 504 // of the omnibox text may be stale if the user focuses in the omnibox and |
505 // presses enter without typing anything. | 505 // presses enter without typing anything. |
506 if (!ui::PageTransitionCoreTypeIs(page_transition, | 506 if (!ui::PageTransitionCoreTypeIs(page_transition, |
507 ui::PAGE_TRANSITION_TYPED) && | 507 ui::PAGE_TRANSITION_TYPED) && |
508 !ui::PageTransitionCoreTypeIs(page_transition, | 508 !ui::PageTransitionCoreTypeIs(page_transition, |
509 ui::PAGE_TRANSITION_RELOAD) && | 509 ui::PAGE_TRANSITION_RELOAD) && |
510 browser->instant_controller() && | 510 browser->instant_controller()) { |
511 browser->instant_controller()->OpenInstant(open_disposition, url)) | 511 browser->instant_controller()->OpenInstant(open_disposition, url); |
512 return; | 512 } |
513 | 513 |
514 NavigateParams params(browser, url, page_transition); | 514 NavigateParams params(browser, url, page_transition); |
515 params.disposition = open_disposition; | 515 params.disposition = open_disposition; |
516 // Use ADD_INHERIT_OPENER so that all pages opened by the omnibox at least | 516 // Use ADD_INHERIT_OPENER so that all pages opened by the omnibox at least |
517 // inherit the opener. In some cases the tabstrip will determine the group | 517 // inherit the opener. In some cases the tabstrip will determine the group |
518 // should be inherited, in which case the group is inherited instead of the | 518 // should be inherited, in which case the group is inherited instead of the |
519 // opener. | 519 // opener. |
520 params.tabstrip_add_types = | 520 params.tabstrip_add_types = |
521 TabStripModel::ADD_FORCE_INDEX | TabStripModel::ADD_INHERIT_OPENER; | 521 TabStripModel::ADD_FORCE_INDEX | TabStripModel::ADD_INHERIT_OPENER; |
522 Navigate(¶ms); | 522 Navigate(¶ms); |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); | 1292 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); |
1293 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1293 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1294 | 1294 |
1295 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1295 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1296 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1296 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1297 app_browser->window()->Show(); | 1297 app_browser->window()->Show(); |
1298 } | 1298 } |
1299 #endif // defined(ENABLE_EXTENSIONS) | 1299 #endif // defined(ENABLE_EXTENSIONS) |
1300 | 1300 |
1301 } // namespace chrome | 1301 } // namespace chrome |
OLD | NEW |