Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: chrome/browser/ui/browser_tab_restore_service_delegate.cc

Issue 1343833002: Abstract content::SessionStorageNamespace from core TabRestore code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@extension_tab_helper
Patch Set: Response to review Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/browser_tab_restore_service_delegate.h ('k') | components/sessions.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "chrome/browser/ui/browser_window.h" 11 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" 12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "components/sessions/content/content_tab_client_data.h"
13 #include "content/public/browser/navigation_controller.h" 14 #include "content/public/browser/navigation_controller.h"
15 #include "content/public/browser/session_storage_namespace.h"
14 16
15 using content::NavigationController; 17 using content::NavigationController;
16 using content::SessionStorageNamespace; 18 using content::SessionStorageNamespace;
17 using content::WebContents; 19 using content::WebContents;
18 20
19 void BrowserTabRestoreServiceDelegate::ShowBrowserWindow() { 21 void BrowserTabRestoreServiceDelegate::ShowBrowserWindow() {
20 browser_->window()->Show(); 22 browser_->window()->Show();
21 } 23 }
22 24
23 const SessionID& BrowserTabRestoreServiceDelegate::GetSessionID() const { 25 const SessionID& BrowserTabRestoreServiceDelegate::GetSessionID() const {
(...skipping 19 matching lines...) Expand all
43 45
44 WebContents* BrowserTabRestoreServiceDelegate::GetActiveWebContents() const { 46 WebContents* BrowserTabRestoreServiceDelegate::GetActiveWebContents() const {
45 return browser_->tab_strip_model()->GetActiveWebContents(); 47 return browser_->tab_strip_model()->GetActiveWebContents();
46 } 48 }
47 49
48 bool BrowserTabRestoreServiceDelegate::IsTabPinned(int index) const { 50 bool BrowserTabRestoreServiceDelegate::IsTabPinned(int index) const {
49 return browser_->tab_strip_model()->IsTabPinned(index); 51 return browser_->tab_strip_model()->IsTabPinned(index);
50 } 52 }
51 53
52 WebContents* BrowserTabRestoreServiceDelegate::AddRestoredTab( 54 WebContents* BrowserTabRestoreServiceDelegate::AddRestoredTab(
53 const std::vector<sessions::SerializedNavigationEntry>& navigations, 55 const std::vector<sessions::SerializedNavigationEntry>& navigations,
54 int tab_index, 56 int tab_index,
55 int selected_navigation, 57 int selected_navigation,
56 const std::string& extension_app_id, 58 const std::string& extension_app_id,
57 bool select, 59 bool select,
58 bool pin, 60 bool pin,
59 bool from_last_session, 61 bool from_last_session,
60 SessionStorageNamespace* storage_namespace, 62 const sessions::TabClientData* tab_client_data,
61 const std::string& user_agent_override) { 63 const std::string& user_agent_override) {
64 SessionStorageNamespace* storage_namespace =
65 tab_client_data
66 ? static_cast<const sessions::ContentTabClientData*>(tab_client_data)
67 ->session_storage_namespace()
68 : nullptr;
62 return chrome::AddRestoredTab(browser_, navigations, tab_index, 69 return chrome::AddRestoredTab(browser_, navigations, tab_index,
63 selected_navigation, extension_app_id, select, 70 selected_navigation, extension_app_id, select,
64 pin, from_last_session, storage_namespace, 71 pin, from_last_session, storage_namespace,
65 user_agent_override); 72 user_agent_override);
66 } 73 }
67 74
68 WebContents* BrowserTabRestoreServiceDelegate::ReplaceRestoredTab( 75 WebContents* BrowserTabRestoreServiceDelegate::ReplaceRestoredTab(
69 const std::vector<sessions::SerializedNavigationEntry>& navigations, 76 const std::vector<sessions::SerializedNavigationEntry>& navigations,
70 int selected_navigation, 77 int selected_navigation,
71 bool from_last_session, 78 bool from_last_session,
72 const std::string& extension_app_id, 79 const std::string& extension_app_id,
73 SessionStorageNamespace* session_storage_namespace, 80 const sessions::TabClientData* tab_client_data,
74 const std::string& user_agent_override) { 81 const std::string& user_agent_override) {
82 SessionStorageNamespace* storage_namespace =
83 tab_client_data
84 ? static_cast<const sessions::ContentTabClientData*>(tab_client_data)
85 ->session_storage_namespace()
86 : nullptr;
75 return chrome::ReplaceRestoredTab(browser_, navigations, selected_navigation, 87 return chrome::ReplaceRestoredTab(browser_, navigations, selected_navigation,
76 from_last_session, extension_app_id, 88 from_last_session, extension_app_id,
77 session_storage_namespace, user_agent_override); 89 storage_namespace, user_agent_override);
78 } 90 }
79 91
80 void BrowserTabRestoreServiceDelegate::CloseTab() { 92 void BrowserTabRestoreServiceDelegate::CloseTab() {
81 chrome::CloseTab(browser_); 93 chrome::CloseTab(browser_);
82 } 94 }
83 95
84 // static 96 // static
85 TabRestoreServiceDelegate* BrowserTabRestoreServiceDelegate::Create( 97 TabRestoreServiceDelegate* BrowserTabRestoreServiceDelegate::Create(
86 Profile* profile, 98 Profile* profile,
87 chrome::HostDesktopType host_desktop_type, 99 chrome::HostDesktopType host_desktop_type,
(...skipping 23 matching lines...) Expand all
111 } 123 }
112 124
113 // static 125 // static
114 TabRestoreServiceDelegate* BrowserTabRestoreServiceDelegate::FindDelegateWithID( 126 TabRestoreServiceDelegate* BrowserTabRestoreServiceDelegate::FindDelegateWithID(
115 SessionID::id_type desired_id, 127 SessionID::id_type desired_id,
116 chrome::HostDesktopType host_desktop_type) { 128 chrome::HostDesktopType host_desktop_type) {
117 Browser* browser = chrome::FindBrowserWithID(desired_id); 129 Browser* browser = chrome::FindBrowserWithID(desired_id);
118 return (browser && browser->host_desktop_type() == host_desktop_type) ? 130 return (browser && browser->host_desktop_type() == host_desktop_type) ?
119 browser->tab_restore_service_delegate() : NULL; 131 browser->tab_restore_service_delegate() : NULL;
120 } 132 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_tab_restore_service_delegate.h ('k') | components/sessions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698