Home | History | Annotate | Download | only in sessions

Lines Matching defs:Tab

43       type(TAB),
60 // . When the user closes a tab a command of type
61 // kCommandSelectedNavigationInTab is written identifying the tab and
62 // the selected index, then a kCommandPinnedState command if the tab was
63 // pinned and kCommandSetExtensionAppID if the tab has an app id. This is
67 // is written out and followed by n tab closed sequences (as previoulsy
97 // Payload used for the start of a tab close. This is the old struct that is
110 // Payload used for the start of a tab close.
115 // Only written if the tab is pinned.
143 std::vector<TabRestoreService::Tab>::iterator j = window->tabs.begin();
155 void RecordAppLaunch(Profile* profile, const TabRestoreService::Tab& tab) {
156 GURL url = tab.navigations.at(tab.current_navigation_index).virtual_url();
168 TabRestoreService::Tab::Tab()
169 : Entry(TAB),
176 TabRestoreService::Tab::~Tab() {
216 void TabRestoreService::CreateHistoricalTab(NavigationController* tab,
222 TabRestoreServiceDelegate::FindDelegateForController(tab, NULL);
226 scoped_ptr<Tab> local_tab(new Tab());
227 PopulateTab(local_tab.get(), index, delegate, tab);
240 // Don't use std::vector::resize() because it will push copies of an empty tab
243 window->tabs.push_back(Tab());
259 // Short-circuit creating a Window if only 1 tab was present. This fixes
260 // http://crbug.com/56744. Copy the Tab because it's owned by an object on
262 AddEntry(new Tab(window->tabs[0]), true, true);
326 // entry is a window from which a single tab will be restored.
337 if (entry->type == TAB) {
338 Tab* tab = static_cast<Tab*>(entry);
339 delegate = RestoreTab(*tab, delegate, replace_existing_tab);
346 // single tab within it. If the entry's ID matches the one to restore, then
351 const Tab& tab = window->tabs[tab_i];
353 delegate->AddRestoredTab(tab.navigations, delegate->GetTabCount(),
354 tab.current_navigation_index,
355 tab.extension_app_id,
358 tab.pinned, tab.from_last_session,
359 tab.session_storage_namespace);
362 RecordAppLaunch(profile(), tab);
371 // Restore a single tab from the window. Find the tab that matches the ID
373 for (std::vector<Tab>::iterator tab_i = window->tabs.begin();
375 const Tab& tab = *tab_i;
376 if (tab.id == id) {
377 delegate = RestoreTab(tab, delegate, replace_existing_tab);
379 // If restoring the tab leaves the window with nothing else, delete it
386 // any one is restored, it goes into the same window as the tab
388 UpdateTabBrowserIDs(tab.browser_id,
390 for (std::vector<Tab>::iterator tab_j = window->tabs.begin();
461 if (entry->type == TAB) {
462 Tab* tab = static_cast<Tab*>(entry);
463 int selected_index = GetSelectedNavigationIndexToPersist(*tab);
465 ScheduleCommandsForTab(*tab, selected_index);
477 void TabRestoreService::PopulateTab(Tab* tab,
485 tab->navigations.resize(static_cast<int>(entry_count));
489 tab->navigations[i].SetFromNavigationEntry(*entry);
491 tab->timestamp = TimeNow();
492 tab->current_navigation_index = controller->GetCurrentEntryIndex();
493 if (tab->current_navigation_index == -1 && entry_count > 0)
494 tab->current_navigation_index = 0;
495 tab->tabstrip_index = index;
505 tab->extension_app_id = extension->id();
508 tab->session_storage_namespace = controller->session_storage_namespace();
512 tab->browser_id = delegate->GetSessionID().id();
513 tab->pinned = delegate->IsTabPinned(tab->tabstrip_index);
550 // For Window entries, see if the ID matches a tab. If so, report the window
553 std::vector<Tab>& tabs = static_cast<Window*>(*i)->tabs;
554 for (std::vector<Tab>::iterator j = tabs.begin();
593 void TabRestoreService::ScheduleCommandsForTab(const Tab& tab,
595 const std::vector<TabNavigation>& navigations = tab.navigations;
609 // Write the command that identifies the selected tab.
611 CreateSelectedNavigationInTabCommand(tab.id,
613 tab.timestamp));
615 if (tab.pinned) {
623 if (!tab.extension_app_id.empty()) {
625 CreateSetTabExtensionAppIDCommand(kCommandSetExtensionAppID, tab.id,
626 tab.extension_app_id));
639 CreateUpdateTabNavigationCommand(kCommandUpdateTabNavigation, tab.id,
687 int TabRestoreService::GetSelectedNavigationIndexToPersist(const Tab& tab) {
688 const std::vector<TabNavigation>& navigations = tab.navigations;
689 int selected_index = tab.current_navigation_index;
703 selected_index = tab.current_navigation_index + 1;
734 // If non-null we're processing the navigations of this tab.
735 Tab* current_tab = NULL;
787 // Should always have at least 1 tab. Likely indicates corruption.
826 current_tab = new Tab();
837 // Should be in a tab when we get this.
851 // Should be in a tab when we get this.
855 // tab is pinned.
862 // Should be in a tab when we get this.
889 const Tab& tab,
896 delegate->ReplaceRestoredTab(tab.navigations,
897 tab.current_navigation_index,
898 tab.from_last_session,
899 tab.extension_app_id,
900 tab.session_storage_namespace);
902 if (tab.has_browser())
903 delegate = TabRestoreServiceDelegate::FindDelegateWithID(tab.browser_id);
907 tab_index = tab.tabstrip_index;
910 if (tab.has_browser()) {
911 UpdateTabBrowserIDs(tab.browser_id, delegate->GetSessionID().id());
919 delegate->AddRestoredTab(tab.navigations,
921 tab.current_navigation_index,
922 tab.extension_app_id,
923 true, tabtab.from_last_session,
924 tab.session_storage_namespace);
926 RecordAppLaunch(profile(), tab);
931 bool TabRestoreService::ValidateTab(Tab* tab) {
932 if (tab->navigations.empty())
935 tab->current_navigation_index =
936 std::max(0, std::min(tab->current_navigation_index,
937 static_cast<int>(tab->navigations.size()) - 1));
952 if ((*i)->type == TAB) {
953 Tab* tab = static_cast<Tab*>(*i);
954 if (ValidateTab(tab))
958 for (std::vector<Tab>::iterator tab_i = window->tabs.begin();
989 if (entry->type == TAB) {
990 Tab* tab = static_cast<Tab*>(entry);
991 if (tab->browser_id == old_id)
992 tab->browser_id = new_id;
1025 Tab& tab = window->tabs.back();
1026 tab.pinned = session_window->tabs[i]->pinned;
1027 tab.navigations.swap(session_window->tabs[i]->navigations);
1028 tab.current_navigation_index =
1030 tab.extension_app_id = session_window->tabs[i]->extension_app_id;
1031 tab.timestamp = Time();