Chromium Code Reviews| 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 if (contents_is_selected) | 2700 // Focus on the content if the window and tab are active and the call was |
| 2701 // triggered by an automated page refresh. | |
| 2702 if (user_initiated && contents_is_selected && window()->IsActive()) | |
|
sky
2012/05/21 20:42:52
Shouldn' this be an or, eg:
if (content_is_select
Mr4D (OOO till 08-26)
2012/05/21 21:27:12
Done. (Wow good catch - somehow didn't think strai
| |
| 2701 contents->web_contents()->Focus(); | 2703 contents->web_contents()->Focus(); |
| 2702 } | 2704 } |
| 2703 | 2705 |
| 2704 void Browser::ShowCollectedCookiesDialog(TabContentsWrapper* wrapper) { | 2706 void Browser::ShowCollectedCookiesDialog(TabContentsWrapper* wrapper) { |
| 2705 browser::ShowCollectedCookiesDialog(window()->GetNativeHandle(), wrapper); | 2707 browser::ShowCollectedCookiesDialog(window()->GetNativeHandle(), wrapper); |
| 2706 } | 2708 } |
| 2707 | 2709 |
| 2708 /////////////////////////////////////////////////////////////////////////////// | 2710 /////////////////////////////////////////////////////////////////////////////// |
| 2709 // Browser, PageNavigator implementation: | 2711 // Browser, PageNavigator implementation: |
| 2710 | 2712 |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3402 // Browser, content::WebContentsDelegate implementation: | 3404 // Browser, content::WebContentsDelegate implementation: |
| 3403 | 3405 |
| 3404 WebContents* Browser::OpenURLFromTab(WebContents* source, | 3406 WebContents* Browser::OpenURLFromTab(WebContents* source, |
| 3405 const OpenURLParams& params) { | 3407 const OpenURLParams& params) { |
| 3406 browser::NavigateParams nav_params(this, params.url, params.transition); | 3408 browser::NavigateParams nav_params(this, params.url, params.transition); |
| 3407 nav_params.source_contents = GetTabContentsWrapperAt( | 3409 nav_params.source_contents = GetTabContentsWrapperAt( |
| 3408 tab_strip_model_->GetWrapperIndex(source)); | 3410 tab_strip_model_->GetWrapperIndex(source)); |
| 3409 nav_params.referrer = params.referrer; | 3411 nav_params.referrer = params.referrer; |
| 3410 nav_params.disposition = params.disposition; | 3412 nav_params.disposition = params.disposition; |
| 3411 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE; | 3413 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE; |
| 3412 nav_params.window_action = browser::NavigateParams::SHOW_WINDOW; | 3414 |
| 3415 // Show the tab if either the tab and window are already active, or this | |
| 3416 // was not triggered by an update tab function (through e.g. an automated | |
| 3417 // update). | |
| 3418 if (params.disposition != CURRENT_TAB || | |
| 3419 (GetSelectedWebContents() == source && window()->IsActive())) | |
| 3420 nav_params.window_action = browser::NavigateParams::SHOW_WINDOW; | |
| 3421 | |
| 3413 nav_params.user_gesture = true; | 3422 nav_params.user_gesture = true; |
| 3414 nav_params.override_encoding = params.override_encoding; | 3423 nav_params.override_encoding = params.override_encoding; |
| 3415 nav_params.is_renderer_initiated = params.is_renderer_initiated; | 3424 nav_params.is_renderer_initiated = params.is_renderer_initiated; |
| 3416 nav_params.transferred_global_request_id = | 3425 nav_params.transferred_global_request_id = |
| 3417 params.transferred_global_request_id; | 3426 params.transferred_global_request_id; |
| 3418 browser::Navigate(&nav_params); | 3427 browser::Navigate(&nav_params); |
| 3419 | 3428 |
| 3420 return nav_params.target_contents ? | 3429 return nav_params.target_contents ? |
| 3421 nav_params.target_contents->web_contents() : NULL; | 3430 nav_params.target_contents->web_contents() : NULL; |
| 3422 } | 3431 } |
| (...skipping 2002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5425 if (contents && !allow_js_access) { | 5434 if (contents && !allow_js_access) { |
| 5426 contents->web_contents()->GetController().LoadURL( | 5435 contents->web_contents()->GetController().LoadURL( |
| 5427 target_url, | 5436 target_url, |
| 5428 content::Referrer(), | 5437 content::Referrer(), |
| 5429 content::PAGE_TRANSITION_LINK, | 5438 content::PAGE_TRANSITION_LINK, |
| 5430 std::string()); // No extra headers. | 5439 std::string()); // No extra headers. |
| 5431 } | 5440 } |
| 5432 | 5441 |
| 5433 return contents != NULL; | 5442 return contents != NULL; |
| 5434 } | 5443 } |
| OLD | NEW |