diff options
author | iannucci@chromium.org <iannucci@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-27 07:59:00 +0000 |
---|---|---|
committer | iannucci@chromium.org <iannucci@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-27 07:59:00 +0000 |
commit | b8816a4626b9c908dd006803b1b6132bf1e4cd5d (patch) | |
tree | 1b3fd762a48cb9c284ed1d49a618e984071baf2b /apps | |
parent | 4c1fd7d345306af3f163081415814beaa21e88c4 (diff) | |
download | chromium_src-b8816a4626b9c908dd006803b1b6132bf1e4cd5d.zip chromium_src-b8816a4626b9c908dd006803b1b6132bf1e4cd5d.tar.gz chromium_src-b8816a4626b9c908dd006803b1b6132bf1e4cd5d.tar.bz2 |
Revert "Track and persist what file entries an extension has access to."
This reverts commit 4fe61bc24f343a6a1381a782dec4fb45b2f6c437 (r184878).
This was causing test failures in FileSystemApiOpenBackgroundTest and
FileSystemApiSaveBackgroundTest on linux (example
http://build.chromium.org/p/chromium.linux/buildstatus?builder=Linux%20Tests%20%28dbg%29%281%29&number=23657 )
TBR=koz@chromium.org
BUG=
Review URL: https://codereview.chromium.org/12319140
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184900 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_restore_service.cc | 11 | ||||
-rw-r--r-- | apps/app_restore_service.h | 15 | ||||
-rw-r--r-- | apps/app_restore_service_browsertest.cc | 46 |
3 files changed, 5 insertions, 67 deletions
diff --git a/apps/app_restore_service.cc b/apps/app_restore_service.cc index f1b3fd3..554f873 100644 --- a/apps/app_restore_service.cc +++ b/apps/app_restore_service.cc @@ -5,7 +5,6 @@ #include "apps/app_restore_service.h" #include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h" -#include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" #include "chrome/browser/extensions/event_router.h" #include "chrome/browser/extensions/extension_host.h" #include "chrome/browser/extensions/extension_service.h" @@ -48,11 +47,9 @@ void AppRestoreService::HandleStartup(bool should_restore_apps) { it != extensions->end(); ++it) { const Extension* extension = *it; if (extension_prefs->IsExtensionRunning(extension->id())) { - std::vector<SavedFileEntry> file_entries; - extension_prefs->GetSavedFileEntries(extension->id(), &file_entries); RecordAppStop(extension->id()); if (should_restore_apps) - RestoreApp(*it, file_entries); + RestoreApp(*it); } } } @@ -97,13 +94,9 @@ void AppRestoreService::RecordAppStop(const std::string& extension_id) { ExtensionPrefs* extension_prefs = ExtensionSystem::Get(profile_)->extension_service()->extension_prefs(); extension_prefs->SetExtensionRunning(extension_id, false); - extension_prefs->ClearSavedFileEntries(extension_id); } -void AppRestoreService::RestoreApp( - const Extension* extension, - const std::vector<SavedFileEntry>& file_entries) { - // TODO(koz): Make |file_entries| available to the newly restarted app. +void AppRestoreService::RestoreApp(const Extension* extension) { AppEventRouter::DispatchOnRestartedEvent(profile_, extension); } diff --git a/apps/app_restore_service.h b/apps/app_restore_service.h index 0217f60..f919a7a 100644 --- a/apps/app_restore_service.h +++ b/apps/app_restore_service.h @@ -11,19 +11,12 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +class Profile; + namespace extensions { class Extension; - -namespace app_file_handler_util { -struct SavedFileEntry; -} - } -class Profile; - -using extensions::app_file_handler_util::SavedFileEntry; - namespace apps { // Tracks what apps need to be restarted when the browser restarts. @@ -44,9 +37,7 @@ class AppRestoreService : public ProfileKeyedService, void RecordAppStart(const std::string& extension_id); void RecordAppStop(const std::string& extension_id); - void RestoreApp( - const extensions::Extension* extension, - const std::vector<SavedFileEntry>& file_entries); + void RestoreApp(const extensions::Extension* extension); content::NotificationRegistrar registrar_; Profile* profile_; diff --git a/apps/app_restore_service_browsertest.cc b/apps/app_restore_service_browsertest.cc index 3eaf3ff..094812d 100644 --- a/apps/app_restore_service_browsertest.cc +++ b/apps/app_restore_service_browsertest.cc @@ -4,8 +4,6 @@ #include "apps/app_restore_service.h" #include "apps/app_restore_service_factory.h" -#include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" -#include "chrome/browser/extensions/api/file_system/file_system_api.h" #include "chrome/browser/extensions/extension_prefs.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_system.h" @@ -14,12 +12,9 @@ #include "chrome/common/extensions/extension.h" #include "content/public/test/test_utils.h" -using extensions::app_file_handler_util::SavedFileEntry; using extensions::Extension; using extensions::ExtensionPrefs; using extensions::ExtensionSystem; -using extensions::FileSystemChooseEntryFunction; - // TODO(benwells): Move PlatformAppBrowserTest to apps namespace in apps // component. using extensions::PlatformAppBrowserTest; @@ -57,45 +52,4 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, RunningAppsAreRecorded) { restart_listener.WaitUntilSatisfied(); } -IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, FileAccessIsSavedToPrefs) { - content::WindowedNotificationObserver extension_suspended( - chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, - content::NotificationService::AllSources()); - - base::ScopedTempDir temp_directory; - ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); - base::FilePath temp_file; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_directory.path(), - &temp_file)); - - FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( - &temp_file); - - ExtensionTestMessageListener file_written_listener("fileWritten", false); - ExtensionTestMessageListener access_ok_listener( - "restartedFileAccessOK", false); - - const Extension* extension = - LoadAndLaunchPlatformApp("file_access_saved_to_prefs_test"); - ASSERT_TRUE(extension); - file_written_listener.WaitUntilSatisfied(); - - ExtensionService* extension_service = - ExtensionSystem::Get(browser()->profile())->extension_service(); - ExtensionPrefs* extension_prefs = extension_service->extension_prefs(); - - // Record the file entries in prefs because when the app gets suspended it - // will have them all cleared. - std::vector<SavedFileEntry> file_entries; - extension_prefs->GetSavedFileEntries(extension->id(), &file_entries); - // One for the read-only file entry and one for the writable file entry. - ASSERT_EQ(2u, file_entries.size()); - - extension_suspended.Wait(); - file_entries.clear(); - extension_prefs->GetSavedFileEntries(extension->id(), &file_entries); - // File entries should be cleared when the extension is suspended. - ASSERT_TRUE(file_entries.empty()); -} - } // namespace apps |