OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 return window_->GetRootWindowResizerRect(); | 1382 return window_->GetRootWindowResizerRect(); |
1383 } | 1383 } |
1384 | 1384 |
1385 void Browser::BeforeUnloadFired(WebContents* web_contents, | 1385 void Browser::BeforeUnloadFired(WebContents* web_contents, |
1386 bool proceed, | 1386 bool proceed, |
1387 bool* proceed_to_fire_unload) { | 1387 bool* proceed_to_fire_unload) { |
1388 *proceed_to_fire_unload = | 1388 *proceed_to_fire_unload = |
1389 unload_controller_->BeforeUnloadFired(web_contents, proceed); | 1389 unload_controller_->BeforeUnloadFired(web_contents, proceed); |
1390 } | 1390 } |
1391 | 1391 |
| 1392 bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) { |
| 1393 return source->GetURL() == GURL(chrome::kChromeUINewTabURL); |
| 1394 } |
| 1395 |
1392 void Browser::SetFocusToLocationBar(bool select_all) { | 1396 void Browser::SetFocusToLocationBar(bool select_all) { |
1393 // Two differences between this and FocusLocationBar(): | 1397 // Two differences between this and FocusLocationBar(): |
1394 // (1) This doesn't get recorded in user metrics, since it's called | 1398 // (1) This doesn't get recorded in user metrics, since it's called |
1395 // internally. | 1399 // internally. |
1396 // (2) This checks whether the location bar can be focused, and if not, clears | 1400 // (2) This checks whether the location bar can be focused, and if not, clears |
1397 // the focus. FocusLocationBar() is only reached when the location bar is | 1401 // the focus. FocusLocationBar() is only reached when the location bar is |
1398 // focusable, but this may be reached at other times, e.g. while in | 1402 // focusable, but this may be reached at other times, e.g. while in |
1399 // fullscreen mode, where we need to leave focus in a consistent state. | 1403 // fullscreen mode, where we need to leave focus in a consistent state. |
1400 window_->SetFocusToLocationBar(select_all); | 1404 window_->SetFocusToLocationBar(select_all); |
1401 } | 1405 } |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2346 if (contents && !allow_js_access) { | 2350 if (contents && !allow_js_access) { |
2347 contents->web_contents()->GetController().LoadURL( | 2351 contents->web_contents()->GetController().LoadURL( |
2348 target_url, | 2352 target_url, |
2349 content::Referrer(), | 2353 content::Referrer(), |
2350 content::PAGE_TRANSITION_LINK, | 2354 content::PAGE_TRANSITION_LINK, |
2351 std::string()); // No extra headers. | 2355 std::string()); // No extra headers. |
2352 } | 2356 } |
2353 | 2357 |
2354 return contents != NULL; | 2358 return contents != NULL; |
2355 } | 2359 } |
OLD | NEW |