diff --git a/BUILD.gn b/BUILD.gn index 4283a4f..ce3ab61f 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -269,13 +269,6 @@ deps += [ "//tools/xdisplaycheck" ] } - if (is_win) { - deps += [ - "//chrome/credential_provider", - "//chrome/credential_provider/test:gcp_unittests", - ] - } - if (is_mac) { deps += [ "//chrome/installer/gcapi_mac:gcapi_example" ] }
diff --git a/DEPS b/DEPS index a3ee4ecd..bb63e78 100644 --- a/DEPS +++ b/DEPS
@@ -105,11 +105,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '58887bc3c18670276044664dc4ad190ee636417a', + 'skia_revision': 'd945698c5dfa8e78c05da0a3e1730da9d95d33db', # 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': '1cac54c9dbb100764a2d739afd60f56dab9fb950', + 'v8_revision': 'fdd620c6fe49b2bdadc9ef513c1f52187f72647a', # 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. @@ -117,7 +117,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': 'b4ead90b037359a14e90d78a935b426f862cbc36', + 'angle_revision': '14246813a110fe2f67ed01dfb2102b6d72cc7ec4', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling build tools # and whatever else without interference from each other. @@ -129,7 +129,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': '38772e9f7456021df78eaea3258c63e8c39cf309', + 'pdfium_revision': '39cf6a765ae349242289ec3287eaf4d6c5fd57f8', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling openmax_dl # and whatever else without interference from each other. @@ -165,7 +165,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '1b6e81b579f317a1c69d06538f6c8ee48d062c5f', + 'catapult_revision': '3f7d74f7cd026ad3611e089c377b03304277d566', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -313,7 +313,7 @@ }, 'src/ios/third_party/material_components_ios/src': { - 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '50455404c6a72aa0540406325e787f0e2cf9b8d0', + 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '2ccd8f24cd0218f6ef55f10f3d18d9b1fb74d31b', 'condition': 'checkout_ios', }, @@ -620,7 +620,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'e8f574a2167a69418b45ada45f178faca7bad83a', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '5b1fa949bba4c75c88aead94948d89c6cb161e0c', 'src/third_party/devtools-node-modules': Var('chromium_git') + '/external/github.com/ChromeDevTools/devtools-node-modules' + '@' + Var('devtools_node_modules_revision'), @@ -1106,7 +1106,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '6d2f3f4cb8bac1f7c4a945c73d07a33df74f22f9', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + 'f638bbc181eb73e2a2d9fde701507ce1cda1bc37', + Var('webrtc_git') + '/src.git' + '@' + '264079a57aec9d865840b26c672bab538c9d11dc', 'src/third_party/xdg-utils': { 'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d', @@ -1137,7 +1137,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@c92be01892751eba0cfa5c39328251a4de2569bb', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@7b52a768375781cc7a742ae24d2d2379fc040f69', 'condition': 'checkout_src_internal', },
diff --git a/android_webview/tools/run_cts.py b/android_webview/tools/run_cts.py index 0173325..062bfd4 100755 --- a/android_webview/tools/run_cts.py +++ b/android_webview/tools/run_cts.py
@@ -235,6 +235,7 @@ '--test-launcher-summary-output', '--json-results-file', '--write-full-results-to', + '--isolated-script-test-output', dest='json_results_file', type=os.path.realpath, help='If set, will dump results in JSON form to the specified file. ' 'Note that this will also trigger saving per-test logcats to '
diff --git a/ash/rotator/screen_rotation_animator.cc b/ash/rotator/screen_rotation_animator.cc index 48f7e96..89e93e8 100644 --- a/ash/rotator/screen_rotation_animator.cc +++ b/ash/rotator/screen_rotation_animator.cc
@@ -203,6 +203,7 @@ rotation_request->mode) { StartSlowAnimation(std::move(rotation_request)); } else { + current_async_rotation_request_ = ScreenRotationRequest(*rotation_request); RequestCopyScreenRotationContainerLayer( std::make_unique<viz::CopyOutputRequest>( viz::CopyOutputRequest::ResultFormat::RGBA_TEXTURE, @@ -225,6 +226,9 @@ display::Display::Rotation old_rotation, display::Display::Rotation new_rotation, display::Display::RotationSource source) { + // Reset the current request because its rotation must be applied if any. + current_async_rotation_request_.reset(); + // Allow compositor locks to extend timeout, so that screen rotation only // takes output copy after contents are properlly resized, such as wallpaper // and ARC apps. @@ -460,9 +464,25 @@ std::make_unique<ScreenRotationRequest>(rotation_request_id_, display_id, new_rotation, source, mode); target_rotation_ = new_rotation; + + if (mode == DisplayConfigurationController::ANIMATION_SYNC) + current_async_rotation_request_.reset(); + switch (screen_rotation_state_) { case IDLE: + DCHECK(!current_async_rotation_request_); + FALLTHROUGH; case COPY_REQUESTED: + if (current_async_rotation_request_ && + !RootWindowChangedForDisplayId( + root_window_, current_async_rotation_request_->display_id)) { + Shell::Get()->display_manager()->SetDisplayRotation( + current_async_rotation_request_->display_id, + current_async_rotation_request_->new_rotation, + current_async_rotation_request_->source); + current_async_rotation_request_.reset(); + } + StartRotationAnimation(std::move(rotation_request)); break; case ROTATING: @@ -489,6 +509,7 @@ old_layer_tree_owner_.reset(); new_layer_tree_owner_.reset(); mask_layer_tree_owner_.reset(); + current_async_rotation_request_.reset(); if (last_pending_request_ && !RootWindowChangedForDisplayId(root_window_, last_pending_request_->display_id)) {
diff --git a/ash/rotator/screen_rotation_animator.h b/ash/rotator/screen_rotation_animator.h index 98944b4e..987f494 100644 --- a/ash/rotator/screen_rotation_animator.h +++ b/ash/rotator/screen_rotation_animator.h
@@ -13,6 +13,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" +#include "base/optional.h" #include "ui/display/display.h" namespace aura { @@ -186,6 +187,7 @@ std::unique_ptr<ui::LayerTreeOwner> new_layer_tree_owner_; std::unique_ptr<ui::LayerTreeOwner> mask_layer_tree_owner_; std::unique_ptr<ScreenRotationRequest> last_pending_request_; + base::Optional<ScreenRotationRequest> current_async_rotation_request_; bool has_switch_ash_disable_smooth_screen_rotation_; display::Display::Rotation target_rotation_ = display::Display::ROTATE_0; base::WeakPtrFactory<ScreenRotationAnimator> weak_factory_;
diff --git a/ash/rotator/screen_rotation_animator_unittest.cc b/ash/rotator/screen_rotation_animator_unittest.cc index dbfc3adb..907cd0d 100644 --- a/ash/rotator/screen_rotation_animator_unittest.cc +++ b/ash/rotator/screen_rotation_animator_unittest.cc
@@ -658,4 +658,59 @@ GetDisplayRotation(internal_display_id)); } +TEST_F(ScreenRotationAnimatorSmoothAnimationTest, NewRequestShouldNotCancel) { + const int64_t display_id = display_manager()->GetDisplayAt(0).id(); + aura::Window* root_window = Shell::GetRootWindowForDisplayId(display_id); + SetScreenRotationAnimator( + root_window, run_loop_->QuitWhenIdleClosure(), + base::BindRepeating( + &ScreenRotationAnimatorSmoothAnimationTest::QuitWaitForCopyCallback, + base::Unretained(this))); + SetDisplayRotation(display_id, display::Display::ROTATE_0); + animator()->Rotate(display::Display::ROTATE_90, + display::Display::RotationSource::USER, + DisplayConfigurationController::ANIMATION_ASYNC); + EXPECT_EQ(display::Display::ROTATE_0, GetDisplayRotation(display_id)); + + // Requesting new orientation while waiting for copy should apply the previous + // change immediately. + animator()->Rotate(display::Display::ROTATE_180, + display::Display::RotationSource::USER, + DisplayConfigurationController::ANIMATION_ASYNC); + EXPECT_EQ(display::Display::ROTATE_90, GetDisplayRotation(display_id)); + + // Requesting yet another new orientation while waiting for copy should do the + // same. + animator()->Rotate(display::Display::ROTATE_270, + display::Display::RotationSource::USER, + DisplayConfigurationController::ANIMATION_ASYNC); + EXPECT_EQ(display::Display::ROTATE_180, GetDisplayRotation(display_id)); + + WaitForCopyCallback(); + // The display must be rotated once copy finishes. + EXPECT_EQ(display::Display::ROTATE_270, GetDisplayRotation(display_id)); + EXPECT_TRUE(test_api()->HasActiveAnimations()); + + // Requesting new orientation while animating will be queued. + animator()->Rotate(display::Display::ROTATE_0, + display::Display::RotationSource::USER, + DisplayConfigurationController::ANIMATION_ASYNC); + EXPECT_EQ(display::Display::ROTATE_270, GetDisplayRotation(display_id)); + EXPECT_FALSE(test_api()->HasActiveAnimations()); + + // Finish current animation will start queued animation (from 270 to 0). + test_api()->CompleteAnimations(); + EXPECT_TRUE(animator()->IsRotating()); + EXPECT_EQ(display::Display::ROTATE_270, GetDisplayRotation(display_id)); + EXPECT_FALSE(test_api()->HasActiveAnimations()); + + WaitForCopyCallback(); + EXPECT_TRUE(test_api()->HasActiveAnimations()); + EXPECT_EQ(display::Display::ROTATE_0, GetDisplayRotation(display_id)); + + test_api()->CompleteAnimations(); + EXPECT_FALSE(test_api()->HasActiveAnimations()); + EXPECT_EQ(display::Display::ROTATE_0, GetDisplayRotation(display_id)); +} + } // namespace ash
diff --git a/ash/wm/window_dimmer_unittest.cc b/ash/wm/window_dimmer_unittest.cc index b220a43..e943dd8 100644 --- a/ash/wm/window_dimmer_unittest.cc +++ b/ash/wm/window_dimmer_unittest.cc
@@ -9,7 +9,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/aura/test/aura_test_base.h" #include "ui/aura/test/test_windows.h" -#include "ui/aura/window_occlusion_tracker.h" namespace ash { @@ -20,7 +19,7 @@ aura::Window* root_window = CurrentContext(); aura::Window* bottom_window = aura::test::CreateTestWindow( SK_ColorWHITE, 1, root_window->bounds(), root_window); - aura::WindowOcclusionTracker::Track(bottom_window); + bottom_window->TrackOcclusionState(); WindowDimmer dimmer(root_window); EXPECT_EQ(aura::Window::OcclusionState::VISIBLE, bottom_window->occlusion_state());
diff --git a/base/syslog_logging.cc b/base/syslog_logging.cc index 2c44cd5..53bc1aa 100644 --- a/base/syslog_logging.cc +++ b/base/syslog_logging.cc
@@ -41,11 +41,6 @@ g_event_id = event_id; } -void ResetEventSourceForTesting() { - delete g_event_source_name; - g_event_source_name = nullptr; -} - #endif // defined(OS_WIN) EventLogMessage::EventLogMessage(const char* file,
diff --git a/base/syslog_logging.h b/base/syslog_logging.h index b67aeff..736a5b2e 100644 --- a/base/syslog_logging.h +++ b/base/syslog_logging.h
@@ -27,10 +27,6 @@ void BASE_EXPORT SetEventSource(const std::string& name, uint16_t category, uint32_t event_id); - -// The event source may get set more than once in tests. This function allows -// a test to reset the source when needed. -void BASE_EXPORT ResetEventSourceForTesting(); #endif // defined(OS_WIN) // Creates a formatted message on the system event log. That would be the
diff --git a/base/win/windows_types.h b/base/win/windows_types.h index 13067d5..9fb5e30 100644 --- a/base/win/windows_types.h +++ b/base/win/windows_types.h
@@ -74,20 +74,16 @@ #define CHROME_DECLARE_HANDLE(name) \ struct name##__; \ typedef struct name##__* name -CHROME_DECLARE_HANDLE(HDESK); CHROME_DECLARE_HANDLE(HGLRC); CHROME_DECLARE_HANDLE(HICON); CHROME_DECLARE_HANDLE(HINSTANCE); CHROME_DECLARE_HANDLE(HKEY); CHROME_DECLARE_HANDLE(HKL); CHROME_DECLARE_HANDLE(HMENU); -CHROME_DECLARE_HANDLE(HWINSTA); CHROME_DECLARE_HANDLE(HWND); +typedef HINSTANCE HMODULE; #undef CHROME_DECLARE_HANDLE -typedef LPVOID HINTERNET; -typedef HINSTANCE HMODULE; -typedef PVOID LSA_HANDLE; // Forward declare some Windows struct/typedef sets. @@ -109,8 +105,6 @@ typedef struct tagNMHDR NMHDR; -typedef PVOID PSID; - // Declare Chrome versions of some Windows structures. These are needed for // when we need a concrete type but don't want to pull in Windows.h. We can't // declare the Windows types so we declare our types and cast to the Windows
diff --git a/base/win/windows_version.cc b/base/win/windows_version.cc index bb41a07..6fc31850 100644 --- a/base/win/windows_version.cc +++ b/base/win/windows_version.cc
@@ -11,7 +11,6 @@ #include "base/file_version_info_win.h" #include "base/files/file_path.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/strings/utf_string_conversions.h" #include "base/win/registry.h" @@ -75,6 +74,28 @@ return VERSION_PRE_XP; } +// Retrieve a version from kernel32. This is useful because when running in +// compatibility mode for a down-level version of the OS, the file version of +// kernel32 will still be the "real" version. +Version GetVersionFromKernel32() { + std::unique_ptr<FileVersionInfoWin> file_version_info( + static_cast<FileVersionInfoWin*>( + FileVersionInfoWin::CreateFileVersionInfo( + base::FilePath(FILE_PATH_LITERAL("kernel32.dll"))))); + if (file_version_info) { + const int major = + HIWORD(file_version_info->fixed_file_info()->dwFileVersionMS); + const int minor = + LOWORD(file_version_info->fixed_file_info()->dwFileVersionMS); + const int build = + HIWORD(file_version_info->fixed_file_info()->dwFileVersionLS); + return MajorMinorBuildToVersion(major, minor, build); + } + + NOTREACHED(); + return VERSION_WIN_LAST; +} + // Returns the the "UBR" value from the registry. Introduced in Windows 10, // this undocumented value appears to be similar to a patch number. // Returns 0 if the value does not exist or it could not be read. @@ -134,6 +155,8 @@ const _SYSTEM_INFO& system_info, int os_type) : version_(VERSION_PRE_XP), + kernel32_version_(VERSION_PRE_XP), + got_kernel32_version_(false), architecture_(OTHER_ARCHITECTURE), wow64_status_(GetWOW64StatusForProcess(GetCurrentProcess())) { version_number_.major = version_info.dwMajorVersion; @@ -224,34 +247,11 @@ } Version OSInfo::Kernel32Version() const { - static const Version kernel32_version = - MajorMinorBuildToVersion(Kernel32BaseVersion().components()[0], - Kernel32BaseVersion().components()[1], - Kernel32BaseVersion().components()[2]); - return kernel32_version; -} - -// Retrieve a version from kernel32. This is useful because when running in -// compatibility mode for a down-level version of the OS, the file version of -// kernel32 will still be the "real" version. -base::Version OSInfo::Kernel32BaseVersion() const { - static const base::NoDestructor<base::Version> version([] { - std::unique_ptr<FileVersionInfoWin> file_version_info( - static_cast<FileVersionInfoWin*>( - FileVersionInfoWin::CreateFileVersionInfo( - base::FilePath(FILE_PATH_LITERAL("kernel32.dll"))))); - DCHECK(file_version_info); - const int major = - HIWORD(file_version_info->fixed_file_info()->dwFileVersionMS); - const int minor = - LOWORD(file_version_info->fixed_file_info()->dwFileVersionMS); - const int build = - HIWORD(file_version_info->fixed_file_info()->dwFileVersionLS); - const int patch = - LOWORD(file_version_info->fixed_file_info()->dwFileVersionLS); - return base::Version(std::vector<uint32_t>{major, minor, build, patch}); - }()); - return *version; + if (!got_kernel32_version_) { + kernel32_version_ = GetVersionFromKernel32(); + got_kernel32_version_ = true; + } + return kernel32_version_; } std::string OSInfo::processor_model_name() {
diff --git a/base/win/windows_version.h b/base/win/windows_version.h index 64f8041..22b9d00 100644 --- a/base/win/windows_version.h +++ b/base/win/windows_version.h
@@ -11,7 +11,6 @@ #include "base/base_export.h" #include "base/macros.h" -#include "base/version.h" typedef void* HANDLE; struct _OSVERSIONINFOEXW; @@ -109,7 +108,6 @@ Version version() const { return version_; } Version Kernel32Version() const; - base::Version Kernel32BaseVersion() const; // The next two functions return arrays of values, [major, minor(, build)]. VersionNumber version_number() const { return version_number_; } VersionType version_type() const { return version_type_; } @@ -135,6 +133,8 @@ ~OSInfo(); Version version_; + mutable Version kernel32_version_; + mutable bool got_kernel32_version_; VersionNumber version_number_; VersionType version_type_; ServicePack service_pack_;
diff --git a/build/check_gn_headers_whitelist.txt b/build/check_gn_headers_whitelist.txt index 38e6257..232ebfab 100644 --- a/build/check_gn_headers_whitelist.txt +++ b/build/check_gn_headers_whitelist.txt
@@ -123,10 +123,10 @@ components/wifi/wifi_service.h content/browser/background_fetch/background_fetch_constants.h content/browser/service_worker/service_worker_response_type.h -content/common/gpu_stream_constants.h content/common/mac/attributed_string_coder.h content/public/browser/context_factory.h content/public/browser/media_observer.h +content/public/common/gpu_stream_constants.h content/renderer/external_popup_menu.h content/shell/android/shell_descriptors.h device/media_transfer_protocol/media_transfer_protocol_manager.h
diff --git a/cc/animation/animation.cc b/cc/animation/animation.cc index 8da0380..644de377 100644 --- a/cc/animation/animation.cc +++ b/cc/animation/animation.cc
@@ -48,7 +48,7 @@ } bool Animation::IsElementAttached(ElementId id) const { - return !!element_to_keyframe_effect_id_map_.count(id); + return base::ContainsKey(element_to_keyframe_effect_id_map_, id); } void Animation::SetAnimationHost(AnimationHost* animation_host) {
diff --git a/cc/animation/element_animations.cc b/cc/animation/element_animations.cc index cea0c14..2af7060 100644 --- a/cc/animation/element_animations.cc +++ b/cc/animation/element_animations.cc
@@ -76,14 +76,17 @@ disabled_state_mask.currently_running = disable_properties; disabled_state_mask.potentially_animating = disable_properties; - if (has_element_in_active_list()) { + // This method may get called from AnimationHost dtor so it is possible for + // mutator_host_client() to be null. + if (has_element_in_active_list() && animation_host()->mutator_host_client()) { animation_host()->mutator_host_client()->ElementIsAnimatingChanged( element_id(), ElementListType::ACTIVE, disabled_state_mask, disabled_state); } set_has_element_in_active_list(false); - if (has_element_in_pending_list()) { + if (has_element_in_pending_list() && + animation_host()->mutator_host_client()) { animation_host()->mutator_host_client()->ElementIsAnimatingChanged( element_id(), ElementListType::PENDING, disabled_state_mask, disabled_state);
diff --git a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedNewTabPageMediator.java b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedNewTabPageMediator.java index bf2272b..ec22014 100644 --- a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedNewTabPageMediator.java +++ b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedNewTabPageMediator.java
@@ -178,6 +178,7 @@ if (mSignInPromo != null) { mSignInPromo.setCanShowPersonalizedSuggestions(suggestionsVisible); } + mStreamContentChanged = true; } /** @@ -263,9 +264,10 @@ @Override public boolean isChildVisibleAtPosition(int position) { + if (!isScrollViewInitialized()) return false; + if (mFeedEnabled) { - return isScrollViewInitialized() - && mCoordinator.getStream().isChildAtPositionVisible(position); + return mCoordinator.getStream().isChildAtPositionVisible(position); } else { ScrollView scrollView = mCoordinator.getScrollViewForPolicy(); Rect rect = new Rect();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java index aa249f3..a90be424 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
@@ -2092,8 +2092,29 @@ mNavigationPopup = new NavigationPopup(tab.getProfile(), this, tab.getWebContents().getNavigationController(), NavigationPopup.Type.ANDROID_SYSTEM_BACK); - mNavigationPopup.setOnDismissCallback(() -> mNavigationPopup = null); - mNavigationPopup.show(findViewById(R.id.navigation_popup_anchor_stub)); + mNavigationPopup.setWidth( + getResources().getDimensionPixelSize(R.dimen.navigation_popup_width)); + mNavigationPopup.setAnchorView(findViewById(R.id.navigation_popup_anchor_stub)); + mNavigationPopup.setOnDismissListener(() -> mNavigationPopup = null); + + positionAndShowNavigationPopup(); + } + + @Override + public void onOrientationChange(int orientation) { + super.onOrientationChange(orientation); + positionAndShowNavigationPopup(); + } + + private void positionAndShowNavigationPopup() { + if (mNavigationPopup == null) return; + + // Center popup window. + ViewGroup coordinator = findViewById(R.id.coordinator); + int horizontalOffset = coordinator.getWidth() / 2 - mNavigationPopup.getWidth() / 2; + if (horizontalOffset > 0) mNavigationPopup.setHorizontalOffset(horizontalOffset); + + mNavigationPopup.show(); } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/NavigationPopup.java b/chrome/android/java/src/org/chromium/chrome/browser/NavigationPopup.java index d0b0c36e..e687f920 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/NavigationPopup.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/NavigationPopup.java
@@ -5,16 +5,12 @@ package org.chromium.chrome.browser; import android.content.Context; -import android.content.res.Resources; import android.graphics.Bitmap; import android.support.annotation.IntDef; -import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnAttachStateChangeListener; -import android.view.View.OnLayoutChangeListener; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; @@ -45,7 +41,8 @@ /** * A popup that handles displaying the navigation history for a given tab. */ -public class NavigationPopup implements AdapterView.OnItemClickListener { +public class NavigationPopup extends ListPopupWindow implements AdapterView.OnItemClickListener { + private static final int MAXIMUM_HISTORY_ITEMS = 8; private static final int FULL_HISTORY_ENTRY_INDEX = -1; @@ -60,14 +57,12 @@ private final Profile mProfile; private final Context mContext; - private final ListPopupWindow mPopup; private final NavigationController mNavigationController; private NavigationHistory mHistory; private final NavigationAdapter mAdapter; private final @Type int mType; + private final int mFaviconSize; - @Nullable - private final OnLayoutChangeListener mAnchorViewLayoutChangeListener; private DefaultFaviconHelper mDefaultFaviconHelper; @@ -75,7 +70,6 @@ * Loads the favicons asynchronously. */ private FaviconHelper mFaviconHelper; - private Runnable mOnDismissCallback; private boolean mInitialized; @@ -89,9 +83,9 @@ */ public NavigationPopup(Profile profile, Context context, NavigationController navigationController, @Type int type) { + super(context, null, android.R.attr.popupMenuStyle); mProfile = profile; mContext = context; - Resources resources = mContext.getResources(); mNavigationController = navigationController; mType = type; @@ -101,105 +95,51 @@ mHistory = mNavigationController.getDirectedNavigationHistory( isForward, MAXIMUM_HISTORY_ITEMS); mHistory.addEntry(new NavigationEntry(FULL_HISTORY_ENTRY_INDEX, UrlConstants.HISTORY_URL, - null, null, null, resources.getString(R.string.show_full_history), null, 0)); + null, null, null, mContext.getResources().getString(R.string.show_full_history), + null, 0)); + + setBackgroundDrawable(ApiCompatibilityUtils.getDrawable(mContext.getResources(), + anchorToBottom ? R.drawable.popup_bg_bottom : R.drawable.popup_bg)); + // By default ListPopupWindow uses the top & bottom padding of the background to determine + // the vertical offset applied to the window. This causes the popup to be shifted up + // by the top padding, and thus we forcibly need to specify a vertical offset of 0 to + // prevent that. + if (anchorToBottom) setVerticalOffset(0); mAdapter = new NavigationAdapter(); + if (anchorToBottom) mAdapter.reverseOrder(); - mPopup = new ListPopupWindow(context); - mPopup.setOnDismissListener(this::onDismiss); - mPopup.setBackgroundDrawable(ApiCompatibilityUtils.getDrawable( - resources, anchorToBottom ? R.drawable.popup_bg_bottom : R.drawable.popup_bg)); - mPopup.setModal(true); - mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED); - mPopup.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); - mPopup.setOnItemClickListener(this); - mPopup.setAdapter(mAdapter); - mPopup.setWidth(resources.getDimensionPixelSize( - anchorToBottom ? R.dimen.navigation_popup_width : R.dimen.menu_width)); + setModal(true); + setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED); + setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); + setOnItemClickListener(this); + setAdapter(mAdapter); - if (anchorToBottom) { - // By default ListPopupWindow uses the top & bottom padding of the background to - // determine the vertical offset applied to the window. This causes the popup to be - // shifted up by the top padding, and thus we forcibly need to specify a vertical offset - // of 0 to prevent that. - mPopup.setVerticalOffset(0); - mAnchorViewLayoutChangeListener = new OnLayoutChangeListener() { - @Override - public void onLayoutChange(View v, int left, int top, int right, int bottom, - int oldLeft, int oldTop, int oldRight, int oldBottom) { - centerPopupOverAnchorViewAndShow(); - } - }; - mAdapter.reverseOrder(); - } else { - mAnchorViewLayoutChangeListener = null; - } - - mFaviconSize = resources.getDimensionPixelSize(R.dimen.default_favicon_size); - } - - @VisibleForTesting - ListPopupWindow getPopupForTesting() { - return mPopup; + mFaviconSize = mContext.getResources().getDimensionPixelSize(R.dimen.default_favicon_size); } private String buildComputedAction(String action) { return (mType == Type.TABLET_FORWARD ? "ForwardMenu_" : "BackMenu_") + action; } - /** - * Shows the popup attached to the specified anchor view. - */ - public void show(View anchorView) { + @Override + public void show() { if (!mInitialized) initialize(); - if (!mPopup.isShowing()) RecordUserAction.record(buildComputedAction("Popup")); - if (mPopup.getAnchorView() != null && mAnchorViewLayoutChangeListener != null) { - mPopup.getAnchorView().removeOnLayoutChangeListener(mAnchorViewLayoutChangeListener); - } - mPopup.setAnchorView(anchorView); - if (mType == Type.ANDROID_SYSTEM_BACK) { - anchorView.addOnLayoutChangeListener(mAnchorViewLayoutChangeListener); - centerPopupOverAnchorViewAndShow(); - } else { - mPopup.show(); - } + if (!isShowing()) RecordUserAction.record(buildComputedAction("Popup")); + super.show(); if (mAdapter.mInReverseOrder) scrollToBottom(); } - /** - * Dismisses the popup. - */ + @Override public void dismiss() { - mPopup.dismiss(); - } - - /** - * Sets the callback to be notified when the popup has been dismissed. - * @param onDismiss The callback to be notified. - */ - public void setOnDismissCallback(Runnable onDismiss) { - mOnDismissCallback = onDismiss; - } - - private void centerPopupOverAnchorViewAndShow() { - assert mInitialized; - int horizontalOffset = (mPopup.getAnchorView().getWidth() - mPopup.getWidth()) / 2; - if (horizontalOffset > 0) mPopup.setHorizontalOffset(horizontalOffset); - mPopup.show(); - } - - private void onDismiss() { if (mInitialized) mFaviconHelper.destroy(); mInitialized = false; if (mDefaultFaviconHelper != null) mDefaultFaviconHelper.clearCache(); - if (mAnchorViewLayoutChangeListener != null) { - mPopup.getAnchorView().removeOnLayoutChangeListener(mAnchorViewLayoutChangeListener); - } - if (mOnDismissCallback != null) mOnDismissCallback.run(); + super.dismiss(); } private void scrollToBottom() { - mPopup.getListView().addOnAttachStateChangeListener(new OnAttachStateChangeListener() { + getListView().addOnAttachStateChangeListener(new OnAttachStateChangeListener() { @Override public void onViewDetachedFromWindow(View v) { if (v != null) v.removeOnAttachStateChangeListener(this); @@ -266,7 +206,7 @@ mNavigationController.goToNavigationIndex(entry.getIndex()); } - mPopup.dismiss(); + dismiss(); } private class NavigationAdapter extends BaseAdapter {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java index 40d1ee98..1daace8 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java
@@ -7,8 +7,11 @@ import android.content.Context; import android.content.pm.ResolveInfo; import android.content.res.Resources; +import android.graphics.drawable.Drawable; import android.os.SystemClock; import android.support.annotation.Nullable; +import android.support.v4.graphics.drawable.DrawableCompat; +import android.support.v7.content.res.AppCompatResources; import android.text.TextUtils; import android.view.Menu; import android.view.MenuItem; @@ -130,7 +133,11 @@ forwardMenuItem.setEnabled(currentTab.canGoForward()); mReloadMenuItem = menu.findItem(R.id.reload_menu_id); - mReloadMenuItem.setIcon(R.drawable.btn_reload_stop); + Drawable icon = + AppCompatResources.getDrawable(mActivity, R.drawable.btn_reload_stop); + DrawableCompat.setTintList(icon, + AppCompatResources.getColorStateList(mActivity, R.color.dark_mode_tint)); + mReloadMenuItem.setIcon(icon); loadingStateChanged(currentTab.isLoading()); MenuItem bookmarkMenuItem = menu.findItem(R.id.bookmark_this_page_id);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabAppMenuPropertiesDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabAppMenuPropertiesDelegate.java index f9167dd..0f35a05 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabAppMenuPropertiesDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabAppMenuPropertiesDelegate.java
@@ -4,6 +4,9 @@ package org.chromium.chrome.browser.customtabs; +import android.graphics.drawable.Drawable; +import android.support.v4.graphics.drawable.DrawableCompat; +import android.support.v7.content.res.AppCompatResources; import android.text.TextUtils; import android.view.Menu; import android.view.MenuItem; @@ -65,7 +68,10 @@ forwardMenuItem.setEnabled(currentTab.canGoForward()); mReloadMenuItem = menu.findItem(R.id.reload_menu_id); - mReloadMenuItem.setIcon(R.drawable.btn_reload_stop); + Drawable icon = AppCompatResources.getDrawable(mActivity, R.drawable.btn_reload_stop); + DrawableCompat.setTintList( + icon, AppCompatResources.getColorStateList(mActivity, R.color.dark_mode_tint)); + mReloadMenuItem.setIcon(icon); loadingStateChanged(currentTab.isLoading()); MenuItem shareItem = menu.findItem(R.id.share_row_menu_id);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java index 7116c58..a25f9f8 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
@@ -1174,11 +1174,14 @@ info, notificationId, systemDownloadId, canResolve, false); } - Profile profile = info.isOffTheRecord() - ? Profile.getLastUsedProfile().getOffTheRecordProfile() - : Profile.getLastUsedProfile().getOriginalProfile(); - Tracker tracker = TrackerFactory.getTrackerForProfile(profile); - tracker.notifyEvent(EventConstants.DOWNLOAD_COMPLETED); + if (BrowserStartupController.get(LibraryProcessType.PROCESS_BROWSER) + .isStartupSuccessfullyCompleted()) { + Profile profile = info.isOffTheRecord() + ? Profile.getLastUsedProfile().getOffTheRecordProfile() + : Profile.getLastUsedProfile().getOriginalProfile(); + Tracker tracker = TrackerFactory.getTrackerForProfile(profile); + tracker.notifyEvent(EventConstants.DOWNLOAD_COMPLETED); + } } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/feedback/FeedbackCollector.java b/chrome/android/java/src/org/chromium/chrome/browser/feedback/FeedbackCollector.java index 6739a3a..895cca5 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/feedback/FeedbackCollector.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/feedback/FeedbackCollector.java
@@ -87,6 +87,7 @@ sources.add(new SimplifiedNtpFeedbackSource()); sources.add(new FeedbackContextFeedbackSource(feedbackContext)); sources.add(new DuetFeedbackSource()); + sources.add(new InterestFeedFeedbackSource()); // Sanity check in case a source is added to the wrong list. for (FeedbackSource source : sources) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/feedback/InterestFeedFeedbackSource.java b/chrome/android/java/src/org/chromium/chrome/browser/feedback/InterestFeedFeedbackSource.java new file mode 100644 index 0000000..262a81988 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/feedback/InterestFeedFeedbackSource.java
@@ -0,0 +1,34 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.feedback; + +import org.chromium.chrome.browser.ChromeFeatureList; + +import java.util.HashMap; +import java.util.Map; + +/** + * Provides information about whether the interest feed is enabled for use in feedback reports. + */ +public class InterestFeedFeedbackSource implements FeedbackSource { + private static final String KEY = "Interest Feed"; + private static final String ENABLED_VALUE = "Enabled"; + private static final String DISABLED_VALUE = "Disabled"; + + private final HashMap<String, String> mMap; + + InterestFeedFeedbackSource() { + mMap = new HashMap<>(1); + mMap.put(KEY, + ChromeFeatureList.isEnabled(ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS) + ? ENABLED_VALUE + : DISABLED_VALUE); + } + + @Override + public Map<String, String> getFeedback() { + return mMap; + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/PreviewsLitePageInfoBar.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/PreviewsLitePageInfoBar.java new file mode 100644 index 0000000..286a59b --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/PreviewsLitePageInfoBar.java
@@ -0,0 +1,39 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.infobar; + +import android.content.Intent; + +import org.chromium.base.annotations.CalledByNative; +import org.chromium.chrome.browser.ResourceId; +import org.chromium.chrome.browser.preferences.PreferencesLauncher; +import org.chromium.chrome.browser.preferences.datareduction.DataReductionPreferences; + +/** + * An InfoBar that lets the user know that Data Saver Lite Mode now also applies to HTTPS pages. + */ +public class PreviewsLitePageInfoBar extends ConfirmInfoBar { + public static final String FROM_INFOBAR = "FromInfoBar"; + + @CalledByNative + private static InfoBar show(int enumeratedIconId, String message, String linkText) { + return new PreviewsLitePageInfoBar( + ResourceId.mapToDrawableId(enumeratedIconId), message, linkText); + } + + private PreviewsLitePageInfoBar(int iconDrawbleId, String message, String linkText) { + super(iconDrawbleId, null, message, linkText, null, null); + } + + @Override + public void onLinkClicked() { + super.onLinkClicked(); + + final Intent intent = PreferencesLauncher.createIntentForSettingsPage( + getContext(), DataReductionPreferences.class.getName()); + intent.putExtra(FROM_INFOBAR, true); + getContext().startActivity(intent); + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java index f057bb3..1237810 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
@@ -401,9 +401,9 @@ // During startup the view may not be fully initialized. if (!mScrollDelegate.isScrollViewInitialized()) return 0f; - if (!mScrollDelegate.isChildVisibleAtPosition(0)) { + if (isSearchBoxOffscreen()) { // getVerticalScrollOffset is valid only for the scroll view if the first item is - // visible. If the first item is not visible, we must have scrolled quite far and we + // visible. If the search box view is offscreen, we must have scrolled quite far and we // know the toolbar transition should be 100%. This might be the initial scroll position // due to the scroll restore feature, so the search box will not have been laid out yet. return 1f; @@ -694,28 +694,40 @@ translation.set(0, 0); - View view = mSearchBoxView; - while (true) { - view = (View) view.getParent(); - if (view == null) { - // The |mSearchBoxView| is not a child of this view. This can happen if the - // RecyclerView detaches the NewTabPageLayout after it has been scrolled out of - // view. Set the translation to the minimum Y value as an approximation. - translation.y = Integer.MIN_VALUE; - break; + if (isSearchBoxOffscreen()) { + translation.y = Integer.MIN_VALUE; + } else { + View view = mSearchBoxView; + while (true) { + view = (View) view.getParent(); + if (view == null) { + // The |mSearchBoxView| is not a child of this view. This can happen if the + // RecyclerView detaches the NewTabPageLayout after it has been scrolled out of + // view. Set the translation to the minimum Y value as an approximation. + translation.y = Integer.MIN_VALUE; + break; + } + translation.offset(-view.getScrollX(), -view.getScrollY()); + if (view == parentView) break; + translation.offset((int) view.getX(), (int) view.getY()); } - translation.offset(-view.getScrollX(), -view.getScrollY()); - if (view == parentView) break; - translation.offset((int) view.getX(), (int) view.getY()); } - bounds.offset(translation.x, translation.y); + bounds.offset(translation.x, translation.y); if (translation.y != Integer.MIN_VALUE) { bounds.inset(0, mSearchBoxBoundsVerticalInset); } } /** + * @return Whether the search box view is scrolled off the screen. + */ + private boolean isSearchBoxOffscreen() { + return !mScrollDelegate.isChildVisibleAtPosition(0) + || mScrollDelegate.getVerticalScrollOffset() > mSearchBoxView.getTop(); + } + + /** * Sets the listener for search box scroll changes. * @param listener The listener to be notified on changes. */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionPreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionPreferences.java index f32b9e0..674a9ea 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionPreferences.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionPreferences.java
@@ -17,6 +17,7 @@ import org.chromium.base.CommandLine; import org.chromium.chrome.R; import org.chromium.chrome.browser.help.HelpAndFeedback; +import org.chromium.chrome.browser.infobar.PreviewsLitePageInfoBar; import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; import org.chromium.chrome.browser.preferences.ChromeSwitchPreference; import org.chromium.chrome.browser.preferences.PreferenceUtils; @@ -40,6 +41,7 @@ /** Whether the current Activity is started from the snackbar promo. */ private boolean mFromPromo; private boolean mFromMainMenu; + private boolean mFromInfobar; @Override public void onCreate(Bundle savedInstanceState) { @@ -60,6 +62,8 @@ DataReductionPromoSnackbarController.FROM_PROMO, false); mFromMainMenu = IntentUtils.safeGetBooleanExtra( getActivity().getIntent(), FROM_MAIN_MENU, false); + mFromInfobar = IntentUtils.safeGetBooleanExtra( + getActivity().getIntent(), PreviewsLitePageInfoBar.FROM_INFOBAR, false); } } @@ -85,6 +89,14 @@ statusChange = mIsEnabled ? DataReductionProxyUma.ACTION_MAIN_MENU_OFF_TO_ON : DataReductionProxyUma.ACTION_MAIN_MENU_OFF_TO_OFF; } + } else if (mFromInfobar) { + if (mWasEnabledAtCreation) { + statusChange = mIsEnabled ? DataReductionProxyUma.ACTION_INFOBAR_ON_TO_ON + : DataReductionProxyUma.ACTION_INFOBAR_ON_TO_OFF; + } else { + statusChange = mIsEnabled ? DataReductionProxyUma.ACTION_INFOBAR_OFF_TO_ON + : DataReductionProxyUma.ACTION_INFOBAR_OFF_TO_OFF; + } } else if (mWasEnabledAtCreation) { statusChange = mIsEnabled ? DataReductionProxyUma.ACTION_ON_TO_ON
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionProxyUma.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionProxyUma.java index 591515d1..0427ecb 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionProxyUma.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionProxyUma.java
@@ -56,7 +56,11 @@ public static final int ACTION_SITE_BREAKDOWN_SORTED_BY_DATA_USED = 25; public static final int ACTION_SITE_BREAKDOWN_EXPANDED = 26; public static final int ACTION_SITE_BREAKDOWN_SORTED_BY_HOSTNAME = 27; - public static final int ACTION_INDEX_BOUNDARY = 28; + public static final int ACTION_INFOBAR_OFF_TO_OFF = 28; + public static final int ACTION_INFOBAR_OFF_TO_ON = 29; + public static final int ACTION_INFOBAR_ON_TO_OFF = 30; + public static final int ACTION_INFOBAR_ON_TO_ON = 31; + public static final int ACTION_INDEX_BOUNDARY = 32; // Represent the possible Lo-Fi context menu user actions. This must remain in sync with // Previews.ContextMenuAction.LoFi in tools/metrics/histograms/histograms.xml.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarTablet.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarTablet.java index cd29713..4626f83 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarTablet.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarTablet.java
@@ -301,7 +301,13 @@ mNavigationPopup = new NavigationPopup(tab.getProfile(), getContext(), tab.getWebContents().getNavigationController(), isForward ? NavigationPopup.Type.TABLET_FORWARD : NavigationPopup.Type.TABLET_BACK); - mNavigationPopup.show(anchorView); + + mNavigationPopup.setAnchorView(anchorView); + + int menuWidth = getResources().getDimensionPixelSize(R.dimen.menu_width); + mNavigationPopup.setWidth(menuWidth); + + mNavigationPopup.show(); } @Override
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni index baa832d..5eff3f3 100644 --- a/chrome/android/java_sources.gni +++ b/chrome/android/java_sources.gni
@@ -612,6 +612,7 @@ "java/src/org/chromium/chrome/browser/feedback/FeedbackSourceProvider.java", "java/src/org/chromium/chrome/browser/feedback/HistogramFeedbackSource.java", "java/src/org/chromium/chrome/browser/feedback/IMEFeedbackSource.java", + "java/src/org/chromium/chrome/browser/feedback/InterestFeedFeedbackSource.java", "java/src/org/chromium/chrome/browser/feedback/LowEndDeviceFeedbackSource.java", "java/src/org/chromium/chrome/browser/feedback/PermissionFeedbackSource.java", "java/src/org/chromium/chrome/browser/feedback/ProcessIdFeedbackSource.java", @@ -723,6 +724,7 @@ "java/src/org/chromium/chrome/browser/infobar/PermissionInfoBar.java", "java/src/org/chromium/chrome/browser/infobar/PermissionUpdateInfoBarDelegate.java", "java/src/org/chromium/chrome/browser/infobar/PreviewsInfoBar.java", + "java/src/org/chromium/chrome/browser/infobar/PreviewsLitePageInfoBar.java", "java/src/org/chromium/chrome/browser/infobar/ReaderModeInfoBar.java", "java/src/org/chromium/chrome/browser/infobar/SavePasswordInfoBar.java", "java/src/org/chromium/chrome/browser/infobar/SearchGeolocationDisclosureInfoBar.java",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java index 1f0f4b8..3ff4313 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java
@@ -9,7 +9,6 @@ import android.support.test.filters.SmallTest; import android.view.KeyEvent; import android.view.View; -import android.widget.ListPopupWindow; import android.widget.ListView; import android.widget.TextView; @@ -242,7 +241,7 @@ @Feature({"Navigation"}) public void testFaviconFetching() throws ExecutionException { final TestNavigationController controller = new TestNavigationController(); - final ListPopupWindow popup = showPopup(controller); + final NavigationPopup popup = showPopup(controller); CriteriaHelper.pollUiThread(new Criteria("All favicons did not get updated.") { @Override @@ -265,7 +264,7 @@ @Feature({"Navigation"}) public void testItemSelection() throws ExecutionException { final TestNavigationController controller = new TestNavigationController(); - final ListPopupWindow popup = showPopup(controller); + final NavigationPopup popup = showPopup(controller); ThreadUtils.runOnUiThreadBlocking((Runnable) () -> popup.performItemClick(1)); @@ -279,7 +278,7 @@ @Feature({"Navigation"}) public void testShowAllHistory() throws ExecutionException { final TestNavigationController controller = new TestNavigationController(); - final ListPopupWindow popup = showPopup(controller); + final NavigationPopup popup = showPopup(controller); ThreadUtils.runOnUiThreadBlocking(() -> { ListView list = popup.getListView(); @@ -332,12 +331,16 @@ () -> mActivityTestRule.getActivity().getNavigationPopupForTesting())); } - private ListPopupWindow showPopup(NavigationController controller) throws ExecutionException { + private NavigationPopup showPopup(NavigationController controller) throws ExecutionException { return ThreadUtils.runOnUiThreadBlocking(() -> { NavigationPopup popup = new NavigationPopup(mProfile, mActivityTestRule.getActivity(), controller, NavigationPopup.Type.TABLET_FORWARD); - popup.show(mActivityTestRule.getActivity().getActivityTab().getContentView()); - return popup.getPopupForTesting(); + popup.setWidth(300); + popup.setHeight(300); + popup.setAnchorView(mActivityTestRule.getActivity().getActivityTab().getContentView()); + + popup.show(); + return popup; }); }
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 5119aa2d..d3f3a85 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -4432,6 +4432,9 @@ <message name="IDS_LITE_PAGE_PREVIEWS_MESSAGE" desc="The text of the infobar notifying the user that Chrome's Lite mode will now also apply to HTTPS pages."> Lite Mode now makes browsing faster on all pages, including HTTPS. </message> + <message name="IDS_LITE_PAGE_PREVIEWS_SETTINGS_LINK" desc="This link opens the Data Saver settings to explain and configure Lite mode settings."> + Settings + </message> <!-- WebRTC logs --> <message name="IDS_WEBRTC_LOGS_TITLE" desc="Title for the chrome://webrtc-logs page.">
diff --git a/chrome/app/printing_strings.grdp b/chrome/app/printing_strings.grdp index d24cda60..0df75455 100644 --- a/chrome/app/printing_strings.grdp +++ b/chrome/app/printing_strings.grdp
@@ -282,6 +282,9 @@ <message name="IDS_PRINT_PREVIEW_SHOW_ADVANCED_OPTIONS" desc="The text for the button to open the printer's advanced settings dialog."> Change printer options... </message> + <message name="IDS_PRINT_PREVIEW_NEW_SHOW_ADVANCED_OPTIONS" desc="The text for the button to open the printer's advanced settings dialog in the new UI."> + Advanced printer options + </message> <message name="IDS_PRINT_PREVIEW_ACCEPT_INVITE" desc="Text for the button to accept the printer-sharing invitation."> Accept </message>
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 08c23c6..4eb6d7d 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -4663,6 +4663,7 @@ "../android/java/src/org/chromium/chrome/browser/infobar/PermissionInfoBar.java", "../android/java/src/org/chromium/chrome/browser/infobar/PermissionUpdateInfoBarDelegate.java", "../android/java/src/org/chromium/chrome/browser/infobar/PreviewsInfoBar.java", + "../android/java/src/org/chromium/chrome/browser/infobar/PreviewsLitePageInfoBar.java", "../android/java/src/org/chromium/chrome/browser/infobar/ReaderModeInfoBar.java", "../android/java/src/org/chromium/chrome/browser/infobar/SavePasswordInfoBar.java", "../android/java/src/org/chromium/chrome/browser/infobar/SearchGeolocationDisclosureInfoBar.java",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 1c1d632..7bd59e3 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -2389,9 +2389,6 @@ SINGLE_VALUE_TYPE(switches::kTrySupportedChannelLayouts)}, #endif // OS_WIN #if defined(OS_MACOSX) - {"mac-v2-sandbox", flag_descriptions::kMacV2SandboxName, - flag_descriptions::kMacV2SandboxDescription, kOsMac, - FEATURE_VALUE_TYPE(features::kMacV2Sandbox)}, {"mac-views-task-manager", flag_descriptions::kMacViewsTaskManagerName, flag_descriptions::kMacViewsTaskManagerDescription, kOsMac, FEATURE_VALUE_TYPE(features::kViewsTaskManager)},
diff --git a/chrome/browser/android/metrics/ukm_utils_for_test.cc b/chrome/browser/android/metrics/ukm_utils_for_test.cc index 5a8c137..5c80488 100644 --- a/chrome/browser/android/metrics/ukm_utils_for_test.cc +++ b/chrome/browser/android/metrics/ukm_utils_for_test.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/android/jni_string.h" +#include "base/stl_util.h" #include "chrome/browser/browser_process.h" #include "components/metrics_services_manager/metrics_services_manager.h" #include "components/ukm/ukm_service.h" @@ -26,7 +27,7 @@ auto* service = g_browser_process->GetMetricsServicesManager()->GetUkmService(); DCHECK(service); - return !!service->sources().count(source_id); + return base::ContainsKey(service->sources(), source_id); } // static
diff --git a/chrome/browser/autofill/captured_sites_test_utils.cc b/chrome/browser/autofill/captured_sites_test_utils.cc index 331a74f..0e11f7d 100644 --- a/chrome/browser/autofill/captured_sites_test_utils.cc +++ b/chrome/browser/autofill/captured_sites_test_utils.cc
@@ -197,6 +197,38 @@ } } +void IFrameWaiter::DidFinishLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url) { + if (!run_loop_.running()) + return; + switch (query_type_) { + case ORIGIN: + if (validated_url.GetOrigin() == origin_) + run_loop_.Quit(); + break; + case URL: + if (FrameHasSourceUrl(validated_url, render_frame_host)) + run_loop_.Quit(); + break; + default: + break; + } +} + +void IFrameWaiter::FrameNameChanged(content::RenderFrameHost* render_frame_host, + const std::string& name) { + if (!run_loop_.running()) + return; + switch (query_type_) { + case NAME: + if (FrameMatchesName(name, render_frame_host)) + run_loop_.Quit(); + break; + default: + break; + } +} + bool IFrameWaiter::FrameHasOrigin(const GURL& origin, content::RenderFrameHost* frame) { GURL url = frame->GetLastCommittedURL(); @@ -229,7 +261,7 @@ "MAP *:443 127.0.0.1:%d," // Uncomment to use the live autofill prediction server. - //"EXCLUDE clients1.google.com," + // "EXCLUDE clients1.google.com," "EXCLUDE localhost", kHostHttpPort, kHostHttpsPort)); }
diff --git a/chrome/browser/autofill/captured_sites_test_utils.h b/chrome/browser/autofill/captured_sites_test_utils.h index 61208ff..6095c178 100644 --- a/chrome/browser/autofill/captured_sites_test_utils.h +++ b/chrome/browser/autofill/captured_sites_test_utils.h
@@ -9,11 +9,14 @@ #include "base/files/file_path.h" #include "chrome/browser/ui/browser.h" #include "content/public/browser/browser_context.h" -#include "content/public/browser/render_frame_host.h" -#include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" #include "services/network/public/cpp/network_switches.h" +namespace content { +class RenderFrameHost; +class WebContents; +} // namespace content + namespace captured_sites_test_utils { // The amount of time to wait for an action to complete, or for a page element @@ -118,6 +121,10 @@ // content::WebContentsObserver void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; + void DidFinishLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url) override; + void FrameNameChanged(content::RenderFrameHost* render_frame_host, + const std::string& name) override; QueryType query_type_; base::RunLoop run_loop_;
diff --git a/chrome/browser/background_fetch/background_fetch_delegate_factory.cc b/chrome/browser/background_fetch/background_fetch_delegate_factory.cc index 8e3392d..6c05e1e7 100644 --- a/chrome/browser/background_fetch/background_fetch_delegate_factory.cc +++ b/chrome/browser/background_fetch/background_fetch_delegate_factory.cc
@@ -11,11 +11,10 @@ #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" -#include "components/offline_items_collection/core/offline_content_aggregator.h" #include "content/public/browser/background_fetch_delegate.h" namespace { -constexpr char kBackgroundFetchNamespacePrefix[] = "background_fetch"; +constexpr char kBackgroundFetchNamespacePrefix[] = "background_fetch_"; } // namespace // static @@ -42,9 +41,12 @@ KeyedService* BackgroundFetchDelegateFactory::BuildServiceInstanceFor( content::BrowserContext* context) const { + // Number of offline content aggregator registrations. There can be multiple + // incognito profiles created, and the provided namespace needs to be unique. + static int num_registrations = 0; + std::string provider_namespace = - offline_items_collection::OfflineContentAggregator::CreateUniqueNameSpace( - kBackgroundFetchNamespacePrefix); + kBackgroundFetchNamespacePrefix + base::IntToString(++num_registrations); return new BackgroundFetchDelegateImpl(Profile::FromBrowserContext(context), provider_namespace); }
diff --git a/chrome/browser/background_fetch/background_fetch_delegate_impl.cc b/chrome/browser/background_fetch/background_fetch_delegate_impl.cc index a10b550..a01c87c 100644 --- a/chrome/browser/background_fetch/background_fetch_delegate_impl.cc +++ b/chrome/browser/background_fetch/background_fetch_delegate_impl.cc
@@ -44,10 +44,6 @@ DCHECK(profile_); DCHECK(!provider_namespace_.empty()); offline_content_aggregator_->RegisterProvider(provider_namespace_, this); - - // Ensure that downloads UI components are initialized to handle the UI - // updates. - content::BrowserContext::GetDownloadManager(profile_); } BackgroundFetchDelegateImpl::~BackgroundFetchDelegateImpl() {
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 232a328..3fac27e 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -269,6 +269,8 @@ "accessibility/accessibility_panel.h", "accessibility/ax_host_service.cc", "accessibility/ax_host_service.h", + "accessibility/ax_remote_host_delegate.cc", + "accessibility/ax_remote_host_delegate.h", "accessibility/chromevox_panel.cc", "accessibility/chromevox_panel.h", "accessibility/dictation_chromeos.cc",
diff --git a/chrome/browser/chromeos/accessibility/ax_host_service.cc b/chrome/browser/chromeos/accessibility/ax_host_service.cc index b291295a..91cd8e8d 100644 --- a/chrome/browser/chromeos/accessibility/ax_host_service.cc +++ b/chrome/browser/chromeos/accessibility/ax_host_service.cc
@@ -4,23 +4,18 @@ #include "chrome/browser/chromeos/accessibility/ax_host_service.h" +#include <utility> + #include "base/bind.h" -#include "chrome/browser/extensions/api/automation_internal/automation_event_router.h" -#include "chrome/common/extensions/chrome_extension_messages.h" -#include "services/service_manager/public/cpp/connector.h" -#include "services/service_manager/public/cpp/service_context.h" -#include "ui/accessibility/ax_event.h" -#include "ui/aura/env.h" -#include "ui/views/mus/ax_remote_host.h" +#include "base/stl_util.h" +#include "chrome/browser/chromeos/accessibility/ax_remote_host_delegate.h" +#include "ui/accessibility/ax_tree_id.h" AXHostService* AXHostService::instance_ = nullptr; bool AXHostService::automation_enabled_ = false; AXHostService::AXHostService() { - // AX tree ID is automatically assigned. - DCHECK_NE(tree_id(), ui::AXTreeIDUnknown()); - DCHECK(!instance_); instance_ = this; registry_.AddInterface<ax::mojom::AXHost>( @@ -46,43 +41,43 @@ registry_.BindInterface(interface_name, std::move(interface_pipe)); } -void AXHostService::SetRemoteHost(ax::mojom::AXRemoteHostPtr remote, - SetRemoteHostCallback cb) { - remote_host_ = std::move(remote); +void AXHostService::RegisterRemoteHost( + ax::mojom::AXRemoteHostPtr remote_host_ptr, + RegisterRemoteHostCallback cb) { + // Create the AXRemoteHostDelegate first so a tree ID will be assigned. + auto remote_host_delegate = + std::make_unique<AXRemoteHostDelegate>(this, std::move(remote_host_ptr)); + ui::AXTreeID tree_id = remote_host_delegate->tree_id(); + DCHECK_NE(ui::AXTreeIDUnknown(), tree_id); + DCHECK(!base::ContainsKey(remote_host_delegate_map_, tree_id)); + remote_host_delegate_map_[tree_id] = std::move(remote_host_delegate); - // Handle both clean and unclean shutdown. - remote_host_.set_connection_error_handler(base::BindOnce( - &AXHostService::OnRemoteHostDisconnected, base::Unretained(this))); - - std::move(cb).Run(tree_id(), automation_enabled_); + // Inform the remote process of the tree ID. + std::move(cb).Run(tree_id, automation_enabled_); } void AXHostService::HandleAccessibilityEvent( const ui::AXTreeID& tree_id, const std::vector<ui::AXTreeUpdate>& updates, const ui::AXEvent& event) { - CHECK_EQ(tree_id, this->tree_id()); - ExtensionMsg_AccessibilityEventBundleParams event_bundle; - event_bundle.tree_id = tree_id; - for (const ui::AXTreeUpdate& update : updates) - event_bundle.updates.push_back(update); - event_bundle.events.push_back(event); - event_bundle.mouse_location = aura::Env::GetInstance()->last_mouse_location(); - - // Forward the tree updates and the event to the accessibility extension. - extensions::AutomationEventRouter::GetInstance()->DispatchAccessibilityEvents( - event_bundle); + auto it = remote_host_delegate_map_.find(tree_id); + if (it == remote_host_delegate_map_.end()) + return; + AXRemoteHostDelegate* delegate = it->second.get(); + delegate->HandleAccessibilityEvent(tree_id, updates, event); } -void AXHostService::PerformAction(const ui::AXActionData& data) { - // TODO(jamescook): This assumes a single remote host. Need to have one - // AXHostDelegate per remote host and only send to the appropriate one. - if (remote_host_) - remote_host_->PerformAction(data); +void AXHostService::OnRemoteHostDisconnected(const ui::AXTreeID& tree_id) { + // AXRemoteHostDelegate notified the extension that the tree was destroyed. + // Delete the AXRemoteHostDelegate. + remote_host_delegate_map_.erase(tree_id); } void AXHostService::FlushForTesting() { - remote_host_.FlushForTesting(); + for (const auto& pair : remote_host_delegate_map_) { + AXRemoteHostDelegate* delegate = pair.second.get(); + delegate->FlushForTesting(); + } } void AXHostService::AddBinding(ax::mojom::AXHostRequest request) { @@ -90,11 +85,8 @@ } void AXHostService::NotifyAutomationEnabled() { - if (remote_host_) - remote_host_->OnAutomationEnabled(automation_enabled_); -} - -void AXHostService::OnRemoteHostDisconnected() { - extensions::AutomationEventRouter::GetInstance()->DispatchTreeDestroyedEvent( - tree_id(), nullptr /* browser_context */); + for (const auto& pair : remote_host_delegate_map_) { + AXRemoteHostDelegate* delegate = pair.second.get(); + delegate->OnAutomationEnabled(automation_enabled_); + } }
diff --git a/chrome/browser/chromeos/accessibility/ax_host_service.h b/chrome/browser/chromeos/accessibility/ax_host_service.h index c3efe1738..baeb2ec5 100644 --- a/chrome/browser/chromeos/accessibility/ax_host_service.h +++ b/chrome/browser/chromeos/accessibility/ax_host_service.h
@@ -5,23 +5,21 @@ #ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_AX_HOST_SERVICE_H_ #define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_AX_HOST_SERVICE_H_ +#include <map> #include <memory> #include "mojo/public/cpp/bindings/binding_set.h" -#include "mojo/public/cpp/bindings/interface_ptr_set.h" #include "services/service_manager/public/cpp/binder_registry.h" #include "services/service_manager/public/cpp/service.h" -#include "ui/accessibility/ax_host_delegate.h" #include "ui/accessibility/mojom/ax_host.mojom.h" -// Forwards accessibility events from clients in other processes that use aura -// and views (e.g. the Chrome OS keyboard shortcut_viewer) to accessibility -// extensions. Renderers, PDF, etc. use a different path. Created when the first -// client connects over mojo. Implements AXHostDelegate by routing actions over -// mojo to the remote process. +class AXRemoteHostDelegate; + +// Manages a set of remote processes that use aura and views. Renderers such as +// web content, PDF, etc. use a different path. Created when the first client +// connects over mojo. class AXHostService : public service_manager::Service, - public ax::mojom::AXHost, - public ui::AXHostDelegate { + public ax::mojom::AXHost { public: AXHostService(); ~AXHostService() override; @@ -38,30 +36,32 @@ mojo::ScopedMessagePipeHandle interface_pipe) override; // ax::mojom::AXHost: - void SetRemoteHost(ax::mojom::AXRemoteHostPtr remote, - SetRemoteHostCallback cb) override; + void RegisterRemoteHost(ax::mojom::AXRemoteHostPtr remote_host_ptr, + RegisterRemoteHostCallback cb) override; void HandleAccessibilityEvent(const ui::AXTreeID& tree_id, const std::vector<ui::AXTreeUpdate>& updates, const ui::AXEvent& event) override; - // ui::AXHostDelegate: - void PerformAction(const ui::AXActionData& data) override; + // Cleans up after a remote host disconnects. + void OnRemoteHostDisconnected(const ui::AXTreeID& tree_id); - ui::AXTreeID tree_id_for_testing() const { return tree_id(); } void FlushForTesting(); private: void AddBinding(ax::mojom::AXHostRequest request); + + // Notifies all remote trees of automation enabled state. void NotifyAutomationEnabled(); - void OnRemoteHostDisconnected(); static AXHostService* instance_; static bool automation_enabled_; service_manager::BinderRegistry registry_; mojo::BindingSet<ax::mojom::AXHost> bindings_; - // TODO(jamescook): Support multiple remote hosts. - mojo::InterfacePtr<ax::mojom::AXRemoteHost> remote_host_; + + // Map from a child tree id to the remote host responsible for that tree. + std::map<ui::AXTreeID, std::unique_ptr<AXRemoteHostDelegate>> + remote_host_delegate_map_; DISALLOW_COPY_AND_ASSIGN(AXHostService); };
diff --git a/chrome/browser/chromeos/accessibility/ax_host_service_unittest.cc b/chrome/browser/chromeos/accessibility/ax_host_service_unittest.cc index 43ac4b48..fa7207e 100644 --- a/chrome/browser/chromeos/accessibility/ax_host_service_unittest.cc +++ b/chrome/browser/chromeos/accessibility/ax_host_service_unittest.cc
@@ -7,8 +7,10 @@ #include "base/bind.h" #include "base/macros.h" #include "base/test/scoped_task_environment.h" +#include "chrome/browser/chromeos/accessibility/ax_remote_host_delegate.h" #include "mojo/public/cpp/bindings/binding.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/accessibility/ax_tree_id_registry.h" #include "ui/accessibility/mojom/ax_host.mojom.h" namespace { @@ -25,7 +27,7 @@ } // Simulates the real AXRemoteHost. - void SetRemoteHostCallback(const ui::AXTreeID& tree_id, bool enabled) { + void RegisterRemoteHostCallback(const ui::AXTreeID& tree_id, bool enabled) { tree_id_ = tree_id; OnAutomationEnabled(enabled); } @@ -56,6 +58,14 @@ AXHostServiceTest() = default; ~AXHostServiceTest() override = default; + void RegisterRemoteHost(AXHostService* service, TestAXRemoteHost* remote) { + service->RegisterRemoteHost( + remote->CreateInterfacePtr(), + base::BindOnce(&TestAXRemoteHost::RegisterRemoteHostCallback, + base::Unretained(remote))); + service->FlushForTesting(); + } + private: base::test::ScopedTaskEnvironment scoped_task_enviroment_; @@ -65,15 +75,15 @@ TEST_F(AXHostServiceTest, AddClientThenEnable) { AXHostService service; TestAXRemoteHost remote; - service.SetRemoteHost(remote.CreateInterfacePtr(), - base::BindOnce(&TestAXRemoteHost::SetRemoteHostCallback, - base::Unretained(&remote))); - service.FlushForTesting(); + RegisterRemoteHost(&service, &remote); // Remote received initial state. EXPECT_EQ(1, remote.automation_enabled_count_); EXPECT_FALSE(remote.last_automation_enabled_); - EXPECT_EQ(service.tree_id_for_testing(), remote.tree_id_); + + // AXHostService assigned a tree id. + ui::AXTreeID tree_id = remote.tree_id_; + EXPECT_NE(ui::AXTreeIDUnknown(), tree_id); AXHostService::SetAutomationEnabled(true); service.FlushForTesting(); @@ -88,15 +98,14 @@ AXHostService::SetAutomationEnabled(true); TestAXRemoteHost remote; - service.SetRemoteHost(remote.CreateInterfacePtr(), - base::BindOnce(&TestAXRemoteHost::SetRemoteHostCallback, - base::Unretained(&remote))); - service.FlushForTesting(); + RegisterRemoteHost(&service, &remote); // Remote received initial state. EXPECT_EQ(1, remote.automation_enabled_count_); EXPECT_TRUE(remote.last_automation_enabled_); - EXPECT_EQ(service.tree_id_for_testing(), remote.tree_id_); + + // AXHostService assigned a tree id. + EXPECT_NE(ui::AXTreeIDUnknown(), remote.tree_id_); } TEST_F(AXHostServiceTest, PerformAction) { @@ -104,14 +113,18 @@ AXHostService::SetAutomationEnabled(true); TestAXRemoteHost remote; - service.SetRemoteHost(remote.CreateInterfacePtr(), - base::BindOnce(&TestAXRemoteHost::SetRemoteHostCallback, - base::Unretained(&remote))); - service.FlushForTesting(); + RegisterRemoteHost(&service, &remote); + // AXHostDelegate was created. + ui::AXTreeID tree_id = remote.tree_id_; + ui::AXHostDelegate* delegate = + ui::AXTreeIDRegistry::GetInstance()->GetHostDelegate(tree_id); + ASSERT_TRUE(delegate); + + // Trigger an action. ui::AXActionData action; action.action = ax::mojom::Action::kScrollUp; - service.PerformAction(action); + delegate->PerformAction(action); service.FlushForTesting(); // Remote interface received the action. @@ -119,4 +132,58 @@ EXPECT_EQ(ax::mojom::Action::kScrollUp, remote.last_action_.action); } +TEST_F(AXHostServiceTest, MultipleRemoteHosts) { + AXHostService service; + AXHostService::SetAutomationEnabled(true); + + // Connect 2 remote hosts. + TestAXRemoteHost remote1; + RegisterRemoteHost(&service, &remote1); + TestAXRemoteHost remote2; + RegisterRemoteHost(&service, &remote2); + + // Different tree ids were assigned. + EXPECT_NE(ui::AXTreeIDUnknown(), remote1.tree_id_); + EXPECT_NE(ui::AXTreeIDUnknown(), remote2.tree_id_); + EXPECT_NE(remote1.tree_id_, remote2.tree_id_); + + // Trigger an action on the first remote. + ui::AXActionData action; + action.action = ax::mojom::Action::kScrollUp; + ui::AXHostDelegate* delegate = + ui::AXTreeIDRegistry::GetInstance()->GetHostDelegate(remote1.tree_id_); + delegate->PerformAction(action); + service.FlushForTesting(); + + // Remote 1 received the action. + EXPECT_EQ(1, remote1.perform_action_count_); + EXPECT_EQ(ax::mojom::Action::kScrollUp, remote1.last_action_.action); + + // Remote 2 did not receive the action. + EXPECT_EQ(0, remote2.perform_action_count_); +} + +TEST_F(AXHostServiceTest, RemoteHostDisconnect) { + AXHostService service; + AXHostService::SetAutomationEnabled(true); + + // Connect 2 remote hosts. + TestAXRemoteHost remote1; + RegisterRemoteHost(&service, &remote1); + TestAXRemoteHost remote2; + RegisterRemoteHost(&service, &remote2); + + // Tree IDs exist for both. + auto* tree_id_registry = ui::AXTreeIDRegistry::GetInstance(); + EXPECT_TRUE(tree_id_registry->GetHostDelegate(remote1.tree_id_)); + EXPECT_TRUE(tree_id_registry->GetHostDelegate(remote2.tree_id_)); + + // Simulate remote 1 disconnecting. + service.OnRemoteHostDisconnected(remote1.tree_id_); + + // Tree ID for remote 1 is gone. + EXPECT_FALSE(tree_id_registry->GetHostDelegate(remote1.tree_id_)); + EXPECT_TRUE(tree_id_registry->GetHostDelegate(remote2.tree_id_)); +} + } // namespace
diff --git a/chrome/browser/chromeos/accessibility/ax_remote_host_delegate.cc b/chrome/browser/chromeos/accessibility/ax_remote_host_delegate.cc new file mode 100644 index 0000000..c41e543 --- /dev/null +++ b/chrome/browser/chromeos/accessibility/ax_remote_host_delegate.cc
@@ -0,0 +1,66 @@ +// Copyright 2018 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/chromeos/accessibility/ax_remote_host_delegate.h" + +#include "base/bind.h" +#include "chrome/browser/chromeos/accessibility/ax_host_service.h" +#include "chrome/browser/extensions/api/automation_internal/automation_event_router.h" +#include "chrome/common/extensions/chrome_extension_messages.h" +#include "ui/accessibility/ax_event.h" +#include "ui/accessibility/ax_tree_update.h" +#include "ui/aura/env.h" + +AXRemoteHostDelegate::AXRemoteHostDelegate(AXHostService* host_service, + ax::mojom::AXRemoteHostPtr ptr) + : host_service_(host_service), remote_host_ptr_(std::move(ptr)) { + DCHECK(host_service_); + DCHECK(remote_host_ptr_); + + // AX tree ID is automatically assigned. + DCHECK_NE(tree_id(), ui::AXTreeIDUnknown()); + + // Handle both clean and unclean shutdown of the remote app. + remote_host_ptr_.set_connection_error_handler(base::BindOnce( + &AXRemoteHostDelegate::OnRemoteHostDisconnected, base::Unretained(this))); +} + +AXRemoteHostDelegate::~AXRemoteHostDelegate() = default; + +void AXRemoteHostDelegate::OnAutomationEnabled(bool enabled) { + remote_host_ptr_->OnAutomationEnabled(enabled); +} + +void AXRemoteHostDelegate::HandleAccessibilityEvent( + const ui::AXTreeID& tree_id, + const std::vector<ui::AXTreeUpdate>& updates, + const ui::AXEvent& event) { + CHECK_EQ(tree_id, this->tree_id()); + ExtensionMsg_AccessibilityEventBundleParams event_bundle; + event_bundle.tree_id = tree_id; + for (const ui::AXTreeUpdate& update : updates) + event_bundle.updates.push_back(update); + event_bundle.events.push_back(event); + event_bundle.mouse_location = aura::Env::GetInstance()->last_mouse_location(); + + // Forward the tree updates and the event to the accessibility extension. + extensions::AutomationEventRouter::GetInstance()->DispatchAccessibilityEvents( + event_bundle); +} + +void AXRemoteHostDelegate::PerformAction(const ui::AXActionData& data) { + // Send to remote host. + remote_host_ptr_->PerformAction(data); +} + +void AXRemoteHostDelegate::FlushForTesting() { + remote_host_ptr_.FlushForTesting(); +} + +void AXRemoteHostDelegate::OnRemoteHostDisconnected() { + extensions::AutomationEventRouter::GetInstance()->DispatchTreeDestroyedEvent( + tree_id(), nullptr /* browser_context */); + host_service_->OnRemoteHostDisconnected(tree_id()); + // This object is now deleted. +}
diff --git a/chrome/browser/chromeos/accessibility/ax_remote_host_delegate.h b/chrome/browser/chromeos/accessibility/ax_remote_host_delegate.h new file mode 100644 index 0000000..f660c379 --- /dev/null +++ b/chrome/browser/chromeos/accessibility/ax_remote_host_delegate.h
@@ -0,0 +1,64 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_AX_REMOTE_HOST_DELEGATE_H_ +#define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_AX_REMOTE_HOST_DELEGATE_H_ + +#include <vector> + +#include "mojo/public/cpp/bindings/interface_ptr.h" +#include "ui/accessibility/ax_host_delegate.h" +#include "ui/accessibility/ax_tree_update.h" +#include "ui/accessibility/mojom/ax_host.mojom.h" + +namespace ui { +struct AXEvent; +class AXTreeID; +} // namespace ui + +class AXHostService; + +// Forwards accessibility events from a remote process that uses aura and views +// (e.g. the Chrome OS keyboard shortcut_viewer) to accessibility extensions. +// Renderers, PDF, etc. use a different path. Created when the app connects over +// mojo. Implements AXHostDelegate to route actions over mojo to the remote +// process. +class AXRemoteHostDelegate : public ui::AXHostDelegate { + public: + // |host_service| owns this object. |remote_host_ptr| is the mojo interface + // for the remote app. + AXRemoteHostDelegate(AXHostService* host_service, + ax::mojom::AXRemoteHostPtr remote_host_ptr); + ~AXRemoteHostDelegate() override; + + // Requests AX node trees from remote clients and starts listening for remote + // AX events. Static because the mojo service_manager creates and owns the + // service object, but automation may be enabled before a client connects and + // the service starts. + void OnAutomationEnabled(bool enabled); + + // Handles an accessibility event from a remote host. + void HandleAccessibilityEvent(const ui::AXTreeID& tree_id, + const std::vector<ui::AXTreeUpdate>& updates, + const ui::AXEvent& event); + + // ui::AXHostDelegate: + void PerformAction(const ui::AXActionData& data) override; + + void FlushForTesting(); + + private: + // Cleans up the extension's AX tree when the remote app disconnects. + void OnRemoteHostDisconnected(); + + // The owning AXHostService. + AXHostService* host_service_; + + // Connection to the remote host. + mojo::InterfacePtr<ax::mojom::AXRemoteHost> remote_host_ptr_; + + DISALLOW_COPY_AND_ASSIGN(AXRemoteHostDelegate); +}; + +#endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_AX_REMOTE_HOST_DELEGATE_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_manager.cc b/chrome/browser/chromeos/crostini/crostini_manager.cc index 76cf915a..0ffdd83 100644 --- a/chrome/browser/chromeos/crostini/crostini_manager.cc +++ b/chrome/browser/chromeos/crostini/crostini_manager.cc
@@ -388,6 +388,10 @@ CrostiniManager::RestartId CrostiniManager::CrostiniRestarter::next_restart_id_ = 0; +bool CrostiniManager::is_cros_termina_registered_ = false; +// Unit tests need this initialized to true. In Browser tests and real life, +// it is updated via MaybeUpgradeCrostini. +bool CrostiniManager::is_dev_kvm_present_ = true; void CrostiniManager::SetVmState(std::string vm_name, VmState vm_state) { auto vm_info = running_vms_.find(std::move(vm_name)); @@ -465,37 +469,50 @@ GetConciergeClient()->RemoveObserver(this); } -bool CrostiniManager::IsCrosTerminaInstalled() const { +// static +bool CrostiniManager::IsCrosTerminaInstalled() { return is_cros_termina_registered_; } +// static +bool CrostiniManager::IsDevKvmPresent() { + return is_dev_kvm_present_; +} + void CrostiniManager::MaybeUpgradeCrostini() { - if (!IsCrostiniAllowedForProfile(profile_)) { - return; - } auto* component_manager = g_browser_process->platform_part()->cros_component_manager(); if (!component_manager) { // |component_manager| may be nullptr in unit tests. return; } - base::PostTaskWithTraitsAndReplyWithResult( + base::PostTaskWithTraitsAndReply( FROM_HERE, {base::MayBlock()}, - base::BindOnce(&component_updater::CrOSComponentManager::IsRegistered, - base::Unretained(component_manager), - imageloader::kTerminaComponentName), - base::BindOnce(&CrostiniManager::MaybeUpgradeCrostiniAfterTerminaCheck, + base::BindOnce(CrostiniManager::CheckPathsAndComponents), + base::BindOnce(&CrostiniManager::MaybeUpgradeCrostiniAfterChecks, weak_ptr_factory_.GetWeakPtr())); } -void CrostiniManager::MaybeUpgradeCrostiniAfterTerminaCheck( - bool is_registered) { - is_cros_termina_registered_ = is_registered; - VLOG(1) << "cros-termina is " - << (is_registered ? "registered" : "not registered"); +// static +void CrostiniManager::CheckPathsAndComponents() { + is_dev_kvm_present_ = base::PathExists(base::FilePath("/dev/kvm")); + auto* component_manager = + g_browser_process->platform_part()->cros_component_manager(); + DCHECK(component_manager); + is_cros_termina_registered_ = + component_manager->IsRegistered(imageloader::kTerminaComponentName); +} + +void CrostiniManager::MaybeUpgradeCrostiniAfterChecks() { + if (!is_dev_kvm_present_) { + return; + } if (!is_cros_termina_registered_) { return; } + if (!IsCrostiniAllowedForProfile(profile_)) { + return; + } termina_update_check_needed_ = true; if (net::NetworkChangeNotifier::IsOffline()) { // Can't do a component Load with kForce when offline.
diff --git a/chrome/browser/chromeos/crostini/crostini_manager.h b/chrome/browser/chromeos/crostini/crostini_manager.h index 5f14dd8..35969f2 100644 --- a/chrome/browser/chromeos/crostini/crostini_manager.h +++ b/chrome/browser/chromeos/crostini/crostini_manager.h
@@ -165,8 +165,11 @@ explicit CrostiniManager(Profile* profile); ~CrostiniManager() override; - // Checks if the cros-termina component is installed. - bool IsCrosTerminaInstalled() const; + // Returns true if the cros-termina component is installed. + static bool IsCrosTerminaInstalled(); + + // Returns true if the /dev/kvm directory is present. + static bool IsDevKvmPresent(); // Generate the URL for Crostini terminal application. static GURL GenerateVshInCroshUrl( @@ -490,9 +493,13 @@ GetContainerSshKeysCallback callback, base::Optional<vm_tools::concierge::ContainerSshKeysResponse> reply); + // Helper for CrostiniManager::MaybeUpgradeCrostini. Makes blocking calls to + // check for file paths and registered components. + static void CheckPathsAndComponents(); + // Helper for CrostiniManager::MaybeUpgradeCrostini. Separated because the - // checking registration code may block. - void MaybeUpgradeCrostiniAfterTerminaCheck(bool is_registered); + // checking component registration code may block. + void MaybeUpgradeCrostiniAfterChecks(); // Helper for CrostiniManager::CreateDiskImage. Separated so it can be run // off the main thread. @@ -515,8 +522,9 @@ component_manager_load_error_for_testing_ = component_updater::CrOSComponentManager::Error::NONE; - bool is_cros_termina_registered_ = false; + static bool is_cros_termina_registered_; bool termina_update_check_needed_ = false; + static bool is_dev_kvm_present_; // Pending container started callbacks are keyed by <vm_name, container_name> // string pairs.
diff --git a/chrome/browser/chromeos/crostini/crostini_util.cc b/chrome/browser/chromeos/crostini/crostini_util.cc index 010e4af..3fec8d99 100644 --- a/chrome/browser/chromeos/crostini/crostini_util.cc +++ b/chrome/browser/chromeos/crostini/crostini_util.cc
@@ -232,6 +232,10 @@ if (!user->IsAffiliated() && !IsUnaffiliatedCrostiniAllowedByPolicy()) { return false; } + if (!crostini::CrostiniManager::IsDevKvmPresent()) { + // Hardware is physically incapable, no matter what the user wants. + return false; + } return virtual_machines::AreVirtualMachinesAllowedByVersionAndChannel() && virtual_machines::AreVirtualMachinesAllowedByPolicy() && base::FeatureList::IsEnabled(features::kCrostini);
diff --git a/chrome/browser/chromeos/login/auto_launched_kiosk_browsertest.cc b/chrome/browser/chromeos/login/auto_launched_kiosk_browsertest.cc index 373cb8e..f3477a7b 100644 --- a/chrome/browser/chromeos/login/auto_launched_kiosk_browsertest.cc +++ b/chrome/browser/chromeos/login/auto_launched_kiosk_browsertest.cc
@@ -419,6 +419,7 @@ .Set("PublicAccounts", extensions::ListBuilder().Append(GetTestAppUserId()).Build()) .Build(); + local_state->SetKey(prefs::kOobeComplete, base::Value(true)); JSONFileValueSerializer serializer( user_data_path.Append(chrome::kLocalStateFilename));
diff --git a/chrome/browser/chromeos/login/profile_auth_data.cc b/chrome/browser/chromeos/login/profile_auth_data.cc index a63b41e8..6da107a 100644 --- a/chrome/browser/chromeos/login/profile_auth_data.cc +++ b/chrome/browser/chromeos/login/profile_auth_data.cc
@@ -12,16 +12,15 @@ #include "base/location.h" #include "base/logging.h" #include "base/memory/ref_counted.h" +#include "base/memory/ref_counted_delete_on_sequence.h" #include "base/single_thread_task_runner.h" #include "base/task/post_task.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" -#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/storage_partition.h" #include "net/cookies/canonical_cookie.h" -#include "net/cookies/cookie_store.h" #include "net/http/http_auth_cache.h" #include "net/http/http_network_session.h" #include "net/http/http_transaction_factory.h" @@ -29,6 +28,7 @@ #include "net/ssl/channel_id_store.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" +#include "services/network/public/mojom/cookie_manager.mojom.h" #include "url/gurl.h" using content::BrowserThread; @@ -40,24 +40,31 @@ const char kSAMLStartCookie[] = "google-accounts-saml-start"; const char kSAMLEndCookie[] = "google-accounts-saml-end"; -// Import |cookies| into |cookie_store|. -// |cookie.IsCanonical()| must be true for all cookies in |cookies|. -void ImportCookies(const net::CookieList& cookies, - net::CookieStore* cookie_store) { - for (const auto& cookie : cookies) { - std::unique_ptr<net::CanonicalCookie> cc( - std::make_unique<net::CanonicalCookie>(cookie)); - DCHECK(cc->IsCanonical()); +// Given a |cookie| set during login, returns true if the cookie may have been +// set by GAIA. The main criterion is the |cookie|'s creation date. The points +// in time at which redirects from GAIA to SAML IdP and back occur are stored +// in |saml_start_time| and |saml_end_time|. If the cookie was set between +// these two times, it was created by the SAML IdP. Otherwise, it was created +// by GAIA. +// As an additional precaution, the cookie's domain is checked. If the domain +// contains "google" or "youtube", the cookie is considered to have been set +// by GAIA as well. +bool IsGAIACookie(const base::Time& saml_start_time, + const base::Time& saml_end_time, + const net::CanonicalCookie& cookie) { + const base::Time& creation_date = cookie.CreationDate(); + if (creation_date < saml_start_time) + return true; + if (!saml_end_time.is_null() && creation_date > saml_end_time) + return true; - // Assume secure_source - since the cookies are being restored from - // another store, they have already gone through the strict secure check. - cookie_store->SetCanonicalCookieAsync( - std::move(cc), true /*secure_source*/, true /*modify_http_only*/, - net::CookieStore::SetCookiesCallback()); - } + const std::string& domain = cookie.Domain(); + return domain.find("google") != std::string::npos || + domain.find("youtube") != std::string::npos; } -class ProfileAuthDataTransferer { +class ProfileAuthDataTransferer + : public base::RefCountedDeleteOnSequence<ProfileAuthDataTransferer> { public: ProfileAuthDataTransferer( content::StoragePartition* from_partition, @@ -69,73 +76,53 @@ void BeginTransfer(); private: - void BeginTransferOnIOThread(); + friend class RefCountedDeleteOnSequence<ProfileAuthDataTransferer>; + friend class base::DeleteHelper<ProfileAuthDataTransferer>; + + ~ProfileAuthDataTransferer(); // Transfer the proxy auth cache from |from_context_| to |to_context_|. If // the user was required to authenticate with a proxy during login, this // authentication information will be transferred into the user's session. void TransferProxyAuthCache(); - // Callback that receives the content of |to_context_|'s cookie jar. Checks + // Callback that receives the content of |to_partition_|'s cookie jar. Checks // whether this is the user's first login, based on the state of the cookie - // jar, and starts retrieval of the data that should be transfered. Calls - // Finish() if there is no data to transfer. + // jar, and starts retrieval of the data that should be transfered. void OnTargetCookieJarContentsRetrieved( const net::CookieList& target_cookies); - // Retrieve the contents of |from_context_|'s cookie jar. When the retrieval + // Retrieve the contents of |from_partition_|'s cookie jar. When the retrieval // finishes, OnCookiesToTransferRetrieved will be called with the result. void RetrieveCookiesToTransfer(); - // Callback that receives the contents of |from_context_|'s cookie jar. Calls - // MaybeTransferCookiesAndChannelIDs() to try and perform the transfer. + // Callback that receives the contents of |from_partition_|'s cookie jar. + // Transfers the necessary cookies to |to_partition_|'s cookie jar. void OnCookiesToTransferRetrieved(const net::CookieList& cookies_to_transfer); + // Imports |cookies| into |to_partition_|'s cookie jar. |cookie.IsCanonical()| + // must be true for all cookies in |cookies|. + void ImportCookies(const net::CookieList& cookies); + void OnCookieSet(bool result); + // Retrieve |from_context_|'s channel IDs. When the retrieval finishes, // OnChannelIDsToTransferRetrieved will be called with the result. void RetrieveChannelIDsToTransfer(); - // Callback that receives |from_context_|'s channel IDs. Calls - // MaybeTransferCookiesAndChannelIDs() to try and perform the transfer. + // Callback that receives |from_context_|'s channel IDs and transfers them to + // |to_context_|. void OnChannelIDsToTransferRetrieved( const net::ChannelIDStore::ChannelIDList& channel_ids_to_transfer); - // Given a |cookie| set during login, returns true if the cookie may have been - // set by GAIA. The main criterion is the |cookie|'s creation date. The points - // in time at which redirects from GAIA to SAML IdP and back occur are stored - // in |saml_start_time_| and |saml_end_time_|. If the cookie was set between - // these two times, it was created by the SAML IdP. Otherwise, it was created - // by GAIA. - // As an additional precaution, the cookie's domain is checked. If the domain - // contains "google" or "youtube", the cookie is considered to have been set - // by GAIA as well. - bool IsGAIACookie(const net::CanonicalCookie& cookie); - - // If all data to be transferred has been retrieved already, transfer it to - // |to_context_| and call Finish(). - void MaybeTransferCookiesAndChannelIDs(); - - // Post the |completion_callback_| to the UI thread and schedule destruction - // of |this|. - void Finish(); - + content::StoragePartition* from_partition_; scoped_refptr<net::URLRequestContextGetter> from_context_; + content::StoragePartition* to_partition_; scoped_refptr<net::URLRequestContextGetter> to_context_; bool transfer_auth_cookies_and_channel_ids_on_first_login_; bool transfer_saml_auth_cookies_on_subsequent_login_; - base::Closure completion_callback_; + base::OnceClosure completion_callback_; - net::CookieList cookies_to_transfer_; - net::ChannelIDStore::ChannelIDList channel_ids_to_transfer_; - - // The time at which a redirect from GAIA to a SAML IdP occurred. - base::Time saml_start_time_; - // The time at which a redirect from a SAML IdP back to GAIA occurred. - base::Time saml_end_time_; - - bool first_login_; - bool waiting_for_auth_cookies_; - bool waiting_for_channel_ids_; + bool first_login_ = false; }; ProfileAuthDataTransferer::ProfileAuthDataTransferer( @@ -144,49 +131,38 @@ bool transfer_auth_cookies_and_channel_ids_on_first_login, bool transfer_saml_auth_cookies_on_subsequent_login, const base::Closure& completion_callback) - : from_context_(from_partition->GetURLRequestContext()), + : RefCountedDeleteOnSequence<ProfileAuthDataTransferer>( + base::ThreadTaskRunnerHandle::Get()), + from_partition_(from_partition), + from_context_(from_partition->GetURLRequestContext()), + to_partition_(to_partition), to_context_(to_partition->GetURLRequestContext()), transfer_auth_cookies_and_channel_ids_on_first_login_( transfer_auth_cookies_and_channel_ids_on_first_login), transfer_saml_auth_cookies_on_subsequent_login_( transfer_saml_auth_cookies_on_subsequent_login), - completion_callback_(completion_callback), - first_login_(false), - waiting_for_auth_cookies_(false), - waiting_for_channel_ids_(false) {} + completion_callback_(completion_callback) {} + +ProfileAuthDataTransferer::~ProfileAuthDataTransferer() { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + if (!completion_callback_.is_null()) + std::move(completion_callback_).Run(); +} void ProfileAuthDataTransferer::BeginTransfer() { DCHECK_CURRENTLY_ON(BrowserThread::UI); - // If we aren't transferring auth cookies or channel IDs, post the completion - // callback immediately. Otherwise, it will be called when the transfer - // finishes. - if (!transfer_auth_cookies_and_channel_ids_on_first_login_ && - !transfer_saml_auth_cookies_on_subsequent_login_) { - base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, - completion_callback_); - // Null the callback so that when Finish is called, the callback won't be - // called again. - completion_callback_.Reset(); - } + base::PostTaskWithTraits( FROM_HERE, {BrowserThread::IO}, - base::BindOnce(&ProfileAuthDataTransferer::BeginTransferOnIOThread, - base::Unretained(this))); -} + base::BindOnce(&ProfileAuthDataTransferer::TransferProxyAuthCache, this)); -void ProfileAuthDataTransferer::BeginTransferOnIOThread() { - DCHECK_CURRENTLY_ON(BrowserThread::IO); - TransferProxyAuthCache(); if (transfer_auth_cookies_and_channel_ids_on_first_login_ || transfer_saml_auth_cookies_on_subsequent_login_) { - // Retrieve the contents of |to_context_|'s cookie jar. - net::CookieStore* to_store = - to_context_->GetURLRequestContext()->cookie_store(); - to_store->GetAllCookiesAsync(base::BindOnce( - &ProfileAuthDataTransferer::OnTargetCookieJarContentsRetrieved, - base::Unretained(this))); - } else { - Finish(); + // Retrieve the contents of |to_partition_|'s cookie jar. + network::mojom::CookieManager* to_manager = + to_partition_->GetCookieManagerForBrowserProcess(); + to_manager->GetAllCookies(base::BindOnce( + &ProfileAuthDataTransferer::OnTargetCookieJarContentsRetrieved, this)); } } @@ -204,130 +180,111 @@ void ProfileAuthDataTransferer::OnTargetCookieJarContentsRetrieved( const net::CookieList& target_cookies) { - DCHECK_CURRENTLY_ON(BrowserThread::IO); + DCHECK_CURRENTLY_ON(BrowserThread::UI); + bool transfer_auth_cookies = false; + bool transfer_channel_ids = false; + first_login_ = target_cookies.empty(); if (first_login_) { // On first login, transfer all auth cookies and channel IDs if // |transfer_auth_cookies_and_channel_ids_on_first_login_| is true. - waiting_for_auth_cookies_ = + transfer_auth_cookies = transfer_auth_cookies_and_channel_ids_on_first_login_; - waiting_for_channel_ids_ = + transfer_channel_ids = transfer_auth_cookies_and_channel_ids_on_first_login_; } else { // On subsequent login, transfer auth cookies set by the SAML IdP if // |transfer_saml_auth_cookies_on_subsequent_login_| is true. - waiting_for_auth_cookies_ = transfer_saml_auth_cookies_on_subsequent_login_; + transfer_auth_cookies = transfer_saml_auth_cookies_on_subsequent_login_; } - if (!waiting_for_auth_cookies_ && !waiting_for_channel_ids_) { - Finish(); - return; - } - - if (waiting_for_auth_cookies_) + if (transfer_auth_cookies) RetrieveCookiesToTransfer(); - if (waiting_for_channel_ids_) - RetrieveChannelIDsToTransfer(); + + if (transfer_channel_ids) { + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, + base::BindOnce(&ProfileAuthDataTransferer::RetrieveChannelIDsToTransfer, + this)); + } } void ProfileAuthDataTransferer::RetrieveCookiesToTransfer() { - DCHECK_CURRENTLY_ON(BrowserThread::IO); - net::CookieStore* from_store = - from_context_->GetURLRequestContext()->cookie_store(); - from_store->GetAllCookiesAsync( - base::BindOnce(&ProfileAuthDataTransferer::OnCookiesToTransferRetrieved, - base::Unretained(this))); + DCHECK_CURRENTLY_ON(BrowserThread::UI); + network::mojom::CookieManager* from_manager = + from_partition_->GetCookieManagerForBrowserProcess(); + from_manager->GetAllCookies(base::BindOnce( + &ProfileAuthDataTransferer::OnCookiesToTransferRetrieved, this)); } void ProfileAuthDataTransferer::OnCookiesToTransferRetrieved( - const net::CookieList& cookies_to_transfer) { - DCHECK_CURRENTLY_ON(BrowserThread::IO); - waiting_for_auth_cookies_ = false; - cookies_to_transfer_ = cookies_to_transfer; + const net::CookieList& cookies) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); // Look for cookies indicating the points in time at which redirects from GAIA // to SAML IdP and back occurred. These cookies are synthesized by // chrome/browser/resources/gaia_auth/background.js. If the cookies are found, - // their creation times are stored in |saml_start_time_| and - // |cookies_to_transfer_| and the cookies are deleted. - for (net::CookieList::iterator it = cookies_to_transfer_.begin(); - it != cookies_to_transfer_.end();) { - if (it->Name() == kSAMLStartCookie) { - saml_start_time_ = it->CreationDate(); - it = cookies_to_transfer_.erase(it); - } else if (it->Name() == kSAMLEndCookie) { - saml_end_time_ = it->CreationDate(); - it = cookies_to_transfer_.erase(it); + // their creation times are noted and the cookies are deleted. + base::Time saml_start_time; + base::Time saml_end_time; + net::CookieList cookies_to_transfer; + for (const auto& cookie : cookies) { + if (cookie.Name() == kSAMLStartCookie) { + saml_start_time = cookie.CreationDate(); + } else if (cookie.Name() == kSAMLEndCookie) { + saml_end_time = cookie.CreationDate(); } else { - ++it; + cookies_to_transfer.push_back(cookie); } } - MaybeTransferCookiesAndChannelIDs(); + if (first_login_) { + ImportCookies(cookies_to_transfer); + } else { + net::CookieList non_gaia_cookies; + for (const auto& cookie : cookies_to_transfer) { + if (!IsGAIACookie(saml_start_time, saml_end_time, cookie)) + non_gaia_cookies.push_back(cookie); + } + ImportCookies(non_gaia_cookies); + } +} + +void ProfileAuthDataTransferer::ImportCookies(const net::CookieList& cookies) { + network::mojom::CookieManager* cookie_manager = + to_partition_->GetCookieManagerForBrowserProcess(); + + for (const auto& cookie : cookies) { + // Assume secure_source - since the cookies are being restored from + // another store, they have already gone through the strict secure check. + DCHECK(cookie.IsCanonical()); + cookie_manager->SetCanonicalCookie( + cookie, true /*secure_source*/, true /*modify_http_only*/, + base::BindOnce(&ProfileAuthDataTransferer::OnCookieSet, this)); + } +} + +void ProfileAuthDataTransferer::OnCookieSet(bool result) { + // This function does nothing but extend the lifetime of |this| until after + // all cookies have been transferred. } void ProfileAuthDataTransferer::RetrieveChannelIDsToTransfer() { DCHECK_CURRENTLY_ON(BrowserThread::IO); net::ChannelIDService* from_service = from_context_->GetURLRequestContext()->channel_id_service(); - from_service->GetChannelIDStore()->GetAllChannelIDs( - base::Bind(&ProfileAuthDataTransferer::OnChannelIDsToTransferRetrieved, - base::Unretained(this))); + from_service->GetChannelIDStore()->GetAllChannelIDs(base::BindOnce( + &ProfileAuthDataTransferer::OnChannelIDsToTransferRetrieved, this)); } void ProfileAuthDataTransferer::OnChannelIDsToTransferRetrieved( const net::ChannelIDStore::ChannelIDList& channel_ids_to_transfer) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - channel_ids_to_transfer_ = channel_ids_to_transfer; - waiting_for_channel_ids_ = false; - MaybeTransferCookiesAndChannelIDs(); -} + DCHECK(first_login_); -bool ProfileAuthDataTransferer::IsGAIACookie( - const net::CanonicalCookie& cookie) { - const base::Time& creation_date = cookie.CreationDate(); - if (creation_date < saml_start_time_) - return true; - if (!saml_end_time_.is_null() && creation_date > saml_end_time_) - return true; - - const std::string& domain = cookie.Domain(); - return domain.find("google") != std::string::npos || - domain.find("youtube") != std::string::npos; -} - -void ProfileAuthDataTransferer::MaybeTransferCookiesAndChannelIDs() { - DCHECK_CURRENTLY_ON(BrowserThread::IO); - if (waiting_for_auth_cookies_ || waiting_for_channel_ids_) - return; - - net::CookieStore* to_store = - to_context_->GetURLRequestContext()->cookie_store(); - if (first_login_) { - ImportCookies(cookies_to_transfer_, to_store); - net::ChannelIDService* to_cert_service = - to_context_->GetURLRequestContext()->channel_id_service(); - to_cert_service->GetChannelIDStore()->InitializeFrom( - channel_ids_to_transfer_); - } else { - net::CookieList non_gaia_cookies; - for (net::CookieList::const_iterator it = cookies_to_transfer_.begin(); - it != cookies_to_transfer_.end(); ++it) { - if (!IsGAIACookie(*it)) - non_gaia_cookies.push_back(*it); - } - ImportCookies(non_gaia_cookies, to_store); - } - - Finish(); -} - -void ProfileAuthDataTransferer::Finish() { - DCHECK_CURRENTLY_ON(BrowserThread::IO); - if (!completion_callback_.is_null()) - base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, - completion_callback_); - base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); + net::ChannelIDService* to_cert_service = + to_context_->GetURLRequestContext()->channel_id_service(); + to_cert_service->GetChannelIDStore()->InitializeFrom(channel_ids_to_transfer); } } // namespace @@ -339,10 +296,10 @@ bool transfer_saml_auth_cookies_on_subsequent_login, const base::Closure& completion_callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - (new ProfileAuthDataTransferer( - from_partition, to_partition, - transfer_auth_cookies_and_channel_ids_on_first_login, - transfer_saml_auth_cookies_on_subsequent_login, completion_callback)) + base::MakeRefCounted<ProfileAuthDataTransferer>( + from_partition, to_partition, + transfer_auth_cookies_and_channel_ids_on_first_login, + transfer_saml_auth_cookies_on_subsequent_login, completion_callback) ->BeginTransfer(); }
diff --git a/chrome/browser/chromeos/login/profile_auth_data_unittest.cc b/chrome/browser/chromeos/login/profile_auth_data_unittest.cc index 304dc35..f099bb5 100644 --- a/chrome/browser/chromeos/login/profile_auth_data_unittest.cc +++ b/chrome/browser/chromeos/login/profile_auth_data_unittest.cc
@@ -14,6 +14,7 @@ #include "base/run_loop.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/bind_test_util.h" #include "base/time/time.h" #include "chrome/test/base/testing_profile.h" #include "content/public/browser/browser_context.h" @@ -21,7 +22,6 @@ #include "content/public/test/test_browser_thread_bundle.h" #include "net/cookies/canonical_cookie.h" #include "net/cookies/cookie_constants.h" -#include "net/cookies/cookie_store.h" #include "net/http/http_auth.h" #include "net/http/http_auth_cache.h" #include "net/http/http_network_session.h" @@ -31,6 +31,7 @@ #include "net/test/channel_id_test_util.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" +#include "services/network/public/mojom/cookie_manager.mojom.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" @@ -89,11 +90,10 @@ net::URLRequestContext* GetRequestContext( content::BrowserContext* browser_context); net::HttpAuthCache* GetProxyAuth(content::BrowserContext* browser_context); - net::CookieStore* GetCookies(content::BrowserContext* browser_context); + network::mojom::CookieManager* GetCookies( + content::BrowserContext* browser_context); net::ChannelIDStore* GetChannelIDs(content::BrowserContext* browser_context); - void QuitLoop(const net::CookieList& ignored); - void StoreCookieListAndQuitLoop(const net::CookieList& cookie_list); void StoreChannelIDListAndQuitLoop( const net::ChannelIDStore::ChannelIDList& channel_id_list); @@ -102,7 +102,6 @@ TestingProfile login_browser_context_; TestingProfile user_browser_context_; - net::CookieList user_cookie_list_; net::ChannelIDStore::ChannelIDList user_channel_id_list_; std::unique_ptr<base::RunLoop> run_loop_; @@ -142,13 +141,16 @@ } net::CookieList ProfileAuthDataTest::GetUserCookies() { - run_loop_.reset(new base::RunLoop); + base::RunLoop run_loop; + net::CookieList result; GetCookies(&user_browser_context_) - ->GetAllCookiesAsync( - base::BindOnce(&ProfileAuthDataTest::StoreCookieListAndQuitLoop, - base::Unretained(this))); - run_loop_->Run(); - return user_cookie_list_; + ->GetAllCookies( + base::BindLambdaForTesting([&](const net::CookieList& cookie_list) { + result = cookie_list; + run_loop.Quit(); + })); + run_loop.Run(); + return result; } net::ChannelIDStore::ChannelIDList ProfileAuthDataTest::GetUserChannelIDs() { @@ -215,37 +217,34 @@ base::ASCIIToUTF16(proxy_auth_password)), std::string()); - net::CookieStore* cookies = GetCookies(browser_context); + network::mojom::CookieManager* cookies = GetCookies(browser_context); // Ensure |cookies| is fully initialized. - run_loop_.reset(new base::RunLoop); - cookies->GetAllCookiesAsync( - base::BindOnce(&ProfileAuthDataTest::QuitLoop, base::Unretained(this))); - run_loop_->Run(); + base::RunLoop run_loop; + cookies->GetAllCookies(base::BindLambdaForTesting( + [&](const net::CookieList& cookies) { run_loop.Quit(); })); + run_loop.Run(); - cookies->SetCanonicalCookieAsync( - net::CanonicalCookie::CreateSanitizedCookie( + cookies->SetCanonicalCookie( + *net::CanonicalCookie::CreateSanitizedCookie( GURL(kSAMLIdPCookieURL), kCookieName, cookie_value, kSAMLIdPCookieDomainWithWildcard, std::string(), base::Time(), base::Time(), base::Time(), true, false, net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT), - true /*secure_source*/, true /*modify_http_only*/, - net::CookieStore::SetCookiesCallback()); + true /*secure_source*/, true /*modify_http_only*/, base::DoNothing()); - cookies->SetCanonicalCookieAsync( - net::CanonicalCookie::CreateSanitizedCookie( + cookies->SetCanonicalCookie( + *net::CanonicalCookie::CreateSanitizedCookie( GURL(kSAMLIdPCookieURL), kCookieName, cookie_value, std::string(), std::string(), base::Time(), base::Time(), base::Time(), true, false, net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT), - true /*secure_source*/, true /*modify_http_only*/, - net::CookieStore::SetCookiesCallback()); + true /*secure_source*/, true /*modify_http_only*/, base::DoNothing()); - cookies->SetCanonicalCookieAsync( - net::CanonicalCookie::CreateSanitizedCookie( + cookies->SetCanonicalCookie( + *net::CanonicalCookie::CreateSanitizedCookie( GURL(kGAIACookieURL), kCookieName, cookie_value, std::string(), std::string(), base::Time(), base::Time(), base::Time(), true, false, net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT), - true /*secure_source*/, true /*modify_http_only*/, - net::CookieStore::SetCookiesCallback()); + true /*secure_source*/, true /*modify_http_only*/, base::DoNothing()); GetChannelIDs(browser_context) ->SetChannelID(std::make_unique<net::ChannelIDStore::ChannelID>( @@ -267,9 +266,10 @@ ->http_auth_cache(); } -net::CookieStore* ProfileAuthDataTest::GetCookies( +network::mojom::CookieManager* ProfileAuthDataTest::GetCookies( content::BrowserContext* browser_context) { - return GetRequestContext(browser_context)->cookie_store(); + return content::BrowserContext::GetDefaultStoragePartition(browser_context) + ->GetCookieManagerForBrowserProcess(); } net::ChannelIDStore* ProfileAuthDataTest::GetChannelIDs( @@ -279,16 +279,6 @@ ->GetChannelIDStore(); } -void ProfileAuthDataTest::QuitLoop(const net::CookieList& ignored) { - run_loop_->Quit(); -} - -void ProfileAuthDataTest::StoreCookieListAndQuitLoop( - const net::CookieList& cookie_list) { - user_cookie_list_ = cookie_list; - run_loop_->Quit(); -} - void ProfileAuthDataTest::StoreChannelIDListAndQuitLoop( const net::ChannelIDStore::ChannelIDList& channel_id_list) { user_channel_id_list_ = channel_id_list;
diff --git a/chrome/browser/chromeos/login/session/chrome_session_manager.cc b/chrome/browser/chromeos/login/session/chrome_session_manager.cc index edc7aedb..7d596dab 100644 --- a/chrome/browser/chromeos/login/session/chrome_session_manager.cc +++ b/chrome/browser/chromeos/login/session/chrome_session_manager.cc
@@ -26,6 +26,7 @@ #include "chrome/browser/chromeos/login/login_wizard.h" #include "chrome/browser/chromeos/login/screens/sync_consent_screen.h" #include "chrome/browser/chromeos/login/session/user_session_manager.h" +#include "chrome/browser/chromeos/login/startup_utils.h" #include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/chromeos/policy/app_install_event_log_manager_wrapper.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" @@ -63,7 +64,11 @@ return command_line.HasSwitch(switches::kLoginManager) && !command_line.HasSwitch(switches::kForceLoginManagerInTests) && app_manager->IsAutoLaunchEnabled() && - KioskAppLaunchError::Get() == KioskAppLaunchError::NONE; + KioskAppLaunchError::Get() == KioskAppLaunchError::NONE && + // IsOobeCompleted() is needed to prevent kiosk session start in case + // of enterprise rollback, when keeping the enrollment, policy, not + // clearing TPM, but wiping stateful partition. + StartupUtils::IsOobeCompleted(); } // Starts kiosk app auto launch and shows the splash screen.
diff --git a/chrome/browser/chromeos/login/ui/oobe_ui_dialog_delegate.cc b/chrome/browser/chromeos/login/ui/oobe_ui_dialog_delegate.cc index cf58cae..b3d542d 100644 --- a/chrome/browser/chromeos/login/ui/oobe_ui_dialog_delegate.cc +++ b/chrome/browser/chromeos/login/ui/oobe_ui_dialog_delegate.cc
@@ -67,8 +67,9 @@ public ChromeWebModalDialogManagerDelegate, public web_modal::WebContentsModalDialogHost { public: - explicit CaptivePortalDialogDelegate(content::WebContents* web_contents) - : web_contents_(web_contents) { + explicit CaptivePortalDialogDelegate(views::WebDialogView* host_dialog_view) + : host_view_(host_dialog_view), + web_contents_(host_dialog_view->web_contents()) { view_ = new views::WebDialogView(ProfileHelper::GetSigninProfile(), this, new ChromeWebContentsHandler); view_->SetVisible(false); @@ -106,7 +107,10 @@ // web_modal::WebContentsModalDialogHost: gfx::NativeView GetHostView() const override { - return widget_->GetNativeWindow(); + if (widget_->IsVisible()) + return widget_->GetNativeWindow(); + else + return host_view_->GetWidget()->GetNativeWindow(); } gfx::Point GetDialogPosition(const gfx::Size& size) override { @@ -160,6 +164,7 @@ private: views::Widget* widget_ = nullptr; views::WebDialogView* view_ = nullptr; + views::WebDialogView* host_view_ = nullptr; content::WebContents* web_contents_ = nullptr; DISALLOW_COPY_AND_ASSIGN(CaptivePortalDialogDelegate); @@ -198,8 +203,7 @@ dialog_view_->web_contents()->SetDelegate(this); - captive_portal_delegate_ = - new CaptivePortalDialogDelegate(dialog_view_->web_contents()); + captive_portal_delegate_ = new CaptivePortalDialogDelegate(dialog_view_); GetOobeUI()->GetErrorScreen()->MaybeInitCaptivePortalWindowProxy( dialog_view_->web_contents());
diff --git a/chrome/browser/chromeos/policy/OWNERS b/chrome/browser/chromeos/policy/OWNERS index 6bc31f0..a21f5545 100644 --- a/chrome/browser/chromeos/policy/OWNERS +++ b/chrome/browser/chromeos/policy/OWNERS
@@ -1,9 +1,4 @@ set noparent -atwilson@chromium.org -bartfab@chromium.org -emaxx@chromium.org -pastarmovj@chromium.org -pmarko@chromium.org -poromov@chromium.org +file://chromeos/policy/OWNERS # COMPONENT: Enterprise
diff --git a/chrome/browser/download/download_item_model.cc b/chrome/browser/download/download_item_model.cc index 8a6f6d4e..3c37462 100644 --- a/chrome/browser/download/download_item_model.cc +++ b/chrome/browser/download/download_item_model.cc
@@ -136,10 +136,7 @@ ContentId DownloadItemModel::GetContentId() const { bool off_the_record = content::DownloadItemUtils::GetBrowserContext(download_) ->IsOffTheRecord(); - // Caveat. Create a dummy namespace, so this might be incorrect if used to - // query the provider. After migration to offline items, we shouldn't need - // this. - return ContentId(OfflineItemUtils::GetDownloadNamespacePrefix(off_the_record), + return ContentId(OfflineItemUtils::GetDownloadNamespace(off_the_record), download_->GetGuid()); }
diff --git a/chrome/browser/download/download_offline_content_provider.cc b/chrome/browser/download/download_offline_content_provider.cc index 6a26423b..31d03b18 100644 --- a/chrome/browser/download/download_offline_content_provider.cc +++ b/chrome/browser/download/download_offline_content_provider.cc
@@ -45,14 +45,15 @@ Profile* profile = Profile::FromBrowserContext(manager_->GetBrowserContext()); profile = profile->GetOriginalProfile(); aggregator_ = OfflineContentAggregatorFactory::GetForBrowserContext(profile); - name_space_ = OfflineContentAggregator::CreateUniqueNameSpace( - OfflineItemUtils::GetDownloadNamespacePrefix( - manager_->GetBrowserContext()->IsOffTheRecord())); - aggregator_->RegisterProvider(name_space_, this); + aggregator_->RegisterProvider( + OfflineItemUtils::GetDownloadNamespace( + manager_->GetBrowserContext()->IsOffTheRecord()), + this); } DownloadOfflineContentProvider::~DownloadOfflineContentProvider() { - aggregator_->UnregisterProvider(name_space_); + aggregator_->UnregisterProvider(OfflineItemUtils::GetDownloadNamespace( + manager_->GetBrowserContext()->IsOffTheRecord())); } // TODO(shaktisahu) : Pass DownloadOpenSource. @@ -94,8 +95,7 @@ DownloadItem* item = manager_->GetDownloadByGuid(id.id); auto offline_item = item && ShouldShowDownloadItem(item) - ? base::make_optional( - OfflineItemUtils::CreateOfflineItem(name_space_, item)) + ? base::make_optional(OfflineItemUtils::CreateOfflineItem(item)) : base::nullopt; base::ThreadTaskRunnerHandle::Get()->PostTask( @@ -112,7 +112,7 @@ if (!ShouldShowDownloadItem(item)) continue; - items.push_back(OfflineItemUtils::CreateOfflineItem(name_space_, item)); + items.push_back(OfflineItemUtils::CreateOfflineItem(item)); } base::ThreadTaskRunnerHandle::Get()->PostTask( @@ -180,10 +180,8 @@ if (!ShouldShowDownloadItem(item)) return; - for (auto& observer : observers_) { - observer.OnItemUpdated( - OfflineItemUtils::CreateOfflineItem(name_space_, item)); - } + for (auto& observer : observers_) + observer.OnItemUpdated(OfflineItemUtils::CreateOfflineItem(item)); } void DownloadOfflineContentProvider::OnDownloadRemoved(DownloadManager* manager, @@ -191,7 +189,9 @@ if (!ShouldShowDownloadItem(item)) return; - ContentId contentId(name_space_, item->GetGuid()); + ContentId contentId(OfflineItemUtils::GetDownloadNamespace( + manager_->GetBrowserContext()->IsOffTheRecord()), + item->GetGuid()); for (auto& observer : observers_) observer.OnItemRemoved(contentId); }
diff --git a/chrome/browser/download/download_offline_content_provider.h b/chrome/browser/download/download_offline_content_provider.h index 1aa96dc..aa90035 100644 --- a/chrome/browser/download/download_offline_content_provider.h +++ b/chrome/browser/download/download_offline_content_provider.h
@@ -65,7 +65,6 @@ download::AllDownloadItemNotifier download_notifier_; base::ObserverList<OfflineContentProvider::Observer>::Unchecked observers_; OfflineContentAggregator* aggregator_; - std::string name_space_; base::WeakPtrFactory<DownloadOfflineContentProvider> weak_ptr_factory_;
diff --git a/chrome/browser/download/download_shelf_controller.cc b/chrome/browser/download/download_shelf_controller.cc index 94942ca6..1685aaa 100644 --- a/chrome/browser/download/download_shelf_controller.cc +++ b/chrome/browser/download/download_shelf_controller.cc
@@ -42,9 +42,6 @@ } void DownloadShelfController::OnItemUpdated(const OfflineItem& item) { - if (profile_->IsOffTheRecord() != item.is_off_the_record) - return; - if (OfflineItemUtils::IsDownload(item.id)) return;
diff --git a/chrome/browser/download/notification/download_item_notification_unittest.cc b/chrome/browser/download/notification/download_item_notification_unittest.cc index c14b74b..946ff092 100644 --- a/chrome/browser/download/notification/download_item_notification_unittest.cc +++ b/chrome/browser/download/notification/download_item_notification_unittest.cc
@@ -120,8 +120,7 @@ void CreateDownloadItemNotification() { offline_items_collection::ContentId id( - OfflineItemUtils::GetDownloadNamespacePrefix( - profile_->IsOffTheRecord()), + OfflineItemUtils::GetDownloadNamespace(profile_->IsOffTheRecord()), download_item_->GetGuid()); download_notification_manager_->OnNewDownloadReady(download_item_.get());
diff --git a/chrome/browser/download/offline_item_utils.cc b/chrome/browser/download/offline_item_utils.cc index 7a1fb4a..b7d8333a 100644 --- a/chrome/browser/download/offline_item_utils.cc +++ b/chrome/browser/download/offline_item_utils.cc
@@ -57,14 +57,14 @@ } // namespace -OfflineItem OfflineItemUtils::CreateOfflineItem(const std::string& name_space, - DownloadItem* download_item) { +OfflineItem OfflineItemUtils::CreateOfflineItem(DownloadItem* download_item) { bool off_the_record = content::DownloadItemUtils::GetBrowserContext(download_item) ->IsOffTheRecord(); OfflineItem item; - item.id = ContentId(name_space, download_item->GetGuid()); + item.id = + ContentId(GetDownloadNamespace(off_the_record), download_item->GetGuid()); item.title = download_item->GetFileNameToReportUser().AsUTF8Unsafe(); item.description = download_item->GetFileNameToReportUser().AsUTF8Unsafe(); item.filter = MimeTypeToOfflineItemFilter(download_item->GetMimeType()); @@ -126,8 +126,7 @@ return item; } -std::string OfflineItemUtils::GetDownloadNamespacePrefix( - bool is_off_the_record) { +std::string OfflineItemUtils::GetDownloadNamespace(bool is_off_the_record) { return is_off_the_record ? kDownloadIncognitoNamespace : kDownloadNamespace; }
diff --git a/chrome/browser/download/offline_item_utils.h b/chrome/browser/download/offline_item_utils.h index 829436e..2eeb3d6b 100644 --- a/chrome/browser/download/offline_item_utils.h +++ b/chrome/browser/download/offline_item_utils.h
@@ -18,10 +18,9 @@ class OfflineItemUtils { public: static offline_items_collection::OfflineItem CreateOfflineItem( - const std::string& name_space, download::DownloadItem* item); - static std::string GetDownloadNamespacePrefix(bool is_off_the_record); + static std::string GetDownloadNamespace(bool is_off_the_record); static bool IsDownload(const offline_items_collection::ContentId& id);
diff --git a/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc b/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc index 8d1c434..d4b2f5d 100644 --- a/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc +++ b/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc
@@ -7,6 +7,7 @@ #include <stddef.h> #include "base/callback.h" +#include "base/metrics/histogram_macros.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "chrome/browser/extensions/extension_tab_util.h" @@ -24,6 +25,25 @@ namespace { +// U2FAttestationPromptResult enumerates events related to attestation prompts. +// These values are recorded in an UMA histogram and so should not be +// reassigned. +enum class U2FAttestationPromptResult { + // kQueried indicates that the embedder was queried in order to determine + // whether attestation information should be returned to the origin. + kQueried = 0, + // kAllowed indicates that the query to the embedder was resolved positively. + // (E.g. the user clicked to allow, or the embedder allowed immediately by + // policy.) Note that this may still be recorded if the user clicks to allow + // attestation after the request has timed out. + kAllowed = 1, + // kBlocked indicates that the query to the embedder was resolved negatively. + // (E.g. the user clicked to block, or closed the dialog.) Navigating away or + // closing the tab also fall into this bucket. + kBlocked = 2, + kMaxValue = kBlocked, +}; + const char kGoogleDotCom[] = "google.com"; constexpr const char* kGoogleGstaticAppIds[] = { "https://www.gstatic.com/securitykey/origins.json", @@ -55,6 +75,11 @@ return false; } +void RecordAttestationEvent(U2FAttestationPromptResult event) { + UMA_HISTOGRAM_ENUMERATION("WebAuthentication.U2FAttestationPromptResult", + event); +} + } // namespace namespace extensions { @@ -201,6 +226,7 @@ return RespondNow(Error("no PermissionRequestManager")); } + RecordAttestationEvent(U2FAttestationPromptResult::kQueried); // The created AttestationPermissionRequest deletes itself once complete. permission_request_manager->AddRequest(NewAttestationPermissionRequest( origin, @@ -210,6 +236,8 @@ } void CryptotokenPrivateCanAppIdGetAttestationFunction::Complete(bool result) { + RecordAttestationEvent(result ? U2FAttestationPromptResult::kAllowed + : U2FAttestationPromptResult::kBlocked); Respond(OneArgument(std::make_unique<base::Value>(result))); }
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc b/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc index 40cc910..d2de9d2 100644 --- a/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc +++ b/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc
@@ -9,6 +9,7 @@ #include <memory> #include <utility> +#include "base/feature_list.h" #include "base/macros.h" #include "chrome/browser/chromeos/input_method/input_method_engine.h" #include "chrome/browser/chromeos/login/lock/screen_locker.h" @@ -25,8 +26,8 @@ #include "ui/base/ime/chromeos/extension_ime_util.h" #include "ui/base/ime/chromeos/input_method_manager.h" #include "ui/base/ime/ime_engine_handler_interface.h" +#include "ui/base/ui_base_features.h" #include "ui/keyboard/keyboard_controller.h" -#include "ui/keyboard/keyboard_util.h" namespace input_ime = extensions::api::input_ime; namespace input_method_private = extensions::api::input_method_private; @@ -208,7 +209,7 @@ // event is only for ChromeOS and contains additional information about pen // inputs. We ensure that we only trigger one OnFocus event. if (HasListener(input_method_private::OnFocus::kEventName) && - keyboard::IsStylusVirtualKeyboardEnabled()) { + base::FeatureList::IsEnabled(features::kEnableStylusVirtualKeyboard)) { input_method_private::InputContext input_context; input_context.context_id = context.id; input_context.type = input_method_private::ParseInputContextType(
diff --git a/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc b/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc index e622753..9ee7b74 100644 --- a/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc +++ b/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc
@@ -11,6 +11,7 @@ #include "ash/shell.h" #include "base/bind.h" #include "base/command_line.h" +#include "base/feature_list.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" @@ -21,6 +22,7 @@ #include "chrome/browser/ui/ash/chrome_keyboard_controller_client.h" #include "chrome/browser/ui/chrome_pages.h" #include "chrome/common/url_constants.h" +#include "chromeos/chromeos_features.h" #include "components/user_manager/user_manager.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/service_manager_connection.h" @@ -31,6 +33,7 @@ #include "services/audio/public/cpp/audio_system_factory.h" #include "services/service_manager/public/cpp/connector.h" #include "ui/aura/window_tree_host.h" +#include "ui/base/ui_base_features.h" #include "ui/keyboard/keyboard_controller.h" #include "ui/keyboard/keyboard_switches.h" #include "ui/keyboard/keyboard_util.h" @@ -270,18 +273,29 @@ // TODO(blakeo): once the old flag's usages have been removed from the // extension and all pushes have settled, remove this overly verbose comment. features->AppendString(GenerateFeatureFlag( - "floatingkeyboard", keyboard::IsFloatingVirtualKeyboardEnabled())); - features->AppendString( - GenerateFeatureFlag("gesturetyping", keyboard::IsGestureTypingEnabled())); + "floatingkeyboard", + base::FeatureList::IsEnabled(features::kEnableFloatingVirtualKeyboard))); features->AppendString(GenerateFeatureFlag( - "gestureediting", keyboard::IsGestureEditingEnabled())); + "gesturetyping", !base::CommandLine::ForCurrentProcess()->HasSwitch( + keyboard::switches::kDisableGestureTyping))); + // TODO(shend): Gesture editing is not implemented in the MD UI. + // https://crbug.com/890134. + bool enable_gesture_editing = + !base::FeatureList::IsEnabled(features::kEnableVirtualKeyboardMdUi) && + !base::CommandLine::ForCurrentProcess()->HasSwitch( + keyboard::switches::kDisableGestureEditing); + features->AppendString( + GenerateFeatureFlag("gestureediting", enable_gesture_editing)); features->AppendString(GenerateFeatureFlag( "fullscreenhandwriting", - keyboard::IsFullscreenHandwritingVirtualKeyboardEnabled())); + base::FeatureList::IsEnabled( + features::kEnableFullscreenHandwritingVirtualKeyboard))); features->AppendString(GenerateFeatureFlag( - "virtualkeyboardmdui", keyboard::IsVirtualKeyboardMdUiEnabled())); - features->AppendString( - GenerateFeatureFlag("imeservice", keyboard::IsImeServiceEnabled())); + "virtualkeyboardmdui", + base::FeatureList::IsEnabled(features::kEnableVirtualKeyboardMdUi))); + features->AppendString(GenerateFeatureFlag( + "imeservice", base::FeatureList::IsEnabled( + chromeos::features::kImeServiceConnectable))); auto config = ChromeKeyboardControllerClient::Get()->GetKeyboardConfig(); // TODO(oka): Change this to use config.voice_input.
diff --git a/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc index 11395c83..9a8f598 100644 --- a/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc
@@ -9,8 +9,6 @@ #include "base/macros.h" #include "chrome/common/extensions/extension_test_util.h" #include "chromeos/login/scoped_test_public_session_login_state.h" -#include "content/public/browser/resource_request_info.h" -#include "content/public/common/previews_state.h" #include "content/public/test/test_browser_thread_bundle.h" #include "extensions/browser/api/web_request/web_request_info.h" #include "extensions/browser/api/web_request/web_request_permissions.h" @@ -28,7 +26,6 @@ #include "chromeos/login/login_state.h" #endif // defined(OS_CHROMEOS) -using content::ResourceRequestInfo; using extensions::Extension; using extensions::Manifest; using extensions::PermissionsData; @@ -103,161 +100,27 @@ false); // notifications_disabled } -TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest, TestHideRequestForURL) { - net::TestURLRequestContext context; - - // TODO(karandeepb): Merge some of this test with - // ExtensionWebRequestPermissions.IsSensitiveRequest. - enum HideRequestMask { - HIDE_NONE = 0, - HIDE_RENDERER_REQUEST = 1, - HIDE_SUB_FRAME_NAVIGATION = 2, - HIDE_MAIN_FRAME_NAVIGATION = 4, - HIDE_BROWSER_SUB_RESOURCE_REQUEST = 8, - HIDE_ALL = HIDE_RENDERER_REQUEST | HIDE_SUB_FRAME_NAVIGATION | - HIDE_MAIN_FRAME_NAVIGATION | HIDE_BROWSER_SUB_RESOURCE_REQUEST, - }; - - struct { - std::string url; - int expected_hide_request_mask; - } test_cases[] = { - // clientX.google.com urls. - {"http://clients2.google.com", - HIDE_SUB_FRAME_NAVIGATION | HIDE_BROWSER_SUB_RESOURCE_REQUEST}, - {"http://clients22.google.com", - HIDE_SUB_FRAME_NAVIGATION | HIDE_BROWSER_SUB_RESOURCE_REQUEST}, - {"https://clients2.google.com", - HIDE_SUB_FRAME_NAVIGATION | HIDE_BROWSER_SUB_RESOURCE_REQUEST}, - {"https://clients.google.com", - HIDE_SUB_FRAME_NAVIGATION | HIDE_BROWSER_SUB_RESOURCE_REQUEST}, - {"https://test.clients.google.com", - HIDE_SUB_FRAME_NAVIGATION | HIDE_BROWSER_SUB_RESOURCE_REQUEST}, - - // Sensitive urls. - {"http://clients2.google.com/service/update2/crx", HIDE_ALL}, - {"https://clients2.google.com/service/update2/crx", HIDE_ALL}, - {"http://www.gstatic.com/chrome/extensions/blacklist", HIDE_ALL}, - {"https://www.gstatic.com/chrome/extensions/blacklist", HIDE_ALL}, - {"https://chrome.google.com/webstore/", HIDE_ALL}, - {"https://chrome.google.com/webstore/inlineinstall/detail/" - "kcnhkahnjcbndmmehfkdnkjomaanaooo", - HIDE_ALL}, - - // Scheme not allowed by web request api. - {"notregisteredscheme://www.foobar.com", HIDE_ALL}, - - // Non-sensitive url. - {"http://www.google.com/", HIDE_BROWSER_SUB_RESOURCE_REQUEST}, - }; - - const int kRendererProcessId = 2; - const int kBrowserProcessId = -1; - - // Returns a WebRequestInfo instance constructed as per the given parameters. - auto create_request = [](const GURL& url, content::ResourceType type, - int render_process_id) { +// Ensures that requests to extension blacklist urls can't be intercepted by +// extensions. +TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest, + BlacklistUpdateUrlsHidden) { + auto create_request = [](const std::string& url) { + const int kRendererProcessId = 2; WebRequestInfo request; - request.url = url; - request.type = type; - request.render_process_id = render_process_id; - - request.web_request_type = extensions::ToWebRequestResourceType(type); - request.is_browser_side_navigation = - type == content::RESOURCE_TYPE_MAIN_FRAME || - type == content::RESOURCE_TYPE_SUB_FRAME; + request.url = GURL(url); + request.render_process_id = kRendererProcessId; return request; }; - for (const auto& test_case : test_cases) { - SCOPED_TRACE(test_case.url); + WebRequestInfo request = + create_request("http://www.gstatic.com/chrome/extensions/blacklist"); + EXPECT_TRUE( + WebRequestPermissions::HideRequest(extension_info_map_.get(), request)); - GURL request_url(test_case.url); - ASSERT_TRUE(request_url.is_valid()); - - { - SCOPED_TRACE("Renderer initiated sub-resource request"); - WebRequestInfo request = create_request( - request_url, content::RESOURCE_TYPE_SUB_RESOURCE, kRendererProcessId); - bool expect_hidden = - test_case.expected_hide_request_mask & HIDE_RENDERER_REQUEST; - EXPECT_EQ(expect_hidden, WebRequestPermissions::HideRequest( - extension_info_map_.get(), request)); - } - - { - SCOPED_TRACE("Browser initiated sub-resource request"); - WebRequestInfo request = create_request( - request_url, content::RESOURCE_TYPE_SUB_RESOURCE, kBrowserProcessId); - bool expect_hidden = test_case.expected_hide_request_mask & - HIDE_BROWSER_SUB_RESOURCE_REQUEST; - EXPECT_EQ(expect_hidden, WebRequestPermissions::HideRequest( - extension_info_map_.get(), request)); - } - - { - SCOPED_TRACE("Main-frame navigation"); - WebRequestInfo request = create_request( - request_url, content::RESOURCE_TYPE_MAIN_FRAME, kBrowserProcessId); - bool expect_hidden = - test_case.expected_hide_request_mask & HIDE_MAIN_FRAME_NAVIGATION; - EXPECT_EQ(expect_hidden, WebRequestPermissions::HideRequest( - extension_info_map_.get(), request)); - } - - { - SCOPED_TRACE("Sub-frame navigation"); - WebRequestInfo request = create_request( - request_url, content::RESOURCE_TYPE_SUB_FRAME, kBrowserProcessId); - bool expect_hidden = - test_case.expected_hide_request_mask & HIDE_SUB_FRAME_NAVIGATION; - EXPECT_EQ(expect_hidden, WebRequestPermissions::HideRequest( - extension_info_map_.get(), request)); - } - } - - // Check protection of requests originating from the frame showing the Chrome - // WebStore. - // Normally this request is not protected: - GURL non_sensitive_url("http://www.google.com/test.js"); - std::unique_ptr<net::URLRequest> non_sensitive_request( - context.CreateRequest(non_sensitive_url, net::DEFAULT_PRIORITY, NULL, - TRAFFIC_ANNOTATION_FOR_TESTS)); - WebRequestInfo non_sensitive_request_info(non_sensitive_request.get()); - non_sensitive_request_info.render_process_id = kRendererProcessId; - EXPECT_FALSE(WebRequestPermissions::HideRequest(extension_info_map_.get(), - non_sensitive_request_info)); - // If the origin is labeled by the WebStoreAppId, it becomes protected. - { - int process_id = 42; - int site_instance_id = 23; - int view_id = 17; - std::unique_ptr<net::URLRequest> sensitive_request( - context.CreateRequest(non_sensitive_url, net::DEFAULT_PRIORITY, NULL, - TRAFFIC_ANNOTATION_FOR_TESTS)); - ResourceRequestInfo::AllocateForTesting( - sensitive_request.get(), content::RESOURCE_TYPE_SCRIPT, NULL, - process_id, view_id, MSG_ROUTING_NONE, - /*is_main_frame=*/false, - /*allow_download=*/true, - /*is_async=*/false, content::PREVIEWS_OFF, - /*navigation_ui_data*/ nullptr); - extension_info_map_->RegisterExtensionProcess(extensions::kWebStoreAppId, - process_id, site_instance_id); - WebRequestInfo sensitive_request_info(sensitive_request.get()); - EXPECT_TRUE(WebRequestPermissions::HideRequest(extension_info_map_.get(), - sensitive_request_info)); - } - - // Check that requests are for a non-sensitive URL is rejected if it's a PAC - // script fetch. - std::unique_ptr<net::URLRequest> request( - context.CreateRequest(non_sensitive_url, net::DEFAULT_PRIORITY, NULL, - TRAFFIC_ANNOTATION_FOR_TESTS)); - request->set_is_pac_request(true); - WebRequestInfo request_info(request.get()); - EXPECT_TRUE(WebRequestPermissions::HideRequest(extension_info_map_.get(), - request_info)); + request = + create_request("https://www.gstatic.com/chrome/extensions/blacklist"); + EXPECT_TRUE( + WebRequestPermissions::HideRequest(extension_info_map_.get(), request)); } TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest,
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index ce4ed50..27dc10f4 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -2956,11 +2956,6 @@ const char kMacTouchBarName[] = "Hardware Touch Bar"; const char kMacTouchBarDescription[] = "Control the use of the Touch Bar."; -const char kMacV2SandboxName[] = "Mac V2 Sandbox"; -const char kMacV2SandboxDescription[] = - "Eliminates the unsandboxed warmup phase and sandboxes processes for their " - "entire life cycle."; - const char kMacViewsNativeAppWindowsName[] = "Toolkit-Views App Windows."; const char kMacViewsNativeAppWindowsDescription[] = "Controls whether to use Toolkit-Views based Chrome App windows.";
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 1baf611..e69c61d 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -1786,9 +1786,6 @@ extern const char kMacTouchBarName[]; extern const char kMacTouchBarDescription[]; -extern const char kMacV2SandboxName[]; -extern const char kMacV2SandboxDescription[]; - extern const char kMacViewsNativeAppWindowsName[]; extern const char kMacViewsNativeAppWindowsDescription[];
diff --git a/chrome/browser/metrics/ukm_browsertest.cc b/chrome/browser/metrics/ukm_browsertest.cc index 77b7181..1f0ca2a 100644 --- a/chrome/browser/metrics/ukm_browsertest.cc +++ b/chrome/browser/metrics/ukm_browsertest.cc
@@ -5,6 +5,7 @@ #include <memory> #include "base/run_loop.h" +#include "base/stl_util.h" #include "base/strings/string_util.h" #include "base/sys_info.h" #include "build/build_config.h" @@ -177,7 +178,7 @@ } bool HasSource(ukm::SourceId source_id) const { auto* service = ukm_service(); - return service ? !!service->sources().count(source_id) : false; + return service && base::ContainsKey(service->sources(), source_id); } void RecordDummySource(ukm::SourceId source_id) { auto* service = ukm_service();
diff --git a/chrome/browser/navigation_predictor/navigation_predictor.cc b/chrome/browser/navigation_predictor/navigation_predictor.cc index 1aaa595..1658fa8d 100644 --- a/chrome/browser/navigation_predictor/navigation_predictor.cc +++ b/chrome/browser/navigation_predictor/navigation_predictor.cc
@@ -38,10 +38,45 @@ NavigationPredictor::NavigationPredictor( content::RenderFrameHost* render_frame_host) : browser_context_( - render_frame_host->GetSiteInstance()->GetBrowserContext()) { + render_frame_host->GetSiteInstance()->GetBrowserContext()), + ratio_area_scale_(base::GetFieldTrialParamByFeatureAsInt( + blink::features::kRecordAnchorMetricsVisible, + "ratio_area_scale", + 100)), + is_in_iframe_scale_(base::GetFieldTrialParamByFeatureAsInt( + blink::features::kRecordAnchorMetricsVisible, + "is_in_iframe_scale", + 0)), + is_same_host_scale_(base::GetFieldTrialParamByFeatureAsInt( + blink::features::kRecordAnchorMetricsVisible, + "is_same_host_scale", + 0)), + contains_image_scale_(base::GetFieldTrialParamByFeatureAsInt( + blink::features::kRecordAnchorMetricsVisible, + "contains_image_scale", + 50)), + is_url_incremented_scale_(base::GetFieldTrialParamByFeatureAsInt( + blink::features::kRecordAnchorMetricsVisible, + "is_url_incremented_scale", + 100)), + source_engagement_score_scale_(base::GetFieldTrialParamByFeatureAsInt( + blink::features::kRecordAnchorMetricsVisible, + "source_engagement_score_scale", + 100)), + target_engagement_score_scale_(base::GetFieldTrialParamByFeatureAsInt( + blink::features::kRecordAnchorMetricsVisible, + "target_engagement_score_scale", + 100)), + area_rank_scale_(base::GetFieldTrialParamByFeatureAsInt( + blink::features::kRecordAnchorMetricsVisible, + "area_rank_scale", + 100)), + sum_scales_(ratio_area_scale_ + is_in_iframe_scale_ + + is_same_host_scale_ + contains_image_scale_ + + is_url_incremented_scale_ + source_engagement_score_scale_ + + target_engagement_score_scale_ + area_rank_scale_) { DCHECK(browser_context_); DETACH_FROM_SEQUENCE(sequence_checker_); - InitializeFieldTrialMetricScales(); } NavigationPredictor::~NavigationPredictor() { @@ -66,25 +101,6 @@ metric.source_url.SchemeIsHTTPOrHTTPS(); } -void NavigationPredictor::InitializeFieldTrialMetricScales() { - const base::Feature& feature = blink::features::kRecordAnchorMetricsVisible; - ratio_area_scale_ = base::GetFieldTrialParamByFeatureAsInt( - feature, "ratio_area_scale", ratio_area_scale_); - is_in_iframe_scale_ = base::GetFieldTrialParamByFeatureAsInt( - feature, "is_in_iframe_scale", is_in_iframe_scale_); - is_same_host_scale_ = base::GetFieldTrialParamByFeatureAsInt( - feature, "is_same_host_scale", is_same_host_scale_); - contains_image_scale_ = base::GetFieldTrialParamByFeatureAsInt( - feature, "contains_image_scale", contains_image_scale_); - is_url_incremented_scale_ = base::GetFieldTrialParamByFeatureAsInt( - feature, "is_url_incremented_scale", is_url_incremented_scale_); - source_engagement_score_scale_ = base::GetFieldTrialParamByFeatureAsInt( - feature, "source_engagement_score_scale", source_engagement_score_scale_); - target_engagement_score_scale_ = base::GetFieldTrialParamByFeatureAsInt( - feature, "target_engagement_score_scale", target_engagement_score_scale_); - area_rank_scale_ = base::GetFieldTrialParamByFeatureAsInt( - feature, "area_rank_scale", area_rank_scale_); -} void NavigationPredictor::RecordTimingOnClick() { base::TimeTicks current_timing = base::TimeTicks::Now(); @@ -364,16 +380,61 @@ double target_engagement_score, int area_rank, int number_of_anchors) const { + if (sum_scales_ == 0) + return 0.0; + + double max_engagement_points = GetEngagementService()->GetMaxPoints(); + document_engagement_score /= max_engagement_points; + target_engagement_score /= max_engagement_points; + + double area_rank_score = + (double)((number_of_anchors - area_rank)) / number_of_anchors; + + DCHECK_LE(0, metrics.ratio_visible_area); + // TODO(tbansal): https://crbug.com/891719. Disable the check until the bug + // for duplicate anchor elements is fixed. + // DCHECK_GE(1, metrics.ratio_visible_area); + + DCHECK_LE(0, metrics.is_in_iframe); + DCHECK_GE(1, metrics.is_in_iframe); + + DCHECK_LE(0, metrics.is_same_host); + DCHECK_GE(1, metrics.is_same_host); + + DCHECK_LE(0, metrics.contains_image); + DCHECK_GE(1, metrics.contains_image); + + DCHECK_LE(0, metrics.is_url_incremented_by_one); + DCHECK_GE(1, metrics.is_url_incremented_by_one); + + DCHECK_LE(0, document_engagement_score); + DCHECK_GE(1, document_engagement_score); + + DCHECK_LE(0, target_engagement_score); + DCHECK_GE(1, target_engagement_score); + + DCHECK_LE(0, area_rank_score); + DCHECK_GE(1, area_rank_score); + // TODO(chelu): https://crbug.com/850624/. Experiment with other heuristic // algorithms for computing the anchor elements score. - return ratio_area_scale_ * metrics.ratio_visible_area + - is_same_host_scale_ * metrics.is_same_host + - contains_image_scale_ * metrics.contains_image + - is_in_iframe_scale_ * metrics.is_in_iframe + - is_url_incremented_scale_ * metrics.is_url_incremented_by_one + - source_engagement_score_scale_ * document_engagement_score + - target_engagement_score_scale_ * target_engagement_score + - area_rank_scale_ * (number_of_anchors - area_rank); + double score = ratio_area_scale_ * metrics.ratio_visible_area + + is_in_iframe_scale_ * metrics.is_in_iframe + + is_same_host_scale_ * metrics.is_same_host + + contains_image_scale_ * metrics.contains_image + + is_url_incremented_scale_ * metrics.is_url_incremented_by_one + + source_engagement_score_scale_ * document_engagement_score + + target_engagement_score_scale_ * target_engagement_score + + area_rank_scale_ * (area_rank_score); + + // Normalize to 100. + score = score / sum_scales_ * 100.0; + DCHECK_LE(0.0, score); + + // TODO(tbansal): https://crbug.com/891719. Disable the check until the bug + // for duplicate anchor elements is fixed. + // DCHECK_GE(100.0, score); + return score; } void NavigationPredictor::MaybeTakeActionOnLoad(
diff --git a/chrome/browser/navigation_predictor/navigation_predictor.h b/chrome/browser/navigation_predictor/navigation_predictor.h index b01ef8dce..7f10df7 100644 --- a/chrome/browser/navigation_predictor/navigation_predictor.h +++ b/chrome/browser/navigation_predictor/navigation_predictor.h
@@ -52,10 +52,6 @@ bool IsValidMetricFromRenderer( const blink::mojom::AnchorElementMetrics& metric) const; - // Retrieve scaling factors for each metric from Finch and save to this class. - // These scales are used to compute navigation scores. - void InitializeFieldTrialMetricScales(); - // Returns site engagement service, which can be used to get site engagement // score. Return value is guaranteed to be non-null. SiteEngagementService* GetEngagementService() const; @@ -107,14 +103,17 @@ int number_of_anchors_url_incremented_ = 0; // Scaling factors used to compute navigation scores. - int ratio_area_scale_ = 100; - int is_same_host_scale_ = 0; - int contains_image_scale_ = 0; - int is_in_iframe_scale_ = 0; - int is_url_incremented_scale_ = 0; - int source_engagement_score_scale_ = 0; - int target_engagement_score_scale_ = 0; - int area_rank_scale_ = 0; + const int ratio_area_scale_; + const int is_in_iframe_scale_; + const int is_same_host_scale_; + const int contains_image_scale_; + const int is_url_incremented_scale_; + const int source_engagement_score_scale_; + const int target_engagement_score_scale_; + const int area_rank_scale_; + + // Sum of all scales. Used to normalize the final computed weight. + const int sum_scales_; // Timing of document loaded and last click. base::TimeTicks document_loaded_timing_;
diff --git a/chrome/browser/previews/previews_lite_page_browsertest.cc b/chrome/browser/previews/previews_lite_page_browsertest.cc index cd51c6c..04b7edb 100644 --- a/chrome/browser/previews/previews_lite_page_browsertest.cc +++ b/chrome/browser/previews/previews_lite_page_browsertest.cc
@@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stdint.h> #include <map> #include <memory> #include <string> @@ -30,7 +31,11 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_test_utils.h" +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h" +#include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h" +#include "components/data_reduction_proxy/proto/data_store.pb.h" #include "components/infobars/core/infobar.h" +#include "components/prefs/pref_service.h" #include "components/previews/core/previews_features.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" @@ -216,6 +221,47 @@ EXPECT_EQ(content::PAGE_TYPE_ERROR, entry->GetPageType()); } + void ResetDataSavings() const { + DataReductionProxyChromeSettingsFactory::GetForBrowserContext( + browser()->profile()) + ->data_reduction_proxy_service() + ->compression_stats() + ->ResetStatistics(); + } + + // Gets the data usage recorded against the host the origin server runs on. + uint64_t GetDataUsage() const { + const auto& data_usage_map = + DataReductionProxyChromeSettingsFactory::GetForBrowserContext( + browser()->profile()) + ->data_reduction_proxy_service() + ->compression_stats() + ->DataUsageMapForTesting(); + const auto& it = + data_usage_map.find(https_server_->host_port_pair().host()); + if (it != data_usage_map.end()) + return it->second->data_used(); + return 0; + } + + // Gets the data usage recorded against all hosts. + uint64_t GetTotalDataUsage() const { + return DataReductionProxyChromeSettingsFactory::GetForBrowserContext( + browser()->profile()) + ->data_reduction_proxy_service() + ->compression_stats() + ->GetHttpReceivedContentLength(); + } + + // Gets the original content length recorded against all hosts. + uint64_t GetTotalOriginalContentLength() const { + return DataReductionProxyChromeSettingsFactory::GetForBrowserContext( + browser()->profile()) + ->data_reduction_proxy_service() + ->compression_stats() + ->GetHttpOriginalContentLength(); + } + // Returns a HTTP URL that will respond with the given HTTP response code and // headers when used by the previews server. The response can be delayed a // number of milliseconds by passing a value > 0 for |delay_ms| or pass -1 to @@ -354,6 +400,8 @@ switch (return_code) { case 200: response->set_code(net::HTTP_OK); + response->set_content("porgporgporgporgporg" /* length = 20 */); + response->AddCustomHeader("chrome-proxy", "ofcl=60"); break; case 307: response->set_code(net::HTTP_TEMPORARY_REDIRECT); @@ -658,6 +706,32 @@ VerifyPreviewLoaded(); } +// Previews InfoBar (which these tests trigger) does not work on Mac. +// See https://crbug.com/782322 for detail. +// Also occasional flakes on win7 (https://crbug.com/789542). +#if defined(OS_ANDROID) || defined(OS_LINUX) +#define MAYBE_LitePagePreviewsReportSavings LitePagePreviewsReportSavings +#else +#define MAYBE_LitePagePreviewsReportSavings \ + DISABLED_LitePagePreviewsReportSavings +#endif +IN_PROC_BROWSER_TEST_F(PreviewsLitePageServerBrowserTest, + MAYBE_LitePagePreviewsReportSavings) { + PrefService* prefs = browser()->profile()->GetPrefs(); + prefs->SetBoolean(data_reduction_proxy::prefs::kDataUsageReportingEnabled, + true); + // Give the setting notification a chance to propagate. + base::RunLoop().RunUntilIdle(); + + ResetDataSavings(); + + ui_test_utils::NavigateToURL(browser(), HttpsLitePageURL(200)); + VerifyPreviewLoaded(); + + EXPECT_EQ(GetTotalOriginalContentLength() - GetTotalDataUsage(), 40U); + EXPECT_EQ(GetDataUsage(), 20U); +} + class PreviewsLitePageServerTimeoutBrowserTest : public PreviewsLitePageServerBrowserTest { public:
diff --git a/chrome/browser/previews/previews_lite_page_decider.cc b/chrome/browser/previews/previews_lite_page_decider.cc index 3a02baeb..eed0629 100644 --- a/chrome/browser/previews/previews_lite_page_decider.cc +++ b/chrome/browser/previews/previews_lite_page_decider.cc
@@ -8,6 +8,7 @@ #include "base/memory/ptr_util.h" #include "base/rand_util.h" #include "base/time/default_tick_clock.h" +#include "build/build_config.h" #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h" #include "chrome/browser/previews/previews_lite_page_infobar_delegate.h" @@ -15,6 +16,10 @@ #include "chrome/browser/previews/previews_service.h" #include "chrome/browser/previews/previews_service_factory.h" #include "chrome/browser/profiles/profile.h" +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics.h" +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h" +#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" +#include "components/data_use_measurement/core/data_use_user_data.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_service.h" #include "components/previews/core/previews_experiments.h" @@ -246,6 +251,25 @@ return ++page_id_; } +void PreviewsLitePageDecider::ReportDataSavings(int64_t network_bytes, + int64_t original_bytes, + const std::string& host) { + if (!drp_settings_ || !drp_settings_->data_reduction_proxy_service()) + return; + + drp_settings_->data_reduction_proxy_service()->UpdateDataUseForHost( + network_bytes, original_bytes, host); + + drp_settings_->data_reduction_proxy_service()->UpdateContentLengths( + network_bytes, original_bytes, true /* data_reduction_proxy_enabled */, + data_reduction_proxy::DataReductionProxyRequestType:: + VIA_DATA_REDUCTION_PROXY, + "text/html", true /* is_user_traffic */, + data_use_measurement::DataUseUserData::DataUseContentType:: + MAIN_FRAME_HTML, + 0); +} + bool PreviewsLitePageDecider::NeedsToNotifyUser() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return need_to_show_notification_;
diff --git a/chrome/browser/previews/previews_lite_page_decider.h b/chrome/browser/previews/previews_lite_page_decider.h index 83a6107d..ec471fe 100644 --- a/chrome/browser/previews/previews_lite_page_decider.h +++ b/chrome/browser/previews/previews_lite_page_decider.h
@@ -75,6 +75,9 @@ void AddSingleBypass(std::string url) override; bool CheckSingleBypass(std::string url) override; uint64_t GeneratePageID() override; + void ReportDataSavings(int64_t network_bytes, + int64_t original_bytes, + const std::string& host) override; bool NeedsToNotifyUser() override; void NotifyUser(content::WebContents* web_contents) override;
diff --git a/chrome/browser/previews/previews_lite_page_infobar_delegate.cc b/chrome/browser/previews/previews_lite_page_infobar_delegate.cc index e24cb2c5..97044d1 100644 --- a/chrome/browser/previews/previews_lite_page_infobar_delegate.cc +++ b/chrome/browser/previews/previews_lite_page_infobar_delegate.cc
@@ -15,6 +15,11 @@ #include "content/public/browser/web_contents.h" #include "ui/base/l10n/l10n_util.h" +#if defined(OS_ANDROID) +#include "chrome/browser/android/android_theme_resources.h" +#include "chrome/browser/ui/android/infobars/previews_lite_page_infobar.h" +#endif + namespace { void RecordInfoBarAction( @@ -35,8 +40,14 @@ std::unique_ptr<PreviewsLitePageInfoBarDelegate> delegate( new PreviewsLitePageInfoBarDelegate()); +#if defined(OS_ANDROID) + std::unique_ptr<infobars::InfoBar> infobar_ptr( + PreviewsLitePageInfoBar::CreateInfoBar(infobar_service, + std::move(delegate))); +#else std::unique_ptr<infobars::InfoBar> infobar_ptr( infobar_service->CreateConfirmInfoBar(std::move(delegate))); +#endif RecordInfoBarAction(kInfoBarShown); infobar_service->AddInfoBar(std::move(infobar_ptr)); @@ -50,13 +61,6 @@ return LITE_PAGE_PREVIEWS_INFOBAR; } -// TODO(robertogden): Add link on Android. - -int PreviewsLitePageInfoBarDelegate::GetIconId() const { - // TODO(robertogden): Add an Android icon. - return kNoIconID; -} - void PreviewsLitePageInfoBarDelegate::InfoBarDismissed() { RecordInfoBarAction(kInfoBarDismissed); } @@ -68,3 +72,19 @@ int PreviewsLitePageInfoBarDelegate::GetButtons() const { return BUTTON_NONE; } + +#if defined(OS_ANDROID) +int PreviewsLitePageInfoBarDelegate::GetIconId() const { + return IDR_ANDROID_INFOBAR_PREVIEWS; +} + +base::string16 PreviewsLitePageInfoBarDelegate::GetLinkText() const { + return l10n_util::GetStringUTF16(IDS_LITE_PAGE_PREVIEWS_SETTINGS_LINK); +} + +bool PreviewsLitePageInfoBarDelegate::LinkClicked( + WindowOpenDisposition disposition) { + RecordInfoBarAction(kInfoBarLinkClicked); + return true; +} +#endif
diff --git a/chrome/browser/previews/previews_lite_page_infobar_delegate.h b/chrome/browser/previews/previews_lite_page_infobar_delegate.h index 1a361db..767f23c 100644 --- a/chrome/browser/previews/previews_lite_page_infobar_delegate.h +++ b/chrome/browser/previews/previews_lite_page_infobar_delegate.h
@@ -9,6 +9,7 @@ #include "base/strings/string16.h" #include "base/time/tick_clock.h" #include "base/time/time.h" +#include "build/build_config.h" #include "components/infobars/core/confirm_infobar_delegate.h" namespace content { @@ -26,7 +27,8 @@ enum PreviewsLitePageInfoBarAction { kInfoBarShown = 0, kInfoBarDismissed = 1, - kMaxValue = kInfoBarDismissed, + kInfoBarLinkClicked = 2, + kMaxValue = kInfoBarLinkClicked, }; // Shows the InfoBar. @@ -39,8 +41,12 @@ infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; void InfoBarDismissed() override; int GetButtons() const override; - int GetIconId() const override; base::string16 GetMessageText() const override; +#if defined(OS_ANDROID) + int GetIconId() const override; + base::string16 GetLinkText() const override; + bool LinkClicked(WindowOpenDisposition disposition) override; +#endif DISALLOW_COPY_AND_ASSIGN(PreviewsLitePageInfoBarDelegate); };
diff --git a/chrome/browser/previews/previews_lite_page_infobar_delegate_unittest.cc b/chrome/browser/previews/previews_lite_page_infobar_delegate_unittest.cc index 09a5815..a3c8837 100644 --- a/chrome/browser/previews/previews_lite_page_infobar_delegate_unittest.cc +++ b/chrome/browser/previews/previews_lite_page_infobar_delegate_unittest.cc
@@ -17,6 +17,10 @@ #include "components/previews/core/previews_features.h" #include "ui/base/l10n/l10n_util.h" +#if defined(OS_ANDROID) +#include "chrome/browser/android/android_theme_resources.h" +#endif + class PreviewsLitePageInfoBarDelegateUnitTest : public ChromeRenderViewHostTestHarness { protected: @@ -73,6 +77,12 @@ ASSERT_TRUE(infobar); ASSERT_EQ(l10n_util::GetStringUTF16(IDS_LITE_PAGE_PREVIEWS_MESSAGE), infobar->GetMessageText()); +#if defined(OS_ANDROID) + ASSERT_EQ(l10n_util::GetStringUTF16(IDS_LITE_PAGE_PREVIEWS_SETTINGS_LINK), + infobar->GetLinkText()); + ASSERT_EQ(IDR_ANDROID_INFOBAR_PREVIEWS, infobar->GetIconId()); +#else ASSERT_EQ(base::string16(), infobar->GetLinkText()); ASSERT_EQ(PreviewsLitePageInfoBarDelegate::kNoIconID, infobar->GetIconId()); +#endif }
diff --git a/chrome/browser/previews/previews_lite_page_navigation_throttle.cc b/chrome/browser/previews/previews_lite_page_navigation_throttle.cc index 4992c3e..7bca863c 100644 --- a/chrome/browser/previews/previews_lite_page_navigation_throttle.cc +++ b/chrome/browser/previews/previews_lite_page_navigation_throttle.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/previews/previews_lite_page_navigation_throttle.h" +#include <stdint.h> #include <string> #include <unordered_set> #include <vector> @@ -430,8 +431,17 @@ const int response_code = response_headers->response_code(); if (response_code == net::HTTP_OK) { + // Attempt to get the original content length and report it to Data Saver. + const int64_t ofcl = + data_reduction_proxy::GetDataReductionProxyOFCL(response_headers); + if (ofcl > 0) { + manager_->ReportDataSavings(response_headers->GetContentLength(), ofcl, + GURL(original_url).host()); + } + UMA_HISTOGRAM_ENUMERATION("Previews.ServerLitePage.ServerResponse", ServerResponse::kOk); + return content::NavigationThrottle::PROCEED; }
diff --git a/chrome/browser/previews/previews_lite_page_navigation_throttle_manager.h b/chrome/browser/previews/previews_lite_page_navigation_throttle_manager.h index 7ea111f..b524042 100644 --- a/chrome/browser/previews/previews_lite_page_navigation_throttle_manager.h +++ b/chrome/browser/previews/previews_lite_page_navigation_throttle_manager.h
@@ -38,6 +38,11 @@ // Generates a new page id for a request to the previews server. virtual uint64_t GeneratePageID() = 0; + // Reports data savings to Data Saver. + virtual void ReportDataSavings(int64_t network_bytes, + int64_t original_bytes, + const std::string& host) = 0; + // Note: |NeedsToToNotify| is intentionally separate from |NotifyUser| for // ease of testing and metrics collection without changing the notification // state.
diff --git a/chrome/browser/resources/chromeos/select_to_speak/paragraph_utils.js b/chrome/browser/resources/chromeos/select_to_speak/paragraph_utils.js index 2d39ee0..c100ffd0 100644 --- a/chrome/browser/resources/chromeos/select_to_speak/paragraph_utils.js +++ b/chrome/browser/resources/chromeos/select_to_speak/paragraph_utils.js
@@ -23,11 +23,12 @@ if (parent == root) { return parent; } - if (parent.role == RoleType.PARAGRAPH) { + if (parent.role == RoleType.PARAGRAPH || parent.role == RoleType.SVG_ROOT) { return parent; } if (parent.display !== undefined && parent.display != 'inline' && - parent.role != RoleType.STATIC_TEXT) { + parent.role != RoleType.STATIC_TEXT && + (parent.parent && parent.parent.role != RoleType.SVG_ROOT)) { return parent; } parent = parent.parent; @@ -215,7 +216,8 @@ result.nodes.push(newNode); } } - if (!ParagraphUtils.inSameParagraph(node, next)) { + if (index + 1 >= nodes.length || + !ParagraphUtils.inSameParagraph(node, next)) { break; } index += 1;
diff --git a/chrome/browser/resources/chromeos/select_to_speak/paragraph_utils_unittest.gtestjs b/chrome/browser/resources/chromeos/select_to_speak/paragraph_utils_unittest.gtestjs index ccbf96c..047bb6f4d 100644 --- a/chrome/browser/resources/chromeos/select_to_speak/paragraph_utils_unittest.gtestjs +++ b/chrome/browser/resources/chromeos/select_to_speak/paragraph_utils_unittest.gtestjs
@@ -37,6 +37,20 @@ assertEquals(div, ParagraphUtils.getFirstBlockAncestor(text4)); }); +TEST_F('SelectToSpeakParagraphUnitTest', 'SVGRootIsBlockAncestor', function() { + let root = {role: 'rootWebArea'}; + let svgRoot = {role: 'svgRoot', parent: root, root: root}; + let text1 = {role: 'staticText', parent: svgRoot, root: root}; + let inline1 = {role: 'inlineTextBox', parent: text1, root: root}; + let text2 = {role: 'staticText', parent: svgRoot, root: root}; + let inline2 = {role: 'inlineTextBox', parent: text2, root: root}; + assertEquals(svgRoot, ParagraphUtils.getFirstBlockAncestor(text1)); + assertEquals(svgRoot, ParagraphUtils.getFirstBlockAncestor(inline1)); + assertEquals(svgRoot, ParagraphUtils.getFirstBlockAncestor(inline2)); + assertTrue(ParagraphUtils.inSameParagraph(inline1, inline2)); +}); + + TEST_F('SelectToSpeakParagraphUnitTest', 'InSameParagraph', function() { let root = {role: 'rootWebArea'}; let paragraph1 = {role: 'paragraph', display: 'block', parent: 'rootWebArea', @@ -201,4 +215,18 @@ searchBar.value = ''; result = ParagraphUtils.buildNodeGroup([searchBar], 0); assertEquals('Address and search bar ', result.text); -}); \ No newline at end of file +}); + +TEST_F('SelectToSpeakParagraphUnitTest', 'BuildNodeGroupWithSvg', function() { + let root = {role: 'rootWebArea'}; + let svgRoot = {role: 'svgRoot', parent: root, root: root}; + let text1 = {role: 'staticText', parent: svgRoot, root: root, name: 'Hello,'}; + let inline1 = {role: 'inlineTextBox', parent: text1, root: root, + name: 'Hello,'}; + let text2 = {role: 'staticText', parent: svgRoot, root: root, name: 'world!'}; + let inline2 = {role: 'inlineTextBox', parent: text2, root: root, + name: 'world!'}; + + let result = ParagraphUtils.buildNodeGroup([inline1, inline2], 0); + assertEquals('Hello, world! ', result.text); +});
diff --git a/chrome/browser/resources/chromeos/select_to_speak/select_to_speak.js b/chrome/browser/resources/chromeos/select_to_speak/select_to_speak.js index ca5ab0b..ff8eeaf4d 100644 --- a/chrome/browser/resources/chromeos/select_to_speak/select_to_speak.js +++ b/chrome/browser/resources/chromeos/select_to_speak/select_to_speak.js
@@ -635,8 +635,10 @@ this.currentNodeGroupIndex_ += 1; this.currentNode_ = next; this.currentNodeWord_ = null; - next = nodeGroup.nodes[this.currentNodeGroupIndex_ + 1]; nodeUpdated = true; + if (this.currentNodeGroupIndex_ + 1 >= nodeGroup.nodes.length) + break; + next = nodeGroup.nodes[this.currentNodeGroupIndex_ + 1]; } if (nodeUpdated) { if (!this.prefsManager_.wordHighlightingEnabled()) {
diff --git a/chrome/browser/resources/chromeos/select_to_speak/test_support.js b/chrome/browser/resources/chromeos/select_to_speak/test_support.js index 911b931e..f320cd3 100644 --- a/chrome/browser/resources/chromeos/select_to_speak/test_support.js +++ b/chrome/browser/resources/chromeos/select_to_speak/test_support.js
@@ -26,6 +26,7 @@ RADIO_BUTTON: 'radioButton', ROOT_WEB_AREA: 'rootWebArea', STATIC_TEXT: 'staticText', + SVG_ROOT: 'svgRoot', TEXT_FIELD: 'textField', WINDOW: 'window' };
diff --git a/chrome/browser/resources/print_preview/new/advanced_options_settings.html b/chrome/browser/resources/print_preview/new/advanced_options_settings.html index a7f252c..b0cc55f 100644 --- a/chrome/browser/resources/print_preview/new/advanced_options_settings.html +++ b/chrome/browser/resources/print_preview/new/advanced_options_settings.html
@@ -26,7 +26,7 @@ <div slot="controls"> <paper-button id="button" disabled$="[[disabled]]" on-click="onButtonClick_"> - $i18n{showAdvancedOptions} + $i18n{newShowAdvancedOptions} </paper-button> </div> </print-preview-settings-section>
diff --git a/chrome/browser/resources/settings/downloads_page/add_smb_share_dialog.html b/chrome/browser/resources/settings/downloads_page/add_smb_share_dialog.html index c4d4070c..5a70d93 100644 --- a/chrome/browser/resources/settings/downloads_page/add_smb_share_dialog.html +++ b/chrome/browser/resources/settings/downloads_page/add_smb_share_dialog.html
@@ -47,6 +47,7 @@ <div slot="body" spellcheck="false"> <cr-searchable-drop-down id="address" label="$i18n{smbShareUrl}" value="{{mountUrl_}}" items="[[discoveredShares_]]" + placeholder="\\server\share" update-value-on-input autofocus> </cr-searchable-drop-down> <cr-input id="name" label="$i18n{smbShareName}" value="{{mountName_}}"
diff --git a/chrome/browser/resources/settings/people_page/people_page.js b/chrome/browser/resources/settings/people_page/people_page.js index 007f938..84b14a7 100644 --- a/chrome/browser/resources/settings/people_page/people_page.js +++ b/chrome/browser/resources/settings/people_page/people_page.js
@@ -168,7 +168,9 @@ if (settings.routes.MANAGE_PROFILE) { map.set( settings.routes.MANAGE_PROFILE.path, - '#picture-subpage-trigger .subpage-arrow button'); + loadTimeData.getBoolean('diceEnabled') ? + '#edit-profile .subpage-arrow button' : + '#picture-subpage-trigger .subpage-arrow button'); } // </if> // <if expr="chromeos">
diff --git a/chrome/browser/resources/welcome/onboarding_welcome/google_apps/nux_google_apps.html b/chrome/browser/resources/welcome/onboarding_welcome/google_apps/nux_google_apps.html index 0b29922b..499414b 100644 --- a/chrome/browser/resources/welcome/onboarding_welcome/google_apps/nux_google_apps.html +++ b/chrome/browser/resources/welcome/onboarding_welcome/google_apps/nux_google_apps.html
@@ -39,6 +39,7 @@ h1 { color: var(--cr-primary-text-color); font-size: 24px; + font-weight: 500; margin-bottom: 48px; opacity: .8; text-align: center; @@ -50,10 +51,6 @@ margin-bottom: 48px; } - paper-button { - font-size: 14px; - } - .button-bar { display: flex; justify-content: space-between;
diff --git a/chrome/browser/resources/welcome/onboarding_welcome/shared/chooser_shared_css.html b/chrome/browser/resources/welcome/onboarding_welcome/shared/chooser_shared_css.html index 6c64c2a8..f6b5864 100644 --- a/chrome/browser/resources/welcome/onboarding_welcome/shared/chooser_shared_css.html +++ b/chrome/browser/resources/welcome/onboarding_welcome/shared/chooser_shared_css.html
@@ -21,12 +21,13 @@ box-sizing: border-box; display: inline-flex; flex-direction: column; - height: 96px; + font-family: inherit; + height: 84px; justify-content: center; outline: 0; position: relative; vertical-align: bottom; - width: 120px; + width: 104px; } .option:not(:first-of-type) { @@ -49,10 +50,10 @@ background-position: center; background-repeat: no-repeat; background-size: contain; - height: 40px; + height: 32px; margin: 0; margin-bottom: 4px; - width: 40px; + width: 32px; } .option iron-icon {
diff --git a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc index 5f4f64f..7864c9a 100644 --- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc
@@ -2506,4 +2506,19 @@ ASSERT_EQ(2, referrer_chain.size()); } +IN_PROC_BROWSER_TEST_F(SBNavigationObserverBrowserTest, + SetWindowLocationGetsReferrerChain) { + GURL initial_url = embedded_test_server()->GetURL(kSingleFrameTestURL); + ui_test_utils::NavigateToURL(browser(), initial_url); + + ASSERT_TRUE(content::ExecuteScript( + browser()->tab_strip_model()->GetActiveWebContents(), + "window.location='../signed.exe'")); + base::RunLoop().RunUntilIdle(); + + ReferrerChain referrer_chain; + IdentifyReferrerChainForDownload(GetDownload(), &referrer_chain); + ASSERT_EQ(2, referrer_chain.size()); +} + } // namespace safe_browsing
diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc index 8c0de54..5aa741c 100644 --- a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc +++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
@@ -14,6 +14,7 @@ #include "base/files/file_util.h" #include "base/files/important_file_writer.h" #include "base/md5.h" +#include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" @@ -260,7 +261,7 @@ } bool SpellcheckCustomDictionary::HasWord(const std::string& word) const { - return !!words_.count(word); + return base::ContainsKey(words_, word); } void SpellcheckCustomDictionary::AddObserver(Observer* observer) {
diff --git a/chrome/browser/ssl/chrome_ssl_host_state_delegate.cc b/chrome/browser/ssl/chrome_ssl_host_state_delegate.cc index c366f31b..b8b3b3b5 100644 --- a/chrome/browser/ssl/chrome_ssl_host_state_delegate.cc +++ b/chrome/browser/ssl/chrome_ssl_host_state_delegate.cc
@@ -17,6 +17,7 @@ #include "base/logging.h" #include "base/metrics/field_trial.h" #include "base/metrics/field_trial_params.h" +#include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/time/clock.h" #include "base/time/default_clock.h" @@ -395,12 +396,12 @@ const std::string& host, int child_id, InsecureContentType content_type) const { + auto entry = BrokenHostEntry(host, child_id); switch (content_type) { case MIXED_CONTENT: - return !!ran_mixed_content_hosts_.count(BrokenHostEntry(host, child_id)); + return base::ContainsKey(ran_mixed_content_hosts_, entry); case CERT_ERRORS_CONTENT: - return !!ran_content_with_cert_errors_hosts_.count( - BrokenHostEntry(host, child_id)); + return base::ContainsKey(ran_content_with_cert_errors_hosts_, entry); } NOTREACHED(); return false;
diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc index 8df0d7e..b723890 100644 --- a/chrome/browser/ssl/ssl_blocking_page.cc +++ b/chrome/browser/ssl/ssl_blocking_page.cc
@@ -45,6 +45,9 @@ namespace { +const char kSymantecSupportUrl[] = + "https://support.google.com/chrome?p=symantec"; + std::unique_ptr<ChromeMetricsHelper> CreateSslProblemMetricsHelper( content::WebContents* web_contents, int cert_error, @@ -110,6 +113,15 @@ } } + if (cert_error == net::ERR_CERT_SYMANTEC_LEGACY) { + GURL symantec_support_url(kSymantecSupportUrl); + return new SSLBlockingPage( + web_contents, cert_error, ssl_info, request_url, options_mask, + time_triggered, std::move(symantec_support_url), + std::move(ssl_cert_reporter), overridable, std::move(metrics_helper), + is_superfish, callback); + } + return new SSLBlockingPage(web_contents, cert_error, ssl_info, request_url, options_mask, time_triggered, support_url, std::move(ssl_cert_reporter), overridable,
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 6d9fdfe..b632b5e 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -752,6 +752,8 @@ "android/infobars/permission_infobar.h", "android/infobars/previews_infobar.cc", "android/infobars/previews_infobar.h", + "android/infobars/previews_lite_page_infobar.cc", + "android/infobars/previews_lite_page_infobar.h", "android/infobars/reader_mode_infobar.cc", "android/infobars/reader_mode_infobar.h", "android/infobars/save_password_infobar.cc",
diff --git a/chrome/browser/ui/android/infobars/previews_lite_page_infobar.cc b/chrome/browser/ui/android/infobars/previews_lite_page_infobar.cc new file mode 100644 index 0000000..29fbac9c --- /dev/null +++ b/chrome/browser/ui/android/infobars/previews_lite_page_infobar.cc
@@ -0,0 +1,35 @@ +// Copyright 2018 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/ui/android/infobars/previews_lite_page_infobar.h" + +#include <utility> + +#include "base/android/jni_android.h" +#include "base/android/jni_string.h" +#include "jni/PreviewsLitePageInfoBar_jni.h" + +PreviewsLitePageInfoBar::PreviewsLitePageInfoBar( + std::unique_ptr<PreviewsLitePageInfoBarDelegate> delegate) + : ConfirmInfoBar(std::move(delegate)) {} + +PreviewsLitePageInfoBar::~PreviewsLitePageInfoBar() {} + +// static +std::unique_ptr<infobars::InfoBar> PreviewsLitePageInfoBar::CreateInfoBar( + infobars::InfoBarManager* infobar_manager, + std::unique_ptr<PreviewsLitePageInfoBarDelegate> delegate) { + return std::make_unique<PreviewsLitePageInfoBar>(std::move(delegate)); +} + +base::android::ScopedJavaLocalRef<jobject> +PreviewsLitePageInfoBar::CreateRenderInfoBar(JNIEnv* env) { + ConfirmInfoBarDelegate* delegate = GetDelegate(); + base::android::ScopedJavaLocalRef<jstring> message_text = + base::android::ConvertUTF16ToJavaString(env, delegate->GetMessageText()); + base::android::ScopedJavaLocalRef<jstring> link_text = + base::android::ConvertUTF16ToJavaString(env, delegate->GetLinkText()); + return Java_PreviewsLitePageInfoBar_show(env, GetEnumeratedIconId(), + message_text, link_text); +}
diff --git a/chrome/browser/ui/android/infobars/previews_lite_page_infobar.h b/chrome/browser/ui/android/infobars/previews_lite_page_infobar.h new file mode 100644 index 0000000..224f8b0 --- /dev/null +++ b/chrome/browser/ui/android/infobars/previews_lite_page_infobar.h
@@ -0,0 +1,37 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_ANDROID_INFOBARS_PREVIEWS_LITE_PAGE_INFOBAR_H_ +#define CHROME_BROWSER_UI_ANDROID_INFOBARS_PREVIEWS_LITE_PAGE_INFOBAR_H_ + +#include <memory> + +#include "base/android/scoped_java_ref.h" +#include "base/macros.h" +#include "chrome/browser/previews/previews_lite_page_infobar_delegate.h" +#include "chrome/browser/ui/android/infobars/confirm_infobar.h" + +// This InfoBar notifies the user that Data Saver now also applies to HTTPS +// pages. +class PreviewsLitePageInfoBar : public ConfirmInfoBar { + public: + explicit PreviewsLitePageInfoBar( + std::unique_ptr<PreviewsLitePageInfoBarDelegate> delegate); + + ~PreviewsLitePageInfoBar() override; + + // Returns a Previews Lite page InfoBar that owns |delegate|. + static std::unique_ptr<infobars::InfoBar> CreateInfoBar( + infobars::InfoBarManager* infobar_manager, + std::unique_ptr<PreviewsLitePageInfoBarDelegate> delegate); + + private: + // ConfirmInfoBar: + base::android::ScopedJavaLocalRef<jobject> CreateRenderInfoBar( + JNIEnv* env) override; + + DISALLOW_COPY_AND_ASSIGN(PreviewsLitePageInfoBar); +}; + +#endif // CHROME_BROWSER_UI_ANDROID_INFOBARS_PREVIEWS_LITE_PAGE_INFOBAR_H_
diff --git a/chrome/browser/ui/ash/chrome_keyboard_ui.cc b/chrome/browser/ui/ash/chrome_keyboard_ui.cc index d846dc9..1c975624 100644 --- a/chrome/browser/ui/ash/chrome_keyboard_ui.cc +++ b/chrome/browser/ui/ash/chrome_keyboard_ui.cc
@@ -11,6 +11,8 @@ #include "ash/public/cpp/shell_window_ids.h" #include "ash/root_window_controller.h" #include "ash/shell.h" +#include "base/command_line.h" +#include "base/feature_list.h" #include "base/macros.h" #include "base/no_destructor.h" #include "chrome/browser/ui/ash/chrome_keyboard_controller_client.h" @@ -28,12 +30,14 @@ #include "ui/base/ime/ime_bridge.h" #include "ui/base/ime/input_method.h" #include "ui/base/ime/text_input_client.h" +#include "ui/base/ui_base_features.h" #include "ui/compositor/layer.h" #include "ui/compositor_extra/shadow.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/rect.h" #include "ui/keyboard/keyboard_controller.h" #include "ui/keyboard/keyboard_resource_util.h" +#include "ui/keyboard/keyboard_switches.h" #include "ui/keyboard/keyboard_util.h" #include "ui/wm/core/shadow_types.h" @@ -145,8 +149,9 @@ // keyboard to be see-through. // TODO(https://crbug.com/840731): Find a permanent fix for this on the // keyboard extension side. - if (keyboard::IsFullscreenHandwritingVirtualKeyboardEnabled() || - keyboard::IsVirtualKeyboardMdUiEnabled()) { + if (base::FeatureList::IsEnabled( + features::kEnableFullscreenHandwritingVirtualKeyboard) || + base::FeatureList::IsEnabled(features::kEnableVirtualKeyboardMdUi)) { view->SetBackgroundColor(SK_ColorTRANSPARENT); view->GetNativeView()->SetTransparent(true); } @@ -250,8 +255,10 @@ if (!override_url.is_empty()) return override_url; - if (!keyboard::IsInputViewEnabled()) + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + keyboard::switches::kDisableInputView)) { return GURL(keyboard::kKeyboardURL); + } chromeos::input_method::InputMethodManager* ime_manager = chromeos::input_method::InputMethodManager::Get();
diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc index 2954546..04c98598 100644 --- a/chrome/browser/ui/views/find_bar_view.cc +++ b/chrome/browser/ui/views/find_bar_view.cc
@@ -9,6 +9,7 @@ #include "base/i18n/number_formatting.h" #include "base/macros.h" #include "base/strings/string_util.h" +#include "build/build_config.h" #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/themes/theme_properties.h" @@ -321,7 +322,9 @@ void FindBarView::SetFocusAndSelection(bool select_all) { find_text_->RequestFocus(); +#if !defined(OS_WIN) GetWidget()->GetInputMethod()->ShowVirtualKeyboardIfEnabled(); +#endif if (select_all && !find_text_->text().empty()) find_text_->SelectAll(true); }
diff --git a/chrome/browser/ui/views/media_router/cast_dialog_view.cc b/chrome/browser/ui/views/media_router/cast_dialog_view.cc index 837f2e3..97bea063 100644 --- a/chrome/browser/ui/views/media_router/cast_dialog_view.cc +++ b/chrome/browser/ui/views/media_router/cast_dialog_view.cc
@@ -99,7 +99,12 @@ } base::string16 CastDialogView::GetWindowTitle() const { - return dialog_title_; + // |dialog_title_| may contain the presentation URL origin which is not + // relevant for non-tab sources. So we override it with the default title for + // those sources. + return selected_source_ == kTabSource + ? dialog_title_ + : l10n_util::GetStringUTF16(IDS_MEDIA_ROUTER_CAST_DIALOG_TITLE); } int CastDialogView::GetDialogButtons() const { @@ -187,6 +192,7 @@ void CastDialogView::ExecuteCommand(int command_id, int event_flags) { selected_source_ = command_id; DisableUnsupportedSinks(); + GetWidget()->UpdateWindowTitle(); metrics_.OnCastModeSelected(); }
diff --git a/chrome/browser/ui/views/media_router/media_router_views_ui.cc b/chrome/browser/ui/views/media_router/media_router_views_ui.cc index ce0b6f0..7b43c94 100644 --- a/chrome/browser/ui/views/media_router/media_router_views_ui.cc +++ b/chrome/browser/ui/views/media_router/media_router_views_ui.cc
@@ -45,7 +45,8 @@ void MediaRouterViewsUI::AddObserver(CastDialogController::Observer* observer) { observers_.AddObserver(observer); - observer->OnModelUpdated(model_); + // TODO(takumif): Update the header when this object is initialized instead. + UpdateModelHeader(); } void MediaRouterViewsUI::RemoveObserver( @@ -108,8 +109,6 @@ } void MediaRouterViewsUI::UpdateSinks() { - model_.set_dialog_header( - l10n_util::GetStringUTF16(IDS_MEDIA_ROUTER_CAST_DIALOG_TITLE)); std::vector<UIMediaSink> media_sinks; for (const MediaSinkWithCastModes& sink : GetEnabledSinks()) { auto route_it = std::find_if( @@ -166,6 +165,31 @@ UpdateSinks(); } +void MediaRouterViewsUI::OnDefaultPresentationChanged( + const content::PresentationRequest& presentation_request) { + // This sets the default cast mode to presentation when the dialog is opened. + // So we need to update the header to reflect that. + MediaRouterUIBase::OnDefaultPresentationChanged(presentation_request); + UpdateModelHeader(); +} + +void MediaRouterViewsUI::OnDefaultPresentationRemoved() { + MediaRouterUIBase::OnDefaultPresentationRemoved(); + UpdateModelHeader(); +} + +void MediaRouterViewsUI::UpdateModelHeader() { + const std::string source_name = GetTruncatedPresentationRequestSourceName(); + const base::string16 header_text = + source_name.empty() + ? l10n_util::GetStringUTF16(IDS_MEDIA_ROUTER_CAST_DIALOG_TITLE) + : l10n_util::GetStringFUTF16(IDS_MEDIA_ROUTER_PRESENTATION_CAST_MODE, + base::UTF8ToUTF16(source_name)); + model_.set_dialog_header(header_text); + for (CastDialogController::Observer& observer : observers_) + observer.OnModelUpdated(model_); +} + void MediaRouterViewsUI::FileDialogFileSelected( const ui::SelectedFileInfo& file_info) { CreateRoute(local_file_sink_id_.value(), LOCAL_FILE);
diff --git a/chrome/browser/ui/views/media_router/media_router_views_ui.h b/chrome/browser/ui/views/media_router/media_router_views_ui.h index 2843a42c1..4585e53 100644 --- a/chrome/browser/ui/views/media_router/media_router_views_ui.h +++ b/chrome/browser/ui/views/media_router/media_router_views_ui.h
@@ -33,6 +33,7 @@ private: FRIEND_TEST_ALL_PREFIXES(MediaRouterViewsUITest, NotifyObserver); FRIEND_TEST_ALL_PREFIXES(MediaRouterViewsUITest, SinkFriendlyName); + FRIEND_TEST_ALL_PREFIXES(MediaRouterViewsUITest, SetDialogHeader); FRIEND_TEST_ALL_PREFIXES(MediaRouterViewsUITest, RemovePseudoSink); FRIEND_TEST_ALL_PREFIXES(MediaRouterViewsUITest, ConnectingState); FRIEND_TEST_ALL_PREFIXES(MediaRouterViewsUITest, DisconnectingState); @@ -47,9 +48,12 @@ void UpdateSinks() override; void OnIssue(const Issue& issue) override; void OnIssueCleared() override; + void OnDefaultPresentationChanged( + const content::PresentationRequest& presentation_request) override; + void OnDefaultPresentationRemoved() override; - // This value is set whenever there is an outstanding issue. - base::Optional<Issue> issue_; + // Update the header text in the dialog model and notify observers. + void UpdateModelHeader(); UIMediaSink ConvertToUISink(const MediaSinkWithCastModes& sink, const MediaRoute* route, @@ -59,6 +63,9 @@ void FileDialogFileSelected(const ui::SelectedFileInfo& file_info) override; void FileDialogSelectionFailed(const IssueInfo& issue) override; + // This value is set whenever there is an outstanding issue. + base::Optional<Issue> issue_; + // Contains up-to-date data to show in the dialog. CastDialogModel model_; @@ -71,6 +78,7 @@ base::Optional<MediaRoute::Id> terminating_route_id_; // Observers for dialog model updates. + // TODO(takumif): CastDialogModel should manage the observers. base::ObserverList<CastDialogController::Observer>::Unchecked observers_; DISALLOW_COPY_AND_ASSIGN(MediaRouterViewsUI);
diff --git a/chrome/browser/ui/views/media_router/media_router_views_ui_unittest.cc b/chrome/browser/ui/views/media_router/media_router_views_ui_unittest.cc index 56c929ab..401fdd6 100644 --- a/chrome/browser/ui/views/media_router/media_router_views_ui_unittest.cc +++ b/chrome/browser/ui/views/media_router/media_router_views_ui_unittest.cc
@@ -13,9 +13,11 @@ #include "chrome/browser/ui/media_router/media_cast_mode.h" #include "chrome/common/media_router/media_source_helper.h" #include "chrome/common/media_router/route_request_result.h" +#include "chrome/grit/generated_resources.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/l10n/l10n_util.h" #include "url/origin.h" using testing::_; @@ -141,6 +143,37 @@ ui_->RemoveObserver(&observer); } +TEST_F(MediaRouterViewsUITest, SetDialogHeader) { + MockControllerObserver observer; + // Initially, the dialog header should simply say "Cast". + EXPECT_CALL(observer, OnModelUpdated(_)) + .WillOnce([&](const CastDialogModel& model) { + EXPECT_EQ(l10n_util::GetStringUTF16(IDS_MEDIA_ROUTER_CAST_DIALOG_TITLE), + model.dialog_header()); + }); + ui_->AddObserver(&observer); + // We temporarily remove the observer here because the implementation calls + // OnModelUpdated() multiple times when the presentation request gets set. + ui_->RemoveObserver(&observer); + + GURL gurl("https://example.com"); + url::Origin origin = url::Origin::Create(gurl); + ui_->OnDefaultPresentationChanged(content::PresentationRequest( + content::GlobalFrameRoutingId(), {gurl}, origin)); + + // Now that the presentation request has been set, the dialog header contains + // its origin. + EXPECT_CALL(observer, OnModelUpdated(_)) + .WillOnce([&](const CastDialogModel& model) { + EXPECT_EQ( + l10n_util::GetStringFUTF16(IDS_MEDIA_ROUTER_PRESENTATION_CAST_MODE, + base::UTF8ToUTF16(origin.host())), + model.dialog_header()); + }); + ui_->AddObserver(&observer); + ui_->RemoveObserver(&observer); +} + TEST_F(MediaRouterViewsUITest, StartCasting) { MediaSource media_source = MediaSourceForTab(SessionTabHelper::IdForTab(web_contents()).id());
diff --git a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc index 7643756..07519d0a 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
@@ -88,10 +88,12 @@ // Set up 'switch to tab' button. if (match.ShouldShowTabMatch()) { - constexpr int ids_hint = IDS_OMNIBOX_TAB_SUGGEST_HINT; - constexpr int ids_hint_short = IDS_OMNIBOX_TAB_SUGGEST_SHORT_HINT; + const base::string16 hint = + l10n_util::GetStringUTF16(IDS_OMNIBOX_TAB_SUGGEST_HINT); + const base::string16 hint_short = + l10n_util::GetStringUTF16(IDS_OMNIBOX_TAB_SUGGEST_SHORT_HINT); suggestion_tab_switch_button_ = std::make_unique<OmniboxTabSwitchButton>( - model_, this, ids_hint, ids_hint_short, omnibox::kSwitchIcon); + model_, this, hint, hint_short, omnibox::kSwitchIcon); suggestion_tab_switch_button_->set_owned_by_client(); AddChildView(suggestion_tab_switch_button_.get()); } else {
diff --git a/chrome/browser/ui/views/omnibox/omnibox_tab_switch_button.cc b/chrome/browser/ui/views/omnibox/omnibox_tab_switch_button.cc index 4ac9cba..e7b7525 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_tab_switch_button.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_tab_switch_button.cc
@@ -28,16 +28,16 @@ OmniboxTabSwitchButton::OmniboxTabSwitchButton(OmniboxPopupContentsView* model, OmniboxResultView* result_view, - int ids_hint, - int ids_hint_short, + const base::string16& hint, + const base::string16& hint_short, const gfx::VectorIcon& icon) : MdTextButton(result_view, views::style::CONTEXT_BUTTON_MD), model_(model), result_view_(result_view), initialized_(false), animation_(new gfx::SlideAnimation(this)), - ids_hint_(ids_hint), - ids_hint_short_(ids_hint_short) { + hint_(hint), + hint_short_(hint_short) { SetBgColorOverride(GetBackgroundColor()); SetImage(STATE_NORMAL, gfx::CreateVectorIcon( icon, GetLayoutConstant(LOCATION_BAR_ICON_SIZE), @@ -45,15 +45,15 @@ SetImageLabelSpacing(8); if (!calculated_widths_) { icon_only_width_ = MdTextButton::CalculatePreferredSize().width(); - SetText(l10n_util::GetStringUTF16(ids_hint_short_)); + SetText(hint_short_); short_text_width_ = MdTextButton::CalculatePreferredSize().width(); - SetText(l10n_util::GetStringUTF16(ids_hint_)); + SetText(hint_); full_text_width_ = MdTextButton::CalculatePreferredSize().width(); calculated_widths_ = true; } else { - SetText(l10n_util::GetStringUTF16(ids_hint_)); + SetText(hint_); } - SetTooltipText(l10n_util::GetStringUTF16(ids_hint_)); + SetTooltipText(hint_); set_corner_radius(CalculatePreferredSize().height() / 2.f); animation_->SetSlideDuration(500); SetElideBehavior(gfx::FADE_TAIL); @@ -191,11 +191,11 @@ size_t OmniboxTabSwitchButton::CalculateGoalWidth(size_t parent_width, base::string16* goal_text) { if (full_text_width_ * 5 <= parent_width) { - *goal_text = l10n_util::GetStringUTF16(ids_hint_); + *goal_text = hint_; return full_text_width_; } if (short_text_width_ * 5 <= parent_width) { - *goal_text = l10n_util::GetStringUTF16(ids_hint_short_); + *goal_text = hint_short_; return short_text_width_; } *goal_text = base::string16();
diff --git a/chrome/browser/ui/views/omnibox/omnibox_tab_switch_button.h b/chrome/browser/ui/views/omnibox/omnibox_tab_switch_button.h index b30801f..4fc6dec 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_tab_switch_button.h +++ b/chrome/browser/ui/views/omnibox/omnibox_tab_switch_button.h
@@ -18,8 +18,8 @@ public: OmniboxTabSwitchButton(OmniboxPopupContentsView* model, OmniboxResultView* result_view, - int ids_hint, - int ids_hint_short, + const base::string16& hint, + const base::string16& hint_short, const gfx::VectorIcon& icon); ~OmniboxTabSwitchButton() override; @@ -84,9 +84,9 @@ base::string16 goal_text_; std::unique_ptr<gfx::SlideAnimation> animation_; - // String identifiers for hint text and its short version (may be same). - int ids_hint_; - int ids_hint_short_; + // Label strings for hint text and its short version (may be same). + base::string16 hint_; + base::string16 hint_short_; DISALLOW_COPY_AND_ASSIGN(OmniboxTabSwitchButton); };
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc index b534563..24f69d8 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
@@ -352,6 +352,8 @@ IDS_PRINT_PREVIEW_ADVANCED_OPTIONS_LABEL); source->AddLocalizedString("showAdvancedOptions", IDS_PRINT_PREVIEW_SHOW_ADVANCED_OPTIONS); + source->AddLocalizedString("newShowAdvancedOptions", + IDS_PRINT_PREVIEW_NEW_SHOW_ADVANCED_OPTIONS); source->AddLocalizedString("accept", IDS_PRINT_PREVIEW_ACCEPT_INVITE); source->AddLocalizedString(
diff --git a/chrome/credential_provider/BUILD.gn b/chrome/credential_provider/BUILD.gn deleted file mode 100644 index c16aab7..0000000 --- a/chrome/credential_provider/BUILD.gn +++ /dev/null
@@ -1,31 +0,0 @@ -# Copyright 2018 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. - -# Make the GCP installer. -action("gcp_installer") { - script = "build/make_setup.py" - - outputs = [ - "$root_out_dir/gcp_installer.exe", - ] - - args = [ - rebase_path("//", root_build_dir), - rebase_path(".", root_build_dir), - rebase_path(root_out_dir, root_build_dir), - rebase_path(target_gen_dir, root_build_dir), - ] - - deps = [ - "//chrome/credential_provider/eventlog:gcp_eventlog_provider", - "//chrome/credential_provider/gaiacp:gaia1_0", - "//chrome/credential_provider/setup:gcp_setup", - ] -} - -group("credential_provider") { - deps = [ - ":gcp_installer", - ] -}
diff --git a/chrome/credential_provider/DEPS b/chrome/credential_provider/DEPS deleted file mode 100644 index 798ef25..0000000 --- a/chrome/credential_provider/DEPS +++ /dev/null
@@ -1,6 +0,0 @@ -include_rules = [ - "+chrome/common", - "+chrome/installer/util", - "+google_apis", -] -
diff --git a/chrome/credential_provider/OWNERS b/chrome/credential_provider/OWNERS deleted file mode 100644 index 614bf97..0000000 --- a/chrome/credential_provider/OWNERS +++ /dev/null
@@ -1,4 +0,0 @@ -rogerta@chromium.org - -# COMPONENT: Enterprise -
diff --git a/chrome/credential_provider/build/make_setup.py b/chrome/credential_provider/build/make_setup.py deleted file mode 100755 index 7d045b0a..0000000 --- a/chrome/credential_provider/build/make_setup.py +++ /dev/null
@@ -1,102 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 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. -# -# This script builds the credential provider installer that is used to install -# all required components of the Google Credential Provider for Windows. The -# installer is a 7-zip self extracting executable file that wraps three main -# parts: -# -# - the Credential Provider COM DLL -# - a DLL that contains Windows EventLog message formatting -# - a setup exe that performs action required during install and uninstall -# -# In this description "installer" refers to the self extracting executable that -# wraps all the parts, whereas "setup" refers to an exe inside the installer -# that runs specific actions at install and uninstall time. -# -# When run, the installer extracts the wrapped files into a new empty -# directory under %TEMP%. The setup exe is then run to register the COM -# objects, install the message format dll, and properly register the credential -# provider with Windows. Once installation completes, the new directory -# containing the extracted files is automatically deleted. -# -# The installer can be run multiple times on the same machine. On an already -# working computer this is essentially a noop. On a damaged computer the files -# will be overwritten and the parts registered, so can be used to correct -# problems. -# -# Running a new version of the installer will replace the existing install with -# a newer one. It is not required to first uninstall the old version. -# Installation of the newer version will attempt to delete older versions if -# possible. -# -# The installer is not needed for uninstall and may be removed after initial -# install. To uninstall the Google Credential Provider for Windows, run the -# setup exe with the command line argument: /uninstall - -"""Creates the GCPW self extracting installer. This script is not run manually, -it is called when building the //credential_provider:gcp_installer GN target. - -All paths can be absolute or relative to $root_build_dir. -""" - -import argparse -import os -import subprocess -import sys - - -def main(): - parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) - parser.add_argument('src_path', help='Path to the source root') - parser.add_argument('cp_path', - help='Path to the credential provider directory') - parser.add_argument('root_build_path', help='$root_build_dir GN variable') - parser.add_argument('target_gen_path', help='$target_gen_dir GN variable') - args = parser.parse_args() - - # Make sure all arguments are converted to absolute paths for use below. - args.src_path = os.path.abspath(args.src_path) - args.cp_path = os.path.abspath(args.cp_path) - args.root_build_path = os.path.abspath(args.root_build_path) - args.target_gen_path = os.path.abspath(args.target_gen_path) - - if not os.path.isdir(args.cp_path): - parser.error('Invalid cp_path: "%s"' % args.cp_path) - - if not os.path.isdir(args.src_path): - parser.error('Invalid src_path: "%s"' % args.src_path) - - # Absolute path to gcp installer. - gcp_installer_fn = os.path.join(args.root_build_path, 'gcp_installer.exe') - gcp_7z_fn = os.path.join(args.root_build_path, 'gcp.7z') - - sz_fn = os.path.join(args.src_path, r'third_party\lzma_sdk\7zr.exe') - sfx_fn = os.path.join(args.src_path, - r'third_party\lzma_sdk\Executable\7zS2.sfx') - - # Because of the way that 7zS2.sfx determine what program to run after - # extraction, only gcp_setup.exe should be placed in the root of the archive. - # Other "executable" type files (bat, cmd, exe, inf, msi, html, htm) should - # be located only in subfolders. - - # Add the credential provider dll and setup programs to the archive. - # If the files added to the archive are changed, make sure to update the - # kFilenames array in setup_lib.cc. - os.chdir(args.root_build_path) - subprocess.call([sz_fn, 'u', gcp_7z_fn, 'gaia1_0.dll']) - subprocess.call([sz_fn, 'u', gcp_7z_fn, 'gcp_setup.exe']) - subprocess.call([sz_fn, 'u', gcp_7z_fn, 'gcp_eventlog_provider.dll']) - - # Combine the SFX module with the archive to make a self extracting - # executable. - command = 'copy /b %s + %s %s' % (sfx_fn, gcp_7z_fn, gcp_installer_fn) - subprocess.call(command, shell=True) - return 0 - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/chrome/credential_provider/eventlog/BUILD.gn b/chrome/credential_provider/eventlog/BUILD.gn deleted file mode 100644 index 835f51d..0000000 --- a/chrome/credential_provider/eventlog/BUILD.gn +++ /dev/null
@@ -1,39 +0,0 @@ -# Copyright 2018 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("//build/config/sanitizers/sanitizers.gni") -import("//build/win/message_compiler.gni") -import("//chrome/process_version_rc_template.gni") - -message_compiler("gcp_eventlog_messages") { - sources = [ - "gcp_eventlog_messages.mc", - ] - - user_mode_logging = false - compile_generated_code = false -} - -process_version_rc_template("gcp_eventlog_provider_dll_version") { - sources = [ - "gcp_eventlog_provider.ver", - ] - output = "$target_gen_dir/gcp_eventlog_provider_dll_version.rc" -} - -shared_library("gcp_eventlog_provider") { - sources = [ - "$root_gen_dir/chrome/credential_provider/eventlog/gcp_eventlog_messages.rc", - "gcp_eventlog_provider.cc", - ] - - if (!is_asan) { - ldflags = [ "/NOENTRY" ] - } - - deps = [ - ":gcp_eventlog_messages", - ":gcp_eventlog_provider_dll_version", - ] -}
diff --git a/chrome/credential_provider/eventlog/gcp_eventlog_messages.mc b/chrome/credential_provider/eventlog/gcp_eventlog_messages.mc deleted file mode 100644 index 0dfd0b3a..0000000 --- a/chrome/credential_provider/eventlog/gcp_eventlog_messages.mc +++ /dev/null Binary files differ
diff --git a/chrome/credential_provider/eventlog/gcp_eventlog_provider.cc b/chrome/credential_provider/eventlog/gcp_eventlog_provider.cc deleted file mode 100644 index 80032e86..0000000 --- a/chrome/credential_provider/eventlog/gcp_eventlog_provider.cc +++ /dev/null
@@ -1,9 +0,0 @@ -// Copyright 2018 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. - -// Force the generation of a .lib file for the .dll since Ninja expects shared -// libraries to generate a .dll and a .lib file. -__declspec(dllexport) bool fn() { - return true; -}
diff --git a/chrome/credential_provider/eventlog/gcp_eventlog_provider.ver b/chrome/credential_provider/eventlog/gcp_eventlog_provider.ver deleted file mode 100644 index a4d9e6c7..0000000 --- a/chrome/credential_provider/eventlog/gcp_eventlog_provider.ver +++ /dev/null
@@ -1,2 +0,0 @@ -INTERNAL_NAME=gcp_eventlog_provider_dll -ORIGINAL_FILENAME=gcp_eventlog_provider.dll
diff --git a/chrome/credential_provider/gaiacp/BUILD.gn b/chrome/credential_provider/gaiacp/BUILD.gn deleted file mode 100644 index 46f6393..0000000 --- a/chrome/credential_provider/gaiacp/BUILD.gn +++ /dev/null
@@ -1,161 +0,0 @@ -# Copyright 2018 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("//build/buildflag_header.gni") -import("//build/config/allocator.gni") -import("//build/config/clang/clang.gni") -import("//build/config/compiler/compiler.gni") -import("//build/config/dcheck_always_on.gni") -import("//build/nocompile.gni") -import("//build/toolchain/win/midl.gni") -import("//chrome/process_version_rc_template.gni") -import("//tools/grit/grit_rule.gni") -import("//testing/libfuzzer/fuzzer_test.gni") -import("//testing/test.gni") - -# This static library is shared with the setup program. - -source_set("common") { - sources = [ - "gcp_strings.cc", - "gcp_strings.h", - "gcp_utils.cc", - "gcp_utils.h", - "logging.cc", - "logging.h", - ] - public_configs = [ ":common_config" ] - deps = [ - "//base:base", - "//components/version_info", - "//google_apis:google_apis", - ] -} - -config("common_config") { - defines = [ - # Needed in order to include the win32 header security.h. - "SECURITY_WIN32", - ] - libs = [ - "secur32.lib", # For LsaXXX functions - ] -} - -# This static library is shared with the test code. - -source_set("gaiacp_lib") { - sources = [ - "gaia_credential.cc", - "gaia_credential.h", - "gaia_credential_base.cc", - "gaia_credential_base.h", - "gaia_credential_provider.cc", - "gaia_credential_provider.h", - "gaia_credential_provider_module.cc", - "gaia_credential_provider_module.h", - "initguid.cc", - "os_process_manager.cc", - "os_process_manager.h", - "os_user_manager.cc", - "os_user_manager.h", - "reauth_credential.cc", - "reauth_credential.h", - "reg_utils.cc", - "reg_utils.h", - "scoped_handle.h", - "scoped_lsa_policy.cc", - "scoped_lsa_policy.h", - "scoped_user_profile.cc", - "scoped_user_profile.h", - "stdafx.h", - "win_http_url_fetcher.cc", - "win_http_url_fetcher.h", - ] - public_configs = [ ":gaiacp_config" ] - public_deps = [ ":common" ] - deps = [ - ":gaia_credential_provider_idl", - ":resources", - "//chrome/common:version_header", - ] -} - -config("gaiacp_config") { - defines = [ - # Needed to build COM objects that will be hosted in a DLL. - "_WINDLL", - ] - cflags = [ - # C4245: 'conversion' : conversion from 'type1' to 'type2', - # signed/unsigned mismatch - # Disabling because this Level 4 warning is causing ATL code to not compile, - # warnings are errors: - # c:\src\depot_tools\win_toolchain\vs_files\ - # d3cb0e37bdd120ad0ac4650b674b09e81be45616\vc\atlmfc\include\ - # atlexcept.h(102): warning C4245: '=': - # conversion from 'NTSTATUS' to 'DWORD', signed/unsigned mismatch - "/wd4245", - ] - libs = [ - "advapi32.lib", # For LookupAccountSid() - "credui.lib", # For CredPackAuthenticationBufferW() - "crypt32.lib", # For CryptProtectData() - "netapi32.lib", # For NetUserXXX() - "userenv.lib", # For GetUserProfileDirectoryW() - "winhttp.lib", # For WinHttpXXX() - ] -} - -# Targets for the credential provider dll. - -process_version_rc_template("version") { - template_file = "gaia_credential_provider.rc.version" - output = "$root_out_dir/gaia_credential_provider.rc" -} - -midl("gaia_credential_provider_idl") { - sources = [ - "gaia_credential_provider.idl", - ] - header_file = "gaia_credential_provider_i.h" -} - -grit("resources") { - source = "gaia_resources.grd" - inputs = [ - "gaia_credential_provider.rgs", - "google_logo_small.bmp", - ] - outputs = [ - "grit/gaia_resources.h", - "grit/gaia_resources.rc", - ] - resource_ids = "" - grit_flags = [ - "-E", - "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), - ] - deps = [ - ":gaia_credential_provider_idl", - ] -} - -shared_library("gaia1_0") { - sources = [ - "dllmain.cc", - "dllmain.h", - "gaia_credential_provider.def", - "gaia_credential_provider.rgs", - ] - deps = [ - ":common", - ":gaiacp_lib", - ":version", - "//chrome/common:version_header", - ] - configs += [ - "//build/config/win:windowed", - ] -}
diff --git a/chrome/credential_provider/gaiacp/dllmain.cc b/chrome/credential_provider/gaiacp/dllmain.cc deleted file mode 100644 index 8991819..0000000 --- a/chrome/credential_provider/gaiacp/dllmain.cc +++ /dev/null
@@ -1,182 +0,0 @@ -// Copyright 2018 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/credential_provider/gaiacp/dllmain.h" - -// It is important to include gaia_credential_base.h, reauth_credential.h and -// gaia_credential.h here, even though the classes are not used in this source -// file, in order to ensure that the COM objects will be properly linked into -// the dll. This became important after moving all the COM object code into a -// static library for testing purposes. -// -// This article clearly describes the issue and the fix: -// -// https://blogs.msdn.microsoft.com/larryosterman/2004/09/27/when-i-moved-my-code-into-a-library-what-happened-to-my-atl-com-objects/ - -#include "base/json/json_reader.h" -#include "base/macros.h" -#include "base/stl_util.h" -#include "base/values.h" -#include "base/win/registry.h" -#include "chrome/common/chrome_version.h" -#include "chrome/credential_provider/gaiacp/gaia_credential.h" -#include "chrome/credential_provider/gaiacp/gaia_credential_base.h" -#include "chrome/credential_provider/gaiacp/gaia_credential_provider.h" -#include "chrome/credential_provider/gaiacp/gaia_credential_provider_module.h" -#include "chrome/credential_provider/gaiacp/gcp_strings.h" -#include "chrome/credential_provider/gaiacp/gcp_utils.h" -#include "chrome/credential_provider/gaiacp/logging.h" -#include "chrome/credential_provider/gaiacp/os_user_manager.h" -#include "chrome/credential_provider/gaiacp/reauth_credential.h" -#include "chrome/credential_provider/gaiacp/reg_utils.h" - -using credential_provider::putHR; - -credential_provider::CGaiaCredentialProviderModule _AtlModule; - -#define __TYPELIB_ID_SUFFIX_STRING(id) L"\\" _T(#id) -#define _TYPELIB_ID_SUFFIX_STRING(id) __TYPELIB_ID_SUFFIX_STRING(id) -#define TYPELIB_SUFFIX_STRING \ - _TYPELIB_ID_SUFFIX_STRING(TLB_GAIACREDENTIALPROVIDER) - -// DLL Entry Point -extern "C" BOOL WINAPI DllMain(HINSTANCE hinstance, - DWORD reason, - LPVOID reserved) { - return _AtlModule.DllMain(hinstance, reason, reserved); -} - -using namespace ATL; - -// Used to determine whether the DLL can be unloaded by OLE. -STDAPI DllCanUnloadNow(void) { - HRESULT hr = _AtlModule.DllCanUnloadNow(); - LOGFN(INFO) << "hr=" << putHR(hr); - return hr; -} - -// Returns a class factory to create an object of the requested type. -STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { - return _AtlModule.DllGetClassObject(rclsid, riid, ppv); -} - -// DllRegisterServer - Adds entries to the system registry. -STDAPI DllRegisterServer(void) { - HRESULT hr = credential_provider::CGaiaCredentialBase::OnDllRegisterServer(); - LOGFN(INFO) << "CGaiaCredential::OnDllRegisterServer hr=" << putHR(hr); - - if (SUCCEEDED(hr)) { - // Registers object. FALSE means don't register typelib. The default - // behaviour is assume the typelib has ID 1. But in this case grit can't - // be forced to use an ID of 1 when writing the rc file. - hr = _AtlModule.DllRegisterServer(FALSE); - LOGFN(INFO) << "_AtlModule.DllRegisterServer hr=" << putHR(hr); - } - - // Register with Google Update. - if (SUCCEEDED(hr)) { - base::win::RegKey key(HKEY_LOCAL_MACHINE, - credential_provider::kRegUpdaterClientsAppPath, - KEY_SET_VALUE | KEY_WOW64_32KEY); - LONG sts = key.WriteValue(L"pv", TEXT(CHROME_VERSION_STRING)); - if (sts != ERROR_SUCCESS) { - hr = HRESULT_FROM_WIN32(sts); - LOGFN(ERROR) << "key.WriteValue(pv) hr=" << putHR(hr); - } else { - sts = key.WriteValue(L"name", - credential_provider::GetStringResource(IDS_PROJNAME).c_str()); - if (sts != ERROR_SUCCESS) { - hr = HRESULT_FROM_WIN32(sts); - LOGFN(ERROR) << "key.WriteValue(name) hr=" << putHR(hr); - } - } - } - - return hr; -} - -// DllUnregisterServer - Removes entries from the system registry. -STDAPI DllUnregisterServer(void) { - // Unegister with Google Update. - base::win::RegKey key(HKEY_LOCAL_MACHINE, L"", DELETE | KEY_WOW64_32KEY); - LONG sts = key.DeleteKey(credential_provider::kRegUpdaterClientsAppPath); - - bool all_succeeded = sts == ERROR_SUCCESS; - - HRESULT hr = - credential_provider::CGaiaCredentialBase::OnDllUnregisterServer(); - LOGFN(INFO) << "CGaiaCredential::OnDllUnregisterServer hr=" << putHR(hr); - all_succeeded &= SUCCEEDED(hr); - - hr = _AtlModule.DllUnregisterServer(FALSE); - LOGFN(INFO) << "_AtlModule.DllUnregisterServer hr=" << putHR(hr); - all_succeeded &= SUCCEEDED(hr); - - return all_succeeded ? S_OK : E_FAIL; -} - -// This entry point is called via rundll32. See -// CGaiaCredential::WaitForLoginUI() for details. -void CALLBACK SaveAccountInfoW(HWND /*hwnd*/, - HINSTANCE /*hinst*/, - wchar_t* /*pszCmdLine*/, - int /*show*/) { - LOGFN(INFO); - - HANDLE hStdin = ::GetStdHandle(STD_INPUT_HANDLE); // No need to close. - if (hStdin == INVALID_HANDLE_VALUE) { - LOGFN(INFO) << "No stdin"; - return; - } - - char buffer[credential_provider::CGaiaCredentialBase::kAccountInfoBufferSize]; - DWORD buffer_len_bytes = static_cast<DWORD>(sizeof(buffer)); // In bytes. - if (!::ReadFile(hStdin, buffer, buffer_len_bytes, &buffer_len_bytes, - nullptr)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "ReadFile hr=" << putHR(hr); - return; - } - buffer[buffer_len_bytes] = 0; - // Don't log |buffer| since it contains sensitive info like password. - - HRESULT hr = S_OK; - base::DictionaryValue* dict = nullptr; - std::unique_ptr<base::Value> properties = - base::JSONReader::Read(buffer, base::JSON_ALLOW_TRAILING_COMMAS); - if (!properties || !properties->GetAsDictionary(&dict)) { - LOGFN(ERROR) << "base::JSONReader::Read failed"; - hr = E_FAIL; - } - - hr = credential_provider::CGaiaCredentialBase::SaveAccountInfo(*dict); - if (FAILED(hr)) - LOGFN(ERROR) << "SaveAccountInfoW hr=" << putHR(hr); - - // If an MDM URL is configured in the registry, use it. - - wchar_t mdm_url[256]; - ULONG length = base::size(mdm_url); - hr = credential_provider::GetGlobalFlag(L"mdm", mdm_url, &length); - if (SUCCEEDED(hr)) { - dict->SetString(credential_provider::kKeyMdmUrl, mdm_url); - - hr = credential_provider::EnrollToGoogleMdmIfNeeded(*dict); - if (FAILED(hr)) - LOGFN(INFO) << "EnrollToGoogleMdmIfNeeded hr=" << putHR(hr); - } else { - LOGFN(INFO) << "Not enrolling to MDM"; - } - - LOGFN(INFO) << "Done"; -} - -void CALLBACK SetFakesForTesting( - const credential_provider::FakesForTesting* fakes) { - DCHECK(fakes); - credential_provider::ScopedLsaPolicy::SetCreatorForTesting( - fakes->scoped_lsa_policy_creator); - credential_provider::OSUserManager::SetInstanceForTesting( - fakes->os_manager_for_testing); -}
diff --git a/chrome/credential_provider/gaiacp/dllmain.h b/chrome/credential_provider/gaiacp/dllmain.h deleted file mode 100644 index 18ce5335..0000000 --- a/chrome/credential_provider/gaiacp/dllmain.h +++ /dev/null
@@ -1,12 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_GAIACP_DLLMAIN_H_ -#define CHROME_CREDENTIAL_PROVIDER_GAIACP_DLLMAIN_H_ - -#include "chrome/credential_provider/gaiacp/gaia_credential_provider_module.h" - -extern credential_provider::CGaiaCredentialProviderModule _AtlModule; - -#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_DLLMAIN_H_
diff --git a/chrome/credential_provider/gaiacp/gaia_credential.cc b/chrome/credential_provider/gaiacp/gaia_credential.cc deleted file mode 100644 index 30fd25f..0000000 --- a/chrome/credential_provider/gaiacp/gaia_credential.cc +++ /dev/null
@@ -1,51 +0,0 @@ -// Copyright 2018 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/credential_provider/gaiacp/gaia_credential.h" - -#include <algorithm> -#include <memory> - -#include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h" -#include "chrome/credential_provider/gaiacp/logging.h" -#include "chrome/credential_provider/gaiacp/os_user_manager.h" - -namespace credential_provider { - -CGaiaCredential::CGaiaCredential() {} - -CGaiaCredential::~CGaiaCredential() {} - -HRESULT CGaiaCredential::FinalConstruct() { - LOGFN(INFO); - return S_OK; -} - -void CGaiaCredential::FinalRelease() { - LOGFN(INFO); -} - -HRESULT CGaiaCredential::FinishAuthentication(BSTR username, - BSTR password, - BSTR fullname, - BSTR* sid, - BSTR* error_text) { - LOGFN(INFO); - DCHECK(error_text); - - OSUserManager* manager = OSUserManager::Get(); - base::string16 comment(GetStringResource(IDS_USER_ACCOUNT_COMMENT)); - HRESULT hr = CreateNewUser(manager, OLE2CW(username), OLE2CW(password), - OLE2CW(fullname), comment.c_str(), true, sid); - if (FAILED(hr)) { - LOGFN(ERROR) << "CreateNewUser hr=" << putHR(hr) - << " account=" << OLE2CW(username); - *error_text = AllocErrorString(IDS_CANT_CREATE_USER); - return hr; - } - - return S_OK; -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/gaia_credential.h b/chrome/credential_provider/gaiacp/gaia_credential.h deleted file mode 100644 index c26e469..0000000 --- a/chrome/credential_provider/gaiacp/gaia_credential.h +++ /dev/null
@@ -1,52 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_GAIACP_GAIA_CREDENTIAL_H_ -#define CHROME_CREDENTIAL_PROVIDER_GAIACP_GAIA_CREDENTIAL_H_ - -#include "chrome/credential_provider/gaiacp/gaia_credential_base.h" -#include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h" -#include "chrome/credential_provider/gaiacp/grit/gaia_resources.h" - -namespace credential_provider { - -// Implementation of an ICredentialProviderCredential backed by a Gaia account. -class ATL_NO_VTABLE CGaiaCredential - : public CComObjectRootEx<CComMultiThreadModel>, - public CComCoClass<CGaiaCredential, &CLSID_GaiaCredential>, - public CGaiaCredentialBase { - public: - DECLARE_NO_REGISTRY() - - CGaiaCredential(); - ~CGaiaCredential(); - - HRESULT FinalConstruct(); - void FinalRelease(); - - private: - // This class does not say it implements ICredentialProviderCredential2. - // It only implements ICredentialProviderCredential. Otherwise the - // credential will show up on the welcome screen only for domain joined - // machines. - BEGIN_COM_MAP(CGaiaCredential) - COM_INTERFACE_ENTRY(IGaiaCredential) - COM_INTERFACE_ENTRY(ICredentialProviderCredential) - END_COM_MAP() - - DECLARE_PROTECT_FINAL_CONSTRUCT() - - // IGaiaCredential - IFACEMETHODIMP FinishAuthentication(BSTR username, - BSTR password, - BSTR fullname, - BSTR* sid, - BSTR* error_text) override; -}; - -OBJECT_ENTRY_AUTO(__uuidof(GaiaCredential), CGaiaCredential) - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_GAIA_CREDENTIAL_H_
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_base.cc b/chrome/credential_provider/gaiacp/gaia_credential_base.cc deleted file mode 100644 index f2e7ab0..0000000 --- a/chrome/credential_provider/gaiacp/gaia_credential_base.cc +++ /dev/null
@@ -1,1220 +0,0 @@ -// Copyright 2018 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. - -// Implementation of CGaiaCredentialBase class, used as the base for all -// credentials that need to show the gaia sign in page. - -#include "chrome/credential_provider/gaiacp/gaia_credential_base.h" - -#include <algorithm> -#include <memory> - -#include "base/command_line.h" -#include "base/files/file_path.h" -#include "base/json/json_reader.h" -#include "base/json/json_writer.h" -#include "base/path_service.h" -#include "base/stl_util.h" -#include "base/strings/utf_string_conversions.h" -#include "base/values.h" -#include "base/win/current_module.h" -#include "base/win/registry.h" -#include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h" -#include "chrome/credential_provider/gaiacp/gcp_strings.h" -#include "chrome/credential_provider/gaiacp/gcp_utils.h" -#include "chrome/credential_provider/gaiacp/logging.h" -#include "chrome/credential_provider/gaiacp/os_process_manager.h" -#include "chrome/credential_provider/gaiacp/os_user_manager.h" -#include "chrome/credential_provider/gaiacp/reg_utils.h" -#include "chrome/credential_provider/gaiacp/scoped_lsa_policy.h" -#include "chrome/credential_provider/gaiacp/scoped_user_profile.h" -#include "google_apis/google_api_keys.h" - -namespace credential_provider { - -namespace { - -// TODO(crbug.com/885278): This function transforms an email address into a -// well formed Windows username. May need to revisit this algorithm -std::string MakeUsernameFromEmail(const std::string& email) { - std::string username = email; - std::transform(username.begin(), username.end(), username.begin(), ::tolower); - - // If the email ends with @gmail.com or @googlemail.com, strip it. - base::string16::size_type at = username.find("@gmail.com"); - if (at == base::string16::npos) - at = username.find("@googlemail.com"); - if (at != base::string16::npos) - username.resize(at); - - // Strip off some well known 3-letter TLDs. - base::string16::size_type pos = username.size() > 4 ? username.size() - 4 : 0; - if (username.find(".com") == pos || username.find(".net") == pos || - username.find(".org") == pos || username.find(".edu") == pos) { - username.resize(pos); - } - - // If the username is longer than 20 characters, truncate. - if (username.size() > 20) - username.resize(20); - - // Replace invalid characters. While @ is not strictly invalid according to - // MSDN docs, it causes trouble. - for (auto& c : username) { - if (strchr("@\\[]:|<>+=;?*", c) != nullptr || c < 32) - c = '_'; - } - - return username; -} - -// Waits for the login UI to completes and returns the result of the operation. -// This function returns S_OK on success, E_UNEXPECTED on failure, and E_ABORT -// if the user aborted or timed out (or was killed during cleanup). -HRESULT WaitForLoginUIAndGetResult( - CGaiaCredentialBase::UIProcessInfo* uiprocinfo, - std::unique_ptr<base::DictionaryValue>* result, - BSTR* status_text) { - LOGFN(INFO); - DCHECK(uiprocinfo); - DCHECK(result); - DCHECK(status_text); - - // Buffers used to accumulate output from UI. - const int kBufferSize = 4096; - static char stdout_buffer[kBufferSize]; - static char stderr_buffer[kBufferSize]; - - DWORD exit_code; - HRESULT hr = WaitForProcess(uiprocinfo->procinfo.process_handle(), - uiprocinfo->parent_handles, &exit_code, - stdout_buffer, stderr_buffer, kBufferSize); - // stdout contains sensitive information like the password. Don't log it. - LOGFN(INFO) << "exit_code=" << exit_code - << " stderr: " << stderr_buffer; - - // If the UI process did not complete successfully, nothing more to do. - if (exit_code == kUiecEMailMissmatch) { - LOGFN(ERROR) << "WaitForProcess hr=" << putHR(hr); - *status_text = CGaiaCredentialBase::AllocErrorString(IDS_EMAIL_MISMATCH); - return E_UNEXPECTED; - } else if (exit_code != kUiecSuccess) { - return E_ABORT; - } - - std::unique_ptr<base::Value> parsed( - base::JSONReader::Read(stdout_buffer, base::JSON_ALLOW_TRAILING_COMMAS)); - if (!parsed || !parsed->is_dict()) { - LOGFN(ERROR) << "Could not parse data from logon UI"; - *status_text = - CGaiaCredentialBase::AllocErrorString(IDS_INVALID_UI_RESPONSE); - return E_UNEXPECTED; - } - - *result = base::DictionaryValue::From(std::move(parsed)); - return S_OK; -} - -// This function validates the response from GLS and makes sure it contained -// all the fields required to proceed with logon. This does not necessarily -// guarantee that the logon will succeed, only that GLS response seems correct. -HRESULT ValidateAndFixResult(base::DictionaryValue* result, BSTR* status_text) { - DCHECK(result); - DCHECK(status_text); - - // Check that the webui returned all expected values. - - bool has_error = false; - std::string email = GetDictStringUTF8(result, kKeyEmail); - if (email.empty()) { - LOGFN(ERROR) << "Email is empty"; - has_error = true; - } - - std::string fullname = GetDictStringUTF8(result, kKeyFullname); - if (fullname.empty()) { - LOGFN(ERROR) << "Full name is empty"; - has_error = true; - } - - std::string id = GetDictStringUTF8(result, kKeyId); - if (id.empty()) { - LOGFN(ERROR) << "Id is empty"; - has_error = true; - } - - std::string mdm_access_token = GetDictStringUTF8(result, kKeyMdmAcessToken); - if (mdm_access_token.empty()) { - LOGFN(ERROR) << "mdm access token is empty"; - has_error = true; - } - - std::string password = GetDictStringUTF8(result, kKeyPassword); - if (password.empty()) { - LOGFN(ERROR) << "Password is empty"; - has_error = true; - } - - std::string refresh_token = GetDictStringUTF8(result, kKeyRefreshToken); - if (refresh_token.empty()) { - LOGFN(ERROR) << "refresh token is empty"; - has_error = true; - } - - std::string token_handle = GetDictStringUTF8(result, kKeyTokenHandle); - if (token_handle.empty()) { - LOGFN(ERROR) << "Token handle is empty"; - has_error = true; - } - - if (has_error) { - *status_text = - CGaiaCredentialBase::AllocErrorString(IDS_INVALID_UI_RESPONSE); - return E_UNEXPECTED; - } - - std::string username = MakeUsernameFromEmail(email); - result->SetString(kKeyUsername, username); - - return S_OK; -} - -HRESULT BuildCredPackAuthenticationBuffer( - BSTR username, - BSTR password, - CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION* pcpcs) { - DCHECK(username); - DCHECK(password); - DCHECK(pcpcs); - - HRESULT hr = GetAuthenticationPackageId(&(pcpcs->ulAuthenticationPackage)); - if (FAILED(hr)) { - LOGFN(ERROR) << "GetAuthenticationPackageId hr=" << putHR(hr); - return hr; - } - - // Build the full username as "domain\username". The domain in this case - // is the computer name since this is a local account. - - wchar_t computer_name[MAX_COMPUTERNAME_LENGTH + 1]; - DWORD length = base::size(computer_name); - if (!::GetComputerNameW(computer_name, &length)) { - hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "GetComputerNameW hr=" << putHR(hr); - return hr; - } - - length += 1 + SysStringLen(username) + 1; // backslash, username, null - std::unique_ptr<wchar_t[]> domain_username(new wchar_t[length]); - swprintf_s(domain_username.get(), length, L"%s\\%s", computer_name, - OLE2CW(username)); - - // Create the buffer needed to pass back to winlogon. Get length first. - - pcpcs->cbSerialization = 0; - if (!::CredPackAuthenticationBufferW(0, domain_username.get(), - OLE2W(password), nullptr, - &(pcpcs->cbSerialization))) { - hr = HRESULT_FROM_WIN32(::GetLastError()); - if (hr != HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) { - LOGFN(ERROR) << "CredPackAuthenticationBufferW length" - << " dn=" << domain_username.get() << " hr=" << putHR(hr); - return hr; - } - } - - pcpcs->rgbSerialization = - static_cast<LPBYTE>(::CoTaskMemAlloc(pcpcs->cbSerialization)); - if (pcpcs->rgbSerialization == nullptr) { - hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "can't alloc rgbSerialization " - << " dn=" << domain_username.get() << " hr=" << putHR(hr) - << " length=" << pcpcs->cbSerialization; - return hr; - } - - if (!::CredPackAuthenticationBufferW(0, domain_username.get(), - OLE2W(password), pcpcs->rgbSerialization, - &(pcpcs->cbSerialization))) { - hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "CredPackAuthenticationBufferW " - << " dn=" << domain_username.get() << " hr=" << putHR(hr); - return hr; - } - - // Caller should fill this in. - pcpcs->clsidCredentialProvider = GUID_NULL; - return S_OK; -} - -} // namespace - -CGaiaCredentialBase::UIProcessInfo::UIProcessInfo() {} - -CGaiaCredentialBase::UIProcessInfo::~UIProcessInfo() {} - -// static -HRESULT CGaiaCredentialBase::OnDllRegisterServer() { - OSUserManager* manager = OSUserManager::Get(); - - // Generate a random password for the gaia account. - wchar_t password[32]; - HRESULT hr = manager->GenerateRandomPassword(password, base::size(password)); - if (FAILED(hr)) { - LOGFN(ERROR) << "GenerateRandomPassword hr=" << putHR(hr); - return hr; - } - - // Create the special Gaia account used to run the UI. - - CComBSTR sid_string; - bool save_password = true; - base::string16 fullname(GetStringResource(IDS_GAIA_ACCOUNT_FULLNAME)); - base::string16 comment(GetStringResource(IDS_GAIA_ACCOUNT_COMMENT)); - hr = CreateNewUser(manager, kGaiaAccountName, password, fullname.c_str(), - comment.c_str(), /*add_to_users_group=*/false, - &sid_string); - if (hr == HRESULT_FROM_WIN32(NERR_UserExists)) { - // If CreateNewUser() found an existing user, the password was not changed. - // Consider this a success but don't save the newly generated password - // in LSA. - hr = S_OK; - save_password = false; - } else if (FAILED(hr)) { - LOGFN(ERROR) << "CreateNewUser hr=" << putHR(hr); - return hr; - } - - auto policy = ScopedLsaPolicy::Create(POLICY_ALL_ACCESS); - if (!policy) { - hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "ScopedLsaPolicy::Create hr=" << putHR(hr); - return hr; - } - - if (save_password) { - // Save the password in a machine secret area. - hr = policy->StorePrivateData(kLsaKeyGaiaPassword, password); - if (FAILED(hr)) { - LOGFN(ERROR) << "policy.StorePrivateData hr=" << putHR(hr); - return hr; - } - } - - PSID sid; - if (!::ConvertStringSidToSid(sid_string, &sid)) { - hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "ConvertStringSidToSid hr=" << putHR(hr); - return hr; - } - - // Add "logon as batch" right. - hr = policy->AddAccountRights(sid, SE_BATCH_LOGON_NAME); - ::LocalFree(sid); - if (FAILED(hr)) { - LOGFN(ERROR) << "policy.AddAccountRights hr=" << putHR(hr); - return hr; - } - - return S_OK; -} - -// static -HRESULT CGaiaCredentialBase::OnDllUnregisterServer() { - auto policy = ScopedLsaPolicy::Create(POLICY_ALL_ACCESS); - if (policy) { - wchar_t password[32]; - - HRESULT hr = policy->RetrievePrivateData(kLsaKeyGaiaPassword, password, - base::size(password)); - if (FAILED(hr)) - LOGFN(ERROR) << "policy.RetrievePrivateData hr=" << putHR(hr); - - hr = policy->RemovePrivateData(kLsaKeyGaiaPassword); - if (FAILED(hr)) - LOGFN(ERROR) << "policy.RemovePrivateData hr=" << putHR(hr); - - OSUserManager* manager = OSUserManager::Get(); - PSID sid; - - hr = manager->GetUserSID(kGaiaAccountName, &sid); - if (FAILED(hr)) { - LOGFN(ERROR) << "manager.GetUserSID hr=" << putHR(hr); - sid = nullptr; - } - - hr = manager->RemoveUser(kGaiaAccountName, password); - if (FAILED(hr)) - LOGFN(ERROR) << "manager->RemoveUser hr=" << putHR(hr); - - // Remove the account from LSA after the OS account is deleted. - if (sid != nullptr) { - hr = policy->RemoveAccount(sid); - ::LocalFree(sid); - if (FAILED(hr)) - LOGFN(ERROR) << "policy.RemoveAccount hr=" << putHR(hr); - } - } else { - LOGFN(ERROR) << "ScopedLsaPolicy::Create failed"; - } - - return S_OK; -} - -CGaiaCredentialBase::CGaiaCredentialBase() - : logon_ui_process_(INVALID_HANDLE_VALUE), - result_status_(STATUS_SUCCESS), - result_substatus_(STATUS_SUCCESS) {} - -CGaiaCredentialBase::~CGaiaCredentialBase() {} - -bool CGaiaCredentialBase::AreCredentialsValid() const { - return username_.Length() > 0 && password_.Length() > 0 && sid_.Length() > 0; -} - -HRESULT CGaiaCredentialBase::GetStringValueImpl(DWORD field_id, - wchar_t** value) { - HRESULT hr = E_INVALIDARG; - switch (field_id) { - case FID_DESCRIPTION: { - base::string16 description(GetStringResource(IDS_AUTH_FID_DESCRIPTION)); - hr = ::SHStrDupW(description.c_str(), value); - break; - } - case FID_PROVIDER_LABEL: { - base::string16 label(GetStringResource(IDS_AUTH_FID_PROVIDER_LABEL)); - hr = ::SHStrDupW(label.c_str(), value); - break; - } - default: - break; - } - - return hr; -} - -HRESULT CGaiaCredentialBase::FinishOnUserAuthenticated(BSTR username, - BSTR password, - BSTR sid) { - LOGFN(INFO); - DCHECK(username); - DCHECK(password); - DCHECK(sid); - - username_ = username; - password_ = password; - sid_ = sid; - - result_status_ = STATUS_SUCCESS; - result_substatus_ = STATUS_SUCCESS; - result_status_text_.clear(); - - return provider_->OnUserAuthenticated(static_cast<IGaiaCredential*>(this), - username, password, sid); -} - -// static -HRESULT CGaiaCredentialBase::GetAppNameAndCommandline( - const wchar_t* email, - base::CommandLine* command_line) { - DCHECK(email); - DCHECK(command_line); - - // Get the application name. - - base::FilePath install_path; - HRESULT hr = GetInstallDirectory(&install_path); - if (FAILED(hr)) { - LOGFN(ERROR) << "GetInstallDirectory hr=" << putHR(hr); - return hr; - } - - // TODO(crbug.com/887444): Replace this with path to chrome. - command_line->SetProgram( - install_path.Append( - FILE_PATH_LITERAL("weblogin-win32-ia32\\weblogin.exe"))); - - LOGFN(INFO) << "App exe: " << command_line->GetProgram().value(); - - // Get the command line. - - // If an email pattern is specified, pass it to the webui. - wchar_t email_pattern[64]; - ULONG length = base::size(email_pattern); - hr = GetGlobalFlag(L"ep", email_pattern, &length); - if (FAILED(hr)) - email_pattern[0] = 0; - - // TODO: these arguments will not be needed once the electron app is replaced - // with chrome. - std::string id = google_apis::GetOAuth2ClientID(google_apis::CLIENT_MAIN); - std::string secret = - google_apis::GetOAuth2ClientSecret(google_apis::CLIENT_MAIN); - - if (wcslen(email_pattern) > 0) - command_line->AppendSwitchNative("pattern", email_pattern); - - if (email && wcslen(email) > 0) - command_line->AppendSwitchNative("email", email); - - command_line->AppendSwitchASCII("client-id", id); - command_line->AppendSwitchASCII("client-secret", secret); - - LOGFN(INFO) << "Command line: " << command_line->GetCommandLineString(); - return S_OK; -} - -void CGaiaCredentialBase::ResetInternalState() { - LOGFN(INFO); - username_.Empty(); - password_.Empty(); - sid_.Empty(); -} - -HRESULT CGaiaCredentialBase::GetEmailForReauth(wchar_t* email, size_t length) { - if (email == nullptr) - return E_POINTER; - - if (length < 1) - return E_INVALIDARG; - - email[0] = 0; - return S_OK; -} - -HRESULT CGaiaCredentialBase::HandleAutologon( - CREDENTIAL_PROVIDER_GET_SERIALIZATION_RESPONSE* pcpgsr, - CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION* pcpcs) { - LOGFN(INFO) << "user-sid=" << get_sid().m_str; - DCHECK(pcpgsr); - DCHECK(pcpcs); - - if (!AreCredentialsValid()) - return S_FALSE; - - // The OS user has already been created, so return all the information needed - // to log them in. - HRESULT hr = BuildCredPackAuthenticationBuffer(get_username(), get_password(), - pcpcs); - if (FAILED(hr)) { - LOGFN(ERROR) << "BuildCredPackAuthenticationBuffer hr=" << putHR(hr); - return hr; - } - - pcpcs->clsidCredentialProvider = CLSID_GaiaCredentialProvider; - - hr = S_OK; - *pcpgsr = CPGSR_RETURN_CREDENTIAL_FINISHED; - - return hr; -} - -// static -void CGaiaCredentialBase::TellOmahaDidRun() { - // Tell omaha that product was used. Best effort only. - // - // This code always runs as LocalSystem, which means that HKCU maps to - // HKU\.Default. This is OK because omaha reads the "dr" value from subkeys - // of HKEY_USERS. - base::win::RegKey key; - LONG sts = key.Create(HKEY_CURRENT_USER, kRegUpdaterClientStateAppPath, - KEY_SET_VALUE | KEY_WOW64_32KEY); - if (sts != ERROR_SUCCESS) { - LOGFN(INFO) << "Unable to open omaha key sts=" << sts; - } else { - sts = key.WriteValue(L"dr", L"1"); - if (sts != ERROR_SUCCESS) - LOGFN(INFO) << "Unable to write omaha dr value sts=" << sts; - } -} - -// static -HRESULT CGaiaCredentialBase::CreateNewUser(OSUserManager* manager, - const wchar_t* username, - const wchar_t* password, - const wchar_t* fullname, - const wchar_t* comment, - bool add_to_users_group, - BSTR* sid) { - DWORD error; - HRESULT hr = manager->AddUser(username, password, fullname, comment, - add_to_users_group, sid, &error); - LOGFN(INFO) << "hr=" << putHR(hr) << " username=" << username; - return hr; -} - -// static -BSTR CGaiaCredentialBase::AllocErrorString(UINT id) { - CComBSTR str; - str.LoadStringW(CURRENT_MODULE(), id); - return str.Detach(); -} - -// static -HRESULT CGaiaCredentialBase::GetInstallDirectory(base::FilePath* path) { - DCHECK(path); - - if (!base::PathService::Get(base::FILE_MODULE, path)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "Get(FILE_MODULE) hr=" << putHR(hr); - return hr; - } - - *path = path->DirName(); - return S_OK; -} - -// ICredentialProviderCredential ////////////////////////////////////////////// - -HRESULT CGaiaCredentialBase::Advise( - ICredentialProviderCredentialEvents* pcpce) { - LOGFN(INFO); - events_ = pcpce; - return S_OK; -} - -HRESULT CGaiaCredentialBase::UnAdvise(void) { - LOGFN(INFO); - events_.Release(); - return S_OK; -} - -HRESULT CGaiaCredentialBase::SetSelected(BOOL* auto_login) { - *auto_login = AreCredentialsValid(); - LOGFN(INFO) << "auto-login=" << *auto_login; - return S_OK; -} - -HRESULT CGaiaCredentialBase::SetDeselected(void) { - LOGFN(INFO); - - // Terminate login UI process if started. This is best effort since it may - // have already terminated. - if (logon_ui_process_ != INVALID_HANDLE_VALUE) { - LOGFN(INFO) << "Attempting to kill logon UI process"; - ::TerminateProcess(logon_ui_process_, kUiecKilled); - logon_ui_process_ = INVALID_HANDLE_VALUE; - } - - // Do not reset the internal state here, otherwise auto-logon will not work. - - return S_OK; -} - -HRESULT CGaiaCredentialBase::GetFieldState( - DWORD field_id, - CREDENTIAL_PROVIDER_FIELD_STATE* pcpfs, - CREDENTIAL_PROVIDER_FIELD_INTERACTIVE_STATE* pcpfis) { - HRESULT hr = E_INVALIDARG; - switch (field_id) { - case FID_DESCRIPTION: - case FID_SUBMIT: - *pcpfs = CPFS_DISPLAY_IN_SELECTED_TILE; - *pcpfis = CPFIS_NONE; - hr = S_OK; - break; - case FID_PROVIDER_LOGO: - *pcpfs = ::IsWindows8OrGreater() ? CPFS_HIDDEN : CPFS_DISPLAY_IN_BOTH; - *pcpfis = CPFIS_NONE; - hr = S_OK; - break; - case FID_PROVIDER_LABEL: - *pcpfs = ::IsWindows8OrGreater() ? CPFS_HIDDEN - : CPFS_DISPLAY_IN_DESELECTED_TILE; - *pcpfis = CPFIS_NONE; - hr = S_OK; - break; - default: - break; - } - LOGFN(INFO) << "hr=" << putHR(hr) << " field=" << field_id - << " state=" << *pcpfs << " inter-state=" << *pcpfis; - return hr; -} - -HRESULT CGaiaCredentialBase::GetStringValue(DWORD field_id, wchar_t** value) { - return GetStringValueImpl(field_id, value); -} - -HRESULT CGaiaCredentialBase::GetBitmapValue(DWORD field_id, HBITMAP* phbmp) { - HRESULT hr = E_INVALIDARG; - switch (field_id) { - case FID_PROVIDER_LOGO: - *phbmp = ::LoadBitmap(CURRENT_MODULE(), - MAKEINTRESOURCE(IDB_GOOGLE_LOGO_SMALL)); - if (*phbmp) - hr = S_OK; - break; - default: - break; - } - - return hr; -} - -HRESULT CGaiaCredentialBase::GetCheckboxValue(DWORD field_id, - BOOL* pbChecked, - wchar_t** ppszLabel) { - // No checkboxes. - return E_NOTIMPL; -} - -HRESULT CGaiaCredentialBase::GetSubmitButtonValue(DWORD field_id, - DWORD* adjacent_to) { - HRESULT hr = E_INVALIDARG; - switch (field_id) { - case FID_SUBMIT: - *adjacent_to = FID_DESCRIPTION; - hr = S_OK; - break; - default: - break; - } - - return hr; -} - -HRESULT CGaiaCredentialBase::GetComboBoxValueCount(DWORD field_id, - DWORD* pcItems, - DWORD* pdwSelectedItem) { - // No comboboxes. - return E_NOTIMPL; -} - -HRESULT CGaiaCredentialBase::GetComboBoxValueAt(DWORD field_id, - DWORD dwItem, - wchar_t** ppszItem) { - // No comboboxes. - return E_NOTIMPL; -} - -HRESULT CGaiaCredentialBase::SetStringValue(DWORD field_id, - const wchar_t* psz) { - // No editable strings. - HRESULT hr = E_INVALIDARG; - return hr; -} - -HRESULT CGaiaCredentialBase::SetCheckboxValue(DWORD field_id, BOOL bChecked) { - // No checkboxes. - return E_NOTIMPL; -} - -HRESULT CGaiaCredentialBase::SetComboBoxSelectedValue(DWORD field_id, - DWORD dwSelectedItem) { - // No comboboxes. - return E_NOTIMPL; -} - -HRESULT CGaiaCredentialBase::CommandLinkClicked(DWORD dwFieldID) { - // No links. - return E_NOTIMPL; -} - -HRESULT CGaiaCredentialBase::GetSerialization( - CREDENTIAL_PROVIDER_GET_SERIALIZATION_RESPONSE* pcpgsr, - CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION* pcpcs, - wchar_t** ppszOptionalStatusText, - CREDENTIAL_PROVIDER_STATUS_ICON* pcpsiOptionalStatusIcon) { - LOGFN(INFO); - - HRESULT hr = HandleAutologon(pcpgsr, pcpcs); - - // Clear the state of the credential on error or on autologon. - if (hr != S_FALSE) - ResetInternalState(); - - if (FAILED(hr)) { - LOGFN(ERROR) << "HandleAutologon hr=" << putHR(hr); - return hr; - } - - // If HandleAutologon returns S_FALSE, then there was not enough information - // to log the user on. Display the Gaia sign in page. - if (hr == S_FALSE) { - LOGFN(INFO) << "HandleAutologon hr=" << putHR(hr); - TellOmahaDidRun(); - - // The account creation is async so we are not done yet. - *pcpgsr = CPGSR_NO_CREDENTIAL_NOT_FINISHED; - - // The expectation is that the UI will eventually return the username, - // password, and auth to this CGaiaCredentialBase object, so that - // OnUserAuthenticated() can be called, followed by - // provider_->OnUserAuthenticated(). - hr = CreateAndRunLogonStub(); - } - - return hr; -} - -HRESULT CGaiaCredentialBase::CreateAndRunLogonStub() { - LOGFN(INFO); - - wchar_t email[64]; - HRESULT hr = GetEmailForReauth(email, base::size(email)); - if (FAILED(hr)) { - LOGFN(ERROR) << "GetEmailForReauth hr=" << putHR(hr); - return hr; - } - - base::CommandLine command_line(base::CommandLine::NO_PROGRAM); - hr = GetAppNameAndCommandline(email, &command_line); - if (FAILED(hr)) { - LOGFN(ERROR) << "GetAppNameAndCommandline hr=" << putHR(hr); - return hr; - } - - // The process should start on the interactive window station (since it - // needs to show a UI) but on its own desktop so that it cannot interact - // with winlogon on user windows. - std::unique_ptr<UIProcessInfo> uiprocinfo(new UIProcessInfo); - PSID logon_sid; - OSProcessManager* process_manager = OSProcessManager::Get(); - hr = CreateGaiaLogonToken(process_manager, &uiprocinfo->logon_token, - &logon_sid); - if (FAILED(hr)) { - LOGFN(ERROR) << "CreateGaiaLogonToken hr=" << putHR(hr); - return hr; - } - - hr = process_manager->SetupPermissionsForLogonSid(logon_sid); - LocalFree(logon_sid); - if (FAILED(hr)) { - LOGFN(ERROR) << "SetupPermissionsForLogonSid hr=" << putHR(hr); - return hr; - } - - hr = ForkGaiaLogonStub(process_manager, command_line, uiprocinfo.get()); - if (FAILED(hr)) { - LOGFN(ERROR) << "ForkGaiaLogonStub hr=" << putHR(hr); - return hr; - } - - // Save the handle to the logon UI process so that it can be killed should - // the credential be Unadvise()d. - logon_ui_process_ = uiprocinfo->procinfo.process_handle(); - - uiprocinfo->credential = this; - - // Background thread takes ownership of |uiprocinfo|. - unsigned int wait_thread_id; - uintptr_t wait_thread = _beginthreadex( - nullptr, 0, WaitForLoginUI, uiprocinfo.release(), 0, &wait_thread_id); - if (wait_thread != 0) { - LOGFN(INFO) << "Started wait thread id=" << wait_thread_id; - ::CloseHandle((HANDLE)wait_thread); - } else { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "Unable to start wait thread hr=" << putHR(hr); - ::TerminateProcess(uiprocinfo->procinfo.process_handle(), kUiecKilled); - return hr; - } - - // This function returns success, which means that GetSerialization() will - // return success. CGaiaCredentialBase is now committed to telling - // CGaiaCredentialProvider whether the serialization eventually succeeds or - // fails, so that CGaiaCredentialProvider can in turn inform winlogon about - // what happened. - LOGFN(INFO) << "cleaning up"; - return S_OK; -} - -// static -HRESULT CGaiaCredentialBase::CreateGaiaLogonToken( - OSProcessManager* manager, - base::win::ScopedHandle* token, - PSID* sid) { - DCHECK(manager); - DCHECK(token); - DCHECK(sid); - - auto policy = ScopedLsaPolicy::Create(POLICY_ALL_ACCESS); - if (!policy) { - LOGFN(ERROR) << "LsaOpenPolicy failed"; - return E_UNEXPECTED; - } - - wchar_t password[32]; - HRESULT hr = policy->RetrievePrivateData(kLsaKeyGaiaPassword, password, - base::size(password)); - if (FAILED(hr)) { - LOGFN(ERROR) << "policy.RetrievePrivateData hr=" << putHR(hr); - return hr; - } - - hr = manager->CreateLogonToken(kGaiaAccountName, password, token); - if (FAILED(hr)) { - LOGFN(ERROR) << "CreateLogonToken hr=" << putHR(hr); - return hr; - } - - hr = manager->GetTokenLogonSID(*token, sid); - if (FAILED(hr)) { - LOGFN(ERROR) << "GetTokenLogonSID hr=" << putHR(hr); - token->Close(); - return hr; - } - - wchar_t* sid_string; - if (::ConvertSidToStringSid(*sid, &sid_string)) { - LOGFN(INFO) << "logon-sid=" << sid_string; - LocalFree(sid_string); - } else { - LOGFN(ERROR) << "logon-sid=<can't get string>"; - } - - return S_OK; -} - -// static -HRESULT CGaiaCredentialBase::ForkGaiaLogonStub( - OSProcessManager* process_manager, - const base::CommandLine& command_line, - UIProcessInfo* uiprocinfo) { - LOGFN(INFO); - DCHECK(process_manager); - DCHECK(uiprocinfo); - - ScopedStartupInfo startupinfo(kDesktopFullName); - HRESULT hr = InitializeStdHandles(CommDirection::kChildToParentOnly, - &startupinfo, &uiprocinfo->parent_handles); - if (FAILED(hr)) { - LOGFN(ERROR) << "InitializeStdHandles hr=" << putHR(hr); - return hr; - } - - // The process is created suspended so that we can adjust its environment - // before it starts. Also, it must not run before it is added to the job - // object. - hr = process_manager->CreateProcessWithToken( - uiprocinfo->logon_token, command_line, startupinfo.GetInfo(), - &uiprocinfo->procinfo); - if (FAILED(hr)) { - LOGFN(ERROR) << "CreateProcessWithTokenW hr=" << putHR(hr); - return hr; - } - - LOGFN(INFO) << "pid=" << uiprocinfo->procinfo.process_id() - << " tid=" << uiprocinfo->procinfo.thread_id(); - - // Don't create a job here with UI restrictions, since win10 does not allow - // nested jobs unless all jobs don't specify UI restrictions. Since chrome - // will set a job with UI restrictions for renderer/gpu/etc processes, setting - // one here causes chrome to fail. - - // Environment is fully set up for UI, so let it go. - if (::ResumeThread(uiprocinfo->procinfo.thread_handle()) == - static_cast<DWORD>(-1)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "ResumeThread hr=" << putHR(hr); - ::TerminateProcess(uiprocinfo->procinfo.process_handle(), kUiecKilled); - return hr; - } - - // Don't close the desktop until after the process has started and acquired - // a handle to it. Otherwise, the desktop will be destroyed and the process - // will fail to start. - // - // WaitForInputIdle() return immediately with an error if the process created - // is a console app. To handle this case, if the wait call fails just wait - // for 2 secs. In practice the logon stub won't be a console app, but it - // was a console app during early testing. - DWORD ret = ::WaitForInputIdle(uiprocinfo->procinfo.process_handle(), 10000); - if (ret != 0) { - LOGFN(INFO) << "WaitForInputIdle, sleeping for 2 secs ret=" << ret; - Sleep(2000); - } - - return S_OK; -} - -// static -HRESULT CGaiaCredentialBase::ForkSaveAccountInfoStub( - const std::unique_ptr<base::DictionaryValue>& dict, - BSTR* status_text) { - LOGFN(INFO); - DCHECK(status_text); - - ScopedStartupInfo startupinfo; - StdParentHandles parent_handles; - HRESULT hr = InitializeStdHandles(CommDirection::kParentToChildOnly, - &startupinfo, &parent_handles); - if (FAILED(hr)) { - LOGFN(ERROR) << "InitializeStdHandles hr=" << putHR(hr); - *status_text = AllocErrorString(IDS_INTERNAL_ERROR); - return hr; - } - - wchar_t command_line[MAX_PATH + 32]; - hr = GetCommandLineForEntrypoint(CURRENT_MODULE(), L"SaveAccountInfo", - command_line, base::size(command_line)); - if (FAILED(hr)) { - LOGFN(ERROR) << "GetCommandLineForEntryPoint hr=" << putHR(hr); - *status_text = AllocErrorString(IDS_INTERNAL_ERROR); - return hr; - } - - PROCESS_INFORMATION temp_procinfo = {}; - if (!::CreateProcessW(L"rundll32.exe", // Exe name - command_line, // Command line - nullptr, // process secattr - nullptr, // thread secattr - TRUE, // Inherit handles - 0, // Creation flags - nullptr, // Environment - nullptr, // Current directory - startupinfo.GetInfo(), &temp_procinfo)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "CreateProcess hr=" << putHR(hr); - *status_text = AllocErrorString(IDS_INTERNAL_ERROR); - return hr; - } - base::win::ScopedProcessInformation procinfo(temp_procinfo); - - // Write account info to stdin of child process. This buffer is read by - // SaveAccountInfoW() in dllmain.cpp. - std::string json; - if (base::JSONWriter::Write(*dict, &json)) { - DWORD written; - if (!::WriteFile(parent_handles.hstdin_write.Get(), json.c_str(), - json.length() + 1, &written, /*lpOverlapped=*/nullptr)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "WriteFile hr=" << putHR(hr); - *status_text = AllocErrorString(IDS_INTERNAL_ERROR); - } - } else { - LOGFN(ERROR) << "base::JSONWriter::Write failed"; - } - - return S_OK; -} - -// static -unsigned __stdcall CGaiaCredentialBase::WaitForLoginUI(void* param) { - DCHECK(param); - std::unique_ptr<UIProcessInfo> uiprocinfo( - reinterpret_cast<UIProcessInfo*>(param)); - - // If WaitForLoginUIImpl() returns successfully, it is assumed that the - // returned property list |properties| is valid and contains all properties - // needed to continue with logon. - std::unique_ptr<base::DictionaryValue> properties; - CComBSTR status_text; - HRESULT hr = WaitForLoginUIImpl(uiprocinfo.get(), &properties, &status_text); - if (SUCCEEDED(hr)) { - // Notify that the new user is created. - // TODO(rogerta): Docs say this should not be called on a background thread, - // but on the thread that received the CGaiaCredentialBase::Advise() call. - // Seems to work for now though, but I suspect there could be a problem if - // this call races with a call to CGaiaCredentialBase::Unadvise(). - base::string16 username = GetDictString(properties, kKeyUsername); - base::string16 password = GetDictString(properties, kKeyPassword); - base::string16 sid = GetDictString(properties, kKeySID); - - if (SUCCEEDED(hr)) { - hr = uiprocinfo->credential->OnUserAuthenticated( - CComBSTR(W2COLE(username.c_str())), - CComBSTR(W2COLE(password.c_str())), CComBSTR(W2COLE(sid.c_str()))); - if (FAILED(hr)) { - LOGFN(ERROR) << "uiprocinfo->credential->OnUserAuthenticated hr=" - << putHR(hr); - } - } - } else if (hr == E_ABORT) { - // User aborted logon. - HRESULT hr = uiprocinfo->credential->ReportError( - STATUS_SUCCESS, STATUS_SUCCESS, status_text); - if (FAILED(hr)) { - LOGFN(INFO) << "uiprocinfo->credential->ReportError hr=" << putHR(hr); - } - } else { - // TODO(rogerta): for some reason the error info saved by ReportError() - // never gets used because ReportResult() is never called by winlogon.exe - // when the logon fails. Not sure what I'm doing wrong here. This - // message box does show the error at the appropriate time though. - base::string16 title(GetStringResource(IDS_ERROR_DIALOG_TITLE)); - ::MessageBoxW(nullptr, OLE2CW(status_text), title.c_str(), - MB_TOPMOST | MB_SETFOREGROUND | MB_ICONERROR | MB_OK); - - hr = uiprocinfo->credential->ReportError(HRESULT_CODE(hr), STATUS_SUCCESS, - status_text); - if (FAILED(hr)) { - LOGFN(ERROR) << "uiprocinfo->credential->ReportError hr=" << putHR(hr); - } - } - - LOGFN(INFO) << "done"; - return 0; -} - -// static -HRESULT CGaiaCredentialBase::WaitForLoginUIImpl( - UIProcessInfo* uiprocinfo, - std::unique_ptr<base::DictionaryValue>* properties, - BSTR* status_text) { - USES_CONVERSION; - LOGFN(INFO); - DCHECK(uiprocinfo); - DCHECK(properties); - DCHECK(status_text); - - properties->reset(); - *status_text = nullptr; - std::unique_ptr<base::DictionaryValue> dict; - - HRESULT hr = WaitForLoginUIAndGetResult(uiprocinfo, &dict, status_text); - if (FAILED(hr)) { - if (hr != E_ABORT) - LOGFN(ERROR) << "WaitForLoginUIAndGetResult hr=" << putHR(hr); - return hr; - } - - hr = ValidateAndFixResult(dict.get(), status_text); - if (FAILED(hr)) { - LOGFN(ERROR) << "ValidateAndFixResult hr=" << putHR(hr); - return hr; - } - - // From this point the code assume the dictionary |dict| is valid. - - CComBSTR sid; - hr = uiprocinfo->credential->FinishAuthentication( - CComBSTR(W2COLE(GetDictString(dict, kKeyUsername).c_str())), - CComBSTR(W2COLE(GetDictString(dict, kKeyPassword).c_str())), - CComBSTR(W2COLE(GetDictString(dict, kKeyFullname).c_str())), &sid, - status_text); - if (FAILED(hr)) { - LOGFN(ERROR) << "credential->FinishAuthentication hr=" << putHR(hr); - return hr; - } - - dict->SetString(kKeySID, OLE2CA(sid)); - - // Fire off a process to call SaveAccountInfo(). - // - // The eventual call to OnUserAuthenticated() will tell winlogon that logging - // in is finished. It seems that winlogon will kill this process after a short - // time, which races with an attempt to save the account info to the registry - // if done here. For this reason a child pocess is used. - hr = ForkSaveAccountInfoStub(dict, status_text); - if (FAILED(hr)) { - LOGFN(ERROR) << "ForkSaveAccountInfoStub hr=" << putHR(hr); - return hr; - } - - *properties = std::move(dict); - - // When this function returns, winlogon will be told to logon to the newly - // created account. This is important, as the save account info process - // can't actually save the info until the user's profile is created, which - // happens on first logon. - - return S_OK; -} - -// static -HRESULT CGaiaCredentialBase::SaveAccountInfo( - const base::DictionaryValue& properties) { - LOGFN(INFO); - - base::string16 sid = GetDictString(&properties, kKeySID); - if (sid.empty()) { - LOGFN(ERROR) << "SID is empty"; - return E_INVALIDARG; - } - - base::string16 username = GetDictString(&properties, kKeyUsername); - if (username.empty()) { - LOGFN(ERROR) << "Username is empty"; - return E_INVALIDARG; - } - - base::string16 password = GetDictString(&properties, kKeyPassword); - if (password.empty()) { - LOGFN(ERROR) << "Password is empty"; - return E_INVALIDARG; - } - - // Load the user's profile so that their regsitry hive is available. - auto profile = ScopedUserProfile::Create(sid, username, password); - if (!profile) { - LOGFN(ERROR) << "Could not load user profile"; - return E_UNEXPECTED; - } - - HRESULT hr = profile->SaveAccountInfo(properties); - if (FAILED(hr)) - LOGFN(ERROR) << "profile.SaveAccountInfo failed (cont) hr=" << putHR(hr); - - return hr; -} - -HRESULT CGaiaCredentialBase::ReportResult( - NTSTATUS status, - NTSTATUS substatus, - wchar_t** ppszOptionalStatusText, - CREDENTIAL_PROVIDER_STATUS_ICON* pcpsiOptionalStatusIcon) { - LOGFN(INFO) << "status=" << putHR(status) - << " substatus=" << putHR(substatus); - - *ppszOptionalStatusText = nullptr; - *pcpsiOptionalStatusIcon = CPSI_NONE; - ResetInternalState(); - return S_OK; -} - -HRESULT CGaiaCredentialBase::GetUserSid(wchar_t** sid) { - *sid = nullptr; - return S_FALSE; -} - -HRESULT CGaiaCredentialBase::Initialize(IGaiaCredentialProvider* provider) { - LOGFN(INFO); - DCHECK(provider); - - provider_ = provider; - return S_OK; -} - -HRESULT CGaiaCredentialBase::Terminate() { - LOGFN(INFO); - SetDeselected(); - provider_.Release(); - return S_OK; -} - -HRESULT CGaiaCredentialBase::FinishAuthentication(BSTR username, - BSTR password, - BSTR fullname, - BSTR* sid, - BSTR* error_text) { - // Derived classes need to implement this. - return E_NOTIMPL; -} - -HRESULT CGaiaCredentialBase::OnUserAuthenticated(BSTR username, - BSTR password, - BSTR sid) { - return FinishOnUserAuthenticated(username, password, sid); -} - -HRESULT CGaiaCredentialBase::ReportError(LONG status, - LONG substatus, - BSTR status_text) { - USES_CONVERSION; - LOGFN(INFO); - - result_status_ = status; - result_substatus_ = substatus; - - if (status_text != nullptr) - result_status_text_.assign(OLE2CW(status_text)); - - return provider_->OnUserAuthenticated(nullptr, CComBSTR(), CComBSTR(), - CComBSTR()); -} - -} // namespace credential_provider -
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_base.h b/chrome/credential_provider/gaiacp/gaia_credential_base.h deleted file mode 100644 index 84746310..0000000 --- a/chrome/credential_provider/gaiacp/gaia_credential_base.h +++ /dev/null
@@ -1,228 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_GAIACP_GAIA_CREDENTIAL_BASE_H_ -#define CHROME_CREDENTIAL_PROVIDER_GAIACP_GAIA_CREDENTIAL_BASE_H_ - -#include "chrome/credential_provider/gaiacp/stdafx.h" - -#include <memory> - -#include "base/strings/string16.h" -#include "base/values.h" -#include "base/win/scoped_handle.h" -#include "base/win/scoped_process_information.h" -#include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h" -#include "chrome/credential_provider/gaiacp/gcp_utils.h" -#include "chrome/credential_provider/gaiacp/grit/gaia_resources.h" -#include "chrome/credential_provider/gaiacp/scoped_handle.h" - -namespace base { -class CommandLine; -class FilePath; -} // namespace base - -namespace credential_provider { - -class OSProcessManager; -class OSUserManager; - -enum FIELDID { - FID_DESCRIPTION, - FID_SUBMIT, - FID_PROVIDER_LOGO, - FID_PROVIDER_LABEL, - FIELD_COUNT // Must be last. -}; - -// Implementation of an ICredentialProviderCredential backed by a Gaia account. -// This is used as a base class for the COM objects that implement first time -// sign in and password update. -class ATL_NO_VTABLE CGaiaCredentialBase - : public IGaiaCredential, - public ICredentialProviderCredential2 { - public: - // Size in wchar_t of string buffer to pass account information to background - // process to save that information into the registry. - const static int kAccountInfoBufferSize = 1024; - - // Called when the DLL is registered or unregistered. - static HRESULT OnDllRegisterServer(); - static HRESULT OnDllUnregisterServer(); - - // Saves gaia information in the OS account that was just created. - static HRESULT SaveAccountInfo(const base::DictionaryValue& properties); - - // Allocates a BSTR from a DLL string resource given by |id|. - static BSTR AllocErrorString(UINT id); - - // Gets the directory where the credential provider is installed. - static HRESULT GetInstallDirectory(base::FilePath* path); - - // Passed to WaitForLoginUI(). - struct UIProcessInfo { - UIProcessInfo(); - ~UIProcessInfo(); - - CComPtr<IGaiaCredential> credential; - base::win::ScopedHandle logon_token; - base::win::ScopedProcessInformation procinfo; - StdParentHandles parent_handles; - }; - - protected: - CGaiaCredentialBase(); - ~CGaiaCredentialBase(); - - // Creates a new windows OS user with the given username, fullname, and - // password on the local machine. Returns the SID of the new user. - static HRESULT CreateNewUser(OSUserManager* manager, - const wchar_t* username, - const wchar_t* password, - const wchar_t* fullname, - const wchar_t* comment, - bool add_to_users_group, - BSTR* sid); - - // Members to access user credentials. - const CComBSTR& get_username() const { return username_; } - const CComBSTR& get_password() const { return password_; } - const CComBSTR& get_sid() const { return sid_; } - bool AreCredentialsValid() const; - - // Gets the string value for the given credential UI field. - HRESULT GetStringValueImpl(DWORD field_id, wchar_t** value); - - // Called from derived classes when implementing OnUserAuthenticated(). - HRESULT FinishOnUserAuthenticated(BSTR username, BSTR password, BSTR sid); - - private: - static HRESULT GetAppNameAndCommandline(const wchar_t* email, - base::CommandLine* command_line); - - // Resets the state of the credential, forgetting any username or password - // that may have been set previously. Derived classes may override to - // perform more state resetting if needed, but should always call the base - // class method. - virtual void ResetInternalState(); - - // Derived classes should implement this function to return an email address - // only when reauthenticating the user. - virtual HRESULT GetEmailForReauth(wchar_t* email, size_t length); - - // Called from GetSerialization() to handle auto-logon. If the credential - // has enough information in internal state to auto-logon, the two arguments - // are filled in as needed and S_OK is returned. S_FALSE is returned to - // indicate that the UI should be shown to the user. - HRESULT HandleAutologon( - CREDENTIAL_PROVIDER_GET_SERIALIZATION_RESPONSE* pcpgsr, - CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION* pcpcs); - - // Writes value to omaha registry to record that GCP has been used. - static void TellOmahaDidRun(); - - // Sets up the envriroment for the Gaia logon stub, runs it, and waits for - // it to finish in a background thread. - HRESULT CreateAndRunLogonStub(); - - // Creates a restricted token for the Gaia account that can be used to run - // the logon stub. The returned SID is a logon SID and not the SID of the - // Gaia account. - static HRESULT CreateGaiaLogonToken(OSProcessManager* manager, - base::win::ScopedHandle* token, - PSID* sid); - - // Forks the logon stub process and waits for it to start. - static HRESULT ForkGaiaLogonStub(OSProcessManager* process_manager, - const base::CommandLine& command_line, - UIProcessInfo* uiprocinfo); - - // Forks a stub process to save account information for a user. - static HRESULT ForkSaveAccountInfoStub( - const std::unique_ptr<base::DictionaryValue>& dict, - BSTR* status_text); - - // The param is a pointer to a UIProcessInfo struct. This function must - // release the memory for this structure using delete operator. - static unsigned __stdcall WaitForLoginUI(void* param); - static HRESULT WaitForLoginUIImpl( - UIProcessInfo* uiprocinfo, - std::unique_ptr<base::DictionaryValue>* properties, - BSTR* status_text); - - // ICredentialProviderCredential2 - IFACEMETHODIMP Advise(ICredentialProviderCredentialEvents* pcpce) override; - IFACEMETHODIMP UnAdvise(void) override; - IFACEMETHODIMP SetSelected(BOOL* auto_login) override; - IFACEMETHODIMP SetDeselected(void) override; - IFACEMETHODIMP GetFieldState( - DWORD dwFieldID, - CREDENTIAL_PROVIDER_FIELD_STATE* pcpfs, - CREDENTIAL_PROVIDER_FIELD_INTERACTIVE_STATE* pcpfis) override; - IFACEMETHODIMP GetStringValue(DWORD dwFieldID, wchar_t** ppsz) override; - IFACEMETHODIMP GetBitmapValue(DWORD dwFieldID, HBITMAP* phbmp) override; - IFACEMETHODIMP GetCheckboxValue(DWORD field_id, - BOOL* pbChecked, - wchar_t** ppszLabel) override; - IFACEMETHODIMP GetSubmitButtonValue(DWORD field_id, - DWORD* pdwAdjacentTo) override; - IFACEMETHODIMP GetComboBoxValueCount(DWORD field_id, - DWORD* pcItems, - DWORD* pdwSelectedItem) override; - IFACEMETHODIMP GetComboBoxValueAt(DWORD field_id, - DWORD dwItem, - wchar_t** ppszItem) override; - IFACEMETHODIMP SetStringValue(DWORD field_id, const wchar_t* psz) override; - IFACEMETHODIMP SetCheckboxValue(DWORD field_id, BOOL bChecked) override; - IFACEMETHODIMP SetComboBoxSelectedValue(DWORD field_id, - DWORD dwSelectedItem) override; - IFACEMETHODIMP CommandLinkClicked(DWORD field_id) override; - IFACEMETHODIMP GetSerialization( - CREDENTIAL_PROVIDER_GET_SERIALIZATION_RESPONSE* pcpgsr, - CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION* pcpcs, - wchar_t** ppszOptionalStatusText, - CREDENTIAL_PROVIDER_STATUS_ICON* pcpsiOptionalStatusIcon) override; - IFACEMETHODIMP ReportResult( - NTSTATUS ntsStatus, - NTSTATUS ntsSubstatus, - wchar_t** ppszOptionalStatusText, - CREDENTIAL_PROVIDER_STATUS_ICON* pcpsiOptionalStatusIcon) override; - IFACEMETHODIMP GetUserSid(wchar_t** sid) override; - - // IGaiaCredential - IFACEMETHODIMP Initialize(IGaiaCredentialProvider* provider) override; - IFACEMETHODIMP Terminate() override; - IFACEMETHODIMP FinishAuthentication(BSTR username, - BSTR password, - BSTR fullname, - BSTR* sid, - BSTR* error_text) override; - IFACEMETHODIMP OnUserAuthenticated(BSTR username, - BSTR password, - BSTR sid) override; - IFACEMETHODIMP ReportError(LONG status, - LONG substatus, - BSTR status_text) override; - - CComPtr<ICredentialProviderCredentialEvents> events_; - - // Handle to the logon UI process. - HANDLE logon_ui_process_; - - CComPtr<IGaiaCredentialProvider> provider_; - - // Information about the just created or re-auth-ed user. - CComBSTR username_; - CComBSTR password_; - CComBSTR sid_; - - // Whether success or failure, these members hold information about result. - NTSTATUS result_status_; - NTSTATUS result_substatus_; - base::string16 result_status_text_; -}; - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_GAIA_CREDENTIAL_BASE_H_
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_provider.cc b/chrome/credential_provider/gaiacp/gaia_credential_provider.cc deleted file mode 100644 index 39b66b7..0000000 --- a/chrome/credential_provider/gaiacp/gaia_credential_provider.cc +++ /dev/null
@@ -1,501 +0,0 @@ -// Copyright 2018 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/credential_provider/gaiacp/gaia_credential_provider.h" - -#include <iomanip> -#include <map> - -#include "base/json/json_reader.h" -#include "base/stl_util.h" -#include "base/strings/string16.h" -#include "base/strings/stringprintf.h" -#include "base/values.h" -#include "chrome/credential_provider/gaiacp/gaia_credential.h" -#include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h" -#include "chrome/credential_provider/gaiacp/gcp_strings.h" -#include "chrome/credential_provider/gaiacp/logging.h" -#include "chrome/credential_provider/gaiacp/os_user_manager.h" -#include "chrome/credential_provider/gaiacp/reauth_credential.h" -#include "chrome/credential_provider/gaiacp/reg_utils.h" -#include "chrome/credential_provider/gaiacp/win_http_url_fetcher.h" - -namespace credential_provider { - -#define W2CW(p) const_cast<wchar_t*>(p) - -static const CREDENTIAL_PROVIDER_FIELD_DESCRIPTOR g_field_desc[] = { - {FID_DESCRIPTION, CPFT_LARGE_TEXT, W2CW(L"Description"), GUID_NULL}, - {FID_SUBMIT, CPFT_SUBMIT_BUTTON, W2CW(L"Submit button"), GUID_NULL}, - {FID_PROVIDER_LOGO, CPFT_TILE_IMAGE, W2CW(L"Provider logo"), - CPFG_CREDENTIAL_PROVIDER_LOGO}, - {FID_PROVIDER_LABEL, CPFT_LARGE_TEXT, W2CW(L"Provider label"), - CPFG_CREDENTIAL_PROVIDER_LABEL}, -}; - -static_assert(base::size(g_field_desc) == FIELD_COUNT, - "g_field_desc does not match FIELDID enum"); - -CGaiaCredentialProvider::CGaiaCredentialProvider() {} - -CGaiaCredentialProvider::~CGaiaCredentialProvider() {} - -HRESULT CGaiaCredentialProvider::FinalConstruct() { - LOGFN(INFO); - CleanupStaleTokenHandles(); - return S_OK; -} - -void CGaiaCredentialProvider::FinalRelease() { - LOGFN(INFO); - ClearTransient(); -} - -HRESULT CGaiaCredentialProvider::CreateGaiaCredential() { - if (users_.size() > 0) { - LOG(ERROR) << "Users should be empty"; - return E_UNEXPECTED; - } - - CComPtr<IGaiaCredential> cred; - HRESULT hr = CComCreator<CComObject<CGaiaCredential>>::CreateInstance( - nullptr, IID_IGaiaCredential, (void**)&cred); - if (FAILED(hr)) { - LOG(ERROR) << "Could not create credential hr=" << putHR(hr); - return hr; - } - - hr = cred->Initialize(this); - if (FAILED(hr)) { - LOG(ERROR) << "Could not initialize credential hr=" << putHR(hr); - return hr; - } - - users_.emplace_back(cred); - return S_OK; -} - -HRESULT CGaiaCredentialProvider::DestroyCredentials() { - LOGFN(INFO); - for (auto it = users_.begin(); it != users_.end(); ++it) - (*it)->Terminate(); - - users_.clear(); - return S_OK; -} - -void CGaiaCredentialProvider::ClearTransient() { - LOGFN(INFO); - // Reset event support. - advise_context_ = 0; - events_.Release(); - new_user_sid_.Empty(); - index_ = std::numeric_limits<size_t>::max(); -} - -void CGaiaCredentialProvider::CleanupStaleTokenHandles() { - LOGFN(INFO); - std::map<base::string16, base::string16> handles; - - HRESULT hr = GetUserTokenHandles(&handles); - if (FAILED(hr)) { - LOGFN(ERROR) << "GetUserTokenHandles hr=" << putHR(hr); - return; - } - - OSUserManager* manager = OSUserManager::Get(); - for (auto it = handles.cbegin(); it != handles.cend(); ++it) { - HRESULT hr = manager->FindUserBySID(it->first.c_str()); - if (hr == HRESULT_FROM_WIN32(ERROR_NONE_MAPPED)) { - RemoveAllUserProperties(it->first.c_str()); - } else if (FAILED(hr)) { - LOGFN(ERROR) << "manager->FindUserBySID hr=" << putHR(hr); - } - } -} - -// IGaiaCredentialProvider //////////////////////////////////////////////////// - -HRESULT CGaiaCredentialProvider::OnUserAuthenticated(IUnknown* credential, - BSTR /*username*/, - BSTR /*password*/, - BSTR sid) { - DCHECK(credential); - DCHECK(sid); - - // |credential| should be in the |users_|. Find its index. - index_ = std::numeric_limits<size_t>::max(); - for (size_t i = 0; i < users_.size(); ++i) { - if (users_[i].IsEqualObject(credential)) { - index_ = i; - break; - } - } - if (index_ == std::numeric_limits<size_t>::max()) { - LOGFN(INFO) << "Could not find credential"; - return E_INVALIDARG; - } - - new_user_sid_ = sid; - - // Tell winlogon.exe that credential info has changed. This provider will - // make the newly created user the default login credential with auto - // logon enabled. See GetCredentialCount() for more detais. - HRESULT hr = S_OK; - if (events_) - hr = events_->CredentialsChanged(advise_context_); - - LOGFN(INFO) << "hr=" << putHR(hr) << " sid=" << new_user_sid_.m_str - << " index=" << index_; - return hr; -} - -// IGaiaCredentialProviderForTesting ////////////////////////////////////////// - -HRESULT CGaiaCredentialProvider::SetReauthCheckDoneEvent(INT_PTR event) { - DCHECK(event); - reauth_check_done_event_ = reinterpret_cast<HANDLE>(event); - return S_OK; -} - -// ICredentialProvider //////////////////////////////////////////////////////// - -HRESULT CGaiaCredentialProvider::SetUserArray( - ICredentialProviderUserArray* users) { - LOGFN(INFO); - std::map<base::string16, base::string16> sid_to_username; - - // Get the SIDs of all users being shown in the logon UI. - { - if (!users) { - LOGFN(ERROR) << "hr=" << putHR(E_INVALIDARG); - return E_INVALIDARG; - } - - HRESULT hr = users->SetProviderFilter(Identity_LocalUserProvider); - if (FAILED(hr)) { - LOGFN(ERROR) << "users->SetProviderFilter hr=" << putHR(hr); - return hr; - } - - DWORD count; - hr = users->GetCount(&count); - if (FAILED(hr)) { - LOGFN(ERROR) << "users->GetCount hr=" << putHR(hr); - return hr; - } - - LOGFN(INFO) << "count=" << count; - - for (DWORD i = 0; i < count; ++i) { - CComPtr<ICredentialProviderUser> user; - hr = users->GetAt(i, &user); - if (FAILED(hr)) { - LOGFN(ERROR) << "users->GetAt hr=" << putHR(hr); - return hr; - } - - wchar_t* sid = nullptr; - wchar_t* username = nullptr; - - hr = user->GetSid(&sid); - if (SUCCEEDED(hr)) - hr = user->GetStringValue(PKEY_Identity_UserName, &username); - - if (SUCCEEDED(hr)) { - sid_to_username.emplace(sid, username); - } else { - LOGFN(ERROR) << "Can't get sid or username hr=" << putHR(hr); - } - - ::CoTaskMemFree(username); - ::CoTaskMemFree(sid); - } - } - - // For each SID, check to see if this user requires reauth. - for (const auto& kv : sid_to_username) { - DWORD needs_reauth = 0; - HRESULT hr = GetUserProperty(kv.first.c_str(), kUserNeedsReauth, - &needs_reauth); - if (FAILED(hr)) { - needs_reauth = 0; - hr = S_OK; - } - - if (needs_reauth) { - // Get the user's email address. If not found, proceed anyway. The net - // effect is that the user will need to enter their email address - // manually instead of it being pre-filled. Need to see if it would be - // better to just fail. - wchar_t email[64]; - ULONG length = base::size(email); - hr = GetUserProperty(kv.first.c_str(), kUserEmail, email, &length); - if (FAILED(hr)) { - LOGFN(ERROR) << "GetUserProperty(" << kv.first << ", email)" - << " hr=" << putHR(hr); - email[0] = 0; - hr = S_OK; - } - - LOGFN(INFO) << "User needs reauth sid=" << kv.first - << " user=" << kv.second << " email=" << email; - - CComPtr<IGaiaCredential> cred; - hr = CComCreator<CComObject<CReauthCredential>>::CreateInstance( - nullptr, IID_IGaiaCredential, (void**)&cred); - if (FAILED(hr)) { - LOG(ERROR) << "Could not create credential hr=" << putHR(hr); - return hr; - } - - hr = cred->Initialize(this); - if (FAILED(hr)) { - LOG(ERROR) << "Could not initialize credential hr=" << putHR(hr); - return hr; - } - - CComPtr<IReauthCredential> reauth; - reauth = cred; - hr = reauth->SetUserInfo(CComBSTR(W2COLE(kv.first.c_str())), - CComBSTR(email)); - if (FAILED(hr)) { - LOG(ERROR) << "reauth->SetUserInfo hr=" << putHR(hr); - return hr; - } - - users_.emplace_back(cred); - } - } - - // Fire off a thread to check with Gaia if a re-auth is required. This - // sets the kUserNeedsReauth bit if needed. - unsigned wait_thread_id; - uintptr_t wait_thread = _beginthreadex( - nullptr, 0, CheckReauthStatus, - reinterpret_cast<void*>(reauth_check_done_event_), 0, &wait_thread_id); - if (wait_thread != 0) { - LOGFN(INFO) << "Started check re-auth thread id=" << wait_thread_id; - ::CloseHandle(reinterpret_cast<HANDLE>(wait_thread)); - } else { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "Unable to start check re-auth thread hr=" << putHR(hr); - } - - return S_OK; -} - -// static -unsigned __stdcall CGaiaCredentialProvider::CheckReauthStatus(void* param) { - LOGFN(INFO) << "Start"; - DCHECK(param); - HANDLE reauth_check_done_event = reinterpret_cast<HANDLE>(param); - std::map<base::string16, base::string16> handles; - - auto fetcher = WinHttpUrlFetcher::Create( - GURL("https://www.googleapis.com/oauth2/v2/tokeninfo")); - - if (fetcher) { - fetcher->SetRequestHeader("Content-Type", - "application/x-www-form-urlencoded"); - - GetUserTokenHandles(&handles); - for (const auto& kv : handles) { - DWORD needs_reauth; - HRESULT hr = - GetUserProperty(kv.first.c_str(), kUserNeedsReauth, &needs_reauth); - if (SUCCEEDED(hr) && needs_reauth) { - LOGFN(INFO) << "Already needs reath sid=" << kv.first; - continue; - } - - std::string body = - base::StringPrintf("token_handle=%S", kv.second.c_str()); - hr = fetcher->SetRequestBody(body.c_str()); - if (FAILED(hr)) { - LOGFN(ERROR) << "fetcher.SetRequestBody sid=" << kv.first - << " hr=" << putHR(hr); - continue; - } - - std::string response; - hr = fetcher->Fetch(&response); - if (FAILED(hr)) { - LOGFN(INFO) << "fetcher.Fetch sid=" << kv.first << " hr=" << putHR(hr); - continue; - } - - base::DictionaryValue* dict = nullptr; - std::unique_ptr<base::Value> properties( - base::JSONReader::Read(response, base::JSON_ALLOW_TRAILING_COMMAS)); - if (properties.get() == nullptr || !properties->GetAsDictionary(&dict)) { - LOGFN(ERROR) << "base::JSONReader::Read failed"; - continue; - } - - int expires_in; - if (dict->HasKey("error") || - !dict->GetInteger("expires_in", &expires_in) || expires_in < 0) { - LOGFN(INFO) << "Needs reauth sid=" << kv.first; - hr = SetUserProperty(kv.first.c_str(), kUserNeedsReauth, 1); - if (FAILED(hr)) { - LOGFN(ERROR) << "SetUserProperty sid=" << kv.first - << " hr=" << putHR(hr); - } - } else { - LOGFN(INFO) << "No reauth sid=" << kv.first; - } - } - } - - // This event handle is used only in tests to wait for the reauth check - // to complete. - if (reauth_check_done_event != INVALID_HANDLE_VALUE) - ::SetEvent(reauth_check_done_event); - - LOGFN(INFO) << "Done"; - return 0; -} - -// ICredentialProvider //////////////////////////////////////////////////////// - -HRESULT CGaiaCredentialProvider::SetUsageScenario( - CREDENTIAL_PROVIDER_USAGE_SCENARIO cpus, - DWORD flags) { - ClearTransient(); - - cpus_ = cpus; - cpus_flags_ = flags; - - // This credential provider only supports signing in and unlocking the screen. - HRESULT hr = E_INVALIDARG; - switch (cpus) { - case CPUS_LOGON: - case CPUS_UNLOCK_WORKSTATION: - hr = CreateGaiaCredential(); - break; - case CPUS_CHANGE_PASSWORD: - case CPUS_CREDUI: - case CPUS_PLAP: - default: - hr = E_NOTIMPL; - break; - } - - LOGFN(INFO) << "hr=" << putHR(hr) << " cpu=" << cpus - << " flags=" << std::setbase(16) << flags; - return hr; -} - -HRESULT CGaiaCredentialProvider::SetSerialization( - const CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION* pcpcs) { - DCHECK(pcpcs); - - // NOTE: we only need to support this method if we want to support the - // CredUI or support remote login with gaia creds. We are likely to want - // to support both, but not for prototype. - if (pcpcs->clsidCredentialProvider == CLSID_GaiaCredentialProvider) { - // Unmarshall the serialized buffer and fill in partial fields as needed. - // Examine cpusflags for things like admin-only, cred-in-only, etc. - LOGFN(INFO) << " authpkg=" << pcpcs->ulAuthenticationPackage - << " setsize=" << pcpcs->cbSerialization; - } - - return S_OK; -} - -HRESULT CGaiaCredentialProvider::Advise(ICredentialProviderEvents* pcpe, - UINT_PTR context) { - DCHECK(pcpe); - - bool had_previous = events_.p != nullptr; - events_ = pcpe; - advise_context_ = context; - LOGFN(INFO) << " had=" << had_previous; - return S_OK; -} - -HRESULT CGaiaCredentialProvider::UnAdvise() { - ClearTransient(); - HRESULT hr = DestroyCredentials(); - LOGFN(INFO) << "hr=" << putHR(hr); - return S_OK; -} - -HRESULT CGaiaCredentialProvider::GetFieldDescriptorCount(DWORD* count) { - *count = FIELD_COUNT; - LOGFN(INFO) << " count=" << *count; - return S_OK; -} - -HRESULT CGaiaCredentialProvider::GetFieldDescriptorAt( - DWORD index, - CREDENTIAL_PROVIDER_FIELD_DESCRIPTOR** ppcpfd) { - *ppcpfd = nullptr; - HRESULT hr = E_INVALIDARG; - if (index < FIELD_COUNT) { - // Always return a CoTask copy of the structure as well as any strings - // pointed to by that structure. - *ppcpfd = reinterpret_cast<CREDENTIAL_PROVIDER_FIELD_DESCRIPTOR*>( - ::CoTaskMemAlloc(sizeof(**ppcpfd))); - if (*ppcpfd) { - **ppcpfd = g_field_desc[index]; - if ((*ppcpfd)->pszLabel) { - hr = ::SHStrDupW((*ppcpfd)->pszLabel, &(*ppcpfd)->pszLabel); - } else { - (*ppcpfd)->pszLabel = nullptr; - hr = S_OK; - } - } - - if (FAILED(hr)) { - ::CoTaskMemFree(*ppcpfd); - *ppcpfd = nullptr; - } - } - - LOGFN(INFO) << "hr=" << putHR(hr) << " index=" << index; - return hr; -} - -HRESULT CGaiaCredentialProvider::GetCredentialCount( - DWORD* count, - DWORD* default_index, - BOOL* autologin_with_default) { - // NOTE: assumes SetUserArray() is called before this. - *count = users_.size(); - *default_index = CREDENTIAL_PROVIDER_NO_DEFAULT; - *autologin_with_default = false; - - // If a user was authenticated, winlogon was notified of credentials changes - // and is re-enumerating the credentials. Make sure autologin is enabled. - if (index_ < users_.size() && new_user_sid_.Length() > 0) { - *default_index = index_; - *autologin_with_default = true; - } - - LOGFN(INFO) << " count=" << *count - << " default=" << *default_index - << " auto=" << *autologin_with_default; - return S_OK; -} - -HRESULT CGaiaCredentialProvider::GetCredentialAt( - DWORD index, - ICredentialProviderCredential** ppcpc) { - HRESULT hr = E_INVALIDARG; - if (!ppcpc || (index > 1)) { - LOG(ERROR) << "hr=" << putHR(hr) << " index=" << index; - return hr; - } - - *ppcpc = nullptr; - hr = users_[index]->QueryInterface(IID_ICredentialProviderCredential, - (void**)ppcpc); - - LOGFN(INFO) << "hr=" << putHR(hr) << " index=" << index; - return hr; -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_provider.def b/chrome/credential_provider/gaiacp/gaia_credential_provider.def deleted file mode 100644 index 443c51dd..0000000 --- a/chrome/credential_provider/gaiacp/gaia_credential_provider.def +++ /dev/null
@@ -1,14 +0,0 @@ -; Copyright 2018 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. - -LIBRARY - -EXPORTS - DllMain PRIVATE - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - DllRegisterServer PRIVATE - DllUnregisterServer PRIVATE - SaveAccountInfoW PRIVATE - SetFakesForTesting PRIVATE
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_provider.h b/chrome/credential_provider/gaiacp/gaia_credential_provider.h deleted file mode 100644 index 52db16e..0000000 --- a/chrome/credential_provider/gaiacp/gaia_credential_provider.h +++ /dev/null
@@ -1,110 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_GAIACP_GAIA_CREDENTIAL_PROVIDER_H_ -#define CHROME_CREDENTIAL_PROVIDER_GAIACP_GAIA_CREDENTIAL_PROVIDER_H_ - -#include <limits> -#include <memory> -#include <vector> - -#include "chrome/credential_provider/gaiacp/gaia_credential.h" -#include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h" -#include "chrome/credential_provider/gaiacp/grit/gaia_resources.h" - -namespace credential_provider { - -// Implementation of ICredentialProvider backed by Gaia. -class ATL_NO_VTABLE CGaiaCredentialProvider - : public CComObjectRootEx<CComMultiThreadModel>, - public CComCoClass<CGaiaCredentialProvider, - &CLSID_GaiaCredentialProvider>, - public IGaiaCredentialProvider, - public IGaiaCredentialProviderForTesting, - public ICredentialProviderSetUserArray, - public ICredentialProvider { - public: - // This COM object is registered with the rgs file. The rgs file is used by - // CGaiaCredentialProviderModule class, see latter for details. - DECLARE_NO_REGISTRY() - - CGaiaCredentialProvider(); - ~CGaiaCredentialProvider(); - - BEGIN_COM_MAP(CGaiaCredentialProvider) - COM_INTERFACE_ENTRY(IGaiaCredentialProvider) - COM_INTERFACE_ENTRY(IGaiaCredentialProviderForTesting) - COM_INTERFACE_ENTRY(ICredentialProviderSetUserArray) - COM_INTERFACE_ENTRY(ICredentialProvider) - END_COM_MAP() - - DECLARE_PROTECT_FINAL_CONSTRUCT() - - HRESULT FinalConstruct(); - void FinalRelease(); - - private: - HRESULT CreateGaiaCredential(); - HRESULT DestroyCredentials(); - void ClearTransient(); - void CleanupStaleTokenHandles(); - - // Checks of any of the Google account users need to re-auth. - static unsigned __stdcall CheckReauthStatus(void* param); - - // IGaiaCredentialProvider - IFACEMETHODIMP OnUserAuthenticated(IUnknown* credential, - BSTR username, - BSTR password, - BSTR sid) override; - - // IGaiaCredentialProviderForTesting - IFACEMETHODIMP SetReauthCheckDoneEvent([in] INT_PTR event) override; - - // ICredentialProviderSetUserArray - IFACEMETHODIMP SetUserArray(ICredentialProviderUserArray* users) override; - - // ICredentialProvider - IFACEMETHODIMP SetUsageScenario(CREDENTIAL_PROVIDER_USAGE_SCENARIO cpus, - DWORD dwFlags) override; - IFACEMETHODIMP SetSerialization( - const CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION* pcpcs) override; - IFACEMETHODIMP Advise(ICredentialProviderEvents* pcpe, - UINT_PTR upAdviseContext) override; - IFACEMETHODIMP UnAdvise() override; - IFACEMETHODIMP GetFieldDescriptorCount(DWORD* pdwCount) override; - IFACEMETHODIMP GetFieldDescriptorAt( - DWORD dwIndex, - CREDENTIAL_PROVIDER_FIELD_DESCRIPTOR** ppcpfd) override; - IFACEMETHODIMP GetCredentialCount(DWORD* pdwCount, - DWORD* pdwDefault, - BOOL* pbAutoLogonWithDefault) override; - IFACEMETHODIMP GetCredentialAt( - DWORD dwIndex, - ICredentialProviderCredential** ppcpc) override; - - CREDENTIAL_PROVIDER_USAGE_SCENARIO cpus_ = CPUS_INVALID; - DWORD cpus_flags_ = 0; - UINT_PTR advise_context_; - CComPtr<ICredentialProviderEvents> events_; - - // List of credentials exposed by this provider. The first is always the - // Gaia credential for creating new users. The rest are reauth credentials. - std::vector<CComPtr<IGaiaCredential>> users_; - - // SID of the user that was authenticated. - CComBSTR new_user_sid_; - - // Index in the |users_| array of the credential that performed the - // authentication. - size_t index_ = std::numeric_limits<size_t>::max(); - - HANDLE reauth_check_done_event_ = INVALID_HANDLE_VALUE; -}; - -OBJECT_ENTRY_AUTO(__uuidof(GaiaCredentialProvider), CGaiaCredentialProvider) - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_GAIA_CREDENTIAL_PROVIDER_H_
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_provider.idl b/chrome/credential_provider/gaiacp/gaia_credential_provider.idl deleted file mode 100644 index c37971c..0000000 --- a/chrome/credential_provider/gaiacp/gaia_credential_provider.idl +++ /dev/null
@@ -1,90 +0,0 @@ -// Copyright 2018 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. - -// This file will be processed by the MIDL tool to -// produce the type library (GaiaCredentialProvider.tlb) and marshalling code. - -import "oaidl.idl"; -import "ocidl.idl"; - -[ - object, - uuid(CEC9EF6C-B2E6-4BB6-8F1E-1747BA4F7138), - pointer_default(unique) -] -interface IGaiaCredentialProvider : IUnknown { - HRESULT OnUserAuthenticated([in] IUnknown* credential, - [in] BSTR username, - [in] BSTR password, - [in] BSTR sid); -}; - -[ - object, - uuid(224CE2FB-2977-4585-BD46-1BAE8D7964DE), - pointer_default(unique) -] -interface IGaiaCredentialProviderForTesting : IUnknown { - HRESULT SetReauthCheckDoneEvent([in] INT_PTR event); -}; - -[ - object, - uuid(E5BF88DF-9966-465B-B233-C1CAC7510A59), - pointer_default(unique) -] -interface IGaiaCredential : IUnknown { - HRESULT Initialize([in] IGaiaCredentialProvider* provider); - HRESULT Terminate(); - HRESULT FinishAuthentication([in] BSTR username, - [in] BSTR password, - [in] BSTR fullname, - [out] BSTR* sid, - [out] BSTR* error_text); - HRESULT OnUserAuthenticated([in] BSTR username, - [in] BSTR password, - [in] BSTR sid); - HRESULT ReportError([in] LONG status, - [in] LONG substatus, - [in] BSTR status_text); -}; - -[ - object, - uuid(CC75BCEA-A636-4798-BF8E-0FF64D743451), - pointer_default(unique) -] -interface IReauthCredential : IUnknown { - HRESULT SetUserInfo([in] BSTR sid, [in] BSTR email); -}; - -[ - uuid(4ADC3A52-8673-4CE3-81F6-833D18BEEBA2), - version(1.0), -] -library GaiaCredentialProviderLib -{ - importlib("stdole2.tlb"); - [ - uuid(0B5BFDF0-4594-47AC-940A-CFC69ABC561C) - ] - coclass GaiaCredentialProvider - { - [default] interface IGaiaCredentialProvider; - }; - [ - uuid(44AF95AC-6B23-4C54-94BE-EDB1CB52DAFD) - ] - coclass GaiaCredential - { - [default] interface IGaiaCredential; - }; - [ - uuid(E6CC5D8B-54C2-4586-ADC3-748ED16284B7) - ] - coclass ReauthCredential - { - [default] interface IGaiaCredential; - }; -};
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_provider.rc.version b/chrome/credential_provider/gaiacp/gaia_credential_provider.rc.version deleted file mode 100644 index fa40904..0000000 --- a/chrome/credential_provider/gaiacp/gaia_credential_provider.rc.version +++ /dev/null
@@ -1,43 +0,0 @@ -// Copyright 2018 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. - -// Use the ordinal 1 here, to avoid needing to #include a header file -// to use the VS_VERSION_INFO macro. This header file changes with different -// SDK versions which causes headaches building in some environments. The -// VERSIONINFO resource will always be at index 1. -1 VERSIONINFO - FILEVERSION @MAJOR@,@MINOR@,@BUILD@,@PATCH@ - PRODUCTVERSION @MAJOR@,@MINOR@,@BUILD@,@PATCH@ - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "@COMPANY_FULLNAME@" - VALUE "FileDescription", "Google Account Credential Provider" - VALUE "FileVersion", "@MAJOR@.@MINOR@.@BUILD@.@PATCH@" - VALUE "InternalName", "gcp_setup" - VALUE "LegalCopyright", "@COPYRIGHT@" - VALUE "ProductName", "Google Account Credential Provider" - VALUE "ProductVersion", "@MAJOR@.@MINOR@.@BUILD@.@PATCH@" - VALUE "CompanyShortName", "@COMPANY_SHORTNAME@" - VALUE "ProductShortName", "GaiaCP" - VALUE "LastChange", "@LASTCHANGE@" - VALUE "Official Build", "@OFFICIAL_BUILD@" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_provider.rgs b/chrome/credential_provider/gaiacp/gaia_credential_provider.rgs deleted file mode 100644 index 38330ed..0000000 --- a/chrome/credential_provider/gaiacp/gaia_credential_provider.rgs +++ /dev/null
@@ -1,65 +0,0 @@ -HKCR -{ - NoRemove CLSID - { - ForceRemove {0B5BFDF0-4594-47AC-940A-CFC69ABC561C} = s 'GaiaCredentialProvider Class' - { - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Apartment' - } - TypeLib = s '{4ADC3A52-8673-4CE3-81F6-833D18BEEBA2}' - Version = s '%VERSION%' - } - } -} -HKLM -{ - NoRemove SOFTWARE - { - NoRemove Microsoft - { - NoRemove Windows - { - NoRemove CurrentVersion - { - NoRemove Authentication - { - NoRemove 'Credential Providers' - { - ForceRemove {0B5BFDF0-4594-47AC-940A-CFC69ABC561C} = s 'Google Credential Provider' - { - } - } - } - } - } - } - } -} -HKLM -{ - NoRemove SYSTEM - { - NoRemove CurrentControlSet - { - NoRemove Services - { - NoRemove EventLog - { - NoRemove Application - { - ForceRemove GCP - { - val CategoryCount = d '1' - val CategoryMessageFile = s '%EVENTLOG_PATH%' - val EventMessageFile = s '%EVENTLOG_PATH%' - val ParameterMessageFile = s '%EVENTLOG_PATH%' - val TypesSupported = d '7' - } - } - } - } - } - } -}
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_provider_module.cc b/chrome/credential_provider/gaiacp/gaia_credential_provider_module.cc deleted file mode 100644 index d9e526e..0000000 --- a/chrome/credential_provider/gaiacp/gaia_credential_provider_module.cc +++ /dev/null
@@ -1,92 +0,0 @@ -// Copyright 2018 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/credential_provider/gaiacp/dllmain.h" - -#include "base/command_line.h" -#include "base/files/file_path.h" -#include "base/logging.h" -#include "base/macros.h" -#include "chrome/common/chrome_version.h" -#include "chrome/credential_provider/eventlog/gcp_eventlog_messages.h" -#include "chrome/credential_provider/gaiacp/gaia_credential_base.h" -#include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h" -#include "chrome/credential_provider/gaiacp/logging.h" - -namespace credential_provider { - -namespace { - -void InvalidParameterHandler(const wchar_t* expression, - const wchar_t* function, - const wchar_t* file, - unsigned int line, - uintptr_t pReserved) { - LOGFN(ERROR) << "func=" << (function ? function : L"-") - << " expression=" << (expression ? expression : L"-") - << " file=" << (file ? file : L"-") << " line=" << line; -} - -} // namespace - -// static -HRESULT WINAPI -CGaiaCredentialProviderModule::UpdateRegistryAppId(BOOL do_register) throw() { - base::FilePath eventlog_path; - HRESULT hr = CGaiaCredentialBase::GetInstallDirectory(&eventlog_path); - if (FAILED(hr)) { - LOGFN(ERROR) << "CGaiaCredentialBase::GetInstallDirectory hr=" << putHR(hr); - return hr; - } - eventlog_path = - eventlog_path.Append(FILE_PATH_LITERAL("gcp_eventlog_provider.dll")); - - ATL::_ATL_REGMAP_ENTRY regmap[] = { - {L"APPID", L"{C2DDF2F2-F760-4B27-92F4-3461EE8A7A0B}"}, - {L"VERSION", TEXT(CHROME_VERSION_STRING)}, - {L"EVENTLOG_PATH", eventlog_path.value().c_str()}, - {nullptr, nullptr}, - }; - - return ATL::_pAtlModule->UpdateRegistryFromResource( - IDR_GAIACREDENTIALPROVIDER, do_register, regmap); -} - -BOOL CGaiaCredentialProviderModule::DllMain(HINSTANCE /*hinstance*/, - DWORD reason, - LPVOID reserved) { - switch (reason) { - case DLL_PROCESS_ATTACH: { - _set_invalid_parameter_handler(InvalidParameterHandler); - - // Initialize base. Command line will be set from GetCommandLineW(). - base::CommandLine::Init(0, nullptr); - - // Initialize logging. - logging::LoggingSettings settings; - settings.logging_dest = logging::LOG_NONE; - logging::InitLogging(settings); - logging::SetLogItems(true, // Enable process id. - true, // Enable thread id. - true, // Enable timestamp. - false); // Enable tickcount. - logging::SetEventSource("GCP", GCP_CATEGORY, MSG_LOG_MESSAGE); - LOGFN(INFO) << "DllMain(DLL_PROCESS_ATTACH)"; - break; - } - case DLL_PROCESS_DETACH: - LOGFN(INFO) << "DllMain(DLL_PROCESS_DETACH)"; - base::CommandLine::Reset(); - _set_invalid_parameter_handler(nullptr); - break; - - default: - break; - } - - return ATL::CAtlDllModuleT<CGaiaCredentialProviderModule>::DllMain(reason, - reserved); -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_provider_module.h b/chrome/credential_provider/gaiacp/gaia_credential_provider_module.h deleted file mode 100644 index 51492444..0000000 --- a/chrome/credential_provider/gaiacp/gaia_credential_provider_module.h +++ /dev/null
@@ -1,31 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_GAIACP_GAIA_CREDENTIAL_PROVIDER_MODULE_H_ -#define CHROME_CREDENTIAL_PROVIDER_GAIACP_GAIA_CREDENTIAL_PROVIDER_MODULE_H_ - -// Due to windows include file ordering, this needs to remain first. -#include "chrome/credential_provider/gaiacp/stdafx.h" - -#include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h" - -namespace credential_provider { - -// Declaration of Afx module class for this DLL. -class CGaiaCredentialProviderModule - : public ATL::CAtlDllModuleT<CGaiaCredentialProviderModule> { - public: - DECLARE_LIBID(LIBID_GaiaCredentialProviderLib) - - // This class implements UpdateRegistryAppId() directly instead of using the - // the DECLARE_REGISTRY_APPID_RESOURCEID so that it can use additional rgs - // file variable substitutions. - static HRESULT WINAPI UpdateRegistryAppId(BOOL do_register) throw(); - - BOOL DllMain(HINSTANCE hinstance, DWORD reason, LPVOID reserved); -}; - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_GAIA_CREDENTIAL_PROVIDER_MODULE_H_
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_provider_unittests.cc b/chrome/credential_provider/gaiacp/gaia_credential_provider_unittests.cc deleted file mode 100644 index 5decba9..0000000 --- a/chrome/credential_provider/gaiacp/gaia_credential_provider_unittests.cc +++ /dev/null
@@ -1,295 +0,0 @@ -// Copyright 2018 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 <atlbase.h> -#include <atlcom.h> -#include <atlcomcli.h> -#include <credentialprovider.h> - -#include "base/synchronization/waitable_event.h" -#include "base/test/test_reg_util_win.h" -#include "base/win/registry.h" -#include "chrome/credential_provider/gaiacp/gaia_credential_provider.h" -#include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h" -#include "chrome/credential_provider/gaiacp/reg_utils.h" -#include "chrome/credential_provider/test/com_fakes.h" -#include "chrome/credential_provider/test/gcp_fakes.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace credential_provider { - -class GcpCredentialProviderTest : public ::testing::Test { - public: - void CreateGCPWUser(const wchar_t* username, - const wchar_t* password, - const wchar_t* fullname, - const wchar_t* comment, - BSTR* sid) { - DWORD error; - ASSERT_EQ(S_OK, fake_os_user_manager_.AddUser(username, password, fullname, - comment, true, sid, &error)); - ASSERT_EQ(S_OK, SetUserProperty(OLE2CW(*sid), L"nr", 0)); - ASSERT_EQ(S_OK, SetUserProperty(OLE2CW(*sid), L"th", L"th_value")); - } - - void CreateDeletedGCPWUser(BSTR* sid) { - PSID sid_deleted; - ASSERT_EQ(S_OK, fake_os_user_manager_.CreateNewSID(&sid_deleted)); - wchar_t* user_sid_string = nullptr; - ASSERT_TRUE(ConvertSidToStringSid(sid_deleted, &user_sid_string)); - *sid = SysAllocString(W2COLE(user_sid_string)); - - ASSERT_EQ(S_OK, SetUserProperty(user_sid_string, L"nr", 0)); - ASSERT_EQ(S_OK, SetUserProperty(user_sid_string, L"th", L"th_value")); - LocalFree(user_sid_string); - } - - FakeWinHttpUrlFetcherFactory* url_fetcher_factory() { - return &url_fetcher_factory_; - } - - private: - void SetUp() override; - - registry_util::RegistryOverrideManager registry_override_; - FakeWinHttpUrlFetcherFactory url_fetcher_factory_; - FakeOSUserManager fake_os_user_manager_; - FakeScopedLsaPolicyFactory fake_scoped_lsa_policy_factory_; -}; - -void GcpCredentialProviderTest::SetUp() { - ASSERT_NO_FATAL_FAILURE( - registry_override_.OverrideRegistry(HKEY_LOCAL_MACHINE)); -} - -TEST_F(GcpCredentialProviderTest, Basic) { - CComPtr<IGaiaCredentialProvider> provider; - ASSERT_EQ(S_OK, - CComCreator<CComObject<CGaiaCredentialProvider>>::CreateInstance( - nullptr, IID_IGaiaCredentialProvider, (void**)&provider)); -} - -TEST_F(GcpCredentialProviderTest, CleanupStaleTokenHandles) { - // Simulate a user created by GCPW that does not have a stale handle. - CComBSTR sid_good; - CreateGCPWUser(L"username", L"password", L"Full Name", L"Comment", &sid_good); - - // Simulate a user created by GCPW that was deleted from the machine. - CComBSTR sid_bad; - CreateDeletedGCPWUser(&sid_bad); - - // Now create the provider. - CComPtr<IGaiaCredentialProvider> provider; - ASSERT_EQ(S_OK, - CComCreator<CComObject<CGaiaCredentialProvider>>::CreateInstance( - nullptr, IID_IGaiaCredentialProvider, (void**)&provider)); - - // Expect "good" sid to still in the registry, "bad" one to be cleaned up. - base::win::RegKey key; - ASSERT_EQ(ERROR_SUCCESS, - key.Open(HKEY_LOCAL_MACHINE, L"Software\\Google\\GCP\\Users\\", - KEY_READ)); - EXPECT_EQ(ERROR_SUCCESS, key.OpenKey(OLE2CW(sid_good), KEY_READ)); - - ASSERT_EQ(ERROR_SUCCESS, - key.Open(HKEY_LOCAL_MACHINE, L"Software\\Google\\GCP\\Users\\", - KEY_READ)); - EXPECT_NE(ERROR_SUCCESS, key.OpenKey(OLE2CW(sid_bad), KEY_READ)); -} - -TEST_F(GcpCredentialProviderTest, SetUserArray) { - CComPtr<ICredentialProviderSetUserArray> user_array; - ASSERT_EQ( - S_OK, - CComCreator<CComObject<CGaiaCredentialProvider>>::CreateInstance( - nullptr, IID_ICredentialProviderSetUserArray, (void**)&user_array)); - - FakeCredentialProviderUserArray array; - array.AddUser(L"sid", L"username"); - ASSERT_EQ(S_OK, user_array->SetUserArray(&array)); - - CComPtr<ICredentialProvider> provider; - ASSERT_EQ(S_OK, user_array.QueryInterface(&provider)); - - // There should be no credentials. The user added above should be ignored - // because it does not need reauth. - DWORD count; - DWORD default_index; - BOOL autologon; - ASSERT_EQ(S_OK, - provider->GetCredentialCount(&count, &default_index, &autologon)); - EXPECT_EQ(0u, count); - EXPECT_EQ(CREDENTIAL_PROVIDER_NO_DEFAULT, default_index); - EXPECT_FALSE(autologon); -} - -TEST_F(GcpCredentialProviderTest, SetUserArray_NeedsReauth) { - // Create a GCPW user user as needing reauth. - CComBSTR sid; - CreateGCPWUser(L"username", L"password", L"Full Name", L"Comment", &sid); - ASSERT_EQ(S_OK, SetUserProperty(OLE2CW(sid), L"nr", 1)); - - CComPtr<ICredentialProviderSetUserArray> user_array; - ASSERT_EQ( - S_OK, - CComCreator<CComObject<CGaiaCredentialProvider>>::CreateInstance( - nullptr, IID_ICredentialProviderSetUserArray, (void**)&user_array)); - - FakeCredentialProviderUserArray array; - array.AddUser(OLE2CW(sid), L"username"); - array.AddUser(L"sid2", L"username2"); - ASSERT_EQ(S_OK, user_array->SetUserArray(&array)); - - CComPtr<ICredentialProvider> provider; - ASSERT_EQ(S_OK, user_array.QueryInterface(&provider)); - - // There should be 1 credential. It should implement IReauthCredential. - DWORD count; - DWORD default_index; - BOOL autologon; - ASSERT_EQ(S_OK, - provider->GetCredentialCount(&count, &default_index, &autologon)); - ASSERT_EQ(1u, count); - EXPECT_EQ(CREDENTIAL_PROVIDER_NO_DEFAULT, default_index); - EXPECT_FALSE(autologon); - - CComPtr<ICredentialProviderCredential> cred; - ASSERT_EQ(S_OK, provider->GetCredentialAt(0, &cred)); - CComPtr<IReauthCredential> reauth; - EXPECT_EQ(S_OK, cred.QueryInterface(&reauth)); -} - -TEST_F(GcpCredentialProviderTest, SetUserArray_PasswordChanged) { - // Create two GCPW users that are not marked as needing reauth. - CComBSTR sid1; - CreateGCPWUser(L"u1", L"p1", L"n1", L"c1", &sid1); - - CComPtr<ICredentialProviderSetUserArray> user_array; - ASSERT_EQ( - S_OK, - CComCreator<CComObject<CGaiaCredentialProvider>>::CreateInstance( - nullptr, IID_ICredentialProviderSetUserArray, (void**)&user_array)); - - base::WaitableEvent reauth_check_done_event; - CComPtr<IGaiaCredentialProviderForTesting> for_testing; - ASSERT_EQ(S_OK, user_array.QueryInterface(&for_testing)); - ASSERT_EQ(S_OK, - for_testing->SetReauthCheckDoneEvent( - reinterpret_cast<INT_PTR>(reauth_check_done_event.handle()))); - - url_fetcher_factory()->SetFakeResponse( - GURL("https://www.googleapis.com/oauth2/v2/tokeninfo"), - FakeWinHttpUrlFetcher::Headers(), "{\"error\":\"foo\"}"); - - FakeCredentialProviderUserArray array; - array.AddUser(OLE2CW(sid1), L"u1"); - ASSERT_EQ(S_OK, user_array->SetUserArray(&array)); - - CComPtr<ICredentialProvider> provider; - ASSERT_EQ(S_OK, user_array.QueryInterface(&provider)); - - // There should be no credentials since none need reauth. - DWORD count; - DWORD default_index; - BOOL autologon; - ASSERT_EQ(S_OK, - provider->GetCredentialCount(&count, &default_index, &autologon)); - ASSERT_EQ(0u, count); - EXPECT_EQ(CREDENTIAL_PROVIDER_NO_DEFAULT, default_index); - EXPECT_FALSE(autologon); - - // After the network check, account should be marked as needing reauth. - reauth_check_done_event.Wait(); - DWORD needs_reauth; - ASSERT_EQ(S_OK, GetUserProperty(OLE2CW(sid1), L"nr", &needs_reauth)); - ASSERT_EQ(1u, needs_reauth); -} - -TEST_F(GcpCredentialProviderTest, CpusLogon) { - CComPtr<ICredentialProvider> provider; - ASSERT_EQ(S_OK, - CComCreator<CComObject<CGaiaCredentialProvider>>::CreateInstance( - nullptr, IID_ICredentialProvider, (void**)&provider)); - - // Start process for logon screen. - ASSERT_EQ(S_OK, provider->SetUsageScenario(CPUS_LOGON, 0)); - - // Give list of users visible on welcome screen. - CComPtr<ICredentialProviderSetUserArray> user_array; - ASSERT_EQ(S_OK, provider.QueryInterface(&user_array)); - FakeCredentialProviderUserArray array; - array.AddUser(L"sid1", L"username1"); - ASSERT_EQ(S_OK, user_array->SetUserArray(&array)); - - // Activate the CP. - FakeCredentialProviderEvents events; - ASSERT_EQ(S_OK, provider->Advise(&events, 0)); - - // Check credentials. - DWORD count; - DWORD default_index; - BOOL autologon; - ASSERT_EQ(S_OK, - provider->GetCredentialCount(&count, &default_index, &autologon)); - ASSERT_EQ(1u, count); - EXPECT_EQ(CREDENTIAL_PROVIDER_NO_DEFAULT, default_index); - EXPECT_FALSE(autologon); - CComPtr<ICredentialProviderCredential> cred; - ASSERT_EQ(S_OK, provider->GetCredentialAt(0, &cred)); - CComPtr<IGaiaCredential> gaia_cred; - EXPECT_EQ(S_OK, cred.QueryInterface(&gaia_cred)); - - // Get fields. - DWORD field_count; - ASSERT_EQ(S_OK, provider->GetFieldDescriptorCount(&field_count)); - EXPECT_EQ(4u, field_count); - - // Deactivate the CP. - ASSERT_EQ(S_OK, provider->UnAdvise()); -} - -TEST_F(GcpCredentialProviderTest, CpusUnlock) { - CComPtr<ICredentialProvider> provider; - ASSERT_EQ(S_OK, - CComCreator<CComObject<CGaiaCredentialProvider>>::CreateInstance( - nullptr, IID_ICredentialProvider, (void**)&provider)); - - // Start process for logon screen. - ASSERT_EQ(S_OK, provider->SetUsageScenario(CPUS_UNLOCK_WORKSTATION, 0)); - - // Give list of users visible on welcome screen. - CComPtr<ICredentialProviderSetUserArray> user_array; - ASSERT_EQ(S_OK, provider.QueryInterface(&user_array)); - FakeCredentialProviderUserArray array; - array.AddUser(L"sid1", L"username1"); - ASSERT_EQ(S_OK, user_array->SetUserArray(&array)); - - // Activate the CP. - FakeCredentialProviderEvents events; - ASSERT_EQ(S_OK, provider->Advise(&events, 0)); - - // Check credentials. - DWORD count; - DWORD default_index; - BOOL autologon; - ASSERT_EQ(S_OK, - provider->GetCredentialCount(&count, &default_index, &autologon)); - ASSERT_EQ(1u, count); - EXPECT_EQ(CREDENTIAL_PROVIDER_NO_DEFAULT, default_index); - EXPECT_FALSE(autologon); - CComPtr<ICredentialProviderCredential> cred; - ASSERT_EQ(S_OK, provider->GetCredentialAt(0, &cred)); - CComPtr<IGaiaCredential> gaia_cred; - EXPECT_EQ(S_OK, cred.QueryInterface(&gaia_cred)); - - // Get fields. - DWORD field_count; - ASSERT_EQ(S_OK, provider->GetFieldDescriptorCount(&field_count)); - EXPECT_EQ(4u, field_count); - - // Deactivate the CP. - ASSERT_EQ(S_OK, provider->UnAdvise()); -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_unittests.cc b/chrome/credential_provider/gaiacp/gaia_credential_unittests.cc deleted file mode 100644 index 763c8e7..0000000 --- a/chrome/credential_provider/gaiacp/gaia_credential_unittests.cc +++ /dev/null
@@ -1,45 +0,0 @@ -// Copyright 2018 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 <atlbase.h> -#include <atlcom.h> -#include <atlcomcli.h> - -#include "chrome/credential_provider/gaiacp/gaia_credential.h" -#include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h" -#include "chrome/credential_provider/test/gcp_fakes.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace credential_provider { - -class GcpGaiaCredentialTest : public ::testing::Test { - private: - FakeOSUserManager fake_os_user_manager_; - FakeScopedLsaPolicyFactory fake_scoped_lsa_policy_factory_; -}; - -TEST_F(GcpGaiaCredentialTest, FinishAuthentication) { - CComPtr<IGaiaCredential> cred; - ASSERT_EQ(S_OK, CComCreator<CComObject<CGaiaCredential>>::CreateInstance( - nullptr, IID_IGaiaCredential, (void**)&cred)); - ASSERT_TRUE(!!cred); - - CComBSTR sid; - CComBSTR error; - ASSERT_EQ(S_OK, cred->FinishAuthentication(CComBSTR(W2COLE(L"username")), - CComBSTR(W2COLE(L"password")), - CComBSTR(W2COLE(L"Full Name")), - &sid, &error)); - sid.Empty(); - error.Empty(); - - // Finishing with the same username should fail. - // TODO(rogerta): Will want to allow this at some point. - ASSERT_EQ(HRESULT_FROM_WIN32(NERR_UserExists), - cred->FinishAuthentication( - CComBSTR(W2COLE(L"username")), CComBSTR(W2COLE(L"password")), - CComBSTR(W2COLE(L"Full Name")), &sid, &error)); -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/gaia_resources.grd b/chrome/credential_provider/gaiacp/gaia_resources.grd deleted file mode 100644 index 3679025..0000000 --- a/chrome/credential_provider/gaiacp/gaia_resources.grd +++ /dev/null
@@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<grit current_release="1" latest_public_release="0"> - <outputs> - <output filename="grit/gaia_resources.h" type="rc_header"> - <emit emit_type='prepend'></emit> - </output> - <output filename="grit/gaia_resources.rc" type="rc_all" /> - </outputs> - <release seq="1"> - <includes> - <include name="IDR_GAIACREDENTIALPROVIDER" - file="gaia_credential_provider.rgs" - type="REGISTRY" /> - <include name="IDB_GOOGLE_LOGO_SMALL" - file="google_logo_small.bmp" - type="BITMAP" /> - </includes> - <messages fallback_to_english="true"> - <message name="IDS_PROJNAME" desc=""> - Google Credential Provider - </message> - <message name="IDS_INVALID_UI_RESPONSE" desc=""> - Signing in to your Google account failed, please try again. Make sure the computer has a valid internet connection. If the error persists, please report to Google. - </message> - <message name="IDS_CANT_CREATE_USER" desc=""> - A user could not be created. - </message> - <message name="IDS_INTERNAL_ERROR" desc=""> - An internal error occurred. If the error persists. please report to Google. - </message> - <message name="IDS_EMAIL_MISMATCH" desc=""> - Logon with this Google Account is not permitted. - </message> - <message name="IDS_GAIA_ACCOUNT_FULLNAME" desc=""> - Google Credential Provider Helper - </message> - <message name="IDS_GAIA_ACCOUNT_COMMENT" desc=""> - Used to run Google Credential Provider sign in page. - </message> - <message name="IDS_AUTH_FID_DESCRIPTION" desc=""> - Logon using your Google Account. - </message> - <message name="IDS_AUTH_FID_PROVIDER_LABEL" desc=""> - Google Account - </message> - <message name="IDS_REAUTH_FID_DESCRIPTION" desc=""> - Logon using your updated Google Account password. - </message> - <message name="IDS_REAUTH_FID_PROVIDER_LABEL" desc=""> - Update password - </message> - <message name="IDS_ERROR_DIALOG_TITLE" desc=""> - Google Account Logon - </message> - <message name="IDS_USER_ACCOUNT_COMMENT" desc=""> - Google user - </message> - </messages> - </release> -</grit>
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_AUTH_FID_DESCRIPTION.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_AUTH_FID_DESCRIPTION.png.sha1 deleted file mode 100644 index 6b960d5c..0000000 --- a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_AUTH_FID_DESCRIPTION.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -1e5368f132d18a05b6dcc097e7cc7468e071dd3c \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_AUTH_FID_PROVIDER_LABEL.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_AUTH_FID_PROVIDER_LABEL.png.sha1 deleted file mode 100644 index 6b960d5c..0000000 --- a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_AUTH_FID_PROVIDER_LABEL.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -1e5368f132d18a05b6dcc097e7cc7468e071dd3c \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_CANT_CREATE_USER.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_CANT_CREATE_USER.png.sha1 deleted file mode 100644 index e82c5e4..0000000 --- a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_CANT_CREATE_USER.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -6210f8821698a55be1e5a73caae76bdc584f55f7 \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_EMAIL_MISMATCH.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_EMAIL_MISMATCH.png.sha1 deleted file mode 100644 index 5b30864..0000000 --- a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_EMAIL_MISMATCH.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -cc3bb563f1d14dc2076d0d3fd314defb8c0726d5 \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_ERROR_DIALOG_TITLE.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_ERROR_DIALOG_TITLE.png.sha1 deleted file mode 100644 index e82c5e4..0000000 --- a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_ERROR_DIALOG_TITLE.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -6210f8821698a55be1e5a73caae76bdc584f55f7 \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_GAIA_ACCOUNT_COMMENT.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_GAIA_ACCOUNT_COMMENT.png.sha1 deleted file mode 100644 index d416ef3..0000000 --- a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_GAIA_ACCOUNT_COMMENT.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -feb3af1e4e7cf16028655e041d6fc724e6054140 \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_GAIA_ACCOUNT_FULLNAME.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_GAIA_ACCOUNT_FULLNAME.png.sha1 deleted file mode 100644 index 374e2b8..0000000 --- a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_GAIA_ACCOUNT_FULLNAME.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -9cb4fc2f21605d37e94eb3e2a47951c591db3146 \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_INTERNAL_ERROR.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_INTERNAL_ERROR.png.sha1 deleted file mode 100644 index 4ac23f8..0000000 --- a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_INTERNAL_ERROR.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -36d8c7b4adda2ef44d3571b7264d22356df593fc \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_INVALID_UI_RESPONSE.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_INVALID_UI_RESPONSE.png.sha1 deleted file mode 100644 index 1d3a55f..0000000 --- a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_INVALID_UI_RESPONSE.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -d1e5ad3f8b52e3310fc0014e075f7d3f70d6f615 \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_PROJNAME.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_PROJNAME.png.sha1 deleted file mode 100644 index c05aba8..0000000 --- a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_PROJNAME.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -5601f037f04570629f870b43e4e5a58ffa8a29d3 \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_REAUTH_FID_DESCRIPTION.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_REAUTH_FID_DESCRIPTION.png.sha1 deleted file mode 100644 index 4f5c1cd..0000000 --- a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_REAUTH_FID_DESCRIPTION.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -005a78f6867c3dbea56707ebc207b5458e47d69f \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_REAUTH_FID_PROVIDER_LABEL.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_REAUTH_FID_PROVIDER_LABEL.png.sha1 deleted file mode 100644 index fc8cd71..0000000 --- a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_REAUTH_FID_PROVIDER_LABEL.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -6f0d980bc27f861de29105238a13a6ef554170b2 \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_USER_ACCOUNT_COMMENT.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_USER_ACCOUNT_COMMENT.png.sha1 deleted file mode 100644 index ac643d2..0000000 --- a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_USER_ACCOUNT_COMMENT.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -13f89f7d537aaf3b49b4af4d1ca6b86f3b6a95c4 \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gcp_strings.cc b/chrome/credential_provider/gaiacp/gcp_strings.cc deleted file mode 100644 index 7b7d278..0000000 --- a/chrome/credential_provider/gaiacp/gcp_strings.cc +++ /dev/null
@@ -1,43 +0,0 @@ -// Copyright 2018 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/credential_provider/gaiacp/gcp_strings.h" - -namespace credential_provider { - -// Names of keys returned on json data from UI process. -const char kKeyEmail[] = "email"; -const char kKeyFullname[] = "full_name"; -const char kKeyId[] = "id"; -const char kKeyMdmUrl[] = "mdm_url"; -const char kKeyMdmAcessToken[] = "mdm_access_token"; -const char kKeyPassword[] = "password"; -const char kKeyRefreshToken[] = "refresh_token"; -const char kKeySID[] = "sid"; -const char kKeyTokenHandle[] = "token_handle"; -const char kKeyUsername[] = "user_name"; - -// Name of registry value that holds user properties. -const wchar_t kUserTokenHandle[] = L"th"; -const wchar_t kUserNeedsReauth[] = L"nr"; -const wchar_t kUserEmail[] = L"email"; - -// Username and password key for special GAIA account to run GLS. -const wchar_t kGaiaAccountName[] = L"gaia"; -// L$ prefix means this secret can only be accessed locally. -const wchar_t kLsaKeyGaiaPassword[] = L"L$GAIA_PASSWORD"; - -// These two variables need to remain consistent. -const wchar_t kDesktopName[] = L"Winlogon"; -const wchar_t kDesktopFullName[] = L"WinSta0\\Winlogon"; - -// Google Update related registry paths. -const wchar_t kRegUpdaterClientStateAppPath[] = - L"SOFTWARE\\Google\\Update\\ClientState\\" - L"{32987697-A14E-4B89-84D6-630D5431E831}"; -const wchar_t kRegUpdaterClientsAppPath[] = - L"SOFTWARE\\Google\\Update\\Clients\\" - L"{32987697-A14E-4B89-84D6-630D5431E831}"; - -} // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/gcp_strings.h b/chrome/credential_provider/gaiacp/gcp_strings.h deleted file mode 100644 index bcfe16a..0000000 --- a/chrome/credential_provider/gaiacp/gcp_strings.h +++ /dev/null
@@ -1,42 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_GAIACP_GCP_STRINGS_H_ -#define CHROME_CREDENTIAL_PROVIDER_GAIACP_GCP_STRINGS_H_ - -namespace credential_provider { - -// Names of keys returned on json data from UI process. -extern const char kKeyEmail[]; -extern const char kKeyFullname[]; -extern const char kKeyId[]; -extern const char kKeyMdmUrl[]; -extern const char kKeyMdmAcessToken[]; -extern const char kKeyPassword[]; -extern const char kKeyRefreshToken[]; -extern const char kKeySID[]; -extern const char kKeyTokenHandle[]; -extern const char kKeyUsername[]; - -// Name of registry value that holds user properties. -extern const wchar_t kUserTokenHandle[]; -extern const wchar_t kUserNeedsReauth[]; -extern const wchar_t kUserEmail[]; - -// Username and password key for special GAIA account to run GLS. -extern const wchar_t kGaiaAccountName[]; -extern const wchar_t kLsaKeyGaiaPassword[]; - -// Name of the desktop used on the Window welcome screen for interactive -// logon. -extern const wchar_t kDesktopName[]; -extern const wchar_t kDesktopFullName[]; - -// Google Update related registry paths. -extern const wchar_t kRegUpdaterClientStateAppPath[]; -extern const wchar_t kRegUpdaterClientsAppPath[]; - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_GCP_STRINGS_H_
diff --git a/chrome/credential_provider/gaiacp/gcp_utils.cc b/chrome/credential_provider/gaiacp/gcp_utils.cc deleted file mode 100644 index 54d2caa8..0000000 --- a/chrome/credential_provider/gaiacp/gcp_utils.cc +++ /dev/null
@@ -1,552 +0,0 @@ -// Copyright 2018 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/credential_provider/gaiacp/gcp_utils.h" - -#include <windows.h> -#include <winternl.h> -#include <wincred.h> // For <ntsecapi.h> - -#define _NTDEF_ // Prevent redefition errors, must come after <winternl.h> -#include <MDMRegistration.h> // For RegisterDeviceWithManagement() -#include <ntsecapi.h> // For LsaLookupAuthenticationPackage() -#include <sddl.h> // For ConvertSidToStringSid() -#include <security.h> // For NEGOSSP_NAME_A - -#include <atlconv.h> - -#include <malloc.h> -#include <memory.h> -#include <stdlib.h> - -#include <iomanip> -#include <memory> - -#include "base/files/file_path.h" -#include "base/macros.h" -#include "base/scoped_native_library.h" -#include "base/stl_util.h" -#include "base/strings/stringprintf.h" -#include "base/strings/utf_string_conversions.h" -#include "base/win/current_module.h" -#include "base/win/registry.h" -#include "base/win/win_util.h" -#include "chrome/credential_provider/gaiacp/gcp_strings.h" -#include "chrome/credential_provider/gaiacp/logging.h" - -namespace credential_provider { - -namespace { - -HRESULT RegisterWithGoogleDeviceManagement(const base::string16& mdm_url, - const base::string16& email, - const base::string16& token) { - base::ScopedNativeLibrary library( - base::FilePath(FILE_PATH_LITERAL("MDMRegistration.dll"))); - if (!library.is_valid()) { - LOGFN(ERROR) << "base::ScopedNativeLibrary hr=" << putHR(E_NOTIMPL); - return E_NOTIMPL; - } - - using RegisterDeviceWithManagementFunction = - decltype(&::RegisterDeviceWithManagement); - RegisterDeviceWithManagementFunction - register_device_with_management_function = - reinterpret_cast<RegisterDeviceWithManagementFunction>( - library.GetFunctionPointer("RegisterDeviceWithManagement")); - if (!register_device_with_management_function) { - LOGFN(ERROR) << "library.GetFunctionPointer hr=" << putHR(E_NOTIMPL); - return E_NOTIMPL; - } - - return register_device_with_management_function( - email.c_str(), mdm_url.c_str(), token.c_str()); -} - -} // namespace - -// StdParentHandles /////////////////////////////////////////////////////////// - -StdParentHandles::StdParentHandles() {} - -StdParentHandles::~StdParentHandles() {} - -// ScopedStartupInfo ////////////////////////////////////////////////////////// - -ScopedStartupInfo::ScopedStartupInfo() { - memset(&info_, 0, sizeof(info_)); - info_.hStdInput = INVALID_HANDLE_VALUE; - info_.hStdOutput = INVALID_HANDLE_VALUE; - info_.hStdError = INVALID_HANDLE_VALUE; - info_.cb = sizeof(info_); -} - -ScopedStartupInfo::ScopedStartupInfo(const wchar_t* desktop) - : ScopedStartupInfo() { - DCHECK(desktop); - desktop_.assign(desktop); - info_.lpDesktop = const_cast<wchar_t*>(desktop_.c_str()); -} - -ScopedStartupInfo::~ScopedStartupInfo() { - Shutdown(); -} - -HRESULT ScopedStartupInfo::SetStdHandles( - base::win::ScopedHandle* hstdin, - base::win::ScopedHandle* hstdout, - base::win::ScopedHandle* hstderr) { - if ((info_.dwFlags & STARTF_USESTDHANDLES) == STARTF_USESTDHANDLES) { - LOGFN(ERROR) << "Already set"; - return E_UNEXPECTED; - } - - info_.dwFlags |= STARTF_USESTDHANDLES; - info_.hStdInput = hstdin->Take(); - info_.hStdOutput = hstdout->Take(); - info_.hStdError = hstderr->Take(); - return S_OK; -} - -void ScopedStartupInfo::Shutdown() { - if ((info_.dwFlags & STARTF_USESTDHANDLES) == STARTF_USESTDHANDLES) { - info_.dwFlags &= ~STARTF_USESTDHANDLES; - - ::CloseHandle(info_.hStdInput); - ::CloseHandle(info_.hStdOutput); - ::CloseHandle(info_.hStdError); - info_.hStdInput = INVALID_HANDLE_VALUE; - info_.hStdOutput = INVALID_HANDLE_VALUE; - info_.hStdError = INVALID_HANDLE_VALUE; - } -} - -// Waits for a process to terminate while capturing its stdout and stderr to -// the buffers |stdout_buffer| and |stderr_buffer| respectively. Both buffers -// are assumed to be of the size |buffer_size| and expected to be relatively -// small. The exit code of the process is written to |exit_code|. -HRESULT WaitForProcess(base::win::ScopedHandle::Handle process_handle, - const StdParentHandles& parent_handles, - DWORD* exit_code, - char* stdout_buffer, - char* stderr_buffer, - int buffer_size) { - LOGFN(INFO); - DCHECK(exit_code); - DCHECK_GT(buffer_size, 0); - - stdout_buffer[0] = 0; - stderr_buffer[0] = 0; - - // stdio handles to wait on. This array and count are modified by code - // below if errors are detected. - base::win::ScopedHandle::Handle handles[] = { - parent_handles.hstdout_read.Get(), parent_handles.hstderr_read.Get(), - }; - DWORD count = base::size(handles); - - for (bool is_done = false; !is_done && count > 0;) { - base::win::ScopedHandle::Handle h = INVALID_HANDLE_VALUE; - char buffer[80]; - DWORD length = base::size(buffer) - 1; - HRESULT hr = S_OK; - - const DWORD kThreeMinutesInMs = 3 * 60 * 1000; - DWORD ret = ::WaitForMultipleObjectsEx(count, handles, - FALSE, // wait all - kThreeMinutesInMs, // timeout ms - TRUE); // alertable wait - switch (ret) { - case WAIT_OBJECT_0: - case WAIT_OBJECT_0 + 1: { - int index = ret - WAIT_OBJECT_0; - LOGFN(INFO) << "WAIT_OBJECT_" << index; - h = handles[index]; - if (!::ReadFile(h, buffer, length, &length, nullptr)) { - hr = HRESULT_FROM_WIN32(::GetLastError()); - if (hr != HRESULT_FROM_WIN32(ERROR_BROKEN_PIPE)) - LOGFN(ERROR) << "ReadFile(" << index << ") hr=" << putHR(hr); - } else { - LOGFN(INFO) << "ReadFile(" << index << ") length=" << length; - buffer[length] = 0; - } - break; - } - case WAIT_IO_COMPLETION: - // This is normal. Just ignore. - LOGFN(INFO) << "WaitForMultipleObjectsEx WAIT_IO_COMPLETION"; - break; - case WAIT_TIMEOUT: { - // User took too long to log in, so kill UI process. - LOGFN(INFO) << "WaitForMultipleObjectsEx WAIT_TIMEOUT, killing UI"; - ::TerminateProcess(process_handle, kUiecTimeout); - is_done = true; - break; - } - case WAIT_FAILED: - default: { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "WaitForMultipleObjectsEx hr=" << putHR(hr); - is_done = true; - break; - } - } - - // Copy the read buffer to either the stdout or stderr, as apppropriate. - // If the pipe was broken, remove the corresponding handle from |handles| - // so that WaitForMultipleObjectsEx() above no longer waits for it. - if (h == parent_handles.hstdout_read.Get()) { - if (hr == HRESULT_FROM_WIN32(ERROR_BROKEN_PIPE)) { - LOGFN(INFO) << "Stop waiting for stdout"; - handles[0] = handles[1]; - --count; - } else { - strcat_s(stdout_buffer, buffer_size, buffer); - } - } else if (h == parent_handles.hstderr_read.Get()) { - if (hr == HRESULT_FROM_WIN32(ERROR_BROKEN_PIPE)) { - LOGFN(INFO) << "Stop waiting for stderr"; - --count; - } else { - strcat_s(stderr_buffer, buffer_size, buffer); - } - } - } - - // At this point both stdout and stderr have been closed. Wait on the process - // handle for the process to terminate, getting the exit code. If the - // process does not terminate gracefully, kill it before returning. - DWORD ret = ::WaitForSingleObject(process_handle, 10000); - if (ret == 0) { - if (::GetExitCodeProcess(process_handle, exit_code)) { - LOGFN(INFO) << "Process terminated with exit code " << *exit_code; - } else { - LOGFN(INFO) << "Process terminated without exit code"; - *exit_code = kUiecAbort; - } - } else { - LOGFN(INFO) << "UI did not terminiate within 10 seconds, killing now"; - ::TerminateProcess(process_handle, kUiecKilled); - *exit_code = kUiecKilled; - } - - return S_OK; -} - -HRESULT CreateLogonToken(const wchar_t* username, - const wchar_t* password, - base::win::ScopedHandle* token) { - DCHECK(username); - DCHECK(password); - DCHECK(token); - - base::win::ScopedHandle::Handle handle; - if (!::LogonUserW(username, L".", password, LOGON32_LOGON_BATCH, - LOGON32_PROVIDER_DEFAULT, &handle)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "LogonUserW hr=" << putHR(hr); - return hr; - } - base::win::ScopedHandle primary_token(handle); - - if (!::CreateRestrictedToken(primary_token.Get(), DISABLE_MAX_PRIVILEGE, 0, - nullptr, 0, nullptr, 0, nullptr, &handle)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "CreateRestrictedToken hr=" << putHR(hr); - return hr; - } - token->Set(handle); - return S_OK; -} - -HRESULT CreateJobForSignin(base::win::ScopedHandle* job) { - LOGFN(INFO); - DCHECK(job); - - job->Set(::CreateJobObject(nullptr, nullptr)); - if (!job->IsValid()) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "CreateJobObject hr=" << putHR(hr); - return hr; - } - - JOBOBJECT_BASIC_UI_RESTRICTIONS ui; - ui.UIRestrictionsClass = - JOB_OBJECT_UILIMIT_DESKTOP | // Create/switch desktops. - JOB_OBJECT_UILIMIT_HANDLES | // Only access own handles. - JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS | // Cannot set sys params. - JOB_OBJECT_UILIMIT_WRITECLIPBOARD; // Cannot write to clipboard. - if (!::SetInformationJobObject(job->Get(), JobObjectBasicUIRestrictions, &ui, - sizeof(ui))) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "SetInformationJobObject hr=" << putHR(hr); - return hr; - } - - return S_OK; -} - -HRESULT CreatePipeForChildProcess(bool child_reads, - bool use_nul, - base::win::ScopedHandle* reading, - base::win::ScopedHandle* writing) { - // Make sure that all handles created here are inheritable. It is important - // that the child side handle is inherited. - SECURITY_ATTRIBUTES sa; - sa.nLength = sizeof(sa); - sa.bInheritHandle = TRUE; - sa.lpSecurityDescriptor = nullptr; - - if (use_nul) { - base::win::ScopedHandle h( - ::CreateFileW(L"nul:", FILE_GENERIC_READ | FILE_GENERIC_WRITE, - FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, - &sa, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr)); - if (!h.IsValid()) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "CreateFile(nul) hr=" << putHR(hr); - return hr; - } - - if (child_reads) { - reading->Set(h.Take()); - } else { - writing->Set(h.Take()); - } - } else { - base::win::ScopedHandle::Handle temp_handle1; - base::win::ScopedHandle::Handle temp_handle2; - if (!::CreatePipe(&temp_handle1, &temp_handle2, &sa, 0)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "CreatePipe(reading) hr=" << putHR(hr); - return hr; - } - reading->Set(temp_handle1); - writing->Set(temp_handle2); - - // Make sure parent side is not inherited. - if (!::SetHandleInformation(child_reads ? writing->Get() : reading->Get(), - HANDLE_FLAG_INHERIT, 0)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "SetHandleInformation(parent) hr=" << putHR(hr); - return hr; - } - } - - return S_OK; -} - -HRESULT InitializeStdHandles(CommDirection direction, - ScopedStartupInfo* startupinfo, - StdParentHandles* parent_handles) { - LOGFN(INFO); - DCHECK(startupinfo); - DCHECK(parent_handles); - - base::win::ScopedHandle hstdin_read; - base::win::ScopedHandle hstdin_write; - HRESULT hr = CreatePipeForChildProcess( - true, // child reads - direction == CommDirection::kChildToParentOnly, // use nul - &hstdin_read, &hstdin_write); - if (FAILED(hr)) { - LOGFN(ERROR) << "CreatePipeForChildProcess(stdin) hr=" << putHR(hr); - return hr; - } - - base::win::ScopedHandle hstdout_read; - base::win::ScopedHandle hstdout_write; - hr = CreatePipeForChildProcess( - false, // child reads - direction == CommDirection::kParentToChildOnly, // use nul - &hstdout_read, &hstdout_write); - if (FAILED(hr)) { - LOGFN(ERROR) << "CreatePipeForChildProcess(stdout) hr=" << putHR(hr); - return hr; - } - - base::win::ScopedHandle hstderr_read; - base::win::ScopedHandle hstderr_write; - hr = CreatePipeForChildProcess( - false, // child reads - direction == CommDirection::kParentToChildOnly, // use nul - &hstderr_read, &hstderr_write); - if (FAILED(hr)) { - LOGFN(ERROR) << "CreatePipeForChildProcess(stderr) hr=" << putHR(hr); - return hr; - } - - hr = startupinfo->SetStdHandles(&hstdin_read, &hstdout_write, &hstderr_write); - if (FAILED(hr)) { - LOGFN(ERROR) << "startupinfo->SetStdHandles hr=" << putHR(hr); - return hr; - } - - parent_handles->hstdin_write.Set(hstdin_write.Take()); - parent_handles->hstdout_read.Set(hstdout_read.Take()); - parent_handles->hstderr_read.Set(hstderr_read.Take()); - return S_OK; -} - -HRESULT GetCommandLineForEntrypoint(HINSTANCE hDll, - const wchar_t* entrypoint, - wchar_t* command_line, - size_t command_line_length) { - DCHECK(entrypoint); - DCHECK(command_line); - - // rundll32 expects the first command line argument to be the path to the - // DLL, followed by a comma and the name of the function to call. There can - // be no spaces around the comma. There can be no spaces in the path. It - // is recommended to use the short path name of the DLL. - wchar_t path[MAX_PATH]; - DWORD length = base::size(path); - length = ::GetModuleFileName(hDll, path, length); - if (length == base::size(path) && - ::GetLastError() == ERROR_INSUFFICIENT_BUFFER) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "GetModuleFileNameW hr=" << putHR(hr); - return hr; - } - - wchar_t short_path[MAX_PATH]; - DWORD short_length = base::size(short_path); - short_length = ::GetShortPathName(path, short_path, short_length); - if (short_length >= base::size(short_path)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "GetShortPathNameW hr=" << putHR(hr); - return hr; - } - - const wchar_t kCommandLineFormat[] = L"rundll32 %s,%s"; - const int kCommandLineFormatRequiredLength = 10; - - // The command line buffer needs to be at least as large as the short path - // name plus the entrypoint length plus the extra overhead of the command - // line formatting. - if (command_line_length < short_length + wcslen(entrypoint) + - kCommandLineFormatRequiredLength) { - LOGFN(ERROR) << "command_line_length too short"; - return E_OUTOFMEMORY; - } - - if (swprintf_s(command_line, command_line_length, kCommandLineFormat, - short_path, entrypoint) == -1) { - LOGFN(ERROR) << "_stprintf_s(command_line) doserror=" << _doserrno; - return E_OUTOFMEMORY; - } - - return S_OK; -} - -HRESULT EnrollToGoogleMdmIfNeeded(const base::DictionaryValue& properties) { - USES_CONVERSION; - LOGFN(INFO); - - // Enroll to Google MDM if not already enrolled. - - HRESULT hr = E_FAIL; - BOOL is_registered = base::win::IsDeviceRegisteredWithManagement(); - LOGFN(INFO) << "MDM is_registered=" << is_registered; - - if (!is_registered) { - base::string16 email = GetDictString(&properties, kKeyEmail); - base::string16 token = GetDictString(&properties, kKeyMdmAcessToken); - base::string16 mdm_url = GetDictString(&properties, kKeyMdmUrl); - - if (email.empty()) { - LOGFN(ERROR) << "Email is empty"; - return E_INVALIDARG; - } - - if (token.empty()) { - LOGFN(ERROR) << "MDM access token is empty"; - return E_INVALIDARG; - } - - if (mdm_url.empty()) { - LOGFN(ERROR) << "No MDM URL specified"; - return E_INVALIDARG; - } - - LOGFN(INFO) << "MDM_URL=" << mdm_url - << " token=" << base::string16(token.c_str(), 10); - - hr = RegisterWithGoogleDeviceManagement(mdm_url, email, token); - LOGFN(INFO) << "RegisterWithGoogleDeviceManagement hr=" << putHR(hr); - } - - return hr; -} - -HRESULT GetAuthenticationPackageId(ULONG* id) { - DCHECK(id); - - HANDLE lsa; - NTSTATUS status = ::LsaConnectUntrusted(&lsa); - HRESULT hr = HRESULT_FROM_NT(status); - if (FAILED(hr)) { - LOGFN(ERROR) << "LsaConnectUntrusted hr=" << putHR(hr); - return hr; - } - - LSA_STRING name; - name.Buffer = const_cast<PCHAR>(NEGOSSP_NAME_A); - name.Length = static_cast<USHORT>(strlen(name.Buffer)); - name.MaximumLength = name.Length + 1; - - status = ::LsaLookupAuthenticationPackage(lsa, &name, id); - ::LsaDeregisterLogonProcess(lsa); - hr = HRESULT_FROM_NT(status); - if (FAILED(hr)) - LOGFN(ERROR) << "LsaLookupAuthenticationPackage hr=" << putHR(hr); - - return hr; -} - -base::string16 GetStringResource(UINT id) { - // When LoadStringW receives 0 as the fourth argument (buffer length), it - // assumes the third argument (buffer) is a pointer. The returned pointer - // is still owned by the system and must not be freed. Furthermore the string - // pointed at is not null terminated, so the returned length must be used to - // construct the final base::string16. - wchar_t* str; - int length = - ::LoadStringW(CURRENT_MODULE(), id, reinterpret_cast<wchar_t*>(&str), 0); - return base::string16(str, length); -} - -base::string16 GetDictString( - const base::DictionaryValue* dict, - const char* name) { - DCHECK(name); - auto* value = dict->FindKey(name); - return value && value->is_string() ? base::UTF8ToUTF16(value->GetString()) - : base::string16(); -} - -base::string16 GetDictString(const std::unique_ptr<base::DictionaryValue>& dict, - const char* name) { - return GetDictString(dict.get(), name); -} - -std::string GetDictStringUTF8( - const base::DictionaryValue* dict, - const char* name) { - DCHECK(name); - auto* value = dict->FindKey(name); - return value && value->is_string() ? value->GetString() : std::string(); -} - -std::string GetDictStringUTF8( - const std::unique_ptr<base::DictionaryValue>& dict, - const char* name) { - return GetDictStringUTF8(dict.get(), name); -} - -FakesForTesting::FakesForTesting() {} - -FakesForTesting::~FakesForTesting() {} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/gcp_utils.h b/chrome/credential_provider/gaiacp/gcp_utils.h deleted file mode 100644 index 757703d..0000000 --- a/chrome/credential_provider/gaiacp/gcp_utils.h +++ /dev/null
@@ -1,183 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_GAIACP_GCP_UTILS_H_ -#define CHROME_CREDENTIAL_PROVIDER_GAIACP_GCP_UTILS_H_ - -#include "base/callback.h" -#include "base/strings/string16.h" -#include "base/values.h" -#include "base/win/scoped_handle.h" -#include "base/win/windows_types.h" -#include "chrome/credential_provider/gaiacp/scoped_handle.h" -#include "chrome/credential_provider/gaiacp/scoped_lsa_policy.h" -#include "url/gurl.h" - -// These define are documented in -// https://msdn.microsoft.com/en-us/library/bb470234(v=vs.85).aspx not available -// in the user mode headers. -#define DIRECTORY_QUERY 0x00000001 -#define DIRECTORY_TRAVERSE 0x00000002 -#define DIRECTORY_CREATE_OBJECT 0x00000004 -#define DIRECTORY_CREATE_SUBDIRECTORY 0x00000008 -#define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF) - -namespace credential_provider { - -// Because of some strange dependency problems with windows header files, -// define STATUS_SUCCESS here instead of including ntstatus.h or SubAuth.h -#define STATUS_SUCCESS ((NTSTATUS)0x00000000L) - -// The the UI process can exit with the following exit code. -enum UiExitCodes { - // The user completed the sign in successfully. - kUiecSuccess, - - // The sign in was aborted by the user. - kUiecAbort, - - // The sign in timed out. - kUiecTimeout, - - // The process was killed by the GCP. - kUiecKilled, - - // The email does not match the required pattern. - kUiecEMailMissmatch, -}; - -// Filled in by InitializeStdHandles to return the parent side of stdin/stdout/ -// stderr pipes of the login UI process. -struct StdParentHandles { - StdParentHandles(); - ~StdParentHandles(); - - base::win::ScopedHandle hstdin_write; - base::win::ScopedHandle hstdout_read; - base::win::ScopedHandle hstderr_read; -}; - -// Process startup options that allows customization of stdin/stdout/stderr -// handles. -class ScopedStartupInfo { - public: - ScopedStartupInfo(); - explicit ScopedStartupInfo(const wchar_t* desktop); - ~ScopedStartupInfo(); - - // This function takes ownership of the handles. - HRESULT SetStdHandles(base::win::ScopedHandle* hstdin, - base::win::ScopedHandle* hstdout, - base::win::ScopedHandle* hstderr); - - LPSTARTUPINFOW GetInfo() { return &info_; } - - // Releases all resources held by this info. - void Shutdown(); - - private: - STARTUPINFOW info_; - base::string16 desktop_; -}; - -// Waits for the process specified by |procinfo| to terminate. The handles -// in |read_handles| can be used to read stdout/err from the process. Upon -// return, |exit_code| contains one of the UIEC_xxx constants listed above, -// and |stdout_buffer| and |stderr_buffer| contain the output, if any. -// Both buffers must be at least |buffer_size| characters long. -HRESULT WaitForProcess(base::win::ScopedHandle::Handle process_handle, - const StdParentHandles& parent_handles, - DWORD* exit_code, - char* stdout_buffer, - char* stderr_buffer, - int buffer_size); - -// Creates a restricted, batch login token for the given user. -HRESULT CreateLogonToken(const wchar_t* username, - const wchar_t* password, - base::win::ScopedHandle* token); - -HRESULT CreateJobForSignin(base::win::ScopedHandle* job); - -// Creates a pipe that can be used by a parent process to communicate with a -// child process. If |child_reads| is false, then it is expected that the -// parent process will read from |reading| anything the child process writes -// to |writing|. For example, this is used to read stdout/stderr of child. -// -// If |child_reads| is true, then it is expected that the child process will -// read from |reading| anything the parent process writes to |writing|. For -// example, this is used to write to stdin of child. -// -// If |use_nul| is true, then the parent's handle is not used (can be passed -// as nullptr). The child reads from or writes to the null device. -HRESULT CreatePipeForChildProcess(bool child_reads, - bool use_nul, - base::win::ScopedHandle* reading, - base::win::ScopedHandle* writing); - -// Initializes 3 pipes for communicating with a child process. On return, -// |startupinfo| will be set with the handles needed by the child. This is -// used when creating the child process. |parent_handles| contains the -// corresponding handles to be used by the parent process. -// -// Communication direction is used to optimize handle creation. If -// communication occurs in only one direction then some pipes will be directed -// to the nul device. -enum class CommDirection { - kParentToChildOnly, - kChildToParentOnly, - kBidirectional, -}; -HRESULT InitializeStdHandles(CommDirection direction, - ScopedStartupInfo* startupinfo, - StdParentHandles* parent_handles); - -// This function is used to build the command line for rundll32 to call an -// exported entrypoint from the DLL given by |hDll|. -HRESULT GetCommandLineForEntrypoint(HINSTANCE hDll, - const wchar_t* entrypoint, - wchar_t* command_line, - size_t command_line_length); - -// Enrolls the machine to with the Google MDM server if not already. -HRESULT EnrollToGoogleMdmIfNeeded(const base::DictionaryValue& properties); - -// Gets the auth package id for NEGOSSP_NAME_A. -HRESULT GetAuthenticationPackageId(ULONG* id); - -// Gets a string resource from the DLL with the given id. -base::string16 GetStringResource(UINT id); - -// Helpers to get strings from DictionaryValues. -base::string16 GetDictString(const base::DictionaryValue* dict, - const char* name); -base::string16 GetDictString(const std::unique_ptr<base::DictionaryValue>& dict, - const char* name); -std::string GetDictStringUTF8(const base::DictionaryValue* dict, - const char* name); -std::string GetDictStringUTF8( - const std::unique_ptr<base::DictionaryValue>& dict, - const char* name); - -class OSUserManager; - -// This structure is used in tests to set fake objects in the credential -// provider dll. See the function SetFakesForTesting() for details. -struct FakesForTesting { - FakesForTesting(); - ~FakesForTesting(); - - ScopedLsaPolicy::CreatorCallback scoped_lsa_policy_creator; - OSUserManager* os_manager_for_testing = nullptr; -}; - -// DLL entrypoint signature for settings testing fakes. This is used by -// the setup tests to install fakes into the dynamically loaded gaia1_0 DLL -// static data. This way the production DLL does not need to include binary -// code used only for testing. -typedef void CALLBACK (*SetFakesForTestingFn)(const FakesForTesting* fakes); - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_GCP_UTILS_H_
diff --git a/chrome/credential_provider/gaiacp/gcp_utils_unittests.cc b/chrome/credential_provider/gaiacp/gcp_utils_unittests.cc deleted file mode 100644 index 88f9859..0000000 --- a/chrome/credential_provider/gaiacp/gcp_utils_unittests.cc +++ /dev/null
@@ -1,347 +0,0 @@ -// Copyright 2018 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 "base/compiler_specific.h" -#include "base/macros.h" -#include "base/process/launch.h" -#include "base/stl_util.h" -#include "base/win/scoped_handle.h" -#include "build/build_config.h" -#include "chrome/credential_provider/gaiacp/gcp_utils.h" -#include "chrome/credential_provider/test/gcp_fakes.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace credential_provider { - -TEST(GcpPasswordTest, GenerateRandomPassword) { - wchar_t password[64]; - - OSUserManager* manager = OSUserManager::Get(); - - // Password buffer must be minimum length. - ASSERT_NE(S_OK, manager->GenerateRandomPassword(password, 0)); - ASSERT_NE(S_OK, manager->GenerateRandomPassword(password, 23)); - - // Generate a few passwords and make sure length i correct. - for (int i = 0; i < 100; ++i) { - ASSERT_EQ(S_OK, - manager->GenerateRandomPassword(password, base::size(password))); - ASSERT_LT(24u, wcslen(password)); - } -} - -class GcpProcHelperTest : public ::testing::Test { - protected: - void CreateHandle(base::win::ScopedHandle* handle); - - bool TestPipe(const base::win::ScopedHandle::Handle& reading, - const base::win::ScopedHandle::Handle& writing); - - void StripCrLf(char* buffer); - - FakeOSUserManager fake_os_user_manager_; -}; - -void GcpProcHelperTest::CreateHandle(base::win::ScopedHandle* handle) { - handle->Set( - ::CreateFileW(L"nul:", FILE_GENERIC_READ | FILE_GENERIC_WRITE, - FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, - nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr)); - ASSERT_TRUE(handle->IsValid()); -} - -bool GcpProcHelperTest::TestPipe( - const base::win::ScopedHandle::Handle& reading, - const base::win::ScopedHandle::Handle& writing) { - char input_buffer[8]; - char output_buffer[8]; - strcpy_s(input_buffer, base::size(input_buffer), "hello"); - const DWORD kExpectedDataLength = strlen(input_buffer) + 1; - - // Make sure what is written can be read. - DWORD written; - EXPECT_TRUE(::WriteFile(writing, input_buffer, kExpectedDataLength, &written, - nullptr)); - EXPECT_EQ(kExpectedDataLength, written); - - DWORD read; - EXPECT_TRUE(ReadFile(reading, output_buffer, base::size(output_buffer), &read, - nullptr)); - EXPECT_EQ(kExpectedDataLength, read); - return strcmp(input_buffer, output_buffer) == 0; -} - -void GcpProcHelperTest::StripCrLf(char* buffer) { - for (char* p = buffer + strlen(buffer) - 1; p >= buffer; --p) { - if (*p == '\n' || *p == '\r') - *p = 0; - } -} - -TEST_F(GcpProcHelperTest, ScopedStartupInfo) { - ScopedStartupInfo info; - ASSERT_EQ(sizeof(STARTUPINFOW), info.GetInfo()->cb); - ASSERT_EQ(nullptr, info.GetInfo()->lpDesktop); - ASSERT_EQ(0u, info.GetInfo()->dwFlags & STARTF_USESTDHANDLES); - ASSERT_EQ(INVALID_HANDLE_VALUE, info.GetInfo()->hStdInput); - ASSERT_EQ(INVALID_HANDLE_VALUE, info.GetInfo()->hStdOutput); - ASSERT_EQ(INVALID_HANDLE_VALUE, info.GetInfo()->hStdError); -} - -TEST_F(GcpProcHelperTest, ScopedStartupInfo_desktop) { - ScopedStartupInfo info(L"desktop"); - ASSERT_EQ(sizeof(STARTUPINFOW), info.GetInfo()->cb); - ASSERT_STREQ(L"desktop", info.GetInfo()->lpDesktop); - ASSERT_EQ(0u, info.GetInfo()->dwFlags & STARTF_USESTDHANDLES); - ASSERT_EQ(INVALID_HANDLE_VALUE, info.GetInfo()->hStdInput); - ASSERT_EQ(INVALID_HANDLE_VALUE, info.GetInfo()->hStdOutput); - ASSERT_EQ(INVALID_HANDLE_VALUE, info.GetInfo()->hStdError); -} - -TEST_F(GcpProcHelperTest, ScopedStartupInfo_handles) { - base::win::ScopedHandle::Handle hstdin = INVALID_HANDLE_VALUE; - base::win::ScopedHandle::Handle hstdout = INVALID_HANDLE_VALUE; - base::win::ScopedHandle::Handle hstderr = INVALID_HANDLE_VALUE; - - { - ScopedStartupInfo info; - base::win::ScopedHandle shstdin; - CreateHandle(&shstdin); - base::win::ScopedHandle shstdout; - CreateHandle(&shstdout); - base::win::ScopedHandle shstderr; - CreateHandle(&shstderr); - - // Setting handles in the info should take ownership. - ASSERT_EQ(S_OK, info.SetStdHandles(&shstdin, &shstdout, &shstderr)); - ASSERT_FALSE(shstdin.IsValid()); - ASSERT_FALSE(shstdout.IsValid()); - ASSERT_FALSE(shstderr.IsValid()); - ASSERT_EQ(static_cast<DWORD>(STARTF_USESTDHANDLES), - info.GetInfo()->dwFlags & STARTF_USESTDHANDLES); - ASSERT_NE(INVALID_HANDLE_VALUE, info.GetInfo()->hStdInput); - ASSERT_NE(INVALID_HANDLE_VALUE, info.GetInfo()->hStdOutput); - ASSERT_NE(INVALID_HANDLE_VALUE, info.GetInfo()->hStdError); - hstdin = info.GetInfo()->hStdInput; - hstdout = info.GetInfo()->hStdOutput; - hstderr = info.GetInfo()->hStdError; - } - - // When the info goes out of scope with handles attached, those handle should - // be closed. In this test, it is unlikely that handles will get recycled - // and become valid again. - DWORD flags; - ASSERT_FALSE(GetHandleInformation(hstdin, &flags)); - ASSERT_FALSE(GetHandleInformation(hstdout, &flags)); - ASSERT_FALSE(GetHandleInformation(hstderr, &flags)); -} - -TEST_F(GcpProcHelperTest, CreatePipeForChildProcess_ParentReads) { - base::win::ScopedHandle reading; - base::win::ScopedHandle writing; - - ASSERT_EQ(S_OK, CreatePipeForChildProcess(false, false, &reading, &writing)); - ASSERT_TRUE(reading.IsValid()); - ASSERT_TRUE(writing.IsValid()); - - DWORD flags; - ASSERT_TRUE(::GetHandleInformation(reading.Get(), &flags)); - ASSERT_EQ(0u, flags & HANDLE_FLAG_INHERIT); - ASSERT_TRUE(::GetHandleInformation(writing.Get(), &flags)); - ASSERT_EQ(static_cast<DWORD>(HANDLE_FLAG_INHERIT), - flags & HANDLE_FLAG_INHERIT); - - EXPECT_TRUE(TestPipe(reading.Get(), writing.Get())); -} - -TEST_F(GcpProcHelperTest, CreatePipeForChildProcess_ChildReads) { - base::win::ScopedHandle reading; - base::win::ScopedHandle writing; - - ASSERT_EQ(S_OK, CreatePipeForChildProcess(true, false, &reading, &writing)); - ASSERT_TRUE(reading.IsValid()); - ASSERT_TRUE(writing.IsValid()); - - DWORD flags; - ASSERT_TRUE(::GetHandleInformation(reading.Get(), &flags)); - ASSERT_EQ(static_cast<DWORD>(HANDLE_FLAG_INHERIT), - flags & HANDLE_FLAG_INHERIT); - ASSERT_TRUE(::GetHandleInformation(writing.Get(), &flags)); - ASSERT_EQ(0u, flags & HANDLE_FLAG_INHERIT); - - EXPECT_TRUE(TestPipe(reading.Get(), writing.Get())); -} - -TEST_F(GcpProcHelperTest, CreatePipeForChildProcess_ParentReadsNul) { - base::win::ScopedHandle reading; - base::win::ScopedHandle writing; - - ASSERT_EQ(S_OK, CreatePipeForChildProcess(false, true, &reading, &writing)); - ASSERT_FALSE(reading.IsValid()); - ASSERT_TRUE(writing.IsValid()); // Writes to nul: - - DWORD flags; - ASSERT_TRUE(::GetHandleInformation(writing.Get(), &flags)); - ASSERT_EQ(static_cast<DWORD>(HANDLE_FLAG_INHERIT), - flags & HANDLE_FLAG_INHERIT); -} - -TEST_F(GcpProcHelperTest, CreatePipeForChildProcess_ChildReadsNul) { - base::win::ScopedHandle reading; - base::win::ScopedHandle writing; - - ASSERT_EQ(S_OK, CreatePipeForChildProcess(true, true, &reading, &writing)); - ASSERT_TRUE(reading.IsValid()); // Reads from nul: - ASSERT_FALSE(writing.IsValid()); - - DWORD flags; - ASSERT_TRUE(::GetHandleInformation(reading.Get(), &flags)); - ASSERT_EQ(static_cast<DWORD>(HANDLE_FLAG_INHERIT), - flags & HANDLE_FLAG_INHERIT); -} - -TEST_F(GcpProcHelperTest, InitializeStdHandles_ParentToChild) { - ScopedStartupInfo startupinfo; - StdParentHandles parent_handles; - - ASSERT_EQ(S_OK, InitializeStdHandles(CommDirection::kParentToChildOnly, - &startupinfo, &parent_handles)); - - // Check parent handles. - ASSERT_TRUE(parent_handles.hstdin_write.IsValid()); - ASSERT_FALSE(parent_handles.hstdout_read.IsValid()); - ASSERT_FALSE(parent_handles.hstderr_read.IsValid()); - - // Check child handles. stdout and stderr go to nul:. - ASSERT_NE(nullptr, startupinfo.GetInfo()->hStdInput); - ASSERT_NE(INVALID_HANDLE_VALUE, startupinfo.GetInfo()->hStdInput); - ASSERT_NE(nullptr, startupinfo.GetInfo()->hStdOutput); - ASSERT_NE(INVALID_HANDLE_VALUE, startupinfo.GetInfo()->hStdOutput); - ASSERT_NE(nullptr, startupinfo.GetInfo()->hStdError); - ASSERT_NE(INVALID_HANDLE_VALUE, startupinfo.GetInfo()->hStdError); - - EXPECT_TRUE(TestPipe(startupinfo.GetInfo()->hStdInput, - parent_handles.hstdin_write.Get())); -} - -TEST_F(GcpProcHelperTest, InitializeStdHandles_ChildToParent) { - ScopedStartupInfo startupinfo; - StdParentHandles parent_handles; - - ASSERT_EQ(S_OK, InitializeStdHandles(CommDirection::kChildToParentOnly, - &startupinfo, &parent_handles)); - - // Check parent handles. - ASSERT_FALSE(parent_handles.hstdin_write.IsValid()); - ASSERT_TRUE(parent_handles.hstdout_read.IsValid()); - ASSERT_TRUE(parent_handles.hstderr_read.IsValid()); - - // Check child handles. stdin comes from nul:. - ASSERT_NE(nullptr, startupinfo.GetInfo()->hStdInput); - ASSERT_NE(INVALID_HANDLE_VALUE, startupinfo.GetInfo()->hStdInput); - ASSERT_NE(nullptr, startupinfo.GetInfo()->hStdOutput); - ASSERT_NE(INVALID_HANDLE_VALUE, startupinfo.GetInfo()->hStdOutput); - ASSERT_NE(nullptr, startupinfo.GetInfo()->hStdError); - ASSERT_NE(INVALID_HANDLE_VALUE, startupinfo.GetInfo()->hStdError); - - EXPECT_TRUE(TestPipe(parent_handles.hstdout_read.Get(), - startupinfo.GetInfo()->hStdOutput)); -} - -TEST_F(GcpProcHelperTest, InitializeStdHandles_ParentChildBirectional) { - ScopedStartupInfo startupinfo; - StdParentHandles parent_handles; - - ASSERT_EQ(S_OK, InitializeStdHandles(CommDirection::kBidirectional, - &startupinfo, &parent_handles)); - - // Check parent handles. - ASSERT_TRUE(parent_handles.hstdin_write.IsValid()); - ASSERT_TRUE(parent_handles.hstdout_read.IsValid()); - ASSERT_TRUE(parent_handles.hstderr_read.IsValid()); - - // Check child handles. stdin comes from nul:. - ASSERT_NE(nullptr, startupinfo.GetInfo()->hStdInput); - ASSERT_NE(INVALID_HANDLE_VALUE, startupinfo.GetInfo()->hStdInput); - ASSERT_NE(nullptr, startupinfo.GetInfo()->hStdOutput); - ASSERT_NE(INVALID_HANDLE_VALUE, startupinfo.GetInfo()->hStdOutput); - ASSERT_NE(nullptr, startupinfo.GetInfo()->hStdError); - ASSERT_NE(INVALID_HANDLE_VALUE, startupinfo.GetInfo()->hStdError); - - EXPECT_TRUE(TestPipe(startupinfo.GetInfo()->hStdInput, - parent_handles.hstdin_write.Get())); - EXPECT_TRUE(TestPipe(parent_handles.hstdout_read.Get(), - startupinfo.GetInfo()->hStdOutput)); -} - -TEST_F(GcpProcHelperTest, WaitForProcess) { - ScopedStartupInfo startupinfo; - StdParentHandles parent_handles; - - ASSERT_EQ(S_OK, InitializeStdHandles(CommDirection::kBidirectional, - &startupinfo, &parent_handles)); - base::LaunchOptions options; - options.inherit_mode = base::LaunchOptions::Inherit::kAll; - options.stdin_handle = startupinfo.GetInfo()->hStdInput; - options.stdout_handle = startupinfo.GetInfo()->hStdOutput; - options.stderr_handle = startupinfo.GetInfo()->hStdError; - - // Launch an app that copies stdin to stdout. This is not a perfect copy - // of linux cat since it appends \r\n to the output strings. The test - // needs to take that in account below. - base::Process process(base::LaunchProcess(L"find.exe /v \"\"", options)); - ASSERT_TRUE(process.IsValid()); - - // Write to stdin of the child process. - const int kBufferSize = 16; - char input_buffer[kBufferSize]; - strcpy_s(input_buffer, base::size(input_buffer), "hello"); - const DWORD kExpectedDataLength = strlen(input_buffer) + 1; - DWORD written; - ASSERT_TRUE(::WriteFile(parent_handles.hstdin_write.Get(), input_buffer, - kExpectedDataLength, &written, nullptr)); - ASSERT_EQ(kExpectedDataLength, written); - ASSERT_TRUE(FlushFileBuffers(parent_handles.hstdin_write.Get())); - parent_handles.hstdin_write.Close(); - - // Close all child handles that the parent is still holding onto, to ensure - // the child process quits. Otherwise the pipe will remain open and the child - // will continue to wait for input. - startupinfo.Shutdown(); - - DWORD exit_code; - char output_buffer[kBufferSize]; - char error_buffer[kBufferSize]; - EXPECT_EQ(S_OK, WaitForProcess(process.Handle(), parent_handles, &exit_code, - output_buffer, error_buffer, kBufferSize)); - EXPECT_EQ(0u, exit_code); - StripCrLf(output_buffer); - EXPECT_STREQ(input_buffer, output_buffer); -} - -TEST_F(GcpProcHelperTest, GetCommandLineForEntrypoint) { - wchar_t command_line[256]; - - EXPECT_NE(S_OK, GetCommandLineForEntrypoint(nullptr, L"entrypoint", - command_line, 0)); - EXPECT_NE(S_OK, GetCommandLineForEntrypoint(nullptr, L"entrypoint", - command_line, 20)); - - // Get short path name of this binary and build the expect command line. - wchar_t path[MAX_PATH]; - wchar_t short_path[MAX_PATH]; - wchar_t expected_command_line[MAX_PATH]; - ASSERT_LT(0u, GetModuleFileName(nullptr, path, base::size(path))); - ASSERT_LT(0u, GetShortPathName(path, short_path, base::size(short_path))); - ASSERT_NE(-1, - swprintf_s(expected_command_line, base::size(expected_command_line), - L"rundll32 %s,entrypoint", short_path)); - - EXPECT_EQ(S_OK, - GetCommandLineForEntrypoint(nullptr, L"entrypoint", command_line, - base::size(command_line))); - EXPECT_STREQ(expected_command_line, command_line); -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/google_logo_small.bmp b/chrome/credential_provider/gaiacp/google_logo_small.bmp deleted file mode 100644 index 85fe03d..0000000 --- a/chrome/credential_provider/gaiacp/google_logo_small.bmp +++ /dev/null Binary files differ
diff --git a/chrome/credential_provider/gaiacp/initguid.cc b/chrome/credential_provider/gaiacp/initguid.cc deleted file mode 100644 index 80952c548..0000000 --- a/chrome/credential_provider/gaiacp/initguid.cc +++ /dev/null
@@ -1,9 +0,0 @@ -// Copyright 2018 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. - -// Defines system GUIDs used in this binary to prevent linking errors. - -#define INITGUID - -#include "chrome/credential_provider/gaiacp/stdafx.h"
diff --git a/chrome/credential_provider/gaiacp/logging.cc b/chrome/credential_provider/gaiacp/logging.cc deleted file mode 100644 index b366ace..0000000 --- a/chrome/credential_provider/gaiacp/logging.cc +++ /dev/null
@@ -1,16 +0,0 @@ -// Copyright 2018 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/credential_provider/gaiacp/logging.h" - -#include <iomanip> - -namespace credential_provider { - -std::ostream& operator<<(std::ostream& stream, const putHR& o) { - stream << std::setbase(16) << o.hr_; - return stream; -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/logging.h b/chrome/credential_provider/gaiacp/logging.h deleted file mode 100644 index cbb6654..0000000 --- a/chrome/credential_provider/gaiacp/logging.h +++ /dev/null
@@ -1,32 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_GAIACP_LOGGING_H_ -#define CHROME_CREDENTIAL_PROVIDER_GAIACP_LOGGING_H_ - -#include <ostream> - -#include "base/syslog_logging.h" -#include "base/win/windows_types.h" - -namespace credential_provider { - -// An ostream manipulator that writes an HRESULT in hex to the stream. -class putHR { - public: - explicit putHR(HRESULT hr) : hr_(hr) {} - friend std::ostream& operator<<(std::ostream& stream, const putHR& o); - - private: - HRESULT hr_; -}; - -// A macro that puts the function name into the logging stream. This is a -// drop-in replacement for the LOG macro. - -#define LOGFN(LEVEL) SYSLOG(LEVEL) << __FUNCTION__ << ": " - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_LOGGING_H_
diff --git a/chrome/credential_provider/gaiacp/os_process_manager.cc b/chrome/credential_provider/gaiacp/os_process_manager.cc deleted file mode 100644 index 825ff73..0000000 --- a/chrome/credential_provider/gaiacp/os_process_manager.cc +++ /dev/null
@@ -1,476 +0,0 @@ -// Copyright 2018 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/credential_provider/gaiacp/os_process_manager.h" - -#include <Windows.h> -#include <Winternl.h> - -#include <MDMRegistration.h> -#include <Shellapi.h> // For CommandLineToArgvW() -#include <Shlobj.h> -#include <aclapi.h> -#include <dpapi.h> -#include <sddl.h> -#include <security.h> -#include <userenv.h> -#include <wincred.h> - -#include <atlconv.h> - -#include <malloc.h> -#include <memory.h> -#include <stdlib.h> - -#include <iomanip> -#include <memory> - -#include "base/command_line.h" -#include "base/files/file_path.h" -#include "base/macros.h" -#include "base/scoped_native_library.h" -#include "base/stl_util.h" -#include "base/strings/stringprintf.h" -#include "base/strings/utf_string_conversions.h" -#include "base/win/registry.h" -#include "base/win/scoped_process_information.h" -#include "base/win/win_util.h" -#include "chrome/credential_provider/gaiacp/gcp_strings.h" -#include "chrome/credential_provider/gaiacp/gcp_utils.h" -#include "chrome/credential_provider/gaiacp/logging.h" - -typedef NTSTATUS(FAR WINAPI* NtOpenDirectoryObjectPfn)( - OUT PHANDLE DirectoryHandle, - IN ACCESS_MASK DesiredAccess, - IN POBJECT_ATTRIBUTES ObjectAttributes); - -namespace credential_provider { - -namespace { - -void InitUnicodeString(const wchar_t* string, UNICODE_STRING* uicode_string) { - uicode_string->Buffer = const_cast<wchar_t*>(string); - uicode_string->Length = - static_cast<USHORT>(wcslen(uicode_string->Buffer) * sizeof(wchar_t)); - uicode_string->MaximumLength = uicode_string->Length + sizeof(wchar_t); -} - -HRESULT GetTokenLogonSID(const base::win::ScopedHandle& token, PSID* sid) { - LOGFN(INFO); - DCHECK(sid); - - // TODO: make more robust by asking for needed length first. - char buffer[256]; - DWORD returned_length; - if (!::GetTokenInformation(token.Get(), TokenLogonSid, &buffer, - base::size(buffer), &returned_length)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "GetTokenInformation hr=" << putHR(hr); - return hr; - } - - // Make sure the data returned is correct. - TOKEN_GROUPS* groups = reinterpret_cast<TOKEN_GROUPS*>(buffer); - if (groups->GroupCount != 1) { - LOGFN(ERROR) << "GetTokenInformation count=" << groups->GroupCount; - return E_UNEXPECTED; - } - - if ((groups->Groups[0].Attributes & SE_GROUP_LOGON_ID) != SE_GROUP_LOGON_ID) { - LOGFN(ERROR) << "GetTokenInformation not a logon sid attr=" - << std::setbase(16) << groups->Groups[0].Attributes; - return E_UNEXPECTED; - } - - if (!::IsValidSid(groups->Groups[0].Sid)) { - LOGFN(ERROR) << "GetTokenInformation not valid sid attr=" - << std::setbase(16) << groups->Groups[0].Attributes; - return E_UNEXPECTED; - } - - DWORD length = ::GetLengthSid(groups->Groups[0].Sid); - *sid = reinterpret_cast<SID*>(LocalAlloc(LMEM_FIXED, length)); - if (*sid == nullptr) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "LocalAlloc sid hr=" << putHR(hr); - return hr; - } - - ::CopySid(length, *sid, groups->Groups[0].Sid); - return S_OK; -} - -HRESULT AddAllowedACE(ACL* dacl, - DWORD flags, - DWORD access_mask, - PSID sid, - ACL** new_dacl) { - LOGFN(INFO); - DCHECK(new_dacl); - - ACL_SIZE_INFORMATION si; - if (!::GetAclInformation(dacl, &si, sizeof(si), AclSizeInformation)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "GetAclInformation hr=" << putHR(hr); - return hr; - } - - // Allocate memory for the existing DACL plus the new entry. - DWORD new_dacl_size = si.AclBytesInUse + sizeof(ACCESS_ALLOWED_ACE) + - ::GetSidLengthRequired(SID_MAX_SUB_AUTHORITIES); - std::unique_ptr<ACL, decltype(&LocalFree)> local_dacl( - reinterpret_cast<ACL*>(::LocalAlloc(GPTR, new_dacl_size)), ::LocalFree); - if (local_dacl == nullptr) { - HRESULT hr = E_OUTOFMEMORY; - LOGFN(ERROR) << "LocalAlloc ACL hr=" << putHR(hr); - return hr; - } - - if (!::InitializeAcl(local_dacl.get(), new_dacl_size, ACL_REVISION)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "InitializeAcl hr=" << putHR(hr); - return hr; - } - - bool inserted = false; - for (DWORD i = 0; i < si.AceCount; ++i) { - ACE_HEADER* ace; - if (!GetAce(dacl, i, reinterpret_cast<void**>(&ace))) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "GetAe i=" << i << " hr=" << putHR(hr); - return hr; - } - - if (!inserted && ace->AceFlags & INHERITED_ACE) { - if (!::AddAccessAllowedAceEx(local_dacl.get(), ACL_REVISION, flags, - access_mask, sid)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "AddAccessAllowedAceEx i=" << i << " hr=" << putHR(hr); - return hr; - } - - inserted = true; - } - - if (!::AddAce(local_dacl.get(), ACL_REVISION, MAXWORD, ace, ace->AceSize)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "AddAce i=" << i << " hr=" << putHR(hr); - return hr; - } - } - - if (!inserted) { - if (!::AddAccessAllowedAceEx(local_dacl.get(), ACL_REVISION, flags, - access_mask, sid)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "AddAccessAllowedAceEx hr=" << putHR(hr); - return hr; - } - } - - *new_dacl = local_dacl.release(); - return S_OK; -} - -HRESULT AllowLogonSIDOnLocalBasedNamedObjects(PSID sid) { - HMODULE ntdll = ::GetModuleHandleW(L"ntdll.dll"); // Don't close handle. - if (ntdll == nullptr) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "GetModuleHandleW hr=" << putHR(hr); - return hr; - } - - NtOpenDirectoryObjectPfn NtOpenDirectoryObject = - reinterpret_cast<NtOpenDirectoryObjectPfn>( - ::GetProcAddress(ntdll, "NtOpenDirectoryObject")); - if (NtOpenDirectoryObject == nullptr) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "GetProcAddress hr=" << putHR(hr); - return hr; - } - - DWORD session_id; - if (!::ProcessIdToSessionId(GetCurrentProcessId(), &session_id)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "ProcessIdToSessionId hr=" << putHR(hr); - return hr; - } - - LOGFN(INFO) << "session=" << session_id; - - UNICODE_STRING name; - wchar_t name_buffer[64]; - if (session_id == 0) { - _snwprintf_s(name_buffer, base::size(name_buffer), L"\\BaseNamedObjects"); - } else { - _snwprintf_s(name_buffer, base::size(name_buffer), - L"\\Sessions\\%d\\BaseNamedObjects", session_id); - } - InitUnicodeString(name_buffer, &name); - - OBJECT_ATTRIBUTES oa; - oa.Length = sizeof(oa); - oa.RootDirectory = nullptr; - oa.ObjectName = &name; - oa.Attributes = 0; - oa.SecurityDescriptor = nullptr; - oa.SecurityQualityOfService = nullptr; - - const ACCESS_MASK kDesiredAccess = - DIRECTORY_TRAVERSE | READ_CONTROL | WRITE_DAC; - base::win::ScopedHandle::Handle handle; - NTSTATUS sts = (*NtOpenDirectoryObject)(&handle, kDesiredAccess, &oa); - if (sts != STATUS_SUCCESS) { - HRESULT hr = HRESULT_FROM_NT(sts); - LOGFN(ERROR) << "NtOpenDirectoryObject hr=" << putHR(hr); - return hr; - } - base::win::ScopedHandle dir_handle(handle); - - PSECURITY_DESCRIPTOR sd; - ACL* dacl; // Not owned. - DWORD err = ::GetSecurityInfo(dir_handle.Get(), SE_WINDOW_OBJECT, - DACL_SECURITY_INFORMATION, nullptr, nullptr, - &dacl, nullptr, &sd); - if (err != ERROR_SUCCESS) { - HRESULT hr = HRESULT_FROM_NT(err); - LOGFN(ERROR) << "GetSecurityInfo hr=" << putHR(hr); - return hr; - } - - const DWORD kDesiredSidAccess = DIRECTORY_QUERY | DIRECTORY_TRAVERSE | - DIRECTORY_CREATE_OBJECT | - DIRECTORY_CREATE_SUBDIRECTORY; - ACL* new_dacl = nullptr; - HRESULT hr = AddAllowedACE(dacl, NO_PROPAGATE_INHERIT_ACE, - kDesiredSidAccess, sid, &new_dacl); - ::LocalFree(sd); // This "frees" dacl too. - if (FAILED(hr)) { - LOGFN(ERROR) << "AddAllowedACE 0 hr=" << putHR(hr); - return hr; - } - - err = ::SetSecurityInfo(dir_handle.Get(), SE_WINDOW_OBJECT, - DACL_SECURITY_INFORMATION, nullptr, nullptr, new_dacl, - nullptr); - ::LocalFree(new_dacl); - if (err != ERROR_SUCCESS) { - HRESULT hr = HRESULT_FROM_NT(err); - LOGFN(ERROR) << "SetSecurityInfo hr=" << putHR(hr); - return hr; - } - - return S_OK; -} - -HRESULT AllowLogonSIDOnWinSta0(PSID sid) { - LOGFN(INFO); - - ScopedWindowStationHandle winsta0( - ::OpenWindowStationW(L"WinSta0", FALSE, READ_CONTROL | WRITE_DAC)); - if (!winsta0.IsValid()) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "OpenWindowStation hr=" << putHR(hr); - return hr; - } - - PSECURITY_DESCRIPTOR sd; - ACL* dacl; // Not owned. - DWORD err = ::GetSecurityInfo(winsta0.Get(), SE_WINDOW_OBJECT, - DACL_SECURITY_INFORMATION, nullptr, nullptr, - &dacl, nullptr, &sd); - if (err != ERROR_SUCCESS) { - HRESULT hr = HRESULT_FROM_NT(err); - LOGFN(ERROR) << "GetSecurityInfo hr=" << putHR(hr); - return hr; - } - - // Add DACL entries. This is the minimum set of access rights needed for - // a simple MFC app to run. Hopefully a program that displays a webui - // won't need more than this. - const DWORD kDesiredAccess = - WINSTA_ACCESSGLOBALATOMS | WINSTA_READSCREEN | WINSTA_EXITWINDOWS | - READ_CONTROL | - // The below needed to run chrome for webview. In particular, - // WINSTA_WRITEATTRIBUTES is needed so that keyboard shortcuts works. - WINSTA_READATTRIBUTES | WINSTA_WRITEATTRIBUTES; - ACL* new_dacl = nullptr; - HRESULT hr = AddAllowedACE(dacl, NO_PROPAGATE_INHERIT_ACE, kDesiredAccess, - sid, &new_dacl); - LocalFree(sd); // This "frees" dacl too. - if (FAILED(hr)) { - LOGFN(ERROR) << "AddAllowedACE 0 hr=" << putHR(hr); - return hr; - } - - err = ::SetSecurityInfo(winsta0.Get(), SE_WINDOW_OBJECT, - DACL_SECURITY_INFORMATION, nullptr, nullptr, new_dacl, - nullptr); - ::LocalFree(new_dacl); - if (err != ERROR_SUCCESS) { - HRESULT hr = HRESULT_FROM_NT(err); - LOGFN(ERROR) << "SetSecurityInfo hr=" << putHR(hr); - return hr; - } - - // Usually a window station also sets inherit-only permissions for apps that - // create new desktops. However, the gaia logon app is not expected to do - // that (nor is the logon session being given CREATEDESKTOP permission above - // anyway) so not setting any inherited permissions for the logon session. - - return S_OK; -} - -HDESK GetAndAllowLogonSIDOnDesktop(const wchar_t* desktop_name, - PSID sid, - DWORD desired_access) { - LOGFN(INFO); - - const DWORD kDesiredAccess = - desired_access | READ_CONTROL | WRITE_DAC | DESKTOP_CREATEWINDOW; - ScopedDesktopHandle desktop( - ::OpenDesktop(desktop_name, 0, FALSE, kDesiredAccess)); - if (!desktop.IsValid()) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) { - desktop.Set(::CreateDesktop(desktop_name, nullptr, nullptr, 0, - kDesiredAccess, nullptr)); - if (!desktop.IsValid()) { - hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "CreateDesktop hr=" << putHR(hr); - return nullptr; - } - } else { - LOGFN(ERROR) << "OpenDesktop hr=" << putHR(hr); - return nullptr; - } - } - - PSECURITY_DESCRIPTOR sd; - ACL* dacl; // Not owned. - DWORD err = ::GetSecurityInfo(desktop.Get(), SE_WINDOW_OBJECT, - DACL_SECURITY_INFORMATION, nullptr, nullptr, - &dacl, nullptr, &sd); - if (err != ERROR_SUCCESS) { - HRESULT hr = HRESULT_FROM_NT(err); - LOGFN(ERROR) << "GetSecurityInfo hr=" << putHR(hr); - return nullptr; - } - - // Add DACL entries. This is the minimum set of access rights needed for - // a simple MFC app to run. Hopefully a program that displays a webui - // won't need more than this. - const DWORD kAccessMask = DESKTOP_CREATEWINDOW | DESKTOP_CREATEMENU | - DESKTOP_HOOKCONTROL | DESKTOP_ENUMERATE | - DESKTOP_READOBJECTS | DESKTOP_WRITEOBJECTS | - READ_CONTROL; - ACL* new_dacl = nullptr; - HRESULT hr = AddAllowedACE(dacl, 0, kAccessMask, sid, &new_dacl); - ::LocalFree(sd); // This "frees" dacl too. - if (FAILED(hr)) { - LOGFN(ERROR) << "AddAllowedACE 0 hr=" << putHR(hr); - return nullptr; - } - - err = ::SetSecurityInfo(desktop.Get(), SE_WINDOW_OBJECT, - DACL_SECURITY_INFORMATION, nullptr, nullptr, new_dacl, - nullptr); - ::LocalFree(new_dacl); - if (err != ERROR_SUCCESS) { - HRESULT hr = HRESULT_FROM_NT(err); - LOGFN(ERROR) << "SetSecurityInfo hr=" << putHR(hr); - return nullptr; - } - - return desktop.Take(); -} - -// Sets up the minimum required privileges or ACLs needed for the logon SID -// to run the logon stub process in a restricted environment. -HRESULT SetupPermissionsForLogonSid(PSID sid) { - HRESULT hr = AllowLogonSIDOnLocalBasedNamedObjects(sid); - if (FAILED(hr)) { - LOGFN(ERROR) << "AllowLogonSIDOnLocalBasedNamedObjects hr=" << putHR(hr); - return hr; - } - - // Assume current window station is "WinSta0", which it should be for - // winlogon.exe. - if (kDesktopName[0] != 0) { - // Add logon SID to the ACL of WinSta0. - hr = AllowLogonSIDOnWinSta0(sid); - if (FAILED(hr)) { - LOGFN(ERROR) << "AllowLogonSIDOnWinSta0 hr=" << putHR(hr); - return hr; - } - - ScopedDesktopHandle desktop; - desktop.Set( - GetAndAllowLogonSIDOnDesktop(kDesktopName, sid, DESKTOP_SWITCHDESKTOP)); - if (!desktop.IsValid()) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "GetAndAllowLogonSIDOnDesktop hr=" << putHR(hr); - return hr; - } - } - - return S_OK; -} - -} // namespace - -// static -OSProcessManager** OSProcessManager::GetInstanceStorage() { - static OSProcessManager* instance = new OSProcessManager(); - return &instance; -} - -// static -OSProcessManager* OSProcessManager::Get() { - return *GetInstanceStorage(); -} - -OSProcessManager::~OSProcessManager() {} - -HRESULT OSProcessManager::CreateLogonToken(const wchar_t* username, - const wchar_t* password, - base::win::ScopedHandle* token) { - return ::credential_provider::CreateLogonToken(username, password, token); -} - -HRESULT OSProcessManager::GetTokenLogonSID(const base::win::ScopedHandle& token, - PSID* sid) { - return ::credential_provider::GetTokenLogonSID(token, sid); -} - -HRESULT OSProcessManager::SetupPermissionsForLogonSid(PSID sid) { - return ::credential_provider::SetupPermissionsForLogonSid(sid); -} - -HRESULT OSProcessManager::CreateProcessWithToken( - const base::win::ScopedHandle& logon_token, - const base::CommandLine& command_line, - _STARTUPINFOW* startupinfo, - base::win::ScopedProcessInformation* procinfo) { - // CreateProcessWithTokenW() expects the command line to be non-const, so make - // a copy here. - std::unique_ptr<wchar_t, void (*)(void*)> - cmdline(wcsdup(command_line.GetCommandLineString().c_str()), std::free); - PROCESS_INFORMATION temp_procinfo = {}; - if (!::CreateProcessWithTokenW(logon_token.Get(), - LOGON_WITH_PROFILE, - command_line.GetProgram().value().c_str(), - cmdline.get(), - CREATE_SUSPENDED, - nullptr, // environment - nullptr, // current directory - startupinfo, &temp_procinfo)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - return hr; - } - procinfo->Set(temp_procinfo); - return S_OK; -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/os_process_manager.h b/chrome/credential_provider/gaiacp/os_process_manager.h deleted file mode 100644 index f2a5f512..0000000 --- a/chrome/credential_provider/gaiacp/os_process_manager.h +++ /dev/null
@@ -1,63 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_GAIACP_OS_PROCESS_MANAGER_H_ -#define CHROME_CREDENTIAL_PROVIDER_GAIACP_OS_PROCESS_MANAGER_H_ - -#include "base/win/scoped_handle.h" -#include "base/win/windows_types.h" - -struct _STARTUPINFOW; - -namespace base { - -class CommandLine; - -namespace win { -class ScopedProcessInformation; -} // namespace win - -} // namespace base - -namespace credential_provider { - -// Manages OS processes and process attributes. -class OSProcessManager { - public: - static OSProcessManager* Get(); - - virtual ~OSProcessManager(); - - // Creates a batch type logon token for the given user. - virtual HRESULT CreateLogonToken(const wchar_t* username, - const wchar_t* password, - base::win::ScopedHandle* token); - - // Gets the logon SID from the specified logon token. The call must release - // the returned |sid| by calling LocalFree(). - virtual HRESULT GetTokenLogonSID(const base::win::ScopedHandle& token, - PSID* sid); - - // Sets up permissions for the given logon SID so that it can access the - // interactive desktop of the window station. - virtual HRESULT SetupPermissionsForLogonSid(PSID sid); - - // Creates a process with the specified logon token. The process is initially - // suspend and must be resumed by the caller. - virtual HRESULT CreateProcessWithToken( - const base::win::ScopedHandle& logon_token, - const base::CommandLine& command_line, - _STARTUPINFOW* startupinfo, - base::win::ScopedProcessInformation* procinfo); - - protected: - OSProcessManager() {} - - // Returns the storage used for the instance pointer. - static OSProcessManager** GetInstanceStorage(); -}; - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_OS_PROCESS_MANAGER_H_
diff --git a/chrome/credential_provider/gaiacp/os_user_manager.cc b/chrome/credential_provider/gaiacp/os_user_manager.cc deleted file mode 100644 index 24fb9db..0000000 --- a/chrome/credential_provider/gaiacp/os_user_manager.cc +++ /dev/null
@@ -1,358 +0,0 @@ -// Copyright 2018 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/credential_provider/gaiacp/os_user_manager.h" - -#include <windows.h> -#include <lm.h> -#include <Shellapi.h> // For <Shlobj.h> -#include <Shlobj.h> // For SHFileOperation() -#include <sddl.h> // For ConvertSidToStringSid() -#include <userenv.h> // For GetUserProfileDirectory() -#include <wincrypt.h> // For CryptXXX() - -#include <atlconv.h> - -#include <malloc.h> -#include <memory.h> -#include <stdlib.h> - -#include <iomanip> -#include <memory> - -#include "base/files/file_path.h" -#include "base/macros.h" -#include "base/scoped_native_library.h" -#include "base/stl_util.h" -#include "base/strings/stringprintf.h" -#include "base/strings/utf_string_conversions.h" -#include "base/win/registry.h" -#include "base/win/win_util.h" -#include "chrome/credential_provider/gaiacp/gcp_utils.h" -#include "chrome/credential_provider/gaiacp/logging.h" - -namespace credential_provider { - -// static -OSUserManager** OSUserManager::GetInstanceStorage() { - static OSUserManager* instance = new OSUserManager(); - return &instance; -} - -// static -OSUserManager* OSUserManager::Get() { - return *GetInstanceStorage(); -} - -// static -void OSUserManager::SetInstanceForTesting(OSUserManager* instance) { - *GetInstanceStorage() = instance; -} - -OSUserManager::~OSUserManager() {} - -#define IS_PASSWORD_STRONG_ENOUGH() \ - (cur_length > kMinPasswordLength) && \ - (has_upper + has_lower + has_digit + has_punct > 3) - -HRESULT OSUserManager::GenerateRandomPassword(wchar_t* password, int length) { - HRESULT hr; - HCRYPTPROV prov; - - // TODO(rogerta): read password policy GPOs to see what the password policy - // is for this machine in order to create one that adheres correctly. For - // now will generate a random password that fits typical strong password - // policies on windows. - const wchar_t kValidPasswordChars[] = - L"ABCDEFGHIJKLMNOPQRSTUVWXYZ" - L"abcdefghijklmnopqrstuvwxyz" - L"`1234567890-=" - L"~!@#$%^&*()_+" - L"[]\\;',./" - L"{}|:\"<>?"; - - if (length < kMinPasswordLength) - return E_INVALIDARG; - - if (!::CryptAcquireContext(&prov, nullptr, nullptr, PROV_RSA_FULL, - CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) { - hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "CryptAcquireContext hr=" << putHR(hr); - return hr; - } - - int cur_length; - int has_upper; - int has_lower; - int has_digit; - int has_punct; - { - cur_length = 0; - has_upper = 0; - has_lower = 0; - has_digit = 0; - has_punct = 0; - - wchar_t* p = password; - int remaining_length = length; - - while (remaining_length > 1) { - BYTE r; - if (!::CryptGenRandom(prov, sizeof(r), &r)) { - hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "CryptGenRandom hr=" << putHR(hr); - ::CryptReleaseContext(prov, 0); - return hr; - } - - wchar_t c = - kValidPasswordChars[r % (base::size(kValidPasswordChars) - 1)]; - *p++ = c; - ++cur_length; - --remaining_length; - - // Check if we have all the requirements for a strong password. - if (isupper(c)) - has_upper = 1; - if (islower(c)) - has_lower = 1; - if (isdigit(c)) - has_digit = 1; - if (ispunct(c)) - has_punct = 1; - - if (IS_PASSWORD_STRONG_ENOUGH()) - break; - } - - // Make sure password is terminated. - *p = 0; - - // Because this is a random function, there is a chance that the password - // might not be strong enough by the time the code reaches this point. This - // could happen if two categories of characters were never included. - // - // This highest probability of this happening would be if the caller - // specified the shortest password allowed and the missing characters came - // from the smallest two sets (say digits and lower case letters). - // - // This probability is equal to 1 minus the probability that all characters - // are upper case or punctuation: - // - // P(!strong) = 1 - P(all chars either upper or punctuation) - // - // There are valid 96 characters in all, of which 56 are not digits or - // lower case. The probability that any single character is upper case or - // punctuation is 56/96. If the minimum length is used, then: - // - // P(all chars either upper or punctuation) = (56/96)^23 = 4.1e-6 - // - // P(!strong) = 1 - 1.8e-4 = 0.999996 - // - // or about 4 in every million. The exponent is 23 and not 24 because the - // minimum password length includes the null terminiator. - // - // This means: - // - ~4 in every million will run this loop at least twice - // - ~4 in every 250 billion will run this loop at least thrice - // - ~4 in every 6.25e13 will run this loop at least four times - } - while (!IS_PASSWORD_STRONG_ENOUGH()); - - ::CryptReleaseContext(prov, 0); - - return S_OK; -} - -HRESULT OSUserManager::AddUser(const wchar_t* username, - const wchar_t* password, - const wchar_t* fullname, - const wchar_t* comment, - bool add_to_users_group, - BSTR* sid, - DWORD* error) { - DCHECK(sid); - - bool user_found = false; - USER_INFO_1 info; - memset(&info, 0, sizeof(info)); - info.usri1_comment = _wcsdup(comment); - info.usri1_flags = - UF_PASSWD_CANT_CHANGE | UF_DONT_EXPIRE_PASSWD | UF_NORMAL_ACCOUNT; - info.usri1_name = const_cast<wchar_t*>(username); - info.usri1_password = const_cast<wchar_t*>(password); - info.usri1_priv = USER_PRIV_USER; - - NET_API_STATUS nsts = - ::NetUserAdd(nullptr, 1, reinterpret_cast<LPBYTE>(&info), error); - free(info.usri1_comment); - - // Set the user's full name. - if (nsts == NERR_Success) { - USER_INFO_1011 info1011; - memset(&info1011, 0, sizeof(info1011)); - info1011.usri1011_full_name = const_cast<wchar_t*>(fullname); - nsts = ::NetUserSetInfo(nullptr, info.usri1_name, 1011, - reinterpret_cast<LPBYTE>(&info1011), error); - if (nsts != NERR_Success) { - LOGFN(ERROR) << "NetUserSetInfo nsts=" << nsts; - } - } else if (!add_to_users_group && nsts == NERR_UserExists) { - // If adding the special "gaia" account, and if the error is "user already - // exists", consider this is a success. - // TODO: might want to check that account permissions are not permissive. - LOGFN(INFO) << "Using existing gaia user"; - user_found = true; - } else { - LOGFN(ERROR) << "NetUserAdd nsts=" << nsts; - return HRESULT_FROM_WIN32(nsts); - } - - // Get the new user's SID and return it to caller. - LPBYTE buffer = nullptr; - nsts = ::NetUserGetInfo(nullptr, info.usri1_name, 4, &buffer); - if (nsts == NERR_Success) { - const USER_INFO_4* user_info = reinterpret_cast<const USER_INFO_4*>(buffer); - wchar_t* sidstr = nullptr; - if (::ConvertSidToStringSid(user_info->usri4_user_sid, &sidstr)) { - *sid = SysAllocString(T2COLE(sidstr)); - LOGFN(INFO) << "sid=" << sidstr; - ::LocalFree(sidstr); - } else { - LOGFN(ERROR) << "Could not convert SID to string"; - *sid = nullptr; - nsts = NERR_ProgNeedsExtraMem; - } - - if (nsts == NERR_Success && add_to_users_group) { - // Add to the "Users" group so that it appears on login screen. - LOCALGROUP_MEMBERS_INFO_0 member_info; - memset(&member_info, 0, sizeof(member_info)); - member_info.lgrmi0_sid = user_info->usri4_user_sid; - nsts = ::NetLocalGroupAddMembers( - nullptr, L"Users", 0, reinterpret_cast<LPBYTE>(&member_info), 1); - if (nsts != NERR_Success) { - LOGFN(ERROR) << "NetLocalGroupAddMembers nsts=" << nsts; - } - } - - ::NetApiBufferFree(buffer); - } - - return HRESULT_FROM_WIN32( - (nsts == NERR_Success && user_found) ? NERR_UserExists : nsts); -} - -HRESULT OSUserManager::SetUserPassword(const wchar_t* username, - const wchar_t* password, - DWORD* error) { - USER_INFO_1003 info1003; - NET_API_STATUS nsts; - memset(&info1003, 0, sizeof(info1003)); - info1003.usri1003_password = const_cast<wchar_t*>(password); - nsts = ::NetUserSetInfo(nullptr, username, 1003, - reinterpret_cast<LPBYTE>(&info1003), error); - if (nsts != NERR_Success) { - LOGFN(ERROR) << "Unable to change password for '" << username - << "' nsts=" << nsts; - } - - return HRESULT_FROM_WIN32(nsts); -} - -HRESULT OSUserManager::GetUserSID(const wchar_t* username, PSID* sid) { - DCHECK(username); - DCHECK(sid); - - LPBYTE buffer = nullptr; - NET_API_STATUS nsts = ::NetUserGetInfo(nullptr, username, 4, &buffer); - if (nsts == NERR_Success) { - const USER_INFO_4* user_info = reinterpret_cast<const USER_INFO_4*>(buffer); - if (::IsValidSid(user_info->usri4_user_sid)) { - DWORD sid_length = GetLengthSid(user_info->usri4_user_sid); - *sid = ::LocalAlloc(LMEM_FIXED, sid_length); - ::CopySid(sid_length, *sid, user_info->usri4_user_sid); - } else { - LOGFN(ERROR) << "Invalid SID for username=" << username; - } - ::NetApiBufferFree(buffer); - } else { - LOGFN(ERROR) << "NetUserGetInfo nsts=" << nsts; - } - return HRESULT_FROM_WIN32(nsts); -} - -HRESULT OSUserManager::FindUserBySID(const wchar_t* sid) { - PSID psid; - if (!::ConvertStringSidToSidW(sid, &psid)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "ConvertStringSidToSidW sid=" << sid << " hr=" << putHR(hr); - return hr; - } - - HRESULT hr = S_OK; - DWORD name_length = 0; - DWORD domain_length = 0; - SID_NAME_USE use; - if (!::LookupAccountSid(nullptr, psid, nullptr, &name_length, nullptr, - &domain_length, &use)) { - hr = HRESULT_FROM_WIN32(::GetLastError()); - if (hr != HRESULT_FROM_WIN32(ERROR_NONE_MAPPED)) - LOGFN(ERROR) << "LookupAccountSid hr=" << putHR(hr); - } - - ::LocalFree(psid); - return hr; -} - -HRESULT OSUserManager::RemoveUser(const wchar_t* username, - const wchar_t* password) { - DCHECK(username); - DCHECK(password); - - // Get the user's profile directory. - base::win::ScopedHandle token; - wchar_t profiledir[MAX_PATH + 1]; - - // Get the user's profile directory. - HRESULT hr = CreateLogonToken(username, password, &token); - if (SUCCEEDED(hr)) { - // Get the gaia user's profile directory so that it can be deleted. - DWORD length = base::size(profiledir) - 1; - if (!::GetUserProfileDirectory(token.Get(), profiledir, &length)) { - hr = HRESULT_FROM_WIN32(::GetLastError()); - if (hr != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) - LOGFN(ERROR) << "GetUserProfileDirectory hr=" << putHR(hr); - profiledir[0] = 0; - } else { - // Double null terminate the profile directory for SHFileOperation(). - profiledir[length] = 0; - } - } else { - LOGFN(ERROR) << "CreateLogonToken hr=" << putHR(hr); - } - - // Remove the OS user. - NET_API_STATUS nsts = ::NetUserDel(nullptr, username); - if (nsts != NERR_Success) - LOGFN(ERROR) << "NetUserDel nsts=" << nsts; - - // Force delete the user's profile directory. - if (profiledir[0] != 0) { - SHFILEOPSTRUCT op; - memset(&op, 0, sizeof(op)); - op.wFunc = FO_DELETE; - op.pFrom = profiledir; // Double null terminated above. - op.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NO_UI | FOF_SILENT; - - int ret = ::SHFileOperation(&op); - if (ret != 0) { - LOGFN(ERROR) << "SHFileOperation ret=" << ret; - } - } - - return S_OK; -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/os_user_manager.h b/chrome/credential_provider/gaiacp/os_user_manager.h deleted file mode 100644 index 40c55c9..0000000 --- a/chrome/credential_provider/gaiacp/os_user_manager.h +++ /dev/null
@@ -1,68 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_GAIACP_OS_USER_MANAGER_H_ -#define CHROME_CREDENTIAL_PROVIDER_GAIACP_OS_USER_MANAGER_H_ - -#include "base/win/windows_types.h" - -typedef wchar_t* BSTR; - -namespace credential_provider { - -// Manages OS users on the system. -class OSUserManager { - public: - // Minimum length for password buffer when calling GenerateRandomPassword(). - static const int kMinPasswordLength = 24; - - static OSUserManager* Get(); - - virtual ~OSUserManager(); - - // Generates a cryptographically secure random password. - virtual HRESULT GenerateRandomPassword(wchar_t* password, int length); - - // Creates a new OS user on the system with the given credentials. If - // |add_to_users_group| is true, the Os user is added to the machine's - // "Users" group which allows interactive logon. The OS user's SID is - // returned in |sid|. - virtual HRESULT AddUser(const wchar_t* username, - const wchar_t* password, - const wchar_t* fullname, - const wchar_t* comment, - bool add_to_users_group, - BSTR* sid, - DWORD* error); - - // Changes the password of the given OS user. - virtual HRESULT SetUserPassword(const wchar_t* username, - const wchar_t* password, - DWORD* error); - - // Gets the SID of the given OS user. The caller owns the pointer |sid| and - // should free it with a call to LocalFree(). - virtual HRESULT GetUserSID(const wchar_t* username, PSID* sid); - - // Returns NERR_Success if a user with the given SID exists, and - // NERR_BadUsername otherwise. - virtual HRESULT FindUserBySID(const wchar_t* sid); - - // Removes the user from the machine. - virtual HRESULT RemoveUser(const wchar_t* username, const wchar_t* password); - - // This method is called either from FakeOSUserManager or from dllmain.cc when - // setting fakes from one module to another. - static void SetInstanceForTesting(OSUserManager* factory); - - protected: - OSUserManager() {} - - // Returns the storage used for the instance pointer. - static OSUserManager** GetInstanceStorage(); -}; - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_OS_USER_MANAGER_H_
diff --git a/chrome/credential_provider/gaiacp/reauth_credential.cc b/chrome/credential_provider/gaiacp/reauth_credential.cc deleted file mode 100644 index 9d09f89..0000000 --- a/chrome/credential_provider/gaiacp/reauth_credential.cc +++ /dev/null
@@ -1,134 +0,0 @@ -// Copyright 2018 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/credential_provider/gaiacp/reauth_credential.h" - -#include "base/stl_util.h" -#include "chrome/credential_provider/gaiacp/gcp_strings.h" -#include "chrome/credential_provider/gaiacp/logging.h" -#include "chrome/credential_provider/gaiacp/os_user_manager.h" -#include "chrome/credential_provider/gaiacp/reg_utils.h" - -namespace credential_provider { - -CReauthCredential::CReauthCredential() {} - -CReauthCredential::~CReauthCredential() {} - -HRESULT CReauthCredential::FinalConstruct() { - LOGFN(INFO); - return S_OK; -} - -void CReauthCredential::FinalRelease() { - LOGFN(INFO); -} - -HRESULT CReauthCredential::GetEmailForReauth(wchar_t* email, size_t length) { - if (email == nullptr) - return E_POINTER; - - if (length < 1) - return E_INVALIDARG; - - errno_t err = wcsncpy_s(email, length, OLE2CW(user_email_), _TRUNCATE); - return err == 0 ? S_OK : E_FAIL; -} - -HRESULT CReauthCredential::GetStringValue(DWORD field_id, wchar_t** value) { - DCHECK(value); - - HRESULT hr = E_INVALIDARG; - switch (field_id) { - case FID_DESCRIPTION: { - base::string16 description(GetStringResource(IDS_REAUTH_FID_DESCRIPTION)); - hr = ::SHStrDupW(description.c_str(), value); - break; - } - case FID_PROVIDER_LABEL: { - base::string16 label(GetStringResource(IDS_REAUTH_FID_PROVIDER_LABEL)); - hr = ::SHStrDupW(label.c_str(), value); - break; - } - default: - hr = GetStringValueImpl(field_id, value); - break; - } - - return hr; -} - -HRESULT CReauthCredential::GetUserSid(wchar_t** sid) { - USES_CONVERSION; - DCHECK(sid); - LOGFN(INFO) << "sid=" << OLE2CW(user_sid_) - << " email=" << OLE2CW(user_email_); - - HRESULT hr = ::SHStrDupW(OLE2CW(user_sid_), sid); - if (FAILED(hr)) - LOGFN(ERROR) << "SHStrDupW hr=" << putHR(hr); - - return hr; -} - -HRESULT CReauthCredential::FinishAuthentication(BSTR username, - BSTR password, - BSTR /*fullname*/, - BSTR* sid, - BSTR* error_text) { - USES_CONVERSION; - LOGFN(INFO); - DCHECK(sid); - DCHECK(error_text); - - // Change the user's password. - OSUserManager* manager = OSUserManager::Get(); - DWORD error; - HRESULT hr = manager->SetUserPassword(username, password, &error); - if (FAILED(hr)) { - LOGFN(ERROR) << "Unable to change password for '" << username - << "' hr=" << putHR(hr); - *error_text = AllocErrorString(IDS_INTERNAL_ERROR); - return hr; - } - - hr = SetUserProperty(OLE2CW(user_sid_), kUserNeedsReauth, 0); - if (FAILED(hr)) { - LOGFN(ERROR) << "SetUserProperty hr=" << putHR(hr); - return hr; - } - - // Return the user's SID. - *sid = ::SysAllocString(user_sid_); - if (*sid == nullptr) { - LOGFN(ERROR) << "Out of memory username=" << username; - *error_text = AllocErrorString(IDS_INTERNAL_ERROR); - return E_OUTOFMEMORY; - } - - return S_OK; -} - -HRESULT CReauthCredential::OnUserAuthenticated(BSTR username, - BSTR password, - BSTR sid) { - // Make sure arguments contain expected values. - if (user_sid_ != sid) { - LOGFN(ERROR) << "Unexpected SID(" << sid << "," << user_sid_ << ")"; - return E_INVALIDARG; - } - - return FinishOnUserAuthenticated(username, password, sid); -} - -IFACEMETHODIMP CReauthCredential::SetUserInfo(BSTR sid, BSTR email) { - DCHECK(sid); - DCHECK(email); - - user_sid_ = sid; - user_email_ = email; - return S_OK; -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/reauth_credential.h b/chrome/credential_provider/gaiacp/reauth_credential.h deleted file mode 100644 index 443d6b97..0000000 --- a/chrome/credential_provider/gaiacp/reauth_credential.h +++ /dev/null
@@ -1,69 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_GAIACP_REAUTH_CREDENTIAL_H_ -#define CHROME_CREDENTIAL_PROVIDER_GAIACP_REAUTH_CREDENTIAL_H_ - -#include "chrome/credential_provider/gaiacp/gaia_credential_base.h" -#include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h" - -namespace credential_provider { - -// Implementation of a ICredentialProviderCredential backed by a Gaia account. -class ATL_NO_VTABLE CReauthCredential - : public CComObjectRootEx<CComMultiThreadModel>, - public CComCoClass<CReauthCredential, &CLSID_ReauthCredential>, - public CGaiaCredentialBase, - public IReauthCredential { - public: - DECLARE_NO_REGISTRY() - - CReauthCredential(); - ~CReauthCredential(); - - HRESULT FinalConstruct(); - void FinalRelease(); - - private: - // This class does not say it implements ICredentialProviderCredential2. - // It only implements ICredentialProviderCredential. Otherwise the - // credential will show up on the welcome screen only for domain joined - // machines. - BEGIN_COM_MAP(CReauthCredential) - COM_INTERFACE_ENTRY(IGaiaCredential) - COM_INTERFACE_ENTRY(ICredentialProviderCredential) - COM_INTERFACE_ENTRY(ICredentialProviderCredential2) - COM_INTERFACE_ENTRY(IReauthCredential) - END_COM_MAP() - - DECLARE_PROTECT_FINAL_CONSTRUCT() - - HRESULT GetEmailForReauth(wchar_t* email, size_t length) override; - - // ICredentialProviderCredential2 - IFACEMETHODIMP GetStringValue(DWORD dwFieldID, wchar_t** ppsz) override; - IFACEMETHODIMP GetUserSid(wchar_t** sid) override; - - // IGaiaCredential - IFACEMETHODIMP FinishAuthentication(BSTR username, - BSTR password, - BSTR fullname, - BSTR* sid, - BSTR* error_text) override; - IFACEMETHODIMP OnUserAuthenticated(BSTR username, - BSTR password, - BSTR sid) override; - - // IReauthCredential - IFACEMETHODIMP SetUserInfo(BSTR sid, BSTR username) override; - - CComBSTR user_sid_; - CComBSTR user_email_; -}; - -OBJECT_ENTRY_AUTO(__uuidof(ReauthCredential), CReauthCredential) - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_REAUTH_CREDENTIAL_H_
diff --git a/chrome/credential_provider/gaiacp/reauth_credential_unittests.cc b/chrome/credential_provider/gaiacp/reauth_credential_unittests.cc deleted file mode 100644 index 7a4fd08b..0000000 --- a/chrome/credential_provider/gaiacp/reauth_credential_unittests.cc +++ /dev/null
@@ -1,111 +0,0 @@ -// Copyright 2018 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 <atlbase.h> -#include <atlcom.h> -#include <atlcomcli.h> - -#include "base/test/test_reg_util_win.h" -#include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h" -#include "chrome/credential_provider/gaiacp/reauth_credential.h" -#include "chrome/credential_provider/test/com_fakes.h" -#include "chrome/credential_provider/test/gcp_fakes.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace credential_provider { - -class GcpReauthCredentialTest : public ::testing::Test { - private: - void SetUp() override; - - registry_util::RegistryOverrideManager registry_override_; - FakeOSUserManager fake_os_user_manager_; - FakeScopedLsaPolicyFactory fake_scoped_lsa_policy_factory_; -}; - -void GcpReauthCredentialTest::SetUp() { - ASSERT_NO_FATAL_FAILURE( - registry_override_.OverrideRegistry(HKEY_LOCAL_MACHINE)); -} - -TEST_F(GcpReauthCredentialTest, SetUserInfo) { - CComPtr<IReauthCredential> reauth; - ASSERT_EQ(S_OK, CComCreator<CComObject<CReauthCredential>>::CreateInstance( - nullptr, IID_IReauthCredential, (void**)&reauth)); - ASSERT_TRUE(!!reauth); - - const CComBSTR kSid(W2COLE(L"sid")); - ASSERT_EQ(S_OK, reauth->SetUserInfo(kSid, CComBSTR(W2COLE(L"email")))); - - CComPtr<ICredentialProviderCredential2> cpc2; - ASSERT_EQ(S_OK, reauth->QueryInterface(IID_ICredentialProviderCredential2, - reinterpret_cast<void**>(&cpc2))); - - wchar_t* sid; - ASSERT_EQ(S_OK, cpc2->GetUserSid(&sid)); - ASSERT_EQ(kSid, CComBSTR(W2COLE(sid))); - ::CoTaskMemFree(sid); -} - -TEST_F(GcpReauthCredentialTest, FinishAuthentication) { - // Create a fake user to reauth. - const wchar_t* kUsername = L"username"; - OSUserManager* manager = OSUserManager::Get(); - CComBSTR sid; - DWORD error; - ASSERT_EQ(S_OK, manager->AddUser(kUsername, L"password", L"fullname", - L"comment", true, &sid, &error)); - - // Initialize a reauth credential. - CComPtr<IReauthCredential> reauth; - ASSERT_EQ(S_OK, CComCreator<CComObject<CReauthCredential>>::CreateInstance( - nullptr, IID_IReauthCredential, (void**)&reauth)); - const CComBSTR kSid(W2COLE(L"sid")); - ASSERT_EQ(S_OK, reauth->SetUserInfo(kSid, CComBSTR(W2COLE(L"email")))); - - CComPtr<IGaiaCredential> cred; - ASSERT_EQ(S_OK, reauth->QueryInterface(IID_IGaiaCredential, - reinterpret_cast<void**>(&cred))); - - // Finishing reauth with an invalid username should fail. - CComBSTR error2; - ASSERT_NE(S_OK, cred->FinishAuthentication( - CComBSTR(W2COLE(L"user2")), CComBSTR(W2COLE(L"password")), - CComBSTR(W2COLE(L"Full Name")), &sid, &error2)); - sid.Empty(); - error2.Empty(); - - // Finishing reauth with an correct username should succeed. - ASSERT_EQ(S_OK, cred->FinishAuthentication(CComBSTR(W2COLE(kUsername)), - CComBSTR(W2COLE(L"password")), - CComBSTR(W2COLE(L"Full Name")), - &sid, &error2)); -} - -TEST_F(GcpReauthCredentialTest, OnUserAuthenticated) { - // Initialize a reauth credential. - CComPtr<IReauthCredential> reauth; - ASSERT_EQ(S_OK, CComCreator<CComObject<CReauthCredential>>::CreateInstance( - nullptr, IID_IReauthCredential, (void**)&reauth)); - const CComBSTR kSid(W2COLE(L"sid")); - ASSERT_EQ(S_OK, reauth->SetUserInfo(kSid, CComBSTR(W2COLE(L"email")))); - - FakeGaiaCredentialProvider provider; - CComPtr<IGaiaCredential> cred; - ASSERT_EQ(S_OK, reauth->QueryInterface(IID_IGaiaCredential, - reinterpret_cast<void**>(&cred))); - ASSERT_EQ(S_OK, cred->Initialize(&provider)); - - // Finishing reauth with an correct username should succeed. - CComBSTR kUsername(W2COLE(L"username")); - CComBSTR kPassword(W2COLE(L"password")); - ASSERT_EQ(S_OK, cred->OnUserAuthenticated(kUsername, kPassword, kSid)); - - // Check that values were propagated to the provider. - EXPECT_EQ(kUsername, provider.username()); - EXPECT_EQ(kPassword, provider.password()); - EXPECT_EQ(kSid, provider.sid()); -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/reg_utils.cc b/chrome/credential_provider/gaiacp/reg_utils.cc deleted file mode 100644 index 471209b..0000000 --- a/chrome/credential_provider/gaiacp/reg_utils.cc +++ /dev/null
@@ -1,180 +0,0 @@ -// Copyright 2018 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/credential_provider/gaiacp/reg_utils.h" - -#include <Windows.h> - -#include "base/stl_util.h" -#include "base/win/registry.h" -#include "chrome/credential_provider/gaiacp/gcp_strings.h" - -namespace credential_provider { - -namespace { - -// Root registry key for GCP configuration and state. -// TODO(crbug.com/883943): This should be different between Chromium and -// Google Chrome builds. -const wchar_t kGcpRootKeyName[] = L"Software\\Google\\GCP"; - -HRESULT GetRegDWORD(const base::string16& key_name, - const base::string16& name, - DWORD* value) { - base::win::RegKey key; - LONG sts = key.Open(HKEY_LOCAL_MACHINE, key_name.c_str(), KEY_READ); - if (sts != ERROR_SUCCESS) - return HRESULT_FROM_WIN32(sts); - - sts = key.ReadValueDW(name.c_str(), value); - if (sts != ERROR_SUCCESS) - return HRESULT_FROM_WIN32(sts); - - return S_OK; -} - -HRESULT GetRegString(const base::string16& key_name, - const base::string16& name, - wchar_t* value, - ULONG* length) { - DCHECK(value); - DCHECK(length); - DCHECK_GT(*length, 0u); - - base::win::RegKey key; - LONG sts = key.Open(HKEY_LOCAL_MACHINE, key_name.c_str(), KEY_READ); - if (sts != ERROR_SUCCESS) - return HRESULT_FROM_WIN32(sts); - - // read one less character that specified in |length| so that the returned - // string can always be null terminated. Note that string registry values - // are not guaranteed to be null terminated. - DWORD type; - ULONG local_length = *length - 1; - sts = key.ReadValue(name.c_str(), value, &local_length, &type); - if (sts != ERROR_SUCCESS) - return HRESULT_FROM_WIN32(sts); - if (type != REG_SZ) - return HRESULT_FROM_WIN32(ERROR_CANTREAD); - - value[local_length] = 0; - *length = local_length; - return S_OK; -} - -HRESULT SetRegDWORD(const base::string16& key_name, - const base::string16& name, - DWORD value) { - base::win::RegKey key; - LONG sts = key.Create(HKEY_LOCAL_MACHINE, key_name.c_str(), KEY_WRITE); - if (sts != ERROR_SUCCESS) - return HRESULT_FROM_WIN32(sts); - - sts = key.WriteValue(name.c_str(), value); - if (sts != ERROR_SUCCESS) - return HRESULT_FROM_WIN32(sts); - - return S_OK; -} - -HRESULT SetRegString(const base::string16& key_name, - const base::string16& name, - const base::string16& value) { - base::win::RegKey key; - LONG sts = key.Create(HKEY_LOCAL_MACHINE, key_name.c_str(), KEY_WRITE); - if (sts != ERROR_SUCCESS) - return HRESULT_FROM_WIN32(sts); - - if (value.empty()) { - sts = key.DeleteValue(name.c_str()); - } else { - sts = key.WriteValue(name.c_str(), value.c_str()); - } - if (sts != ERROR_SUCCESS) - return HRESULT_FROM_WIN32(sts); - - return S_OK; -} - -} // namespace - -HRESULT GetGlobalFlag(const base::string16& name, DWORD* value) { - return GetRegDWORD(kGcpRootKeyName, name, value); -} - -HRESULT GetGlobalFlag(const base::string16& name, - wchar_t* value, - ULONG* length) { - return GetRegString(kGcpRootKeyName, name, value, length); -} - -HRESULT GetUserProperty(const base::string16& sid, - const base::string16& name, - DWORD* value) { - wchar_t key_name[128]; - swprintf_s(key_name, base::size(key_name), L"%s\\Users\\%s", kGcpRootKeyName, - sid.c_str()); - return GetRegDWORD(key_name, name, value); -} - -HRESULT GetUserProperty(const base::string16& sid, - const base::string16& name, - wchar_t* value, - ULONG* length) { - wchar_t key_name[128]; - swprintf_s(key_name, base::size(key_name), L"%s\\Users\\%s", kGcpRootKeyName, - sid.c_str()); - return GetRegString(key_name, name, value, length); -} - -HRESULT SetUserProperty(const base::string16& sid, - const base::string16& name, - DWORD value) { - wchar_t key_name[128]; - swprintf_s(key_name, base::size(key_name), L"%s\\Users\\%s", kGcpRootKeyName, - sid.c_str()); - return SetRegDWORD(key_name, name, value); -} - -HRESULT SetUserProperty(const base::string16& sid, - const base::string16& name, - const base::string16& value) { - wchar_t key_name[128]; - swprintf_s(key_name, base::size(key_name), L"%s\\Users\\%s", kGcpRootKeyName, - sid.c_str()); - return SetRegString(key_name, name, value); -} - -HRESULT RemoveAllUserProperties(const base::string16& sid) { - wchar_t key_name[128]; - swprintf_s(key_name, base::size(key_name), L"%s\\Users", kGcpRootKeyName); - - base::win::RegKey key; - LONG sts = key.Open(HKEY_LOCAL_MACHINE, key_name, KEY_WRITE); - if (sts != ERROR_SUCCESS) - return HRESULT_FROM_WIN32(sts); - - sts = key.DeleteKey(sid.c_str()); - return sts != ERROR_SUCCESS ? HRESULT_FROM_WIN32(sts) : S_OK; -} - -HRESULT GetUserTokenHandles(std::map<base::string16, base::string16>* handles) { - DCHECK(handles); - - wchar_t key_name[128]; - swprintf_s(key_name, base::size(key_name), L"%s\\Users", kGcpRootKeyName); - - base::win::RegistryKeyIterator iter(HKEY_LOCAL_MACHINE, key_name); - for (; iter.Valid(); ++iter) { - const wchar_t* sid = iter.Name(); - wchar_t token_handle[256]; - ULONG length = base::size(token_handle); - HRESULT hr = GetUserProperty(sid, kUserTokenHandle, token_handle, &length); - if (SUCCEEDED(hr)) - handles->emplace(sid, token_handle); - } - return S_OK; -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/reg_utils.h b/chrome/credential_provider/gaiacp/reg_utils.h deleted file mode 100644 index 5a066b9d..0000000 --- a/chrome/credential_provider/gaiacp/reg_utils.h +++ /dev/null
@@ -1,58 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_GAIACP_REG_UTILS_H_ -#define CHROME_CREDENTIAL_PROVIDER_GAIACP_REG_UTILS_H_ - -#include <map> - -#include "base/strings/string16.h" -#include "base/win/windows_types.h" - -namespace credential_provider { - -// Gets global DWORD flag. -HRESULT GetGlobalFlag(const base::string16& name, DWORD* value); - -// Gets global string flag. Upon calling |length| contains maximum size of -// the |value| buffer in characters. Upon return |length| contains the length -// of string. This function guarantees that the string is null terminated, so -// the maximum number of non-null characters returned is |length-1|. -HRESULT GetGlobalFlag(const base::string16& name, - wchar_t* value, - ULONG* length); - -// Gets DWORD property set for the given user. -HRESULT GetUserProperty(const base::string16& sid, - const base::string16& name, - DWORD* value); - -// Gets a string user property. Upon calling |length| contains maximum size of -// the |value| buffer in characters. Upon return |length| contains the length -// of string. This function guarantees that the string is null terminated, so -// the maximum number of non-null characters returned is |length-1|. -HRESULT GetUserProperty(const base::string16& sid, - const base::string16& name, - wchar_t* value, - ULONG* length); - -// Sets a DWORD user property. -HRESULT SetUserProperty(const base::string16& sid, - const base::string16& name, - DWORD value); - -// Sets a string user property. -HRESULT SetUserProperty(const base::string16& sid, - const base::string16& name, - const base::string16& value); - -// Removes all properties for the user. -HRESULT RemoveAllUserProperties(const base::string16& sid); - -// Gets token handles for all users created by this credential provider. -HRESULT GetUserTokenHandles(std::map<base::string16, base::string16>* handles); - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_REG_UTILS_H_
diff --git a/chrome/credential_provider/gaiacp/scoped_handle.h b/chrome/credential_provider/gaiacp/scoped_handle.h deleted file mode 100644 index 32d3925..0000000 --- a/chrome/credential_provider/gaiacp/scoped_handle.h +++ /dev/null
@@ -1,97 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_GAIACP_SCOPED_HANDLE_H_ -#define CHROME_CREDENTIAL_PROVIDER_GAIACP_SCOPED_HANDLE_H_ - -#include <windows.h> -#include <winhttp.h> - -#include "base/macros.h" -#include "base/win/scoped_handle.h" -#include "base/win/windows_types.h" - -namespace credential_provider { - -// Window station scoped handle. - -class WindowStationTraits { - public: - using Handle = HWINSTA; - - static bool CloseHandle(HWINSTA handle) { - return ::CloseWindowStation(handle) != FALSE; - } - - static bool IsHandleValid(HWINSTA handle) { - return handle != nullptr; - } - - static HWINSTA NullHandle() { - return nullptr; - } - - private: - DISALLOW_IMPLICIT_CONSTRUCTORS(WindowStationTraits); -}; - -typedef base::win::GenericScopedHandle<WindowStationTraits, - base::win::DummyVerifierTraits> - ScopedWindowStationHandle; - -// Desktop scoped handle. - -class DesktopTraits { - public: - using Handle = HDESK; - - static bool CloseHandle(HDESK handle) { - return ::CloseDesktop(handle) != FALSE; - } - - static bool IsHandleValid(HDESK handle) { - return handle != nullptr; - } - - static HDESK NullHandle() { - return nullptr; - } - - private: - DISALLOW_IMPLICIT_CONSTRUCTORS(DesktopTraits); -}; - -typedef base::win::GenericScopedHandle<DesktopTraits, - base::win::DummyVerifierTraits> - ScopedDesktopHandle; - -// WinHttp scoped handle. - -class WinHttpTraits { - public: - using Handle = HINTERNET; - - static bool CloseHandle(HINTERNET handle) { - return ::WinHttpCloseHandle(handle) != FALSE; - } - - static bool IsHandleValid(HINTERNET handle) { - return handle != nullptr; - } - - static HINTERNET NullHandle() { - return nullptr; - } - - private: - DISALLOW_IMPLICIT_CONSTRUCTORS(WinHttpTraits); -}; - -typedef base::win::GenericScopedHandle<WinHttpTraits, - base::win::DummyVerifierTraits> - ScopedWinHttpHandle; - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_SCOPED_HANDLE_H_
diff --git a/chrome/credential_provider/gaiacp/scoped_lsa_policy.cc b/chrome/credential_provider/gaiacp/scoped_lsa_policy.cc deleted file mode 100644 index 16ae3b7..0000000 --- a/chrome/credential_provider/gaiacp/scoped_lsa_policy.cc +++ /dev/null
@@ -1,151 +0,0 @@ -// Copyright 2018 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/credential_provider/gaiacp/scoped_lsa_policy.h" - -#include <Windows.h> // Needed for ACCESS_MASK, <lm.h> -#include <Winternl.h> -#include <lm.h> // Needed for LSA_UNICODE_STRING - -#define _NTDEF_ // Prevent redefition errors, must come after <winternl.h> -#include <ntsecapi.h> // For LSA_xxx types - -#include "chrome/credential_provider/gaiacp/gcp_utils.h" // For STATUS_SUCCESS. -#include "chrome/credential_provider/gaiacp/logging.h" - -namespace credential_provider { - -// static -ScopedLsaPolicy::CreatorCallback* ScopedLsaPolicy::GetCreatorCallbackStorage() { - static CreatorCallback creator_for_testing; - return &creator_for_testing; -} - -// static -void ScopedLsaPolicy::SetCreatorForTesting(CreatorCallback creator) { - *GetCreatorCallbackStorage() = creator; -} - -// static -std::unique_ptr<ScopedLsaPolicy> ScopedLsaPolicy::Create(ACCESS_MASK mask) { - if (!GetCreatorCallbackStorage()->is_null()) - return GetCreatorCallbackStorage()->Run(mask); - - std::unique_ptr<ScopedLsaPolicy> scoped(new ScopedLsaPolicy(mask)); - return scoped->IsValid() ? std::move(scoped) : nullptr; -} - -ScopedLsaPolicy::ScopedLsaPolicy(ACCESS_MASK mask) { - LSA_OBJECT_ATTRIBUTES oa; - memset(&oa, 0, sizeof(oa)); - NTSTATUS sts = ::LsaOpenPolicy(nullptr, &oa, mask, &handle_); - if (sts != STATUS_SUCCESS) { - HRESULT hr = HRESULT_FROM_NT(sts); - LOGFN(ERROR) << "LsaOpenPolicy hr=" << putHR(hr); - ::SetLastError(hr); - handle_ = nullptr; - } -} - -ScopedLsaPolicy::~ScopedLsaPolicy() { - if (handle_ != nullptr) - ::LsaClose(handle_); -} - -bool ScopedLsaPolicy::IsValid() const { - return handle_ != nullptr; -} - -HRESULT ScopedLsaPolicy::StorePrivateData(const wchar_t* key, - const wchar_t* value) { - LSA_UNICODE_STRING lsa_key; - InitLsaString(key, &lsa_key); - LSA_UNICODE_STRING lsa_value; - InitLsaString(value, &lsa_value); - - // When calling LsaStorePrivateData(), the value's length should include - // the null terminator. - lsa_value.Length = lsa_value.MaximumLength; - - NTSTATUS sts = ::LsaStorePrivateData(handle_, &lsa_key, &lsa_value); - if (sts != STATUS_SUCCESS) { - HRESULT hr = HRESULT_FROM_NT(sts); - LOGFN(ERROR) << "LsaStorePrivateData hr=" << putHR(hr); - return hr; - } - return S_OK; -} - -HRESULT ScopedLsaPolicy::RemovePrivateData(const wchar_t* key) { - LSA_UNICODE_STRING lsa_key; - InitLsaString(key, &lsa_key); - - NTSTATUS sts = ::LsaStorePrivateData(handle_, &lsa_key, nullptr); - if (sts != STATUS_SUCCESS) { - HRESULT hr = HRESULT_FROM_NT(sts); - LOGFN(ERROR) << "LsaStorePrivateData hr=" << putHR(hr); - return hr; - } - return S_OK; -} - -HRESULT ScopedLsaPolicy::RetrievePrivateData(const wchar_t* key, - wchar_t* value, - size_t length) { - LSA_UNICODE_STRING lsa_key; - InitLsaString(key, &lsa_key); - LSA_UNICODE_STRING* lsa_value; - - NTSTATUS sts = ::LsaRetrievePrivateData(handle_, &lsa_key, &lsa_value); - if (sts != STATUS_SUCCESS) { - HRESULT hr = HRESULT_FROM_NT(sts); - LOGFN(ERROR) << "LsaRetrievePrivateData hr=" << putHR(hr); - return hr; - } - - errno_t err = wcscpy_s(value, length, lsa_value->Buffer); - ::LsaFreeMemory(lsa_value); - - return err == 0 ? S_OK : E_FAIL; -} - -HRESULT ScopedLsaPolicy::AddAccountRights(PSID sid, const wchar_t* right) { - LSA_UNICODE_STRING lsa_right; - InitLsaString(right, &lsa_right); - NTSTATUS sts = ::LsaAddAccountRights(handle_, sid, &lsa_right, 1); - if (sts != STATUS_SUCCESS) { - HRESULT hr = HRESULT_FROM_NT(sts); - LOGFN(ERROR) << "LsaAddAccountRights sts=" << putHR(sts) - << " hr=" << putHR(hr); - return hr; - } - return S_OK; -} - -HRESULT ScopedLsaPolicy::RemoveAccount(PSID sid) { - // When all rights are removed from an account, the account itself is also - // deleted. - // I thought the above meant the user would be removed from the - // computer, but apparently I am mistaken. It is still important to call - // NetUserDel(). - NTSTATUS sts = ::LsaRemoveAccountRights(handle_, sid, TRUE, nullptr, 0); - if (sts != STATUS_SUCCESS) { - HRESULT hr = HRESULT_FROM_NT(sts); - LOGFN(ERROR) << "LsaRemoveAccountRights sts=" << putHR(sts) - << " hr=" << putHR(hr); - return hr; - } - return S_OK; -} - -// static -void ScopedLsaPolicy::InitLsaString(const wchar_t* string, - _UNICODE_STRING* lsa_string) { - lsa_string->Buffer = const_cast<wchar_t*>(string); - lsa_string->Length = - static_cast<USHORT>(wcslen(lsa_string->Buffer) * sizeof(wchar_t)); - lsa_string->MaximumLength = lsa_string->Length + sizeof(wchar_t); -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/scoped_lsa_policy.h b/chrome/credential_provider/gaiacp/scoped_lsa_policy.h deleted file mode 100644 index 2558abf..0000000 --- a/chrome/credential_provider/gaiacp/scoped_lsa_policy.h +++ /dev/null
@@ -1,66 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_GAIACP_SCOPED_LSA_POLICY_H_ -#define CHROME_CREDENTIAL_PROVIDER_GAIACP_SCOPED_LSA_POLICY_H_ - -#include "base/callback.h" -#include "base/win/windows_types.h" - -struct _UNICODE_STRING; - -namespace credential_provider { - -class FakeScopedLsaPolicyFactory; - -class ScopedLsaPolicy { - public: - static std::unique_ptr<ScopedLsaPolicy> Create(ACCESS_MASK mask); - - virtual ~ScopedLsaPolicy(); - - // Methods to store, retrieve, and remove private keyed data. This data - // is stored in protected memory in the OS that required SYSTEM account - // to decrypt. - virtual HRESULT StorePrivateData(const wchar_t* key, const wchar_t* value); - virtual HRESULT RemovePrivateData(const wchar_t* key); - virtual HRESULT RetrievePrivateData(const wchar_t* key, - wchar_t* value, - size_t length); - - // Adds the given right to the given user. - virtual HRESULT AddAccountRights(PSID sid, const wchar_t* right); - - // Removes the user account from the system. - virtual HRESULT RemoveAccount(PSID sid); - - // Initializes an LSA_UNICODE_STRING string from the given wide string. - // A copy of the wide string is not made, so |lsa_string| must outlive - // |string|. - static void InitLsaString(const wchar_t* string, _UNICODE_STRING* lsa_string); - - // Set the function used to create instances of this class in tests. This - // is used in the Create() static function. - using CreatorFunc = decltype(Create); - using CreatorCallback = base::RepeatingCallback<CreatorFunc>; - static void SetCreatorForTesting(CreatorCallback creator); - - protected: - explicit ScopedLsaPolicy(ACCESS_MASK mask); - - bool IsValid() const; - - private: - friend class FakeScopedLsaPolicyFactory; - - LSA_HANDLE handle_; - - // Gets storage of the function pointer used to create instances of this - // class for tests. - static CreatorCallback* GetCreatorCallbackStorage(); -}; - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_SCOPED_LSA_POLICY_H_
diff --git a/chrome/credential_provider/gaiacp/scoped_user_profile.cc b/chrome/credential_provider/gaiacp/scoped_user_profile.cc deleted file mode 100644 index 29b09e3..0000000 --- a/chrome/credential_provider/gaiacp/scoped_user_profile.cc +++ /dev/null
@@ -1,252 +0,0 @@ -// Copyright 2018 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/credential_provider/gaiacp/scoped_user_profile.h" - -#include <Windows.h> -#include <dpapi.h> -#include <security.h> -#include <userenv.h> -#include <atlconv.h> - -#include "base/stl_util.h" -#include "base/strings/utf_string_conversions.h" -#include "base/win/registry.h" -#include "chrome/credential_provider/gaiacp/gcp_strings.h" -#include "chrome/credential_provider/gaiacp/gcp_utils.h" -#include "chrome/credential_provider/gaiacp/logging.h" -#include "chrome/credential_provider/gaiacp/reg_utils.h" - -namespace credential_provider { - -namespace { - -// Registry key under HKCU to write account info into. -const wchar_t kRegAccountsPath[] = L"Software\\Google\\Accounts"; - -std::string GetEncryptedRefreshToken( - base::win::ScopedHandle::Handle logon_handle, - const base::DictionaryValue& properties) { - std::string refresh_token = GetDictStringUTF8(&properties, kKeyRefreshToken); - if (refresh_token.empty()) { - LOGFN(ERROR) << "Refresh token is empty"; - return std::string(); - } - - if (!::ImpersonateLoggedOnUser(logon_handle)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "ImpersonateLoggedOnUser hr=" << putHR(hr); - return std::string(); - } - - // Don't include null character in ciphertext. - DATA_BLOB plaintext; - plaintext.pbData = - reinterpret_cast<BYTE*>(const_cast<char*>(refresh_token.c_str())); - plaintext.cbData = static_cast<DWORD>(refresh_token.length()); - - DATA_BLOB ciphertext; - BOOL success = - ::CryptProtectData(&plaintext, L"Gaia refresh token", nullptr, nullptr, - nullptr, CRYPTPROTECT_UI_FORBIDDEN, &ciphertext); - HRESULT hr = success ? S_OK : HRESULT_FROM_WIN32(::GetLastError()); - ::RevertToSelf(); - if (!success) { - LOGFN(ERROR) << "CryptProtectData hr=" << putHR(hr); - return std::string(); - } - - // NOTE: return value is binary data, not null-terminate string. - std::string encrypted_data(reinterpret_cast<char*>(ciphertext.pbData), - ciphertext.cbData); - ::LocalFree(ciphertext.pbData); - return encrypted_data; -} - -} // namespace - -// static -ScopedUserProfile::CreatorCallback* -ScopedUserProfile::GetCreatorFunctionStorage() { - static CreatorCallback creator_for_testing; - return &creator_for_testing; -} - -// static -std::unique_ptr<ScopedUserProfile> ScopedUserProfile::Create( - const base::string16& sid, - const base::string16& username, - const base::string16& password) { - if (!GetCreatorFunctionStorage()->is_null()) - return GetCreatorFunctionStorage()->Run(sid, username, password); - - std::unique_ptr<ScopedUserProfile> scoped( - new ScopedUserProfile(sid, username, password)); - return scoped->IsValid() ? std::move(scoped) : nullptr; -} - -ScopedUserProfile::ScopedUserProfile(const base::string16& sid, - const base::string16& username, - const base::string16& password) { - LOGFN(INFO); - // Load the user's profile so that their regsitry hive is available. - base::win::ScopedHandle::Handle handle; - if (!::LogonUserW(username.c_str(), L".", password.c_str(), - LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, - &handle)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "LogonUserW hr=" << putHR(hr); - return; - } - token_.Set(handle); - - if (!WaitForProfileCreation(sid)) - token_.Close(); -} - -ScopedUserProfile::~ScopedUserProfile() {} - -bool ScopedUserProfile::IsValid() { - return token_.IsValid(); -} - -HRESULT ScopedUserProfile::SaveAccountInfo( - const base::DictionaryValue& properties) { - LOGFN(INFO); - - base::string16 sid = GetDictString(&properties, kKeySID); - if (sid.empty()) { - LOGFN(ERROR) << "SID is empty"; - return E_INVALIDARG; - } - - base::string16 id = GetDictString(&properties, kKeyId); - if (id.empty()) { - LOGFN(ERROR) << "Id is empty"; - return E_INVALIDARG; - } - - base::string16 email = GetDictString(&properties, kKeyEmail); - if (email.empty()) { - LOGFN(ERROR) << "Email is empty"; - return E_INVALIDARG; - } - - base::string16 token_handle = GetDictString(&properties, kKeyTokenHandle); - if (token_handle.empty()) { - LOGFN(ERROR) << "Token handle is empty"; - return E_INVALIDARG; - } - - // Save token handle. This handle will be used later to determine if the - // the user has changed their password since the account was created. - HRESULT hr = SetUserProperty(sid.c_str(), kUserTokenHandle, - token_handle.c_str()); - if (FAILED(hr)) { - LOGFN(ERROR) << "SetUserProperty(th) hr=" << putHR(hr); - return hr; - } - - hr = SetUserProperty(sid.c_str(), kUserEmail, email.c_str()); - if (FAILED(hr)) { - LOGFN(ERROR) << "SetUserProperty(email) hr=" << putHR(hr); - return hr; - } - - // Write account information to the user's hive. - // NOTE: regular users cannot access the registry entry of other users, - // but administrators and SYSTEM can. - { - wchar_t key_name[128]; - swprintf_s(key_name, base::size(key_name), L"%s\\%s\\%s", sid.c_str(), - kRegAccountsPath, id.c_str()); - LOGFN(INFO) << "HKU\\" << key_name; - - base::win::RegKey key; - LONG sts = key.Create(HKEY_USERS, key_name, KEY_READ | KEY_WRITE); - if (sts != ERROR_SUCCESS) { - HRESULT hr = HRESULT_FROM_WIN32(sts); - LOGFN(ERROR) << "key.Create(" << id << ") hr=" << putHR(hr); - return hr; - } - - sts = key.WriteValue(base::ASCIIToUTF16(kKeyEmail).c_str(), email.c_str()); - if (sts != ERROR_SUCCESS) { - HRESULT hr = HRESULT_FROM_WIN32(sts); - LOGFN(ERROR) << "key.WriteValue(" << sid << ", email) hr=" << putHR(hr); - return hr; - } - - // NOTE: |encrypted_data| is binary data, not null-terminate string. - std::string encrypted_data = - GetEncryptedRefreshToken(token_.Get(), properties); - if (encrypted_data.empty()) { - LOGFN(ERROR) << "GetEncryptedRefreshToken returned empty string"; - return E_UNEXPECTED; - } - - sts = key.WriteValue( - base::ASCIIToUTF16(kKeyRefreshToken).c_str(), encrypted_data.c_str(), - static_cast<ULONG>(encrypted_data.length()), REG_BINARY); - if (sts != ERROR_SUCCESS) { - HRESULT hr = HRESULT_FROM_WIN32(sts); - LOGFN(ERROR) << "key.WriteValue(" << sid << ", RT) hr=" << putHR(hr); - return hr; - } - } - - return S_OK; -} - -ScopedUserProfile::ScopedUserProfile() {} - -bool ScopedUserProfile::WaitForProfileCreation(const base::string16& sid) { - LOGFN(INFO); - wchar_t profile_dir[MAX_PATH]; - bool created = false; - - for (int i = 0; i < 10; ++i) { - Sleep(1000); - DWORD length = base::size(profile_dir); - if (::GetUserProfileDirectoryW(token_.Get(), profile_dir, &length)) { - LOGFN(INFO) << "GetUserProfileDirectoryW " << i << " " << profile_dir; - created = true; - break; - } else { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(INFO) << "GetUserProfileDirectoryW hr=" << putHR(hr); - } - } - - if (!created) - LOGFN(INFO) << "Profile not created yet???"; - - created = false; - - // Write account information to the user's hive. - // NOTE: regular users cannot access the registry entry of other users, - // but administrators and SYSTEM can. - base::win::RegKey key; - wchar_t key_name[128]; - swprintf_s(key_name, base::size(key_name), L"%s\\%s", sid.c_str(), - kRegAccountsPath); - LOGFN(INFO) << "HKU\\" << key_name; - - for (int i = 0; i < 10; ++i) { - Sleep(1000); - LONG sts = key.Create(HKEY_USERS, key_name, KEY_READ | KEY_WRITE); - if (sts == ERROR_SUCCESS) { - LOGFN(INFO) << "Registry hive created " << i; - created = true; - break; - } - } - - if (!created) - LOGFN(ERROR) << "Profile not created really???"; - - return created; -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/scoped_user_profile.h b/chrome/credential_provider/gaiacp/scoped_user_profile.h deleted file mode 100644 index 9df5194..0000000 --- a/chrome/credential_provider/gaiacp/scoped_user_profile.h +++ /dev/null
@@ -1,71 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_GAIACP_SCOPED_USER_PROFILE_H_ -#define CHROME_CREDENTIAL_PROVIDER_GAIACP_SCOPED_USER_PROFILE_H_ - -#include <string> - -#include "base/callback.h" -#include "base/strings/string16.h" -#include "base/values.h" -#include "base/win/scoped_handle.h" - -namespace credential_provider { - -class FakeScopedUserProfileFactory; - -// Class that ensure an account's user profile and its home directory are -// properly created. -class ScopedUserProfile { - public: - static std::unique_ptr<ScopedUserProfile> Create( - const base::string16& sid, - const base::string16& username, - const base::string16& password); - - virtual ~ScopedUserProfile(); - - // Saves Gaia information to the account's KHCU registry hive. - virtual HRESULT SaveAccountInfo(const base::DictionaryValue& properties); - - protected: - // This constructor is used by the derived fake class to bypass the - // initialization code in the public constructor that will fail because the - // tests are not running elevated. - ScopedUserProfile(); - - private: - friend class FakeScopedUserProfileFactory; - - bool IsValid(); - - // Waits for the specified user's profile to be created. The credprov - // does not have backup/restore privileges, so cannot call LoadUserProfile() - // directly. winlogon.exe does have the privileges, but somehow they do - // not get transferred. - // - // Another option is CreateProcessWithLogonW(...LOGON_WITH_PROFILE...), - // however a process running as SYSTEM is not permitted to call this. The - // workaround used in this class is to simply wait for the user's profile - // directtory and registry hive to be loaded by the system itself. This - // code must be run after the credprov tells winlogon to log the user in. - ScopedUserProfile(const base::string16& sid, - const base::string16& username, - const base::string16& password); - - bool WaitForProfileCreation(const base::string16& sid); - - base::win::ScopedHandle token_; - - // Gets storage of the function pointer used to create instances of this - // class for tests. - using CreatorFunc = decltype(Create); - using CreatorCallback = base::RepeatingCallback<CreatorFunc>; - static CreatorCallback* GetCreatorFunctionStorage(); -}; - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_SCOPED_USER_PROFILE_H_
diff --git a/chrome/credential_provider/gaiacp/stdafx.h b/chrome/credential_provider/gaiacp/stdafx.h deleted file mode 100644 index 964cbc1..0000000 --- a/chrome/credential_provider/gaiacp/stdafx.h +++ /dev/null
@@ -1,51 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_GAIACP_STDAFX_H_ -#define CHROME_CREDENTIAL_PROVIDER_GAIACP_STDAFX_H_ - -// Include common system include files. - -#include <windows.h> -#include <winternl.h> - -#include <wincred.h> -#include <wincrypt.h> - -#define _NTDEF_ // Prevent redefition errors, must come after <winternl.h> -#include <Shellapi.h> // For CommandLineToArgvW() -#include <Shlobj.h> -#include <aclapi.h> -#include <credentialprovider.h> -#include <dpapi.h> -#include <lm.h> -#include <MDMRegistration.h> -#include <ntsecapi.h> -#include <propkey.h> -#include <sddl.h> -#include <security.h> -#include <userenv.h> -#include <versionhelpers.h> - -#include <malloc.h> -#include <memory.h> -#include <stdlib.h> - -#include <fcntl.h> // for _O_TEXT | _O_APPEND -#include <inttypes.h> -#include <io.h> - -#include <memory> - -// The ATL headers don't like to be compiled with INITGUID defined. -#if !defined(INITGUID) - -#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString ctors are explicit -#include <atlbase.h> -#include <atlcom.h> -#include <atlstr.h> - -#endif - -#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_STDAFX_H_
diff --git a/chrome/credential_provider/gaiacp/win_http_url_fetcher.cc b/chrome/credential_provider/gaiacp/win_http_url_fetcher.cc deleted file mode 100644 index 342ba07..0000000 --- a/chrome/credential_provider/gaiacp/win_http_url_fetcher.cc +++ /dev/null
@@ -1,171 +0,0 @@ -// Copyright 2018 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/credential_provider/gaiacp/win_http_url_fetcher.h" - -#include <Windows.h> -#include <winhttp.h> - -#include <atlconv.h> - -#include "base/strings/string16.h" -#include "base/strings/stringprintf.h" -#include "chrome/credential_provider/gaiacp/logging.h" - -namespace credential_provider { - -// static -WinHttpUrlFetcher::CreatorCallback* -WinHttpUrlFetcher::GetCreatorFunctionStorage() { - static CreatorCallback creator_for_testing; - return &creator_for_testing; -} - -// static -std::unique_ptr<WinHttpUrlFetcher> WinHttpUrlFetcher::Create(const GURL& url) { - return !GetCreatorFunctionStorage()->is_null() - ? GetCreatorFunctionStorage()->Run(url) - : std::unique_ptr<WinHttpUrlFetcher>(new WinHttpUrlFetcher(url)); -} - -WinHttpUrlFetcher::WinHttpUrlFetcher(const GURL& url) - : url_(url), session_(nullptr), request_(nullptr) { - LOGFN(INFO) << "url=" << url.spec() << " (scheme and port ignored)"; - - ScopedWinHttpHandle::Handle session = ::WinHttpOpen( - L"GaiaCP/1.0 (Windows NT)", WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY, - WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0); - if (!session) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "WinHttpOpen hr=" << putHR(hr); - } - session_.Set(session); -} - -WinHttpUrlFetcher::WinHttpUrlFetcher() {} - -WinHttpUrlFetcher::~WinHttpUrlFetcher() { - // Closing the session handle closes all derived handles too. -} - -bool WinHttpUrlFetcher::IsValid() const { - return session_.IsValid(); -} - -HRESULT WinHttpUrlFetcher::SetRequestHeader(const char* name, - const char* value) { - DCHECK(name); - DCHECK(value); - - // TODO(rogerta): does not support multivalued headers. - request_headers_[name] = value; - return S_OK; -} - -HRESULT WinHttpUrlFetcher::SetRequestBody(const char* body) { - DCHECK(body); - body_ = body; - return S_OK; -} - -HRESULT WinHttpUrlFetcher::Fetch(std::string* response) { - USES_CONVERSION; - DCHECK(response); - - if (!session_.IsValid()) { - LOGFN(ERROR) << "Invalid fetcher"; - return E_UNEXPECTED; - } - - // Open a connection to the server. - ScopedWinHttpHandle connect; - { - ScopedWinHttpHandle::Handle connect_tmp = ::WinHttpConnect( - session_.Get(), A2CW(url_.host().c_str()), INTERNET_DEFAULT_PORT, 0); - if (!connect_tmp) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "WinHttpConnect hr=" << putHR(hr); - return hr; - } - connect.Set(connect_tmp); - } - - { - bool use_post = !body_.empty(); - ScopedWinHttpHandle::Handle request = ::WinHttpOpenRequest( - connect.Get(), use_post ? L"POST" : L"GET", A2CW(url_.path().c_str()), - nullptr, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, - WINHTTP_FLAG_REFRESH | WINHTTP_FLAG_SECURE); - if (!request) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "WinHttpOpenRequest hr=" << putHR(hr); - return hr; - } - request_.Set(request); - } - - // Add request headers. - - for (const auto& kv : request_headers_) { - base::string16 header = - base::StringPrintf(L"%S: %S", kv.first.c_str(), kv.second.c_str()); - if (!::WinHttpAddRequestHeaders( - request_.Get(), header.c_str(), header.length(), - WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "WinHttpAddRequestHeaders name=" << kv.first - << " hr=" << putHR(hr); - return hr; - } - } - - // Write request body if needed. - - if (!::WinHttpSendRequest(request_.Get(), WINHTTP_NO_ADDITIONAL_HEADERS, 0, - const_cast<char*>(body_.c_str()), body_.length(), - body_.length(), - reinterpret_cast<DWORD_PTR>(nullptr))) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "WinHttpSendRequest hr=" << putHR(hr); - return hr; - } - - // Wait for the response. - - if (!::WinHttpReceiveResponse(request_.Get(), nullptr)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "WinHttpReceiveResponse hr=" << putHR(hr); - return hr; - } - - DWORD length = 0; - if (!::WinHttpQueryDataAvailable(request_.Get(), &length)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "WinHttpQueryDataAvailable hr=" << putHR(hr); - return hr; - } - - // Read the response. - std::unique_ptr<char> buffer(new char[length]); - while (length > 0) { - DWORD actual; - if (!::WinHttpReadData(request_.Get(), buffer.get(), length, &actual)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "WinHttpReadData hr=" << putHR(hr); - return hr; - } - - response->append(buffer.get(), actual); - length -= actual; - } - - return S_OK; -} - -HRESULT WinHttpUrlFetcher::Close() { - request_.Close(); - return S_OK; -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/win_http_url_fetcher.h b/chrome/credential_provider/gaiacp/win_http_url_fetcher.h deleted file mode 100644 index 90fe5e3..0000000 --- a/chrome/credential_provider/gaiacp/win_http_url_fetcher.h +++ /dev/null
@@ -1,61 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_GAIACP_WIN_HTTP_URL_FETCHER_H_ -#define CHROME_CREDENTIAL_PROVIDER_GAIACP_WIN_HTTP_URL_FETCHER_H_ - -#include <map> -#include <string> - -#include "base/callback.h" -#include "chrome/credential_provider/gaiacp/scoped_handle.h" -#include "url/gurl.h" - -namespace credential_provider { - -class FakeWinHttpUrlFetcherFactory; - -// A synchronous URL fetcher for small requests. -class WinHttpUrlFetcher { - public: - static std::unique_ptr<WinHttpUrlFetcher> Create(const GURL& url); - - virtual ~WinHttpUrlFetcher(); - - virtual bool IsValid() const; - - virtual HRESULT SetRequestHeader(const char* name, const char* value); - virtual HRESULT SetRequestBody(const char* body); - virtual HRESULT Fetch(std::string* response); - virtual HRESULT Close(); - - protected: - using Headers = std::map<std::string, std::string>; - - // This constructor is used by the derived fake class to bypass the - // initialization code in the public constructor that will fail because the - // tests are not running elevated. - WinHttpUrlFetcher(); - - private: - friend class FakeWinHttpUrlFetcherFactory; - - explicit WinHttpUrlFetcher(const GURL& url); - - GURL url_; - Headers request_headers_; - std::string body_; - ScopedWinHttpHandle session_; - ScopedWinHttpHandle request_; - - // Gets storage of the function pointer used to create instances of this - // class for tests. - using CreatorFunc = decltype(Create); - using CreatorCallback = base::RepeatingCallback<CreatorFunc>; - static CreatorCallback* GetCreatorFunctionStorage(); -}; - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_WIN_HTTP_URL_FETCHER_H_
diff --git a/chrome/credential_provider/setup/BUILD.gn b/chrome/credential_provider/setup/BUILD.gn deleted file mode 100644 index 78018f6..0000000 --- a/chrome/credential_provider/setup/BUILD.gn +++ /dev/null
@@ -1,48 +0,0 @@ -# Copyright 2018 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("//build/buildflag_header.gni") -import("//build/config/allocator.gni") -import("//build/config/clang/clang.gni") -import("//build/config/compiler/compiler.gni") -import("//build/config/dcheck_always_on.gni") -import("//build/nocompile.gni") -import("//chrome/process_version_rc_template.gni") -import("//testing/libfuzzer/fuzzer_test.gni") -import("//testing/test.gni") - -process_version_rc_template("version") { - template_file = "gcp_setup.rc.version" - output = "$root_out_dir/gcp_setup_version.rc" -} - -source_set("common") { - sources = [ - "setup_lib.cc", - "setup_lib.h", - ] - public_deps = [ - "//base:base", - ] - deps = [ - ":version", - "//chrome/installer/util:with_no_strings", - "../gaiacp:common", - ] -} - -executable("gcp_setup") { - sources = [ - "setup.cc", - ] - deps = [ - ":common", - "//chrome/common:version_header", - "../eventlog:gcp_eventlog_messages", - "../gaiacp:common", - ] - configs += [ - "//build/config/win:windowed", - ] -}
diff --git a/chrome/credential_provider/setup/gcp_setup.rc.version b/chrome/credential_provider/setup/gcp_setup.rc.version deleted file mode 100644 index 7438a046..0000000 --- a/chrome/credential_provider/setup/gcp_setup.rc.version +++ /dev/null
@@ -1,43 +0,0 @@ -// Copyright 2018 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. - -// Use the ordinal 1 here, to avoid needing to #include a header file -// to use the VS_VERSION_INFO macro. This header file changes with different -// SDK versions which causes headaches building in some environments. The -// VERSIONINFO resource will always be at index 1. -1 VERSIONINFO - FILEVERSION @MAJOR@,@MINOR@,@BUILD@,@PATCH@ - PRODUCTVERSION @MAJOR@,@MINOR@,@BUILD@,@PATCH@ - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "@COMPANY_FULLNAME@" - VALUE "FileDescription", "Google Credential Provider installer" - VALUE "FileVersion", "@MAJOR@.@MINOR@.@BUILD@.@PATCH@" - VALUE "InternalName", "gcp_setup" - VALUE "LegalCopyright", "@COPYRIGHT@" - VALUE "ProductName", "Google Credential Provider installer" - VALUE "ProductVersion", "@MAJOR@.@MINOR@.@BUILD@.@PATCH@" - VALUE "CompanyShortName", "@COMPANY_SHORTNAME@" - VALUE "ProductShortName", "Google Credential Provider installer" - VALUE "LastChange", "@LASTCHANGE@" - VALUE "Official Build", "@OFFICIAL_BUILD@" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END
diff --git a/chrome/credential_provider/setup/setup.cc b/chrome/credential_provider/setup/setup.cc deleted file mode 100644 index f3175bba..0000000 --- a/chrome/credential_provider/setup/setup.cc +++ /dev/null
@@ -1,182 +0,0 @@ -// Copyright 2018 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. - -// This app is written as a windowsless win32 app instead of a console app so -// that the app can be made entireless silent, as required by omaha. - -#include <Windows.h> -#include <shlobj.h> // Needed for IsUserAnAdmin() - -#include <stdlib.h> -#include <string> - -#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // make some CString ctors explicit - -#include <atlbase.h> -#include <atlstr.h> - -#include "base/at_exit.h" -#include "base/command_line.h" -#include "base/files/file_path.h" -#include "base/files/file_util.h" -#include "base/logging.h" -#include "base/process/memory.h" -#include "base/stl_util.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/string_piece.h" -#include "base/win/process_startup_helper.h" -#include "base/win/scoped_handle.h" -#include "base/win/win_util.h" -#include "base/win/windows_version.h" -#include "chrome/common/chrome_version.h" -#include "chrome/credential_provider/eventlog/gcp_eventlog_messages.h" -#include "chrome/credential_provider/gaiacp/logging.h" -#include "chrome/credential_provider/setup/setup_lib.h" - -using credential_provider::putHR; - -namespace { - -bool IsPerUserInstallFromGoogleUpdate() { - wchar_t value[2]; - DWORD length = ::GetEnvironmentVariable(L"GoogleUpdateIsMachine", value, - base::size(value)); - - return length == 1 && value[0] == L'0'; -} - -} // namespace - -int APIENTRY wWinMain(HINSTANCE hInstance, - HINSTANCE /*hPrevInstance*/, - wchar_t* lpCmdLine, - int /*nCmdShow*/) { - HRESULT hr = S_OK; - - // Initialize base. Command line will be set from GetCommandLineW(). - base::AtExitManager exit_manager; - base::CommandLine::Init(0, nullptr); - - // Initialize logging. - logging::LoggingSettings settings; - settings.logging_dest = logging::LOG_NONE; - logging::InitLogging(settings); - logging::SetLogItems(true, // Enable process id. - true, // Enable thread id. - true, // Enable timestamp. - false); // Enable tickcount. - logging::SetEventSource("GCP", GCP_CATEGORY, MSG_LOG_MESSAGE); - - // Make sure the process exits cleanly on unexpected errors. - base::EnableTerminationOnHeapCorruption(); - base::EnableTerminationOnOutOfMemory(); - base::win::RegisterInvalidParamHandler(); - base::win::SetupCRT(*base::CommandLine::ForCurrentProcess()); - - wchar_t module[MAX_PATH]; - DWORD module_length = ::GetModuleFileName(hInstance, module, - base::size(module)); - if (module_length == 0) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "GetModuleFileName hr=" << putHR(hr); - return -1; - } else if (module_length == base::size(module)) { - LOGFN(ERROR) << "GetModuleFileName: module name too long"; - return -1; - } - - base::FilePath gcp_setup_exe_path(base::StringPiece16(module, module_length)); - - wchar_t time_string[64]; - if (::GetTimeFormatEx(LOCALE_NAME_USER_DEFAULT, 0, nullptr, nullptr, - time_string, base::size(time_string)) == 0) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "GetTimeFormatEx(start) hr=" << putHR(hr); - wcscpy_s(time_string, base::size(time_string), L"Unknown"); - } - - LOGFN(INFO) << "Start: " << time_string; - LOGFN(INFO) << "Module: " << gcp_setup_exe_path; - LOGFN(INFO) << "Args: " << lpCmdLine; - LOGFN(INFO) << "Version: " << TEXT(CHROME_VERSION_STRING); - LOGFN(INFO) << "Windows: " - << base::win::OSInfo::GetInstance()->Kernel32BaseVersion(); - - // If running from omaha, make sure machine install is used. - if (IsPerUserInstallFromGoogleUpdate()) { - LOGFN(ERROR) << "Only machine installs supported with Google Update"; - return -1; - } - - if (!::IsUserAnAdmin()) { - LOGFN(ERROR) << "Setup must be run with administrative privilege."; - return -1; - } - - hr = ::CoInitializeEx(nullptr, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE); - if (FAILED(hr)) { - LOGFN(ERROR) << "Could not initialize COM."; - return -1; - } - - // Parse command line. - base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); - bool is_uninstall = cmdline->HasSwitch( - credential_provider::switches::kUninstall); - base::FilePath path = cmdline->GetSwitchValuePath( - credential_provider::switches::kInstallPath); - std::string parent_handle_str = - cmdline->GetSwitchValueASCII( - credential_provider::switches::kParentHandle); - - if (is_uninstall) { - // If this is a user invoked uninstall, copy the exe to the temp directory - // and rerun it from there. Append a new arg so that setup knows it is not - // user invoked and where to uninstall from. - if (path.empty()) { - hr = credential_provider::RelaunchUninstaller(gcp_setup_exe_path); - } else { - // Wait for parent process to exit. Proceed in any case. - if (!parent_handle_str.empty()) { - uint32_t parent_handle_value; - if (base::StringToUint(parent_handle_str, &parent_handle_value)) { - base::win::ScopedHandle parent_handle( - base::win::Uint32ToHandle(parent_handle_value)); - DWORD ret = ::WaitForSingleObject(parent_handle.Get(), 5000); - LOGFN(INFO) << "Waited for parent(" << parent_handle.Get() - << "): ret=" << ret; - } - } - - hr = credential_provider::DoUninstall(gcp_setup_exe_path, path, nullptr); - - // Schedule the installer to be deleted on the next reboot. - if (!base::DeleteFileAfterReboot(gcp_setup_exe_path)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "DeleteFileAfterReboot hr=" << putHR(hr); - } - } - } else { - hr = credential_provider::DoInstall(gcp_setup_exe_path, - TEXT(CHROME_VERSION_STRING), nullptr); - } - - // Log success or failure only if uninstall was not launched as a separate - // process. - if (!(is_uninstall && path.empty())) { - if (::GetTimeFormatEx(LOCALE_NAME_USER_DEFAULT, 0, nullptr, nullptr, - time_string, base::size(time_string)) == 0) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "GetTimeFormatEx(end) hr=" << putHR(hr); - wcscpy_s(time_string, base::size(time_string), L"Unknown"); - } - - LOGFN(INFO) << (SUCCEEDED(hr) ? "Setup completed successfully" - : "Setup failed") - << ". " << time_string; - } - - ::CoUninitialize(); - return 0; -}
diff --git a/chrome/credential_provider/setup/setup_lib.cc b/chrome/credential_provider/setup/setup_lib.cc deleted file mode 100644 index a0e753e..0000000 --- a/chrome/credential_provider/setup/setup_lib.cc +++ /dev/null
@@ -1,382 +0,0 @@ -// Copyright 2018 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/credential_provider/setup/setup_lib.h" - -#include <shlobj.h> -#include <atlbase.h> -#include <iomanip> -#include <string> - -#include "base/command_line.h" -#include "base/file_version_info.h" -#include "base/files/file.h" -#include "base/files/file_enumerator.h" -#include "base/files/file_util.h" -#include "base/macros.h" -#include "base/path_service.h" -#include "base/process/launch.h" -#include "base/scoped_native_library.h" -#include "base/stl_util.h" -#include "base/strings/string16.h" -#include "base/strings/string_number_conversions.h" -#include "base/win/scoped_handle.h" -#include "base/win/win_util.h" -#include "base/win/windows_version.h" -#include "chrome/installer/util/delete_after_reboot_helper.h" -#include "chrome/credential_provider/gaiacp/gcp_utils.h" -#include "chrome/credential_provider/gaiacp/logging.h" - -namespace credential_provider { - -namespace { - -constexpr base::FilePath::CharType kCredentialProviderDll[] = - FILE_PATH_LITERAL("Gaia1_0.dll"); - -// List of files to install. If the file list is changed here, make sure to -// update the files added in make_setup.py. -constexpr const base::FilePath::CharType* kFilenames[] = { - FILE_PATH_LITERAL("gcp_setup.exe"), - FILE_PATH_LITERAL("gcp_eventlog_provider.dll"), - kCredentialProviderDll, // Base name to the CP dll. -}; - -// List of dlls to register. Must be a subset of kFilenames. -constexpr const base::FilePath::CharType* kRegsiterDlls[] = { - kCredentialProviderDll, -}; - -// Creates the directory where GCP is to be installed. -base::FilePath CreateInstallDirectory() { - base::FilePath dest_path; - if (!base::PathService::Get(base::DIR_PROGRAM_FILES, &dest_path)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "PathService::Get(DIR_PROGRAM_FILES) hr=" << putHR(hr); - return base::FilePath(); - } - - dest_path = dest_path.Append(FILE_PATH_LITERAL("Google")) - .Append(FILE_PATH_LITERAL("Credential Provider")); - - if (!base::CreateDirectory(dest_path)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "base::CreateDirectory hr=" << putHR(hr); - return base::FilePath(); - } - - return dest_path; -} - -// Copies the files specified in |names| from |src_path| to |dest_path| creating -// any intermedidate subdirectories of |dest_path| as needed. Both |src_path| -// and |dest_path| are full paths. |names| are paths relative to |src_path| -// and are copied to the same relative path under |dest_path|. -HRESULT InstallFiles(const base::FilePath& src_path, - const base::FilePath& dest_path, - const base::FilePath::CharType* const names[], - size_t length) { - for (size_t i = 0; i < length; ++i) { - base::FilePath src = src_path.Append(names[i]); - base::FilePath dest = dest_path.Append(names[i]); - - // Make sure parent of destination file exists. - if (!base::CreateDirectory(dest.DirName())) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "CreateDirectory hr=" << putHR(hr) - << " name=" << names[i]; - return hr; - } - - if (!base::CopyFile(src, dest)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "CopyFile hr=" << putHR(hr) << " name=" << names[i]; - return hr; - } - LOGFN(INFO) << "Installed name=" << names[i]; - } - - return S_OK; -} - -// Registers the named DLLs by calling the DllRegisterServer entrypoint. The -// DLLs are specified with the |names| argument which are paths relative to -// |dest_path|. |fakes| is non-null during unit tests to install fakes into -// the loaded DLL. -HRESULT RegisterDlls(const base::FilePath& dest_path, - const base::FilePath::CharType* const names[], - size_t length, - FakesForTesting* fakes) { - bool has_failures = false; - - for (size_t i = 0; i < length; ++i) { - base::ScopedNativeLibrary library(dest_path.Append(names[i])); - - if (fakes) { - SetFakesForTestingFn set_fakes_for_testing_fn = - reinterpret_cast<SetFakesForTestingFn>( - library.GetFunctionPointer("SetFakesForTesting")); - if (set_fakes_for_testing_fn) - (*set_fakes_for_testing_fn)(fakes); - } - - FARPROC register_server_fn = reinterpret_cast<FARPROC>( - library.GetFunctionPointer("DllRegisterServer")); - HRESULT hr = S_OK; - - if (register_server_fn) { - hr = static_cast<HRESULT>((*register_server_fn)()); - LOGFN(INFO) << "Registered name=" << names[i] << " hr=" << putHR(hr); - } else { - LOGFN(ERROR) << "Failed to register name=" << names[i]; - hr = E_NOTIMPL; - } - has_failures |= FAILED(hr); - } - - return has_failures ? E_UNEXPECTED : S_OK; -} - -// Unregisters the named DLLs by calling the DllUneegisterServer entrypoint. -// The DLLs are specified with the |names| argument which are paths relative to -// |dest_path|. |fakes| is non-null during unit tests to install fakes into -// the loaded DLL. -HRESULT UnregisterDlls(const base::FilePath& dest_path, - const base::FilePath::CharType* const names[], - size_t length, - FakesForTesting* fakes) { - bool has_failures = false; - - for (size_t i = 0; i < length; ++i) { - base::ScopedNativeLibrary library(dest_path.Append(names[i])); - - if (fakes) { - SetFakesForTestingFn pmfn = reinterpret_cast<SetFakesForTestingFn>( - library.GetFunctionPointer("SetFakesForTesting")); - if (pmfn) - (*pmfn)(fakes); - } - - FARPROC pfn = reinterpret_cast<FARPROC>( - library.GetFunctionPointer("DllUnregisterServer")); - HRESULT hr = pfn ? static_cast<HRESULT>((*pfn)()) : E_UNEXPECTED; - LOGFN(INFO) << "Unregistered name=" << names[i] << " hr=" << putHR(hr); - has_failures |= FAILED(hr); - } - - return has_failures ? E_UNEXPECTED : S_OK; -} - -// Opens |path| with options that prevent the file from being read or written -// via another handle. As long as the returned object is alive, it is guaranteed -// that |path| isn't in use. It can however be deleted. -base::File GetFileLock(const base::FilePath& path) { - return base::File(path, base::File::FLAG_OPEN | base::File::FLAG_READ | - base::File::FLAG_EXCLUSIVE_READ | - base::File::FLAG_EXCLUSIVE_WRITE | - base::File::FLAG_SHARE_DELETE); -} - -// Deletes a specific GCP version from the disk. -void DeleteVersionDirectory(const base::FilePath& version_path) { - // Lock all exes and dlls for exclusive access while allowing deletes. Mark - // the files for deletion and release them, causing them to actually be - // deleted. This allows the deletion of the version path itself. - std::vector<base::File> locks; - const int types = base::FileEnumerator::FILES; - base::FileEnumerator enumerator_version(version_path, false, types, - FILE_PATH_LITERAL("*")); - bool all_deletes_succeeded = true; - for (base::FilePath path = enumerator_version.Next(); !path.empty(); - path = enumerator_version.Next()) { - if (!path.MatchesExtension(FILE_PATH_LITERAL(".exe")) && - !path.MatchesExtension(FILE_PATH_LITERAL(".dll"))) { - continue; - } - - // Open the file for exclusive access while allowing deletes. - locks.push_back(GetFileLock(path)); - if (!locks.back().IsValid()) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "Could not lock " << path << " hr=" << putHR(hr); - all_deletes_succeeded = false; - continue; - } - - // Mark the file for deletion. - HRESULT hr = base::DeleteFile(path, false); - if (FAILED(hr)) { - LOGFN(ERROR) << "Could not delete " << path; - all_deletes_succeeded = false; - } - } - - // Release the locks, actually deleting the files. It is now possible to - // delete the version path. - locks.clear(); - if (all_deletes_succeeded && !base::DeleteFile(version_path, true)) - LOGFN(ERROR) << "Could not delete version " << version_path.BaseName(); -} - -// Deletes versions of GCP found under |gcp_path| except for version -// |product_version|. -// -// TODO(crbug.com/883935): figure out how to call this from credential provider -// code too. That way if older versions cannot be deleted at install time, they -// can eventually be cleaned up at next run. -void DeleteVersionsExcept(const base::FilePath& gcp_path, - const base::string16& product_version) { - base::FilePath version = base::FilePath(product_version); - const int types = base::FileEnumerator::DIRECTORIES; - base::FileEnumerator enumerator(gcp_path, false, types, - FILE_PATH_LITERAL("*")); - for (base::FilePath name = enumerator.Next(); !name.empty(); - name = enumerator.Next()) { - base::FilePath basename = name.BaseName(); - if (version == basename) - continue; - - // Found an older version on the machine that can be deleted. This is - // best effort only. If any errors occurred they are logged by - // DeleteVersionDirectory(). - DeleteVersionDirectory(gcp_path.Append(basename)); - } -} - -} // namespace - -namespace switches { - -// These are command line switches to the setup program. - -// Indicates the handle of the parent setup process when setup relaunches itself -// during uninstall. -const char kParentHandle[] = "parent-handle"; - -// Indicates the full path to the GCP installation to delete. This switch is -// only used during uninstall. -const char kInstallPath[] = "install-path"; - -// Indicates to setup that it is being run to inunstall GCP. If this switch -// is not present the assumption is to install GCP. -const char kUninstall[] = "uninstall"; - -} // namespace switches - -HRESULT DoInstall(const base::FilePath& installer_path, - const base::string16& product_version, - FakesForTesting* fakes) { - const base::FilePath gcp_path = CreateInstallDirectory(); - if (gcp_path.empty()) - return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); - - base::FilePath dest_path = gcp_path.Append(product_version); - LOGFN(INFO) << "Install to: " << dest_path; - - // Make sure nothing under the destination directory is pending delete - // after reboot, so that files installed now won't get deleted later. - if (!RemoveFromMovesPendingReboot(dest_path)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "RemoveFromMovesPendingReboot hr=" << putHR(hr); - return hr; - } - - base::FilePath src_path = installer_path.DirName(); - HRESULT hr = - InstallFiles(src_path, dest_path, kFilenames, base::size(kFilenames)); - if (FAILED(hr)) - return hr; - - hr = RegisterDlls(dest_path, kRegsiterDlls, base::size(kRegsiterDlls), fakes); - if (FAILED(hr)) - return hr; - - // If all is good, try to delete all other versions on best effort basis. - if (SUCCEEDED(hr)) - DeleteVersionsExcept(gcp_path, product_version); - - return S_OK; -} - -HRESULT DoUninstall(const base::FilePath& installer_path, - const base::FilePath& dest_path, - FakesForTesting* fakes) { - bool has_failures = false; - - // Do all actions best effort and keep going. - has_failures |= FAILED(UnregisterDlls(dest_path, kRegsiterDlls, - base::size(kRegsiterDlls), fakes)); - - // Delete all files in the destination directory. This directory does not - // contain any configuration files or anything else user generated. - if (!base::DeleteFile(dest_path, true)) { - has_failures = true; - ScheduleDirectoryForDeletion(dest_path); - } - - // |dest_path| is of the form %ProgramFile%\Google\GCP\VERSION. Now try to - // delete the parent directory if possible. - if (base::IsDirectoryEmpty(dest_path.DirName())) - has_failures |= !base::DeleteFile(dest_path.DirName(), false); - - // TODO(rogerta): ask user to reboot if anything went wrong during uninstall. - - return has_failures ? E_UNEXPECTED : S_OK; -} - -HRESULT RelaunchUninstaller(const base::FilePath& installer_path) { - base::FilePath temp_path; - if (!base::CreateNewTempDirectory(FILE_PATH_LITERAL("gcp"), &temp_path)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "CreateNewTempDirectory hr=" << putHR(hr); - return hr; - } - - base::FilePath new_installer_path = - temp_path.Append(installer_path.BaseName()); - - if (!base::CopyFile(installer_path, new_installer_path)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "Could not copy uninstaller hr=" << putHR(hr) << " '" - << installer_path << "' --> '" << new_installer_path << "'"; - return hr; - } - - base::win::ScopedHandle::Handle this_process_handle_handle; - if (!::DuplicateHandle(GetCurrentProcess(), GetCurrentProcess(), - GetCurrentProcess(), &this_process_handle_handle, 0, - TRUE, // Inheritable. - DUPLICATE_SAME_ACCESS)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - LOGFN(ERROR) << "Error duplicating parent process handle."; - return hr; - } - base::win::ScopedHandle this_process_handle(this_process_handle_handle); - - LOGFN(INFO) << "This process handle: " << this_process_handle_handle; - - base::CommandLine cmdline(new_installer_path); - cmdline.AppendSwitch(switches::kUninstall); - cmdline.AppendSwitchPath(switches::kInstallPath, installer_path.DirName()); - cmdline.AppendSwitchNative(switches::kParentHandle, - base::NumberToString16(base::win::HandleToUint32( - this_process_handle_handle))); - - LOGFN(INFO) << "Cmd: " << cmdline.GetCommandLineString(); - - base::LaunchOptions options; - options.handles_to_inherit.push_back(this_process_handle_handle); - options.current_directory = temp_path; - base::Process process(base::LaunchProcess(cmdline, options)); - - return process.IsValid() ? S_OK : E_FAIL; -} - -void GetInstalledFileBasenames(const base::FilePath::CharType* const** names, - size_t* count) { - *names = kFilenames; - *count = base::size(kFilenames); -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/setup/setup_lib.h b/chrome/credential_provider/setup/setup_lib.h deleted file mode 100644 index b578537..0000000 --- a/chrome/credential_provider/setup/setup_lib.h +++ /dev/null
@@ -1,56 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_SETUP_SETUP_LIB_H_ -#define CHROME_CREDENTIAL_PROVIDER_SETUP_SETUP_LIB_H_ - -#include "base/files/file_path.h" -#include "base/strings/string16.h" -#include "base/win/windows_types.h" - -namespace base { -class FilePath; -} // namespace base - -namespace credential_provider { - -struct FakesForTesting; - -// Define command line swtiches for setup. - -namespace switches { - -extern const char kParentHandle[]; -extern const char kInstallPath[]; -extern const char kUninstall[]; - -} // namespace switches - -// Does a full install of GCP. |installer_path| is the full path to the -// installer exe and |product_version| is the version of GCP being installed. -HRESULT DoInstall(const base::FilePath& installer_path, - const base::string16& product_version, - FakesForTesting* fakes); - -// Does a full uninstall of GCP. |installer_path| is the full path to the -// installer exe, |dest_path| is the directory containing the GCP to uninstall. -HRESULT DoUninstall(const base::FilePath& installer_path, - const base::FilePath& dest_path, - FakesForTesting* fakes); - -// Relaunches the installer at |installer_path| in a new process, telling it to -// uninstall GCP from the parent directory of |installer_path|. This function -// returns immediately and does not wait for the new process to complete. -// This new process will wait for this one to exit before continuing so that -// files are not locked and can be deleted correctly. -HRESULT RelaunchUninstaller(const base::FilePath& installer_path); - -// Returns the basenames of the files that are installed by setup. This is -// used in tests to validate that files are correctly installed. -void GetInstalledFileBasenames(const base::FilePath::CharType* const** names, - size_t* count); - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_SETUP_SETUP_LIB_H_
diff --git a/chrome/credential_provider/test/BUILD.gn b/chrome/credential_provider/test/BUILD.gn deleted file mode 100644 index 4a44020..0000000 --- a/chrome/credential_provider/test/BUILD.gn +++ /dev/null
@@ -1,32 +0,0 @@ -# Copyright 2018 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("//testing/test.gni") - -test("gcp_unittests") { - sources = [ - "../gaiacp/gaia_credential_provider_unittests.cc", - "../gaiacp/gaia_credential_unittests.cc", - "../gaiacp/gcp_utils_unittests.cc", - "../gaiacp/reauth_credential_unittests.cc", - "com_fakes.cc", - "com_fakes.h", - "gcp_fakes.cc", - "gcp_fakes.h", - "gcp_setup_unittests.cc", - "gcp_test_main.cc", - ] - - deps = [ - "../eventlog:gcp_eventlog_provider", - "../gaiacp:common", - "../gaiacp:gaiacp_lib", - "../gaiacp:version", - "../setup:common", - "//base", - "//net:test_support", - "//testing/gmock", - "//testing/gtest", - ] -}
diff --git a/chrome/credential_provider/test/com_fakes.cc b/chrome/credential_provider/test/com_fakes.cc deleted file mode 100644 index 8192ebb..0000000 --- a/chrome/credential_provider/test/com_fakes.cc +++ /dev/null
@@ -1,120 +0,0 @@ -// Copyright 2018 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/credential_provider/gaiacp/stdafx.h" -#include "chrome/credential_provider/test/com_fakes.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace credential_provider { - -#define IMPL_IUNKOWN_NOQI_NOREF(cls) \ - IFACEMETHODIMP cls::QueryInterface(REFIID riid, void** ppv) { \ - return E_NOTIMPL; \ - } \ - ULONG cls::AddRef() { return 0; } \ - ULONG cls::Release(void) { return 0; } - -/////////////////////////////////////////////////////////////////////////////// - -FakeCredentialProviderUser::FakeCredentialProviderUser(const wchar_t* sid, - const wchar_t* username) - : sid_(sid), username_(username) {} - -FakeCredentialProviderUser::~FakeCredentialProviderUser() {} - -HRESULT STDMETHODCALLTYPE FakeCredentialProviderUser::GetSid(wchar_t** sid) { - DWORD length = sid_.length() + 1; - *sid = static_cast<wchar_t*>(::CoTaskMemAlloc(length * sizeof(wchar_t))); - EXPECT_EQ(0, wcscpy_s(*sid, length, sid_.c_str())); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE -FakeCredentialProviderUser::GetProviderID(GUID* providerID) { - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE -FakeCredentialProviderUser::GetStringValue(REFPROPERTYKEY key, - wchar_t** value) { - if (key != PKEY_Identity_UserName) - return E_INVALIDARG; - - DWORD length = username_.length() + 1; - *value = - static_cast<wchar_t*>(::CoTaskMemAlloc(length * sizeof(wchar_t))); - EXPECT_EQ(0, wcscpy_s(*value, length, username_.c_str())); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE -FakeCredentialProviderUser::GetValue(REFPROPERTYKEY key, PROPVARIANT* value) { - return E_NOTIMPL; -} - -IMPL_IUNKOWN_NOQI_NOREF(FakeCredentialProviderUser); - -/////////////////////////////////////////////////////////////////////////////// - -FakeCredentialProviderUserArray::FakeCredentialProviderUserArray() {} - -FakeCredentialProviderUserArray::~FakeCredentialProviderUserArray() {} - -HRESULT FakeCredentialProviderUserArray::SetProviderFilter( - REFGUID guidProviderToFilterTo) { - return S_OK; -} - -HRESULT FakeCredentialProviderUserArray::GetAccountOptions( - CREDENTIAL_PROVIDER_ACCOUNT_OPTIONS* credentialProviderAccountOptions) { - return E_NOTIMPL; -} - -HRESULT FakeCredentialProviderUserArray::GetCount(DWORD* count) { - *count = users_.size(); - return S_OK; -} - -HRESULT FakeCredentialProviderUserArray::GetAt(DWORD index, - ICredentialProviderUser** user) { - EXPECT_LT(index, users_.size()); - *user = &users_[index]; - return S_OK; -} - -IMPL_IUNKOWN_NOQI_NOREF(FakeCredentialProviderUserArray); - -/////////////////////////////////////////////////////////////////////////////// - -FakeCredentialProviderEvents::FakeCredentialProviderEvents() {} - -FakeCredentialProviderEvents::~FakeCredentialProviderEvents() {} - -HRESULT FakeCredentialProviderEvents::CredentialsChanged( - UINT_PTR upAdviseContext) { - did_change_ = true; - return S_OK; -} - -IMPL_IUNKOWN_NOQI_NOREF(FakeCredentialProviderEvents); - -/////////////////////////////////////////////////////////////////////////////// - -FakeGaiaCredentialProvider::FakeGaiaCredentialProvider() {} - -FakeGaiaCredentialProvider::~FakeGaiaCredentialProvider() {} - -HRESULT FakeGaiaCredentialProvider::OnUserAuthenticated(IUnknown* credential, - BSTR username, - BSTR password, - BSTR sid) { - username_ = username; - password_ = password; - sid_ = sid; - return S_OK; -} - -IMPL_IUNKOWN_NOQI_NOREF(FakeGaiaCredentialProvider); - -} // namespace credential_provider
diff --git a/chrome/credential_provider/test/com_fakes.h b/chrome/credential_provider/test/com_fakes.h deleted file mode 100644 index 9ac24aa..0000000 --- a/chrome/credential_provider/test/com_fakes.h +++ /dev/null
@@ -1,117 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_TEST_COM_FAKES_H_ -#define CHROME_CREDENTIAL_PROVIDER_TEST_COM_FAKES_H_ - -#include <atlcomcli.h> -#include <credentialprovider.h> -#include <propkey.h> - -#include <vector> - -#include "base/strings/string16.h" -#include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h" - -namespace credential_provider { - -/////////////////////////////////////////////////////////////////////////////// - -// Fake the CredentialProviderUserArray COM object. -class FakeCredentialProviderUser : public ICredentialProviderUser { - public: - FakeCredentialProviderUser(const wchar_t* sid, const wchar_t* username); - virtual ~FakeCredentialProviderUser(); - - private: - // ICredentialProviderUser - IFACEMETHODIMP QueryInterface(REFIID riid, void** ppv) override; - ULONG STDMETHODCALLTYPE AddRef() override; - ULONG STDMETHODCALLTYPE Release(void) override; - HRESULT STDMETHODCALLTYPE GetSid(wchar_t** sid) override; - HRESULT STDMETHODCALLTYPE GetProviderID(GUID* providerID) override; - HRESULT STDMETHODCALLTYPE GetStringValue(REFPROPERTYKEY key, - wchar_t** stringValue) override; - HRESULT STDMETHODCALLTYPE GetValue(REFPROPERTYKEY key, - PROPVARIANT* value) override; - - base::string16 sid_; - base::string16 username_; -}; - -/////////////////////////////////////////////////////////////////////////////// - -// Fake the CredentialProviderUserArray COM object. -class FakeCredentialProviderUserArray : public ICredentialProviderUserArray { - public: - FakeCredentialProviderUserArray(); - virtual ~FakeCredentialProviderUserArray(); - - void AddUser(const wchar_t* sid, const wchar_t* username) { - users_.emplace_back(sid, username); - } - - private: - // ICredentialProviderUserArray - IFACEMETHODIMP QueryInterface(REFIID riid, void** ppv) override; - ULONG STDMETHODCALLTYPE AddRef() override; - ULONG STDMETHODCALLTYPE Release(void) override; - IFACEMETHODIMP SetProviderFilter(REFGUID guidProviderToFilterTo) override; - IFACEMETHODIMP GetAccountOptions( - CREDENTIAL_PROVIDER_ACCOUNT_OPTIONS* credentialProviderAccountOptions) - override; - IFACEMETHODIMP GetCount(DWORD* userCount) override; - IFACEMETHODIMP GetAt(DWORD index, ICredentialProviderUser** user) override; - - std::vector<FakeCredentialProviderUser> users_; -}; - -/////////////////////////////////////////////////////////////////////////////// - -// Fake OS imlpementation of ICredentialProviderEvents. -class FakeCredentialProviderEvents : public ICredentialProviderEvents { - public: - FakeCredentialProviderEvents(); - virtual ~FakeCredentialProviderEvents(); - - // ICredentialProviderEvents - IFACEMETHODIMP QueryInterface(REFIID riid, void** ppv) override; - ULONG STDMETHODCALLTYPE AddRef() override; - ULONG STDMETHODCALLTYPE Release(void) override; - IFACEMETHODIMP CredentialsChanged(UINT_PTR upAdviseContext) override; - - private: - bool did_change_ = false; -}; - -/////////////////////////////////////////////////////////////////////////////// - -// Fake the GaiaCredentialProvider COM object. -class FakeGaiaCredentialProvider : public IGaiaCredentialProvider { - public: - FakeGaiaCredentialProvider(); - virtual ~FakeGaiaCredentialProvider(); - - const CComBSTR& username() const { return username_; } - const CComBSTR& password() const { return password_; } - const CComBSTR& sid() const { return sid_; } - - private: - // IGaiaCredentialProvider - IFACEMETHODIMP QueryInterface(REFIID riid, void** ppv) override; - ULONG STDMETHODCALLTYPE AddRef() override; - ULONG STDMETHODCALLTYPE Release(void) override; - IFACEMETHODIMP OnUserAuthenticated(IUnknown* credential, - BSTR username, - BSTR password, - BSTR sid) override; - - CComBSTR username_; - CComBSTR password_; - CComBSTR sid_; -}; - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_TEST_COM_FAKES_H_
diff --git a/chrome/credential_provider/test/gcp_fakes.cc b/chrome/credential_provider/test/gcp_fakes.cc deleted file mode 100644 index 5979bd40..0000000 --- a/chrome/credential_provider/test/gcp_fakes.cc +++ /dev/null
@@ -1,367 +0,0 @@ -// Copyright 2018 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/credential_provider/test/gcp_fakes.h" - -#include <windows.h> -#include <lm.h> -#include <sddl.h> - -#include <atlconv.h> - -#include "base/bind.h" -#include "base/command_line.h" -#include "base/files/file_path.h" -#include "base/win/scoped_process_information.h" -#include "chrome/credential_provider/gaiacp/logging.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace credential_provider { - -namespace { - -HRESULT CreateArbitrarySid(DWORD subauth0, PSID* sid) { - SID_IDENTIFIER_AUTHORITY Authority = {SECURITY_NON_UNIQUE_AUTHORITY}; - if (!::AllocateAndInitializeSid(&Authority, 1, subauth0, 0, 0, 0, 0, 0, - 0, 0, sid)) { - return(HRESULT_FROM_WIN32(::GetLastError())); - } - return S_OK; -} - -} // namespace - -/////////////////////////////////////////////////////////////////////////////// - -FakeOSProcessManager::FakeOSProcessManager() - : original_manager_(*GetInstanceStorage()) { - *GetInstanceStorage() = this; -} - -FakeOSProcessManager::~FakeOSProcessManager() { - *GetInstanceStorage() = original_manager_; -} - -HRESULT FakeOSProcessManager::CreateLogonToken(const wchar_t* username, - const wchar_t* password, - base::win::ScopedHandle* token) { - // Setting a non-null value for the token. The value won't be used for - // anything except to check for the magic number. - token->Set(reinterpret_cast<base::win::ScopedHandle::Handle>(this)); - return S_OK; -} - -HRESULT FakeOSProcessManager::GetTokenLogonSID( - const base::win::ScopedHandle& token, - PSID* sid) { - // Make sure the handle has been created by CreateLogonToken(). - if (token.Get() != reinterpret_cast<base::win::ScopedHandle::Handle>(this)) - return E_INVALIDARG; - - return CreateArbitrarySid(++next_rid_, sid); -} - -HRESULT FakeOSProcessManager::SetupPermissionsForLogonSid(PSID sid) { - // Ignore. - return S_OK; -} - -HRESULT FakeOSProcessManager::CreateProcessWithToken( - const base::win::ScopedHandle& logon_token, - const base::CommandLine& command_line, - _STARTUPINFOW* startupinfo, - base::win::ScopedProcessInformation* procinfo) { - // Ignore the logon token and create a process as the current user. - PROCESS_INFORMATION new_procinfo = {}; - // Pass a copy of the command line string to CreateProcessW() because this - // function could change the string. - std::unique_ptr<wchar_t, void (*)(void*)> - cmdline(_wcsdup(command_line.GetCommandLineString().c_str()), std::free); - if (!::CreateProcessW(command_line.GetProgram().value().c_str(), - cmdline.get(), - nullptr, nullptr, TRUE, CREATE_SUSPENDED, nullptr, - nullptr, startupinfo, &new_procinfo)) { - HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); - return hr; - } - procinfo->Set(new_procinfo); - return S_OK; -} - -/////////////////////////////////////////////////////////////////////////////// - -FakeOSUserManager::FakeOSUserManager() - : original_manager_(*GetInstanceStorage()) { - *GetInstanceStorage() = this; -} - -FakeOSUserManager::~FakeOSUserManager() { - *GetInstanceStorage() = original_manager_; -} - -HRESULT FakeOSUserManager::GenerateRandomPassword(wchar_t* password, - int length) { - if (length < kMinPasswordLength) - return E_INVALIDARG; - - // Make sure to generate a different password each time. Actually randomness - // is not important for tests. - static int nonce = 0; - EXPECT_NE(-1, swprintf_s(password, length, L"bad-password-%d", ++nonce)); - return S_OK; -} - -HRESULT FakeOSUserManager::AddUser(const wchar_t* username, - const wchar_t* password, - const wchar_t* fullname, - const wchar_t* comment, - bool add_to_users_group, - BSTR* sid, - DWORD* error) { - if (error) - *error = 0; - - bool user_found = username_to_info_.count(username) > 0; - - if (user_found) { - // If adding the special "gaia" account, and if the error is "user already - // exists", consider this is a success. Otherwise the user is not allowed - // to exist already. !add_to_users_group means special "gaia" account. - if (!add_to_users_group) { - *sid = ::SysAllocString(W2COLE(username_to_info_[username].sid.c_str())); - } else { - *sid = nullptr; - } - - return HRESULT_FROM_WIN32(NERR_UserExists); - } - - PSID psid = nullptr; - HRESULT hr = FakeOSUserManager::CreateNewSID(&psid); - if (FAILED(hr)) - return hr; - - wchar_t* sidstr = nullptr; - bool ok = ::ConvertSidToStringSid(psid, &sidstr); - ::FreeSid(psid); - if (!ok) { - *sid = nullptr; - return HRESULT_FROM_WIN32(NERR_ProgNeedsExtraMem); - } - - *sid = ::SysAllocString(W2COLE(sidstr)); - username_to_info_.emplace(username, - UserInfo(password, fullname, comment, sidstr)); - ::LocalFree(sidstr); - - return S_OK; -} - -HRESULT FakeOSUserManager::SetUserPassword(const wchar_t* username, - const wchar_t* password, - DWORD* error) { - if (error) - *error = 0; - - if (username_to_info_.count(username) > 0) { - username_to_info_[username].password = password; - return S_OK; - } - - return HRESULT_FROM_WIN32(NERR_UserNotFound); -} - -HRESULT FakeOSUserManager::GetUserSID(const wchar_t* username, PSID* sid) { - if (username_to_info_.count(username) > 0) { - if (!::ConvertStringSidToSid(username_to_info_[username].sid.c_str(), sid)) - return HRESULT_FROM_WIN32(NERR_ProgNeedsExtraMem); - - return S_OK; - } - - return HRESULT_FROM_WIN32(NERR_UserNotFound); -} - -HRESULT FakeOSUserManager::FindUserBySID(const wchar_t* sid) { - for (auto& kv : username_to_info_) { - if (kv.second.sid == sid) - return S_OK; - } - - return HRESULT_FROM_WIN32(ERROR_NONE_MAPPED); -} - -HRESULT FakeOSUserManager::RemoveUser(const wchar_t* username, - const wchar_t* password) { - username_to_info_.erase(username); - return S_OK; -} - -FakeOSUserManager::UserInfo::UserInfo(const wchar_t* password, - const wchar_t* fullname, - const wchar_t* comment, - const wchar_t* sid) - : password(password), fullname(fullname), comment(comment), sid(sid) {} - -FakeOSUserManager::UserInfo::UserInfo() {} - -FakeOSUserManager::UserInfo::UserInfo(const UserInfo& other) = default; - -FakeOSUserManager::UserInfo::~UserInfo() {} - -bool FakeOSUserManager::UserInfo::operator==(const UserInfo& other) const { - return password == other.password && fullname == other.fullname && - comment == other.comment && sid == other.sid; -} - -const FakeOSUserManager::UserInfo FakeOSUserManager::GetUserInfo( - const wchar_t* username) { - return (username_to_info_.count(username) > 0) ? username_to_info_[username] - : UserInfo(); -} - -HRESULT FakeOSUserManager::CreateNewSID(PSID* sid) { - return CreateArbitrarySid(++next_rid_, sid); -} - -/////////////////////////////////////////////////////////////////////////////// - -FakeScopedLsaPolicyFactory::FakeScopedLsaPolicyFactory() - : original_creator_(*ScopedLsaPolicy::GetCreatorCallbackStorage()) { - *ScopedLsaPolicy::GetCreatorCallbackStorage() = GetCreatorCallback(); -} - -FakeScopedLsaPolicyFactory::~FakeScopedLsaPolicyFactory() { - *ScopedLsaPolicy::GetCreatorCallbackStorage() = original_creator_; -} - -ScopedLsaPolicy::CreatorCallback -FakeScopedLsaPolicyFactory::GetCreatorCallback() { - return base::BindRepeating(&FakeScopedLsaPolicyFactory::Create, - base::Unretained(this)); -} - -std::unique_ptr<ScopedLsaPolicy> FakeScopedLsaPolicyFactory::Create( - ACCESS_MASK mask) { - return std::unique_ptr<ScopedLsaPolicy>(new FakeScopedLsaPolicy(this)); -} - -FakeScopedLsaPolicy::FakeScopedLsaPolicy(FakeScopedLsaPolicyFactory* factory) - : ScopedLsaPolicy(STANDARD_RIGHTS_READ), factory_(factory) { - // The base class ctor will fail to initialize because these tests are not - // running elevated. That's OK, everything is faked out anyway. -} - -FakeScopedLsaPolicy::~FakeScopedLsaPolicy() {} - -HRESULT FakeScopedLsaPolicy::StorePrivateData(const wchar_t* key, - const wchar_t* value) { - private_data()[key] = value; - return S_OK; -} - -HRESULT FakeScopedLsaPolicy::RemovePrivateData(const wchar_t* key) { - private_data().erase(key); - return S_OK; -} - -HRESULT FakeScopedLsaPolicy::RetrievePrivateData(const wchar_t* key, - wchar_t* value, - size_t length) { - if (private_data().count(key) == 0) - return E_INVALIDARG; - - errno_t err = wcscpy_s(value, length, private_data()[key].c_str()); - if (err != 0) - return E_FAIL; - - return S_OK; -} - -HRESULT FakeScopedLsaPolicy::AddAccountRights(PSID sid, const wchar_t* right) { - return S_OK; -} - -HRESULT FakeScopedLsaPolicy::RemoveAccount(PSID sid) { - return S_OK; -} - -/////////////////////////////////////////////////////////////////////////////// - -FakeScopedUserProfileFactory::FakeScopedUserProfileFactory() - : original_creator_(*ScopedUserProfile::GetCreatorFunctionStorage()) { - *ScopedUserProfile::GetCreatorFunctionStorage() = base::BindRepeating( - &FakeScopedUserProfileFactory::Create, base::Unretained(this)); -} - -FakeScopedUserProfileFactory::~FakeScopedUserProfileFactory() { - *ScopedUserProfile::GetCreatorFunctionStorage() = original_creator_; -} - -std::unique_ptr<ScopedUserProfile> FakeScopedUserProfileFactory::Create( - const base::string16& sid, - const base::string16& username, - const base::string16& password) { - return std::unique_ptr<ScopedUserProfile>( - new FakeScopedUserProfile(sid, username, password)); -} - -FakeScopedUserProfile::FakeScopedUserProfile(const base::string16& sid, - const base::string16& username, - const base::string16& password) {} - -FakeScopedUserProfile::~FakeScopedUserProfile() {} - -/////////////////////////////////////////////////////////////////////////////// - -FakeWinHttpUrlFetcherFactory::FakeWinHttpUrlFetcherFactory() - : original_creator_(*WinHttpUrlFetcher::GetCreatorFunctionStorage()) { - *WinHttpUrlFetcher::GetCreatorFunctionStorage() = base::BindRepeating( - &FakeWinHttpUrlFetcherFactory::Create, base::Unretained(this)); -} - -FakeWinHttpUrlFetcherFactory::~FakeWinHttpUrlFetcherFactory() { - *WinHttpUrlFetcher::GetCreatorFunctionStorage() = original_creator_; -} - -void FakeWinHttpUrlFetcherFactory::SetFakeResponse( - const GURL& url, - const WinHttpUrlFetcher::Headers& headers, - const std::string& response) { - fake_responses_.emplace(url, std::make_pair(headers, response)); -} - -std::unique_ptr<WinHttpUrlFetcher> FakeWinHttpUrlFetcherFactory::Create( - const GURL& url) { - if (fake_responses_.count(url) == 0) - return nullptr; - - const Response& response = fake_responses_[url]; - - FakeWinHttpUrlFetcher* fetcher = new FakeWinHttpUrlFetcher(std::move(url)); - fetcher->response_headers_ = response.first; - fetcher->response_ = response.second; - return std::unique_ptr<WinHttpUrlFetcher>(fetcher); -} - -FakeWinHttpUrlFetcher::FakeWinHttpUrlFetcher(const GURL& url) - : WinHttpUrlFetcher() {} - -FakeWinHttpUrlFetcher::~FakeWinHttpUrlFetcher() {} - -// WinHttpUrlFetcher -bool FakeWinHttpUrlFetcher::IsValid() const { - return true; -} - -HRESULT FakeWinHttpUrlFetcher::Fetch(std::string* response) { - response->assign(response_); - return S_OK; -} - -HRESULT FakeWinHttpUrlFetcher::Close() { - return S_OK; -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/test/gcp_fakes.h b/chrome/credential_provider/test/gcp_fakes.h deleted file mode 100644 index f4ec1ca..0000000 --- a/chrome/credential_provider/test/gcp_fakes.h +++ /dev/null
@@ -1,213 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_CREDENTIAL_PROVIDER_TEST_GCP_FAKES_H_ -#define CHROME_CREDENTIAL_PROVIDER_TEST_GCP_FAKES_H_ - -#include <map> - -#include "base/strings/string16.h" -#include "chrome/credential_provider/gaiacp/os_process_manager.h" -#include "chrome/credential_provider/gaiacp/os_user_manager.h" -#include "chrome/credential_provider/gaiacp/scoped_lsa_policy.h" -#include "chrome/credential_provider/gaiacp/scoped_user_profile.h" -#include "chrome/credential_provider/gaiacp/win_http_url_fetcher.h" - -namespace credential_provider { - -/////////////////////////////////////////////////////////////////////////////// - -class FakeOSProcessManager : public OSProcessManager { - public: - FakeOSProcessManager(); - ~FakeOSProcessManager() override; - - // OSProcessManager - HRESULT CreateLogonToken(const wchar_t* username, - const wchar_t* password, - base::win::ScopedHandle* token) override; - HRESULT GetTokenLogonSID(const base::win::ScopedHandle& token, - PSID* sid) override; - HRESULT SetupPermissionsForLogonSid(PSID sid) override; - HRESULT CreateProcessWithToken( - const base::win::ScopedHandle& logon_token, - const base::CommandLine& command_line, - _STARTUPINFOW* startupinfo, - base::win::ScopedProcessInformation* procinfo) override; - - private: - OSProcessManager* original_manager_; - DWORD next_rid_ = 0; -}; - -/////////////////////////////////////////////////////////////////////////////// - -class FakeOSUserManager : public OSUserManager { - public: - FakeOSUserManager(); - ~FakeOSUserManager() override; - - // OSUserManager - HRESULT GenerateRandomPassword(wchar_t* password, int length) override; - HRESULT AddUser(const wchar_t* username, - const wchar_t* password, - const wchar_t* fullname, - const wchar_t* comment, - bool add_to_users_group, - BSTR* sid, - DWORD* error) override; - HRESULT SetUserPassword(const wchar_t* username, - const wchar_t* password, - DWORD* error) override; - HRESULT GetUserSID(const wchar_t* username, PSID* sid) override; - HRESULT FindUserBySID(const wchar_t* sid) override; - HRESULT RemoveUser(const wchar_t* username, const wchar_t* password) override; - - struct UserInfo { - UserInfo(const wchar_t* password, - const wchar_t* fullname, - const wchar_t* comment, - const wchar_t* sid); - UserInfo(); - UserInfo(const UserInfo& other); - ~UserInfo(); - - bool operator==(const UserInfo& other) const; - - base::string16 password; - base::string16 fullname; - base::string16 comment; - base::string16 sid; - }; - const UserInfo GetUserInfo(const wchar_t* username); - - // Creates a new unique sid. Free returned sid with FreeSid(). - HRESULT CreateNewSID(PSID* sid); - - private: - OSUserManager* original_manager_; - DWORD next_rid_ = 0; - std::map<base::string16, UserInfo> username_to_info_; -}; - -/////////////////////////////////////////////////////////////////////////////// - -class FakeScopedLsaPolicyFactory { - public: - FakeScopedLsaPolicyFactory(); - virtual ~FakeScopedLsaPolicyFactory(); - - ScopedLsaPolicy::CreatorCallback GetCreatorCallback(); - - // PrivateDataMap is a string-to-string key/value store that maps private - // names to their corresponding data strings. The term "private" here is - // used to reflect the name of the underlying OS calls. This data is meant - // to be shared by all ScopedLsaPolicy instances created by this factory. - using PrivateDataMap = std::map<base::string16, base::string16>; - PrivateDataMap& private_data() { return private_data_; } - - private: - std::unique_ptr<ScopedLsaPolicy> Create(ACCESS_MASK mask); - - ScopedLsaPolicy::CreatorCallback original_creator_; - PrivateDataMap private_data_; -}; - -class FakeScopedLsaPolicy : public ScopedLsaPolicy { - public: - ~FakeScopedLsaPolicy() override; - - // ScopedLsaPolicy - HRESULT StorePrivateData(const wchar_t* key, const wchar_t* value) override; - HRESULT RemovePrivateData(const wchar_t* key) override; - HRESULT RetrievePrivateData(const wchar_t* key, - wchar_t* value, - size_t length) override; - HRESULT AddAccountRights(PSID sid, const wchar_t* right) override; - HRESULT RemoveAccount(PSID sid) override; - - private: - friend class FakeScopedLsaPolicyFactory; - - explicit FakeScopedLsaPolicy(FakeScopedLsaPolicyFactory* factory); - - FakeScopedLsaPolicyFactory::PrivateDataMap& private_data() { - return factory_->private_data(); - } - - FakeScopedLsaPolicyFactory* factory_; -}; - -/////////////////////////////////////////////////////////////////////////////// - -// A scoped FakeScopedUserProfile factory. Installs itself when constructed -// and removes itself when deleted. -class FakeScopedUserProfileFactory { - public: - FakeScopedUserProfileFactory(); - virtual ~FakeScopedUserProfileFactory(); - - private: - std::unique_ptr<ScopedUserProfile> Create(const base::string16& sid, - const base::string16& username, - const base::string16& password); - - ScopedUserProfile::CreatorCallback original_creator_; -}; - -class FakeScopedUserProfile : public ScopedUserProfile { - private: - friend class FakeScopedUserProfileFactory; - - FakeScopedUserProfile(const base::string16& sid, - const base::string16& username, - const base::string16& password); - ~FakeScopedUserProfile() override; -}; - -/////////////////////////////////////////////////////////////////////////////// - -// A scoped FakeWinHttpUrlFetcher factory. Installs itself when constructed -// and removes itself when deleted. -class FakeWinHttpUrlFetcherFactory { - public: - FakeWinHttpUrlFetcherFactory(); - ~FakeWinHttpUrlFetcherFactory(); - - void SetFakeResponse(const GURL& url, - const WinHttpUrlFetcher::Headers& headers, - const std::string& response); - - private: - std::unique_ptr<WinHttpUrlFetcher> Create(const GURL& url); - - WinHttpUrlFetcher::CreatorCallback original_creator_; - using Response = std::pair<WinHttpUrlFetcher::Headers, std::string>; - std::map<GURL, Response> fake_responses_; -}; - -class FakeWinHttpUrlFetcher : public WinHttpUrlFetcher { - public: - explicit FakeWinHttpUrlFetcher(const GURL& url); - ~FakeWinHttpUrlFetcher() override; - - using WinHttpUrlFetcher::Headers; - - const Headers& response_headers() { return response_headers_; } - - // WinHttpUrlFetcher - bool IsValid() const override; - HRESULT Fetch(std::string* response) override; - HRESULT Close() override; - - private: - friend FakeWinHttpUrlFetcherFactory; - - Headers response_headers_; - std::string response_; -}; - -} // namespace credential_provider - -#endif // CHROME_CREDENTIAL_PROVIDER_TEST_GCP_FAKES_H_
diff --git a/chrome/credential_provider/test/gcp_setup_unittests.cc b/chrome/credential_provider/test/gcp_setup_unittests.cc deleted file mode 100644 index 6f4036d..0000000 --- a/chrome/credential_provider/test/gcp_setup_unittests.cc +++ /dev/null
@@ -1,301 +0,0 @@ -// Copyright 2018 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 <atlbase.h> -#include <objbase.h> -#include <unknwn.h> - -#include <memory> - -#include "base/base_paths.h" -#include "base/compiler_specific.h" -#include "base/environment.h" -#include "base/file_version_info.h" -#include "base/files/file.h" -#include "base/files/file_util.h" -#include "base/files/scoped_temp_dir.h" -#include "base/process/launch.h" -#include "base/strings/string16.h" -#include "base/syslog_logging.h" -#include "base/test/scoped_path_override.h" -#include "base/test/test_reg_util_win.h" -#include "base/win/registry.h" -#include "build/build_config.h" -#include "chrome/credential_provider/gaiacp/gcp_strings.h" -#include "chrome/credential_provider/gaiacp/gcp_utils.h" -#include "chrome/credential_provider/setup/setup_lib.h" -#include "chrome/credential_provider/test/gcp_fakes.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace credential_provider { - -class GcpSetupTest : public ::testing::Test { - protected: - const base::FilePath& module_path() const { return module_path_; } - const base::string16& product_version() const { return product_version_; } - - void ExpectAllFilesToExist(bool exist, const base::string16& product_version); - void ExpectCredentialProviderToBeRegistered( - bool registered, - const base::string16& product_version); - - base::FilePath installed_path_for_version( - const base::string16& product_version) { - return scoped_temp_prog_dir_.GetPath() - .Append(FILE_PATH_LITERAL("Google\\Credential Provider")) - .Append(product_version); - } - - base::FilePath installed_path() { - return installed_path_for_version(product_version_); - } - - FakeOSUserManager* fake_os_user_manager() { return &fake_os_user_manager_; } - - FakeScopedLsaPolicyFactory* fake_scoped_lsa_policy_factory() { - return &fake_scoped_lsa_policy_factory_; - } - - FakesForTesting* fakes_for_testing() { return &fakes_; } - - private: - void SetUp() override; - - void GetModulePathAndProductVersion(base::FilePath* module_path, - base::string16* product_version); - - registry_util::RegistryOverrideManager registry_override_; - base::ScopedTempDir scoped_temp_prog_dir_; - base::ScopedTempDir scoped_temp_start_menu_dir_; - std::unique_ptr<base::ScopedPathOverride> program_files_override_; - std::unique_ptr<base::ScopedPathOverride> start_menu_override_; - std::unique_ptr<base::ScopedPathOverride> dll_path_override_; - base::FilePath module_path_; - base::string16 product_version_; - FakeOSUserManager fake_os_user_manager_; - FakeScopedLsaPolicyFactory fake_scoped_lsa_policy_factory_; - FakesForTesting fakes_; -}; - -void GcpSetupTest::GetModulePathAndProductVersion( - base::FilePath* module_path, - base::string16* product_version) { - // Pass null module handle to get path for the executable file of the - // current process. - wchar_t module[MAX_PATH]; - ASSERT_TRUE(::GetModuleFileName(nullptr, module, MAX_PATH)); - - // These tests assume all the binaries exist in the same directory. - *module_path = base::FilePath(module); - ASSERT_FALSE(module_path->empty()); - - *product_version = - FileVersionInfo::CreateFileVersionInfo(*module_path)->product_version(); - ASSERT_FALSE(product_version->empty()); -} - -void GcpSetupTest::ExpectAllFilesToExist( - bool exist, - const base::string16& product_version) { - base::FilePath root = installed_path_for_version(product_version); - EXPECT_EQ(exist, base::PathExists(root)); - - const base::FilePath::CharType* const* filenames; - size_t number_of_files; - GetInstalledFileBasenames(&filenames, &number_of_files); - - for (size_t i = 0; i < number_of_files; ++i) - EXPECT_EQ(exist, base::PathExists(root.Append(filenames[i]))); -} - -void GcpSetupTest::ExpectCredentialProviderToBeRegistered( - bool registered, - const base::string16& product_version) { - // Make sure COM object is registered. - base::string16 subkey( - L"CLSID\\{0B5BFDF0-4594-47AC-940A-CFC69ABC561C}\\InprocServer32"); - base::win::RegKey clsid_key(HKEY_CLASSES_ROOT, subkey.c_str(), KEY_READ); - EXPECT_EQ(registered, clsid_key.Valid()); - - if (registered) { - base::FilePath path = installed_path_for_version(product_version) - .Append(FILE_PATH_LITERAL("Gaia1_0.dll")); - base::string16 value; - EXPECT_EQ(ERROR_SUCCESS, clsid_key.ReadValue(L"", &value)); - EXPECT_EQ(path.value(), value); - } - - // Make sure credential provider is registered. - base::win::RegKey cp_key(HKEY_LOCAL_MACHINE, - L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\" - L"Authentication\\Credential Providers\\" - L"{0B5BFDF0-4594-47AC-940A-CFC69ABC561C}", - KEY_READ); - EXPECT_EQ(registered, cp_key.Valid()); - - // Make sure eventlog source is registered. - base::win::RegKey el_key( - HKEY_LOCAL_MACHINE, - L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\GCP", - KEY_READ); - EXPECT_EQ(registered, el_key.Valid()); - - if (registered) { - base::FilePath path = - installed_path_for_version(product_version) - .Append(FILE_PATH_LITERAL("gcp_eventlog_provider.dll")); - base::string16 value; - EXPECT_EQ(ERROR_SUCCESS, el_key.ReadValue(L"EventMessageFile", &value)); - EXPECT_EQ(path.value(), value); - } -} - -void GcpSetupTest::SetUp() { - ASSERT_TRUE(SUCCEEDED( - CoInitializeEx(nullptr, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE))); - - // Get the path to the setup exe (this exe during unit tests) and the - // chrome version. - GetModulePathAndProductVersion(&module_path_, &product_version_); - - // Override registry so that tests don't mess up the machine's state. - ASSERT_NO_FATAL_FAILURE( - registry_override_.OverrideRegistry(HKEY_LOCAL_MACHINE)); - ASSERT_NO_FATAL_FAILURE( - registry_override_.OverrideRegistry(HKEY_CLASSES_ROOT)); - ASSERT_NO_FATAL_FAILURE(registry_override_.OverrideRegistry(HKEY_USERS)); - - // Override the environment used by setup so that tests don't mess - // up the machine's state. - std::unique_ptr<base::Environment> env(base::Environment::Create()); - ASSERT_NE(nullptr, env.get()); - - ASSERT_TRUE(scoped_temp_prog_dir_.CreateUniqueTempDir()); - program_files_override_.reset(new base::ScopedPathOverride( - base::DIR_PROGRAM_FILES, scoped_temp_prog_dir_.GetPath())); - - ASSERT_TRUE(scoped_temp_start_menu_dir_.CreateUniqueTempDir()); - start_menu_override_.reset(new base::ScopedPathOverride( - base::DIR_COMMON_START_MENU, scoped_temp_start_menu_dir_.GetPath())); - - // In non-component builds, base::FILE_MODULE will always return the path - // to base.dll because of the way CURRENT_MODULE works. Therefore overriding - // to point to gaia1_0.dll's destination path (i.e. after it is installed). - // The actual file name is not important, just the directory. - dll_path_override_.reset(new base::ScopedPathOverride( - base::FILE_MODULE, installed_path().Append(FILE_PATH_LITERAL("foo.dll")), - true /*=is_absolute*/, false /*=create*/)); - - base::FilePath startup_path = - scoped_temp_start_menu_dir_.GetPath().Append(L"StartUp"); - ASSERT_TRUE(base::CreateDirectoryAndGetError(startup_path, nullptr)); - - // Fake factories for testing the DLL registration. - fakes_.os_manager_for_testing = &fake_os_user_manager_; - fakes_.scoped_lsa_policy_creator = - fake_scoped_lsa_policy_factory_.GetCreatorCallback(); -} - -TEST_F(GcpSetupTest, DoInstall) { - logging::ResetEventSourceForTesting(); - - ASSERT_EQ(S_OK, - DoInstall(module_path(), product_version(), fakes_for_testing())); - ExpectAllFilesToExist(true, product_version()); - ExpectCredentialProviderToBeRegistered(true, product_version()); - - EXPECT_FALSE( - fake_os_user_manager()->GetUserInfo(kGaiaAccountName).sid.empty()); - EXPECT_FALSE(fake_scoped_lsa_policy_factory() - ->private_data()[kLsaKeyGaiaPassword] - .empty()); -} - -TEST_F(GcpSetupTest, DoInstallOverOldInstall) { - logging::ResetEventSourceForTesting(); - - // Install using some old version. - const base::string16 old_version(L"1.0.0.0"); - ASSERT_EQ(S_OK, DoInstall(module_path(), old_version, fakes_for_testing())); - ExpectAllFilesToExist(true, old_version); - - FakeOSUserManager::UserInfo old_user_info = - fake_os_user_manager()->GetUserInfo(kGaiaAccountName); - base::string16 old_password = fake_scoped_lsa_policy_factory() - ->private_data()[kLsaKeyGaiaPassword]; - EXPECT_FALSE(old_password.empty()); - - logging::ResetEventSourceForTesting(); - - // Now install a newer version. - ASSERT_EQ(S_OK, - DoInstall(module_path(), product_version(), fakes_for_testing())); - - // Make sure newer version exists and old version is gone. - ExpectAllFilesToExist(true, product_version()); - ExpectAllFilesToExist(false, old_version); - - // Make sure kGaiaAccountName info and private data are unchanged. - EXPECT_EQ(old_user_info, - fake_os_user_manager()->GetUserInfo(kGaiaAccountName)); - EXPECT_EQ(old_password, - fake_scoped_lsa_policy_factory() - ->private_data()[kLsaKeyGaiaPassword]); -} - -TEST_F(GcpSetupTest, DoInstallOverOldLockedInstall) { - logging::ResetEventSourceForTesting(); - - // Install using some old version. - const base::string16 old_version(L"1.0.0.0"); - ASSERT_EQ(S_OK, DoInstall(module_path(), old_version, fakes_for_testing())); - ExpectAllFilesToExist(true, old_version); - - // Lock the CP DLL. - base::FilePath dll_path = installed_path_for_version(old_version) - .Append(FILE_PATH_LITERAL("Gaia1_0.dll")); - base::File lock(dll_path, base::File::FLAG_OPEN | base::File::FLAG_READ | - base::File::FLAG_EXCLUSIVE_READ | - base::File::FLAG_EXCLUSIVE_WRITE); - - logging::ResetEventSourceForTesting(); - - // Now install a newer version. - ASSERT_EQ(S_OK, - DoInstall(module_path(), product_version(), fakes_for_testing())); - - // Make sure newer version exists. - ExpectAllFilesToExist(true, product_version()); - - // The locked file will still exist, the others are gone. - const base::FilePath::CharType* const* filenames; - size_t count; - GetInstalledFileBasenames(&filenames, &count); - for (size_t i = 0; i < count; ++i) { - const base::FilePath path = - installed_path_for_version(old_version).Append(filenames[i]); - EXPECT_EQ(path == dll_path, base::PathExists(path)); - } -} - -TEST_F(GcpSetupTest, DoUninstall) { - logging::ResetEventSourceForTesting(); - - ASSERT_EQ(S_OK, - DoInstall(module_path(), product_version(), fakes_for_testing())); - - logging::ResetEventSourceForTesting(); - - ASSERT_EQ(S_OK, - DoUninstall(module_path(), installed_path(), fakes_for_testing())); - ExpectAllFilesToExist(false, product_version()); - ExpectCredentialProviderToBeRegistered(false, product_version()); - EXPECT_TRUE( - fake_os_user_manager()->GetUserInfo(kGaiaAccountName).sid.empty()); - EXPECT_TRUE(fake_scoped_lsa_policy_factory() - ->private_data()[kLsaKeyGaiaPassword] - .empty()); -} - -} // namespace credential_provider
diff --git a/chrome/credential_provider/test/gcp_test_main.cc b/chrome/credential_provider/test/gcp_test_main.cc deleted file mode 100644 index 3429dd00..0000000 --- a/chrome/credential_provider/test/gcp_test_main.cc +++ /dev/null
@@ -1,21 +0,0 @@ -// Copyright 2018 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. -// -// Main entry point for all unit tests. - -#include "base/at_exit.h" -#include "base/command_line.h" -#include "chrome/credential_provider/gaiacp/gaia_credential_provider_module.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -credential_provider::CGaiaCredentialProviderModule _AtlModule; - -int main(int argc, char** argv) { - base::AtExitManager at_exit; - base::CommandLine::Init(argc, argv); - testing::InitGoogleMock(&argc, argv); - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -}
diff --git a/chromecast/browser/cast_content_browser_client.cc b/chromecast/browser/cast_content_browser_client.cc index abb08e98..3a9cb287 100644 --- a/chromecast/browser/cast_content_browser_client.cc +++ b/chromecast/browser/cast_content_browser_client.cc
@@ -90,6 +90,7 @@ #if defined(OS_ANDROID) #include "components/cdm/browser/cdm_message_filter_android.h" #include "components/crash/content/browser/child_exit_observer_android.h" +#include "media/mojo/services/android_mojo_media_client.h" #if !BUILDFLAG(USE_CHROMECAST_CDMS) #include "components/cdm/browser/media_drm_storage_impl.h" #include "url/origin.h" @@ -124,6 +125,10 @@ #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) static std::unique_ptr<service_manager::Service> CreateMediaService( CastContentBrowserClient* browser_client) { +#if defined(OS_ANDROID) + return std::make_unique<::media::MediaService>( + std::make_unique<::media::AndroidMojoMediaClient>()); +#else auto mojo_media_client = std::make_unique<media::CastMojoMediaClient>( browser_client->GetCmaBackendFactory(), base::Bind(&CastContentBrowserClient::CreateCdmFactory, @@ -132,6 +137,7 @@ browser_client->GetVideoResolutionPolicy(), browser_client->media_resource_tracker()); return std::make_unique<::media::MediaService>(std::move(mojo_media_client)); +#endif // defined(OS_ANDROID) } #endif // BUILDFLAG(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) @@ -660,7 +666,7 @@ #if defined(OS_ANDROID) && !BUILDFLAG(USE_CHROMECAST_CDMS) registry->AddInterface( base::BindRepeating(&CreateMediaDrmStorage, render_frame_host)); -#endif +#endif // defined(OS_ANDROID) && !BUILDFLAG(USE_CHROMECAST_CDMS) std::string application_session_id = CastNavigationUIData::GetSessionIdForWebContents(
diff --git a/chromecast/media/cma/backend/BUILD.gn b/chromecast/media/cma/backend/BUILD.gn index 2155e12..35c73b5 100644 --- a/chromecast/media/cma/backend/BUILD.gn +++ b/chromecast/media/cma/backend/BUILD.gn
@@ -263,11 +263,13 @@ "mock_redirected_audio_output.h", "stream_mixer_external_audio_pipeline_unittest.cc", "stream_mixer_unittest.cc", + "volume_map_unittest.cc", ] deps = [ ":audio_helpers", ":av_sync_dummy", + ":cast_audio_json", ":for_mixer_audio", ":null_video", ":public",
diff --git a/chromecast/media/cma/backend/cast_audio_json.cc b/chromecast/media/cma/backend/cast_audio_json.cc index 6e6d3e2..588c86d5 100644 --- a/chromecast/media/cma/backend/cast_audio_json.cc +++ b/chromecast/media/cma/backend/cast_audio_json.cc
@@ -4,7 +4,17 @@ #include "chromecast/media/cma/backend/cast_audio_json.h" +#include <string> +#include <utility> + +#include "base/bind.h" +#include "base/files/file_path_watcher.h" #include "base/files/file_util.h" +#include "base/json/json_reader.h" +#include "base/location.h" +#include "base/logging.h" +#include "base/message_loop/message_loop.h" +#include "base/sequenced_task_runner.h" #include "build/build_config.h" namespace chromecast { @@ -17,6 +27,14 @@ #endif const char kCastAudioJsonFileName[] = "cast_audio.json"; +#define ENSURE_OWN_THREAD(method, ...) \ + if (!task_runner_->RunsTasksInCurrentSequence()) { \ + task_runner_->PostTask( \ + FROM_HERE, base::BindOnce(&CastAudioJsonProviderImpl::method, \ + base::Unretained(this), ##__VA_ARGS__)); \ + return; \ + } + // static base::FilePath CastAudioJson::GetFilePath() { base::FilePath tuning_path = CastAudioJson::GetFilePathForTuning(); @@ -37,5 +55,56 @@ return base::GetHomeDir().Append(kCastAudioJsonFileName); } +CastAudioJsonProviderImpl::CastAudioJsonProviderImpl() + : thread_("cast_audio_json_provider"), + cast_audio_watcher_(std::make_unique<base::FilePathWatcher>()) { + base::Thread::Options options; + options.message_loop_type = base::MessageLoop::TYPE_IO; + thread_.StartWithOptions(options); + task_runner_ = thread_.task_runner(); +} + +CastAudioJsonProviderImpl::~CastAudioJsonProviderImpl() { + StopWatchingFileOnThread(); +} + +std::unique_ptr<base::Value> CastAudioJsonProviderImpl::GetCastAudioConfig() { + std::string contents; + base::ReadFileToString(CastAudioJson::GetFilePath(), &contents); + return base::JSONReader::Read(contents); +} + +void CastAudioJsonProviderImpl::SetTuningChangedCallback( + TuningChangedCallback callback) { + ENSURE_OWN_THREAD(SetTuningChangedCallback, std::move(callback)); + + CHECK(!callback_); + callback_ = callback; + cast_audio_watcher_->Watch( + CastAudioJson::GetFilePathForTuning(), false /* recursive */, + base::BindRepeating(&CastAudioJsonProviderImpl::OnTuningFileChanged, + base::Unretained(this))); +} + +void CastAudioJsonProviderImpl::StopWatchingFileOnThread() { + ENSURE_OWN_THREAD(StopWatchingFileOnThread); + cast_audio_watcher_.reset(); +} + +void CastAudioJsonProviderImpl::OnTuningFileChanged(const base::FilePath& path, + bool error) { + DCHECK(task_runner_->RunsTasksInCurrentSequence()); + DCHECK(callback_); + + std::string contents; + base::ReadFileToString(path, &contents); + std::unique_ptr<base::Value> value = base::JSONReader::Read(contents); + if (value) { + callback_.Run(std::move(value)); + return; + } + LOG(ERROR) << "Unable to parse JSON in " << path; +} + } // namespace media } // namespace chromecast
diff --git a/chromecast/media/cma/backend/cast_audio_json.h b/chromecast/media/cma/backend/cast_audio_json.h index 7cb7c875..38fc7668 100644 --- a/chromecast/media/cma/backend/cast_audio_json.h +++ b/chromecast/media/cma/backend/cast_audio_json.h
@@ -5,7 +5,18 @@ #ifndef CHROMECAST_MEDIA_CMA_BACKEND_CAST_AUDIO_JSON_H_ #define CHROMECAST_MEDIA_CMA_BACKEND_CAST_AUDIO_JSON_H_ +#include <memory> + +#include "base/callback.h" #include "base/files/file_path.h" +#include "base/memory/scoped_refptr.h" +#include "base/threading/thread.h" +#include "base/values.h" + +namespace base { +class FilePathWatcher; +class SequencedTaskRunner; +} // namespace base namespace chromecast { namespace media { @@ -19,6 +30,51 @@ static base::FilePath GetFilePathForTuning(); }; +// Provides an interface for reading CastAudioJson and registering for file +// updates. +class CastAudioJsonProvider { + public: + using TuningChangedCallback = + base::RepeatingCallback<void(std::unique_ptr<base::Value> contents)>; + + virtual ~CastAudioJsonProvider() = default; + + // Returns the contents of cast_audio.json. + // If a file exists at CastAudioJson::GetFilePathForTuning() and is valid + // JSON, its contents will be returned. Otherwise, the contents of the file + // at CastAudioJson::GetReadOnlyFilePath() will be returned. + // This function will run on the thread on which it is called, and may + // perform blocking I/O. + virtual std::unique_ptr<base::Value> GetCastAudioConfig() = 0; + + // |callback| will be called when a new cast_audio config is available. + // |callback| will always be called from the same thread, but not the same + // thread on which |SetTuningChangedCallback| is called. + // |callback| will never be called after ~CastAudioJsonProvider() is called. + virtual void SetTuningChangedCallback(TuningChangedCallback callback) = 0; +}; + +class CastAudioJsonProviderImpl : public CastAudioJsonProvider { + public: + CastAudioJsonProviderImpl(); + ~CastAudioJsonProviderImpl() override; + + private: + // CastAudioJsonProvider implementation: + std::unique_ptr<base::Value> GetCastAudioConfig() override; + void SetTuningChangedCallback(TuningChangedCallback callback) override; + + void StopWatchingFileOnThread(); + void OnTuningFileChanged(const base::FilePath& path, bool error); + + TuningChangedCallback callback_; + base::Thread thread_; + scoped_refptr<base::SequencedTaskRunner> task_runner_; + std::unique_ptr<base::FilePathWatcher> cast_audio_watcher_; + + DISALLOW_COPY_AND_ASSIGN(CastAudioJsonProviderImpl); +}; + } // namespace media } // namespace chromecast
diff --git a/chromecast/media/cma/backend/volume_map.cc b/chromecast/media/cma/backend/volume_map.cc index 5672e8a..47b220c 100644 --- a/chromecast/media/cma/backend/volume_map.cc +++ b/chromecast/media/cma/backend/volume_map.cc
@@ -4,11 +4,11 @@ #include "chromecast/media/cma/backend/volume_map.h" -#include "base/files/file_path.h" -#include "base/files/file_util.h" +#include <utility> + +#include "base/bind.h" #include "base/logging.h" #include "base/values.h" -#include "chromecast/base/serializers.h" #include "chromecast/media/cma/backend/cast_audio_json.h" namespace chromecast { @@ -22,9 +22,22 @@ } // namespace -VolumeMap::VolumeMap() { - auto cast_audio_config = - DeserializeJsonFromFile(CastAudioJson::GetFilePath()); +VolumeMap::VolumeMap() + : VolumeMap(std::make_unique<CastAudioJsonProviderImpl>()) {} + +VolumeMap::VolumeMap(std::unique_ptr<CastAudioJsonProvider> config_provider) + : config_provider_(std::move(config_provider)) { + DCHECK(config_provider_); + + // base::Unretained is safe because VolumeMap outlives |config_provider_|. + config_provider_->SetTuningChangedCallback( + base::BindRepeating(&VolumeMap::LoadVolumeMap, base::Unretained(this))); + LoadVolumeMap(config_provider_->GetCastAudioConfig()); +} + +VolumeMap::~VolumeMap() = default; + +void VolumeMap::LoadVolumeMap(std::unique_ptr<base::Value> cast_audio_config) { const base::DictionaryValue* cast_audio_dict; if (!cast_audio_config || !cast_audio_config->GetAsDictionary(&cast_audio_dict)) { @@ -41,6 +54,7 @@ } double prev_level = -1.0; + std::vector<LevelToDb> new_map; for (size_t i = 0; i < volume_map_list->GetSize(); ++i) { const base::DictionaryValue* volume_map_entry; CHECK(volume_map_list->GetDictionary(i, &volume_map_entry)); @@ -59,26 +73,27 @@ CHECK_EQ(db, 0.0); } - volume_map_.push_back({level, db}); + new_map.push_back({level, db}); } - if (volume_map_.empty()) { + if (new_map.empty()) { LOG(FATAL) << "No entries in volume map."; return; } - if (volume_map_[0].level > 0.0) { - volume_map_.insert(volume_map_.begin(), {0.0, kMinDbFS}); + if (new_map[0].level > 0.0) { + new_map.insert(new_map.begin(), {0.0, kMinDbFS}); } - if (volume_map_.rbegin()->level < 1.0) { - volume_map_.push_back({1.0, 0.0}); + if (new_map.rbegin()->level < 1.0) { + new_map.push_back({1.0, 0.0}); } + base::AutoLock lock(lock_); + volume_map_ = std::move(new_map); } -VolumeMap::~VolumeMap() = default; - float VolumeMap::VolumeToDbFS(float volume) { + base::AutoLock lock(lock_); if (volume <= volume_map_[0].level) { return volume_map_[0].db; } @@ -95,6 +110,7 @@ } float VolumeMap::DbFSToVolume(float db) { + base::AutoLock lock(lock_); if (db <= volume_map_[0].db) { return volume_map_[0].level; } @@ -110,13 +126,14 @@ return volume_map_[volume_map_.size() - 1].level; } -// static void VolumeMap::UseDefaultVolumeMap() { - volume_map_ = {{0.0f, kMinDbFS}, - {0.01f, -58.0f}, - {0.090909f, -48.0f}, - {0.818182f, -8.0f}, - {1.0f, 0.0f}}; + std::vector<LevelToDb> new_map = {{0.0f, kMinDbFS}, + {0.01f, -58.0f}, + {0.090909f, -48.0f}, + {0.818182f, -8.0f}, + {1.0f, 0.0f}}; + base::AutoLock lock(lock_); + volume_map_ = std::move(new_map); } } // namespace media
diff --git a/chromecast/media/cma/backend/volume_map.h b/chromecast/media/cma/backend/volume_map.h index 0f72f44..c326a963 100644 --- a/chromecast/media/cma/backend/volume_map.h +++ b/chromecast/media/cma/backend/volume_map.h
@@ -5,9 +5,16 @@ #ifndef CHROMECAST_MEDIA_CMA_BACKEND_VOLUME_MAP_H_ #define CHROMECAST_MEDIA_CMA_BACKEND_VOLUME_MAP_H_ +#include <memory> #include <vector> #include "base/macros.h" +#include "base/synchronization/lock.h" +#include "chromecast/media/cma/backend/cast_audio_json.h" + +namespace base { +class Value; +} // namespace base namespace chromecast { namespace media { @@ -15,6 +22,10 @@ class VolumeMap { public: VolumeMap(); + + // For testing. + VolumeMap(std::unique_ptr<CastAudioJsonProvider> config_provider); + ~VolumeMap(); float VolumeToDbFS(float volume); @@ -27,10 +38,15 @@ float db; }; + void LoadVolumeMap(std::unique_ptr<base::Value> cast_audio_config); void UseDefaultVolumeMap(); + // |volume_map_| must be accessed with |lock_|. + base::Lock lock_; std::vector<LevelToDb> volume_map_; + std::unique_ptr<CastAudioJsonProvider> config_provider_; + DISALLOW_COPY_AND_ASSIGN(VolumeMap); };
diff --git a/chromecast/media/cma/backend/volume_map_unittest.cc b/chromecast/media/cma/backend/volume_map_unittest.cc new file mode 100644 index 0000000..269dd35b --- /dev/null +++ b/chromecast/media/cma/backend/volume_map_unittest.cc
@@ -0,0 +1,95 @@ +// Copyright 2018 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 "chromecast/media/cma/backend/volume_map.h" + +#include <string> + +#include "base/json/json_reader.h" +#include "base/logging.h" +#include "base/macros.h" +#include "chromecast/media/cma/backend/cast_audio_json.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace chromecast { +namespace media { +namespace { + +const float kEpsilon = 0.0001; +const char* kNewVolumeMap = R"json({"volume_map": [ + {"level":0.0, "db":-120.0}, + {"level":0.5, "db":-10.0}, + {"level":1.0, "db":0.0} + ]} +)json"; + +class TestFileProvider : public CastAudioJsonProvider { + public: + TestFileProvider(const std::string& file_contents) + : file_contents_(file_contents) {} + + ~TestFileProvider() override = default; + + void CallTuningChangedCallback(const std::string& new_config) { + DCHECK(callback_); + callback_.Run(base::JSONReader::Read(new_config)); + } + + private: + std::unique_ptr<base::Value> GetCastAudioConfig() override { + return base::JSONReader::Read(file_contents_); + } + + void SetTuningChangedCallback(TuningChangedCallback callback) override { + callback_ = std::move(callback); + } + + const std::string file_contents_; + TuningChangedCallback callback_; + + DISALLOW_COPY_AND_ASSIGN(TestFileProvider); +}; + +TEST(VolumeMapTest, UsesDefaultMapIfConfigEmpty) { + VolumeMap volume_map(std::make_unique<TestFileProvider>("")); + EXPECT_NEAR(-58.0f, volume_map.VolumeToDbFS(0.01f), kEpsilon); + EXPECT_NEAR(-48.0f, volume_map.VolumeToDbFS(1.0 / 11.0), kEpsilon); + EXPECT_NEAR(-8.0f, volume_map.VolumeToDbFS(9.0 / 11.0), kEpsilon); + EXPECT_NEAR(-0.0f, volume_map.VolumeToDbFS(1.0f), kEpsilon); + + EXPECT_NEAR(0.01, volume_map.DbFSToVolume(-58.0), kEpsilon); + EXPECT_NEAR(1.0 / 11.0, volume_map.DbFSToVolume(-48.0), kEpsilon); + EXPECT_NEAR(9.0 / 11.0, volume_map.DbFSToVolume(-8.0), kEpsilon); + EXPECT_NEAR(1.0, volume_map.DbFSToVolume(0.0), kEpsilon); +} + +TEST(VolumeMapTest, LoadsInitialConfig) { + VolumeMap volume_map(std::make_unique<TestFileProvider>(kNewVolumeMap)); + EXPECT_NEAR(-10.0f, volume_map.VolumeToDbFS(0.5), kEpsilon); +} + +TEST(VolumeMapTest, VolumeToDbFSInterpolates) { + VolumeMap volume_map(std::make_unique<TestFileProvider>(kNewVolumeMap)); + EXPECT_NEAR((-120.0 - 10.0) / 2, volume_map.VolumeToDbFS(0.25f), kEpsilon); + EXPECT_NEAR((-10.0 - 0.0) / 2, volume_map.VolumeToDbFS(0.75f), kEpsilon); +} + +TEST(VolumeMapTest, DbFSToVolumeInterpolates) { + VolumeMap volume_map(std::make_unique<TestFileProvider>(kNewVolumeMap)); + EXPECT_NEAR(0.25f, volume_map.DbFSToVolume((-120.0 - 10.0) / 2), kEpsilon); + EXPECT_NEAR(0.75f, volume_map.DbFSToVolume((-10.0 - 0.0) / 2), kEpsilon); +} + +TEST(VolumeMapTest, LoadsNewMapWhenFileChanges) { + auto provider = std::make_unique<TestFileProvider>(""); + TestFileProvider* provider_ptr = provider.get(); + VolumeMap volume_map(std::move(provider)); + + provider_ptr->CallTuningChangedCallback(kNewVolumeMap); + EXPECT_NEAR(-10.0f, volume_map.VolumeToDbFS(0.5), kEpsilon); +} + +} // namespace +} // namespace media +} // namespace chromecast
diff --git a/chromecast/media/service/cast_mojo_media_client.cc b/chromecast/media/service/cast_mojo_media_client.cc index 04cc924..90bdd55 100644 --- a/chromecast/media/service/cast_mojo_media_client.cc +++ b/chromecast/media/service/cast_mojo_media_client.cc
@@ -4,19 +4,13 @@ #include "chromecast/media/service/cast_mojo_media_client.h" -#include "build/build_config.h" #include "chromecast/media/cma/backend/cma_backend_factory.h" #include "chromecast/media/service/cast_renderer.h" #include "chromecast/public/media/media_pipeline_backend.h" -#include "media/base/audio_decoder.h" #include "media/base/cdm_factory.h" #include "media/base/media_log.h" #include "media/base/overlay_info.h" -#if defined(OS_ANDROID) -#include "media/filters/android/media_codec_audio_decoder.h" -#endif // defined(OS_ANDROID) - namespace chromecast { namespace media { @@ -59,13 +53,5 @@ return create_cdm_factory_cb_.Run(); } -std::unique_ptr<::media::AudioDecoder> CastMojoMediaClient::CreateAudioDecoder( - scoped_refptr<base::SingleThreadTaskRunner> task_runner) { -#if defined(OS_ANDROID) - return std::make_unique<::media::MediaCodecAudioDecoder>(task_runner); -#endif // defined(OS_ANDROID) - return nullptr; -} - } // namespace media } // namespace chromecast
diff --git a/chromecast/media/service/cast_mojo_media_client.h b/chromecast/media/service/cast_mojo_media_client.h index dbc41d8..8b9065e0 100644 --- a/chromecast/media/service/cast_mojo_media_client.h +++ b/chromecast/media/service/cast_mojo_media_client.h
@@ -39,8 +39,6 @@ const std::string& audio_device_id) override; std::unique_ptr<::media::CdmFactory> CreateCdmFactory( service_manager::mojom::InterfaceProvider* host_interfaces) override; - std::unique_ptr<::media::AudioDecoder> CreateAudioDecoder( - scoped_refptr<base::SingleThreadTaskRunner> task_runner) override; private: service_manager::Connector* connector_;
diff --git a/chromeos/policy/OWNERS b/chromeos/policy/OWNERS new file mode 100644 index 0000000..6bc31f0 --- /dev/null +++ b/chromeos/policy/OWNERS
@@ -0,0 +1,9 @@ +set noparent +atwilson@chromium.org +bartfab@chromium.org +emaxx@chromium.org +pastarmovj@chromium.org +pmarko@chromium.org +poromov@chromium.org + +# COMPONENT: Enterprise
diff --git a/components/autofill/core/browser/strike_database.cc b/components/autofill/core/browser/strike_database.cc index c4831518..e01ed95 100644 --- a/components/autofill/core/browser/strike_database.cc +++ b/components/autofill/core/browser/strike_database.cc
@@ -17,6 +17,8 @@ namespace { const char kDatabaseClientName[] = "StrikeService"; +const char kKeyDeliminator[] = "__"; +const char kKeyPrefixForCreditCardSave[] = "creditCardSave"; } // namespace StrikeDatabase::StrikeDatabase(const base::FilePath& database_dir) @@ -48,7 +50,7 @@ } void StrikeDatabase::ClearAllStrikesForKey( - const std::string key, + const std::string& key, const ClearStrikesCallback& outer_callback) { std::unique_ptr<std::vector<std::string>> keys_to_remove( new std::vector<std::string>()); @@ -61,6 +63,11 @@ base::Unretained(this), outer_callback)); } +std::string StrikeDatabase::GetKeyForCreditCardSave( + const std::string& card_last_four_digits) { + return CreateKey(GetKeyPrefixForCreditCardSave(), card_last_four_digits); +} + void StrikeDatabase::OnDatabaseInit(bool success) {} void StrikeDatabase::GetStrikeData(const std::string key, @@ -68,7 +75,7 @@ db_->GetEntry(key, callback); } -void StrikeDatabase::SetStrikeData(const std::string key, +void StrikeDatabase::SetStrikeData(const std::string& key, const StrikeData& data, const SetValueCallback& callback) { std::unique_ptr<StrikeDataProto::KeyEntryVector> entries( @@ -123,4 +130,13 @@ callback.Run(success); } +std::string StrikeDatabase::CreateKey(const std::string& type_prefix, + const std::string& identifier_suffix) { + return type_prefix + kKeyDeliminator + identifier_suffix; +} + +std::string StrikeDatabase::GetKeyPrefixForCreditCardSave() { + return kKeyPrefixForCreditCardSave; +} + } // namespace autofill
diff --git a/components/autofill/core/browser/strike_database.h b/components/autofill/core/browser/strike_database.h index 859478b..473d0b3e 100644 --- a/components/autofill/core/browser/strike_database.h +++ b/components/autofill/core/browser/strike_database.h
@@ -48,9 +48,13 @@ void AddStrike(const std::string key, const StrikesCallback& outer_callback); // Removes database entry for |key|, which implicitly sets strike count to 0. - void ClearAllStrikesForKey(const std::string key, + void ClearAllStrikesForKey(const std::string& key, const ClearStrikesCallback& outer_callback); + // Returns concatenation of prefix + |card_last_four_digits| to be used as key + // for credit card save. + std::string GetKeyForCreditCardSave(const std::string& card_last_four_digits); + protected: std::unique_ptr<leveldb_proto::ProtoDatabase<StrikeData>> db_; @@ -63,7 +67,7 @@ // Sets the entry for |key| to |strike_data|. Success status is passed to the // callback. - void SetStrikeData(const std::string key, + void SetStrikeData(const std::string& key, const StrikeData& strike_data, const SetValueCallback& inner_callback); @@ -86,6 +90,12 @@ void OnClearAllStrikesForKey(ClearStrikesCallback outer_callback, bool success); + // Concatenates type prefix and identifier suffix to create a key. + std::string CreateKey(const std::string& type_prefix, + const std::string& identifier_suffix); + + std::string GetKeyPrefixForCreditCardSave(); + base::WeakPtrFactory<StrikeDatabase> weak_ptr_factory_; };
diff --git a/components/autofill/core/browser/strike_database_unittest.cc b/components/autofill/core/browser/strike_database_unittest.cc index 81280af..a87e523 100644 --- a/components/autofill/core/browser/strike_database_unittest.cc +++ b/components/autofill/core/browser/strike_database_unittest.cc
@@ -77,6 +77,10 @@ run_loop.Run(); } + protected: + base::test::ScopedTaskEnvironment scoped_task_environment_; + TestStrikeDatabase db_; + private: static const base::FilePath InitFilePath() { base::ScopedTempDir temp_dir_; @@ -87,9 +91,7 @@ } int num_strikes_; - base::test::ScopedTaskEnvironment scoped_task_environment_; std::unique_ptr<StrikeData> strike_data_; - TestStrikeDatabase db_; }; TEST_F(StrikeDatabaseTest, AddStrikeTest) { @@ -167,4 +169,9 @@ EXPECT_EQ(5, strikes); } +TEST_F(StrikeDatabaseTest, GetKeyForCreditCardSave) { + const std::string last_four = "1234"; + EXPECT_EQ("creditCardSave__1234", db_.GetKeyForCreditCardSave(last_four)); +} + } // namespace autofill
diff --git a/components/autofill_assistant/browser/actions/action_delegate.h b/components/autofill_assistant/browser/actions/action_delegate.h index 9bac421..15c2964 100644 --- a/components/autofill_assistant/browser/actions/action_delegate.h +++ b/components/autofill_assistant/browser/actions/action_delegate.h
@@ -23,7 +23,6 @@ namespace autofill_assistant { class ClientMemory; -class NodeProto; // Action delegate called when processing actions. class ActionDelegate { @@ -88,11 +87,10 @@ const std::string& value, base::OnceCallback<void(bool)> callback) = 0; - // Given an element |selectors| on the page as the root element, build a node - // tree using the output parameter |node_tree_out| as a starting node. - virtual void BuildNodeTree(const std::vector<std::string>& selectors, - NodeProto* node_tree_out, - base::OnceCallback<void(bool)> callback) = 0; + // Return the outerHTML of an element given by |selectors|. + virtual void GetOuterHtml( + const std::vector<std::string>& selectors, + base::OnceCallback<void(bool, const std::string&)> callback) = 0; // Load |url| in the current tab. Returns immediately, before the new page has // been loaded.
diff --git a/components/autofill_assistant/browser/actions/mock_action_delegate.h b/components/autofill_assistant/browser/actions/mock_action_delegate.h index b8d842a..a9fc101 100644 --- a/components/autofill_assistant/browser/actions/mock_action_delegate.h +++ b/components/autofill_assistant/browser/actions/mock_action_delegate.h
@@ -94,10 +94,10 @@ void(const std::vector<std::string>& selectors, const std::string& value, base::OnceCallback<void(bool)>& callback)); - MOCK_METHOD3(BuildNodeTree, - void(const std::vector<std::string>& selectors, - NodeProto* node_tree_out, - base::OnceCallback<void(bool)> callback)); + MOCK_METHOD2( + GetOuterHtml, + void(const std::vector<std::string>& selectors, + base::OnceCallback<void(bool, const std::string&)> callback)); MOCK_METHOD1(LoadURL, void(const GURL& url)); MOCK_METHOD0(Shutdown, void()); MOCK_METHOD0(Restart, void());
diff --git a/components/autofill_assistant/browser/actions/upload_dom_action.cc b/components/autofill_assistant/browser/actions/upload_dom_action.cc index 1b20311..e5a47d2 100644 --- a/components/autofill_assistant/browser/actions/upload_dom_action.cc +++ b/components/autofill_assistant/browser/actions/upload_dom_action.cc
@@ -27,20 +27,26 @@ for (const auto& selector : proto_.upload_dom().tree_root().selectors()) { selectors.emplace_back(selector); } - NodeProto* root_node = processed_action_proto_->mutable_page_content() - ->mutable_dom_tree() - ->mutable_root(); - delegate->BuildNodeTree( - selectors, root_node, - base::BindOnce(&UploadDomAction::OnBuildNodeTree, + DCHECK(!selectors.empty()); + delegate->GetOuterHtml( + selectors, + base::BindOnce(&UploadDomAction::OnGetOuterHtml, weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } -void UploadDomAction::OnBuildNodeTree(ProcessActionCallback callback, - bool status) { +void UploadDomAction::OnGetOuterHtml(ProcessActionCallback callback, + bool successful, + const std::string& outer_html) { // TODO(crbug.com/806868): Distinguish element not found from other error and // report them as ELEMENT_RESOLUTION_FAILED. - UpdateProcessedAction(status ? ACTION_APPLIED : OTHER_ACTION_STATUS); + if (!successful) { + UpdateProcessedAction(OTHER_ACTION_STATUS); + std::move(callback).Run(std::move(processed_action_proto_)); + return; + } + + processed_action_proto_->set_html_source(outer_html); + UpdateProcessedAction(ACTION_APPLIED); std::move(callback).Run(std::move(processed_action_proto_)); }
diff --git a/components/autofill_assistant/browser/actions/upload_dom_action.h b/components/autofill_assistant/browser/actions/upload_dom_action.h index 5857f1b..99fdff67 100644 --- a/components/autofill_assistant/browser/actions/upload_dom_action.h +++ b/components/autofill_assistant/browser/actions/upload_dom_action.h
@@ -23,7 +23,9 @@ ProcessActionCallback callback) override; private: - void OnBuildNodeTree(ProcessActionCallback callback, bool status); + void OnGetOuterHtml(ProcessActionCallback callback, + bool successful, + const std::string& outer_html); base::WeakPtrFactory<UploadDomAction> weak_ptr_factory_;
diff --git a/components/autofill_assistant/browser/script_executor.cc b/components/autofill_assistant/browser/script_executor.cc index ff4a0b6..022553e 100644 --- a/components/autofill_assistant/browser/script_executor.cc +++ b/components/autofill_assistant/browser/script_executor.cc
@@ -104,11 +104,10 @@ std::move(callback)); } -void ScriptExecutor::BuildNodeTree(const std::vector<std::string>& selectors, - NodeProto* node_tree_out, - base::OnceCallback<void(bool)> callback) { - delegate_->GetWebController()->BuildNodeTree(selectors, node_tree_out, - std::move(callback)); +void ScriptExecutor::GetOuterHtml( + const std::vector<std::string>& selectors, + base::OnceCallback<void(bool, const std::string&)> callback) { + delegate_->GetWebController()->GetOuterHtml(selectors, std::move(callback)); } void ScriptExecutor::LoadURL(const GURL& url) {
diff --git a/components/autofill_assistant/browser/script_executor.h b/components/autofill_assistant/browser/script_executor.h index 75a46c7..a5199acc 100644 --- a/components/autofill_assistant/browser/script_executor.h +++ b/components/autofill_assistant/browser/script_executor.h
@@ -76,9 +76,9 @@ void SetFieldValue(const std::vector<std::string>& selectors, const std::string& value, base::OnceCallback<void(bool)> callback) override; - void BuildNodeTree(const std::vector<std::string>& selectors, - NodeProto* node_tree_out, - base::OnceCallback<void(bool)> callback) override; + void GetOuterHtml( + const std::vector<std::string>& selectors, + base::OnceCallback<void(bool, const std::string&)> callback) override; void LoadURL(const GURL& url) override; void Shutdown() override; void Restart() override;
diff --git a/components/autofill_assistant/browser/service.proto b/components/autofill_assistant/browser/service.proto index 720829d..61ff84e1 100644 --- a/components/autofill_assistant/browser/service.proto +++ b/components/autofill_assistant/browser/service.proto
@@ -199,50 +199,13 @@ } } -message NodeProto { - // Note: these use the same constant value as the DOM spec, - // except for UNKNOWN. - // https://developer.mozilla.org/en/docs/Web/API/Node/nodeType - enum Type { - UNKNOWN = 0; - ELEMENT = 1; - TEXT = 3; - DOCUMENT = 9; - } - - message Attribute { - optional string name = 1; - optional string value = 2; - } - - optional Type type = 1; - - // For ELEMENT nodes: the <TAG> name, *always* in UPPERCASE. - // For TEXT nodes: the text content. - optional string value = 2; - repeated Attribute attribute = 3; - - // Children in the order of their indices. - repeated NodeProto child = 7; -} - -message TreeProto { - optional NodeProto root = 1; - optional string url = 5; -} - -message PageContentProto { - optional TreeProto dom_tree = 1; - optional string url = 3; -} - message ProcessedActionProto { // The action that was processed. optional ActionProto action = 1; optional ProcessedActionStatusProto status = 2; - optional PageContentProto page_content = 3; + oneof result_data { string html_source = 12; } } enum ProcessedActionStatusProto {
diff --git a/components/autofill_assistant/browser/web_controller.cc b/components/autofill_assistant/browser/web_controller.cc index 1562ca6..6874731 100644 --- a/components/autofill_assistant/browser/web_controller.cc +++ b/components/autofill_assistant/browser/web_controller.cc
@@ -64,6 +64,12 @@ const char* const kSetValueAttributeScript = "function (value) { this.value = value; }"; +// Javascript code to get the outerHTML of a node. +// TODO(crbug.com/806868): Investigate if using DOM.GetOuterHtml would be a +// better solution than injecting Javascript code. +const char* const kGetOuterHtmlScript = + "function () { return this.outerHTML; }"; + } // namespace // static @@ -702,13 +708,56 @@ OnResult(result && !result->HasExceptionDetails(), std::move(callback)); } -void WebController::BuildNodeTree(const std::vector<std::string>& selectors, - NodeProto* node_tree_out, - base::OnceCallback<void(bool)> callback) { - // TODO(crbug.com/806868): We return a dummy dom tree for now. - node_tree_out->set_type(NodeProto::ELEMENT); - node_tree_out->set_value("BODY"); - std::move(callback).Run(true); +void WebController::GetOuterHtml( + const std::vector<std::string>& selectors, + base::OnceCallback<void(bool, const std::string&)> callback) { + FindElement( + selectors, + base::BindOnce(&WebController::OnFindElementForGetOuterHtml, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); +} + +void WebController::OnResult( + bool successful, + const std::string& result, + base::OnceCallback<void(bool, const std::string&)> callback) { + devtools_client_->GetDOM()->Disable(); + std::move(callback).Run(successful, result); +} + +void WebController::OnFindElementForGetOuterHtml( + base::OnceCallback<void(bool, const std::string&)> callback, + std::unique_ptr<FindElementResult> element_result) { + const std::string object_id = element_result->object_id; + if (object_id.empty()) { + OnResult(false, "", std::move(callback)); + return; + } + + devtools_client_->GetRuntime()->Enable(); + devtools_client_->GetRuntime()->CallFunctionOn( + runtime::CallFunctionOnParams::Builder() + .SetObjectId(object_id) + .SetFunctionDeclaration(std::string(kGetOuterHtmlScript)) + .SetReturnByValue(true) + .Build(), + base::BindOnce(&WebController::OnGetOuterHtml, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); +} + +void WebController::OnGetOuterHtml( + base::OnceCallback<void(bool, const std::string&)> callback, + std::unique_ptr<runtime::CallFunctionOnResult> result) { + devtools_client_->GetRuntime()->Disable(); + if (!result || result->HasExceptionDetails()) { + OnResult(false, "", std::move(callback)); + return; + } + + // Read the result returned from Javascript code. + DCHECK(result->GetResult()->GetValue()->is_string()); + OnResult(true, result->GetResult()->GetValue()->GetString(), + std::move(callback)); } } // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/web_controller.h b/components/autofill_assistant/browser/web_controller.h index 9ba20fa..642cfab4 100644 --- a/components/autofill_assistant/browser/web_controller.h +++ b/components/autofill_assistant/browser/web_controller.h
@@ -32,7 +32,6 @@ } namespace autofill_assistant { -class NodeProto; // Controller to interact with the web pages. // @@ -107,11 +106,10 @@ const std::string& value, base::OnceCallback<void(bool)> callback); - // Given an element |selectors| on the page as the root element, build a node - // tree using the output parameter |node_tree_out| as a starting node. - virtual void BuildNodeTree(const std::vector<std::string>& selectors, - NodeProto* node_tree_out, - base::OnceCallback<void(bool)> callback); + // Return the outerHTML of |selectors|. + virtual void GetOuterHtml( + const std::vector<std::string>& selectors, + base::OnceCallback<void(bool, const std::string&)> callback); private: friend class WebControllerBrowserTest; @@ -243,6 +241,15 @@ void OnSetValueAttribute( base::OnceCallback<void(bool)> callback, std::unique_ptr<runtime::CallFunctionOnResult> result); + void OnFindElementForGetOuterHtml( + base::OnceCallback<void(bool, const std::string&)> callback, + std::unique_ptr<FindElementResult> element_result); + void OnResult(bool successful, + const std::string& result, + base::OnceCallback<void(bool, const std::string&)> callback); + void OnGetOuterHtml( + base::OnceCallback<void(bool, const std::string&)> callback, + std::unique_ptr<runtime::CallFunctionOnResult> result); // Weak pointer is fine here since it must outlive this web controller, which // is guaranteed by the owner of this object.
diff --git a/components/autofill_assistant/browser/web_controller_browsertest.cc b/components/autofill_assistant/browser/web_controller_browsertest.cc index 0df28081..05d1f8e 100644 --- a/components/autofill_assistant/browser/web_controller_browsertest.cc +++ b/components/autofill_assistant/browser/web_controller_browsertest.cc
@@ -120,19 +120,27 @@ std::move(done_callback).Run(); } - void BuildNodeTree(const std::vector<std::string>& selectors, - NodeProto* node) { + bool GetOuterHtml(const std::vector<std::string>& selectors, + std::string* html_output) { base::RunLoop run_loop; - web_controller_->BuildNodeTree( - selectors, node, - base::BindOnce(&WebControllerBrowserTest::OnBuildNodeTree, - base::Unretained(this), run_loop.QuitClosure())); + bool result; + web_controller_->GetOuterHtml( + selectors, + base::BindOnce(&WebControllerBrowserTest::OnGetOuterHtml, + base::Unretained(this), run_loop.QuitClosure(), &result, + html_output)); run_loop.Run(); + return result; } - void OnBuildNodeTree(const base::Closure& done_callback, bool result) { + void OnGetOuterHtml(const base::Closure& done_callback, + bool* successful_output, + std::string* html_output, + bool successful, + const std::string& html) { + *successful_output = successful; + *html_output = html; done_callback.Run(); - EXPECT_TRUE(result); } void FindElement(const std::vector<std::string>& selectors, @@ -377,14 +385,14 @@ EXPECT_EQ("NY", content::EvalJs(shell(), javascript)); } -IN_PROC_BROWSER_TEST_F(WebControllerBrowserTest, BuildNodeTree) { - // TODO(crbug/808686): Complete this test when the implementation is finished. +IN_PROC_BROWSER_TEST_F(WebControllerBrowserTest, GetOuterHtml) { std::vector<std::string> selectors; - NodeProto node; - BuildNodeTree(selectors, &node); - - EXPECT_EQ(node.type(), NodeProto::ELEMENT); - EXPECT_EQ(node.value(), "BODY"); + selectors.emplace_back("#testOuterHtml"); + std::string html; + ASSERT_TRUE(GetOuterHtml(selectors, &html)); + EXPECT_EQ( + R"(<div id="testOuterHtml"><span>Span</span><p>Paragraph</p></div>)", + html); } IN_PROC_BROWSER_TEST_F(WebControllerBrowserTest, GetAndSetFieldValue) {
diff --git a/components/exo/surface_tree_host.cc b/components/exo/surface_tree_host.cc index 70f82439..aa8b28f 100644 --- a/components/exo/surface_tree_host.cc +++ b/components/exo/surface_tree_host.cc
@@ -108,10 +108,11 @@ if (root_surface == root_surface_) return; - // This method applies multiple changes to the window tree. Use - // ScopedPauseOcclusionTracking to ensure that occlusion isn't recomputed - // before all changes have been applied. - aura::WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion; + // This method applies multiple changes to the window tree. Use ScopedPause to + // ensure that occlusion isn't recomputed before all changes have been + // applied. + aura::WindowOcclusionTracker::ScopedPause pause_occlusion( + host_window_->env()); if (root_surface_) { root_surface_->window()->Hide(); @@ -266,10 +267,11 @@ // SurfaceTreeHost, private: void SurfaceTreeHost::UpdateHostWindowBounds() { - // This method applies multiple changes to the window tree. Use - // ScopedPauseOcclusionTracking to ensure that occlusion isn't recomputed - // before all changes have been applied. - aura::WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion; + // This method applies multiple changes to the window tree. Use ScopedPause + // to ensure that occlusion isn't recomputed before all changes have been + // applied. + aura::WindowOcclusionTracker::ScopedPause pause_occlusion( + host_window_->env()); gfx::Rect bounds = root_surface_->surface_hierarchy_content_bounds(); host_window_->SetBounds(
diff --git a/components/offline_items_collection/core/offline_content_aggregator.cc b/components/offline_items_collection/core/offline_content_aggregator.cc index e7c80106..4a33ab9 100644 --- a/components/offline_items_collection/core/offline_content_aggregator.cc +++ b/components/offline_items_collection/core/offline_content_aggregator.cc
@@ -8,7 +8,6 @@ #include "base/bind.h" #include "base/stl_util.h" -#include "base/strings/string_number_conversions.h" #include "base/threading/thread_task_runner_handle.h" #include "components/offline_items_collection/core/offline_content_aggregator.h" #include "components/offline_items_collection/core/offline_item.h" @@ -33,12 +32,6 @@ OfflineContentAggregator::~OfflineContentAggregator() = default; -std::string OfflineContentAggregator::CreateUniqueNameSpace( - const std::string& prefix) { - static int num_registrations = 0; - return prefix + "_" + base::IntToString(++num_registrations); -} - void OfflineContentAggregator::RegisterProvider( const std::string& name_space, OfflineContentProvider* provider) {
diff --git a/components/offline_items_collection/core/offline_content_aggregator.h b/components/offline_items_collection/core/offline_content_aggregator.h index 73aa6ea..5b8dfc7 100644 --- a/components/offline_items_collection/core/offline_content_aggregator.h +++ b/components/offline_items_collection/core/offline_content_aggregator.h
@@ -42,10 +42,6 @@ OfflineContentAggregator(); ~OfflineContentAggregator() override; - // Creates a unique namespace with the given prefix. Should be called to get - // the namespace for registration in order to avoid namespace collision. - static std::string CreateUniqueNameSpace(const std::string& prefix); - // Registers a provider and associates it with all OfflineItems with // |name_space|. UI actions taken on OfflineItems with |name_space| will be // routed to |provider|. |provider| is expected to only expose OfflineItems
diff --git a/components/omnibox/browser/BUILD.gn b/components/omnibox/browser/BUILD.gn index 8fe3865..aab1bd8 100644 --- a/components/omnibox/browser/BUILD.gn +++ b/components/omnibox/browser/BUILD.gn
@@ -118,6 +118,10 @@ "omnibox_metrics_provider.cc", "omnibox_metrics_provider.h", "omnibox_navigation_observer.h", + "omnibox_pedal.cc", + "omnibox_pedal.h", + "omnibox_pedal_provider.cc", + "omnibox_pedal_provider.h", "omnibox_popup_model.cc", "omnibox_popup_model.h", "omnibox_popup_view.h", @@ -321,6 +325,8 @@ "omnibox_controller_unittest.cc", "omnibox_edit_model_unittest.cc", "omnibox_field_trial_unittest.cc", + "omnibox_pedal_provider_unittest.cc", + "omnibox_pedal_unittest.cc", "omnibox_popup_model_unittest.cc", "omnibox_view_unittest.cc", "query_in_omnibox_unittest.cc",
diff --git a/components/omnibox/browser/omnibox_pedal.cc b/components/omnibox/browser/omnibox_pedal.cc new file mode 100644 index 0000000..860c7fa --- /dev/null +++ b/components/omnibox/browser/omnibox_pedal.cc
@@ -0,0 +1,91 @@ +// Copyright 2018 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 "components/omnibox/browser/omnibox_pedal.h" +#include "base/strings/utf_string_conversions.h" +#include "components/omnibox/browser/omnibox_client.h" +#include "components/omnibox/browser/omnibox_edit_controller.h" +#include "components/omnibox/browser/omnibox_field_trial.h" +#include "components/strings/grit/components_strings.h" +#include "ui/base/l10n/l10n_util.h" + +OmniboxPedal::LabelStrings::LabelStrings(int id_hint, + int id_hint_short, + int id_suggestion_contents) + : hint(l10n_util::GetStringUTF16(id_hint)), + hint_short(l10n_util::GetStringUTF16(id_hint_short)), + suggestion_contents(l10n_util::GetStringUTF16(id_suggestion_contents)) {} + +OmniboxPedal::OmniboxPedal(OmniboxPedal::LabelStrings strings) + : strings_(strings) {} + +OmniboxPedal::~OmniboxPedal() {} + +const OmniboxPedal::LabelStrings& OmniboxPedal::GetLabelStrings() const { + return strings_; +} + +bool OmniboxPedal::ShouldExecute(bool button_pressed) const { + const auto mode = OmniboxFieldTrial::GetPedalSuggestionMode(); + return (mode == OmniboxFieldTrial::PedalSuggestionMode::DEDICATED) || + (mode == OmniboxFieldTrial::PedalSuggestionMode::IN_SUGGESTION && + button_pressed); +} + +bool OmniboxPedal::ShouldPresentButton() const { + return OmniboxFieldTrial::GetPedalSuggestionMode() == + OmniboxFieldTrial::PedalSuggestionMode::IN_SUGGESTION; +} + +bool OmniboxPedal::IsTriggerMatch(const base::string16& match_text) const { + return triggers_.find(match_text) != triggers_.end(); +} + +void OmniboxPedal::OpenURL(OmniboxPedal::ExecutionContext& context, + const GURL& url) const { + // TODO(orinj): This will use AutocompleteMatchType::PEDAL + context.controller_.OnAutocompleteAccept( + url, WindowOpenDisposition::CURRENT_TAB, ui::PAGE_TRANSITION_GENERATED, + AutocompleteMatchType::NAVSUGGEST, context.match_selection_timestamp_); +} + +// ============================================================================= + +OmniboxPedalClearBrowsingData::OmniboxPedalClearBrowsingData() + : OmniboxPedal(OmniboxPedal::LabelStrings( + IDS_OMNIBOX_PEDAL_CLEAR_BROWSING_DATA_HINT, + IDS_OMNIBOX_PEDAL_CLEAR_BROWSING_DATA_HINT_SHORT, + IDS_OMNIBOX_PEDAL_CLEAR_BROWSING_DATA_SUGGESTION_CONTENTS)) { + // TODO(orinj): Move all trigger strings to files (maybe even per language). + const auto triggers = { + "how to clear browsing data on chrome", + "how to clear history", + "how to clear history on google chrome", + "how to clear history on chrome", + "how to clear history in google chrome", + "how to clear google chrome history", + "how to clear history google chrome", + "how to clear browsing history in chrome", + "clear browsing data", + "clear history", + "clear browsing data on chrome", + "clear history on google chrome", + "clear history google chrome", + "clear browsing history in chrome", + "clear cookies chrome", + "clear chrome history", + "clear chrome cache", + "history clear", + "history clear chrome", + }; + + for (const auto* trigger : triggers) { + triggers_.insert(base::ASCIIToUTF16(trigger)); + } +} + +void OmniboxPedalClearBrowsingData::Execute( + OmniboxPedal::ExecutionContext& context) const { + OpenURL(context, GURL("chrome://settings/clearBrowserData")); +}
diff --git a/components/omnibox/browser/omnibox_pedal.h b/components/omnibox/browser/omnibox_pedal.h new file mode 100644 index 0000000..d5842ff --- /dev/null +++ b/components/omnibox/browser/omnibox_pedal.h
@@ -0,0 +1,95 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_PEDAL_H_ +#define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_PEDAL_H_ + +#include <unordered_set> + +#include "base/strings/string16.h" +#include "base/time/time.h" +#include "url/gurl.h" + +class OmniboxEditController; +class OmniboxClient; + +// Conceptually, a Pedal is a fixed action that can be taken by the user +// pressing a button or taking a new dedicated suggestion when some +// associated intention is detected in an omnibox match suggestion. +// The typical action is to navigate to an internal Chrome surface +// like settings, but other actions like translation or launching +// an incognito window are possible. The intention is detected by +// checking trigger queries against suggested match queries. +class OmniboxPedal { + public: + struct LabelStrings { + LabelStrings(int id_hint, int id_hint_short, int id_suggestion_contents); + const base::string16 hint; + const base::string16 hint_short; + const base::string16 suggestion_contents; + }; + + // ExecutionContext provides the necessary structure for Pedal + // execution implementations that potentially vary widely, and + // references are preferred over pointers for members that are + // not nullable. If there's ever a good case for changing to + // nullable pointers, this can change but for now presence is + // guaranteed so Pedals can use them without needing to check. + // The other reason to use a context is that it's easier to + // maintain with lots of Pedal implementations because the amount + // of boilerplate required is greatly reduced. + class ExecutionContext { + public: + ExecutionContext(OmniboxClient& client, + OmniboxEditController& controller, + base::TimeTicks match_selection_timestamp) + : client_(client), + controller_(controller), + match_selection_timestamp_(match_selection_timestamp) {} + OmniboxClient& client_; + OmniboxEditController& controller_; + base::TimeTicks match_selection_timestamp_; + }; + + OmniboxPedal(LabelStrings strings); + virtual ~OmniboxPedal(); + + // Provides read access to labels associated with this Pedal. + const LabelStrings& GetLabelStrings() const; + + // These Should* methods can likely be eliminated when Pedal + // suggestion mode is firmly established. + + // When a suggestion is selected by user, it may be via button press or + // normal click/keypress. This method tells whether the mode of selection + // taken should result in execution of the suggestion's Pedal. + virtual bool ShouldExecute(bool button_pressed) const; + + // Some Pedals (or all, depending on mode) may be presented with a side + // button; this method returns true if this Pedal presents a button. + virtual bool ShouldPresentButton() const; + + // Takes the action associated with this Pedal. + virtual void Execute(ExecutionContext& context) const = 0; + + // Returns true if the preprocessed match suggestion text triggers + // presentation of this Pedal. This is not intended for general use, + // and only OmniboxPedalProvider should need to call this method. + bool IsTriggerMatch(const base::string16& match_text) const; + + protected: + // Use this for the common case of navigating to a URL. + void OpenURL(ExecutionContext& context, const GURL& url) const; + + std::unordered_set<base::string16> triggers_; + LabelStrings strings_; +}; + +class OmniboxPedalClearBrowsingData : public OmniboxPedal { + public: + OmniboxPedalClearBrowsingData(); + void Execute(ExecutionContext& context) const override; +}; + +#endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_PEDAL_H_
diff --git a/components/omnibox/browser/omnibox_pedal_provider.cc b/components/omnibox/browser/omnibox_pedal_provider.cc new file mode 100644 index 0000000..edda980d --- /dev/null +++ b/components/omnibox/browser/omnibox_pedal_provider.cc
@@ -0,0 +1,34 @@ +// Copyright 2018 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 "components/omnibox/browser/omnibox_pedal_provider.h" + +#include "components/omnibox/browser/omnibox_pedal.h" + +OmniboxPedalProvider::OmniboxPedalProvider() { + RegisterPedals(); +} + +OmniboxPedalProvider::~OmniboxPedalProvider() {} + +OmniboxPedal* OmniboxPedalProvider::FindPedalMatch( + const base::string16& match_text) const { + // Right now Pedals are few and small, but if this linear search ever + // encounters performance concerns, see crrev.com/c/1247223 for a ready made + // optimization that quickly eliminates the vast majority of searches. + for (const auto& pedal : pedals_) { + if (pedal->IsTriggerMatch(match_text)) { + return pedal.get(); + } + } + return nullptr; +} + +void OmniboxPedalProvider::Add(OmniboxPedal* pedal) { + pedals_.push_back(std::unique_ptr<OmniboxPedal>(pedal)); +} + +void OmniboxPedalProvider::RegisterPedals() { + Add(new OmniboxPedalClearBrowsingData()); +}
diff --git a/components/omnibox/browser/omnibox_pedal_provider.h b/components/omnibox/browser/omnibox_pedal_provider.h new file mode 100644 index 0000000..2c48eeb --- /dev/null +++ b/components/omnibox/browser/omnibox_pedal_provider.h
@@ -0,0 +1,31 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_PEDAL_PROVIDER_H_ +#define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_PEDAL_PROVIDER_H_ + +#include <memory> +#include <vector> + +#include "base/strings/utf_offset_string_conversions.h" + +class OmniboxPedal; + +class OmniboxPedalProvider { + public: + OmniboxPedalProvider(); + ~OmniboxPedalProvider(); + + OmniboxPedal* FindPedalMatch(const base::string16& match_text) const; + + private: + void Add(OmniboxPedal* pedal); + void RegisterPedals(); + + std::vector<std::unique_ptr<OmniboxPedal>> pedals_; + + DISALLOW_COPY_AND_ASSIGN(OmniboxPedalProvider); +}; + +#endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_PEDAL_PROVIDER_H_
diff --git a/components/omnibox/browser/omnibox_pedal_provider_unittest.cc b/components/omnibox/browser/omnibox_pedal_provider_unittest.cc new file mode 100644 index 0000000..adea962 --- /dev/null +++ b/components/omnibox/browser/omnibox_pedal_provider_unittest.cc
@@ -0,0 +1,22 @@ +// Copyright 2018 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 "components/omnibox/browser/omnibox_pedal_provider.h" + +#include "base/strings/utf_string_conversions.h" +#include "testing/gtest/include/gtest/gtest.h" + +class OmniboxPedalProviderTest : public testing::Test { + protected: + OmniboxPedalProviderTest() {} +}; + +TEST_F(OmniboxPedalProviderTest, QueriesTriggerPedals) { + OmniboxPedalProvider provider; + EXPECT_EQ(provider.FindPedalMatch(base::ASCIIToUTF16("")), nullptr); + EXPECT_EQ(provider.FindPedalMatch(base::ASCIIToUTF16("clear histor")), + nullptr); + EXPECT_NE(provider.FindPedalMatch(base::ASCIIToUTF16("clear history")), + nullptr); +}
diff --git a/components/omnibox/browser/omnibox_pedal_unittest.cc b/components/omnibox/browser/omnibox_pedal_unittest.cc new file mode 100644 index 0000000..dd9d0e868 --- /dev/null +++ b/components/omnibox/browser/omnibox_pedal_unittest.cc
@@ -0,0 +1,41 @@ +// Copyright 2018 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 "components/omnibox/browser/omnibox_pedal.h" + +#include "base/message_loop/message_loop.h" +#include "base/strings/utf_string_conversions.h" +#include "base/time/time.h" +#include "components/omnibox/browser/test_omnibox_client.h" +#include "components/omnibox/browser/test_omnibox_edit_controller.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" + +class OmniboxPedalTest : public testing::Test { + protected: + OmniboxPedalTest() + : omnibox_client_(new TestOmniboxClient), + omnibox_edit_controller_(new TestOmniboxEditController) {} + + TestToolbarModel* toolbar() { + return omnibox_edit_controller_->GetToolbarModel(); + } + + base::MessageLoop message_loop_; + std::unique_ptr<TestOmniboxClient> omnibox_client_; + std::unique_ptr<TestOmniboxEditController> omnibox_edit_controller_; +}; + +TEST_F(OmniboxPedalTest, PedalExecutes) { + base::TimeTicks match_selection_timestamp; + OmniboxPedal::ExecutionContext context( + *omnibox_client_, *omnibox_edit_controller_, match_selection_timestamp); + { + OmniboxPedalClearBrowsingData pedal; + EXPECT_TRUE(pedal.IsTriggerMatch(base::ASCIIToUTF16("clear history"))); + pedal.Execute(context); + const GURL& url = omnibox_edit_controller_->destination_url(); + EXPECT_EQ(url, GURL("chrome://settings/clearBrowserData")); + } +}
diff --git a/components/omnibox/browser/test_omnibox_edit_controller.h b/components/omnibox/browser/test_omnibox_edit_controller.h index 8e6702d..2d61b440 100644 --- a/components/omnibox/browser/test_omnibox_edit_controller.h +++ b/components/omnibox/browser/test_omnibox_edit_controller.h
@@ -16,6 +16,8 @@ TestToolbarModel* GetToolbarModel() override; const TestToolbarModel* GetToolbarModel() const override; + using OmniboxEditController::destination_url; + private: TestToolbarModel toolbar_model_;
diff --git a/components/omnibox_strings.grdp b/components/omnibox_strings.grdp index a34fff73..ced57c39 100644 --- a/components/omnibox_strings.grdp +++ b/components/omnibox_strings.grdp
@@ -74,6 +74,16 @@ <ph name="RESULT_MODIFIED_DATE">$1<ex>12/31/2018</ex></ph> - <ph name="RESULT_PRODUCT_SOURCE">$2<ex>Google Docs</ex></ph> </message> + <!-- Omnibox Pedals --> + <message name="IDS_OMNIBOX_PEDAL_CLEAR_BROWSING_DATA_HINT" desc="The button text contents to suggest pedal action, clear browsing data."> + Clear Data + </message> + <message name="IDS_OMNIBOX_PEDAL_CLEAR_BROWSING_DATA_HINT_SHORT" desc="The short one-word button text contents to suggest pedal action, clear browsing data."> + Clear + </message> + <message name="IDS_OMNIBOX_PEDAL_CLEAR_BROWSING_DATA_SUGGESTION_CONTENTS" desc="The suggestion content text to suggest pedal action, clear browsing data."> + Clear Chrome's browsing history data + </message> <!-- Accessibility labels for autocomplete match types. These are parameterized on the text being completed into the omnibox.
diff --git a/components/search_engines/template_url_service.cc b/components/search_engines/template_url_service.cc index 064b6ad..d365237 100644 --- a/components/search_engines/template_url_service.cc +++ b/components/search_engines/template_url_service.cc
@@ -12,6 +12,7 @@ #include "base/format_macros.h" #include "base/guid.h" #include "base/metrics/histogram_macros.h" +#include "base/stl_util.h" #include "base/strings/string_split.h" #include "base/strings/utf_string_conversions.h" #include "components/omnibox/browser/omnibox_field_trial.h" @@ -107,7 +108,7 @@ // Sync and TemplateURLs that were initially local, assuming |sync_data| is the // |initial_sync_data| parameter. bool IsFromSync(const TemplateURL* turl, const SyncDataMap& sync_data) { - return !!sync_data.count(turl->sync_guid()); + return base::ContainsKey(sync_data, turl->sync_guid()); } // Log the number of instances of a keyword that exist, with zero or more
diff --git a/components/test/data/autofill_assistant/autofill_assistant_target_website.html b/components/test/data/autofill_assistant/autofill_assistant_target_website.html index 7c96e97..7161b19 100644 --- a/components/test/data/autofill_assistant/autofill_assistant_target_website.html +++ b/components/test/data/autofill_assistant/autofill_assistant_target_website.html
@@ -53,6 +53,8 @@ <input id="input" type="field" value="helloworld" /> </div> + <div id="testOuterHtml"><span>Span</span><p>Paragraph</p></div> + <iframe id="iframe" name="test_iframe" width="100%" height="500" src= "autofill_assistant_target_website_iframe_one.html"></iframe> </body>
diff --git a/components/viz/common/hit_test/hit_test_region_list.h b/components/viz/common/hit_test/hit_test_region_list.h index 9c0d73c..1ef8c4c 100644 --- a/components/viz/common/hit_test/hit_test_region_list.h +++ b/components/viz/common/hit_test/hit_test_region_list.h
@@ -14,8 +14,6 @@ namespace viz { -// New flags must be added to GetFlagNames in hit_test_query.cc in order to be -// displayed in hit-test debug logging. enum HitTestRegionFlags : uint32_t { // Region maps to this surface (me). kHitTestMine = 0x01,
diff --git a/components/viz/host/hit_test/hit_test_query.cc b/components/viz/host/hit_test/hit_test_query.cc index 3991ca79..892cbb5 100644 --- a/components/viz/host/hit_test/hit_test_query.cc +++ b/components/viz/host/hit_test/hit_test_query.cc
@@ -4,7 +4,6 @@ #include "components/viz/host/hit_test/hit_test_query.h" -#include "base/containers/stack.h" #include "base/metrics/histogram_macros.h" #include "base/timer/elapsed_timer.h" #include "components/viz/common/hit_test/hit_test_region_list.h" @@ -30,35 +29,6 @@ (static_cast<size_t>(child_count) < child_count_max); } -const std::string GetFlagNames(uint32_t flag) { - std::string names = ""; - uint32_t mask = 1; - -#define CASE_TYPE(t) \ - case kHitTest##t: \ - names += names.empty() ? #t : ", " #t; \ - break; - - while (flag) { - switch (flag & mask) { - CASE_TYPE(Mine); - CASE_TYPE(Ignore); - CASE_TYPE(ChildSurface); - CASE_TYPE(Ask); - CASE_TYPE(Mouse); - CASE_TYPE(Touch); - CASE_TYPE(NotActive); - case 0: - break; - } - - flag &= ~mask; - mask <<= 1; - } -#undef CASE_TYPE - return names; -} - } // namespace HitTestQuery::HitTestQuery(base::RepeatingClosure bad_message_gpu_callback) @@ -289,47 +259,4 @@ bad_message_gpu_callback_.Run(); } -std::string HitTestQuery::PrintHitTestData() const { - std::ostringstream oss; - base::stack<uint32_t> parents; - std::string tabs = ""; - - for (uint32_t i = 0; i < hit_test_data_.size(); ++i) { - const AggregatedHitTestRegion& htr = hit_test_data_[i]; - - oss << tabs << "Index: " << i << '\n'; - oss << tabs << "Children: " << htr.child_count << '\n'; - oss << tabs << "Flags: " << GetFlagNames(htr.flags) << '\n'; - oss << tabs << "Frame Sink Id: " << htr.frame_sink_id.ToString() << '\n'; - oss << tabs << "Rect: " << htr.rect.ToString() << '\n'; - oss << tabs << "Transform:" << '\n'; - - // gfx::Transform::ToString spans multiple lines, so we use an additional - // stringstream. - { - std::string s; - std::stringstream transform_ss; - - transform_ss << htr.transform().ToString() << '\n'; - - while (getline(transform_ss, s)) { - oss << tabs << s << '\n'; - } - } - - tabs += "\t\t"; - parents.push(i); - - while (!parents.empty() && - parents.top() + hit_test_data_[parents.top()].child_count <= i) { - tabs.pop_back(); - tabs.pop_back(); - - parents.pop(); - } - } - - return oss.str(); -} - } // namespace viz
diff --git a/components/viz/host/hit_test/hit_test_query.h b/components/viz/host/hit_test/hit_test_query.h index cef04e9..c5c43ce 100644 --- a/components/viz/host/hit_test/hit_test_query.h +++ b/components/viz/host/hit_test/hit_test_query.h
@@ -101,9 +101,6 @@ // data for |frame_sink_id|. bool ContainsActiveFrameSinkId(const FrameSinkId& frame_sink_id) const; - // Returns hit-test data, using indentation to visualize the tree structure. - std::string PrintHitTestData() const; - private: friend class content::HitTestRegionObserver; // Helper function to find |target| for |location_in_parent| in the
diff --git a/components/viz/service/display/surface_aggregator.cc b/components/viz/service/display/surface_aggregator.cc index 18b6c20..ac3e7d5 100644 --- a/components/viz/service/display/surface_aggregator.cc +++ b/components/viz/service/display/surface_aggregator.cc
@@ -889,8 +889,9 @@ render_pass->filters.HasFilterThatMovesPixels(); if (has_pixel_moving_filter) moved_pixel_passes_.insert(remapped_pass_id); - bool in_moved_pixel_pass = has_pixel_moving_filter || - !!moved_pixel_passes_.count(remapped_pass_id); + bool in_moved_pixel_pass = + has_pixel_moving_filter || + base::ContainsKey(moved_pixel_passes_, remapped_pass_id); for (auto* quad : render_pass->quad_list) { if (quad->material == DrawQuad::SURFACE_CONTENT) { const auto* surface_quad = SurfaceDrawQuad::MaterialCast(quad);
diff --git a/components/viz/service/display_embedder/gpu_display_provider.cc b/components/viz/service/display_embedder/gpu_display_provider.cc index c775cbb..e5b0cda 100644 --- a/components/viz/service/display_embedder/gpu_display_provider.cc +++ b/components/viz/service/display_embedder/gpu_display_provider.cc
@@ -154,6 +154,9 @@ context_result = context_provider->BindToCurrentThread(); if (IsFatalOrSurfaceFailure(context_result)) { +#if defined(OS_ANDROID) + display_client->OnFatalOrSurfaceContextCreationFailure(context_result); +#endif gpu_service_impl_->DisableGpuCompositing(); return nullptr; }
diff --git a/components/viz/test/DEPS b/components/viz/test/DEPS index ad95262..5077f39 100644 --- a/components/viz/test/DEPS +++ b/components/viz/test/DEPS
@@ -8,6 +8,7 @@ "+gpu/command_buffer/client/raster_implementation_gles.h", "+gpu/command_buffer/client/shared_image_interface.h", "+gpu/command_buffer/common/capabilities.h", + "+gpu/command_buffer/common/context_result.h", "+gpu/command_buffer/common/skia_utils.h", "+gpu/command_buffer/common/sync_token.h", "+gpu/config/gpu_feature_info.h",
diff --git a/components/viz/test/mock_display_client.h b/components/viz/test/mock_display_client.h index 96bb156..ae05c43 100644 --- a/components/viz/test/mock_display_client.h +++ b/components/viz/test/mock_display_client.h
@@ -6,6 +6,7 @@ #define COMPONENTS_VIZ_TEST_MOCK_DISPLAY_CLIENT_H_ #include "build/build_config.h" +#include "gpu/command_buffer/common/context_result.h" #include "mojo/public/cpp/bindings/binding.h" #include "services/viz/privileged/interfaces/compositing/frame_sink_manager.mojom.h" #include "testing/gmock/include/gmock/gmock.h" @@ -31,6 +32,8 @@ #endif #if defined(OS_ANDROID) MOCK_METHOD1(DidCompleteSwapWithSize, void(const gfx::Size&)); + MOCK_METHOD1(OnFatalOrSurfaceContextCreationFailure, + void(gpu::ContextResult)); #endif private:
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 836173f..6328c62 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -1307,8 +1307,6 @@ "renderer_host/frame_sink_provider_impl.h", "renderer_host/frame_token_message_queue.cc", "renderer_host/frame_token_message_queue.h", - "renderer_host/hit_test_debug_key_event_observer.cc", - "renderer_host/hit_test_debug_key_event_observer.h", "renderer_host/input/fling_controller.cc", "renderer_host/input/fling_controller.h", "renderer_host/input/fling_scheduler.cc",
diff --git a/content/browser/background_fetch/background_fetch_context.cc b/content/browser/background_fetch/background_fetch_context.cc index eb08b1d..e95ff15 100644 --- a/content/browser/background_fetch/background_fetch_context.cc +++ b/content/browser/background_fetch/background_fetch_context.cc
@@ -404,14 +404,6 @@ blink::mojom::BackgroundFetchService::AbortCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - auto controllers_iter = job_controllers_.find(registration_id.unique_id()); - if (controllers_iter == job_controllers_.end()) { - std::move(callback).Run(blink::mojom::BackgroundFetchError::INVALID_ID); - return; - } - - controllers_iter->second->Abort(FailureReason::CANCELLED_BY_DEVELOPER); - DidFinishJob(std::move(callback), registration_id, FailureReason::CANCELLED_BY_DEVELOPER); } @@ -419,21 +411,21 @@ void BackgroundFetchContext::DidFinishJob( base::OnceCallback<void(blink::mojom::BackgroundFetchError)> callback, const BackgroundFetchRegistrationId& registration_id, - FailureReason failure_reason) { + FailureReason reason_to_abort) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - // If the registration was aborted, this will also propagate the event to any - // active JobController, to terminate in-progress requests. + // If |aborted| is true, this will also propagate the event to any active + // JobController for the registration, to terminate in-progress requests. data_manager_->MarkRegistrationForDeletion( registration_id, base::BindOnce(&BackgroundFetchContext::DidMarkForDeletion, weak_factory_.GetWeakPtr(), registration_id, - failure_reason, std::move(callback))); + reason_to_abort, std::move(callback))); } void BackgroundFetchContext::DidMarkForDeletion( const BackgroundFetchRegistrationId& registration_id, - FailureReason failure_reason, + FailureReason reason_to_abort, base::OnceCallback<void(blink::mojom::BackgroundFetchError)> callback, blink::mojom::BackgroundFetchError error) { DCHECK(callback); @@ -442,30 +434,51 @@ // It's normal to get INVALID_ID errors here - it means the registration was // already inactive (marked for deletion). This happens when an abort (from // developer or from user) races with the download completing/failing, or even - // when two aborts race. + // when two aborts race. TODO(johnme): Log STORAGE_ERRORs to UMA though. if (error != blink::mojom::BackgroundFetchError::NONE) return; - if (failure_reason == FailureReason::NONE) { - // As far as we know the fetch was successful, go over the entries in the - // cache and make sure all the responses are there and successful. - data_manager_->GetSettledFetchesForRegistration( - registration_id, std::make_unique<BackgroundFetchRequestMatchParams>(), - base::BindOnce(&BackgroundFetchContext::DidGetSettledFetches, - weak_factory_.GetWeakPtr(), registration_id)); - return; - } - - // The fetch failed, dispatch an appropriate event. auto controllers_iter = job_controllers_.find(registration_id.unique_id()); - DCHECK(controllers_iter != job_controllers_.end()); + + if (reason_to_abort == FailureReason::CANCELLED_BY_DEVELOPER) { + DCHECK(controllers_iter != job_controllers_.end()); + controllers_iter->second->Abort(reason_to_abort); + } auto registration = controllers_iter->second->NewRegistration( blink::mojom::BackgroundFetchResult::FAILURE); - DispatchCompletionEvent(registration_id, std::move(registration)); + + switch (reason_to_abort) { + case FailureReason::CANCELLED_BY_DEVELOPER: + case FailureReason::CANCELLED_FROM_UI: + CleanupRegistration(registration_id, {}, + blink::mojom::BackgroundFetchResult::FAILURE); + event_dispatcher_.DispatchBackgroundFetchAbortEvent( + registration_id, std::move(registration), base::DoNothing()); + return; + case FailureReason::TOTAL_DOWNLOAD_SIZE_EXCEEDED: + case FailureReason::SERVICE_WORKER_UNAVAILABLE: + case FailureReason::QUOTA_EXCEEDED: + case FailureReason::BAD_STATUS: + case FailureReason::FETCH_ERROR: + case FailureReason::NONE: + // This will send a BackgroundFetchFetched or BackgroundFetchFail event. + // We still need this to figure out which event to send. + // TODO(crbug.com/699957, crbug.com/874092): Add a method to only return + // the information needed to dispatch these events, instead of settled + // fetches. + data_manager_->GetSettledFetchesForRegistration( + registration_id, + std::make_unique<BackgroundFetchRequestMatchParams>(), + base::BindOnce(&BackgroundFetchContext::DidGetSettledFetches, + weak_factory_.GetWeakPtr(), registration_id, + std::move(registration))); + return; + } } void BackgroundFetchContext::DidGetSettledFetches( const BackgroundFetchRegistrationId& registration_id, + std::unique_ptr<BackgroundFetchRegistration> registration, blink::mojom::BackgroundFetchError error, FailureReason failure_reason, std::vector<BackgroundFetchSettledFetch> settled_fetches, @@ -476,53 +489,55 @@ failure_reason == FailureReason::SERVICE_WORKER_UNAVAILABLE || failure_reason == FailureReason::BAD_STATUS); - auto controllers_iter = job_controllers_.find(registration_id.unique_id()); - DCHECK(controllers_iter != job_controllers_.end()); - failure_reason = controllers_iter->second->MergeFailureReason(failure_reason); + if (error != blink::mojom::BackgroundFetchError::NONE) { + CleanupRegistration(registration_id, {} /* fetches */, + blink::mojom::BackgroundFetchResult::FAILURE, + true /* preserve_info_to_dispatch_click_event */); + return; + } - blink::mojom::BackgroundFetchResult result = - failure_reason == FailureReason::NONE - ? blink::mojom::BackgroundFetchResult::SUCCESS - : blink::mojom::BackgroundFetchResult::FAILURE; + DCHECK(job_controllers_.count(registration_id.unique_id())); - auto registration = controllers_iter->second->NewRegistration(result); - DispatchCompletionEvent(registration_id, std::move(registration)); -} - -void BackgroundFetchContext::DispatchCompletionEvent( - const BackgroundFetchRegistrationId& registration_id, - std::unique_ptr<BackgroundFetchRegistration> registration) { - DCHECK_CURRENTLY_ON(BrowserThread::IO); + // The `backgroundfetchsuccess` event will be invoked when all requests in the + // registration have completed successfully. In all other cases, the + // `backgroundfetchfail` event will be invoked instead. + if (registration->failure_reason == FailureReason::NONE && + failure_reason != FailureReason::NONE) { + registration->failure_reason = failure_reason; + } switch (registration->failure_reason) { case FailureReason::NONE: + registration->result = blink::mojom::BackgroundFetchResult::SUCCESS; event_dispatcher_.DispatchBackgroundFetchSuccessEvent( registration_id, std::move(registration), base::BindOnce( &BackgroundFetchContext::CleanupRegistration, weak_factory_.GetWeakPtr(), registration_id, + // The blob uuid is sent as part of |settled_fetches|. Bind + // |blob_data_handles| to the callback to keep them alive + // until the waitUntil event is resolved. + std::move(blob_data_handles), blink::mojom::BackgroundFetchResult::SUCCESS, true /* preserve_info_to_dispatch_click_event */)); return; case FailureReason::CANCELLED_FROM_UI: case FailureReason::CANCELLED_BY_DEVELOPER: - event_dispatcher_.DispatchBackgroundFetchAbortEvent( - registration_id, std::move(registration), - base::BindOnce(&BackgroundFetchContext::CleanupRegistration, - weak_factory_.GetWeakPtr(), registration_id, - blink::mojom::BackgroundFetchResult::FAILURE, - false /* preserve_info_to_dispatch_click_event */)); - return; case FailureReason::BAD_STATUS: case FailureReason::FETCH_ERROR: case FailureReason::SERVICE_WORKER_UNAVAILABLE: case FailureReason::QUOTA_EXCEEDED: case FailureReason::TOTAL_DOWNLOAD_SIZE_EXCEEDED: + registration->result = blink::mojom::BackgroundFetchResult::FAILURE; event_dispatcher_.DispatchBackgroundFetchFailEvent( registration_id, std::move(registration), base::BindOnce( &BackgroundFetchContext::CleanupRegistration, weak_factory_.GetWeakPtr(), registration_id, + // The blob uuid is sent as part of |settled_fetches|. Bind + // |blob_data_handles| to the callback to keep them alive + // until the waitUntil event is resolved. + std::move(blob_data_handles), blink::mojom::BackgroundFetchResult::FAILURE, true /* preserve_info_to_dispatch_click_event */)); return; @@ -531,6 +546,7 @@ void BackgroundFetchContext::CleanupRegistration( const BackgroundFetchRegistrationId& registration_id, + const std::vector<std::unique_ptr<storage::BlobDataHandle>>& blob_handles, blink::mojom::BackgroundFetchResult background_fetch_result, bool preserve_info_to_dispatch_click_event) { DCHECK_CURRENTLY_ON(BrowserThread::IO);
diff --git a/content/browser/background_fetch/background_fetch_context.h b/content/browser/background_fetch/background_fetch_context.h index 10e0327..7dea305 100644 --- a/content/browser/background_fetch/background_fetch_context.h +++ b/content/browser/background_fetch/background_fetch_context.h
@@ -201,12 +201,12 @@ void DidFinishJob( base::OnceCallback<void(blink::mojom::BackgroundFetchError)> callback, const BackgroundFetchRegistrationId& registration_id, - blink::mojom::BackgroundFetchFailureReason failure_reason); + blink::mojom::BackgroundFetchFailureReason reason_to_abort); // Called when the data manager finishes marking a registration as deleted. void DidMarkForDeletion( const BackgroundFetchRegistrationId& registration_id, - blink::mojom::BackgroundFetchFailureReason failure_reason, + blink::mojom::BackgroundFetchFailureReason reason_to_abort, base::OnceCallback<void(blink::mojom::BackgroundFetchError)> callback, blink::mojom::BackgroundFetchError error); @@ -214,6 +214,7 @@ // retrieved from storage, and the Service Worker event can be invoked. void DidGetSettledFetches( const BackgroundFetchRegistrationId& registration_id, + std::unique_ptr<BackgroundFetchRegistration> registration, blink::mojom::BackgroundFetchError error, blink::mojom::BackgroundFetchFailureReason failure_reason, std::vector<BackgroundFetchSettledFetch> settled_fetches, @@ -229,11 +230,6 @@ std::vector<BackgroundFetchSettledFetch> settled_fetches, std::vector<std::unique_ptr<storage::BlobDataHandle>> blob_data_handles); - // Dispatches an appropriate event (success, fail, abort). - void DispatchCompletionEvent( - const BackgroundFetchRegistrationId& registration_id, - std::unique_ptr<BackgroundFetchRegistration> registration); - // Called when the notification UI for the background fetch job associated // with |unique_id| is activated. void DispatchClickEvent(const std::string& unique_id); @@ -245,14 +241,16 @@ initialization_data); // Called when all processing for the |registration_id| has been finished and - // the job is ready to be deleted. - // |preserve_info_to_dispatch_click_event|, when set, preserves the - // registration ID, and the result of the Fetch when it completed, in - // |completed_fetches_|. This is not done when fetch is aborted or cancelled. - // We use this information to propagate BackgroundFetchClicked event to the - // developer, when the user taps the UI. + // the job is ready to be deleted. |blob_handles| are unused, but some callers + // use it to keep blobs alive for the right duration. + // |partial cleanup|, when set, preserves the registration ID, and the result + // of Fetch when it completed, in |completed_fetches_|. This is not done when + // fetch is aborted or cancelled. We use this information to propagate + // BackgroundFetchClicked event to the developer, when the user taps the UI. void CleanupRegistration( const BackgroundFetchRegistrationId& registration_id, + const std::vector<std::unique_ptr<storage::BlobDataHandle>>& + blob_data_handles, blink::mojom::BackgroundFetchResult background_fetch_result, bool preserve_info_to_dispatch_click_event = false);
diff --git a/content/browser/background_fetch/background_fetch_job_controller.cc b/content/browser/background_fetch/background_fetch_job_controller.cc index 0b16fc3..aae90ba 100644 --- a/content/browser/background_fetch/background_fetch_job_controller.cc +++ b/content/browser/background_fetch/background_fetch_job_controller.cc
@@ -13,8 +13,6 @@ namespace content { -using blink::mojom::BackgroundFetchFailureReason; - BackgroundFetchJobController::BackgroundFetchJobController( BackgroundFetchDelegateProxy* delegate_proxy, BackgroundFetchScheduler* scheduler, @@ -196,12 +194,10 @@ std::unique_ptr<BackgroundFetchRegistration> BackgroundFetchJobController::NewRegistration( blink::mojom::BackgroundFetchResult result) const { - DCHECK_NE(result, blink::mojom::BackgroundFetchResult::UNSET); - return std::make_unique<BackgroundFetchRegistration>( registration_id().developer_id(), registration_id().unique_id(), 0 /* upload_total */, 0 /* uploaded */, total_downloads_size_, - complete_requests_downloaded_bytes_cache_, result, failure_reason_); + complete_requests_downloaded_bytes_cache_, result, reason_to_abort_); } uint64_t BackgroundFetchJobController::GetInProgressDownloadedBytes() { @@ -209,8 +205,8 @@ } void BackgroundFetchJobController::Abort( - BackgroundFetchFailureReason failure_reason) { - failure_reason_ = failure_reason; + blink::mojom::BackgroundFetchFailureReason reason_to_abort) { + reason_to_abort_ = reason_to_abort; // Stop propagating any in-flight events to the scheduler. active_request_finished_callback_.Reset(); @@ -218,14 +214,7 @@ // Cancel any in-flight downloads and UI through the BGFetchDelegate. delegate_proxy_->Abort(registration_id().unique_id()); - Finish(failure_reason_); -} - -BackgroundFetchFailureReason BackgroundFetchJobController::MergeFailureReason( - BackgroundFetchFailureReason failure_reason) { - if (failure_reason_ == BackgroundFetchFailureReason::NONE) - failure_reason_ = failure_reason; - return failure_reason_; + Finish(reason_to_abort); } } // namespace content
diff --git a/content/browser/background_fetch/background_fetch_job_controller.h b/content/browser/background_fetch/background_fetch_job_controller.h index 5461744e..56d0941 100644 --- a/content/browser/background_fetch/background_fetch_job_controller.h +++ b/content/browser/background_fetch/background_fetch_job_controller.h
@@ -94,11 +94,6 @@ // Returns the number of requests that comprise the whole job. int total_downloads() const { return total_downloads_; } - // If |failure_reason_| is none, overwrites it with |failure_reason|, and - // returns the new value. - blink::mojom::BackgroundFetchFailureReason MergeFailureReason( - blink::mojom::BackgroundFetchFailureReason failure_reason); - base::WeakPtr<BackgroundFetchJobController> GetWeakPtr() { return weak_ptr_factory_.GetWeakPtr(); } @@ -119,7 +114,7 @@ std::vector<scoped_refptr<BackgroundFetchRequestInfo>> TakeOutstandingRequests() override; void Abort( - blink::mojom::BackgroundFetchFailureReason failure_reason) override; + blink::mojom::BackgroundFetchFailureReason reason_to_abort) override; private: // Performs mixed content checks on the |request| for Background Fetch. @@ -172,7 +167,7 @@ int completed_downloads_ = 0; // The reason background fetch was aborted. - blink::mojom::BackgroundFetchFailureReason failure_reason_ = + blink::mojom::BackgroundFetchFailureReason reason_to_abort_ = blink::mojom::BackgroundFetchFailureReason::NONE; base::WeakPtrFactory<BackgroundFetchJobController> weak_ptr_factory_;
diff --git a/content/browser/child_process_launcher_helper_mac.cc b/content/browser/child_process_launcher_helper_mac.cc index c1b02ef..7f67abb2 100644 --- a/content/browser/child_process_launcher_helper_mac.cc +++ b/content/browser/child_process_launcher_helper_mac.cc
@@ -73,34 +73,8 @@ command_line_->HasSwitch(service_manager::switches::kNoSandbox) || service_manager::IsUnsandboxedSandboxType(sandbox_type); - // TODO(kerrnel): Delete this switch once the V2 sandbox is always enabled. - bool use_v2 = base::FeatureList::IsEnabled(features::kMacV2Sandbox); - - switch (sandbox_type) { - case service_manager::SANDBOX_TYPE_NO_SANDBOX: - break; - case service_manager::SANDBOX_TYPE_CDM: - case service_manager::SANDBOX_TYPE_PPAPI: - case service_manager::SANDBOX_TYPE_RENDERER: - case service_manager::SANDBOX_TYPE_UTILITY: - case service_manager::SANDBOX_TYPE_NACL_LOADER: - case service_manager::SANDBOX_TYPE_PDF_COMPOSITOR: - case service_manager::SANDBOX_TYPE_PROFILING: - // If the feature experiment is enabled and this process type supports - // the v2 sandbox, use it. - use_v2 &= true; - break; - case service_manager::SANDBOX_TYPE_AUDIO: - // The audio service only exists with the v2 sandbox. - use_v2 |= true; - break; - default: - // This is a 'break' because the V2 sandbox is not enabled for all - // processes yet, and so there are sandbox types like NETWORK that - // should not be run under the V2 sandbox. - use_v2 = false; - break; - } + bool use_v2 = + !no_sandbox && (sandbox_type != service_manager::SANDBOX_TYPE_GPU); if (use_v2 && !no_sandbox) { // Generate the profile string.
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc index 3ef8b77..78e52104 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -48,9 +48,9 @@ #include "content/browser/gpu/compositor_util.h" #include "content/browser/gpu/gpu_data_manager_impl.h" #include "content/browser/renderer_host/render_widget_host_impl.h" -#include "content/common/gpu_stream_constants.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/content_switches.h" +#include "content/public/common/gpu_stream_constants.h" #include "gpu/GLES2/gl2extchromium.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "gpu/command_buffer/client/raster_interface.h"
diff --git a/content/browser/compositor/viz_process_transport_factory.cc b/content/browser/compositor/viz_process_transport_factory.cc index 2e4a7ba..8ae1f00f 100644 --- a/content/browser/compositor/viz_process_transport_factory.cc +++ b/content/browser/compositor/viz_process_transport_factory.cc
@@ -26,11 +26,11 @@ #include "content/browser/gpu/compositor_util.h" #include "content/browser/gpu/gpu_data_manager_impl.h" #include "content/browser/gpu/gpu_process_host.h" -#include "content/common/gpu_stream_constants.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" +#include "content/public/common/gpu_stream_constants.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "gpu/command_buffer/client/raster_interface.h" #include "gpu/ipc/client/gpu_channel_host.h"
diff --git a/content/browser/find_request_manager_browsertest.cc b/content/browser/find_request_manager_browsertest.cc index 5dcc4b68..e8c0f18 100644 --- a/content/browser/find_request_manager_browsertest.cc +++ b/content/browser/find_request_manager_browsertest.cc
@@ -377,7 +377,7 @@ // Remove a frame. FrameTreeNode* root = contents()->GetFrameTree()->root(); - root->RemoveChild(root->child_at(0)); + root->current_frame_host()->RemoveChild(root->child_at(0)); // The number of matches and active match ordinal should update automatically // to exclude the matches from the removed frame.
diff --git a/content/browser/frame_host/frame_tree.cc b/content/browser/frame_host/frame_tree.cc index 4952e5e8..8baa4a4 100644 --- a/content/browser/frame_host/frame_tree.cc +++ b/content/browser/frame_host/frame_tree.cc
@@ -207,8 +207,8 @@ new_node->set_was_discarded(); // Add the new node to the FrameTree, creating the RenderFrameHost. - FrameTreeNode* added_node = - parent->AddChild(std::move(new_node), process_id, new_routing_id); + FrameTreeNode* added_node = parent->current_frame_host()->AddChild( + std::move(new_node), process_id, new_routing_id); DCHECK(interface_provider_request.is_pending()); added_node->current_frame_host()->BindInterfaceProviderRequest( @@ -239,7 +239,7 @@ return; } - parent->RemoveChild(child); + parent->current_frame_host()->RemoveChild(child); } void FrameTree::CreateProxiesForSiteInstance(
diff --git a/content/browser/frame_host/frame_tree_node.cc b/content/browser/frame_host/frame_tree_node.cc index 6ce11e7..49d12d5f 100644 --- a/content/browser/frame_host/frame_tree_node.cc +++ b/content/browser/frame_host/frame_tree_node.cc
@@ -130,9 +130,8 @@ } FrameTreeNode::~FrameTreeNode() { - // Remove the children. See https://crbug.com/612450 for explanation why we - // don't just call the std::vector::clear method. - std::vector<std::unique_ptr<FrameTreeNode>>().swap(children_); + // Remove the children. + current_frame_host()->ResetChildren(); // If the removed frame was created by a script, then its history entry will // never be reused - we can save some memory by removing the history entry. @@ -177,47 +176,8 @@ return frame_tree_->root() == this; } -FrameTreeNode* FrameTreeNode::AddChild(std::unique_ptr<FrameTreeNode> child, - int process_id, - int frame_routing_id) { - // Child frame must always be created in the same process as the parent. - CHECK_EQ(process_id, render_manager_.current_host()->GetProcess()->GetID()); - - // Initialize the RenderFrameHost for the new node. We always create child - // frames in the same SiteInstance as the current frame, and they can swap to - // a different one if they navigate away. - child->render_manager()->Init( - render_manager_.current_host()->GetSiteInstance(), - render_manager_.current_host()->GetRoutingID(), frame_routing_id, - MSG_ROUTING_NONE, false); - - // Other renderer processes in this BrowsingInstance may need to find out - // about the new frame. Create a proxy for the child frame in all - // SiteInstances that have a proxy for the frame's parent, since all frames - // in a frame tree should have the same set of proxies. - render_manager_.CreateProxiesForChildFrame(child.get()); - - children_.push_back(std::move(child)); - return children_.back().get(); -} - -void FrameTreeNode::RemoveChild(FrameTreeNode* child) { - for (auto iter = children_.begin(); iter != children_.end(); ++iter) { - if (iter->get() == child) { - // Subtle: we need to make sure the node is gone from the tree before - // observers are notified of its deletion. - std::unique_ptr<FrameTreeNode> node_to_delete(std::move(*iter)); - children_.erase(iter); - node_to_delete.reset(); - return; - } - } -} - void FrameTreeNode::ResetForNewProcess() { - // Remove child nodes from the tree, then delete them. This destruction - // operation will notify observers. - std::vector<std::unique_ptr<FrameTreeNode>>().swap(children_); + current_frame_host()->ResetChildren(); } void FrameTreeNode::ResetForNavigation() {
diff --git a/content/browser/frame_host/frame_tree_node.h b/content/browser/frame_host/frame_tree_node.h index aa21efda..fdc902b 100644 --- a/content/browser/frame_host/frame_tree_node.h +++ b/content/browser/frame_host/frame_tree_node.h
@@ -39,6 +39,14 @@ // of those frames. We are mirroring this tree in the browser process. This // class represents a node in this tree and is a wrapper for all objects that // are frame-specific (as opposed to page-specific). +// +// Each FrameTreeNode has a current RenderFrameHost, which can change over +// time as the frame is navigated. Any immediate subframes of the current +// document are tracked using FrameTreeNodes owned by the current +// RenderFrameHost, rather than as children of FrameTreeNode itself. This +// allows subframe FrameTreeNodes to stay alive while a RenderFrameHost is +// still alive - for example while pending deletion, after a new current +// RenderFrameHost has replaced it. class CONTENT_EXPORT FrameTreeNode { public: class Observer { @@ -77,11 +85,6 @@ bool IsMainFrame() const; - FrameTreeNode* AddChild(std::unique_ptr<FrameTreeNode> child, - int process_id, - int frame_routing_id); - void RemoveChild(FrameTreeNode* child); - // Clears process specific-state in this node to prepare for a new process. void ResetForNewProcess(); @@ -121,9 +124,7 @@ return devtools_frame_token_; } - size_t child_count() const { - return children_.size(); - } + size_t child_count() const { return current_frame_host()->child_count(); } unsigned int depth() const { return depth_; } @@ -146,7 +147,7 @@ void SetOriginalOpener(FrameTreeNode* opener); FrameTreeNode* child_at(size_t index) const { - return children_[index].get(); + return current_frame_host()->child_at(index); } // Returns the URL of the last committed page in the current frame. @@ -464,9 +465,6 @@ // destroyed. std::unique_ptr<OpenerDestroyedObserver> original_opener_observer_; - // The immediate children of this specific frame. - std::vector<std::unique_ptr<FrameTreeNode>> children_; - // Whether this frame has committed any real load, replacing its initial // about:blank page. bool has_committed_real_load_;
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index 75d3695..f79e26d 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -1714,6 +1714,51 @@ SetLastCommittedOrigin(origin); } +FrameTreeNode* RenderFrameHostImpl::AddChild( + std::unique_ptr<FrameTreeNode> child, + int process_id, + int frame_routing_id) { + // Child frame must always be created in the same process as the parent. + CHECK_EQ(process_id, GetProcess()->GetID()); + + // Initialize the RenderFrameHost for the new node. We always create child + // frames in the same SiteInstance as the current frame, and they can swap to + // a different one if they navigate away. + child->render_manager()->Init(render_view_host()->GetSiteInstance(), + render_view_host()->GetRoutingID(), + frame_routing_id, MSG_ROUTING_NONE, false); + + // Other renderer processes in this BrowsingInstance may need to find out + // about the new frame. Create a proxy for the child frame in all + // SiteInstances that have a proxy for the frame's parent, since all frames + // in a frame tree should have the same set of proxies. + frame_tree_node_->render_manager()->CreateProxiesForChildFrame(child.get()); + + children_.push_back(std::move(child)); + + return children_.back().get(); +} + +void RenderFrameHostImpl::RemoveChild(FrameTreeNode* child) { + for (auto iter = children_.begin(); iter != children_.end(); ++iter) { + if (iter->get() == child) { + // Subtle: we need to make sure the node is gone from the tree before + // observers are notified of its deletion. + std::unique_ptr<FrameTreeNode> node_to_delete(std::move(*iter)); + children_.erase(iter); + node_to_delete.reset(); + return; + } + } +} + +void RenderFrameHostImpl::ResetChildren() { + // Remove child nodes from the tree, then delete them. This destruction + // operation will notify observers. See https://crbug.com/612450 for + // explanation why we don't just call the std::vector::clear method. + std::vector<std::unique_ptr<FrameTreeNode>>().swap(children_); +} + void RenderFrameHostImpl::SetLastCommittedUrl(const GURL& url) { last_committed_url_ = url; }
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h index 6d2f10d63..9e5d027 100644 --- a/content/browser/frame_host/render_frame_host_impl.h +++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -343,6 +343,17 @@ RenderFrameHostDelegate* delegate() { return delegate_; } FrameTreeNode* frame_tree_node() { return frame_tree_node_; } + // Methods to add/remove/reset/query child FrameTreeNodes of this frame. + // See class-level comment for FrameTreeNode for how the frame tree is + // represented. + size_t child_count() { return children_.size(); } + FrameTreeNode* child_at(size_t index) const { return children_[index].get(); } + FrameTreeNode* AddChild(std::unique_ptr<FrameTreeNode> child, + int process_id, + int frame_routing_id); + void RemoveChild(FrameTreeNode* child); + void ResetChildren(); + // Allows FrameTreeNode::SetCurrentURL to update this frame's last committed // URL. Do not call this directly, since we rely on SetCurrentURL to track // whether a real load has committed or not. @@ -1327,6 +1338,9 @@ // The FrameTreeNode which this RenderFrameHostImpl is hosted in. FrameTreeNode* const frame_tree_node_; + // The immediate children of this specific frame. + std::vector<std::unique_ptr<FrameTreeNode>> children_; + // The active parent RenderFrameHost for this frame, if it is a subframe. // Null for the main frame. This is cached because the parent FrameTreeNode // may change its current RenderFrameHost while this child is pending
diff --git a/content/browser/gpu/gpu_ipc_browsertests.cc b/content/browser/gpu/gpu_ipc_browsertests.cc index 801da2d8f..02b5dac7 100644 --- a/content/browser/gpu/gpu_ipc_browsertests.cc +++ b/content/browser/gpu/gpu_ipc_browsertests.cc
@@ -10,11 +10,11 @@ #include "content/browser/browser_main_loop.h" #include "content/browser/compositor/image_transport_factory.h" #include "content/browser/gpu/gpu_process_host.h" -#include "content/common/gpu_stream_constants.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/gpu_data_manager.h" #include "content/public/browser/gpu_utils.h" #include "content/public/common/content_switches.h" +#include "content/public/common/gpu_stream_constants.h" #include "content/public/test/content_browser_test.h" #include "content/test/gpu_browsertest_helpers.h" #include "gpu/ipc/client/command_buffer_proxy_impl.h"
diff --git a/content/browser/indexed_db/indexed_db_factory_impl.cc b/content/browser/indexed_db/indexed_db_factory_impl.cc index 4d34582..da555dc5 100644 --- a/content/browser/indexed_db/indexed_db_factory_impl.cc +++ b/content/browser/indexed_db/indexed_db_factory_impl.cc
@@ -15,6 +15,7 @@ #include "base/logging.h" #include "base/metrics/histogram_macros.h" #include "base/rand_util.h" +#include "base/stl_util.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "content/browser/indexed_db/indexed_db_backing_store.h" @@ -605,11 +606,12 @@ bool IndexedDBFactoryImpl::IsDatabaseOpen(const Origin& origin, const base::string16& name) const { - return !!database_map_.count(IndexedDBDatabase::Identifier(origin, name)); + return base::ContainsKey(database_map_, + IndexedDBDatabase::Identifier(origin, name)); } bool IndexedDBFactoryImpl::IsBackingStoreOpen(const Origin& origin) const { - return backing_store_map_.find(origin) != backing_store_map_.end(); + return base::ContainsKey(backing_store_map_, origin); } bool IndexedDBFactoryImpl::IsBackingStorePendingClose(
diff --git a/content/browser/media/android/browser_gpu_video_accelerator_factories.cc b/content/browser/media/android/browser_gpu_video_accelerator_factories.cc index df09b0b..1b8d471 100644 --- a/content/browser/media/android/browser_gpu_video_accelerator_factories.cc +++ b/content/browser/media/android/browser_gpu_video_accelerator_factories.cc
@@ -5,8 +5,8 @@ #include "content/browser/media/android/browser_gpu_video_accelerator_factories.h" #include "content/browser/browser_main_loop.h" -#include "content/common/gpu_stream_constants.h" #include "content/public/browser/android/gpu_video_accelerator_factories_provider.h" +#include "content/public/common/gpu_stream_constants.h" #include "gpu/command_buffer/client/shared_memory_limits.h" #include "gpu/command_buffer/common/context_creation_attribs.h" #include "gpu/ipc/client/command_buffer_proxy_impl.h"
diff --git a/content/browser/media/session/media_session_impl.cc b/content/browser/media/session/media_session_impl.cc index 23ef1a81..19cf17e 100644 --- a/content/browser/media/session/media_session_impl.cc +++ b/content/browser/media/session/media_session_impl.cc
@@ -631,6 +631,10 @@ AudioFocusDelegate::AudioFocusResult MediaSessionImpl::RequestSystemAudioFocus( AudioFocusType audio_focus_type) { + // |kGainTransient| is not used in MediaSessionImpl. + DCHECK_NE(media_session::mojom::AudioFocusType::kGainTransient, + audio_focus_type); + AudioFocusDelegate::AudioFocusResult result = delegate_->RequestAudioFocus(audio_focus_type); desired_audio_focus_type_ = audio_focus_type; @@ -735,6 +739,10 @@ // media session. OnSuspendInternal(SuspendType::kSystem, State::SUSPENDED); break; + case AudioFocusType::kGainTransient: + // MediaSessionImpl does not use |kGainTransient|. + NOTREACHED(); + break; case AudioFocusType::kGainTransientMayDuck: // The focus request failed, we should suspend any players that have // the same audio focus type.
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index c120832..30f0df9 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -66,12 +66,12 @@ #include "content/browser/gpu/gpu_data_manager_impl.h" #include "content/browser/gpu/gpu_process_host.h" #include "content/browser/renderer_host/render_widget_host_impl.h" -#include "content/common/gpu_stream_constants.h" #include "content/public/browser/android/compositor.h" #include "content/public/browser/android/compositor_client.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/content_switches.h" +#include "content/public/common/gpu_stream_constants.h" #include "gpu/command_buffer/client/context_support.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "gpu/command_buffer/common/swap_buffers_complete_params.h" @@ -148,18 +148,28 @@ class AndroidHostDisplayClient : public viz::HostDisplayClient { public: explicit AndroidHostDisplayClient( - base::RepeatingCallback<void(const gfx::Size&)> on_swap) + base::RepeatingCallback<void(const gfx::Size&)> on_swap, + base::RepeatingCallback<void(gpu::ContextResult)> + on_context_creation_failure) : HostDisplayClient(gfx::kNullAcceleratedWidget), - on_swap_(std::move(on_swap)) {} + on_swap_(std::move(on_swap)), + on_context_creation_failure_(std::move(on_context_creation_failure)) {} // viz::mojom::DisplayClient implementation: void DidCompleteSwapWithSize(const gfx::Size& pixel_size) override { if (on_swap_) on_swap_.Run(pixel_size); } + void OnFatalOrSurfaceContextCreationFailure( + gpu::ContextResult context_result) override { + if (on_context_creation_failure_) + on_context_creation_failure_.Run(context_result); + } private: base::RepeatingCallback<void(const gfx::Size&)> on_swap_; + base::RepeatingCallback<void(gpu::ContextResult)> + on_context_creation_failure_; }; class CompositorDependencies { @@ -1364,9 +1374,12 @@ viz::mojom::CompositorFrameSinkClientRequest client_request = mojo::MakeRequest(&root_params->compositor_frame_sink_client); root_params->display_private = mojo::MakeRequest(&display_private_); - display_client_ = - std::make_unique<AndroidHostDisplayClient>(base::BindRepeating( - &CompositorImpl::DidSwapBuffers, weak_factory_.GetWeakPtr())); + display_client_ = std::make_unique<AndroidHostDisplayClient>( + base::BindRepeating(&CompositorImpl::DidSwapBuffers, + weak_factory_.GetWeakPtr()), + base::BindRepeating( + &CompositorImpl::OnFatalOrSurfaceContextCreationFailure, + weak_factory_.GetWeakPtr())); root_params->display_client = display_client_->GetBoundPtr(task_runner).PassInterface(); @@ -1416,4 +1429,10 @@ return viz::LocalSurfaceId(); } +void CompositorImpl::OnFatalOrSurfaceContextCreationFailure( + gpu::ContextResult context_result) { + LOG_IF(FATAL, context_result == gpu::ContextResult::kFatalFailure) + << "Fatal error making Gpu context"; +} + } // namespace content
diff --git a/content/browser/renderer_host/compositor_impl_android.h b/content/browser/renderer_host/compositor_impl_android.h index 34a7d12..f761c11a 100644 --- a/content/browser/renderer_host/compositor_impl_android.h +++ b/content/browser/renderer_host/compositor_impl_android.h
@@ -194,6 +194,10 @@ // Registers the root frame sink ID. void RegisterRootFrameSink(); + // Called when we fail to create the context for the root frame sink. + void OnFatalOrSurfaceContextCreationFailure( + gpu::ContextResult context_result); + // Viz specific functions: void InitializeVizLayerTreeFrameSink( scoped_refptr<ws::ContextProviderCommandBuffer> context_provider);
diff --git a/content/browser/renderer_host/compositor_impl_android_browsertest.cc b/content/browser/renderer_host/compositor_impl_android_browsertest.cc index 207c42d..e2b2f8a6 100644 --- a/content/browser/renderer_host/compositor_impl_android_browsertest.cc +++ b/content/browser/renderer_host/compositor_impl_android_browsertest.cc
@@ -11,8 +11,8 @@ #include "content/browser/renderer_host/compositor_impl_android.h" #include "content/browser/renderer_host/render_widget_host_view_android.h" #include "content/browser/web_contents/web_contents_impl.h" -#include "content/common/gpu_stream_constants.h" #include "content/public/common/content_switches.h" +#include "content/public/common/gpu_stream_constants.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/content_browser_test.h" #include "content/public/test/content_browser_test_utils.h"
diff --git a/content/browser/renderer_host/hit_test_debug_key_event_observer.cc b/content/browser/renderer_host/hit_test_debug_key_event_observer.cc deleted file mode 100644 index ee542014..0000000 --- a/content/browser/renderer_host/hit_test_debug_key_event_observer.cc +++ /dev/null
@@ -1,76 +0,0 @@ -// Copyright 2018 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 "content/browser/renderer_host/hit_test_debug_key_event_observer.h" - -#include "components/viz/common/hit_test/hit_test_region_list.h" -#include "components/viz/host/host_frame_sink_manager.h" -#include "content/browser/compositor/surface_utils.h" -#include "content/browser/renderer_host/render_widget_host_impl.h" -#include "content/browser/renderer_host/render_widget_host_view_base.h" -#include "ui/events/keycodes/keyboard_codes.h" - -typedef blink::WebInputEvent::Type Type; -typedef blink::WebInputEvent::Modifiers Modifiers; - -namespace { - -viz::HitTestQuery* GetHitTestQuery( - viz::HostFrameSinkManager* host_frame_sink_manager, - const viz::FrameSinkId& frame_sink_id) { - if (!frame_sink_id.is_valid()) - return nullptr; - const auto& display_hit_test_query_map = - host_frame_sink_manager->display_hit_test_query(); - const auto iter = display_hit_test_query_map.find(frame_sink_id); - if (iter == display_hit_test_query_map.end()) - return nullptr; - return iter->second.get(); -} - -} // namespace - -namespace content { - -HitTestDebugKeyEventObserver::HitTestDebugKeyEventObserver( - RenderWidgetHostImpl* host) - : host_(host), hit_test_query_(nullptr) { - host_->AddInputEventObserver(this); -} - -HitTestDebugKeyEventObserver::~HitTestDebugKeyEventObserver() { - host_->RemoveInputEventObserver(this); -} - -void HitTestDebugKeyEventObserver::OnInputEventAck( - InputEventAckSource source, - InputEventAckState state, - const blink::WebInputEvent& event) { - if (INPUT_EVENT_ACK_STATE_CONSUMED == state || - (event.GetType() != Type::kRawKeyDown && - event.GetType() != Type::kKeyDown)) { - return; - } - - const blink::WebKeyboardEvent& key_event = - static_cast<const blink::WebKeyboardEvent&>(event); - - if (key_event.windows_key_code != ui::VKEY_H || - key_event.GetModifiers() != - (Modifiers::kControlKey | Modifiers::kShiftKey)) { - return; - } - - if (!hit_test_query_) { - hit_test_query_ = GetHitTestQuery(GetHostFrameSinkManager(), - host_->GetView()->GetRootFrameSinkId()); - } - if (hit_test_query_) { - std::string printed_hit_test_data = hit_test_query_->PrintHitTestData(); - VLOG(1) << (printed_hit_test_data.empty() ? "No hit-test data." - : printed_hit_test_data); - } -} - -} // namespace content
diff --git a/content/browser/renderer_host/hit_test_debug_key_event_observer.h b/content/browser/renderer_host/hit_test_debug_key_event_observer.h deleted file mode 100644 index 90e20ef..0000000 --- a/content/browser/renderer_host/hit_test_debug_key_event_observer.h +++ /dev/null
@@ -1,40 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_RENDERER_HOST_HIT_TEST_DEBUG_KEY_EVENT_OBSERVER_H_ -#define CONTENT_BROWSER_RENDERER_HOST_HIT_TEST_DEBUG_KEY_EVENT_OBSERVER_H_ - -#include "content/public/browser/render_widget_host.h" - -namespace viz { - -class HitTestQuery; - -} // namespace viz - -namespace content { - -class RenderWidgetHostImpl; - -// Implements the RenderWidgetHost::InputEventObserver interface, and acts on -// keyboard input events to print hit-test data. -class HitTestDebugKeyEventObserver - : public RenderWidgetHost::InputEventObserver { - public: - explicit HitTestDebugKeyEventObserver(RenderWidgetHostImpl* host); - ~HitTestDebugKeyEventObserver() override; - - // RenderWidgetHost::InputEventObserver: - void OnInputEventAck(InputEventAckSource source, - InputEventAckState state, - const blink::WebInputEvent&) override; - - private: - RenderWidgetHostImpl* host_; - viz::HitTestQuery* hit_test_query_; -}; - -} // namespace content - -#endif // CONTENT_BROWSER_RENDERER_HOST_HIT_TEST_DEBUG_KEY_EVENT_OBSERVER_H_
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc index 9750d3c..c7d29b7 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -977,10 +977,6 @@ Send(new ViewMsg_MoveOrResizeStarted(GetRoutingID())); } -void RenderViewHostImpl::SelectWordAroundCaret() { - Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); -} - void RenderViewHostImpl::PostRenderViewReady() { GetProcess()->PostTaskWhenProcessIsReady(base::BindOnce( &RenderViewHostImpl::RenderViewReady, weak_factory_.GetWeakPtr()));
diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h index 5df82a9..e70977a 100644 --- a/content/browser/renderer_host/render_view_host_impl.h +++ b/content/browser/renderer_host/render_view_host_impl.h
@@ -109,7 +109,6 @@ WebPreferences GetWebkitPreferences() override; void UpdateWebkitPreferences(const WebPreferences& prefs) override; void OnWebkitPreferencesChanged() override; - void SelectWordAroundCaret() override; // RenderProcessHostObserver implementation void RenderProcessExited(RenderProcessHost* host,
diff --git a/content/browser/renderer_host/render_widget_host_input_event_router.cc b/content/browser/renderer_host/render_widget_host_input_event_router.cc index 117bdecf..39b30d84 100644 --- a/content/browser/renderer_host/render_widget_host_input_event_router.cc +++ b/content/browser/renderer_host/render_widget_host_input_event_router.cc
@@ -1709,4 +1709,11 @@ mouse_capture_target_.target = nullptr; } +RenderWidgetHostImpl* +RenderWidgetHostInputEventRouter::GetMouseCaptureWidgetForTests() const { + if (mouse_capture_target_.target) + return mouse_capture_target_.target->host(); + return nullptr; +} + } // namespace content
diff --git a/content/browser/renderer_host/render_widget_host_input_event_router.h b/content/browser/renderer_host/render_widget_host_input_event_router.h index f7d74d7a..e1bf8094 100644 --- a/content/browser/renderer_host/render_widget_host_input_event_router.h +++ b/content/browser/renderer_host/render_widget_host_input_event_router.h
@@ -127,6 +127,7 @@ // Allows a target to claim or release capture of mouse events. void SetMouseCaptureTarget(RenderWidgetHostViewBase* target, bool captures_dragging); + RenderWidgetHostImpl* GetMouseCaptureWidgetForTests() const; std::vector<RenderWidgetHostView*> GetRenderWidgetHostViewsForTests() const; RenderWidgetTargeter* GetRenderWidgetTargeterForTests();
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc index 85469b0..9e22da6 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.cc +++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -62,8 +62,6 @@ #include "content/browser/renderer_host/render_widget_host_input_event_router.h" #include "content/browser/renderer_host/ui_events_helper.h" #include "content/common/content_switches_internal.h" -#include "content/common/input_messages.h" -#include "content/common/view_messages.h" #include "content/public/browser/android/compositor.h" #include "content/public/browser/android/synchronous_compositor_client.h" #include "content/public/browser/browser_thread.h" @@ -73,8 +71,6 @@ #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" #include "content/public/common/use_zoom_for_dsf_policy.h" -#include "ipc/ipc_message_macros.h" -#include "ipc/ipc_message_start.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkColor.h" @@ -249,17 +245,6 @@ destruction_observers_.RemoveObserver(observer); } -bool RenderWidgetHostViewAndroid::OnMessageReceived( - const IPC::Message& message) { - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) - IPC_MESSAGE_HANDLER(ViewHostMsg_SelectWordAroundCaretAck, - OnSelectWordAroundCaretAck) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - return handled; -} - void RenderWidgetHostViewAndroid::InitAsChild(gfx::NativeView parent_view) { NOTIMPLEMENTED(); } @@ -473,9 +458,9 @@ return is_showing_ && view_.parent(); } -void RenderWidgetHostViewAndroid::OnSelectWordAroundCaretAck(bool did_select, - int start_adjust, - int end_adjust) { +void RenderWidgetHostViewAndroid::SelectWordAroundCaretAck(bool did_select, + int start_adjust, + int end_adjust) { if (!selection_popup_controller_) return; selection_popup_controller_->OnSelectWordAroundCaretAck(
diff --git a/content/browser/renderer_host/render_widget_host_view_android.h b/content/browser/renderer_host/render_widget_host_view_android.h index 1cad17bc..85cb772 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.h +++ b/content/browser/renderer_host/render_widget_host_view_android.h
@@ -95,7 +95,6 @@ } // RenderWidgetHostView implementation. - bool OnMessageReceived(const IPC::Message& msg) override; void InitAsChild(gfx::NativeView parent_view) override; void InitAsPopup(RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) override; @@ -290,9 +289,9 @@ void ShowContextMenuAtPoint(const gfx::Point& point, ui::MenuSourceType); void DismissTextHandles(); void SetTextHandlesTemporarilyHidden(bool hide_handles); - void OnSelectWordAroundCaretAck(bool did_select, - int start_adjust, - int end_adjust); + void SelectWordAroundCaretAck(bool did_select, + int start_adjust, + int end_adjust); void SynchronousFrameMetadata(viz::CompositorFrameMetadata frame_metadata);
diff --git a/content/browser/renderer_host/render_widget_host_view_event_handler.cc b/content/browser/renderer_host/render_widget_host_view_event_handler.cc index caea824..7318323b 100644 --- a/content/browser/renderer_host/render_widget_host_view_event_handler.cc +++ b/content/browser/renderer_host/render_widget_host_view_event_handler.cc
@@ -4,11 +4,8 @@ #include "content/browser/renderer_host/render_widget_host_view_event_handler.h" -#include "base/command_line.h" #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" -#include "components/viz/common/features.h" -#include "content/browser/renderer_host/hit_test_debug_key_event_observer.h" #include "content/browser/renderer_host/input/touch_selection_controller_client_aura.h" #include "content/browser/renderer_host/overscroll_controller.h" #include "content/browser/renderer_host/render_view_host_delegate.h" @@ -104,15 +101,6 @@ return view->GetWidgetType() == content::WidgetType::kPopup; } -// Enables hit-test debug logging. -const char kEnableVizHitTestDebug[] = "enable-viz-hit-test-debug"; - -inline bool IsVizHitTestingDebugEnabled() { - return features::IsVizHitTestingEnabled() && - base::CommandLine::ForCurrentProcess()->HasSwitch( - kEnableVizHitTestDebug); -} - } // namespace namespace content { @@ -140,10 +128,7 @@ popup_child_event_handler_(nullptr), delegate_(delegate), window_(nullptr), - mouse_wheel_phase_handler_(host_view), - debug_observer_(IsVizHitTestingDebugEnabled() - ? std::make_unique<HitTestDebugKeyEventObserver>(host) - : nullptr) {} + mouse_wheel_phase_handler_(host_view) {} RenderWidgetHostViewEventHandler::~RenderWidgetHostViewEventHandler() {}
diff --git a/content/browser/renderer_host/render_widget_host_view_event_handler.h b/content/browser/renderer_host/render_widget_host_view_event_handler.h index 8b28ee30..5db1ce0 100644 --- a/content/browser/renderer_host/render_widget_host_view_event_handler.h +++ b/content/browser/renderer_host/render_widget_host_view_event_handler.h
@@ -42,7 +42,6 @@ class RenderWidgetHostImpl; class RenderWidgetHostViewBase; class TouchSelectionControllerClientAura; -class HitTestDebugKeyEventObserver; // Provides an implementation of ui::EventHandler for use with // RenderWidgetHostViewBase. A delegate is required in order to provide platform @@ -291,8 +290,6 @@ aura::Window* window_; MouseWheelPhaseHandler mouse_wheel_phase_handler_; - std::unique_ptr<HitTestDebugKeyEventObserver> debug_observer_; - DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewEventHandler); };
diff --git a/content/browser/service_worker/service_worker_browsertest.cc b/content/browser/service_worker/service_worker_browsertest.cc index 4494d3b3..26a57ea0 100644 --- a/content/browser/service_worker/service_worker_browsertest.cc +++ b/content/browser/service_worker/service_worker_browsertest.cc
@@ -976,6 +976,7 @@ ServiceWorkerFetchDispatcher::FetchEventResult actual_result, blink::mojom::FetchAPIResponsePtr actual_response, blink::mojom::ServiceWorkerStreamHandlePtr /* stream */, + blink::mojom::ServiceWorkerFetchEventTimingPtr /* timing */, scoped_refptr<ServiceWorkerVersion> worker) { ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); ASSERT_TRUE(fetch_dispatcher_);
diff --git a/content/browser/service_worker/service_worker_fetch_dispatcher.cc b/content/browser/service_worker/service_worker_fetch_dispatcher.cc index 59bd5583..015e215 100644 --- a/content/browser/service_worker/service_worker_fetch_dispatcher.cc +++ b/content/browser/service_worker/service_worker_fetch_dispatcher.cc
@@ -367,7 +367,8 @@ if (!fetch_dispatcher) return; fetch_dispatcher->DidFinish(fetch_event_id.value(), fetch_result, - std::move(response), std::move(body_as_stream)); + std::move(response), std::move(body_as_stream), + std::move(timing)); } mojo::Binding<blink::mojom::ServiceWorkerFetchResponseCallback> binding_; @@ -567,24 +568,27 @@ blink::ServiceWorkerStatusCode status) { DCHECK_NE(blink::ServiceWorkerStatusCode::kOk, status); Complete(status, FetchEventResult::kShouldFallback, - blink::mojom::FetchAPIResponse::New(), nullptr /* body_as_stream */); + blink::mojom::FetchAPIResponse::New(), nullptr /* body_as_stream */, + nullptr /* timing */); } void ServiceWorkerFetchDispatcher::DidFinish( int request_id, FetchEventResult fetch_result, blink::mojom::FetchAPIResponsePtr response, - blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream) { + blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream, + blink::mojom::ServiceWorkerFetchEventTimingPtr timing) { net_log_.EndEvent(net::NetLogEventType::SERVICE_WORKER_FETCH_EVENT); Complete(blink::ServiceWorkerStatusCode::kOk, fetch_result, - std::move(response), std::move(body_as_stream)); + std::move(response), std::move(body_as_stream), std::move(timing)); } void ServiceWorkerFetchDispatcher::Complete( blink::ServiceWorkerStatusCode status, FetchEventResult fetch_result, blink::mojom::FetchAPIResponsePtr response, - blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream) { + blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream, + blink::mojom::ServiceWorkerFetchEventTimingPtr timing) { DCHECK(fetch_callback_); did_complete_ = true; @@ -594,7 +598,7 @@ std::move(fetch_callback_) .Run(status, fetch_result, std::move(response), std::move(body_as_stream), - version_); + std::move(timing), version_); } // Non-S13nServiceWorker
diff --git a/content/browser/service_worker/service_worker_fetch_dispatcher.h b/content/browser/service_worker/service_worker_fetch_dispatcher.h index 3849613..319cf6e 100644 --- a/content/browser/service_worker/service_worker_fetch_dispatcher.h +++ b/content/browser/service_worker/service_worker_fetch_dispatcher.h
@@ -51,6 +51,7 @@ FetchEventResult, blink::mojom::FetchAPIResponsePtr, blink::mojom::ServiceWorkerStreamHandlePtr, + blink::mojom::ServiceWorkerFetchEventTimingPtr, scoped_refptr<ServiceWorkerVersion>)>; // |request_body_*| and |client_id| are used in non-S13nServiceWorker only. @@ -98,11 +99,13 @@ void DidFinish(int request_id, FetchEventResult fetch_result, blink::mojom::FetchAPIResponsePtr response, - blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream); + blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream, + blink::mojom::ServiceWorkerFetchEventTimingPtr timing); void Complete(blink::ServiceWorkerStatusCode status, FetchEventResult fetch_result, blink::mojom::FetchAPIResponsePtr response, - blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream); + blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream, + blink::mojom::ServiceWorkerFetchEventTimingPtr timing); // The fetch event stays open until all respondWith() and waitUntil() promises // are settled. This function is called once the renderer signals that
diff --git a/content/browser/service_worker/service_worker_navigation_loader.cc b/content/browser/service_worker/service_worker_navigation_loader.cc index 8b0dd73..9952fc48 100644 --- a/content/browser/service_worker/service_worker_navigation_loader.cc +++ b/content/browser/service_worker/service_worker_navigation_loader.cc
@@ -7,6 +7,7 @@ #include <sstream> #include <utility> +#include "base/metrics/histogram_macros.h" #include "base/optional.h" #include "base/trace_event/trace_event.h" #include "content/browser/service_worker/service_worker_version.h" @@ -260,6 +261,8 @@ DCHECK(url_loader_client_.is_bound()); TransitionToStatus(Status::kCompleted); + if (error_code == net::OK) + RecordTimingMetrics(true); // |stream_waiter_| calls this when done. stream_waiter_.reset(); @@ -300,6 +303,7 @@ ServiceWorkerFetchDispatcher::FetchEventResult fetch_result, blink::mojom::FetchAPIResponsePtr response, blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream, + blink::mojom::ServiceWorkerFetchEventTimingPtr timing, scoped_refptr<ServiceWorkerVersion> version) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_EQ(status_, Status::kStarted); @@ -325,6 +329,8 @@ return; } + fetch_event_timing_ = std::move(timing); + if (status != blink::ServiceWorkerStatusCode::kOk) { // Dispatching the event to the service worker failed. Do a last resort // attempt to load the page via network as if there was no service worker. @@ -340,6 +346,7 @@ if (fetch_result == ServiceWorkerFetchDispatcher::FetchEventResult::kShouldFallback) { TransitionToStatus(Status::kCompleted); + RecordTimingMetrics(false); // TODO(falken): Propagate the timing info to the renderer somehow, or else // Navigation Timing etc APIs won't know about service worker. std::move(fallback_callback_) @@ -509,6 +516,70 @@ delete this; } +void ServiceWorkerNavigationLoader::RecordTimingMetrics(bool handled) { + DCHECK(fetch_event_timing_); + DCHECK(!completion_time_.is_null()); + + // We only record these metrics for top-level navigation. + if (resource_request_.resource_type != RESOURCE_TYPE_MAIN_FRAME) + return; + + // |fetch_event_timing_| is recorded in renderer so we can get reasonable + // metrics only when TimeTicks are consistent across processes. + if (!base::TimeTicks::IsHighResolution() || + !base::TimeTicks::IsConsistentAcrossProcesses()) + return; + + // Time between the request is made and the request is routed to this loader. + UMA_HISTOGRAM_TIMES( + "ServiceWorker.LoadTiming.MainFrame.MainResource." + "StartToForwardServiceWorker", + response_head_.service_worker_start_time - + response_head_.load_timing.request_start); + + // Time spent for service worker startup. + UMA_HISTOGRAM_TIMES( + "ServiceWorker.LoadTiming.MainFrame.MainResource." + "ForwardServiceWorkerToWorkerReady", + response_head_.service_worker_ready_time - + response_head_.service_worker_start_time); + + // Browser -> Renderer IPC delay. + UMA_HISTOGRAM_TIMES( + "ServiceWorker.LoadTiming.MainFrame.MainResource." + "WorkerReadyToFetchHandlerStart", + fetch_event_timing_->dispatch_event_time - + response_head_.service_worker_ready_time); + + // Time spent by fetch handlers. + UMA_HISTOGRAM_TIMES( + "ServiceWorker.LoadTiming.MainFrame.MainResource." + "FetchHandlerStartToFetchHandlerEnd", + fetch_event_timing_->respond_with_settled_time - + fetch_event_timing_->dispatch_event_time); + + if (handled) { + // Renderer -> Browser IPC delay. + UMA_HISTOGRAM_TIMES( + "ServiceWorker.LoadTiming.MainFrame.MainResource." + "FetchHandlerEndToResponseReceived", + response_head_.load_timing.receive_headers_end - + fetch_event_timing_->respond_with_settled_time); + + // Time spent reading response body. + UMA_HISTOGRAM_TIMES( + "ServiceWorker.LoadTiming.MainFrame.MainResource." + "ResponseReceivedToCompleted", + completion_time_ - response_head_.load_timing.receive_headers_end); + } else { + // Renderer -> Browser IPC delay (network fallback case). + UMA_HISTOGRAM_TIMES( + "ServiceWorker.LoadTiming.MainFrame.MainResource." + "FetchHandlerEndToFallbackNetwork", + completion_time_ - fetch_event_timing_->respond_with_settled_time); + } +} + void ServiceWorkerNavigationLoader::TransitionToStatus(Status new_status) { #if DCHECK_IS_ON() switch (new_status) { @@ -534,6 +605,8 @@ #endif // DCHECK_IS_ON() status_ = new_status; + if (new_status == Status::kCompleted) + completion_time_ = base::TimeTicks::Now(); } } // namespace content
diff --git a/content/browser/service_worker/service_worker_navigation_loader.h b/content/browser/service_worker/service_worker_navigation_loader.h index b839fe3..8f740b9 100644 --- a/content/browser/service_worker/service_worker_navigation_loader.h +++ b/content/browser/service_worker/service_worker_navigation_loader.h
@@ -125,6 +125,7 @@ ServiceWorkerFetchDispatcher::FetchEventResult fetch_result, blink::mojom::FetchAPIResponsePtr response, blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream, + blink::mojom::ServiceWorkerFetchEventTimingPtr timing, scoped_refptr<ServiceWorkerVersion> version); void StartResponse(blink::mojom::FetchAPIResponsePtr response, @@ -155,6 +156,11 @@ void ReportDestination( ServiceWorkerMetrics::MainResourceRequestDestination destination); + // Records loading milestones. Called only after ForwardToServiceWorker() is + // called and there was no error. |handled| is true when a fetch handler + // handled the request (i.e. non network fallback case). + void RecordTimingMetrics(bool handled); + void TransitionToStatus(Status new_status); ResponseType response_type_ = ResponseType::NOT_DETERMINED; @@ -180,6 +186,9 @@ bool did_navigation_preload_ = false; network::ResourceResponseHead response_head_; + blink::mojom::ServiceWorkerFetchEventTimingPtr fetch_event_timing_; + base::TimeTicks completion_time_; + // Pointer to the URLLoaderClient (i.e. NavigationURLLoader). network::mojom::URLLoaderClientPtr url_loader_client_; mojo::Binding<network::mojom::URLLoader> binding_;
diff --git a/content/browser/service_worker/service_worker_url_request_job.cc b/content/browser/service_worker/service_worker_url_request_job.cc index 07fd61481..2b4ae78 100644 --- a/content/browser/service_worker/service_worker_url_request_job.cc +++ b/content/browser/service_worker/service_worker_url_request_job.cc
@@ -660,6 +660,7 @@ ServiceWorkerFetchDispatcher::FetchEventResult fetch_result, blink::mojom::FetchAPIResponsePtr response, blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream, + blink::mojom::ServiceWorkerFetchEventTimingPtr timing, scoped_refptr<ServiceWorkerVersion> version) { // Do not clear |fetch_dispatcher_| if it has dispatched a navigation preload // request to keep the network::mojom::URLLoader related objects in it,
diff --git a/content/browser/service_worker/service_worker_url_request_job.h b/content/browser/service_worker/service_worker_url_request_job.h index a402e5a0..d7bcb2ca 100644 --- a/content/browser/service_worker/service_worker_url_request_job.h +++ b/content/browser/service_worker/service_worker_url_request_job.h
@@ -194,6 +194,7 @@ ServiceWorkerFetchDispatcher::FetchEventResult fetch_result, blink::mojom::FetchAPIResponsePtr response, blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream, + blink::mojom::ServiceWorkerFetchEventTimingPtr timing, scoped_refptr<ServiceWorkerVersion> version); void SetResponse(blink::mojom::FetchAPIResponsePtr response);
diff --git a/content/browser/web_contents/web_contents_android.cc b/content/browser/web_contents/web_contents_android.cc index b0d3fea..7a4d8d9 100644 --- a/content/browser/web_contents/web_contents_android.cc +++ b/content/browser/web_contents/web_contents_android.cc
@@ -470,13 +470,23 @@ frame->GetFrameInputHandler()->ScrollFocusedEditableNodeIntoRect(gfx::Rect()); } +void WebContentsAndroid::SelectWordAroundCaretAck(bool did_select, + int start_adjust, + int end_adjust) { + RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid(); + if (rwhva) + rwhva->SelectWordAroundCaretAck(did_select, start_adjust, end_adjust); +} + void WebContentsAndroid::SelectWordAroundCaret( JNIEnv* env, const JavaParamRef<jobject>& obj) { - RenderViewHost* host = web_contents_->GetRenderViewHost(); - if (!host) + RenderFrameHostImpl* frame = web_contents_->GetFocusedFrame(); + if (!frame) return; - host->SelectWordAroundCaret(); + frame->GetFrameInputHandler()->SelectWordAroundCaret( + base::BindOnce(&WebContentsAndroid::SelectWordAroundCaretAck, + weak_factory_.GetWeakPtr())); } void WebContentsAndroid::AdjustSelectionByCharacterOffset(
diff --git a/content/browser/web_contents/web_contents_android.h b/content/browser/web_contents/web_contents_android.h index 6e55efc6..6223f76 100644 --- a/content/browser/web_contents/web_contents_android.h +++ b/content/browser/web_contents/web_contents_android.h
@@ -265,6 +265,9 @@ const GURL& url, const std::vector<SkBitmap>& bitmaps, const std::vector<gfx::Size>& sizes); + void SelectWordAroundCaretAck(bool did_select, + int start_adjust, + int end_adjust); WebContentsImpl* web_contents_;
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc index f201805c..2b4596f 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -59,7 +59,6 @@ #include "ui/aura/env.h" #include "ui/aura/window.h" #include "ui/aura/window_observer.h" -#include "ui/aura/window_occlusion_tracker.h" #include "ui/aura/window_tree_host.h" #include "ui/aura/window_tree_host_observer.h" #include "ui/base/clipboard/clipboard.h" @@ -763,7 +762,7 @@ root_window->GetBoundsInScreen()); } window_->layer()->SetMasksToBounds(true); - aura::WindowOcclusionTracker::Track(window_.get()); + window_->TrackOcclusionState(); // WindowObserver is not interesting and is problematic for Browser Plugin // guests.
diff --git a/content/common/input/input_handler.mojom b/content/common/input/input_handler.mojom index df7e9e12..3f4c564 100644 --- a/content/common/input/input_handler.mojom +++ b/content/common/input/input_handler.mojom
@@ -338,6 +338,14 @@ AdjustSelectionByCharacterOffset( int32 start, int32 end, blink.mojom.SelectionMenuBehavior behavior); + // Requests the renderer to select word around caret. + // Expects ack with new selection information when finished. |start_adjust| + // and |end_adjust| are the start and end offset difference between the + // current selection and the previous selection (which is a caret). + [EnableIf=is_android] + SelectWordAroundCaret() + => (bool did_select, int32 start_adjust, int32 end_adjust); + // Requests the renderer to move the selection extent point to a new position. // Expects a MoveRangeSelectionExtent_ACK message when finished. MoveRangeSelectionExtent(gfx.mojom.Point extent);
diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 7b0ec1a..a7f73e6 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h
@@ -228,8 +228,6 @@ bool /* result */) #endif -IPC_MESSAGE_ROUTED0(ViewMsg_SelectWordAroundCaret) - // ----------------------------------------------------------------------------- // Messages sent from the renderer to the browser. @@ -349,13 +347,6 @@ // Sent once the RenderWidgetCompositor issues a draw command. IPC_MESSAGE_ROUTED0(ViewHostMsg_DidCommitAndDrawCompositorFrame) -// Acknowledges that a SelectWordAroundCaret completed with the specified -// result and adjustments to the selection offsets. -IPC_MESSAGE_ROUTED3(ViewHostMsg_SelectWordAroundCaretAck, - bool /* did_select */, - int /* start_adjust */, - int /* end_adjust */) - // Adding a new message? Stick to the sort order above: first platform // independent ViewMsg, then ifdefs for platform specific ViewMsg, then platform // independent ViewHostMsg, then ifdefs for platform specific ViewHostMsg.
diff --git a/content/public/app/mojo/content_renderer_manifest.json b/content/public/app/mojo/content_renderer_manifest.json index d048cbc..e19c5e68 100644 --- a/content/public/app/mojo/content_renderer_manifest.json +++ b/content/public/app/mojo/content_renderer_manifest.json
@@ -40,7 +40,8 @@ "device": [ "device:power_monitor", "device:screen_orientation", - "device:time_zone_monitor" + "device:time_zone_monitor", + "device:wake_lock" ], "ui": [ "discardable_memory",
diff --git a/content/public/browser/gpu_utils.cc b/content/public/browser/gpu_utils.cc index 75255050..d6162ed 100644 --- a/content/public/browser/gpu_utils.cc +++ b/content/public/browser/gpu_utils.cc
@@ -12,6 +12,7 @@ #include "build/build_config.h" #include "cc/base/switches.h" #include "components/viz/common/features.h" +#include "content/browser/browser_main_loop.h" #include "content/browser/gpu/gpu_process_host.h" #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" @@ -135,4 +136,9 @@ base::ThreadTaskRunnerHandle::Get(), callback))); } +gpu::GpuChannelEstablishFactory* GetGpuChannelEstablishFactory() { + return content::BrowserMainLoop::GetInstance() + ->gpu_channel_establish_factory(); +} + } // namespace content
diff --git a/content/public/browser/gpu_utils.h b/content/public/browser/gpu_utils.h index e4c9ad2..a919eb59 100644 --- a/content/public/browser/gpu_utils.h +++ b/content/public/browser/gpu_utils.h
@@ -9,12 +9,18 @@ #include "content/common/content_export.h" #include "gpu/config/gpu_preferences.h" +namespace gpu { +class GpuChannelEstablishFactory; +} + namespace content { CONTENT_EXPORT const gpu::GpuPreferences GetGpuPreferencesFromCommandLine(); CONTENT_EXPORT void StopGpuProcess(const base::Closure& callback); +CONTENT_EXPORT gpu::GpuChannelEstablishFactory* GetGpuChannelEstablishFactory(); + } // namespace content #endif // CONTENT_PUBLIC_BROWSER_GPU_UTILS_H_
diff --git a/content/public/browser/media_session.h b/content/public/browser/media_session.h index b886735a..b915ccf 100644 --- a/content/public/browser/media_session.h +++ b/content/public/browser/media_session.h
@@ -34,10 +34,6 @@ ~MediaSession() override = default; - // Resume the media session. - // |type| represents the origin of the request. - virtual void Resume(SuspendType suspend_type) = 0; - // Stop the media session. // |type| represents the origin of the request. virtual void Stop(SuspendType suspend_type) = 0; @@ -67,6 +63,10 @@ // |type| represents the origin of the request. void Suspend(SuspendType suspend_type) override = 0; + // Resume the media session. + // |type| represents the origin of the request. + void Resume(SuspendType suspend_type) override = 0; + // Let the media session start ducking such that the volume multiplier is // reduced. void StartDucking() override = 0;
diff --git a/content/public/browser/render_view_host.h b/content/public/browser/render_view_host.h index f376ec1..ce8282a 100644 --- a/content/public/browser/render_view_host.h +++ b/content/public/browser/render_view_host.h
@@ -133,9 +133,6 @@ // Passes a list of Webkit preferences to the renderer. virtual void UpdateWebkitPreferences(const WebPreferences& prefs) = 0; - // Notify the render view host to select the word around the caret. - virtual void SelectWordAroundCaret() = 0; - private: // This interface should only be implemented inside content. friend class RenderViewHostImpl;
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index cc603a60..73a42c3 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -660,11 +660,6 @@ // Enable IOSurface based screen capturer. const base::Feature kIOSurfaceCapturer{"IOSurfaceCapturer", base::FEATURE_ENABLED_BY_DEFAULT}; - -// The V2 sandbox on MacOS removes the unsandboed warmup phase and sandboxes the -// entire life of the process. -const base::Feature kMacV2Sandbox{"MacV2Sandbox", - base::FEATURE_ENABLED_BY_DEFAULT}; #endif // defined(OS_MACOSX) enum class VideoCaptureServiceConfiguration {
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h index 874fc98f..0c59d31 100644 --- a/content/public/common/content_features.h +++ b/content/public/common/content_features.h
@@ -160,7 +160,6 @@ #if defined(OS_MACOSX) CONTENT_EXPORT extern const base::Feature kDeviceMonitorMac; CONTENT_EXPORT extern const base::Feature kIOSurfaceCapturer; -CONTENT_EXPORT extern const base::Feature kMacV2Sandbox; #endif // defined(OS_MACOSX) // DON'T ADD RANDOM STUFF HERE. Put it in the main section above in
diff --git a/content/common/gpu_stream_constants.h b/content/public/common/gpu_stream_constants.h similarity index 88% rename from content/common/gpu_stream_constants.h rename to content/public/common/gpu_stream_constants.h index afcf6f5..ead4164 100644 --- a/content/common/gpu_stream_constants.h +++ b/content/public/common/gpu_stream_constants.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_COMMON_GPU_STREAM_CONSTANTS_H_ -#define CONTENT_COMMON_GPU_STREAM_CONSTANTS_H_ +#ifndef CONTENT_PUBLIC_COMMON_GPU_STREAM_CONSTANTS_H_ +#define CONTENT_PUBLIC_COMMON_GPU_STREAM_CONSTANTS_H_ #include "gpu/command_buffer/common/scheduling_priority.h" @@ -40,4 +40,4 @@ } // namespace content -#endif // CONTENT_COMMON_GPU_STREAM_CONSTANTS_H_ +#endif // CONTENT_PUBLIC_COMMON_GPU_STREAM_CONSTANTS_H_
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc index 09a35ff..e862addc 100644 --- a/content/public/test/browser_test_utils.cc +++ b/content/public/test/browser_test_utils.cc
@@ -786,6 +786,21 @@ ui::LatencyInfo()); } +void SendMouseDownToWidget(RenderWidgetHost* target, + int modifiers, + blink::WebMouseEvent::Button button) { + auto* view = static_cast<content::RenderWidgetHostImpl*>(target)->GetView(); + + blink::WebMouseEvent mouse_event(blink::WebInputEvent::kMouseDown, modifiers, + ui::EventTimeForNow()); + mouse_event.button = button; + int x = view->GetViewBounds().width() / 2; + int y = view->GetViewBounds().height() / 2; + mouse_event.SetPositionInWidget(x, y); + mouse_event.click_count = 1; + target->ForwardMouseEvent(mouse_event); +} + void SimulateMouseEvent(WebContents* web_contents, blink::WebInputEvent::Type type, const gfx::Point& point) { @@ -1876,6 +1891,12 @@ return static_cast<WebContentsImpl*>(web_contents)->GetKeyboardLockWidget(); } +RenderWidgetHost* GetMouseCaptureWidget(WebContents* web_contents) { + return static_cast<WebContentsImpl*>(web_contents) + ->GetInputEventRouter() + ->GetMouseCaptureWidgetForTests(); +} + bool RequestKeyboardLock(WebContents* web_contents, base::Optional<base::flat_set<ui::DomCode>> codes) { DCHECK(!codes.has_value() || !codes.value().empty());
diff --git a/content/public/test/browser_test_utils.h b/content/public/test/browser_test_utils.h index 7f74a31c..420b2df 100644 --- a/content/public/test/browser_test_utils.h +++ b/content/public/test/browser_test_utils.h
@@ -169,6 +169,12 @@ blink::WebMouseEvent::Button button, const gfx::Point& point); +// Simulates MouseDown at the center of the given RenderWidgetHost's area. +// This does not send a corresponding MouseUp. +void SendMouseDownToWidget(RenderWidgetHost* target, + int modifiers, + blink::WebMouseEvent::Button button); + // Simulates asynchronously a mouse enter/move/leave event. void SimulateMouseEvent(WebContents* web_contents, blink::WebInputEvent::Type type, @@ -840,6 +846,12 @@ // Returns the RenderWidgetHost that holds the keyboard lock. RenderWidgetHost* GetKeyboardLockWidget(WebContents* web_contents); +// Returns the RenderWidgetHost that holds mouse capture, if any. This is +// distinct from MouseLock above in that it is a widget that has requested +// implicit capture, such as during a drag. MouseLock is explicitly gained +// through the JavaScript API. +RenderWidgetHost* GetMouseCaptureWidget(WebContents* web_contents); + // Allows tests to drive keyboard lock functionality without requiring access // to the RenderWidgetHostImpl header or setting up an HTTP test server. // |codes| represents the set of keys to lock. If |codes| has no value, then
diff --git a/content/renderer/input/frame_input_handler_impl.cc b/content/renderer/input/frame_input_handler_impl.cc index 175e4aa..b2f1c689 100644 --- a/content/renderer/input/frame_input_handler_impl.cc +++ b/content/renderer/input/frame_input_handler_impl.cc
@@ -58,11 +58,11 @@ new FrameInputHandlerImpl(render_frame, std::move(request)); } -void FrameInputHandlerImpl::RunOnMainThread(const base::Closure& closure) { +void FrameInputHandlerImpl::RunOnMainThread(base::OnceClosure closure) { if (input_event_queue_) { - input_event_queue_->QueueClosure(closure); + input_event_queue_->QueueClosure(std::move(closure)); } else { - closure.Run(); + std::move(closure).Run(); } } @@ -287,6 +287,49 @@ window_widget->ConvertWindowPointToViewport(extent)); } +#if defined(OS_ANDROID) +void FrameInputHandlerImpl::SelectWordAroundCaret( + SelectWordAroundCaretCallback callback) { + if (!main_thread_task_runner_->BelongsToCurrentThread()) { + RunOnMainThread( + base::BindOnce(&FrameInputHandlerImpl::SelectWordAroundCaret, + weak_this_, std::move(callback))); + return; + } + + bool did_select = false; + int start_adjust = 0; + int end_adjust = 0; + if (render_frame_) { + blink::WebLocalFrame* frame = render_frame_->GetWebFrame(); + blink::WebRange initial_range = frame->SelectionRange(); + render_frame_->GetRenderWidget()->SetHandlingInputEvent(true); + if (!initial_range.IsNull()) + did_select = frame->SelectWordAroundCaret(); + if (did_select) { + blink::WebRange adjusted_range = frame->SelectionRange(); + DCHECK(!adjusted_range.IsNull()); + start_adjust = adjusted_range.StartOffset() - initial_range.StartOffset(); + end_adjust = adjusted_range.EndOffset() - initial_range.EndOffset(); + } + render_frame_->GetRenderWidget()->SetHandlingInputEvent(false); + } + + // If the mojom channel is registered with compositor thread, we have to run + // the callback on compositor thread. Otherwise run it on main thread. Mojom + // requires the callback runs on the same thread. + if (RenderThreadImpl::current() && + RenderThreadImpl::current()->compositor_task_runner() && + input_event_queue_) { + RenderThreadImpl::current()->compositor_task_runner()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), did_select, start_adjust, + end_adjust)); + } else { + std::move(callback).Run(did_select, start_adjust, end_adjust); + } +} +#endif // defined(OS_ANDROID) + void FrameInputHandlerImpl::AdjustSelectionByCharacterOffset( int32_t start, int32_t end,
diff --git a/content/renderer/input/frame_input_handler_impl.h b/content/renderer/input/frame_input_handler_impl.h index 794229f..8155c1a 100644 --- a/content/renderer/input/frame_input_handler_impl.h +++ b/content/renderer/input/frame_input_handler_impl.h
@@ -6,6 +6,7 @@ #define CONTENT_RENDERER_INPUT_FRAME_INPUT_HANDLER_IMPL_H_ #include "base/memory/ref_counted.h" +#include "build/build_config.h" #include "content/common/content_export.h" #include "content/common/input/input_handler.mojom.h" #include "content/renderer/render_frame_impl.h" @@ -66,6 +67,9 @@ void SelectAll() override; void CollapseSelection() override; void SelectRange(const gfx::Point& base, const gfx::Point& extent) override; +#if defined(OS_ANDROID) + void SelectWordAroundCaret(SelectWordAroundCaretCallback callback) override; +#endif // defined(OS_ANDROID) void AdjustSelectionByCharacterOffset( int32_t start, int32_t end, @@ -96,7 +100,7 @@ FrameInputHandlerImpl(base::WeakPtr<RenderFrameImpl> render_frame, mojom::FrameInputHandlerRequest request); - void RunOnMainThread(const base::Closure& closure); + void RunOnMainThread(base::OnceClosure closure); void BindNow(mojom::FrameInputHandlerRequest request); void ExecuteCommandOnMainThread(const std::string& command, UpdateState state);
diff --git a/content/renderer/pepper/pepper_video_encoder_host.cc b/content/renderer/pepper/pepper_video_encoder_host.cc index cf8e633..1cb22a60 100644 --- a/content/renderer/pepper/pepper_video_encoder_host.cc +++ b/content/renderer/pepper/pepper_video_encoder_host.cc
@@ -11,8 +11,8 @@ #include "base/numerics/safe_math.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" -#include "content/common/gpu_stream_constants.h" #include "content/common/pepper_file_util.h" +#include "content/public/common/gpu_stream_constants.h" #include "content/public/renderer/renderer_ppapi_host.h" #include "content/renderer/pepper/gfx_conversion.h" #include "content/renderer/pepper/host_globals.h"
diff --git a/content/renderer/pepper/ppb_graphics_3d_impl.cc b/content/renderer/pepper/ppb_graphics_3d_impl.cc index 4e2717b..6043089 100644 --- a/content/renderer/pepper/ppb_graphics_3d_impl.cc +++ b/content/renderer/pepper/ppb_graphics_3d_impl.cc
@@ -12,9 +12,9 @@ #include "base/single_thread_task_runner.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/thread_task_runner_handle.h" -#include "content/common/gpu_stream_constants.h" #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" +#include "content/public/common/gpu_stream_constants.h" #include "content/public/common/web_preferences.h" #include "content/renderer/pepper/host_globals.h" #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 7630d96dc..70dc575 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -62,12 +62,12 @@ #include "content/common/dom_storage/dom_storage_messages.h" #include "content/common/frame_messages.h" #include "content/common/frame_owner_properties.h" -#include "content/common/gpu_stream_constants.h" #include "content/common/view_messages.h" #include "content/public/common/content_constants.h" #include "content/public/common/content_features.h" #include "content/public/common/content_paths.h" #include "content/public/common/content_switches.h" +#include "content/public/common/gpu_stream_constants.h" #include "content/public/common/renderer_preferences.h" #include "content/public/common/resource_usage_reporter.mojom.h" #include "content/public/common/resource_usage_reporter_type_converters.h"
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index fcab7999..05f920c3 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc
@@ -1217,33 +1217,6 @@ // IPC message handlers ----------------------------------------- -void RenderViewImpl::OnSelectWordAroundCaret() { - // TODO(ajwong): Move this into RenderWidget. http://crbug.com/545684 - // Set default values for the ACK - bool did_select = false; - int start_adjust = 0; - int end_adjust = 0; - - if (webview()) { - WebLocalFrame* focused_frame = GetWebView()->FocusedFrame(); - if (focused_frame) { - GetWidget()->SetHandlingInputEvent(true); - blink::WebRange initial_range = focused_frame->SelectionRange(); - if (!initial_range.IsNull()) - did_select = focused_frame->SelectWordAroundCaret(); - if (did_select) { - blink::WebRange adjusted_range = focused_frame->SelectionRange(); - start_adjust = - adjusted_range.StartOffset() - initial_range.StartOffset(); - end_adjust = adjusted_range.EndOffset() - initial_range.EndOffset(); - } - GetWidget()->SetHandlingInputEvent(false); - } - } - Send(new ViewHostMsg_SelectWordAroundCaretAck( - GetWidget()->routing_id(), did_select, start_adjust, end_adjust)); -} - void RenderViewImpl::OnUpdateTargetURLAck() { // Check if there is a targeturl waiting to be sent. if (target_url_status_ == TARGET_PENDING) @@ -1348,7 +1321,6 @@ OnDisableScrollbarsForSmallWindows) IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs) IPC_MESSAGE_HANDLER(ViewMsg_PluginActionAt, OnPluginActionAt) - IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) // Page messages. IPC_MESSAGE_HANDLER(PageMsg_UpdateWindowScreenRect,
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index 4338420..70c2159 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h
@@ -453,7 +453,6 @@ void OnUpdateTargetURLAck(); void OnUpdateWebPreferences(const WebPreferences& prefs); void OnSetPageScale(float page_scale_factor); - void OnSelectWordAroundCaret(); void OnAudioStateChanged(bool is_audio_playing); void OnPausePageScheduledTasks(bool paused);
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc index e1b4f2c..7911a12 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc
@@ -31,9 +31,9 @@ #include "content/child/child_process.h" #include "content/child/thread_safe_sender.h" #include "content/common/frame_messages.h" -#include "content/common/gpu_stream_constants.h" #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" +#include "content/public/common/gpu_stream_constants.h" #include "content/public/common/service_manager_connection.h" #include "content/public/common/service_names.mojom.h" #include "content/public/common/webplugininfo.h"
diff --git a/content/renderer/shared_worker/embedded_shared_worker_stub.cc b/content/renderer/shared_worker/embedded_shared_worker_stub.cc index 2336d12..c2a3eea 100644 --- a/content/renderer/shared_worker/embedded_shared_worker_stub.cc +++ b/content/renderer/shared_worker/embedded_shared_worker_stub.cc
@@ -280,15 +280,6 @@ base::nullopt /* subresource_overrides */); } - // It is important to understand the default factory of - // |subresource_loader_factories_|. |subresource_loader_factories_| was made - // from CreateDefaultURLLoaderFactoryBundle, which does not set a default - // factory, and |subresource_loader_factories| passed from the browser, whose - // default factory is the direct network factory (as SharedWorkerHost sets it - // that way). Therefore, the default factory either does not exist or is the - // direct network factory. So we don't need to call CloneWithoutDefault() to - // bypass features like AppCache, unlike the bundle created for a frame. - impl_->StartWorkerContext( url_, blink::WebString::FromUTF8(name_), blink::WebString::FromUTF8(info->content_security_policy), @@ -414,18 +405,10 @@ if (blink::ServiceWorkerUtils::IsServicificationEnabled()) container_host_ptr_info = context->CloneContainerHostPtrInfo(); - // We know |subresource_loader_factories_|'s default factory is not a feature - // like AppCache, so it's OK to call Clone() and not CloneWithoutDefault() to - // get the fallback factory. We don't want to call CloneWithoutDefault() - // because the default is a NetworkService-backed factory with auto-reconnect - // when NetworkService is enabled (it will support auto-reconnect once - // https://crbug.com/848256 is addressed). See comments in the constructor. - // - // TODO(nhiroki): We might need to set the default factory of - // |subresource_loader_factories_| to AppCache if requests from this shared - // worker are supposed to go through AppCache. + // Make the factory used for service worker network fallback. Omit the default + // factory in case it is for a non-network factory like AppCache. std::unique_ptr<network::SharedURLLoaderFactoryInfo> fallback_factory = - subresource_loader_factories_->Clone(); + subresource_loader_factories_->CloneWithoutDefaultFactory(); auto worker_fetch_context = std::make_unique<WebWorkerFetchContextImpl>( std::move(renderer_preferences_), std::move(preference_watcher_request_),
diff --git a/content/shell/browser/layout_test/blink_test_controller.cc b/content/shell/browser/layout_test/blink_test_controller.cc index 36da6eab..1f08485 100644 --- a/content/shell/browser/layout_test/blink_test_controller.cc +++ b/content/shell/browser/layout_test/blink_test_controller.cc
@@ -412,12 +412,23 @@ main_window_->web_contents()->GetRenderViewHost()->GetWidget()->Focus(); // Flush IPC messages on the widget. - base::RunLoop run_loop; - main_window_->web_contents() - ->GetRenderViewHost() - ->GetWidget() - ->FlushForTesting(run_loop.QuitClosure()); - run_loop.Run(); + { + base::RunLoop run_loop; + main_window_->web_contents() + ->GetRenderViewHost() + ->GetWidget() + ->FlushForTesting(run_loop.QuitClosure()); + run_loop.Run(); + } + + // Flush the TestControl interface. + { + base::RunLoop run_loop; + GetLayoutTestControlPtr( + main_window_->web_contents()->GetRenderViewHost()->GetMainFrame()) + ->FlushForTesting(run_loop.QuitClosure()); + run_loop.Run(); + } // Loading the URL will immediately start the layout test. Manually call // LoadURLWithParams on the WebContents to avoid extraneous calls from @@ -470,12 +481,22 @@ main_window_->web_contents()->GetRenderViewHost()->GetWidget()->Focus(); // Flush IPC messages on the widget. - base::RunLoop run_loop; - main_window_->web_contents() - ->GetRenderViewHost() - ->GetWidget() - ->FlushForTesting(run_loop.QuitClosure()); - run_loop.Run(); + { + base::RunLoop run_loop; + main_window_->web_contents() + ->GetRenderViewHost() + ->GetWidget() + ->FlushForTesting(run_loop.QuitClosure()); + run_loop.Run(); + } + + // Flush the TestControl interface. + { + base::RunLoop run_loop; + GetLayoutTestControlPtr(render_view_host->GetMainFrame()) + ->FlushForTesting(run_loop.QuitClosure()); + run_loop.Run(); + } if (is_devtools_js_test) { LoadDevToolsJSTest();
diff --git a/content/shell/common/layout_test.mojom b/content/shell/common/layout_test.mojom index be9a11b6..fee695a 100644 --- a/content/shell/common/layout_test.mojom +++ b/content/shell/common/layout_test.mojom
@@ -60,6 +60,9 @@ // that hosts parts of the main test window. ReplicateTestConfiguration(ShellTestConfiguration config); + // Ensures that all queued messages are flushed. + FlushForTesting() => (); + // Sets the test config for a layout test that is being started. This message // is sent only to a renderer that hosts parts of the main test window. SetTestConfiguration(ShellTestConfiguration config);
diff --git a/content/shell/renderer/layout_test/layout_test_render_frame_observer.cc b/content/shell/renderer/layout_test/layout_test_render_frame_observer.cc index d13d9616..95db5c3 100644 --- a/content/shell/renderer/layout_test/layout_test_render_frame_observer.cc +++ b/content/shell/renderer/layout_test/layout_test_render_frame_observer.cc
@@ -79,6 +79,11 @@ ->OnReplicateTestConfiguration(std::move(config)); } +void LayoutTestRenderFrameObserver::FlushForTesting( + FlushForTestingCallback callback) { + std::move(callback).Run(); +} + void LayoutTestRenderFrameObserver::SetTestConfiguration( mojom::ShellTestConfigurationPtr config) { BlinkTestRunner::Get(render_frame()->GetRenderView())
diff --git a/content/shell/renderer/layout_test/layout_test_render_frame_observer.h b/content/shell/renderer/layout_test/layout_test_render_frame_observer.h index 2e18be6..ff295cd 100644 --- a/content/shell/renderer/layout_test/layout_test_render_frame_observer.h +++ b/content/shell/renderer/layout_test/layout_test_render_frame_observer.h
@@ -25,6 +25,7 @@ void CaptureDump(CaptureDumpCallback callback) override; void CompositeWithRaster(CompositeWithRasterCallback callback) override; void DumpFrameLayout(DumpFrameLayoutCallback callback) override; + void FlushForTesting(FlushForTestingCallback callback) override; void SetTestConfiguration(mojom::ShellTestConfigurationPtr config) override; void ReplicateTestConfiguration( mojom::ShellTestConfigurationPtr config) override;
diff --git a/content/test/gpu_browsertest_helpers.cc b/content/test/gpu_browsertest_helpers.cc index dd13a47..77a173b 100644 --- a/content/test/gpu_browsertest_helpers.cc +++ b/content/test/gpu_browsertest_helpers.cc
@@ -9,7 +9,7 @@ #include "base/callback.h" #include "base/run_loop.h" #include "content/browser/browser_main_loop.h" -#include "content/common/gpu_stream_constants.h" +#include "content/public/common/gpu_stream_constants.h" #include "gpu/command_buffer/client/shared_memory_limits.h" #include "gpu/command_buffer/common/context_creation_attribs.h" #include "gpu/ipc/client/gpu_channel_host.h"
diff --git a/content/test/layouttest_support.cc b/content/test/layouttest_support.cc index 09ca3d56a..6a09e4d0 100644 --- a/content/test/layouttest_support.cc +++ b/content/test/layouttest_support.cc
@@ -24,10 +24,10 @@ #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/shared_worker/shared_worker_service_impl.h" -#include "content/common/gpu_stream_constants.h" #include "content/common/renderer.mojom.h" #include "content/common/unique_name_helper.h" #include "content/public/browser/storage_partition.h" +#include "content/public/common/gpu_stream_constants.h" #include "content/public/common/page_state.h" #include "content/public/common/screen_info.h" #include "content/renderer/gpu/layer_tree_view.h"
diff --git a/device/fido/BUILD.gn b/device/fido/BUILD.gn index 1d7bed1..bf97afc 100644 --- a/device/fido/BUILD.gn +++ b/device/fido/BUILD.gn
@@ -73,6 +73,8 @@ "fido_device_authenticator.h", "fido_discovery.cc", "fido_discovery.h", + "fido_discovery_base.cc", + "fido_discovery_base.h", "fido_parsing_utils.cc", "fido_parsing_utils.h", "fido_request_handler.h",
diff --git a/device/fido/ble/fido_ble_discovery.cc b/device/fido/ble/fido_ble_discovery.cc index b683caf7..8e21dcee 100644 --- a/device/fido/ble/fido_ble_discovery.cc +++ b/device/fido/ble/fido_ble_discovery.cc
@@ -14,6 +14,7 @@ #include "device/bluetooth/bluetooth_uuid.h" #include "device/fido/ble/fido_ble_device.h" #include "device/fido/ble/fido_ble_uuids.h" +#include "device/fido/fido_authenticator.h" namespace device { @@ -108,8 +109,8 @@ devices_.erase(it); if (observer()) { - observer()->DeviceIdChanged(this, previous_device_id, - std::move(new_device_id)); + observer()->AuthenticatorIdChanged(this, previous_device_id, + std::move(new_device_id)); } }
diff --git a/device/fido/ble/fido_ble_discovery_unittest.cc b/device/fido/ble/fido_ble_discovery_unittest.cc index 5b34cefd..1e1a697 100644 --- a/device/fido/ble/fido_ble_discovery_unittest.cc +++ b/device/fido/ble/fido_ble_discovery_unittest.cc
@@ -16,6 +16,7 @@ #include "device/bluetooth/test/mock_bluetooth_device.h" #include "device/fido/ble/fido_ble_device.h" #include "device/fido/ble/fido_ble_uuids.h" +#include "device/fido/fido_authenticator.h" #include "device/fido/mock_fido_discovery_observer.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -82,8 +83,8 @@ MockFidoDiscoveryObserver observer; discovery.set_observer(&observer); EXPECT_CALL(observer, DiscoveryStarted(&discovery, _)).Times(0); - EXPECT_CALL(observer, DeviceAdded(&discovery, _)).Times(0); - EXPECT_CALL(observer, DeviceRemoved(&discovery, _)).Times(0); + EXPECT_CALL(observer, AuthenticatorAdded(&discovery, _)).Times(0); + EXPECT_CALL(observer, AuthenticatorRemoved(&discovery, _)).Times(0); } TEST_F(BluetoothTest, FidoBleDiscoveryFindsKnownDevice) { @@ -104,9 +105,10 @@ { base::RunLoop run_loop; auto quit = run_loop.QuitClosure(); - EXPECT_CALL(observer, - DeviceAdded(&discovery, - IdMatches(BluetoothTestBase::kTestDeviceAddress1))); + EXPECT_CALL( + observer, + AuthenticatorAdded(&discovery, + IdMatches(BluetoothTestBase::kTestDeviceAddress1))); EXPECT_CALL(observer, DiscoveryStarted(&discovery, true)) .WillOnce(ReturnFromAsyncCall(quit)); @@ -139,9 +141,10 @@ { base::RunLoop run_loop; auto quit = run_loop.QuitClosure(); - EXPECT_CALL(observer, - DeviceAdded(&discovery, - IdMatches(BluetoothTestBase::kTestDeviceAddress1))) + EXPECT_CALL( + observer, + AuthenticatorAdded(&discovery, + IdMatches(BluetoothTestBase::kTestDeviceAddress1))) .WillOnce(ReturnFromAsyncCall(quit)); SimulateLowEnergyDevice(4); // This device should be ignored. @@ -184,9 +187,10 @@ { base::RunLoop run_loop; auto quit = run_loop.QuitClosure(); - EXPECT_CALL(observer, - DeviceAdded(&discovery, - IdMatches(BluetoothTestBase::kTestDeviceAddress1))) + EXPECT_CALL( + observer, + AuthenticatorAdded(&discovery, + IdMatches(BluetoothTestBase::kTestDeviceAddress1))) .WillOnce(ReturnFromAsyncCall(quit)); // This will update properties for device 3. @@ -222,7 +226,7 @@ run_loop.Run(); } - EXPECT_CALL(observer, DeviceAdded(&discovery, _)).Times(0); + EXPECT_CALL(observer, AuthenticatorAdded(&discovery, _)).Times(0); // Simulates a discovery of two Cable devices one of which is an Android Cable // authenticator and other is IOS Cable authenticator. @@ -231,7 +235,7 @@ // Simulates a device change update received from the BluetoothAdapter. As the // updated device has an address that we know is an Cable device, this should - // not trigger DeviceAdded(). + // not trigger AuthenticatorAdded(). SimulateLowEnergyDevice(7); } @@ -261,8 +265,8 @@ std::vector<BluetoothUUID>{BluetoothUUID(kFidoServiceUUID)})); BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter.get()); - EXPECT_CALL(observer, DeviceIdChanged(&discovery, kAuthenticatorId, - kAuthenticatorChangedId)); + EXPECT_CALL(observer, AuthenticatorIdChanged(&discovery, kAuthenticatorId, + kAuthenticatorChangedId)); discovery.Start(); EXPECT_CALL(*mock_device.get(), GetAddress)
diff --git a/device/fido/cable/fido_cable_discovery_unittest.cc b/device/fido/cable/fido_cable_discovery_unittest.cc index 8af70961..814033e 100644 --- a/device/fido/cable/fido_cable_discovery_unittest.cc +++ b/device/fido/cable/fido_cable_discovery_unittest.cc
@@ -317,7 +317,7 @@ TEST_F(FidoCableDiscoveryTest, TestDiscoveryFindsNewDevice) { auto cable_discovery = CreateDiscovery(); NiceMock<MockFidoDiscoveryObserver> mock_observer; - EXPECT_CALL(mock_observer, DeviceAdded(_, _)); + EXPECT_CALL(mock_observer, AuthenticatorAdded(_, _)); cable_discovery->set_observer(&mock_observer); auto mock_adapter = @@ -336,7 +336,7 @@ TEST_F(FidoCableDiscoveryTest, TestDiscoveryFindsNewAppleDevice) { auto cable_discovery = CreateDiscovery(); NiceMock<MockFidoDiscoveryObserver> mock_observer; - EXPECT_CALL(mock_observer, DeviceAdded(_, _)); + EXPECT_CALL(mock_observer, AuthenticatorAdded(_, _)); cable_discovery->set_observer(&mock_observer); auto mock_adapter = @@ -357,7 +357,7 @@ TEST_F(FidoCableDiscoveryTest, TestDiscoveryFindsIncorrectDevice) { auto cable_discovery = CreateDiscovery(); NiceMock<MockFidoDiscoveryObserver> mock_observer; - EXPECT_CALL(mock_observer, DeviceAdded(_, _)).Times(0); + EXPECT_CALL(mock_observer, AuthenticatorAdded(_, _)).Times(0); cable_discovery->set_observer(&mock_observer); auto mock_adapter = @@ -395,7 +395,7 @@ mock_adapter->ExpectDiscoveryWithScanCallback(kAuthenticatorEid); NiceMock<MockFidoDiscoveryObserver> mock_observer; - EXPECT_CALL(mock_observer, DeviceAdded(_, _)); + EXPECT_CALL(mock_observer, AuthenticatorAdded(_, _)); cable_discovery->set_observer(&mock_observer); Sequence sequence; @@ -424,7 +424,7 @@ auto cable_discovery = std::make_unique<FakeFidoCableDiscovery>(std::move(discovery_data)); NiceMock<MockFidoDiscoveryObserver> mock_observer; - EXPECT_CALL(mock_observer, DeviceAdded(_, _)); + EXPECT_CALL(mock_observer, AuthenticatorAdded(_, _)); cable_discovery->set_observer(&mock_observer); auto mock_adapter = @@ -456,7 +456,7 @@ std::make_unique<FakeFidoCableDiscovery>(std::move(discovery_data)); NiceMock<MockFidoDiscoveryObserver> mock_observer; - EXPECT_CALL(mock_observer, DeviceAdded(_, _)).Times(0); + EXPECT_CALL(mock_observer, AuthenticatorAdded(_, _)).Times(0); cable_discovery->set_observer(&mock_observer); auto mock_adapter = @@ -504,7 +504,7 @@ TEST_F(FidoCableDiscoveryTest, TestResumeDiscoveryAfterPoweredOn) { auto cable_discovery = CreateDiscovery(); NiceMock<MockFidoDiscoveryObserver> mock_observer; - EXPECT_CALL(mock_observer, DeviceAdded); + EXPECT_CALL(mock_observer, AuthenticatorAdded); cable_discovery->set_observer(&mock_observer); auto mock_adapter =
diff --git a/device/fido/fake_fido_discovery_unittest.cc b/device/fido/fake_fido_discovery_unittest.cc index 61a9bef..8e38849 100644 --- a/device/fido/fake_fido_discovery_unittest.cc +++ b/device/fido/fake_fido_discovery_unittest.cc
@@ -20,6 +20,8 @@ namespace device { namespace test { +using ::testing::_; + class FakeFidoDiscoveryTest : public ::testing::Test { public: FakeFidoDiscoveryTest() = default; @@ -119,7 +121,7 @@ auto device0 = std::make_unique<MockFidoDevice>(); EXPECT_CALL(*device0, GetId()).WillOnce(::testing::Return("device0")); base::RunLoop device0_done; - EXPECT_CALL(observer, DeviceAdded(&discovery, ::testing::_)) + EXPECT_CALL(observer, AuthenticatorAdded(&discovery, _)) .WillOnce(testing::InvokeWithoutArgs( [&device0_done]() { device0_done.Quit(); })); discovery.AddDevice(std::move(device0)); @@ -133,7 +135,7 @@ auto device1 = std::make_unique<MockFidoDevice>(); EXPECT_CALL(*device1, GetId()).WillOnce(::testing::Return("device1")); base::RunLoop device1_done; - EXPECT_CALL(observer, DeviceAdded(&discovery, ::testing::_)) + EXPECT_CALL(observer, AuthenticatorAdded(&discovery, _)) .WillOnce(testing::InvokeWithoutArgs( [&device1_done]() { device1_done.Quit(); })); discovery.AddDevice(std::move(device1));
diff --git a/device/fido/fido_device_authenticator.h b/device/fido/fido_device_authenticator.h index 606e5b99..07c6e5a 100644 --- a/device/fido/fido_device_authenticator.h +++ b/device/fido/fido_device_authenticator.h
@@ -34,9 +34,8 @@ // FidoAuthenticator: void InitializeAuthenticator(base::OnceClosure callback) override; - void MakeCredential( - CtapMakeCredentialRequest request, - MakeCredentialCallback callback) override; + void MakeCredential(CtapMakeCredentialRequest request, + MakeCredentialCallback callback) override; void GetAssertion(CtapGetAssertionRequest request, GetAssertionCallback callback) override; void Cancel() override; @@ -46,6 +45,8 @@ FidoTransportProtocol AuthenticatorTransport() const override; base::WeakPtr<FidoAuthenticator> GetWeakPtr() override; + FidoDevice* GetDeviceForTesting() { return device_; } + protected: void OnCtapMakeCredentialResponseReceived( MakeCredentialCallback callback,
diff --git a/device/fido/fido_discovery.cc b/device/fido/fido_discovery.cc index 4de2ef6..ccedf32d7 100644 --- a/device/fido/fido_discovery.cc +++ b/device/fido/fido_discovery.cc
@@ -10,7 +10,9 @@ #include "build/build_config.h" #include "device/fido/ble/fido_ble_discovery.h" #include "device/fido/cable/fido_cable_discovery.h" +#include "device/fido/fido_authenticator.h" #include "device/fido/fido_device.h" +#include "device/fido/fido_device_authenticator.h" // HID is not supported on Android. #if !defined(OS_ANDROID) @@ -81,7 +83,7 @@ } FidoDiscovery::FidoDiscovery(FidoTransportProtocol transport) - : transport_(transport), weak_factory_(this) {} + : FidoDiscoveryBase(transport), weak_factory_(this) {} FidoDiscovery::~FidoDiscovery() = default; @@ -98,30 +100,31 @@ DCHECK_EQ(state_, State::kStarting); if (success) state_ = State::kRunning; - if (!observer_) + if (!observer()) return; - observer_->DiscoveryStarted(this, success); + observer()->DiscoveryStarted(this, success); } -void FidoDiscovery::NotifyDeviceAdded(FidoDevice* device) { +void FidoDiscovery::NotifyAuthenticatorAdded(FidoAuthenticator* authenticator) { DCHECK_NE(state_, State::kIdle); - if (!observer_) + if (!observer()) return; - observer_->DeviceAdded(this, device); + observer()->AuthenticatorAdded(this, authenticator); } -void FidoDiscovery::NotifyDeviceRemoved(FidoDevice* device) { +void FidoDiscovery::NotifyAuthenticatorRemoved( + FidoAuthenticator* authenticator) { DCHECK_NE(state_, State::kIdle); - if (!observer_) + if (!observer()) return; - observer_->DeviceRemoved(this, device); + observer()->AuthenticatorRemoved(this, authenticator); } std::vector<FidoDevice*> FidoDiscovery::GetDevices() { std::vector<FidoDevice*> devices; devices.reserve(devices_.size()); for (const auto& device : devices_) - devices.push_back(device.second.get()); + devices.push_back(device.second.second.get()); return devices; } @@ -129,7 +132,7 @@ std::vector<const FidoDevice*> devices; devices.reserve(devices_.size()); for (const auto& device : devices_) - devices.push_back(device.second.get()); + devices.push_back(device.second.second.get()); return devices; } @@ -140,17 +143,20 @@ const FidoDevice* FidoDiscovery::GetDevice(base::StringPiece device_id) const { auto found = devices_.find(device_id); - return found != devices_.end() ? found->second.get() : nullptr; + return found != devices_.end() ? found->second.second.get() : nullptr; } bool FidoDiscovery::AddDevice(std::unique_ptr<FidoDevice> device) { std::string device_id = device->GetId(); - const auto result = devices_.emplace(std::move(device_id), std::move(device)); + auto authenticator = std::make_unique<FidoDeviceAuthenticator>(device.get()); + const auto result = devices_.emplace( + std::move(device_id), + std::make_pair(std::move(authenticator), std::move(device))); if (!result.second) { return false; // Duplicate device id. } - NotifyDeviceAdded(result.first->second.get()); + NotifyAuthenticatorAdded(result.first->second.first.get()); return true; } @@ -159,9 +165,9 @@ if (found == devices_.end()) return false; - auto device = std::move(found->second); + auto authenticator_device_pair = std::move(found->second); devices_.erase(found); - NotifyDeviceRemoved(device.get()); + NotifyAuthenticatorRemoved(authenticator_device_pair.first.get()); return true; }
diff --git a/device/fido/fido_discovery.h b/device/fido/fido_discovery.h index ef260170c..e8d67c7 100644 --- a/device/fido/fido_discovery.h +++ b/device/fido/fido_discovery.h
@@ -18,6 +18,7 @@ #include "base/memory/weak_ptr.h" #include "base/strings/string_piece.h" #include "device/fido/cable/cable_discovery_data.h" +#include "device/fido/fido_discovery_base.h" #include "device/fido/fido_transport_protocol.h" namespace service_manager { @@ -32,7 +33,7 @@ class ScopedFidoDiscoveryFactory; } -class COMPONENT_EXPORT(DEVICE_FIDO) FidoDiscovery { +class COMPONENT_EXPORT(DEVICE_FIDO) FidoDiscovery : public FidoDiscoveryBase { public: enum class State { kIdle, @@ -40,32 +41,6 @@ kRunning, }; - class COMPONENT_EXPORT(DEVICE_FIDO) Observer { - public: - virtual ~Observer(); - - // It is guaranteed that this is never invoked synchronously from Start(). - virtual void DiscoveryStarted(FidoDiscovery* discovery, bool success) {} - - // It is guaranteed that DeviceAdded/DeviceRemoved() will not be invoked - // before the client of FidoDiscovery calls FidoDiscovery::Start(). However, - // for devices already known to the system at that point, DeviceAdded() - // might already be called to reported already known devices. - // - // The supplied FidoDevice instance is guaranteed to have its protocol - // version initialized. I.e., FidoDiscovery calls - // FidoDevice::DiscoverSupportedProtocolAndDeviceInfo() before notifying - // the Observer. - virtual void DeviceAdded(FidoDiscovery* discovery, FidoDevice* device) = 0; - virtual void DeviceRemoved(FidoDiscovery* discovery, - FidoDevice* device) = 0; - // Invoked when address of the connected FIDO Bluetooth device changes due - // to pairing. - virtual void DeviceIdChanged(FidoDiscovery* discovery, - const std::string& previous_id, - std::string new_id) = 0; - }; - // Factory functions to construct an instance that discovers authenticators on // the given |transport| protocol. The first variant is for everything except // for cloud-assisted BLE which is handled by the second variant. @@ -78,32 +53,27 @@ static std::unique_ptr<FidoDiscovery> CreateCable( std::vector<CableDiscoveryData> cable_data); - virtual ~FidoDiscovery(); + ~FidoDiscovery() override; - Observer* observer() const { return observer_; } - void set_observer(Observer* observer) { - DCHECK(!observer_ || !observer) << "Only one observer is supported."; - observer_ = observer; - } - - FidoTransportProtocol transport() const { return transport_; } bool is_start_requested() const { return state_ != State::kIdle; } bool is_running() const { return state_ == State::kRunning; } - void Start(); - std::vector<FidoDevice*> GetDevices(); std::vector<const FidoDevice*> GetDevices() const; + // TODO(martinkr): Rename to GetDeviceForTesting. FidoDevice* GetDevice(base::StringPiece device_id); const FidoDevice* GetDevice(base::StringPiece device_id) const; + // FidoDiscoveryBase: + void Start() override; + protected: FidoDiscovery(FidoTransportProtocol transport); void NotifyDiscoveryStarted(bool success); - void NotifyDeviceAdded(FidoDevice* device); - void NotifyDeviceRemoved(FidoDevice* device); + void NotifyAuthenticatorAdded(FidoAuthenticator* authenticator); + void NotifyAuthenticatorRemoved(FidoAuthenticator* authenticator); bool AddDevice(std::unique_ptr<FidoDevice> device); bool RemoveDevice(base::StringPiece device_id); @@ -115,8 +85,11 @@ // the discovery is s tarted. virtual void StartInternal() = 0; - std::map<std::string, std::unique_ptr<FidoDevice>, std::less<>> devices_; - Observer* observer_ = nullptr; + std::map<std::string, + std::pair<std::unique_ptr<FidoAuthenticator>, + std::unique_ptr<FidoDevice>>, + std::less<>> + devices_; private: friend class internal::ScopedFidoDiscoveryFactory; @@ -127,7 +100,6 @@ static FactoryFuncPtr g_factory_func_; static CableFactoryFuncPtr g_cable_factory_func_; - const FidoTransportProtocol transport_; State state_ = State::kIdle; base::WeakPtrFactory<FidoDiscovery> weak_factory_;
diff --git a/device/fido/fido_discovery_base.cc b/device/fido/fido_discovery_base.cc new file mode 100644 index 0000000..4dd026ad --- /dev/null +++ b/device/fido/fido_discovery_base.cc
@@ -0,0 +1,13 @@ +// Copyright 2018 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 "device/fido/fido_discovery_base.h" + +namespace device { + +FidoDiscoveryBase::FidoDiscoveryBase(FidoTransportProtocol transport) + : transport_(transport) {} +FidoDiscoveryBase::~FidoDiscoveryBase() = default; + +} // namespace device
diff --git a/device/fido/fido_discovery_base.h b/device/fido/fido_discovery_base.h new file mode 100644 index 0000000..f83a3a8 --- /dev/null +++ b/device/fido/fido_discovery_base.h
@@ -0,0 +1,69 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef DEVICE_FIDO_FIDO_DISCOVERY_BASE_H_ +#define DEVICE_FIDO_FIDO_DISCOVERY_BASE_H_ + +#include "base/component_export.h" +#include "base/logging.h" +#include "base/macros.h" +#include "device/fido/fido_transport_protocol.h" + +namespace device { + +class FidoAuthenticator; + +class COMPONENT_EXPORT(DEVICE_FIDO) FidoDiscoveryBase { + public: + virtual ~FidoDiscoveryBase(); + + class COMPONENT_EXPORT(DEVICE_FIDO) Observer { + public: + virtual ~Observer(); + + // It is guaranteed that this is never invoked synchronously from Start(). + virtual void DiscoveryStarted(FidoDiscoveryBase* discovery, bool success) {} + + // It is guaranteed that AuthenticatorAdded/AuthenticatorRemoved() will not + // be invoked before the client of FidoDiscoveryBase calls + // FidoDiscoveryBase::Start(). However, for authenticators already known to + // the system at that point, AuthenticatorAdded() might already be called to + // reported already known devices. + virtual void AuthenticatorAdded(FidoDiscoveryBase* discovery, + FidoAuthenticator* authenticator) = 0; + virtual void AuthenticatorRemoved(FidoDiscoveryBase* discovery, + FidoAuthenticator* authenticator) = 0; + + // Invoked when address of a connected FIDO Bluetooth device changes due + // to pairing. + virtual void AuthenticatorIdChanged(FidoDiscoveryBase* discovery, + const std::string& previous_id, + std::string new_id) = 0; + }; + + // Start authenticator discovery. The Observer must have been set before this + // method is invoked. DiscoveryStarted must be invoked asynchronously from + // this method. + virtual void Start() = 0; + + Observer* observer() const { return observer_; } + void set_observer(Observer* observer) { + DCHECK(!observer_ || !observer) << "Only one observer is supported."; + observer_ = observer; + } + FidoTransportProtocol transport() const { return transport_; } + + protected: + FidoDiscoveryBase(FidoTransportProtocol transport); + + private: + const FidoTransportProtocol transport_; + Observer* observer_ = nullptr; + + DISALLOW_COPY_AND_ASSIGN(FidoDiscoveryBase); +}; + +} // namespace device + +#endif // DEVICE_FIDO_FIDO_DISCOVERY_BASE_H_
diff --git a/device/fido/fido_discovery_unittest.cc b/device/fido/fido_discovery_unittest.cc index 46827b8..4ebf0ab1 100644 --- a/device/fido/fido_discovery_unittest.cc +++ b/device/fido/fido_discovery_unittest.cc
@@ -9,6 +9,8 @@ #include "base/macros.h" #include "base/run_loop.h" #include "base/test/scoped_task_environment.h" +#include "device/fido/fido_authenticator.h" +#include "device/fido/fido_device_authenticator.h" #include "device/fido/fido_test_data.h" #include "device/fido/mock_fido_device.h" #include "device/fido/mock_fido_discovery_observer.h" @@ -20,7 +22,9 @@ namespace { using ::testing::_; +using ::testing::DoAll; using ::testing::Return; +using ::testing::SaveArg; using ::testing::UnorderedElementsAre; // A minimal implementation of FidoDiscovery that is no longer abstract. @@ -33,11 +37,8 @@ MOCK_METHOD0(StartInternal, void()); using FidoDiscovery::AddDevice; - using FidoDiscovery::RemoveDevice; - using FidoDiscovery::NotifyDiscoveryStarted; - using FidoDiscovery::NotifyDeviceAdded; - using FidoDiscovery::NotifyDeviceRemoved; + using FidoDiscovery::RemoveDevice; private: DISALLOW_COPY_AND_ASSIGN(ConcreteFidoDiscovery); @@ -102,12 +103,17 @@ // Expect successful insertion. auto device0 = std::make_unique<MockFidoDevice>(); auto* device0_raw = device0.get(); + FidoAuthenticator* authenticator0 = nullptr; base::RunLoop device0_done; - EXPECT_CALL(observer, DeviceAdded(&discovery, device0_raw)) - .WillOnce(testing::InvokeWithoutArgs( - [&device0_done]() { device0_done.Quit(); })); - EXPECT_CALL(*device0, GetId()).WillOnce(Return("device0")); + EXPECT_CALL(observer, AuthenticatorAdded(&discovery, _)) + .WillOnce(DoAll(SaveArg<1>(&authenticator0), + testing::InvokeWithoutArgs( + [&device0_done]() { device0_done.Quit(); }))); + EXPECT_CALL(*device0, GetId()).WillRepeatedly(Return("device0")); EXPECT_TRUE(discovery.AddDevice(std::move(device0))); + EXPECT_EQ("device0", authenticator0->GetId()); + EXPECT_EQ(device0_raw, static_cast<FidoDeviceAuthenticator*>(authenticator0) + ->GetDeviceForTesting()); device0_done.Run(); ::testing::Mock::VerifyAndClearExpectations(&observer); @@ -115,17 +121,22 @@ base::RunLoop device1_done; auto device1 = std::make_unique<MockFidoDevice>(); auto* device1_raw = device1.get(); - EXPECT_CALL(observer, DeviceAdded(&discovery, device1_raw)) - .WillOnce(testing::InvokeWithoutArgs( - [&device1_done]() { device1_done.Quit(); })); - EXPECT_CALL(*device1, GetId()).WillOnce(Return("device1")); + FidoAuthenticator* authenticator1 = nullptr; + EXPECT_CALL(observer, AuthenticatorAdded(&discovery, _)) + .WillOnce(DoAll(SaveArg<1>(&authenticator1), + testing::InvokeWithoutArgs( + [&device1_done]() { device1_done.Quit(); }))); + EXPECT_CALL(*device1, GetId()).WillRepeatedly(Return("device1")); EXPECT_TRUE(discovery.AddDevice(std::move(device1))); + EXPECT_EQ("device1", authenticator1->GetId()); + EXPECT_EQ(device1_raw, static_cast<FidoDeviceAuthenticator*>(authenticator1) + ->GetDeviceForTesting()); device1_done.Run(); ::testing::Mock::VerifyAndClearExpectations(&observer); // Inserting a device with an already present id should be prevented. auto device1_dup = std::make_unique<MockFidoDevice>(); - EXPECT_CALL(observer, DeviceAdded(_, _)).Times(0); + EXPECT_CALL(observer, AuthenticatorAdded(_, _)).Times(0); EXPECT_CALL(*device1_dup, GetId()).WillOnce(Return("device1")); EXPECT_FALSE(discovery.AddDevice(std::move(device1_dup))); ::testing::Mock::VerifyAndClearExpectations(&observer); @@ -142,15 +153,15 @@ UnorderedElementsAre(device0_raw, device1_raw)); // Trying to remove a non-present device should fail. - EXPECT_CALL(observer, DeviceRemoved(_, _)).Times(0); + EXPECT_CALL(observer, AuthenticatorRemoved(_, _)).Times(0); EXPECT_FALSE(discovery.RemoveDevice("device2")); ::testing::Mock::VerifyAndClearExpectations(&observer); - EXPECT_CALL(observer, DeviceRemoved(&discovery, device1_raw)); + EXPECT_CALL(observer, AuthenticatorRemoved(&discovery, authenticator1)); EXPECT_TRUE(discovery.RemoveDevice("device1")); ::testing::Mock::VerifyAndClearExpectations(&observer); - EXPECT_CALL(observer, DeviceRemoved(&discovery, device0_raw)); + EXPECT_CALL(observer, AuthenticatorRemoved(&discovery, authenticator0)); EXPECT_TRUE(discovery.RemoveDevice("device0")); ::testing::Mock::VerifyAndClearExpectations(&observer); }
diff --git a/device/fido/fido_request_handler.h b/device/fido/fido_request_handler.h index 00cf754..b1ac902 100644 --- a/device/fido/fido_request_handler.h +++ b/device/fido/fido_request_handler.h
@@ -41,7 +41,7 @@ ~FidoRequestHandler() override { if (!is_complete()) - CancelOngoingTasks(); + CancelActiveAuthenticators(); } bool is_complete() const { return completion_callback_.is_null(); } @@ -72,7 +72,7 @@ // Once response has been passed to the relying party, cancel all other on // going requests. - CancelOngoingTasks(authenticator->GetId()); + CancelActiveAuthenticators(authenticator->GetId()); std::move(completion_callback_) .Run(*return_code, std::move(response_data), authenticator->AuthenticatorTransport());
diff --git a/device/fido/fido_request_handler_base.cc b/device/fido/fido_request_handler_base.cc index 402c5092..5014e59 100644 --- a/device/fido/fido_request_handler_base.cc +++ b/device/fido/fido_request_handler_base.cc
@@ -14,8 +14,6 @@ #include "base/threading/sequenced_task_runner_handle.h" #include "build/build_config.h" #include "device/fido/ble_adapter_manager.h" -#include "device/fido/fido_device.h" -#include "device/fido/fido_task.h" #include "services/service_manager/public/cpp/connector.h" namespace device { @@ -121,14 +119,14 @@ void FidoRequestHandlerBase::StartAuthenticatorRequest( const std::string& authenticator_id) { - auto authenticator = active_authenticators_.find(authenticator_id); - if (authenticator == active_authenticators_.end()) + auto authenticator_it = active_authenticators_.find(authenticator_id); + if (authenticator_it == active_authenticators_.end()) return; - InitializeAuthenticatorAndDispatchRequest(authenticator->second.get()); + InitializeAuthenticatorAndDispatchRequest(authenticator_it->second); } -void FidoRequestHandlerBase::CancelOngoingTasks( +void FidoRequestHandlerBase::CancelActiveAuthenticators( base::StringPiece exclude_device_id) { for (auto task_it = active_authenticators_.begin(); task_it != active_authenticators_.end();) { @@ -136,6 +134,10 @@ if (task_it->first != exclude_device_id) { DCHECK(task_it->second); task_it->second->Cancel(); + + // Note that the pointer being erased is non-owning. The actual + // FidoAuthenticator instance is owned by its discovery (which in turn is + // owned by |discoveries_|. task_it = active_authenticators_.erase(task_it); } else { ++task_it; @@ -183,34 +185,32 @@ discovery->Start(); } -void FidoRequestHandlerBase::DeviceAdded(FidoDiscovery* discovery, - FidoDevice* device) { - DCHECK(!base::ContainsKey(active_authenticators(), device->GetId())); - AddAuthenticator(CreateAuthenticatorFromDevice(device)); +void FidoRequestHandlerBase::AuthenticatorAdded( + FidoDiscoveryBase* discovery, + FidoAuthenticator* authenticator) { + DCHECK(!base::ContainsKey(active_authenticators(), authenticator->GetId())); + AddAuthenticator(authenticator); } -std::unique_ptr<FidoDeviceAuthenticator> -FidoRequestHandlerBase::CreateAuthenticatorFromDevice(FidoDevice* device) { - return std::make_unique<FidoDeviceAuthenticator>(device); -} - -void FidoRequestHandlerBase::DeviceRemoved(FidoDiscovery* discovery, - FidoDevice* device) { +void FidoRequestHandlerBase::AuthenticatorRemoved( + FidoDiscoveryBase* discovery, + FidoAuthenticator* authenticator) { // Device connection has been lost or device has already been removed. // Thus, calling CancelTask() is not necessary. Also, below // ongoing_tasks_.erase() will have no effect for the devices that have been // already removed due to processing error or due to invocation of // CancelOngoingTasks(). - DCHECK(device); - active_authenticators_.erase(device->GetId()); + DCHECK(authenticator); + active_authenticators_.erase(authenticator->GetId()); if (observer_) - observer_->FidoAuthenticatorRemoved(device->GetId()); + observer_->FidoAuthenticatorRemoved(authenticator->GetId()); } -void FidoRequestHandlerBase::DeviceIdChanged(FidoDiscovery* discovery, - const std::string& previous_id, - std::string new_id) { +void FidoRequestHandlerBase::AuthenticatorIdChanged( + FidoDiscoveryBase* discovery, + const std::string& previous_id, + std::string new_id) { DCHECK_EQ(FidoTransportProtocol::kBluetoothLowEnergy, discovery->transport()); auto it = active_authenticators_.find(previous_id); if (it == active_authenticators_.end()) @@ -224,21 +224,19 @@ } void FidoRequestHandlerBase::AddAuthenticator( - std::unique_ptr<FidoAuthenticator> authenticator) { + FidoAuthenticator* authenticator) { DCHECK(authenticator && !base::ContainsKey(active_authenticators(), authenticator->GetId())); - FidoAuthenticator* authenticator_ptr = authenticator.get(); - active_authenticators_.emplace(authenticator->GetId(), - std::move(authenticator)); + active_authenticators_.emplace(authenticator->GetId(), authenticator); - // If |observer_| exists, dispatching request to |authenticator_ptr| is - // delegated to |observer_|. Else, dispatch request to |authenticator_ptr| + // If |observer_| exists, dispatching request to |authenticator| is + // delegated to |observer_|. Else, dispatch request to |authenticator| // immediately. bool embedder_controls_dispatch = false; if (observer_) { embedder_controls_dispatch = - observer_->EmbedderControlsAuthenticatorDispatch(*authenticator_ptr); - observer_->FidoAuthenticatorAdded(*authenticator_ptr); + observer_->EmbedderControlsAuthenticatorDispatch(*authenticator); + observer_->FidoAuthenticatorAdded(*authenticator); } if (!embedder_controls_dispatch) { @@ -249,12 +247,13 @@ FROM_HERE, base::BindOnce( &FidoRequestHandlerBase::InitializeAuthenticatorAndDispatchRequest, - GetWeakPtr(), authenticator_ptr)); + GetWeakPtr(), authenticator)); } } void FidoRequestHandlerBase::SetPlatformAuthenticatorOrMarkUnavailable( base::Optional<PlatformAuthenticatorInfo> platform_authenticator_info) { + DCHECK(!platform_authenticator_); if (platform_authenticator_info && base::ContainsKey(transport_availability_info_.available_transports, FidoTransportProtocol::kInternal)) { @@ -264,7 +263,9 @@ FidoTransportProtocol::kInternal)); transport_availability_info_.has_recognized_mac_touch_id_credential = platform_authenticator_info->has_recognized_mac_touch_id_credential; - AddAuthenticator(std::move(platform_authenticator_info->authenticator)); + platform_authenticator_ = + std::move(platform_authenticator_info->authenticator); + AddAuthenticator(platform_authenticator_.get()); } else { transport_availability_info_.available_transports.erase( FidoTransportProtocol::kInternal);
diff --git a/device/fido/fido_request_handler_base.h b/device/fido/fido_request_handler_base.h index 0ab206f4..403dd21 100644 --- a/device/fido/fido_request_handler_base.h +++ b/device/fido/fido_request_handler_base.h
@@ -31,8 +31,6 @@ class BleAdapterManager; class FidoAuthenticator; -class FidoDevice; -class FidoTask; struct COMPONENT_EXPORT(DEVICE_FIDO) PlatformAuthenticatorInfo { PlatformAuthenticatorInfo(std::unique_ptr<FidoAuthenticator> authenticator, @@ -45,16 +43,16 @@ bool has_recognized_mac_touch_id_credential; }; -// Base class that handles device discovery/removal. Each FidoRequestHandlerBase -// is owned by FidoRequestManager and its lifetime is equivalent to that of a -// single WebAuthn request. For each authenticator, the per-device work is -// carried out by one FidoTask instance, which is constructed on DeviceAdded(), -// and destroyed either on DeviceRemoved() or CancelOutgoingTaks(). +// Base class that handles authenticator discovery/removal. Its lifetime is +// equivalent to that of a single WebAuthn request. For each authenticator, the +// per-device work is carried out by one FidoAuthenticator instance, which is +// constructed in a FidoDiscoveryBase and passed to the request handler via its +// Observer interface. class COMPONENT_EXPORT(DEVICE_FIDO) FidoRequestHandlerBase - : public FidoDiscovery::Observer { + : public FidoDiscoveryBase::Observer { public: using AuthenticatorMap = - std::map<std::string, std::unique_ptr<FidoAuthenticator>, std::less<>>; + std::map<std::string, FidoAuthenticator*, std::less<>>; using RequestCallback = base::RepeatingCallback<void(const std::string&)>; enum class RequestType { kMakeCredential, kGetAssertion }; @@ -128,17 +126,16 @@ // FidoAuthenticator with given |authenticator_id|. void StartAuthenticatorRequest(const std::string& authenticator_id); - // Triggers cancellation of all per-device FidoTasks, except for the device - // with |exclude_device_id|, if one is provided. Cancelled tasks are - // immediately removed from |ongoing_tasks_|. + // Invokes |FidoAuthenticator::Cancel| on all authenticators, except if + // matching |exclude_id|, if one is provided. Cancelled authenticators are + // immediately removed from |active_authenticators_|. // - // This function is invoked either when: - // (a) the entire WebAuthn API request is canceled or, - // (b) a successful response or "invalid state error" is received from the - // any one of the connected authenticators, in which case all other - // per-device tasks are cancelled. + // This function is invoked either when: (a) the entire WebAuthn API request + // is canceled or, (b) a successful response or "invalid state error" is + // received from the any one of the connected authenticators, in which case + // all other authenticators are cancelled. // https://w3c.github.io/webauthn/#iface-pkcredential - void CancelOngoingTasks(base::StringPiece exclude_device_id = nullptr); + void CancelActiveAuthenticators(base::StringPiece exclude_id = nullptr); void OnBluetoothAdapterEnumerated(bool is_present, bool is_powered_on, bool can_power_on); @@ -173,12 +170,8 @@ void Start(); - // Testing seam to allow unit tests to inject a fake authenticator. - virtual std::unique_ptr<FidoDeviceAuthenticator> - CreateAuthenticatorFromDevice(FidoDevice* device); - AuthenticatorMap& active_authenticators() { return active_authenticators_; } - std::vector<std::unique_ptr<FidoDiscovery>>& discoveries() { + std::vector<std::unique_ptr<FidoDiscoveryBase>>& discoveries() { return discoveries_; } TransportAvailabilityObserver* observer() const { return observer_; } @@ -186,14 +179,16 @@ private: friend class FidoRequestHandlerTest; - // FidoDiscovery::Observer - void DeviceAdded(FidoDiscovery* discovery, FidoDevice* device) final; - void DeviceRemoved(FidoDiscovery* discovery, FidoDevice* device) final; - void DeviceIdChanged(FidoDiscovery* discovery, - const std::string& previous_id, - std::string new_id) final; + // FidoDiscoveryBase::Observer + void AuthenticatorAdded(FidoDiscoveryBase* discovery, + FidoAuthenticator* authenticator) final; + void AuthenticatorRemoved(FidoDiscoveryBase* discovery, + FidoAuthenticator* authenticator) final; + void AuthenticatorIdChanged(FidoDiscoveryBase* discovery, + const std::string& previous_id, + std::string new_id) final; - void AddAuthenticator(std::unique_ptr<FidoAuthenticator> authenticator); + void AddAuthenticator(FidoAuthenticator* authenticator); void NotifyObserverTransportAvailability(); // Invokes FidoAuthenticator::InitializeAuthenticator(), followed by @@ -204,11 +199,14 @@ void ConstructBleAdapterPowerManager(); AuthenticatorMap active_authenticators_; - std::vector<std::unique_ptr<FidoDiscovery>> discoveries_; + std::vector<std::unique_ptr<FidoDiscoveryBase>> discoveries_; TransportAvailabilityObserver* observer_ = nullptr; TransportAvailabilityInfo transport_availability_info_; base::RepeatingClosure notify_observer_callback_; std::unique_ptr<BleAdapterManager> bluetooth_adapter_manager_; + // TODO(martinkr): Inject platform authenticators through FidoDiscovery and + // hold ownership there. + std::unique_ptr<FidoAuthenticator> platform_authenticator_; base::WeakPtrFactory<FidoRequestHandlerBase> weak_factory_; DISALLOW_COPY_AND_ASSIGN(FidoRequestHandlerBase);
diff --git a/device/fido/fido_request_handler_unittest.cc b/device/fido/fido_request_handler_unittest.cc index 3daa0b1..dd3bd2f 100644 --- a/device/fido/fido_request_handler_unittest.cc +++ b/device/fido/fido_request_handler_unittest.cc
@@ -189,11 +189,6 @@ weak_factory_.GetWeakPtr(), authenticator)); } - std::unique_ptr<FidoDeviceAuthenticator> CreateAuthenticatorFromDevice( - FidoDevice* device) override { - return std::make_unique<FakeFidoAuthenticator>(device); - } - private: base::WeakPtrFactory<FakeFidoRequestHandler> weak_factory_; }; @@ -244,8 +239,8 @@ void ChangeAuthenticatorId(FakeFidoRequestHandler* request_handler, FidoDevice* device, std::string new_authenticator_id) { - request_handler->DeviceIdChanged(ble_discovery_, device->GetId(), - std::move(new_authenticator_id)); + request_handler->AuthenticatorIdChanged(ble_discovery_, device->GetId(), + std::move(new_authenticator_id)); } test::FakeFidoDiscovery* discovery() const { return discovery_; }
diff --git a/device/fido/hid/fido_hid_discovery_unittest.cc b/device/fido/hid/fido_hid_discovery_unittest.cc index 75c1c70..ebae8e7 100644 --- a/device/fido/hid/fido_hid_discovery_unittest.cc +++ b/device/fido/hid/fido_hid_discovery_unittest.cc
@@ -8,6 +8,7 @@ #include <utility> #include "base/test/scoped_task_environment.h" +#include "device/fido/fido_authenticator.h" #include "device/fido/hid/fake_hid_impl_for_testing.h" #include "device/fido/hid/fido_hid_device.h" #include "device/fido/mock_fido_discovery_observer.h" @@ -91,26 +92,26 @@ // Devices initially known to the service before discovery started should be // reported as KNOWN. - EXPECT_CALL(observer, DeviceAdded(&discovery, IdMatches("known"))); + EXPECT_CALL(observer, AuthenticatorAdded(&discovery, IdMatches("known"))); scoped_task_environment().RunUntilIdle(); // Devices added during the discovery should be reported as ADDED. - EXPECT_CALL(observer, DeviceAdded(&discovery, IdMatches("added"))); + EXPECT_CALL(observer, AuthenticatorAdded(&discovery, IdMatches("added"))); fake_hid_manager_->AddDevice(MakeFidoHidDevice("added")); scoped_task_environment().RunUntilIdle(); // Added non-U2F devices should not be reported at all. - EXPECT_CALL(observer, DeviceAdded(_, _)).Times(0); + EXPECT_CALL(observer, AuthenticatorAdded(_, _)).Times(0); fake_hid_manager_->AddDevice(MakeOtherDevice("other")); // Removed non-U2F devices should not be reported at all. - EXPECT_CALL(observer, DeviceRemoved(_, _)).Times(0); + EXPECT_CALL(observer, AuthenticatorRemoved(_, _)).Times(0); fake_hid_manager_->RemoveDevice("other"); scoped_task_environment().RunUntilIdle(); // Removed U2F devices should be reported as REMOVED. - EXPECT_CALL(observer, DeviceRemoved(&discovery, IdMatches("known"))); - EXPECT_CALL(observer, DeviceRemoved(&discovery, IdMatches("added"))); + EXPECT_CALL(observer, AuthenticatorRemoved(&discovery, IdMatches("known"))); + EXPECT_CALL(observer, AuthenticatorRemoved(&discovery, IdMatches("added"))); fake_hid_manager_->RemoveDevice("known"); fake_hid_manager_->RemoveDevice("added"); scoped_task_environment().RunUntilIdle();
diff --git a/device/fido/mock_fido_discovery_observer.h b/device/fido/mock_fido_discovery_observer.h index 3362c5e..3f87945d9 100644 --- a/device/fido/mock_fido_discovery_observer.h +++ b/device/fido/mock_fido_discovery_observer.h
@@ -14,19 +14,21 @@ namespace device { -class FidoDevice; +class FidoAuthenticator; -class MockFidoDiscoveryObserver : public FidoDiscovery::Observer { +class MockFidoDiscoveryObserver : public FidoDiscoveryBase::Observer { public: MockFidoDiscoveryObserver(); ~MockFidoDiscoveryObserver() override; - MOCK_METHOD2(DiscoveryStarted, void(FidoDiscovery*, bool)); - MOCK_METHOD2(DiscoveryStopped, void(FidoDiscovery*, bool)); - MOCK_METHOD2(DeviceAdded, void(FidoDiscovery*, FidoDevice*)); - MOCK_METHOD2(DeviceRemoved, void(FidoDiscovery*, FidoDevice*)); - MOCK_METHOD3(DeviceIdChanged, - void(FidoDiscovery*, const std::string&, std::string)); + MOCK_METHOD2(DiscoveryStarted, void(FidoDiscoveryBase*, bool)); + MOCK_METHOD2(DiscoveryStopped, void(FidoDiscoveryBase*, bool)); + MOCK_METHOD2(AuthenticatorAdded, + void(FidoDiscoveryBase*, FidoAuthenticator*)); + MOCK_METHOD2(AuthenticatorRemoved, + void(FidoDiscoveryBase*, FidoAuthenticator*)); + MOCK_METHOD3(AuthenticatorIdChanged, + void(FidoDiscoveryBase*, const std::string&, std::string)); private: DISALLOW_COPY_AND_ASSIGN(MockFidoDiscoveryObserver);
diff --git a/extensions/browser/api/web_request/web_request_permissions_unittest.cc b/extensions/browser/api/web_request/web_request_permissions_unittest.cc index 8441b7d..976cde2 100644 --- a/extensions/browser/api/web_request/web_request_permissions_unittest.cc +++ b/extensions/browser/api/web_request/web_request_permissions_unittest.cc
@@ -4,6 +4,7 @@ #include "extensions/browser/api/web_request/web_request_permissions.h" +#include "base/memory/scoped_refptr.h" #include "base/strings/stringprintf.h" #include "content/public/test/test_browser_thread_bundle.h" #include "extensions/browser/api/extensions_api_client.h" @@ -21,7 +22,7 @@ namespace extensions { -TEST(ExtensionWebRequestPermissions, IsSensitiveRequest) { +TEST(ExtensionWebRequestPermissions, TestHideRequestForURL) { enum HideRequestMask { HIDE_NONE = 0, HIDE_RENDERER_REQUEST = 1, @@ -33,6 +34,7 @@ }; ExtensionsAPIClient api_client; + auto info_map = base::MakeRefCounted<extensions::InfoMap>(); struct TestCase { const char* url; @@ -43,6 +45,8 @@ {"https://www.example.com", HIDE_BROWSER_SUB_RESOURCE_REQUEST}, {"https://clients.google.com", HIDE_BROWSER_SUB_RESOURCE_REQUEST | HIDE_SUB_FRAME_NAVIGATION}, + {"http://clients4.google.com", + HIDE_BROWSER_SUB_RESOURCE_REQUEST | HIDE_SUB_FRAME_NAVIGATION}, {"https://clients4.google.com", HIDE_BROWSER_SUB_RESOURCE_REQUEST | HIDE_SUB_FRAME_NAVIGATION}, {"https://clients9999.google.com", @@ -54,6 +58,8 @@ HIDE_BROWSER_SUB_RESOURCE_REQUEST | HIDE_SUB_FRAME_NAVIGATION}, {"https://.clients.google.com.", HIDE_BROWSER_SUB_RESOURCE_REQUEST | HIDE_SUB_FRAME_NAVIGATION}, + {"https://test.clients.google.com", + HIDE_SUB_FRAME_NAVIGATION | HIDE_BROWSER_SUB_RESOURCE_REQUEST}, {"http://google.example.com", HIDE_BROWSER_SUB_RESOURCE_REQUEST}, {"http://www.example.com", HIDE_BROWSER_SUB_RESOURCE_REQUEST}, {"https://www.example.com", HIDE_BROWSER_SUB_RESOURCE_REQUEST}, @@ -74,17 +80,24 @@ {"https://safebrowsing.google.com/safebrowsing/anything", HIDE_ALL}, {"https://safebrowsing.google.com", HIDE_BROWSER_SUB_RESOURCE_REQUEST}, {"https://chrome.google.com", HIDE_BROWSER_SUB_RESOURCE_REQUEST}, + {"http://www.google.com/", HIDE_BROWSER_SUB_RESOURCE_REQUEST}, {"https://chrome.google.com/webstore", HIDE_ALL}, {"https://chrome.google.com./webstore", HIDE_ALL}, + {"https://chrome.google.com./webstore/", HIDE_ALL}, // Unsupported scheme. {"blob:https://chrome.google.com/fc3f440b-78ed-469f-8af8-7a1717ff39ae", HIDE_ALL}, + {"notregisteredscheme://www.foobar.com", HIDE_ALL}, {"https://chrome.google.com:80/webstore", HIDE_ALL}, {"https://chrome.google.com/webstore?query", HIDE_ALL}, + {"http://clients2.google.com/service/update2/crx", HIDE_ALL}, + {"https://clients2.google.com/service/update2/crx", HIDE_ALL}, + {"https://chrome.google.com/webstore/inlineinstall/detail/" + "kcnhkahnjcbndmmehfkdnkjomaanaooo", + HIDE_ALL}, }; const int kRendererProcessId = 1; const int kBrowserProcessId = -1; - extensions::InfoMap* info_map = nullptr; // Returns a WebRequestInfo instance constructed as per the given parameters. auto create_request = [](const GURL& url, content::ResourceType type, @@ -114,7 +127,7 @@ bool expect_hidden = test_case.expected_hide_request_mask & HIDE_RENDERER_REQUEST; EXPECT_EQ(expect_hidden, - WebRequestPermissions::HideRequest(info_map, request)); + WebRequestPermissions::HideRequest(info_map.get(), request)); } { @@ -124,7 +137,7 @@ bool expect_hidden = test_case.expected_hide_request_mask & HIDE_BROWSER_SUB_RESOURCE_REQUEST; EXPECT_EQ(expect_hidden, - WebRequestPermissions::HideRequest(info_map, request)); + WebRequestPermissions::HideRequest(info_map.get(), request)); } { @@ -134,7 +147,7 @@ bool expect_hidden = test_case.expected_hide_request_mask & HIDE_MAIN_FRAME_NAVIGATION; EXPECT_EQ(expect_hidden, - WebRequestPermissions::HideRequest(info_map, request)); + WebRequestPermissions::HideRequest(info_map.get(), request)); } { @@ -144,9 +157,35 @@ bool expect_hidden = test_case.expected_hide_request_mask & HIDE_SUB_FRAME_NAVIGATION; EXPECT_EQ(expect_hidden, - WebRequestPermissions::HideRequest(info_map, request)); + WebRequestPermissions::HideRequest(info_map.get(), request)); } } + + // Check protection of requests originating from the frame showing the Chrome + // WebStore. Normally this request is not protected: + GURL non_sensitive_url("http://www.google.com/test.js"); + WebRequestInfo non_sensitive_request_info = create_request( + non_sensitive_url, content::RESOURCE_TYPE_SCRIPT, kRendererProcessId); + EXPECT_FALSE(WebRequestPermissions::HideRequest(info_map.get(), + non_sensitive_request_info)); + + // If the origin is labeled by the WebStoreAppId, it becomes protected. + { + const int kWebstoreProcessId = 42; + const int kSiteInstanceId = 23; + info_map->RegisterExtensionProcess(extensions::kWebStoreAppId, + kWebstoreProcessId, kSiteInstanceId); + WebRequestInfo sensitive_request_info = create_request( + non_sensitive_url, content::RESOURCE_TYPE_SCRIPT, kWebstoreProcessId); + EXPECT_TRUE(WebRequestPermissions::HideRequest(info_map.get(), + sensitive_request_info)); + } + + // Check that a request for a non-sensitive URL is rejected if it's a PAC + // script fetch. + non_sensitive_request_info.is_pac_request = true; + EXPECT_TRUE(WebRequestPermissions::HideRequest(info_map.get(), + non_sensitive_request_info)); } TEST(ExtensionWebRequestPermissions,
diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_browsertest.cc b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_browsertest.cc index 9f9b9552..5e0df73 100644 --- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_browsertest.cc +++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_browsertest.cc
@@ -341,4 +341,24 @@ FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); run_loop.Run(); } -} \ No newline at end of file +} + +// Verify that a BrowserPlugin captures mouse input on MouseDown. +IN_PROC_BROWSER_TEST_F(MimeHandlerViewBrowserPluginSpecificTest, + MouseCaptureOnMouseDown) { + RunTest("testBasic.csv"); + auto* guest_web_contents = GetGuestViewManager()->WaitForSingleGuestCreated(); + auto* guest_widget = MimeHandlerViewGuest::FromWebContents(guest_web_contents) + ->GetOwnerRenderWidgetHost(); + auto* embedder_web_contents = GetEmbedderWebContents(); + + SendMouseDownToWidget(guest_widget, 0, blink::WebMouseEvent::Button::kLeft); + + while (!GetMouseCaptureWidget(embedder_web_contents)) { + base::RunLoop run_loop; + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( + FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); + run_loop.Run(); + } + EXPECT_EQ(GetMouseCaptureWidget(embedder_web_contents), guest_widget); +}
diff --git a/extensions/renderer/resource_bundle_source_map.cc b/extensions/renderer/resource_bundle_source_map.cc index d71555e..2bd987be 100644 --- a/extensions/renderer/resource_bundle_source_map.cc +++ b/extensions/renderer/resource_bundle_source_map.cc
@@ -5,6 +5,7 @@ #include "extensions/renderer/resource_bundle_source_map.h" #include "base/logging.h" +#include "base/stl_util.h" #include "base/strings/string_piece.h" #include "extensions/renderer/static_v8_external_one_byte_string_resource.h" #include "third_party/zlib/google/compression_utils.h" @@ -88,7 +89,7 @@ } bool ResourceBundleSourceMap::Contains(const std::string& name) const { - return !!resource_map_.count(name); + return base::ContainsKey(resource_map_, name); } } // namespace extensions
diff --git a/gpu/ipc/common/BUILD.gn b/gpu/ipc/common/BUILD.gn index 373f81ac..cb89b312 100644 --- a/gpu/ipc/common/BUILD.gn +++ b/gpu/ipc/common/BUILD.gn
@@ -170,6 +170,7 @@ mojom("interfaces") { sources = [ "capabilities.mojom", + "context_result.mojom", "dx_diag_node.mojom", "gpu_feature_info.mojom", "gpu_info.mojom", @@ -212,6 +213,7 @@ source_set("struct_traits") { sources = [ + "context_result_struct_traits.h", "mailbox_holder_struct_traits.h", "mailbox_struct_traits.h", "memory_stats_struct_traits.h",
diff --git a/gpu/ipc/common/context_result.mojom b/gpu/ipc/common/context_result.mojom new file mode 100644 index 0000000..5585a83 --- /dev/null +++ b/gpu/ipc/common/context_result.mojom
@@ -0,0 +1,13 @@ +// Copyright 2018 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. + +module gpu.mojom; + +// gpu::ContextResult +enum ContextResult { + Success, + TransientFailure, + FatalFailure, + SurfaceFailure +};
diff --git a/gpu/ipc/common/context_result.typemap b/gpu/ipc/common/context_result.typemap new file mode 100644 index 0000000..5197a8e9 --- /dev/null +++ b/gpu/ipc/common/context_result.typemap
@@ -0,0 +1,8 @@ +# Copyright 2018 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. + +mojom = "//gpu/ipc/common/context_result.mojom" +public_headers = [ "//gpu/command_buffer/common/context_result.h" ] +traits_headers = [ "//gpu/ipc/common/context_result_struct_traits.h" ] +type_mappings = [ "gpu.mojom.ContextResult=gpu::ContextResult" ]
diff --git a/gpu/ipc/common/context_result_struct_traits.h b/gpu/ipc/common/context_result_struct_traits.h new file mode 100644 index 0000000..37cc529 --- /dev/null +++ b/gpu/ipc/common/context_result_struct_traits.h
@@ -0,0 +1,52 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef GPU_IPC_COMMON_CONTEXT_RESULT_STRUCT_TRAITS_H_ +#define GPU_IPC_COMMON_CONTEXT_RESULT_STRUCT_TRAITS_H_ + +#include "gpu/command_buffer/common/context_result.h" +#include "gpu/ipc/common/context_result.mojom-shared.h" + +namespace mojo { + +template <> +struct EnumTraits<gpu::mojom::ContextResult, gpu::ContextResult> { + static gpu::mojom::ContextResult ToMojom(gpu::ContextResult context_result) { + switch (context_result) { + case gpu::ContextResult::kSuccess: + return gpu::mojom::ContextResult::Success; + case gpu::ContextResult::kTransientFailure: + return gpu::mojom::ContextResult::TransientFailure; + case gpu::ContextResult::kFatalFailure: + return gpu::mojom::ContextResult::FatalFailure; + case gpu::ContextResult::kSurfaceFailure: + return gpu::mojom::ContextResult::SurfaceFailure; + } + NOTREACHED(); + return gpu::mojom::ContextResult::FatalFailure; + } + + static bool FromMojom(gpu::mojom::ContextResult input, + gpu::ContextResult* out) { + switch (input) { + case gpu::mojom::ContextResult::Success: + *out = gpu::ContextResult::kSuccess; + return true; + case gpu::mojom::ContextResult::TransientFailure: + *out = gpu::ContextResult::kTransientFailure; + return true; + case gpu::mojom::ContextResult::FatalFailure: + *out = gpu::ContextResult::kFatalFailure; + return true; + case gpu::mojom::ContextResult::SurfaceFailure: + *out = gpu::ContextResult::kSurfaceFailure; + return true; + } + return false; + } +}; + +} // namespace mojo + +#endif // GPU_IPC_COMMON_GPU_FEATURE_INFO_STRUCT_TRAITS_H_
diff --git a/gpu/ipc/common/typemaps.gni b/gpu/ipc/common/typemaps.gni index d89d86d..54e4bf2 100644 --- a/gpu/ipc/common/typemaps.gni +++ b/gpu/ipc/common/typemaps.gni
@@ -4,6 +4,7 @@ typemaps = [ "//gpu/ipc/common/capabilities.typemap", + "//gpu/ipc/common/context_result.typemap", "//gpu/ipc/common/gpu_feature_info.typemap", "//gpu/ipc/common/gpu_info.typemap", "//gpu/ipc/common/gpu_preferences.typemap",
diff --git a/infra/config/global/cr-buildbucket-dev.cfg b/infra/config/global/cr-buildbucket-dev.cfg index 99093ae57..be6ae04 100644 --- a/infra/config/global/cr-buildbucket-dev.cfg +++ b/infra/config/global/cr-buildbucket-dev.cfg
@@ -108,5 +108,15 @@ name: "snapshots/builder" } } + + builders { + name: "Snapshots" + execution_timeout_secs: 3600 + recipe { + cipd_package: "infra/recipe_bundles/chromium.googlesource.com/infra/infra" + cipd_version: "refs/heads/master" + name: "snapshots/snapshot" + } + } } }
diff --git a/infra/config/global/cr-buildbucket.cfg b/infra/config/global/cr-buildbucket.cfg index 5898452..5bc7b2aa 100644 --- a/infra/config/global/cr-buildbucket.cfg +++ b/infra/config/global/cr-buildbucket.cfg
@@ -487,6 +487,19 @@ } } +# TODO(crbug.com/818301): Get rid of this once all former chromium.webkit +# builders are prod on LUCI and chromium.webkit Buildbot master is shutdown. +builder_mixins { + name: "webkit-ci-migration" + recipe { + # This tells Buildbucket to look at migration status of corresponding + # chromium.webkit builder on luci-migration app, regardless of 'mastername' + # property. Useful when moving builder to LUCI and changing their masters + # at the same time. + properties: "luci_migration_master_name:chromium.webkit" + } +} + builder_mixins { name: "win" dimensions: "os:Windows" @@ -2039,7 +2052,8 @@ builders { name: "WebKit Mac10.13 (retina)" dimensions: "os:Mac-10.13" - mixins: "webkit-ci" + mixins: "mac-ci" + mixins: "webkit-ci-migration" } builders { name: "Afl Upload Linux ASan" @@ -2342,6 +2356,7 @@ } builders { name: "WebKit Mac Builder" + # This may be obsolete (WebKit Mac testers are triggered by Mac Builder). dimensions: "os:Mac-10.12.2" mixins: "webkit-ci" } @@ -2395,7 +2410,7 @@ builders { name: "WebKit Win10" dimensions: "os:Windows-10" - mixins: "win-ci" + mixins: "webkit-ci" } builders { name: "win32-dbg"
diff --git a/infra/config/global/luci-milo-dev.cfg b/infra/config/global/luci-milo-dev.cfg index 62f31f6..3e8c9f3d 100644 --- a/infra/config/global/luci-milo-dev.cfg +++ b/infra/config/global/luci-milo-dev.cfg
@@ -180,4 +180,7 @@ builders { name: "buildbucket/luci.chromium.cron/Snapshot Builder" } + builders { + name: "buildbucket/luci.chromium.cron/Snapshots" + } }
diff --git a/infra/config/global/luci-milo.cfg b/infra/config/global/luci-milo.cfg index 7c16872..8490282 100644 --- a/infra/config/global/luci-milo.cfg +++ b/infra/config/global/luci-milo.cfg
@@ -712,6 +712,7 @@ } builders { name: "buildbot/chromium.webkit/WebKit Mac10.13 (retina)" + name: "buildbucket/luci.chromium.ci/WebKit Mac10.13 (retina)" category: "chromium.webkit|mac|release" short_name: "13r" }
diff --git a/infra/config/global/luci-scheduler.cfg b/infra/config/global/luci-scheduler.cfg index 12c82ad..52c881f 100644 --- a/infra/config/global/luci-scheduler.cfg +++ b/infra/config/global/luci-scheduler.cfg
@@ -3666,6 +3666,7 @@ } job { + # This may be obsolete (WebKit Mac testers are triggered by Mac Builder). id: "WebKit Mac Builder" acl_sets: "default" buildbucket: { @@ -3677,7 +3678,7 @@ job { id: "WebKit Mac10.13 (retina)" - # Triggered by "WebKit Mac Builder" + # Triggered by "Mac Builder" acl_sets: "triggered-by-parent-builders" buildbucket: { server: "cr-buildbucket.appspot.com"
diff --git a/ios/chrome/browser/metrics/ukm_egtest.mm b/ios/chrome/browser/metrics/ukm_egtest.mm index 152b93d..1ecfa45 100644 --- a/ios/chrome/browser/metrics/ukm_egtest.mm +++ b/ios/chrome/browser/metrics/ukm_egtest.mm
@@ -6,6 +6,7 @@ #import <XCTest/XCTest.h> #include "base/macros.h" +#include "base/stl_util.h" #import "base/test/ios/wait_util.h" #include "components/metrics/metrics_service.h" #include "components/metrics_services_manager/metrics_services_manager.h" @@ -69,7 +70,7 @@ static bool HasDummySource(ukm::SourceId source_id) { auto* service = ukm_service(); - return service ? !!service->sources().count(source_id) : false; + return service && base::ContainsKey(service->sources(), source_id); } static void RecordDummySource(ukm::SourceId source_id) {
diff --git a/ios/chrome/browser/ui/open_in_controller.mm b/ios/chrome/browser/ui/open_in_controller.mm index 6ecc569..56a3999 100644 --- a/ios/chrome/browser/ui/open_in_controller.mm +++ b/ios/chrome/browser/ui/open_in_controller.mm
@@ -8,10 +8,10 @@ #include "base/files/file_path.h" #include "base/location.h" #include "base/logging.h" -#include "base/task/post_task.h" - +#include "base/mac/scoped_cftyperef.h" #include "base/sequenced_task_runner.h" #include "base/strings/sys_string_conversions.h" +#include "base/task/post_task.h" #include "base/threading/scoped_blocking_call.h" #include "components/strings/grit/components_strings.h" #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" @@ -62,6 +62,15 @@ // Bottom margin for the label displayed on the |overlayedView_|. const CGFloat kOverlayedViewLabelBottomMargin = 60; +// Returns true if the file located at |url| is a valid PDF file. +bool HasValidPdfAtUrl(NSURL* _Nullable url) { + if (!url) + return false; + base::ScopedCFTypeRef<CGPDFDocumentRef> document( + CGPDFDocumentCreateWithURL((__bridge CFURLRef)url)); + return document; +} + } // anonymous namespace @interface OpenInController ()<CRWWebViewScrollViewProxyObserver> { @@ -522,7 +531,9 @@ #pragma mark - #pragma mark File management -- (void)removeDocumentAtPath:(NSString*)path { +- (void)removeDocumentAtPath:(nullable NSString*)path { + if (!path) + return; base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::WILL_BLOCK); NSFileManager* fileManager = [NSFileManager defaultManager]; NSError* error = nil; @@ -584,18 +595,17 @@ } - (void)urlLoadDidComplete:(const base::FilePath&)filePath { - if (!filePath.empty()) { - NSURL* fileURL = - [NSURL fileURLWithPath:base::SysUTF8ToNSString(filePath.value())]; - if (downloadCanceled_) { - sequencedTaskRunner_->PostTask(FROM_HERE, base::BindOnce(^{ - [self - removeDocumentAtPath:[fileURL path]]; - })); - } else { - [self presentOpenInMenuForFileAtURL:fileURL]; - } - } else if (!downloadCanceled_) { + NSURL* fileURL = nil; + if (!filePath.empty()) + fileURL = [NSURL fileURLWithPath:base::SysUTF8ToNSString(filePath.value())]; + if (!downloadCanceled_ && HasValidPdfAtUrl(fileURL)) { + [self presentOpenInMenuForFileAtURL:fileURL]; + return; + } + sequencedTaskRunner_->PostTask(FROM_HERE, base::BindOnce(^{ + [self removeDocumentAtPath:fileURL.path]; + })); + if (!downloadCanceled_) { if (IsIPadIdiom()) [self hideOpenInToolbar]; [self removeOverlayedView];
diff --git a/ios/chrome/browser/ui/open_in_controller_unittest.mm b/ios/chrome/browser/ui/open_in_controller_unittest.mm index 493acb7..55d78ea 100644 --- a/ios/chrome/browser/ui/open_in_controller_unittest.mm +++ b/ios/chrome/browser/ui/open_in_controller_unittest.mm
@@ -61,6 +61,17 @@ suggestedFilename:@"doc.pdf"]; } + // Returns the string of a two blank pages created PDF document. + std::string CreatePdfString() { + NSMutableData* pdf_data = [NSMutableData data]; + UIGraphicsBeginPDFContextToData(pdf_data, CGRectZero, nil); + UIGraphicsBeginPDFPage(); + UIGraphicsBeginPDFPage(); + UIGraphicsEndPDFContext(); + return std::string(reinterpret_cast<char const*>([pdf_data bytes]), + pdf_data.length); + } + base::test::ScopedTaskEnvironment scoped_task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> @@ -72,30 +83,44 @@ }; TEST_F(OpenInControllerTest, TestDisplayOpenInMenu) { - id documentController = + id document_controller = [OCMockObject niceMockForClass:[UIDocumentInteractionController class]]; - [open_in_controller_ setDocumentInteractionController:documentController]; + [open_in_controller_ setDocumentInteractionController:document_controller]; [open_in_controller_ startDownload]; - [[[documentController expect] andReturnValue:[NSNumber numberWithBool:YES]] - presentOpenInMenuFromRect:CGRectMake(0, 0, 0, 0) + [[[document_controller expect] andReturnValue:@YES] + presentOpenInMenuFromRect:CGRectZero inView:OCMOCK_ANY animated:YES]; auto* pending_request = test_url_loader_factory_.GetPendingRequest(0); - DCHECK(pending_request); + ASSERT_TRUE(pending_request); // Set the response for the set URLFetcher to be a blank PDF. - NSMutableData* pdfData = [NSMutableData data]; - UIGraphicsBeginPDFContextToData(pdfData, CGRectMake(0, 0, 100, 100), @{}); - UIGraphicsBeginPDFPage(); - UIGraphicsEndPDFContext(); - unsigned char* array = (unsigned char*)[pdfData bytes]; - + std::string pdf_str = CreatePdfString(); test_url_loader_factory_.SimulateResponseForPendingRequest( - pending_request->request.url.spec(), - std::string((char*)array, sizeof(pdfData))); + pending_request->request.url.spec(), pdf_str); scoped_task_environment_.RunUntilIdle(); - EXPECT_OCMOCK_VERIFY(documentController); + EXPECT_OCMOCK_VERIFY(document_controller); +} + +TEST_F(OpenInControllerTest, TestCorruptedPDFDownload) { + id document_controller = + [OCMockObject niceMockForClass:[UIDocumentInteractionController class]]; + [open_in_controller_ setDocumentInteractionController:document_controller]; + [open_in_controller_ startDownload]; + [[[document_controller reject] andReturnValue:@YES] + presentOpenInMenuFromRect:CGRectZero + inView:OCMOCK_ANY + animated:YES]; + auto* pending_request = test_url_loader_factory_.GetPendingRequest(0); + ASSERT_TRUE(pending_request); + std::string pdf_str = CreatePdfString(); + // Only use half the string so the downloaded PDF is corrupted. + test_url_loader_factory_.SimulateResponseForPendingRequest( + pending_request->request.url.spec(), pdf_str.substr(pdf_str.size() / 2)); + scoped_task_environment_.RunUntilIdle(); + + EXPECT_OCMOCK_VERIFY(document_controller); } } // namespace
diff --git a/ios/third_party/material_components_ios/README.chromium b/ios/third_party/material_components_ios/README.chromium index f906bf75..99259908 100644 --- a/ios/third_party/material_components_ios/README.chromium +++ b/ios/third_party/material_components_ios/README.chromium
@@ -1,7 +1,7 @@ Name: Material Components for iOS URL: https://github.com/material-components/material-components-ios Version: 0 -Revision: 50455404c6a72aa0540406325e787f0e2cf9b8d0 +Revision: 2ccd8f24cd0218f6ef55f10f3d18d9b1fb74d31b License: Apache 2.0 License File: LICENSE Security Critical: yes
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc index dc40e1b..fc92b3b 100644 --- a/net/disk_cache/entry_unittest.cc +++ b/net/disk_cache/entry_unittest.cc
@@ -2692,6 +2692,43 @@ } } +TEST_F(DiskCacheEntryTest, SimpleCacheGiantEntry) { + const int kBufSize = 32 * 1024; + scoped_refptr<net::IOBuffer> buffer = + base::MakeRefCounted<net::IOBuffer>(kBufSize); + CacheTestFillBuffer(buffer->data(), kBufSize, false); + + // Make sure SimpleCache can write up to 5MiB entry even with a 20MiB cache + // size that Android WebView uses at the time of this test's writing. + SetSimpleCacheMode(); + SetMaxSize(20 * 1024 * 1024); + InitCache(); + + { + std::string key1("the first key"); + disk_cache::Entry* entry1 = nullptr; + ASSERT_THAT(CreateEntry(key1, &entry1), IsOk()); + + const int kSize1 = 5 * 1024 * 1024; + EXPECT_EQ(kBufSize, WriteData(entry1, 1 /* stream */, kSize1 - kBufSize, + buffer.get(), kBufSize, true /* truncate */)); + entry1->Close(); + } + + // ... but not bigger than that. + { + std::string key2("the second key"); + disk_cache::Entry* entry2 = nullptr; + ASSERT_THAT(CreateEntry(key2, &entry2), IsOk()); + + const int kSize2 = 5 * 1024 * 1024 + 1; + EXPECT_EQ(net::ERR_FAILED, + WriteData(entry2, 1 /* stream */, kSize2 - kBufSize, buffer.get(), + kBufSize, true /* truncate */)); + entry2->Close(); + } +} + TEST_F(DiskCacheEntryTest, SimpleCacheSizeChanges) { SetSimpleCacheMode(); InitCache();
diff --git a/net/disk_cache/simple/simple_backend_impl.cc b/net/disk_cache/simple/simple_backend_impl.cc index 2321fa3..3dd6282a 100644 --- a/net/disk_cache/simple/simple_backend_impl.cc +++ b/net/disk_cache/simple/simple_backend_impl.cc
@@ -61,6 +61,9 @@ // Maximum fraction of the cache that one entry can consume. const int kMaxFileRatio = 8; +// Overrides the above. +const int kMinFileSizeLimit = 5 * 1024 * 1024; + bool g_fd_limit_histogram_has_been_populated = false; void MaybeHistogramFdLimit() { @@ -299,7 +302,8 @@ } int SimpleBackendImpl::GetMaxFileSize() const { - return base::saturated_cast<int>(index_->max_size() / kMaxFileRatio); + return std::max(base::saturated_cast<int>(index_->max_size() / kMaxFileRatio), + kMinFileSizeLimit); } void SimpleBackendImpl::OnDoomStart(uint64_t entry_hash) {
diff --git a/net/proxy_resolution/proxy_resolution_service.cc b/net/proxy_resolution/proxy_resolution_service.cc index 9d58929..c08dea30 100644 --- a/net/proxy_resolution/proxy_resolution_service.cc +++ b/net/proxy_resolution/proxy_resolution_service.cc
@@ -1115,20 +1115,9 @@ CompletionOnceCallback callback, std::unique_ptr<Request>* out_request, const NetLogWithSource& net_log) { - DCHECK(!callback.is_null()); - return ResolveProxyHelper(raw_url, method, result, std::move(callback), - out_request, net_log); -} - -int ProxyResolutionService::ResolveProxyHelper( - const GURL& raw_url, - const std::string& method, - ProxyInfo* result, - CompletionOnceCallback callback, - std::unique_ptr<Request>* out_request, - const NetLogWithSource& net_log) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - DCHECK(out_request || callback.is_null()); + DCHECK(!callback.is_null()); + DCHECK(out_request); net_log.BeginEvent(NetLogEventType::PROXY_RESOLUTION_SERVICE); @@ -1155,9 +1144,6 @@ return rv; } - if (callback.is_null()) - return ERR_IO_PENDING; - std::unique_ptr<RequestImpl> req = std::make_unique<RequestImpl>( this, url, method, result, std::move(callback), net_log); @@ -1181,15 +1167,6 @@ return rv; // ERR_IO_PENDING } -bool ProxyResolutionService::TryResolveProxySynchronously( - const GURL& raw_url, - const std::string& method, - ProxyInfo* result, - const NetLogWithSource& net_log) { - return ResolveProxyHelper(raw_url, method, result, CompletionOnceCallback(), - nullptr /* out_request*/, net_log) == OK; -} - int ProxyResolutionService::TryToCompleteSynchronously( const GURL& url, ProxyInfo* result) {
diff --git a/net/proxy_resolution/proxy_resolution_service.h b/net/proxy_resolution/proxy_resolution_service.h index df1d7ab3..04a0d10 100644 --- a/net/proxy_resolution/proxy_resolution_service.h +++ b/net/proxy_resolution/proxy_resolution_service.h
@@ -164,13 +164,6 @@ std::unique_ptr<Request>* request, const NetLogWithSource& net_log); - // Returns true if the proxy information could be determined without spawning - // an asynchronous task. Otherwise, |result| is unmodified. - bool TryResolveProxySynchronously(const GURL& raw_url, - const std::string& method, - ProxyInfo* result, - const NetLogWithSource& net_log); - // Explicitly trigger proxy fallback for the given |results| by updating our // list of bad proxies to include the first entry of |results|, and, // additional bad proxies (can be none). Will retry after |retry_delay| if @@ -352,16 +345,6 @@ // Completing synchronously means we don't need to query ProxyResolver. int TryToCompleteSynchronously(const GURL& url, ProxyInfo* result); - // Identical to ResolveProxy, except that |callback| is permitted to be null. - // if |callback.is_null()|, this function becomes a thin wrapper around - // |TryToCompleteSynchronously|. - int ResolveProxyHelper(const GURL& url, - const std::string& method, - ProxyInfo* results, - CompletionOnceCallback callback, - std::unique_ptr<Request>* request, - const NetLogWithSource& net_log); - // Cancels all of the requests sent to the ProxyResolver. These will be // restarted when calling SetReady(). void SuspendAllPendingRequests();
diff --git a/net/proxy_resolution/proxy_resolution_service_unittest.cc b/net/proxy_resolution/proxy_resolution_service_unittest.cc index ead9ad5..c3aea3a 100644 --- a/net/proxy_resolution/proxy_resolution_service_unittest.cc +++ b/net/proxy_resolution/proxy_resolution_service_unittest.cc
@@ -3672,60 +3672,6 @@ EXPECT_TRUE(info3.is_direct()); } -// Test that the synchronous resolution fails when a PAC script is active. -TEST_F(ProxyResolutionServiceTest, SynchronousWithPAC) { - MockProxyConfigService* config_service = - new MockProxyConfigService("http://foopy/proxy.pac"); - - MockAsyncProxyResolverFactory* factory = - new MockAsyncProxyResolverFactory(false); - - ProxyResolutionService service(base::WrapUnique(config_service), - base::WrapUnique(factory), nullptr); - - GURL url("http://www.google.com/"); - - ProxyInfo info; - info.UseDirect(); - BoundTestNetLog log; - - bool synchronous_success = service.TryResolveProxySynchronously( - url, std::string(), &info, log.bound()); - EXPECT_FALSE(synchronous_success); - - // |info| should not have been modified. - EXPECT_TRUE(info.is_direct()); -} - -// Test that synchronous results are returned correctly if a fixed proxy -// configuration is active. -TEST_F(ProxyResolutionServiceTest, SynchronousWithFixedConfiguration) { - ProxyConfig config; - config.proxy_rules().ParseFromString("foopy1:8080"); - config.set_auto_detect(false); - - MockAsyncProxyResolverFactory* factory = - new MockAsyncProxyResolverFactory(false); - - ProxyResolutionService service( - std::make_unique<MockProxyConfigService>(config), - base::WrapUnique(factory), nullptr); - - GURL url("http://www.google.com/"); - - ProxyInfo info; - BoundTestNetLog log; - - bool synchronous_success = service.TryResolveProxySynchronously( - url, std::string(), &info, log.bound()); - EXPECT_TRUE(synchronous_success); - EXPECT_FALSE(info.is_direct()); - EXPECT_EQ("foopy1", info.proxy_server().host_port_pair().host()); - - // No request should have been queued. - EXPECT_EQ(0u, factory->pending_requests().size()); -} - // Helper class to exercise URL sanitization using the different policies. This // works by submitted URLs to the ProxyResolutionService. In turn the // ProxyResolutionService sanitizes the URL and then passes it along to the
diff --git a/services/media_session/audio_focus_manager.cc b/services/media_session/audio_focus_manager.cc index 7b88c55..5092168 100644 --- a/services/media_session/audio_focus_manager.cc +++ b/services/media_session/audio_focus_manager.cc
@@ -8,6 +8,7 @@ #include <utility> #include "base/atomic_sequence_num.h" +#include "base/containers/adapters.h" #include "base/threading/thread_task_runner_handle.h" #include "mojo/public/cpp/bindings/interface_request.h" #include "services/media_session/public/cpp/switches.h" @@ -189,7 +190,7 @@ } if (IsAudioFocusEnforcementEnabled()) - EnforceAudioFocusAbandon(); + EnforceAudioFocusAbandon(row->audio_focus_type()); // Notify observers that we lost audio focus. observers_.ForAllPtrs([&row](mojom::AudioFocusObserver* observer) { @@ -251,24 +252,27 @@ void AudioFocusManager::EnforceAudioFocusRequest(mojom::AudioFocusType type) { DCHECK(IsAudioFocusEnforcementEnabled()); - if (type == mojom::AudioFocusType::kGainTransientMayDuck) { - for (auto& old_session : audio_focus_stack_) + for (auto& old_session : audio_focus_stack_) { + // If the session has the force duck flag set then we should always duck it. + if (old_session->info()->force_duck) { old_session->session()->StartDucking(); - } else { - for (auto& old_session : audio_focus_stack_) { - // If the session has the force duck bit set then we should duck the - // session instead of suspending it. - if (old_session->info()->force_duck) { - old_session->session()->StartDucking(); - } else { + continue; + } + + switch (type) { + case mojom::AudioFocusType::kGain: + case mojom::AudioFocusType::kGainTransient: old_session->session()->Suspend( mojom::MediaSession::SuspendType::kSystem); - } + break; + case mojom::AudioFocusType::kGainTransientMayDuck: + old_session->session()->StartDucking(); + break; } } } -void AudioFocusManager::EnforceAudioFocusAbandon() { +void AudioFocusManager::EnforceAudioFocusAbandon(mojom::AudioFocusType type) { DCHECK(IsAudioFocusEnforcementEnabled()); // Allow the top-most MediaSession having force duck to unduck even if @@ -278,6 +282,7 @@ if (!(*iter)->info()->force_duck) continue; + // TODO(beccahughes): Replace with std::rotate. auto duck_row = std::move(*iter); duck_row->session()->StopDucking(); audio_focus_stack_.erase(std::next(iter).base()); @@ -285,10 +290,33 @@ return; } - // Only try to unduck the new MediaSession on top. The session might be - // still inactive but it will not be resumed (so it doesn't surprise the - // user). - audio_focus_stack_.back()->session()->StopDucking(); + DCHECK(!audio_focus_stack_.empty()); + StackRow* top = audio_focus_stack_.back().get(); + + switch (type) { + case mojom::AudioFocusType::kGain: + // Do nothing. The abandoned session suspended all the media sessions and + // they should stay suspended to avoid surprising the user. + break; + case mojom::AudioFocusType::kGainTransient: + // The abandoned session suspended all the media sessions but we should + // start playing the top one again as the abandoned media was transient. + top->session()->Resume(mojom::MediaSession::SuspendType::kSystem); + break; + case mojom::AudioFocusType::kGainTransientMayDuck: + // The abandoned session ducked all the media sessions so we should unduck + // them. If they are not playing then they will not resume. + for (auto& session : base::Reversed(audio_focus_stack_)) { + session->session()->StopDucking(); + + // If the new session is ducking then we should continue ducking all but + // the new session. + if (top->audio_focus_type() == + mojom::AudioFocusType::kGainTransientMayDuck) + break; + } + break; + } } void AudioFocusManager::ResetForTesting() {
diff --git a/services/media_session/audio_focus_manager.h b/services/media_session/audio_focus_manager.h index 1bb5aa7..20c597df 100644 --- a/services/media_session/audio_focus_manager.h +++ b/services/media_session/audio_focus_manager.h
@@ -63,7 +63,7 @@ void EnforceAudioFocusRequest(mojom::AudioFocusType); void AbandonAudioFocusInternal(RequestId); - void EnforceAudioFocusAbandon(); + void EnforceAudioFocusAbandon(mojom::AudioFocusType); // Flush for testing will flush any pending messages to the observers. void FlushForTesting();
diff --git a/services/media_session/audio_focus_manager_unittest.cc b/services/media_session/audio_focus_manager_unittest.cc index b03d80d..e509c534 100644 --- a/services/media_session/audio_focus_manager_unittest.cc +++ b/services/media_session/audio_focus_manager_unittest.cc
@@ -46,6 +46,11 @@ SetState(mojom::MediaSessionInfo::SessionState::kSuspended); } + void Resume(SuspendType suspend_type) override { + DCHECK_EQ(SuspendType::kSystem, suspend_type); + SetState(mojom::MediaSessionInfo::SessionState::kActive); + } + void StartDucking() override { is_ducking_ = true; NotifyObservers(); @@ -176,20 +181,12 @@ return kNoFocusedSession; } + int GetTransientCount() { + return GetCountForType(mojom::AudioFocusType::kGainTransient); + } + int GetTransientMaybeDuckCount() { - const auto audio_focus_requests = GetRequests(); - int count = 0; - - for (auto iter = audio_focus_requests.rbegin(); - iter != audio_focus_requests.rend(); ++iter) { - if ((*iter)->audio_focus_type == - mojom::AudioFocusType::kGainTransientMayDuck) - ++count; - else - break; - } - - return count; + return GetCountForType(mojom::AudioFocusType::kGainTransientMayDuck); } void AbandonAudioFocus(MockMediaSession* session) { @@ -300,6 +297,15 @@ } private: + int GetCountForType(mojom::AudioFocusType type) { + const auto audio_focus_requests = GetRequests(); + return std::count_if(audio_focus_requests.begin(), + audio_focus_requests.end(), + [type](const auto& session) { + return session->audio_focus_type == type; + }); + } + std::vector<mojom::AudioFocusRequestStatePtr> GetRequests() { std::vector<mojom::AudioFocusRequestStatePtr> result; @@ -418,6 +424,19 @@ TEST_P(AudioFocusManagerTest, RequestAudioFocusGain_FromTransient) { MockMediaSession media_session; + AudioFocusManager::RequestId request_id = + RequestAudioFocus(&media_session, mojom::AudioFocusType::kGainTransient); + EXPECT_EQ(kNoFocusedSession, GetAudioFocusedSession()); + EXPECT_EQ(1, GetTransientCount()); + + RequestAudioFocus(&media_session, mojom::AudioFocusType::kGain); + EXPECT_EQ(request_id, GetAudioFocusedSession()); + EXPECT_EQ(0, GetTransientCount()); +} + +TEST_P(AudioFocusManagerTest, RequestAudioFocusGain_FromTransientMayDuck) { + MockMediaSession media_session; + AudioFocusManager::RequestId request_id = RequestAudioFocus( &media_session, mojom::AudioFocusType::kGainTransientMayDuck); EXPECT_EQ(kNoFocusedSession, GetAudioFocusedSession()); @@ -435,6 +454,22 @@ RequestAudioFocus(&media_session, mojom::AudioFocusType::kGain); EXPECT_EQ(request_id, GetAudioFocusedSession()); + EXPECT_EQ(0, GetTransientCount()); + + RequestAudioFocus(&media_session, mojom::AudioFocusType::kGainTransient); + EXPECT_EQ(kNoFocusedSession, GetAudioFocusedSession()); + EXPECT_EQ(1, GetTransientCount()); + EXPECT_NE(mojom::MediaSessionInfo::SessionState::kSuspended, + GetState(&media_session)); +} + +TEST_P(AudioFocusManagerTest, RequestAudioFocusTransientMayDuck_FromGain) { + MockMediaSession media_session; + + AudioFocusManager::RequestId request_id = + RequestAudioFocus(&media_session, mojom::AudioFocusType::kGain); + + EXPECT_EQ(request_id, GetAudioFocusedSession()); EXPECT_EQ(0, GetTransientMaybeDuckCount()); RequestAudioFocus(&media_session, @@ -456,6 +491,30 @@ RequestAudioFocus(&media_session_2, mojom::AudioFocusType::kGainTransientMayDuck); + EXPECT_EQ(0, GetTransientCount()); + EXPECT_EQ(1, GetTransientMaybeDuckCount()); + EXPECT_EQ(GetStateFromParam(mojom::MediaSessionInfo::SessionState::kDucking), + GetState(&media_session_1)); + + RequestAudioFocus(&media_session_1, mojom::AudioFocusType::kGainTransient); + EXPECT_EQ(1, GetTransientCount()); + EXPECT_EQ(1, GetTransientMaybeDuckCount()); + EXPECT_EQ(mojom::MediaSessionInfo::SessionState::kActive, + GetState(&media_session_1)); +} + +TEST_P(AudioFocusManagerTest, + RequestAudioFocusTransientMayDuck_FromGainWhileDucking) { + MockMediaSession media_session_1; + MockMediaSession media_session_2; + + RequestAudioFocus(&media_session_1, mojom::AudioFocusType::kGain); + EXPECT_EQ(0, GetTransientMaybeDuckCount()); + EXPECT_EQ(mojom::MediaSessionInfo::SessionState::kActive, + GetState(&media_session_1)); + + RequestAudioFocus(&media_session_2, + mojom::AudioFocusType::kGainTransientMayDuck); EXPECT_EQ(1, GetTransientMaybeDuckCount()); EXPECT_EQ(GetStateFromParam(mojom::MediaSessionInfo::SessionState::kDucking), GetState(&media_session_1)); @@ -494,7 +553,7 @@ EXPECT_TRUE(observer->focus_lost_session_.is_null()); } -TEST_P(AudioFocusManagerTest, AbandonAudioFocus_RemovesTransientEntry) { +TEST_P(AudioFocusManagerTest, AbandonAudioFocus_RemovesTransientMayDuckEntry) { MockMediaSession media_session; RequestAudioFocus(&media_session, @@ -511,6 +570,22 @@ } } +TEST_P(AudioFocusManagerTest, AbandonAudioFocus_RemovesTransientEntry) { + MockMediaSession media_session; + + RequestAudioFocus(&media_session, mojom::AudioFocusType::kGainTransient); + EXPECT_EQ(1, GetTransientCount()); + + { + std::unique_ptr<test::TestAudioFocusObserver> observer = CreateObserver(); + AbandonAudioFocus(&media_session); + + EXPECT_EQ(0, GetTransientCount()); + EXPECT_TRUE(observer->focus_lost_session_.Equals( + test::GetMediaSessionInfoSync(&media_session))); + } +} + TEST_P(AudioFocusManagerTest, AbandonAudioFocus_WhileDuckingThenResume) { MockMediaSession media_session_1; MockMediaSession media_session_2; @@ -558,6 +633,27 @@ GetState(&media_session_1)); } +TEST_P(AudioFocusManagerTest, AbandonAudioFocus_ResumesPlayback) { + MockMediaSession media_session_1; + MockMediaSession media_session_2; + + RequestAudioFocus(&media_session_1, mojom::AudioFocusType::kGain); + EXPECT_EQ(0, GetTransientCount()); + EXPECT_EQ(mojom::MediaSessionInfo::SessionState::kActive, + GetState(&media_session_1)); + + RequestAudioFocus(&media_session_2, mojom::AudioFocusType::kGainTransient); + EXPECT_EQ(1, GetTransientCount()); + EXPECT_EQ( + GetStateFromParam(mojom::MediaSessionInfo::SessionState::kSuspended), + GetState(&media_session_1)); + + AbandonAudioFocus(&media_session_2); + EXPECT_EQ(0, GetTransientCount()); + EXPECT_EQ(mojom::MediaSessionInfo::SessionState::kActive, + GetState(&media_session_1)); +} + TEST_P(AudioFocusManagerTest, DuckWhilePlaying) { MockMediaSession media_session_1; MockMediaSession media_session_2; @@ -576,6 +672,18 @@ MockMediaSession media_session_1; MockMediaSession media_session_2; + RequestAudioFocus(&media_session_2, mojom::AudioFocusType::kGainTransient); + + RequestAudioFocus(&media_session_1, mojom::AudioFocusType::kGain); + EXPECT_EQ( + GetStateFromParam(mojom::MediaSessionInfo::SessionState::kSuspended), + GetState(&media_session_2)); +} + +TEST_P(AudioFocusManagerTest, GainSuspendsTransientMayDuck) { + MockMediaSession media_session_1; + MockMediaSession media_session_2; + RequestAudioFocus(&media_session_2, mojom::AudioFocusType::kGainTransientMayDuck); @@ -585,32 +693,45 @@ GetState(&media_session_2)); } -TEST_P(AudioFocusManagerTest, DuckWithMultipleTransients) { +TEST_P(AudioFocusManagerTest, DuckWithMultipleTransientMayDucks) { MockMediaSession media_session_1; MockMediaSession media_session_2; MockMediaSession media_session_3; + MockMediaSession media_session_4; RequestAudioFocus(&media_session_1, mojom::AudioFocusType::kGain); EXPECT_NE(mojom::MediaSessionInfo::SessionState::kDucking, GetState(&media_session_1)); - RequestAudioFocus(&media_session_2, - mojom::AudioFocusType::kGainTransientMayDuck); - EXPECT_EQ(GetStateFromParam(mojom::MediaSessionInfo::SessionState::kDucking), - GetState(&media_session_1)); + RequestAudioFocus(&media_session_2, mojom::AudioFocusType::kGainTransient); + EXPECT_NE(mojom::MediaSessionInfo::SessionState::kDucking, + GetState(&media_session_2)); RequestAudioFocus(&media_session_3, mojom::AudioFocusType::kGainTransientMayDuck); EXPECT_EQ(GetStateFromParam(mojom::MediaSessionInfo::SessionState::kDucking), GetState(&media_session_1)); + EXPECT_EQ(GetStateFromParam(mojom::MediaSessionInfo::SessionState::kDucking), + GetState(&media_session_2)); - AbandonAudioFocus(&media_session_2); + RequestAudioFocus(&media_session_4, + mojom::AudioFocusType::kGainTransientMayDuck); EXPECT_EQ(GetStateFromParam(mojom::MediaSessionInfo::SessionState::kDucking), GetState(&media_session_1)); + EXPECT_EQ(GetStateFromParam(mojom::MediaSessionInfo::SessionState::kDucking), + GetState(&media_session_2)); AbandonAudioFocus(&media_session_3); + EXPECT_EQ(GetStateFromParam(mojom::MediaSessionInfo::SessionState::kDucking), + GetState(&media_session_1)); + EXPECT_EQ(GetStateFromParam(mojom::MediaSessionInfo::SessionState::kDucking), + GetState(&media_session_2)); + + AbandonAudioFocus(&media_session_4); EXPECT_NE(mojom::MediaSessionInfo::SessionState::kDucking, GetState(&media_session_1)); + EXPECT_NE(mojom::MediaSessionInfo::SessionState::kDucking, + GetState(&media_session_2)); } TEST_P(AudioFocusManagerTest, MediaSessionDestroyed_ReleasesFocus) { @@ -630,7 +751,21 @@ EXPECT_EQ(kNoFocusedSession, GetAudioFocusedSession()); } -TEST_P(AudioFocusManagerTest, MediaSessionDestroyed_ReleasesTransients) { +TEST_P(AudioFocusManagerTest, MediaSessionDestroyed_ReleasesTransient) { + { + MockMediaSession media_session; + RequestAudioFocus(&media_session, mojom::AudioFocusType::kGainTransient); + EXPECT_EQ(1, GetTransientCount()); + } + + // If the media session is destroyed without abandoning audio focus we do not + // know until we next interact with the manager. + MockMediaSession media_session; + RequestAudioFocus(&media_session, mojom::AudioFocusType::kGain); + EXPECT_EQ(0, GetTransientCount()); +} + +TEST_P(AudioFocusManagerTest, MediaSessionDestroyed_ReleasesTransientMayDucks) { { MockMediaSession media_session; RequestAudioFocus(&media_session, @@ -747,4 +882,52 @@ EXPECT_TRUE(debug_info->name.empty()); } +TEST_P(AudioFocusManagerTest, + RequestAudioFocusTransient_FromGainWhileSuspended) { + MockMediaSession media_session_1; + MockMediaSession media_session_2; + + RequestAudioFocus(&media_session_1, mojom::AudioFocusType::kGain); + EXPECT_EQ(0, GetTransientCount()); + EXPECT_EQ(mojom::MediaSessionInfo::SessionState::kActive, + GetState(&media_session_1)); + + RequestAudioFocus(&media_session_2, mojom::AudioFocusType::kGainTransient); + EXPECT_EQ(1, GetTransientCount()); + EXPECT_EQ( + GetStateFromParam(mojom::MediaSessionInfo::SessionState::kSuspended), + GetState(&media_session_1)); + + RequestAudioFocus(&media_session_1, mojom::AudioFocusType::kGainTransient); + EXPECT_EQ(2, GetTransientCount()); + EXPECT_EQ(mojom::MediaSessionInfo::SessionState::kActive, + GetState(&media_session_1)); +} + +TEST_P(AudioFocusManagerTest, + RequestAudioFocusTransientMayDuck_FromGainWhileSuspended) { + MockMediaSession media_session_1; + MockMediaSession media_session_2; + + RequestAudioFocus(&media_session_1, mojom::AudioFocusType::kGain); + EXPECT_EQ(0, GetTransientCount()); + EXPECT_EQ(0, GetTransientMaybeDuckCount()); + EXPECT_EQ(mojom::MediaSessionInfo::SessionState::kActive, + GetState(&media_session_1)); + + RequestAudioFocus(&media_session_2, mojom::AudioFocusType::kGainTransient); + EXPECT_EQ(1, GetTransientCount()); + EXPECT_EQ(0, GetTransientMaybeDuckCount()); + EXPECT_EQ( + GetStateFromParam(mojom::MediaSessionInfo::SessionState::kSuspended), + GetState(&media_session_1)); + + RequestAudioFocus(&media_session_1, + mojom::AudioFocusType::kGainTransientMayDuck); + EXPECT_EQ(1, GetTransientCount()); + EXPECT_EQ(1, GetTransientMaybeDuckCount()); + EXPECT_EQ(mojom::MediaSessionInfo::SessionState::kActive, + GetState(&media_session_1)); +} + } // namespace media_session
diff --git a/services/media_session/public/mojom/audio_focus.mojom b/services/media_session/public/mojom/audio_focus.mojom index 29b5eaa..ba13fda 100644 --- a/services/media_session/public/mojom/audio_focus.mojom +++ b/services/media_session/public/mojom/audio_focus.mojom
@@ -13,9 +13,14 @@ // previous holder of audio focus to stop playing. kGain, + // Request transient focus with ducking to indicate that you expect to play + // audio for only a short time and that it's OK for the previous focus owner + // to keep playing if it "ducks" (lowers) its audio output. + kGainTransientMayDuck, + // Request transient focus when you expect to play audio for only a short // time and you expect the previous holder to pause playing. - kGainTransientMayDuck, + kGainTransient, }; // Contains information about |MediaSessions| that have requested audio focus
diff --git a/services/media_session/public/mojom/media_session.mojom b/services/media_session/public/mojom/media_session.mojom index 9a156c8..542bd630 100644 --- a/services/media_session/public/mojom/media_session.mojom +++ b/services/media_session/public/mojom/media_session.mojom
@@ -78,5 +78,9 @@ // |type| represents the origin of the request. Suspend(SuspendType suspend_type); + // Resume the media session. + // |type| represents the origin of the request. + Resume(SuspendType suspend_type); + AddObserver(MediaSessionObserver observer); };
diff --git a/services/viz/privileged/interfaces/compositing/display_private.mojom b/services/viz/privileged/interfaces/compositing/display_private.mojom index 5d61d35..b7c13897 100644 --- a/services/viz/privileged/interfaces/compositing/display_private.mojom +++ b/services/viz/privileged/interfaces/compositing/display_private.mojom
@@ -4,6 +4,7 @@ module viz.mojom; +import "gpu/ipc/common/context_result.mojom"; import "mojo/public/mojom/base/time.mojom"; import "ui/gfx/mojo/ca_layer_params.mojom"; import "ui/gfx/mojo/color_space.mojom"; @@ -69,4 +70,9 @@ // size of the swapped frame. [EnableIf=is_android] DidCompleteSwapWithSize(gfx.mojom.Size size); + + // Notifies that context creation failed. On Android we can't fall back to + // SW in these cases, so we need to handle this specifically. + [EnableIf=is_android] + OnFatalOrSurfaceContextCreationFailure(gpu.mojom.ContextResult result); };
diff --git a/testing/buildbot/filters/mojo.fyi.chromeos.network_browser_tests.filter b/testing/buildbot/filters/mojo.fyi.chromeos.network_browser_tests.filter index 44bab77..fe1a4e2 100644 --- a/testing/buildbot/filters/mojo.fyi.chromeos.network_browser_tests.filter +++ b/testing/buildbot/filters/mojo.fyi.chromeos.network_browser_tests.filter
@@ -7,7 +7,6 @@ # See https://crbug.com/881976 # Uncategorized timeouts or test failures. --PolicyProvidedTrustAnchorsRegularUserTest.AllowedForRegularUser -ForceMaximizeOnFirstRunTest.TwoRuns -ForceMaximizePolicyFalseTest.GeneralFirstRun @@ -145,6 +144,10 @@ # Flaky with error: `picture_in_picture_window_controller_impl.cc(167)] Check failed: media_player_id_.has_value()`. -PictureInPictureWindowControllerBrowserTest.TabIconUpdated +# Relies on net::CertVerifier. +# https://crbug.com/862043 +-PolicyProvidedTrustAnchorsRegularUserTest.AllowedForRegularUser + # NOTE: if adding an exclusion for an existing failure (e.g. additional test for # feature X that is already not working), please add it beside the existing # failures. Otherwise please reach out to network-service-dev@.
diff --git a/testing/buildbot/generate_buildbot_json.py b/testing/buildbot/generate_buildbot_json.py index d2e11b0..ee29281a 100755 --- a/testing/buildbot/generate_buildbot_json.py +++ b/testing/buildbot/generate_buildbot_json.py
@@ -192,7 +192,7 @@ self.waterfalls = None self.test_suites = None self.exceptions = None - self.swarming_mixins = None + self.mixins = None def generate_abs_file_path(self, relative_path): return os.path.join(self.this_dir, relative_path) # pragma: no cover @@ -422,7 +422,7 @@ def update_and_cleanup_test(self, test, test_name, tester_name, tester_config, waterfall): # Apply swarming mixins. - test = self.apply_all_swarming_mixins( + test = self.apply_all_mixins( test, waterfall, tester_name, tester_config) # See if there are any exceptions that need to be merged into this # test's specification. @@ -680,7 +680,7 @@ self.waterfalls = self.load_pyl_file('waterfalls.pyl') self.test_suites = self.load_pyl_file('test_suites.pyl') self.exceptions = self.load_pyl_file('test_suite_exceptions.pyl') - self.swarming_mixins = self.load_pyl_file('swarming_mixins.pyl') + self.mixins = self.load_pyl_file('mixins.pyl') def resolve_configuration_files(self): self.resolve_composition_test_suites() @@ -700,33 +700,33 @@ 'Unknown test suite type ' + suite_type + ' in bot ' + bot_name + ' on waterfall ' + waterfall_name) - def apply_all_swarming_mixins(self, test, waterfall, builder_name, builder): + def apply_all_mixins(self, test, waterfall, builder_name, builder): """Applies all present swarming mixins to the test for a given builder. Checks in the waterfall, builder, and test objects for mixins. """ def valid_mixin(mixin_name): """Asserts that the mixin is valid.""" - if mixin_name not in self.swarming_mixins: + if mixin_name not in self.mixins: raise BBGenErr("bad mixin %s" % mixin_name) def must_be_list(mixins, typ, name): """Asserts that given mixins are a list.""" if not isinstance(mixins, list): raise BBGenErr("'%s' in %s '%s' must be a list" % (mixins, typ, name)) - if 'swarming_mixins' in waterfall: - must_be_list(waterfall['swarming_mixins'], 'waterfall', waterfall['name']) - for mixin in waterfall['swarming_mixins']: + if 'mixins' in waterfall: + must_be_list(waterfall['mixins'], 'waterfall', waterfall['name']) + for mixin in waterfall['mixins']: valid_mixin(mixin) - test = self.apply_swarming_mixin(self.swarming_mixins[mixin], test) + test = self.apply_mixin(self.mixins[mixin], test) - if 'swarming_mixins' in builder: - must_be_list(builder['swarming_mixins'], 'builder', builder_name) - for mixin in builder['swarming_mixins']: + if 'mixins' in builder: + must_be_list(builder['mixins'], 'builder', builder_name) + for mixin in builder['mixins']: valid_mixin(mixin) - test = self.apply_swarming_mixin(self.swarming_mixins[mixin], test) + test = self.apply_mixin(self.mixins[mixin], test) - if not 'swarming_mixins' in test: + if not 'mixins' in test: return test test_name = test.get('name') @@ -735,35 +735,47 @@ if not test_name: # pragma: no cover # Not the best name, but we should say something. test_name = str(test) - must_be_list(test['swarming_mixins'], 'test', test_name) - for mixin in test['swarming_mixins']: + must_be_list(test['mixins'], 'test', test_name) + for mixin in test['mixins']: valid_mixin(mixin) - test = self.apply_swarming_mixin(self.swarming_mixins[mixin], test) - del test['swarming_mixins'] + test = self.apply_mixin(self.mixins[mixin], test) + del test['mixins'] return test - def apply_swarming_mixin(self, mixin, test): - """Applies a swarming mixin to a test. + def apply_mixin(self, mixin, test): + """Applies a mixin to a test. Mixins will not override an existing key. This is to ensure exceptions can override a setting a mixin applies. - Dimensions are handled in a special way. Instead of specifying + Swarming dimensions are handled in a special way. Instead of specifying 'dimension_sets', which is how normal test suites specify their dimensions, you specify a 'dimensions' key, which maps to a dictionary. This dictionary is then applied to every dimension set in the test. + """ + # TODO(martiniss): Maybe make lists extend, possibly on a case by case + # basis. Motivation is 'args', where you want a common base, and then + # different mixins adding different sets of args. new_test = copy.deepcopy(test) mixin = copy.deepcopy(mixin) - new_test.setdefault('swarming', {}) - if 'dimensions' in mixin: - new_test['swarming'].setdefault('dimension_sets', [{}]) - for dimension_set in new_test['swarming']['dimension_sets']: - dimension_set.update(mixin['dimensions']) - del mixin['dimensions'] + if 'swarming' in mixin: + swarming_mixin = mixin['swarming'] + new_test.setdefault('swarming', {}) + if 'dimensions' in swarming_mixin: + new_test['swarming'].setdefault('dimension_sets', [{}]) + for dimension_set in new_test['swarming']['dimension_sets']: + dimension_set.update(swarming_mixin['dimensions']) + del swarming_mixin['dimensions'] - new_test['swarming'].update(mixin) + # python dict update doesn't do recursion at all. Just hard code the + # nested update we need (mixin['swarming'] shouldn't clobber + # test['swarming'], but should update it). + new_test['swarming'].update(swarming_mixin) + del mixin['swarming'] + + new_test.update(mixin) return new_test @@ -944,9 +956,9 @@ # All mixins must be referenced seen_mixins = set() for waterfall in self.waterfalls: - seen_mixins = seen_mixins.union(waterfall.get('swarming_mixins', set())) + seen_mixins = seen_mixins.union(waterfall.get('mixins', set())) for bot_name, tester in waterfall['machines'].iteritems(): - seen_mixins = seen_mixins.union(tester.get('swarming_mixins', set())) + seen_mixins = seen_mixins.union(tester.get('mixins', set())) for suite in self.test_suites.values(): if isinstance(suite, list): # Don't care about this, it's a composition, which shouldn't include a @@ -959,9 +971,9 @@ # swarming mixin entries. Ignore them continue - seen_mixins = seen_mixins.union(test.get('swarming_mixins', set())) + seen_mixins = seen_mixins.union(test.get('mixins', set())) - missing_mixins = set(self.swarming_mixins.keys()) - seen_mixins + missing_mixins = set(self.mixins.keys()) - seen_mixins if missing_mixins: raise BBGenErr('The following mixins are unreferenced: %s. They must be' ' referenced in a waterfall, machine, or test suite.' % ( @@ -1044,7 +1056,7 @@ bad_files = set() for filename in ( - 'swarming_mixins.pyl', + 'mixins.pyl', 'test_suites.pyl', 'test_suite_exceptions.pyl', ):
diff --git a/testing/buildbot/generate_buildbot_json_unittest.py b/testing/buildbot/generate_buildbot_json_unittest.py index bc22253..c8f7520e 100755 --- a/testing/buildbot/generate_buildbot_json_unittest.py +++ b/testing/buildbot/generate_buildbot_json_unittest.py
@@ -13,7 +13,7 @@ class FakeBBGen(generate_buildbot_json.BBJSONGenerator): - def __init__(self, waterfalls, test_suites, exceptions, swarming_mixins, + def __init__(self, waterfalls, test_suites, exceptions, mixins, luci_milo_cfg): super(FakeBBGen, self).__init__() infra_config_dir = os.path.abspath( @@ -25,7 +25,7 @@ 'waterfalls.pyl': waterfalls, 'test_suites.pyl': test_suites, 'test_suite_exceptions.pyl': exceptions, - 'swarming_mixins.pyl': swarming_mixins, + 'mixins.pyl': mixins, luci_milo_cfg_path: luci_milo_cfg, luci_milo_dev_cfg_path: '', } @@ -114,7 +114,7 @@ FOO_GTESTS_WATERFALL_MIXIN_WATERFALL = """\ [ { - 'swarming_mixins': ['waterfall_mixin'], + 'mixins': ['waterfall_mixin'], 'name': 'chromium.test', 'machines': { 'Fake Tester': { @@ -134,7 +134,24 @@ 'name': 'chromium.test', 'machines': { 'Fake Tester': { - 'swarming_mixins': ['builder_mixin'], + 'mixins': ['builder_mixin'], + 'swarming': {}, + 'test_suites': { + 'gtest_tests': 'foo_tests', + }, + }, + }, + }, +] +""" + +FOO_GTESTS_BUILDER_MIXIN_NON_SWARMING_WATERFALL = """\ +[ + { + 'name': 'chromium.test', + 'machines': { + 'Fake Tester': { + 'mixins': ['random_mixin'], 'swarming': {}, 'test_suites': { 'gtest_tests': 'foo_tests', @@ -151,7 +168,7 @@ 'name': 'chromium.test', 'machines': { 'Fake Tester': { - 'swarming_mixins': ['dimension_mixin'], + 'mixins': ['dimension_mixin'], 'swarming': {}, 'test_suites': { 'gtest_tests': 'foo_tests', @@ -168,7 +185,7 @@ 'name': 'chromium.test', 'machines': { 'Fake Tester': { - 'swarming_mixins': ['dimension_mixin'], + 'mixins': ['dimension_mixin'], 'os_type': 'win', 'browser_config': 'release', 'test_suites': { @@ -187,7 +204,7 @@ 'name': 'chromium.test', 'machines': { 'Fake Tester': { - 'swarming_mixins': 'dimension_mixin', + 'mixins': 'dimension_mixin', 'swarming': {}, 'test_suites': { 'gtest_tests': 'foo_tests', @@ -203,7 +220,7 @@ 'name': 'chromium.test', 'machines': { 'Fake Tester': { - 'swarming_mixins': ['nonexistant'], + 'mixins': ['nonexistant'], 'swarming': {}, 'test_suites': { 'gtest_tests': 'foo_tests', @@ -217,7 +234,7 @@ FOO_GTESTS_TEST_MIXIN_WATERFALL = """\ [ { - 'swarming_mixins': ['waterfall_mixin'], + 'mixins': ['waterfall_mixin'], 'name': 'chromium.test', 'machines': { 'Fake Tester': { @@ -234,7 +251,7 @@ FOO_GTESTS_SORTING_MIXINS_WATERFALL = """\ [ { - 'swarming_mixins': ['a_mixin', 'b_mixin', 'c_mixin'], + 'mixins': ['a_mixin', 'b_mixin', 'c_mixin'], 'name': 'chromium.test', 'machines': { 'Fake Tester': { @@ -369,7 +386,7 @@ 'name': 'chromium.test', 'machines': { 'Fake Tester': { - 'swarming_mixins': ['test_mixin'], + 'mixins': ['test_mixin'], 'test_suites': { 'cts_tests': 'foo_cts_tests', }, @@ -602,7 +619,7 @@ ], 'expiration': 120, }, - 'swarming_mixins': ['test_mixin'], + 'mixins': ['test_mixin'], }, }, }, @@ -1434,6 +1451,30 @@ } """ +BUILDER_MIXIN_NON_SWARMING_WATERFALL_OUTPUT = """\ +{ + "AAAAA1 AUTOGENERATED FILE DO NOT EDIT": {}, + "AAAAA2 See generate_buildbot_json.py to make changes": {}, + "Fake Tester": { + "gtest_tests": [ + { + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "integrity": "high" + } + ], + "expiration": 120 + }, + "test": "foo_test", + "value": "random" + } + ] + } +} +""" + TEST_MIXIN_WATERFALL_OUTPUT = """\ { "AAAAA1 AUTOGENERATED FILE DO NOT EDIT": {}, @@ -1541,18 +1582,29 @@ SWARMING_MIXINS = """\ { 'builder_mixin': { - 'value': 'builder', - }, - 'dimension_mixin': { - 'dimensions': { - 'iama': 'mixin', + 'swarming': { + 'value': 'builder', }, }, + 'dimension_mixin': { + 'swarming': { + 'dimensions': { + 'iama': 'mixin', + }, + }, + }, + 'random_mixin': { + 'value': 'random', + }, 'test_mixin': { - 'value': 'test', + 'swarming': { + 'value': 'test', + }, }, 'waterfall_mixin': { - 'value': 'waterfall', + 'swarming': { + 'value': 'waterfall', + }, }, } """ @@ -2181,7 +2233,7 @@ fbb.check_input_file_consistency(verbose=True) self.assertFalse(fbb.printed_lines) - def test_swarming_mixins_waterfall(self): + def test_mixins_waterfall(self): fbb = FakeBBGen(FOO_GTESTS_WATERFALL_MIXIN_WATERFALL, FOO_TEST_SUITE, EMPTY_PYL_FILE, @@ -2191,7 +2243,7 @@ fbb.check_output_file_consistency(verbose=True) self.assertFalse(fbb.printed_lines) - def test_swarming_mixins_waterfall_exception_overrides(self): + def test_mixins_waterfall_exception_overrides(self): fbb = FakeBBGen(FOO_GTESTS_WATERFALL_MIXIN_WATERFALL, FOO_TEST_SUITE, SCRIPT_WITH_ARGS_SWARMING_EXCEPTIONS, @@ -2201,7 +2253,7 @@ fbb.check_output_file_consistency(verbose=True) self.assertFalse(fbb.printed_lines) - def test_swarming_mixins_builder(self): + def test_mixins_builder(self): fbb = FakeBBGen(FOO_GTESTS_BUILDER_MIXIN_WATERFALL, FOO_TEST_SUITE, EMPTY_PYL_FILE, @@ -2211,7 +2263,18 @@ fbb.check_output_file_consistency(verbose=True) self.assertFalse(fbb.printed_lines) - def test_swarming_mixins_test(self): + def test_mixins_builder_non_swarming(self): + fbb = FakeBBGen(FOO_GTESTS_BUILDER_MIXIN_NON_SWARMING_WATERFALL, + FOO_TEST_SUITE, + EMPTY_PYL_FILE, + SWARMING_MIXINS, + LUCI_MILO_CFG) + fbb.files['chromium.test.json'] = ( + BUILDER_MIXIN_NON_SWARMING_WATERFALL_OUTPUT) + fbb.check_output_file_consistency(verbose=True) + self.assertFalse(fbb.printed_lines) + + def test_mixins_test(self): fbb = FakeBBGen(FOO_GTESTS_WATERFALL, FOO_TEST_SUITE_WITH_MIXIN, EMPTY_PYL_FILE, @@ -2221,7 +2284,7 @@ fbb.check_output_file_consistency(verbose=True) self.assertFalse(fbb.printed_lines) - def test_swarming_mixins_dimension(self): + def test_mixins_dimension(self): fbb = FakeBBGen(FOO_GTESTS_DIMENSIONS_MIXIN_WATERFALL, FOO_TEST_SUITE_WITH_MIXIN, EMPTY_PYL_FILE, @@ -2231,7 +2294,7 @@ fbb.check_output_file_consistency(verbose=True) self.assertFalse(fbb.printed_lines) - def test_swarming_mixins_dimension_gpu(self): + def test_mixins_dimension_gpu(self): fbb = FakeBBGen(FOO_GPU_TELEMETRY_TEST_DIMENSIONS_WATERFALL, FOO_TEST_SUITE_WITH_MIXIN, EMPTY_PYL_FILE, @@ -2241,7 +2304,7 @@ fbb.check_output_file_consistency(verbose=True) self.assertFalse(fbb.printed_lines) - def test_swarming_mixins_unreferenced(self): + def test_mixins_unreferenced(self): fbb = FakeBBGen(FOO_GTESTS_WATERFALL, FOO_TEST_SUITE_WITH_MIXIN, EMPTY_PYL_FILE, @@ -2252,7 +2315,7 @@ fbb.check_input_file_consistency(verbose=True) self.assertFalse(fbb.printed_lines) - def test_swarming_mixins_cts(self): + def test_mixins_cts(self): fbb = FakeBBGen(FOO_CTS_WATERFALL_MIXINS, FOO_CTS_SUITE , EMPTY_PYL_FILE, @@ -2263,7 +2326,7 @@ fbb.check_output_file_consistency(verbose=True) self.assertFalse(fbb.printed_lines) - def test_swarming_mixins_unused(self): + def test_mixins_unused(self): fbb = FakeBBGen(FOO_GTESTS_INVALID_NOTFOUND_MIXIN_WATERFALL, FOO_TEST_SUITE_WITH_MIXIN, EMPTY_PYL_FILE, @@ -2274,7 +2337,7 @@ fbb.check_output_file_consistency(verbose=True) self.assertFalse(fbb.printed_lines) - def test_swarming_mixins_list(self): + def test_mixins_list(self): fbb = FakeBBGen(FOO_GTESTS_INVALID_LIST_MIXIN_WATERFALL, FOO_TEST_SUITE_WITH_MIXIN, EMPTY_PYL_FILE, @@ -2285,7 +2348,7 @@ fbb.check_output_file_consistency(verbose=True) self.assertFalse(fbb.printed_lines) - def test_swarming_mixins_must_be_sorted(self): + def test_mixins_must_be_sorted(self): fbb = FakeBBGen(FOO_GTESTS_SORTING_MIXINS_WATERFALL, FOO_TEST_SUITE, EMPTY_PYL_FILE, @@ -2405,7 +2468,7 @@ fbb.printed_lines = [] self.assertFalse(fbb.printed_lines) - def test_swarming_mixins_no_duplicate_keys(self): + def test_mixins_no_duplicate_keys(self): fbb = FakeBBGen(FOO_GTESTS_BUILDER_MIXIN_WATERFALL, FOO_TEST_SUITE, EMPTY_PYL_FILE, @@ -2413,7 +2476,7 @@ LUCI_MILO_CFG) with self.assertRaisesRegexp( generate_buildbot_json.BBGenErr, - 'The following files have invalid keys: swarming_mixins.pyl'): + 'The following files have invalid keys: mixins.pyl'): fbb.check_input_file_consistency(verbose=True) joined_lines = ' '.join(fbb.printed_lines) self.assertRegexpMatches(
diff --git a/testing/buildbot/mixins.pyl b/testing/buildbot/mixins.pyl new file mode 100644 index 0000000..9650fdf --- /dev/null +++ b/testing/buildbot/mixins.pyl
@@ -0,0 +1,284 @@ +# Copyright 2018 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. + +# This is a .pyl, or "Python Literal", file. You can treat it just like a +# .json file, with the following exceptions: +# * all keys must be quoted (use single quotes, please); +# * comments are allowed, using '#' syntax; and +# * trailing commas are allowed. +# +# The mixins known to exist. These can be applied to a waterfall, builder, or +# test. The mixins are copied verbatim for each test in a config, overwriting +# existing values. These values can be overriden by exceptions. +# +# 'swarming' mixins are copied verbatim into the test, with one exception; the +# swarming 'dimensions' key. All values in the 'dimensions' key are applied to +# every 'dimension_set' in a test, creating one if no 'dimension_set' already +# exists. +# +# TODO: Potentially switch structure. It's possible we want swarming dimensions +# to live in their own 'swarming' top level key. This could make things more +# clear for users, but would require moving mixins into sections. Re-evaluate +# if there are more uses of this potential feature. +# +# Examples: +# +# == Regular == +# Mixin: +# 'mac-rel-args': { +# 'args': [ +# 'mac-release/sizes', +# ], +# }, +# +# Waterfall: +# { +# 'name': 'chromium' +# 'machines': { +# 'mac-rel': { +# 'test_suites': { +# 'scripts': 'public_build_scripts', +# }, +# 'mixins': ['mac-rel-args'], +# }, +# }, +# }, +# +# Output: +# { +# 'name': 'chromium' +# 'machines': { +# 'mac-rel': { +# "scripts": [ +# { +# "args": [ +# "mac-release/sizes" +# ], +# "name": "sizes", +# "script": "sizes.py" +# } +# ] +# }, +# }, +# }, +# +# == Swarming == +# Mixin: +# 'x86-64': { +# 'swarming': { +# 'dimensions': { +# 'cpu': 'x86-64', +# }, +# }, +# }, +# +# Waterfall: +# { +# 'name': 'chromium' +# 'machines': { +# 'msan-bot': { +# 'test_suites': { +# 'scripts': 'linux_chromeos_gtests', +# }, +# 'mixins': ['x86-64'], +# }, +# }, +# }, +# +# Output: +# { +# 'name': 'chromium' +# 'machines': { +# 'msan-bot': { +# "gtest_tests": [ +# { +# "args": [ +# "--test-launcher-print-test-stdio=always" +# ], +# "swarming": { +# "can_use_on_swarming_builders": true, +# "dimension_sets": [ +# { +# "cpu": "x86-64", +# "os": "Ubuntu-14.04" +# } +# ] +# }, +# "test": "accessibility_unittests" +# }, +# <snip> +# }, +# }, +# }, + +{ + 'amd_8870m': { + 'swarming': { + 'dimensions': { + 'gpu': '1002:6821', + }, + }, + }, + 'arm_tester': { + 'swarming': { + 'dimensions': { + 'cpu': 'armv7l-32', + }, + }, + }, + 'bullhead': { + 'swarming': { + 'dimensions': { + 'device_type': 'bullhead', + 'os': 'Android', + }, + }, + }, + 'gpu_pool': { + 'swarming': { + 'dimensions': { + 'pool': 'Chrome-GPU', + }, + }, + }, + 'hammerhead': { + 'swarming': { + 'dimensions': { + 'device_type': 'hammerhead', + 'os': 'Android', + }, + }, + }, + 'intel_iris_5100': { + 'swarming': { + 'dimensions': { + 'gpu': '8086:0a2e', + }, + }, + }, + 'kitkat': { + 'swarming': { + 'dimensions': { + 'device_os': 'K', + }, + }, + }, + 'limited_capacity_bot': { + # Some FYI bot configurations have a limited number of bots in the swarming + # pool. Increase the default expiration time of 1 hour (3600 seconds) to + # prevent shards from timing out. + 'swarming': { + 'expiration': 10800, + }, + }, + 'linux-rel-args': { + 'args': [ + 'linux-release-64/sizes', + ], + }, + 'linux-trusty': { + 'swarming': { + 'dimensions': { + 'os': 'Ubuntu-14.04', + }, + }, + }, + 'mac-rel-args': { + 'args': [ + 'mac-release/sizes', + ], + }, + 'mac_10.10': { + 'swarming': { + 'dimensions': { + 'os': 'Mac-10.10', + }, + }, + }, + 'mac_10.11': { + 'swarming': { + 'dimensions': { + 'os': 'Mac-10.11', + }, + }, + }, + 'mac_10.13': { + 'swarming': { + 'dimensions': { + 'os': 'Mac-10.13', + }, + }, + }, + 'mac_10.14': { + 'swarming': { + 'dimensions': { + 'os': 'Mac-10.14', + }, + }, + }, + 'mac_mini_10.12': { + 'swarming': { + 'dimensions': { + 'gpu': '8086:0a2e', + 'os': 'Mac-10.12.6', + }, + }, + }, + 'marshmallow': { + 'swarming': { + 'dimensions': { + 'device_os': 'MMB29Q', + }, + }, + }, + 'no_gpu': { + 'swarming': { + 'dimensions': { + 'gpu': 'none', + }, + }, + }, + 'nvidia_750m_mac_edition': { + 'swarming': { + 'dimensions': { + 'gpu': '10de:0fe9', + }, + }, + }, + 'win10': { + 'swarming': { + 'dimensions': { + 'os': 'Windows-10-15063', + }, + }, + }, + 'win7': { + 'swarming': { + 'dimensions': { + 'os': 'Windows-7-SP1', + }, + }, + }, + 'win8': { + 'swarming': { + 'dimensions': { + 'os': 'Windows-8.1-SP0', + }, + }, + }, + 'x86-32': { + 'swarming': { + 'dimensions': { + 'cpu': 'x86-32', + }, + }, + }, + 'x86-64': { + 'swarming': { + 'dimensions': { + 'cpu': 'x86-64', + }, + }, + }, +}
diff --git a/testing/buildbot/test_suite_exceptions.pyl b/testing/buildbot/test_suite_exceptions.pyl index ccdd8e0e..2b61f2d 100644 --- a/testing/buildbot/test_suite_exceptions.pyl +++ b/testing/buildbot/test_suite_exceptions.pyl
@@ -1012,27 +1012,6 @@ 'win-rel', ], 'modifications': { - # chromium - 'mac-dbg': { - 'args': [ - 'mac-debug/sizes', - ], - }, - 'mac-rel': { - 'args': [ - 'mac-release/sizes', - ], - }, - 'linux-dbg': { - 'args': [ - 'linux-debug-64/sizes', - ], - }, - 'linux-rel': { - 'args': [ - 'linux-release-64/sizes', - ], - }, # chromium.android.fyi 'Android Cronet KitKat Builder': { 'args': [
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index 4dd52ac9..bf257a7 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -28,6 +28,7 @@ ], }, 'linux-rel': { + 'mixins': ['linux-rel-args'], 'additional_compile_targets': [ 'all', ], @@ -41,6 +42,7 @@ ], }, 'mac-rel': { + 'mixins': ['mac-rel-args'], 'additional_compile_targets': [ 'all', ], @@ -958,7 +960,7 @@ ], }, 'Linux ARM': { - 'swarming_mixins': [ + 'mixins': [ 'linux-trusty', 'arm_tester', ], @@ -1378,7 +1380,7 @@ }, }, 'mac-osxbeta-rel': { - 'swarming_mixins': [ + 'mixins': [ 'intel_iris_5100', 'mac_10.14', ], @@ -2266,7 +2268,7 @@ 'Mac FYI 10.14 Release (AMD)': { 'os_type': 'mac', 'browser_config': 'release', - 'swarming_mixins': [ + 'mixins': [ 'amd_8870m', 'gpu_pool', 'limited_capacity_bot', @@ -2280,7 +2282,7 @@ 'Mac FYI 10.14 Release (Intel)': { 'os_type': 'mac', 'browser_config': 'release', - 'swarming_mixins': [ + 'mixins': [ 'gpu_pool', 'intel_iris_5100', 'limited_capacity_bot', @@ -2294,7 +2296,7 @@ 'Mac FYI 10.14 Release (NVIDIA)': { 'os_type': 'mac', 'browser_config': 'release', - 'swarming_mixins': [ + 'mixins': [ 'gpu_pool', 'mac_10.14', 'limited_capacity_bot', @@ -3174,7 +3176,7 @@ ], }, 'Mac10.10 Tests': { - 'swarming_mixins': [ + 'mixins': [ 'mac_10.10', 'no_gpu', ], @@ -3184,7 +3186,7 @@ }, }, 'Mac10.11 Tests': { - 'swarming_mixins': [ + 'mixins': [ 'mac_10.11', 'no_gpu', ], @@ -3194,7 +3196,7 @@ }, }, 'Mac10.12 Tests': { - 'swarming_mixins': [ + 'mixins': [ 'mac_mini_10.12', ], 'test_suites': { @@ -3203,7 +3205,7 @@ }, }, 'Mac10.13 Tests': { - 'swarming_mixins': [ + 'mixins': [ 'mac_10.13', 'no_gpu', ], @@ -3214,7 +3216,7 @@ }, }, 'Mac10.13 Tests (dbg)': { - 'swarming_mixins': [ + 'mixins': [ 'mac_10.13', 'no_gpu', ], @@ -3278,7 +3280,7 @@ ], }, 'Linux ChromiumOS MSan Tests': { - 'swarming_mixins': [ + 'mixins': [ 'linux-trusty', 'x86-64', ], @@ -3290,7 +3292,7 @@ ], }, 'Linux MSan Tests': { - 'swarming_mixins': [ + 'mixins': [ 'linux-trusty', 'x86-64', ], @@ -3518,7 +3520,7 @@ 'WebRTC Chromium FYI Android Builder (dbg)': {}, 'WebRTC Chromium FYI Android Builder ARM64 (dbg)': {}, 'WebRTC Chromium FYI Android Tests (dbg) (K Nexus5)': { - 'swarming_mixins': [ + 'mixins': [ 'kitkat', 'hammerhead', ], @@ -3527,7 +3529,7 @@ }, }, 'WebRTC Chromium FYI Android Tests (dbg) (M Nexus5X)': { - 'swarming_mixins': [ + 'mixins': [ 'marshmallow', 'bullhead', ], @@ -3554,7 +3556,7 @@ ], }, 'WebRTC Chromium FYI Linux Tester': { - 'swarming_mixins': [ + 'mixins': [ 'x86-64', 'linux-trusty', ], @@ -3581,7 +3583,7 @@ ], }, 'WebRTC Chromium FYI Mac Tester': { - 'swarming_mixins': [ + 'mixins': [ 'mac_mini_10.12', ], 'test_suites': { @@ -3607,7 +3609,7 @@ ], }, 'WebRTC Chromium FYI Win10 Tester': { - 'swarming_mixins': [ + 'mixins': [ 'x86-64', 'win10', ], @@ -3616,7 +3618,7 @@ }, }, 'WebRTC Chromium FYI Win7 Tester': { - 'swarming_mixins': [ + 'mixins': [ 'x86-64', 'win7', ], @@ -3625,7 +3627,7 @@ }, }, 'WebRTC Chromium FYI Win8 Tester': { - 'swarming_mixins': [ + 'mixins': [ 'x86-64', 'win8', ], @@ -3653,7 +3655,7 @@ }, }, 'Win10 Tests x64': { - 'swarming_mixins': [ + 'mixins': [ 'x86-64', 'win10', ], @@ -3663,7 +3665,7 @@ }, }, 'Win10 Tests x64 (dbg)': { - 'swarming_mixins': [ + 'mixins': [ 'x86-64', 'win10', ], @@ -3673,7 +3675,7 @@ }, }, 'Win7 (32) Tests': { - 'swarming_mixins': [ + 'mixins': [ 'x86-32', 'win7', ],
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 750ca67..b474050 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -2440,21 +2440,6 @@ ] } ], - "MacV2Sandbox": [ - { - "platforms": [ - "mac" - ], - "experiments": [ - { - "name": "Enabled", - "enable_features": [ - "MacV2Sandbox" - ] - } - ] - } - ], "MediaFoundationH264Encoding": [ { "platforms": [
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-gen-property-trees b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-gen-property-trees index c547e4879..6f521ce1 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-gen-property-trees +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-gen-property-trees
@@ -140,62 +140,6 @@ # Single pixel snapping difference on scrolling content size. Bug(none) compositing/iframes/invisible-nested-iframe-show.html [ Failure ] -# Gradient/image slightly changed. Likely benign. -Bug(none) compositing/masks/simple-composited-mask.html [ Failure ] -Bug(none) compositing/masks/masked-ancestor.html [ Failure ] -Bug(none) compositing/masks/multiple-masks.html [ Failure ] -Bug(none) compositing/lots-of-img-layers.html [ Failure ] -Bug(none) compositing/lots-of-img-layers-with-opacity.html [ Failure ] - -# Subpixel differences on text. Likely benign. -Bug(none) css3/blending/background-blend-mode-overlapping-accelerated-elements.html [ Failure ] - -# Benign subpixel differences. -Bug(none) transforms/3d/point-mapping/3d-point-mapping-deep.html [ Failure ] -Bug(none) transforms/3d/point-mapping/3d-point-mapping-preserve-3d.html [ Failure ] -Bug(none) compositing/direct-image-compositing.html [ Failure ] -Bug(none) compositing/masks/direct-image-mask.html [ Failure ] -Bug(none) compositing/geometry/layer-due-to-layer-children.html [ Failure ] -Bug(none) compositing/perpendicular-layer-sorting.html [ Failure ] -Bug(none) compositing/perspective-interest-rect.html [ Failure ] - -# Rounded borders have slightly different antialiasing -Bug(none) compositing/composited-scaled-child-with-border-radius-parent-clip.html [ Failure ] -Bug(none) compositing/composited-translated-child-with-border-radius-parent-clip.html [ Failure ] -Bug(none) compositing/overflow/border-radius-above-composited-subframe.html [ Failure ] -Bug(none) compositing/overflow/border-radius-composited-subframe.html [ Failure ] -Bug(none) compositing/overflow/border-radius-on-grandparent-composited-grandchild.html [ Failure ] -Bug(none) compositing/overflow/border-radius-on-parent-composited-grandchild.html [ Failure ] -Bug(none) compositing/overflow/border-radius-on-two-ancestors-composited-grandchild.html [ Failure ] -Bug(none) compositing/overflow/border-radius-styles-with-composited-child.html [ Failure ] -Bug(none) compositing/overflow/grandchild-composited-with-border-radius-ancestor.html [ Failure ] -Bug(none) compositing/overflow/grandchild-with-border-radius-ancestor.html [ Failure ] -Bug(none) compositing/overflow/siblings-composited-with-border-radius-ancestor.html [ Failure ] -Bug(none) compositing/overflow/siblings-composited-with-border-radius-ancestor-one-clipped.html [ Failure ] -Bug(none) compositing/overflow/siblings-with-border-radius-ancestor.html [ Failure ] -Bug(none) fast/borders/border-radius-mask-canvas-border.html [ Failure ] -Bug(none) fast/borders/border-radius-mask-canvas-with-mask.html [ Failure ] -Bug(none) fast/borders/border-radius-mask-canvas.html [ Failure ] -Bug(none) fast/borders/border-radius-mask-video-ratio.html [ Failure ] -Bug(none) fast/borders/border-radius-mask-video-shadow.html [ Failure ] -Bug(none) fast/borders/border-radius-mask-video.html [ Failure ] -Bug(none) fast/clip/overflow-border-radius-composited-parent.html [ Failure ] -Bug(none) fast/clip/overflow-border-radius-composited.html [ Failure ] -Bug(none) compositing/overflow/tiled-mask.html [ Failure ] -Bug(none) compositing/opacity-with-mask.html [ Failure ] -Bug(none) virtual/prefer_compositing_to_lcd_text/compositing/overflow/border-radius-above-composited-subframe.html [ Failure ] -Bug(none) virtual/prefer_compositing_to_lcd_text/compositing/overflow/border-radius-composited-subframe.html [ Failure ] -Bug(none) virtual/prefer_compositing_to_lcd_text/compositing/overflow/border-radius-on-grandparent-composited-grandchild.html [ Failure ] -Bug(none) virtual/prefer_compositing_to_lcd_text/compositing/overflow/border-radius-on-parent-composited-grandchild.html [ Failure ] -Bug(none) virtual/prefer_compositing_to_lcd_text/compositing/overflow/border-radius-on-two-ancestors-composited-grandchild.html [ Failure ] -Bug(none) virtual/prefer_compositing_to_lcd_text/compositing/overflow/border-radius-styles-with-composited-child.html [ Failure ] -Bug(none) virtual/prefer_compositing_to_lcd_text/compositing/overflow/grandchild-composited-with-border-radius-ancestor.html [ Failure ] -Bug(none) virtual/prefer_compositing_to_lcd_text/compositing/overflow/grandchild-with-border-radius-ancestor.html [ Failure ] -Bug(none) virtual/prefer_compositing_to_lcd_text/compositing/overflow/siblings-composited-with-border-radius-ancestor.html [ Failure ] -Bug(none) virtual/prefer_compositing_to_lcd_text/compositing/overflow/siblings-composited-with-border-radius-ancestor-one-clipped.html [ Failure ] -Bug(none) virtual/prefer_compositing_to_lcd_text/compositing/overflow/siblings-with-border-radius-ancestor.html [ Failure ] -Bug(none) virtual/prefer_compositing_to_lcd_text/compositing/overflow/tiled-mask.html [ Failure ] - # One line of pixels different when clipping the scrollbar. Bug(none) virtual/prefer_compositing_to_lcd_text/compositing/overflow/scaled-overflow.html [ Failure ] Bug(none) compositing/overflow/scaled-overflow.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 4ef1c71..2696bf6 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -36,6 +36,7 @@ # svg # canvas, fast/canvas # transforms +# display-lock # Some additional bugs that are caused by painting problems are also within this section. # Failures due to SPV2, that don't also fail without SPV2. DO NOT REBASELINE. @@ -166,6 +167,9 @@ crbug.com/857490 virtual/paint-touchaction-rects/fast/events/touch/gesture/pad-gesture-fling.html [ Skip ] crbug.com/857490 virtual/paint-touchaction-rects/fast/events/touch/gesture/touch-gesture-fling-with-page-scale.html [ Skip ] +# Display locking, currently only available via a virtual test. +crbug.com/882663 display-lock [ Skip ] + # Sheriff 2018/05/25 crbug.com/846747 http/tests/navigation/navigation-interrupted-by-fragment.html [ Pass Timeout ] crbug.com/846747 virtual/outofblink-cors/http/tests/navigation/navigation-interrupted-by-fragment.html [ Pass Timeout ]
diff --git a/third_party/WebKit/LayoutTests/VirtualTestSuites b/third_party/WebKit/LayoutTests/VirtualTestSuites index ad57cd69..e43afd9 100644 --- a/third_party/WebKit/LayoutTests/VirtualTestSuites +++ b/third_party/WebKit/LayoutTests/VirtualTestSuites
@@ -763,5 +763,10 @@ "prefix" : "lazyload-policy", "base": "external/wpt/feature-policy/experimental-features/lazyload", "args": ["--enable-blink-features=LazyFrameLoading"] + }, + { + "prefix": "display-lock", + "base": "display-lock", + "args": ["--enable-blink-features=DisplayLocking"] } ]
diff --git a/third_party/WebKit/LayoutTests/display-lock/acquire-display-lock-expected.html b/third_party/WebKit/LayoutTests/display-lock/acquire-display-lock-expected.html new file mode 100644 index 0000000..0c922c7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/display-lock/acquire-display-lock-expected.html
@@ -0,0 +1,18 @@ +<!doctype HTML> + +<style> +#parent { + contain: paint; + width: 150px; + height: 150px; + background: lightblue; +} +#child { + width: 50px; + height: 50px; + background: lightgreen; +} +</style> + +<div id="log">PASS</div> +<div id="parent"><div id="child"></div></div>
diff --git a/third_party/WebKit/LayoutTests/display-lock/acquire-display-lock.html b/third_party/WebKit/LayoutTests/display-lock/acquire-display-lock.html new file mode 100644 index 0000000..dcf817dc --- /dev/null +++ b/third_party/WebKit/LayoutTests/display-lock/acquire-display-lock.html
@@ -0,0 +1,45 @@ +<!doctype HTML> + +<style> +#parent { + contain: paint; + width: 150px; + height: 150px; + background: lightblue; +} +#child { + width: 50px; + height: 50px; + background: lightgreen; +} +</style> + +<div id="log"></div> +<div id="parent"></div> + +<script> +if (window.testRunner) + window.testRunner.waitUntilDone(); + +function modifyDom(context) { + let child = document.createElement("div"); + child.id = "child"; + document.getElementById("parent").appendChild(child); +} + +function acquire() { + document.getElementById("parent").acquireDisplayLock(modifyDom).then( + () => { + document.getElementById("log").innerHTML = "PASS"; + if (window.testRunner) + window.testRunner.notifyDone(); + }, + () => { + document.getElementById("log").innerHTML = "FAIL"; + if (window.testRunner) + window.testRunner.notifyDone(); + }); +} + +window.onload = acquire; +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/background-fetch/abort.https.window.js b/third_party/WebKit/LayoutTests/external/wpt/background-fetch/abort.https.window.js deleted file mode 100644 index 43c455b..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/background-fetch/abort.https.window.js +++ /dev/null
@@ -1,45 +0,0 @@ -// META: script=/service-workers/service-worker/resources/test-helpers.sub.js -// META: script=resources/utils.js -'use strict'; - -// Covers basic functionality provided by BackgroundFetchManager.abort(). -// https://wicg.github.io/background-fetch/#background-fetch-registration-abort - -backgroundFetchTest(async (test, backgroundFetch) => { - const registration = await backgroundFetch.fetch( - uniqueId(), - ['resources/feature-name.txt', '/serviceworker/resources/slow-response.php']); - - assert_true(await registration.abort()); - assert_false(await registration.abort()); - -}, 'Aborting the same registration twice fails'); - -backgroundFetchTest(async (test, backgroundFetch) => { - const registration = await backgroundFetch.fetch( - uniqueId(), - ['resources/feature-name.txt', '/serviceworker/resources/slow-response.php']); - const resultPromise = getMessageFromServiceWorker(); - - await new Promise(resolve => { - // Run the following steps after the first request is complete. - registration.onprogress = async () => { - assert_true(await registration.abort()); - - const {type, eventRegistration, results} = await resultPromise; - - assert_equals(eventRegistration.result, 'failure'); - assert_equals(eventRegistration.failureReason, 'aborted'); - - assert_equals(type, 'backgroundfetchabort'); - assert_equals(results.length, 1); - - assert_true(results[0].url.includes('resources/feature-name.txt')); - assert_equals(results[0].status, 200); - assert_equals(results[0].text, 'Background Fetch'); - - resolve(); - }; - }); - -}, 'Calling BackgroundFetchRegistration.abort sets the correct fields and responses are still available'); \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/wpt/background-fetch/service_workers/sw.js b/third_party/WebKit/LayoutTests/external/wpt/background-fetch/service_workers/sw.js index 2e3fbfff1..af4655d 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/background-fetch/service_workers/sw.js +++ b/third_party/WebKit/LayoutTests/external/wpt/background-fetch/service_workers/sw.js
@@ -27,4 +27,3 @@ self.addEventListener('backgroundfetchsuccess', handleBackgroundFetchUpdateEvent); self.addEventListener('backgroundfetchfail', handleBackgroundFetchUpdateEvent); -self.addEventListener('backgroundfetchabort', handleBackgroundFetchUpdateEvent);
diff --git a/third_party/WebKit/LayoutTests/external/wpt/wake-lock/wakelock-type.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/wake-lock/wakelock-type.https-expected.txt deleted file mode 100644 index 4b361c2..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/wake-lock/wakelock-type.https-expected.txt +++ /dev/null
@@ -1,7 +0,0 @@ -This is a testharness.js-based test. -PASS Test that wakeLock.type is 'screen' when screen wake lock is invoked -FAIL Test that wakeLock.type is 'system' when system wake lock is invoked promise_test: Unhandled rejection with value: object "NotSupportedError: WakeLockType Not Supported" -PASS 'TypeError' is thrown when set an empty wake lock type -PASS 'TypeError' is thrown when set an unsupported wake lock type -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/composited-scaled-child-with-border-radius-parent-clip-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/composited-scaled-child-with-border-radius-parent-clip-expected.png new file mode 100644 index 0000000..c692dda --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/composited-scaled-child-with-border-radius-parent-clip-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/composited-translated-child-with-border-radius-parent-clip-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/composited-translated-child-with-border-radius-parent-clip-expected.png new file mode 100644 index 0000000..5bfd018 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/composited-translated-child-with-border-radius-parent-clip-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/direct-image-compositing-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/direct-image-compositing-expected.png index fb597a8..dc93bab 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/direct-image-compositing-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/direct-image-compositing-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/geometry/layer-due-to-layer-children-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/geometry/layer-due-to-layer-children-expected.png new file mode 100644 index 0000000..ed06fd1d --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/geometry/layer-due-to-layer-children-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/lots-of-img-layers-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/lots-of-img-layers-expected.png new file mode 100644 index 0000000..78867cc3 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/lots-of-img-layers-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/lots-of-img-layers-with-opacity-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/lots-of-img-layers-with-opacity-expected.png new file mode 100644 index 0000000..ab2f6f89 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/lots-of-img-layers-with-opacity-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/masks/direct-image-mask-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/masks/direct-image-mask-expected.png new file mode 100644 index 0000000..e7dcf18 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/masks/direct-image-mask-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/masks/masked-ancestor-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/masks/masked-ancestor-expected.png new file mode 100644 index 0000000..a204713 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/masks/masked-ancestor-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/masks/multiple-masks-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/masks/multiple-masks-expected.png new file mode 100644 index 0000000..0989690 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/masks/multiple-masks-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/masks/simple-composited-mask-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/masks/simple-composited-mask-expected.png new file mode 100644 index 0000000..97c3286 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/masks/simple-composited-mask-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/opacity-with-mask-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/opacity-with-mask-expected.png new file mode 100644 index 0000000..7792efb --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/opacity-with-mask-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-above-composited-subframe-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-above-composited-subframe-expected.png new file mode 100644 index 0000000..1a941fc1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-above-composited-subframe-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-composited-subframe-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-composited-subframe-expected.png new file mode 100644 index 0000000..d0ef886 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-composited-subframe-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-on-grandparent-composited-grandchild-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-on-grandparent-composited-grandchild-expected.png new file mode 100644 index 0000000..2cee245 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-on-grandparent-composited-grandchild-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-on-parent-composited-grandchild-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-on-parent-composited-grandchild-expected.png new file mode 100644 index 0000000..9e367a68 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-on-parent-composited-grandchild-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-on-two-ancestors-composited-grandchild-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-on-two-ancestors-composited-grandchild-expected.png new file mode 100644 index 0000000..b9fac482 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-on-two-ancestors-composited-grandchild-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-styles-with-composited-child-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-styles-with-composited-child-expected.png new file mode 100644 index 0000000..3a2a7e5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/border-radius-styles-with-composited-child-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/grandchild-composited-with-border-radius-ancestor-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/grandchild-composited-with-border-radius-ancestor-expected.png new file mode 100644 index 0000000..f38a1b2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/grandchild-composited-with-border-radius-ancestor-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/grandchild-with-border-radius-ancestor-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/grandchild-with-border-radius-ancestor-expected.png new file mode 100644 index 0000000..f38a1b2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/grandchild-with-border-radius-ancestor-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/siblings-composited-with-border-radius-ancestor-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/siblings-composited-with-border-radius-ancestor-expected.png new file mode 100644 index 0000000..f38a1b2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/siblings-composited-with-border-radius-ancestor-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/siblings-composited-with-border-radius-ancestor-one-clipped-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/siblings-composited-with-border-radius-ancestor-one-clipped-expected.png new file mode 100644 index 0000000..00fa2b9 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/siblings-composited-with-border-radius-ancestor-one-clipped-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/siblings-with-border-radius-ancestor-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/siblings-with-border-radius-ancestor-expected.png new file mode 100644 index 0000000..ff3a0270 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/siblings-with-border-radius-ancestor-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/tiled-mask-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/tiled-mask-expected.png new file mode 100644 index 0000000..d1b758a --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/overflow/tiled-mask-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/perpendicular-layer-sorting-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/perpendicular-layer-sorting-expected.png new file mode 100644 index 0000000..a5b6beb6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/perpendicular-layer-sorting-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/perspective-interest-rect-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/perspective-interest-rect-expected.png new file mode 100644 index 0000000..eec373b --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/compositing/perspective-interest-rect-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/css3/blending/background-blend-mode-overlapping-accelerated-elements-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/css3/blending/background-blend-mode-overlapping-accelerated-elements-expected.png new file mode 100644 index 0000000..d26cca4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/css3/blending/background-blend-mode-overlapping-accelerated-elements-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-canvas-border-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-canvas-border-expected.png new file mode 100644 index 0000000..10863d7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-canvas-border-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-canvas-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-canvas-expected.png new file mode 100644 index 0000000..c0e8fd5e --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-canvas-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-canvas-with-mask-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-canvas-with-mask-expected.png new file mode 100644 index 0000000..80ef073 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-canvas-with-mask-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-video-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-video-expected.png new file mode 100644 index 0000000..7435b7ddc --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-video-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-video-ratio-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-video-ratio-expected.png new file mode 100644 index 0000000..b07697d1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-video-ratio-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-video-shadow-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-video-shadow-expected.png new file mode 100644 index 0000000..7e26cf82 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/borders/border-radius-mask-video-shadow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/clip/overflow-border-radius-composited-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/clip/overflow-border-radius-composited-expected.png new file mode 100644 index 0000000..58a04a3 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/clip/overflow-border-radius-composited-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/clip/overflow-border-radius-composited-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/clip/overflow-border-radius-composited-expected.txt new file mode 100644 index 0000000..3abd7c4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/clip/overflow-border-radius-composited-expected.txt
@@ -0,0 +1,47 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x471 + LayoutBlockFlow {HTML} at (0,0) size 800x471 + LayoutBlockFlow {BODY} at (8,8) size 784x455 + LayoutText {#text} at (0,0) size 462x19 + text run at (0,0) width 462: "The white text and grey backgrounds should all clip to the border-radius. " + LayoutBR {BR} at (462,0) size 0x19 + LayoutText {#text} at (240,145) size 4x19 + text run at (240,145) width 4: " " + LayoutText {#text} at (484,145) size 4x19 + text run at (484,145) width 4: " " + LayoutText {#text} at (0,0) size 0x0 + LayoutText {#text} at (240,290) size 4x19 + text run at (240,290) width 4: " " + LayoutBR {BR} at (244,290) size 0x19 + LayoutText {#text} at (0,0) size 0x0 +layer at (18,38) size 220x120 clip at (28,48) size 200x100 scrollWidth 206 scrollHeight 156 + LayoutBlockFlow {DIV} at (10,30) size 220x120 [border: (10px solid #000000)] +layer at (262,38) size 220x120 clip at (272,48) size 200x100 scrollWidth 206 scrollHeight 156 + LayoutBlockFlow {DIV} at (254,30) size 220x120 [border: (10px solid #000000)] +layer at (28,48) size 200x100 + LayoutBlockFlow {DIV} at (10,10) size 200x100 [color=#FFFFFF] [bgcolor=#808080] + LayoutText {#text} at (0,0) size 81x19 + text run at (0,0) width 81: "static > static" +layer at (272,48) size 200x100 + LayoutBlockFlow (relative positioned) {DIV} at (10,10) size 200x100 [color=#FFFFFF] [bgcolor=#808080] + LayoutText {#text} at (0,0) size 95x19 + text run at (0,0) width 95: "static > relative" +layer at (506,38) size 220x120 clip at (516,48) size 200x100 scrollWidth 206 scrollHeight 156 + LayoutBlockFlow (relative positioned) {DIV} at (498,30) size 220x120 [border: (10px solid #000000)] +layer at (516,48) size 200x100 + LayoutBlockFlow {DIV} at (10,10) size 200x100 [color=#FFFFFF] [bgcolor=#808080] + LayoutText {#text} at (0,0) size 95x19 + text run at (0,0) width 95: "relative > static" +layer at (18,183) size 220x120 clip at (28,193) size 200x100 scrollWidth 206 scrollHeight 156 + LayoutBlockFlow (relative positioned) {DIV} at (10,175) size 220x120 [border: (10px solid #000000)] +layer at (28,193) size 200x100 + LayoutBlockFlow (relative positioned) {DIV} at (10,10) size 200x100 [color=#FFFFFF] [bgcolor=#808080] + LayoutText {#text} at (0,0) size 109x19 + text run at (0,0) width 109: "relative > relative" +layer at (18,328) size 220x120 clip at (28,338) size 200x100 scrollWidth 206 scrollHeight 156 + LayoutBlockFlow (relative positioned) {DIV} at (10,320) size 220x120 [border: (10px solid #000000)] +layer at (28,338) size 200x100 + LayoutBlockFlow (positioned) {DIV} at (10,10) size 200x100 [color=#FFFFFF] [bgcolor=#808080] + LayoutText {#text} at (0,0) size 115x19 + text run at (0,0) width 115: "relative > absolute"
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/clip/overflow-border-radius-composited-parent-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/clip/overflow-border-radius-composited-parent-expected.png new file mode 100644 index 0000000..2f813ee3 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/clip/overflow-border-radius-composited-parent-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/clip/overflow-border-radius-composited-parent-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/clip/overflow-border-radius-composited-parent-expected.txt new file mode 100644 index 0000000..6c9a373 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/fast/clip/overflow-border-radius-composited-parent-expected.txt
@@ -0,0 +1,47 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x471 + LayoutBlockFlow {HTML} at (0,0) size 800x471 + LayoutBlockFlow {BODY} at (8,8) size 784x455 + LayoutText {#text} at (0,0) size 462x19 + text run at (0,0) width 462: "The white text and grey backgrounds should all clip to the border-radius. " + LayoutBR {BR} at (462,0) size 0x19 + LayoutText {#text} at (240,145) size 4x19 + text run at (240,145) width 4: " " + LayoutText {#text} at (484,145) size 4x19 + text run at (484,145) width 4: " " + LayoutText {#text} at (0,0) size 0x0 + LayoutText {#text} at (240,290) size 4x19 + text run at (240,290) width 4: " " + LayoutBR {BR} at (244,290) size 0x19 + LayoutText {#text} at (0,0) size 0x0 +layer at (18,38) size 220x120 clip at (28,48) size 200x100 scrollWidth 206 scrollHeight 156 + LayoutBlockFlow {DIV} at (10,30) size 220x120 [border: (10px solid #000000)] +layer at (28,48) size 200x100 + LayoutBlockFlow {DIV} at (10,10) size 200x100 [color=#FFFFFF] [bgcolor=#808080] + LayoutText {#text} at (0,0) size 81x19 + text run at (0,0) width 81: "static > static" +layer at (262,38) size 220x120 clip at (272,48) size 200x100 scrollWidth 206 scrollHeight 156 + LayoutBlockFlow {DIV} at (254,30) size 220x120 [border: (10px solid #000000)] +layer at (272,48) size 200x100 + LayoutBlockFlow (relative positioned) {DIV} at (10,10) size 200x100 [color=#FFFFFF] [bgcolor=#808080] + LayoutText {#text} at (0,0) size 95x19 + text run at (0,0) width 95: "static > relative" +layer at (506,38) size 220x120 clip at (516,48) size 200x100 scrollWidth 206 scrollHeight 156 + LayoutBlockFlow (relative positioned) {DIV} at (498,30) size 220x120 [border: (10px solid #000000)] +layer at (516,48) size 200x100 + LayoutBlockFlow {DIV} at (10,10) size 200x100 [color=#FFFFFF] [bgcolor=#808080] + LayoutText {#text} at (0,0) size 95x19 + text run at (0,0) width 95: "relative > static" +layer at (18,183) size 220x120 clip at (28,193) size 200x100 scrollWidth 206 scrollHeight 156 + LayoutBlockFlow (relative positioned) {DIV} at (10,175) size 220x120 [border: (10px solid #000000)] +layer at (28,193) size 200x100 + LayoutBlockFlow (relative positioned) {DIV} at (10,10) size 200x100 [color=#FFFFFF] [bgcolor=#808080] + LayoutText {#text} at (0,0) size 109x19 + text run at (0,0) width 109: "relative > relative" +layer at (18,328) size 220x120 clip at (28,338) size 200x100 scrollWidth 206 scrollHeight 156 + LayoutBlockFlow (relative positioned) {DIV} at (10,320) size 220x120 [border: (10px solid #000000)] +layer at (28,338) size 200x100 + LayoutBlockFlow (positioned) {DIV} at (10,10) size 200x100 [color=#FFFFFF] [bgcolor=#808080] + LayoutText {#text} at (0,0) size 115x19 + text run at (0,0) width 115: "relative > absolute"
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/transforms/3d/point-mapping/3d-point-mapping-deep-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/transforms/3d/point-mapping/3d-point-mapping-deep-expected.png new file mode 100644 index 0000000..7124a660 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/transforms/3d/point-mapping/3d-point-mapping-deep-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/transforms/3d/point-mapping/3d-point-mapping-preserve-3d-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/transforms/3d/point-mapping/3d-point-mapping-preserve-3d-expected.png new file mode 100644 index 0000000..f860aa5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-gen-property-trees/transforms/3d/point-mapping/3d-point-mapping-preserve-3d-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-all-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-all-expected.txt deleted file mode 100644 index e1c93d9c..0000000 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-all-expected.txt +++ /dev/null
@@ -1,29 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x496 - LayoutBlockFlow {HTML} at (0,0) size 800x496.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x469.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 90x22 - text run at (0,0) width 90: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x80 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 393x19 - text run at (0,0) width 393: "the 10px gray background is visible around the canvas content" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 152x19 - text run at (0,0) width 152: "has 5px solid red border" - LayoutListItem {LI} at (40,40) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 316x19 - text run at (0,0) width 316: "all the corners for border and padding are rounded" - LayoutListItem {LI} at (40,60) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 366x19 - text run at (0,0) width 366: "the bottom right corner of canvas content is NOT rounded" - LayoutBlockFlow (anonymous) at (0,137.72) size 784x332 - LayoutText {#text} at (0,0) size 0x0 -layer at (28,176) size 287x287 - LayoutHTMLCanvas {CANVAS} at (20,20) size 287x287 [bgcolor=#808080] [border: (5px solid #FF0000)]
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-border-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-border-expected.txt deleted file mode 100644 index 4933c7b..0000000 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-border-expected.txt +++ /dev/null
@@ -1,25 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x426 - LayoutBlockFlow {HTML} at (0,0) size 800x426.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x399.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 90x22 - text run at (0,0) width 90: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x60 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 391x19 - text run at (0,0) width 391: "the canvas content has rounded corners (top-left and top-right)" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 351x19 - text run at (0,0) width 351: "the 10px red border is visible around the canvas content" - LayoutListItem {LI} at (40,40) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 156x19 - text run at (0,0) width 156: "gray border is not visible" - LayoutBlockFlow (anonymous) at (0,117.72) size 784x282 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,136) size 277x277 - LayoutHTMLCanvas {CANVAS} at (0,0) size 277x277 [bgcolor=#808080] [border: (10px solid #FF0000)]
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-expected.txt deleted file mode 100644 index 0486da0ae..0000000 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-expected.txt +++ /dev/null
@@ -1,21 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x386 - LayoutBlockFlow {HTML} at (0,0) size 800x386.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x359.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 90x22 - text run at (0,0) width 90: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x40 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 415x19 - text run at (0,0) width 415: "the canvas content has rounded corners (top-left and bottom-right)" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 190x19 - text run at (0,0) width 190: "gray background is not visible" - LayoutBlockFlow (anonymous) at (0,97.72) size 784x262 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,116) size 257x257 - LayoutHTMLCanvas {CANVAS} at (0,0) size 257x257 [bgcolor=#808080]
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-padding-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-padding-expected.txt deleted file mode 100644 index fe35cab..0000000 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-padding-expected.txt +++ /dev/null
@@ -1,21 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x406 - LayoutBlockFlow {HTML} at (0,0) size 800x406.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x379.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 90x22 - text run at (0,0) width 90: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x40 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 415x19 - text run at (0,0) width 415: "the canvas content has rounded corners (bottom-left and top-right)" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 393x19 - text run at (0,0) width 393: "the 10px gray background is visible around the canvas content" - LayoutBlockFlow (anonymous) at (0,97.72) size 784x282 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,116) size 277x277 - LayoutHTMLCanvas {CANVAS} at (0,0) size 277x277 [bgcolor=#808080]
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-with-mask-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-with-mask-expected.txt deleted file mode 100644 index 4a65654ee..0000000 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-with-mask-expected.txt +++ /dev/null
@@ -1,21 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x456 - LayoutBlockFlow {HTML} at (0,0) size 800x456.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x429.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 90x22 - text run at (0,0) width 90: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x40 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 297x19 - text run at (0,0) width 297: "the canvas element has a gradient mask applied" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 247x19 - text run at (0,0) width 247: "the canvas content has rounded corners" - LayoutBlockFlow (anonymous) at (0,97.72) size 784x332 - LayoutText {#text} at (0,0) size 0x0 -layer at (28,136) size 287x287 transparent - LayoutHTMLCanvas {CANVAS} at (20,20) size 287x287 [bgcolor=#808080] [border: (5px solid #FF0000)]
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-with-shadow-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-with-shadow-expected.txt deleted file mode 100644 index 3a8d1f6..0000000 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-canvas-with-shadow-expected.txt +++ /dev/null
@@ -1,21 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x456 - LayoutBlockFlow {HTML} at (0,0) size 800x456.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x429.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 90x22 - text run at (0,0) width 90: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x40 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 305x19 - text run at (0,0) width 305: "the canvas element has 8px gray shadow around" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 247x19 - text run at (0,0) width 247: "the canvas content has rounded corners" - LayoutBlockFlow (anonymous) at (0,97.72) size 784x332 - LayoutText {#text} at (0,0) size 0x0 -layer at (28,136) size 287x287 - LayoutHTMLCanvas {CANVAS} at (20,20) size 287x287 [bgcolor=#808080] [border: (5px solid #FF0000)]
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-video-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-video-expected.txt deleted file mode 100644 index 49d0179..0000000 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/fast/borders/border-radius-mask-video-expected.txt +++ /dev/null
@@ -1,26 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x354 - LayoutBlockFlow {HTML} at (0,0) size 800x354.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x327.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 90x22 - text run at (0,0) width 90: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x40 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 405x19 - text run at (0,0) width 405: "the video content has rounded corners (top left and bottom right)" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 190x19 - text run at (0,0) width 190: "gray background is not visible" - LayoutBlockFlow (anonymous) at (0,97.72) size 784x230 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,116) size 400x225 - LayoutVideo {VIDEO} at (0,0) size 400x225 [bgcolor=#808080] -layer at (8,116) size 400x225 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 400x225 - LayoutFlexibleBox {DIV} at (0,0) size 400x225 -layer at (8,116) size 400x225 - LayoutBlockFlow (positioned) {DIV} at (0,0) size 400x225
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-headers-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-headers-expected.txt index 61921b7..c339d1bf 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-headers-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-headers-expected.txt
@@ -81,7 +81,7 @@ blocked : 3.8059999860711398 connect : 229.12300000000002 dns : 84.076 - receive : 6.20800000615418 + receive : 5.23900002008304 send : 0.5549999999999784 ssl : 98.702 wait : 568.4820000130125
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-all-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-all-expected.txt deleted file mode 100644 index a15fa1c..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-all-expected.txt +++ /dev/null
@@ -1,30 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x496 - LayoutBlockFlow {HTML} at (0,0) size 800x496.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x469.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 90x22 - text run at (0,0) width 90: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x80 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 393x19 - text run at (0,0) width 393: "the 10px gray background is visible around the canvas content" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 152x19 - text run at (0,0) width 152: "has 5px solid red border" - LayoutListItem {LI} at (40,40) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 316x19 - text run at (0,0) width 316: "all the corners for border and padding are rounded" - LayoutListItem {LI} at (40,60) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 366x19 - text run at (0,0) width 366: "the bottom right corner of canvas content is NOT rounded" - LayoutBlockFlow (anonymous) at (0,137.72) size 784x332 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (28,176) size 287x287 - LayoutHTMLCanvas {CANVAS} at (20,20) size 287x287 [bgcolor=#808080] [border: (5px solid #FF0000)]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-border-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-border-expected.txt deleted file mode 100644 index d7b9334..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-border-expected.txt +++ /dev/null
@@ -1,26 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x426 - LayoutBlockFlow {HTML} at (0,0) size 800x426.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x399.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 90x22 - text run at (0,0) width 90: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x60 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 391x19 - text run at (0,0) width 391: "the canvas content has rounded corners (top-left and top-right)" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 351x19 - text run at (0,0) width 351: "the 10px red border is visible around the canvas content" - LayoutListItem {LI} at (40,40) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 156x19 - text run at (0,0) width 156: "gray border is not visible" - LayoutBlockFlow (anonymous) at (0,117.72) size 784x282 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,136) size 277x277 - LayoutHTMLCanvas {CANVAS} at (0,0) size 277x277 [bgcolor=#808080] [border: (10px solid #FF0000)]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-expected.txt deleted file mode 100644 index e96abbc..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-expected.txt +++ /dev/null
@@ -1,22 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x386 - LayoutBlockFlow {HTML} at (0,0) size 800x386.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x359.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 90x22 - text run at (0,0) width 90: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x40 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 415x19 - text run at (0,0) width 415: "the canvas content has rounded corners (top-left and bottom-right)" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 190x19 - text run at (0,0) width 190: "gray background is not visible" - LayoutBlockFlow (anonymous) at (0,97.72) size 784x262 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,116) size 257x257 - LayoutHTMLCanvas {CANVAS} at (0,0) size 257x257 [bgcolor=#808080]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-padding-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-padding-expected.txt deleted file mode 100644 index 5740e95..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-padding-expected.txt +++ /dev/null
@@ -1,22 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x406 - LayoutBlockFlow {HTML} at (0,0) size 800x406.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x379.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 90x22 - text run at (0,0) width 90: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x40 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 415x19 - text run at (0,0) width 415: "the canvas content has rounded corners (bottom-left and top-right)" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 393x19 - text run at (0,0) width 393: "the 10px gray background is visible around the canvas content" - LayoutBlockFlow (anonymous) at (0,97.72) size 784x282 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,116) size 277x277 - LayoutHTMLCanvas {CANVAS} at (0,0) size 277x277 [bgcolor=#808080]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-with-mask-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-with-mask-expected.txt deleted file mode 100644 index 7a9fc4b..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-with-mask-expected.txt +++ /dev/null
@@ -1,22 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x456 - LayoutBlockFlow {HTML} at (0,0) size 800x456.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x429.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 90x22 - text run at (0,0) width 90: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x40 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 297x19 - text run at (0,0) width 297: "the canvas element has a gradient mask applied" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 247x19 - text run at (0,0) width 247: "the canvas content has rounded corners" - LayoutBlockFlow (anonymous) at (0,97.72) size 784x332 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (28,136) size 287x287 transparent - LayoutHTMLCanvas {CANVAS} at (20,20) size 287x287 [bgcolor=#808080] [border: (5px solid #FF0000)]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-with-shadow-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-with-shadow-expected.txt deleted file mode 100644 index 81d3700..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-canvas-with-shadow-expected.txt +++ /dev/null
@@ -1,22 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x456 - LayoutBlockFlow {HTML} at (0,0) size 800x456.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x429.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 90x22 - text run at (0,0) width 90: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x40 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 305x19 - text run at (0,0) width 305: "the canvas element has 8px gray shadow around" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 247x19 - text run at (0,0) width 247: "the canvas content has rounded corners" - LayoutBlockFlow (anonymous) at (0,97.72) size 784x332 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (28,136) size 287x287 - LayoutHTMLCanvas {CANVAS} at (20,20) size 287x287 [bgcolor=#808080] [border: (5px solid #FF0000)]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-video-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-video-expected.txt deleted file mode 100644 index aa3bc626..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-video-expected.txt +++ /dev/null
@@ -1,26 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x354 - LayoutBlockFlow {HTML} at (0,0) size 800x354.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x327.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 90x22 - text run at (0,0) width 90: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x40 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 405x19 - text run at (0,0) width 405: "the video content has rounded corners (top left and bottom right)" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 190x19 - text run at (0,0) width 190: "gray background is not visible" - LayoutBlockFlow (anonymous) at (0,97.72) size 784x230 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,116) size 400x225 - LayoutVideo {VIDEO} at (0,0) size 400x225 [bgcolor=#808080] -layer at (8,116) size 400x225 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 400x225 - LayoutBlockFlow {DIV} at (0,193) size 400x32 -layer at (8,116) size 400x183 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 400x183
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-video-ratio-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-video-ratio-expected.txt deleted file mode 100644 index bf9fd120..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-video-ratio-expected.txt +++ /dev/null
@@ -1,26 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x354 - LayoutBlockFlow {HTML} at (0,0) size 800x354.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x327.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 90x22 - text run at (0,0) width 90: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x40 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 405x19 - text run at (0,0) width 405: "the video content has rounded corners (top left and bottom right)" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 471x19 - text run at (0,0) width 471: "the remaining space is gray and has same rounded corners as video content" - LayoutBlockFlow (anonymous) at (0,97.72) size 784x230 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,116) size 500x225 - LayoutVideo {VIDEO} at (0,0) size 500x225 [bgcolor=#808080] -layer at (8,116) size 500x225 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 500x225 - LayoutBlockFlow {DIV} at (0,193) size 500x32 -layer at (8,116) size 500x183 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 500x183
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-video-shadow-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-video-shadow-expected.txt deleted file mode 100644 index 224184f..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-mask-video-shadow-expected.txt +++ /dev/null
@@ -1,30 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x394 - LayoutBlockFlow {HTML} at (0,0) size 800x394.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x367.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 90x22 - text run at (0,0) width 90: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x60 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 405x19 - text run at (0,0) width 405: "the video content has rounded corners (top left and bottom right)" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 471x19 - text run at (0,0) width 471: "the remaining space is gray and has same rounded corners as video content" - LayoutListItem {LI} at (40,40) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 265x19 - text run at (0,0) width 265: "has box shadow around the video element" - LayoutBlockFlow (anonymous) at (0,117.72) size 784x250 - LayoutText {#text} at (0,0) size 0x0 -layer at (18,146) size 500x225 - LayoutVideo {VIDEO} at (10,10) size 500x225 [bgcolor=#808080] -layer at (18,146) size 500x225 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 500x225 - LayoutBlockFlow {DIV} at (0,193) size 500x32 -layer at (18,146) size 500x183 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 500x183
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-all-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-all-expected.txt deleted file mode 100644 index 0fe0fce..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-all-expected.txt +++ /dev/null
@@ -1,30 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x486 - LayoutBlockFlow {HTML} at (0,0) size 800x486.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x459.72 - LayoutBlockFlow {H3} at (0,0) size 784x22 - LayoutText {#text} at (0,0) size 91x22 - text run at (0,0) width 91: "It passes if:" - LayoutBlockFlow {UL} at (0,40.72) size 784x72 - LayoutListItem {LI} at (40,0) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 400x18 - text run at (0,0) width 400: "the 10px gray background is visible around the canvas content" - LayoutListItem {LI} at (40,18) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 155x18 - text run at (0,0) width 155: "has 5px solid red border" - LayoutListItem {LI} at (40,36) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 322x18 - text run at (0,0) width 322: "all the corners for border and padding are rounded" - LayoutListItem {LI} at (40,54) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 372x18 - text run at (0,0) width 372: "the bottom right corner of canvas content is NOT rounded" - LayoutBlockFlow (anonymous) at (0,128.72) size 784x331 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (28,167) size 287x287 - LayoutHTMLCanvas {CANVAS} at (20,20) size 287x287 [bgcolor=#808080] [border: (5px solid #FF0000)]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-border-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-border-expected.txt deleted file mode 100644 index bb83c72..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-border-expected.txt +++ /dev/null
@@ -1,26 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x418 - LayoutBlockFlow {HTML} at (0,0) size 800x418.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x391.72 - LayoutBlockFlow {H3} at (0,0) size 784x22 - LayoutText {#text} at (0,0) size 91x22 - text run at (0,0) width 91: "It passes if:" - LayoutBlockFlow {UL} at (0,40.72) size 784x54 - LayoutListItem {LI} at (40,0) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 400x18 - text run at (0,0) width 400: "the canvas content has rounded corners (top-left and top-right)" - LayoutListItem {LI} at (40,18) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 358x18 - text run at (0,0) width 358: "the 10px red border is visible around the canvas content" - LayoutListItem {LI} at (40,36) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 160x18 - text run at (0,0) width 160: "gray border is not visible" - LayoutBlockFlow (anonymous) at (0,110.72) size 784x281 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,129) size 277x277 - LayoutHTMLCanvas {CANVAS} at (0,0) size 277x277 [bgcolor=#808080] [border: (10px solid #FF0000)]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-expected.txt deleted file mode 100644 index 6230024..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-expected.txt +++ /dev/null
@@ -1,22 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x380 - LayoutBlockFlow {HTML} at (0,0) size 800x380.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x353.72 - LayoutBlockFlow {H3} at (0,0) size 784x22 - LayoutText {#text} at (0,0) size 91x22 - text run at (0,0) width 91: "It passes if:" - LayoutBlockFlow {UL} at (0,40.72) size 784x36 - LayoutListItem {LI} at (40,0) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 425x18 - text run at (0,0) width 425: "the canvas content has rounded corners (top-left and bottom-right)" - LayoutListItem {LI} at (40,18) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 194x18 - text run at (0,0) width 194: "gray background is not visible" - LayoutBlockFlow (anonymous) at (0,92.72) size 784x261 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,111) size 257x257 - LayoutHTMLCanvas {CANVAS} at (0,0) size 257x257 [bgcolor=#808080]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-padding-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-padding-expected.txt deleted file mode 100644 index 8cb7729e..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-padding-expected.txt +++ /dev/null
@@ -1,22 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x400 - LayoutBlockFlow {HTML} at (0,0) size 800x400.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x373.72 - LayoutBlockFlow {H3} at (0,0) size 784x22 - LayoutText {#text} at (0,0) size 91x22 - text run at (0,0) width 91: "It passes if:" - LayoutBlockFlow {UL} at (0,40.72) size 784x36 - LayoutListItem {LI} at (40,0) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 425x18 - text run at (0,0) width 425: "the canvas content has rounded corners (bottom-left and top-right)" - LayoutListItem {LI} at (40,18) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 400x18 - text run at (0,0) width 400: "the 10px gray background is visible around the canvas content" - LayoutBlockFlow (anonymous) at (0,92.72) size 784x281 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,111) size 277x277 - LayoutHTMLCanvas {CANVAS} at (0,0) size 277x277 [bgcolor=#808080]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-with-mask-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-with-mask-expected.txt deleted file mode 100644 index 1ad65df..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-with-mask-expected.txt +++ /dev/null
@@ -1,22 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x450 - LayoutBlockFlow {HTML} at (0,0) size 800x450.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x423.72 - LayoutBlockFlow {H3} at (0,0) size 784x22 - LayoutText {#text} at (0,0) size 91x22 - text run at (0,0) width 91: "It passes if:" - LayoutBlockFlow {UL} at (0,40.72) size 784x36 - LayoutListItem {LI} at (40,0) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 304x18 - text run at (0,0) width 304: "the canvas element has a gradient mask applied" - LayoutListItem {LI} at (40,18) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 252x18 - text run at (0,0) width 252: "the canvas content has rounded corners" - LayoutBlockFlow (anonymous) at (0,92.72) size 784x331 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (28,131) size 287x287 transparent - LayoutHTMLCanvas {CANVAS} at (20,20) size 287x287 [bgcolor=#808080] [border: (5px solid #FF0000)]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-with-shadow-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-with-shadow-expected.txt deleted file mode 100644 index 73b3b61b..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-canvas-with-shadow-expected.txt +++ /dev/null
@@ -1,22 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x450 - LayoutBlockFlow {HTML} at (0,0) size 800x450.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x423.72 - LayoutBlockFlow {H3} at (0,0) size 784x22 - LayoutText {#text} at (0,0) size 91x22 - text run at (0,0) width 91: "It passes if:" - LayoutBlockFlow {UL} at (0,40.72) size 784x36 - LayoutListItem {LI} at (40,0) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 309x18 - text run at (0,0) width 309: "the canvas element has 8px gray shadow around" - LayoutListItem {LI} at (40,18) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 252x18 - text run at (0,0) width 252: "the canvas content has rounded corners" - LayoutBlockFlow (anonymous) at (0,92.72) size 784x331 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (28,131) size 287x287 - LayoutHTMLCanvas {CANVAS} at (20,20) size 287x287 [bgcolor=#808080] [border: (5px solid #FF0000)]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-video-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-video-expected.txt deleted file mode 100644 index c05b74d3..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-video-expected.txt +++ /dev/null
@@ -1,26 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x348 - LayoutBlockFlow {HTML} at (0,0) size 800x348.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x321.72 - LayoutBlockFlow {H3} at (0,0) size 784x22 - LayoutText {#text} at (0,0) size 91x22 - text run at (0,0) width 91: "It passes if:" - LayoutBlockFlow {UL} at (0,40.72) size 784x36 - LayoutListItem {LI} at (40,0) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 415x18 - text run at (0,0) width 415: "the video content has rounded corners (top left and bottom right)" - LayoutListItem {LI} at (40,18) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 194x18 - text run at (0,0) width 194: "gray background is not visible" - LayoutBlockFlow (anonymous) at (0,92.72) size 784x229 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,111) size 400x225 - LayoutVideo {VIDEO} at (0,0) size 400x225 [bgcolor=#808080] -layer at (8,111) size 400x225 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 400x225 - LayoutBlockFlow {DIV} at (0,193) size 400x32 -layer at (8,111) size 400x183 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 400x183
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-video-ratio-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-video-ratio-expected.txt deleted file mode 100644 index a0b9c02f..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-video-ratio-expected.txt +++ /dev/null
@@ -1,26 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x348 - LayoutBlockFlow {HTML} at (0,0) size 800x348.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x321.72 - LayoutBlockFlow {H3} at (0,0) size 784x22 - LayoutText {#text} at (0,0) size 91x22 - text run at (0,0) width 91: "It passes if:" - LayoutBlockFlow {UL} at (0,40.72) size 784x36 - LayoutListItem {LI} at (40,0) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 415x18 - text run at (0,0) width 415: "the video content has rounded corners (top left and bottom right)" - LayoutListItem {LI} at (40,18) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 480x18 - text run at (0,0) width 480: "the remaining space is gray and has same rounded corners as video content" - LayoutBlockFlow (anonymous) at (0,92.72) size 784x229 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,111) size 500x225 - LayoutVideo {VIDEO} at (0,0) size 500x225 [bgcolor=#808080] -layer at (8,111) size 500x225 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 500x225 - LayoutBlockFlow {DIV} at (0,193) size 500x32 -layer at (8,111) size 500x183 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 500x183
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-video-shadow-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-video-shadow-expected.txt deleted file mode 100644 index 01e4a64..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-mask-video-shadow-expected.txt +++ /dev/null
@@ -1,30 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x386 - LayoutBlockFlow {HTML} at (0,0) size 800x386.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x359.72 - LayoutBlockFlow {H3} at (0,0) size 784x22 - LayoutText {#text} at (0,0) size 91x22 - text run at (0,0) width 91: "It passes if:" - LayoutBlockFlow {UL} at (0,40.72) size 784x54 - LayoutListItem {LI} at (40,0) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 415x18 - text run at (0,0) width 415: "the video content has rounded corners (top left and bottom right)" - LayoutListItem {LI} at (40,18) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 480x18 - text run at (0,0) width 480: "the remaining space is gray and has same rounded corners as video content" - LayoutListItem {LI} at (40,36) size 744x18 - LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet - LayoutText {#text} at (0,0) size 269x18 - text run at (0,0) width 269: "has box shadow around the video element" - LayoutBlockFlow (anonymous) at (0,110.72) size 784x249 - LayoutText {#text} at (0,0) size 0x0 -layer at (18,139) size 500x225 - LayoutVideo {VIDEO} at (10,10) size 500x225 [bgcolor=#808080] -layer at (18,139) size 500x225 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 500x225 - LayoutBlockFlow {DIV} at (0,193) size 500x32 -layer at (18,139) size 500x183 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 500x183
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-all-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-all-expected.txt deleted file mode 100644 index dac0b009..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-all-expected.txt +++ /dev/null
@@ -1,30 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x496 - LayoutBlockFlow {HTML} at (0,0) size 800x496.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x469.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 92x22 - text run at (0,0) width 92: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x80 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 374x19 - text run at (0,0) width 374: "the 10px gray background is visible around the canvas content" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 148x19 - text run at (0,0) width 148: "has 5px solid red border" - LayoutListItem {LI} at (40,40) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 305x19 - text run at (0,0) width 305: "all the corners for border and padding are rounded" - LayoutListItem {LI} at (40,60) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 351x19 - text run at (0,0) width 351: "the bottom right corner of canvas content is NOT rounded" - LayoutBlockFlow (anonymous) at (0,137.72) size 784x332 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (28,176) size 287x287 - LayoutHTMLCanvas {CANVAS} at (20,20) size 287x287 [bgcolor=#808080] [border: (5px solid #FF0000)]
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-border-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-border-expected.txt deleted file mode 100644 index 6e3d9c3e..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-border-expected.txt +++ /dev/null
@@ -1,26 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x426 - LayoutBlockFlow {HTML} at (0,0) size 800x426.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x399.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 92x22 - text run at (0,0) width 92: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x60 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 378x19 - text run at (0,0) width 378: "the canvas content has rounded corners (top-left and top-right)" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 337x19 - text run at (0,0) width 337: "the 10px red border is visible around the canvas content" - LayoutListItem {LI} at (40,40) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 148x19 - text run at (0,0) width 148: "gray border is not visible" - LayoutBlockFlow (anonymous) at (0,117.72) size 784x282 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,136) size 277x277 - LayoutHTMLCanvas {CANVAS} at (0,0) size 277x277 [bgcolor=#808080] [border: (10px solid #FF0000)]
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-expected.txt deleted file mode 100644 index cbafbf6..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-expected.txt +++ /dev/null
@@ -1,22 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x386 - LayoutBlockFlow {HTML} at (0,0) size 800x386.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x359.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 92x22 - text run at (0,0) width 92: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x40 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 401x19 - text run at (0,0) width 401: "the canvas content has rounded corners (top-left and bottom-right)" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 179x19 - text run at (0,0) width 179: "gray background is not visible" - LayoutBlockFlow (anonymous) at (0,97.72) size 784x262 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,116) size 257x257 - LayoutHTMLCanvas {CANVAS} at (0,0) size 257x257 [bgcolor=#808080]
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-padding-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-padding-expected.txt deleted file mode 100644 index c7dbd27..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-padding-expected.txt +++ /dev/null
@@ -1,22 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x406 - LayoutBlockFlow {HTML} at (0,0) size 800x406.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x379.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 92x22 - text run at (0,0) width 92: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x40 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 401x19 - text run at (0,0) width 401: "the canvas content has rounded corners (bottom-left and top-right)" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 374x19 - text run at (0,0) width 374: "the 10px gray background is visible around the canvas content" - LayoutBlockFlow (anonymous) at (0,97.72) size 784x282 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,116) size 277x277 - LayoutHTMLCanvas {CANVAS} at (0,0) size 277x277 [bgcolor=#808080]
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-with-mask-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-with-mask-expected.txt deleted file mode 100644 index 71ed891..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-with-mask-expected.txt +++ /dev/null
@@ -1,22 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x456 - LayoutBlockFlow {HTML} at (0,0) size 800x456.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x429.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 92x22 - text run at (0,0) width 92: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x40 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 284x19 - text run at (0,0) width 284: "the canvas element has a gradient mask applied" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 238x19 - text run at (0,0) width 238: "the canvas content has rounded corners" - LayoutBlockFlow (anonymous) at (0,97.72) size 784x332 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (28,136) size 287x287 transparent - LayoutHTMLCanvas {CANVAS} at (20,20) size 287x287 [bgcolor=#808080] [border: (5px solid #FF0000)]
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-with-shadow-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-with-shadow-expected.txt deleted file mode 100644 index 313fc892..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-canvas-with-shadow-expected.txt +++ /dev/null
@@ -1,22 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x456 - LayoutBlockFlow {HTML} at (0,0) size 800x456.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x429.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 92x22 - text run at (0,0) width 92: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x40 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 291x19 - text run at (0,0) width 291: "the canvas element has 8px gray shadow around" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 238x19 - text run at (0,0) width 238: "the canvas content has rounded corners" - LayoutBlockFlow (anonymous) at (0,97.72) size 784x332 - LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (0,0) size 0x0 -layer at (28,136) size 287x287 - LayoutHTMLCanvas {CANVAS} at (20,20) size 287x287 [bgcolor=#808080] [border: (5px solid #FF0000)]
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-video-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-video-expected.txt deleted file mode 100644 index 6a9f1b3..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-video-expected.txt +++ /dev/null
@@ -1,26 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x354 - LayoutBlockFlow {HTML} at (0,0) size 800x354.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x327.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 92x22 - text run at (0,0) width 92: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x40 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 389x19 - text run at (0,0) width 389: "the video content has rounded corners (top left and bottom right)" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 179x19 - text run at (0,0) width 179: "gray background is not visible" - LayoutBlockFlow (anonymous) at (0,97.72) size 784x230 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,116) size 400x225 - LayoutVideo {VIDEO} at (0,0) size 400x225 [bgcolor=#808080] -layer at (8,116) size 400x225 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 400x225 - LayoutBlockFlow {DIV} at (0,193) size 400x32 -layer at (8,116) size 400x183 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 400x183
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-video-ratio-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-video-ratio-expected.txt deleted file mode 100644 index d76dbb0..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-video-ratio-expected.txt +++ /dev/null
@@ -1,26 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x354 - LayoutBlockFlow {HTML} at (0,0) size 800x354.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x327.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 92x22 - text run at (0,0) width 92: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x40 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 389x19 - text run at (0,0) width 389: "the video content has rounded corners (top left and bottom right)" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 451x19 - text run at (0,0) width 451: "the remaining space is gray and has same rounded corners as video content" - LayoutBlockFlow (anonymous) at (0,97.72) size 784x230 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,116) size 500x225 - LayoutVideo {VIDEO} at (0,0) size 500x225 [bgcolor=#808080] -layer at (8,116) size 500x225 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 500x225 - LayoutBlockFlow {DIV} at (0,193) size 500x32 -layer at (8,116) size 500x183 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 500x183
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-video-shadow-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-video-shadow-expected.txt deleted file mode 100644 index c24a28a..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-mask-video-shadow-expected.txt +++ /dev/null
@@ -1,30 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x394 - LayoutBlockFlow {HTML} at (0,0) size 800x394.44 - LayoutBlockFlow {BODY} at (8,18.72) size 784x367.72 - LayoutBlockFlow {H3} at (0,0) size 784x23 - LayoutText {#text} at (0,0) size 92x22 - text run at (0,0) width 92: "It passes if:" - LayoutBlockFlow {UL} at (0,41.72) size 784x60 - LayoutListItem {LI} at (40,0) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 389x19 - text run at (0,0) width 389: "the video content has rounded corners (top left and bottom right)" - LayoutListItem {LI} at (40,20) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 451x19 - text run at (0,0) width 451: "the remaining space is gray and has same rounded corners as video content" - LayoutListItem {LI} at (40,40) size 744x20 - LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet - LayoutText {#text} at (0,0) size 253x19 - text run at (0,0) width 253: "has box shadow around the video element" - LayoutBlockFlow (anonymous) at (0,117.72) size 784x250 - LayoutText {#text} at (0,0) size 0x0 -layer at (18,146) size 500x225 - LayoutVideo {VIDEO} at (10,10) size 500x225 [bgcolor=#808080] -layer at (18,146) size 500x225 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 500x225 - LayoutBlockFlow {DIV} at (0,193) size 500x32 -layer at (18,146) size 500x183 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 500x183
diff --git a/third_party/WebKit/LayoutTests/virtual/display-lock/display-lock/README.txt b/third_party/WebKit/LayoutTests/virtual/display-lock/display-lock/README.txt new file mode 100644 index 0000000..1704d2b --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/display-lock/display-lock/README.txt
@@ -0,0 +1,2 @@ +This tests a display locking feature. It runs tests until display-lock directory +with --enable-blink-features=DisplayLocking flag.
diff --git a/third_party/blink/renderer/bindings/core/v8/BUILD.gn b/third_party/blink/renderer/bindings/core/v8/BUILD.gn index de8f9a8..d12c0db 100644 --- a/third_party/blink/renderer/bindings/core/v8/BUILD.gn +++ b/third_party/blink/renderer/bindings/core/v8/BUILD.gn
@@ -132,6 +132,8 @@ "$bindings_core_v8_output_dir/v8_blob_callback.h", "$bindings_core_v8_output_dir/v8_custom_element_constructor.cc", "$bindings_core_v8_output_dir/v8_custom_element_constructor.h", + "$bindings_core_v8_output_dir/v8_display_lock_callback.cc", + "$bindings_core_v8_output_dir/v8_display_lock_callback.h", "$bindings_core_v8_output_dir/v8_frame_request_callback.cc", "$bindings_core_v8_output_dir/v8_frame_request_callback.h", "$bindings_core_v8_output_dir/v8_function.cc",
diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn index 084832bb..160f1e5 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn
@@ -181,6 +181,7 @@ "//third_party/blink/renderer/core/clipboard", "//third_party/blink/renderer/core/context_features", "//third_party/blink/renderer/core/css", + "//third_party/blink/renderer/core/display_lock", "//third_party/blink/renderer/core/dom", "//third_party/blink/renderer/core/editing", "//third_party/blink/renderer/core/events",
diff --git a/third_party/blink/renderer/core/core_idl_files.gni b/third_party/blink/renderer/core/core_idl_files.gni index 3707776..4861186 100644 --- a/third_party/blink/renderer/core/core_idl_files.gni +++ b/third_party/blink/renderer/core/core_idl_files.gni
@@ -100,6 +100,7 @@ "css/cssom/css_variable_reference_value.idl", "css/cssom/style_property_map.idl", "css/cssom/style_property_map_read_only.idl", + "display_lock/display_lock_context.idl", "dom/abort_controller.idl", "dom/abort_signal.idl", "dom/attr.idl",
diff --git a/third_party/blink/renderer/core/display_lock/BUILD.gn b/third_party/blink/renderer/core/display_lock/BUILD.gn new file mode 100644 index 0000000..85c2a60 --- /dev/null +++ b/third_party/blink/renderer/core/display_lock/BUILD.gn
@@ -0,0 +1,16 @@ +# Copyright 2018 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("//third_party/blink/renderer/core/core.gni") + +blink_core_sources("display_lock") { + sources = [ + "display_lock_context.cc", + "display_lock_context.h", + ] + + public_deps = [ + "//third_party/blink/renderer/bindings/core/v8:bindings_core_v8_generated", + ] +}
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_context.cc b/third_party/blink/renderer/core/display_lock/display_lock_context.cc new file mode 100644 index 0000000..fd35164e --- /dev/null +++ b/third_party/blink/renderer/core/display_lock/display_lock_context.cc
@@ -0,0 +1,18 @@ +// Copyright 2018 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 "third_party/blink/renderer/core/display_lock/display_lock_context.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_display_lock_callback.h" + +namespace blink { + +DisplayLockContext::~DisplayLockContext() {} + +void DisplayLockContext::Dispose() {} + +void DisplayLockContext::schedule(V8DisplayLockCallback* callback) { + callback->InvokeAndReportException(nullptr, this); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_context.h b/third_party/blink/renderer/core/display_lock/display_lock_context.h new file mode 100644 index 0000000..0d4087bf --- /dev/null +++ b/third_party/blink/renderer/core/display_lock/display_lock_context.h
@@ -0,0 +1,28 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DISPLAY_LOCK_DISPLAY_LOCK_CONTEXT_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_DISPLAY_LOCK_DISPLAY_LOCK_CONTEXT_H_ + +#include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/platform/bindings/script_wrappable.h" + +namespace blink { + +class V8DisplayLockCallback; +class CORE_EXPORT DisplayLockContext final : public ScriptWrappable { + DEFINE_WRAPPERTYPEINFO(); + + public: + DisplayLockContext() = default; + ~DisplayLockContext() override; + + void Dispose(); + + void schedule(V8DisplayLockCallback*); +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_DISPLAY_LOCK_DISPLAY_LOCK_CONTEXT_H_
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_context.idl b/third_party/blink/renderer/core/display_lock/display_lock_context.idl new file mode 100644 index 0000000..67171c7e --- /dev/null +++ b/third_party/blink/renderer/core/display_lock/display_lock_context.idl
@@ -0,0 +1,9 @@ +// Copyright 2018 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. + +[RuntimeEnabled=DisplayLocking] callback DisplayLockCallback = void(DisplayLockContext context); +[RuntimeEnabled=DisplayLocking] interface DisplayLockContext { + void schedule(DisplayLockCallback callback); +}; +
diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc index 2dc09c3..56411f9 100644 --- a/third_party/blink/renderer/core/dom/element.cc +++ b/third_party/blink/renderer/core/dom/element.cc
@@ -36,6 +36,7 @@ #include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_script.h" #include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_script_url.h" #include "third_party/blink/renderer/bindings/core/v8/usv_string_or_trusted_url.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_display_lock_callback.h" #include "third_party/blink/renderer/core/accessibility/ax_context.h" #include "third_party/blink/renderer/core/accessibility/ax_object_cache.h" #include "third_party/blink/renderer/core/animation/css/css_animations.h" @@ -55,6 +56,7 @@ #include "third_party/blink/renderer/core/css/style_change_reason.h" #include "third_party/blink/renderer/core/css/style_engine.h" #include "third_party/blink/renderer/core/css_value_keywords.h" +#include "third_party/blink/renderer/core/display_lock/display_lock_context.h" #include "third_party/blink/renderer/core/dom/attr.h" #include "third_party/blink/renderer/core/dom/dataset_dom_string_map.h" #include "third_party/blink/renderer/core/dom/document.h" @@ -3712,6 +3714,18 @@ GetScrollCustomizationCallbacks().SetInScrollPhase(this, false); } +ScriptPromise Element::acquireDisplayLock(ScriptState* script_state, + V8DisplayLockCallback* callback) { + // For now, just invoke the callback, and resolve the promise immediately. + // TODO(vmpstr): Finish implementation. + callback->InvokeAndReportException(nullptr, new DisplayLockContext); + + auto* resolver = ScriptPromiseResolver::Create(script_state); + const auto& promise = resolver->Promise(); + resolver->Resolve(); + return promise; +} + // Step 1 of http://domparsing.spec.whatwg.org/#insertadjacenthtml() static Element* ContextElementForInsertion(const String& where, Element* element,
diff --git a/third_party/blink/renderer/core/dom/element.h b/third_party/blink/renderer/core/dom/element.h index f2f4183d..36d8ccd 100644 --- a/third_party/blink/renderer/core/dom/element.h +++ b/third_party/blink/renderer/core/dom/element.h
@@ -26,6 +26,7 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_ELEMENT_H_ #include "third_party/blink/public/platform/web_focus_type.h" +#include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/css/css_primitive_value.h" #include "third_party/blink/renderer/core/css/css_selector.h" @@ -87,6 +88,7 @@ class StylePropertyMapReadOnly; class USVStringOrTrustedURL; class V0CustomElementDefinition; +class V8DisplayLockCallback; class V8ScrollStateCallback; enum SpellcheckAttributeState { @@ -906,6 +908,8 @@ void WillBeginCustomizedScrollPhase(ScrollCustomization::ScrollDirection); void DidEndCustomizedScrollPhase(); + ScriptPromise acquireDisplayLock(ScriptState*, V8DisplayLockCallback*); + protected: Element(const QualifiedName& tag_name, Document*, ConstructionType);
diff --git a/third_party/blink/renderer/core/dom/element.idl b/third_party/blink/renderer/core/dom/element.idl index fc5c899..a1e311a 100644 --- a/third_party/blink/renderer/core/dom/element.idl +++ b/third_party/blink/renderer/core/dom/element.idl
@@ -142,6 +142,9 @@ attribute EventHandler onbeforecut; attribute EventHandler onbeforepaste; attribute EventHandler onsearch; + + // Display locking. + [RuntimeEnabled=DisplayLocking, CallWith=ScriptState] Promise acquireDisplayLock(DisplayLockCallback callback); }; Element implements ParentNode;
diff --git a/third_party/blink/renderer/core/dom/events/custom_event.cc b/third_party/blink/renderer/core/dom/events/custom_event.cc index d79af10b..902d22a3 100644 --- a/third_party/blink/renderer/core/dom/events/custom_event.cc +++ b/third_party/blink/renderer/core/dom/events/custom_event.cc
@@ -25,6 +25,8 @@ #include "third_party/blink/renderer/core/dom/events/custom_event.h" +#include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" +#include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value_factory.h" #include "third_party/blink/renderer/core/event_names.h" namespace blink { @@ -34,9 +36,12 @@ CustomEvent::CustomEvent(ScriptState* script_state, const AtomicString& type, const CustomEventInit& initializer) - : Event(type, initializer), - detail_(initializer.hasDetail() ? initializer.detail() - : ScriptValue::CreateNull(script_state)) { + : Event(type, initializer) { + world_ = WrapRefCounted(&script_state->World()); + if (initializer.hasDetail()) { + detail_.Set(initializer.detail().GetIsolate(), + initializer.detail().V8Value()); + } } CustomEvent::~CustomEvent() = default; @@ -47,14 +52,23 @@ bool cancelable, const ScriptValue& script_value) { initEvent(type, bubbles, cancelable); + world_ = WrapRefCounted(&script_state->World()); if (!IsBeingDispatched() && !script_value.IsEmpty()) - detail_ = script_value; - else - detail_ = ScriptValue::CreateNull(script_state); + detail_.Set(script_value.GetIsolate(), script_value.V8Value()); } ScriptValue CustomEvent::detail(ScriptState* script_state) const { - return ScriptValue(script_state, detail_.V8ValueFor(script_state)); + v8::Isolate* isolate = script_state->GetIsolate(); + if (detail_.IsEmpty()) + return ScriptValue(script_state, v8::Null(isolate)); + // Returns a clone of |detail_| if the world is different. + if (!world_ || world_->GetWorldId() != script_state->World().GetWorldId()) { + v8::Local<v8::Value> value = detail_.NewLocal(isolate); + scoped_refptr<SerializedScriptValue> serialized = + SerializedScriptValue::SerializeAndSwallowExceptions(isolate, value); + return ScriptValue(script_state, serialized->Deserialize(isolate)); + } + return ScriptValue(script_state, detail_.NewLocal(isolate)); } const AtomicString& CustomEvent::InterfaceName() const { @@ -62,6 +76,7 @@ } void CustomEvent::Trace(blink::Visitor* visitor) { + visitor->Trace(detail_); Event::Trace(visitor); }
diff --git a/third_party/blink/renderer/core/dom/events/custom_event.h b/third_party/blink/renderer/core/dom/events/custom_event.h index e0db9e5..72c81b2 100644 --- a/third_party/blink/renderer/core/dom/events/custom_event.h +++ b/third_party/blink/renderer/core/dom/events/custom_event.h
@@ -26,10 +26,11 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_CUSTOM_EVENT_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_CUSTOM_EVENT_H_ -#include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/dom/events/custom_event_init.h" #include "third_party/blink/renderer/core/dom/events/event.h" +#include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h" +#include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" namespace blink { @@ -64,7 +65,9 @@ CustomEvent(ScriptState*, const AtomicString& type, const CustomEventInit& initializer); - ScriptValue detail_; + + scoped_refptr<DOMWrapperWorld> world_; + TraceWrapperV8Reference<v8::Value> detail_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc index 6df0cc2..419ffb2 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -427,6 +427,7 @@ if (!result.GetScrollbar() && hit_node && hit_node->GetLayoutObject() && hit_node->GetLayoutObject()->IsEmbeddedObject()) { mouse_capture_node_ = hit_node; + page_->DeprecatedLocalMainFrame()->Client()->SetMouseCapture(true); TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this); } } @@ -1847,6 +1848,8 @@ void WebViewImpl::MouseCaptureLost() { TRACE_EVENT_ASYNC_END0("input", "capturing mouse", this); mouse_capture_node_ = nullptr; + if (page_->DeprecatedLocalMainFrame()) + page_->DeprecatedLocalMainFrame()->Client()->SetMouseCapture(false); } void WebViewImpl::SetFocus(bool enable) {
diff --git a/third_party/blink/renderer/core/paint/find_paint_offset_and_visual_rect_needing_update.h b/third_party/blink/renderer/core/paint/find_paint_offset_and_visual_rect_needing_update.h index 4df507f..ae53517 100644 --- a/third_party/blink/renderer/core/paint/find_paint_offset_and_visual_rect_needing_update.h +++ b/third_party/blink/renderer/core/paint/find_paint_offset_and_visual_rect_needing_update.h
@@ -8,7 +8,6 @@ #if DCHECK_IS_ON() #include "third_party/blink/renderer/core/layout/layout_object.h" -#include "third_party/blink/renderer/core/paint/find_properties_needing_update.h" #include "third_party/blink/renderer/core/paint/object_paint_invalidator.h" #include "third_party/blink/renderer/core/paint/paint_invalidator.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" @@ -32,10 +31,11 @@ fragment_data_(fragment_data), is_actually_needed_(is_actually_needed), old_paint_offset_(fragment_data.PaintOffset()) { - auto* properties = fragment_data.PaintProperties(); - if (properties && properties->PaintOffsetTranslation()) { - old_paint_offset_translation_ = - properties->PaintOffsetTranslation()->Clone(); + if (const auto* properties = fragment_data.PaintProperties()) { + if (const auto* translation = properties->PaintOffsetTranslation()) { + old_parent_ = translation->Parent(); + old_translation_ = translation->Matrix(); + } } } @@ -43,12 +43,20 @@ if (is_actually_needed_) return; LayoutPoint paint_offset = fragment_data_.PaintOffset(); - DCHECK_OBJECT_PROPERTY_EQ(object_, &old_paint_offset_, &paint_offset); - auto* paint_properties = fragment_data_.PaintProperties(); - const auto* paint_offset_translation = - paint_properties ? paint_properties->PaintOffsetTranslation() : nullptr; - DCHECK_OBJECT_PROPERTY_EQ(object_, old_paint_offset_translation_.get(), - paint_offset_translation); + DCHECK_EQ(old_paint_offset_, paint_offset) << object_.DebugName(); + + const TransformPaintPropertyNode* new_parent = nullptr; + base::Optional<TransformationMatrix> new_translation; + if (const auto* properties = fragment_data_.PaintProperties()) { + if (const auto* translation = properties->PaintOffsetTranslation()) { + new_parent = translation->Parent(); + new_translation = translation->Matrix(); + } + } + DCHECK_EQ(!!old_translation_, !!new_translation) << object_.DebugName(); + DCHECK_EQ(old_parent_, new_parent) << object_.DebugName(); + if (old_translation_ && new_translation) + DCHECK_EQ(*old_translation_, *new_translation) << object_.DebugName(); } private: @@ -56,7 +64,8 @@ const FragmentData& fragment_data_; const bool& is_actually_needed_; LayoutPoint old_paint_offset_; - scoped_refptr<TransformPaintPropertyNode> old_paint_offset_translation_; + const TransformPaintPropertyNode* old_parent_ = nullptr; + base::Optional<TransformationMatrix> old_translation_; }; class FindVisualRectNeedingUpdateScopeBase {
diff --git a/third_party/blink/renderer/core/paint/find_properties_needing_update.h b/third_party/blink/renderer/core/paint/find_properties_needing_update.h index 2d7370e..31832e2 100644 --- a/third_party/blink/renderer/core/paint/find_properties_needing_update.h +++ b/third_party/blink/renderer/core/paint/find_properties_needing_update.h
@@ -26,41 +26,15 @@ // causes object paint properties to DCHECK that property values are not // changed. -#define DUMP_PROPERTIES(original, updated) \ - "\nOriginal:\n" \ - << (original ? (original)->ToString().Ascii().data() : "null") \ - << "\nUpdated:\n" \ - << (updated ? (updated)->ToString().Ascii().data() : "null") - -#define CHECK_PROPERTY_EQ(thing, original, updated) \ - do { \ - DCHECK(!!original == !!updated) \ - << "Property was created or deleted " \ - << "without " << thing << " needing a paint property update." \ - << DUMP_PROPERTIES(original, updated); \ - if (!!original && !!updated) { \ - DCHECK(*original == *updated) \ - << "Property was updated without " << thing \ - << " needing a paint property update." \ - << DUMP_PROPERTIES(original, updated); \ - } \ - } while (0) - -#define DCHECK_OBJECT_PROPERTY_EQ(object, original, updated) \ - CHECK_PROPERTY_EQ("the layout object (" << object.DebugName() << ")", \ - original, updated) - -class FindObjectPropertiesNeedingUpdateScope { +class FindPropertiesNeedingUpdateScope { public: - FindObjectPropertiesNeedingUpdateScope(const LayoutObject& object, - const FragmentData& fragment_data, - bool force_subtree_update) + FindPropertiesNeedingUpdateScope(const LayoutObject& object, + const FragmentData& fragment_data, + bool force_subtree_update) : object_(object), fragment_data_(fragment_data), needed_paint_property_update_(object.NeedsPaintPropertyUpdate()), - needed_forced_subtree_update_(force_subtree_update), - original_paint_offset_(fragment_data.PaintOffset()) { - // No need to check if an update was already needed. + needed_forced_subtree_update_(force_subtree_update) { if (needed_paint_property_update_ || needed_forced_subtree_update_) return; @@ -80,13 +54,7 @@ } } - ~FindObjectPropertiesNeedingUpdateScope() { - // Paint offset and paintOffsetTranslation should not change under - // FindObjectPropertiesNeedingUpdateScope no matter if we needed paint - // property update. - LayoutPoint paint_offset = fragment_data_.PaintOffset(); - DCHECK_OBJECT_PROPERTY_EQ(object_, &original_paint_offset_, &paint_offset); - + ~FindPropertiesNeedingUpdateScope() { // No need to check if an update was already needed. if (needed_paint_property_update_ || needed_forced_subtree_update_) return; @@ -103,19 +71,19 @@ if (original_local_border_box_properties_ && fragment_data_.HasLocalBorderBoxProperties()) { const auto object_border_box = fragment_data_.LocalBorderBoxProperties(); - DCHECK_OBJECT_PROPERTY_EQ( - object_, original_local_border_box_properties_->Transform(), - object_border_box.Transform()); - DCHECK_OBJECT_PROPERTY_EQ(object_, - original_local_border_box_properties_->Clip(), - object_border_box.Clip()); - DCHECK_OBJECT_PROPERTY_EQ(object_, - original_local_border_box_properties_->Effect(), - object_border_box.Effect()); + DCHECK_EQ(original_local_border_box_properties_->Transform(), + object_border_box.Transform()) + << object_.DebugName(); + DCHECK_EQ(original_local_border_box_properties_->Clip(), + object_border_box.Clip()) + << object_.DebugName(); + DCHECK_EQ(original_local_border_box_properties_->Effect(), + object_border_box.Effect()) + << object_.DebugName(); } else { DCHECK_EQ(!!original_local_border_box_properties_, fragment_data_.HasLocalBorderBoxProperties()) - << " Object: " << object_.DebugName(); + << object_.DebugName(); } // Restore original clean bit. @@ -127,7 +95,6 @@ const FragmentData& fragment_data_; bool needed_paint_property_update_ = false; bool needed_forced_subtree_update_ = false; - LayoutPoint original_paint_offset_; std::unique_ptr<const PropertyTreeState> original_local_border_box_properties_; bool had_original_properties_ = false;
diff --git a/third_party/blink/renderer/core/paint/object_paint_properties.h b/third_party/blink/renderer/core/paint/object_paint_properties.h index 325cd9ac..4c2f4b3 100644 --- a/third_party/blink/renderer/core/paint/object_paint_properties.h +++ b/third_party/blink/renderer/core/paint/object_paint_properties.h
@@ -124,12 +124,11 @@ // or InlineBox's PhysicalLocation()) in this space, we should add // ScrollOrigin() to the offset. // - // ... +-[ TransformIsolationNode ] This serves as a parent to subtree - // transforms on an element with paint - // containment. It induces a - // paintOffsetTranslationNode and is the - // deepest child of any transform tree on - // the contain: paint element. + // ... +-[ TransformIsolationNode ] + // This serves as a parent to subtree transforms on an element with + // paint containment. It induces a PaintOffsetTranslation node and + // is the deepest child of any transform tree on the contain: paint + // element. ADD_TRANSFORM(PaintOffsetTranslation, paint_offset_translation_); ADD_TRANSFORM(StickyTranslation, sticky_translation_); ADD_TRANSFORM(Transform, transform_);
diff --git a/third_party/blink/renderer/core/paint/paint_property_tree_builder.cc b/third_party/blink/renderer/core/paint/paint_property_tree_builder.cc index 4b864024..625689f7 100644 --- a/third_party/blink/renderer/core/paint/paint_property_tree_builder.cc +++ b/third_party/blink/renderer/core/paint/paint_property_tree_builder.cc
@@ -479,26 +479,26 @@ ->GetScrollableArea() ->GetStickyConstraintsMap() .at(layer); - CompositorStickyConstraint& constraint = state.sticky_constraint; - constraint.is_sticky = true; - constraint.is_anchored_left = layout_constraint.is_anchored_left; - constraint.is_anchored_right = layout_constraint.is_anchored_right; - constraint.is_anchored_top = layout_constraint.is_anchored_top; - constraint.is_anchored_bottom = layout_constraint.is_anchored_bottom; - constraint.left_offset = layout_constraint.left_offset; - constraint.right_offset = layout_constraint.right_offset; - constraint.top_offset = layout_constraint.top_offset; - constraint.bottom_offset = layout_constraint.bottom_offset; - constraint.constraint_box_rect = + auto constraint = std::make_unique<CompositorStickyConstraint>(); + constraint->is_sticky = true; + constraint->is_anchored_left = layout_constraint.is_anchored_left; + constraint->is_anchored_right = layout_constraint.is_anchored_right; + constraint->is_anchored_top = layout_constraint.is_anchored_top; + constraint->is_anchored_bottom = layout_constraint.is_anchored_bottom; + constraint->left_offset = layout_constraint.left_offset; + constraint->right_offset = layout_constraint.right_offset; + constraint->top_offset = layout_constraint.top_offset; + constraint->bottom_offset = layout_constraint.bottom_offset; + constraint->constraint_box_rect = box_model.ComputeStickyConstrainingRect(); - constraint.scroll_container_relative_sticky_box_rect = RoundedIntRect( + constraint->scroll_container_relative_sticky_box_rect = RoundedIntRect( layout_constraint.scroll_container_relative_sticky_box_rect); constraint - .scroll_container_relative_containing_block_rect = RoundedIntRect( + ->scroll_container_relative_containing_block_rect = RoundedIntRect( layout_constraint.scroll_container_relative_containing_block_rect); if (PaintLayer* sticky_box_shifting_ancestor = layout_constraint.nearest_sticky_layer_shifting_sticky_box) { - constraint.nearest_element_shifting_sticky_box = + constraint->nearest_element_shifting_sticky_box = CompositorElementIdFromUniqueObjectId( sticky_box_shifting_ancestor->GetLayoutObject().UniqueId(), CompositorElementIdNamespace::kStickyTranslation); @@ -506,12 +506,13 @@ if (PaintLayer* containing_block_shifting_ancestor = layout_constraint .nearest_sticky_layer_shifting_containing_block) { - constraint.nearest_element_shifting_containing_block = + constraint->nearest_element_shifting_containing_block = CompositorElementIdFromUniqueObjectId( containing_block_shifting_ancestor->GetLayoutObject() .UniqueId(), CompositorElementIdNamespace::kStickyTranslation); } + state.sticky_constraint = std::move(constraint); } OnUpdate(properties_->UpdateStickyTranslation(*context_.current.transform, @@ -2073,11 +2074,6 @@ void FragmentPaintPropertyTreeBuilder::UpdateForObjectLocationAndSize( base::Optional<IntPoint>& paint_offset_translation) { -#if DCHECK_IS_ON() - FindPaintOffsetNeedingUpdateScope check_scope( - object_, fragment_data_, full_context_.is_actually_needed); -#endif - context_.old_paint_offset = fragment_data_.PaintOffset(); UpdatePaintOffset(); UpdateForPaintOffsetTranslation(paint_offset_translation); @@ -2129,6 +2125,11 @@ } void FragmentPaintPropertyTreeBuilder::UpdateForSelf() { +#if DCHECK_IS_ON() + FindPaintOffsetNeedingUpdateScope check_paint_offset( + object_, fragment_data_, full_context_.is_actually_needed); +#endif + // This is not in FindObjectPropertiesNeedingUpdateScope because paint offset // can change without NeedsPaintPropertyUpdate. base::Optional<IntPoint> paint_offset_translation; @@ -2138,13 +2139,20 @@ UpdateClipPathCache(); if (properties_) { - // TODO(wangxianzhu): Put these in FindObjectPropertiesNeedingUpdateScope. - UpdateFragmentClip(); + { +#if DCHECK_IS_ON() + FindPropertiesNeedingUpdateScope check_fragment_clip( + object_, fragment_data_, full_context_.force_subtree_update_reasons); +#endif + UpdateFragmentClip(); + } + // Update of PaintOffsetTranslation is checked by + // FindPaintOffsetNeedingUpdateScope. UpdatePaintOffsetTranslation(paint_offset_translation); } #if DCHECK_IS_ON() - FindObjectPropertiesNeedingUpdateScope check_needs_update_scope( + FindPropertiesNeedingUpdateScope check_paint_properties( object_, fragment_data_, full_context_.force_subtree_update_reasons); #endif @@ -2164,7 +2172,12 @@ void FragmentPaintPropertyTreeBuilder::UpdateForChildren() { #if DCHECK_IS_ON() - FindObjectPropertiesNeedingUpdateScope check_needs_update_scope( + // Paint offset should not change during this function. + const bool needs_paint_offset_update = false; + FindPaintOffsetNeedingUpdateScope check_paint_offset( + object_, fragment_data_, needs_paint_offset_update); + + FindPropertiesNeedingUpdateScope check_paint_properties( object_, fragment_data_, full_context_.force_subtree_update_reasons); #endif
diff --git a/third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc b/third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc index 79372c1d..1e75f70 100644 --- a/third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc +++ b/third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc
@@ -6222,44 +6222,50 @@ ASSERT_TRUE(outer_properties && outer_properties->StickyTranslation()); EXPECT_EQ(TransformationMatrix().Translate(0, 60), outer_properties->StickyTranslation()->Matrix()); + ASSERT_NE(nullptr, + outer_properties->StickyTranslation()->GetStickyConstraint()); EXPECT_TRUE( - outer_properties->StickyTranslation()->GetStickyConstraint().is_sticky); + outer_properties->StickyTranslation()->GetStickyConstraint()->is_sticky); EXPECT_EQ(CompositorElementId(), outer_properties->StickyTranslation() ->GetStickyConstraint() - .nearest_element_shifting_sticky_box); + ->nearest_element_shifting_sticky_box); EXPECT_EQ(CompositorElementId(), outer_properties->StickyTranslation() ->GetStickyConstraint() - .nearest_element_shifting_containing_block); + ->nearest_element_shifting_containing_block); const auto* middle_properties = PaintPropertiesForElement("middle"); ASSERT_TRUE(middle_properties && middle_properties->StickyTranslation()); EXPECT_EQ(TransformationMatrix().Translate(0, 15), middle_properties->StickyTranslation()->Matrix()); + ASSERT_NE(nullptr, + middle_properties->StickyTranslation()->GetStickyConstraint()); EXPECT_TRUE( - middle_properties->StickyTranslation()->GetStickyConstraint().is_sticky); + middle_properties->StickyTranslation()->GetStickyConstraint()->is_sticky); EXPECT_EQ(CompositorElementId(), middle_properties->StickyTranslation() ->GetStickyConstraint() - .nearest_element_shifting_sticky_box); + ->nearest_element_shifting_sticky_box); EXPECT_EQ(outer_properties->StickyTranslation()->GetCompositorElementId(), middle_properties->StickyTranslation() ->GetStickyConstraint() - .nearest_element_shifting_containing_block); + ->nearest_element_shifting_containing_block); const auto* inner_properties = PaintPropertiesForElement("inner"); ASSERT_TRUE(inner_properties && inner_properties->StickyTranslation()); EXPECT_EQ(TransformationMatrix().Translate(0, 20), inner_properties->StickyTranslation()->Matrix()); + ASSERT_NE(nullptr, + inner_properties->StickyTranslation()->GetStickyConstraint()); EXPECT_TRUE( - inner_properties->StickyTranslation()->GetStickyConstraint().is_sticky); + inner_properties->StickyTranslation()->GetStickyConstraint()->is_sticky); EXPECT_EQ(middle_properties->StickyTranslation()->GetCompositorElementId(), inner_properties->StickyTranslation() ->GetStickyConstraint() - .nearest_element_shifting_sticky_box); + ->nearest_element_shifting_sticky_box); EXPECT_EQ(outer_properties->StickyTranslation()->GetCompositorElementId(), inner_properties->StickyTranslation() ->GetStickyConstraint() - .nearest_element_shifting_containing_block); + ->nearest_element_shifting_containing_block); } TEST_P(PaintPropertyTreeBuilderTest, NonScrollableSticky) { @@ -6285,22 +6291,22 @@ ASSERT_TRUE(outer_properties && outer_properties->StickyTranslation()); EXPECT_EQ(TransformationMatrix().Translate(0, 60), outer_properties->StickyTranslation()->Matrix()); - EXPECT_FALSE( - outer_properties->StickyTranslation()->GetStickyConstraint().is_sticky); + EXPECT_EQ(nullptr, + outer_properties->StickyTranslation()->GetStickyConstraint()); const auto* middle_properties = PaintPropertiesForElement("middle"); ASSERT_TRUE(middle_properties && middle_properties->StickyTranslation()); EXPECT_EQ(TransformationMatrix().Translate(0, 15), middle_properties->StickyTranslation()->Matrix()); - EXPECT_FALSE( - middle_properties->StickyTranslation()->GetStickyConstraint().is_sticky); + EXPECT_EQ(nullptr, + middle_properties->StickyTranslation()->GetStickyConstraint()); const auto* inner_properties = PaintPropertiesForElement("inner"); ASSERT_TRUE(inner_properties && inner_properties->StickyTranslation()); EXPECT_EQ(TransformationMatrix().Translate(0, 20), inner_properties->StickyTranslation()->Matrix()); - EXPECT_FALSE( - inner_properties->StickyTranslation()->GetStickyConstraint().is_sticky); + EXPECT_EQ(nullptr, + inner_properties->StickyTranslation()->GetStickyConstraint()); } TEST_P(PaintPropertyTreeBuilderTest, WillChangeOpacityInducesAnEffectNode) {
diff --git a/third_party/blink/renderer/devtools/front_end/sdk/HARLog.js b/third_party/blink/renderer/devtools/front_end/sdk/HARLog.js index 643d66c..e39b3fe 100644 --- a/third_party/blink/renderer/devtools/front_end/sdk/HARLog.js +++ b/third_party/blink/renderer/devtools/front_end/sdk/HARLog.js
@@ -303,7 +303,7 @@ result.wait = waitEnd - waitStart; const receiveStart = waitEnd; - const receiveEnd = SDK.HARLog.Entry._toMilliseconds(this._request.endTime - issueTime); + const receiveEnd = SDK.HARLog.Entry._toMilliseconds(this._request.endTime - requestTime); result.receive = Math.max(receiveEnd - receiveStart, 0); return result;
diff --git a/third_party/blink/renderer/modules/wake_lock/DEPS b/third_party/blink/renderer/modules/wake_lock/DEPS index 23424fb8..5f009fc2 100644 --- a/third_party/blink/renderer/modules/wake_lock/DEPS +++ b/third_party/blink/renderer/modules/wake_lock/DEPS
@@ -3,5 +3,6 @@ "+services/device/public/mojom", "+services/device/public/interfaces/constants.mojom-blink.h", "+services/device/public/mojom/wake_lock.mojom-blink.h", + "+services/device/public/mojom/wake_lock_provider.mojom-blink.h", "+third_party/blink/renderer/modules/event_target_modules.h", ]
diff --git a/third_party/blink/renderer/modules/wake_lock/navigator_wake_lock.cc b/third_party/blink/renderer/modules/wake_lock/navigator_wake_lock.cc index 43671330..58ea962f 100644 --- a/third_party/blink/renderer/modules/wake_lock/navigator_wake_lock.cc +++ b/third_party/blink/renderer/modules/wake_lock/navigator_wake_lock.cc
@@ -27,11 +27,14 @@ ScriptPromise NavigatorWakeLock::getWakeLock(ScriptState* script_state, String lock_type) { - // TODO(crbug.com/873030): Handle 'system' Wake Lock if (lock_type == "screen") { if (!wake_lock_screen_) wake_lock_screen_ = WakeLock::CreateScreenWakeLock(script_state); return wake_lock_screen_->GetPromise(script_state); + } else if (lock_type == "system") { + if (!wake_lock_system_) + wake_lock_system_ = WakeLock::CreateSystemWakeLock(script_state); + return wake_lock_system_->GetPromise(script_state); } return ScriptPromise::RejectWithDOMException( @@ -51,6 +54,7 @@ void NavigatorWakeLock::Trace(blink::Visitor* visitor) { visitor->Trace(wake_lock_screen_); + visitor->Trace(wake_lock_system_); Supplement<Navigator>::Trace(visitor); }
diff --git a/third_party/blink/renderer/modules/wake_lock/navigator_wake_lock.h b/third_party/blink/renderer/modules/wake_lock/navigator_wake_lock.h index 1ffe09e..f6d0c18 100644 --- a/third_party/blink/renderer/modules/wake_lock/navigator_wake_lock.h +++ b/third_party/blink/renderer/modules/wake_lock/navigator_wake_lock.h
@@ -33,6 +33,7 @@ explicit NavigatorWakeLock(Navigator&); Member<WakeLock> wake_lock_screen_; + Member<WakeLock> wake_lock_system_; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/wake_lock/wake_lock.cc b/third_party/blink/renderer/modules/wake_lock/wake_lock.cc index 4be2b882..f1947eb 100644 --- a/third_party/blink/renderer/modules/wake_lock/wake_lock.cc +++ b/third_party/blink/renderer/modules/wake_lock/wake_lock.cc
@@ -5,6 +5,8 @@ #include "third_party/blink/renderer/modules/wake_lock/wake_lock.h" #include "services/device/public/mojom/constants.mojom-blink.h" +#include "services/device/public/mojom/wake_lock_provider.mojom-blink.h" +#include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/interface_provider.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/core/dom/document.h" @@ -21,6 +23,10 @@ return new WakeLock(script_state, LockType::kScreen); } +WakeLock* WakeLock::CreateSystemWakeLock(ScriptState* script_state) { + return new WakeLock(script_state, LockType::kSystem); +} + WakeLock::~WakeLock() = default; WakeLock::WakeLock(ScriptState* script_state, LockType type) @@ -28,7 +34,6 @@ PageVisibilityObserver( To<Document>(blink::ExecutionContext::From(script_state))->GetPage()), type_(type) { - DCHECK(type == LockType::kScreen); } ScriptPromise WakeLock::GetPromise(ScriptState* script_state) { @@ -79,9 +84,23 @@ if (wake_lock_service_) return; - LocalFrame* frame = To<Document>(GetExecutionContext())->GetFrame(); - frame->GetInterfaceProvider().GetInterface( + device::mojom::blink::WakeLockType type; + switch (type_) { + case LockType::kSystem: + type = device::mojom::blink::WakeLockType::kPreventAppSuspension; + break; + case LockType::kScreen: + type = device::mojom::blink::WakeLockType::kPreventDisplaySleep; + break; + } + + device::mojom::blink::WakeLockProviderPtr provider; + Platform::Current()->GetConnector()->BindInterface( + device::mojom::blink::kServiceName, mojo::MakeRequest(&provider)); + provider->GetWakeLockWithoutContext( + type, device::mojom::blink::WakeLockReason::kOther, "Blink Wake Lock", mojo::MakeRequest(&wake_lock_service_)); + wake_lock_service_.set_connection_error_handler( WTF::Bind(&WakeLock::OnConnectionError, WrapWeakPersistent(this))); }
diff --git a/third_party/blink/renderer/modules/wake_lock/wake_lock.h b/third_party/blink/renderer/modules/wake_lock/wake_lock.h index 40112dc..a8896f2 100644 --- a/third_party/blink/renderer/modules/wake_lock/wake_lock.h +++ b/third_party/blink/renderer/modules/wake_lock/wake_lock.h
@@ -36,6 +36,8 @@ // Called by NavigatorWakeLock to create Screen Wake Lock static WakeLock* CreateScreenWakeLock(ScriptState*); + // Called by NavigatorWakeLock to create System Wake Lock + static WakeLock* CreateSystemWakeLock(ScriptState*); // Resolves and returns same promise of that particular WakeLockType each time ScriptPromise GetPromise(ScriptState*);
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index 6e5048db..75efa91 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -1733,6 +1733,7 @@ "graphics/paint/drawing_recorder_test.cc", "graphics/paint/float_clip_rect_test.cc", "graphics/paint/geometry_mapper_test.cc", + "graphics/paint/geometry_mapper_transform_cache_test.cc", "graphics/paint/paint_chunk_test.cc", "graphics/paint/paint_chunker_test.cc", "graphics/paint/paint_controller_test.cc",
diff --git a/third_party/blink/renderer/platform/graphics/compositing/property_tree_manager.cc b/third_party/blink/renderer/platform/graphics/compositing/property_tree_manager.cc index bfbb5e6..835e1ce 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/property_tree_manager.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/property_tree_manager.cc
@@ -199,7 +199,7 @@ // to the local matrix. Cc applies sticky offset dynamically on top of the // local matrix. We should not set the local matrix on cc node if it is a // sticky node because the sticky offset would be applied twice otherwise. - if (!transform_node->GetStickyConstraint().is_sticky) { + if (!transform_node->GetStickyConstraint()) { compositor_node.local.matrix() = TransformationMatrix::ToSkMatrix44(transform_node->Matrix()); } @@ -215,10 +215,11 @@ GetTransformTree().AddNodeAffectedByOuterViewportBoundsDelta(id); } - if (transform_node->GetStickyConstraint().is_sticky) { + if (const auto* sticky_constraint = transform_node->GetStickyConstraint()) { + DCHECK(sticky_constraint->is_sticky); cc::StickyPositionNodeData* sticky_data = GetTransformTree().StickyPositionData(id); - sticky_data->constraints = transform_node->GetStickyConstraint(); + sticky_data->constraints = *sticky_constraint; // TODO(pdr): This could be a performance issue because it crawls up the // transform tree for each pending layer. If this is on profiles, we should // cache a lookup of transform node to scroll translation transform node.
diff --git a/third_party/blink/renderer/platform/graphics/paint/clip_paint_property_node.h b/third_party/blink/renderer/platform/graphics/paint/clip_paint_property_node.h index 069d24c..16fe0724 100644 --- a/third_party/blink/renderer/platform/graphics/paint/clip_paint_property_node.h +++ b/third_party/blink/renderer/platform/graphics/paint/clip_paint_property_node.h
@@ -123,22 +123,6 @@ return state_.direct_compositing_reasons != CompositingReason::kNone; } -#if DCHECK_IS_ON() - // The clone function is used by FindPropertiesNeedingUpdate.h for recording - // a clip node before it has been updated, to later detect changes. - scoped_refptr<ClipPaintPropertyNode> Clone() const { - return base::AdoptRef( - new ClipPaintPropertyNode(Parent(), State(state_), IsParentAlias())); - } - - // The equality operator is used by FindPropertiesNeedingUpdate.h for checking - // if a clip node has changed. - bool operator==(const ClipPaintPropertyNode& o) const { - return Parent() == o.Parent() && state_ == o.state_ && - IsParentAlias() == o.IsParentAlias(); - } -#endif - std::unique_ptr<JSONObject> ToJSON() const; // Returns memory usage of the clip cache of this node plus ancestors.
diff --git a/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h b/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h index 9f98eacb..73af730 100644 --- a/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h +++ b/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h
@@ -154,22 +154,6 @@ return state_.compositor_element_id; } -#if DCHECK_IS_ON() - // The clone function is used by FindPropertiesNeedingUpdate.h for recording - // an effect node before it has been updated, to later detect changes. - scoped_refptr<EffectPaintPropertyNode> Clone() const { - return base::AdoptRef( - new EffectPaintPropertyNode(Parent(), State(state_), IsParentAlias())); - } - - // The equality operator is used by FindPropertiesNeedingUpdate.h for checking - // if an effect node has changed. - bool operator==(const EffectPaintPropertyNode& o) const { - return Parent() == o.Parent() && state_ == o.state_ && - IsParentAlias() == o.IsParentAlias(); - } -#endif - std::unique_ptr<JSONObject> ToJSON() const; // Returns memory usage of this node plus ancestors.
diff --git a/third_party/blink/renderer/platform/graphics/paint/geometry_mapper.cc b/third_party/blink/renderer/platform/graphics/paint/geometry_mapper.cc index 00b977b9..c098514 100644 --- a/third_party/blink/renderer/platform/graphics/paint/geometry_mapper.cc +++ b/third_party/blink/renderer/platform/graphics/paint/geometry_mapper.cc
@@ -94,7 +94,22 @@ const GeometryMapperTransformCache& destination_cache = destination->GetTransformCache(); - // Case 1: Check if source and destination are known to be coplanar. + // Case 1a (fast path of case 1b): check if source and destination are under + // the same 2d translation root. + if (source_cache.root_of_2d_translation() == + destination_cache.root_of_2d_translation()) { + success = true; + if (source == destination_cache.root_of_2d_translation()) + return destination_cache.from_2d_translation_root(); + if (destination == source_cache.root_of_2d_translation()) + return source_cache.to_2d_translation_root(); + temp = destination_cache.from_2d_translation_root(); + temp.Translate(source_cache.to_2d_translation_root().E(), + source_cache.to_2d_translation_root().F()); + return temp; + } + + // Case 1b: Check if source and destination are known to be coplanar. // Even if destination may have invertible screen projection, // this formula is likely to be numerically more stable. if (source_cache.plane_root() == destination_cache.plane_root()) { @@ -111,6 +126,9 @@ // Case 2: Check if we can fallback to the canonical definition of // flatten(destination_to_screen)^-1 * flatten(source_to_screen) // If flatten(destination_to_screen)^-1 is invalid, we are out of luck. + // Screen transform data are updated lazily because they are rarely used. + source->UpdateScreenTransform(); + destination->UpdateScreenTransform(); if (!destination_cache.projection_from_screen_is_valid()) { success = false; return identity;
diff --git a/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_test.cc b/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_test.cc index 58d4e40..0a7fc36 100644 --- a/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_test.cc +++ b/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_test.cc
@@ -576,8 +576,8 @@ GeometryMapper::LocalToAncestorVisualRect(transform1_state, transform2_state, result_clip); FloatClipRect expected_clip(FloatRect(-100, 0, 100, 100)); - // This is because the combined Rotate(45) and Rotate(-45) is not exactly a - // translation-only transform due to calculation errors. + // We convervatively treat any rotated clip rect as not tight, even if it's + // rotated by 90 degrees. expected_clip.ClearIsTight(); EXPECT_CLIP_RECT_EQ(expected_clip, result_clip); @@ -889,4 +889,25 @@ local_state, ancestor_state, FloatPoint(5, 5))); } +TEST_P(GeometryMapperTest, Precision) { + auto t1 = CreateTransform(t0(), TransformationMatrix().Scale(32767)); + auto t2 = CreateTransform(*t1, TransformationMatrix().Rotate(1)); + auto t3 = CreateTransform(*t2, TransformationMatrix()); + auto t4 = CreateTransform(*t3, TransformationMatrix()); + EXPECT_EQ(TransformationMatrix(), + GeometryMapper::SourceToDestinationProjection(t4.get(), t4.get())); + EXPECT_EQ(TransformationMatrix(), + GeometryMapper::SourceToDestinationProjection(t3.get(), t4.get())); + EXPECT_EQ(TransformationMatrix(), + GeometryMapper::SourceToDestinationProjection(t2.get(), t4.get())); + EXPECT_EQ(TransformationMatrix(), + GeometryMapper::SourceToDestinationProjection(t3.get(), t2.get())); + EXPECT_EQ(TransformationMatrix(), + GeometryMapper::SourceToDestinationProjection(t4.get(), t2.get())); + EXPECT_EQ(TransformationMatrix(), + GeometryMapper::SourceToDestinationProjection(t4.get(), t3.get())); + EXPECT_EQ(TransformationMatrix(), + GeometryMapper::SourceToDestinationProjection(t2.get(), t3.get())); +} + } // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_transform_cache.cc b/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_transform_cache.cc index d50d53c0..cad4fc4 100644 --- a/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_transform_cache.cc +++ b/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_transform_cache.cc
@@ -33,42 +33,102 @@ DCHECK_NE(cache_generation_, s_global_generation); cache_generation_ = s_global_generation; - if (!node.Parent()) { - to_screen_.MakeIdentity(); - to_screen_is_invertible_ = true; - projection_from_screen_.MakeIdentity(); - projection_from_screen_is_valid_ = true; - plane_root_ = &node; - to_plane_root_.MakeIdentity(); - from_plane_root_.MakeIdentity(); + if (node.IsRoot()) { + DCHECK(node.Matrix().IsIdentity()); + to_2d_translation_root_.MakeIdentity(); + from_2d_translation_root_.MakeIdentity(); + root_of_2d_translation_ = &node; + plane_root_transform_ = nullptr; + screen_transform_ = nullptr; return; } const GeometryMapperTransformCache& parent = node.Parent()->GetTransformCache(); + // screen_transform_ will be updated only when needed. + screen_transform_ = nullptr; + + if (node.IsIdentityOr2DTranslation()) { + root_of_2d_translation_ = parent.root_of_2d_translation_; + to_2d_translation_root_ = parent.to_2d_translation_root_; + to_2d_translation_root_.Translate(node.Matrix().E(), node.Matrix().F()); + from_2d_translation_root_ = parent.from_2d_translation_root_; + from_2d_translation_root_.Translate(-node.Matrix().E(), -node.Matrix().F()); + + if (!parent.plane_root_transform_) { + // The parent doesn't have plane root transform means that the parent's + // plane root is the same as the 2d translation root, so this node + // which is a 2d translation also doesn't need plane root transform + // because the plane root is still the same as the 2d translation root. + plane_root_transform_ = nullptr; + return; + } + } else { + root_of_2d_translation_ = &node; + } + + TransformationMatrix local = node.Matrix(); + if (!node.IsIdentityOr2DTranslation()) + local.ApplyTransformOrigin(node.Origin()); + + bool is_plane_root = !local.IsFlat() || !local.IsInvertible(); + if (is_plane_root && root_of_2d_translation_ == &node) { + // We don't need plane root transform because the plane root is the same + // as the 2d translation root. + plane_root_transform_ = nullptr; + return; + } + + if (!plane_root_transform_) + plane_root_transform_.reset(new PlaneRootTransform()); + + if (is_plane_root) { + plane_root_transform_->plane_root = &node; + plane_root_transform_->to_plane_root.MakeIdentity(); + plane_root_transform_->from_plane_root.MakeIdentity(); + } else { + plane_root_transform_->plane_root = parent.plane_root(); + plane_root_transform_->to_plane_root = parent.to_plane_root(); + plane_root_transform_->to_plane_root.Multiply(local); + plane_root_transform_->from_plane_root = local.Inverse(); + plane_root_transform_->from_plane_root.Multiply(parent.from_plane_root()); + } +} + +void GeometryMapperTransformCache::UpdateScreenTransform( + const TransformPaintPropertyNode& node) { + // The cache should have been updated. + DCHECK_EQ(cache_generation_, s_global_generation); + + // If the plane root is the root of the tree, we can just use the plane root + // transform as the screen transform. + if (plane_root()->IsRoot()) + return; + + // If the node is the root, then its plane root is itself, and we should have + // returned above. + DCHECK(!node.IsRoot()); + node.Parent()->UpdateScreenTransform(); + const auto& parent = node.Parent()->GetTransformCache(); + TransformationMatrix local = node.Matrix(); local.ApplyTransformOrigin(node.Origin()); - to_screen_ = parent.to_screen_; + screen_transform_.reset(new ScreenTransform()); + screen_transform_->to_screen = parent.to_screen(); if (node.FlattensInheritedTransform()) - to_screen_.FlattenTo2d(); - to_screen_.Multiply(local); - to_screen_is_invertible_ = to_screen_.IsInvertible(); - projection_from_screen_is_valid_ = - InverseProjection(to_screen_, projection_from_screen_); - - if (!local.IsFlat() || !local.IsInvertible()) { - plane_root_ = &node; - to_plane_root_.MakeIdentity(); - from_plane_root_.MakeIdentity(); - } else { // (local.IsFlat() && local.IsInvertible()) - plane_root_ = parent.plane_root_; - to_plane_root_ = parent.to_plane_root_; - to_plane_root_.Multiply(local); - from_plane_root_ = local.Inverse(); - from_plane_root_.Multiply(parent.from_plane_root_); - } + screen_transform_->to_screen.FlattenTo2d(); + screen_transform_->to_screen.Multiply(local); + screen_transform_->projection_from_screen_is_valid = InverseProjection( + screen_transform_->to_screen, screen_transform_->projection_from_screen); } +#if DCHECK_IS_ON() +void GeometryMapperTransformCache::CheckScreenTransformUpdated() const { + // We should create screen transform iff the plane root is not the root. + DCHECK_EQ(plane_root()->IsRoot(), !screen_transform_); +} +#endif + } // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_transform_cache.h b/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_transform_cache.h index cadd1f5..94fd1f0 100644 --- a/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_transform_cache.h +++ b/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_transform_cache.h
@@ -29,34 +29,86 @@ DCHECK_EQ(cache_generation_, s_global_generation); } - const TransformationMatrix& to_screen() const { return to_screen_; } - bool to_screen_is_invertible() const { return to_screen_is_invertible_; } + const TransformationMatrix& to_2d_translation_root() const { + DCHECK(to_2d_translation_root_.IsIdentityOr2DTranslation()); + return to_2d_translation_root_; + } + const TransformationMatrix& from_2d_translation_root() const { + DCHECK(from_2d_translation_root_.IsIdentityOr2DTranslation()); + return from_2d_translation_root_; + } + const TransformPaintPropertyNode* root_of_2d_translation() const { + return root_of_2d_translation_; + } + + // As screen transform data are used rarely, they are updated only when + // needed. This method must be called before calling any screen transform + // related getters. + void UpdateScreenTransform(const TransformPaintPropertyNode&); + + // These getters must be called after UpdateScreenTransform() when screen + // transform data is really needed. + const TransformationMatrix& to_screen() const { + CheckScreenTransformUpdated(); + return UNLIKELY(screen_transform_) ? screen_transform_->to_screen + : to_plane_root(); + } const TransformationMatrix& projection_from_screen() const { - return projection_from_screen_; + CheckScreenTransformUpdated(); + return UNLIKELY(screen_transform_) + ? screen_transform_->projection_from_screen + : from_plane_root(); } bool projection_from_screen_is_valid() const { - return projection_from_screen_is_valid_; + CheckScreenTransformUpdated(); + return LIKELY(!screen_transform_) || + screen_transform_->projection_from_screen_is_valid; } - const TransformationMatrix& to_plane_root() const { return to_plane_root_; } - const TransformationMatrix& from_plane_root() const { - return from_plane_root_; + const TransformationMatrix& to_plane_root() const { + return UNLIKELY(plane_root_transform_) + ? plane_root_transform_->to_plane_root + : to_2d_translation_root_; } - const TransformPaintPropertyNode* plane_root() const { return plane_root_; } + const TransformationMatrix& from_plane_root() const { + return UNLIKELY(plane_root_transform_) + ? plane_root_transform_->from_plane_root + : from_2d_translation_root_; + } + const TransformPaintPropertyNode* plane_root() const { + return UNLIKELY(plane_root_transform_) ? plane_root_transform_->plane_root + : root_of_2d_translation(); + } private: + friend class GeometryMapperTransformCacheTest; + +#if DCHECK_IS_ON() + void CheckScreenTransformUpdated() const; +#else + void CheckScreenTransformUpdated() const {} +#endif + void Update(const TransformPaintPropertyNode&); static unsigned s_global_generation; + // The accumulated transform to/from root_of_2d_translation(). + TransformationMatrix to_2d_translation_root_; + TransformationMatrix from_2d_translation_root_; + + // The parent of the root of consecutive identity or 2d translations from the + // transform node, or the root of the tree if the whole path from the + // transform node to the root contains identity or 2d translations only. + const TransformPaintPropertyNode* root_of_2d_translation_; + // The cached values here can be categorized in two logical groups: // // [ Screen Transform ] // to_screen : The screen matrix of the node, as defined by: // to_screen = (flattens_inherited_transform ? // flatten(parent.to_screen) : parent.to_screen) * local - // to_screen_is_invertible : Whether to_screen is invertible. // projection_from_screen : Back projection from screen. // projection_from_screen = flatten(to_screen) ^ -1 // Undefined if the inverse projection doesn't exist. @@ -107,14 +159,21 @@ // = flatten(parent.to_screen) * local // = flatten(parent.plane_root.to_screen) * parent.to_plane_root * local // = flatten(plane_root.to_screen) * to_plane_root - TransformationMatrix to_screen_; - TransformationMatrix projection_from_screen_; - TransformationMatrix to_plane_root_; - TransformationMatrix from_plane_root_; - const TransformPaintPropertyNode* plane_root_ = nullptr; + struct PlaneRootTransform { + TransformationMatrix to_plane_root; + TransformationMatrix from_plane_root; + const TransformPaintPropertyNode* plane_root; + }; + std::unique_ptr<PlaneRootTransform> plane_root_transform_; + + struct ScreenTransform { + TransformationMatrix to_screen; + TransformationMatrix projection_from_screen; + bool projection_from_screen_is_valid; + }; + std::unique_ptr<ScreenTransform> screen_transform_; + unsigned cache_generation_ = s_global_generation - 1; - unsigned to_screen_is_invertible_ : 1; - unsigned projection_from_screen_is_valid_ : 1; DISALLOW_COPY_AND_ASSIGN(GeometryMapperTransformCache); };
diff --git a/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_transform_cache_test.cc b/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_transform_cache_test.cc new file mode 100644 index 0000000..572606fc --- /dev/null +++ b/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_transform_cache_test.cc
@@ -0,0 +1,204 @@ +// Copyright 2018 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 "third_party/blink/renderer/platform/graphics/paint/geometry_mapper_transform_cache.h" + +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h" +#include "third_party/blink/renderer/platform/testing/paint_property_test_helpers.h" + +namespace blink { + +class GeometryMapperTransformCacheTest : public testing::Test { + protected: + static const GeometryMapperTransformCache& GetTransformCache( + const TransformPaintPropertyNode& transform) { + return transform.GetTransformCache(); + } + + static void UpdateScreenTransform(const TransformPaintPropertyNode& node) { + node.UpdateScreenTransform(); + } + + static bool HasPlaneRootTransform(const TransformPaintPropertyNode& node) { + return !!node.GetTransformCache().plane_root_transform_; + } + + static bool HasScreenTransform(const TransformPaintPropertyNode& node) { + return !!node.GetTransformCache().screen_transform_; + } + + static void Check2dTranslationToRoot(const TransformPaintPropertyNode& node, + double x, + double y) { + const auto& cache = GetTransformCache(node); + EXPECT_EQ(&t0(), cache.root_of_2d_translation()); + EXPECT_EQ(TransformationMatrix().Translate(x, y), + cache.to_2d_translation_root()); + EXPECT_EQ(TransformationMatrix().Translate(-x, -y), + cache.from_2d_translation_root()); + + EXPECT_FALSE(HasPlaneRootTransform(node)); + EXPECT_FALSE(HasScreenTransform(node)); + UpdateScreenTransform(node); + EXPECT_FALSE(HasPlaneRootTransform(node)); + EXPECT_FALSE(HasScreenTransform(node)); + + EXPECT_EQ(&t0(), cache.plane_root()); + EXPECT_EQ(cache.to_2d_translation_root(), cache.to_plane_root()); + EXPECT_EQ(cache.from_2d_translation_root(), cache.from_plane_root()); + EXPECT_EQ(cache.to_2d_translation_root(), cache.to_screen()); + EXPECT_EQ(cache.from_2d_translation_root(), cache.projection_from_screen()); + }; + + static void CheckRootAsPlaneRoot( + const TransformPaintPropertyNode& node, + const TransformPaintPropertyNode& root_of_2d_translation, + const TransformationMatrix& to_plane_root, + double translate_x, + double translate_y) { + const auto& cache = GetTransformCache(node); + EXPECT_EQ(&root_of_2d_translation, cache.root_of_2d_translation()); + EXPECT_EQ(TransformationMatrix().Translate(translate_x, translate_y), + cache.to_2d_translation_root()); + EXPECT_EQ(TransformationMatrix().Translate(-translate_x, -translate_y), + cache.from_2d_translation_root()); + + EXPECT_TRUE(HasPlaneRootTransform(node)); + EXPECT_FALSE(HasScreenTransform(node)); + UpdateScreenTransform(node); + EXPECT_TRUE(HasPlaneRootTransform(node)); + EXPECT_FALSE(HasScreenTransform(node)); + + EXPECT_EQ(&t0(), cache.plane_root()); + EXPECT_EQ(to_plane_root, cache.to_plane_root()); + EXPECT_EQ(to_plane_root.Inverse(), cache.from_plane_root()); + EXPECT_EQ(cache.to_plane_root(), cache.to_screen()); + EXPECT_EQ(cache.from_plane_root(), cache.projection_from_screen()); + } + + static void CheckPlaneRootSameAs2dTranslationRoot( + const TransformPaintPropertyNode& node, + const TransformationMatrix& to_screen, + const TransformPaintPropertyNode& plane_root, + double translate_x, + double translate_y) { + const auto& cache = GetTransformCache(node); + EXPECT_EQ(&plane_root, cache.root_of_2d_translation()); + EXPECT_EQ(TransformationMatrix().Translate(translate_x, translate_y), + cache.to_2d_translation_root()); + EXPECT_EQ(TransformationMatrix().Translate(-translate_x, -translate_y), + cache.from_2d_translation_root()); + + EXPECT_FALSE(HasPlaneRootTransform(node)); + EXPECT_FALSE(HasScreenTransform(node)); + UpdateScreenTransform(node); + EXPECT_FALSE(HasPlaneRootTransform(node)); + EXPECT_TRUE(HasScreenTransform(node)); + + EXPECT_EQ(&plane_root, cache.plane_root()); + EXPECT_EQ(cache.to_2d_translation_root(), cache.to_plane_root()); + EXPECT_EQ(cache.from_2d_translation_root(), cache.from_plane_root()); + EXPECT_EQ(to_screen, cache.to_screen()); + auto projection_from_screen = to_screen; + projection_from_screen.FlattenTo2d(); + projection_from_screen = projection_from_screen.Inverse(); + EXPECT_EQ(projection_from_screen, cache.projection_from_screen()); + } + + static void CheckPlaneRootDifferent2dTranslationRoot( + const TransformPaintPropertyNode& node, + const TransformationMatrix& to_screen, + const TransformPaintPropertyNode& plane_root, + const TransformationMatrix& to_plane_root, + const TransformPaintPropertyNode& root_of_2d_translation, + double translate_x, + double translate_y) { + const auto& cache = GetTransformCache(node); + EXPECT_EQ(&root_of_2d_translation, cache.root_of_2d_translation()); + EXPECT_EQ(TransformationMatrix().Translate(translate_x, translate_y), + cache.to_2d_translation_root()); + EXPECT_EQ(TransformationMatrix().Translate(-translate_x, -translate_y), + cache.from_2d_translation_root()); + + EXPECT_TRUE(HasPlaneRootTransform(node)); + EXPECT_FALSE(HasScreenTransform(node)); + UpdateScreenTransform(node); + EXPECT_TRUE(HasPlaneRootTransform(node)); + EXPECT_TRUE(HasScreenTransform(node)); + + EXPECT_EQ(&plane_root, cache.plane_root()); + EXPECT_EQ(to_plane_root, cache.to_plane_root()); + EXPECT_EQ(to_plane_root.Inverse(), cache.from_plane_root()); + EXPECT_EQ(to_screen, cache.to_screen()); + auto projection_from_screen = to_screen; + projection_from_screen.FlattenTo2d(); + projection_from_screen = projection_from_screen.Inverse(); + EXPECT_EQ(projection_from_screen, cache.projection_from_screen()); + } +}; + +TEST_F(GeometryMapperTransformCacheTest, All2dTranslations) { + auto t1 = CreateTransform(t0(), TransformationMatrix().Translate(1, 2)); + auto t2 = CreateTransform(*t1, TransformationMatrix()); + auto t3 = CreateTransform(*t2, TransformationMatrix().Translate(7, 8)); + + Check2dTranslationToRoot(t0(), 0, 0); + Check2dTranslationToRoot(*t1, 1, 2); + Check2dTranslationToRoot(*t2, 1, 2); + Check2dTranslationToRoot(*t3, 8, 10); +} + +TEST_F(GeometryMapperTransformCacheTest, RootAsPlaneRootWithIntermediateScale) { + auto t1 = CreateTransform(t0(), TransformationMatrix().Translate(1, 2)); + auto t2 = CreateTransform(*t1, TransformationMatrix().Scale(3)); + auto t3 = CreateTransform(*t2, TransformationMatrix().Translate(7, 8)); + + Check2dTranslationToRoot(t0(), 0, 0); + Check2dTranslationToRoot(*t1, 1, 2); + auto to_plane_root = TransformationMatrix().Translate(1, 2).Scale(3); + CheckRootAsPlaneRoot(*t2, *t2, to_plane_root, 0, 0); + to_plane_root = to_plane_root.Translate(7, 8); + CheckRootAsPlaneRoot(*t3, *t2, to_plane_root, 7, 8); +} + +TEST_F(GeometryMapperTransformCacheTest, + IntermediatePlaneRootSameAs2dTranslationRoot) { + auto t1 = CreateTransform(t0(), TransformationMatrix().Translate(1, 2)); + auto t2 = CreateTransform(*t1, TransformationMatrix().Rotate3d(0, 45, 0)); + auto t3 = CreateTransform(*t2, TransformationMatrix().Translate(7, 8)); + + Check2dTranslationToRoot(t0(), 0, 0); + Check2dTranslationToRoot(*t1, 1, 2); + auto to_screen = TransformationMatrix().Translate(1, 2).Rotate3d(0, 45, 0); + CheckPlaneRootSameAs2dTranslationRoot(*t2, to_screen, *t2, 0, 0); + to_screen = to_screen.Translate(7, 8); + CheckPlaneRootSameAs2dTranslationRoot(*t3, to_screen, *t2, 7, 8); +} + +TEST_F(GeometryMapperTransformCacheTest, + IntermediatePlaneRootDifferent2dTranslationRoot) { + auto t1 = CreateTransform(t0(), TransformationMatrix().Translate(1, 2)); + auto t2 = CreateTransform(*t1, TransformationMatrix().Rotate3d(0, 45, 0)); + auto t3 = CreateTransform(*t2, TransformationMatrix().Scale(3)); + auto t4 = CreateTransform(*t3, TransformationMatrix().Translate(7, 8)); + + Check2dTranslationToRoot(t0(), 0, 0); + Check2dTranslationToRoot(*t1, 1, 2); + + auto to_screen = TransformationMatrix().Translate(1, 2).Rotate3d(0, 45, 0); + CheckPlaneRootSameAs2dTranslationRoot(*t2, to_screen, *t2, 0, 0); + + auto to_plane_root = TransformationMatrix().Scale(3); + to_screen = to_screen.Scale(3); + CheckPlaneRootDifferent2dTranslationRoot(*t3, to_screen, *t2, to_plane_root, + *t3, 0, 0); + + to_plane_root = to_plane_root.Translate(7, 8); + to_screen = to_screen.Translate(7, 8); + CheckPlaneRootDifferent2dTranslationRoot(*t4, to_screen, *t2, to_plane_root, + *t3, 7, 8); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/paint/scroll_paint_property_node.h b/third_party/blink/renderer/platform/graphics/paint/scroll_paint_property_node.h index 5dc76d0..c0cecac 100644 --- a/third_party/blink/renderer/platform/graphics/paint/scroll_paint_property_node.h +++ b/third_party/blink/renderer/platform/graphics/paint/scroll_paint_property_node.h
@@ -151,20 +151,6 @@ return state_.compositor_element_id; } -#if DCHECK_IS_ON() - // The clone function is used by FindPropertiesNeedingUpdate.h for recording - // a scroll node before it has been updated, to later detect changes. - scoped_refptr<ScrollPaintPropertyNode> Clone() const { - return base::AdoptRef(new ScrollPaintPropertyNode(Parent(), State(state_))); - } - - // The equality operator is used by FindPropertiesNeedingUpdate.h for checking - // if a scroll node has changed. - bool operator==(const ScrollPaintPropertyNode& o) const { - return Parent() == o.Parent() && state_ == o.state_; - } -#endif - std::unique_ptr<JSONObject> ToJSON() const; private:
diff --git a/third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h b/third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h index dc600e85..ee5ac86 100644 --- a/third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h +++ b/third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h
@@ -57,7 +57,7 @@ unsigned rendering_context_id = 0; CompositingReasons direct_compositing_reasons = CompositingReason::kNone; CompositorElementId compositor_element_id; - CompositorStickyConstraint sticky_constraint; + std::unique_ptr<CompositorStickyConstraint> sticky_constraint; bool operator==(const State& o) const { return matrix == o.matrix && origin == o.origin && @@ -69,7 +69,9 @@ scroll == o.scroll && affected_by_outer_viewport_bounds_delta == o.affected_by_outer_viewport_bounds_delta && - sticky_constraint == o.sticky_constraint; + ((!sticky_constraint && !o.sticky_constraint) || + (sticky_constraint && o.sticky_constraint && + *sticky_constraint == *o.sticky_constraint)); } }; @@ -123,8 +125,8 @@ return state_.affected_by_outer_viewport_bounds_delta; } - const cc::LayerStickyPositionConstraint& GetStickyConstraint() const { - return state_.sticky_constraint; + const cc::LayerStickyPositionConstraint* GetStickyConstraint() const { + return state_.sticky_constraint.get(); } // If this is a scroll offset translation (i.e., has an associated scroll @@ -186,22 +188,6 @@ unsigned RenderingContextId() const { return state_.rendering_context_id; } bool HasRenderingContext() const { return state_.rendering_context_id; } -#if DCHECK_IS_ON() - // The clone function is used by FindPropertiesNeedingUpdate.h for recording - // a transform node before it has been updated, to later detect changes. - scoped_refptr<TransformPaintPropertyNode> Clone() const { - return base::AdoptRef(new TransformPaintPropertyNode( - Parent(), State(state_), IsParentAlias())); - } - - // The equality operator is used by FindPropertiesNeedingUpdate.h for checking - // if a transform node has changed. - bool operator==(const TransformPaintPropertyNode& o) const { - return Parent() == o.Parent() && state_ == o.state_ && - IsParentAlias() == o.IsParentAlias(); - } -#endif - std::unique_ptr<JSONObject> ToJSON() const; // Returns memory usage of the transform cache of this node plus ancestors. @@ -240,10 +226,11 @@ #endif } - // For access to getTransformCache() and setCachedTransform. + // For access to GetTransformCache() and SetCachedTransform. friend class GeometryMapper; friend class GeometryMapperTest; friend class GeometryMapperTransformCache; + friend class GeometryMapperTransformCacheTest; const GeometryMapperTransformCache& GetTransformCache() const { if (!transform_cache_) @@ -251,6 +238,9 @@ transform_cache_->UpdateIfNeeded(*this); return *transform_cache_; } + void UpdateScreenTransform() const { + transform_cache_->UpdateScreenTransform(*this); + } State state_; mutable std::unique_ptr<GeometryMapperTransformCache> transform_cache_;
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 1277577..26167ce 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -377,6 +377,9 @@ settable_from_internals: true, }, { + name: "DisplayLocking", + }, + { name: "DisplayNoneIFrameCreatesNoLayoutObject", status: "stable", },
diff --git a/third_party/blink/tools/blinkpy/common/system/executive.py b/third_party/blink/tools/blinkpy/common/system/executive.py index af7188df..bf33f76 100644 --- a/third_party/blink/tools/blinkpy/common/system/executive.py +++ b/third_party/blink/tools/blinkpy/common/system/executive.py
@@ -369,7 +369,12 @@ if sys.platform == 'win32' and sys.version < '3': return True - return False + # On other (POSIX) platforms, we need to encode arguments if the system + # does not use UTF-8 encoding. Otherwise, subprocess.Popen will raise + # TypeError. Note that macOS always uses UTF-8, while on UNIX it + # depends on user locale (LC_CTYPE) and sys.getfilesystemencoding() may + # fail and return None. + return (sys.getfilesystemencoding() or '').lower() != 'utf-8' def _encode_argument_if_needed(self, argument): if not self._should_encode_child_process_arguments():
diff --git a/third_party/tcmalloc/chromium/src/memory_region_map.cc b/third_party/tcmalloc/chromium/src/memory_region_map.cc old mode 100755 new mode 100644 index 841d6f3c..06b6fb0 --- a/third_party/tcmalloc/chromium/src/memory_region_map.cc +++ b/third_party/tcmalloc/chromium/src/memory_region_map.cc
@@ -234,6 +234,9 @@ memset(bucket_table_, 0, table_bytes); num_buckets_ = 0; } + if (regions_ == NULL) { // init regions_ + InitRegionSetLocked(); + } Unlock(); RAW_VLOG(10, "MemoryRegionMap Init done"); } @@ -536,6 +539,15 @@ } } +inline void MemoryRegionMap::InitRegionSetLocked() { + RAW_VLOG(12, "Initializing region set"); + regions_ = regions_rep.region_set(); + recursive_insert = true; + new (regions_) RegionSet(); + HandleSavedRegionsLocked(&DoInsertRegionLocked); + recursive_insert = false; +} + inline void MemoryRegionMap::InsertRegionLocked(const Region& region) { RAW_CHECK(LockIsHeld(), "should be held (by this thread)"); // We can be called recursively, because RegionSet constructor @@ -556,12 +568,7 @@ saved_regions[saved_regions_count++] = region; } else { // not a recusrive call if (regions_ == NULL) { // init regions_ - RAW_VLOG(12, "Initializing region set"); - regions_ = regions_rep.region_set(); - recursive_insert = true; - new(regions_) RegionSet(); - HandleSavedRegionsLocked(&DoInsertRegionLocked); - recursive_insert = false; + InitRegionSetLocked(); } recursive_insert = true; // Do the actual insertion work to put new regions into regions_:
diff --git a/third_party/tcmalloc/chromium/src/memory_region_map.h b/third_party/tcmalloc/chromium/src/memory_region_map.h index ec388e1..f774994 100644 --- a/third_party/tcmalloc/chromium/src/memory_region_map.h +++ b/third_party/tcmalloc/chromium/src/memory_region_map.h
@@ -362,6 +362,9 @@ // table where all buckets eventually should be. static void RestoreSavedBucketsLocked(); + // Initialize RegionSet regions_. + inline static void InitRegionSetLocked(); + // Wrapper around DoInsertRegionLocked // that handles the case of recursive allocator calls. inline static void InsertRegionLocked(const Region& region);
diff --git a/third_party/win_build_output/mc/chrome/credential_provider/eventlog/MSG00409.bin b/third_party/win_build_output/mc/chrome/credential_provider/eventlog/MSG00409.bin deleted file mode 100644 index c88a120..0000000 --- a/third_party/win_build_output/mc/chrome/credential_provider/eventlog/MSG00409.bin +++ /dev/null Binary files differ
diff --git a/third_party/win_build_output/mc/chrome/credential_provider/eventlog/gcp_eventlog_messages.h b/third_party/win_build_output/mc/chrome/credential_provider/eventlog/gcp_eventlog_messages.h deleted file mode 100644 index 6a45791..0000000 --- a/third_party/win_build_output/mc/chrome/credential_provider/eventlog/gcp_eventlog_messages.h +++ /dev/null
@@ -1,66 +0,0 @@ -// Copyright 2018 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. -// -// Defines the names and types of messages that are logged with the SYSLOG -// macro. -// TODO(rogerta): Subdivide into more categories if needed. -// -// Values are 32 bit values laid out as follows: -// -// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 -// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 -// +---+-+-+-----------------------+-------------------------------+ -// |Sev|C|R| Facility | Code | -// +---+-+-+-----------------------+-------------------------------+ -// -// where -// -// Sev - is the severity code -// -// 00 - Success -// 01 - Informational -// 10 - Warning -// 11 - Error -// -// C - is the Customer code flag -// -// R - is a reserved bit -// -// Facility - is the facility code -// -// Code - is the facility's status code -// -// -// Define the facility codes -// -#define FACILITY_SYSTEM 0x0 - - -// -// Define the severity codes -// -#define STATUS_SEVERITY_INFORMATIONAL 0x0 -#define STATUS_SEVERITY_WARNING 0x1 -#define STATUS_SEVERITY_ERROR 0x2 -#define STATUS_SEVERITY_FATAL 0x3 - - -// -// MessageId: GCP_CATEGORY -// -// MessageText: -// -// GCP Events -// -#define GCP_CATEGORY ((WORD)0x00000001L) - -// -// MessageId: MSG_LOG_MESSAGE -// -// MessageText: -// -// %1!S! -// -#define MSG_LOG_MESSAGE ((DWORD)0x80000100L) -
diff --git a/third_party/win_build_output/mc/chrome/credential_provider/eventlog/gcp_eventlog_messages.rc b/third_party/win_build_output/mc/chrome/credential_provider/eventlog/gcp_eventlog_messages.rc deleted file mode 100644 index 4bd3ab7..0000000 --- a/third_party/win_build_output/mc/chrome/credential_provider/eventlog/gcp_eventlog_messages.rc +++ /dev/null
@@ -1,2 +0,0 @@ -LANGUAGE 0x9,0x1 -1 11 "MSG00409.bin"
diff --git a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x64/gaia_credential_provider.dlldata.c b/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x64/gaia_credential_provider.dlldata.c deleted file mode 100644 index da368593..0000000 --- a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x64/gaia_credential_provider.dlldata.c +++ /dev/null
@@ -1,37 +0,0 @@ -/********************************************************* - DllData file -- generated by MIDL compiler - - DO NOT ALTER THIS FILE - - This file is regenerated by MIDL on every IDL file compile. - - To completely reconstruct this file, delete it and rerun MIDL - on all the IDL files in this DLL, specifying this file for the - /dlldata command line option - -*********************************************************/ - - -#include <rpcproxy.h> - -#ifdef __cplusplus -extern "C" { -#endif - -EXTERN_PROXY_FILE( gaia_credential_provider ) - - -PROXYFILE_LIST_START -/* Start of list */ - REFERENCE_PROXY_FILE( gaia_credential_provider ), -/* End of list */ -PROXYFILE_LIST_END - - -DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) - -#ifdef __cplusplus -} /*extern "C" */ -#endif - -/* end of generated dlldata file */
diff --git a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x64/gaia_credential_provider.tlb b/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x64/gaia_credential_provider.tlb deleted file mode 100644 index dbcd1c1..0000000 --- a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x64/gaia_credential_provider.tlb +++ /dev/null Binary files differ
diff --git a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x64/gaia_credential_provider_i.c b/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x64/gaia_credential_provider_i.c deleted file mode 100644 index bb729ba..0000000 --- a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x64/gaia_credential_provider_i.c +++ /dev/null
@@ -1,100 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ - -/* link this file in with the server and any clients */ - - - /* File created by MIDL compiler version 8.xx.xxxx */ -/* at a redacted point in time - */ -/* Compiler settings for ../../chrome/credential_provider/gaiacp/gaia_credential_provider.idl: - Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.xx.xxxx - protocol : dce , ms_ext, c_ext, robust - error checks: allocation ref bounds_check enum stub_data - VC __declspec() decoration level: - __declspec(uuid()), __declspec(selectany), __declspec(novtable) - DECLSPEC_UUID(), MIDL_INTERFACE() -*/ -/* @@MIDL_FILE_HEADING( ) */ - -#pragma warning( disable: 4049 ) /* more than 64k source lines */ - - -#ifdef __cplusplus -extern "C"{ -#endif - - -#include <rpc.h> -#include <rpcndr.h> - -#ifdef _MIDL_USE_GUIDDEF_ - -#ifndef INITGUID -#define INITGUID -#include <guiddef.h> -#undef INITGUID -#else -#include <guiddef.h> -#endif - -#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ - DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) - -#else // !_MIDL_USE_GUIDDEF_ - -#ifndef __IID_DEFINED__ -#define __IID_DEFINED__ - -typedef struct _IID -{ - unsigned long x; - unsigned short s1; - unsigned short s2; - unsigned char c[8]; -} IID; - -#endif // __IID_DEFINED__ - -#ifndef CLSID_DEFINED -#define CLSID_DEFINED -typedef IID CLSID; -#endif // CLSID_DEFINED - -#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ - EXTERN_C __declspec(selectany) const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} - -#endif // !_MIDL_USE_GUIDDEF_ - -MIDL_DEFINE_GUID(IID, IID_IGaiaCredentialProvider,0xCEC9EF6C,0xB2E6,0x4BB6,0x8F,0x1E,0x17,0x47,0xBA,0x4F,0x71,0x38); - - -MIDL_DEFINE_GUID(IID, IID_IGaiaCredentialProviderForTesting,0x224CE2FB,0x2977,0x4585,0xBD,0x46,0x1B,0xAE,0x8D,0x79,0x64,0xDE); - - -MIDL_DEFINE_GUID(IID, IID_IGaiaCredential,0xE5BF88DF,0x9966,0x465B,0xB2,0x33,0xC1,0xCA,0xC7,0x51,0x0A,0x59); - - -MIDL_DEFINE_GUID(IID, IID_IReauthCredential,0xCC75BCEA,0xA636,0x4798,0xBF,0x8E,0x0F,0xF6,0x4D,0x74,0x34,0x51); - - -MIDL_DEFINE_GUID(IID, LIBID_GaiaCredentialProviderLib,0x4ADC3A52,0x8673,0x4CE3,0x81,0xF6,0x83,0x3D,0x18,0xBE,0xEB,0xA2); - - -MIDL_DEFINE_GUID(CLSID, CLSID_GaiaCredentialProvider,0x0B5BFDF0,0x4594,0x47AC,0x94,0x0A,0xCF,0xC6,0x9A,0xBC,0x56,0x1C); - - -MIDL_DEFINE_GUID(CLSID, CLSID_GaiaCredential,0x44AF95AC,0x6B23,0x4C54,0x94,0xBE,0xED,0xB1,0xCB,0x52,0xDA,0xFD); - - -MIDL_DEFINE_GUID(CLSID, CLSID_ReauthCredential,0xE6CC5D8B,0x54C2,0x4586,0xAD,0xC3,0x74,0x8E,0xD1,0x62,0x84,0xB7); - -#undef MIDL_DEFINE_GUID - -#ifdef __cplusplus -} -#endif - - -
diff --git a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x64/gaia_credential_provider_i.h b/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x64/gaia_credential_provider_i.h deleted file mode 100644 index 11b1bc2..0000000 --- a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x64/gaia_credential_provider_i.h +++ /dev/null
@@ -1,553 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 8.xx.xxxx */ -/* at a redacted point in time - */ -/* Compiler settings for ../../chrome/credential_provider/gaiacp/gaia_credential_provider.idl: - Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.xx.xxxx - protocol : dce , ms_ext, c_ext, robust - error checks: allocation ref bounds_check enum stub_data - VC __declspec() decoration level: - __declspec(uuid()), __declspec(selectany), __declspec(novtable) - DECLSPEC_UUID(), MIDL_INTERFACE() -*/ -/* @@MIDL_FILE_HEADING( ) */ - -#pragma warning( disable: 4049 ) /* more than 64k source lines */ - - -/* verify that the <rpcndr.h> version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 475 -#endif - -#include "rpc.h" -#include "rpcndr.h" - -#ifndef __RPCNDR_H_VERSION__ -#error this stub requires an updated version of <rpcndr.h> -#endif /* __RPCNDR_H_VERSION__ */ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __gaia_credential_provider_i_h__ -#define __gaia_credential_provider_i_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IGaiaCredentialProvider_FWD_DEFINED__ -#define __IGaiaCredentialProvider_FWD_DEFINED__ -typedef interface IGaiaCredentialProvider IGaiaCredentialProvider; - -#endif /* __IGaiaCredentialProvider_FWD_DEFINED__ */ - - -#ifndef __IGaiaCredentialProviderForTesting_FWD_DEFINED__ -#define __IGaiaCredentialProviderForTesting_FWD_DEFINED__ -typedef interface IGaiaCredentialProviderForTesting IGaiaCredentialProviderForTesting; - -#endif /* __IGaiaCredentialProviderForTesting_FWD_DEFINED__ */ - - -#ifndef __IGaiaCredential_FWD_DEFINED__ -#define __IGaiaCredential_FWD_DEFINED__ -typedef interface IGaiaCredential IGaiaCredential; - -#endif /* __IGaiaCredential_FWD_DEFINED__ */ - - -#ifndef __IReauthCredential_FWD_DEFINED__ -#define __IReauthCredential_FWD_DEFINED__ -typedef interface IReauthCredential IReauthCredential; - -#endif /* __IReauthCredential_FWD_DEFINED__ */ - - -#ifndef __GaiaCredentialProvider_FWD_DEFINED__ -#define __GaiaCredentialProvider_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class GaiaCredentialProvider GaiaCredentialProvider; -#else -typedef struct GaiaCredentialProvider GaiaCredentialProvider; -#endif /* __cplusplus */ - -#endif /* __GaiaCredentialProvider_FWD_DEFINED__ */ - - -#ifndef __GaiaCredential_FWD_DEFINED__ -#define __GaiaCredential_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class GaiaCredential GaiaCredential; -#else -typedef struct GaiaCredential GaiaCredential; -#endif /* __cplusplus */ - -#endif /* __GaiaCredential_FWD_DEFINED__ */ - - -#ifndef __ReauthCredential_FWD_DEFINED__ -#define __ReauthCredential_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class ReauthCredential ReauthCredential; -#else -typedef struct ReauthCredential ReauthCredential; -#endif /* __cplusplus */ - -#endif /* __ReauthCredential_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "oaidl.h" -#include "ocidl.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -#ifndef __IGaiaCredentialProvider_INTERFACE_DEFINED__ -#define __IGaiaCredentialProvider_INTERFACE_DEFINED__ - -/* interface IGaiaCredentialProvider */ -/* [unique][uuid][object] */ - - -EXTERN_C const IID IID_IGaiaCredentialProvider; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("CEC9EF6C-B2E6-4BB6-8F1E-1747BA4F7138") - IGaiaCredentialProvider : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE OnUserAuthenticated( - /* [in] */ IUnknown *credential, - /* [in] */ BSTR username, - /* [in] */ BSTR password, - /* [in] */ BSTR sid) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IGaiaCredentialProviderVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IGaiaCredentialProvider * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IGaiaCredentialProvider * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IGaiaCredentialProvider * This); - - HRESULT ( STDMETHODCALLTYPE *OnUserAuthenticated )( - IGaiaCredentialProvider * This, - /* [in] */ IUnknown *credential, - /* [in] */ BSTR username, - /* [in] */ BSTR password, - /* [in] */ BSTR sid); - - END_INTERFACE - } IGaiaCredentialProviderVtbl; - - interface IGaiaCredentialProvider - { - CONST_VTBL struct IGaiaCredentialProviderVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IGaiaCredentialProvider_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IGaiaCredentialProvider_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IGaiaCredentialProvider_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IGaiaCredentialProvider_OnUserAuthenticated(This,credential,username,password,sid) \ - ( (This)->lpVtbl -> OnUserAuthenticated(This,credential,username,password,sid) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IGaiaCredentialProvider_INTERFACE_DEFINED__ */ - - -#ifndef __IGaiaCredentialProviderForTesting_INTERFACE_DEFINED__ -#define __IGaiaCredentialProviderForTesting_INTERFACE_DEFINED__ - -/* interface IGaiaCredentialProviderForTesting */ -/* [unique][uuid][object] */ - - -EXTERN_C const IID IID_IGaiaCredentialProviderForTesting; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("224CE2FB-2977-4585-BD46-1BAE8D7964DE") - IGaiaCredentialProviderForTesting : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetReauthCheckDoneEvent( - /* [in] */ INT_PTR event) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IGaiaCredentialProviderForTestingVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IGaiaCredentialProviderForTesting * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IGaiaCredentialProviderForTesting * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IGaiaCredentialProviderForTesting * This); - - HRESULT ( STDMETHODCALLTYPE *SetReauthCheckDoneEvent )( - IGaiaCredentialProviderForTesting * This, - /* [in] */ INT_PTR event); - - END_INTERFACE - } IGaiaCredentialProviderForTestingVtbl; - - interface IGaiaCredentialProviderForTesting - { - CONST_VTBL struct IGaiaCredentialProviderForTestingVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IGaiaCredentialProviderForTesting_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IGaiaCredentialProviderForTesting_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IGaiaCredentialProviderForTesting_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IGaiaCredentialProviderForTesting_SetReauthCheckDoneEvent(This,event) \ - ( (This)->lpVtbl -> SetReauthCheckDoneEvent(This,event) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IGaiaCredentialProviderForTesting_INTERFACE_DEFINED__ */ - - -#ifndef __IGaiaCredential_INTERFACE_DEFINED__ -#define __IGaiaCredential_INTERFACE_DEFINED__ - -/* interface IGaiaCredential */ -/* [unique][uuid][object] */ - - -EXTERN_C const IID IID_IGaiaCredential; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("E5BF88DF-9966-465B-B233-C1CAC7510A59") - IGaiaCredential : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Initialize( - /* [in] */ IGaiaCredentialProvider *provider) = 0; - - virtual HRESULT STDMETHODCALLTYPE Terminate( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE FinishAuthentication( - /* [in] */ BSTR username, - /* [in] */ BSTR password, - /* [in] */ BSTR fullname, - /* [out] */ BSTR *sid, - /* [out] */ BSTR *error_text) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnUserAuthenticated( - /* [in] */ BSTR username, - /* [in] */ BSTR password, - /* [in] */ BSTR sid) = 0; - - virtual HRESULT STDMETHODCALLTYPE ReportError( - /* [in] */ LONG status, - /* [in] */ LONG substatus, - /* [in] */ BSTR status_text) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IGaiaCredentialVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IGaiaCredential * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IGaiaCredential * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IGaiaCredential * This); - - HRESULT ( STDMETHODCALLTYPE *Initialize )( - IGaiaCredential * This, - /* [in] */ IGaiaCredentialProvider *provider); - - HRESULT ( STDMETHODCALLTYPE *Terminate )( - IGaiaCredential * This); - - HRESULT ( STDMETHODCALLTYPE *FinishAuthentication )( - IGaiaCredential * This, - /* [in] */ BSTR username, - /* [in] */ BSTR password, - /* [in] */ BSTR fullname, - /* [out] */ BSTR *sid, - /* [out] */ BSTR *error_text); - - HRESULT ( STDMETHODCALLTYPE *OnUserAuthenticated )( - IGaiaCredential * This, - /* [in] */ BSTR username, - /* [in] */ BSTR password, - /* [in] */ BSTR sid); - - HRESULT ( STDMETHODCALLTYPE *ReportError )( - IGaiaCredential * This, - /* [in] */ LONG status, - /* [in] */ LONG substatus, - /* [in] */ BSTR status_text); - - END_INTERFACE - } IGaiaCredentialVtbl; - - interface IGaiaCredential - { - CONST_VTBL struct IGaiaCredentialVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IGaiaCredential_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IGaiaCredential_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IGaiaCredential_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IGaiaCredential_Initialize(This,provider) \ - ( (This)->lpVtbl -> Initialize(This,provider) ) - -#define IGaiaCredential_Terminate(This) \ - ( (This)->lpVtbl -> Terminate(This) ) - -#define IGaiaCredential_FinishAuthentication(This,username,password,fullname,sid,error_text) \ - ( (This)->lpVtbl -> FinishAuthentication(This,username,password,fullname,sid,error_text) ) - -#define IGaiaCredential_OnUserAuthenticated(This,username,password,sid) \ - ( (This)->lpVtbl -> OnUserAuthenticated(This,username,password,sid) ) - -#define IGaiaCredential_ReportError(This,status,substatus,status_text) \ - ( (This)->lpVtbl -> ReportError(This,status,substatus,status_text) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IGaiaCredential_INTERFACE_DEFINED__ */ - - -#ifndef __IReauthCredential_INTERFACE_DEFINED__ -#define __IReauthCredential_INTERFACE_DEFINED__ - -/* interface IReauthCredential */ -/* [unique][uuid][object] */ - - -EXTERN_C const IID IID_IReauthCredential; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("CC75BCEA-A636-4798-BF8E-0FF64D743451") - IReauthCredential : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetUserInfo( - /* [in] */ BSTR sid, - /* [in] */ BSTR email) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IReauthCredentialVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IReauthCredential * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IReauthCredential * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IReauthCredential * This); - - HRESULT ( STDMETHODCALLTYPE *SetUserInfo )( - IReauthCredential * This, - /* [in] */ BSTR sid, - /* [in] */ BSTR email); - - END_INTERFACE - } IReauthCredentialVtbl; - - interface IReauthCredential - { - CONST_VTBL struct IReauthCredentialVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IReauthCredential_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IReauthCredential_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IReauthCredential_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IReauthCredential_SetUserInfo(This,sid,email) \ - ( (This)->lpVtbl -> SetUserInfo(This,sid,email) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IReauthCredential_INTERFACE_DEFINED__ */ - - - -#ifndef __GaiaCredentialProviderLib_LIBRARY_DEFINED__ -#define __GaiaCredentialProviderLib_LIBRARY_DEFINED__ - -/* library GaiaCredentialProviderLib */ -/* [version][uuid] */ - - -EXTERN_C const IID LIBID_GaiaCredentialProviderLib; - -EXTERN_C const CLSID CLSID_GaiaCredentialProvider; - -#ifdef __cplusplus - -class DECLSPEC_UUID("0B5BFDF0-4594-47AC-940A-CFC69ABC561C") -GaiaCredentialProvider; -#endif - -EXTERN_C const CLSID CLSID_GaiaCredential; - -#ifdef __cplusplus - -class DECLSPEC_UUID("44AF95AC-6B23-4C54-94BE-EDB1CB52DAFD") -GaiaCredential; -#endif - -EXTERN_C const CLSID CLSID_ReauthCredential; - -#ifdef __cplusplus - -class DECLSPEC_UUID("E6CC5D8B-54C2-4586-ADC3-748ED16284B7") -ReauthCredential; -#endif -#endif /* __GaiaCredentialProviderLib_LIBRARY_DEFINED__ */ - -/* Additional Prototypes for ALL interfaces */ - -unsigned long __RPC_USER BSTR_UserSize( unsigned long *, unsigned long , BSTR * ); -unsigned char * __RPC_USER BSTR_UserMarshal( unsigned long *, unsigned char *, BSTR * ); -unsigned char * __RPC_USER BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * ); -void __RPC_USER BSTR_UserFree( unsigned long *, BSTR * ); - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - -
diff --git a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x64/gaia_credential_provider_p.c b/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x64/gaia_credential_provider_p.c deleted file mode 100644 index 8198483..0000000 --- a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x64/gaia_credential_provider_p.c +++ /dev/null
@@ -1,830 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the proxy stub code */ - - - /* File created by MIDL compiler version 8.xx.xxxx */ -/* at a redacted point in time - */ -/* Compiler settings for ../../chrome/credential_provider/gaiacp/gaia_credential_provider.idl: - Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.xx.xxxx - protocol : dce , ms_ext, c_ext, robust - error checks: allocation ref bounds_check enum stub_data - VC __declspec() decoration level: - __declspec(uuid()), __declspec(selectany), __declspec(novtable) - DECLSPEC_UUID(), MIDL_INTERFACE() -*/ -/* @@MIDL_FILE_HEADING( ) */ - -#if defined(_M_AMD64) - - -#pragma warning( disable: 4049 ) /* more than 64k source lines */ -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif - -#pragma warning( disable: 4211 ) /* redefine extern to static */ -#pragma warning( disable: 4232 ) /* dllimport identity*/ -#pragma warning( disable: 4024 ) /* array to pointer mapping*/ -#pragma warning( disable: 4152 ) /* function/data pointer conversion in expression */ - -#define USE_STUBLESS_PROXY - - -/* verify that the <rpcproxy.h> version is high enough to compile this file*/ -#ifndef __REDQ_RPCPROXY_H_VERSION__ -#define __REQUIRED_RPCPROXY_H_VERSION__ 475 -#endif - - -#include "rpcproxy.h" -#ifndef __RPCPROXY_H_VERSION__ -#error this stub requires an updated version of <rpcproxy.h> -#endif /* __RPCPROXY_H_VERSION__ */ - - -#include "gaia_credential_provider_i.h" - -#define TYPE_FORMAT_STRING_SIZE 93 -#define PROC_FORMAT_STRING_SIZE 371 -#define EXPR_FORMAT_STRING_SIZE 1 -#define TRANSMIT_AS_TABLE_SIZE 0 -#define WIRE_MARSHAL_TABLE_SIZE 1 - -typedef struct _gaia_credential_provider_MIDL_TYPE_FORMAT_STRING - { - short Pad; - unsigned char Format[ TYPE_FORMAT_STRING_SIZE ]; - } gaia_credential_provider_MIDL_TYPE_FORMAT_STRING; - -typedef struct _gaia_credential_provider_MIDL_PROC_FORMAT_STRING - { - short Pad; - unsigned char Format[ PROC_FORMAT_STRING_SIZE ]; - } gaia_credential_provider_MIDL_PROC_FORMAT_STRING; - -typedef struct _gaia_credential_provider_MIDL_EXPR_FORMAT_STRING - { - long Pad; - unsigned char Format[ EXPR_FORMAT_STRING_SIZE ]; - } gaia_credential_provider_MIDL_EXPR_FORMAT_STRING; - - -static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax = -{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}; - - -extern const gaia_credential_provider_MIDL_TYPE_FORMAT_STRING gaia_credential_provider__MIDL_TypeFormatString; -extern const gaia_credential_provider_MIDL_PROC_FORMAT_STRING gaia_credential_provider__MIDL_ProcFormatString; -extern const gaia_credential_provider_MIDL_EXPR_FORMAT_STRING gaia_credential_provider__MIDL_ExprFormatString; - - -extern const MIDL_STUB_DESC Object_StubDesc; - - -extern const MIDL_SERVER_INFO IGaiaCredentialProvider_ServerInfo; -extern const MIDL_STUBLESS_PROXY_INFO IGaiaCredentialProvider_ProxyInfo; - - -extern const MIDL_STUB_DESC Object_StubDesc; - - -extern const MIDL_SERVER_INFO IGaiaCredentialProviderForTesting_ServerInfo; -extern const MIDL_STUBLESS_PROXY_INFO IGaiaCredentialProviderForTesting_ProxyInfo; - - -extern const MIDL_STUB_DESC Object_StubDesc; - - -extern const MIDL_SERVER_INFO IGaiaCredential_ServerInfo; -extern const MIDL_STUBLESS_PROXY_INFO IGaiaCredential_ProxyInfo; - - -extern const MIDL_STUB_DESC Object_StubDesc; - - -extern const MIDL_SERVER_INFO IReauthCredential_ServerInfo; -extern const MIDL_STUBLESS_PROXY_INFO IReauthCredential_ProxyInfo; - - -extern const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ]; - -#if !defined(__RPC_WIN64__) -#error Invalid build platform for this stub. -#endif - -static const gaia_credential_provider_MIDL_PROC_FORMAT_STRING gaia_credential_provider__MIDL_ProcFormatString = - { - 0, - { - - /* Procedure OnUserAuthenticated */ - - 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 2 */ NdrFcLong( 0x0 ), /* 0 */ -/* 6 */ NdrFcShort( 0x3 ), /* 3 */ -/* 8 */ NdrFcShort( 0x30 ), /* X64 Stack size/offset = 48 */ -/* 10 */ NdrFcShort( 0x0 ), /* 0 */ -/* 12 */ NdrFcShort( 0x8 ), /* 8 */ -/* 14 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ - 0x5, /* 5 */ -/* 16 */ 0xa, /* 10 */ - 0x5, /* Ext Flags: new corr desc, srv corr check, */ -/* 18 */ NdrFcShort( 0x0 ), /* 0 */ -/* 20 */ NdrFcShort( 0x1 ), /* 1 */ -/* 22 */ NdrFcShort( 0x0 ), /* 0 */ -/* 24 */ NdrFcShort( 0x0 ), /* 0 */ - - /* Parameter credential */ - -/* 26 */ NdrFcShort( 0xb ), /* Flags: must size, must free, in, */ -/* 28 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ -/* 30 */ NdrFcShort( 0x2 ), /* Type Offset=2 */ - - /* Parameter username */ - -/* 32 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 34 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ -/* 36 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Parameter password */ - -/* 38 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 40 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ -/* 42 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Parameter sid */ - -/* 44 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 46 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */ -/* 48 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Return value */ - -/* 50 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 52 */ NdrFcShort( 0x28 ), /* X64 Stack size/offset = 40 */ -/* 54 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Procedure SetReauthCheckDoneEvent */ - -/* 56 */ 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 58 */ NdrFcLong( 0x0 ), /* 0 */ -/* 62 */ NdrFcShort( 0x3 ), /* 3 */ -/* 64 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ -/* 66 */ NdrFcShort( 0x8 ), /* 8 */ -/* 68 */ NdrFcShort( 0x8 ), /* 8 */ -/* 70 */ 0x44, /* Oi2 Flags: has return, has ext, */ - 0x2, /* 2 */ -/* 72 */ 0xa, /* 10 */ - 0x1, /* Ext Flags: new corr desc, */ -/* 74 */ NdrFcShort( 0x0 ), /* 0 */ -/* 76 */ NdrFcShort( 0x0 ), /* 0 */ -/* 78 */ NdrFcShort( 0x0 ), /* 0 */ -/* 80 */ NdrFcShort( 0x0 ), /* 0 */ - - /* Parameter event */ - -/* 82 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ -/* 84 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ -/* 86 */ 0xb8, /* FC_INT3264 */ - 0x0, /* 0 */ - - /* Return value */ - -/* 88 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 90 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ -/* 92 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Procedure Initialize */ - -/* 94 */ 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 96 */ NdrFcLong( 0x0 ), /* 0 */ -/* 100 */ NdrFcShort( 0x3 ), /* 3 */ -/* 102 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ -/* 104 */ NdrFcShort( 0x0 ), /* 0 */ -/* 106 */ NdrFcShort( 0x8 ), /* 8 */ -/* 108 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ - 0x2, /* 2 */ -/* 110 */ 0xa, /* 10 */ - 0x1, /* Ext Flags: new corr desc, */ -/* 112 */ NdrFcShort( 0x0 ), /* 0 */ -/* 114 */ NdrFcShort( 0x0 ), /* 0 */ -/* 116 */ NdrFcShort( 0x0 ), /* 0 */ -/* 118 */ NdrFcShort( 0x0 ), /* 0 */ - - /* Parameter provider */ - -/* 120 */ NdrFcShort( 0xb ), /* Flags: must size, must free, in, */ -/* 122 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ -/* 124 */ NdrFcShort( 0x38 ), /* Type Offset=56 */ - - /* Return value */ - -/* 126 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 128 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ -/* 130 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Procedure Terminate */ - -/* 132 */ 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 134 */ NdrFcLong( 0x0 ), /* 0 */ -/* 138 */ NdrFcShort( 0x4 ), /* 4 */ -/* 140 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ -/* 142 */ NdrFcShort( 0x0 ), /* 0 */ -/* 144 */ NdrFcShort( 0x8 ), /* 8 */ -/* 146 */ 0x44, /* Oi2 Flags: has return, has ext, */ - 0x1, /* 1 */ -/* 148 */ 0xa, /* 10 */ - 0x1, /* Ext Flags: new corr desc, */ -/* 150 */ NdrFcShort( 0x0 ), /* 0 */ -/* 152 */ NdrFcShort( 0x0 ), /* 0 */ -/* 154 */ NdrFcShort( 0x0 ), /* 0 */ -/* 156 */ NdrFcShort( 0x0 ), /* 0 */ - - /* Return value */ - -/* 158 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 160 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ -/* 162 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Procedure FinishAuthentication */ - -/* 164 */ 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 166 */ NdrFcLong( 0x0 ), /* 0 */ -/* 170 */ NdrFcShort( 0x5 ), /* 5 */ -/* 172 */ NdrFcShort( 0x38 ), /* X64 Stack size/offset = 56 */ -/* 174 */ NdrFcShort( 0x0 ), /* 0 */ -/* 176 */ NdrFcShort( 0x8 ), /* 8 */ -/* 178 */ 0x47, /* Oi2 Flags: srv must size, clt must size, has return, has ext, */ - 0x6, /* 6 */ -/* 180 */ 0xa, /* 10 */ - 0x7, /* Ext Flags: new corr desc, clt corr check, srv corr check, */ -/* 182 */ NdrFcShort( 0x1 ), /* 1 */ -/* 184 */ NdrFcShort( 0x1 ), /* 1 */ -/* 186 */ NdrFcShort( 0x0 ), /* 0 */ -/* 188 */ NdrFcShort( 0x0 ), /* 0 */ - - /* Parameter username */ - -/* 190 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 192 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ -/* 194 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Parameter password */ - -/* 196 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 198 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ -/* 200 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Parameter fullname */ - -/* 202 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 204 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ -/* 206 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Parameter sid */ - -/* 208 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ -/* 210 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */ -/* 212 */ NdrFcShort( 0x52 ), /* Type Offset=82 */ - - /* Parameter error_text */ - -/* 214 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ -/* 216 */ NdrFcShort( 0x28 ), /* X64 Stack size/offset = 40 */ -/* 218 */ NdrFcShort( 0x52 ), /* Type Offset=82 */ - - /* Return value */ - -/* 220 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 222 */ NdrFcShort( 0x30 ), /* X64 Stack size/offset = 48 */ -/* 224 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Procedure OnUserAuthenticated */ - -/* 226 */ 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 228 */ NdrFcLong( 0x0 ), /* 0 */ -/* 232 */ NdrFcShort( 0x6 ), /* 6 */ -/* 234 */ NdrFcShort( 0x28 ), /* X64 Stack size/offset = 40 */ -/* 236 */ NdrFcShort( 0x0 ), /* 0 */ -/* 238 */ NdrFcShort( 0x8 ), /* 8 */ -/* 240 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ - 0x4, /* 4 */ -/* 242 */ 0xa, /* 10 */ - 0x5, /* Ext Flags: new corr desc, srv corr check, */ -/* 244 */ NdrFcShort( 0x0 ), /* 0 */ -/* 246 */ NdrFcShort( 0x1 ), /* 1 */ -/* 248 */ NdrFcShort( 0x0 ), /* 0 */ -/* 250 */ NdrFcShort( 0x0 ), /* 0 */ - - /* Parameter username */ - -/* 252 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 254 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ -/* 256 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Parameter password */ - -/* 258 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 260 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ -/* 262 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Parameter sid */ - -/* 264 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 266 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ -/* 268 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Return value */ - -/* 270 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 272 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */ -/* 274 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Procedure ReportError */ - -/* 276 */ 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 278 */ NdrFcLong( 0x0 ), /* 0 */ -/* 282 */ NdrFcShort( 0x7 ), /* 7 */ -/* 284 */ NdrFcShort( 0x28 ), /* X64 Stack size/offset = 40 */ -/* 286 */ NdrFcShort( 0x10 ), /* 16 */ -/* 288 */ NdrFcShort( 0x8 ), /* 8 */ -/* 290 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ - 0x4, /* 4 */ -/* 292 */ 0xa, /* 10 */ - 0x5, /* Ext Flags: new corr desc, srv corr check, */ -/* 294 */ NdrFcShort( 0x0 ), /* 0 */ -/* 296 */ NdrFcShort( 0x1 ), /* 1 */ -/* 298 */ NdrFcShort( 0x0 ), /* 0 */ -/* 300 */ NdrFcShort( 0x0 ), /* 0 */ - - /* Parameter status */ - -/* 302 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ -/* 304 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ -/* 306 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Parameter substatus */ - -/* 308 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ -/* 310 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ -/* 312 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Parameter status_text */ - -/* 314 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 316 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ -/* 318 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Return value */ - -/* 320 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 322 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */ -/* 324 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Procedure SetUserInfo */ - -/* 326 */ 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 328 */ NdrFcLong( 0x0 ), /* 0 */ -/* 332 */ NdrFcShort( 0x3 ), /* 3 */ -/* 334 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */ -/* 336 */ NdrFcShort( 0x0 ), /* 0 */ -/* 338 */ NdrFcShort( 0x8 ), /* 8 */ -/* 340 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ - 0x3, /* 3 */ -/* 342 */ 0xa, /* 10 */ - 0x5, /* Ext Flags: new corr desc, srv corr check, */ -/* 344 */ NdrFcShort( 0x0 ), /* 0 */ -/* 346 */ NdrFcShort( 0x1 ), /* 1 */ -/* 348 */ NdrFcShort( 0x0 ), /* 0 */ -/* 350 */ NdrFcShort( 0x0 ), /* 0 */ - - /* Parameter sid */ - -/* 352 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 354 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ -/* 356 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Parameter email */ - -/* 358 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 360 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ -/* 362 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Return value */ - -/* 364 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 366 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ -/* 368 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - 0x0 - } - }; - -static const gaia_credential_provider_MIDL_TYPE_FORMAT_STRING gaia_credential_provider__MIDL_TypeFormatString = - { - 0, - { - NdrFcShort( 0x0 ), /* 0 */ -/* 2 */ - 0x2f, /* FC_IP */ - 0x5a, /* FC_CONSTANT_IID */ -/* 4 */ NdrFcLong( 0x0 ), /* 0 */ -/* 8 */ NdrFcShort( 0x0 ), /* 0 */ -/* 10 */ NdrFcShort( 0x0 ), /* 0 */ -/* 12 */ 0xc0, /* 192 */ - 0x0, /* 0 */ -/* 14 */ 0x0, /* 0 */ - 0x0, /* 0 */ -/* 16 */ 0x0, /* 0 */ - 0x0, /* 0 */ -/* 18 */ 0x0, /* 0 */ - 0x46, /* 70 */ -/* 20 */ - 0x12, 0x0, /* FC_UP */ -/* 22 */ NdrFcShort( 0xe ), /* Offset= 14 (36) */ -/* 24 */ - 0x1b, /* FC_CARRAY */ - 0x1, /* 1 */ -/* 26 */ NdrFcShort( 0x2 ), /* 2 */ -/* 28 */ 0x9, /* Corr desc: FC_ULONG */ - 0x0, /* */ -/* 30 */ NdrFcShort( 0xfffc ), /* -4 */ -/* 32 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ -/* 34 */ 0x6, /* FC_SHORT */ - 0x5b, /* FC_END */ -/* 36 */ - 0x17, /* FC_CSTRUCT */ - 0x3, /* 3 */ -/* 38 */ NdrFcShort( 0x8 ), /* 8 */ -/* 40 */ NdrFcShort( 0xfff0 ), /* Offset= -16 (24) */ -/* 42 */ 0x8, /* FC_LONG */ - 0x8, /* FC_LONG */ -/* 44 */ 0x5c, /* FC_PAD */ - 0x5b, /* FC_END */ -/* 46 */ 0xb4, /* FC_USER_MARSHAL */ - 0x83, /* 131 */ -/* 48 */ NdrFcShort( 0x0 ), /* 0 */ -/* 50 */ NdrFcShort( 0x8 ), /* 8 */ -/* 52 */ NdrFcShort( 0x0 ), /* 0 */ -/* 54 */ NdrFcShort( 0xffde ), /* Offset= -34 (20) */ -/* 56 */ - 0x2f, /* FC_IP */ - 0x5a, /* FC_CONSTANT_IID */ -/* 58 */ NdrFcLong( 0xcec9ef6c ), /* -825626772 */ -/* 62 */ NdrFcShort( 0xb2e6 ), /* -19738 */ -/* 64 */ NdrFcShort( 0x4bb6 ), /* 19382 */ -/* 66 */ 0x8f, /* 143 */ - 0x1e, /* 30 */ -/* 68 */ 0x17, /* 23 */ - 0x47, /* 71 */ -/* 70 */ 0xba, /* 186 */ - 0x4f, /* 79 */ -/* 72 */ 0x71, /* 113 */ - 0x38, /* 56 */ -/* 74 */ - 0x11, 0x4, /* FC_RP [alloced_on_stack] */ -/* 76 */ NdrFcShort( 0x6 ), /* Offset= 6 (82) */ -/* 78 */ - 0x13, 0x0, /* FC_OP */ -/* 80 */ NdrFcShort( 0xffd4 ), /* Offset= -44 (36) */ -/* 82 */ 0xb4, /* FC_USER_MARSHAL */ - 0x83, /* 131 */ -/* 84 */ NdrFcShort( 0x0 ), /* 0 */ -/* 86 */ NdrFcShort( 0x8 ), /* 8 */ -/* 88 */ NdrFcShort( 0x0 ), /* 0 */ -/* 90 */ NdrFcShort( 0xfff4 ), /* Offset= -12 (78) */ - - 0x0 - } - }; - -static const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ] = - { - - { - BSTR_UserSize - ,BSTR_UserMarshal - ,BSTR_UserUnmarshal - ,BSTR_UserFree - } - - }; - - - -/* Object interface: IUnknown, ver. 0.0, - GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */ - - -/* Object interface: IGaiaCredentialProvider, ver. 0.0, - GUID={0xCEC9EF6C,0xB2E6,0x4BB6,{0x8F,0x1E,0x17,0x47,0xBA,0x4F,0x71,0x38}} */ - -#pragma code_seg(".orpc") -static const unsigned short IGaiaCredentialProvider_FormatStringOffsetTable[] = - { - 0 - }; - -static const MIDL_STUBLESS_PROXY_INFO IGaiaCredentialProvider_ProxyInfo = - { - &Object_StubDesc, - gaia_credential_provider__MIDL_ProcFormatString.Format, - &IGaiaCredentialProvider_FormatStringOffsetTable[-3], - 0, - 0, - 0 - }; - - -static const MIDL_SERVER_INFO IGaiaCredentialProvider_ServerInfo = - { - &Object_StubDesc, - 0, - gaia_credential_provider__MIDL_ProcFormatString.Format, - &IGaiaCredentialProvider_FormatStringOffsetTable[-3], - 0, - 0, - 0, - 0}; -CINTERFACE_PROXY_VTABLE(4) _IGaiaCredentialProviderProxyVtbl = -{ - &IGaiaCredentialProvider_ProxyInfo, - &IID_IGaiaCredentialProvider, - IUnknown_QueryInterface_Proxy, - IUnknown_AddRef_Proxy, - IUnknown_Release_Proxy , - (void *) (INT_PTR) -1 /* IGaiaCredentialProvider::OnUserAuthenticated */ -}; - -const CInterfaceStubVtbl _IGaiaCredentialProviderStubVtbl = -{ - &IID_IGaiaCredentialProvider, - &IGaiaCredentialProvider_ServerInfo, - 4, - 0, /* pure interpreted */ - CStdStubBuffer_METHODS -}; - - -/* Object interface: IGaiaCredentialProviderForTesting, ver. 0.0, - GUID={0x224CE2FB,0x2977,0x4585,{0xBD,0x46,0x1B,0xAE,0x8D,0x79,0x64,0xDE}} */ - -#pragma code_seg(".orpc") -static const unsigned short IGaiaCredentialProviderForTesting_FormatStringOffsetTable[] = - { - 56 - }; - -static const MIDL_STUBLESS_PROXY_INFO IGaiaCredentialProviderForTesting_ProxyInfo = - { - &Object_StubDesc, - gaia_credential_provider__MIDL_ProcFormatString.Format, - &IGaiaCredentialProviderForTesting_FormatStringOffsetTable[-3], - 0, - 0, - 0 - }; - - -static const MIDL_SERVER_INFO IGaiaCredentialProviderForTesting_ServerInfo = - { - &Object_StubDesc, - 0, - gaia_credential_provider__MIDL_ProcFormatString.Format, - &IGaiaCredentialProviderForTesting_FormatStringOffsetTable[-3], - 0, - 0, - 0, - 0}; -CINTERFACE_PROXY_VTABLE(4) _IGaiaCredentialProviderForTestingProxyVtbl = -{ - &IGaiaCredentialProviderForTesting_ProxyInfo, - &IID_IGaiaCredentialProviderForTesting, - IUnknown_QueryInterface_Proxy, - IUnknown_AddRef_Proxy, - IUnknown_Release_Proxy , - (void *) (INT_PTR) -1 /* IGaiaCredentialProviderForTesting::SetReauthCheckDoneEvent */ -}; - -const CInterfaceStubVtbl _IGaiaCredentialProviderForTestingStubVtbl = -{ - &IID_IGaiaCredentialProviderForTesting, - &IGaiaCredentialProviderForTesting_ServerInfo, - 4, - 0, /* pure interpreted */ - CStdStubBuffer_METHODS -}; - - -/* Object interface: IGaiaCredential, ver. 0.0, - GUID={0xE5BF88DF,0x9966,0x465B,{0xB2,0x33,0xC1,0xCA,0xC7,0x51,0x0A,0x59}} */ - -#pragma code_seg(".orpc") -static const unsigned short IGaiaCredential_FormatStringOffsetTable[] = - { - 94, - 132, - 164, - 226, - 276 - }; - -static const MIDL_STUBLESS_PROXY_INFO IGaiaCredential_ProxyInfo = - { - &Object_StubDesc, - gaia_credential_provider__MIDL_ProcFormatString.Format, - &IGaiaCredential_FormatStringOffsetTable[-3], - 0, - 0, - 0 - }; - - -static const MIDL_SERVER_INFO IGaiaCredential_ServerInfo = - { - &Object_StubDesc, - 0, - gaia_credential_provider__MIDL_ProcFormatString.Format, - &IGaiaCredential_FormatStringOffsetTable[-3], - 0, - 0, - 0, - 0}; -CINTERFACE_PROXY_VTABLE(8) _IGaiaCredentialProxyVtbl = -{ - &IGaiaCredential_ProxyInfo, - &IID_IGaiaCredential, - IUnknown_QueryInterface_Proxy, - IUnknown_AddRef_Proxy, - IUnknown_Release_Proxy , - (void *) (INT_PTR) -1 /* IGaiaCredential::Initialize */ , - (void *) (INT_PTR) -1 /* IGaiaCredential::Terminate */ , - (void *) (INT_PTR) -1 /* IGaiaCredential::FinishAuthentication */ , - (void *) (INT_PTR) -1 /* IGaiaCredential::OnUserAuthenticated */ , - (void *) (INT_PTR) -1 /* IGaiaCredential::ReportError */ -}; - -const CInterfaceStubVtbl _IGaiaCredentialStubVtbl = -{ - &IID_IGaiaCredential, - &IGaiaCredential_ServerInfo, - 8, - 0, /* pure interpreted */ - CStdStubBuffer_METHODS -}; - - -/* Object interface: IReauthCredential, ver. 0.0, - GUID={0xCC75BCEA,0xA636,0x4798,{0xBF,0x8E,0x0F,0xF6,0x4D,0x74,0x34,0x51}} */ - -#pragma code_seg(".orpc") -static const unsigned short IReauthCredential_FormatStringOffsetTable[] = - { - 326 - }; - -static const MIDL_STUBLESS_PROXY_INFO IReauthCredential_ProxyInfo = - { - &Object_StubDesc, - gaia_credential_provider__MIDL_ProcFormatString.Format, - &IReauthCredential_FormatStringOffsetTable[-3], - 0, - 0, - 0 - }; - - -static const MIDL_SERVER_INFO IReauthCredential_ServerInfo = - { - &Object_StubDesc, - 0, - gaia_credential_provider__MIDL_ProcFormatString.Format, - &IReauthCredential_FormatStringOffsetTable[-3], - 0, - 0, - 0, - 0}; -CINTERFACE_PROXY_VTABLE(4) _IReauthCredentialProxyVtbl = -{ - &IReauthCredential_ProxyInfo, - &IID_IReauthCredential, - IUnknown_QueryInterface_Proxy, - IUnknown_AddRef_Proxy, - IUnknown_Release_Proxy , - (void *) (INT_PTR) -1 /* IReauthCredential::SetUserInfo */ -}; - -const CInterfaceStubVtbl _IReauthCredentialStubVtbl = -{ - &IID_IReauthCredential, - &IReauthCredential_ServerInfo, - 4, - 0, /* pure interpreted */ - CStdStubBuffer_METHODS -}; - -static const MIDL_STUB_DESC Object_StubDesc = - { - 0, - NdrOleAllocate, - NdrOleFree, - 0, - 0, - 0, - 0, - 0, - gaia_credential_provider__MIDL_TypeFormatString.Format, - 1, /* -error bounds_check flag */ - 0x50002, /* Ndr library version */ - 0, - 0x801026e, /* MIDL Version 8.1.622 */ - 0, - UserMarshalRoutines, - 0, /* notify & notify_flag routine table */ - 0x1, /* MIDL flag */ - 0, /* cs routines */ - 0, /* proxy/server info */ - 0 - }; - -const CInterfaceProxyVtbl * const _gaia_credential_provider_ProxyVtblList[] = -{ - ( CInterfaceProxyVtbl *) &_IGaiaCredentialProviderProxyVtbl, - ( CInterfaceProxyVtbl *) &_IGaiaCredentialProxyVtbl, - ( CInterfaceProxyVtbl *) &_IReauthCredentialProxyVtbl, - ( CInterfaceProxyVtbl *) &_IGaiaCredentialProviderForTestingProxyVtbl, - 0 -}; - -const CInterfaceStubVtbl * const _gaia_credential_provider_StubVtblList[] = -{ - ( CInterfaceStubVtbl *) &_IGaiaCredentialProviderStubVtbl, - ( CInterfaceStubVtbl *) &_IGaiaCredentialStubVtbl, - ( CInterfaceStubVtbl *) &_IReauthCredentialStubVtbl, - ( CInterfaceStubVtbl *) &_IGaiaCredentialProviderForTestingStubVtbl, - 0 -}; - -PCInterfaceName const _gaia_credential_provider_InterfaceNamesList[] = -{ - "IGaiaCredentialProvider", - "IGaiaCredential", - "IReauthCredential", - "IGaiaCredentialProviderForTesting", - 0 -}; - - -#define _gaia_credential_provider_CHECK_IID(n) IID_GENERIC_CHECK_IID( _gaia_credential_provider, pIID, n) - -int __stdcall _gaia_credential_provider_IID_Lookup( const IID * pIID, int * pIndex ) -{ - IID_BS_LOOKUP_SETUP - - IID_BS_LOOKUP_INITIAL_TEST( _gaia_credential_provider, 4, 2 ) - IID_BS_LOOKUP_NEXT_TEST( _gaia_credential_provider, 1 ) - IID_BS_LOOKUP_RETURN_RESULT( _gaia_credential_provider, 4, *pIndex ) - -} - -const ExtendedProxyFileInfo gaia_credential_provider_ProxyFileInfo = -{ - (PCInterfaceProxyVtblList *) & _gaia_credential_provider_ProxyVtblList, - (PCInterfaceStubVtblList *) & _gaia_credential_provider_StubVtblList, - (const PCInterfaceName * ) & _gaia_credential_provider_InterfaceNamesList, - 0, /* no delegation */ - & _gaia_credential_provider_IID_Lookup, - 4, - 2, - 0, /* table of [async_uuid] interfaces */ - 0, /* Filler1 */ - 0, /* Filler2 */ - 0 /* Filler3 */ -}; -#if _MSC_VER >= 1200 -#pragma warning(pop) -#endif - - -#endif /* defined(_M_AMD64)*/ -
diff --git a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x86/gaia_credential_provider.dlldata.c b/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x86/gaia_credential_provider.dlldata.c deleted file mode 100644 index da368593..0000000 --- a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x86/gaia_credential_provider.dlldata.c +++ /dev/null
@@ -1,37 +0,0 @@ -/********************************************************* - DllData file -- generated by MIDL compiler - - DO NOT ALTER THIS FILE - - This file is regenerated by MIDL on every IDL file compile. - - To completely reconstruct this file, delete it and rerun MIDL - on all the IDL files in this DLL, specifying this file for the - /dlldata command line option - -*********************************************************/ - - -#include <rpcproxy.h> - -#ifdef __cplusplus -extern "C" { -#endif - -EXTERN_PROXY_FILE( gaia_credential_provider ) - - -PROXYFILE_LIST_START -/* Start of list */ - REFERENCE_PROXY_FILE( gaia_credential_provider ), -/* End of list */ -PROXYFILE_LIST_END - - -DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) - -#ifdef __cplusplus -} /*extern "C" */ -#endif - -/* end of generated dlldata file */
diff --git a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x86/gaia_credential_provider.tlb b/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x86/gaia_credential_provider.tlb deleted file mode 100644 index cd1e751..0000000 --- a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x86/gaia_credential_provider.tlb +++ /dev/null Binary files differ
diff --git a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x86/gaia_credential_provider_i.c b/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x86/gaia_credential_provider_i.c deleted file mode 100644 index 48dc5c3..0000000 --- a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x86/gaia_credential_provider_i.c +++ /dev/null
@@ -1,100 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ - -/* link this file in with the server and any clients */ - - - /* File created by MIDL compiler version 8.xx.xxxx */ -/* at a redacted point in time - */ -/* Compiler settings for ../../chrome/credential_provider/gaiacp/gaia_credential_provider.idl: - Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.xx.xxxx - protocol : dce , ms_ext, c_ext, robust - error checks: allocation ref bounds_check enum stub_data - VC __declspec() decoration level: - __declspec(uuid()), __declspec(selectany), __declspec(novtable) - DECLSPEC_UUID(), MIDL_INTERFACE() -*/ -/* @@MIDL_FILE_HEADING( ) */ - -#pragma warning( disable: 4049 ) /* more than 64k source lines */ - - -#ifdef __cplusplus -extern "C"{ -#endif - - -#include <rpc.h> -#include <rpcndr.h> - -#ifdef _MIDL_USE_GUIDDEF_ - -#ifndef INITGUID -#define INITGUID -#include <guiddef.h> -#undef INITGUID -#else -#include <guiddef.h> -#endif - -#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ - DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) - -#else // !_MIDL_USE_GUIDDEF_ - -#ifndef __IID_DEFINED__ -#define __IID_DEFINED__ - -typedef struct _IID -{ - unsigned long x; - unsigned short s1; - unsigned short s2; - unsigned char c[8]; -} IID; - -#endif // __IID_DEFINED__ - -#ifndef CLSID_DEFINED -#define CLSID_DEFINED -typedef IID CLSID; -#endif // CLSID_DEFINED - -#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ - EXTERN_C __declspec(selectany) const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} - -#endif // !_MIDL_USE_GUIDDEF_ - -MIDL_DEFINE_GUID(IID, IID_IGaiaCredentialProvider,0xCEC9EF6C,0xB2E6,0x4BB6,0x8F,0x1E,0x17,0x47,0xBA,0x4F,0x71,0x38); - - -MIDL_DEFINE_GUID(IID, IID_IGaiaCredentialProviderForTesting,0x224CE2FB,0x2977,0x4585,0xBD,0x46,0x1B,0xAE,0x8D,0x79,0x64,0xDE); - - -MIDL_DEFINE_GUID(IID, IID_IGaiaCredential,0xE5BF88DF,0x9966,0x465B,0xB2,0x33,0xC1,0xCA,0xC7,0x51,0x0A,0x59); - - -MIDL_DEFINE_GUID(IID, IID_IReauthCredential,0xCC75BCEA,0xA636,0x4798,0xBF,0x8E,0x0F,0xF6,0x4D,0x74,0x34,0x51); - - -MIDL_DEFINE_GUID(IID, LIBID_GaiaCredentialProviderLib,0x4ADC3A52,0x8673,0x4CE3,0x81,0xF6,0x83,0x3D,0x18,0xBE,0xEB,0xA2); - - -MIDL_DEFINE_GUID(CLSID, CLSID_GaiaCredentialProvider,0x0B5BFDF0,0x4594,0x47AC,0x94,0x0A,0xCF,0xC6,0x9A,0xBC,0x56,0x1C); - - -MIDL_DEFINE_GUID(CLSID, CLSID_GaiaCredential,0x44AF95AC,0x6B23,0x4C54,0x94,0xBE,0xED,0xB1,0xCB,0x52,0xDA,0xFD); - - -MIDL_DEFINE_GUID(CLSID, CLSID_ReauthCredential,0xE6CC5D8B,0x54C2,0x4586,0xAD,0xC3,0x74,0x8E,0xD1,0x62,0x84,0xB7); - -#undef MIDL_DEFINE_GUID - -#ifdef __cplusplus -} -#endif - - -
diff --git a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x86/gaia_credential_provider_i.h b/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x86/gaia_credential_provider_i.h deleted file mode 100644 index 0ac426f0..0000000 --- a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x86/gaia_credential_provider_i.h +++ /dev/null
@@ -1,553 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 8.xx.xxxx */ -/* at a redacted point in time - */ -/* Compiler settings for ../../chrome/credential_provider/gaiacp/gaia_credential_provider.idl: - Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.xx.xxxx - protocol : dce , ms_ext, c_ext, robust - error checks: allocation ref bounds_check enum stub_data - VC __declspec() decoration level: - __declspec(uuid()), __declspec(selectany), __declspec(novtable) - DECLSPEC_UUID(), MIDL_INTERFACE() -*/ -/* @@MIDL_FILE_HEADING( ) */ - -#pragma warning( disable: 4049 ) /* more than 64k source lines */ - - -/* verify that the <rpcndr.h> version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 475 -#endif - -#include "rpc.h" -#include "rpcndr.h" - -#ifndef __RPCNDR_H_VERSION__ -#error this stub requires an updated version of <rpcndr.h> -#endif /* __RPCNDR_H_VERSION__ */ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __gaia_credential_provider_i_h__ -#define __gaia_credential_provider_i_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IGaiaCredentialProvider_FWD_DEFINED__ -#define __IGaiaCredentialProvider_FWD_DEFINED__ -typedef interface IGaiaCredentialProvider IGaiaCredentialProvider; - -#endif /* __IGaiaCredentialProvider_FWD_DEFINED__ */ - - -#ifndef __IGaiaCredentialProviderForTesting_FWD_DEFINED__ -#define __IGaiaCredentialProviderForTesting_FWD_DEFINED__ -typedef interface IGaiaCredentialProviderForTesting IGaiaCredentialProviderForTesting; - -#endif /* __IGaiaCredentialProviderForTesting_FWD_DEFINED__ */ - - -#ifndef __IGaiaCredential_FWD_DEFINED__ -#define __IGaiaCredential_FWD_DEFINED__ -typedef interface IGaiaCredential IGaiaCredential; - -#endif /* __IGaiaCredential_FWD_DEFINED__ */ - - -#ifndef __IReauthCredential_FWD_DEFINED__ -#define __IReauthCredential_FWD_DEFINED__ -typedef interface IReauthCredential IReauthCredential; - -#endif /* __IReauthCredential_FWD_DEFINED__ */ - - -#ifndef __GaiaCredentialProvider_FWD_DEFINED__ -#define __GaiaCredentialProvider_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class GaiaCredentialProvider GaiaCredentialProvider; -#else -typedef struct GaiaCredentialProvider GaiaCredentialProvider; -#endif /* __cplusplus */ - -#endif /* __GaiaCredentialProvider_FWD_DEFINED__ */ - - -#ifndef __GaiaCredential_FWD_DEFINED__ -#define __GaiaCredential_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class GaiaCredential GaiaCredential; -#else -typedef struct GaiaCredential GaiaCredential; -#endif /* __cplusplus */ - -#endif /* __GaiaCredential_FWD_DEFINED__ */ - - -#ifndef __ReauthCredential_FWD_DEFINED__ -#define __ReauthCredential_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class ReauthCredential ReauthCredential; -#else -typedef struct ReauthCredential ReauthCredential; -#endif /* __cplusplus */ - -#endif /* __ReauthCredential_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "oaidl.h" -#include "ocidl.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -#ifndef __IGaiaCredentialProvider_INTERFACE_DEFINED__ -#define __IGaiaCredentialProvider_INTERFACE_DEFINED__ - -/* interface IGaiaCredentialProvider */ -/* [unique][uuid][object] */ - - -EXTERN_C const IID IID_IGaiaCredentialProvider; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("CEC9EF6C-B2E6-4BB6-8F1E-1747BA4F7138") - IGaiaCredentialProvider : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE OnUserAuthenticated( - /* [in] */ IUnknown *credential, - /* [in] */ BSTR username, - /* [in] */ BSTR password, - /* [in] */ BSTR sid) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IGaiaCredentialProviderVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IGaiaCredentialProvider * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IGaiaCredentialProvider * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IGaiaCredentialProvider * This); - - HRESULT ( STDMETHODCALLTYPE *OnUserAuthenticated )( - IGaiaCredentialProvider * This, - /* [in] */ IUnknown *credential, - /* [in] */ BSTR username, - /* [in] */ BSTR password, - /* [in] */ BSTR sid); - - END_INTERFACE - } IGaiaCredentialProviderVtbl; - - interface IGaiaCredentialProvider - { - CONST_VTBL struct IGaiaCredentialProviderVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IGaiaCredentialProvider_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IGaiaCredentialProvider_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IGaiaCredentialProvider_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IGaiaCredentialProvider_OnUserAuthenticated(This,credential,username,password,sid) \ - ( (This)->lpVtbl -> OnUserAuthenticated(This,credential,username,password,sid) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IGaiaCredentialProvider_INTERFACE_DEFINED__ */ - - -#ifndef __IGaiaCredentialProviderForTesting_INTERFACE_DEFINED__ -#define __IGaiaCredentialProviderForTesting_INTERFACE_DEFINED__ - -/* interface IGaiaCredentialProviderForTesting */ -/* [unique][uuid][object] */ - - -EXTERN_C const IID IID_IGaiaCredentialProviderForTesting; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("224CE2FB-2977-4585-BD46-1BAE8D7964DE") - IGaiaCredentialProviderForTesting : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetReauthCheckDoneEvent( - /* [in] */ INT_PTR event) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IGaiaCredentialProviderForTestingVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IGaiaCredentialProviderForTesting * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IGaiaCredentialProviderForTesting * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IGaiaCredentialProviderForTesting * This); - - HRESULT ( STDMETHODCALLTYPE *SetReauthCheckDoneEvent )( - IGaiaCredentialProviderForTesting * This, - /* [in] */ INT_PTR event); - - END_INTERFACE - } IGaiaCredentialProviderForTestingVtbl; - - interface IGaiaCredentialProviderForTesting - { - CONST_VTBL struct IGaiaCredentialProviderForTestingVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IGaiaCredentialProviderForTesting_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IGaiaCredentialProviderForTesting_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IGaiaCredentialProviderForTesting_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IGaiaCredentialProviderForTesting_SetReauthCheckDoneEvent(This,event) \ - ( (This)->lpVtbl -> SetReauthCheckDoneEvent(This,event) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IGaiaCredentialProviderForTesting_INTERFACE_DEFINED__ */ - - -#ifndef __IGaiaCredential_INTERFACE_DEFINED__ -#define __IGaiaCredential_INTERFACE_DEFINED__ - -/* interface IGaiaCredential */ -/* [unique][uuid][object] */ - - -EXTERN_C const IID IID_IGaiaCredential; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("E5BF88DF-9966-465B-B233-C1CAC7510A59") - IGaiaCredential : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Initialize( - /* [in] */ IGaiaCredentialProvider *provider) = 0; - - virtual HRESULT STDMETHODCALLTYPE Terminate( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE FinishAuthentication( - /* [in] */ BSTR username, - /* [in] */ BSTR password, - /* [in] */ BSTR fullname, - /* [out] */ BSTR *sid, - /* [out] */ BSTR *error_text) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnUserAuthenticated( - /* [in] */ BSTR username, - /* [in] */ BSTR password, - /* [in] */ BSTR sid) = 0; - - virtual HRESULT STDMETHODCALLTYPE ReportError( - /* [in] */ LONG status, - /* [in] */ LONG substatus, - /* [in] */ BSTR status_text) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IGaiaCredentialVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IGaiaCredential * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IGaiaCredential * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IGaiaCredential * This); - - HRESULT ( STDMETHODCALLTYPE *Initialize )( - IGaiaCredential * This, - /* [in] */ IGaiaCredentialProvider *provider); - - HRESULT ( STDMETHODCALLTYPE *Terminate )( - IGaiaCredential * This); - - HRESULT ( STDMETHODCALLTYPE *FinishAuthentication )( - IGaiaCredential * This, - /* [in] */ BSTR username, - /* [in] */ BSTR password, - /* [in] */ BSTR fullname, - /* [out] */ BSTR *sid, - /* [out] */ BSTR *error_text); - - HRESULT ( STDMETHODCALLTYPE *OnUserAuthenticated )( - IGaiaCredential * This, - /* [in] */ BSTR username, - /* [in] */ BSTR password, - /* [in] */ BSTR sid); - - HRESULT ( STDMETHODCALLTYPE *ReportError )( - IGaiaCredential * This, - /* [in] */ LONG status, - /* [in] */ LONG substatus, - /* [in] */ BSTR status_text); - - END_INTERFACE - } IGaiaCredentialVtbl; - - interface IGaiaCredential - { - CONST_VTBL struct IGaiaCredentialVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IGaiaCredential_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IGaiaCredential_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IGaiaCredential_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IGaiaCredential_Initialize(This,provider) \ - ( (This)->lpVtbl -> Initialize(This,provider) ) - -#define IGaiaCredential_Terminate(This) \ - ( (This)->lpVtbl -> Terminate(This) ) - -#define IGaiaCredential_FinishAuthentication(This,username,password,fullname,sid,error_text) \ - ( (This)->lpVtbl -> FinishAuthentication(This,username,password,fullname,sid,error_text) ) - -#define IGaiaCredential_OnUserAuthenticated(This,username,password,sid) \ - ( (This)->lpVtbl -> OnUserAuthenticated(This,username,password,sid) ) - -#define IGaiaCredential_ReportError(This,status,substatus,status_text) \ - ( (This)->lpVtbl -> ReportError(This,status,substatus,status_text) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IGaiaCredential_INTERFACE_DEFINED__ */ - - -#ifndef __IReauthCredential_INTERFACE_DEFINED__ -#define __IReauthCredential_INTERFACE_DEFINED__ - -/* interface IReauthCredential */ -/* [unique][uuid][object] */ - - -EXTERN_C const IID IID_IReauthCredential; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("CC75BCEA-A636-4798-BF8E-0FF64D743451") - IReauthCredential : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetUserInfo( - /* [in] */ BSTR sid, - /* [in] */ BSTR email) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IReauthCredentialVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IReauthCredential * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IReauthCredential * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IReauthCredential * This); - - HRESULT ( STDMETHODCALLTYPE *SetUserInfo )( - IReauthCredential * This, - /* [in] */ BSTR sid, - /* [in] */ BSTR email); - - END_INTERFACE - } IReauthCredentialVtbl; - - interface IReauthCredential - { - CONST_VTBL struct IReauthCredentialVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IReauthCredential_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IReauthCredential_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IReauthCredential_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IReauthCredential_SetUserInfo(This,sid,email) \ - ( (This)->lpVtbl -> SetUserInfo(This,sid,email) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IReauthCredential_INTERFACE_DEFINED__ */ - - - -#ifndef __GaiaCredentialProviderLib_LIBRARY_DEFINED__ -#define __GaiaCredentialProviderLib_LIBRARY_DEFINED__ - -/* library GaiaCredentialProviderLib */ -/* [version][uuid] */ - - -EXTERN_C const IID LIBID_GaiaCredentialProviderLib; - -EXTERN_C const CLSID CLSID_GaiaCredentialProvider; - -#ifdef __cplusplus - -class DECLSPEC_UUID("0B5BFDF0-4594-47AC-940A-CFC69ABC561C") -GaiaCredentialProvider; -#endif - -EXTERN_C const CLSID CLSID_GaiaCredential; - -#ifdef __cplusplus - -class DECLSPEC_UUID("44AF95AC-6B23-4C54-94BE-EDB1CB52DAFD") -GaiaCredential; -#endif - -EXTERN_C const CLSID CLSID_ReauthCredential; - -#ifdef __cplusplus - -class DECLSPEC_UUID("E6CC5D8B-54C2-4586-ADC3-748ED16284B7") -ReauthCredential; -#endif -#endif /* __GaiaCredentialProviderLib_LIBRARY_DEFINED__ */ - -/* Additional Prototypes for ALL interfaces */ - -unsigned long __RPC_USER BSTR_UserSize( unsigned long *, unsigned long , BSTR * ); -unsigned char * __RPC_USER BSTR_UserMarshal( unsigned long *, unsigned char *, BSTR * ); -unsigned char * __RPC_USER BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * ); -void __RPC_USER BSTR_UserFree( unsigned long *, BSTR * ); - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - -
diff --git a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x86/gaia_credential_provider_p.c b/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x86/gaia_credential_provider_p.c deleted file mode 100644 index db38570..0000000 --- a/third_party/win_build_output/midl/chrome/credential_provider/gaiacp/x86/gaia_credential_provider_p.c +++ /dev/null
@@ -1,833 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the proxy stub code */ - - - /* File created by MIDL compiler version 8.xx.xxxx */ -/* at a redacted point in time - */ -/* Compiler settings for ../../chrome/credential_provider/gaiacp/gaia_credential_provider.idl: - Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.xx.xxxx - protocol : dce , ms_ext, c_ext, robust - error checks: allocation ref bounds_check enum stub_data - VC __declspec() decoration level: - __declspec(uuid()), __declspec(selectany), __declspec(novtable) - DECLSPEC_UUID(), MIDL_INTERFACE() -*/ -/* @@MIDL_FILE_HEADING( ) */ - -#if !defined(_M_IA64) && !defined(_M_AMD64) && !defined(_ARM_) - - -#pragma warning( disable: 4049 ) /* more than 64k source lines */ -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif - -#pragma warning( disable: 4211 ) /* redefine extern to static */ -#pragma warning( disable: 4232 ) /* dllimport identity*/ -#pragma warning( disable: 4024 ) /* array to pointer mapping*/ -#pragma warning( disable: 4152 ) /* function/data pointer conversion in expression */ -#pragma warning( disable: 4100 ) /* unreferenced arguments in x86 call */ - -#pragma optimize("", off ) - -#define USE_STUBLESS_PROXY - - -/* verify that the <rpcproxy.h> version is high enough to compile this file*/ -#ifndef __REDQ_RPCPROXY_H_VERSION__ -#define __REQUIRED_RPCPROXY_H_VERSION__ 475 -#endif - - -#include "rpcproxy.h" -#ifndef __RPCPROXY_H_VERSION__ -#error this stub requires an updated version of <rpcproxy.h> -#endif /* __RPCPROXY_H_VERSION__ */ - - -#include "gaia_credential_provider_i.h" - -#define TYPE_FORMAT_STRING_SIZE 93 -#define PROC_FORMAT_STRING_SIZE 355 -#define EXPR_FORMAT_STRING_SIZE 1 -#define TRANSMIT_AS_TABLE_SIZE 0 -#define WIRE_MARSHAL_TABLE_SIZE 1 - -typedef struct _gaia_credential_provider_MIDL_TYPE_FORMAT_STRING - { - short Pad; - unsigned char Format[ TYPE_FORMAT_STRING_SIZE ]; - } gaia_credential_provider_MIDL_TYPE_FORMAT_STRING; - -typedef struct _gaia_credential_provider_MIDL_PROC_FORMAT_STRING - { - short Pad; - unsigned char Format[ PROC_FORMAT_STRING_SIZE ]; - } gaia_credential_provider_MIDL_PROC_FORMAT_STRING; - -typedef struct _gaia_credential_provider_MIDL_EXPR_FORMAT_STRING - { - long Pad; - unsigned char Format[ EXPR_FORMAT_STRING_SIZE ]; - } gaia_credential_provider_MIDL_EXPR_FORMAT_STRING; - - -static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax = -{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}; - - -extern const gaia_credential_provider_MIDL_TYPE_FORMAT_STRING gaia_credential_provider__MIDL_TypeFormatString; -extern const gaia_credential_provider_MIDL_PROC_FORMAT_STRING gaia_credential_provider__MIDL_ProcFormatString; -extern const gaia_credential_provider_MIDL_EXPR_FORMAT_STRING gaia_credential_provider__MIDL_ExprFormatString; - - -extern const MIDL_STUB_DESC Object_StubDesc; - - -extern const MIDL_SERVER_INFO IGaiaCredentialProvider_ServerInfo; -extern const MIDL_STUBLESS_PROXY_INFO IGaiaCredentialProvider_ProxyInfo; - - -extern const MIDL_STUB_DESC Object_StubDesc; - - -extern const MIDL_SERVER_INFO IGaiaCredentialProviderForTesting_ServerInfo; -extern const MIDL_STUBLESS_PROXY_INFO IGaiaCredentialProviderForTesting_ProxyInfo; - - -extern const MIDL_STUB_DESC Object_StubDesc; - - -extern const MIDL_SERVER_INFO IGaiaCredential_ServerInfo; -extern const MIDL_STUBLESS_PROXY_INFO IGaiaCredential_ProxyInfo; - - -extern const MIDL_STUB_DESC Object_StubDesc; - - -extern const MIDL_SERVER_INFO IReauthCredential_ServerInfo; -extern const MIDL_STUBLESS_PROXY_INFO IReauthCredential_ProxyInfo; - - -extern const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ]; - -#if !defined(__RPC_WIN32__) -#error Invalid build platform for this stub. -#endif - -#if !(TARGET_IS_NT50_OR_LATER) -#error You need Windows 2000 or later to run this stub because it uses these features: -#error /robust command line switch. -#error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems. -#error This app will fail with the RPC_X_WRONG_STUB_VERSION error. -#endif - - -static const gaia_credential_provider_MIDL_PROC_FORMAT_STRING gaia_credential_provider__MIDL_ProcFormatString = - { - 0, - { - - /* Procedure OnUserAuthenticated */ - - 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 2 */ NdrFcLong( 0x0 ), /* 0 */ -/* 6 */ NdrFcShort( 0x3 ), /* 3 */ -/* 8 */ NdrFcShort( 0x18 ), /* x86 Stack size/offset = 24 */ -/* 10 */ NdrFcShort( 0x0 ), /* 0 */ -/* 12 */ NdrFcShort( 0x8 ), /* 8 */ -/* 14 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ - 0x5, /* 5 */ -/* 16 */ 0x8, /* 8 */ - 0x5, /* Ext Flags: new corr desc, srv corr check, */ -/* 18 */ NdrFcShort( 0x0 ), /* 0 */ -/* 20 */ NdrFcShort( 0x1 ), /* 1 */ -/* 22 */ NdrFcShort( 0x0 ), /* 0 */ - - /* Parameter credential */ - -/* 24 */ NdrFcShort( 0xb ), /* Flags: must size, must free, in, */ -/* 26 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ -/* 28 */ NdrFcShort( 0x2 ), /* Type Offset=2 */ - - /* Parameter username */ - -/* 30 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 32 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ -/* 34 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Parameter password */ - -/* 36 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 38 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ -/* 40 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Parameter sid */ - -/* 42 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 44 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */ -/* 46 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Return value */ - -/* 48 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 50 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */ -/* 52 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Procedure SetReauthCheckDoneEvent */ - -/* 54 */ 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 56 */ NdrFcLong( 0x0 ), /* 0 */ -/* 60 */ NdrFcShort( 0x3 ), /* 3 */ -/* 62 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ -/* 64 */ NdrFcShort( 0x8 ), /* 8 */ -/* 66 */ NdrFcShort( 0x8 ), /* 8 */ -/* 68 */ 0x44, /* Oi2 Flags: has return, has ext, */ - 0x2, /* 2 */ -/* 70 */ 0x8, /* 8 */ - 0x1, /* Ext Flags: new corr desc, */ -/* 72 */ NdrFcShort( 0x0 ), /* 0 */ -/* 74 */ NdrFcShort( 0x0 ), /* 0 */ -/* 76 */ NdrFcShort( 0x0 ), /* 0 */ - - /* Parameter event */ - -/* 78 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ -/* 80 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ -/* 82 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Return value */ - -/* 84 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 86 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ -/* 88 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Procedure Initialize */ - -/* 90 */ 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 92 */ NdrFcLong( 0x0 ), /* 0 */ -/* 96 */ NdrFcShort( 0x3 ), /* 3 */ -/* 98 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ -/* 100 */ NdrFcShort( 0x0 ), /* 0 */ -/* 102 */ NdrFcShort( 0x8 ), /* 8 */ -/* 104 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ - 0x2, /* 2 */ -/* 106 */ 0x8, /* 8 */ - 0x1, /* Ext Flags: new corr desc, */ -/* 108 */ NdrFcShort( 0x0 ), /* 0 */ -/* 110 */ NdrFcShort( 0x0 ), /* 0 */ -/* 112 */ NdrFcShort( 0x0 ), /* 0 */ - - /* Parameter provider */ - -/* 114 */ NdrFcShort( 0xb ), /* Flags: must size, must free, in, */ -/* 116 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ -/* 118 */ NdrFcShort( 0x38 ), /* Type Offset=56 */ - - /* Return value */ - -/* 120 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 122 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ -/* 124 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Procedure Terminate */ - -/* 126 */ 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 128 */ NdrFcLong( 0x0 ), /* 0 */ -/* 132 */ NdrFcShort( 0x4 ), /* 4 */ -/* 134 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ -/* 136 */ NdrFcShort( 0x0 ), /* 0 */ -/* 138 */ NdrFcShort( 0x8 ), /* 8 */ -/* 140 */ 0x44, /* Oi2 Flags: has return, has ext, */ - 0x1, /* 1 */ -/* 142 */ 0x8, /* 8 */ - 0x1, /* Ext Flags: new corr desc, */ -/* 144 */ NdrFcShort( 0x0 ), /* 0 */ -/* 146 */ NdrFcShort( 0x0 ), /* 0 */ -/* 148 */ NdrFcShort( 0x0 ), /* 0 */ - - /* Return value */ - -/* 150 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 152 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ -/* 154 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Procedure FinishAuthentication */ - -/* 156 */ 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 158 */ NdrFcLong( 0x0 ), /* 0 */ -/* 162 */ NdrFcShort( 0x5 ), /* 5 */ -/* 164 */ NdrFcShort( 0x1c ), /* x86 Stack size/offset = 28 */ -/* 166 */ NdrFcShort( 0x0 ), /* 0 */ -/* 168 */ NdrFcShort( 0x8 ), /* 8 */ -/* 170 */ 0x47, /* Oi2 Flags: srv must size, clt must size, has return, has ext, */ - 0x6, /* 6 */ -/* 172 */ 0x8, /* 8 */ - 0x7, /* Ext Flags: new corr desc, clt corr check, srv corr check, */ -/* 174 */ NdrFcShort( 0x1 ), /* 1 */ -/* 176 */ NdrFcShort( 0x1 ), /* 1 */ -/* 178 */ NdrFcShort( 0x0 ), /* 0 */ - - /* Parameter username */ - -/* 180 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 182 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ -/* 184 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Parameter password */ - -/* 186 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 188 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ -/* 190 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Parameter fullname */ - -/* 192 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 194 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ -/* 196 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Parameter sid */ - -/* 198 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ -/* 200 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */ -/* 202 */ NdrFcShort( 0x52 ), /* Type Offset=82 */ - - /* Parameter error_text */ - -/* 204 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ -/* 206 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */ -/* 208 */ NdrFcShort( 0x52 ), /* Type Offset=82 */ - - /* Return value */ - -/* 210 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 212 */ NdrFcShort( 0x18 ), /* x86 Stack size/offset = 24 */ -/* 214 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Procedure OnUserAuthenticated */ - -/* 216 */ 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 218 */ NdrFcLong( 0x0 ), /* 0 */ -/* 222 */ NdrFcShort( 0x6 ), /* 6 */ -/* 224 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */ -/* 226 */ NdrFcShort( 0x0 ), /* 0 */ -/* 228 */ NdrFcShort( 0x8 ), /* 8 */ -/* 230 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ - 0x4, /* 4 */ -/* 232 */ 0x8, /* 8 */ - 0x5, /* Ext Flags: new corr desc, srv corr check, */ -/* 234 */ NdrFcShort( 0x0 ), /* 0 */ -/* 236 */ NdrFcShort( 0x1 ), /* 1 */ -/* 238 */ NdrFcShort( 0x0 ), /* 0 */ - - /* Parameter username */ - -/* 240 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 242 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ -/* 244 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Parameter password */ - -/* 246 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 248 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ -/* 250 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Parameter sid */ - -/* 252 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 254 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ -/* 256 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Return value */ - -/* 258 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 260 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */ -/* 262 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Procedure ReportError */ - -/* 264 */ 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 266 */ NdrFcLong( 0x0 ), /* 0 */ -/* 270 */ NdrFcShort( 0x7 ), /* 7 */ -/* 272 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */ -/* 274 */ NdrFcShort( 0x10 ), /* 16 */ -/* 276 */ NdrFcShort( 0x8 ), /* 8 */ -/* 278 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ - 0x4, /* 4 */ -/* 280 */ 0x8, /* 8 */ - 0x5, /* Ext Flags: new corr desc, srv corr check, */ -/* 282 */ NdrFcShort( 0x0 ), /* 0 */ -/* 284 */ NdrFcShort( 0x1 ), /* 1 */ -/* 286 */ NdrFcShort( 0x0 ), /* 0 */ - - /* Parameter status */ - -/* 288 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ -/* 290 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ -/* 292 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Parameter substatus */ - -/* 294 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ -/* 296 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ -/* 298 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Parameter status_text */ - -/* 300 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 302 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ -/* 304 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Return value */ - -/* 306 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 308 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */ -/* 310 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Procedure SetUserInfo */ - -/* 312 */ 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 314 */ NdrFcLong( 0x0 ), /* 0 */ -/* 318 */ NdrFcShort( 0x3 ), /* 3 */ -/* 320 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */ -/* 322 */ NdrFcShort( 0x0 ), /* 0 */ -/* 324 */ NdrFcShort( 0x8 ), /* 8 */ -/* 326 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ - 0x3, /* 3 */ -/* 328 */ 0x8, /* 8 */ - 0x5, /* Ext Flags: new corr desc, srv corr check, */ -/* 330 */ NdrFcShort( 0x0 ), /* 0 */ -/* 332 */ NdrFcShort( 0x1 ), /* 1 */ -/* 334 */ NdrFcShort( 0x0 ), /* 0 */ - - /* Parameter sid */ - -/* 336 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 338 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ -/* 340 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Parameter email */ - -/* 342 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -/* 344 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ -/* 346 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ - - /* Return value */ - -/* 348 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 350 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ -/* 352 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - 0x0 - } - }; - -static const gaia_credential_provider_MIDL_TYPE_FORMAT_STRING gaia_credential_provider__MIDL_TypeFormatString = - { - 0, - { - NdrFcShort( 0x0 ), /* 0 */ -/* 2 */ - 0x2f, /* FC_IP */ - 0x5a, /* FC_CONSTANT_IID */ -/* 4 */ NdrFcLong( 0x0 ), /* 0 */ -/* 8 */ NdrFcShort( 0x0 ), /* 0 */ -/* 10 */ NdrFcShort( 0x0 ), /* 0 */ -/* 12 */ 0xc0, /* 192 */ - 0x0, /* 0 */ -/* 14 */ 0x0, /* 0 */ - 0x0, /* 0 */ -/* 16 */ 0x0, /* 0 */ - 0x0, /* 0 */ -/* 18 */ 0x0, /* 0 */ - 0x46, /* 70 */ -/* 20 */ - 0x12, 0x0, /* FC_UP */ -/* 22 */ NdrFcShort( 0xe ), /* Offset= 14 (36) */ -/* 24 */ - 0x1b, /* FC_CARRAY */ - 0x1, /* 1 */ -/* 26 */ NdrFcShort( 0x2 ), /* 2 */ -/* 28 */ 0x9, /* Corr desc: FC_ULONG */ - 0x0, /* */ -/* 30 */ NdrFcShort( 0xfffc ), /* -4 */ -/* 32 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ -/* 34 */ 0x6, /* FC_SHORT */ - 0x5b, /* FC_END */ -/* 36 */ - 0x17, /* FC_CSTRUCT */ - 0x3, /* 3 */ -/* 38 */ NdrFcShort( 0x8 ), /* 8 */ -/* 40 */ NdrFcShort( 0xfff0 ), /* Offset= -16 (24) */ -/* 42 */ 0x8, /* FC_LONG */ - 0x8, /* FC_LONG */ -/* 44 */ 0x5c, /* FC_PAD */ - 0x5b, /* FC_END */ -/* 46 */ 0xb4, /* FC_USER_MARSHAL */ - 0x83, /* 131 */ -/* 48 */ NdrFcShort( 0x0 ), /* 0 */ -/* 50 */ NdrFcShort( 0x4 ), /* 4 */ -/* 52 */ NdrFcShort( 0x0 ), /* 0 */ -/* 54 */ NdrFcShort( 0xffde ), /* Offset= -34 (20) */ -/* 56 */ - 0x2f, /* FC_IP */ - 0x5a, /* FC_CONSTANT_IID */ -/* 58 */ NdrFcLong( 0xcec9ef6c ), /* -825626772 */ -/* 62 */ NdrFcShort( 0xb2e6 ), /* -19738 */ -/* 64 */ NdrFcShort( 0x4bb6 ), /* 19382 */ -/* 66 */ 0x8f, /* 143 */ - 0x1e, /* 30 */ -/* 68 */ 0x17, /* 23 */ - 0x47, /* 71 */ -/* 70 */ 0xba, /* 186 */ - 0x4f, /* 79 */ -/* 72 */ 0x71, /* 113 */ - 0x38, /* 56 */ -/* 74 */ - 0x11, 0x4, /* FC_RP [alloced_on_stack] */ -/* 76 */ NdrFcShort( 0x6 ), /* Offset= 6 (82) */ -/* 78 */ - 0x13, 0x0, /* FC_OP */ -/* 80 */ NdrFcShort( 0xffd4 ), /* Offset= -44 (36) */ -/* 82 */ 0xb4, /* FC_USER_MARSHAL */ - 0x83, /* 131 */ -/* 84 */ NdrFcShort( 0x0 ), /* 0 */ -/* 86 */ NdrFcShort( 0x4 ), /* 4 */ -/* 88 */ NdrFcShort( 0x0 ), /* 0 */ -/* 90 */ NdrFcShort( 0xfff4 ), /* Offset= -12 (78) */ - - 0x0 - } - }; - -static const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ] = - { - - { - BSTR_UserSize - ,BSTR_UserMarshal - ,BSTR_UserUnmarshal - ,BSTR_UserFree - } - - }; - - - -/* Object interface: IUnknown, ver. 0.0, - GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */ - - -/* Object interface: IGaiaCredentialProvider, ver. 0.0, - GUID={0xCEC9EF6C,0xB2E6,0x4BB6,{0x8F,0x1E,0x17,0x47,0xBA,0x4F,0x71,0x38}} */ - -#pragma code_seg(".orpc") -static const unsigned short IGaiaCredentialProvider_FormatStringOffsetTable[] = - { - 0 - }; - -static const MIDL_STUBLESS_PROXY_INFO IGaiaCredentialProvider_ProxyInfo = - { - &Object_StubDesc, - gaia_credential_provider__MIDL_ProcFormatString.Format, - &IGaiaCredentialProvider_FormatStringOffsetTable[-3], - 0, - 0, - 0 - }; - - -static const MIDL_SERVER_INFO IGaiaCredentialProvider_ServerInfo = - { - &Object_StubDesc, - 0, - gaia_credential_provider__MIDL_ProcFormatString.Format, - &IGaiaCredentialProvider_FormatStringOffsetTable[-3], - 0, - 0, - 0, - 0}; -CINTERFACE_PROXY_VTABLE(4) _IGaiaCredentialProviderProxyVtbl = -{ - &IGaiaCredentialProvider_ProxyInfo, - &IID_IGaiaCredentialProvider, - IUnknown_QueryInterface_Proxy, - IUnknown_AddRef_Proxy, - IUnknown_Release_Proxy , - (void *) (INT_PTR) -1 /* IGaiaCredentialProvider::OnUserAuthenticated */ -}; - -const CInterfaceStubVtbl _IGaiaCredentialProviderStubVtbl = -{ - &IID_IGaiaCredentialProvider, - &IGaiaCredentialProvider_ServerInfo, - 4, - 0, /* pure interpreted */ - CStdStubBuffer_METHODS -}; - - -/* Object interface: IGaiaCredentialProviderForTesting, ver. 0.0, - GUID={0x224CE2FB,0x2977,0x4585,{0xBD,0x46,0x1B,0xAE,0x8D,0x79,0x64,0xDE}} */ - -#pragma code_seg(".orpc") -static const unsigned short IGaiaCredentialProviderForTesting_FormatStringOffsetTable[] = - { - 54 - }; - -static const MIDL_STUBLESS_PROXY_INFO IGaiaCredentialProviderForTesting_ProxyInfo = - { - &Object_StubDesc, - gaia_credential_provider__MIDL_ProcFormatString.Format, - &IGaiaCredentialProviderForTesting_FormatStringOffsetTable[-3], - 0, - 0, - 0 - }; - - -static const MIDL_SERVER_INFO IGaiaCredentialProviderForTesting_ServerInfo = - { - &Object_StubDesc, - 0, - gaia_credential_provider__MIDL_ProcFormatString.Format, - &IGaiaCredentialProviderForTesting_FormatStringOffsetTable[-3], - 0, - 0, - 0, - 0}; -CINTERFACE_PROXY_VTABLE(4) _IGaiaCredentialProviderForTestingProxyVtbl = -{ - &IGaiaCredentialProviderForTesting_ProxyInfo, - &IID_IGaiaCredentialProviderForTesting, - IUnknown_QueryInterface_Proxy, - IUnknown_AddRef_Proxy, - IUnknown_Release_Proxy , - (void *) (INT_PTR) -1 /* IGaiaCredentialProviderForTesting::SetReauthCheckDoneEvent */ -}; - -const CInterfaceStubVtbl _IGaiaCredentialProviderForTestingStubVtbl = -{ - &IID_IGaiaCredentialProviderForTesting, - &IGaiaCredentialProviderForTesting_ServerInfo, - 4, - 0, /* pure interpreted */ - CStdStubBuffer_METHODS -}; - - -/* Object interface: IGaiaCredential, ver. 0.0, - GUID={0xE5BF88DF,0x9966,0x465B,{0xB2,0x33,0xC1,0xCA,0xC7,0x51,0x0A,0x59}} */ - -#pragma code_seg(".orpc") -static const unsigned short IGaiaCredential_FormatStringOffsetTable[] = - { - 90, - 126, - 156, - 216, - 264 - }; - -static const MIDL_STUBLESS_PROXY_INFO IGaiaCredential_ProxyInfo = - { - &Object_StubDesc, - gaia_credential_provider__MIDL_ProcFormatString.Format, - &IGaiaCredential_FormatStringOffsetTable[-3], - 0, - 0, - 0 - }; - - -static const MIDL_SERVER_INFO IGaiaCredential_ServerInfo = - { - &Object_StubDesc, - 0, - gaia_credential_provider__MIDL_ProcFormatString.Format, - &IGaiaCredential_FormatStringOffsetTable[-3], - 0, - 0, - 0, - 0}; -CINTERFACE_PROXY_VTABLE(8) _IGaiaCredentialProxyVtbl = -{ - &IGaiaCredential_ProxyInfo, - &IID_IGaiaCredential, - IUnknown_QueryInterface_Proxy, - IUnknown_AddRef_Proxy, - IUnknown_Release_Proxy , - (void *) (INT_PTR) -1 /* IGaiaCredential::Initialize */ , - (void *) (INT_PTR) -1 /* IGaiaCredential::Terminate */ , - (void *) (INT_PTR) -1 /* IGaiaCredential::FinishAuthentication */ , - (void *) (INT_PTR) -1 /* IGaiaCredential::OnUserAuthenticated */ , - (void *) (INT_PTR) -1 /* IGaiaCredential::ReportError */ -}; - -const CInterfaceStubVtbl _IGaiaCredentialStubVtbl = -{ - &IID_IGaiaCredential, - &IGaiaCredential_ServerInfo, - 8, - 0, /* pure interpreted */ - CStdStubBuffer_METHODS -}; - - -/* Object interface: IReauthCredential, ver. 0.0, - GUID={0xCC75BCEA,0xA636,0x4798,{0xBF,0x8E,0x0F,0xF6,0x4D,0x74,0x34,0x51}} */ - -#pragma code_seg(".orpc") -static const unsigned short IReauthCredential_FormatStringOffsetTable[] = - { - 312 - }; - -static const MIDL_STUBLESS_PROXY_INFO IReauthCredential_ProxyInfo = - { - &Object_StubDesc, - gaia_credential_provider__MIDL_ProcFormatString.Format, - &IReauthCredential_FormatStringOffsetTable[-3], - 0, - 0, - 0 - }; - - -static const MIDL_SERVER_INFO IReauthCredential_ServerInfo = - { - &Object_StubDesc, - 0, - gaia_credential_provider__MIDL_ProcFormatString.Format, - &IReauthCredential_FormatStringOffsetTable[-3], - 0, - 0, - 0, - 0}; -CINTERFACE_PROXY_VTABLE(4) _IReauthCredentialProxyVtbl = -{ - &IReauthCredential_ProxyInfo, - &IID_IReauthCredential, - IUnknown_QueryInterface_Proxy, - IUnknown_AddRef_Proxy, - IUnknown_Release_Proxy , - (void *) (INT_PTR) -1 /* IReauthCredential::SetUserInfo */ -}; - -const CInterfaceStubVtbl _IReauthCredentialStubVtbl = -{ - &IID_IReauthCredential, - &IReauthCredential_ServerInfo, - 4, - 0, /* pure interpreted */ - CStdStubBuffer_METHODS -}; - -static const MIDL_STUB_DESC Object_StubDesc = - { - 0, - NdrOleAllocate, - NdrOleFree, - 0, - 0, - 0, - 0, - 0, - gaia_credential_provider__MIDL_TypeFormatString.Format, - 1, /* -error bounds_check flag */ - 0x50002, /* Ndr library version */ - 0, - 0x801026e, /* MIDL Version 8.1.622 */ - 0, - UserMarshalRoutines, - 0, /* notify & notify_flag routine table */ - 0x1, /* MIDL flag */ - 0, /* cs routines */ - 0, /* proxy/server info */ - 0 - }; - -const CInterfaceProxyVtbl * const _gaia_credential_provider_ProxyVtblList[] = -{ - ( CInterfaceProxyVtbl *) &_IGaiaCredentialProviderProxyVtbl, - ( CInterfaceProxyVtbl *) &_IGaiaCredentialProxyVtbl, - ( CInterfaceProxyVtbl *) &_IReauthCredentialProxyVtbl, - ( CInterfaceProxyVtbl *) &_IGaiaCredentialProviderForTestingProxyVtbl, - 0 -}; - -const CInterfaceStubVtbl * const _gaia_credential_provider_StubVtblList[] = -{ - ( CInterfaceStubVtbl *) &_IGaiaCredentialProviderStubVtbl, - ( CInterfaceStubVtbl *) &_IGaiaCredentialStubVtbl, - ( CInterfaceStubVtbl *) &_IReauthCredentialStubVtbl, - ( CInterfaceStubVtbl *) &_IGaiaCredentialProviderForTestingStubVtbl, - 0 -}; - -PCInterfaceName const _gaia_credential_provider_InterfaceNamesList[] = -{ - "IGaiaCredentialProvider", - "IGaiaCredential", - "IReauthCredential", - "IGaiaCredentialProviderForTesting", - 0 -}; - - -#define _gaia_credential_provider_CHECK_IID(n) IID_GENERIC_CHECK_IID( _gaia_credential_provider, pIID, n) - -int __stdcall _gaia_credential_provider_IID_Lookup( const IID * pIID, int * pIndex ) -{ - IID_BS_LOOKUP_SETUP - - IID_BS_LOOKUP_INITIAL_TEST( _gaia_credential_provider, 4, 2 ) - IID_BS_LOOKUP_NEXT_TEST( _gaia_credential_provider, 1 ) - IID_BS_LOOKUP_RETURN_RESULT( _gaia_credential_provider, 4, *pIndex ) - -} - -const ExtendedProxyFileInfo gaia_credential_provider_ProxyFileInfo = -{ - (PCInterfaceProxyVtblList *) & _gaia_credential_provider_ProxyVtblList, - (PCInterfaceStubVtblList *) & _gaia_credential_provider_StubVtblList, - (const PCInterfaceName * ) & _gaia_credential_provider_InterfaceNamesList, - 0, /* no delegation */ - & _gaia_credential_provider_IID_Lookup, - 4, - 2, - 0, /* table of [async_uuid] interfaces */ - 0, /* Filler1 */ - 0, /* Filler2 */ - 0 /* Filler3 */ -}; -#if _MSC_VER >= 1200 -#pragma warning(pop) -#endif - - -#endif /* !defined(_M_IA64) && !defined(_M_AMD64) && !defined(_ARM_) */ -
diff --git a/tools/gritsettings/resource_ids b/tools/gritsettings/resource_ids index 0d621a15..68b9c12 100644 --- a/tools/gritsettings/resource_ids +++ b/tools/gritsettings/resource_ids
@@ -139,16 +139,12 @@ "chrome/common/common_resources.grd": { "includes": [13380], }, - "chrome/credential_provider/gaiacp/gaia_resources.grd": { - "includes": [13400], - "messages": [13410], - }, "chrome/renderer/resources/renderer_resources.grd": { - "includes": [13500], - "structures": [13600], + "includes": [13390], + "structures": [13470], }, "chrome/test/data/webui_test_resources.grd": { - "includes": [13650], + "includes": [13480], }, # END chrome/ miscellaneous section.
diff --git a/tools/gritsettings/translation_expectations.pyl b/tools/gritsettings/translation_expectations.pyl index 5cb6aa8..24d06b0 100644 --- a/tools/gritsettings/translation_expectations.pyl +++ b/tools/gritsettings/translation_expectations.pyl
@@ -34,7 +34,6 @@ "components/components_strings.grd", "components/policy/resources/policy_templates.grd", "content/app/strings/content_strings.grd", - "credential_provider/gaiacp/gaia_resources.grd", "device/bluetooth/bluetooth_strings.grd", "device/fido/fido_strings.grd", "extensions/strings/extensions_strings.grd",
diff --git a/tools/metrics/BUILD.gn b/tools/metrics/BUILD.gn index c95de626..9c1a96c 100644 --- a/tools/metrics/BUILD.gn +++ b/tools/metrics/BUILD.gn
@@ -88,10 +88,9 @@ "//tools/metrics/metrics_python_tests.py", "//tools/metrics/actions/action_utils.py", + "//tools/metrics/actions/actions_print_style.py", "//tools/metrics/actions/extract_actions.py", "//tools/metrics/actions/extract_actions_test.py", - "//tools/metrics/actions/pretty_print.py", - "//tools/metrics/actions/print_style.py", "//tools/metrics/common/diff_util.py", "//tools/metrics/common/models.py", @@ -102,13 +101,16 @@ "//tools/metrics/histograms/extract_histograms.py", "//tools/metrics/histograms/generate_expired_histograms_array.py", "//tools/metrics/histograms/generate_expired_histograms_array_unittest.py", + "//tools/metrics/histograms/histograms_print_style.py", "//tools/metrics/histograms/merge_xml.py", + "//tools/metrics/histograms/pretty_print.py", + "//tools/metrics/histograms/pretty_print_test.py", - "//tools/metrics/rappor/model.py", - "//tools/metrics/rappor/pretty_print_test.py", + "//tools/metrics/rappor/rappor_model.py", + "//tools/metrics/rappor/rappor_model_test.py", - "//tools/metrics/ukm/model.py", - "//tools/metrics/ukm/pretty_print_test.py", + "//tools/metrics/ukm/ukm_model.py", + "//tools/metrics/ukm/ukm_model_test.py", "//tools/python/google/path_utils.py",
diff --git a/tools/metrics/actions/print_style.py b/tools/metrics/actions/actions_print_style.py similarity index 100% rename from tools/metrics/actions/print_style.py rename to tools/metrics/actions/actions_print_style.py
diff --git a/tools/metrics/actions/extract_actions.py b/tools/metrics/actions/extract_actions.py index 7203fcc5..169f5b3e 100755 --- a/tools/metrics/actions/extract_actions.py +++ b/tools/metrics/actions/extract_actions.py
@@ -32,7 +32,7 @@ from xml.dom import minidom import action_utils -import print_style +import actions_print_style # Import the metrics/common module for pretty print xml. sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common')) @@ -712,7 +712,7 @@ for suffix_tag in suffixes: actions_element.appendChild(suffix_tag) - return print_style.GetPrintStyle().PrettyPrintXml(doc) + return actions_print_style.GetPrintStyle().PrettyPrintXml(doc) def UpdateXml(original_xml):
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 535c2fd..3a997cac 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -9992,6 +9992,18 @@ <int value="25" label="Site breakdown sorted by data used"/> <int value="26" label="Site breakdown expanded to see more sites"/> <int value="27" label="Site breakdown sorted by hostname"/> + <int value="28" + label="Arrived at settings menu by HTTPS Preview Infobar: entered off, + exited off"/> + <int value="29" + label="Arrived at settings menu by HTTPS Preview Infobar: entered off, + exited on"/> + <int value="30" + label="Arrived at settings menu by HTTPS Preview Infobar: entered on, + exited off"/> + <int value="31" + label="Arrived at settings menu by HTTPS Preview Infobar: entered on, + exited on"/> </enum> <enum name="DataReductionProxyWarmupURLFetchAttemptEvent"> @@ -40580,6 +40592,7 @@ <enum name="PreviewsLitePageInfoBarAction"> <int value="0" label="Infobar shown"/> <int value="1" label="Infobar dismissed by user"/> + <int value="2" label="Infobar 'Settings' clicked"/> </enum> <enum name="PreviewsOptimizationFilterStatus"> @@ -51528,6 +51541,12 @@ <int value="4" label="Abandoned"/> </enum> +<enum name="WebAuthenticationU2FAttestationPromptResult"> + <int value="0" label="Queried"/> + <int value="1" label="Allowed"/> + <int value="2" label="Blocked"/> +</enum> + <enum name="WebBluetoothConnectGATTOutcome"> <int value="0" label="Success"/> <int value="1" label="Device no longer in range"/>
diff --git a/tools/metrics/histograms/generate_expired_histograms_array_unittest.py b/tools/metrics/histograms/generate_expired_histograms_array_unittest.py old mode 100644 new mode 100755 index 7747d88..12aef04 --- a/tools/metrics/histograms/generate_expired_histograms_array_unittest.py +++ b/tools/metrics/histograms/generate_expired_histograms_array_unittest.py
@@ -1,3 +1,4 @@ +#!/usr/bin/env python # Copyright 2017 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.
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 63adde2..c02a499 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -1021,7 +1021,7 @@ <summary> The highest navigation score of the anchor elements sent to the browser process on a page load. This histogram is recorded when the webpage is - loaded. + loaded. Normalized to a value between 0.0 and 100.0. </summary> </histogram> @@ -94857,6 +94857,119 @@ <summary>The result of dispatching the install event to the worker.</summary> </histogram> +<histogram + name="ServiceWorker.LoadTiming.MainFrame.MainResource.FetchHandlerEndToFallbackNetwork" + units="ms" expires_after="2021-10-31"> + <owner>bashi@chromium.org</owner> + <owner>falken@chromium.org</owner> + <summary> + The time taken from (a) renderer process sends an IPC message to notify that + a resource loading request needs to be fall back to network, to (b) browser + process received the IPC. Recorded when no fetch event handler provided a + response to the request. + + Recorded for each navigation request (including redirects) where there is a + fetch event handler and the fetch event was successfully dispatched to the + service worker. + </summary> +</histogram> + +<histogram + name="ServiceWorker.LoadTiming.MainFrame.MainResource.FetchHandlerEndToResponseReceived" + units="ms" expires_after="2021-10-31"> + <owner>bashi@chromium.org</owner> + <owner>falken@chromium.org</owner> + <summary> + The time taken from (a) renderer process sends an IPC message to notify that + a promise of respondWith() is settled, to (b) browser process received the + IPC message. Recorded when a fetch event handler handled the request and + provided a response to the request. + + Recorded for each navigation request (including redirects) where there is a + fetch event handler and the fetch event was successfully dispatched to the + service worker. + </summary> +</histogram> + +<histogram + name="ServiceWorker.LoadTiming.MainFrame.MainResource.FetchHandlerStartToFetchHandlerEnd" + units="ms" expires_after="2021-10-31"> + <owner>bashi@chromium.org</owner> + <owner>falken@chromium.org</owner> + <summary> + The time taken from (a) a fetch event is dispatched, to (b) respondWith() is + settled for the fetch event, or fetch event dispatch is finished without + respondWith() being called. + + Recorded for each navigation request (including redirects) where there is a + fetch event handler and the fetch event was successfully dispatched to the + service worker. + </summary> +</histogram> + +<histogram + name="ServiceWorker.LoadTiming.MainFrame.MainResource.ForwardServiceWorkerToWorkerReady" + units="ms" expires_after="2021-10-31"> + <owner>bashi@chromium.org</owner> + <owner>falken@chromium.org</owner> + <summary> + The time taken from (a) a resource loading request is routed to service + worker path, to (b) a service worker is ready to handle the request. + + Recorded for each navigation request (including redirects) where there is a + fetch event handler and the fetch event was successfully dispatched to the + service worker. + </summary> +</histogram> + +<histogram + name="ServiceWorker.LoadTiming.MainFrame.MainResource.ResponseReceivedToCompleted" + units="ms" expires_after="2021-10-31"> + <owner>bashi@chromium.org</owner> + <owner>falken@chromium.org</owner> + <summary> + The time taken from (a) response headers from service worker are received, + to (b) reading response body is completed. + + Recorded when a fetch event handler handled the request. Recorded for each + navigation request (including redirects) where there is a fetch event + handler and the fetch event was successfully dispatched to the service + worker. + </summary> +</histogram> + +<histogram + name="ServiceWorker.LoadTiming.MainFrame.MainResource.StartToForwardServiceWorker" + units="ms" expires_after="2021-10-31"> + <owner>bashi@chromium.org</owner> + <owner>falken@chromium.org</owner> + <summary> + The time taken from (a) the start of a navigation request, to (b) the + request is forwarded to a service worker code path. This includes looking up + a service worker registration and throttling. + + Recorded for each navigation request (including redirects) where there is a + fetch event handler and the fetch event was successfully dispatched to the + service worker. + </summary> +</histogram> + +<histogram + name="ServiceWorker.LoadTiming.MainFrame.MainResource.WorkerReadyToFetchHandlerStart" + units="ms" expires_after="2021-10-31"> + <owner>bashi@chromium.org</owner> + <owner>falken@chromium.org</owner> + <summary> + The time taken from (a) browser process sends an IPC message to dispatch a + fetch event, to (b) a renderer process received the IPC message and is about + to dispatch a fetch event. + + Recorded for each navigation request (including redirects) where there is a + fetch event handler and the fetch event was successfully dispatched to the + service worker. + </summary> +</histogram> + <histogram name="ServiceWorker.MainFramePageLoad" enum="ServiceWorkerSite"> <owner>horo@chromium.org</owner> <summary> @@ -115479,6 +115592,22 @@ </summary> </histogram> +<histogram name="WebAuthentication.U2FAttestationPromptResult" + enum="WebAuthenticationU2FAttestationPromptResult"> + <owner>agl@chromium.org</owner> + <summary> + Tracks events related to prompting users for permission to pass U2F + attestation information back to origins. "Queried" means that the + embedder was queried for a decision. (Since such decisions can be resolved + by enterprise policy, that doesn't imply that a user saw a permissions + prompt in every case.) Then either a positive or negative result can happen. + However, note some complications: a negative will be recorded when the tab + is closed or the user navigates away, and a positive result will be recorded + when the user accepts the permission prompt but the request has already + timed out. + </summary> +</histogram> + <histogram name="WebController.CertVerificationErrorsCacheHit" enum="BooleanCacheHit"> <owner>eugenebut@chromium.org</owner>
diff --git a/tools/metrics/histograms/print_style.py b/tools/metrics/histograms/histograms_print_style.py similarity index 100% rename from tools/metrics/histograms/print_style.py rename to tools/metrics/histograms/histograms_print_style.py
diff --git a/tools/metrics/histograms/pretty_print.py b/tools/metrics/histograms/pretty_print.py index 3cbae2dd..1e96b4f4 100755 --- a/tools/metrics/histograms/pretty_print.py +++ b/tools/metrics/histograms/pretty_print.py
@@ -24,7 +24,7 @@ import diff_util import presubmit_util -import print_style +import histograms_print_style class Error(Exception): @@ -102,7 +102,7 @@ DropNodesByTagName(tree, 'enums') canonicalizeUnits(tree) fixObsoleteOrder(tree) - return print_style.GetPrintStyle().PrettyPrintXml(tree) + return histograms_print_style.GetPrintStyle().PrettyPrintXml(tree) def PrettyPrintEnums(raw_xml): @@ -111,7 +111,7 @@ # Prevent accidentally adding histograms to enums.xml DropNodesByTagName(tree, 'histograms') DropNodesByTagName(tree, 'histogram_suffixes_list') - return print_style.GetPrintStyle().PrettyPrintXml(tree) + return histograms_print_style.GetPrintStyle().PrettyPrintXml(tree) def main():
diff --git a/tools/metrics/metrics_python_tests.py b/tools/metrics/metrics_python_tests.py index 6acc509e..8ae90ee 100755 --- a/tools/metrics/metrics_python_tests.py +++ b/tools/metrics/metrics_python_tests.py
@@ -22,7 +22,9 @@ sys.exit(typ.main(tests=resolve( 'actions/extract_actions_test.py', 'histograms/generate_expired_histograms_array_unittest.py', - 'ukm/pretty_print_test.py', + 'histograms/pretty_print_test.py', + 'rappor/rappor_model_test.py', + 'ukm/ukm_model_test.py', "../json_comment_eater/json_comment_eater_test.py", "../json_to_struct/element_generator_test.py", "../json_to_struct/struct_generator_test.py",
diff --git a/tools/metrics/rappor/pretty_print.py b/tools/metrics/rappor/pretty_print.py index 007ff983..3d77ca9 100755 --- a/tools/metrics/rappor/pretty_print.py +++ b/tools/metrics/rappor/pretty_print.py
@@ -7,13 +7,13 @@ import os import sys -import model +import rappor_model sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common')) import presubmit_util def main(argv): presubmit_util.DoPresubmitMain(argv, 'rappor.xml', 'rappor.old.xml', - 'pretty_print.py', model.UpdateXML) + 'pretty_print.py', rappor_model.UpdateXML) if '__main__' == __name__:
diff --git a/tools/metrics/rappor/model.py b/tools/metrics/rappor/rappor_model.py similarity index 100% rename from tools/metrics/rappor/model.py rename to tools/metrics/rappor/rappor_model.py
diff --git a/tools/metrics/rappor/pretty_print_test.py b/tools/metrics/rappor/rappor_model_test.py similarity index 79% rename from tools/metrics/rappor/pretty_print_test.py rename to tools/metrics/rappor/rappor_model_test.py index d0837352..832e6491 100755 --- a/tools/metrics/rappor/pretty_print_test.py +++ b/tools/metrics/rappor/rappor_model_test.py
@@ -6,10 +6,9 @@ from __future__ import unicode_literals import copy -import json import unittest -import model +import rappor_model PUBLIC_XML_SNIPPET = """ <rappor-configuration> @@ -90,16 +89,16 @@ """ PARSED_XML = { - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'noiseLevels': { - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'levels': [ { - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'name': 'NO_NOISE', 'summary': 'NO_NOISE description.', 'values': { - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'fake-prob': 0.0, 'fake-one-prob': 0.0, 'one-coin-prob': 1.0, @@ -107,11 +106,11 @@ }, }, { - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'name': 'NORMAL_NOISE', 'summary': 'NORMAL_NOISE description.', 'values': { - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'fake-prob': 0.5, 'fake-one-prob': 0.5, 'one-coin-prob': 0.75, @@ -121,14 +120,14 @@ ] }, 'parameterTypes': { - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'types': [ { - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'name': 'ETLD_PLUS_ONE', 'summary': 'ETLD+1 parameters.', 'parameters': { - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'num-cohorts': 128, 'bytes': 16, 'hash-functions': 2, @@ -137,11 +136,11 @@ }, }, { - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'name': 'SAFEBROWSING_RAPPOR_TYPE', 'summary': 'SAFEBROWSING parameters.', 'parameters': { - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'num-cohorts': 128, 'bytes': 1, 'hash-functions': 2, @@ -152,24 +151,24 @@ ] }, 'metrics': { - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'metrics': [{ - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'name': 'MultiD.TestMetric', 'flags': [{ - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'name': 'flags', 'summary': 'Flags Summary.', 'flags': [ { - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'summary': 'Bit 0' }, { - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'summary': 'What it means', 'label': 'MyBit', 'bit': 1, @@ -178,7 +177,7 @@ }], 'owners': ['holte@chromium.org'], 'strings': [{ - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'name': 'domain', 'summary': 'Domain Summary.', }], @@ -188,12 +187,12 @@ 'SAFEBROWSING_RAPPOR_TYPE', 'uint64': [], }, { - model.models.COMMENT_KEY: [], + rappor_model.models.COMMENT_KEY: [], 'name': 'Search.DefaultSearchProvider', 'flags': [], 'owners': ['holte@chromium.org'], 'strings': [], - 'summary': 'BLAH BLAH BLAH', + 'summary': 'BLAH BLAH BLAH', 'type': 'ETLD_PLUS_ONE', 'uint64': [], }] @@ -262,7 +261,7 @@ <rappor-metric name="Search.DefaultSearchProvider" type="ETLD_PLUS_ONE"> <owner>holte@chromium.org</owner> <summary> - BLAH BLAH BLAH + BLAH BLAH BLAH </summary> </rappor-metric> @@ -275,14 +274,14 @@ class RapporModelTest(unittest.TestCase): def testParse(self): - parsed = model.RAPPOR_XML_TYPE.Parse(PUBLIC_XML_SNIPPET) + parsed = rappor_model.RAPPOR_XML_TYPE.Parse(PUBLIC_XML_SNIPPET) self.assertEqual(PARSED_XML, parsed) def testUpdate(self): - updated = model.UpdateXML(PUBLIC_XML_SNIPPET) + updated = rappor_model.UpdateXML(PUBLIC_XML_SNIPPET) # Compare list of lines for nicer diff on errors. self.assertEqual(PRETTY_PRINTED_XML.split('\n'), updated.split('\n')) - reprinted = model.UpdateXML(updated) + reprinted = rappor_model.UpdateXML(updated) self.assertEqual(PRETTY_PRINTED_XML.split('\n'), reprinted.split('\n')) def testIsValidNoise(self): @@ -296,19 +295,19 @@ 'zero-coin-prob': 0.25, }, } - self.assertTrue(model._IsValidNoiseLevel(valid_noise_level)) + self.assertTrue(rappor_model._IsValidNoiseLevel(valid_noise_level)) invalid_noise_level = copy.copy(valid_noise_level) del invalid_noise_level['name'] - self.assertFalse(model._IsValidNoiseLevel(invalid_noise_level)) + self.assertFalse(rappor_model._IsValidNoiseLevel(invalid_noise_level)) invalid_noise_level = copy.copy(valid_noise_level) del invalid_noise_level['summary'] - self.assertFalse(model._IsValidNoiseLevel(invalid_noise_level)) + self.assertFalse(rappor_model._IsValidNoiseLevel(invalid_noise_level)) invalid_noise_level = copy.copy(valid_noise_level) del invalid_noise_level['values'] - self.assertFalse(model._IsValidNoiseLevel(invalid_noise_level)) + self.assertFalse(rappor_model._IsValidNoiseLevel(invalid_noise_level)) invalid_noise_level = copy.deepcopy(valid_noise_level) del invalid_noise_level['values']['fake-prob'] - self.assertFalse(model._IsValidNoiseLevel(invalid_noise_level)) + self.assertFalse(rappor_model._IsValidNoiseLevel(invalid_noise_level)) def testIsValidRapporType(self): noise_level_names = {'NORMAL_NOISE'} @@ -323,7 +322,8 @@ 'noise-level': 'NORMAL_NOISE', }, } - self.assertTrue(model._IsValidRapporType(valid_type, noise_level_names)) + self.assertTrue(rappor_model._IsValidRapporType(valid_type, + noise_level_names)) def testIsValidRapporMetric(self): type_names = {'ETLD_PLUS_ONE'} @@ -332,23 +332,23 @@ 'flags': [], 'owners': ['holte@chromium.org'], 'strings': [], - 'summary': 'BLAH BLAH BLAH', + 'summary': 'BLAH BLAH BLAH', 'type': 'ETLD_PLUS_ONE', 'uint64': [], } - self.assertTrue(model._IsValidMetric(valid_metric, type_names)) + self.assertTrue(rappor_model._IsValidMetric(valid_metric, type_names)) invalid_metric = copy.copy(valid_metric) del invalid_metric['name'] - self.assertFalse(model._IsValidMetric(invalid_metric, type_names)) + self.assertFalse(rappor_model._IsValidMetric(invalid_metric, type_names)) invalid_metric = copy.copy(valid_metric) del invalid_metric['summary'] - self.assertFalse(model._IsValidMetric(invalid_metric, type_names)) + self.assertFalse(rappor_model._IsValidMetric(invalid_metric, type_names)) invalid_metric = copy.copy(valid_metric) invalid_metric['type'] = 'FOO' - self.assertFalse(model._IsValidMetric(invalid_metric, type_names)) + self.assertFalse(rappor_model._IsValidMetric(invalid_metric, type_names)) invalid_metric = copy.copy(valid_metric) invalid_metric['owners'] = [] - self.assertFalse(model._IsValidMetric(invalid_metric, type_names)) + self.assertFalse(rappor_model._IsValidMetric(invalid_metric, type_names)) if __name__ == '__main__':
diff --git a/tools/metrics/ukm/gen_builders.py b/tools/metrics/ukm/gen_builders.py index 80b0101..e9f1c39 100755 --- a/tools/metrics/ukm/gen_builders.py +++ b/tools/metrics/ukm/gen_builders.py
@@ -13,7 +13,7 @@ import argparse import sys -import model +import ukm_model import builders_template import decode_template @@ -24,7 +24,7 @@ def main(argv): args = parser.parse_args() - data = model.UKM_XML_TYPE.Parse(open(args.input).read()) + data = ukm_model.UKM_XML_TYPE.Parse(open(args.input).read()) relpath = 'services/metrics/public/cpp/' builders_template.WriteFiles(args.output, relpath, data) decode_template.WriteFiles(args.output, relpath, data)
diff --git a/tools/metrics/ukm/pretty_print.py b/tools/metrics/ukm/pretty_print.py index 8398ed3..52fd0546 100755 --- a/tools/metrics/ukm/pretty_print.py +++ b/tools/metrics/ukm/pretty_print.py
@@ -6,7 +6,7 @@ import os import sys -import model +import ukm_model sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common')) import presubmit_util @@ -14,7 +14,7 @@ def main(argv): presubmit_util.DoPresubmitMain(argv, 'ukm.xml', 'ukm.old.xml', - 'pretty_print.py', model.UpdateXML) + 'pretty_print.py', ukm_model.UpdateXML) if '__main__' == __name__:
diff --git a/tools/metrics/ukm/model.py b/tools/metrics/ukm/ukm_model.py similarity index 100% rename from tools/metrics/ukm/model.py rename to tools/metrics/ukm/ukm_model.py
diff --git a/tools/metrics/ukm/pretty_print_test.py b/tools/metrics/ukm/ukm_model_test.py similarity index 91% rename from tools/metrics/ukm/pretty_print_test.py rename to tools/metrics/ukm/ukm_model_test.py index 8f23cd7f..3880dcc 100755 --- a/tools/metrics/ukm/pretty_print_test.py +++ b/tools/metrics/ukm/ukm_model_test.py
@@ -5,7 +5,7 @@ import unittest -import model +import ukm_model PRETTY_XML = """ @@ -34,7 +34,7 @@ class UkmXmlTest(unittest.TestCase): def testIsPretty(self): - result = model.UpdateXML(PRETTY_XML) + result = ukm_model.UpdateXML(PRETTY_XML) self.assertMultiLineEqual(PRETTY_XML, result.strip())
diff --git a/tools/perf/page_sets/data/credentials.json.sha1 b/tools/perf/page_sets/data/credentials.json.sha1 index 177cf291..f4677d0 100644 --- a/tools/perf/page_sets/data/credentials.json.sha1 +++ b/tools/perf/page_sets/data/credentials.json.sha1
@@ -1 +1 @@ -38f6afad3baf96684730bf307244fc7fa6bd6f7d \ No newline at end of file +62bb07f739452c44b3618b9b3f3de6251bf73322 \ No newline at end of file
diff --git a/tools/perf/page_sets/data/system_health_desktop.json b/tools/perf/page_sets/data/system_health_desktop.json index 8a597e4..3247a7d 100644 --- a/tools/perf/page_sets/data/system_health_desktop.json +++ b/tools/perf/page_sets/data/system_health_desktop.json
@@ -12,9 +12,6 @@ "browse:media:tumblr": { "DEFAULT": "system_health_desktop_036.wprgo" }, - "browse:media:tumblr:2018": { - "DEFAULT": "system_health_desktop_55cb9dd713.wprgo" - }, "browse:media:youtube": { "DEFAULT": "system_health_desktop_026.wprgo", "linux": "system_health_desktop_026.wprgo",
diff --git a/tools/perf/page_sets/data/system_health_desktop_55cb9dd713.wprgo.sha1 b/tools/perf/page_sets/data/system_health_desktop_55cb9dd713.wprgo.sha1 deleted file mode 100644 index 7be67b22..0000000 --- a/tools/perf/page_sets/data/system_health_desktop_55cb9dd713.wprgo.sha1 +++ /dev/null
@@ -1 +0,0 @@ -55cb9dd71364f014e51f4ed50207ac91820a555d \ No newline at end of file
diff --git a/tools/perf/page_sets/login_helpers/tumblr_login.py b/tools/perf/page_sets/login_helpers/tumblr_login.py deleted file mode 100644 index 5eff8533..0000000 --- a/tools/perf/page_sets/login_helpers/tumblr_login.py +++ /dev/null
@@ -1,31 +0,0 @@ -# Copyright 2018 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. - -from page_sets.login_helpers import login_utils - - -def LoginDesktopAccount(action_runner, credential, - credentials_path=login_utils.DEFAULT_CREDENTIAL_PATH): - """Logs in into a Tumblr account.""" - - account_name, password = login_utils.GetAccountNameAndPassword( - credential, credentials_path=credentials_path) - - action_runner.Navigate('https://www.tumblr.com/login') - login_utils.InputWithSelector( - action_runner, account_name, 'input[type=email]') - - next_button = '.signup_determine_btn' - enter_password_button = '.forgot_password_link' - action_runner.WaitForElement(selector=next_button) - action_runner.ClickElement(selector=next_button) - action_runner.Wait(1) - action_runner.WaitForElement(selector=enter_password_button) - action_runner.ClickElement(selector=enter_password_button) - action_runner.Wait(1) - login_utils.InputWithSelector( - action_runner, password, 'input[type=password]') - action_runner.Wait(1) - action_runner.WaitForElement(selector=next_button) - action_runner.ClickElement(selector=next_button)
diff --git a/tools/perf/page_sets/system_health/browsing_stories.py b/tools/perf/page_sets/system_health/browsing_stories.py index 7fb7268..71bb2bf 100644 --- a/tools/perf/page_sets/system_health/browsing_stories.py +++ b/tools/perf/page_sets/system_health/browsing_stories.py
@@ -15,7 +15,6 @@ from page_sets.login_helpers import facebook_login from page_sets.login_helpers import pinterest_login -from page_sets.login_helpers import tumblr_login from telemetry.util import js_template @@ -574,28 +573,6 @@ action_runner.MouseClick(selector='#tumblr_lightbox_center_image') action_runner.Wait(1) # To make browsing more realistic. - -class TumblrDesktopStory2018(_MediaBrowsingStory): - NAME = 'browse:media:tumblr:2018' - URL = 'https://tumblr.com/search/gifs' - ITEM_SELECTOR = '.post_media' - IS_SINGLE_PAGE_APP = True - ITEMS_TO_VISIT = 8 - INCREMENT_INDEX_AFTER_EACH_ITEM = True - SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY - TAGS = [story_tags.YEAR_2018] - - def _Login(self, action_runner): - tumblr_login.LoginDesktopAccount(action_runner, 'tumblr') - action_runner.Wait(3) - - def _ViewMediaItem(self, action_runner, index): - super(TumblrDesktopStory2018, self)._ViewMediaItem(action_runner, index) - action_runner.WaitForElement(selector='#tumblr_lightbox') - action_runner.MouseClick(selector='#tumblr_lightbox') - action_runner.Wait(1) # To make browsing more realistic. - - class PinterestDesktopStory(_MediaBrowsingStory): NAME = 'browse:media:pinterest' URL = 'https://pinterest.com'
diff --git a/ui/accessibility/ax_host_delegate.h b/ui/accessibility/ax_host_delegate.h index a9c968e5..4d49609 100644 --- a/ui/accessibility/ax_host_delegate.h +++ b/ui/accessibility/ax_host_delegate.h
@@ -5,8 +5,6 @@ #ifndef UI_ACCESSIBILITY_AX_HOST_DELEGATE_H_ #define UI_ACCESSIBILITY_AX_HOST_DELEGATE_H_ -#include <stdint.h> - #include "ui/accessibility/ax_export.h" #include "ui/accessibility/ax_tree_id.h" @@ -27,6 +25,10 @@ // Handle an action from an accessibility client. virtual void PerformAction(const ui::AXActionData& data) = 0; + // A tree id appropriate for annotating events sent to an accessibility + // client. + AXTreeID tree_id() const { return tree_id_; } + protected: // A delegate with an automatically assigned tree id. AXHostDelegate(); @@ -35,10 +37,6 @@ // the uniqueness of the id. explicit AXHostDelegate(AXTreeID tree_id); - // A tree id appropriate for annotating events sent to an accessibility - // client. - AXTreeID tree_id() const { return tree_id_; } - private: // Register or unregister this class with |AXTreeIDRegistry|. void UpdateActiveState(bool active);
diff --git a/ui/accessibility/mojom/ax_host.mojom b/ui/accessibility/mojom/ax_host.mojom index fde8570..10c300b8 100644 --- a/ui/accessibility/mojom/ax_host.mojom +++ b/ui/accessibility/mojom/ax_host.mojom
@@ -23,7 +23,7 @@ // root of the AX node tree. If |automation_enabled| is true then the remote // process must send its initial AX node tree immediately (because a feature // like ChromeVox is enabled). - SetRemoteHost(AXRemoteHost remote) => + RegisterRemoteHost(AXRemoteHost remote) => (ax.mojom.AXTreeID tree_id, bool automation_enabled); // Handles an accessibility |event| (e.g. focus change) for |tree_id| in the
diff --git a/ui/android/java/res/layout/dropdown_window.xml b/ui/android/java/res/layout/dropdown_window.xml index 3818e1f..bab65d1 100644 --- a/ui/android/java/res/layout/dropdown_window.xml +++ b/ui/android/java/res/layout/dropdown_window.xml
@@ -18,7 +18,8 @@ android:id="@+id/dropdown_body_list" android:layout_width="match_parent" android:layout_height="0dp" - android:layout_weight="1" /> + android:layout_weight="1" + android:layout_marginVertical="@dimen/dropdown_vertical_margin" /> <View style="@style/HorizontalDivider" android:id="@+id/dropdown_body_footer_divider"
diff --git a/ui/android/java/res/values/dimens.xml b/ui/android/java/res/values/dimens.xml index 476fd71b..bfe7338 100644 --- a/ui/android/java/res/values/dimens.xml +++ b/ui/android/java/res/values/dimens.xml
@@ -16,6 +16,7 @@ <dimen name="dropdown_item_divider_height">1px</dimen> <dimen name="dropdown_item_label_margin">10dp</dimen> <dimen name="dropdown_icon_margin">8dp</dimen> + <dimen name="dropdown_vertical_margin">4dp</dimen> <dimen name="button_compat_corner_radius">4dp</dimen> <!-- Divider Dimensions -->
diff --git a/ui/aura/env.cc b/ui/aura/env.cc index 46c9287..bbd9140 100644 --- a/ui/aura/env.cc +++ b/ui/aura/env.cc
@@ -6,6 +6,7 @@ #include "base/command_line.h" #include "base/lazy_instance.h" +#include "base/memory/ptr_util.h" #include "services/ws/public/mojom/window_tree.mojom.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/env_input_state_controller.h" @@ -20,6 +21,7 @@ #include "ui/aura/mus/window_tree_client.h" #include "ui/aura/window.h" #include "ui/aura/window_event_dispatcher_observer.h" +#include "ui/aura/window_occlusion_tracker.h" #include "ui/aura/window_port_for_shutdown.h" #include "ui/base/ui_base_features.h" #include "ui/events/event_target_iterator.h" @@ -185,6 +187,17 @@ window_tree_client_->ScheduleEmbed(std::move(client), std::move(callback)); } +WindowOcclusionTracker* Env::GetWindowOcclusionTracker() { + // TODO(https://crbug.com/867150): DCHECK to ensure LOCAL aura after mus + // code path is wired up. + if (!window_occlusion_tracker_) { + // Use base::WrapUnique + new because of the constructor is private. + window_occlusion_tracker_ = base::WrapUnique(new WindowOcclusionTracker()); + } + + return window_occlusion_tracker_.get(); +} + //////////////////////////////////////////////////////////////////////////////// // Env, private:
diff --git a/ui/aura/env.h b/ui/aura/env.h index f8fb629..3738281 100644 --- a/ui/aura/env.h +++ b/ui/aura/env.h
@@ -59,6 +59,7 @@ class MusMouseLocationUpdater; class Window; class WindowEventDispatcherObserver; +class WindowOcclusionTracker; class WindowPort; class WindowTreeClient; class WindowTreeHost; @@ -191,6 +192,9 @@ mojo::InterfacePtr<ws::mojom::WindowTreeClient> client, base::OnceCallback<void(const base::UnguessableToken&)> callback); + // Get WindowOcclusionTracker instance. Create it if it is not yet created. + WindowOcclusionTracker* GetWindowOcclusionTracker(); + private: friend class test::EnvTestHelper; friend class test::EnvWindowTreeClientSetter; @@ -285,6 +289,9 @@ // Only created if CreateMouseLocationManager() was called. std::unique_ptr<MouseLocationManager> mouse_location_manager_; + // Lazily created for LOCAL aura. + std::unique_ptr<WindowOcclusionTracker> window_occlusion_tracker_; + DISALLOW_COPY_AND_ASSIGN(Env); };
diff --git a/ui/aura/test/window_occlusion_tracker_test_api.cc b/ui/aura/test/window_occlusion_tracker_test_api.cc index 11dc682e..f32330b 100644 --- a/ui/aura/test/window_occlusion_tracker_test_api.cc +++ b/ui/aura/test/window_occlusion_tracker_test_api.cc
@@ -4,16 +4,19 @@ #include "ui/aura/test/window_occlusion_tracker_test_api.h" +#include "ui/aura/env.h" #include "ui/aura/window_occlusion_tracker.h" namespace aura { namespace test { -WindowOcclusionTrackerTestApi::WindowOcclusionTrackerTestApi() = default; +WindowOcclusionTrackerTestApi::WindowOcclusionTrackerTestApi(Env* env) + : tracker_(env->GetWindowOcclusionTracker()) {} + WindowOcclusionTrackerTestApi::~WindowOcclusionTrackerTestApi() = default; int WindowOcclusionTrackerTestApi::GetNumTimesOcclusionRecomputed() const { - return WindowOcclusionTracker::GetInstance()->num_times_occlusion_recomputed_; + return tracker_->num_times_occlusion_recomputed_; } } // namespace test
diff --git a/ui/aura/test/window_occlusion_tracker_test_api.h b/ui/aura/test/window_occlusion_tracker_test_api.h index 32bce81..71ce75e 100644 --- a/ui/aura/test/window_occlusion_tracker_test_api.h +++ b/ui/aura/test/window_occlusion_tracker_test_api.h
@@ -8,17 +8,22 @@ #include "base/macros.h" namespace aura { + +class Env; +class WindowOcclusionTracker; + namespace test { class WindowOcclusionTrackerTestApi { public: - WindowOcclusionTrackerTestApi(); + explicit WindowOcclusionTrackerTestApi(Env* env); ~WindowOcclusionTrackerTestApi(); // Returns the number of times that occlusion was recomputed in this process. int GetNumTimesOcclusionRecomputed() const; private: + WindowOcclusionTracker* const tracker_; DISALLOW_COPY_AND_ASSIGN(WindowOcclusionTrackerTestApi); };
diff --git a/ui/aura/window.cc b/ui/aura/window.cc index a7dcd85..ed6b696e 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc
@@ -92,7 +92,7 @@ } Window::~Window() { - WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion_tracking; + WindowOcclusionTracker::ScopedPause pause_occlusion_tracking(env_); if (layer()->owner() == this) layer()->CompleteAllAnimations(); @@ -160,7 +160,7 @@ } void Window::Init(ui::LayerType layer_type) { - WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion_tracking; + WindowOcclusionTracker::ScopedPause pause_occlusion_tracking(env_); if (!port_owner_) { port_owner_ = env_->CreateWindowPort(this); @@ -285,7 +285,7 @@ } void Window::SetTransform(const gfx::Transform& transform) { - WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion_tracking; + WindowOcclusionTracker::ScopedPause pause_occlusion_tracking(env_); for (WindowObserver& observer : observers_) observer.OnWindowTargetTransformChanging(this, transform); layer()->SetTransform(transform); @@ -373,7 +373,7 @@ } void Window::AddChild(Window* child) { - WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion_tracking; + WindowOcclusionTracker::ScopedPause pause_occlusion_tracking(env_); DCHECK(layer()) << "Parent has not been Init()ed yet."; DCHECK(child->layer()) << "Child has not been Init()ed yt."; @@ -415,7 +415,7 @@ } void Window::RemoveChild(Window* child) { - WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion_tracking; + WindowOcclusionTracker::ScopedPause pause_occlusion_tracking(env_); WindowObserver::HierarchyChangeParams params; params.target = child; @@ -837,7 +837,7 @@ if (visible == layer()->GetTargetVisibility()) return; // No change. - WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion_tracking; + WindowOcclusionTracker::ScopedPause pause_occlusion_tracking(env_); for (WindowObserver& observer : observers_) observer.OnWindowVisibilityChanging(this, visible); @@ -912,7 +912,7 @@ DCHECK_EQ(this, child->parent()); DCHECK_EQ(this, target->parent()); - WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion_tracking; + WindowOcclusionTracker::ScopedPause pause_occlusion_tracking(env_); client::WindowStackingClient* stacking_client = client::GetWindowStackingClient(); @@ -1149,6 +1149,10 @@ return embeds_external_client_; } +void Window::TrackOcclusionState() { + env_->GetWindowOcclusionTracker()->Track(this); +} + bool Window::RequiresDoubleTapGestureEvents() const { return delegate_ && delegate_->RequiresDoubleTapGestureEvents(); } @@ -1166,7 +1170,7 @@ void Window::OnLayerBoundsChanged(const gfx::Rect& old_bounds, ui::PropertyChangeReason reason) { - WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion_tracking; + WindowOcclusionTracker::ScopedPause pause_occlusion_tracking(env_); bounds_ = layer()->bounds(); @@ -1183,13 +1187,13 @@ } void Window::OnLayerOpacityChanged(ui::PropertyChangeReason reason) { - WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion_tracking; + WindowOcclusionTracker::ScopedPause pause_occlusion_tracking(env_); for (WindowObserver& observer : observers_) observer.OnWindowOpacitySet(this, reason); } void Window::OnLayerAlphaShapeChanged() { - WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion_tracking; + WindowOcclusionTracker::ScopedPause pause_occlusion_tracking(env_); for (WindowObserver& observer : observers_) observer.OnWindowAlphaShapeSet(this); } @@ -1197,7 +1201,7 @@ void Window::OnLayerTransformed(const gfx::Transform& old_transform, ui::PropertyChangeReason reason) { port_->OnDidChangeTransform(old_transform, layer()->transform()); - WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion_tracking; + WindowOcclusionTracker::ScopedPause pause_occlusion_tracking(env_); for (WindowObserver& observer : observers_) observer.OnWindowTransformed(this, reason); } @@ -1263,7 +1267,7 @@ } std::unique_ptr<ui::Layer> Window::RecreateLayer() { - WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion_tracking; + WindowOcclusionTracker::ScopedPause pause_occlusion_tracking(env_); ui::LayerAnimator* const animator = layer()->GetAnimator(); const bool was_animating_opacity =
diff --git a/ui/aura/window.h b/ui/aura/window.h index 540bb3cc..f04a1cc 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h
@@ -95,8 +95,8 @@ STACK_BELOW }; enum class OcclusionState { - // The window's occlusion state isn't tracked - // (WindowOcclusionTracker::Track) or hasn't been computed yet. + // The window's occlusion state isn't tracked (Window::TrackOcclusionState) + // or hasn't been computed yet. UNKNOWN, // The window or one of its descendants IsVisible() [1] and: // - Its bounds aren't completely covered by fully opaque windows [2], or, @@ -194,9 +194,9 @@ // whether Show() without a Hide() has been invoked. bool TargetVisibility() const { return visible_; } // Returns the occlusion state of this window. Is UNKNOWN if the occlusion - // state of this window isn't tracked (WindowOcclusionTracker::Track) or + // state of this window isn't tracked (Window::TrackOcclusionState) or // hasn't been computed yet. Is stale if called within the scope of a - // WindowOcclusionTracker::ScopedPauseOcclusionTracking. + // WindowOcclusionTracker::ScopedPause. OcclusionState occlusion_state() const { return occlusion_state_; } // Returns the window's bounds in root window's coordinates. @@ -431,6 +431,9 @@ // Returns whether this window is embedding another client. bool IsEmbeddingClient() const; + // Starts occlusion state tracking. + void TrackOcclusionState(); + Env* env() { return env_; } const Env* env() const { return env_; }
diff --git a/ui/aura/window_occlusion_tracker.cc b/ui/aura/window_occlusion_tracker.cc index 89f7a5b..16a1d228 100644 --- a/ui/aura/window_occlusion_tracker.cc +++ b/ui/aura/window_occlusion_tracker.cc
@@ -9,6 +9,7 @@ #include "base/stl_util.h" #include "third_party/skia/include/core/SkRect.h" #include "third_party/skia/include/core/SkRegion.h" +#include "ui/aura/env.h" #include "ui/aura/window_tracker.h" #include "ui/gfx/geometry/safe_integer_conversions.h" #include "ui/gfx/transform.h" @@ -32,10 +33,6 @@ // RenderWidgetHostViewAura. https://crbug.com/827268 constexpr int kMaxRecomputeOcclusion = 3; -WindowOcclusionTracker* g_tracker = nullptr; - -int g_num_pause_occlusion_tracking = 0; - bool WindowOrParentHasShape(Window* window) { if (window->layer()->alpha_shape()) return true; @@ -112,46 +109,36 @@ } // namespace -WindowOcclusionTracker::ScopedPauseOcclusionTracking:: - ScopedPauseOcclusionTracking() { - ++g_num_pause_occlusion_tracking; +WindowOcclusionTracker::ScopedPause::ScopedPause(Env* env) + : tracker_(env->GetWindowOcclusionTracker()) { + ++tracker_->num_pause_occlusion_tracking_; } -WindowOcclusionTracker::ScopedPauseOcclusionTracking:: - ~ScopedPauseOcclusionTracking() { - --g_num_pause_occlusion_tracking; - DCHECK_GE(g_num_pause_occlusion_tracking, 0); - if (g_tracker) - g_tracker->MaybeComputeOcclusion(); +WindowOcclusionTracker::ScopedPause::~ScopedPause() { + --tracker_->num_pause_occlusion_tracking_; + DCHECK_GE(tracker_->num_pause_occlusion_tracking_, 0); + tracker_->MaybeComputeOcclusion(); } void WindowOcclusionTracker::Track(Window* window) { DCHECK(window); DCHECK(window != window->GetRootWindow()); - if (!g_tracker) - g_tracker = new WindowOcclusionTracker(); - - auto insert_result = g_tracker->tracked_windows_.insert( - {window, Window::OcclusionState::UNKNOWN}); + auto insert_result = + tracked_windows_.insert({window, Window::OcclusionState::UNKNOWN}); DCHECK(insert_result.second); - if (!window->HasObserver(g_tracker)) - window->AddObserver(g_tracker); + if (!window_observer_.IsObserving(window)) + window_observer_.Add(window); if (window->GetRootWindow()) - g_tracker->TrackedWindowAddedToRoot(window); + TrackedWindowAddedToRoot(window); } WindowOcclusionTracker::WindowOcclusionTracker() = default; WindowOcclusionTracker::~WindowOcclusionTracker() = default; -WindowOcclusionTracker* WindowOcclusionTracker::GetInstance() { - DCHECK(g_tracker); - return g_tracker; -} - void WindowOcclusionTracker::MaybeComputeOcclusion() { - if (g_num_pause_occlusion_tracking || + if (num_pause_occlusion_tracking_ || num_times_occlusion_recomputed_in_current_step_ != 0) { return; } @@ -459,9 +446,10 @@ void WindowOcclusionTracker::RemoveObserverFromWindowAndDescendants( Window* window) { if (WindowIsTracked(window)) { - DCHECK(window->HasObserver(this)); + DCHECK(window_observer_.IsObserving(window)); } else { - window->RemoveObserver(this); + if (window_observer_.IsObserving(window)) + window_observer_.Remove(window); window->layer()->GetAnimator()->RemoveObserver(this); animated_windows_.erase(window); } @@ -470,10 +458,12 @@ } void WindowOcclusionTracker::AddObserverToWindowAndDescendants(Window* window) { - if (WindowIsTracked(window)) - DCHECK(window->HasObserver(this)); - else - window->AddObserver(this); + if (WindowIsTracked(window)) { + DCHECK(window_observer_.IsObserving(window)); + } else { + DCHECK(!window_observer_.IsObserving(window)); + window_observer_.Add(window); + } for (Window* child_window : window->children()) AddObserverToWindowAndDescendants(child_window); } @@ -498,7 +488,7 @@ Window* const window = params.target; Window* const root_window = window->GetRootWindow(); if (root_window && base::ContainsKey(root_windows_, root_window) && - !window->HasObserver(this)) { + !window_observer_.IsObserving(window)) { AddObserverToWindowAndDescendants(window); } } @@ -582,6 +572,7 @@ void WindowOcclusionTracker::OnWindowDestroyed(Window* window) { DCHECK(!window->GetRootWindow() || (window == window->GetRootWindow())); tracked_windows_.erase(window); + window_observer_.Remove(window); // Animations should be completed or aborted before a window is destroyed. DCHECK(!window->layer()->GetAnimator()->IsAnimatingOnePropertyOf( kSkipWindowWhenPropertiesAnimated));
diff --git a/ui/aura/window_occlusion_tracker.h b/ui/aura/window_occlusion_tracker.h index 2e6d557..2b546a5 100644 --- a/ui/aura/window_occlusion_tracker.h +++ b/ui/aura/window_occlusion_tracker.h
@@ -5,9 +5,12 @@ #ifndef UI_AURA_WINDOW_OCCLUSION_TRACKER_H_ #define UI_AURA_WINDOW_OCCLUSION_TRACKER_H_ +#include <memory> + #include "base/containers/flat_map.h" #include "base/containers/flat_set.h" #include "base/macros.h" +#include "base/scoped_observer.h" #include "ui/aura/aura_export.h" #include "ui/aura/window.h" #include "ui/aura/window_observer.h" @@ -26,10 +29,12 @@ class WindowOcclusionTrackerTestApi; } +class Env; + // Notifies tracked Windows when their occlusion state change. // // To start tracking the occlusion state of a Window, call -// WindowOcclusionTracker::Track(). +// aura::Window::TrackOcclusionState() // // A Window is occluded if its bounds and transform are not animated and one of // these conditions is true: @@ -43,22 +48,25 @@ public: // Prevents window occlusion state computations within its scope. If an event // that could cause window occlusion states to change occurs within the scope - // of a ScopedPauseOcclusionTracking, window occlusion state computations are - // delayed until all ScopedPauseOcclusionTracking objects have been destroyed. - class AURA_EXPORT ScopedPauseOcclusionTracking { + // of a ScopedPause, window occlusion state computations are delayed until all + // ScopedPause objects have been destroyed. + class AURA_EXPORT ScopedPause { public: - ScopedPauseOcclusionTracking(); - ~ScopedPauseOcclusionTracking(); + explicit ScopedPause(Env* env); + ~ScopedPause(); private: - DISALLOW_COPY_AND_ASSIGN(ScopedPauseOcclusionTracking); + WindowOcclusionTracker* const tracker_; + DISALLOW_COPY_AND_ASSIGN(ScopedPause); }; // Start tracking the occlusion state of |window|. - static void Track(Window* window); + void Track(Window* window); private: friend class test::WindowOcclusionTrackerTestApi; + friend class Env; + friend std::unique_ptr<WindowOcclusionTracker>::deleter_type; struct RootWindowState { // Number of Windows whose occlusion state is tracked under this root @@ -72,11 +80,8 @@ WindowOcclusionTracker(); ~WindowOcclusionTracker() override; - static WindowOcclusionTracker* GetInstance(); - // Recomputes the occlusion state of tracked windows under roots marked as - // dirty in |root_windows_| if there are no active - // ScopedPauseOcclusionTracking instance. + // dirty in |root_windows_| if there are no active ScopedPause instance. void MaybeComputeOcclusion(); // Recomputes the occlusion state of |window| and its descendants. @@ -211,6 +216,12 @@ // recomputed occlusion states. Always 0 when not in MaybeComputeOcclusion(). int num_times_occlusion_recomputed_in_current_step_ = 0; + // Counter of the current occlusion tracking pause. + int num_pause_occlusion_tracking_ = 0; + + // Tracks the observed windows. + ScopedObserver<Window, WindowObserver> window_observer_{this}; + DISALLOW_COPY_AND_ASSIGN(WindowOcclusionTracker); };
diff --git a/ui/aura/window_occlusion_tracker_unittest.cc b/ui/aura/window_occlusion_tracker_unittest.cc index 27caa095..ee9247f 100644 --- a/ui/aura/window_occlusion_tracker_unittest.cc +++ b/ui/aura/window_occlusion_tracker_unittest.cc
@@ -76,7 +76,7 @@ window->Show(); parent = parent ? parent : root_window(); parent->AddChild(window); - WindowOcclusionTracker::Track(window); + window->TrackOcclusionState(); return window; } @@ -958,9 +958,8 @@ } // Verify that the bounds of windows are changed multiple times within the scope -// of a ScopedPauseOcclusionTracking, occlusion states are updated once at the -// end of the scope. -TEST_F(WindowOcclusionTrackerTest, ScopedPauseOcclusionTracking) { +// of a ScopedPause, occlusion states are updated once at the end of the scope. +TEST_F(WindowOcclusionTrackerTest, ScopedPause) { // Create window a. Expect it to be non-occluded. MockWindowDelegate* delegate_a = new MockWindowDelegate(); delegate_a->set_expectation(Window::OcclusionState::VISIBLE); @@ -977,8 +976,8 @@ // Change bounds multiple times. At the end of the scope, expect window a to // be occluded. { - WindowOcclusionTracker::ScopedPauseOcclusionTracking - pause_occlusion_tracking; + WindowOcclusionTracker::ScopedPause pause_occlusion_tracking( + root_window()->env()); window_b->SetBounds(window_a->bounds()); window_a->SetBounds(gfx::Rect(0, 10, 5, 5)); window_b->SetBounds(window_a->bounds()); @@ -988,8 +987,8 @@ EXPECT_FALSE(delegate_a->is_expecting_call()); } -// Same as the previous test, but with nested ScopedPauseOcclusionTracking. -TEST_F(WindowOcclusionTrackerTest, NestedScopedPauseOcclusionTracking) { +// Same as the previous test, but with nested ScopedPause. +TEST_F(WindowOcclusionTrackerTest, NestedScopedPause) { // Create window a. Expect it to be non-occluded. MockWindowDelegate* delegate_a = new MockWindowDelegate(); delegate_a->set_expectation(Window::OcclusionState::VISIBLE); @@ -1006,22 +1005,22 @@ // Change bounds multiple times. At the end of the scope, expect window a to // be occluded. { - WindowOcclusionTracker::ScopedPauseOcclusionTracking - pause_occlusion_tracking_a; + WindowOcclusionTracker::ScopedPause pause_occlusion_tracking_a( + root_window()->env()); { - WindowOcclusionTracker::ScopedPauseOcclusionTracking - pause_occlusion_tracking_b; + WindowOcclusionTracker::ScopedPause pause_occlusion_tracking_b( + root_window()->env()); window_b->SetBounds(window_a->bounds()); } { - WindowOcclusionTracker::ScopedPauseOcclusionTracking - pause_occlusion_tracking_c; + WindowOcclusionTracker::ScopedPause pause_occlusion_tracking_c( + root_window()->env()); window_a->SetBounds(gfx::Rect(0, 10, 5, 5)); } { - WindowOcclusionTracker::ScopedPauseOcclusionTracking - pause_occlusion_tracking_d; + WindowOcclusionTracker::ScopedPause pause_occlusion_tracking_d( + root_window()->env()); window_b->SetBounds(window_a->bounds()); } @@ -1451,7 +1450,7 @@ // Verify that if a window changes its visibility every time it is notified that // its occlusion state changed, a DCHECK occurs. TEST_F(WindowOcclusionTrackerTest, OcclusionStatesDontBecomeStable) { - test::WindowOcclusionTrackerTestApi test_api; + test::WindowOcclusionTrackerTestApi test_api(root_window()->env()); // Create 2 superposed tracked windows. MockWindowDelegate* delegate_a = new MockWindowDelegate(); @@ -1651,7 +1650,7 @@ // to be recomputed. TEST_F(WindowOcclusionTrackerTest, HideWindowWithHiddenParentOnOcclusionChange) { - test::WindowOcclusionTrackerTestApi test_api; + test::WindowOcclusionTrackerTestApi test_api(root_window()->env()); auto* delegate_a = new WindowDelegateAddingAndHidingChild(this); delegate_a->set_expectation(Window::OcclusionState::VISIBLE);
diff --git a/ui/events/event.h b/ui/events/event.h index d15c49e..05199c68 100644 --- a/ui/events/event.h +++ b/ui/events/event.h
@@ -556,7 +556,6 @@ set_flags(flags); } - // Used for synthetic events in testing, gesture recognizer and Ozone // Note: Use the ctor for MouseWheelEvent if type is ET_MOUSEWHEEL. MouseEvent(EventType type, const gfx::Point& location,
diff --git a/ui/file_manager/file_manager/common/js/volume_manager_common.js b/ui/file_manager/file_manager/common/js/volume_manager_common.js index f7b92732..005bd6f 100644 --- a/ui/file_manager/file_manager/common/js/volume_manager_common.js +++ b/ui/file_manager/file_manager/common/js/volume_manager_common.js
@@ -99,9 +99,6 @@ // 'Offline'. DRIVE_FAKE_ROOT: 'drive_fake_root', - // 'Add new services' menu item. - ADD_NEW_SERVICES_MENU: 'add_new_services_menu', - // Root for crostini 'Linux files'. CROSTINI: 'crostini', @@ -144,7 +141,6 @@ VolumeManagerCommon.RootType.MEDIA_VIEW, VolumeManagerCommon.RootType.RECENT, VolumeManagerCommon.RootType.DRIVE_FAKE_ROOT, - VolumeManagerCommon.RootType.ADD_NEW_SERVICES_MENU, VolumeManagerCommon.RootType.CROSTINI, VolumeManagerCommon.RootType.ANDROID_FILES, VolumeManagerCommon.RootType.MY_FILES,
diff --git a/ui/file_manager/file_manager/foreground/css/file_types.css b/ui/file_manager/file_manager/foreground/css/file_types.css index ba1bb90..a35613c 100644 --- a/ui/file_manager/file_manager/foreground/css/file_types.css +++ b/ui/file_manager/file_manager/foreground/css/file_types.css
@@ -442,12 +442,6 @@ url(../images/files/ui/2x/store.png) 2x); } -.tree-row [menu-button-icon='add-new-services'] { - background-image: -webkit-image-set( - url(../images/volumes/add.png) 1x, - url(../images/volumes/2x/add.png) 2x); -} - [root-type-icon='recent'] { background-image: -webkit-image-set( url(../images/volumes/recent.png) 1x,
diff --git a/ui/file_manager/file_manager/foreground/images/volumes/2x/add.png b/ui/file_manager/file_manager/foreground/images/volumes/2x/add.png deleted file mode 100644 index 08e26c1..0000000 --- a/ui/file_manager/file_manager/foreground/images/volumes/2x/add.png +++ /dev/null Binary files differ
diff --git a/ui/file_manager/file_manager/foreground/images/volumes/add.png b/ui/file_manager/file_manager/foreground/images/volumes/add.png deleted file mode 100644 index 9061c7d..0000000 --- a/ui/file_manager/file_manager/foreground/images/volumes/add.png +++ /dev/null Binary files differ
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager.js b/ui/file_manager/file_manager/foreground/js/file_manager.js index db0993ff..5bb3989f 100644 --- a/ui/file_manager/file_manager/foreground/js/file_manager.js +++ b/ui/file_manager/file_manager/foreground/js/file_manager.js
@@ -1210,7 +1210,6 @@ VolumeManagerCommon.RootType.RECENT, true, this.getSourceRestriction_())) : null, - null, // TODO(crbug.com/869252) remove this null. this.commandLineFlags_['disable-my-files-navigation']); this.setupCrostini_(); this.ui_.initDirectoryTree(directoryTree);
diff --git a/ui/file_manager/file_manager/foreground/js/navigation_list_model.js b/ui/file_manager/file_manager/foreground/js/navigation_list_model.js index 07636b5..5a8b4fc 100644 --- a/ui/file_manager/file_manager/foreground/js/navigation_list_model.js +++ b/ui/file_manager/file_manager/foreground/js/navigation_list_model.js
@@ -8,7 +8,6 @@ var NavigationModelItemType = { SHORTCUT: 'shortcut', VOLUME: 'volume', - MENU: 'menu', RECENT: 'recent', CROSTINI: 'crostini', ENTRY_LIST: 'entry-list', @@ -120,45 +119,6 @@ }; /** - * Item of NavigationListModel for a menu button. - * - * @param {string} label Label on the menu button. - * @param {string} menu Selector for the menu element. - * @param {string} icon Name of an icon on the menu button. - * @constructor - * @extends {NavigationModelItem} - * @struct - */ -function NavigationModelMenuItem(label, menu, icon) { - NavigationModelItem.call(this, label, NavigationModelItemType.MENU); - - /** - * @private {string} - * @const - */ - this.menu_ = menu; - - /** - * @private {string} - * @const - */ - this.icon_ = icon; -} - -NavigationModelMenuItem.prototype = /** @struct */ { - __proto__: NavigationModelItem.prototype, - /** - * @return {string} - */ - get menu() { return this.menu_; }, - - /** - * @return {string} - */ - get icon() { return this.icon_; } -}; - -/** * Item of NavigationListModel for a fake item such as Recent or Linux files. * * @param {string} label Label on the menu button. @@ -186,7 +146,6 @@ * @param {(!cr.ui.ArrayDataModel|!FolderShortcutsDataModel)} shortcutListModel * The list of folder shortcut. * @param {NavigationModelFakeItem} recentModelItem Recent folder. - * @param {NavigationModelMenuItem} addNewServicesItem Add new services item. * @param {boolean=} opt_disableMyFilesNavigation true if should use the new * navigation style, value should come from flag * disable-my-files-navigation. @@ -194,7 +153,7 @@ * @extends {cr.EventTarget} */ function NavigationListModel( - volumeManager, shortcutListModel, recentModelItem, addNewServicesItem, + volumeManager, shortcutListModel, recentModelItem, opt_disableMyFilesNavigation) { cr.EventTarget.call(this); @@ -225,12 +184,6 @@ this.linuxFilesItem_ = null; /** - * @private {NavigationModelMenuItem} - * @const - */ - this.addNewServicesItem_ = addNewServicesItem; - - /** * NavigationModel for MyFiles, since DirectoryTree expect it to be always the * same reference we keep the initial reference for reuse. * @private {NavigationModelFakeItem}
diff --git a/ui/file_manager/file_manager/foreground/js/navigation_list_model_unittest.js b/ui/file_manager/file_manager/foreground/js/navigation_list_model_unittest.js index afa3ebf5..245ded7 100644 --- a/ui/file_manager/file_manager/foreground/js/navigation_list_model_unittest.js +++ b/ui/file_manager/file_manager/foreground/js/navigation_list_model_unittest.js
@@ -42,23 +42,18 @@ var recentItem = new NavigationModelFakeItem( 'recent-label', NavigationModelItemType.RECENT, {toURL: () => 'fake-entry://recent'}); - var addNewServicesItem = new NavigationModelMenuItem( - 'menu-button-label', '#add-new-services', 'menu-button-icon'); var model = new NavigationListModel( - volumeManager, shortcutListModel, recentItem, addNewServicesItem, true); + volumeManager, shortcutListModel, recentItem, true); model.linuxFilesItem = new NavigationModelFakeItem( 'linux-files-label', NavigationModelItemType.CROSTINI, {toURL: () => 'fake-entry://linux-files'}); - assertEquals(6, model.length); + assertEquals(5, model.length); assertEquals('drive', model.item(0).volumeInfo.volumeId); assertEquals('downloads', model.item(1).volumeInfo.volumeId); assertEquals('fake-entry://recent', model.item(2).entry.toURL()); assertEquals('fake-entry://linux-files', model.item(3).entry.toURL()); assertEquals('/root/shortcut', model.item(4).entry.fullPath); - assertEquals('menu-button-label', model.item(5).label); - assertEquals('#add-new-services', model.item(5).menu); - assertEquals('menu-button-icon', model.item(5).icon); } function testNoRecentOrLinuxFiles() { @@ -66,18 +61,13 @@ var shortcutListModel = new MockFolderShortcutDataModel( [new MockFileEntry(drive, '/root/shortcut')]); var recentItem = null; - var addNewServicesItem = new NavigationModelMenuItem( - 'menu-button-label', '#add-new-services', 'menu-button-icon'); var model = new NavigationListModel( - volumeManager, shortcutListModel, recentItem, addNewServicesItem, true); + volumeManager, shortcutListModel, recentItem, true); - assertEquals(4, model.length); + assertEquals(3, model.length); assertEquals('drive', model.item(0).volumeInfo.volumeId); assertEquals('downloads', model.item(1).volumeInfo.volumeId); assertEquals('/root/shortcut', model.item(2).entry.fullPath); - assertEquals('menu-button-label', model.item(3).label); - assertEquals('#add-new-services', model.item(3).menu); - assertEquals('menu-button-icon', model.item(3).icon); } function testAddAndRemoveShortcuts() { @@ -85,9 +75,8 @@ var shortcutListModel = new MockFolderShortcutDataModel( [new MockFileEntry(drive, '/root/shortcut')]); var recentItem = null; - var addNewServicesItem = null; var model = new NavigationListModel( - volumeManager, shortcutListModel, recentItem, addNewServicesItem, true); + volumeManager, shortcutListModel, recentItem, true); assertEquals(3, model.length); @@ -120,9 +109,8 @@ var shortcutListModel = new MockFolderShortcutDataModel( [new MockFileEntry(drive, '/root/shortcut')]); var recentItem = null; - var addNewServicesItem = null; var model = new NavigationListModel( - volumeManager, shortcutListModel, recentItem, addNewServicesItem, true); + volumeManager, shortcutListModel, recentItem, true); assertEquals(3, model.length); @@ -172,7 +160,6 @@ const recentItem = new NavigationModelFakeItem( 'recent-label', NavigationModelItemType.RECENT, {toURL: () => 'fake-entry://recent'}); - const addNewServicesItem = null; const zipVolumeId = 'provided:dmboannefpncccogfdikhmhpmdnddgoe:' + '~%2FDownloads%2Fazip_file%2Ezip:' + '096eaa592ea7e8ffb9a27435e50dabd6c809c125'; @@ -225,7 +212,7 @@ // Constructor already calls orderAndNestItems_. const model = new NavigationListModel( - volumeManager, shortcutListModel, recentItem, addNewServicesItem, false); + volumeManager, shortcutListModel, recentItem, false); // Check items order and that MTP/Archive/Removable respect the original // order.
diff --git a/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js b/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js index a4170af..3c72769 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js +++ b/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js
@@ -116,17 +116,6 @@ '</div>' + '<div class="tree-children"></div>'; -var MENU_TREE_ITEM_INNER_HTML = - '<div class="tree-row">' + - ' <paper-ripple fit class="recenteringTouch"></paper-ripple>' + - ' <span class="expand-icon"></span>' + - ' <div class="button">' + - ' <span class="icon item-icon"></span>' + - ' <span class="label entry-name"></span>' + - ' </div>' + - '</div>' + - '<div class="tree-children"></div>'; - //////////////////////////////////////////////////////////////////////////////// // DirectoryItem @@ -1339,95 +1328,6 @@ }; //////////////////////////////////////////////////////////////////////////////// -// MenuItem - -/** - * A TreeItem which represents a command button. - * Command items are displayed as top-level children of DirectoryTree. - * - * @param {!NavigationModelMenuItem} modelItem - * @param {!DirectoryTree} tree Current tree, which contains this item. - * @extends {cr.ui.TreeItem} - * @constructor - */ -function MenuItem(modelItem, tree) { - var item = new cr.ui.TreeItem(); - // Get the original label id defined by TreeItem, before overwriting - // prototype. - var labelId = item.labelElement.id; - item.__proto__ = MenuItem.prototype; - if (window.IN_TEST) { - item.setAttribute('dir-type', 'MenuItem'); - item.setAttribute('entry-label', modelItem.label); - } - - item.parentTree_ = tree; - item.modelItem_ = modelItem; - item.innerHTML = MENU_TREE_ITEM_INNER_HTML; - item.labelElement.id = labelId; - item.label = modelItem.label; - - item.menuButton_ = /** @type {!cr.ui.MenuButton} */(queryRequiredElement( - '.button', assert(item.firstElementChild))); - item.menuButton_.setAttribute('menu', item.modelItem_.menu); - cr.ui.MenuButton.decorate(item.menuButton_); - - var icon = queryRequiredElement('.icon', item); - icon.setAttribute('menu-button-icon', item.modelItem_.icon); - - return item; -} - -MenuItem.prototype = { - __proto__: cr.ui.TreeItem.prototype, - get entry() { - return null; - }, - get modelItem() { - return this.modelItem_; - }, - get labelElement() { - return this.firstElementChild.querySelector('.label'); - } -}; - -/** - * @param {!DirectoryEntry|!FakeEntry} entry - * @return {boolean} True if the parent item is found. - */ -MenuItem.prototype.searchAndSelectByEntry = function(entry) { - return false; -}; - -/** - * @override - */ -MenuItem.prototype.handleClick = function(e) { - this.activate(); - - DirectoryItemTreeBaseMethods.recordUMASelectedEntry.call( - this, e, VolumeManagerCommon.RootType.ADD_NEW_SERVICES_MENU, true); -}; - -/** - * @param {!DirectoryEntry} entry - */ -MenuItem.prototype.selectByEntry = function(entry) { -}; - -/** - * Executes the command. - */ -MenuItem.prototype.activate = function() { - // Dispatch an event to update the menu (if updatable). - var updateEvent = /** @type {MenuItemUpdateEvent} */ (new Event('update')); - updateEvent.menuButton = this.menuButton_; - this.menuButton_.menu.dispatchEvent(updateEvent); - - this.menuButton_.showMenu(); -}; - -//////////////////////////////////////////////////////////////////////////////// // FakeItem /** @@ -1645,10 +1545,6 @@ return new ShortcutItem( /** @type {!NavigationModelShortcutItem} */ (modelItem), tree); break; - case NavigationModelItemType.MENU: - return new MenuItem( - /** @type {!NavigationModelMenuItem} */ (modelItem), tree); - break; case NavigationModelItemType.RECENT: return new FakeItem( VolumeManagerCommon.RootType.RECENT,
diff --git a/ui/file_manager/integration_tests/test_util.js b/ui/file_manager/integration_tests/test_util.js index 596f8eb..c9875f7 100644 --- a/ui/file_manager/integration_tests/test_util.js +++ b/ui/file_manager/integration_tests/test_util.js
@@ -529,7 +529,7 @@ mimeType: 'text/html', lastModifiedTime: 'Sep 4, 1998, 12:34 PM', nameText: 'tall.html', - sizeText: '51 bytes', + sizeText: '589 bytes', typeText: 'HTML document', }),
diff --git a/ui/keyboard/keyboard_controller.cc b/ui/keyboard/keyboard_controller.cc index 3a8f8d34..3ddd01d0 100644 --- a/ui/keyboard/keyboard_controller.cc +++ b/ui/keyboard/keyboard_controller.cc
@@ -13,6 +13,7 @@ #include "base/metrics/histogram_macros.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" +#include "ui/aura/client/aura_constants.h" #include "ui/aura/env.h" #include "ui/aura/window.h" #include "ui/aura/window_delegate.h" @@ -690,7 +691,7 @@ } void KeyboardController::ShowKeyboardInternal(const display::Display& display) { - keyboard::MarkKeyboardLoadStarted(); + MarkKeyboardLoadStarted(); PopulateKeyboardContent(display, true); UpdateInputMethodObserver(); } @@ -1012,4 +1013,24 @@ } } +void KeyboardController::MarkKeyboardLoadStarted() { + if (!keyboard_load_time_logged_) + keyboard_load_time_start_ = base::Time::Now(); +} + +void KeyboardController::MarkKeyboardLoadFinished() { + // Possible to get a load finished without a start if navigating directly to + // chrome://keyboard. + if (keyboard_load_time_start_.is_null()) + return; + + if (keyboard_load_time_logged_) + return; + + // Log the delta only once. + UMA_HISTOGRAM_TIMES("VirtualKeyboard.InitLatency.FirstLoad", + base::Time::Now() - keyboard_load_time_start_); + keyboard_load_time_logged_ = true; +} + } // namespace keyboard
diff --git a/ui/keyboard/keyboard_controller.h b/ui/keyboard/keyboard_controller.h index 4f99d30..e167d9b 100644 --- a/ui/keyboard/keyboard_controller.h +++ b/ui/keyboard/keyboard_controller.h
@@ -348,6 +348,15 @@ // window). void EnsureCaretInWorkArea(const gfx::Rect& occluded_bounds); + // Marks that the keyboard load has started. This is used to measure the time + // it takes to fully load the keyboard. This should be called before + // MarkKeyboardLoadFinished. + void MarkKeyboardLoadStarted(); + + // Marks that the keyboard load has ended. This finishes measuring that the + // keyboard is loaded. + void MarkKeyboardLoadFinished(); + std::unique_ptr<KeyboardControllerMojoImpl> mojo_impl_; std::unique_ptr<KeyboardUI> ui_; KeyboardLayoutDelegate* layout_delegate_ = nullptr; @@ -391,6 +400,9 @@ DisplayUtil display_util_; + bool keyboard_load_time_logged_ = false; + base::Time keyboard_load_time_start_; + base::WeakPtrFactory<KeyboardController> weak_factory_report_lingering_state_; base::WeakPtrFactory<KeyboardController> weak_factory_will_hide_;
diff --git a/ui/keyboard/keyboard_util.cc b/ui/keyboard/keyboard_util.cc index 290beb84..38b02066 100644 --- a/ui/keyboard/keyboard_util.cc +++ b/ui/keyboard/keyboard_util.cc
@@ -7,20 +7,10 @@ #include <string> #include "base/command_line.h" -#include "base/feature_list.h" -#include "base/lazy_instance.h" -#include "base/logging.h" #include "base/metrics/histogram_macros.h" -#include "base/strings/string16.h" -#include "chromeos/chromeos_features.h" -#include "ui/aura/client/aura_constants.h" #include "ui/aura/window_tree_host.h" #include "ui/base/ime/input_method.h" -#include "ui/base/ime/input_method_base.h" #include "ui/base/ime/text_input_client.h" -#include "ui/base/ime/text_input_flags.h" -#include "ui/base/ui_base_features.h" -#include "ui/base/ui_base_switches.h" #include "ui/events/event_sink.h" #include "ui/events/event_utils.h" #include "ui/events/keycodes/dom/dom_code.h" @@ -28,7 +18,6 @@ #include "ui/events/keycodes/dom/keycode_converter.h" #include "ui/events/keycodes/keyboard_code_conversion.h" #include "ui/keyboard/keyboard_switches.h" -#include "ui/keyboard/keyboard_ui.h" namespace keyboard { @@ -47,10 +36,6 @@ CHECK(!details.dispatcher_destroyed); } -bool g_keyboard_load_time_logged = false; -base::LazyInstance<base::Time>::DestructorAtExit g_keyboard_load_time_start = - LAZY_INSTANCE_INITIALIZER; - bool g_accessibility_keyboard_enabled = false; bool g_hotrod_keyboard_enabled = false; @@ -140,46 +125,6 @@ g_keyboard_show_override = show_override; } -bool IsInputViewEnabled() { - return !base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDisableInputView); -} - -bool IsFloatingVirtualKeyboardEnabled() { - return base::FeatureList::IsEnabled(features::kEnableFloatingVirtualKeyboard); -} - -bool IsFullscreenHandwritingVirtualKeyboardEnabled() { - return base::FeatureList::IsEnabled( - features::kEnableFullscreenHandwritingVirtualKeyboard); -} - -bool IsStylusVirtualKeyboardEnabled() { - return base::FeatureList::IsEnabled(features::kEnableStylusVirtualKeyboard); -} - -bool IsVirtualKeyboardMdUiEnabled() { - return base::FeatureList::IsEnabled(features::kEnableVirtualKeyboardMdUi); -} - -bool IsGestureTypingEnabled() { - return !base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDisableGestureTyping); -} - -bool IsGestureEditingEnabled() { - // TODO(https://crbug.com/890134): Gesture editing is not implemented in the - // new UI. - return !IsVirtualKeyboardMdUiEnabled() && - !base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDisableGestureEditing); -} - -bool IsImeServiceEnabled() { - return base::FeatureList::IsEnabled( - chromeos::features::kImeServiceConnectable); -} - bool SendKeyEvent(const std::string type, int key_value, int key_code, @@ -246,24 +191,4 @@ return true; } -void MarkKeyboardLoadStarted() { - if (!g_keyboard_load_time_logged) - g_keyboard_load_time_start.Get() = base::Time::Now(); -} - -void MarkKeyboardLoadFinished() { - // Possible to get a load finished without a start if navigating directly to - // chrome://keyboard. - if (g_keyboard_load_time_start.Get().is_null()) - return; - - if (!g_keyboard_load_time_logged) { - // Log the delta only once. - UMA_HISTOGRAM_TIMES( - "VirtualKeyboard.InitLatency.FirstLoad", - base::Time::Now() - g_keyboard_load_time_start.Get()); - g_keyboard_load_time_logged = true; - } -} - } // namespace keyboard
diff --git a/ui/keyboard/keyboard_util.h b/ui/keyboard/keyboard_util.h index 796b263..df699494 100644 --- a/ui/keyboard/keyboard_util.h +++ b/ui/keyboard/keyboard_util.h
@@ -78,10 +78,6 @@ KEYBOARD_EXPORT void SetKeyboardShowOverride( KeyboardShowOverride show_override); -// Returns true if an IME extension can specify a custom input view for the -// virtual keyboard window. -KEYBOARD_EXPORT bool IsInputViewEnabled(); - // Sets whehther the keyboards is in restricted state - state where advanced // virtual keyboard features are disabled. KEYBOARD_EXPORT void SetKeyboardRestricted(bool restricted); @@ -89,32 +85,6 @@ // Returns whether the keyboard is in restricted state. KEYBOARD_EXPORT bool GetKeyboardRestricted(); -// Returns true if floating virtual keyboard feature is enabled. -KEYBOARD_EXPORT bool IsFloatingVirtualKeyboardEnabled(); - -// Returns true if fullscreen handwriting virtual keyboard feature is enabled. -KEYBOARD_EXPORT bool IsFullscreenHandwritingVirtualKeyboardEnabled(); - -// Returns true if stylus virtual keyboard feature is enabled. -KEYBOARD_EXPORT bool IsStylusVirtualKeyboardEnabled(); - -// Returns true if virtual keyboard md ui feature is enabled. -KEYBOARD_EXPORT bool IsVirtualKeyboardMdUiEnabled(); - -// Returns true if gesture typing option is enabled for virtual keyboard. -KEYBOARD_EXPORT bool IsGestureTypingEnabled(); - -// Returns true if gesture editing option is enabled for virtual keyboard. -KEYBOARD_EXPORT bool IsGestureEditingEnabled(); - -// Returns true if voice input is not disabled for the keyboard by the command -// line switch. It's up to the client to check if there is an input device -// available. -KEYBOARD_EXPORT bool IsVoiceInputEnabled(); - -// Returns true if the IME service is enabled. -KEYBOARD_EXPORT bool IsImeServiceEnabled(); - // Sends a fabricated key event, where |type| is the event type, |key_value| // is the unicode value of the character, |key_code| is the legacy key code // value, |key_name| is the name of the key as defined in the DOM3 key event @@ -128,15 +98,6 @@ int modifiers, aura::WindowTreeHost* host); -// Marks that the keyboard load has started. This is used to measure the time it -// takes to fully load the keyboard. This should be called before -// MarkKeyboardLoadFinished. -KEYBOARD_EXPORT void MarkKeyboardLoadStarted(); - -// Marks that the keyboard load has ended. This finishes measuring that the -// keyboard is loaded. -KEYBOARD_EXPORT void MarkKeyboardLoadFinished(); - } // namespace keyboard #endif // UI_KEYBOARD_KEYBOARD_UTIL_H_
diff --git a/ui/ozone/platform/drm/BUILD.gn b/ui/ozone/platform/drm/BUILD.gn index 832a6c0..bb5c7a2 100644 --- a/ui/ozone/platform/drm/BUILD.gn +++ b/ui/ozone/platform/drm/BUILD.gn
@@ -54,8 +54,6 @@ "gpu/drm_thread_message_proxy.h", "gpu/drm_thread_proxy.cc", "gpu/drm_thread_proxy.h", - "gpu/drm_vsync_provider.cc", - "gpu/drm_vsync_provider.h", "gpu/drm_window.cc", "gpu/drm_window.h", "gpu/drm_window_proxy.cc", @@ -64,8 +62,6 @@ "gpu/gbm_overlay_surface.h", "gpu/gbm_pixmap.cc", "gpu/gbm_pixmap.h", - "gpu/gbm_surface.cc", - "gpu/gbm_surface.h", "gpu/gbm_surface_factory.cc", "gpu/gbm_surface_factory.h", "gpu/gbm_surfaceless.cc",
diff --git a/ui/ozone/platform/drm/gpu/drm_device.cc b/ui/ozone/platform/drm/gpu/drm_device.cc index 60cdf44..f555f84 100644 --- a/ui/ozone/platform/drm/gpu/drm_device.cc +++ b/ui/ozone/platform/drm/gpu/drm_device.cc
@@ -384,20 +384,6 @@ return false; } -bool DrmDevice::PageFlipOverlay(uint32_t crtc_id, - uint32_t framebuffer, - const gfx::Rect& location, - const gfx::Rect& source, - int overlay_plane) { - DCHECK(file_.IsValid()); - TRACE_EVENT2("drm", "DrmDevice::PageFlipOverlay", "crtc", crtc_id, - "framebuffer", framebuffer); - return !drmModeSetPlane(file_.GetPlatformFile(), overlay_plane, crtc_id, - framebuffer, 0, location.x(), location.y(), - location.width(), location.height(), source.x(), - source.y(), source.width(), source.height()); -} - ScopedDrmFramebufferPtr DrmDevice::GetFramebuffer(uint32_t framebuffer) { DCHECK(file_.IsValid()); TRACE_EVENT1("drm", "DrmDevice::GetFramebuffer", "framebuffer", framebuffer);
diff --git a/ui/ozone/platform/drm/gpu/drm_device.h b/ui/ozone/platform/drm/gpu/drm_device.h index cbe98e8..1e62f189 100644 --- a/ui/ozone/platform/drm/gpu/drm_device.h +++ b/ui/ozone/platform/drm/gpu/drm_device.h
@@ -147,15 +147,6 @@ uint32_t framebuffer, scoped_refptr<PageFlipRequest> page_flip_request); - // Schedule an overlay to be show during the page flip for CRTC |crtc_id|. - // |source| location from |framebuffer| will be shown on overlay - // |overlay_plane|, in the bounds specified by |location| on the screen. - virtual bool PageFlipOverlay(uint32_t crtc_id, - uint32_t framebuffer, - const gfx::Rect& location, - const gfx::Rect& source, - int overlay_plane); - // Returns the list of all planes available on this DRM device. virtual ScopedDrmPlaneResPtr GetPlaneResources();
diff --git a/ui/ozone/platform/drm/gpu/drm_thread.cc b/ui/ozone/platform/drm/gpu/drm_thread.cc index 029a8e2..075e11b 100644 --- a/ui/ozone/platform/drm/gpu/drm_thread.cc +++ b/ui/ozone/platform/drm/gpu/drm_thread.cc
@@ -244,17 +244,6 @@ } } -void DrmThread::GetVSyncParameters( - gfx::AcceleratedWidget widget, - const gfx::VSyncProvider::UpdateVSyncCallback& callback) { - DrmWindow* window = screen_manager_->GetWindow(widget); - // No need to call the callback if there isn't a window since the vsync - // provider doesn't require the callback to be called if there isn't a vsync - // data source. - if (window) - window->GetVSyncParameters(callback); -} - void DrmThread::IsDeviceAtomic(gfx::AcceleratedWidget widget, bool* is_atomic) { scoped_refptr<ui::DrmDevice> drm_device = device_manager_->GetDrmDevice(widget);
diff --git a/ui/ozone/platform/drm/gpu/drm_thread.h b/ui/ozone/platform/drm/gpu/drm_thread.h index 79685b1..c6fcabc 100644 --- a/ui/ozone/platform/drm/gpu/drm_thread.h +++ b/ui/ozone/platform/drm/gpu/drm_thread.h
@@ -90,9 +90,6 @@ std::vector<DrmOverlayPlane> planes, SwapCompletionOnceCallback submission_callback, PresentationOnceCallback presentation_callback); - void GetVSyncParameters( - gfx::AcceleratedWidget widget, - const gfx::VSyncProvider::UpdateVSyncCallback& callback); void IsDeviceAtomic(gfx::AcceleratedWidget widget, bool* is_atomic);
diff --git a/ui/ozone/platform/drm/gpu/drm_vsync_provider.cc b/ui/ozone/platform/drm/gpu/drm_vsync_provider.cc deleted file mode 100644 index 4b153e2..0000000 --- a/ui/ozone/platform/drm/gpu/drm_vsync_provider.cc +++ /dev/null
@@ -1,34 +0,0 @@ -// Copyright 2014 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 "ui/ozone/platform/drm/gpu/drm_vsync_provider.h" - -#include "ui/ozone/platform/drm/gpu/drm_window_proxy.h" - -namespace ui { - -DrmVSyncProvider::DrmVSyncProvider(DrmWindowProxy* window) : window_(window) {} - -DrmVSyncProvider::~DrmVSyncProvider() { -} - -void DrmVSyncProvider::GetVSyncParameters(const UpdateVSyncCallback& callback) { - window_->GetVSyncParameters(callback); -} - -bool DrmVSyncProvider::GetVSyncParametersIfAvailable( - base::TimeTicks* timebase, - base::TimeDelta* interval) { - return false; -} - -bool DrmVSyncProvider::SupportGetVSyncParametersIfAvailable() const { - return false; -} - -bool DrmVSyncProvider::IsHWClock() const { - return true; -} - -} // namespace ui
diff --git a/ui/ozone/platform/drm/gpu/drm_vsync_provider.h b/ui/ozone/platform/drm/gpu/drm_vsync_provider.h deleted file mode 100644 index 13f6a6d..0000000 --- a/ui/ozone/platform/drm/gpu/drm_vsync_provider.h +++ /dev/null
@@ -1,35 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_OZONE_PLATFORM_IMPL_DRM_VSYNC_PROVIDER_H_ -#define UI_OZONE_PLATFORM_IMPL_DRM_VSYNC_PROVIDER_H_ - -#include "base/macros.h" -#include "ui/gfx/native_widget_types.h" -#include "ui/gfx/vsync_provider.h" - -namespace ui { - -class DrmWindowProxy; - -class DrmVSyncProvider : public gfx::VSyncProvider { - public: - DrmVSyncProvider(DrmWindowProxy* window); - ~DrmVSyncProvider() override; - - void GetVSyncParameters(const UpdateVSyncCallback& callback) override; - bool GetVSyncParametersIfAvailable(base::TimeTicks* timebase, - base::TimeDelta* interval) override; - bool SupportGetVSyncParametersIfAvailable() const override; - bool IsHWClock() const override; - - private: - DrmWindowProxy* const window_; - - DISALLOW_COPY_AND_ASSIGN(DrmVSyncProvider); -}; - -} // namespace ui - -#endif // UI_OZONE_PLATFORM_IMPL_DRM_VSYNC_PROVIDER_H_
diff --git a/ui/ozone/platform/drm/gpu/drm_window.cc b/ui/ozone/platform/drm/gpu/drm_window.cc index 04f31690..8320dec 100644 --- a/ui/ozone/platform/drm/gpu/drm_window.cc +++ b/ui/ozone/platform/drm/gpu/drm_window.cc
@@ -137,21 +137,6 @@ return DrmOverlayPlane::GetPrimaryPlane(last_submitted_planes_); } -void DrmWindow::GetVSyncParameters( - const gfx::VSyncProvider::UpdateVSyncCallback& callback) const { - if (!controller_) - return; - - // If we're in mirror mode the 2 CRTCs should have similar modes with the same - // refresh rates. - CrtcController* crtc = controller_->crtc_controllers()[0].get(); - const base::TimeTicks last_flip = controller_->GetTimeOfLastFlip(); - if (last_flip == base::TimeTicks() || crtc->mode().vrefresh == 0) - return; // The value is invalid, so we can't update the parameters. - callback.Run(last_flip, - base::TimeDelta::FromSeconds(1) / crtc->mode().vrefresh); -} - void DrmWindow::UpdateCursorImage() { if (!controller_) return;
diff --git a/ui/ozone/platform/drm/gpu/drm_window.h b/ui/ozone/platform/drm/gpu/drm_window.h index 8d0750b..c6848d9 100644 --- a/ui/ozone/platform/drm/gpu/drm_window.h +++ b/ui/ozone/platform/drm/gpu/drm_window.h
@@ -88,9 +88,6 @@ // Returns the last buffer associated with this window. const DrmOverlayPlane* GetLastModesetBuffer(); - void GetVSyncParameters( - const gfx::VSyncProvider::UpdateVSyncCallback& callback) const; - private: // Draw next frame in an animated cursor. void OnCursorAnimationTimeout();
diff --git a/ui/ozone/platform/drm/gpu/drm_window_proxy.cc b/ui/ozone/platform/drm/gpu/drm_window_proxy.cc index bde6d1dda..ce35578e 100644 --- a/ui/ozone/platform/drm/gpu/drm_window_proxy.cc +++ b/ui/ozone/platform/drm/gpu/drm_window_proxy.cc
@@ -34,14 +34,6 @@ CreateSafeOnceCallback(std::move(presentation_callback)))); } -void DrmWindowProxy::GetVSyncParameters( - const gfx::VSyncProvider::UpdateVSyncCallback& callback) { - drm_thread_->task_runner()->PostTask( - FROM_HERE, base::BindOnce(&DrmThread::GetVSyncParameters, - base::Unretained(drm_thread_), widget_, - CreateSafeCallback(callback))); -} - bool DrmWindowProxy::SupportsGpuFences() const { bool is_atomic = false; PostSyncTask(
diff --git a/ui/ozone/platform/drm/gpu/drm_window_proxy.h b/ui/ozone/platform/drm/gpu/drm_window_proxy.h index 700f84f..303051c1 100644 --- a/ui/ozone/platform/drm/gpu/drm_window_proxy.h +++ b/ui/ozone/platform/drm/gpu/drm_window_proxy.h
@@ -28,9 +28,6 @@ SwapCompletionOnceCallback submission_callback, PresentationOnceCallback presentation_callback); - void GetVSyncParameters( - const gfx::VSyncProvider::UpdateVSyncCallback& callback); - bool SupportsGpuFences() const; private:
diff --git a/ui/ozone/platform/drm/gpu/gbm_surface.cc b/ui/ozone/platform/drm/gpu/gbm_surface.cc deleted file mode 100644 index 8588a55..0000000 --- a/ui/ozone/platform/drm/gpu/gbm_surface.cc +++ /dev/null
@@ -1,155 +0,0 @@ -// Copyright 2016 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 "ui/ozone/platform/drm/gpu/gbm_surface.h" - -#include <utility> - -#include "base/logging.h" -#include "ui/display/types/display_snapshot.h" -#include "ui/gfx/gpu_fence.h" -#include "ui/gfx/gpu_fence_handle.h" -#include "ui/gfx/native_pixmap.h" -#include "ui/gl/gl_image_native_pixmap.h" -#include "ui/gl/gl_surface_egl.h" -#include "ui/ozone/platform/drm/gpu/drm_window_proxy.h" -#include "ui/ozone/platform/drm/gpu/gbm_surface_factory.h" - -namespace ui { - -GbmSurface::GbmSurface(GbmSurfaceFactory* surface_factory, - std::unique_ptr<DrmWindowProxy> window, - gfx::AcceleratedWidget widget) - : GbmSurfaceless(surface_factory, std::move(window), widget) { - for (auto& texture : textures_) - texture = 0; -} - -unsigned int GbmSurface::GetBackingFramebufferObject() { - return fbo_; -} - -bool GbmSurface::OnMakeCurrent(gl::GLContext* context) { - DCHECK(!context_ || context == context_); - context_ = context; - if (!fbo_) { - glGenFramebuffersEXT(1, &fbo_); - if (!fbo_) - return false; - glGenTextures(arraysize(textures_), textures_); - if (!CreatePixmaps()) - return false; - } - BindFramebuffer(); - glBindFramebufferEXT(GL_FRAMEBUFFER, fbo_); - return SurfacelessEGL::OnMakeCurrent(context); -} - -bool GbmSurface::Resize(const gfx::Size& size, - float scale_factor, - ColorSpace color_space, - bool has_alpha) { - if (size == GetSize()) - return true; - // Alpha value isn't actually used in allocating buffers yet, so always use - // true instead. - return GbmSurfaceless::Resize(size, scale_factor, color_space, true) && - CreatePixmaps(); -} - -bool GbmSurface::SupportsPostSubBuffer() { - return false; -} - -void GbmSurface::SwapBuffersAsync( - const SwapCompletionCallback& completion_callback, - const PresentationCallback& presentation_callback) { - if (!images_[current_surface_]->ScheduleOverlayPlane( - widget(), 0, gfx::OverlayTransform::OVERLAY_TRANSFORM_NONE, - gfx::Rect(GetSize()), gfx::RectF(1, 1), /* enable_blend */ false, - /* gpu_fence */ nullptr)) { - completion_callback.Run(gfx::SwapResult::SWAP_FAILED, nullptr); - // Notify the caller, the buffer is never presented on a screen. - presentation_callback.Run(gfx::PresentationFeedback::Failure()); - return; - } - GbmSurfaceless::SwapBuffersAsync(completion_callback, presentation_callback); - current_surface_ ^= 1; - BindFramebuffer(); -} - -void GbmSurface::Destroy() { - if (!context_) - return; - scoped_refptr<gl::GLContext> previous_context = gl::GLContext::GetCurrent(); - scoped_refptr<GLSurface> previous_surface; - - bool was_current = previous_context && previous_context->IsCurrent(nullptr) && - GLSurface::GetCurrent() == this; - if (!was_current) { - // Only take a reference to previous surface if it's not |this| - // because otherwise we can take a self reference from our own dtor. - previous_surface = GLSurface::GetCurrent(); - context_->MakeCurrent(this); - } - - glBindFramebufferEXT(GL_FRAMEBUFFER, 0); - if (fbo_) { - glDeleteTextures(arraysize(textures_), textures_); - for (auto& texture : textures_) - texture = 0; - glDeleteFramebuffersEXT(1, &fbo_); - fbo_ = 0; - } - for (auto& image : images_) - image = nullptr; - - if (!was_current) { - if (previous_context) { - previous_context->MakeCurrent(previous_surface.get()); - } else { - context_->ReleaseCurrent(this); - } - } -} - -bool GbmSurface::IsSurfaceless() const { - return false; -} - -GbmSurface::~GbmSurface() { - Destroy(); -} - -void GbmSurface::BindFramebuffer() { - gl::ScopedFramebufferBinder fb(fbo_); - glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, - textures_[current_surface_], 0); -} - -bool GbmSurface::CreatePixmaps() { - if (!fbo_) - return true; - for (size_t i = 0; i < arraysize(textures_); i++) { - scoped_refptr<gfx::NativePixmap> pixmap = - surface_factory()->CreateNativePixmap( - widget(), GetSize(), display::DisplaySnapshot::PrimaryFormat(), - gfx::BufferUsage::SCANOUT); - if (!pixmap) - return false; - scoped_refptr<gl::GLImageNativePixmap> image = - new gl::GLImageNativePixmap(GetSize(), GL_BGRA_EXT); - if (!image->Initialize(pixmap.get(), - display::DisplaySnapshot::PrimaryFormat())) - return false; - images_[i] = image; - // Bind image to texture. - gl::ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]); - if (!images_[i]->BindTexImage(GL_TEXTURE_2D)) - return false; - } - return true; -} - -} // namespace ui
diff --git a/ui/ozone/platform/drm/gpu/gbm_surface.h b/ui/ozone/platform/drm/gpu/gbm_surface.h deleted file mode 100644 index be90a6d..0000000 --- a/ui/ozone/platform/drm/gpu/gbm_surface.h +++ /dev/null
@@ -1,60 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACE_H_ -#define UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACE_H_ - -#include <memory> - -#include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "ui/gl/gl_context.h" -#include "ui/gl/gl_image.h" -#include "ui/ozone/platform/drm/gpu/gbm_surfaceless.h" - -namespace ui { - -class DrmWindowProxy; -class GbmSurfaceFactory; - -// A GLSurface for GBM Ozone platform provides surface-like semantics -// implemented through surfaceless. A framebuffer is bound automatically. -class GbmSurface : public GbmSurfaceless { - public: - GbmSurface(GbmSurfaceFactory* surface_factory, - std::unique_ptr<DrmWindowProxy> window, - gfx::AcceleratedWidget widget); - - // gl::GLSurface: - unsigned int GetBackingFramebufferObject() override; - bool OnMakeCurrent(gl::GLContext* context) override; - bool Resize(const gfx::Size& size, - float scale_factor, - ColorSpace color_space, - bool has_alpha) override; - bool SupportsPostSubBuffer() override; - void SwapBuffersAsync( - const SwapCompletionCallback& completion_callback, - const PresentationCallback& presentation_callback) override; - void Destroy() override; - bool IsSurfaceless() const override; - - private: - ~GbmSurface() override; - - void BindFramebuffer(); - bool CreatePixmaps(); - - scoped_refptr<gl::GLContext> context_; - GLuint fbo_ = 0; - GLuint textures_[2]; - scoped_refptr<gl::GLImage> images_[2]; - int current_surface_ = 0; - - DISALLOW_COPY_AND_ASSIGN(GbmSurface); -}; - -} // namespace ui - -#endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACE_H_
diff --git a/ui/ozone/platform/drm/gpu/gbm_surface_factory.cc b/ui/ozone/platform/drm/gpu/gbm_surface_factory.cc index 7503ba3..dffec5d 100644 --- a/ui/ozone/platform/drm/gpu/gbm_surface_factory.cc +++ b/ui/ozone/platform/drm/gpu/gbm_surface_factory.cc
@@ -21,7 +21,6 @@ #include "ui/ozone/platform/drm/gpu/drm_window_proxy.h" #include "ui/ozone/platform/drm/gpu/gbm_overlay_surface.h" #include "ui/ozone/platform/drm/gpu/gbm_pixmap.h" -#include "ui/ozone/platform/drm/gpu/gbm_surface.h" #include "ui/ozone/platform/drm/gpu/gbm_surfaceless.h" #include "ui/ozone/platform/drm/gpu/proxy_helpers.h" #include "ui/ozone/platform/drm/gpu/screen_manager.h" @@ -64,9 +63,7 @@ scoped_refptr<gl::GLSurface> CreateViewGLSurface( gfx::AcceleratedWidget window) override { - return gl::InitializeGLSurface(new GbmSurface( - surface_factory_, drm_thread_proxy_->CreateDrmWindowProxy(window), - window)); + return nullptr; } scoped_refptr<gl::GLSurface> CreateSurfacelessViewGLSurface(
diff --git a/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc b/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc index fdd70fd..6ee9357 100644 --- a/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc +++ b/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc
@@ -15,7 +15,6 @@ #include "ui/ozone/common/egl_util.h" #include "ui/ozone/platform/drm/gpu/drm_device.h" #include "ui/ozone/platform/drm/gpu/drm_framebuffer.h" -#include "ui/ozone/platform/drm/gpu/drm_vsync_provider.h" #include "ui/ozone/platform/drm/gpu/drm_window_proxy.h" #include "ui/ozone/platform/drm/gpu/gbm_surface_factory.h" @@ -54,9 +53,6 @@ bool GbmSurfaceless::Initialize(gl::GLSurfaceFormat format) { if (!SurfacelessEGL::Initialize(format)) return false; - vsync_provider_ = std::make_unique<DrmVSyncProvider>(window_.get()); - if (!vsync_provider_) - return false; return true; } @@ -84,10 +80,6 @@ return false; } -gfx::VSyncProvider* GbmSurfaceless::GetVSyncProvider() { - return vsync_provider_.get(); -} - bool GbmSurfaceless::SupportsPresentationCallback() { return true; }
diff --git a/ui/ozone/platform/drm/gpu/gbm_surfaceless.h b/ui/ozone/platform/drm/gpu/gbm_surfaceless.h index 21c759a9..8923a624 100644 --- a/ui/ozone/platform/drm/gpu/gbm_surfaceless.h +++ b/ui/ozone/platform/drm/gpu/gbm_surfaceless.h
@@ -45,7 +45,6 @@ bool enable_blend, std::unique_ptr<gfx::GpuFence> gpu_fence) override; bool IsOffscreen() override; - gfx::VSyncProvider* GetVSyncProvider() override; bool SupportsPresentationCallback() override; bool SupportsAsyncSwap() override; bool SupportsPostSubBuffer() override;
diff --git a/ui/ozone/platform/drm/gpu/mock_drm_device.cc b/ui/ozone/platform/drm/gpu/mock_drm_device.cc index 6b3bf89..e10c43f3 100644 --- a/ui/ozone/platform/drm/gpu/mock_drm_device.cc +++ b/ui/ozone/platform/drm/gpu/mock_drm_device.cc
@@ -84,7 +84,6 @@ add_framebuffer_call_count_(0), remove_framebuffer_call_count_(0), page_flip_call_count_(0), - overlay_flip_call_count_(0), overlay_clear_call_count_(0), allocate_buffer_count_(0), set_crtc_expectation_(true), @@ -252,17 +251,6 @@ return page_flip_expectation_; } -bool MockDrmDevice::PageFlipOverlay(uint32_t crtc_id, - uint32_t framebuffer, - const gfx::Rect& location, - const gfx::Rect& source, - int overlay_plane) { - if (!framebuffer) - overlay_clear_call_count_++; - overlay_flip_call_count_++; - return true; -} - ScopedDrmPlanePtr MockDrmDevice::GetPlane(uint32_t plane_id) { PlaneProperties* properties = FindObjectById(plane_id, plane_properties_); if (!properties)
diff --git a/ui/ozone/platform/drm/gpu/mock_drm_device.h b/ui/ozone/platform/drm/gpu/mock_drm_device.h index 2e705d0..a421d68 100644 --- a/ui/ozone/platform/drm/gpu/mock_drm_device.h +++ b/ui/ozone/platform/drm/gpu/mock_drm_device.h
@@ -61,7 +61,6 @@ return remove_framebuffer_call_count_; } int get_page_flip_call_count() const { return page_flip_call_count_; } - int get_overlay_flip_call_count() const { return overlay_flip_call_count_; } int get_overlay_clear_call_count() const { return overlay_clear_call_count_; } int get_commit_count() const { return commit_count_; } int get_set_object_property_count() const { @@ -131,11 +130,6 @@ bool PageFlip(uint32_t crtc_id, uint32_t framebuffer, scoped_refptr<PageFlipRequest> page_flip_request) override; - bool PageFlipOverlay(uint32_t crtc_id, - uint32_t framebuffer, - const gfx::Rect& location, - const gfx::Rect& source, - int overlay_plane) override; ScopedDrmPlanePtr GetPlane(uint32_t plane_id) override; ScopedDrmPropertyPtr GetProperty(drmModeConnector* connector, const char* name) override; @@ -190,7 +184,6 @@ int add_framebuffer_call_count_; int remove_framebuffer_call_count_; int page_flip_call_count_; - int overlay_flip_call_count_; int overlay_clear_call_count_; int allocate_buffer_count_; int commit_count_ = 0;
diff --git a/ui/views/controls/native/native_view_host_aura.cc b/ui/views/controls/native/native_view_host_aura.cc index 6c31922..3be7f53 100644 --- a/ui/views/controls/native/native_view_host_aura.cc +++ b/ui/views/controls/native/native_view_host_aura.cc
@@ -5,6 +5,7 @@ #include "ui/views/controls/native/native_view_host_aura.h" #include "base/logging.h" +#include "base/optional.h" #include "build/build_config.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/focus_client.h" @@ -98,10 +99,12 @@ } void NativeViewHostAura::NativeViewDetaching(bool destroyed) { - // This method causes a succession of window tree changes. - // ScopedPauseOcclusionTracking ensures that occlusion is recomputed at the - // end of the method instead of after each change. - aura::WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion; + // This method causes a succession of window tree changes. ScopedPause ensures + // that occlusion is recomputed at the end of the method instead of after each + // change. + base::Optional<aura::WindowOcclusionTracker::ScopedPause> pause_occlusion; + if (clipping_window_) + pause_occlusion.emplace(clipping_window_->env()); clipping_window_delegate_->set_native_view(NULL); RemoveClippingWindow();
diff --git a/ui/views/corewm/tooltip_win.cc b/ui/views/corewm/tooltip_win.cc index 7fc6a6f0..153d4c47 100644 --- a/ui/views/corewm/tooltip_win.cc +++ b/ui/views/corewm/tooltip_win.cc
@@ -4,9 +4,6 @@ #include "ui/views/corewm/tooltip_win.h" -#include <windowsx.h> -#include <winuser.h> - #include "base/debug/stack_trace.h" #include "base/i18n/rtl.h" #include "base/logging.h" @@ -21,6 +18,22 @@ namespace views { namespace corewm { +namespace { + +// Substitute GetWindowFont() from windowsx.h. +// Do not include windowsx.h as its macros break the views jumbo build. +HFONT GetWindowFont(HWND hwnd) { + return reinterpret_cast<HFONT>(::SendMessage(hwnd, WM_GETFONT, 0, 0)); +} + +// Substitute SetWindowFont() from windowsx.h. +// Do not include windowsx.h as its macros break the views jumbo build. +void SetWindowFont(HWND hwnd, HFONT hfont, BOOL fRedraw) { + ::SendMessage(hwnd, WM_SETFONT, reinterpret_cast<WPARAM>(hfont), fRedraw); +} + +} // namespace + TooltipWin::TooltipWin(HWND parent) : parent_hwnd_(parent), tooltip_hwnd_(NULL),
diff --git a/ui/views/mus/ax_remote_host.cc b/ui/views/mus/ax_remote_host.cc index d0f40dc..01511da2 100644 --- a/ui/views/mus/ax_remote_host.cc +++ b/ui/views/mus/ax_remote_host.cc
@@ -41,12 +41,12 @@ void AXRemoteHost::Init(service_manager::Connector* connector) { connector->BindInterface(ax::mojom::kAXHostServiceName, &ax_host_ptr_); - BindAndSetRemote(); + BindAndRegisterRemote(); } void AXRemoteHost::InitForTesting(ax::mojom::AXHostPtr host_ptr) { ax_host_ptr_ = std::move(host_ptr); - BindAndSetRemote(); + BindAndRegisterRemote(); } void AXRemoteHost::StartMonitoringWidget(Widget* widget) { @@ -177,16 +177,17 @@ ax_host_ptr_.FlushForTesting(); } -void AXRemoteHost::BindAndSetRemote() { +void AXRemoteHost::BindAndRegisterRemote() { ax::mojom::AXRemoteHostPtr remote; binding_.Bind(mojo::MakeRequest(&remote)); - ax_host_ptr_->SetRemoteHost( - std::move(remote), base::BindOnce(&AXRemoteHost::SetRemoteHostCallback, - base::Unretained(this))); + ax_host_ptr_->RegisterRemoteHost( + std::move(remote), + base::BindOnce(&AXRemoteHost::RegisterRemoteHostCallback, + base::Unretained(this))); } -void AXRemoteHost::SetRemoteHostCallback(const ui::AXTreeID& tree_id, - bool enabled) { +void AXRemoteHost::RegisterRemoteHostCallback(const ui::AXTreeID& tree_id, + bool enabled) { tree_id_ = tree_id; // Set the initial enabled state and send the AX tree if necessary.
diff --git a/ui/views/mus/ax_remote_host.h b/ui/views/mus/ax_remote_host.h index 65b72c01..bb432ba 100644 --- a/ui/views/mus/ax_remote_host.h +++ b/ui/views/mus/ax_remote_host.h
@@ -81,10 +81,10 @@ private: // Registers this object as a remote host for the parent AXHost. - void BindAndSetRemote(); + void BindAndRegisterRemote(); // Callback for initial state from AXHost. - void SetRemoteHostCallback(const ui::AXTreeID& tree_id, bool enabled); + void RegisterRemoteHostCallback(const ui::AXTreeID& tree_id, bool enabled); void Enable(); void Disable();
diff --git a/ui/views/mus/ax_remote_host_unittest.cc b/ui/views/mus/ax_remote_host_unittest.cc index 80908fc2..d6620cf 100644 --- a/ui/views/mus/ax_remote_host_unittest.cc +++ b/ui/views/mus/ax_remote_host_unittest.cc
@@ -44,7 +44,7 @@ } void ResetCounts() { - add_client_count_ = 0; + remote_host_count_ = 0; event_count_ = 0; last_tree_id_ = ui::AXTreeIDUnknown(); last_updates_.clear(); @@ -52,9 +52,9 @@ } // ax::mojom::AXHost: - void SetRemoteHost(ax::mojom::AXRemoteHostPtr client, - SetRemoteHostCallback cb) override { - ++add_client_count_; + void RegisterRemoteHost(ax::mojom::AXRemoteHostPtr client, + RegisterRemoteHostCallback cb) override { + ++remote_host_count_; std::move(cb).Run(TestAXTreeID(), automation_enabled_); client.FlushForTesting(); } @@ -69,7 +69,7 @@ mojo::Binding<ax::mojom::AXHost> binding_{this}; bool automation_enabled_ = false; - int add_client_count_ = 0; + int remote_host_count_ = 0; int event_count_ = 0; ui::AXTreeID last_tree_id_ = ui::AXTreeIDUnknown(); std::vector<ui::AXTreeUpdate> last_updates_; @@ -137,7 +137,7 @@ CreateRemote(&service); // Client registered itself with service. - EXPECT_EQ(1, service.add_client_count_); + EXPECT_EQ(1, service.remote_host_count_); } TEST_F(AXRemoteHostTest, AutomationEnabled) {
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc index 01a429a..264858b 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -595,11 +595,15 @@ } void DesktopNativeWidgetAura::ReorderNativeViews() { + if (!content_window_) + return; + // Reordering native views causes multiple changes to the window tree. - // Instantiate a ScopedPauseOcclusionTracking to recompute occlusion once at - // the end of this scope rather than after each individual change. + // Instantiate a ScopedPause to recompute occlusion once at the end of this + // scope rather than after each individual change. // https://crbug.com/829918 - aura::WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion; + aura::WindowOcclusionTracker::ScopedPause pause_occlusion( + content_window_->env()); window_reorderer_->ReorderChildWindows(); }
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc index 9d4d564..2514071e 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
@@ -17,7 +17,6 @@ #include "ui/aura/test/test_window_delegate.h" #include "ui/aura/test/window_occlusion_tracker_test_api.h" #include "ui/aura/window.h" -#include "ui/aura/window_occlusion_tracker.h" #include "ui/aura/window_tree_host.h" #include "ui/display/screen.h" #include "ui/events/event_processor.h" @@ -312,7 +311,7 @@ parent.Show(); aura::Window* parent_window = parent.GetNativeWindow(); - aura::WindowOcclusionTracker::Track(parent_window); + parent_window->TrackOcclusionState(); View* contents_view = parent.GetContentsView(); @@ -335,7 +334,8 @@ contents_view->AddChildView(host_view3); // Reorder child views. Expect occlusion to only be recomputed once. - aura::test::WindowOcclusionTrackerTestApi window_occlusion_tracker_test_api; + aura::test::WindowOcclusionTrackerTestApi window_occlusion_tracker_test_api( + parent_window->env()); const int num_times_occlusion_recomputed = window_occlusion_tracker_test_api.GetNumTimesOcclusionRecomputed(); contents_view->ReorderChildView(host_view3, 0);
diff --git a/ui/webui/resources/cr_elements/cr_searchable_drop_down/cr_searchable_drop_down.html b/ui/webui/resources/cr_elements/cr_searchable_drop_down/cr_searchable_drop_down.html index 168a5fec..209dc71 100644 --- a/ui/webui/resources/cr_elements/cr_searchable_drop_down/cr_searchable_drop_down.html +++ b/ui/webui/resources/cr_elements/cr_searchable_drop_down/cr_searchable_drop_down.html
@@ -49,7 +49,8 @@ immediately as the user types unless the update-value-on-input flag is explicitly used. --> <cr-input label="[[label]]" on-click="onClick_" value="[[value]]" - on-input="onInput_" id="search" autofocus="[[autofocus]]"> + on-input="onInput_" id="search" autofocus="[[autofocus]]" + placeholder="[[placeholder]]"> </cr-input> <iron-dropdown horizontal-align="left" vertical-align="top" vertical-offset="52">
diff --git a/ui/webui/resources/cr_elements/cr_searchable_drop_down/cr_searchable_drop_down.js b/ui/webui/resources/cr_elements/cr_searchable_drop_down/cr_searchable_drop_down.js index 3ce90c6..e7e94ed 100644 --- a/ui/webui/resources/cr_elements/cr_searchable_drop_down/cr_searchable_drop_down.js +++ b/ui/webui/resources/cr_elements/cr_searchable_drop_down/cr_searchable_drop_down.js
@@ -20,6 +20,8 @@ reflectToAttribute: true, }, + placeholder: String, + /** @type {!Array<string>} */ items: Array,