Commit f65b584d authored by Gayane Petrosyan's avatar Gayane Petrosyan Committed by Commit Bot

[QRCode Android] Basic code structure for QrCodeSharing

Screenshot on Android 8
https://screenshot.googleplex.com/UVZOQ5FA2nh.png

Bug: 993920
Change-Id: Id5036c2183ec28ef029e2fb8e19a35b83d7c5755
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1848370
Commit-Queue: Gayane Petrosyan <gayane@chromium.org>
Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707551}
parent 7bd2f05f
......@@ -18,6 +18,7 @@ import("//chrome/android/features/vr/public_vr_java_sources.gni")
import("//chrome/android/feed/feed_java_sources.gni")
import("//chrome/android/modules/chrome_feature_module_tmpl.gni")
import("//chrome/android/monochrome_android_manifest_jinja_variables.gni")
import("//chrome/browser/share/android/java_sources.gni")
import("//chrome/chrome_paks.gni")
import("//chrome/common/features.gni")
import("//chrome/process_version_rc_template.gni") # For branding_file_path.
......@@ -478,6 +479,10 @@ android_library("chrome_java") {
]
processor_args_javac = [ "dagger.fastInit=enabled" ]
# TODO(gayane): Instead of adding source files, add it as a separate
# dependency when circular deps is resolved.
java_files += share_java_sources
}
generate_locale_config_srcjar("chrome_locale_config") {
......
......@@ -870,6 +870,23 @@ by a child template that "extends" this file.
</intent-filter>
</activity>
<activity
android:name="org.chromium.chrome.browser.share.qrcode.QrCodeShareActivity"
android:icon="@drawable/ic_launcher"
android:label="@string/qr_code_share_icon_label"
android:enabled="false"
android:excludeFromRecents="true"
android:exported="true"
android:noHistory="true"
android:theme="@android:style/Theme.NoDisplay"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<!-- Activity for dispatching intents to Instant Apps. -->
<activity
android:name="org.chromium.chrome.browser.instantapps.AuthenticatedProxyActivity"
......
......@@ -2,6 +2,7 @@ include_rules = [
"-chrome/android/features/keyboard_accessory/internal",
"+chrome/browser/android/thin_webview/java",
"+chrome/browser/share/android",
"+chrome/browser/ui/android/widget",
"+chrome/browser/download/android/java",
"+chrome/browser/util/android/java",
......
......@@ -175,6 +175,22 @@
<data android:mimeType="text/plain"/>
</intent-filter>
</activity>
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize"
android:enabled="false"
android:excludeFromRecents="true"
android:exported="true"
android:icon="@drawable/ic_launcher"
android:label="@string/qr_code_share_icon_label"
android:name="org.chromium.chrome.browser.share.qrcode.QrCodeShareActivity"
android:noHistory="true"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"/>
</intent-filter>
</activity>
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize"
android:enabled="false"
......
......@@ -319,6 +319,7 @@ public abstract class ChromeFeatureList {
public static final String SERVICE_WORKER_PAYMENT_APPS = "ServiceWorkerPaymentApps";
public static final String SETTINGS_MODERN_STATUS_BAR = "SettingsModernStatusBar";
public static final String SHARED_CLIPBOARD_UI = "SharedClipboardUI";
public static final String SHARING_QR_CODE_ANDROID = "SharingQrCodeAndroid";
public static final String SHOPPING_ASSIST = "ShoppingAssist";
public static final String SHOW_TRUSTED_PUBLISHER_URL = "ShowTrustedPublisherURL";
public static final String SPANNABLE_INLINE_AUTOCOMPLETE = "SpannableInlineAutocomplete";
......
......@@ -16,6 +16,7 @@ import org.chromium.chrome.browser.feature_engagement.ScreenshotTabObserver;
import org.chromium.chrome.browser.offlinepages.OfflinePageUtils;
import org.chromium.chrome.browser.printing.PrintShareActivity;
import org.chromium.chrome.browser.send_tab_to_self.SendTabToSelfShareActivity;
import org.chromium.chrome.browser.share.qrcode.QrCodeShareActivity;
import org.chromium.chrome.browser.tab.SadTab;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.util.ChromeFileProvider;
......@@ -79,6 +80,10 @@ public class ShareMenuActionHandler {
classesToEnable.add(SendTabToSelfShareActivity.class);
}
if (QrCodeShareActivity.featureIsAvailable()) {
classesToEnable.add(QrCodeShareActivity.class);
}
if (!classesToEnable.isEmpty()) {
OptionalShareTargetsManager.getInstance().enableOptionalShareActivities(activity,
classesToEnable,
......
......@@ -3988,6 +3988,11 @@ The site does NOT gain access to the camera. The camera images are only visible
Extra ICU
</message>
<!-- QR Code -->
<message name="IDS_QR_CODE_SHARE_ICON_LABEL" desc="Icon label for sharing qith QR Code activity.">
QR Code
</message>
</messages>
</release>
</grit>
4cd4c6bd343baba8d302ee5fc63b84df556119a4
\ No newline at end of file
......@@ -2871,6 +2871,7 @@ jumbo_static_library("browser") {
"//chrome/browser/android/thin_webview/internal",
"//chrome/browser/android/webapk:proto",
"//chrome/browser/notifications/scheduler/public",
"//chrome/browser/share",
"//chrome/services/media_gallery_util/public/cpp",
"//components/autofill_assistant/browser",
"//components/cdm/browser",
......
......@@ -13,6 +13,7 @@
#include "base/metrics/field_trial_params.h"
#include "base/stl_util.h"
#include "chrome/android/chrome_jni_headers/ChromeFeatureList_jni.h"
#include "chrome/browser/share/features.h"
#include "chrome/browser/sharing/shared_clipboard/feature_flags.h"
#include "chrome/common/chrome_features.h"
#include "components/autofill/core/common/autofill_features.h"
......@@ -169,6 +170,7 @@ const base::Feature* kFeaturesExposedToJava[] = {
&kServiceManagerForDownload,
&kSettingsModernStatusBar,
&kSharedClipboardUI,
&kSharingQrCodeAndroid,
&kShoppingAssist,
&kSpannableInlineAutocomplete,
&kSpecialLocaleWrapper,
......
# Copyright 2019 The 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.
source_set("share") {
sources = [
"features.cc",
"features.h",
]
deps = [
"//base",
]
}
include_rules = [
# TODO(gayane): Remove this dependency when ShareActivity is moved to chrome/browser/share.
"+chrome/android/java/src/org/chromium/chrome/browser/share",
"+chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java",
"+chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java"
]
\ No newline at end of file
file://components/send_tab_to_self/OWNERS
# COMPONENT: UI>Browser>Sharing
\ No newline at end of file
// Copyright 2019 The 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.share.qrcode;
import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.share.ShareActivity;
/**
* A simple activity that shows sharing QR code option in share menu.
*/
public class QrCodeShareActivity extends ShareActivity {
@Override
protected void handleShareAction(ChromeActivity triggeringActivity) {
// TODO(crbug.com/993920): Open QR code share/scan activity.
}
public static boolean featureIsAvailable() {
return ChromeFeatureList.isEnabled(ChromeFeatureList.SHARING_QR_CODE_ANDROID);
}
}
\ No newline at end of file
# Copyright 2019 The 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.
# TODO(gayane): This should be a separate build target when circular dependencies are removed.
share_java_sources = [ "//chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/qrcode/QrCodeShareActivity.java" ]
// Copyright 2019 The 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.
#include "chrome/browser/share/features.h"
const base::Feature kSharingQrCodeAndroid{"SharingQrCodeAndroid",
base::FEATURE_DISABLED_BY_DEFAULT};
// Copyright 2019 The 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.
#ifndef CHROME_BROWSER_SHARE_FEATURES_H_
#define CHROME_BROWSER_SHARE_FEATURES_H_
#include "base/feature_list.h"
// Feature flag to enable sharing and scanning QR Code on Android.
extern const base::Feature kSharingQrCodeAndroid;
#endif // CHROME_BROWSER_SHARE_FEATURES_H_
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