| OLD | NEW |
| 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 "apps/saved_files_service.h" | 5 #include "apps/saved_files_service.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/apps/app_browsertest_util.h" | 9 #include "chrome/browser/apps/app_browsertest_util.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 11 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
| 14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 15 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
| 16 #include "extensions/browser/extension_prefs.h" | 16 #include "extensions/browser/extension_prefs.h" |
| 17 | 17 |
| 18 namespace extensions { | 18 namespace extensions { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 class AppInstallObserver : public content::NotificationObserver { | 22 class AppInstallObserver : public content::NotificationObserver { |
| 23 public: | 23 public: |
| 24 AppInstallObserver( | 24 AppInstallObserver( |
| 25 base::Callback<void(const Extension*)> callback) | 25 base::Callback<void(const Extension*)> callback) |
| 26 : callback_(callback) { | 26 : callback_(callback) { |
| 27 registrar_.Add(this, | 27 registrar_.Add(this, |
| 28 chrome::NOTIFICATION_EXTENSION_LOADED, | 28 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 29 content::NotificationService::AllSources()); | 29 content::NotificationService::AllSources()); |
| 30 } | 30 } |
| 31 | 31 |
| 32 virtual void Observe(int type, | 32 virtual void Observe(int type, |
| 33 const content::NotificationSource& source, | 33 const content::NotificationSource& source, |
| 34 const content::NotificationDetails& details) OVERRIDE { | 34 const content::NotificationDetails& details) OVERRIDE { |
| 35 EXPECT_EQ(chrome::NOTIFICATION_EXTENSION_LOADED, type); | 35 EXPECT_EQ(chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, type); |
| 36 callback_.Run(content::Details<const Extension>(details).ptr()); | 36 callback_.Run(content::Details<const Extension>(details).ptr()); |
| 37 } | 37 } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 content::NotificationRegistrar registrar_; | 40 content::NotificationRegistrar registrar_; |
| 41 base::Callback<void(const Extension*)> callback_; | 41 base::Callback<void(const Extension*)> callback_; |
| 42 DISALLOW_COPY_AND_ASSIGN(AppInstallObserver); | 42 DISALLOW_COPY_AND_ASSIGN(AppInstallObserver); |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 void SetLastChooseEntryDirectory(const base::FilePath& choose_entry_directory, | 45 void SetLastChooseEntryDirectory(const base::FilePath& choose_entry_directory, |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 AppInstallObserver observer( | 626 AppInstallObserver observer( |
| 627 base::Bind(AddSavedEntry, | 627 base::Bind(AddSavedEntry, |
| 628 test_directory, | 628 test_directory, |
| 629 true, | 629 true, |
| 630 apps::SavedFilesService::Get(profile()))); | 630 apps::SavedFilesService::Get(profile()))); |
| 631 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/restore_directory")) | 631 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/restore_directory")) |
| 632 << message_; | 632 << message_; |
| 633 } | 633 } |
| 634 | 634 |
| 635 } // namespace extensions | 635 } // namespace extensions |
| OLD | NEW |