diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-06 17:03:08 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-06 17:03:08 +0000 |
commit | 98aa0b5c0dd2f6721d7c1bb81fe87812fe5573ee (patch) | |
tree | 77dd37111cdb925321816cc66da4110d43a03880 /chrome/browser/sessions | |
parent | 54903eaa08bde272797e0f2a6befa213dd93b9b6 (diff) | |
download | chromium_src-98aa0b5c0dd2f6721d7c1bb81fe87812fe5573ee.zip chromium_src-98aa0b5c0dd2f6721d7c1bb81fe87812fe5573ee.tar.gz chromium_src-98aa0b5c0dd2f6721d7c1bb81fe87812fe5573ee.tar.bz2 |
Rename all occurrences of "app extension" with "extension app" since we were using both and consistency is nice.
Review URL: http://codereview.chromium.org/1924002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46576 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sessions')
-rw-r--r-- | chrome/browser/sessions/base_session_service.cc | 8 | ||||
-rw-r--r-- | chrome/browser/sessions/base_session_service.h | 8 | ||||
-rw-r--r-- | chrome/browser/sessions/session_restore.cc | 12 | ||||
-rw-r--r-- | chrome/browser/sessions/session_service.cc | 42 | ||||
-rw-r--r-- | chrome/browser/sessions/session_service.h | 4 | ||||
-rw-r--r-- | chrome/browser/sessions/session_service_test_helper.cc | 6 | ||||
-rw-r--r-- | chrome/browser/sessions/session_service_test_helper.h | 4 | ||||
-rw-r--r-- | chrome/browser/sessions/session_service_unittest.cc | 6 | ||||
-rw-r--r-- | chrome/browser/sessions/session_types.h | 2 | ||||
-rw-r--r-- | chrome/browser/sessions/tab_restore_service.cc | 32 | ||||
-rw-r--r-- | chrome/browser/sessions/tab_restore_service.h | 2 | ||||
-rw-r--r-- | chrome/browser/sessions/tab_restore_service_unittest.cc | 8 |
12 files changed, 67 insertions, 67 deletions
diff --git a/chrome/browser/sessions/base_session_service.cc b/chrome/browser/sessions/base_session_service.cc index 45479a9..6b809eb 100644 --- a/chrome/browser/sessions/base_session_service.cc +++ b/chrome/browser/sessions/base_session_service.cc @@ -180,7 +180,7 @@ SessionCommand* BaseSessionService::CreateUpdateTabNavigationCommand( return new SessionCommand(command_id, pickle); } -SessionCommand* BaseSessionService::CreateSetTabAppExtensionIDCommand( +SessionCommand* BaseSessionService::CreateSetTabExtensionAppIDCommand( SessionID::id_type command_id, SessionID::id_type tab_id, const std::string& extension_id) { @@ -233,17 +233,17 @@ bool BaseSessionService::RestoreUpdateTabNavigationCommand( return true; } -bool BaseSessionService::RestoreSetTabAppExtensionIDCommand( +bool BaseSessionService::RestoreSetTabExtensionAppIDCommand( const SessionCommand& command, SessionID::id_type* tab_id, - std::string* app_extension_id) { + std::string* extension_app_id) { scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); if (!pickle.get()) return false; void* iterator = NULL; return pickle->ReadInt(&iterator, tab_id) && - pickle->ReadString(&iterator, app_extension_id); + pickle->ReadString(&iterator, extension_app_id); } bool BaseSessionService::ShouldTrackEntry(const NavigationEntry& entry) { diff --git a/chrome/browser/sessions/base_session_service.h b/chrome/browser/sessions/base_session_service.h index 39dbeca..a7aaa0d 100644 --- a/chrome/browser/sessions/base_session_service.h +++ b/chrome/browser/sessions/base_session_service.h @@ -120,7 +120,7 @@ class BaseSessionService : public CancelableRequestProvider, const NavigationEntry& entry); // Creates a SessionCommand that represents marking a tab as an application. - SessionCommand* CreateSetTabAppExtensionIDCommand( + SessionCommand* CreateSetTabExtensionAppIDCommand( SessionID::id_type command_id, SessionID::id_type tab_id, const std::string& extension_id); @@ -133,12 +133,12 @@ class BaseSessionService : public CancelableRequestProvider, SessionID::id_type* tab_id); // Extracts a SessionCommand as previously created by - // CreateSetTabAppExtensionIDCommand into the tab id and application + // CreateSetTabExtensionAppIDCommand into the tab id and application // extension id. - bool RestoreSetTabAppExtensionIDCommand( + bool RestoreSetTabExtensionAppIDCommand( const SessionCommand& command, SessionID::id_type* tab_id, - std::string* app_extension_id); + std::string* extension_app_id); // Returns true if the NavigationEntry should be written to disk. bool ShouldTrackEntry(const NavigationEntry& entry); diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc index e6eb2b9..86b668d 100644 --- a/chrome/browser/sessions/session_restore.cc +++ b/chrome/browser/sessions/session_restore.cc @@ -282,7 +282,7 @@ class SessionRestoreImpl : public NotificationObserver { void OnGotSession(SessionService::Handle handle, std::vector<SessionWindow*>* windows) { - if (HasAppExtensions(*windows) && profile_->GetExtensionsService() && + if (HasExtensionApps(*windows) && profile_->GetExtensionsService() && !profile_->GetExtensionsService()->is_ready()) { // At least one tab is an app tab and the extension service hasn't // finished loading. Wait to continue processing until the extensions @@ -305,10 +305,10 @@ class SessionRestoreImpl : public NotificationObserver { } // Returns true if any tab in |windows| has an application extension id. - bool HasAppExtensions(const std::vector<SessionWindow*>& windows) { + bool HasExtensionApps(const std::vector<SessionWindow*>& windows) { for (std::vector<SessionWindow*>::const_iterator i = windows.begin(); i != windows.end(); ++i) { - if (HasAppExtensions((*i)->tabs)) + if (HasExtensionApps((*i)->tabs)) return true; } @@ -316,10 +316,10 @@ class SessionRestoreImpl : public NotificationObserver { } // Returns true if any tab in |tabs| has an application extension id. - bool HasAppExtensions(const std::vector<SessionTab*>& tabs) { + bool HasExtensionApps(const std::vector<SessionTab*>& tabs) { for (std::vector<SessionTab*>::const_iterator i = tabs.begin(); i != tabs.end(); ++i) { - if (!(*i)->app_extension_id.empty()) + if (!(*i)->extension_app_id.empty()) return true; } @@ -401,7 +401,7 @@ class SessionRestoreImpl : public NotificationObserver { tab_loader_->AddTab(&browser->AddRestoredTab(tab.navigations, static_cast<int>(i - window.tabs.begin()), selected_index, - tab.app_extension_id, + tab.extension_app_id, false, tab.pinned, true)->controller()); diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index 1ef2a07..e5a734c 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -56,7 +56,7 @@ static const SessionCommand::id_type kCommandSetWindowBounds2 = 10; static const SessionCommand::id_type kCommandTabNavigationPathPrunedFromFront = 11; static const SessionCommand::id_type kCommandSetPinnedState = 12; -static const SessionCommand::id_type kCommandSetAppExtensionID = 13; +static const SessionCommand::id_type kCommandSetExtensionAppID = 13; // Every kWritesPerReset commands triggers recreating the file. static const int kWritesPerReset = 250; @@ -492,11 +492,11 @@ void SessionService::Observe(NotificationType type, NavigationController* controller = Source<NavigationController>(source).ptr(); SetTabWindow(controller->window_id(), controller->session_id()); - if (controller->tab_contents()->app_extension()) { - SetTabAppExtensionID( + if (controller->tab_contents()->extension_app()) { + SetTabExtensionAppID( controller->window_id(), controller->session_id(), - controller->tab_contents()->app_extension()->id()); + controller->tab_contents()->extension_app()->id()); } break; } @@ -549,10 +549,10 @@ void SessionService::Observe(NotificationType type, case NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED: { TabContents* tab_contents = Source<TabContents>(source).ptr(); DCHECK(tab_contents); - if (tab_contents->app_extension()) { - SetTabAppExtensionID(tab_contents->controller().window_id(), + if (tab_contents->extension_app()) { + SetTabExtensionAppID(tab_contents->controller().window_id(), tab_contents->controller().session_id(), - tab_contents->app_extension()->id()); + tab_contents->extension_app()->id()); } break; } @@ -562,17 +562,17 @@ void SessionService::Observe(NotificationType type, } } -void SessionService::SetTabAppExtensionID( +void SessionService::SetTabExtensionAppID( const SessionID& window_id, const SessionID& tab_id, - const std::string& app_extension_id) { + const std::string& extension_app_id) { if (!ShouldTrackChangesToWindow(window_id)) return; - ScheduleCommand(CreateSetTabAppExtensionIDCommand( - kCommandSetAppExtensionID, + ScheduleCommand(CreateSetTabExtensionAppIDCommand( + kCommandSetExtensionAppID, tab_id.id(), - app_extension_id)); + extension_app_id)); } SessionCommand* SessionService::CreateSetSelectedTabInWindow( @@ -991,15 +991,15 @@ bool SessionService::CreateTabsAndWindows( break; } - case kCommandSetAppExtensionID: { + case kCommandSetExtensionAppID: { SessionID::id_type tab_id; - std::string app_extension_id; - if (!RestoreSetTabAppExtensionIDCommand( - *command, &tab_id, &app_extension_id)) { + std::string extension_app_id; + if (!RestoreSetTabExtensionAppIDCommand( + *command, &tab_id, &extension_app_id)) { return true; } - GetTab(tab_id, tabs)->app_extension_id.swap(app_extension_id); + GetTab(tab_id, tabs)->extension_app_id.swap(extension_app_id); break; } @@ -1034,12 +1034,12 @@ void SessionService::BuildCommandsForTab( commands->push_back( CreatePinnedStateCommand(controller->session_id(), true)); } - if (controller->tab_contents()->app_extension()) { + if (controller->tab_contents()->extension_app()) { commands->push_back( - CreateSetTabAppExtensionIDCommand( - kCommandSetAppExtensionID, + CreateSetTabExtensionAppIDCommand( + kCommandSetExtensionAppID, controller->session_id().id(), - controller->tab_contents()->app_extension()->id())); + controller->tab_contents()->extension_app()->id())); } for (int i = min_index; i < max_index; ++i) { const NavigationEntry* entry = (i == pending_index) ? diff --git a/chrome/browser/sessions/session_service.h b/chrome/browser/sessions/session_service.h index 278c94b..86421ca 100644 --- a/chrome/browser/sessions/session_service.h +++ b/chrome/browser/sessions/session_service.h @@ -197,9 +197,9 @@ class SessionService : public BaseSessionService, const NotificationDetails& details); // Sets the application extension id of the specified tab. - void SetTabAppExtensionID(const SessionID& window_id, + void SetTabExtensionAppID(const SessionID& window_id, const SessionID& tab_id, - const std::string& app_extension_id); + const std::string& extension_app_id); // Methods to create the various commands. It is up to the caller to delete // the returned the SessionCommand* object. diff --git a/chrome/browser/sessions/session_service_test_helper.cc b/chrome/browser/sessions/session_service_test_helper.cc index a36562d..fda500b 100644 --- a/chrome/browser/sessions/session_service_test_helper.cc +++ b/chrome/browser/sessions/session_service_test_helper.cc @@ -29,11 +29,11 @@ void SessionServiceTestHelper::PrepareTabInWindow(const SessionID& window_id, service()->SetSelectedTabInWindow(window_id, visual_index); } -void SessionServiceTestHelper::SetTabAppExtensionID( +void SessionServiceTestHelper::SetTabExtensionAppID( const SessionID& window_id, const SessionID& tab_id, - const std::string& app_extension_id) { - service()->SetTabAppExtensionID(window_id, tab_id, app_extension_id); + const std::string& extension_app_id) { + service()->SetTabExtensionAppID(window_id, tab_id, extension_app_id); } // Be sure and null out service to force closing the file. diff --git a/chrome/browser/sessions/session_service_test_helper.h b/chrome/browser/sessions/session_service_test_helper.h index 8239884..88f17c0 100644 --- a/chrome/browser/sessions/session_service_test_helper.h +++ b/chrome/browser/sessions/session_service_test_helper.h @@ -35,9 +35,9 @@ class SessionServiceTestHelper { int visual_index, bool select); - void SetTabAppExtensionID(const SessionID& window_id, + void SetTabExtensionAppID(const SessionID& window_id, const SessionID& tab_id, - const std::string& app_extension_id); + const std::string& extension_app_id); // Reads the contents of the last session. void ReadWindows(std::vector<SessionWindow*>* windows); diff --git a/chrome/browser/sessions/session_service_unittest.cc b/chrome/browser/sessions/session_service_unittest.cc index 3a4e905..e39e780 100644 --- a/chrome/browser/sessions/session_service_unittest.cc +++ b/chrome/browser/sessions/session_service_unittest.cc @@ -514,7 +514,7 @@ TEST_F(SessionServiceTest, PruneFromFront) { ASSERT_EQ(1U, windows[0]->tabs.size()); // There shouldn't be an app id. - EXPECT_TRUE(windows[0]->tabs[0]->app_extension_id.empty()); + EXPECT_TRUE(windows[0]->tabs[0]->extension_app_id.empty()); // We should be left with three navigations, the 2nd selected. SessionTab* tab = windows[0]->tabs[0]; @@ -574,13 +574,13 @@ TEST_F(SessionServiceTest, PersistApplicationExtensionID) { helper_.PrepareTabInWindow(window_id, tab_id, 0, true); UpdateNavigation(window_id, tab_id, nav1, 0, true); - helper_.SetTabAppExtensionID(window_id, tab_id, app_id); + helper_.SetTabExtensionAppID(window_id, tab_id, app_id); ScopedVector<SessionWindow> windows; ReadWindows(&(windows.get())); helper_.AssertSingleWindowWithSingleTab(windows.get(), 1); - EXPECT_TRUE(app_id == windows[0]->tabs[0]->app_extension_id); + EXPECT_TRUE(app_id == windows[0]->tabs[0]->extension_app_id); } // Explicitly set the pinned state to true and make sure we get back true. diff --git a/chrome/browser/sessions/session_types.h b/chrome/browser/sessions/session_types.h index b6f1dbc..475b99b 100644 --- a/chrome/browser/sessions/session_types.h +++ b/chrome/browser/sessions/session_types.h @@ -137,7 +137,7 @@ struct SessionTab { bool pinned; // If non-empty, this tab is an app tab and this is the id of the extension. - std::string app_extension_id; + std::string extension_app_id; std::vector<TabNavigation> navigations; diff --git a/chrome/browser/sessions/tab_restore_service.cc b/chrome/browser/sessions/tab_restore_service.cc index 4dea440..af243d2 100644 --- a/chrome/browser/sessions/tab_restore_service.cc +++ b/chrome/browser/sessions/tab_restore_service.cc @@ -49,7 +49,7 @@ const size_t TabRestoreService::kMaxEntries = 10; // . When the user closes a tab a command of type // kCommandSelectedNavigationInTab is written identifying the tab and // the selected index, then a kCommandPinnedState command if the tab was -// pinned and kCommandSetAppExtensionID if the tab has an app id. This is +// pinned and kCommandSetExtensionAppID if the tab has an app id. This is // followed by any number of kCommandUpdateTabNavigation commands (1 per // navigation entry). // . When the user closes a window a kCommandSelectedNavigationInTab command @@ -62,7 +62,7 @@ static const SessionCommand::id_type kCommandRestoredEntry = 2; static const SessionCommand::id_type kCommandWindow = 3; static const SessionCommand::id_type kCommandSelectedNavigationInTab = 4; static const SessionCommand::id_type kCommandPinnedState = 5; -static const SessionCommand::id_type kCommandSetAppExtensionID = 6; +static const SessionCommand::id_type kCommandSetExtensionAppID = 6; // Number of entries (not commands) before we clobber the file and write // everything. @@ -274,7 +274,7 @@ void TabRestoreService::RestoreEntryById(Browser* browser, browser->ReplaceRestoredTab(tab->navigations, tab->current_navigation_index, tab->from_last_session, - tab->app_extension_id); + tab->extension_app_id); } else { // Use the tab's former browser and index, if available. Browser* tab_browser = NULL; @@ -297,7 +297,7 @@ void TabRestoreService::RestoreEntryById(Browser* browser, tab_index = tab_browser->tab_count(); tab_browser->AddRestoredTab(tab->navigations, tab_index, tab->current_navigation_index, - tab->app_extension_id, true, tab->pinned, + tab->extension_app_id, true, tab->pinned, tab->from_last_session); } } else if (entry->type == WINDOW) { @@ -309,7 +309,7 @@ void TabRestoreService::RestoreEntryById(Browser* browser, TabContents* restored_tab = browser->AddRestoredTab(tab.navigations, browser->tab_count(), tab.current_navigation_index, - tab.app_extension_id, + tab.extension_app_id, (static_cast<int>(tab_i) == window->selected_tab_index), tab.pinned, tab.from_last_session); @@ -414,9 +414,9 @@ void TabRestoreService::PopulateTab(Tab* tab, if (tab->current_navigation_index == -1 && entry_count > 0) tab->current_navigation_index = 0; - Extension* extension = controller->tab_contents()->app_extension(); + Extension* extension = controller->tab_contents()->extension_app(); if (extension) - tab->app_extension_id = extension->id(); + tab->extension_app_id = extension->id(); // Browser may be NULL during unit tests. if (browser) { @@ -520,10 +520,10 @@ void TabRestoreService::ScheduleCommandsForTab(const Tab& tab, ScheduleCommand(command); } - if (!tab.app_extension_id.empty()) { + if (!tab.extension_app_id.empty()) { ScheduleCommand( - CreateSetTabAppExtensionIDCommand(kCommandSetAppExtensionID, tab.id, - tab.app_extension_id)); + CreateSetTabExtensionAppIDCommand(kCommandSetExtensionAppID, tab.id, + tab.extension_app_id)); } // Then write the navigations. @@ -757,18 +757,18 @@ void TabRestoreService::CreateEntriesFromCommands( break; } - case kCommandSetAppExtensionID: { + case kCommandSetExtensionAppID: { if (!current_tab) { // Should be in a tab when we get this. return; } SessionID::id_type tab_id; - std::string app_extension_id; - if (!RestoreSetTabAppExtensionIDCommand(command, &tab_id, - &app_extension_id)) { + std::string extension_app_id; + if (!RestoreSetTabExtensionAppIDCommand(command, &tab_id, + &extension_app_id)) { return; } - current_tab->app_extension_id.swap(app_extension_id); + current_tab->extension_app_id.swap(extension_app_id); break; } @@ -884,7 +884,7 @@ bool TabRestoreService::ConvertSessionWindowToWindow( tab.navigations.swap(session_window->tabs[i]->navigations); tab.current_navigation_index = session_window->tabs[i]->current_navigation_index; - tab.app_extension_id = session_window->tabs[i]->app_extension_id; + tab.extension_app_id = session_window->tabs[i]->extension_app_id; tab.timestamp = Time(); } } diff --git a/chrome/browser/sessions/tab_restore_service.h b/chrome/browser/sessions/tab_restore_service.h index 8aacc9c..229557f 100644 --- a/chrome/browser/sessions/tab_restore_service.h +++ b/chrome/browser/sessions/tab_restore_service.h @@ -102,7 +102,7 @@ class TabRestoreService : public BaseSessionService { bool pinned; // If non-empty gives the id of the extension for the tab. - std::string app_extension_id; + std::string extension_app_id; }; // Represents a previously open window. diff --git a/chrome/browser/sessions/tab_restore_service_unittest.cc b/chrome/browser/sessions/tab_restore_service_unittest.cc index 4af768d..e4e54cb 100644 --- a/chrome/browser/sessions/tab_restore_service_unittest.cc +++ b/chrome/browser/sessions/tab_restore_service_unittest.cc @@ -127,7 +127,7 @@ TEST_F(TabRestoreServiceTest, Basic) { ASSERT_EQ(TabRestoreService::TAB, entry->type); TabRestoreService::Tab* tab = static_cast<TabRestoreService::Tab*>(entry); EXPECT_FALSE(tab->pinned); - EXPECT_TRUE(tab->app_extension_id.empty()); + EXPECT_TRUE(tab->extension_app_id.empty()); ASSERT_EQ(3U, tab->navigations.size()); EXPECT_TRUE(url1_ == tab->navigations[0].virtual_url()); EXPECT_TRUE(url2_ == tab->navigations[1].virtual_url()); @@ -208,8 +208,8 @@ TEST_F(TabRestoreServiceTest, RestorePinnedAndApp) { ASSERT_EQ(TabRestoreService::TAB, entry->type); TabRestoreService::Tab* tab = static_cast<TabRestoreService::Tab*>(entry); tab->pinned = true; - const std::string app_extension_id("test"); - tab->app_extension_id = app_extension_id; + const std::string extension_app_id("test"); + tab->extension_app_id = extension_app_id; // Recreate the service and have it load the tabs. RecreateService(); @@ -227,7 +227,7 @@ TEST_F(TabRestoreServiceTest, RestorePinnedAndApp) { EXPECT_TRUE(url2_ == tab->navigations[1].virtual_url()); EXPECT_TRUE(url3_ == tab->navigations[2].virtual_url()); EXPECT_EQ(2, tab->current_navigation_index); - EXPECT_TRUE(app_extension_id == tab->app_extension_id); + EXPECT_TRUE(extension_app_id == tab->extension_app_id); } // Make sure we persist entries to disk that have post data. |