| 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_tab_restore_service_delegate.h" | 5 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/browser_commands.h" | 8 #include "chrome/browser/ui/browser_commands.h" |
| 9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
| 10 #include "chrome/browser/ui/browser_tabrestore.h" | 10 #include "chrome/browser/ui/browser_tabrestore.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 WebContents* BrowserTabRestoreServiceDelegate::GetActiveWebContents() const { | 44 WebContents* BrowserTabRestoreServiceDelegate::GetActiveWebContents() const { |
| 45 return browser_->tab_strip_model()->GetActiveWebContents(); | 45 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool BrowserTabRestoreServiceDelegate::IsTabPinned(int index) const { | 48 bool BrowserTabRestoreServiceDelegate::IsTabPinned(int index) const { |
| 49 return browser_->tab_strip_model()->IsTabPinned(index); | 49 return browser_->tab_strip_model()->IsTabPinned(index); |
| 50 } | 50 } |
| 51 | 51 |
| 52 WebContents* BrowserTabRestoreServiceDelegate::AddRestoredTab( | 52 WebContents* BrowserTabRestoreServiceDelegate::AddRestoredTab( |
| 53 const std::vector<sessions::SerializedNavigationEntry>& navigations, | 53 const std::vector<sessions::SerializedNavigationEntry>& navigations, |
| 54 int tab_index, | 54 int tab_index, |
| 55 int selected_navigation, | 55 int selected_navigation, |
| 56 const std::string& extension_app_id, | 56 const std::string& extension_app_id, |
| 57 bool select, | 57 bool select, |
| 58 bool pin, | 58 bool pin, |
| 59 bool from_last_session, | 59 bool from_last_session, |
| 60 SessionStorageNamespace* storage_namespace, | 60 SessionStorageNamespace* storage_namespace, |
| 61 const std::string& user_agent_override) { | 61 const std::string& user_agent_override, |
| 62 return chrome::AddRestoredTab(browser_, navigations, tab_index, | 62 const int64& sync_id) { |
| 63 selected_navigation, extension_app_id, select, | 63 return chrome::AddRestoredTab(browser_, |
| 64 pin, from_last_session, storage_namespace, | 64 navigations, |
| 65 user_agent_override); | 65 tab_index, |
| 66 selected_navigation, |
| 67 extension_app_id, |
| 68 select, |
| 69 pin, |
| 70 from_last_session, |
| 71 storage_namespace, |
| 72 user_agent_override, |
| 73 sync_id); |
| 66 } | 74 } |
| 67 | 75 |
| 68 void BrowserTabRestoreServiceDelegate::ReplaceRestoredTab( | 76 void BrowserTabRestoreServiceDelegate::ReplaceRestoredTab( |
| 69 const std::vector<sessions::SerializedNavigationEntry>& navigations, | 77 const std::vector<sessions::SerializedNavigationEntry>& navigations, |
| 70 int selected_navigation, | 78 int selected_navigation, |
| 71 bool from_last_session, | 79 bool from_last_session, |
| 72 const std::string& extension_app_id, | 80 const std::string& extension_app_id, |
| 73 SessionStorageNamespace* session_storage_namespace, | 81 SessionStorageNamespace* session_storage_namespace, |
| 74 const std::string& user_agent_override) { | 82 const std::string& user_agent_override, |
| 75 chrome::ReplaceRestoredTab(browser_, navigations, selected_navigation, | 83 const int64& sync_id) { |
| 76 from_last_session, extension_app_id, | 84 chrome::ReplaceRestoredTab(browser_, |
| 77 session_storage_namespace, user_agent_override); | 85 navigations, |
| 86 selected_navigation, |
| 87 from_last_session, |
| 88 extension_app_id, |
| 89 session_storage_namespace, |
| 90 user_agent_override, |
| 91 sync_id); |
| 78 } | 92 } |
| 79 | 93 |
| 80 void BrowserTabRestoreServiceDelegate::CloseTab() { | 94 void BrowserTabRestoreServiceDelegate::CloseTab() { |
| 81 chrome::CloseTab(browser_); | 95 chrome::CloseTab(browser_); |
| 82 } | 96 } |
| 83 | 97 |
| 84 // Implementations of TabRestoreServiceDelegate static methods | 98 // Implementations of TabRestoreServiceDelegate static methods |
| 85 | 99 |
| 86 // static | 100 // static |
| 87 TabRestoreServiceDelegate* TabRestoreServiceDelegate::Create( | 101 TabRestoreServiceDelegate* TabRestoreServiceDelegate::Create( |
| (...skipping 24 matching lines...) Expand all Loading... |
| 112 } | 126 } |
| 113 | 127 |
| 114 // static | 128 // static |
| 115 TabRestoreServiceDelegate* TabRestoreServiceDelegate::FindDelegateWithID( | 129 TabRestoreServiceDelegate* TabRestoreServiceDelegate::FindDelegateWithID( |
| 116 SessionID::id_type desired_id, | 130 SessionID::id_type desired_id, |
| 117 chrome::HostDesktopType host_desktop_type) { | 131 chrome::HostDesktopType host_desktop_type) { |
| 118 Browser* browser = chrome::FindBrowserWithID(desired_id); | 132 Browser* browser = chrome::FindBrowserWithID(desired_id); |
| 119 return (browser && browser->host_desktop_type() == host_desktop_type) ? | 133 return (browser && browser->host_desktop_type() == host_desktop_type) ? |
| 120 browser->tab_restore_service_delegate() : NULL; | 134 browser->tab_restore_service_delegate() : NULL; |
| 121 } | 135 } |
| OLD | NEW |