Compare commits

...

11 Commits

  1. 2
      android_flags.gn
  2. 0
      misc/android_studio_setup.sh
  3. 278
      patches/Extensions/add-chromium-webstore-extension.patch
  4. 265
      patches/Extensions/allow-select-folder.patch
  5. 39
      patches/Extensions/base/change-package-name-chromium-extensions.patch
  6. 54
      patches/Extensions/base/fix-disabled-supervised-user.patch
  7. 1339
      patches/Extensions/base/gn.patch
  8. 979
      patches/Extensions/base/res.patch
  9. 8267
      patches/Extensions/base/src.patch
  10. 1436
      patches/Extensions/crx-download-install-prompt.patch
  11. 682
      patches/Extensions/fix-extension-remove-button.patch
  12. 129
      patches/Extensions/open-setting-in-new-tab.patch
  13. 12
      patches/series

2
android_flags.gn

@ -6,8 +6,10 @@ android_sdk_build_tools_version="29.0.2"
android_sdk_version=29
clang_base_path="/usr"
disable_android_lint=true
enable_extensions=true
enable_gvr_services=false
enable_resource_whitelist_generation=false
enable_supervised_users=false
exclude_unwind_tables=false
ffmpeg_branding="Chrome"
is_clang=true

0
misc/android_studio_setup.sh

278
patches/Extensions/add-chromium-webstore-extension.patch

