| 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 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 | 1382 |
| 1383 bool Browser::TakeFocus(content::WebContents* source, | 1383 bool Browser::TakeFocus(content::WebContents* source, |
| 1384 bool reverse) { | 1384 bool reverse) { |
| 1385 content::NotificationService::current()->Notify( | 1385 content::NotificationService::current()->Notify( |
| 1386 chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, | 1386 chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, |
| 1387 content::Source<Browser>(this), | 1387 content::Source<Browser>(this), |
| 1388 content::NotificationService::NoDetails()); | 1388 content::NotificationService::NoDetails()); |
| 1389 return false; | 1389 return false; |
| 1390 } | 1390 } |
| 1391 | 1391 |
| 1392 bool Browser::IsApplication() const { | |
| 1393 return is_app(); | |
| 1394 } | |
| 1395 | |
| 1396 gfx::Rect Browser::GetRootWindowResizerRect() const { | 1392 gfx::Rect Browser::GetRootWindowResizerRect() const { |
| 1397 return window_->GetRootWindowResizerRect(); | 1393 return window_->GetRootWindowResizerRect(); |
| 1398 } | 1394 } |
| 1399 | 1395 |
| 1400 void Browser::BeforeUnloadFired(WebContents* web_contents, | 1396 void Browser::BeforeUnloadFired(WebContents* web_contents, |
| 1401 bool proceed, | 1397 bool proceed, |
| 1402 bool* proceed_to_fire_unload) { | 1398 bool* proceed_to_fire_unload) { |
| 1403 *proceed_to_fire_unload = | 1399 *proceed_to_fire_unload = |
| 1404 unload_controller_->BeforeUnloadFired(web_contents, proceed); | 1400 unload_controller_->BeforeUnloadFired(web_contents, proceed); |
| 1405 } | 1401 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 TabContents* tab_contents = chrome::GetTabContentsAt(this, | 1467 TabContents* tab_contents = chrome::GetTabContentsAt(this, |
| 1472 tab_strip_model_->GetIndexOfWebContents(source)); | 1468 tab_strip_model_->GetIndexOfWebContents(source)); |
| 1473 chrome::ViewSource(this, tab_contents, frame_url, frame_content_state); | 1469 chrome::ViewSource(this, tab_contents, frame_url, frame_content_state); |
| 1474 } | 1470 } |
| 1475 | 1471 |
| 1476 void Browser::ShowRepostFormWarningDialog(WebContents* source) { | 1472 void Browser::ShowRepostFormWarningDialog(WebContents* source) { |
| 1477 chrome::ShowTabModalConfirmDialog(new RepostFormWarningController(source), | 1473 chrome::ShowTabModalConfirmDialog(new RepostFormWarningController(source), |
| 1478 TabContents::FromWebContents(source)); | 1474 TabContents::FromWebContents(source)); |
| 1479 } | 1475 } |
| 1480 | 1476 |
| 1481 bool Browser::ShouldAddNavigationToHistory( | |
| 1482 const history::HistoryAddPageArgs& add_page_args, | |
| 1483 content::NavigationType navigation_type) { | |
| 1484 // Don't update history if running as app. | |
| 1485 return !IsApplication(); | |
| 1486 } | |
| 1487 | |
| 1488 bool Browser::ShouldCreateWebContents( | 1477 bool Browser::ShouldCreateWebContents( |
| 1489 WebContents* web_contents, | 1478 WebContents* web_contents, |
| 1490 int route_id, | 1479 int route_id, |
| 1491 WindowContainerType window_container_type, | 1480 WindowContainerType window_container_type, |
| 1492 const string16& frame_name, | 1481 const string16& frame_name, |
| 1493 const GURL& target_url) { | 1482 const GURL& target_url) { |
| 1494 if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { | 1483 if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { |
| 1495 // If a BackgroundContents is created, suppress the normal WebContents. | 1484 // If a BackgroundContents is created, suppress the normal WebContents. |
| 1496 return !MaybeCreateBackgroundContents( | 1485 return !MaybeCreateBackgroundContents( |
| 1497 route_id, web_contents, frame_name, target_url); | 1486 route_id, web_contents, frame_name, target_url); |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2291 if (contents && !allow_js_access) { | 2280 if (contents && !allow_js_access) { |
| 2292 contents->web_contents()->GetController().LoadURL( | 2281 contents->web_contents()->GetController().LoadURL( |
| 2293 target_url, | 2282 target_url, |
| 2294 content::Referrer(), | 2283 content::Referrer(), |
| 2295 content::PAGE_TRANSITION_LINK, | 2284 content::PAGE_TRANSITION_LINK, |
| 2296 std::string()); // No extra headers. | 2285 std::string()); // No extra headers. |
| 2297 } | 2286 } |
| 2298 | 2287 |
| 2299 return contents != NULL; | 2288 return contents != NULL; |
| 2300 } | 2289 } |
| OLD | NEW |