diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-11 23:19:44 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-11 23:19:44 +0000 |
commit | 85e921fb8e323a9226215569d41a5ab7203d3aad (patch) | |
tree | a2da555096fea411a5daa087156683c795f6083f /chrome | |
parent | 07fa03bb5efcc25a61e7e8407a38ee5eacc71b9e (diff) | |
download | chromium_src-85e921fb8e323a9226215569d41a5ab7203d3aad.zip chromium_src-85e921fb8e323a9226215569d41a5ab7203d3aad.tar.gz chromium_src-85e921fb8e323a9226215569d41a5ab7203d3aad.tar.bz2 |
Make session_service.cc compile on Mac and Linux.
Review URL: http://codereview.chromium.org/23018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9608 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser.cc | 2 | ||||
-rw-r--r-- | chrome/browser/browser.scons | 1 | ||||
-rw-r--r-- | chrome/browser/browsing_data_remover.cc | 2 | ||||
-rw-r--r-- | chrome/browser/profile.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sessions/session_service.cc | 15 | ||||
-rw-r--r-- | chrome/browser/sessions/session_service.h | 12 | ||||
-rw-r--r-- | chrome/chrome.xcodeproj/project.pbxproj | 4 | ||||
-rw-r--r-- | chrome/common/temp_scaffolding_stubs.h | 93 | ||||
-rw-r--r-- | chrome/test/testing_profile.h | 2 |
9 files changed, 105 insertions, 28 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index a74a2ee..95afc30 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -14,6 +14,7 @@ #include "chrome/browser/location_bar.h" #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/profile.h" +#include "chrome/browser/sessions/session_service.h" #include "chrome/browser/sessions/session_types.h" #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/browser/tab_contents/navigation_entry.h" @@ -58,7 +59,6 @@ #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/browser/plugin_process_host.h" #include "chrome/browser/plugin_service.h" -#include "chrome/browser/sessions/session_service.h" #include "chrome/browser/ssl/ssl_error_info.h" #include "chrome/browser/status_bubble.h" #include "chrome/browser/tab_contents/interstitial_page.h" diff --git a/chrome/browser/browser.scons b/chrome/browser/browser.scons index de44b18..f408f51 100644 --- a/chrome/browser/browser.scons +++ b/chrome/browser/browser.scons @@ -750,7 +750,6 @@ if not env.Bit('windows'): 'sessions/base_session_service.cc', 'sessions/session_backend.cc', 'sessions/session_restore.cc', - 'sessions/session_service.cc', 'sessions/tab_restore_service.cc', 'shell_integration.cc', 'ssl/ssl_blocking_page.cc', diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc index 7eb25e0..d5cadba 100644 --- a/chrome/browser/browsing_data_remover.cc +++ b/chrome/browser/browsing_data_remover.cc @@ -9,6 +9,7 @@ #include "chrome/browser/profile.h" #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/search_engines/template_url_model.h" +#include "chrome/browser/sessions/session_service.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/common/notification_service.h" #include "net/base/cookie_monster.h" @@ -26,7 +27,6 @@ // TODO(port): Get rid of this section and finish porting. #if defined(OS_WIN) #include "chrome/browser/download/download_manager.h" -#include "chrome/browser/sessions/session_service.h" #include "chrome/browser/sessions/tab_restore_service.h" #endif diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index 158a9e1..baea4d4 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -19,6 +19,7 @@ #include "chrome/browser/profile_manager.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/search_engines/template_url_model.h" +#include "chrome/browser/sessions/session_service.h" #include "chrome/browser/visitedlink_master.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/common/chrome_constants.h" @@ -43,7 +44,6 @@ #include "chrome/browser/download/download_manager.h" #include "chrome/browser/history/history.h" #include "chrome/browser/search_engines/template_url_fetcher.h" -#include "chrome/browser/sessions/session_service.h" #include "chrome/browser/sessions/tab_restore_service.h" #include "chrome/browser/spellchecker.h" #include "chrome/browser/tab_contents/navigation_controller.h" diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index 5f060d8..86a6b19 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -16,16 +16,21 @@ #include "chrome/browser/browser_window.h" #include "chrome/browser/profile.h" #include "chrome/browser/session_startup_pref.h" -#include "chrome/browser/sessions/session_backend.h" -#include "chrome/browser/sessions/session_restore.h" +#include "chrome/browser/sessions/session_command.h" #include "chrome/browser/sessions/session_types.h" #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_details.h" #include "chrome/common/notification_service.h" #include "chrome/common/scoped_vector.h" + +// TODO(port): Get rid of this section and finish porting. +#if defined(OS_WIN) +#include "chrome/browser/sessions/session_backend.h" +#include "chrome/browser/sessions/session_restore.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/win_util.h" +#endif using base::Time; @@ -679,7 +684,7 @@ void SessionService::SortTabsBasedOnVisualOrderAndPrune( if (i->second->tabs.empty() || i->second->is_constrained || !should_track_changes_for_browser_type(i->second->type)) { delete i->second; - i = windows->erase(i); + windows->erase(i++); } else { // Valid window; sort the tabs and add it to the list of valid windows. std::sort(i->second->tabs.begin(), i->second->tabs.end(), @@ -706,7 +711,7 @@ void SessionService::AddTabsToWindows(std::map<int, SessionTab*>* tabs, if (tab->window_id.id() && !tab->navigations.empty()) { SessionWindow* window = GetWindow(tab->window_id.id(), windows); window->tabs.push_back(tab); - i = tabs->erase(i); + tabs->erase(i++); // See note in SessionTab as to why we do this. std::vector<TabNavigation>::iterator j = diff --git a/chrome/browser/sessions/session_service.h b/chrome/browser/sessions/session_service.h index 3c2f7fc..015401c 100644 --- a/chrome/browser/sessions/session_service.h +++ b/chrome/browser/sessions/session_service.h @@ -9,11 +9,21 @@ #include "base/basictypes.h" #include "chrome/browser/browser.h" -#include "chrome/browser/sessions/base_session_service.h" #include "chrome/browser/sessions/session_id.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" +#if defined(OS_POSIX) +// TODO(port): get rid of this include. It's used just to provide declarations +// and stub definitions for classes we encouter during the porting effort. +#include "chrome/common/temp_scaffolding_stubs.h" +#endif + +// TODO(port): Get rid of this section and finish porting. +#if defined(OS_WIN) +#include "chrome/browser/sessions/base_session_service.h" +#endif + class Browser; class NavigationController; class NavigationEntry; diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj index 98981c9..d3b0f56 100644 --- a/chrome/chrome.xcodeproj/project.pbxproj +++ b/chrome/chrome.xcodeproj/project.pbxproj @@ -117,6 +117,7 @@ 3380A9D70F2FC8F9004EF74F /* render_dns_master.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D640CE10EAE86A500EBCFC0 /* render_dns_master.cc */; }; 3AEA44DB19C9D93B63D7A2E4 /* url_fetcher_protect.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0B7CC9C105E90E0665852528 /* url_fetcher_protect.cc */; }; 406DFE278638D6132B21B2C9 /* url_pattern.cc in Sources */ = {isa = PBXBuildFile; fileRef = 6447F24FADC63E58A44DB762 /* url_pattern.cc */; }; + 423A79243BC7B7C0B1E9B97A /* session_service.cc in Sources */ = {isa = PBXBuildFile; fileRef = C8D26D9EC81E03E91E270463 /* session_service.cc */; }; 475CAF858604B413561740C1 /* cache_manager_host.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BF8520E9D4839009A6919 /* cache_manager_host.cc */; }; 49C8AD19AA0094034F59B6F0 /* user_script.cc in Sources */ = {isa = PBXBuildFile; fileRef = 699499C4FBA07FB2D7B298A2 /* user_script.cc */; }; 4D175916B2FC058793051209 /* chrome_paths_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = C18F2A0A6FB6BEF75406511D /* chrome_paths_mac.cc */; }; @@ -2511,6 +2512,7 @@ BADB8B6D0F3A356000989B26 /* resource_dispatcher_host.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = resource_dispatcher_host.cc; path = renderer_host/resource_dispatcher_host.cc; sourceTree = "<group>"; }; BADB8BD20F3A4E4900989B26 /* resource_dispatcher_host.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = resource_dispatcher_host.h; path = renderer_host/resource_dispatcher_host.h; sourceTree = "<group>"; }; C18F2A0A6FB6BEF75406511D /* chrome_paths_mac.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chrome_paths_mac.cc; sourceTree = "<group>"; }; + C8D26D9EC81E03E91E270463 /* session_service.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = session_service.cc; path = browser/sessions/session_service.cc; sourceTree = SOURCE_ROOT; }; E40CC5E10F2E348900708647 /* history_contents_provider.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = history_contents_provider.cc; path = autocomplete/history_contents_provider.cc; sourceTree = "<group>"; }; E40CC5E20F2E348900708647 /* history_contents_provider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = history_contents_provider.h; path = autocomplete/history_contents_provider.h; sourceTree = "<group>"; }; E40CC5E40F2E349000708647 /* history_contents_provider_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = history_contents_provider_unittest.cc; path = autocomplete/history_contents_provider_unittest.cc; sourceTree = "<group>"; }; @@ -3028,6 +3030,7 @@ 699499C4FBA07FB2D7B298A2 /* user_script.cc */, 37521A11B07C479E93A39D52 /* user_script_unittest.cc */, B5EEB5E00F42044300CD3A28 /* System.framework */, + C8D26D9EC81E03E91E270463 /* session_service.cc */, ); sourceTree = "<group>"; }; @@ -5309,6 +5312,7 @@ E4F324650EE5D082002533CE /* sdch_dictionary_fetcher.cc in Sources */, E45075F40F150C01003BE099 /* session_command.cc in Sources */, E45075F70F150C0C003BE099 /* session_id.cc in Sources */, + 423A79243BC7B7C0B1E9B97A /* session_service.cc in Sources */, 4D7BF9B60E9D4894009A6919 /* session_startup_pref.cc in Sources */, E434C46A0F3A5C6000B665C7 /* session_types.cc in Sources */, A7CBAD390F322A7E00360BF5 /* shell_dialogs_mac.mm in Sources */, diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h index 937d244..dcf8eda 100644 --- a/chrome/common/temp_scaffolding_stubs.h +++ b/chrome/common/temp_scaffolding_stubs.h @@ -22,12 +22,14 @@ #include "chrome/browser/bookmarks/bookmark_service.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/cache_manager_host.h" +#include "chrome/browser/cancelable_request.h" #include "chrome/browser/download/save_types.h" #include "chrome/browser/history/download_types.h" #include "chrome/browser/renderer_host/resource_handler.h" #include "chrome/browser/safe_browsing/safe_browsing_util.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/browser/search_engines/template_url.h" +#include "chrome/browser/sessions/session_id.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/browser/tab_contents/page_navigator.h" #include "chrome/browser/tab_contents/tab_contents_type.h" @@ -47,7 +49,6 @@ class Browser; class BookmarkService; -class CancelableRequestConsumerBase; class CommandLine; class ConstrainedWindow; class DOMUIHost; @@ -66,10 +67,12 @@ class Profile; class RenderProcessHost; class RenderWidgetHelper; class ResourceMessageFilter; +class SessionCommand; class SessionID; class SiteInstance; class SpellChecker; class TabContents; +class TabNavigation; struct ThumbnailScore; class Task; class TemplateURL; @@ -84,6 +87,10 @@ struct WebPluginInfo; struct WebPluginGeometry; class WebPreferences; +namespace base { +class Thread; +} + namespace IPC { class Message; } @@ -167,8 +174,13 @@ class UserDataManager { static UserDataManager* instance_; }; -class BaseSessionService - : public base::RefCountedThreadSafe<BaseSessionService> { +class SessionBackend : public base::RefCountedThreadSafe<SessionBackend> { + public: + void MoveCurrentSessionToLastSession() { NOTIMPLEMENTED(); } +}; + +class BaseSessionService : public CancelableRequestProvider, + public base::RefCountedThreadSafe<BaseSessionService> { public: enum SessionType { SESSION_RESTORE, @@ -180,21 +192,68 @@ class BaseSessionService const std::wstring& path) { NOTIMPLEMENTED(); } + Profile* profile() const { NOTIMPLEMENTED(); return NULL; } void DeleteLastSession() { NOTIMPLEMENTED(); } -}; - -class SessionService : public BaseSessionService { - public: - explicit SessionService(Profile* profile) { } - void WindowClosed(const SessionID &) { NOTIMPLEMENTED(); } - void SetWindowBounds(const SessionID&, const gfx::Rect&, bool) - { NOTIMPLEMENTED(); } - void ResetFromCurrentBrowsers() { NOTIMPLEMENTED(); } - void TabRestored(NavigationController*) { NOTIMPLEMENTED(); } - void WindowClosing(const SessionID&) { NOTIMPLEMENTED(); } - void SetTabIndexInWindow(const SessionID&, const SessionID&, int) - { NOTIMPLEMENTED(); } - void SetSelectedTabInWindow(const SessionID&, int) { NOTIMPLEMENTED(); } + class InternalGetCommandsRequest; + typedef Callback2<Handle, scoped_refptr<InternalGetCommandsRequest> >::Type + InternalGetCommandsCallback; + class InternalGetCommandsRequest : + public CancelableRequest<InternalGetCommandsCallback> { + public: + explicit InternalGetCommandsRequest(CallbackType* callback) + : CancelableRequest<InternalGetCommandsCallback>(callback) { + } + virtual ~InternalGetCommandsRequest() { } + std::vector<SessionCommand*> commands; + private: + DISALLOW_COPY_AND_ASSIGN(InternalGetCommandsRequest); + }; + protected: + SessionBackend* backend() const { + NOTIMPLEMENTED(); + return NULL; + } + base::Thread* backend_thread() const { + NOTIMPLEMENTED(); + return NULL; + } + std::vector<SessionCommand*>& pending_commands() { + NOTIMPLEMENTED(); + return pending_commands_; + } + void set_pending_reset(bool value) { NOTIMPLEMENTED(); } + bool pending_reset() const { NOTIMPLEMENTED(); return false; } + int commands_since_reset() const { NOTIMPLEMENTED(); return 0; } + virtual void ScheduleCommand(SessionCommand* command) { NOTIMPLEMENTED(); } + void StartSaveTimer() { NOTIMPLEMENTED(); } + virtual void Save() { NOTIMPLEMENTED(); } + SessionCommand* CreateUpdateTabNavigationCommand( + SessionID::id_type command_id, + SessionID::id_type tab_id, + int index, + const NavigationEntry& entry) { + NOTIMPLEMENTED(); + return NULL; + } + bool RestoreUpdateTabNavigationCommand(const SessionCommand& command, + TabNavigation* navigation, + SessionID::id_type* tab_id) { + NOTIMPLEMENTED(); + return false; + } + bool ShouldTrackEntry(const NavigationEntry& entry) { + NOTIMPLEMENTED(); + return false; + } + Handle ScheduleGetLastSessionCommands( + InternalGetCommandsRequest* request, + CancelableRequestConsumerBase* consumer) { + NOTIMPLEMENTED(); + return 0; + } + static const int max_persist_navigation_count = 6; + private: + std::vector<SessionCommand*> pending_commands_; }; class SessionRestore { diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h index bcaa346..b355aca2 100644 --- a/chrome/test/testing_profile.h +++ b/chrome/test/testing_profile.h @@ -12,6 +12,7 @@ #include "chrome/browser/browser_prefs.h" #include "chrome/browser/profile.h" #include "chrome/browser/search_engines/template_url_model.h" +#include "chrome/browser/sessions/session_service.h" #include "chrome/common/pref_service.h" #if defined(OS_POSIX) @@ -24,7 +25,6 @@ #if defined(OS_WIN) #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/history/history.h" -#include "chrome/browser/sessions/session_service.h" #endif class TestingProfile : public Profile { |