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.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 2679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2690 GetStatusBubble()->Hide(); | 2690 GetStatusBubble()->Hide(); |
2691 | 2691 |
2692 // Update the location bar. This is synchronous. We specifically don't | 2692 // Update the location bar. This is synchronous. We specifically don't |
2693 // update the load state since the load hasn't started yet and updating it | 2693 // update the load state since the load hasn't started yet and updating it |
2694 // will put it out of sync with the actual state like whether we're | 2694 // will put it out of sync with the actual state like whether we're |
2695 // displaying a favicon, which controls the throbber. If we updated it here, | 2695 // displaying a favicon, which controls the throbber. If we updated it here, |
2696 // the throbber will show the default favicon for a split second when | 2696 // the throbber will show the default favicon for a split second when |
2697 // navigating away from the new tab page. | 2697 // navigating away from the new tab page. |
2698 ScheduleUIUpdate(contents->web_contents(), content::INVALIDATE_TYPE_URL); | 2698 ScheduleUIUpdate(contents->web_contents(), content::INVALIDATE_TYPE_URL); |
2699 | 2699 |
2700 // In case of multiple windows we do not want to switch windows when this is | |
sky
2012/05/21 17:29:15
This comment is confusing.
| |
2701 // not user initiated (e.g. automatic page refresh) and the current window | |
2702 // is not the window we are targeting. | |
2703 if (!user_initiated && | |
sky
2012/05/21 17:29:15
I think you missed a comment from last round: "Com
Mr4D (OOO till 08-26)
2012/05/21 18:18:37
Ahh. In that case I have misunderstood. Done.
| |
2704 (GetSelectedWebContents() != contents->web_contents() || | |
2705 !window()->IsActive())) | |
2706 return; | |
2707 | |
2700 if (contents_is_selected) | 2708 if (contents_is_selected) |
2701 contents->web_contents()->Focus(); | 2709 contents->web_contents()->Focus(); |
2702 } | 2710 } |
2703 | 2711 |
2704 void Browser::ShowCollectedCookiesDialog(TabContentsWrapper* wrapper) { | 2712 void Browser::ShowCollectedCookiesDialog(TabContentsWrapper* wrapper) { |
2705 browser::ShowCollectedCookiesDialog(window()->GetNativeHandle(), wrapper); | 2713 browser::ShowCollectedCookiesDialog(window()->GetNativeHandle(), wrapper); |
2706 } | 2714 } |
2707 | 2715 |
2708 /////////////////////////////////////////////////////////////////////////////// | 2716 /////////////////////////////////////////////////////////////////////////////// |
2709 // Browser, PageNavigator implementation: | 2717 // Browser, PageNavigator implementation: |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3402 // Browser, content::WebContentsDelegate implementation: | 3410 // Browser, content::WebContentsDelegate implementation: |
3403 | 3411 |
3404 WebContents* Browser::OpenURLFromTab(WebContents* source, | 3412 WebContents* Browser::OpenURLFromTab(WebContents* source, |
3405 const OpenURLParams& params) { | 3413 const OpenURLParams& params) { |
3406 browser::NavigateParams nav_params(this, params.url, params.transition); | 3414 browser::NavigateParams nav_params(this, params.url, params.transition); |
3407 nav_params.source_contents = GetTabContentsWrapperAt( | 3415 nav_params.source_contents = GetTabContentsWrapperAt( |
3408 tab_strip_model_->GetWrapperIndex(source)); | 3416 tab_strip_model_->GetWrapperIndex(source)); |
3409 nav_params.referrer = params.referrer; | 3417 nav_params.referrer = params.referrer; |
3410 nav_params.disposition = params.disposition; | 3418 nav_params.disposition = params.disposition; |
3411 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE; | 3419 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE; |
3412 nav_params.window_action = browser::NavigateParams::SHOW_WINDOW; | 3420 |
3421 // If the current tab is initiating this, we don't want to update. | |
sky
2012/05/21 17:29:15
You comment doesn't match what you're doing.
Mr4D (OOO till 08-26)
2012/05/21 18:18:37
Done.
| |
3422 if (nav_params.window_action != browser::NavigateParams::NO_ACTION || | |
sky
2012/05/21 17:29:15
I don't understand this first check. The default i
Mr4D (OOO till 08-26)
2012/05/21 18:18:37
Done. Yes, that is correct (forgotten to remove th
| |
3423 params.disposition != CURRENT_TAB || | |
sky
2012/05/21 17:29:15
Why are you checking this?
Mr4D (OOO till 08-26)
2012/05/21 18:18:37
Because when a new thing (Popup / Window / Tab) ge
sky
2012/05/21 20:42:52
I believe Navigate takes care of that for you. See
Mr4D (OOO till 08-26)
2012/05/21 21:27:12
Okay, I removed the special check for the current_
| |
3424 (GetSelectedWebContents() == source && window()->IsActive())) | |
3425 nav_params.window_action = browser::NavigateParams::SHOW_WINDOW; | |
3426 | |
3413 nav_params.user_gesture = true; | 3427 nav_params.user_gesture = true; |
3414 nav_params.override_encoding = params.override_encoding; | 3428 nav_params.override_encoding = params.override_encoding; |
3415 nav_params.is_renderer_initiated = params.is_renderer_initiated; | 3429 nav_params.is_renderer_initiated = params.is_renderer_initiated; |
3416 nav_params.transferred_global_request_id = | 3430 nav_params.transferred_global_request_id = |
3417 params.transferred_global_request_id; | 3431 params.transferred_global_request_id; |
3418 browser::Navigate(&nav_params); | 3432 browser::Navigate(&nav_params); |
3419 | 3433 |
3420 return nav_params.target_contents ? | 3434 return nav_params.target_contents ? |
3421 nav_params.target_contents->web_contents() : NULL; | 3435 nav_params.target_contents->web_contents() : NULL; |
3422 } | 3436 } |
(...skipping 2002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5425 if (contents && !allow_js_access) { | 5439 if (contents && !allow_js_access) { |
5426 contents->web_contents()->GetController().LoadURL( | 5440 contents->web_contents()->GetController().LoadURL( |
5427 target_url, | 5441 target_url, |
5428 content::Referrer(), | 5442 content::Referrer(), |
5429 content::PAGE_TRANSITION_LINK, | 5443 content::PAGE_TRANSITION_LINK, |
5430 std::string()); // No extra headers. | 5444 std::string()); // No extra headers. |
5431 } | 5445 } |
5432 | 5446 |
5433 return contents != NULL; | 5447 return contents != NULL; |
5434 } | 5448 } |
OLD | NEW |