OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" |
| 6 |
| 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/browser_list.h" |
| 9 #include "chrome/browser/ui/browser_window.h" |
| 10 |
| 11 void BrowserTabRestoreServiceDelegate::ShowBrowserWindow() { |
| 12 browser_->window()->Show(); |
| 13 } |
| 14 |
| 15 const SessionID& BrowserTabRestoreServiceDelegate::GetSessionID() const { |
| 16 return browser_->session_id(); |
| 17 } |
| 18 |
| 19 int BrowserTabRestoreServiceDelegate::GetTabCount() const { |
| 20 return browser_->tab_count(); |
| 21 } |
| 22 |
| 23 int BrowserTabRestoreServiceDelegate::GetSelectedIndex() const { |
| 24 return browser_->selected_index(); |
| 25 } |
| 26 |
| 27 TabContents* BrowserTabRestoreServiceDelegate::GetTabContentsAt( |
| 28 int index) const { |
| 29 return browser_->GetTabContentsAt(index); |
| 30 } |
| 31 |
| 32 TabContents* BrowserTabRestoreServiceDelegate::GetSelectedTabContents() const |
| 33 { |
| 34 return browser_->GetSelectedTabContents(); |
| 35 } |
| 36 |
| 37 bool BrowserTabRestoreServiceDelegate::IsTabPinned(int index) const |
| 38 { |
| 39 return browser_->IsTabPinned(index); |
| 40 } |
| 41 |
| 42 TabContents* BrowserTabRestoreServiceDelegate::AddRestoredTab( |
| 43 const std::vector<TabNavigation>& navigations, |
| 44 int tab_index, |
| 45 int selected_navigation, |
| 46 const std::string& extension_app_id, |
| 47 bool select, |
| 48 bool pin, |
| 49 bool from_last_session, |
| 50 SessionStorageNamespace* storage_namespace) { |
| 51 return browser_->AddRestoredTab(navigations, tab_index, selected_navigation, |
| 52 extension_app_id, select, pin, |
| 53 from_last_session, storage_namespace); |
| 54 } |
| 55 |
| 56 void BrowserTabRestoreServiceDelegate::ReplaceRestoredTab( |
| 57 const std::vector<TabNavigation>& navigations, |
| 58 int selected_navigation, |
| 59 bool from_last_session, |
| 60 const std::string& extension_app_id, |
| 61 SessionStorageNamespace* session_storage_namespace) { |
| 62 browser_->ReplaceRestoredTab(navigations, selected_navigation, |
| 63 from_last_session, extension_app_id, |
| 64 session_storage_namespace); |
| 65 } |
| 66 |
| 67 void BrowserTabRestoreServiceDelegate::CloseTab() { |
| 68 browser_->CloseTab(); |
| 69 } |
| 70 |
| 71 // Implementations of TabRestoreServiceDelegate static methods |
| 72 |
| 73 // static |
| 74 TabRestoreServiceDelegate* TabRestoreServiceDelegate::CreateBrowser( |
| 75 Profile* profile) { |
| 76 return Browser::Create(profile)->tab_restore_service_delegate(); |
| 77 } |
| 78 |
| 79 // static |
| 80 TabRestoreServiceDelegate* TabRestoreServiceDelegate::GetBrowserForController( |
| 81 const NavigationController* controller, int* index) { |
| 82 return Browser::GetBrowserForController(controller, index)-> |
| 83 tab_restore_service_delegate(); |
| 84 } |
| 85 |
| 86 // static |
| 87 TabRestoreServiceDelegate* TabRestoreServiceDelegate::FindBrowserWithID( |
| 88 SessionID::id_type desired_id) { |
| 89 return BrowserList::FindBrowserWithID(desired_id)-> |
| 90 tab_restore_service_delegate(); |
| 91 } |
OLD | NEW |