Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: chrome/browser/ui/browser_navigator.cc

Issue 8760024: Cross-process postMessage (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 disposition(CURRENT_TAB), 343 disposition(CURRENT_TAB),
344 transition(a_transition), 344 transition(a_transition),
345 is_renderer_initiated(false), 345 is_renderer_initiated(false),
346 tabstrip_index(-1), 346 tabstrip_index(-1),
347 tabstrip_add_types(TabStripModel::ADD_ACTIVE), 347 tabstrip_add_types(TabStripModel::ADD_ACTIVE),
348 window_action(NO_ACTION), 348 window_action(NO_ACTION),
349 user_gesture(true), 349 user_gesture(true),
350 path_behavior(RESPECT), 350 path_behavior(RESPECT),
351 ref_behavior(IGNORE_REF), 351 ref_behavior(IGNORE_REF),
352 browser(a_browser), 352 browser(a_browser),
353 profile(NULL) { 353 profile(NULL),
354 opener_browsing_instance_frame_id(-1) {
354 } 355 }
355 356
356 NavigateParams::NavigateParams(Browser* a_browser, 357 NavigateParams::NavigateParams(Browser* a_browser,
357 TabContentsWrapper* a_target_contents) 358 TabContentsWrapper* a_target_contents)
358 : target_contents(a_target_contents), 359 : target_contents(a_target_contents),
359 source_contents(NULL), 360 source_contents(NULL),
360 disposition(CURRENT_TAB), 361 disposition(CURRENT_TAB),
361 transition(content::PAGE_TRANSITION_LINK), 362 transition(content::PAGE_TRANSITION_LINK),
362 is_renderer_initiated(false), 363 is_renderer_initiated(false),
363 tabstrip_index(-1), 364 tabstrip_index(-1),
364 tabstrip_add_types(TabStripModel::ADD_ACTIVE), 365 tabstrip_add_types(TabStripModel::ADD_ACTIVE),
365 window_action(NO_ACTION), 366 window_action(NO_ACTION),
366 user_gesture(true), 367 user_gesture(true),
367 path_behavior(RESPECT), 368 path_behavior(RESPECT),
368 ref_behavior(IGNORE_REF), 369 ref_behavior(IGNORE_REF),
369 browser(a_browser), 370 browser(a_browser),
370 profile(NULL) { 371 profile(NULL),
372 opener_browsing_instance_frame_id(-1) {
371 } 373 }
372 374
373 NavigateParams::~NavigateParams() { 375 NavigateParams::~NavigateParams() {
374 } 376 }
375 377
376 void Navigate(NavigateParams* params) { 378 void Navigate(NavigateParams* params) {
377 Browser* source_browser = params->browser; 379 Browser* source_browser = params->browser;
378 380
379 if (!AdjustNavigateParamsForURL(params)) 381 if (!AdjustNavigateParamsForURL(params))
380 return; 382 return;
(...skipping 11 matching lines...) Expand all
392 if (!params->browser) 394 if (!params->browser)
393 return; 395 return;
394 396
395 // Navigate() must not return early after this point. 397 // Navigate() must not return early after this point.
396 398
397 if (GetSourceProfile(params, source_browser) != params->browser->profile()) { 399 if (GetSourceProfile(params, source_browser) != params->browser->profile()) {
398 // A tab is being opened from a link from a different profile, we must reset 400 // A tab is being opened from a link from a different profile, we must reset
399 // source information that may cause state to be shared. 401 // source information that may cause state to be shared.
400 params->source_contents = NULL; 402 params->source_contents = NULL;
401 params->referrer = GURL(); 403 params->referrer = GURL();
404 params->opener_browsing_instance_frame_id = -1;
402 } 405 }
403 406
404 // Make sure the Browser is shown if params call for it. 407 // Make sure the Browser is shown if params call for it.
405 ScopedBrowserDisplayer displayer(params); 408 ScopedBrowserDisplayer displayer(params);
406 409
407 // Makes sure any TabContents created by this function is destroyed if 410 // Makes sure any TabContents created by this function is destroyed if
408 // not properly added to a tab strip. 411 // not properly added to a tab strip.
409 ScopedTargetContentsOwner target_contents_owner(params); 412 ScopedTargetContentsOwner target_contents_owner(params);
410 413
411 // Some dispositions need coercion to base types. 414 // Some dispositions need coercion to base types.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 InitializeExtraHeaders(params, params->target_contents->profile(), 497 InitializeExtraHeaders(params, params->target_contents->profile(),
495 &extra_headers); 498 &extra_headers);
496 499
497 // Try to handle non-navigational URLs that popup dialogs and such, these 500 // Try to handle non-navigational URLs that popup dialogs and such, these
498 // should not actually navigate. 501 // should not actually navigate.
499 if (!HandleNonNavigationAboutURL(url)) { 502 if (!HandleNonNavigationAboutURL(url)) {
500 // Perform the actual navigation, tracking whether it came from the 503 // Perform the actual navigation, tracking whether it came from the
501 // renderer. 504 // renderer.
502 if (params->is_renderer_initiated) { 505 if (params->is_renderer_initiated) {
503 params->target_contents->controller().LoadURLFromRenderer( 506 params->target_contents->controller().LoadURLFromRenderer(
504 url, params->referrer, params->transition, extra_headers); 507 url, params->referrer, params->transition, extra_headers,
508 params->opener_browsing_instance_frame_id);
505 } else { 509 } else {
506 params->target_contents->controller().LoadURL( 510 params->target_contents->controller().LoadURL(
507 url, params->referrer, params->transition, extra_headers); 511 url, params->referrer, params->transition, extra_headers,
512 params->opener_browsing_instance_frame_id);
508 } 513 }
509 } 514 }
510 } else { 515 } else {
511 // |target_contents| was specified non-NULL, and so we assume it has already 516 // |target_contents| was specified non-NULL, and so we assume it has already
512 // been navigated appropriately. We need to do nothing more other than 517 // been navigated appropriately. We need to do nothing more other than
513 // add it to the appropriate tabstrip. 518 // add it to the appropriate tabstrip.
514 } 519 }
515 520
516 // If the user navigated from the omnibox, and the selected tab is going to 521 // If the user navigated from the omnibox, and the selected tab is going to
517 // lose focus, then make sure the focus for the source tab goes away from the 522 // lose focus, then make sure the focus for the source tab goes away from the
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 // chrome://settings. 631 // chrome://settings.
627 632
628 return !(url.scheme() == chrome::kChromeUIScheme && 633 return !(url.scheme() == chrome::kChromeUIScheme &&
629 (url.host() == chrome::kChromeUISettingsHost || 634 (url.host() == chrome::kChromeUISettingsHost ||
630 url.host() == chrome::kChromeUIExtensionsHost || 635 url.host() == chrome::kChromeUIExtensionsHost ||
631 url.host() == chrome::kChromeUIBookmarksHost || 636 url.host() == chrome::kChromeUIBookmarksHost ||
632 url.host() == chrome::kChromeUISyncPromoHost)); 637 url.host() == chrome::kChromeUISyncPromoHost));
633 } 638 }
634 639
635 } // namespace browser 640 } // namespace browser
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698