Commit 732a2375 authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Extensions] Remove ExtensionPrefs::[Set|Get]AppDraggedByUser()

These methods (originally added in crrev.com/ef8f0ca9) were used
to mark which apps had been re-ordered on the NTP. The preference is
no longer checked anywhere.

Remove both the setter and getter, and add the preference to the list
of obsolete preferences to remove.

Bug: None
Change-Id: Ife36753fb52b5ede503fab02c839a3bf13fed824
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1836020Reviewed-by: default avatarKelvin Jiang <kelvinjiang@chromium.org>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702488}
parent 5dbb22ad
...@@ -641,32 +641,6 @@ class ExtensionPrefsOnExtensionInstalled : public ExtensionPrefsTest { ...@@ -641,32 +641,6 @@ class ExtensionPrefsOnExtensionInstalled : public ExtensionPrefsTest {
TEST_F(ExtensionPrefsOnExtensionInstalled, TEST_F(ExtensionPrefsOnExtensionInstalled,
ExtensionPrefsOnExtensionInstalled) {} ExtensionPrefsOnExtensionInstalled) {}
class ExtensionPrefsAppDraggedByUser : public ExtensionPrefsTest {
public:
void Initialize() override {
extension_ = prefs_.AddExtension("on_extension_installed");
EXPECT_FALSE(prefs()->WasAppDraggedByUser(extension_->id()));
prefs()->OnExtensionInstalled(extension_.get(),
Extension::ENABLED,
syncer::StringOrdinal(),
std::string());
}
void Verify() override {
// Set the flag and see if it persisted.
prefs()->SetAppDraggedByUser(extension_->id());
EXPECT_TRUE(prefs()->WasAppDraggedByUser(extension_->id()));
// Make sure it doesn't change on consecutive calls.
prefs()->SetAppDraggedByUser(extension_->id());
EXPECT_TRUE(prefs()->WasAppDraggedByUser(extension_->id()));
}
private:
scoped_refptr<Extension> extension_;
};
TEST_F(ExtensionPrefsAppDraggedByUser, ExtensionPrefsAppDraggedByUser) {}
class ExtensionPrefsFlags : public ExtensionPrefsTest { class ExtensionPrefsFlags : public ExtensionPrefsTest {
public: public:
void Initialize() override { void Initialize() override {
......
...@@ -719,9 +719,6 @@ void AppLauncherHandler::HandleReorderApps(const base::ListValue* args) { ...@@ -719,9 +719,6 @@ void AppLauncherHandler::HandleReorderApps(const base::ListValue* args) {
// Don't update the page; it already knows the apps have been reordered. // Don't update the page; it already knows the apps have been reordered.
base::AutoReset<bool> auto_reset(&ignore_changes_, true); base::AutoReset<bool> auto_reset(&ignore_changes_, true);
ExtensionPrefs* extension_prefs =
ExtensionPrefs::Get(extension_service_->GetBrowserContext());
extension_prefs->SetAppDraggedByUser(dragged_app_id);
ExtensionSystem::Get(extension_service_->GetBrowserContext()) ExtensionSystem::Get(extension_service_->GetBrowserContext())
->app_sorting() ->app_sorting()
->OnExtensionMoved(dragged_app_id, predecessor_to_moved_ext, ->OnExtensionMoved(dragged_app_id, predecessor_to_moved_ext,
......
...@@ -127,9 +127,6 @@ constexpr const char kPrefAllowFileAccess[] = "newAllowFileAccess"; ...@@ -127,9 +127,6 @@ constexpr const char kPrefAllowFileAccess[] = "newAllowFileAccess";
// the old flag and possibly go back to that name. // the old flag and possibly go back to that name.
// constexpr const char kPrefAllowFileAccessOld[] = "allowFileAccess"; // constexpr const char kPrefAllowFileAccessOld[] = "allowFileAccess";
// A preference specifying if the user dragged the app on the NTP.
constexpr const char kPrefUserDraggedApp[] = "user_dragged_app_ntp";
// Preferences that hold which permissions the user has granted the extension. // Preferences that hold which permissions the user has granted the extension.
// We explicitly keep track of these so that extensions can contain unknown // We explicitly keep track of these so that extensions can contain unknown
// permissions, for backwards compatibility reasons, and we can still prompt // permissions, for backwards compatibility reasons, and we can still prompt
...@@ -1529,16 +1526,6 @@ ExtensionPrefs::GetAllDelayedInstallInfo() const { ...@@ -1529,16 +1526,6 @@ ExtensionPrefs::GetAllDelayedInstallInfo() const {
return extensions_info; return extensions_info;
} }
bool ExtensionPrefs::WasAppDraggedByUser(
const std::string& extension_id) const {
return ReadPrefAsBooleanAndReturn(extension_id, kPrefUserDraggedApp);
}
void ExtensionPrefs::SetAppDraggedByUser(const std::string& extension_id) {
UpdateExtensionPref(extension_id, kPrefUserDraggedApp,
std::make_unique<base::Value>(true));
}
bool ExtensionPrefs::IsFromWebStore( bool ExtensionPrefs::IsFromWebStore(
const std::string& extension_id) const { const std::string& extension_id) const {
const base::DictionaryValue* dictionary = GetExtensionPref(extension_id); const base::DictionaryValue* dictionary = GetExtensionPref(extension_id);
...@@ -2157,6 +2144,9 @@ void ExtensionPrefs::MigrateObsoleteExtensionPrefs() { ...@@ -2157,6 +2144,9 @@ void ExtensionPrefs::MigrateObsoleteExtensionPrefs() {
// Added 2019-07. // Added 2019-07.
"browser_action_visible", "browser_action_visible",
// Added 2019-10.
"user_dragged_app_ntp",
}; };
for (const auto& key_value : extensions_dictionary->DictItems()) { for (const auto& key_value : extensions_dictionary->DictItems()) {
......
...@@ -496,14 +496,6 @@ class ExtensionPrefs : public KeyedService { ...@@ -496,14 +496,6 @@ class ExtensionPrefs : public KeyedService {
// information. // information.
std::unique_ptr<ExtensionsInfo> GetAllDelayedInstallInfo() const; std::unique_ptr<ExtensionsInfo> GetAllDelayedInstallInfo() const;
// Returns true if the user repositioned the app on the app launcher via drag
// and drop.
bool WasAppDraggedByUser(const std::string& extension_id) const;
// Sets a flag indicating that the user repositioned the app on the app
// launcher by drag and dropping it.
void SetAppDraggedByUser(const std::string& extension_id);
// Returns true if there is an extension which controls the preference value // Returns true if there is an extension which controls the preference value
// for |pref_key| *and* it is specific to incognito mode. // for |pref_key| *and* it is specific to incognito mode.
bool HasIncognitoPrefValue(const std::string& pref_key) const; bool HasIncognitoPrefValue(const std::string& pref_key) const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment