| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_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 "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 return browser->host_desktop_type(); | 391 return browser->host_desktop_type(); |
| 392 return chrome::GetActiveDesktop(); | 392 return chrome::GetActiveDesktop(); |
| 393 } | 393 } |
| 394 | 394 |
| 395 } // namespace | 395 } // namespace |
| 396 | 396 |
| 397 namespace chrome { | 397 namespace chrome { |
| 398 | 398 |
| 399 NavigateParams::NavigateParams(Browser* a_browser, | 399 NavigateParams::NavigateParams(Browser* a_browser, |
| 400 const GURL& a_url, | 400 const GURL& a_url, |
| 401 content::PageTransition a_transition) | 401 ui::PageTransition a_transition) |
| 402 : url(a_url), | 402 : url(a_url), |
| 403 frame_tree_node_id(-1), | 403 frame_tree_node_id(-1), |
| 404 uses_post(false), | 404 uses_post(false), |
| 405 target_contents(NULL), | 405 target_contents(NULL), |
| 406 source_contents(NULL), | 406 source_contents(NULL), |
| 407 disposition(CURRENT_TAB), | 407 disposition(CURRENT_TAB), |
| 408 trusted_source(false), | 408 trusted_source(false), |
| 409 transition(a_transition), | 409 transition(a_transition), |
| 410 is_renderer_initiated(false), | 410 is_renderer_initiated(false), |
| 411 tabstrip_index(-1), | 411 tabstrip_index(-1), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 422 } | 422 } |
| 423 | 423 |
| 424 NavigateParams::NavigateParams(Browser* a_browser, | 424 NavigateParams::NavigateParams(Browser* a_browser, |
| 425 WebContents* a_target_contents) | 425 WebContents* a_target_contents) |
| 426 : frame_tree_node_id(-1), | 426 : frame_tree_node_id(-1), |
| 427 uses_post(false), | 427 uses_post(false), |
| 428 target_contents(a_target_contents), | 428 target_contents(a_target_contents), |
| 429 source_contents(NULL), | 429 source_contents(NULL), |
| 430 disposition(CURRENT_TAB), | 430 disposition(CURRENT_TAB), |
| 431 trusted_source(false), | 431 trusted_source(false), |
| 432 transition(content::PAGE_TRANSITION_LINK), | 432 transition(ui::PAGE_TRANSITION_LINK), |
| 433 is_renderer_initiated(false), | 433 is_renderer_initiated(false), |
| 434 tabstrip_index(-1), | 434 tabstrip_index(-1), |
| 435 tabstrip_add_types(TabStripModel::ADD_ACTIVE), | 435 tabstrip_add_types(TabStripModel::ADD_ACTIVE), |
| 436 window_action(NO_ACTION), | 436 window_action(NO_ACTION), |
| 437 user_gesture(true), | 437 user_gesture(true), |
| 438 path_behavior(RESPECT), | 438 path_behavior(RESPECT), |
| 439 ref_behavior(IGNORE_REF), | 439 ref_behavior(IGNORE_REF), |
| 440 browser(a_browser), | 440 browser(a_browser), |
| 441 initiating_profile(NULL), | 441 initiating_profile(NULL), |
| 442 host_desktop_type(GetHostDesktop(a_browser)), | 442 host_desktop_type(GetHostDesktop(a_browser)), |
| 443 should_replace_current_entry(false), | 443 should_replace_current_entry(false), |
| 444 should_set_opener(false) { | 444 should_set_opener(false) { |
| 445 } | 445 } |
| 446 | 446 |
| 447 NavigateParams::NavigateParams(Profile* a_profile, | 447 NavigateParams::NavigateParams(Profile* a_profile, |
| 448 const GURL& a_url, | 448 const GURL& a_url, |
| 449 content::PageTransition a_transition) | 449 ui::PageTransition a_transition) |
| 450 : url(a_url), | 450 : url(a_url), |
| 451 frame_tree_node_id(-1), | 451 frame_tree_node_id(-1), |
| 452 uses_post(false), | 452 uses_post(false), |
| 453 target_contents(NULL), | 453 target_contents(NULL), |
| 454 source_contents(NULL), | 454 source_contents(NULL), |
| 455 disposition(NEW_FOREGROUND_TAB), | 455 disposition(NEW_FOREGROUND_TAB), |
| 456 trusted_source(false), | 456 trusted_source(false), |
| 457 transition(a_transition), | 457 transition(a_transition), |
| 458 is_renderer_initiated(false), | 458 is_renderer_initiated(false), |
| 459 tabstrip_index(-1), | 459 tabstrip_index(-1), |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 | 570 |
| 571 // If we create a popup window from a non user-gesture, don't activate it. | 571 // If we create a popup window from a non user-gesture, don't activate it. |
| 572 if (params->window_action == NavigateParams::SHOW_WINDOW && | 572 if (params->window_action == NavigateParams::SHOW_WINDOW && |
| 573 params->disposition == NEW_POPUP && | 573 params->disposition == NEW_POPUP && |
| 574 params->user_gesture == false) { | 574 params->user_gesture == false) { |
| 575 params->window_action = NavigateParams::SHOW_WINDOW_INACTIVE; | 575 params->window_action = NavigateParams::SHOW_WINDOW_INACTIVE; |
| 576 } | 576 } |
| 577 | 577 |
| 578 // Determine if the navigation was user initiated. If it was, we need to | 578 // Determine if the navigation was user initiated. If it was, we need to |
| 579 // inform the target WebContents, and we may need to update the UI. | 579 // inform the target WebContents, and we may need to update the UI. |
| 580 content::PageTransition base_transition = | 580 ui::PageTransition base_transition = |
| 581 content::PageTransitionStripQualifier(params->transition); | 581 ui::PageTransitionStripQualifier(params->transition); |
| 582 bool user_initiated = | 582 bool user_initiated = |
| 583 params->transition & content::PAGE_TRANSITION_FROM_ADDRESS_BAR || | 583 params->transition & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR || |
| 584 base_transition == content::PAGE_TRANSITION_TYPED || | 584 base_transition == ui::PAGE_TRANSITION_TYPED || |
| 585 base_transition == content::PAGE_TRANSITION_AUTO_BOOKMARK || | 585 base_transition == ui::PAGE_TRANSITION_AUTO_BOOKMARK || |
| 586 base_transition == content::PAGE_TRANSITION_GENERATED || | 586 base_transition == ui::PAGE_TRANSITION_GENERATED || |
| 587 base_transition == content::PAGE_TRANSITION_AUTO_TOPLEVEL || | 587 base_transition == ui::PAGE_TRANSITION_AUTO_TOPLEVEL || |
| 588 base_transition == content::PAGE_TRANSITION_RELOAD || | 588 base_transition == ui::PAGE_TRANSITION_RELOAD || |
| 589 base_transition == content::PAGE_TRANSITION_KEYWORD; | 589 base_transition == ui::PAGE_TRANSITION_KEYWORD; |
| 590 | 590 |
| 591 // Check if this is a singleton tab that already exists | 591 // Check if this is a singleton tab that already exists |
| 592 int singleton_index = chrome::GetIndexOfSingletonTab(params); | 592 int singleton_index = chrome::GetIndexOfSingletonTab(params); |
| 593 | 593 |
| 594 // Did we use a prerender? | 594 // Did we use a prerender? |
| 595 bool swapped_in_prerender = false; | 595 bool swapped_in_prerender = false; |
| 596 | 596 |
| 597 // If no target WebContents was specified, we need to construct one if | 597 // If no target WebContents was specified, we need to construct one if |
| 598 // we are supposed to target a new tab; unless it's a singleton that already | 598 // we are supposed to target a new tab; unless it's a singleton that already |
| 599 // exists. | 599 // exists. |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 bool reverse_on_redirect = false; | 757 bool reverse_on_redirect = false; |
| 758 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 758 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( |
| 759 &rewritten_url, browser_context, &reverse_on_redirect); | 759 &rewritten_url, browser_context, &reverse_on_redirect); |
| 760 | 760 |
| 761 // Some URLs are mapped to uber subpages. Do not allow them in incognito. | 761 // Some URLs are mapped to uber subpages. Do not allow them in incognito. |
| 762 return !(rewritten_url.scheme() == content::kChromeUIScheme && | 762 return !(rewritten_url.scheme() == content::kChromeUIScheme && |
| 763 rewritten_url.host() == chrome::kChromeUIUberHost); | 763 rewritten_url.host() == chrome::kChromeUIUberHost); |
| 764 } | 764 } |
| 765 | 765 |
| 766 } // namespace chrome | 766 } // namespace chrome |
| OLD | NEW |