| 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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 | 1021 |
| 1022 TabContents* Browser::AddBlankTab(bool foreground) { | 1022 TabContents* Browser::AddBlankTab(bool foreground) { |
| 1023 return AddBlankTabAt(-1, foreground); | 1023 return AddBlankTabAt(-1, foreground); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 TabContents* Browser::AddBlankTabAt(int index, bool foreground) { | 1026 TabContents* Browser::AddBlankTabAt(int index, bool foreground) { |
| 1027 // Time new tab page creation time. We keep track of the timing data in | 1027 // Time new tab page creation time. We keep track of the timing data in |
| 1028 // WebContents, but we want to include the time it takes to create the | 1028 // WebContents, but we want to include the time it takes to create the |
| 1029 // WebContents object too. | 1029 // WebContents object too. |
| 1030 base::TimeTicks new_tab_start_time = base::TimeTicks::Now(); | 1030 base::TimeTicks new_tab_start_time = base::TimeTicks::Now(); |
| 1031 browser::NavigateParams params(this, GURL(chrome::kChromeUINewTabURL), | 1031 chrome::NavigateParams params(this, GURL(chrome::kChromeUINewTabURL), |
| 1032 content::PAGE_TRANSITION_TYPED); | 1032 content::PAGE_TRANSITION_TYPED); |
| 1033 params.disposition = foreground ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB; | 1033 params.disposition = foreground ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB; |
| 1034 params.tabstrip_index = index; | 1034 params.tabstrip_index = index; |
| 1035 browser::Navigate(¶ms); | 1035 chrome::Navigate(¶ms); |
| 1036 params.target_contents->web_contents()->SetNewTabStartTime( | 1036 params.target_contents->web_contents()->SetNewTabStartTime( |
| 1037 new_tab_start_time); | 1037 new_tab_start_time); |
| 1038 return params.target_contents; | 1038 return params.target_contents; |
| 1039 } | 1039 } |
| 1040 | 1040 |
| 1041 Browser* Browser::CreateNewStripWithContents( | 1041 Browser* Browser::CreateNewStripWithContents( |
| 1042 TabContents* detached_contents, | 1042 TabContents* detached_contents, |
| 1043 const gfx::Rect& window_bounds, | 1043 const gfx::Rect& window_bounds, |
| 1044 const DockInfo& dock_info, | 1044 const DockInfo& dock_info, |
| 1045 bool maximize) { | 1045 bool maximize) { |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1462 return PanelManager::GetInstance()->CreatePanel(this)->browser_window(); | 1462 return PanelManager::GetInstance()->CreatePanel(this)->browser_window(); |
| 1463 | 1463 |
| 1464 return BrowserWindow::CreateBrowserWindow(this); | 1464 return BrowserWindow::CreateBrowserWindow(this); |
| 1465 } | 1465 } |
| 1466 | 1466 |
| 1467 /////////////////////////////////////////////////////////////////////////////// | 1467 /////////////////////////////////////////////////////////////////////////////// |
| 1468 // Browser, content::WebContentsDelegate implementation: | 1468 // Browser, content::WebContentsDelegate implementation: |
| 1469 | 1469 |
| 1470 WebContents* Browser::OpenURLFromTab(WebContents* source, | 1470 WebContents* Browser::OpenURLFromTab(WebContents* source, |
| 1471 const OpenURLParams& params) { | 1471 const OpenURLParams& params) { |
| 1472 browser::NavigateParams nav_params(this, params.url, params.transition); | 1472 chrome::NavigateParams nav_params(this, params.url, params.transition); |
| 1473 nav_params.source_contents = chrome::GetTabContentsAt(this, | 1473 nav_params.source_contents = chrome::GetTabContentsAt(this, |
| 1474 tab_strip_model_->GetIndexOfWebContents(source)); | 1474 tab_strip_model_->GetIndexOfWebContents(source)); |
| 1475 nav_params.referrer = params.referrer; | 1475 nav_params.referrer = params.referrer; |
| 1476 nav_params.disposition = params.disposition; | 1476 nav_params.disposition = params.disposition; |
| 1477 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE; | 1477 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE; |
| 1478 nav_params.window_action = browser::NavigateParams::SHOW_WINDOW; | 1478 nav_params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
| 1479 nav_params.user_gesture = true; | 1479 nav_params.user_gesture = true; |
| 1480 nav_params.override_encoding = params.override_encoding; | 1480 nav_params.override_encoding = params.override_encoding; |
| 1481 nav_params.is_renderer_initiated = params.is_renderer_initiated; | 1481 nav_params.is_renderer_initiated = params.is_renderer_initiated; |
| 1482 nav_params.transferred_global_request_id = | 1482 nav_params.transferred_global_request_id = |
| 1483 params.transferred_global_request_id; | 1483 params.transferred_global_request_id; |
| 1484 browser::Navigate(&nav_params); | 1484 chrome::Navigate(&nav_params); |
| 1485 | 1485 |
| 1486 return nav_params.target_contents ? | 1486 return nav_params.target_contents ? |
| 1487 nav_params.target_contents->web_contents() : NULL; | 1487 nav_params.target_contents->web_contents() : NULL; |
| 1488 } | 1488 } |
| 1489 | 1489 |
| 1490 void Browser::NavigationStateChanged(const WebContents* source, | 1490 void Browser::NavigationStateChanged(const WebContents* source, |
| 1491 unsigned changed_flags) { | 1491 unsigned changed_flags) { |
| 1492 // Only update the UI when something visible has changed. | 1492 // Only update the UI when something visible has changed. |
| 1493 if (changed_flags) | 1493 if (changed_flags) |
| 1494 ScheduleUIUpdate(source, changed_flags); | 1494 ScheduleUIUpdate(source, changed_flags); |
| (...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2816 if (contents && !allow_js_access) { | 2816 if (contents && !allow_js_access) { |
| 2817 contents->web_contents()->GetController().LoadURL( | 2817 contents->web_contents()->GetController().LoadURL( |
| 2818 target_url, | 2818 target_url, |
| 2819 content::Referrer(), | 2819 content::Referrer(), |
| 2820 content::PAGE_TRANSITION_LINK, | 2820 content::PAGE_TRANSITION_LINK, |
| 2821 std::string()); // No extra headers. | 2821 std::string()); // No extra headers. |
| 2822 } | 2822 } |
| 2823 | 2823 |
| 2824 return contents != NULL; | 2824 return contents != NULL; |
| 2825 } | 2825 } |
| OLD | NEW |