diff --git a/DEPS b/DEPS index a462752da13de0..7da4934adac204 100644 --- a/DEPS +++ b/DEPS @@ -232,7 +232,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '9543988eec751ce6f27e0f8a07c0dad45b3a035f', + 'v8_revision': '6b73348c3a7e59c459e86dccac8dabc1dadf96fb', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. diff --git a/ash/constants/ash_features.cc b/ash/constants/ash_features.cc index 32bcd15eaece10..b84dccedaf61cc 100644 --- a/ash/constants/ash_features.cc +++ b/ash/constants/ash_features.cc @@ -883,6 +883,10 @@ const base::Feature kQuickAnswersTranslationCloudAPI{ const base::Feature kQuickAnswersV2{"QuickAnswersV2", base::FEATURE_DISABLED_BY_DEFAULT}; +// Controls whether to enable quick answers V2 settings sub-toggles. +const base::Feature kQuickAnswersV2SettingsSubToggle{ + "QuickAnswersV2SettingsSubToggle", base::FEATURE_DISABLED_BY_DEFAULT}; + // Enables or disables fingerprint quick unlock. const base::Feature kQuickUnlockFingerprint{"QuickUnlockFingerprint", base::FEATURE_DISABLED_BY_DEFAULT}; @@ -1550,6 +1554,10 @@ bool IsQuickAnswersV2TranslationDisabled() { return base::FeatureList::IsEnabled(kDisableQuickAnswersV2Translation); } +bool IsQuickAnswersV2SettingsSubToggleEnabled() { + return base::FeatureList::IsEnabled(kQuickAnswersV2SettingsSubToggle); +} + bool IsReduceDisplayNotificationsEnabled() { return base::FeatureList::IsEnabled(kReduceDisplayNotifications); } diff --git a/ash/constants/ash_features.h b/ash/constants/ash_features.h index 4647299621576a..a7c315cc0200bb 100644 --- a/ash/constants/ash_features.h +++ b/ash/constants/ash_features.h @@ -334,6 +334,8 @@ COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kQuickAnswersV2; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kDisableQuickAnswersV2Translation; COMPONENT_EXPORT(ASH_CONSTANTS) +extern const base::Feature kQuickAnswersV2SettingsSubToggle; +COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kQuickAnswersOnEditableText; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kQuickAnswersStandaloneSettings; @@ -540,6 +542,7 @@ COMPONENT_EXPORT(ASH_CONSTANTS) bool IsQuickAnswersTranslationCloudAPIEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsQuickAnswersTranslationEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsQuickAnswersV2Enabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsQuickAnswersV2TranslationDisabled(); +COMPONENT_EXPORT(ASH_CONSTANTS) bool IsQuickAnswersV2SettingsSubToggleEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsReduceDisplayNotificationsEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsReverseScrollGesturesEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) diff --git a/base/files/file_util_win.cc b/base/files/file_util_win.cc index f088f62de68308..80488d5f896e6d 100644 --- a/base/files/file_util_win.cc +++ b/base/files/file_util_win.cc @@ -55,67 +55,6 @@ namespace { const DWORD kFileShareAll = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; -// Records a sample in a histogram named -// "Windows.PostOperationState.|operation|" indicating the state of |path| -// following the named operation. If |operation_succeeded| is true, the -// "operation succeeded" sample is recorded. Otherwise, the state of |path| is -// queried and the most meaningful sample is recorded. -void RecordPostOperationState(const FilePath& path, - StringPiece operation, - bool operation_succeeded) { - // The state of a filesystem item after an operation. - // These values are persisted to logs. Entries should not be renumbered and - // numeric values should never be reused. - enum class PostOperationState { - kOperationSucceeded = 0, - kFileNotFoundAfterFailure = 1, - kPathNotFoundAfterFailure = 2, - kAccessDeniedAfterFailure = 3, - kNoAttributesAfterFailure = 4, - kEmptyDirectoryAfterFailure = 5, - kNonEmptyDirectoryAfterFailure = 6, - kNotDirectoryAfterFailure = 7, - kCount - } metric = PostOperationState::kOperationSucceeded; - - if (!operation_succeeded) { - const DWORD attributes = ::GetFileAttributes(path.value().c_str()); - if (attributes == INVALID_FILE_ATTRIBUTES) { - // On failure to delete, one might expect the file/directory to still be - // in place. Slice a failure to get its attributes into a few common error - // buckets. - const DWORD error_code = ::GetLastError(); - if (error_code == ERROR_FILE_NOT_FOUND) - metric = PostOperationState::kFileNotFoundAfterFailure; - else if (error_code == ERROR_PATH_NOT_FOUND) - metric = PostOperationState::kPathNotFoundAfterFailure; - else if (error_code == ERROR_ACCESS_DENIED) - metric = PostOperationState::kAccessDeniedAfterFailure; - else - metric = PostOperationState::kNoAttributesAfterFailure; - } else if (attributes & FILE_ATTRIBUTE_DIRECTORY) { - if (IsDirectoryEmpty(path)) - metric = PostOperationState::kEmptyDirectoryAfterFailure; - else - metric = PostOperationState::kNonEmptyDirectoryAfterFailure; - } else { - metric = PostOperationState::kNotDirectoryAfterFailure; - } - } - - std::string histogram_name = - base::StrCat({"Windows.PostOperationState.", operation}); - UmaHistogramEnumeration(histogram_name, metric, PostOperationState::kCount); -} - -// Records the sample |error| in a histogram named -// "Windows.FilesystemError.|operation|". -void RecordFilesystemError(StringPiece operation, DWORD error) { - std::string histogram_name = - base::StrCat({"Windows.FilesystemError.", operation}); - UmaHistogramSparse(histogram_name, error); -} - // Returns the Win32 last error code or ERROR_SUCCESS if the last error code is // ERROR_FILE_NOT_FOUND or ERROR_PATH_NOT_FOUND. This is useful in cases where // the absence of a file or path is a success condition (e.g., when attempting @@ -361,24 +300,11 @@ DWORD DoDeleteFile(const FilePath& path, bool recursive) { // Deletes the file/directory at |path| (recursively if |recursive| and |path| // names a directory), returning true on success. Sets the Windows last-error // code and returns false on failure. -bool DeleteFileAndRecordMetrics(const FilePath& path, bool recursive) { - static constexpr char kRecursive[] = "DeleteFile.Recursive"; - static constexpr char kNonRecursive[] = "DeleteFile.NonRecursive"; - const StringPiece operation(recursive ? kRecursive : kNonRecursive); - - ScopedBlockingCall scoped_blocking_call(FROM_HERE, BlockingType::MAY_BLOCK); - - // Metrics for delete failures tracked in https://crbug.com/599084. Delete may - // fail for a number of reasons. Log some metrics relating to failures in the - // current code so that any improvements or regressions resulting from - // subsequent code changes can be detected. +bool DeleteFileOrSetLastError(const FilePath& path, bool recursive) { const DWORD error = DoDeleteFile(path, recursive); - RecordPostOperationState(path, operation, error == ERROR_SUCCESS); if (error == ERROR_SUCCESS) return true; - RecordFilesystemError(operation, error); - ::SetLastError(error); return false; } @@ -432,11 +358,11 @@ FilePath MakeAbsoluteFilePath(const FilePath& input) { } bool DeleteFile(const FilePath& path) { - return DeleteFileAndRecordMetrics(path, /*recursive=*/false); + return DeleteFileOrSetLastError(path, /*recursive=*/false); } bool DeletePathRecursively(const FilePath& path) { - return DeleteFileAndRecordMetrics(path, /*recursive=*/true); + return DeleteFileOrSetLastError(path, /*recursive=*/true); } bool DeleteFileAfterReboot(const FilePath& path) { diff --git a/base/json/json_reader_unittest.cc b/base/json/json_reader_unittest.cc index 94fccbab826e3c..816c8d3a6639dc 100644 --- a/base/json/json_reader_unittest.cc +++ b/base/json/json_reader_unittest.cc @@ -182,6 +182,13 @@ TEST(JSONReaderTest, Doubles) { EXPECT_TRUE(root->is_double()); EXPECT_DOUBLE_EQ(1.0, root->GetDouble()); + // Some "parse to float64" implementations find this one tricky. + // https://github.com/serde-rs/json/issues/707 + root = JSONReader::Read("122.416294033786585"); + ASSERT_TRUE(root); + EXPECT_TRUE(root->is_double()); + EXPECT_DOUBLE_EQ(122.416294033786585, root->GetDouble()); + // This is syntaxtically valid, but out of range of a double. auto value_with_error = JSONReader::ReadAndReturnValueWithError("1e1000", JSON_PARSE_RFC); @@ -220,7 +227,7 @@ TEST(JSONReaderTest, InvalidNumbers) { EXPECT_FALSE(JSONReader::Read("4.a")); } -TEST(JSONReader, SimpleString) { +TEST(JSONReaderTest, SimpleString) { absl::optional root = JSONReader::Read("\"hello world\""); ASSERT_TRUE(root); EXPECT_TRUE(root->is_string()); diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc index 9536ec0eb5271f..b7aa0390367082 100644 --- a/base/test/launcher/test_launcher.cc +++ b/base/test/launcher/test_launcher.cc @@ -355,15 +355,16 @@ int LaunchChildTestProcessWithOptions(const CommandLine& command_line, new_options.spawn_flags = FDIO_SPAWN_CLONE_STDIO | FDIO_SPAWN_CLONE_JOB; const base::FilePath kDataPath(base::kPersistedDataDirectoryPath); + const base::FilePath kCachePath(base::kPersistedCacheDirectoryPath); - // Clone all namespace entries from the current process, except /data, which - // is overridden below. + // Clone all namespace entries from the current process, except /data and + // /cache, which are overridden below. fdio_flat_namespace_t* flat_namespace = nullptr; zx_status_t result = fdio_ns_export_root(&flat_namespace); ZX_CHECK(ZX_OK == result, result) << "fdio_ns_export_root"; for (size_t i = 0; i < flat_namespace->count; ++i) { base::FilePath path(flat_namespace->path[i]); - if (path == kDataPath) { + if (path == kDataPath || path == kCachePath) { result = zx_handle_close(flat_namespace->handle[i]); ZX_CHECK(ZX_OK == result, result) << "zx_handle_close"; } else { @@ -379,25 +380,36 @@ int LaunchChildTestProcessWithOptions(const CommandLine& command_line, new_options.job_handle = job_handle.get(); // Give this test its own isolated /data directory by creating a new temporary - // subdirectory under data (/data/test-$PID) and binding that to /data on the - // child process. + // subdirectory under data (/data/test-$PID) and binding paths under that to + // /data and /cache in the child process. + // Persistent data storage is mapped to /cache rather than system-provided + // cache storage, to avoid unexpected purges (see crbug.com/1242170). CHECK(base::PathExists(kDataPath)); // Create the test subdirectory with a name that is unique to the child test // process (qualified by parent PID and an autoincrementing test process // index). static base::AtomicSequenceNumber child_launch_index; - base::FilePath nested_data_path = kDataPath.AppendASCII( + const base::FilePath child_data_path = kDataPath.AppendASCII( base::StringPrintf("test-%zu-%d", base::Process::Current().Pid(), child_launch_index.GetNext())); - CHECK(!base::DirectoryExists(nested_data_path)); - CHECK(base::CreateDirectory(nested_data_path)); - DCHECK(base::DirectoryExists(nested_data_path)); + CHECK(!base::DirectoryExists(child_data_path)); + CHECK(base::CreateDirectory(child_data_path)); + DCHECK(base::DirectoryExists(child_data_path)); - // Bind the new test subdirectory to /data in the child process' namespace. + const base::FilePath test_data_dir(child_data_path.AppendASCII("data")); + CHECK(base::CreateDirectory(test_data_dir)); + const base::FilePath test_cache_dir(child_data_path.AppendASCII("cache")); + CHECK(base::CreateDirectory(test_cache_dir)); + + // Transfer handles to the new directories as /data and /cache in the child + // process' namespace. new_options.paths_to_transfer.push_back( {kDataPath, - base::OpenDirectoryHandle(nested_data_path).TakeChannel().release()}); + base::OpenDirectoryHandle(test_data_dir).TakeChannel().release()}); + new_options.paths_to_transfer.push_back( + {kCachePath, + base::OpenDirectoryHandle(test_cache_dir).TakeChannel().release()}); #endif // defined(OS_FUCHSIA) #if defined(OS_LINUX) || defined(OS_CHROMEOS) @@ -483,7 +495,7 @@ int LaunchChildTestProcessWithOptions(const CommandLine& command_line, ZX_CHECK(status == ZX_OK, status); // Cleanup the data directory. - CHECK(DeletePathRecursively(nested_data_path)); + CHECK(DeletePathRecursively(child_data_path)); #elif defined(OS_POSIX) // It is not possible to waitpid() on any leaked sub-processes of the test // batch process, since those are not direct children of this process. diff --git a/base/test/launcher/test_launcher_unittest.cc b/base/test/launcher/test_launcher_unittest.cc index c6900560ea33ad..1b40ae18b383a0 100644 --- a/base/test/launcher/test_launcher_unittest.cc +++ b/base/test/launcher/test_launcher_unittest.cc @@ -719,6 +719,15 @@ TEST_F(TestLauncherTest, TestChildTempDir) { EXPECT_FALSE(DirectoryExists(task_temp)); } +#if defined(OS_FUCHSIA) +// Verifies that test processes have /data, /cache and /tmp available. +TEST_F(TestLauncherTest, ProvidesDataCacheAndTmpDirs) { + EXPECT_TRUE(base::DirectoryExists(base::FilePath("/data"))); + EXPECT_TRUE(base::DirectoryExists(base::FilePath("/cache"))); + EXPECT_TRUE(base::DirectoryExists(base::FilePath("/tmp"))); +} +#endif // defined(OS_FUCHSIA) + // Unit tests to validate UnitTestLauncherDelegate implementation. class UnitTestLauncherDelegateTester : public testing::Test { protected: diff --git a/build/config/fuchsia/test/access_test_data_dir.test-cmx b/build/config/fuchsia/test/access_test_data_dir.test-cmx deleted file mode 100644 index 57577785438b6b..00000000000000 --- a/build/config/fuchsia/test/access_test_data_dir.test-cmx +++ /dev/null @@ -1,7 +0,0 @@ -{ - "sandbox": { - "features": [ - "isolated-cache-storage" - ] - } -} \ No newline at end of file diff --git a/build/fuchsia/fvdl_target.py b/build/fuchsia/fvdl_target.py index e0cb2aaca5388f..166fc93bf4284e 100644 --- a/build/fuchsia/fvdl_target.py +++ b/build/fuchsia/fvdl_target.py @@ -17,8 +17,8 @@ _DEFAULT_SSH_PORT = 22 _DEVICE_PROTO_TEMPLATE = """ device_spec: {{ - horizontal_resolution: 1280 - vertical_resolution: 800 + horizontal_resolution: 1024 + vertical_resolution: 600 vm_heap: 192 ram: {ramsize} cache: 32 diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayCoordinator.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayCoordinator.java index 5ae9a58af8634e..2ac41477b1eacd 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayCoordinator.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayCoordinator.java @@ -5,6 +5,7 @@ package org.chromium.chrome.browser.autofill_assistant.overlay; import android.content.Context; +import android.graphics.RectF; import org.chromium.chrome.browser.autofill_assistant.overlay.AssistantOverlayModel.AssistantOverlayRect; import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider; @@ -49,6 +50,10 @@ public AssistantOverlayCoordinator(Context context, WebContents webContents = model.get(AssistantOverlayModel.WEB_CONTENTS); mEventFilter.setWebContents(webContents); mDrawable.setWebContents(webContents); + } else if (AssistantOverlayModel.VISUAL_VIEWPORT == propertyKey) { + RectF rect = model.get(AssistantOverlayModel.VISUAL_VIEWPORT); + mEventFilter.setVisualViewport(rect); + mDrawable.setVisualViewport(rect); } else if (AssistantOverlayModel.TOUCHABLE_AREA == propertyKey) { List area = model.get(AssistantOverlayModel.TOUCHABLE_AREA); mEventFilter.setTouchableArea(area); diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayDrawable.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayDrawable.java index fda10d614a2743..0895207e8dc7d5 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayDrawable.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayDrawable.java @@ -94,6 +94,17 @@ class AssistantOverlayDrawable extends Drawable /** The {@link WebContents} this Autofill Assistant is currently associated with. */ private WebContents mWebContents; + /** + * Coordinates of the visual viewport within the page, if known, in CSS pixels relative to the + * origin of the page. + * + * The visual viewport includes the portion of the page that is really visible, excluding any + * area not fully visible because of the current zoom value. + * + * Only relevant in partial mode, when the transparent area is non-empty. + */ + private final RectF mVisualViewport = new RectF(); + private final List mTransparentArea = new ArrayList<>(); private List mRestrictedArea = Collections.emptyList(); @@ -214,6 +225,11 @@ void setWebContents(@NonNull WebContents webContents) { invalidateSelf(); } + void setVisualViewport(RectF visualViewport) { + mVisualViewport.set(visualViewport); + invalidateSelf(); + } + /** Set or updates the transparent area. */ void setTransparentArea(List transparentArea) { // Add or update boxes for each rectangle in the area. @@ -325,8 +341,9 @@ public void draw(Canvas canvas) { RenderCoordinatesImpl renderCoordinates = RenderCoordinatesImpl.fromWebContents(mWebContents); - float left = renderCoordinates.getScrollX(); - float top = renderCoordinates.getScrollY(); + // TODO(b/195482173): Use renderCoordinates to get left and top, remove mVisualViewport. + float left = mVisualViewport.left; + float top = mVisualViewport.top; // Don't draw on top of the restricted area. for (AssistantOverlayRect rect : mRestrictedArea) { @@ -387,7 +404,7 @@ public void onBottomControlsHeightChanged( @Override public void onScrollOffsetOrExtentChanged(int scrollOffsetY, int scrollExtentY) { - invalidateSelf(); + // TODO(b/195482173): call invalidateSelf once the visual viewport is removed. } /** diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayEventFilter.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayEventFilter.java index a9d45be2514254..ed0d28c856ed63 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayEventFilter.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayEventFilter.java @@ -77,6 +77,15 @@ class AssistantOverlayEventFilter /** The {@link WebContents} this Autofill Assistant is currently associated with. */ private WebContents mWebContents; + /** + * Coordinates of the visual viewport within the page, if known, in CSS pixels relative to the + * origin of the page. This is used to convert pixel coordinates to CSS coordinates. + * + * The visual viewport includes the portion of the page that is really visible, excluding any + * area not fully visible because of the current zoom value. + */ + private final RectF mVisualViewport = new RectF(); + /** Touchable area, expressed in CSS pixels relative to the layout viewport. */ private List mTouchableArea = Collections.emptyList(); @@ -167,6 +176,11 @@ void setTapTrackingDurationMs(long durationMs) { mTapTrackingDurationMs = durationMs; } + /** Sets the visual viewport. */ + void setVisualViewport(RectF visualViewport) { + mVisualViewport.set(visualViewport); + } + /** * Set the touchable area. This only applies if current state is AssistantOverlayState.PARTIAL. */ @@ -365,9 +379,8 @@ private boolean rectContains(AssistantOverlayRect rect, float absoluteXCss, floa if (!rect.isFullWidth()) { return rect.contains(absoluteXCss, absoluteYCss); } - RectF rectCompare = new RectF(/* left= */ renderCoordinates.getScrollX(), rect.top, - /* right= */ renderCoordinates.getScrollX() - + renderCoordinates.getContentWidthCss(), + RectF rectCompare = new RectF(/* left= */ mVisualViewport.left, rect.top, + /* right= */ mVisualViewport.left + renderCoordinates.getContentWidthCss(), rect.bottom); return rectCompare.contains(absoluteXCss, absoluteYCss); } @@ -384,8 +397,9 @@ private boolean isInTouchableArea(float x, float y) { / (renderCoordinates.getPageScaleFactor() * renderCoordinates.getDeviceScaleFactor()); - float absoluteXCss = (x * physicalToCssPixels) + renderCoordinates.getScrollX(); - float absoluteYCss = (y * physicalToCssPixels) + renderCoordinates.getScrollY(); + // TODO(b/195482173): Use renderCoordinates to get left and top, remove mVisualViewport. + float absoluteXCss = (x * physicalToCssPixels) + mVisualViewport.left; + float absoluteYCss = (y * physicalToCssPixels) + mVisualViewport.top; for (AssistantOverlayRect rect : mRestrictedArea) { if (rectContains(rect, absoluteXCss, absoluteYCss, renderCoordinates)) return false; diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayModel.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayModel.java index 70500564e35c4a..9ad1f12d1e81b8 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayModel.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayModel.java @@ -62,6 +62,9 @@ public boolean isFullWidth() { public static final WritableObjectPropertyKey WEB_CONTENTS = new WritableObjectPropertyKey<>(); + public static final WritableObjectPropertyKey VISUAL_VIEWPORT = + new WritableObjectPropertyKey<>(); + public static final WritableObjectPropertyKey> TOUCHABLE_AREA = new WritableObjectPropertyKey<>(); @@ -87,9 +90,9 @@ public boolean isFullWidth() { new WritableObjectPropertyKey<>(); public AssistantOverlayModel() { - super(WEB_CONTENTS, STATE, TOUCHABLE_AREA, RESTRICTED_AREA, DELEGATE, BACKGROUND_COLOR, - HIGHLIGHT_BORDER_COLOR, TAP_TRACKING_COUNT, TAP_TRACKING_DURATION_MS, - OVERLAY_IMAGE); + super(WEB_CONTENTS, STATE, VISUAL_VIEWPORT, TOUCHABLE_AREA, RESTRICTED_AREA, DELEGATE, + BACKGROUND_COLOR, HIGHLIGHT_BORDER_COLOR, TAP_TRACKING_COUNT, + TAP_TRACKING_DURATION_MS, OVERLAY_IMAGE); } @CalledByNative @@ -113,6 +116,11 @@ private static List toRectangles(float[] coords) { return boxes; } + @CalledByNative + private void setVisualViewport(float left, float top, float right, float bottom) { + set(VISUAL_VIEWPORT, new RectF(left, top, right, bottom)); + } + @CalledByNative private void setTouchableArea(float[] coords) { set(TOUCHABLE_AREA, toRectangles(coords)); diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayUiTest.java index ffd88694984550..0d2204188d0901 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayUiTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayUiTest.java @@ -27,12 +27,14 @@ import android.graphics.BitmapFactory; import android.graphics.Color; import android.graphics.Rect; +import android.graphics.RectF; import android.support.test.InstrumentationRegistry; import android.view.View; import androidx.annotation.Nullable; import androidx.test.filters.MediumTest; +import org.json.JSONArray; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -51,6 +53,7 @@ import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.content_public.browser.WebContents; +import org.chromium.content_public.browser.test.util.TestCallbackHelperContainer; import org.chromium.content_public.browser.test.util.TestThreadUtils; import java.util.Collections; @@ -208,9 +211,11 @@ public void testSimpleScrollPartialOverlay() throws Exception { scrollIntoViewIfNeeded(mTestRule.getWebContents(), "touch_area_five"); waitUntil(() -> checkElementOnScreen(mTestRule, "touch_area_five")); Rect rect = getBoundingRectForElement(getWebContents(), "touch_area_five"); + Rect viewport = getViewport(getWebContents()); runOnUiThreadBlocking(() -> { model.set(AssistantOverlayModel.STATE, AssistantOverlayState.PARTIAL); model.set(AssistantOverlayModel.WEB_CONTENTS, getWebContents()); + model.set(AssistantOverlayModel.VISUAL_VIEWPORT, new RectF(viewport)); model.set(AssistantOverlayModel.TOUCHABLE_AREA, Collections.singletonList(new AssistantOverlayRect(rect))); }); @@ -283,7 +288,23 @@ private void assertScrimDisplayed(boolean expected) throws Exception { } } - void tapElement(String elementId) throws Exception { + private void tapElement(String elementId) throws Exception { AutofillAssistantUiTestUtil.tapElement(mTestRule, elementId); } + + private Rect getViewport(WebContents webContents) throws Exception { + TestCallbackHelperContainer.OnEvaluateJavaScriptResultHelper javascriptHelper = + new TestCallbackHelperContainer.OnEvaluateJavaScriptResultHelper(); + javascriptHelper.evaluateJavaScriptForTests(webContents, + "(function() {" + + " const v = window.visualViewport;" + + " return [" + + " v.pageLeft, v.pageTop," + + " v.pageLeft + v.width, v.pageTop + v.height" + + " ];" + + "})()"); + javascriptHelper.waitUntilHasValue(); + JSONArray values = new JSONArray(javascriptHelper.getJsonResultAndClear()); + return new Rect(values.getInt(0), values.getInt(1), values.getInt(2), values.getInt(3)); + } } diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelMergingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelMergingTest.java index 0dd0c9472d27eb..17cbecfc90e672 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelMergingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelMergingTest.java @@ -297,7 +297,9 @@ private void waitForActivityStateChange( ApplicationStatus.registerStateListenerForActivity(listener, activity); }); helper.waitForFirst(); - ApplicationStatus.unregisterActivityStateListener(listener); + // listener was registered on UiThread. So it should be unregistered on UiThread. + TestThreadUtils.runOnUiThreadBlocking( + () -> { ApplicationStatus.unregisterActivityStateListener(listener); }); } @Test diff --git a/chrome/app/app_management_strings.grdp b/chrome/app/app_management_strings.grdp index 0e7daf2be76236..4251cdfa080d17 100644 --- a/chrome/app/app_management_strings.grdp +++ b/chrome/app/app_management_strings.grdp @@ -49,8 +49,8 @@ This app has been installed by your administrator. - - Opening supported links + + Opening <a href="#">supported links</a> Open in $1Chrome browser @@ -61,4 +61,7 @@ $1Gmail is set to open in a new browser tab, supported links will also open in the browser. <a href="https://support.google.com/chromebook?p=app_intent" target="_blank">Learn more</a> + + Supported links + diff --git a/chrome/app/app_management_strings_grdp/IDS_APP_MANAGEMENT_INTENT_SETTINGS_DIALOG_TITLE.png.sha1 b/chrome/app/app_management_strings_grdp/IDS_APP_MANAGEMENT_INTENT_SETTINGS_DIALOG_TITLE.png.sha1 new file mode 100644 index 00000000000000..ef24a54f5f1f49 --- /dev/null +++ b/chrome/app/app_management_strings_grdp/IDS_APP_MANAGEMENT_INTENT_SETTINGS_DIALOG_TITLE.png.sha1 @@ -0,0 +1 @@ +3c64244254ec4466b5faef16c58bc87b1d1023ab \ No newline at end of file diff --git a/chrome/app/app_management_strings_grdp/IDS_APP_MANAGEMENT_INTENT_SETTINGS_TITLE.png.sha1 b/chrome/app/app_management_strings_grdp/IDS_APP_MANAGEMENT_INTENT_SETTINGS_TITLE.png.sha1 new file mode 100644 index 00000000000000..bcaf9ce00115b6 --- /dev/null +++ b/chrome/app/app_management_strings_grdp/IDS_APP_MANAGEMENT_INTENT_SETTINGS_TITLE.png.sha1 @@ -0,0 +1 @@ +9723f847663d73fa29647809098488e2b7447796 \ No newline at end of file diff --git a/chrome/app/app_management_strings_grdp/IDS_APP_MANAGEMENT_INTENT_SHARING.png.sha1 b/chrome/app/app_management_strings_grdp/IDS_APP_MANAGEMENT_INTENT_SHARING.png.sha1 deleted file mode 100644 index fdf44faab481db..00000000000000 --- a/chrome/app/app_management_strings_grdp/IDS_APP_MANAGEMENT_INTENT_SHARING.png.sha1 +++ /dev/null @@ -1 +0,0 @@ -b214f07ca2ca58b7fd17c63f1df6513ed77075a1 \ No newline at end of file diff --git a/chrome/app/os_settings_strings.grdp b/chrome/app/os_settings_strings.grdp index f61bdc9d3efce2..699d2f70d10a45 100644 --- a/chrome/app/os_settings_strings.grdp +++ b/chrome/app/os_settings_strings.grdp @@ -862,11 +862,14 @@ Search - Quick Answers + Quick answers With a right-click or long press, show related info for your text selection + + Get definitions, translations, or unit conversions when you right-click or touch & hold text. Customize translation by setting your preferred languages in <a target="_blank" href="#">Web content languages</a>. + Definition diff --git a/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_QUICK_ANSWERS_ENABLE.png.sha1 b/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_QUICK_ANSWERS_ENABLE.png.sha1 index 0c3bf3652e1da5..104b59c73153d7 100644 --- a/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_QUICK_ANSWERS_ENABLE.png.sha1 +++ b/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_QUICK_ANSWERS_ENABLE.png.sha1 @@ -1 +1 @@ -2ffd8e50ce4497cfe3934cb21fd545d8bee7f9bb \ No newline at end of file +2dd5db64db50aef77afe56c5bdd3395d9ffbfb44 diff --git a/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_QUICK_ANSWERS_ENABLE_DESCRIPTION_WITH_LINK.png.sha1 b/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_QUICK_ANSWERS_ENABLE_DESCRIPTION_WITH_LINK.png.sha1 new file mode 100644 index 00000000000000..f5e3b424fa0628 --- /dev/null +++ b/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_QUICK_ANSWERS_ENABLE_DESCRIPTION_WITH_LINK.png.sha1 @@ -0,0 +1 @@ +2dd5db64db50aef77afe56c5bdd3395d9ffbfb44 \ No newline at end of file diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 349890cef3a80c..e1645afaf848db 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -669,6 +669,8 @@ const char kLacrosPrimaryInternalName[] = "lacros-primary"; const char kLacrosSupportInternalName[] = "lacros-support"; const char kLacrosStabilityInternalName[] = "lacros-stability"; const char kWebAppsCrosapiInternalName[] = "web-apps-crosapi"; +const char kArcVmBalloonPolicyInternalName[] = + "arc-use-limit-cache-balloon-policy"; const FeatureEntry::Choice kLacrosStabilityChoices[] = { {flags_ui::kGenericExperimentChoiceDefault, "", ""}, @@ -4140,6 +4142,10 @@ const FeatureEntry kFeatureEntries[] = { flag_descriptions::kArcUseHighMemoryDalvikProfileName, flag_descriptions::kArcUseHighMemoryDalvikProfileDesc, kOsCrOS, FEATURE_VALUE_TYPE(arc::kUseHighMemoryDalvikProfile)}, + {kArcVmBalloonPolicyInternalName, + flag_descriptions::kArcVmBalloonPolicyName, + flag_descriptions::kArcVmBalloonPolicyDesc, kOsCrOS, + FEATURE_VALUE_TYPE(arc::kVmBalloonPolicy)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) {"enable-generic-sensor-extra-classes", flag_descriptions::kEnableGenericSensorExtraClassesName, @@ -7630,6 +7636,10 @@ bool ShouldSkipConditionalFeatureEntry(const flags_ui::FlagsStorage* storage, return !arc::IsArcVmEnabled(); } + if (!strcmp(kArcVmBalloonPolicyInternalName, entry.internal_name)) { + return !arc::IsArcVmEnabled(); + } + // Only show Borealis flags on enabled devices. if (!strcmp(kBorealisDiskManagementInternalName, entry.internal_name)) { return !base::FeatureList::IsEnabled(features::kBorealis); diff --git a/chrome/browser/android/autofill_assistant/ui_controller_android.cc b/chrome/browser/android/autofill_assistant/ui_controller_android.cc index eca2a2dd58496b..722ca98c2e4395 100644 --- a/chrome/browser/android/autofill_assistant/ui_controller_android.cc +++ b/chrome/browser/android/autofill_assistant/ui_controller_android.cc @@ -670,7 +670,9 @@ void UiControllerAndroid::RestoreUi() { ui_delegate_->GetTouchableArea(&area); std::vector restricted_area; ui_delegate_->GetRestrictedArea(&restricted_area); - OnTouchableAreaChanged(area, restricted_area); + RectF visual_viewport; + ui_delegate_->GetVisualViewport(&visual_viewport); + OnTouchableAreaChanged(visual_viewport, area, restricted_area); OnViewportModeChanged(ui_delegate_->GetViewportMode()); OnPeekModeChanged(ui_delegate_->GetPeekMode()); OnFormChanged(ui_delegate_->GetForm(), ui_delegate_->GetFormResult()); @@ -1049,6 +1051,7 @@ void UiControllerAndroid::OnShouldShowOverlayChanged(bool should_show) { } void UiControllerAndroid::OnTouchableAreaChanged( + const RectF& visual_viewport, const std::vector& touchable_areas, const std::vector& restricted_areas) { if (!touchable_areas.empty() && @@ -1058,10 +1061,12 @@ void UiControllerAndroid::OnTouchableAreaChanged( JNIEnv* env = AttachCurrentThread(); + Java_AssistantOverlayModel_setVisualViewport( + env, GetOverlayModel(), visual_viewport.left, visual_viewport.top, + visual_viewport.right, visual_viewport.bottom); Java_AssistantOverlayModel_setTouchableArea( env, GetOverlayModel(), base::android::ToJavaFloatArray(env, ToFloatVector(touchable_areas))); - Java_AssistantOverlayModel_setRestrictedArea( AttachCurrentThread(), GetOverlayModel(), base::android::ToJavaFloatArray(env, ToFloatVector(restricted_areas))); diff --git a/chrome/browser/android/autofill_assistant/ui_controller_android.h b/chrome/browser/android/autofill_assistant/ui_controller_android.h index 60b85ec1e805be..8e8d7cfa9815db 100644 --- a/chrome/browser/android/autofill_assistant/ui_controller_android.h +++ b/chrome/browser/android/autofill_assistant/ui_controller_android.h @@ -112,6 +112,7 @@ class UiControllerAndroid : public ControllerObserver { const ShowProgressBarProto::StepProgressBarConfiguration& configuration) override; void OnTouchableAreaChanged( + const RectF& visual_viewport, const std::vector& touchable_areas, const std::vector& restricted_areas) override; void OnViewportModeChanged(ViewportMode mode) override; diff --git a/chrome/browser/apps/app_service/app_icon_factory.cc b/chrome/browser/apps/app_service/app_icon_factory.cc index 3a6edbd6375f19..a31c7b1b595f3a 100644 --- a/chrome/browser/apps/app_service/app_icon_factory.cc +++ b/chrome/browser/apps/app_service/app_icon_factory.cc @@ -1447,7 +1447,7 @@ void LoadIconFromWebApp(content::BrowserContext* context, DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK(context); web_app::WebAppProvider* web_app_provider = - web_app::WebAppProvider::GetForLocalApps( + web_app::WebAppProvider::GetForLocalAppsUnchecked( Profile::FromBrowserContext(context)); DCHECK(web_app_provider); diff --git a/chrome/browser/ash/arc/metrics/arc_metrics_service_proxy.cc b/chrome/browser/ash/arc/metrics/arc_metrics_service_proxy.cc index 228ecdcc8c92b9..fe23b45079cfe1 100644 --- a/chrome/browser/ash/arc/metrics/arc_metrics_service_proxy.cc +++ b/chrome/browser/ash/arc/metrics/arc_metrics_service_proxy.cc @@ -96,4 +96,13 @@ void ArcMetricsServiceProxy::OnArcOOMKillCount( memory::MemoryKillsMonitor::LogArcOOMKill(current_oom_kills); } +void ArcMetricsServiceProxy::OnArcMemoryPressureKill(int count, + int estimated_freed_kb) { + // TODO(b/197040216): update kill metrics to separate tab discards, LMKD + // kills, and pressure kills. + for (int i = 0; i < count; i++) { + memory::MemoryKillsMonitor::LogLowMemoryKill("APP_PRESSURE", 0); + } +} + } // namespace arc diff --git a/chrome/browser/ash/arc/metrics/arc_metrics_service_proxy.h b/chrome/browser/ash/arc/metrics/arc_metrics_service_proxy.h index 888eae6b2f9a77..1addce3631dfb2 100644 --- a/chrome/browser/ash/arc/metrics/arc_metrics_service_proxy.h +++ b/chrome/browser/ash/arc/metrics/arc_metrics_service_proxy.h @@ -51,6 +51,7 @@ class ArcMetricsServiceProxy : public KeyedService, // ArcMetricsService::AppKillObserver overrides. void OnArcLowMemoryKill() override; void OnArcOOMKillCount(unsigned long current_oom_kills) override; + void OnArcMemoryPressureKill(int count, int estimated_freed_kb) override; private: ArcAppListPrefs* const arc_app_list_prefs_; diff --git a/chrome/browser/ash/arc/nearby_share/arc_nearby_share_bridge.cc b/chrome/browser/ash/arc/nearby_share/arc_nearby_share_bridge.cc index 49fbca291508ce..38088f5efdbccd 100644 --- a/chrome/browser/ash/arc/nearby_share/arc_nearby_share_bridge.cc +++ b/chrome/browser/ash/arc/nearby_share/arc_nearby_share_bridge.cc @@ -73,7 +73,7 @@ ArcNearbyShareBridge::~ArcNearbyShareBridge() { session_map_.clear(); } -void ArcNearbyShareBridge::OnNearbyShareSessionFinished(int32_t task_id) { +void ArcNearbyShareBridge::OnNearbyShareSessionFinished(uint32_t task_id) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (!session_map_.erase(task_id)) { VLOG(1) << "No share session found for " << task_id; diff --git a/chrome/browser/ash/arc/nearby_share/arc_nearby_share_bridge.h b/chrome/browser/ash/arc/nearby_share/arc_nearby_share_bridge.h index 391f30dc84bab3..072032fce56b32 100644 --- a/chrome/browser/ash/arc/nearby_share/arc_nearby_share_bridge.h +++ b/chrome/browser/ash/arc/nearby_share/arc_nearby_share_bridge.h @@ -54,7 +54,7 @@ class ArcNearbyShareBridge : public KeyedService, private: // Called by NearbyShareSessionImpl when the session is finished and can be // cleaned up. - void OnNearbyShareSessionFinished(int32_t task_id); + void OnNearbyShareSessionFinished(uint32_t task_id); ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager. diff --git a/chrome/browser/ash/arc/nearby_share/nearby_share_session_impl.cc b/chrome/browser/ash/arc/nearby_share/nearby_share_session_impl.cc index 70e0bfccb26fde..3e7e25b8ffe0ae 100644 --- a/chrome/browser/ash/arc/nearby_share/nearby_share_session_impl.cc +++ b/chrome/browser/ash/arc/nearby_share/nearby_share_session_impl.cc @@ -101,7 +101,6 @@ NearbyShareSessionImpl::~NearbyShareSessionImpl() { void NearbyShareSessionImpl::OnNearbyShareClosed( views::Widget::ClosedReason reason) { - DCHECK(session_finished_callback_); DCHECK(session_instance_); session_instance_->OnNearbyShareViewClosed(); @@ -115,11 +114,15 @@ void NearbyShareSessionImpl::OnNearbyShareClosed( } // The Nearby Share bubble is not visible. Delete the current session object - // if |file_handler_| is null. |file_handler_| is null if there were no files - // shared or |OnCleanupSession| was called. - if (!file_handler_) { - // Delete the current session object by using the task ID associated with - // it. + // if |file_handler_| is null and |session_finished_callback_| has not been + // invoked yet. |file_handler_| is null if there were no files shared or + // |OnCleanupSession| was called. + // TODO(alanding): Nearby Share bubble is always visible within this function + // after OnCleanupSession(). In this case, IsNearbyShareBubbleVisible() will + // return true in OnCleanupSession(). This bug should be fixed in sharesheet + // so the bubble is closed by the time OnNearbyShareClosed() callback is run. + if (session_finished_callback_ && !file_handler_) { + // Delete the current session object using the task ID associated with it. VLOG(1) << "OnNearbyShareClosed: Deleting session with task ID: " << task_id_; std::move(session_finished_callback_).Run(task_id_); @@ -415,8 +418,6 @@ void NearbyShareSessionImpl::OnSessionDisconnected() { } void NearbyShareSessionImpl::OnCleanupSession() { - DCHECK(session_finished_callback_); - DVLOG(1) << __func__; // PrepareDirectoryTask must first relinquish ownership of |share_path|. prepare_directory_task_.reset(); @@ -434,11 +435,10 @@ void NearbyShareSessionImpl::OnCleanupSession() { } } - // All temp files have been deleted. If the Nearby Share bubble is not - // visible, delete the session object. - if (!IsNearbyShareBubbleVisible()) { - // Delete the current session object by using the task ID associated with - // it. + // All temp files and directories have been deleted. If the Nearby Share + // bubble is not visible, delete the session object if it's still valid. + if (session_finished_callback_ && !IsNearbyShareBubbleVisible()) { + // Delete the current session object using the task ID associated with it. VLOG(1) << "OnCleanupSession: Deleting session with task ID: " << task_id_; std::move(session_finished_callback_).Run(task_id_); } @@ -453,7 +453,6 @@ bool NearbyShareSessionImpl::IsNearbyShareBubbleVisible() const { << task_id_; return false; } - DVLOG(1) << "IsNearbyShareBubbleVisible: Getting Sharesheet service"; sharesheet::SharesheetService* sharesheet_service = sharesheet::SharesheetServiceFactory::GetForProfile(profile_); if (!sharesheet_service) { diff --git a/chrome/browser/ash/arc/nearby_share/nearby_share_session_impl.h b/chrome/browser/ash/arc/nearby_share/nearby_share_session_impl.h index a05d6acdf26c51..8f95960b168fef 100644 --- a/chrome/browser/ash/arc/nearby_share/nearby_share_session_impl.h +++ b/chrome/browser/ash/arc/nearby_share/nearby_share_session_impl.h @@ -31,7 +31,7 @@ class NearbyShareSessionImpl : public mojom::NearbyShareSessionHost, public aura::WindowObserver, public aura::EnvObserver { public: - using SessionFinishedCallback = base::OnceCallback; + using SessionFinishedCallback = base::OnceCallback; NearbyShareSessionImpl( Profile* profile, diff --git a/chrome/browser/ash/arc/session/arc_service_launcher.cc b/chrome/browser/ash/arc/session/arc_service_launcher.cc index dce5315a2f74be..d046dcbc1214ba 100644 --- a/chrome/browser/ash/arc/session/arc_service_launcher.cc +++ b/chrome/browser/ash/arc/session/arc_service_launcher.cc @@ -59,6 +59,7 @@ #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" #include "chrome/common/channel_info.h" #include "components/arc/appfuse/arc_appfuse_bridge.h" +#include "components/arc/arc_features.h" #include "components/arc/arc_service_manager.h" #include "components/arc/arc_util.h" #include "components/arc/audio/arc_audio_bridge.h" @@ -73,6 +74,7 @@ #include "components/arc/keyboard_shortcut/arc_keyboard_shortcut_bridge.h" #include "components/arc/lock_screen/arc_lock_screen_bridge.h" #include "components/arc/media_session/arc_media_session_bridge.h" +#include "components/arc/memory_pressure/arc_memory_pressure_bridge.h" #include "components/arc/metrics/arc_metrics_service.h" #include "components/arc/midis/arc_midis_bridge.h" #include "components/arc/net/arc_net_host_impl.h" @@ -255,8 +257,12 @@ void ArcServiceLauncher::OnPrimaryUserProfilePrepared(Profile* profile) { ash::ApkWebAppService::Get(profile); ash::full_restore::FullRestoreArcTaskHandler::GetForProfile(profile); - // ARC Container-only services. - if (!arc::IsArcVmEnabled()) { + if (arc::IsArcVmEnabled()) { + // ARCVM-only services. + if (base::FeatureList::IsEnabled(kVmBalloonPolicy)) + ArcMemoryPressureBridge::GetForBrowserContext(profile); + } else { + // ARC Container-only services. ArcAppfuseBridge::GetForBrowserContext(profile); ArcObbMounterBridge::GetForBrowserContext(profile); } diff --git a/chrome/browser/ash/file_manager/file_manager_jstest.cc b/chrome/browser/ash/file_manager/file_manager_jstest.cc index 0767b06d7c7b50..4f42c5bca9e21e 100644 --- a/chrome/browser/ash/file_manager/file_manager_jstest.cc +++ b/chrome/browser/ash/file_manager/file_manager_jstest.cc @@ -40,6 +40,10 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, BannerUtil) { RunTestURL("foreground/js/banner_util_unittest.m_gen.html"); } +IN_PROC_BROWSER_TEST_F(FileManagerJsTest, BannerWarning) { + RunTestURL("foreground/js/ui/banners/warning_banner_unittest.m_gen.html"); +} + IN_PROC_BROWSER_TEST_F(FileManagerJsTest, ContentMetadataProvider) { RunTestURL( "foreground/js/metadata/content_metadata_provider_unittest.m_gen.html"); diff --git a/chrome/browser/ash/file_manager/file_manager_string_util.cc b/chrome/browser/ash/file_manager/file_manager_string_util.cc index 802f82965bca95..858f8545c707ff 100644 --- a/chrome/browser/ash/file_manager/file_manager_string_util.cc +++ b/chrome/browser/ash/file_manager/file_manager_string_util.cc @@ -426,6 +426,7 @@ void AddStringsGeneric(base::Value* dict) { SET_STRING("DISMISS_LABEL", IDS_FILE_BROWSER_DISMISS_LABEL); SET_STRING("DOWNLOADS_DIRECTORY_LABEL", IDS_FILE_BROWSER_DOWNLOADS_DIRECTORY_LABEL); + SET_STRING("LEARN_MORE_LABEL", IDS_FILE_BROWSER_LEARN_MORE_LABEL); SET_STRING("DOWNLOADS_DIRECTORY_WARNING", IDS_FILE_BROWSER_DOWNLOADS_DIRECTORY_WARNING); SET_STRING("DOWNLOADS_DIRECTORY_WARNING_FILESNG", diff --git a/chrome/browser/badging/badge_manager.cc b/chrome/browser/badging/badge_manager.cc index 17c8768d9f3992..dd102b873c1d00 100644 --- a/chrome/browser/badging/badge_manager.cc +++ b/chrome/browser/badging/badge_manager.cc @@ -44,9 +44,10 @@ bool IsLastBadgingTimeWithin(base::TimeDelta time_frame, const web_app::AppId& app_id, const base::Clock* clock, Profile* profile) { - const base::Time last_badging_time = WebAppProvider::GetForLocalApps(profile) - ->registrar() - .GetAppLastBadgingTime(app_id); + const base::Time last_badging_time = + WebAppProvider::GetForLocalAppsUnchecked(profile) + ->registrar() + .GetAppLastBadgingTime(app_id); return clock->Now() < last_badging_time + time_frame; } @@ -58,7 +59,7 @@ void UpdateBadgingTime(const base::Clock* clock, return; } - WebAppProvider::GetForLocalApps(profile) + WebAppProvider::GetForLocalAppsUnchecked(profile) ->registry_controller() .SetAppLastBadgingTime(app_id, clock->Now()); } @@ -253,7 +254,7 @@ BadgeManager::FrameBindingContext::GetAppIdsAndUrlsForBadging() const { if (!contents) return std::vector>{}; - auto* provider = WebAppProvider::GetForLocalApps( + auto* provider = WebAppProvider::GetForLocalAppsUnchecked( Profile::FromBrowserContext(contents->GetBrowserContext())); if (!provider) return std::vector>{}; @@ -276,7 +277,7 @@ BadgeManager::ServiceWorkerBindingContext::GetAppIdsAndUrlsForBadging() const { if (!render_process_host) return std::vector>{}; - auto* provider = WebAppProvider::GetForLocalApps( + auto* provider = WebAppProvider::GetForLocalAppsUnchecked( Profile::FromBrowserContext(render_process_host->GetBrowserContext())); if (!provider) return std::vector>{}; diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 185c27f8112ad6..133fdd5216ed7a 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -534,6 +534,8 @@ #include "chrome/browser/ash/app_mode/kiosk_settings_navigation_throttle.h" #include "chrome/browser/ash/child_accounts/time_limits/web_time_limit_navigation_throttle.h" #include "chrome/browser/speech/tts_controller_delegate_impl.h" +// TODO(b/195975836): Support Lacros as well. +#include "chrome/browser/ui/ash/projector/projector_navigation_throttle.h" #endif // BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(ENABLE_MEDIA_REMOTING) @@ -3291,7 +3293,7 @@ void ChromeContentBrowserClient::OverrideWebkitPrefs( Browser* browser = chrome::FindBrowserWithWebContents(web_contents); if (browser && browser->app_controller()) { web_app::WebAppProvider* const web_app_provider = - web_app::WebAppProvider::GetForLocalApps(profile); + web_app::WebAppProvider::GetForLocalAppsUnchecked(profile); const web_app::AppId& app_id = browser->app_controller()->app_id(); const web_app::WebAppRegistrar& registrar = web_app_provider->registrar(); @@ -3920,6 +3922,10 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation( MaybeAddThrottle( ash::WebTimeLimitNavigationThrottle::MaybeCreateThrottleFor(handle), &throttles); + // TODO(b/195975836): Support Lacros as well. + MaybeAddThrottle( + ash::ProjectorNavigationThrottle::MaybeCreateThrottleFor(handle), + &throttles); #endif // BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(ENABLE_SUPERVISED_USERS) diff --git a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc index 24afa01f12d57d..da95ebc0b66c71 100644 --- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc +++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc @@ -328,8 +328,11 @@ void DoSafeBrowsingCheckOnUIThread( if (!item->web_contents) { content::RenderFrameHost* rfh = content::RenderFrameHost::FromID(frame_id); - if (rfh) + if (rfh) { + DCHECK_NE(rfh->GetLifecycleState(), + content::RenderFrameHost::LifecycleState::kPrerendering); item->web_contents = content::WebContents::FromRenderFrameHost(rfh); + } } sb_service->download_protection_service()->CheckFileSystemAccessWrite( diff --git a/chrome/browser/file_system_access/chrome_file_system_access_permission_context_browsertest.cc b/chrome/browser/file_system_access/chrome_file_system_access_permission_context_browsertest.cc new file mode 100644 index 00000000000000..af15dc667fd4ad --- /dev/null +++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context_browsertest.cc @@ -0,0 +1,231 @@ +// Copyright 2021 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/file_system_access/chrome_file_system_access_permission_context.h" + +#include "base/files/file_util.h" +#include "base/files/scoped_temp_dir.h" +#include "chrome/browser/file_system_access/file_system_access_permission_request_manager.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "chrome/test/base/ui_test_utils.h" +#include "content/public/test/browser_test.h" +#include "content/public/test/browser_test_utils.h" +#include "content/public/test/prerender_test_util.h" +#include "net/dns/mock_host_resolver.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/shell_dialogs/select_file_dialog.h" +#include "ui/shell_dialogs/select_file_dialog_factory.h" +#include "ui/shell_dialogs/select_file_policy.h" + +namespace { + +// Fake ui::SelectFileDialog that selects one or more pre-determined files. +class FakeSelectFileDialog : public ui::SelectFileDialog { + public: + FakeSelectFileDialog(std::vector result, + Listener* listener, + std::unique_ptr policy) + : ui::SelectFileDialog(listener, std::move(policy)), + result_(std::move(result)) {} + + protected: + void SelectFileImpl(Type type, + const std::u16string& title, + const base::FilePath& default_path, + const FileTypeInfo* file_types, + int file_type_index, + const base::FilePath::StringType& default_extension, + gfx::NativeWindow owning_window, + void* params) override { + if (result_.size() == 1) + listener_->FileSelected(result_[0], 0, params); + else + listener_->MultiFilesSelected(result_, params); + } + + bool IsRunning(gfx::NativeWindow owning_window) const override { + return false; + } + void ListenerDestroyed() override {} + bool HasMultipleFileTypeChoicesImpl() override { return false; } + + private: + ~FakeSelectFileDialog() override = default; + std::vector result_; +}; + +class FakeSelectFileDialogFactory : public ui::SelectFileDialogFactory { + public: + explicit FakeSelectFileDialogFactory(std::vector result) + : result_(std::move(result)) {} + ~FakeSelectFileDialogFactory() override = default; + + ui::SelectFileDialog* Create( + ui::SelectFileDialog::Listener* listener, + std::unique_ptr policy) override { + return new FakeSelectFileDialog(result_, listener, std::move(policy)); + } + + private: + std::vector result_; +}; + +class TestFileSystemAccessPermissionContext + : public ChromeFileSystemAccessPermissionContext { + public: + explicit TestFileSystemAccessPermissionContext( + content::BrowserContext* context) + : ChromeFileSystemAccessPermissionContext(context) {} + ~TestFileSystemAccessPermissionContext() override = default; + + // ChromeFileSystemAccessPermissionContext: + void PerformAfterWriteChecks( + std::unique_ptr item, + content::GlobalRenderFrameHostId frame_id, + base::OnceCallback callback) override { + std::move(callback).Run(AfterWriteCheckResult::kAllow); + content::RenderFrameHost* rfh = content::RenderFrameHost::FromID(frame_id); + EXPECT_TRUE(rfh->IsActive()); + performed_after_write_checks_ = true; + if (quit_callback_) + std::move(quit_callback_).Run(); + } + + bool performed_after_write_checks() { return performed_after_write_checks_; } + + void WaitForPerformAfterWriteChecks() { + if (performed_after_write_checks_) + return; + + base::RunLoop run_loop; + quit_callback_ = run_loop.QuitClosure(); + run_loop.Run(); + } + + private: + bool performed_after_write_checks_ = false; + base::OnceClosure quit_callback_; +}; + +} // anonymous namespace + +class ChromeFileSystemAccessPermissionContextPrerenderingBrowserTest + : public InProcessBrowserTest { + public: + ChromeFileSystemAccessPermissionContextPrerenderingBrowserTest() + : prerender_test_helper_(base::BindRepeating( + &ChromeFileSystemAccessPermissionContextPrerenderingBrowserTest:: + GetWebContents, + base::Unretained(this))) {} + ~ChromeFileSystemAccessPermissionContextPrerenderingBrowserTest() override = + default; + + void SetUp() override { + ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); + prerender_test_helper_.SetUp(embedded_test_server()); + InProcessBrowserTest::SetUp(); + } + + void SetUpOnMainThread() override { + host_resolver()->AddRule("*", "127.0.0.1"); + test_server_handle_ = embedded_test_server()->StartAndReturnHandle(); + } + + void TearDown() override { + InProcessBrowserTest::TearDown(); + ASSERT_TRUE(temp_dir_.Delete()); + } + + base::FilePath CreateTestFile(const std::string& contents) { + base::ScopedAllowBlockingForTesting allow_blocking; + base::FilePath result; + EXPECT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.GetPath(), &result)); + EXPECT_TRUE(base::WriteFile(result, contents)); + return result; + } + + content::test::PrerenderTestHelper& prerender_helper() { + return prerender_test_helper_; + } + + content::WebContents* GetWebContents() { + return browser()->tab_strip_model()->GetActiveWebContents(); + } + + private: + content::test::PrerenderTestHelper prerender_test_helper_; + net::test_server::EmbeddedTestServerHandle test_server_handle_; + base::ScopedTempDir temp_dir_; +}; + +// Tests that PerformAfterWriteChecks() that is called by +// 'FileSystemWritableFileStream.close()' works with the RenderFrameHost in an +// active state, not the prerendered RenderFrameHost. +IN_PROC_BROWSER_TEST_F( + ChromeFileSystemAccessPermissionContextPrerenderingBrowserTest, + PerformAfterWriteChecks) { + const base::FilePath test_file = CreateTestFile(""); + ui::SelectFileDialog::SetFactory( + new FakeSelectFileDialogFactory({test_file})); + + TestFileSystemAccessPermissionContext permission_context( + browser()->profile()); + content::SetFileSystemAccessPermissionContext(browser()->profile(), + &permission_context); + FileSystemAccessPermissionRequestManager::FromWebContents(GetWebContents()) + ->set_auto_response_for_test(permissions::PermissionAction::GRANTED); + + // Initial navigation. + GURL initial_url = embedded_test_server()->GetURL("/empty.html"); + ASSERT_NE(ui_test_utils::NavigateToURL(browser(), initial_url), nullptr); + + // Add prerendering. + GURL prerender_url = embedded_test_server()->GetURL("/title1.html"); + int host_id = prerender_helper().AddPrerender(prerender_url); + content::RenderFrameHost* prerendered_frame_host = + prerender_helper().GetPrerenderedMainFrameHost(host_id); + + // In order to get the file handle without the file picker dialog in the + // prerendered page, BroadcastChannel gets the file handle from the current + // active page. + ignore_result(content::ExecJs(prerendered_frame_host, R"( + var createWritableAndClose = (async () => { + let b = new BroadcastChannel('channel'); + self.message_promise = new Promise(resolve => { + b.onmessage = resolve; + }); + let e = await self.message_promise; + self.entry = e.data.entry; + const w = await self.entry.createWritable(); + await w.write(new Blob(['hello'])); + await w.close(); + return "";})(); + )")); + + // The active page picks files and sends it to the prerendered page to test + // 'close()' in prerendering. + ignore_result(content::ExecJs( + GetWebContents(), + "(async () => {" + " let [e] = await self.showOpenFilePicker();" + " self.entry = e;" + " new BroadcastChannel('channel').postMessage({entry: e});" + " return e.name; })()")); + + // PerformAfterWriteChecks() is not called in prerendering. + EXPECT_FALSE(permission_context.performed_after_write_checks()); + + // Activate the prerendered page. + prerender_helper().NavigatePrimaryPage(prerender_url); + GetWebContents()->GetMainFrame()->NotifyUserActivation( + blink::mojom::UserActivationNotificationType::kTest); + permission_context.WaitForPerformAfterWriteChecks(); + + // PerformAfterWriteChecks() should be called in the activated page. + EXPECT_TRUE(permission_context.performed_after_write_checks()); + + ui::SelectFileDialog::SetFactory(nullptr); +} diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 82e217165fa4d4..8b85763860b3ed 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json @@ -247,6 +247,11 @@ "owners": [ "khmel" ], "expiry_milestone": 92 }, + { + "name": "arc-use-limit-cache-balloon-policy", + "owners": [ "cwd" ], + "expiry_milestone": 97 + }, { "name": "arc-web-app-share", "owners": [ "tsergeant", "chromeos-apps-foundation-team@google.com" ], @@ -731,6 +736,11 @@ "owners": [ "basiaz@google.com", "chrome-language@google.com" ], "expiry_milestone": 96 }, + { + "name": "context-menu-actions-refresh", + "owners": [ "ewannpv@google.com", "gambard@google.com" ], + "expiry_milestone": 99 + }, { "name": "context-menu-google-lens-chip", "owners": [ "yusuyoutube@google.com", "benwgold@google.com", "lens-chrome@google.com" ], diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 5220c2d684662b..752f20390bb278 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc @@ -3949,6 +3949,12 @@ const char kArcUseHighMemoryDalvikProfileDesc[] = "Allow Android to use high-memory dalvik profile when applicable for " "high-memory devices."; +const char kArcVmBalloonPolicyName[] = + "Enable ARCVM limit cache balloon policy"; +const char kArcVmBalloonPolicyDesc[] = + "Trigger reclaim in ARCVM to reduce memory use when ChromeOS is running " + "low on memory."; + const char kArcWebAppShareName[] = "Enable sharing to Web Apps from ARC"; const char kArcWebAppShareDescription[] = "Allow Android apps to send shared text and files to web apps. When " diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 04887972e945f3..be869f65eb7e30 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h @@ -2259,6 +2259,9 @@ extern const char kArcRtVcpuQuadCoreDesc[]; extern const char kArcUseHighMemoryDalvikProfileName[]; extern const char kArcUseHighMemoryDalvikProfileDesc[]; +extern const char kArcVmBalloonPolicyName[]; +extern const char kArcVmBalloonPolicyDesc[]; + extern const char kArcWebAppShareName[]; extern const char kArcWebAppShareDescription[]; diff --git a/chrome/browser/performance_manager/observers/page_load_metrics_observer.cc b/chrome/browser/performance_manager/observers/page_load_metrics_observer.cc index 40e8ba855636c5..76f66b5e389256 100644 --- a/chrome/browser/performance_manager/observers/page_load_metrics_observer.cc +++ b/chrome/browser/performance_manager/observers/page_load_metrics_observer.cc @@ -57,38 +57,6 @@ enum class NavigationType { kCount, }; -// This enum matches "StabilityPageLoadType" in enums.xml. The ordering -// of values must match the ordering of values in the NavigationType enum. -enum class LoadType { - kVisibleTabBase = 0, - kVisibleTabMainFrameDifferentDocument = 0, - kVisibleTabSubFrameDifferentDocument = 1, - kVisibleTabMainFrameSameDocument = 2, - kVisibleTabSubFrameSameDocument = 3, - kVisibleTabNoCommit = 4, - - kHiddenTabBase = 5, - kHiddenTabMainFrameDifferentDocument = 5, - kHiddenTabSubFrameDifferentDocument = 6, - kHiddenTabMainFrameSameDocument = 7, - kHiddenTabSubFrameSameDocument = 8, - kHiddenTabNoCommit = 9, - - kPrerenderBase = 10, - kPrerenderMainFrameDifferentDocument = 10, - kPrerenderSubFrameDifferentDocument = 11, - kPrerenderMainFrameSameDocument = 12, - kPrerenderSubFrameSameDocument = 13, - kPrerenderNoCommit = 14, - - kExtension = 15, - kDevTools = 16, - - kUnknown = 17, - - kMaxValue = kUnknown, -}; - // Bucketize |load_count| using an exponential function to minimize bits of data // sent through UKM. The bucket spacing is chosen to have exact counts until 20. // go/exponential-bucketing-for-ukm-discussion diff --git a/chrome/browser/performance_manager/observers/page_load_metrics_observer.h b/chrome/browser/performance_manager/observers/page_load_metrics_observer.h index b70abaabd0f229..df23736457c7a2 100644 --- a/chrome/browser/performance_manager/observers/page_load_metrics_observer.h +++ b/chrome/browser/performance_manager/observers/page_load_metrics_observer.h @@ -9,6 +9,38 @@ namespace performance_manager { +// This enum matches "StabilityPageLoadType" in enums.xml. The ordering +// of values must match the ordering of values in the NavigationType enum. +enum class LoadType { + kVisibleTabBase = 0, + kVisibleTabMainFrameDifferentDocument = 0, + kVisibleTabSubFrameDifferentDocument = 1, + kVisibleTabMainFrameSameDocument = 2, + kVisibleTabSubFrameSameDocument = 3, + kVisibleTabNoCommit = 4, + + kHiddenTabBase = 5, + kHiddenTabMainFrameDifferentDocument = 5, + kHiddenTabSubFrameDifferentDocument = 6, + kHiddenTabMainFrameSameDocument = 7, + kHiddenTabSubFrameSameDocument = 8, + kHiddenTabNoCommit = 9, + + kPrerenderBase = 10, + kPrerenderMainFrameDifferentDocument = 10, + kPrerenderSubFrameDifferentDocument = 11, + kPrerenderMainFrameSameDocument = 12, + kPrerenderSubFrameSameDocument = 13, + kPrerenderNoCommit = 14, + + kExtension = 15, + kDevTools = 16, + + kUnknown = 17, + + kMaxValue = kUnknown, +}; + // PageLoadMetricsObserver records detailed metrics to explain what is included // in the "Total Pageloads" presented on stability dashboards. class PageLoadMetricsObserver diff --git a/chrome/browser/performance_manager/observers/page_load_metrics_observer_browsertest.cc b/chrome/browser/performance_manager/observers/page_load_metrics_observer_browsertest.cc new file mode 100644 index 00000000000000..ebbf7b0b389496 --- /dev/null +++ b/chrome/browser/performance_manager/observers/page_load_metrics_observer_browsertest.cc @@ -0,0 +1,99 @@ +// Copyright 2021 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/performance_manager/observers/page_load_metrics_observer.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "chrome/test/base/ui_test_utils.h" +#include "components/ukm/test_ukm_recorder.h" +#include "content/public/test/browser_test.h" +#include "content/public/test/prerender_test_util.h" +#include "net/dns/mock_host_resolver.h" +#include "services/metrics/public/cpp/ukm_builders.h" + +class PageLoadMetricsObserverPrerenderBrowserTest + : public InProcessBrowserTest { + public: + PageLoadMetricsObserverPrerenderBrowserTest() + : prerender_helper_(base::BindRepeating( + &PageLoadMetricsObserverPrerenderBrowserTest::GetWebContents, + base::Unretained(this))) {} + ~PageLoadMetricsObserverPrerenderBrowserTest() override = default; + PageLoadMetricsObserverPrerenderBrowserTest( + const PageLoadMetricsObserverPrerenderBrowserTest&) = delete; + + PageLoadMetricsObserverPrerenderBrowserTest& operator=( + const PageLoadMetricsObserverPrerenderBrowserTest&) = delete; + + void SetUp() override { + prerender_helper_.SetUp(embedded_test_server()); + InProcessBrowserTest::SetUp(); + } + + void SetUpOnMainThread() override { + host_resolver()->AddRule("*", "127.0.0.1"); + ASSERT_TRUE(embedded_test_server()->Start()); + } + + void PreRunTestOnMainThread() override { + InProcessBrowserTest::PreRunTestOnMainThread(); + histogram_tester_ = std::make_unique(); + test_ukm_recorder_ = std::make_unique(); + } + + content::test::PrerenderTestHelper& prerender_test_helper() { + return prerender_helper_; + } + + content::WebContents* GetWebContents() { + return browser()->tab_strip_model()->GetActiveWebContents(); + } + + base::HistogramTester* histogram_tester() { return histogram_tester_.get(); } + ukm::TestAutoSetUkmRecorder* test_ukm_recorder() { + return test_ukm_recorder_.get(); + } + + private: + content::test::PrerenderTestHelper prerender_helper_; + std::unique_ptr histogram_tester_; + std::unique_ptr test_ukm_recorder_; +}; + +IN_PROC_BROWSER_TEST_F(PageLoadMetricsObserverPrerenderBrowserTest, + PrerenderingDontRecordUKMMetricsAndUMAHistogram) { + auto initial_url = embedded_test_server()->GetURL("/empty.html"); + ui_test_utils::NavigateToURL(browser(), initial_url); + + auto entries = test_ukm_recorder()->GetEntriesByName( + ukm::builders::LoadCountsPerTopLevelDocument::kEntryName); + EXPECT_EQ(1u, entries.size()); + histogram_tester()->ExpectBucketCount( + "Stability.Experimental.PageLoads", + performance_manager::LoadType::kVisibleTabBase, 1); + + // Load a page in the prerender. + GURL prerender_url = embedded_test_server()->GetURL("/title1.html"); + const int host_id = prerender_test_helper().AddPrerender(prerender_url); + content::test::PrerenderHostObserver host_observer(*GetWebContents(), + host_id); + EXPECT_FALSE(host_observer.was_activated()); + entries = test_ukm_recorder()->GetEntriesByName( + ukm::builders::LoadCountsPerTopLevelDocument::kEntryName); + // Prerendering should not increase the entry size and the bucket count. + EXPECT_EQ(1u, entries.size()); + histogram_tester()->ExpectBucketCount( + "Stability.Experimental.PageLoads", + performance_manager::LoadType::kVisibleTabBase, 1); + + // Activate the prerender page. + prerender_test_helper().NavigatePrimaryPage(prerender_url); + EXPECT_TRUE(host_observer.was_activated()); + entries = test_ukm_recorder()->GetEntriesByName( + ukm::builders::LoadCountsPerTopLevelDocument::kEntryName); + EXPECT_EQ(2u, entries.size()); + histogram_tester()->ExpectBucketCount( + "Stability.Experimental.PageLoads", + performance_manager::LoadType::kVisibleTabBase, 2); +} diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc index c54c804def76c4..d0c593343ece60 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc @@ -1483,7 +1483,8 @@ void RenderViewContextMenu::AppendOpenInWebAppLinkItems() { if (!apps::AppServiceProxyFactory::IsAppServiceAvailableForProfile(profile)) return; - auto* const provider = web_app::WebAppProvider::GetForLocalApps(profile); + auto* const provider = + web_app::WebAppProvider::GetForLocalAppsUnchecked(profile); if (!provider) return; diff --git a/chrome/browser/resources/settings/chromeos/BUILD.gn b/chrome/browser/resources/settings/chromeos/BUILD.gn index d989ae783988fc..a109773c089b66 100644 --- a/chrome/browser/resources/settings/chromeos/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/BUILD.gn @@ -448,6 +448,7 @@ preprocess_if_expr("preprocess_gen_v3") { "chromeos/os_apps_page/app_management_page/shared_vars.m.js", "chromeos/os_apps_page/app_management_page/store.m.js", "chromeos/os_apps_page/app_management_page/store_client.m.js", + "chromeos/os_apps_page/app_management_page/supported_links_dialog.m.js", "chromeos/os_apps_page/app_management_page/supported_links_item.m.js", "chromeos/os_apps_page/app_management_page/toggle_row.m.js", "chromeos/os_apps_page/app_management_page/types.m.js", @@ -513,7 +514,7 @@ preprocess_if_expr("preprocess_gen_v3") { "chromeos/os_search_page/search_subpage.js", "chromeos/os_search_page/search_engine.js", "chromeos/os_settings_icons_css.m.js", - "chromeos/os_settings_menu/os_settings_menu.m.js", + "chromeos/os_settings_menu/os_settings_menu.js", "chromeos/os_settings_main/os_settings_main.m.js", "chromeos/os_settings_page/main_page_behavior.m.js", "chromeos/os_settings_page/settings_idle_load.m.js", @@ -748,7 +749,7 @@ group("polymer3_elements") { "os_reset_page:web_components", "os_search_page:web_components", "os_settings_main:polymer3_elements", - "os_settings_menu:polymer3_elements", + "os_settings_menu:web_components", "os_settings_page:polymer3_elements", "os_settings_search_box:web_components", "os_settings_ui:polymer3_elements", diff --git a/chrome/browser/resources/settings/chromeos/lazy_load.js b/chrome/browser/resources/settings/chromeos/lazy_load.js index 8bd5f2f9be35e3..b3c14ee0cf2ef0 100644 --- a/chrome/browser/resources/settings/chromeos/lazy_load.js +++ b/chrome/browser/resources/settings/chromeos/lazy_load.js @@ -63,7 +63,7 @@ export {CrostiniBrowserProxy, CrostiniBrowserProxyImpl} from './crostini_page/cr export {TimeZoneAutoDetectMethod} from './date_time_page/date_time_types.js'; export {TimeZoneBrowserProxyImpl} from './date_time_page/timezone_browser_proxy.js'; export {CROSTINI_TYPE, GuestOsBrowserProxy, GuestOsBrowserProxyImpl, GuestOsSharedUsbDevice, PLUGIN_VM_TYPE} from './guest_os/guest_os_browser_proxy.js'; -export {LanguagesMetricsProxy, LanguagesMetricsProxyImpl, LanguagesPageInteraction} from './os_languages_page/languages_metrics_proxy.m.js'; +export {InputsShortcutReminderState, LanguagesMetricsProxy, LanguagesMetricsProxyImpl, LanguagesPageInteraction} from './os_languages_page/languages_metrics_proxy.m.js'; export {PrinterType} from './os_printing_page/cups_printer_types.js'; export {CupsPrintersBrowserProxy, CupsPrintersBrowserProxyImpl, PrinterSetupResult, PrintServerResult} from './os_printing_page/cups_printers_browser_proxy.js'; export {CupsPrintersEntryManager} from './os_printing_page/cups_printers_entry_manager.js'; diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/BUILD.gn index 4755597663b974..2b0c19468914c1 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/BUILD.gn @@ -33,6 +33,7 @@ js_type_check("closure_compile_module") { ":shared_vars.m", ":store.m", ":store_client.m", + ":supported_links_dialog.m", ":supported_links_item.m", ":toggle_row.m", ":types.m", @@ -277,17 +278,30 @@ js_library("store_client.m") { extra_deps = [ ":modulize" ] } +js_library("supported_links_dialog.m") { + sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_dialog.m.js" ] + deps = [ + ":browser_proxy.m", + ":store_client.m", + "//third_party/polymer/v3_0/components-chromium/iron-list:iron-list", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + ] + extra_deps = [ ":supported_links_dialog_module" ] +} + js_library("supported_links_item.m") { sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_item.m.js" ] deps = [ ":browser_proxy.m", ":constants.m", ":store_client.m", + ":supported_links_dialog.m", ":types.m", ":util.m", "../../localized_link:localized_link", "//ui/webui/resources/cr_elements/cr_radio_button:cr_radio_button.m", "//ui/webui/resources/cr_elements/cr_radio_group:cr_radio_group.m", + "//ui/webui/resources/js/cr/ui:focus_without_ink.m", ] extra_deps = [ ":supported_links_item_module" ] } @@ -349,6 +363,7 @@ group("polymer3_elements") { ":resize_lock_item_module", ":shared_style_module", ":shared_vars_module", + ":supported_links_dialog_module", ":supported_links_item_module", ":toggle_row_module", ":uninstall_button_module", @@ -472,6 +487,15 @@ polymer_modulizer("shared_vars") { html_type = "custom-style" } +polymer_modulizer("supported_links_dialog") { + js_file = "supported_links_dialog.js" + html_file = "supported_links_dialog.html" + html_type = "dom-module" + migrated_imports = os_settings_migrated_imports + namespace_rewrites = os_settings_namespace_rewrites + auto_imports = os_settings_auto_imports +} + polymer_modulizer("supported_links_item") { js_file = "supported_links_item.js" html_file = "supported_links_item.html" diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_dialog.html b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_dialog.html new file mode 100644 index 00000000000000..6b1e7b2adbe8a2 --- /dev/null +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_dialog.html @@ -0,0 +1,36 @@ + + + + + + + + + diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_dialog.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_dialog.js new file mode 100644 index 00000000000000..ab08dad9194dbf --- /dev/null +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_dialog.js @@ -0,0 +1,18 @@ +// Copyright 2021 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. + +import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js'; + +Polymer({ + is: 'app-management-supported-links-dialog', + + behaviors: [ + I18nBehavior, + ], + + properties: { + /** @type {!App} */ + app: Object, + }, +}); diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_item.html b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_item.html index 54dff053abf325..8aca68715bbf35 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_item.html +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_item.html @@ -4,11 +4,13 @@ + - + +