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

Unified Diff: chrome/browser/sessions/persistent_tab_restore_service.cc

Issue 672083002: Refactoring of SessionService to get componentized. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First version Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sessions/persistent_tab_restore_service.cc
diff --git a/chrome/browser/sessions/persistent_tab_restore_service.cc b/chrome/browser/sessions/persistent_tab_restore_service.cc
index f0be5620b3c17c876b15f9e72351441ba5563451..21cacdee9095150594591c16e0fa6d381f84efe7 100644
--- a/chrome/browser/sessions/persistent_tab_restore_service.cc
+++ b/chrome/browser/sessions/persistent_tab_restore_service.cc
@@ -19,6 +19,7 @@
#include "base/time/time.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/base_session_service.h"
+#include "chrome/browser/sessions/base_session_service_commands.h"
#include "chrome/browser/sessions/base_session_service_delegate_impl.h"
#include "chrome/browser/sessions/session_command.h"
#include "chrome/browser/sessions/session_service.h"
@@ -116,6 +117,7 @@ const size_t kMaxEntries = TabRestoreServiceHelper::kMaxEntries;
// Implements the link between the tab restore service and the session backend.
class PersistentTabRestoreService::Delegate
: public BaseSessionService,
+ public BaseSessionServiceCommands,
public TabRestoreServiceHelper::Observer {
public:
explicit Delegate(Profile* profile);
@@ -413,10 +415,9 @@ void PersistentTabRestoreService::Delegate::ScheduleCommandsForWindow(
window.timestamp));
if (!window.app_name.empty()) {
- ScheduleCommand(
- CreateSetWindowAppNameCommand(kCommandSetWindowAppName,
- window.id,
- window.app_name));
+ ScheduleCommand(CreateSetWindowAppNameCommand(kCommandSetWindowAppName,
+ window.id,
+ window.app_name));
}
for (size_t i = 0; i < window.tabs.size(); ++i) {
@@ -459,24 +460,26 @@ void PersistentTabRestoreService::Delegate::ScheduleCommandsForTab(
}
if (!tab.extension_app_id.empty()) {
- ScheduleCommand(
- CreateSetTabExtensionAppIDCommand(kCommandSetExtensionAppID, tab.id,
- tab.extension_app_id));
+ ScheduleCommand(CreateSetTabExtensionAppIDCommand(kCommandSetExtensionAppID,
+ tab.id,
+ tab.extension_app_id));
}
if (!tab.user_agent_override.empty()) {
- ScheduleCommand(
- CreateSetTabUserAgentOverrideCommand(kCommandSetTabUserAgentOverride,
- tab.id, tab.user_agent_override));
+ ScheduleCommand(CreateSetTabUserAgentOverrideCommand(
+ kCommandSetTabUserAgentOverride,
+ tab.id,
+ tab.user_agent_override));
}
// Then write the navigations.
for (int i = first_index_to_persist, wrote_count = 0;
i < max_index && wrote_count < 2 * max_persist_navigation_count; ++i) {
if (ShouldTrackEntry(navigations[i].virtual_url())) {
- ScheduleCommand(
- CreateUpdateTabNavigationCommand(kCommandUpdateTabNavigation, tab.id,
- navigations[i]));
+ ScheduleCommand(CreateUpdateTabNavigationCommand(
+ kCommandUpdateTabNavigation,
+ tab.id,
+ navigations[i]));
}
}
}
@@ -686,8 +689,9 @@ void PersistentTabRestoreService::Delegate::CreateEntriesFromCommands(
}
current_tab->navigations.resize(current_tab->navigations.size() + 1);
SessionID::id_type tab_id;
- if (!RestoreUpdateTabNavigationCommand(
- command, &current_tab->navigations.back(), &tab_id)) {
+ if (!RestoreUpdateTabNavigationCommand(command,
+ &current_tab->navigations.back(),
+ &tab_id)) {
return;
}
break;
@@ -727,7 +731,8 @@ void PersistentTabRestoreService::Delegate::CreateEntriesFromCommands(
}
SessionID::id_type tab_id;
std::string extension_app_id;
- if (!RestoreSetTabExtensionAppIDCommand(command, &tab_id,
+ if (!RestoreSetTabExtensionAppIDCommand(command,
+ &tab_id,
&extension_app_id)) {
return;
}
@@ -742,7 +747,8 @@ void PersistentTabRestoreService::Delegate::CreateEntriesFromCommands(
}
SessionID::id_type tab_id;
std::string user_agent_override;
- if (!RestoreSetTabUserAgentOverrideCommand(command, &tab_id,
+ if (!RestoreSetTabUserAgentOverrideCommand(command,
+ &tab_id,
&user_agent_override)) {
return;
}

Powered by Google App Engine
This is Rietveld 408576698