OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_navigator.h" | 5 #include "chrome/browser/ui/browser_navigator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "chrome/browser/browser_about_handler.h" | 10 #include "chrome/browser/browser_about_handler.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 : url(a_url), | 286 : url(a_url), |
287 target_contents(NULL), | 287 target_contents(NULL), |
288 source_contents(NULL), | 288 source_contents(NULL), |
289 disposition(CURRENT_TAB), | 289 disposition(CURRENT_TAB), |
290 transition(a_transition), | 290 transition(a_transition), |
291 tabstrip_index(-1), | 291 tabstrip_index(-1), |
292 tabstrip_add_types(TabStripModel::ADD_ACTIVE), | 292 tabstrip_add_types(TabStripModel::ADD_ACTIVE), |
293 window_action(NO_ACTION), | 293 window_action(NO_ACTION), |
294 user_gesture(true), | 294 user_gesture(true), |
295 path_behavior(RESPECT), | 295 path_behavior(RESPECT), |
296 ref_behavior(IGNORE_REF), | |
296 browser(a_browser), | 297 browser(a_browser), |
297 profile(NULL) { | 298 profile(NULL) { |
298 } | 299 } |
299 | 300 |
300 NavigateParams::NavigateParams(Browser* a_browser, | 301 NavigateParams::NavigateParams(Browser* a_browser, |
301 TabContentsWrapper* a_target_contents) | 302 TabContentsWrapper* a_target_contents) |
302 : target_contents(a_target_contents), | 303 : target_contents(a_target_contents), |
303 source_contents(NULL), | 304 source_contents(NULL), |
304 disposition(CURRENT_TAB), | 305 disposition(CURRENT_TAB), |
305 transition(PageTransition::LINK), | 306 transition(PageTransition::LINK), |
306 tabstrip_index(-1), | 307 tabstrip_index(-1), |
307 tabstrip_add_types(TabStripModel::ADD_ACTIVE), | 308 tabstrip_add_types(TabStripModel::ADD_ACTIVE), |
308 window_action(NO_ACTION), | 309 window_action(NO_ACTION), |
309 user_gesture(true), | 310 user_gesture(true), |
310 path_behavior(RESPECT), | 311 path_behavior(RESPECT), |
312 ref_behavior(IGNORE_REF), | |
311 browser(a_browser), | 313 browser(a_browser), |
312 profile(NULL) { | 314 profile(NULL) { |
313 } | 315 } |
314 | 316 |
315 NavigateParams::~NavigateParams() { | 317 NavigateParams::~NavigateParams() { |
316 } | 318 } |
317 | 319 |
318 void Navigate(NavigateParams* params) { | 320 void Navigate(NavigateParams* params) { |
319 Browser* source_browser = params->browser; | 321 Browser* source_browser = params->browser; |
320 AdjustNavigateParamsForURL(params); | 322 AdjustNavigateParamsForURL(params); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
494 | 496 |
495 // If there are several matches: prefer the active tab by starting there. | 497 // If there are several matches: prefer the active tab by starting there. |
496 int start_index = std::max(0, params->browser->active_index()); | 498 int start_index = std::max(0, params->browser->active_index()); |
497 int tab_count = params->browser->tab_count(); | 499 int tab_count = params->browser->tab_count(); |
498 for (int i = 0; i < tab_count; ++i) { | 500 for (int i = 0; i < tab_count; ++i) { |
499 int tab_index = (start_index + i) % tab_count; | 501 int tab_index = (start_index + i) % tab_count; |
500 TabContentsWrapper* tab = | 502 TabContentsWrapper* tab = |
501 params->browser->GetTabContentsWrapperAt(tab_index); | 503 params->browser->GetTabContentsWrapperAt(tab_index); |
502 | 504 |
503 url_canon::Replacements<char> replacements; | 505 url_canon::Replacements<char> replacements; |
504 replacements.ClearRef(); | 506 if (params->ref_behavior == browser::NavigateParams::IGNORE_REF) |
Greg Billock
2011/08/23 23:38:48
Can you add a browser_navigator_browsertest for th
tbarzic
2011/08/24 00:02:58
will do
| |
507 replacements.ClearRef(); | |
505 if (params->path_behavior == browser::NavigateParams::IGNORE_AND_NAVIGATE || | 508 if (params->path_behavior == browser::NavigateParams::IGNORE_AND_NAVIGATE || |
506 params->path_behavior == browser::NavigateParams::IGNORE_AND_STAY_PUT) { | 509 params->path_behavior == browser::NavigateParams::IGNORE_AND_STAY_PUT) { |
507 replacements.ClearPath(); | 510 replacements.ClearPath(); |
508 replacements.ClearQuery(); | 511 replacements.ClearQuery(); |
509 } | 512 } |
510 | 513 |
511 if (CompareURLsWithReplacements(tab->tab_contents()->GetURL(), | 514 if (CompareURLsWithReplacements(tab->tab_contents()->GetURL(), |
512 params->url, replacements) || | 515 params->url, replacements) || |
513 CompareURLsWithReplacements(tab->tab_contents()->GetURL(), | 516 CompareURLsWithReplacements(tab->tab_contents()->GetURL(), |
514 rewritten_url, replacements)) { | 517 rewritten_url, replacements)) { |
515 params->target_contents = tab; | 518 params->target_contents = tab; |
516 return tab_index; | 519 return tab_index; |
517 } | 520 } |
518 } | 521 } |
519 | 522 |
520 return -1; | 523 return -1; |
521 } | 524 } |
522 | 525 |
523 } // namespace browser | 526 } // namespace browser |
OLD | NEW |