Commit f424c534 authored by Daniel Murphy's avatar Daniel Murphy Committed by Commit Bot

[BMO] Migrate the Youtube platform app to not be a bookmark app.

There is a pre-installed Youtube app that is a hosted app (and not a
bookmark app), but it is hard coded as a bookmark app. To add to this
weirdness, the app id is not the hash of the start url, so this causes
problems within the bookmark app system which assumes this.

This CL fixes the default app configuration, and adds migration code to
fix this for all installs.

R=alancutter@chromium.org, loyso@chromium.org

Bug: 1068453
Fixed: 1084848, 1078450
Change-Id: I7fab1714edede1fbf4030beb55c118b8300f4ebb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2181827
Commit-Queue: calamity <calamity@chromium.org>
Reviewed-by: default avatarcalamity <calamity@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarAlexey Baskakov <loyso@chromium.org>
Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
Auto-Submit: Daniel Murphy <dmurph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#770951}
parent 9a51fdd5
...@@ -7,8 +7,7 @@ ...@@ -7,8 +7,7 @@
{ {
"blpcfgokakmgnkcojhhkbfbldkacnbeo" : { "blpcfgokakmgnkcojhhkbfbldkacnbeo" : {
"external_crx": "youtube.crx", "external_crx": "youtube.crx",
"external_version": "4.2.5", "external_version": "4.2.5"
"is_bookmark_app": true
}, },
"pjkljhegncpnkpknbcohdijeoejaedia" : { "pjkljhegncpnkpknbcohdijeoejaedia" : {
"external_crx": "gmail.crx", "external_crx": "gmail.crx",
......
...@@ -1966,6 +1966,8 @@ ExtensionPrefs::ExtensionPrefs( ...@@ -1966,6 +1966,8 @@ ExtensionPrefs::ExtensionPrefs(
MigrateToNewWithholdingPref(); MigrateToNewWithholdingPref();
MigrateToNewExternalUninstallPref(); MigrateToNewExternalUninstallPref();
MigrateYoutubeOffBookmarkApps();
} }
AppSorting* ExtensionPrefs::app_sorting() const { AppSorting* ExtensionPrefs::app_sorting() const {
...@@ -2246,6 +2248,26 @@ void ExtensionPrefs::FinishExtensionInfoPrefs( ...@@ -2246,6 +2248,26 @@ void ExtensionPrefs::FinishExtensionInfoPrefs(
observer.OnExtensionRegistered(extension_id, install_time, is_enabled); observer.OnExtensionRegistered(extension_id, install_time, is_enabled);
} }
void ExtensionPrefs::MigrateYoutubeOffBookmarkApps() {
const base::DictionaryValue* extensions_dictionary =
prefs_->GetDictionary(pref_names::kExtensions);
DCHECK(extensions_dictionary->is_dict());
const base::DictionaryValue* youtube_dictionary = nullptr;
if (!extensions_dictionary->GetDictionary(extension_misc::kYoutubeAppId,
&youtube_dictionary)) {
return;
}
int creation_flags = 0;
if (!youtube_dictionary->GetInteger(kPrefCreationFlags, &creation_flags) ||
(creation_flags & Extension::FROM_BOOKMARK) == 0) {
return;
}
ScopedExtensionPrefUpdate update(prefs_, extension_misc::kYoutubeAppId);
creation_flags &= ~Extension::FROM_BOOKMARK;
update->SetInteger(kPrefCreationFlags, creation_flags);
}
void ExtensionPrefs::MigrateObsoleteExtensionPrefs() { void ExtensionPrefs::MigrateObsoleteExtensionPrefs() {
const base::Value* extensions_dictionary = const base::Value* extensions_dictionary =
prefs_->GetDictionary(pref_names::kExtensions); prefs_->GetDictionary(pref_names::kExtensions);
......
...@@ -625,6 +625,11 @@ class ExtensionPrefs : public KeyedService { ...@@ -625,6 +625,11 @@ class ExtensionPrefs : public KeyedService {
void SetDNRUseActionCountAsBadgeText(const ExtensionId& extension_id, void SetDNRUseActionCountAsBadgeText(const ExtensionId& extension_id,
bool use_action_count_as_badge_text); bool use_action_count_as_badge_text);
// Looks to see if the Youtube extension is installed, and removes the
// FROM_BOOKMARK flag from it's creation flags.
// TODO(dmurph): Remove this in m90.
void MigrateYoutubeOffBookmarkApps();
// Iterates over the extension pref entries and removes any obsolete keys. We // Iterates over the extension pref entries and removes any obsolete keys. We
// need to do this here specially (rather than in // need to do this here specially (rather than in
// MigrateObsoleteProfilePrefs()) because these entries are subkeys of the // MigrateObsoleteProfilePrefs()) because these entries are subkeys of the
......
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