@ -0,0 +1,278 @@
From: Wengling Chen <[email protected]>
Sun, 28 Jun 2020 03:51:18 -0400
Subject: bundle chromium-web-store
---
chrome/browser/browser_resources.grd | 1
chrome/browser/extensions/component_extensions_whitelist/whitelist.cc | 1
chrome/browser/extensions/component_loader.cc | 3
chrome/browser/resources/component_extension_resources.grd | 18 ++++
extensions/common/extension.cc | 2
extensions/common/extension_l10n_util.cc | 2
extensions/common/file_util.cc | 6 +
extensions/renderer/i18n_hooks_delegate.cc | 44 +++++++++-
8 files changed, 76 insertions(+), 1 deletion(-)
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -203,6 +203,7 @@
<include name="IDR_WEB_FOOTER_EXPERIMENT_HTML" file="resources\web_footer_experiment\index.html" type="BINDATA" />
<include name="IDR_WEBSTORE_MANIFEST" file="resources\webstore_app\manifest.json" type="BINDATA" />
<include name="IDR_CRYPTOTOKEN_MANIFEST" file="resources\cryptotoken\manifest.json" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_MANIFEST" file="resources\chromium_web_store\manifest.json" type="BINDATA" />
<if expr="chromeos">
<if expr="optimize_webui">
<then>
--- a/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc
+++ b/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc
@@ -65,6 +65,7 @@ bool IsComponentExtensionWhitelisted(int
case IDR_CLOUDPRINT_MANIFEST:
#endif
case IDR_CRYPTOTOKEN_MANIFEST:
+ case IDR_CHROMIUM_WEB_STORE_MANIFEST:
case IDR_FEEDBACK_MANIFEST:
#if BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION)
case IDR_HANGOUT_SERVICES_MANIFEST:
--- a/chrome/browser/extensions/component_loader.cc
+++ b/chrome/browser/extensions/component_loader.cc
@@ -573,6 +573,9 @@ void ComponentLoader::AddDefaultComponen
Add(IDR_CRYPTOTOKEN_MANIFEST,
base::FilePath(FILE_PATH_LITERAL("cryptotoken")));
+
+ Add(IDR_CHROMIUM_WEB_STORE_MANIFEST,
+ base::FilePath(FILE_PATH_LITERAL("chromium_web_store")));
}
void ComponentLoader::
--- a/chrome/browser/resources/component_extension_resources.grd
+++ b/chrome/browser/resources/component_extension_resources.grd
@@ -166,6 +166,24 @@
<include name="IDR_CRYPTOTOKEN_CRYPTOTOKENAPPROVEDORIGIN_JS" file="cryptotoken/cryptotokenapprovedorigins.js" type="BINDATA" />
<include name="IDR_CRYPTOTOKEN_CRYPTOTOKENORIGINCHECK_JS" file="cryptotoken/cryptotokenorigincheck.js" type="BINDATA" />
<include name="IDR_CRYPTOTOKEN_CRYPTOTOKENBACKGROUND_JS" file="cryptotoken/cryptotokenbackground.js" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_ASSETS_ICON_ICON_16_PNG" file="chromium_web_store/assets/icon/icon_16.png" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_ASSETS_ICON_ICON_24_PNG" file="chromium_web_store/assets/icon/icon_24.png" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_ASSETS_ICON_ICON_32_PNG" file="chromium_web_store/assets/icon/icon_32.png" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_ASSETS_ICON_ICON_48_PNG" file="chromium_web_store/assets/icon/icon_48.png" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_ASSETS_ICON_ICON_64_PNG" file="chromium_web_store/assets/icon/icon_64.png" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_ASSETS_ICON_ICON_128_PNG" file="chromium_web_store/assets/icon/icon_128.png" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_SCRIPTS_BACKGROUND_JS" file="chromium_web_store/scripts/background.js" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_SCRIPTS_INJECT_JS" file="chromium_web_store/scripts/inject.js" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_SCRIPTS_OPTIONS_JS" file="chromium_web_store/scripts/options.js" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_SCRIPTS_POPUP_JS" file="chromium_web_store/scripts/popup.js" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_SCRIPTS_STORE_JS" file="chromium_web_store/scripts/store.js" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_SCRIPTS_UTIL_JS" file="chromium_web_store/scripts/util.js" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_SHEETS_BASE_CSS" file="chromium_web_store/sheets/base.css" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_SHEETS_OPTIONS_CSS" file="chromium_web_store/sheets/options.css" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_SHEETS_POPUP_CSS" file="chromium_web_store/sheets/popup.css" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_SHEETS_SCROLLBAR_CSS" file="chromium_web_store/sheets/scrollbar.css" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_OPTIONS_HTML" file="chromium_web_store/options.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
+ <include name="IDR_CHROMIUM_WEB_STORE_POPUP_HTML" file="chromium_web_store/popup.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
</includes>
</release>
</grit>
--- a/extensions/renderer/i18n_hooks_delegate.cc
+++ b/extensions/renderer/i18n_hooks_delegate.cc
@@ -145,18 +145,40 @@ v8::Local<v8::Value> GetI18nMessage(cons
v8::Local<v8::Value> v8_options,
content::RenderFrame* render_frame,
v8::Local<v8::Context> context) {
+ LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: init";
+ LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: message_name: " << message_name;
v8::Isolate* isolate = context->GetIsolate();
L10nMessagesMap* l10n_messages = nullptr;
{
ExtensionToL10nMessagesMap& messages_map = *GetExtensionToL10nMessagesMap();
auto iter = messages_map.find(extension_id);
+ LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: &iter->first: " << &iter->first;
if (iter != messages_map.end()) {
l10n_messages = &iter->second;
+ for (const auto& iter_temp : *l10n_messages) {
+ LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: l10n_messages 1:"
+ << "key: "
+ << iter_temp.first
+ << " value: "
+ << iter_temp.second;
+ }
+// LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: l10n_messages 1: first: " << (*l10n_messages).first;
+// LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: l10n_messages 1: second: " << l10n_messages->second;
} else {
+ LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: l10n_messages 2.0";
if (!render_frame)
return v8::Undefined(isolate);
l10n_messages = &messages_map[extension_id];
+ for (const auto& iter_temp : *l10n_messages) {
+ LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: l10n_messages 2:"
+ << "key: "
+ << iter_temp.first
+ << " value: "
+ << iter_temp.second;
+ }
+// LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: l10n_messages 2: first: " << l10n_messages->first;
+// LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: l10n_messages 2: second: " << l10n_messages->second;
// A sync call to load message catalogs for current extension.
// TODO(devlin): Wait, what?! A synchronous call to the browser to perform
// potentially blocking work reading files from disk? That's Bad.
@@ -168,13 +190,16 @@ v8::Local<v8::Value> GetI18nMessage(cons
}
}
+ LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: 2";
std::string message =
MessageBundle::GetL10nMessage(message_name, *l10n_messages);
+ LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: message 1: " << message;
std::vector<std::string> substitutions;
// For now, we just suppress all errors, but that's really not the best.
// See https://crbug.com/807769.
v8::TryCatch try_catch(isolate);
+ LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: 3";
if (v8_substitutions->IsArray()) {
// chrome.i18n.getMessage("message_name", ["more", "params"]);
v8::Local<v8::Array> placeholders = v8_substitutions.As<v8::Array>();
@@ -182,8 +207,10 @@ v8::Local<v8::Value> GetI18nMessage(cons
if (count > 9)
return v8::Undefined(isolate);
+ LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: 4";
for (uint32_t i = 0; i < count; ++i) {
v8::Local<v8::Value> placeholder;
+ LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: 5";
if (!placeholders->Get(context, i).ToLocal(&placeholder))
return v8::Undefined(isolate);
// Note: this tries to convert each entry to a JS string, which can fail.
@@ -192,6 +219,7 @@ v8::Local<v8::Value> GetI18nMessage(cons
// since this goes through an object's toString() method). If it fails,
// we just silently ignore the value.
v8::String::Utf8Value string_value(isolate, placeholder);
+ LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: 6";
if (*string_value)
substitutions.push_back(*string_value);
}
@@ -214,10 +242,12 @@ v8::Local<v8::Value> GetI18nMessage(cons
}
}
+ LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: 7";
// NOTE: We call ReplaceStringPlaceholders even if |substitutions| is empty
// because we substitute $$ to be $ (in order to display a dollar sign in a
// message). See https://crbug.com/127243.
message = base::ReplaceStringPlaceholders(message, substitutions, nullptr);
+ LOG(INFO) << "i18n_hooks_delegate.cc: GetI18nMessage: message 2: " << message;
return gin::StringToV8(isolate, message);
}
@@ -257,6 +287,7 @@ RequestResult I18nHooksDelegate::HandleR
v8::Local<v8::Context> context,
std::vector<v8::Local<v8::Value>>* arguments,
const APITypeReferenceMap& refs) {
+ LOG(INFO) << "i18n_hooks_delegate.cc: HandleRequest: init";
using Handler = RequestResult (I18nHooksDelegate::*)(
ScriptContext*, const std::vector<v8::Local<v8::Value>>&);
static const struct {
@@ -273,19 +304,24 @@ RequestResult I18nHooksDelegate::HandleR
Handler handler = nullptr;
for (const auto& handler_entry : kHandlers) {
if (handler_entry.method == method_name) {
+ LOG(INFO) << "i18n_hooks_delegate.cc: HandleRequest: method_name: " << method_name;
handler = handler_entry.handler;
break;
}
}
- if (!handler)
+ if (!handler) {
+ LOG(INFO) << "i18n_hooks_delegate.cc: HandleRequest: NOT_HANDLED";
return RequestResult(RequestResult::NOT_HANDLED);
+ }
APISignature::V8ParseResult parse_result =
signature->ParseArgumentsToV8(context, *arguments, refs);
+ LOG(INFO) << "i18n_hooks_delegate.cc: HandleRequest: parse_result: " << parse_result.succeeded();
if (!parse_result.succeeded()) {
RequestResult result(RequestResult::INVALID_INVOCATION);
result.error = std::move(*parse_result.error);
+ LOG(INFO) << "i18n_hooks_delegate.cc: HandleRequest: result.error: " << result.error;
return result;
}
@@ -295,13 +331,19 @@ RequestResult I18nHooksDelegate::HandleR
RequestResult I18nHooksDelegate::HandleGetMessage(
ScriptContext* script_context,
const std::vector<v8::Local<v8::Value>>& parsed_arguments) {
+ LOG(INFO) << "i18n_hooks_delegate.cc: HandleGetMessage: init";
DCHECK(script_context->extension());
DCHECK(parsed_arguments[0]->IsString());
+ LOG(INFO) << "i18n_hooks_delegate.cc: HandleGetMessage: gin::V8ToString(script_context->isolate(), parsed_arguments[0]): " << gin::V8ToString(script_context->isolate(), parsed_arguments[0]);
+ LOG(INFO) << "i18n_hooks_delegate.cc: HandleGetMessage: script_context->extension()->id(): " << script_context->extension()->id();
+ LOG(INFO) << "i18n_hooks_delegate.cc: HandleGetMessage: parsed_arguments[1]: " << gin::V8ToString(script_context->isolate(), parsed_arguments[1]);
+ LOG(INFO) << "i18n_hooks_delegate.cc: HandleGetMessage: parsed_arguments[2]: " << gin::V8ToString(script_context->isolate(), parsed_arguments[2]);
v8::Local<v8::Value> message = GetI18nMessage(
gin::V8ToString(script_context->isolate(), parsed_arguments[0]),
script_context->extension()->id(), parsed_arguments[1],
parsed_arguments[2], script_context->GetRenderFrame(),
script_context->v8_context());
+ LOG(INFO) << "i18n_hooks_delegate.cc: HandleGetMessage: message: " << gin::V8ToString(script_context->isolate(), message);
RequestResult result(RequestResult::HANDLED);
result.return_value = message;
--- a/extensions/common/extension.cc
+++ b/extensions/common/extension.cc
@@ -210,6 +210,8 @@ Manifest::Type Extension::GetType() cons
GURL Extension::GetResourceURL(const GURL& extension_url,
const std::string& relative_path) {
DCHECK(extension_url.SchemeIs(kExtensionScheme));
+ LOG(INFO) << "extension.cc: GetResourceURL: extension_url: " << extension_url;
+ LOG(INFO) << "extension.cc: GetResourceURL: relative_path: " << extension_url;
return extension_url.Resolve(relative_path);
}
--- a/extensions/common/file_util.cc
+++ b/extensions/common/file_util.cc
@@ -545,12 +545,17 @@ MessageBundle* LoadMessageBundle(
const std::string& default_locale,
extension_l10n_util::GzippedMessagesPermission gzip_permission,
std::string* error) {
+ LOG(INFO) << "file_util.cc: LoadMessageBundle: init";
error->clear();
// Load locale information if available.
base::FilePath locale_path = extension_path.Append(kLocaleFolder);
+ LOG(INFO) << "file_util.cc: LoadMessageBundle: default_locale: " << default_locale;
+ LOG(INFO) << "file_util.cc: LoadMessageBundle: locale_path: " << locale_path;
+ LOG(INFO) << "file_util.cc: LoadMessageBundle: locale_path_exists: " << (base::PathExists(locale_path));
if (!base::PathExists(locale_path))
return nullptr;
+ LOG(INFO) << "file_util.cc: LoadMessageBundle: 1";
std::set<std::string> chrome_locales;
extension_l10n_util::GetAllLocales(&chrome_locales);
@@ -563,6 +568,7 @@ MessageBundle* LoadMessageBundle(
return nullptr;
}
+ LOG(INFO) << "file_util.cc: LoadMessageBundle: 2";
MessageBundle* message_bundle = extension_l10n_util::LoadMessageCatalogs(
locale_path, default_locale, gzip_permission, error);
--- a/extensions/common/extension_l10n_util.cc
+++ b/extensions/common/extension_l10n_util.cc
@@ -461,6 +461,7 @@ extensions::MessageBundle* LoadMessageCa
const std::string& default_locale,
GzippedMessagesPermission gzip_permission,
std::string* error) {
+ LOG(INFO) << "extension_l10n_util.cc: LoadMessageCatalogs: init";
std::vector<std::string> all_fallback_locales;
GetAllFallbackLocales(default_locale, &all_fallback_locales);
@@ -474,6 +475,7 @@ extensions::MessageBundle* LoadMessageCa
std::unique_ptr<base::DictionaryValue> catalog = LoadMessageFile(
locale_path, all_fallback_locales[i], error, gzip_permission);
if (!catalog.get()) {
+ LOG(INFO) << "extension_l10n_util.cc: LoadMessageCatalogs: !catalog.get(): " << (!catalog.get());
// If locale is valid, but messages.json is corrupted or missing, return
// an error.
return nullptr;

265
patches/Extensions/allow-select-folder.patch

@ -0,0 +1,265 @@
From: Wengling Chen <[email protected]>
Date: Sat, 06 Jun 2020 21:32:57 -0400
Subject: add folder selection mode picker
---
ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java | 153 +++++++++-
ui/shell_dialogs/select_file_dialog_android.cc | 6
2 files changed, 149 insertions(+), 10 deletions(-)
--- a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
+++ b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
@@ -15,10 +15,13 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
+import android.os.storage.StorageManager;
import android.provider.MediaStore;
+import android.provider.DocumentsContract;
import android.text.TextUtils;
import android.webkit.MimeTypeMap;
+import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import org.chromium.base.ContentUriUtils;
@@ -40,6 +43,8 @@ import org.chromium.ui.UiUtils;
import java.io.File;
import java.io.IOException;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -96,6 +101,7 @@ public class SelectFileDialog implements
private final long mNativeSelectFileDialog;
private List<String> mFileTypes;
+ private boolean mIsFolder;
private boolean mCapture;
private boolean mAllowMultiple;
private Uri mCameraOutputUri;
@@ -143,9 +149,10 @@ public class SelectFileDialog implements
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
@CalledByNative
private void selectFile(
- String[] fileTypes, boolean capture, boolean multiple, WindowAndroid window) {
+ String[] fileTypes, boolean capture, boolean multiple, boolean isFolder, WindowAndroid window) {
mFileTypes = new ArrayList<String>(Arrays.asList(fileTypes));
mCapture = capture;
+ mIsFolder = isFolder;
mAllowMultiple = multiple;
mWindowAndroid = (sOverrideWindowAndroid == null) ? window : sOverrideWindowAndroid;
@@ -237,6 +244,12 @@ public class SelectFileDialog implements
RecordHistogram.recordEnumeratedHistogram("Android.SelectFileDialogScope",
determineSelectFileDialogScope(), SELECT_FILE_DIALOG_SCOPE_COUNT);
+ Intent folderSelector = null;
+ if (mIsFolder) {
+ folderSelector = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
+ folderSelector.addCategory(Intent.CATEGORY_DEFAULT);
+ }
+
boolean hasCameraPermission = mWindowAndroid.hasPermission(Manifest.permission.CAMERA);
Intent camcorder = null;
if (mSupportsVideoCapture && hasCameraPermission) {
@@ -281,15 +294,22 @@ public class SelectFileDialog implements
// Create a chooser based on the accept type that was specified in the webpage. Note
// that if the web page specified multiple accept types, we will have built a generic
// chooser above.
- if (shouldShowImageTypes()) {
+ if (shouldShowImageTypes() && !mIsFolder) {
+ Log.d("SelectFileDialog.java", "shouldShowImageTypes");
if (camera != null) extraIntents.add(camera);
getContentIntent.setType(ALL_IMAGE_TYPES);
- } else if (shouldShowVideoTypes()) {
+ } else if (shouldShowVideoTypes() && !mIsFolder) {
+ Log.d("SelectFileDialog.java", "shouldShowVideoTypes");
if (camcorder != null) extraIntents.add(camcorder);
getContentIntent.setType(ALL_VIDEO_TYPES);
- } else if (shouldShowAudioTypes()) {
+ } else if (shouldShowAudioTypes() && !mIsFolder) {
+ Log.d("SelectFileDialog.java", "shouldShowAudioTypes");
if (soundRecorder != null) extraIntents.add(soundRecorder);
getContentIntent.setType(ALL_AUDIO_TYPES);
+ } else if (mIsFolder) {
+ Log.d("SelectFileDialog.java", "mIsFolder, add(folderSelector)");
+ if (folderSelector != null) extraIntents.add(folderSelector);
+ getContentIntent.setType(ANY_TYPES);
}
// If any types are specified, then only accept openable files, as coercing
@@ -300,13 +320,20 @@ public class SelectFileDialog implements
if (extraIntents.isEmpty()) {
// We couldn't resolve an accept type, so fallback to a generic chooser.
getContentIntent.setType(ANY_TYPES);
- if (camera != null) extraIntents.add(camera);
- if (camcorder != null) extraIntents.add(camcorder);
- if (soundRecorder != null) extraIntents.add(soundRecorder);
+ if (!mIsFolder) {
+ Log.d("SelectFileDialog.java", "!mIsFolder");
+ if (camera != null) extraIntents.add(camera);
+ if (camcorder != null) extraIntents.add(camcorder);
+ if (soundRecorder != null) extraIntents.add(soundRecorder);
+ } else {
+ Log.d("SelectFileDialog.java", "mIsFolder, add(folderSelector), 2");
+ if (folderSelector != null) extraIntents.add(folderSelector);
+ }
}
Intent chooser = new Intent(Intent.ACTION_CHOOSER);
if (!extraIntents.isEmpty()) {
+ Log.d("SelectFileDialog.java", "EXTRA_INITIAL_INTENTS");
chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS,
extraIntents.toArray(new Intent[] { }));
}
@@ -701,6 +728,18 @@ public class SelectFileDialog implements
String[] displayNames = new String[mUris.length];
try {
for (int i = 0; i < mUris.length; i++) {
+ // Convert content Uri to absolute file path if in folder selection mode
+ if (mIsFolder) {
+ Context context = ContextUtils.getApplicationContext();
+ String path = FileUtil.getFullPathFromTreeUri(mUris[i], context);
+ if (path != null)
+ Log.d("SelectFileDialog.java", "mUris: %s, path: %s", mUris[i].toString(), path);
+ else
+ Log.d("SelectFileDialog.java", "mUris: %s, path: %s", mUris[i].toString(), "NULL");
+ if (path != null)
+ mUris[i] = Uri.fromFile(new File(path));
+ }
+
// The selected files must be returned as a list of absolute paths. A MIUI 8.5
// device was observed to return a file:// URI instead, so convert if necessary.
// See https://crbug.com/752834 for context.
@@ -709,8 +748,13 @@ public class SelectFileDialog implements
} else {
mFilePaths[i] = mUris[i].toString();
}
- displayNames[i] = ContentUriUtils.getDisplayName(
- mUris[i], mContext, MediaStore.MediaColumns.DISPLAY_NAME);
+
+ if (mIsFolder) {
+ displayNames[i] = mFilePaths[i];
+ } else {
+ displayNames[i] = ContentUriUtils.getDisplayName(
+ mUris[i], mContext, MediaStore.MediaColumns.DISPLAY_NAME);
+ }
}
} catch (SecurityException e) {
// Some third party apps will present themselves as being able
@@ -807,4 +851,95 @@ public class SelectFileDialog implements
void onContactsSelected(
long nativeSelectFileDialogImpl, SelectFileDialog caller, String contacts);
}
+
+ // The following code is from
+ // <a href="https://stackoverflow.com/questions/34927748#36162691">Stack Overflow</a>.
+ // Licensed under CC-BY-SA 3.0.
+ private static final class FileUtil {
+ private static final String PRIMARY_VOLUME_NAME = "primary";
+
+ @Nullable
+ static String getFullPathFromTreeUri(@Nullable final Uri treeUri, Context con) {
+ if (treeUri == null) return null;
+ String volumePath = getVolumePath(getVolumeIdFromTreeUri(treeUri),con);
+ if (volumePath == null)
+ Log.d("SelectFileDialog.java", "volumePath: %s", "NULL");
+ else
+ Log.d("SelectFileDialog.java", "volumePath: %s", volumePath);
+ if (volumePath == null) return File.separator;
+ if (volumePath.endsWith(File.separator))
+ volumePath = volumePath.substring(0, volumePath.length() - 1);
+
+ String documentPath = getDocumentPathFromTreeUri(treeUri);
+ if (documentPath == null || documentPath.equals(""))
+ Log.d("SelectFileDialog.java", "documentPath: %s", "NULL");
+ else
+ Log.d("SelectFileDialog.java", "documentPath: %s", documentPath);
+ if (documentPath.endsWith(File.separator))
+ documentPath = documentPath.substring(0, documentPath.length() - 1);
+
+ if (documentPath.length() > 0) {
+ if (documentPath.startsWith(File.separator))
+ return volumePath + documentPath;
+ else
+ return volumePath + File.separator + documentPath;
+ }
+ else return volumePath;
+ }
+
+ @SuppressLint("ObsoleteSdkInt")
+ private static String getVolumePath(final String volumeId, Context context) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return null;
+ Log.d("SelectFileDialog.java", "getVolumePath: volumeId: %s", volumeId);
+ try {
+ StorageManager mStorageManager =
+ (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
+ Class<?> storageVolumeClazz = Class.forName("android.os.storage.StorageVolume");
+ Method getVolumeList = mStorageManager.getClass().getMethod("getVolumeList");
+ Method getUuid = storageVolumeClazz.getMethod("getUuid");
+ Method getPath = storageVolumeClazz.getMethod("getPath");
+ Method isPrimary = storageVolumeClazz.getMethod("isPrimary");
+ Object result = getVolumeList.invoke(mStorageManager);
+
+ final int length = Array.getLength(result);
+ Log.d("SelectFileDialog.java", "getVolumePath: length: %d", length);
+ for (int i = 0; i < length; i++) {
+ Object storageVolumeElement = Array.get(result, i);
+ String uuid = (String) getUuid.invoke(storageVolumeElement);
+ Log.d("SelectFileDialog.java", "getVolumePath: uuid: %s", uuid);
+ Boolean primary = (Boolean) isPrimary.invoke(storageVolumeElement);
+ Log.d("SelectFileDialog.java", "getVolumePath: primary: %b", primary);
+
+ // primary volume?
+ if (primary && PRIMARY_VOLUME_NAME.equals(volumeId))
+ return (String) getPath.invoke(storageVolumeElement);
+
+ // other volumes?
+ if (uuid != null && uuid.equals(volumeId))
+ return (String) getPath.invoke(storageVolumeElement);
+ }
+ // not found.
+ return null;
+ } catch (Exception ex) {
+ Log.e("SelectFileDialog.java", "getVolumePath: Exception: %s", ex.getMessage());
+ return null;
+ }
+ }
+
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ private static String getVolumeIdFromTreeUri(final Uri treeUri) {
+ final String docId = DocumentsContract.getTreeDocumentId(treeUri);
+ final String[] split = docId.split(":");
+ if (split.length > 0) return split[0];
+ else return null;
+ }
+
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ private static String getDocumentPathFromTreeUri(final Uri treeUri) {
+ final String docId = DocumentsContract.getTreeDocumentId(treeUri);
+ final String[] split = docId.split(":");
+ if ((split.length >= 2) && (split[1] != null)) return split[1];
+ else return File.separator;
+ }
+ }
}
--- a/ui/shell_dialogs/select_file_dialog_android.cc
+++ b/ui/shell_dialogs/select_file_dialog_android.cc
@@ -135,8 +135,12 @@ void SelectFileDialogImpl::SelectFileImp
bool accept_multiple_files = SelectFileDialog::SELECT_OPEN_MULTI_FILE == type;
+ bool is_folder = false;
+ if (type == SelectFileDialog::SELECT_EXISTING_FOLDER)
+ is_folder = true;
+
Java_SelectFileDialog_selectFile(env, java_object_, accept_types_java,
- accept_types.second, accept_multiple_files,
+ accept_types.second, accept_multiple_files, is_folder,
owning_window->GetJavaObject());
}

39
patches/Extensions/base/change-package-name-chromium-extensions.patch

@ -0,0 +1,39 @@
description: change package name to allow co-existence with original Chromium
author: Wengling Chen <[email protected]>
---
chrome/android/BUILD.gn | 4 ++--
chrome/android/java/res_chromium/values/channel_constants.xml | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
--- a/chrome/android/BUILD.gn
+++ b/chrome/android/BUILD.gn
@@ -35,7 +35,7 @@ import("java_sources.gni")
import("static_initializers.gni")
import("trichrome.gni")
-_default_package = "org.chromium.chrome"
+_default_package = "org.ungoogled.chromium.extensions"
if (android_channel != "default") {
# android-binary-size trybot may checks if an internal Chrome variant's
# AndroidManifest is as expected by ensuring the differences between its
@@ -56,7 +56,7 @@ declare_args() {
# for details.
chrome_public_manifest_package = _default_package
}
-chrome_public_test_manifest_package = "org.chromium.chrome.tests"
+chrome_public_test_manifest_package = "org.ungoogled.chromium.extensions.tests"
chrome_public_jinja_variables =
default_chrome_public_jinja_variables +
--- a/chrome/android/java/res_chromium/values/channel_constants.xml
+++ b/chrome/android/java/res_chromium/values/channel_constants.xml
@@ -5,7 +5,7 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The application name displayed to the user. -->
- <string name="app_name" translatable="false">Chromium</string>
+ <string name="app_name" translatable="false">Ungoogled Chromium Extensions</string>
<string name="bookmark_widget_title" translatable="false">Chromium bookmarks</string>
<string name="search_widget_title" translatable="false">Chromium search</string>
</resources>

54
patches/Extensions/base/fix-disabled-supervised-user.patch

@ -0,0 +1,54 @@
From: Wengling Chen <[email protected]>
Date: Sat, 30 May 2020 18:25:38 -0400
Subject: fix for enable_supervised_users=false
---
chrome/android/BUILD.gn | 1
chrome/android/java/src/org/chromium/chrome/browser/childaccounts/ChildAccountService.java | 14 ----------
2 files changed, 15 deletions(-)
--- a/chrome/android/BUILD.gn
+++ b/chrome/android/BUILD.gn
@@ -2734,7 +2734,6 @@ generate_jni("chrome_jni_headers") {
"java/src/org/chromium/chrome/browser/browsing_data/BrowsingDataCounterBridge.java",
"java/src/org/chromium/chrome/browser/browsing_data/UrlFilterBridge.java",
"java/src/org/chromium/chrome/browser/childaccounts/ChildAccountFeedbackReporter.java",
- "java/src/org/chromium/chrome/browser/childaccounts/ChildAccountService.java",
"java/src/org/chromium/chrome/browser/complex_tasks/TaskTabHelper.java",
"java/src/org/chromium/chrome/browser/complex_tasks/endpoint_fetcher/EndpointFetcher.java",
"java/src/org/chromium/chrome/browser/complex_tasks/endpoint_fetcher/EndpointResponse.java",
--- a/chrome/android/java/src/org/chromium/chrome/browser/childaccounts/ChildAccountService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/childaccounts/ChildAccountService.java
@@ -60,32 +60,18 @@ public class ChildAccountService {
* @param callback the callback to be called when the status changes.
*/
public static void listenForStatusChange(Callback<Boolean> callback) {
- ChildAccountServiceJni.get().listenForChildStatusReceived(callback);
}
- @CalledByNative
private static void reauthenticateChildAccount(
WindowAndroid windowAndroid, String accountName, final long nativeCallback) {
ThreadUtils.assertOnUiThread();
Activity activity = windowAndroid.getActivity().get();
if (activity == null) {
- PostTask.postTask(UiThreadTaskTraits.DEFAULT,
- ()
- -> ChildAccountServiceJni.get().onReauthenticationResult(
- nativeCallback, false));
return;
}
Account account = AccountUtils.createAccountFromName(accountName);
- AccountManagerFacadeProvider.getInstance().updateCredentials(account, activity,
- result
- -> ChildAccountServiceJni.get().onReauthenticationResult(nativeCallback, result));
}
- @NativeMethods
- interface Natives {
- void listenForChildStatusReceived(Callback<Boolean> callback);
- void onReauthenticationResult(long callbackPtr, boolean reauthSuccessful);
- }
}

1339
patches/Extensions/base/gn.patch

File diff suppressed because it is too large

979
patches/Extensions/base/res.patch

@ -0,0 +1,979 @@
From: Wengling Chen <[email protected]>
Date: Sat, 30 May 2020 18:25:38 -0400
Subject: resource fixes for enable_extensions=true
---
chrome/app/bookmarks_strings.grdp | 6 +-
chrome/app/chromium_strings.grd | 20 +++----
chrome/app/generated_resources.grd | 77 ++++++++++-------------------
chrome/app/profiles_strings.grdp | 9 ---
chrome/app/theme/theme_resources.grd | 24 ++++-----
chrome/browser/browser_resources.grd | 24 ++++-----
components/autofill_payments_strings.grdp | 14 +----
components/autofill_strings.grdp | 2
components/components_strings.grd | 4 -
components/history_strings.grdp | 2
components/new_or_sad_tab_strings.grdp | 4 -
components/page_info_strings.grdp | 6 +-
components/payments_strings.grdp | 2
components/sync_ui_strings.grdp | 2
mojo/public/js/mojo_bindings_resources.grd | 2
ui/resources/ui_resources.grd | 10 +--
ui/webui/resources/webui_resources.grd | 6 +-
17 files changed, 92 insertions(+), 122 deletions(-)
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -28,7 +28,7 @@
<if expr="is_linux or is_win or chromeos">
<structure type="chrome_scaled_image" name="IDR_ACCESSIBILITY_CAPTIONS_PREVIEW_BACKGROUND" file="common/captions-preview-bg.png" />
</if>
- <if expr="toolkit_views and not is_macosx">
+ <if expr="not is_macosx">
<structure type="chrome_scaled_image" name="IDR_APP_WINDOW_CLOSE" file="common/app_window_close.png" />
<structure type="chrome_scaled_image" name="IDR_APP_WINDOW_CLOSE_H" file="common/app_window_close_hover.png" />
<structure type="chrome_scaled_image" name="IDR_APP_WINDOW_CLOSE_P" file="common/app_window_close_active.png" />
@@ -70,7 +70,7 @@
<if expr="is_win">
<structure type="chrome_scaled_image" name="IDR_BOOKMARK_BAR_FOLDER_MANAGED" file="win/bookmark_bar_folder_managed.png" />
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<structure type="chrome_scaled_image" name="IDR_BOOKMARK_BAR_APPS_SHORTCUT" file="common/apps_bookmark_bar_icon.png" />
<structure type="chrome_scaled_image" name="IDR_BOOKMARKS_FAVICON" file="common/favicon_bookmarks.png" />
</if>
@@ -78,7 +78,7 @@
<structure type="chrome_scaled_image" name="IDR_BUTTON_USER_IMAGE_CHOOSE_FILE" file="cros/choose_file.png" />
<structure type="chrome_scaled_image" name="IDR_BUTTON_USER_IMAGE_TAKE_PHOTO" file="cros/take_photo.png" />
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<!-- Note: Tab close buttons are not traditional buttons. Tab close buttons
fill a background with a color from the theme and tile IDR_CLOSE_1 over it.
See chrome/browser/ui/views/tabs/tab.cc -->
@@ -94,7 +94,7 @@
<if expr="chromeos">
<structure type="chrome_scaled_image" name="IDR_DEVICE_DISABLED" file="cros/device_disabled.png" />
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<structure type="chrome_scaled_image" name="IDR_DOWNLOADS_FAVICON" file="common/favicon_downloads.png" />
<structure type="chrome_scaled_image" name="IDR_ERROR_NETWORK_OFFLINE" file="common/error_network_offline.png" />
</if>
@@ -131,7 +131,7 @@
<if expr="_google_chrome">
<structure type="chrome_scaled_image" name="IDR_GOOGLE_ICON" file="google_chrome/google_icon.png" />
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<structure type="chrome_scaled_image" name="IDR_HELP_MENU" file="common/help_16.png" />
<structure type="chrome_scaled_image" name="IDR_HIDE_PASSWORD_HOVER" file="common/hide_password_hover.png" />
<if expr="not chromeos">
@@ -147,7 +147,7 @@
<if expr="enable_service_discovery">
<structure type="chrome_scaled_image" name="IDR_LOCAL_DISCOVERY_CLOUDPRINT_ICON" file="common/cloudprint.png" />
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<structure type="chrome_scaled_image" name="IDR_MANAGEMENT_FAVICON" file="common/favicon_management.png" />
<structure type="chrome_scaled_image" name="IDR_MAXIMIZE_BUTTON_MASK" file="common/maximize_button_mask.png" />
<structure type="chrome_scaled_image" name="IDR_MINIMIZE_BUTTON_MASK" file="common/minimize_button_mask.png" />
@@ -157,12 +157,12 @@
<structure type="chrome_scaled_image" name="IDR_ARC_PLAY_STORE_OPTIN_IN_PROGRESS_NOTIFICATION" file="cros/notification_play_store_optin_in_progress.png" />
<structure type="chrome_scaled_image" name="IDR_NOTIFICATION_EASYUNLOCK_ENABLED" file="cros/notification_easyunlock_enabled.png" />
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<structure type="chrome_scaled_image" name="IDR_PASSWORD_CHECK" file="common/password_check.png" />
<structure type="chrome_scaled_image" name="IDR_PASSWORD_CHECK_DARK" file="common/password_check_dark.png" />
</if>
<structure type="chrome_scaled_image" name="IDR_PLUGINS_FAVICON" file="common/favicon_plugins.png" />
- <if expr="not is_android">
+ <if expr="is_android">
<structure type="chrome_scaled_image" name="IDR_PRERENDER" file="common/prerender_succeed_icon.png" />
</if>
<if expr="not _google_chrome">
@@ -252,7 +252,7 @@
<structure type="chrome_scaled_image" name="IDR_RESET_WARNING" file="cros/reset_warning.png" />
</if>
<structure type="chrome_scaled_image" name="IDR_RESTORE_BUTTON_MASK" file="common/restore_button_mask.png" />
- <if expr="not is_android">
+ <if expr="is_android">
<structure type="chrome_scaled_image" name="IDR_SAFETY_TIP_LOOKALIKE_ILLUSTRATION_DARK" file="common/safety_tip_lookalike_illustration_dark.png" />
<structure type="chrome_scaled_image" name="IDR_SAFETY_TIP_LOOKALIKE_ILLUSTRATION_LIGHT" file="common/safety_tip_lookalike_illustration_light.png" />
<structure type="chrome_scaled_image" name="IDR_SAFETY_TIP_SUSPICIOUS_ILLUSTRATION_DARK" file="common/safety_tip_suspicious_illustration_dark.png" />
@@ -264,7 +264,7 @@
<if expr="chromeos">
<structure type="chrome_scaled_image" name="IDR_SECONDARY_USER_SETTINGS" file="cros/secondary_user_settings.png" />
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<structure type="chrome_scaled_image" name="IDR_SETTINGS_FAVICON" file="common/favicon_settings.png" />
<structure type="chrome_scaled_image" name="IDR_SHOW_PASSWORD_HOVER" file="common/show_password_hover.png" />
</if>
@@ -286,7 +286,7 @@
<if expr="chromeos">
<structure type="chrome_scaled_image" name="IDR_TAB_RECORDING_INDICATOR" file="cros/tab_recording_indicator.png" />
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<structure type="chrome_scaled_image" name="IDR_COOKIE_BLOCKING_ON_HEADER" file="common/cookie_blocking_on_header.png" />
<structure type="chrome_scaled_image" name="IDR_COOKIE_BLOCKING_OFF_HEADER" file="common/cookie_blocking_off_header.png" />
</if>
@@ -340,7 +340,7 @@
<structure type="chrome_scaled_image" name="IDR_PASTE_VIOLATION_DARK" file="common/paste_violation_dark.png" />
</if>
<if expr="not _google_chrome">
- <if expr="not is_android">
+ <if expr="is_android">
<structure type="chrome_scaled_image" name="IDR_WEBSTORE_ICON" file="chromium/webstore_icon.png" />
<structure type="chrome_scaled_image" name="IDR_WEBSTORE_ICON_16" file="chromium/webstore_icon_16.png" />
<structure type="chrome_scaled_image" name="IDR_WEBSTORE_ICON_24" file="chromium/webstore_icon_24.png" />
--- a/ui/resources/ui_resources.grd
+++ b/ui/resources/ui_resources.grd
@@ -78,7 +78,7 @@
<structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_ZOOM_IN" file="common/pointers/zoom_in.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_ZOOM_OUT" file="common/pointers/zoom_out.png" />
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<structure type="chrome_scaled_image" name="IDR_CLOSE_2" file="close_2.png" />
<structure type="chrome_scaled_image" name="IDR_CLOSE_2_H" file="close_2_hover.png" />
<structure type="chrome_scaled_image" name="IDR_CLOSE_2_MASK" file="close_2_mask.png" />
@@ -92,7 +92,7 @@
</if>
<structure type="chrome_scaled_image" name="IDR_DEFAULT_FAVICON" file="common/default_favicon.png" />
<structure type="chrome_scaled_image" name="IDR_DEFAULT_FAVICON_DARK" file="common/default_favicon_dark.png" />
- <if expr="not is_android">
+ <if expr="is_android">
<structure type="chrome_scaled_image" name="IDR_DEFAULT_FAVICON_32" file="common/default_favicon_32.png" />
<structure type="chrome_scaled_image" name="IDR_DEFAULT_FAVICON_DARK_32" file="common/default_favicon_dark_32.png" />
<structure type="chrome_scaled_image" name="IDR_DEFAULT_FAVICON_64" file="common/default_favicon_64.png" />
@@ -134,7 +134,7 @@
<if expr="toolkit_views and not is_macosx">
<structure type="chrome_scaled_image" name="IDR_NOTIFICATION_SETTINGS" file="common/notification_settings.png"/>
</if>
- <if expr="not is_android and not is_ios">
+ <if expr="is_android and not is_ios">
<structure type="chrome_scaled_image" name="IDR_NTP_DEFAULT_FAVICON" file="common/ntp_default_favicon.png" />
</if>
<if expr="not is_android and not is_ios">
@@ -142,7 +142,7 @@
<structure type="chrome_scaled_image" name="IDR_OOBE_ACTION_BOX_BUTTON_NORMAL" file="cros/action_box_button_normal.png" />
<structure type="chrome_scaled_image" name="IDR_OOBE_ACTION_BOX_BUTTON_PRESSED" file="cros/action_box_button_pressed.png" />
</if>
- <if expr="not is_android and not is_ios">
+ <if expr="is_android and not is_ios">
<structure type="chrome_scaled_image" name="IDR_SIGNAL_0_BAR" file="common/signal_0_bar.png" />
<structure type="chrome_scaled_image" name="IDR_SIGNAL_1_BAR" file="common/signal_1_bar.png" />
<structure type="chrome_scaled_image" name="IDR_SIGNAL_2_BAR" file="common/signal_2_bar.png" />
@@ -154,7 +154,7 @@
<structure type="chrome_scaled_image" name="IDR_SIGNAL_3_BAR_SELECTED" file="common/signal_3_bar_selected.png" />
<structure type="chrome_scaled_image" name="IDR_SIGNAL_4_BAR_SELECTED" file="common/signal_4_bar_selected.png" />
</if>
- <if expr="use_aura">
+ <if expr="is_android">
<structure type="chrome_scaled_image" name="IDR_TEXT_SELECTION_HANDLE_CENTER" file="common/text_selection_handle_center.png" />
<structure type="chrome_scaled_image" name="IDR_TEXT_SELECTION_HANDLE_LEFT" file="common/text_selection_handle_left.png" />
<structure type="chrome_scaled_image" name="IDR_TEXT_SELECTION_HANDLE_RIGHT" file="common/text_selection_handle_right.png" />
--- a/mojo/public/js/mojo_bindings_resources.grd
+++ b/mojo/public/js/mojo_bindings_resources.grd
@@ -14,7 +14,7 @@
<release seq="1">
<includes>
<!-- All resources included on Android should use the lite bindings. -->
- <if expr="not is_android">
+ <if expr="is_android">
<include name="IDR_MOJO_MOJO_BINDINGS_JS"
file="${root_gen_dir}/mojo/public/js/mojo_bindings.js"
use_base_dir="false"
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -294,7 +294,7 @@ are declared in tools/grit/grit_rule.gni
</if>
<!-- Settings specific strings -->
- <if expr="not is_android">
+ <if expr="is_android">
<part file="settings_strings.grdp" />
<part file="shared_settings_strings.grdp"/>
</if>
@@ -305,7 +305,7 @@ are declared in tools/grit/grit_rule.gni
</if>
<!-- Welcome strings -->
- <if expr="not chromeos and not is_android">
+ <if expr="not chromeos and is_android">
<part file="welcome_strings.grdp" />
</if>
@@ -449,7 +449,7 @@ are declared in tools/grit/grit_rule.gni
Disable
</message>
<!-- Search strings are only used in webui, so no mobile. -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_SEARCH_CLEARED" desc="Message announced to screenreader users when search is cleared.">
Search cleared
</message>
@@ -477,7 +477,7 @@ are declared in tools/grit/grit_rule.gni
</if>
<!-- content area context menus. Android does not use it -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_CONTENT_CONTEXT_INSPECTELEMENT" desc="The name of the Inspect Element command in the content area context menu">
I&amp;nspect
</message>
@@ -977,7 +977,7 @@ are declared in tools/grit/grit_rule.gni
</if>
<!-- Page menu. Android has separate strings for its menu -->
- <if expr="not is_android">
+ <if expr="is_android">
<if expr="not use_titlecase">
<message name="IDS_NEW_TAB" desc="The text label of a menu item for opening a new tab">
New &amp;tab
@@ -2021,7 +2021,7 @@ are declared in tools/grit/grit_rule.gni
</message>
<!-- Download Context Menu Items -->
- <if expr="not is_android">
+ <if expr="is_android">
<if expr="not use_titlecase">
<if expr="is_macosx">
<message name="IDS_DOWNLOAD_MENU_SHOW"
@@ -2263,7 +2263,7 @@ are declared in tools/grit/grit_rule.gni
</if>
<!-- Desktop omnibox PWA install icon -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_OMNIBOX_PWA_INSTALL_ICON_LABEL" desc="String for the omnibox icon label promoting an app installation">
Install
</message>
@@ -2739,7 +2739,6 @@ are declared in tools/grit/grit_rule.gni
</message>
<!-- Win certificate selector dialog strings. -->
- <if expr="toolkit_views">
<message name="IDS_CERT_SELECTOR_SUBJECT_COLUMN" desc="The text of the header for the certificate subject column in the certificate selector dialog.">
Subject
</message>
@@ -2752,7 +2751,6 @@ are declared in tools/grit/grit_rule.gni
<message name="IDS_CERT_SELECTOR_SERIAL_COLUMN" desc="The text of the header for the certificate serial number column in the certificate selector dialog.">
Serial
</message>
- </if>
<message name="IDS_CERT_EXPORT_TYPE_BASE64" desc="The description of saving a single certificate in base64 encoding.">
Base64-encoded ASCII, single certificate
@@ -3319,7 +3317,7 @@ are declared in tools/grit/grit_rule.gni
</message>
<!-- Task Manager Window -->
- <if expr="not is_android">
+ <if expr="is_android">
<if expr="not use_titlecase">
<message name="IDS_TASK_MANAGER_KILL" desc="The caption of the Task Manager kill button">
End process
@@ -3598,7 +3596,7 @@ are declared in tools/grit/grit_rule.gni
<message name="IDS_UTILITY_PROCESS_FILE_UTILITY_NAME" desc="The name of the utility process used for various Chrome specific file operations.">
Chrome File Utilities
</message>
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_UTILITY_PROCESS_PROFILE_IMPORTER_NAME" desc="The name of the utility process used for importing profiles.">
Profile Importer
</message>
@@ -5150,7 +5148,7 @@ Keep your key file in a safe place. You
</message>
<!-- about:system strings -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_ABOUT_SYS_TITLE" desc="about:system page title">
About System
</message>
@@ -5181,7 +5179,7 @@ Keep your key file in a safe place. You
</if>
<!-- chrome://browser-switch strings -->
- <if expr="is_win or is_macosx or (is_linux and not chromeos)">
+ <if expr="is_win or is_macosx or is_android or (is_linux and not chromeos)">
<message name="IDS_ABOUT_BROWSER_SWITCH_TITLE" desc="about:browser-switch page title">
Legacy Browser Support
</message>
@@ -5648,7 +5646,7 @@ Keep your key file in a safe place. You
</message>
<!-- Strings for intent picker -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_TOOLTIP_INTENT_PICKER_ICON" desc="The tooltip for the intent picker bubble icon">
To open this link, choose an app
</message>
@@ -5877,23 +5875,10 @@ the Bookmarks menu.">
No thanks
</message>
</if>
- <if expr="not is_android">
- <message name="IDS_PASSWORD_MANAGER_SAVE_BUTTON" desc="Save button text for password manager">
- Save
- </message>
+ <if expr="is_android">
<message name="IDS_PASSWORD_MANAGER_MOVE_BUTTON" desc="Move button text for password manager">
Move
</message>
- <if expr="use_titlecase">
- <message name="IDS_PASSWORD_MANAGER_UPDATE_BUTTON" desc="In Title Case: Update button text for password manager">
- Update Password
- </message>
- </if>
- <if expr="not use_titlecase">
- <message name="IDS_PASSWORD_MANAGER_UPDATE_BUTTON" desc="Update button text for password manager">
- Update password
- </message>
- </if>
<message name="IDS_PASSWORD_MANAGER_BUBBLE_BLACKLIST_BUTTON" desc="Button text for the 'Save Password' bubble's 'Never remember for this site' option">
Never
</message>
@@ -5959,7 +5944,7 @@ the Bookmarks menu.">
</if>
<!-- Android uses custom UI for Bookmark importing -->
- <if expr="not is_android">
+ <if expr="is_android">
<!-- Import Settings Dialog -->
<if expr="is_win">
<message name="IDS_IMPORT_FROM_IE" desc="browser combo box: Microsoft Internet Explorer">
@@ -6786,7 +6771,7 @@ the Bookmarks menu.">
<!-- Settings related strings not specific to chrome://settings.
(Settings specific strings are in settings_strings.grdp).
Android uses native UI for settings -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_TOOLBAR_INFORM_SET_HOME_PAGE" desc="The confirmation message when dropping a link on the Home toolbar button">
Your home page has been set.
</message>
@@ -6993,7 +6978,7 @@ the Bookmarks menu.">
Create QR code for this Image
</message>
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_OMNIBOX_QRCODE_GENERATOR_ICON_LABEL" desc="String for the omnibox icon label for the QR code Generator">
QR code
</message>
@@ -7157,14 +7142,12 @@ the Bookmarks menu.">
</message>
<!-- Accessiblility strings for Infobars in Views -->
- <if expr="toolkit_views">
<message name="IDS_ACCNAME_INFOBAR_CONTAINER" desc="The accessible name for the infobar container.">
Infobar Container
</message>
<message name="IDS_ACCNAME_INFOBAR" desc="The accessible name for an infobar.">
Infobar
</message>
- </if>
<!-- One click sign-in bubble and dialog -->
<message name="IDS_ONE_CLICK_BUBBLE_UNDO" desc="The text for the undo button in the one click sign-in bubble.">
@@ -7218,7 +7201,7 @@ the Bookmarks menu.">
</message>
<!-- Managed UI on pages like chrome://settings and chrome://downloads -->
- <if expr="not is_android">
+ <if expr="is_android">
<if expr="chromeos">
<message name="IDS_DEVICE_MANAGED_WITH_HYPERLINK" desc="Message to end users in Enterprise/EDU, with a link for more info (ChromeOS)">
Your <ph name="BEGIN_LINK">&lt;a target="_blank" href="$1"&gt;</ph><ph name="DEVICE_TYPE">$2<ex>Chromebook</ex></ph> is managed<ph name="END_LINK">&lt;/a&gt;</ph> by your organization
@@ -7339,7 +7322,7 @@ the Bookmarks menu.">
</message>
<!-- Strings used for non-Android builds -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_APP_DEFAULT_PAGE_NAME"
desc="Default name for the first 'Apps' page on the New Tab Page.">
Apps
@@ -7985,7 +7968,7 @@ Please help our engineers fix this probl
</if>
<!-- Android uses native UI to handle Sync settings -->
- <if expr="not is_android">
+ <if expr="is_android">
<!-- Sync options dialog strings -->
<if expr="not chromeos">
<message name="IDS_SYNC_OVERVIEW" desc="The message that appears in the options dialog when sync has not been set up by the user.">
@@ -8094,7 +8077,6 @@ Please help our engineers fix this probl
</if>
<!-- Translate Bubble -->
- <if expr="toolkit_views">
<message name="IDS_TRANSLATE_BUBBLE_BEFORE_TRANSLATE_TITLE" desc="Title text for the translate bubble when asking to translate a page.">
Translate this page?
</message>
@@ -8225,7 +8207,6 @@ Please help our engineers fix this probl
<message name="IDS_TRANSLATE_BUBBLE_RESET" desc="Text to show for the language combobox to revert to its original state in the advanced view under TAB UI">
Reset
</message>
- </if>
<!-- Web and message center notifications -->
<message name="IDS_NOTIFICATION_BUTTON_SETTINGS" desc="Short button label to go to the notification settings panel">
@@ -9112,7 +9093,7 @@ Please help our engineers fix this probl
</message>
<!-- Media Galleries. -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_MEDIA_GALLERIES_DIALOG_HEADER" desc="Header for media gallery permissions dialog.">
Media-File Permissions for "<ph name="EXTENSION">$1<ex>Photo Editor</ex></ph>"
</message>
@@ -9651,7 +9632,7 @@ Please help our engineers fix this probl
</message>
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<!-- Device Chooser Prompt -->
<message name="IDS_BLUETOOTH_DEVICE_CHOOSER_PROMPT_ORIGIN" desc="The label that is used to introduce Bluetooth chooser details to the user in a popup when it is from a website.">
<ph name="Origin">$1<ex>www.9oo91e.qjz9zk</ex></ph> wants to pair
@@ -9764,7 +9745,7 @@ Please help our engineers fix this probl
</message>
<!-- Serial port chooser -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_SERIAL_PORT_CHOOSER_PROMPT_ORIGIN" desc="The label that is used to introduce serial port chooser details to the user in a popup when it is from a website.">
<ph name="Origin">$1<ex>www.9oo91e.qjz9zk</ex></ph> wants to connect to a serial port
</message>
@@ -9783,7 +9764,7 @@ Please help our engineers fix this probl
</if>
<!-- HID (Human Interface Device) chooser -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_HID_CHOOSER_PROMPT_ORIGIN" desc="The label that is used to introduce the Human Interface Device (HID) chooser details to the user in a popup when it is from a website.">
<ph name="Origin">$1<ex>www.9oo91e.qjz9zk</ex></ph> wants to connect to a HID device
</message>
@@ -9844,7 +9825,7 @@ Please help our engineers fix this probl
</if>
<!-- Framebust / Blocked Redirection intervention message -->
- <if expr="not is_android">
+ <if expr="is_android">
<!-- Android strings are declared in android_chrome_strings.grd. -->
<message name="IDS_REDIRECT_BLOCKED_MESSAGE" desc="The message stating that a redirect (noun) was blocked on this page. This will be followed on a separate line with the address the user was being redirected to.">
Redirect blocked:
@@ -9919,7 +9900,7 @@ Please help our engineers fix this probl
</if>
<!-- Download open confirmation dialog -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_DOWNLOAD_OPEN_CONFIRMATION_DIALOG_TITLE" desc="Title of the dialog prompt shown to users when an extension is trying to open a downloaded file.">
Open download
</message>
@@ -10088,7 +10069,7 @@ Please help our engineers fix this probl
</message>
<!-- Relaunch notification bubble and dialog. -->
- <if expr="not is_android">
+ <if expr="is_android">
<if expr="not chromeos">
<message name="IDS_RELAUNCH_ACCEPT_BUTTON" desc="The text in the accept button of a dialog that causes the browser to be relaunched immediately.">
Relaunch now
@@ -10105,7 +10086,7 @@ Please help our engineers fix this probl
</if>
<!-- Web-modal dialog shown during Web Authenticaton API requests. -->
- <if expr="is_win or is_macosx or desktop_linux or chromeos">
+ <if expr="is_win or is_macosx or is_android or desktop_linux or chromeos">
<message name="IDS_WEBAUTHN_GENERIC_TITLE" desc="Title of most dialogs shown while the user is authenticating on a web site using a security key.">
Use your security key with <ph name="APP_NAME">$1<ex>9oo91e.qjz9zk</ex></ph>
</message>
@@ -10348,7 +10329,7 @@ Please help our engineers fix this probl
</message>
<!-- User happiness tracking survey UI -->
- <if expr="not is_android">
+ <if expr="is_android">
<if expr="use_titlecase">
<message name="IDS_HATS_BUBBLE_OK_LABEL" translateable="false" desc="Button label on Happiness Tracking Survey's invitation banner, clicking the button gives the user's consent on taking the survey.">
Take Survey
@@ -10532,7 +10513,7 @@ Please help our engineers fix this probl
</message>
<!-- Extension request -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_ENTERPRISE_EXTENSION_REQUEST_APPROVED_TITLE" desc="The notification title when there are some extension requests approved.">
{NUM_EXTENSIONS, plural,
=1 {An extension has been approved}
--- a/components/components_strings.grd
+++ b/components/components_strings.grd
@@ -318,7 +318,7 @@
<part file="undo_strings.grdp" />
<part file="version_ui_strings.grdp" />
- <if expr="not is_android and not is_ios">
+ <if expr="is_android and not is_ios">
<part file="management_strings.grdp" />
</if>
<if expr="is_android">
@@ -398,7 +398,7 @@
<message name="IDS_PLUGIN_NOT_SUPPORTED" desc="The placeholder text for an unsupported plugin.">
This plugin is not supported
</message>
- <if expr="not is_android">
+ <if expr="is_android">
<if expr="not use_titlecase">
<message name="IDS_PRINT" desc="The text label of the Print... menu item. Opens a dialog box to select print settings">
&amp;Print...
--- a/chrome/app/bookmarks_strings.grdp
+++ b/chrome/app/bookmarks_strings.grdp
@@ -2,7 +2,7 @@
<!-- Bookmarks specific strings (included from generated_resources.grd). -->
<grit-part>
<!-- Begin of Bookmarks Bar strings-->
- <if expr="not is_android">
+ <if expr="is_android">
<!-- The special folders created when importing from other other browsers. -->
<if expr="is_win">
<message name="IDS_BOOKMARK_GROUP_FROM_IE" desc="The group name of bookmarks from Internet Explorer">
@@ -100,7 +100,7 @@
<message name="IDS_BOOKMARK_BAR_NEW_FOLDER" desc="Menu title for adding a new folder">
Add &amp;folder...
</message>
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_SHOW_BOOKMARK_BAR" desc="The toggle to show the bookmark bar">
&amp;Show bookmarks bar
</message>
@@ -152,7 +152,7 @@
<message name="IDS_BOOKMARK_BAR_NEW_FOLDER" desc="In Title Case: Menu title for adding a new folder">
Add &amp;Folder...
</message>
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_SHOW_BOOKMARK_BAR" desc="In Title Case: The toggle to show the bookmark bar">
&amp;Show Bookmarks Bar
</message>
--- a/chrome/app/chromium_strings.grd
+++ b/chrome/app/chromium_strings.grd
@@ -180,7 +180,7 @@ If you update this file, be sure also to
<release seq="1" allow_pseudo="false">
<messages fallback_to_english="true">
<!-- Settings specific strings -->
- <if expr="not is_android">
+ <if expr="is_android">
<part file="settings_chromium_strings.grdp" />
</if>
@@ -668,7 +668,6 @@ Chromium is unable to recover your setti
</if>
<!-- Enterprise sign-in dialog -->
- <if expr="toolkit_views">
<message name="IDS_ENTERPRISE_SIGNIN_TITLE" desc="The title of the dialog to confirm linking the browser profile with the signed-in enterprise account">
Link your Chromium data to this account?
</message>
@@ -678,10 +677,9 @@ Chromium is unable to recover your setti
<message name="IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITH_PROFILE_CREATION" desc="The warning message displayed to an enterprise user about to link their profile to their Google account. Additionally notifies the user that they can create a new profile instead. This message is followed by a 'Learn more' link.">
You are signing in with a managed account and giving its administrator control over your Chromium profile. Your Chromium data, such as your apps, bookmarks, history, passwords, and other settings will become permanently tied to <ph name="USER_NAME">$1<ex>[email protected]</ex></ph>. You will be able to delete this data via the Google Accounts Dashboard, but you will not be able to associate this data with another account. You can optionally create a new profile to keep your existing Chromium data separate. <ph name="LEARN_MORE">$2<ex>Learn more</ex></ph>
</message>
- </if>
<!-- about:browser-switch strings -->
- <if expr="is_win or is_macosx or (is_linux and not chromeos)">
+ <if expr="is_win or is_macosx or is_android or (is_linux and not chromeos)">
<message name="IDS_ABOUT_BROWSER_SWITCH_DESCRIPTION_UNKNOWN_BROWSER" desc="Description shown while waiting for an alternative browser to open, when the browser name is not auto-detected">
Your system administrator has configured Chromium to open an alternative browser to access <ph name="TARGET_URL_HOSTNAME">$1<ex>example.com</ex></ph>.
</message>
@@ -796,7 +794,7 @@ Chromium is unable to recover your setti
</if>
<!-- Material Design User Manager -->
- <if expr="not is_android and not chromeos">
+ <if expr="is_android and not chromeos">
<!-- User pod remove sync warning text -->
<message name="IDS_LOGIN_POD_USER_REMOVE_WARNING_SYNC" desc="Main text shown as a warning when attempting to remove an user.">
This person's browsing data will be deleted from this device. To recover the data, sign in to Chromium as <ph name="USER_EMAIL">$2<ex>[email protected]</ex></ph>.
@@ -873,7 +871,7 @@ Chromium is unable to recover your setti
</message>
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_CONTENT_CONTEXT_ACCESSIBILITY_LABELS_BUBBLE_TEXT" desc="The text of a bubble that confirms users allows integrating the accessibility labels service of Google to Chromium.">
If an image doesn’t have a useful description, Chromium will try to provide one for you. To create descriptions, images are sent to Google. You can turn this off in settings at any time.
</message>
@@ -958,7 +956,7 @@ Chromium is unable to recover your setti
</message>
<!-- Sync errors. Android uses native UI to handle Sync settings -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_SYNC_UPGRADE_CLIENT" desc="Message indicating client needs to be upgraded to the latest version.">
Update Chromium to start sync
</message>
@@ -1049,7 +1047,7 @@ Chromium is unable to recover your setti
</if>
<!-- Welcome page (chrome://welcome) strings -->
- <if expr="not chromeos and not is_android">
+ <if expr="not chromeos and is_android">
<message name="IDS_WELCOME_HEADER" desc="A message which will appear as the header on the Welcome UI if the user has never run Chromium before.">
Welcome to Chromium
</message>
@@ -1062,7 +1060,7 @@ Chromium is unable to recover your setti
</message>
</if>
<!-- Relaunch notification bubble and dialog. -->
- <if expr="not is_android">
+ <if expr="is_android">
<if expr="not chromeos">
<message name="IDS_RELAUNCH_RECOMMENDED_TITLE" desc="The title of a dialog that tells users that a browser relaunch is recommended for an update available for some number of days.">
{0, plural,
@@ -1106,7 +1104,7 @@ Chromium is unable to recover your setti
</if>
</if>
<!-- Chromium launch blocking dialog. -->
- <if expr="not is_android and not chromeos">
+ <if expr="is_android and not chromeos">
<message name="IDS_ENTERPRISE_STARTUP_CLOUD_POLICY_ENROLLMENT_TOOLTIP" desc="The information message of Chromium launch blocking dialog for machine level user cloud policy enrollment.">
Launching Chromium...
</message>
@@ -1121,7 +1119,7 @@ Chromium is unable to recover your setti
Share a Chromium tab
</message>
<!-- User happiness tracking survey UI -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_HATS_BUBBLE_TITLE" translateable="false" desc="The title of Happiness Tracking Survey's invitation banner, it invites users to take a survey">
Help us improve Chromium
</message>
--- a/components/sync_ui_strings.grdp
+++ b/components/sync_ui_strings.grdp
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_SYNC_BASIC_ENCRYPTION_DATA" desc="Text of the radio that when selected enables basic encryption.">
Encrypt synced passwords with your Google credentials
</message>
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -8,10 +8,10 @@
</outputs>
<release seq="1">
<structures>
- <if expr="is_win or is_macosx or desktop_linux or chromeos">
+ <if expr="is_win or is_macosx or desktop_linux or chromeos or is_android">
<structure name="IDR_SIGNIN_SHARED_CSS_JS" file="${root_gen_dir}\chrome\browser\resources\signin\signin_shared_css.js" use_base_dir="false" preprocess="true" type="chrome_html" />
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<!-- New Tab Page WebUI. -->
<structure name="IDR_INCOGNITO_TAB_HTML" file="resources\ntp4\incognito_tab.html" compress="gzip" flattenhtml="true" type="chrome_html" />
<structure name="IDR_INCOGNITO_TAB_THEME_CSS" file="resources\ntp4\incognito_tab_theme.css" compress="gzip" flattenhtml="true" type="chrome_html" />
@@ -64,7 +64,7 @@
<include name="IDR_DISCARDS_SITE_DATA_MOJOM_LITE_JS" file="${root_gen_dir}\chrome\browser\ui\webui\discards\site_data.mojom-lite.js" compress="gzip" use_base_dir="false" type="BINDATA" />
<include name="IDR_DISCARDS_SORTED_TABLE_BEHAVIOR_JS" file="resources\discards\sorted_table_behavior.js" compress="gzip" type="BINDATA" />
</if>
- <if expr="is_win or is_macosx or (is_linux and not chromeos)">
+ <if expr="is_win or is_macosx or is_android or (is_linux and not chromeos)">
<include name="IDR_BROWSER_SWITCH_APP_JS" file="${root_gen_dir}\chrome\browser\resources\browser_switch\app.js" compress="gzip" use_base_dir="false" type="BINDATA" />
<include name="IDR_BROWSER_SWITCH_PROXY_JS" file="resources\browser_switch\browser_switch_proxy.js" compress="gzip" type="BINDATA" />
<include name="IDR_BROWSER_SWITCH_HTML" file="resources\browser_switch\browser_switch.html" compress="gzip" allowexternalscript="true" type="BINDATA" />
@@ -80,7 +80,7 @@
<include name="IDR_ABOUT_NACL_CSS" file="resources\about_nacl\about_nacl.css" compress="gzip" flattenhtml="true" type="chrome_html" />
<include name="IDR_ABOUT_NACL_JS" file="resources\about_nacl\about_nacl.js" compress="gzip" type="BINDATA" />
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<include name="IDR_ABOUT_SYS_HTML" file="resources\about_sys\about_sys.html" compress="gzip" type="BINDATA" />
<include name="IDR_ABOUT_SYS_CSS" file="resources\about_sys\about_sys.css" compress="gzip" flattenhtml="true" type="BINDATA" />
<include name="IDR_ABOUT_SYS_JS" file="resources\about_sys\about_sys.js" compress="gzip" type="BINDATA" />
@@ -111,7 +111,7 @@
<include name="IDR_OFFLINE_INTERNALS_BROWSER_PROXY_JS" file="resources\offline_pages\offline_internals_browser_proxy.js" type="BINDATA" compress="gzip" />
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<!-- New Tab Page -->
<part file="resources/local_ntp/icons.grdp" />
</if>
@@ -129,7 +129,7 @@
<include name="IDR_HANGOUT_SERVICES_MANIFEST" file="resources\hangout_services\manifest.json" type="BINDATA" />
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<!-- Page not available for guest. -->
<include name="IDR_PAGE_NOT_AVAILABLE_FOR_GUEST_APP_HTML" file="resources\page_not_available_for_guest\app.html" type="BINDATA" />
</if>
@@ -171,14 +171,14 @@
<if expr="desktop_linux">
<include name="IDR_PLUGIN_DB_JSON" file="resources\plugin_metadata\plugins_linux.json" type="BINDATA" />
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<include name="IDR_MANAGEMENT_HTML" file="resources\management\management.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_MANAGEMENT_UI_JS" file="${root_gen_dir}/chrome/browser/resources/management/management_ui.js" use_base_dir="false" type="BINDATA" compress="gzip" preprocess="true" />
<include name="IDR_MANAGEMENT_BROWSER_PROXY_JS" file="resources\management\management_browser_proxy.js" type="BINDATA" compress="gzip" preprocess="true" />
<include name="IDR_MANAGEMENT_ICONS_JS" file="${root_gen_dir}/chrome/browser/resources/management/icons.js" use_base_dir="false" type="BINDATA" compress="gzip" preprocess="true" />
</if>
<include name="IDR_URL_MOJOM_LITE_JS" file="${root_gen_dir}\url\mojom\url.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
- <if expr="is_win or is_macosx or desktop_linux or chromeos">
+ <if expr="is_win or is_macosx or desktop_linux or chromeos or is_android">
<include name="IDR_SYNC_DISABLED_CONFIRMATION_HTML" file="resources\signin\sync_confirmation\sync_disabled_confirmation.html" type="BINDATA" />
<include name="IDR_SYNC_DISABLED_CONFIRMATION_APP_JS" file="${root_gen_dir}\chrome\browser\resources\signin\sync_confirmation\sync_disabled_confirmation_app.js" use_base_dir="false" preprocess="true" type="BINDATA" />
<include name="IDR_SYNC_CONFIRMATION_HTML" file="resources\signin\sync_confirmation\sync_confirmation.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
@@ -188,7 +188,7 @@
<include name="IDR_SYNC_CONFIRMATION_IMAGES_SYNC_CONFIRMATION_ILLUSTRATION_SVG" file="resources\signin\sync_confirmation\images\sync_confirmation_illustration.svg" type="BINDATA" compress="gzip" />
<include name="IDR_SYNC_CONFIRMATION_IMAGES_SYNC_CONFIRMATION_ILLUSTRATION_DARK_SVG" file="resources\signin\sync_confirmation\images\sync_confirmation_illustration_dark.svg" type="BINDATA" compress="gzip" />
</if>
- <if expr="is_win or is_macosx or desktop_linux">
+ <if expr="is_win or is_macosx or is_android or desktop_linux">
<include name="IDR_SIGNIN_EMAIL_CONFIRMATION_HTML" file="resources\signin\signin_email_confirmation\signin_email_confirmation.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
<include name="IDR_SIGNIN_EMAIL_CONFIRMATION_APP_JS" file="${root_gen_dir}\chrome\browser\resources\signin\signin_email_confirmation\signin_email_confirmation_app.js" use_base_dir="false" preprocess="true" type="BINDATA" />
<include name="IDR_SIGNIN_ERROR_HTML" file="resources\signin\signin_error\signin_error.html" type="BINDATA" />
@@ -312,7 +312,7 @@
<include name="IDR_QUICKOFFICE_MANIFEST" file="resources\chromeos\quickoffice\manifest.json" type="BINDATA" />
<include name="IDR_PRODUCT_CHROMEOS_SYNC_CONSENT_SCREEN_ICONS" file="internal\resources\chromeos-sync-consent-icons.html" type="BINDATA" />
</if>
- <if expr="not is_android and not chromeos">
+ <if expr="is_android and not chromeos">
<include name="IDR_CONTROL_BAR_HTML" file="resources\user_manager\control_bar.html" type="BINDATA" />
<include name="IDR_CONTROL_BAR_JS" file="resources\user_manager\control_bar.js" type="BINDATA" />
<include name="IDR_CREATE_PROFILE_HTML" file="resources\user_manager\create_profile.html" type="BINDATA" />
@@ -330,7 +330,7 @@
<include name="IDR_USER_MANAGER_TUTORIAL_HTML" file="resources\user_manager\user_manager_tutorial.html" type="BINDATA" />
<include name="IDR_USER_MANAGER_TUTORIAL_JS" file="resources\user_manager\user_manager_tutorial.js" type="BINDATA" />
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<include name="IDR_IDENTITY_INTERNALS_HTML" file="resources\identity_internals\identity_internals.html" compress="gzip" type="BINDATA" />
<include name="IDR_IDENTITY_INTERNALS_CSS" file="resources\identity_internals\identity_internals.css" compress="gzip" type="BINDATA" />
<include name="IDR_IDENTITY_INTERNALS_JS" file="resources\identity_internals\identity_internals.js" compress="gzip" type="BINDATA" />
@@ -407,7 +407,7 @@
</if>
<include name="IDR_BRAILLE_MANIFEST" file="resources\chromeos\accessibility\braille_ime\manifest.json" type="BINDATA" />
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<include name="IDR_MEDIA_ROUTER_INTERNALS_HTML" file="resources\media_router\media_router_internals.html" compress="gzip" type="BINDATA" />
<include name="IDR_MEDIA_ROUTER_INTERNALS_CSS" file="resources\media_router\media_router_internals.css" compress="gzip" type="BINDATA" />
<include name="IDR_MEDIA_ROUTER_INTERNALS_JS" file="resources\media_router\media_router_internals.js" compress="gzip" type="BINDATA" />
--- a/components/history_strings.grdp
+++ b/components/history_strings.grdp
@@ -63,7 +63,7 @@
Clear Browsing Data...
</message>
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_HISTORY_OTHER_SESSIONS_COLLAPSE_SESSION" desc="In the 'Other Sessions' menu on the history page, the label for the command to collapse (hide) the list of windows and tabs in a session.">
Collapse list
</message>
--- a/components/new_or_sad_tab_strings.grdp
+++ b/components/new_or_sad_tab_strings.grdp
@@ -106,7 +106,7 @@
Learn more
</message>
</if>
- <if expr="is_win or is_linux or is_macosx or chromeos">
+ <if expr="is_win or is_linux or is_android or is_macosx or chromeos">
<message name="IDS_SAD_TAB_ERROR_CODE" desc="The message displayed on the crashed web page indicating the type of the crash.">
Error code: <ph name="ERROR_CODE">$1<ex>STATUS_ACCESS_VIOLATION</ex></ph>
</message>
@@ -117,7 +117,7 @@
desc="Title of the new tab page, not to be confused with the action of opening a new tab.">
New Tab
</message>
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_NEW_TAB_OTR_HEADING"
desc="Heading used when a person opens an OTR window">
You’ve gone incognito
--- a/chrome/app/profiles_strings.grdp
+++ b/chrome/app/profiles_strings.grdp
@@ -441,11 +441,6 @@
Although you can no longer access your old profile, you can still remove it.
</message>
<if expr="is_android">
- <message name="IDS_SYNC_USER_NAME_IN_USE_ERROR" desc="Mobile: An error message shown when a user tries to sign in to sync using a user name that's already in use by another profile.">
- This account is already being used on this device.
- </message>
- </if>
- <if expr="not is_android">
<message name="IDS_SYNC_USER_NAME_IN_USE_ERROR" desc="An error message shown when a user tries to sign in to sync using a user name that's already in use by another profile.">
This account is already being used on this computer.
</message>
@@ -455,7 +450,7 @@
</if>
<!-- Android does not support multiple profiles and supervised users -->
- <if expr="not is_android">
+ <if expr="is_android">
<!-- Create Profile Dialog -->
<message name="IDS_PROFILES_CREATE_TITLE" desc="Title of the create profile dialog">
Add person
@@ -488,7 +483,7 @@
</message>
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<!-- User manager web UI -->
<if expr="use_titlecase">
<message name="IDS_ADD_USER_BUTTON" desc="Text shown on an add user button on login/locker screen">
--- a/components/autofill_payments_strings.grdp
+++ b/components/autofill_payments_strings.grdp
@@ -68,7 +68,7 @@
</if>
</if>
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_AUTOFILL_FIELD_LABEL_PHONE" desc="The label of the Phone entry in a settings-like UI to enter a phone number.">
Phone
</message>
@@ -79,19 +79,15 @@
<!-- Autofill save credit card bubble or infobar prompt -->
<if expr="is_android or is_ios">
- <then>
<message name="IDS_AUTOFILL_SAVE_CARD_INFOBAR_ACCEPT" desc="Text to show for the Autofill save credit card infobar accept button.">
Save
</message>
- </then>
- <else>
<message name="IDS_AUTOFILL_SAVE_CARD_BUBBLE_LOCAL_SAVE_ACCEPT" desc="Text to show for the Autofill save credit card local save bubble accept button.">
Save
</message>
<message name="IDS_AUTOFILL_SAVE_CARD_BUBBLE_UPLOAD_SAVE_ACCEPT" desc="Text to show for the Autofill save credit card upload save bubble accept button.">
Save
</message>
- </else>
</if>
<if expr="is_android">
<message name="IDS_AUTOFILL_SAVE_CARD_PROMPT_CONFIRM" desc="Text to show for the Autofill upload save credit card prompt accept button when more information (e.g., CVC) was needed in order to save the card and was entered." formatter_data="android_java">
@@ -196,7 +192,7 @@
</message>
<!-- Autofill Local card migration bubble or dialog -->
- <if expr="not is_ios and not is_android">
+ <if expr="not is_ios and is_android">
<message name="IDS_AUTOFILL_GOOGLE_PAY_LOGO_ACCESSIBLE_NAME" desc="The accessible name for the Google Pay logo in the local card migration bubble or dialog.">
Google Pay logo
</message>
@@ -400,7 +396,7 @@
<!-- WebAuthn fingerprint opt-in dialog -->
<!-- Desktop only -->
- <if expr="not is_ios and not is_android">
+ <if expr="not is_ios and is_android">
<if expr="is_macosx">
<message name="IDS_AUTOFILL_WEBAUTHN_OPT_IN_DIALOG_TITLE" desc="Headline asking the user if they want to use their device's platform authenticator to confirm their cards in the future instead of CVC.">
Use Touch ID instead of CVC?
@@ -456,7 +452,7 @@
<!-- Webauthn verify pending dialog -->
<!-- Desktop only -->
- <if expr="not is_ios and not is_android">
+ <if expr="not is_ios and is_android">
<message name="IDS_AUTOFILL_WEBAUTHN_VERIFY_PENDING_DIALOG_TITLE" desc="Headline of the dialog shown when user has opted in to use platform biometric authenticator and has selected one card to fill the form. This shows the verification of the selected card is in progress.">
Verifying your identity...
</message>
@@ -473,7 +469,7 @@
</message>
<!-- Cloud token related strings (Desktop only) -->
- <if expr="not is_ios and not is_android">
+ <if expr="not is_ios and is_android">
<message name="IDS_AUTOFILL_CLOUD_TOKEN_DROPDOWN_OPTION_LABEL" desc="Text shown in the button in the Autofill dropdown menu when a credit card form field is queried, to offer the option to use a virtual card.">
Use a virtual card number...
</message>
--- a/components/autofill_strings.grdp
+++ b/components/autofill_strings.grdp
@@ -168,7 +168,7 @@
Show cards from your Google Account
</message>
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_AUTOFILL_POPUP_ACCESSIBLE_NODE_DATA" desc="The accessibility text to speak when we display an autofill popup.">
Autofill
</message>
--- a/components/page_info_strings.grdp
+++ b/components/page_info_strings.grdp
@@ -181,7 +181,7 @@
</message>
<!-- Certificate Viewer link -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_PAGE_INFO_CERTIFICATE" desc="Title of the certificate area in the Page Info bubble, shown when a HTTPS site is loaded.">
Certificate
</message>
@@ -217,7 +217,7 @@
</if>
<!-- Cookies -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_PAGE_INFO_COOKIES" desc="The label for the Cookies setting in the Page Information Window.">
Cookies
</message>
@@ -440,7 +440,7 @@
</message>
<!-- Permission change infobar. -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_PAGE_INFO_INFOBAR_TEXT" desc="The string shown in the infobar after the user has changed site permissions settings, reminding them to reload the page in order for the new settings to take effect.">
To apply your updated settings to this site, reload this page
</message>
--- a/components/payments_strings.grdp
+++ b/components/payments_strings.grdp
@@ -558,7 +558,7 @@
</if>
<!-- Payment Request section preview strings. They are slightly different on desktop and android because the pluralization and formatting code behaves differently. -->
- <if expr="not is_android">
+ <if expr="is_android">
<message name="IDS_PAYMENT_REQUEST_PAYMENT_METHODS_PREVIEW" desc="This is a snippet of a payment method a user has saved to Chrome, plus an indication of the number of additional payment methods the user has saved. Its function is to show the user has payment methods that can be used to complete a payment, and thus doesn't have to type the entire payment method. [ICU Syntax]">
{PAYMENT_METHOD, plural,
=0 {<ph name="PAYMENT_METHOD_PREVIEW">{1}<ex>VISA ....1234</ex></ph>}
--- a/ui/webui/resources/webui_resources.grd
+++ b/ui/webui/resources/webui_resources.grd
@@ -135,12 +135,12 @@ without changes to the corresponding grd
use_base_dir="false" type="BINDATA" compress="gzip"
preprocess="true" />
- <if expr="not is_android">
+ <if expr="is_android">
<part file="cr_components/cr_components_images.grdp" />
<part file="cr_elements_images.grdp" />
</if>
- <if expr="not is_android and not is_ios">
+ <if expr="is_android and not is_ios">
<part file="cr_components/cr_components_resources_v3.grdp" />
<part file="cr_elements_resources_v3.grdp" />
<part file="cr_polymer_resources_v3.grdp" />
@@ -459,7 +459,7 @@ without changes to the corresponding grd
compress="gzip" />
</if>
- <if expr="not is_android and not is_ios">
+ <if expr="is_android and not is_ios">
<part file="cr_components/cr_components_resources.grdp" />
<part file="cr_elements_resources.grdp" />
<part file="cr_polymer_resources.grdp" />

8267
patches/Extensions/base/src.patch

File diff suppressed because it is too large

1436
patches/Extensions/crx-download-install-prompt.patch

File diff suppressed because it is too large

682
patches/Extensions/fix-extension-remove-button.patch

@ -0,0 +1,682 @@
From: Wengling Chen <[email protected]>
Date: Mon, 13 Jul 2020 23:37:25 -0400
Subject: fix remove button for extensions
---
---
chrome/android/BUILD.gn | 1
chrome/android/chrome_java_sources.gni | 2
chrome/android/java/src/org/chromium/chrome/browser/extensions/ExtensionUninstallCustomScrollView.java | 63 +++
chrome/android/java/src/org/chromium/chrome/browser/extensions/ExtensionUninstallDialogBridge.java | 146 ++++++++
chrome/browser/extensions/android/BUILD.gn | 1
chrome/browser/extensions/android/java/res/layout/extension_uninstall_dialog.xml | 38 ++
chrome/browser/extensions/chrome_extension_function_details.cc | 17
chrome/browser/ui/BUILD.gn | 3
chrome/browser/ui/android/strings/android_chrome_strings.grd | 5
chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc | 4
chrome/browser/ui/views/extensions/extension_uninstall_dialog_view_android.cc | 176 ++++++++++
chrome/browser/ui/views/extensions/extension_uninstall_dialog_view_android.h | 87 ++++
12 files changed, 536 insertions(+), 7 deletions(-)
--- a/chrome/browser/extensions/chrome_extension_function_details.cc
+++ b/chrome/browser/extensions/chrome_extension_function_details.cc
@@ -76,15 +76,18 @@ gfx::NativeWindow ChromeExtensionFunctio
extensions::WindowController* controller =
extensions::WindowControllerList::GetInstance()->CurrentWindowForFunction(
function_);
- if (controller)
+ LOG(INFO) << "chrome_extension_function_details.cc: GetNativeWindowForUI: controller == NULL: " << (controller == NULL);
+ if (controller) {
+ LOG(INFO) << "chrome_extension_function_details.cc: GetNativeWindowForUI: controller->window()->GetNativeWindow() == NULL: " << (controller->window()->GetNativeWindow() == NULL);
return controller->window()->GetNativeWindow();
+ }
// Next, check the sender web contents for if it supports modal dialogs.
// TODO(devlin): This seems weird. Why wouldn't we check this first?
content::WebContents* sender_web_contents = function_->GetSenderWebContents();
+ LOG(INFO) << "chrome_extension_function_details.cc: GetNativeWindowForUI: sender_web_contents->GetTopLevelNativeWindow() == NULL: " << (sender_web_contents->GetTopLevelNativeWindow() == NULL);
if (sender_web_contents &&
- web_modal::WebContentsModalDialogManager::FromWebContents(
- sender_web_contents)) {
+ sender_web_contents->GetTopLevelNativeWindow()) {
return sender_web_contents->GetTopLevelNativeWindow();
}
@@ -94,16 +97,22 @@ gfx::NativeWindow ChromeExtensionFunctio
extensions::AppWindow* window =
extensions::AppWindowRegistry::Get(function_->browser_context())
->GetCurrentAppWindowForApp(function_->extension()->id());
- if (window)
+ LOG(INFO) << "chrome_extension_function_details.cc: GetNativeWindowForUI: extensions::AppWindow* window == NULL: " << (window == NULL);
+ if (window) {
+ LOG(INFO) << "chrome_extension_function_details.cc: GetNativeWindowForUI: window->web_contents()->GetTopLevelNativeWindow() == NULL: " << (window->web_contents()->GetTopLevelNativeWindow() == NULL);
return window->web_contents()->GetTopLevelNativeWindow();
+ }
}
// As a last resort, find a browser.
Browser* browser = chrome::FindBrowserWithProfile(GetProfile());
+ LOG(INFO) << "chrome_extension_function_details.cc: GetNativeWindowForUI: browser == NULL: " << (browser == NULL);
// If there are no browser windows open, no window is available.
// This could happen e.g. if extension launches a long process or simple
// sleep() in the background script, during which browser is closed.
if (!browser)
return nullptr;
+
+ LOG(INFO) << "chrome_extension_function_details.cc: GetNativeWindowForUI: browser->window()->GetNativeWindow() == NULL: " << (browser->window()->GetNativeWindow() == NULL);
return browser->window()->GetNativeWindow();
}
--- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
@@ -125,13 +125,16 @@ ExtensionUninstallDialogViews::~Extensio
}
void ExtensionUninstallDialogViews::Show() {
+ LOG(INFO) << "extension_uninstall_dialog_view.cc: Show(): parent() == NULL: " << (parent() == NULL);
BrowserView* const browser_view =
parent() ? BrowserView::GetBrowserViewForNativeWindow(parent()) : nullptr;
+ LOG(INFO) << "extension_uninstall_dialog_view.cc: Show(): browser_view == NULL: " << (browser_view == NULL);
ToolbarActionView* anchor_view = nullptr;
ExtensionsToolbarContainer* const container =
browser_view ? browser_view->toolbar_button_provider()
->GetExtensionsToolbarContainer()
: nullptr;
+ LOG(INFO) << "extension_uninstall_dialog_view.cc: Show(): container == NULL: " << (container == NULL);
if (container) {
anchor_view = container->GetViewForId(extension()->id());
} else if (browser_view &&
@@ -145,6 +148,7 @@ void ExtensionUninstallDialogViews::Show
if (reference_view && reference_view->GetVisible())
anchor_view = reference_view;
}
+ LOG(INFO) << "extension_uninstall_dialog_view.cc: Show(): anchor_view == NULL: " << (anchor_view == NULL);
view_ = new ExtensionUninstallDialogDelegateView(
this, anchor_view, extension(), triggering_extension(), &icon());
if (anchor_view) {
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/extensions/ExtensionUninstallCustomScrollView.java
@@ -0,0 +1,63 @@
+// Copyright 2020 The Ungoogled Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.extensions;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.CompoundButton.OnCheckedChangeListener;
+import android.widget.ScrollView;
+import android.widget.TextView;
+
+import org.chromium.chrome.extensions.R;
+
+/**
+ * Dialog that is displayed to ask user whether they want to remove the extension.
+ */
+public class ExtensionUninstallCustomScrollView
+ extends ScrollView implements OnCheckedChangeListener {
+ private TextView mSubtitleView;
+ private CheckBox mCheckbox;
+
+ private boolean mCheckboxChecked;
+
+ public ExtensionUninstallCustomScrollView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ mCheckboxChecked = false;
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+
+ mSubtitleView = findViewById(R.id.subtitle);
+ mCheckbox = findViewById(R.id.checkbox);
+ }
+
+ void initialize(String extension_name,
+ String windowTitle, String heading,
+ boolean checkbox, String checkboxLabel) {
+
+ if (checkbox) {
+ mCheckbox.setVisibility(View.VISIBLE);
+ mCheckbox.setText(checkboxLabel);
+ mCheckbox.setChecked(false);
+ }
+ mCheckbox.setOnCheckedChangeListener(this);
+
+ mSubtitleView.setText(heading);
+ }
+
+ protected boolean getcheckboxChecked() {
+ return mCheckboxChecked;
+ }
+
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ mCheckboxChecked = isChecked;
+ }
+}
\ No newline at end of file
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/extensions/ExtensionUninstallDialogBridge.java
@@ -0,0 +1,146 @@
+// Copyright 2020 The Ungoogled Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.extensions;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.view.LayoutInflater;
+
+import org.chromium.base.annotations.CalledByNative;
+import org.chromium.base.annotations.NativeMethods;
+import org.chromium.chrome.browser.ChromeActivity;
+import org.chromium.chrome.extensions.R;
+import org.chromium.ui.base.WindowAndroid;
+import org.chromium.ui.modaldialog.DialogDismissalCause;
+import org.chromium.ui.modaldialog.ModalDialogManager;
+import org.chromium.ui.modaldialog.ModalDialogProperties;
+import org.chromium.ui.modelutil.PropertyModel;
+
+
+/**
+* Helper class to handle communication between extension uninstall dialog and native.
+*/
+
+public class ExtensionUninstallDialogBridge implements ModalDialogProperties.Controller {
+ private long mNativeExtensionUninstallDialogDelegateView;
+ private PropertyModel mDialogModel;
+ private ExtensionUninstallCustomScrollView mCustomView;
+ private ModalDialogManager mModalDialogManager;
+ private Context mContext;
+
+ private ExtensionUninstallDialogBridge(long nativeExtensionUninstallDialogDelegateView) {
+ mNativeExtensionUninstallDialogDelegateView = nativeExtensionUninstallDialogDelegateView;
+ }
+
+ @CalledByNative
+ public static ExtensionUninstallDialogBridge create(
+ long nativeExtensionUninstallDialogDelegateView) {
+ return new ExtensionUninstallDialogBridge(nativeExtensionUninstallDialogDelegateView);
+ }
+
+ @CalledByNative
+ private void destroy() {
+ mNativeExtensionUninstallDialogDelegateView = 0;
+ if (mModalDialogManager != null) {
+ mModalDialogManager.dismissDialog(
+ mDialogModel, DialogDismissalCause.DISMISSED_BY_NATIVE);
+ }
+ }
+
+ @CalledByNative
+ public void show(WindowAndroid windowAndroid,
+ String extension_name, String windowTitle, String heading,
+ boolean checkbox, String checkboxLabel) {
+ ChromeActivity activity = (ChromeActivity) windowAndroid.getActivity().get();
+ // If the activity has gone away, just clean up the native pointer.
+ if (activity == null) {
+ onDismiss(null, DialogDismissalCause.ACTIVITY_DESTROYED);
+ return;
+ }
+
+ mModalDialogManager = activity.getModalDialogManager();
+ mContext = activity;
+
+ // Already showing the dialog.
+ if (mDialogModel != null) return;
+
+ // Actually show the dialog.
+ mCustomView = (ExtensionUninstallCustomScrollView) LayoutInflater.from(mContext).inflate(
+ R.layout.extension_uninstall_dialog, null);
+ mCustomView.initialize(extension_name, windowTitle, heading,
+ checkbox, checkboxLabel);
+
+ Resources resources = mContext.getResources();
+ mDialogModel =
+ new PropertyModel.Builder(ModalDialogProperties.ALL_KEYS)
+ .with(ModalDialogProperties.CONTROLLER, this)
+ .with(ModalDialogProperties.TITLE, windowTitle)
+ .with(ModalDialogProperties.CUSTOM_VIEW, mCustomView)
+ .with(ModalDialogProperties.POSITIVE_BUTTON_TEXT, resources,
+ R.string.extension_prompt_uninstall_button)
+ .with(ModalDialogProperties.NEGATIVE_BUTTON_TEXT, resources,
+ R.string.cancel)
+ .build();
+
+ mModalDialogManager.showDialog(mDialogModel, ModalDialogManager.ModalDialogType.APP);
+ }
+
+ @Override
+ public void onClick(PropertyModel model, int buttonType) {
+ switch (buttonType) {
+ case ModalDialogProperties.ButtonType.POSITIVE:
+ mModalDialogManager.dismissDialog(
+ model, DialogDismissalCause.POSITIVE_BUTTON_CLICKED);
+ break;