Commit 9cc91038 authored by Tibor Goldschwendt's avatar Tibor Goldschwendt Committed by Commit Bot

Revert "[modules] Auto-determine if resouces go into base or feature module"

This reverts commit 7d13b860.

Reason for revert: Cannot be merged back and will cause merge
conflicts for other tab management CLs.

Original change's description:
> [modules] Auto-determine if resouces go into base or feature module
> 
> + Move tab management resources into its DFM.
> 
> Bug: 944115
> Change-Id: If14cdcfeb6bca94b9f1b040049c0f659831b193b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1534777
> Reviewed-by: Andrew Grieve <agrieve@chromium.org>
> Reviewed-by: Peter Wen <wnwen@chromium.org>
> Reviewed-by: Yusuf Ozuysal <yusufo@chromium.org>
> Commit-Queue: Tibor Goldschwendt <tiborg@chromium.org>
> Auto-Submit: Tibor Goldschwendt <tiborg@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#646437}

TBR=wnwen@chromium.org,yusufo@chromium.org,agrieve@chromium.org,tiborg@chromium.org

Change-Id: I4f15497d2a87c44b8b5833886f1726ea18e64ac3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 944115
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1547762Reviewed-by: default avatarTibor Goldschwendt <tiborg@chromium.org>
Commit-Queue: Tibor Goldschwendt <tiborg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#646477}
parent 18fdb08b
......@@ -939,11 +939,6 @@ def main(argv):
help='Dump the Markdown .build_config format documentation '
'then exit immediately.')
parser.add_option(
'--base-module-build-config',
help='Path to the base module\'s build config '
'if this is a feature module.')
options, args = parser.parse_args(argv)
if args:
......@@ -1054,11 +1049,6 @@ def main(argv):
all_resources_deps = deps.All('android_resources')
all_classpath_library_deps = classpath_deps.All('java_library')
base_module_build_config = None
if options.base_module_build_config:
with open(options.base_module_build_config, 'r') as f:
base_module_build_config = json.load(f)
# Initialize some common config.
# Any value that needs to be queryable by dependents must go within deps_info.
config = {
......@@ -1243,36 +1233,16 @@ def main(argv):
'android_resources', 'android_apk', 'junit_binary', 'resource_rewriter',
'dist_aar', 'android_app_bundle_module'):
config['resources'] = {}
dependency_zips = [
c['resources_zip'] for c in all_resources_deps if c['resources_zip']
]
config['resources']['dependency_zips'] = [
c['resources_zip'] for c in all_resources_deps]
extra_package_names = []
extra_r_text_files = []
if options.type != 'android_resources':
extra_package_names = [
c['package_name'] for c in all_resources_deps if 'package_name' in c]
extra_r_text_files = [
c['r_text'] for c in all_resources_deps if 'r_text' in c]
# For feature modules, remove any resources that already exist in the base
# module.
if base_module_build_config:
dependency_zips = [
c for c in dependency_zips
if c not in base_module_build_config['resources']['dependency_zips']
]
extra_package_names = [
c for c in extra_package_names if c not in
base_module_build_config['resources']['extra_package_names']
]
extra_r_text_files = [
c for c in extra_r_text_files if c not in
base_module_build_config['resources']['extra_r_text_files']
]
config['resources']['dependency_zips'] = dependency_zips
config['resources']['extra_package_names'] = extra_package_names
config['resources']['extra_r_text_files'] = extra_r_text_files
......
......@@ -143,9 +143,6 @@ template("write_build_config") {
if (defined(invoker.android_manifest_dep)) {
deps += [ invoker.android_manifest_dep ]
}
if (defined(invoker.base_module_build_config_target)) {
deps += [ invoker.base_module_build_config_target ]
}
script = "//build/android/gyp/write_build_config.py"
depfile = "$target_gen_dir/$target_name.d"
......@@ -480,12 +477,6 @@ template("write_build_config") {
invoker.main_class,
]
}
if (defined(invoker.base_module_build_config)) {
_rebased_base_module_build_config =
rebase_path(invoker.base_module_build_config, root_build_dir)
args +=
[ "--base-module-build-config=$_rebased_base_module_build_config" ]
}
if (current_toolchain != default_toolchain) {
# This has to be a built-time error rather than a GN assert because many
# packages have a mix of java and non-java targets. For example, the
......@@ -3355,10 +3346,8 @@ if (enable_java_templates) {
if (type == "android_app_bundle_module") {
forward_variables_from(invoker,
[
"base_module_build_config",
"base_module_build_config_target",
"module_rtxt_path",
"proto_resources_path",
"module_rtxt_path",
])
}
build_config = _build_config
......
......@@ -2587,8 +2587,6 @@ if (enable_java_templates) {
"android_manifest",
"android_manifest_dep",
"apk_under_test",
"base_module_build_config",
"base_module_build_config_target",
"chromium_code",
"classpath_deps",
"emma_never_instrument",
......@@ -3296,15 +3294,10 @@ if (enable_java_templates) {
_base_module_target_gen_dir =
get_label_info(_base_module_target, "target_gen_dir")
_base_module_target_name = get_label_info(_base_module_target, "name")
base_module_arsc_resource =
"$_base_module_target_gen_dir/$_base_module_target_name.arsc.ap_"
base_module_arsc_resource_target =
"${_base_module_target}__compile_arsc_resources"
base_module_build_config = "$_base_module_target_gen_dir/" +
"$_base_module_target_name.build_config"
base_module_build_config_target =
"${_base_module_target}$build_config_target_suffix"
}
}
}
......
......@@ -5,14 +5,6 @@
import("//build/config/android/rules.gni")
import("//chrome/common/features.gni")
android_resources("java_resources") {
resource_dirs = [ "java/res" ]
deps = [
"//chrome/android:chrome_app_java_resources",
]
custom_package = "org.chromium.chrome.tab_ui"
}
android_library("java") {
java_files = [
"java/src/org/chromium/chrome/browser/tasks/tab_groups/TabGroupUtils.java",
......@@ -46,10 +38,6 @@ android_library("java") {
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabListFaviconProvider.java",
]
deps = [
":java_resources",
]
classpath_deps = [
"//base:base_java",
"//chrome/android:chrome_java",
......
<?xml version="1.0" encoding="utf-8"?>
<!-- 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. -->
<resources xmlns:tools="http://schemas.android.com/tools">
<dimen name="tab_grid_favicon_size">32dp</dimen>
<dimen name="tab_list_selected_inset">7dp</dimen>
<dimen name="tab_list_card_padding">8dp</dimen>
<dimen name="tab_list_mini_card_radius">4dp</dimen>
<dimen name="tab_list_mini_card_frame_size">1dp</dimen>
<dimen name="tab_grid_thumbnail_card_default_size">152dp</dimen>
<dimen name="swipe_to_dismiss_threshold">72dp</dimen>
</resources>
......@@ -20,10 +20,10 @@ import org.chromium.base.PathUtils;
import org.chromium.base.ThreadUtils;
import org.chromium.base.task.AsyncTask;
import org.chromium.base.task.PostTask;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.tab_ui.R;
import org.chromium.content_public.browser.UiThreadTaskTraits;
import java.io.File;
......@@ -170,21 +170,21 @@ public class MultiThumbnailCardProvider implements TabListMediator.ThumbnailProv
// Initialize Paints to use.
mEmptyThumbnailPaint = new Paint();
mEmptyThumbnailPaint.setStyle(Paint.Style.FILL);
mEmptyThumbnailPaint.setColor(ApiCompatibilityUtils.getColor(
context.getResources(), org.chromium.chrome.R.color.modern_grey_100));
mEmptyThumbnailPaint.setColor(
ApiCompatibilityUtils.getColor(context.getResources(), R.color.modern_grey_100));
mEmptyThumbnailPaint.setAntiAlias(true);
mThumbnailFramePaint = new Paint();
mThumbnailFramePaint.setStyle(Paint.Style.STROKE);
mThumbnailFramePaint.setStrokeWidth(
context.getResources().getDimension(R.dimen.tab_list_mini_card_frame_size));
mThumbnailFramePaint.setColor(ApiCompatibilityUtils.getColor(
context.getResources(), org.chromium.chrome.R.color.modern_grey_300));
mThumbnailFramePaint.setColor(
ApiCompatibilityUtils.getColor(context.getResources(), R.color.modern_grey_300));
mThumbnailFramePaint.setAntiAlias(true);
mTextPaint = new Paint();
mTextPaint.setTextSize(context.getResources().getDimension(
org.chromium.chrome.R.dimen.compositor_tab_title_text_size));
mTextPaint.setTextSize(
context.getResources().getDimension(R.dimen.compositor_tab_title_text_size));
mTextPaint.setFakeBoldText(true);
mTextPaint.setAntiAlias(true);
mTextPaint.setTextAlign(Paint.Align.CENTER);
......
......@@ -11,21 +11,24 @@ import org.chromium.chrome.R;
*/
/* package */ class SilenceLintErrors {
// TODO(yusufo): Add these resources to the DFM
private int[] mRes = new int[] {
R.string.iph_tab_groups_quickly_compare_pages_text,
R.string.iph_tab_groups_tap_to_see_another_tab_text,
R.string.iph_tab_groups_your_tabs_together_text,
R.string.bottom_tab_grid_description,
R.string.bottom_tab_grid_opened_half,
R.string.bottom_tab_grid_opened_full,
R.string.bottom_tab_grid_closed,
R.string.bottom_tab_grid_new_tab,
R.string.bottom_tab_grid_new_tab,
R.plurals.bottom_tab_grid_title_placeholder,
R.string.iph_tab_groups_tap_to_see_another_tab_accessibility_text,
R.string.accessibility_bottom_tab_strip_expand_tab_sheet,
R.string.accessibility_bottom_tab_grid_close_tab_sheet,
};
private int[] mRes =
new int[] {R.dimen.tab_grid_favicon_size, R.string.tab_management_module_title,
R.string.iph_tab_groups_quickly_compare_pages_text,
R.string.iph_tab_groups_tap_to_see_another_tab_text,
R.string.iph_tab_groups_your_tabs_together_text,
R.string.bottom_tab_grid_description, R.string.bottom_tab_grid_opened_half,
R.string.bottom_tab_grid_opened_full, R.string.bottom_tab_grid_closed,
R.dimen.tab_list_selected_inset, R.layout.tab_strip_item,
R.drawable.selected_tab_background, R.drawable.tab_grid_card_background,
R.layout.tab_grid_card_item, R.layout.tab_list_recycler_view_layout,
R.layout.bottom_tab_grid_toolbar, R.string.bottom_tab_grid_new_tab,
R.string.bottom_tab_grid_new_tab, R.plurals.bottom_tab_grid_title_placeholder,
R.string.iph_tab_groups_tap_to_see_another_tab_accessibility_text,
R.string.accessibility_bottom_tab_strip_expand_tab_sheet,
R.layout.bottom_tab_strip_toolbar, R.drawable.tabstrip_selected,
R.dimen.tab_list_card_padding, R.dimen.tab_list_mini_card_text_size,
R.dimen.tab_list_mini_card_frame_size, R.dimen.tab_list_mini_card_radius,
R.drawable.tabstrip_favicon_background, R.dimen.swipe_to_dismiss_threshold};
private SilenceLintErrors() {}
}
......@@ -9,8 +9,8 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.lifecycle.Destroyable;
import org.chromium.chrome.tab_ui.R;
import org.chromium.ui.modelutil.PropertyModel;
import org.chromium.ui.modelutil.PropertyModelChangeProcessor;
......
......@@ -15,7 +15,7 @@ import android.view.View;
import android.widget.FrameLayout;
import org.chromium.base.Callback;
import org.chromium.chrome.tab_ui.R;
import org.chromium.chrome.R;
import org.chromium.ui.modelutil.PropertyKey;
import org.chromium.ui.modelutil.PropertyModel;
......@@ -41,7 +41,7 @@ class TabGridViewBinder {
String title = item.get(TabProperties.TITLE);
holder.title.setText(title);
holder.closeButton.setContentDescription(holder.itemView.getResources().getString(
org.chromium.chrome.R.string.accessibility_tabstrip_btn_close_tab, title));
R.string.accessibility_tabstrip_btn_close_tab, title));
} else if (TabProperties.IS_SELECTED == propertyKey) {
Resources res = holder.itemView.getResources();
Drawable drawable = new InsetDrawable(
......
......@@ -13,7 +13,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.tab_ui.R;
import org.chromium.chrome.R;
import org.chromium.ui.widget.ButtonCompat;
/**
......@@ -35,14 +35,14 @@ class TabGridViewHolder extends RecyclerView.ViewHolder {
this.favicon = itemView.findViewById(R.id.tab_favicon);
this.closeButton = itemView.findViewById(R.id.close_button);
DrawableCompat.setTint(this.closeButton.getDrawable(),
ApiCompatibilityUtils.getColor(
itemView.getResources(), org.chromium.chrome.R.color.light_icon_color));
ApiCompatibilityUtils.getColor(itemView.getResources(), R.color.light_icon_color));
this.createGroupButton = itemView.findViewById(R.id.create_group_button);
}
public static TabGridViewHolder create(ViewGroup parent, int itemViewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.tab_grid_card_item, parent, false);
View view =
LayoutInflater.from(parent.getContext())
.inflate(org.chromium.chrome.R.layout.tab_grid_card_item, parent, false);
return new TabGridViewHolder(view);
}
......
......@@ -13,7 +13,7 @@ import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import org.chromium.chrome.tab_ui.R;
import org.chromium.chrome.R;
import org.chromium.ui.widget.ChromeImageView;
/**
......
......@@ -14,12 +14,12 @@ import android.support.v7.widget.helper.ItemTouchHelper;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.lifecycle.Destroyable;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.tasks.tab_groups.TabGroupUtils;
import org.chromium.chrome.tab_ui.R;
import org.chromium.components.feature_engagement.FeatureConstants;
import org.chromium.ui.modelutil.PropertyKey;
import org.chromium.ui.modelutil.PropertyModel;
......
......@@ -9,8 +9,8 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.lifecycle.Destroyable;
import org.chromium.chrome.tab_ui.R;
import org.chromium.ui.modelutil.PropertyModel;
import org.chromium.ui.modelutil.PropertyModelChangeProcessor;
......
......@@ -10,7 +10,7 @@ import android.support.v4.content.res.ResourcesCompat;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.widget.FrameLayout;
import org.chromium.chrome.tab_ui.R;
import org.chromium.chrome.R;
import org.chromium.ui.modelutil.PropertyKey;
import org.chromium.ui.modelutil.PropertyModel;
......@@ -45,13 +45,13 @@ class TabStripViewBinder {
item.get(TabProperties.TAB_CLOSED_LISTENER).run(holder.getTabId());
});
holder.button.setContentDescription(holder.itemView.getContext().getString(
org.chromium.chrome.R.string.accessibility_tabstrip_btn_close_tab, title));
R.string.accessibility_tabstrip_btn_close_tab, title));
} else {
holder.button.setOnClickListener(view -> {
item.get(TabProperties.TAB_SELECTED_LISTENER).run(holder.getTabId());
});
holder.button.setContentDescription(holder.itemView.getContext().getString(
org.chromium.chrome.R.string.accessibility_tabstrip_tab, title));
R.string.accessibility_tabstrip_tab, title));
}
} else if (TabProperties.FAVICON == propertyKey) {
Drawable faviconDrawable = item.get(TabProperties.FAVICON);
......
......@@ -10,7 +10,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import org.chromium.chrome.tab_ui.R;
import org.chromium.chrome.R;
/**
* {@link RecyclerView.ViewHolder} for tab strip.
......
......@@ -21,7 +21,7 @@ import org.junit.runner.RunWith;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.test.util.CallbackHelper;
import org.chromium.chrome.tab_ui.R;
import org.chromium.chrome.R;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.ui.DummyUiActivity;
import org.chromium.chrome.test.ui.DummyUiActivityTestCase;
......@@ -204,14 +204,14 @@ public class TabGridContainerViewBinderTest extends DummyUiActivityTestCase {
mContainerModel.set(TabListContainerProperties.IS_INCOGNITO, true);
assertThat(mRecyclerView.getBackground(), instanceOf(ColorDrawable.class));
assertThat(((ColorDrawable) mRecyclerView.getBackground()).getColor(),
equalTo(ApiCompatibilityUtils.getColor(mRecyclerView.getResources(),
org.chromium.chrome.R.color.incognito_modern_primary_color)));
equalTo(ApiCompatibilityUtils.getColor(
mRecyclerView.getResources(), R.color.incognito_modern_primary_color)));
mContainerModel.set(TabListContainerProperties.IS_INCOGNITO, false);
assertThat(mRecyclerView.getBackground(), instanceOf(ColorDrawable.class));
assertThat(((ColorDrawable) mRecyclerView.getBackground()).getColor(),
equalTo(ApiCompatibilityUtils.getColor(mRecyclerView.getResources(),
org.chromium.chrome.R.color.modern_primary_color)));
equalTo(ApiCompatibilityUtils.getColor(
mRecyclerView.getResources(), R.color.modern_primary_color)));
}
@Test
......
......@@ -594,4 +594,14 @@
<!-- Explicit Language Ask Prompt dimensions -->
<dimen name="explicit_ask_checkbox_end_padding">4dp</dimen>
<!-- Tab List dimensions -->
<dimen name="tab_grid_favicon_size">32dp</dimen>
<dimen name="tab_list_selected_inset">7dp</dimen>
<dimen name="tab_list_card_padding">8dp</dimen>
<dimen name="tab_list_mini_card_radius">4dp</dimen>
<dimen name="tab_list_mini_card_frame_size">1dp</dimen>
<dimen name="tab_list_mini_card_text_size">12sp</dimen>
<dimen name="tab_grid_thumbnail_card_default_size">152dp</dimen>
<dimen name="swipe_to_dismiss_threshold">72dp</dimen>
</resources>
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