diff --git a/DEPS b/DEPS index d80dfe7..fea6c6f 100644 --- a/DEPS +++ b/DEPS
@@ -195,11 +195,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': '3d921f1b2c56b3e9de7d08a2dd54f6c9b612351e', + 'skia_revision': 'e96cdd18ac5ff04774b55775bf66f1f3ccbe4d62', # 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': 'a9c65f641d84f3810b7a63b356ca8af401e18e21', + 'v8_revision': '95c0414b1889f2d761e26024a8a040d647f81854', # 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. @@ -207,7 +207,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': '19e9df68a7bb94bf12375aa976540cacaeba0f1f', + 'angle_revision': '2663e6012911a3dc3e978a41f7c52d5c12c48c69', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -215,7 +215,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': 'cb9160484da5df0381a1b3b2811cc0ae397917cd', + 'pdfium_revision': '184c9b9164b7f92728e9277b47d3484a68bfa8c6', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling BoringSSL # and whatever else without interference from each other. @@ -258,7 +258,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': '21e6e530cf90dfbef91d2d860bfbaaabcd917e92', + 'catapult_revision': '18d69fb4e7b2225974dfc306ca0c11a58fe4e917', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -266,7 +266,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': '306abde46d5000640d384b1d67d29805f8bec455', + 'devtools_frontend_revision': '0d33d0e062db344a70d991abee0e4163d5c66137', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libprotobuf-mutator # and whatever else without interference from each other. @@ -901,7 +901,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '1099c11d5d12255458303c1ba4e5584cfde90477', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'ead81e2ba233835d7feb4dd6158014a1c3962ecb', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), @@ -1237,7 +1237,7 @@ Var('chromium_git') + '/external/github.com/cisco/openh264' + '@' + '3dd5b80bc4f172dd82925bb259cb7c82348409c5', 'src/third_party/openscreen/src': - Var('chromium_git') + '/openscreen' + '@' + '6d0991e9c086d35630fa744a7ec4e0e35e2d82f9', + Var('chromium_git') + '/openscreen' + '@' + '53a6a132f50cea8150cedbb11e6bb939f29e756d', 'src/third_party/openxr/src': { 'url': Var('chromium_git') + '/external/github.com/KhronosGroup/OpenXR-SDK' + '@' + '9e97b73e7dd2bfc07745489d728f6a36665c648f', @@ -1254,7 +1254,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + 'df3ae5e6f975204d2f35aeed61cbbd0746151d8e', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '88c194fccd3bfdcff22b4dfd0987230a433b5e96', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1524,7 +1524,7 @@ 'packages': [ { 'package': 'skia/tools/goldctl/linux-amd64', - 'version': 'afwCiHe5Fh5p0UN2CvmhSo6uWXlU0d289Yml61Egvg0C', + 'version': 'dMvix4BkhDJmKBK1tudaxlOMub1Dif3ZPcqzSY72-ZAC', }, ], 'dep_type': 'cipd', @@ -1534,7 +1534,7 @@ 'packages': [ { 'package': 'skia/tools/goldctl/windows-amd64', - 'version': '4faik34WiW106WOvsK6NNM4Q1Bz0vY5c29bxlSAWOWMC', + 'version': 'cLgS219WFD65Hr6NfoCQYA5KEE2FfO3FBl30KYhpTFoC', }, ], 'dep_type': 'cipd', @@ -1544,7 +1544,7 @@ 'packages': [ { 'package': 'skia/tools/goldctl/mac-amd64', - 'version': '_s8IulBrrqUxGhXDY3zbvzauPXhMHKLl63qibypfwXcC', + 'version': 'xJncEfNMb0HaDG9EglMx2YNbKAxqk6qJbckhfn0BXb8C', }, ], 'dep_type': 'cipd',
diff --git a/apps/ui/views/app_window_frame_view.cc b/apps/ui/views/app_window_frame_view.cc index 75c7c36..43d5e685 100644 --- a/apps/ui/views/app_window_frame_view.cc +++ b/apps/ui/views/app_window_frame_view.cc
@@ -53,8 +53,7 @@ void AppWindowFrameView::Init() { if (draw_frame_) { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - auto close_button = std::make_unique<views::ImageButton>(); - close_button->set_callback( + auto close_button = std::make_unique<views::ImageButton>( base::BindRepeating(&views::Widget::Close, base::Unretained(widget_))); close_button->SetImage( views::Button::STATE_NORMAL, @@ -69,9 +68,9 @@ l10n_util::GetStringUTF16(IDS_APP_ACCNAME_CLOSE)); close_button_ = AddChildView(std::move(close_button)); // STATE_NORMAL images are set in SetButtonImagesForFrame, not here. - auto maximize_button = std::make_unique<views::ImageButton>(); - maximize_button->set_callback(base::BindRepeating( - &views::Widget::Maximize, base::Unretained(widget_))); + auto maximize_button = + std::make_unique<views::ImageButton>(base::BindRepeating( + &views::Widget::Maximize, base::Unretained(widget_))); maximize_button->SetImage( views::Button::STATE_HOVERED, rb.GetNativeImageNamed(IDR_APP_WINDOW_MAXIMIZE_H).ToImageSkia()); @@ -84,9 +83,9 @@ maximize_button->SetAccessibleName( l10n_util::GetStringUTF16(IDS_APP_ACCNAME_MAXIMIZE)); maximize_button_ = AddChildView(std::move(maximize_button)); - auto restore_button = std::make_unique<views::ImageButton>(); - restore_button->set_callback(base::BindRepeating( - &views::Widget::Restore, base::Unretained(widget_))); + auto restore_button = + std::make_unique<views::ImageButton>(base::BindRepeating( + &views::Widget::Restore, base::Unretained(widget_))); restore_button->SetImage( views::Button::STATE_HOVERED, rb.GetNativeImageNamed(IDR_APP_WINDOW_RESTORE_H).ToImageSkia()); @@ -96,9 +95,9 @@ restore_button->SetAccessibleName( l10n_util::GetStringUTF16(IDS_APP_ACCNAME_RESTORE)); restore_button_ = AddChildView(std::move(restore_button)); - auto minimize_button = std::make_unique<views::ImageButton>(); - minimize_button->set_callback(base::BindRepeating( - &views::Widget::Minimize, base::Unretained(widget_))); + auto minimize_button = + std::make_unique<views::ImageButton>(base::BindRepeating( + &views::Widget::Minimize, base::Unretained(widget_))); minimize_button->SetImage( views::Button::STATE_HOVERED, rb.GetNativeImageNamed(IDR_APP_WINDOW_MINIMIZE_H).ToImageSkia());
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 079c872..200085b2 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -1126,22 +1126,21 @@ "system/phonehub/notification_opt_in_view.h", "system/phonehub/onboarding_view.cc", "system/phonehub/onboarding_view.h", + "system/phonehub/phone_connected_view.cc", + "system/phonehub/phone_connected_view.h", "system/phonehub/phone_hub_interstitial_view.cc", "system/phonehub/phone_hub_interstitial_view.h", "system/phonehub/phone_hub_notification_controller.cc", "system/phonehub/phone_hub_notification_controller.h", "system/phonehub/phone_hub_tray.cc", "system/phonehub/phone_hub_tray.h", + "system/phonehub/phone_hub_ui_controller.cc", + "system/phonehub/phone_hub_ui_controller.h", "system/phonehub/phone_hub_view_ids.h", "system/phonehub/phone_status_view.cc", "system/phonehub/phone_status_view.h", - "system/phonehub/quick_action_controller_base.h", - "system/phonehub/quick_action_item.cc", - "system/phonehub/quick_action_item.h", "system/phonehub/quick_actions_view.cc", "system/phonehub/quick_actions_view.h", - "system/phonehub/silence_phone_quick_action_controller.cc", - "system/phonehub/silence_phone_quick_action_controller.h", "system/phonehub/task_continuation_view.cc", "system/phonehub/task_continuation_view.h", "system/power/backlights_forced_off_setter.cc", @@ -2124,8 +2123,8 @@ "system/palette/tools/screenshot_unittest.cc", "system/phonehub/phone_hub_notification_controller_unittest.cc", "system/phonehub/phone_hub_tray_unittest.cc", + "system/phonehub/phone_hub_ui_controller_unittest.cc", "system/phonehub/phone_status_view_unittest.cc", - "system/phonehub/quick_actions_view_unittest.cc", "system/phonehub/task_continuation_view_unittest.cc", "system/power/backlights_forced_off_setter_unittest.cc", "system/power/peripheral_battery_notifier_unittest.cc",
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index f66efff..267951f 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd
@@ -553,7 +553,7 @@ <ph name="UPDATE_TEXT">$1<ex>Learn more about the latest Chromium OS update</ex></ph>. This Chromebook needs to restart to apply an update. This can take up to 1 minute. </message> <message name="IDS_DIALOG_TITLE_SLOW_BOOT" desc="The title of the Slow Boot Shutdown Confirmation Dialog."> - Restart may take awhile + Restart may take awhile </message> <message name="IDS_DIALOG_MESSAGE_SLOW_BOOT" desc="The body of the Slow Boot Shutdown Confirmation Dialog."> Your screen will go blank for longer than usual (up to a minute) during this update. Please don't press the power button while the update is in progress. @@ -1020,36 +1020,12 @@ <message name="IDS_ASH_PHONE_HUB_QUICK_ACTIONS_DISABLED_STATE_TOOLTIP" desc="The tooltip text indicating the quick actions feature is off."> <ph name="FEATURE_NAME">$1<ex>Silence</ex></ph> is off. </message> - <message name="IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTING_STATE_TOOLTIP" desc="The tooltip text indicating the quick actions feature is currently sending a signal and try to connect to the phone."> - <ph name="FEATURE_NAME">$1<ex>Silence</ex></ph> is connecting. - </message> - <message name="IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_CONNECTED_STATE_TOOLTIP" desc="The tooltip text indicating the quick actions feature is not available to use."> - <ph name="FEATURE_NAME">$1<ex>Enable Hotspot</ex></ph> is not connected. - </message> - <message name="IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTED_STATE_TOOLTIP" desc="The tooltip text indicating the quick actions feature is not available to use."> - <ph name="FEATURE_NAME">$1<ex>Enable Hotspot</ex></ph> is connected. - </message> - <message name="IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_AVAILABLE_STATE_TOOLTIP" desc="The tooltip text indicating the quick actions feature is not available to use."> - <ph name="FEATURE_NAME">$1<ex>Silence</ex></ph> is not available. - </message> <message name="IDS_ASH_PHONE_HUB_QUICK_ACTIONS_OFF_STATE" desc="Quick actions state in phone hub bubble." meaning="Quick actions feature is off."> Off </message> <message name="IDS_ASH_PHONE_HUB_QUICK_ACTIONS_ON_STATE" desc="Quick actions state in phone hub bubble." meaning="Quick actions feature is on."> On </message> - <message name="IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTING_STATE" desc="Quick actions state in phone hub bubble." meaning="The feature is currently sending a signal and try to connect to the phone."> - Connecting... - </message> - <message name="IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_CONNECTED_STATE" desc="Quick actions state in phone hub bubble." meaning="The feature is not connected to the phone."> - Not connected - </message> - <message name="IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTED_STATE" desc="Quick actions state in phone hub bubble." meaning="The feature is connected to the phone and ready to use."> - Connected - </message> - <message name="IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_AVAILABLE_STATE" desc="Quick actions state in phone hub bubble." meaning="Quick actions feature is not available to use."> - Not available - </message> <message name="IDS_ASH_PHONE_HUB_TASK_CONTINUATION_TITLE" desc="Title of the task continuation section (where users pick up unfinished task left off from their phone, currently only support web browsing) in phone hub bubble."> Continue browsing </message>
diff --git a/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTED_STATE.png.sha1 b/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTED_STATE.png.sha1 deleted file mode 100644 index 514dcbdb..0000000 --- a/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTED_STATE.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -f0d2cf8683111c43c0a742492d5e39b3ba128631 \ No newline at end of file
diff --git a/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTED_STATE_TOOLTIP.png.sha1 b/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTED_STATE_TOOLTIP.png.sha1 deleted file mode 100644 index 4a67355..0000000 --- a/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTED_STATE_TOOLTIP.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -b7c6650a313b1c1e797821eccc2feb7c957ad091 \ No newline at end of file
diff --git a/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTING_STATE.png.sha1 b/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTING_STATE.png.sha1 deleted file mode 100644 index 25a0782..0000000 --- a/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTING_STATE.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -cf8fe0079e4e717981ba3a9afedf9280cb6d8fda \ No newline at end of file
diff --git a/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTING_STATE_TOOLTIP.png.sha1 b/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTING_STATE_TOOLTIP.png.sha1 deleted file mode 100644 index 471458a..0000000 --- a/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTING_STATE_TOOLTIP.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -7de2e334fd462e24075fa72eabd0eb3b73e4f13f \ No newline at end of file
diff --git a/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_AVAILABLE_STATE.png.sha1 b/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_AVAILABLE_STATE.png.sha1 deleted file mode 100644 index 9badeef..0000000 --- a/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_AVAILABLE_STATE.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -918d925ef3041ef720077971df3a0d47bed5cc34 \ No newline at end of file
diff --git a/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_AVAILABLE_STATE_TOOLTIP.png.sha1 b/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_AVAILABLE_STATE_TOOLTIP.png.sha1 deleted file mode 100644 index e1a3f8ae..0000000 --- a/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_AVAILABLE_STATE_TOOLTIP.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -ddc04194dd9844eadd4d78cb7d05c8b85ba754e6 \ No newline at end of file
diff --git a/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_CONNECTED_STATE.png.sha1 b/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_CONNECTED_STATE.png.sha1 deleted file mode 100644 index 1ec2699..0000000 --- a/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_CONNECTED_STATE.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -6d96fd17f94b220d46d0089f65c39d78eb35e6bf \ No newline at end of file
diff --git a/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_CONNECTED_STATE_TOOLTIP.png.sha1 b/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_CONNECTED_STATE_TOOLTIP.png.sha1 deleted file mode 100644 index 8966b0c..0000000 --- a/ash/ash_strings_grd/IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_CONNECTED_STATE_TOOLTIP.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -36477329435864bf81335bffbb895daf3f860257 \ No newline at end of file
diff --git a/ash/clipboard/views/clipboard_history_item_view.cc b/ash/clipboard/views/clipboard_history_item_view.cc index 3436de2..87668c5f 100644 --- a/ash/clipboard/views/clipboard_history_item_view.cc +++ b/ash/clipboard/views/clipboard_history_item_view.cc
@@ -110,10 +110,10 @@ ClipboardHistoryItemView::DeleteButton::DeleteButton( ClipboardHistoryItemView* listener) - : views::ImageButton() { - set_callback(base::BindRepeating(&ClipboardHistoryItemView::ExecuteCommand, - base::Unretained(listener), - ClipboardHistoryUtil::kDeleteCommandId)); + : views::ImageButton( + base::BindRepeating(&ClipboardHistoryItemView::ExecuteCommand, + base::Unretained(listener), + ClipboardHistoryUtil::kDeleteCommandId)) { SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); SetAccessibleName(base::ASCIIToUTF16(std::string(GetClassName()))); SetImageHorizontalAlignment(views::ImageButton::ALIGN_CENTER);
diff --git a/ash/hud_display/cpu_graph_page_view.cc b/ash/hud_display/cpu_graph_page_view.cc index 9a118f8e..75905ae 100644 --- a/ash/hud_display/cpu_graph_page_view.cc +++ b/ash/hud_display/cpu_graph_page_view.cc
@@ -4,9 +4,12 @@ #include "ash/hud_display/cpu_graph_page_view.h" +#include <algorithm> #include <numeric> #include "ash/hud_display/hud_constants.h" +#include "base/strings/stringprintf.h" +#include "base/strings/utf_string_conversions.h" #include "ui/gfx/canvas.h" namespace ash { @@ -41,19 +44,28 @@ /*top=*/100, /*right=*/0, /*bottom=*/0, base::ASCIIToUTF16("s"), base::ASCIIToUTF16("%"), data_width, 10 / refresh_interval.InSecondsF()); + Legend::Formatter formatter = base::BindRepeating([](float value) { + return base::ASCIIToUTF16(base::StringPrintf( + "%d %%", std::min(100, std::max(0, (int)(value * 100))))); + }); + const std::vector<Legend::Entry> legend( - {{cpu_idle_.color(), base::ASCIIToUTF16("Idle"), - base::ASCIIToUTF16("Total amount of CPU time spent\nin idle mode.")}, - {cpu_user_.color(), base::ASCIIToUTF16("User"), + {{cpu_idle_, base::ASCIIToUTF16("Idle"), + base::ASCIIToUTF16("Total amount of CPU time spent\nin idle mode."), + formatter}, + {cpu_user_, base::ASCIIToUTF16("User"), base::ASCIIToUTF16( - "Total amount of CPU time spent\n running user processes.")}, - {cpu_system_.color(), base::ASCIIToUTF16("System"), + "Total amount of CPU time spent\n running user processes."), + formatter}, + {cpu_system_, base::ASCIIToUTF16("System"), base::ASCIIToUTF16( - "Total amount of CPU time spent\nrunning system processes.")}, - {cpu_other_.color(), base::ASCIIToUTF16("Other"), + "Total amount of CPU time spent\nrunning system processes."), + formatter}, + {cpu_other_, base::ASCIIToUTF16("Other"), base::ASCIIToUTF16( "Total amount of CPU time spent\nrunning other tasks.\nThis " - "includes IO wait, IRQ, guest OS, etc.")}}); + "includes IO wait, IRQ, guest OS, etc."), + formatter}}); CreateLegend(legend); } @@ -91,10 +103,13 @@ // Assume total already equals 1, no need to re-weight. // Update graph data. - cpu_other_.AddValue(snapshot.cpu_other_part); - cpu_system_.AddValue(snapshot.cpu_system_part); - cpu_user_.AddValue(snapshot.cpu_user_part); - cpu_idle_.AddValue(snapshot.cpu_idle_part); + // unscaled values for CPU are the same. Formatter will display it as %. + cpu_other_.AddValue(snapshot.cpu_other_part, snapshot.cpu_other_part); + cpu_system_.AddValue(snapshot.cpu_system_part, snapshot.cpu_system_part); + cpu_user_.AddValue(snapshot.cpu_user_part, snapshot.cpu_user_part); + cpu_idle_.AddValue(snapshot.cpu_idle_part, snapshot.cpu_idle_part); + + RefreshLegendValues(); } } // namespace hud_display
diff --git a/ash/hud_display/graph.cc b/ash/hud_display/graph.cc index 92860365..8443ed2 100644 --- a/ash/hud_display/graph.cc +++ b/ash/hud_display/graph.cc
@@ -22,8 +22,9 @@ Graph::~Graph() {} -void Graph::AddValue(float value) { +void Graph::AddValue(float value, float unscaled_value) { data_.SaveToBuffer(value); + unscaled_data_.SaveToBuffer(unscaled_value); } void Graph::Layout(const gfx::Rect& graph_bounds, const Graph* base) { @@ -117,6 +118,28 @@ canvas->DrawPath(path, flags); } +float Graph::GetUnscaledValueAt(size_t index) const { + // 0 - the oldest value + // BufferSize() - 1 - the newest value. + const size_t raw_index = index < unscaled_data_.BufferSize() + ? unscaled_data_.BufferSize() - 1 - index + : 0; + + // It will CHECK() if index is not populated. + if (!unscaled_data_.IsFilledIndex(raw_index)) + return 0; + + return unscaled_data_.ReadBuffer(raw_index); +} + +bool Graph::IsFilledIndex(size_t index) const { + // 0 - the oldest value + // BufferSize() - 1 - the newest value. + const size_t raw_index = + index < data_.BufferSize() ? data_.BufferSize() - 1 - index : 0; + return data_.IsFilledIndex(raw_index); +} + #if !defined(NDEBUG) std::string Graph::DebugDump(const std::string& name) const { std::ostringstream os;
diff --git a/ash/hud_display/graph.h b/ash/hud_display/graph.h index 1d1cb7cd..139b4ea 100644 --- a/ash/hud_display/graph.h +++ b/ash/hud_display/graph.h
@@ -47,7 +47,8 @@ // |value| must be normalized to [0,1]. When graphs are drawn stacked, // the full stack must be normalized. - void AddValue(float value); + // |unscaled_value| is used to label graph values to the user. + void AddValue(float value, float unscaled_value); void Layout(const gfx::Rect& graph_bounds, const Graph* base); void Draw(gfx::Canvas* canvas) const; @@ -57,6 +58,18 @@ SkColor color() const { return color_; } + // Returns value from |unscaled_data_|. + // |index| is always interpreted as "negative", i.e. "0" - current data, "1" + // - previous graph data, 2 - two steps "ago". I.e. it's number of graph + // points from the right graph edge. + float GetUnscaledValueAt(size_t index) const; + + // Returns true if |data_| is populated at the given index. + // |index| is always interpreted as "negative", i.e. "0" - current data, "1" + // - previous graph data, 2 - two steps ago. I.e. it's number of graph + // points from the right graph edge. + bool IsFilledIndex(size_t index) const; + #if !defined(NDEBUG) // Returns string representation os this object for debug. std::string DebugDump(const std::string& name) const; @@ -79,6 +92,7 @@ std::vector<SkPoint> bottom_path_; Data data_; + Data unscaled_data_; }; } // namespace hud_display
diff --git a/ash/hud_display/graph_page_view_base.cc b/ash/hud_display/graph_page_view_base.cc index a631d584..d997e68 100644 --- a/ash/hud_display/graph_page_view_base.cc +++ b/ash/hud_display/graph_page_view_base.cc
@@ -149,5 +149,10 @@ horizontal_ticks_interval)); } +void GraphPageViewBase::RefreshLegendValues() { + if (legend_) + legend_->RefreshValues(); +} + } // namespace hud_display } // namespace ash
diff --git a/ash/hud_display/graph_page_view_base.h b/ash/hud_display/graph_page_view_base.h index 9e20393..de0060c 100644 --- a/ash/hud_display/graph_page_view_base.h +++ b/ash/hud_display/graph_page_view_base.h
@@ -19,6 +19,7 @@ namespace hud_display { class Grid; +class Legend; // Interface for a single graph page. class GraphPageViewBase : public views::View, public views::ButtonListener { @@ -49,6 +50,9 @@ int horizontal_points_number, int horizontal_ticks_interval); + protected: + void RefreshLegendValues(); + private: // Container for the Grid object. views::View* grid_container_ = nullptr; // not owned @@ -56,7 +60,7 @@ // Container for the legend object. views::View* legend_container_ = nullptr; // not owned views::ImageButton* legend_min_max_button_ = nullptr; // not owned - views::View* legend_ = nullptr; // not owned + Legend* legend_ = nullptr; // not owned SEQUENCE_CHECKER(ui_sequence_checker_); };
diff --git a/ash/hud_display/hud_display.cc b/ash/hud_display/hud_display.cc index 1246c46..d1bf63e1 100644 --- a/ash/hud_display/hud_display.cc +++ b/ash/hud_display/hud_display.cc
@@ -33,14 +33,14 @@ constexpr size_t kHUDGraphsInset = 5; // Default HUDDisplayView height. -static constexpr size_t kDefaultHUDGraphHeight = 300; +constexpr size_t kDefaultHUDGraphHeight = 300; // Top border + Header height + margin + graph height + bottom border.. constexpr int kHUDViewDefaultHeight = kHUDInset + (kHUDSettingsIconSize + 2 * kSettingsIconBorder) + kHUDGraphsInset + kDefaultHUDGraphHeight + kHUDInset; -std::unique_ptr<views::Widget> g_hud_widget; +views::Widget* g_hud_widget = nullptr; // ClientView that return HTNOWHERE by default. A child view can receive event // by setting kHitTestComponentKey property to HTCLIENT. @@ -79,9 +79,11 @@ // static void HUDDisplayView::Destroy() { - g_hud_widget.reset(); + delete g_hud_widget; + g_hud_widget = nullptr; } +// static void HUDDisplayView::Toggle() { if (g_hud_widget) { Destroy(); @@ -101,7 +103,7 @@ widget->GetLayer()->SetName("HUDDisplayView"); widget->Show(); - g_hud_widget = base::WrapUnique(widget); + g_hud_widget = widget; } HUDDisplayView::HUDDisplayView() {
diff --git a/ash/hud_display/legend.cc b/ash/hud_display/legend.cc index e5ed36a4..67d24090 100644 --- a/ash/hud_display/legend.cc +++ b/ash/hud_display/legend.cc
@@ -4,6 +4,7 @@ #include "ash/hud_display/legend.h" +#include "ash/hud_display/graph.h" #include "ash/hud_display/hud_constants.h" #include "ash/hud_display/solid_source_background.h" #include "cc/paint/paint_flags.h" @@ -35,14 +36,24 @@ // views::View: void OnPaint(gfx::Canvas* canvas) override; + void SetValueIndex(size_t index); + void RefreshValue(); + private: const SkColor color_; + const Graph& graph_; + size_t value_index_ = 0; + Legend::Formatter formatter_; + views::Label* value_ = nullptr; }; BEGIN_METADATA(LegendEntry, View) END_METADATA -LegendEntry::LegendEntry(const Legend::Entry& data) : color_(data.color) { +LegendEntry::LegendEntry(const Legend::Entry& data) + : color_(data.graph.color()), + graph_(data.graph), + formatter_(data.formatter) { views::BoxLayout* layout_manager = SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kHorizontal)); @@ -60,6 +71,16 @@ label->SetEnabledColor(kHUDDefaultColor); if (!data.tooltip.empty()) label->SetTooltipText(data.tooltip); + + constexpr int kLabelToValueSpece = 5; + value_ = AddChildView(std::make_unique<views::Label>( + base::string16(), views::style::CONTEXT_LABEL)); + layout_manager->SetFlexForView(value_, /*flex=*/1); + value_->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_RIGHT); + value_->SetBorder(views::CreateEmptyBorder(0, kLabelToValueSpece, 0, 0)); + value_->SetEnabledColor(kHUDDefaultColor); + + ALLOW_UNUSED_LOCAL(formatter_); } LegendEntry::~LegendEntry() = default; @@ -99,8 +120,34 @@ views::View::OnPaint(canvas); } +void LegendEntry::SetValueIndex(size_t index) { + if (index == value_index_) + return; + + value_index_ = index; + RefreshValue(); +} + +void LegendEntry::RefreshValue() { + if (graph_.IsFilledIndex(value_index_)) { + value_->SetText(formatter_.Run(graph_.GetUnscaledValueAt(value_index_))); + } else { + value_->SetText(base::string16()); + } +} + } // namespace +Legend::Entry::Entry(const Graph& graph, + base::string16 label, + base::string16 tooltip, + Formatter formatter) + : graph(graph), label(label), tooltip(tooltip), formatter(formatter) {} + +Legend::Entry::Entry(const Entry&) = default; + +Legend::Entry::~Entry() = default; + BEGIN_METADATA(Legend, View) END_METADATA @@ -122,5 +169,23 @@ Legend::~Legend() = default; +void Legend::SetValuesIndex(size_t index) { + for (auto* view : children()) { + if (view->GetClassName() != LegendEntry::kViewClassName) + continue; + + static_cast<LegendEntry*>(view)->SetValueIndex(index); + } +} + +void Legend::RefreshValues() { + for (auto* view : children()) { + if (view->GetClassName() != LegendEntry::kViewClassName) + continue; + + static_cast<LegendEntry*>(view)->RefreshValue(); + } +} + } // namespace hud_display } // namespace ash
diff --git a/ash/hud_display/legend.h b/ash/hud_display/legend.h index ed44669..ac538eb3 100644 --- a/ash/hud_display/legend.h +++ b/ash/hud_display/legend.h
@@ -7,21 +7,35 @@ #include <vector> +#include "base/callback.h" + #include "base/strings/string16.h" #include "ui/views/view.h" namespace ash { namespace hud_display { +class Graph; + // Draws legend view. class Legend : public views::View { public: + using Formatter = base::RepeatingCallback<base::string16(float)>; + METADATA_HEADER(Legend); struct Entry { - SkColor color; + Entry(const Graph& graph, + base::string16 label, + base::string16 tooltip, + Formatter formatter); + Entry(const Entry&); + ~Entry(); + + const Graph& graph; base::string16 label; base::string16 tooltip; + Formatter formatter; // formatting function }; Legend(const std::vector<Entry>& contents); @@ -30,6 +44,14 @@ Legend& operator=(const Legend&) = delete; ~Legend() override; + + // Display values for the given index. |index| is always interpreted as + // "negative", i.e. "0" - current data, "1" - previous graph data, 2 - two + // steps ago. I.e. it's number of graph points from the right graph edge. + void SetValuesIndex(size_t index); + + // Update displayed values after data was updated. + void RefreshValues(); }; } // namespace hud_display
diff --git a/ash/hud_display/memory_graph_page_view.cc b/ash/hud_display/memory_graph_page_view.cc index 34bdbf09..f8e5d378 100644 --- a/ash/hud_display/memory_graph_page_view.cc +++ b/ash/hud_display/memory_graph_page_view.cc
@@ -4,6 +4,7 @@ #include "ash/hud_display/memory_graph_page_view.h" +#include <algorithm> #include <numeric> #include "ash/hud_display/grid.h" @@ -58,25 +59,34 @@ // Hide grid until we know total memory size. grid_->SetVisible(false); + Legend::Formatter formatter = base::BindRepeating([](float value) { + return base::ASCIIToUTF16( + base::StringPrintf("%d Mb", std::max(0, (int)(value * 1024)))); + }); + const std::vector<Legend::Entry> legend({ - {graph_gpu_kernel_.color(), base::ASCIIToUTF16("GPU Driver"), + {graph_gpu_kernel_, base::ASCIIToUTF16("GPU Driver"), base::ASCIIToUTF16("Kernel GPU buffers as reported\nby " - "base::SystemMemoryInfo::gem_size.")}, - {graph_gpu_rss_private_.color(), base::ASCIIToUTF16("Chrome GPU"), + "base::SystemMemoryInfo::gem_size."), + formatter}, + {graph_gpu_rss_private_, base::ASCIIToUTF16("Chrome GPU"), base::ASCIIToUTF16( - "RSS private memory of\n --type=gpu-process Chrome process.")}, + "RSS private memory of\n --type=gpu-process Chrome process."), + formatter}, // ARC memory is not usually visible (skipped) - {graph_renderers_rss_private_.color(), - base::ASCIIToUTF16("Chrome Renderer"), + {graph_renderers_rss_private_, base::ASCIIToUTF16("Renderers"), base::ASCIIToUTF16( - "Sum of RSS private memory of\n--type=renderer Chrome process.")}, - {graph_mem_used_unknown_.color(), base::ASCIIToUTF16("Other"), + "Sum of RSS private memory of\n--type=renderer Chrome process."), + formatter}, + {graph_mem_used_unknown_, base::ASCIIToUTF16("Other"), base::ASCIIToUTF16( - "Amount of other used memory.\nEquals to total used minus known.")}, - {graph_mem_free_.color(), base::ASCIIToUTF16("Free"), - base::ASCIIToUTF16("Free memory as reported by kernel.")}, - {graph_chrome_rss_private_.color(), base::ASCIIToUTF16("Browser"), - base::ASCIIToUTF16("RSS private memory of the\nmain Chrome process.")} + "Amount of other used memory.\nEquals to total used minus known."), + formatter}, + {graph_mem_free_, base::ASCIIToUTF16("Free"), + base::ASCIIToUTF16("Free memory as reported by kernel."), formatter}, + {graph_chrome_rss_private_, base::ASCIIToUTF16("Browser"), + base::ASCIIToUTF16("RSS private memory of the\nmain Chrome process."), + formatter} // Browser RSS hairline skipped. }); CreateLegend(legend); @@ -122,27 +132,35 @@ if (total < 1) return; + constexpr float one_gigabyte = 1024 * 1024 * 1024; + if (total_ram_ != total) { total_ram_ = total; - constexpr float one_gigabyte = 1024 * 1024 * 1024; grid_->SetTopLabel(total / one_gigabyte); // In Gigabytes. grid_->SetVisible(true); } - const float chrome_rss_private = - (snapshot.browser_rss - snapshot.browser_rss_shared) / total; - const float mem_free = snapshot.free_ram / total; + const float chrome_rss_private_unscaled = + (snapshot.browser_rss - snapshot.browser_rss_shared); + const float chrome_rss_private = chrome_rss_private_unscaled / total; + const float mem_free_unscaled = snapshot.free_ram; + const float mem_free = mem_free_unscaled / total; // mem_used_unknown is calculated below. - const float renderers_rss_private = - (snapshot.renderers_rss - snapshot.renderers_rss_shared) / total; - const float arc_rss_private = - (snapshot.arc_rss - snapshot.arc_rss_shared) / total; - const float gpu_rss_private = - (snapshot.gpu_rss - snapshot.gpu_rss_shared) / total; - const float gpu_kernel = snapshot.gpu_kernel / total; + const float renderers_rss_private_unscaled = + snapshot.renderers_rss - snapshot.renderers_rss_shared; + const float renderers_rss_private = renderers_rss_private_unscaled / total; + const float arc_rss_private_unscaled = + snapshot.arc_rss - snapshot.arc_rss_shared; + const float arc_rss_private = arc_rss_private_unscaled / total; + const float gpu_rss_private_unscaled = + snapshot.gpu_rss - snapshot.gpu_rss_shared; + const float gpu_rss_private = gpu_rss_private_unscaled / total; + const float gpu_kernel_unscaled = snapshot.gpu_kernel; + const float gpu_kernel = gpu_kernel_unscaled / total; // not stacked. - const float chrome_rss_shared = snapshot.browser_rss_shared / total; + const float chrome_rss_shared_unscaled = snapshot.browser_rss_shared; + const float chrome_rss_shared = chrome_rss_shared_unscaled / total; std::vector<float> used_buckets; used_buckets.push_back(chrome_rss_private); @@ -152,22 +170,32 @@ used_buckets.push_back(gpu_rss_private); used_buckets.push_back(gpu_kernel); - float mem_used_unknown = + const float mem_used_unknown = 1 - std::accumulate(used_buckets.begin(), used_buckets.end(), 0.0f); + const float mem_used_unknown_unscaled = mem_used_unknown * total; if (mem_used_unknown < 0) LOG(WARNING) << "mem_used_unknown=" << mem_used_unknown << " < 0 !"; // Update graph data. - graph_chrome_rss_private_.AddValue(chrome_rss_private); - graph_mem_free_.AddValue(mem_free); - graph_mem_used_unknown_.AddValue(std::max(mem_used_unknown, 0.0f)); - graph_renderers_rss_private_.AddValue(renderers_rss_private); - graph_arc_rss_private_.AddValue(arc_rss_private); - graph_gpu_rss_private_.AddValue(gpu_rss_private); - graph_gpu_kernel_.AddValue(gpu_kernel); + graph_chrome_rss_private_.AddValue( + chrome_rss_private, chrome_rss_private_unscaled / one_gigabyte); + graph_mem_free_.AddValue(mem_free, mem_free_unscaled / one_gigabyte); + graph_mem_used_unknown_.AddValue( + std::max(mem_used_unknown, 0.0f), + std::max(mem_used_unknown_unscaled / one_gigabyte, 0.0f)); + graph_renderers_rss_private_.AddValue( + renderers_rss_private, renderers_rss_private_unscaled / one_gigabyte); + graph_arc_rss_private_.AddValue(arc_rss_private, + arc_rss_private_unscaled / one_gigabyte); + graph_gpu_rss_private_.AddValue(gpu_rss_private, + gpu_rss_private_unscaled / one_gigabyte); + graph_gpu_kernel_.AddValue(gpu_kernel, gpu_kernel_unscaled / one_gigabyte); // Not stacked. - graph_chrome_rss_shared_.AddValue(chrome_rss_shared); + graph_chrome_rss_shared_.AddValue(chrome_rss_shared, + chrome_rss_shared_unscaled / one_gigabyte); + + RefreshLegendValues(); } } // namespace hud_display
diff --git a/ash/public/cpp/app_list/app_list_types.h b/ash/public/cpp/app_list/app_list_types.h index 7dad417c..398dba1 100644 --- a/ash/public/cpp/app_list/app_list_types.h +++ b/ash/public/cpp/app_list/app_list_types.h
@@ -274,7 +274,8 @@ // The subtype of this result. Derived search result classes can use this to // represent their own subtypes. Currently, OmniboxResult sets this to - // indicate this is a history result, previous query, etc. A value of -1 + // indicate this is a history result, previous query, etc. If a result is an + // Answer, OmniboxResult will set this to be the answer type. A value of -1 // indicates no subtype has been set. int result_subtype = -1; @@ -303,6 +304,10 @@ // Whether this result is a recommendation. bool is_recommendation = false; + // Whether this result is an answer. Answer results should originate from + // base::SuggestionAnswer. + bool is_answer = false; + // A query URL associated with this result. The meaning and treatment of the // URL (e.g. displaying inline web contents) is dependent on the result type. base::Optional<GURL> query_url;
diff --git a/ash/system/media/unified_media_controls_controller_unittest.cc b/ash/system/media/unified_media_controls_controller_unittest.cc index 2d7ecb47..4849bfdb 100644 --- a/ash/system/media/unified_media_controls_controller_unittest.cc +++ b/ash/system/media/unified_media_controls_controller_unittest.cc
@@ -202,6 +202,36 @@ EXPECT_EQ(1, media_controller()->resume_count()); } +TEST_F(UnifiedMediaControlsControllerTest, ActionButtonVisibility) { + SimulateMediaPlaybackStateChanged( + media_session::mojom::MediaPlaybackState::kPlaying); + EnableAction(MediaSessionAction::kPause); + EnableAction(MediaSessionAction::kPlay); + EXPECT_EQ(GetActionButton(MediaSessionAction::kPlay), nullptr); + EXPECT_TRUE(GetActionButton(MediaSessionAction::kPause)->GetVisible()); + EXPECT_FALSE( + GetActionButton(MediaSessionAction::kPreviousTrack)->GetVisible()); + EXPECT_FALSE(GetActionButton(MediaSessionAction::kNextTrack)->GetVisible()); + + EnableAction(MediaSessionAction::kPreviousTrack); + EXPECT_TRUE(GetActionButton(MediaSessionAction::kPause)->GetVisible()); + EXPECT_TRUE( + GetActionButton(MediaSessionAction::kPreviousTrack)->GetVisible()); + EXPECT_FALSE(GetActionButton(MediaSessionAction::kNextTrack)->GetVisible()); + + EnableAction(MediaSessionAction::kNextTrack); + DisableAction(MediaSessionAction::kPreviousTrack); + EXPECT_TRUE(GetActionButton(MediaSessionAction::kPause)->GetVisible()); + EXPECT_FALSE( + GetActionButton(MediaSessionAction::kPreviousTrack)->GetVisible()); + EXPECT_TRUE(GetActionButton(MediaSessionAction::kNextTrack)->GetVisible()); + + SimulateMediaPlaybackStateChanged( + media_session::mojom::MediaPlaybackState::kPaused); + EXPECT_EQ(GetActionButton(MediaSessionAction::kPause), nullptr); + EXPECT_TRUE(GetActionButton(MediaSessionAction::kPlay)->GetVisible()); +} + TEST_F(UnifiedMediaControlsControllerTest, MetadataUpdate) { media_session::MediaMetadata metadata; metadata.title = base::ASCIIToUTF16("title"); @@ -310,6 +340,76 @@ EXPECT_FALSE(delegate()->IsControlsVisible()); } +TEST_F(UnifiedMediaControlsControllerTest, FreezeControlsWhenUpdateSession) { + auto request_id = base::UnguessableToken::Create(); + controller()->MediaSessionChanged(request_id); + EnableAction(MediaSessionAction::kPlay); + EnableAction(MediaSessionAction::kPause); + SimulateMediaPlaybackStateChanged( + media_session::mojom::MediaPlaybackState::kPlaying); + + // Initial state of media controls. + EXPECT_TRUE(GetActionButton(MediaSessionAction::kPause)->GetVisible()); + EXPECT_FALSE( + GetActionButton(MediaSessionAction::kPreviousTrack)->GetVisible()); + EXPECT_EQ(title_label()->GetText(), base::ASCIIToUTF16("")); + EXPECT_EQ(artist_label()->GetText(), base::ASCIIToUTF16("")); + EXPECT_FALSE(artwork_view()->GetVisible()); + + controller()->MediaSessionChanged(base::nullopt); + + // Test that metadata update is ignored when we waiting for new session. + media_session::MediaMetadata metadata; + metadata.title = base::ASCIIToUTF16("title"); + metadata.artist = base::ASCIIToUTF16("artist"); + controller()->MediaSessionMetadataChanged(metadata); + + EXPECT_EQ(title_label()->GetText(), base::ASCIIToUTF16("")); + EXPECT_EQ(artist_label()->GetText(), base::ASCIIToUTF16("")); + + // Test that media seeesion info update is ignored when we waiting for new + // session. + SimulateMediaPlaybackStateChanged( + media_session::mojom::MediaPlaybackState::kPaused); + EXPECT_TRUE(GetActionButton(MediaSessionAction::kPause)->GetVisible()); + + // Test that artwork update is ignored when we waiting for new session. + SkBitmap artwork; + artwork.allocN32Pixels(40, 40); + controller()->MediaControllerImageChanged( + media_session::mojom::MediaSessionImageType::kArtwork, artwork); + EXPECT_FALSE(artwork_view()->GetVisible()); + + // Test that enabled action update is ignored when we waiting for new session. + EnableAction(MediaSessionAction::kPreviousTrack); + EXPECT_FALSE( + GetActionButton(MediaSessionAction::kPreviousTrack)->GetVisible()); + + // Resume the session, now we should start updating controls. + controller()->MediaSessionChanged(request_id); + + // Test that metadata is updated. + controller()->MediaSessionMetadataChanged(metadata); + EXPECT_EQ(metadata.title, title_label()->GetText()); + EXPECT_EQ(metadata.artist, artist_label()->GetText()); + + // Test that media session info is updated. + SimulateMediaPlaybackStateChanged( + media_session::mojom::MediaPlaybackState::kPaused); + EXPECT_EQ(GetActionButton(MediaSessionAction::kPause), nullptr); + EXPECT_NE(GetActionButton(MediaSessionAction::kPlay), nullptr); + + // Test that artwork is updated. + controller()->MediaControllerImageChanged( + media_session::mojom::MediaSessionImageType::kArtwork, artwork); + EXPECT_TRUE(artwork_view()->GetVisible()); + + // Test that enabled actions are updated. + EnableAction(MediaSessionAction::kPreviousTrack); + EXPECT_TRUE( + GetActionButton(MediaSessionAction::kPreviousTrack)->GetVisible()); +} + TEST_F(UnifiedMediaControlsControllerTest, NotifyDelegateWhenMediaControlsViewClicked) { CreateWidget();
diff --git a/ash/system/media/unified_media_controls_detailed_view.cc b/ash/system/media/unified_media_controls_detailed_view.cc index 7bb16cce..d9b9a1e 100644 --- a/ash/system/media/unified_media_controls_detailed_view.cc +++ b/ash/system/media/unified_media_controls_detailed_view.cc
@@ -25,10 +25,6 @@ } void UnifiedMediaControlsDetailedView::CreateExtraTitleRowButtons() { - // DetailedView should only be visible when global media controls - // is NOT pinned to shelf. - DCHECK(!MediaTray::IsPinnedToShelf()); - tri_view()->SetContainerVisible(TriView::Container::END, true); tri_view()->AddView(TriView::Container::END, new MediaTray::PinButton()); }
diff --git a/ash/system/media/unified_media_controls_view.cc b/ash/system/media/unified_media_controls_view.cc index 75b4e7b..5173fe1 100644 --- a/ash/system/media/unified_media_controls_view.cc +++ b/ash/system/media/unified_media_controls_view.cc
@@ -105,12 +105,6 @@ GetVectorIconForMediaAction(action), kMediaButtonIconSize, AshColorProvider::Get()->GetContentLayerColor( AshColorProvider::ContentLayerType::kIconColorPrimary))); - - SetImage(views::Button::STATE_DISABLED, - CreateVectorIcon( - GetVectorIconForMediaAction(action), kMediaButtonIconSize, - AshColorProvider::Get()->GetContentLayerColor( - AshColorProvider::ContentLayerType::kIconColorSecondary))); } UnifiedMediaControlsView::UnifiedMediaControlsView( @@ -228,12 +222,18 @@ void UnifiedMediaControlsView::UpdateActionButtonAvailability( const base::flat_set<MediaSessionAction>& enabled_actions) { + bool should_invalidate = false; for (views::View* child : button_row_->children()) { views::Button* button = static_cast<views::Button*>(child); - button->SetEnabled( - base::Contains(enabled_actions, - media_message_center::GetActionFromButtonTag(*button))); + bool should_show = base::Contains( + enabled_actions, media_message_center::GetActionFromButtonTag(*button)); + + should_invalidate |= should_show != button->GetVisible(); + button->SetVisible(should_show); } + + if (should_invalidate) + button_row_->InvalidateLayout(); } SkPath UnifiedMediaControlsView::GetArtworkClipPath() {
diff --git a/ash/system/phonehub/connection_error_view.h b/ash/system/phonehub/connection_error_view.h index e01f14f..dfad61f 100644 --- a/ash/system/phonehub/connection_error_view.h +++ b/ash/system/phonehub/connection_error_view.h
@@ -12,12 +12,6 @@ class PhoneHubInterstitialView; -// Defines possible connection error states of the Phone Hub feature. -enum class ErrorStatus { - kDisconnected, // The connection to the phone has been interrupted. - kReconnecting, // Attempts to resume the connection to the phone. -}; - // An interstitial view represeting that the Phone Hub feature is not available // due to connection issues. class ASH_EXPORT ConnectionErrorView : public views::View, @@ -25,6 +19,12 @@ public: METADATA_HEADER(ConnectionErrorView); + // Defines possible connection error states of the Phone Hub feature. + enum class ErrorStatus { + kDisconnected, // The connection to the phone has been interrupted. + kReconnecting, // Attempts to resume the connection to the phone. + }; + explicit ConnectionErrorView(ErrorStatus error); ConnectionErrorView(const ConnectionErrorView&) = delete; ConnectionErrorView& operator=(const ConnectionErrorView&) = delete;
diff --git a/ash/system/phonehub/phone_connected_view.cc b/ash/system/phonehub/phone_connected_view.cc new file mode 100644 index 0000000..04ee29b --- /dev/null +++ b/ash/system/phonehub/phone_connected_view.cc
@@ -0,0 +1,79 @@ +// Copyright 2020 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 "ash/system/phonehub/phone_connected_view.h" + +#include <memory> + +#include "ash/style/ash_color_provider.h" +#include "ash/system/phonehub/notification_opt_in_view.h" +#include "ash/system/phonehub/phone_status_view.h" +#include "ash/system/phonehub/quick_actions_view.h" +#include "ash/system/phonehub/task_continuation_view.h" +#include "ash/system/tray/tray_constants.h" +#include "chromeos/components/phonehub/notification_access_manager.h" +#include "chromeos/components/phonehub/phone_hub_manager.h" +#include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/geometry/insets.h" +#include "ui/gfx/paint_vector_icon.h" +#include "ui/views/controls/image_view.h" +#include "ui/views/controls/label.h" +#include "ui/views/controls/separator.h" +#include "ui/views/layout/box_layout.h" + +namespace ash { + +namespace { +constexpr int kPaddingBetweenTitleAndSeparator = 3; +} // namespace + +PhoneConnectedView::PhoneConnectedView( + TrayBubbleView* bubble_view, + chromeos::phonehub::PhoneHubManager* phone_hub_manager) { + auto setup_layered_view = [](views::View* view) { + view->SetPaintToLayer(); + view->layer()->SetFillsBoundsOpaquely(false); + }; + + auto* layout = SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::Orientation::kVertical, gfx::Insets(0, 0, 0, 0))); + layout->SetDefaultFlex(1); + + AddSeparator(); + + // TODO(meilinw): handle the case when the user has dismissed this opt in + // view once, we shouldn't show it again. + if (!phone_hub_manager->GetNotificationAccessManager() + ->HasAccessBeenGranted()) { + AddChildView(std::make_unique<NotificationOptInView>(bubble_view)); + } + + setup_layered_view(AddChildView(std::make_unique<QuickActionsView>())); + + AddSeparator(); + + auto* phone_model = phone_hub_manager->GetPhoneModel(); + if (phone_model) { + setup_layered_view( + AddChildView(std::make_unique<TaskContinuationView>(phone_model))); + } +} + +PhoneConnectedView::~PhoneConnectedView() = default; + +const char* PhoneConnectedView::GetClassName() const { + return "PhoneConnectedView"; +} + +void PhoneConnectedView::AddSeparator() { + auto* separator = AddChildView(std::make_unique<views::Separator>()); + separator->SetPaintToLayer(); + separator->layer()->SetFillsBoundsOpaquely(false); + separator->SetColor(AshColorProvider::Get()->GetContentLayerColor( + AshColorProvider::ContentLayerType::kSeparatorColor)); + separator->SetBorder(views::CreateEmptyBorder(gfx::Insets( + kPaddingBetweenTitleAndSeparator, 0, kMenuSeparatorVerticalPadding, 0))); +} + +} // namespace ash
diff --git a/ash/system/phonehub/phone_connected_view.h b/ash/system/phonehub/phone_connected_view.h new file mode 100644 index 0000000..0fdcc31 --- /dev/null +++ b/ash/system/phonehub/phone_connected_view.h
@@ -0,0 +1,38 @@ +// Copyright 2020 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 ASH_SYSTEM_PHONEHUB_PHONE_CONNECTED_VIEW_H_ +#define ASH_SYSTEM_PHONEHUB_PHONE_CONNECTED_VIEW_H_ + +#include "ash/ash_export.h" +#include "ui/views/view.h" + +namespace chromeos { +namespace phonehub { +class PhoneHubManager; +} // namespace phonehub +} // namespace chromeos + +namespace ash { + +class TrayBubbleView; + +// A view of the Phone Hub panel, displaying phone status and utility actions +// such as phone status, task continuation, etc. +class PhoneConnectedView : public views::View { + public: + PhoneConnectedView(TrayBubbleView* bubble_view, + chromeos::phonehub::PhoneHubManager* phone_hub_manager); + ~PhoneConnectedView() override; + + // views::View: + const char* GetClassName() const override; + + private: + void AddSeparator(); +}; + +} // namespace ash + +#endif // ASH_SYSTEM_PHONEHUB_PHONE_CONNECTED_VIEW_H_
diff --git a/ash/system/phonehub/phone_hub_tray.cc b/ash/system/phonehub/phone_hub_tray.cc index 5dc1d139..1e01e69 100644 --- a/ash/system/phonehub/phone_hub_tray.cc +++ b/ash/system/phonehub/phone_hub_tray.cc
@@ -4,15 +4,12 @@ #include "ash/system/phonehub/phone_hub_tray.h" -#include <memory> - #include "ash/accessibility/accessibility_controller_impl.h" #include "ash/resources/vector_icons/vector_icons.h" #include "ash/shelf/shelf.h" #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" #include "ash/style/ash_color_provider.h" -#include "ash/system/phonehub/notification_opt_in_view.h" #include "ash/system/phonehub/phone_status_view.h" #include "ash/system/phonehub/quick_actions_view.h" #include "ash/system/phonehub/task_continuation_view.h" @@ -24,7 +21,6 @@ #include "ash/system/tray/tray_popup_utils.h" #include "ash/system/tray/tray_utils.h" #include "base/bind.h" -#include "chromeos/components/phonehub/notification_access_manager.h" #include "chromeos/components/phonehub/phone_hub_manager.h" #include "chromeos/components/phonehub/phone_model.h" #include "chromeos/constants/chromeos_features.h" @@ -33,8 +29,6 @@ #include "ui/gfx/geometry/insets.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/views/controls/image_view.h" -#include "ui/views/controls/label.h" -#include "ui/views/controls/separator.h" namespace ash { @@ -46,67 +40,13 @@ constexpr gfx::Insets kBubblePadding(4, 16); constexpr int kBubbleWidth = 400; -constexpr int kPaddingBetweenTitleAndSeparator = 3; - -// A content view of the Phone Hub panel, displaying utility actions -// such as quick actions, task continuation, etc. -class PhoneHubView : public views ::View { - public: - explicit PhoneHubView(TrayBubbleView* bubble_view, - chromeos::phonehub::PhoneHubManager* phone_hub_manager) - : bubble_view_(bubble_view) { - auto setup_layered_view = [](views::View* view) { - view->SetPaintToLayer(); - view->layer()->SetFillsBoundsOpaquely(false); - }; - - AddSeparator(); - - // TODO(meilinw): handle the case when the user has dismissed this opt in - // view once, we shouldn't show it again. - if (!phone_hub_manager->GetNotificationAccessManager() - ->HasAccessBeenGranted()) { - bubble_view_->AddChildView( - std::make_unique<NotificationOptInView>(bubble_view_)); - } - - setup_layered_view(bubble_view_->AddChildView( - std::make_unique<QuickActionsView>(phone_hub_manager))); - - AddSeparator(); - - chromeos::phonehub::PhoneModel* phone_model = - phone_hub_manager->GetPhoneModel(); - - if (phone_model) { - setup_layered_view(bubble_view->AddChildView( - std::make_unique<TaskContinuationView>(phone_model))); - } - } - ~PhoneHubView() override = default; - - // views::View: - const char* GetClassName() const override { return "PhoneHubView"; } - - private: - void AddSeparator() { - auto* separator = - bubble_view_->AddChildView(std::make_unique<views::Separator>()); - separator->SetPaintToLayer(); - separator->layer()->SetFillsBoundsOpaquely(false); - separator->SetColor(AshColorProvider::Get()->GetContentLayerColor( - AshColorProvider::ContentLayerType::kSeparatorColor)); - separator->SetBorder(views::CreateEmptyBorder( - gfx::Insets(kPaddingBetweenTitleAndSeparator, 0, - kMenuSeparatorVerticalPadding, 0))); - } - - TrayBubbleView* bubble_view_ = nullptr; -}; } // namespace -PhoneHubTray::PhoneHubTray(Shelf* shelf) : TrayBackgroundView(shelf) { +PhoneHubTray::PhoneHubTray(Shelf* shelf) + : TrayBackgroundView(shelf), ui_controller_(new PhoneHubUiController()) { + observed_phone_hub_ui_controller_.Add(ui_controller_.get()); + // TODO(tengs): Update icon to spec. auto icon = std::make_unique<views::ImageView>(); icon->SetTooltipText( @@ -123,21 +63,11 @@ PhoneHubTray::~PhoneHubTray() { if (bubble_) bubble_->bubble_view()->ResetDelegate(); - CleanUpPhoneHubManager(); } void PhoneHubTray::SetPhoneHubManager( chromeos::phonehub::PhoneHubManager* phone_hub_manager) { - if (phone_hub_manager == phone_hub_manager_) - return; - - CleanUpPhoneHubManager(); - - phone_hub_manager_ = phone_hub_manager; - if (phone_hub_manager_) - phone_hub_manager_->GetFeatureStatusProvider()->AddObserver(this); - - OnFeatureStatusChanged(); + ui_controller_->SetPhoneHubManager(phone_hub_manager); } void PhoneHubTray::ClickedOutsideBubble() { @@ -170,6 +100,27 @@ HideBubbleWithView(bubble_view); } +void PhoneHubTray::OnPhoneHubUiStateChanged() { + UpdateVisibility(); + + if (!bubble_) + return; + TrayBubbleView* bubble_view = bubble_->bubble_view(); + + DCHECK(ui_controller_.get()); + std::unique_ptr<views::View> content_view = + ui_controller_->CreateContentView(bubble_view); + if (!content_view.get()) { + CloseBubble(); + return; + } + + if (content_view_) + bubble_view->RemoveChildView(content_view_); + content_view_ = content_view.get(); + bubble_view->AddChildView(std::move(content_view)); +} + void PhoneHubTray::AnchorUpdated() { if (bubble_) bubble_->bubble_view()->UpdateBubble(); @@ -194,8 +145,6 @@ if (bubble_) return; - DCHECK(phone_hub_manager_); - TrayBubbleView::InitParams init_params; init_params.delegate = this; init_params.parent_window = GetBubbleWindowContainer(); @@ -215,23 +164,25 @@ // We will always have this phone status view on top of the bubble view // to display any available phone status and the settings icon. - chromeos::phonehub::PhoneModel* phone_model = - phone_hub_manager_->GetPhoneModel(); - if (phone_model) { - auto* phone_status = bubble_view->AddChildView( - std::make_unique<PhoneStatusView>(phone_model)); + std::unique_ptr<views::View> phone_status = + ui_controller_->CreateStatusHeaderView(); + if (phone_status) { phone_status->SetPaintToLayer(); phone_status->layer()->SetFillsBoundsOpaquely(false); + bubble_view->AddChildView(std::move(phone_status)); } // Other contents, i.e. the connected view and the interstitial views, // will be positioned underneath the phone status view and updated based // on the current mode. - bubble_view->AddChildView( - std::make_unique<PhoneHubView>(bubble_view, phone_hub_manager_)); + auto content_view = ui_controller_->CreateContentView(bubble_view); + content_view_ = content_view.get(); + if (content_view_) + bubble_view->AddChildView(std::move(content_view)); bubble_ = std::make_unique<TrayBubbleWrapper>(this, bubble_view, false /* is_persistent */); + SetIsActive(true); } @@ -244,43 +195,16 @@ } void PhoneHubTray::CloseBubble() { + content_view_ = nullptr; bubble_.reset(); SetIsActive(false); shelf()->UpdateAutoHideState(); } -void PhoneHubTray::OnFeatureStatusChanged() { - UpdateVisibility(); -} - void PhoneHubTray::UpdateVisibility() { - if (!phone_hub_manager_) { - SetVisiblePreferred(false); - return; - } - - auto feature_status = - phone_hub_manager_->GetFeatureStatusProvider()->GetStatus(); - bool is_visible; - switch (feature_status) { - case chromeos::phonehub::FeatureStatus::kNotEligibleForFeature: - FALLTHROUGH; - case chromeos::phonehub::FeatureStatus::kDisabled: - is_visible = false; - break; - default: - is_visible = true; - break; - } - - SetVisiblePreferred(is_visible); -} - -void PhoneHubTray::CleanUpPhoneHubManager() { - if (!phone_hub_manager_) - return; - - phone_hub_manager_->GetFeatureStatusProvider()->RemoveObserver(this); + DCHECK(ui_controller_.get()); + auto ui_state = ui_controller_->ui_state(); + SetVisiblePreferred(ui_state != PhoneHubUiController::UiState::kHidden); } } // namespace ash
diff --git a/ash/system/phonehub/phone_hub_tray.h b/ash/system/phonehub/phone_hub_tray.h index 666a000..04a2cc9 100644 --- a/ash/system/phonehub/phone_hub_tray.h +++ b/ash/system/phonehub/phone_hub_tray.h
@@ -6,8 +6,9 @@ #define ASH_SYSTEM_PHONEHUB_PHONE_HUB_TRAY_H_ #include "ash/ash_export.h" +#include "ash/system/phonehub/phone_hub_ui_controller.h" #include "ash/system/tray/tray_background_view.h" -#include "chromeos/components/phonehub/feature_status_provider.h" +#include "base/scoped_observer.h" namespace chromeos { namespace phonehub { @@ -25,9 +26,8 @@ // This class represents the Phone Hub tray button in the status area and // controls the bubble that is shown when the tray button is clicked. -class ASH_EXPORT PhoneHubTray - : public TrayBackgroundView, - public chromeos::phonehub::FeatureStatusProvider::Observer { +class ASH_EXPORT PhoneHubTray : public TrayBackgroundView, + public PhoneHubUiController::Observer { public: explicit PhoneHubTray(Shelf* shelf); PhoneHubTray(const PhoneHubTray&) = delete; @@ -51,29 +51,37 @@ TrayBubbleView* GetBubbleView() override; const char* GetClassName() const override; + views::View* content_view_for_testing() { return content_view_; } + private: // TrayBubbleView::Delegate: base::string16 GetAccessibleNameForBubble() override; bool ShouldEnableExtraKeyboardAccessibility() override; void HideBubble(const TrayBubbleView* bubble_view) override; - // chromeos::phonehub::FeatureStatusProvider::Observer: - void OnFeatureStatusChanged() override; + // PhoneHubUiController::Observer: + void OnPhoneHubUiStateChanged() override; // Updates the visibility of the tray in the shelf based on the feature is // enabled. void UpdateVisibility(); - // Cleans up |phone_hub_manager_| by removing all observers. - void CleanUpPhoneHubManager(); - // Icon of the tray. Unowned. views::ImageView* icon_; - // The PhoneHubManager that provides data for the UI. - chromeos::phonehub::PhoneHubManager* phone_hub_manager_ = nullptr; + // Controls the main content view displayed in the bubble based on the current + // PhoneHub state. + std::unique_ptr<PhoneHubUiController> ui_controller_; + // The bubble that appears after clicking the tray button. std::unique_ptr<TrayBubbleWrapper> bubble_; + + // The main content view of the bubble, which changes depending on the state. + // Unowned. + views::View* content_view_ = nullptr; + + ScopedObserver<PhoneHubUiController, PhoneHubUiController::Observer> + observed_phone_hub_ui_controller_{this}; }; } // namespace ash
diff --git a/ash/system/phonehub/phone_hub_tray_unittest.cc b/ash/system/phonehub/phone_hub_tray_unittest.cc index 2ad695cd..6ae7939 100644 --- a/ash/system/phonehub/phone_hub_tray_unittest.cc +++ b/ash/system/phonehub/phone_hub_tray_unittest.cc
@@ -15,6 +15,7 @@ #include "chromeos/components/phonehub/fake_phone_hub_manager.h" #include "chromeos/constants/chromeos_features.h" #include "testing/gmock/include/gmock/gmock.h" +#include "ui/events/event.h" namespace ash { @@ -86,26 +87,26 @@ protected: PhoneHubTray* phone_hub_tray_ = nullptr; chromeos::phonehub::FakePhoneHubManager phone_hub_manager_; - MockNewWindowDelegate new_window_delegate_; base::test::ScopedFeatureList feature_list_; + MockNewWindowDelegate new_window_delegate_; }; TEST_F(PhoneHubTrayTest, SetPhoneHubManager) { // Set a new manager. chromeos::phonehub::FakePhoneHubManager new_manager; new_manager.fake_feature_status_provider()->SetStatus( - chromeos::phonehub::FeatureStatus::kEligiblePhoneButNotSetUp); + chromeos::phonehub::FeatureStatus::kEnabledAndConnected); phone_hub_tray_->SetPhoneHubManager(&new_manager); EXPECT_TRUE(phone_hub_tray_->GetVisible()); // Changing the old manager should have no effect. GetFeatureStatusProvider()->SetStatus( - chromeos::phonehub::FeatureStatus::kDisabled); + chromeos::phonehub::FeatureStatus::kNotEligibleForFeature); EXPECT_TRUE(phone_hub_tray_->GetVisible()); // Only the new manager should work. new_manager.fake_feature_status_provider()->SetStatus( - chromeos::phonehub::FeatureStatus::kDisabled); + chromeos::phonehub::FeatureStatus::kNotEligibleForFeature); EXPECT_FALSE(phone_hub_tray_->GetVisible()); // Set no manager. @@ -166,4 +167,33 @@ ClickOnAndWait(notification_opt_in_view()->set_up_button_for_testing()); } +TEST_F(PhoneHubTrayTest, HideTrayItemOnUiStateChange) { + ClickTrayButton(); + EXPECT_TRUE(phone_hub_tray_->is_active()); + + GetFeatureStatusProvider()->SetStatus( + chromeos::phonehub::FeatureStatus::kNotEligibleForFeature); + + EXPECT_FALSE(phone_hub_tray_->is_active()); + EXPECT_FALSE(phone_hub_tray_->GetVisible()); +} + +TEST_F(PhoneHubTrayTest, TransitionContentView) { + ClickTrayButton(); + EXPECT_TRUE(phone_hub_tray_->is_active()); + + auto* content_view = phone_hub_tray_->content_view_for_testing(); + EXPECT_TRUE(content_view); + // TODO(tengs) Test the actual view id. + EXPECT_EQ(0, content_view->GetID()); + + GetFeatureStatusProvider()->SetStatus( + chromeos::phonehub::FeatureStatus::kEnabledButDisconnected); + + content_view = phone_hub_tray_->content_view_for_testing(); + EXPECT_TRUE(content_view); + // TODO(tengs) Test the actual view id. + EXPECT_EQ(0, content_view->GetID()); +} + } // namespace ash
diff --git a/ash/system/phonehub/phone_hub_ui_controller.cc b/ash/system/phonehub/phone_hub_ui_controller.cc new file mode 100644 index 0000000..f88c86b --- /dev/null +++ b/ash/system/phonehub/phone_hub_ui_controller.cc
@@ -0,0 +1,141 @@ +// Copyright 2020 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 "ash/system/phonehub/phone_hub_ui_controller.h" + +#include "ash/system/phonehub/bluetooth_disabled_view.h" +#include "ash/system/phonehub/connection_error_view.h" +#include "ash/system/phonehub/initial_connecting_view.h" +#include "ash/system/phonehub/onboarding_view.h" +#include "ash/system/phonehub/phone_connected_view.h" +#include "ash/system/phonehub/phone_status_view.h" +#include "base/logging.h" +#include "chromeos/components/phonehub/phone_hub_manager.h" + +using FeatureStatus = chromeos::phonehub::FeatureStatus; + +namespace ash { + +PhoneHubUiController::PhoneHubUiController() = default; + +PhoneHubUiController::~PhoneHubUiController() { + CleanUpPhoneHubManager(); +} + +void PhoneHubUiController::SetPhoneHubManager( + chromeos::phonehub::PhoneHubManager* phone_hub_manager) { + if (phone_hub_manager == phone_hub_manager_) + return; + + CleanUpPhoneHubManager(); + + phone_hub_manager_ = phone_hub_manager; + if (phone_hub_manager_) { + phone_hub_manager_->GetFeatureStatusProvider()->AddObserver(this); + phone_hub_manager_->GetOnboardingUiTracker()->AddObserver(this); + } + + UpdateUiState(); +} + +std::unique_ptr<views::View> PhoneHubUiController::CreateStatusHeaderView() { + if (!phone_hub_manager_) + return nullptr; + return std::make_unique<PhoneStatusView>(phone_hub_manager_->GetPhoneModel()); +} + +std::unique_ptr<views::View> PhoneHubUiController::CreateContentView( + TrayBubbleView* bubble_view) { + switch (ui_state_) { + case UiState::kHidden: + return nullptr; + case UiState::kOnboardingWithoutPhone: + // TODO(tengs): distinguish this onboarding with phone state. + FALLTHROUGH; + case UiState::kOnboardingWithPhone: + return std::make_unique<OnboardingView>(); + case UiState::kBluetoothDisabled: + return std::make_unique<BluetoothDisabledView>(); + case UiState::kInitialConnecting: + return std::make_unique<InitialConnectingView>(); + case UiState::kPhoneConnecting: + return std::make_unique<ConnectionErrorView>( + ConnectionErrorView::ErrorStatus::kReconnecting); + case UiState::kConnectionError: + return std::make_unique<ConnectionErrorView>( + ConnectionErrorView::ErrorStatus::kDisconnected); + case UiState::kPhoneConnected: + return std::make_unique<PhoneConnectedView>(bubble_view, + phone_hub_manager_); + } +} + +void PhoneHubUiController::AddObserver(Observer* observer) { + observer_list_.AddObserver(observer); +} + +void PhoneHubUiController::RemoveObserver(Observer* observer) { + observer_list_.RemoveObserver(observer); +} + +void PhoneHubUiController::OnFeatureStatusChanged() { + UpdateUiState(); +} + +void PhoneHubUiController::OnShouldShowOnboardingUiChanged() { + UpdateUiState(); +} + +void PhoneHubUiController::UpdateUiState() { + auto new_state = GetUiStateFromPhoneHubManager(); + if (new_state == ui_state_) + return; + + ui_state_ = new_state; + for (auto& observer : observer_list_) + observer.OnPhoneHubUiStateChanged(); +} + +PhoneHubUiController::UiState +PhoneHubUiController::GetUiStateFromPhoneHubManager() { + if (!phone_hub_manager_) + return UiState::kHidden; + + auto feature_status = + phone_hub_manager_->GetFeatureStatusProvider()->GetStatus(); + + auto* tracker = phone_hub_manager_->GetOnboardingUiTracker(); + bool should_show_onboarding_ui = tracker->ShouldShowOnboardingUi(); + + switch (feature_status) { + case FeatureStatus::kNotEligibleForFeature: + return UiState::kHidden; + case FeatureStatus::kEligiblePhoneButNotSetUp: + return should_show_onboarding_ui ? UiState::kOnboardingWithPhone + : UiState::kHidden; + case FeatureStatus::kDisabled: + return should_show_onboarding_ui ? UiState::kOnboardingWithoutPhone + : UiState::kHidden; + case FeatureStatus::kPhoneSelectedAndPendingSetup: + return UiState::kInitialConnecting; + case FeatureStatus::kUnavailableBluetoothOff: + return UiState::kBluetoothDisabled; + case FeatureStatus::kEnabledButDisconnected: + return UiState::kConnectionError; + case FeatureStatus::kEnabledAndConnecting: + return UiState::kPhoneConnecting; + case FeatureStatus::kEnabledAndConnected: + return UiState::kPhoneConnected; + } +} + +void PhoneHubUiController::CleanUpPhoneHubManager() { + if (!phone_hub_manager_) + return; + + phone_hub_manager_->GetFeatureStatusProvider()->RemoveObserver(this); + phone_hub_manager_->GetOnboardingUiTracker()->RemoveObserver(this); +} + +} // namespace ash
diff --git a/ash/system/phonehub/phone_hub_ui_controller.h b/ash/system/phonehub/phone_hub_ui_controller.h new file mode 100644 index 0000000..2fd7540 --- /dev/null +++ b/ash/system/phonehub/phone_hub_ui_controller.h
@@ -0,0 +1,104 @@ +// Copyright 2020 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 ASH_SYSTEM_PHONEHUB_PHONE_HUB_UI_CONTROLLER_H_ +#define ASH_SYSTEM_PHONEHUB_PHONE_HUB_UI_CONTROLLER_H_ + +#include "ash/ash_export.h" +#include "base/observer_list.h" +#include "base/observer_list_types.h" +#include "chromeos/components/phonehub/feature_status_provider.h" +#include "chromeos/components/phonehub/onboarding_ui_tracker.h" + +namespace chromeos { +namespace phonehub { +class PhoneHubManager; +} // namespace phonehub +} // namespace chromeos + +namespace views { +class View; +} // namespace views + +namespace ash { + +class TrayBubbleView; + +// This controller translates the state received from PhoneHubManager into the +// corresponding main content view to be displayed in the tray bubble. +class ASH_EXPORT PhoneHubUiController + : public chromeos::phonehub::FeatureStatusProvider::Observer, + public chromeos::phonehub::OnboardingUiTracker::Observer { + public: + class Observer : public base::CheckedObserver { + public: + ~Observer() override = default; + + virtual void OnPhoneHubUiStateChanged() = 0; + }; + + // All the possible states that the main content view can be in. Each state + // has a corresponding view class. + enum class UiState { + kHidden = 0, + kOnboardingWithoutPhone, + kOnboardingWithPhone, + kBluetoothDisabled, + kInitialConnecting, + kPhoneConnecting, + kConnectionError, + kPhoneConnected, + }; + + PhoneHubUiController(); + PhoneHubUiController(const PhoneHubUiController&) = delete; + ~PhoneHubUiController() override; + PhoneHubUiController& operator=(const PhoneHubUiController&) = delete; + + // Sets the PhoneHubManager that provides the data to drive the UI. + void SetPhoneHubManager( + chromeos::phonehub::PhoneHubManager* phone_hub_manager); + + // Creates the corresponding content view for the current UI state. + // |bubble_view| will be the parent the created content view. + std::unique_ptr<views::View> CreateContentView(TrayBubbleView* bubble_view); + + // Creates the header view displaying the phone status. + std::unique_ptr<views::View> CreateStatusHeaderView(); + + // Observer functions. + void AddObserver(Observer* observer); + void RemoveObserver(Observer* observer); + + UiState ui_state() const { return ui_state_; } + + private: + // chromeos::phonehub::FeatureStatusProvider::Observer: + void OnFeatureStatusChanged() override; + + // chromeos::phonehub::OnboardingUiTracker::Observer: + void OnShouldShowOnboardingUiChanged() override; + + // Updates the current UI state and notifies observers. + void UpdateUiState(); + + // Returns the UiState from the PhoneHubManager. + UiState GetUiStateFromPhoneHubManager(); + + // Cleans up |phone_hub_manager_| by removing all observers. + void CleanUpPhoneHubManager(); + + // The PhoneHubManager that provides data for the UI. + chromeos::phonehub::PhoneHubManager* phone_hub_manager_ = nullptr; + + // The current UI state. + UiState ui_state_ = UiState::kHidden; + + // Registered observers. + base::ObserverList<Observer> observer_list_; +}; + +} // namespace ash + +#endif // ASH_SYSTEM_PHONEHUB_PHONE_HUB_UI_CONTROLLER_H_
diff --git a/ash/system/phonehub/phone_hub_ui_controller_unittest.cc b/ash/system/phonehub/phone_hub_ui_controller_unittest.cc new file mode 100644 index 0000000..6f33e1e9 --- /dev/null +++ b/ash/system/phonehub/phone_hub_ui_controller_unittest.cc
@@ -0,0 +1,153 @@ +// Copyright 2020 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 "ash/system/phonehub/phone_hub_ui_controller.h" + +#include "ash/test/ash_test_base.h" +#include "chromeos/components/phonehub/fake_phone_hub_manager.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/views/view.h" + +using FeatureStatus = chromeos::phonehub::FeatureStatus; + +namespace ash { + +class PhoneHubUiControllerTest : public AshTestBase, + public PhoneHubUiController::Observer { + public: + PhoneHubUiControllerTest() = default; + + ~PhoneHubUiControllerTest() override { controller_.RemoveObserver(this); } + + // AshTestBase: + void SetUp() override { + AshTestBase::SetUp(); + + controller_.AddObserver(this); + + GetFeatureStatusProvider()->SetStatus(FeatureStatus::kEnabledAndConnected); + GetOnboardingUiTracker()->SetShouldShowOnboardingUi(false); + controller_.SetPhoneHubManager(&phone_hub_manager_); + + CHECK(ui_state_changed_); + ui_state_changed_ = false; + } + + chromeos::phonehub::FakeFeatureStatusProvider* GetFeatureStatusProvider() { + return phone_hub_manager_.fake_feature_status_provider(); + } + + chromeos::phonehub::FakeOnboardingUiTracker* GetOnboardingUiTracker() { + return phone_hub_manager_.fake_onboarding_ui_tracker(); + } + + protected: + // PhoneHubUiController::Observer: + void OnPhoneHubUiStateChanged() override { + CHECK(!ui_state_changed_); + ui_state_changed_ = true; + } + + PhoneHubUiController controller_; + chromeos::phonehub::FakePhoneHubManager phone_hub_manager_; + bool ui_state_changed_ = false; +}; + +TEST_F(PhoneHubUiControllerTest, NotEligibleForFeature) { + GetFeatureStatusProvider()->SetStatus(FeatureStatus::kNotEligibleForFeature); + EXPECT_EQ(PhoneHubUiController::UiState::kHidden, controller_.ui_state()); + EXPECT_TRUE(ui_state_changed_); + EXPECT_FALSE(controller_.CreateContentView(/*bubble_view=*/nullptr).get()); +} + +TEST_F(PhoneHubUiControllerTest, OnboardingNotEligible) { + GetFeatureStatusProvider()->SetStatus(FeatureStatus::kDisabled); + EXPECT_EQ(PhoneHubUiController::UiState::kHidden, controller_.ui_state()); + EXPECT_FALSE(controller_.CreateContentView(/*bubble_view=*/nullptr).get()); +} + +TEST_F(PhoneHubUiControllerTest, ShowOnboardingUi_WithoutPhone) { + GetFeatureStatusProvider()->SetStatus(FeatureStatus::kDisabled); + EXPECT_TRUE(ui_state_changed_); + ui_state_changed_ = false; + GetOnboardingUiTracker()->SetShouldShowOnboardingUi(true); + EXPECT_TRUE(ui_state_changed_); + + EXPECT_EQ(PhoneHubUiController::UiState::kOnboardingWithoutPhone, + controller_.ui_state()); + + auto content_view = controller_.CreateContentView(/*bubble_view=*/nullptr); + // TODO(tengs): Test the actual view id. + EXPECT_EQ(0, content_view->GetID()); +} + +TEST_F(PhoneHubUiControllerTest, ShowOnboardingUi_WithPhone) { + GetFeatureStatusProvider()->SetStatus( + FeatureStatus::kEligiblePhoneButNotSetUp); + EXPECT_TRUE(ui_state_changed_); + ui_state_changed_ = false; + GetOnboardingUiTracker()->SetShouldShowOnboardingUi(true); + EXPECT_TRUE(ui_state_changed_); + + EXPECT_EQ(PhoneHubUiController::UiState::kOnboardingWithPhone, + controller_.ui_state()); + + auto content_view = controller_.CreateContentView(/*bubble_view=*/nullptr); + // TODO(tengs): Test the actual view id. + EXPECT_EQ(0, content_view->GetID()); +} + +TEST_F(PhoneHubUiControllerTest, PhoneConnectingForOnboarding) { + GetFeatureStatusProvider()->SetStatus( + FeatureStatus::kPhoneSelectedAndPendingSetup); + EXPECT_EQ(PhoneHubUiController::UiState::kInitialConnecting, + controller_.ui_state()); + + auto content_view = controller_.CreateContentView(/*bubble_view=*/nullptr); + // TODO(tengs): Test the actual view id. + EXPECT_EQ(0, content_view->GetID()); +} + +TEST_F(PhoneHubUiControllerTest, BluetoothOff) { + GetFeatureStatusProvider()->SetStatus( + FeatureStatus::kUnavailableBluetoothOff); + EXPECT_EQ(PhoneHubUiController::UiState::kBluetoothDisabled, + controller_.ui_state()); + + auto content_view = controller_.CreateContentView(/*bubble_view=*/nullptr); + // TODO(tengs): Test the actual view id. + EXPECT_EQ(0, content_view->GetID()); +} + +TEST_F(PhoneHubUiControllerTest, PhoneDisconnected) { + GetFeatureStatusProvider()->SetStatus(FeatureStatus::kEnabledButDisconnected); + EXPECT_EQ(PhoneHubUiController::UiState::kConnectionError, + controller_.ui_state()); + + auto content_view = controller_.CreateContentView(/*bubble_view=*/nullptr); + // TODO(tengs): Test the actual view id. + EXPECT_EQ(0, content_view->GetID()); +} + +TEST_F(PhoneHubUiControllerTest, PhoneConnecting) { + GetFeatureStatusProvider()->SetStatus(FeatureStatus::kEnabledAndConnecting); + EXPECT_EQ(PhoneHubUiController::UiState::kPhoneConnecting, + controller_.ui_state()); + + auto content_view = controller_.CreateContentView(/*bubble_view=*/nullptr); + // TODO(tengs): Test the actual view id. + EXPECT_EQ(0, content_view->GetID()); +} + +TEST_F(PhoneHubUiControllerTest, PhoneConnected) { + GetFeatureStatusProvider()->SetStatus(FeatureStatus::kEnabledAndConnected); + EXPECT_EQ(PhoneHubUiController::UiState::kPhoneConnected, + controller_.ui_state()); + + auto content_view = controller_.CreateContentView(/*bubble_view=*/nullptr); + // TODO(tengs): Test the actual view id. + EXPECT_EQ(0, content_view->GetID()); +} + +} // namespace ash
diff --git a/ash/system/phonehub/quick_action_controller_base.h b/ash/system/phonehub/quick_action_controller_base.h deleted file mode 100644 index 8d39ec2a..0000000 --- a/ash/system/phonehub/quick_action_controller_base.h +++ /dev/null
@@ -1,30 +0,0 @@ -// Copyright 2020 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 ASH_SYSTEM_PHONEHUB_QUICK_ACTION_CONTROLLER_BASE_H_ -#define ASH_SYSTEM_PHONEHUB_QUICK_ACTION_CONTROLLER_BASE_H_ - -#include "ash/ash_export.h" -#include "ash/system/phonehub/quick_action_item.h" - -namespace ash { - -class QuickActionItem; - -// Base class for controllers of quick action item. -// To add a new quick action item, implement this class, and add to the list in -// QuickActionsView::InitQuickActionItems(). -class ASH_EXPORT QuickActionControllerBase : public QuickActionItem::Delegate { - public: - virtual ~QuickActionControllerBase() = default; - - // Create the view. Subclasses instantiate QuickActionItem. - // The view will be owned by views hierarchy. The view will be always deleted - // after the controller is destructed. - virtual QuickActionItem* CreateItem() = 0; -}; - -} // namespace ash - -#endif // ASH_SYSTEM_PHONEHUB_QUICK_ACTION_CONTROLLER_BASE_H_
diff --git a/ash/system/phonehub/quick_action_item.cc b/ash/system/phonehub/quick_action_item.cc deleted file mode 100644 index 34f2205..0000000 --- a/ash/system/phonehub/quick_action_item.cc +++ /dev/null
@@ -1,137 +0,0 @@ -// Copyright 2020 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 "ash/system/phonehub/quick_action_item.h" - -#include "ash/resources/vector_icons/vector_icons.h" -#include "ash/strings/grit/ash_strings.h" -#include "ash/style/ash_color_provider.h" -#include "ash/system/tray/tray_constants.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/views/controls/label.h" -#include "ui/views/layout/box_layout.h" - -namespace ash { - -namespace { - -constexpr int kQuickActionItemLabelSize = 14; - -void ConfigureLabel(views::Label* label, bool is_primary) { - label->SetAutoColorReadabilityEnabled(false); - label->SetSubpixelRenderingEnabled(false); - label->set_can_process_events_within_subtree(false); - - auto type = is_primary - ? AshColorProvider::ContentLayerType::kTextColorPrimary - : AshColorProvider::ContentLayerType::kTextColorSecondary; - label->SetEnabledColor(AshColorProvider::Get()->GetContentLayerColor(type)); - - gfx::Font default_font; - gfx::Font label_font = default_font.Derive( - kQuickActionItemLabelSize - default_font.GetFontSize(), gfx::Font::NORMAL, - gfx::Font::Weight::NORMAL); - gfx::FontList font_list(label_font); - label->SetFontList(font_list); -} - -} // namespace - -QuickActionItem::QuickActionItem(Delegate* delegate, - int label_id, - const gfx::VectorIcon& icon_on, - const gfx::VectorIcon& icon_off) - : delegate_(delegate), icon_on_(icon_on), icon_off_(icon_off) { - auto* layout = SetLayoutManager(std::make_unique<views::BoxLayout>( - views::BoxLayout::Orientation::kVertical, gfx::Insets(), - kUnifiedFeaturePodSpacing)); - layout->set_cross_axis_alignment( - views::BoxLayout::CrossAxisAlignment::kCenter); - - icon_button_ = AddChildView( - std::make_unique<FeaturePodIconButton>(this, true /* is_togglable */)); - - auto* label_view = AddChildView(std::make_unique<views::View>()); - label_view->SetLayoutManager(std::make_unique<views::BoxLayout>( - views::BoxLayout::Orientation::kVertical, gfx::Insets())); - - label_ = label_view->AddChildView( - std::make_unique<views::Label>(l10n_util::GetStringUTF16(label_id))); - ConfigureLabel(label_, true /* is_primary */); - - sub_label_ = label_view->AddChildView(std::make_unique<views::Label>()); - ConfigureLabel(sub_label_, false /* is_primary */); - - SetPaintToLayer(); - layer()->SetFillsBoundsOpaquely(false); -} - -QuickActionItem::QuickActionItem(Delegate* delegate, - int label_id, - const gfx::VectorIcon& icon) - : QuickActionItem(delegate, label_id, icon, icon) {} - -QuickActionItem::~QuickActionItem() = default; - -void QuickActionItem::SetSubLabel(const base::string16& sub_label) { - sub_label_->SetText(sub_label); -} - -void QuickActionItem::SetIconTooltip(const base::string16& text) { - icon_button_->SetTooltipText(text); -} - -void QuickActionItem::SetToggled(bool toggled) { - icon_button_->SetToggled(toggled); - icon_button_->SetVectorIcon(toggled ? icon_on_ : icon_off_); -} - -bool QuickActionItem::IsToggled() const { - return icon_button_->toggled(); -} - -const base::string16& QuickActionItem::GetItemLabel() const { - return label_->GetText(); -} - -void QuickActionItem::SetEnabled(bool enabled) { - View::SetEnabled(enabled); - icon_button_->SetEnabled(enabled); - - if (!enabled) { - label_->SetEnabledColor( - AshColorProvider::GetDisabledColor(label_->GetEnabledColor())); - sub_label_->SetEnabledColor( - AshColorProvider::GetDisabledColor(sub_label_->GetEnabledColor())); - - sub_label_->SetText(l10n_util::GetStringUTF16( - IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_AVAILABLE_STATE)); - icon_button_->SetTooltipText(l10n_util::GetStringFUTF16( - IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_AVAILABLE_STATE_TOOLTIP, - GetItemLabel())); - } else { - ConfigureLabel(label_, true /* is_primary */); - ConfigureLabel(sub_label_, false /* is_primary */); - } -} - -void QuickActionItem::ButtonPressed(views::Button* sender, - const ui::Event& event) { - delegate_->OnButtonPressed(IsToggled()); -} - -bool QuickActionItem::HasFocus() const { - return icon_button_->HasFocus() || label_->HasFocus() || - sub_label_->HasFocus(); -} - -void QuickActionItem::RequestFocus() { - icon_button_->RequestFocus(); -} - -const char* QuickActionItem::GetClassName() const { - return "QuickActionItem"; -} - -} // namespace ash
diff --git a/ash/system/phonehub/quick_action_item.h b/ash/system/phonehub/quick_action_item.h deleted file mode 100644 index fb69f0d9..0000000 --- a/ash/system/phonehub/quick_action_item.h +++ /dev/null
@@ -1,84 +0,0 @@ -// Copyright 2020 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 ASH_SYSTEM_PHONEHUB_QUICK_ACTION_ITEM_H_ -#define ASH_SYSTEM_PHONEHUB_QUICK_ACTION_ITEM_H_ - -#include "ash/ash_export.h" -#include "ash/system/unified/feature_pod_button.h" -#include "ui/views/controls/button/button.h" - -namespace views { -class Label; -} - -namespace ash { - -// A toggle button with labels used in the quick action view. -class QuickActionItem : public views::View, public views::ButtonListener { - public: - class Delegate { - public: - // Called when the button of the quick action item is clicked. - virtual void OnButtonPressed(bool is_now_enabled) = 0; - }; - - // |icon_on| and |icon_off| indicates the icons used in on/off state of the - // button. - QuickActionItem(Delegate* delegate, - int label_id, - const gfx::VectorIcon& icon_on, - const gfx::VectorIcon& icon_off); - - // If only one icon is supplied, it will be used in both cases. - QuickActionItem(Delegate* delegate, - int label_id, - const gfx::VectorIcon& icon); - - ~QuickActionItem() override; - QuickActionItem(QuickActionItem&) = delete; - QuickActionItem operator=(QuickActionItem&) = delete; - - // Set the text of sub-label shown below the label. - void SetSubLabel(const base::string16& sub_label); - - // Set the tooltip text of the icon button. - void SetIconTooltip(const base::string16& text); - - // Change the toggled state. If toggled, the background color of the circle - // will change. - void SetToggled(bool toggled); - bool IsToggled() const; - - // Get the title/label text of the item. - const base::string16& GetItemLabel() const; - - // Set the item to be enabled or disabled. When disabled, the button cannot be - // clicked and the labels are greyed out. - void SetEnabled(bool enabled); - - // views::ButtonListener: - void ButtonPressed(views::Button* sender, const ui::Event& event) override; - - // views::View: - bool HasFocus() const override; - void RequestFocus() override; - const char* GetClassName() const override; - - FeaturePodIconButton* icon_button() const { return icon_button_; } - - private: - Delegate* delegate_ = nullptr; - - // Owned by views hierarchy. - FeaturePodIconButton* icon_button_ = nullptr; - const gfx::VectorIcon& icon_on_; - const gfx::VectorIcon& icon_off_; - views::Label* label_ = nullptr; - views::Label* sub_label_ = nullptr; -}; - -} // namespace ash - -#endif // ASH_SYSTEM_PHONEHUB_QUICK_ACTION_VIEW_H_
diff --git a/ash/system/phonehub/quick_actions_view.cc b/ash/system/phonehub/quick_actions_view.cc index 486a3f04..e424832 100644 --- a/ash/system/phonehub/quick_actions_view.cc +++ b/ash/system/phonehub/quick_actions_view.cc
@@ -4,47 +4,161 @@ #include "ash/system/phonehub/quick_actions_view.h" +#include "ash/resources/vector_icons/vector_icons.h" +#include "ash/strings/grit/ash_strings.h" +#include "ash/style/ash_color_provider.h" #include "ash/system/phonehub/phone_hub_view_ids.h" -#include "ash/system/phonehub/quick_action_item.h" -#include "ash/system/phonehub/silence_phone_quick_action_controller.h" +#include "ash/system/tray/tray_constants.h" +#include "ash/system/unified/feature_pod_button.h" +#include "ui/base/l10n/l10n_util.h" #include "ui/views/layout/box_layout.h" namespace ash { namespace { -constexpr gfx::Insets kQuickActionsViewPadding(16, 4); constexpr int kQuickActionsItemSpacing = 36; +constexpr int kQuickActionsItemLabelSize = 14; +constexpr gfx::Insets kQuickActionsViewPadding(16, 4); + +void ConfigureLabel(views::Label* label, bool is_primary) { + label->SetAutoColorReadabilityEnabled(false); + label->SetSubpixelRenderingEnabled(false); + label->set_can_process_events_within_subtree(false); + + auto type = is_primary + ? AshColorProvider::ContentLayerType::kTextColorPrimary + : AshColorProvider::ContentLayerType::kTextColorSecondary; + label->SetEnabledColor(AshColorProvider::Get()->GetContentLayerColor(type)); + + gfx::Font default_font; + gfx::Font label_font = default_font.Derive( + kQuickActionsItemLabelSize - default_font.GetFontSize(), + gfx::Font::NORMAL, gfx::Font::Weight::NORMAL); + gfx::FontList font_list(label_font); + label->SetFontList(font_list); +} } // namespace -QuickActionsView::QuickActionsView( - chromeos::phonehub::PhoneHubManager* phone_hub_manager) - : phone_hub_manager_(phone_hub_manager) { +QuickActionsItem::QuickActionsItem(views::ButtonListener* listener, + const gfx::VectorIcon& vector_icon, + int label_id) + : icon_button_(new FeaturePodIconButton(listener, true /* is_togglable */)), + label_(new views::Label), + sub_label_(new views::Label) { SetID(PhoneHubViewID::kQuickActionsView); auto* layout = SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::Orientation::kVertical, gfx::Insets(), + kUnifiedFeaturePodSpacing)); + layout->set_cross_axis_alignment( + views::BoxLayout::CrossAxisAlignment::kCenter); + + icon_button_ = AddChildView(std::make_unique<FeaturePodIconButton>( + listener, true /* is_togglable */)); + icon_button_->SetVectorIcon(vector_icon); + + auto* label_view = AddChildView(std::make_unique<views::View>()); + label_view->SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::Orientation::kVertical, gfx::Insets())); + + label_ = label_view->AddChildView( + std::make_unique<views::Label>(l10n_util::GetStringUTF16(label_id))); + ConfigureLabel(label_, true /* is_primary */); + + sub_label_ = label_view->AddChildView(std::make_unique<views::Label>()); + ConfigureLabel(sub_label_, false /* is_primary */); + + SetPaintToLayer(); + layer()->SetFillsBoundsOpaquely(false); +} + +QuickActionsItem::~QuickActionsItem() = default; + +void QuickActionsItem::SetSubLabel(const base::string16& sub_label) { + sub_label_->SetText(sub_label); +} + +void QuickActionsItem::SetIconTooltip(const base::string16& text) { + icon_button_->SetTooltipText(text); +} + +void QuickActionsItem::SetToggled(bool toggled) { + icon_button_->SetToggled(toggled); +} + +const base::string16& QuickActionsItem::GetItemLabel() const { + return label_->GetText(); +} + +bool QuickActionsItem::HasFocus() const { + return icon_button_->HasFocus() || label_->HasFocus() || + sub_label_->HasFocus(); +} + +void QuickActionsItem::RequestFocus() { + icon_button_->RequestFocus(); +} + +const char* QuickActionsItem::GetClassName() const { + return "QuickActionsItem"; +} + +QuickActionsView::QuickActionsView() { + auto* layout = SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kHorizontal, kQuickActionsViewPadding, kQuickActionsItemSpacing)); layout->set_main_axis_alignment(views::BoxLayout::MainAxisAlignment::kCenter); layout->set_cross_axis_alignment( views::BoxLayout::CrossAxisAlignment::kCenter); - InitQuickActionItems(); + enable_hotspot_ = AddChildView(std::make_unique<QuickActionsItem>( + this, kSystemMenuPhoneIcon, IDS_ASH_PHONE_HUB_ENABLE_HOTSPOT_TITLE)); + silence_phone_ = AddChildView(std::make_unique<QuickActionsItem>( + this, kSystemMenuPhoneIcon, IDS_ASH_PHONE_HUB_SILENCE_PHONE_TITLE)); + locate_phone_ = AddChildView(std::make_unique<QuickActionsItem>( + this, kSystemMenuPhoneIcon, IDS_ASH_PHONE_HUB_LOCATE_PHONE_TITLE)); + + Update(); } QuickActionsView::~QuickActionsView() = default; -void QuickActionsView::InitQuickActionItems() { - silence_phone_ = AddItem(std::make_unique<SilencePhoneQuickActionController>( - phone_hub_manager_->GetDoNotDisturbController())); +void QuickActionsView::ButtonPressed(views::Button* sender, + const ui::Event& event) { + // TODO(leandre): implement quick actions button functionality. + if (sender == enable_hotspot_->icon_button()) { + UpdateItem(enable_hotspot_, !enable_hotspot_->IsToggled()); + } else if (sender == silence_phone_->icon_button()) { + UpdateItem(silence_phone_, !silence_phone_->IsToggled()); + } else if (sender == locate_phone_->icon_button()) { + UpdateItem(locate_phone_, !locate_phone_->IsToggled()); + } else { + NOTREACHED(); + } } -QuickActionItem* QuickActionsView::AddItem( - std::unique_ptr<QuickActionControllerBase> controller) { - auto* item = AddChildView(controller->CreateItem()); - quick_action_controllers_.push_back(std::move(controller)); - return item; +void QuickActionsView::Update() { + // TODO(leandre): Update items according to phone status. + UpdateItem(enable_hotspot_, false); + UpdateItem(silence_phone_, true); + UpdateItem(locate_phone_, false); +} + +void QuickActionsView::UpdateItem(QuickActionsItem* item, bool is_enabled) { + item->SetToggled(is_enabled); + item->SetSubLabel(l10n_util::GetStringUTF16( + is_enabled ? IDS_ASH_PHONE_HUB_QUICK_ACTIONS_ON_STATE + : IDS_ASH_PHONE_HUB_QUICK_ACTIONS_OFF_STATE)); + int state_text_id = + is_enabled ? IDS_ASH_PHONE_HUB_QUICK_ACTIONS_ENABLED_STATE_TOOLTIP + : IDS_ASH_PHONE_HUB_QUICK_ACTIONS_DISABLED_STATE_TOOLTIP; + base::string16 tooltip_state = + l10n_util::GetStringFUTF16(state_text_id, item->GetItemLabel()); + item->SetIconTooltip( + l10n_util::GetStringFUTF16(IDS_ASH_PHONE_HUB_QUICK_ACTIONS_TOGGLE_TOOLTIP, + item->GetItemLabel(), tooltip_state)); } } // namespace ash
diff --git a/ash/system/phonehub/quick_actions_view.h b/ash/system/phonehub/quick_actions_view.h index 8191b5b..9adbb421 100644 --- a/ash/system/phonehub/quick_actions_view.h +++ b/ash/system/phonehub/quick_actions_view.h
@@ -6,42 +6,70 @@ #define ASH_SYSTEM_PHONEHUB_QUICK_ACTIONS_VIEW_H_ #include "ash/ash_export.h" -#include "chromeos/components/phonehub/phone_hub_manager.h" -#include "ui/views/view.h" +#include "ash/system/unified/feature_pod_button.h" +#include "ui/views/controls/button/button.h" +#include "ui/views/controls/label.h" namespace ash { -class QuickActionControllerBase; -class QuickActionItem; +// A toggle button with labels used in the quick actions view. +class QuickActionsItem : public views::View { + public: + explicit QuickActionsItem(views::ButtonListener* listener, + const gfx::VectorIcon& vector_icon, + int label_id); + ~QuickActionsItem() override; + QuickActionsItem(QuickActionsItem&) = delete; + QuickActionsItem operator=(QuickActionsItem&) = delete; + + // Set the text of sub-label shown below the label. + void SetSubLabel(const base::string16& sub_label); + + // Set the tooltip text of the icon button. + void SetIconTooltip(const base::string16& text); + + // Change the toggled state. If toggled, the background color of the circle + // will change. + void SetToggled(bool toggled); + bool IsToggled() const { return icon_button_->toggled(); } + + // Get the title/label text of the item. + const base::string16& GetItemLabel() const; + + // views::View: + bool HasFocus() const override; + void RequestFocus() override; + const char* GetClassName() const override; + + FeaturePodIconButton* icon_button() const { return icon_button_; } + + private: + // Owned by views hierarchy. + FeaturePodIconButton* icon_button_ = nullptr; + views::Label* label_ = nullptr; + views::Label* sub_label_ = nullptr; +}; // A view in Phone Hub bubble that contains toggle button for quick actions such // as enable hotspot, silence phone and locate phone. -class ASH_EXPORT QuickActionsView : public views::View { +class ASH_EXPORT QuickActionsView : public views::View, + public views::ButtonListener { public: - explicit QuickActionsView( - chromeos::phonehub::PhoneHubManager* phone_hub_manager); + QuickActionsView(); ~QuickActionsView() override; QuickActionsView(QuickActionsView&) = delete; QuickActionsView operator=(QuickActionsView&) = delete; + // views::ButtonListener: + void ButtonPressed(views::Button* sender, const ui::Event& event) override; + private: - FRIEND_TEST_ALL_PREFIXES(QuickActionsViewTest, QuickActionsToggle); + void Update(); + void UpdateItem(QuickActionsItem* item, bool is_enabled); - // Add all the quick actions items to the view. - void InitQuickActionItems(); - - // Helper function to add an item to the view given its controller. - QuickActionItem* AddItem( - std::unique_ptr<QuickActionControllerBase> controller); - - // Controllers of quick actions items. Owned by this. - std::vector<std::unique_ptr<QuickActionControllerBase>> - quick_action_controllers_; - - chromeos::phonehub::PhoneHubManager* phone_hub_manager_ = nullptr; - - // QuickActionItem for unit testing. Owned by this view. - QuickActionItem* silence_phone_ = nullptr; + QuickActionsItem* enable_hotspot_ = nullptr; + QuickActionsItem* silence_phone_ = nullptr; + QuickActionsItem* locate_phone_ = nullptr; }; } // namespace ash
diff --git a/ash/system/phonehub/quick_actions_view_unittest.cc b/ash/system/phonehub/quick_actions_view_unittest.cc deleted file mode 100644 index a6c2474..0000000 --- a/ash/system/phonehub/quick_actions_view_unittest.cc +++ /dev/null
@@ -1,76 +0,0 @@ -// Copyright 2020 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 "ash/system/phonehub/quick_actions_view.h" - -#include "ash/system/phonehub/quick_action_item.h" -#include "ash/test/ash_test_base.h" -#include "base/test/scoped_feature_list.h" -#include "chromeos/components/phonehub/fake_phone_hub_manager.h" -#include "chromeos/constants/chromeos_features.h" - -namespace ash { - -using Status = chromeos::phonehub::TetherController::Status; - -namespace { - -class DummyEvent : public ui::Event { - public: - DummyEvent() : Event(ui::ET_UNKNOWN, base::TimeTicks(), 0) {} -}; - -} // namespace - -class QuickActionsViewTest : public AshTestBase { - public: - QuickActionsViewTest() = default; - ~QuickActionsViewTest() override = default; - - // AshTestBase: - void SetUp() override { - feature_list_.InitAndEnableFeature(chromeos::features::kPhoneHub); - AshTestBase::SetUp(); - - quick_actions_view_ = - std::make_unique<QuickActionsView>(&phone_hub_manager_); - } - - void TearDown() override { - quick_actions_view_.reset(); - AshTestBase::TearDown(); - } - - protected: - QuickActionsView* actions_view() { return quick_actions_view_.get(); } - chromeos::phonehub::FakeTetherController* tether_controller() { - return phone_hub_manager_.fake_tether_controller(); - } - chromeos::phonehub::FakeDoNotDisturbController* dnd_controller() { - return phone_hub_manager_.fake_do_not_disturb_controller(); - } - chromeos::phonehub::FakeFindMyDeviceController* find_my_device_controller() { - return phone_hub_manager_.fake_find_my_device_controller(); - } - - private: - std::unique_ptr<QuickActionsView> quick_actions_view_; - chromeos::phonehub::FakePhoneHubManager phone_hub_manager_; - base::test::ScopedFeatureList feature_list_; -}; - -TEST_F(QuickActionsViewTest, QuickActionsToggle) { - // Initially, silence phone is not enabled. - EXPECT_FALSE(dnd_controller()->IsDndEnabled()); - - // Toggle the button will enable the feature. - actions_view()->silence_phone_->ButtonPressed(nullptr, DummyEvent()); - EXPECT_TRUE(dnd_controller()->IsDndEnabled()); - - // Togge again to disable. - actions_view()->silence_phone_->ButtonPressed(nullptr, DummyEvent()); - EXPECT_FALSE(dnd_controller()->IsDndEnabled()); -} - -} // namespace ash
diff --git a/ash/system/phonehub/silence_phone_quick_action_controller.cc b/ash/system/phonehub/silence_phone_quick_action_controller.cc deleted file mode 100644 index 6d73fcf8..0000000 --- a/ash/system/phonehub/silence_phone_quick_action_controller.cc +++ /dev/null
@@ -1,76 +0,0 @@ -// Copyright 2020 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 "ash/system/phonehub/silence_phone_quick_action_controller.h" - -#include "ash/resources/vector_icons/vector_icons.h" -#include "ash/strings/grit/ash_strings.h" -#include "ash/system/phonehub/quick_action_item.h" -#include "ui/base/l10n/l10n_util.h" - -namespace ash { - -SilencePhoneQuickActionController::SilencePhoneQuickActionController( - chromeos::phonehub::DoNotDisturbController* dnd_controller) - : dnd_controller_(dnd_controller) { - DCHECK(dnd_controller_); - dnd_controller_->AddObserver(this); -} - -SilencePhoneQuickActionController::~SilencePhoneQuickActionController() { - dnd_controller_->RemoveObserver(this); -} - -QuickActionItem* SilencePhoneQuickActionController::CreateItem() { - DCHECK(!item_); - item_ = new QuickActionItem(this, IDS_ASH_PHONE_HUB_SILENCE_PHONE_TITLE, - kSystemMenuPhoneIcon); - OnDndStateChanged(); - return item_; -} - -void SilencePhoneQuickActionController::OnButtonPressed(bool is_now_enabled) { - SetState(ActionState::kConnecting); - dnd_controller_->SetDoNotDisturbState(!is_now_enabled); - // TODO(leandre): Add a timer to switch back to off state after connecting - // failed. -} - -void SilencePhoneQuickActionController::OnDndStateChanged() { - dnd_controller_->IsDndEnabled() ? SetState(ActionState::kOn) - : SetState(ActionState::kOff); -} - -void SilencePhoneQuickActionController::SetState(ActionState state) { - bool icon_enabled; - int state_text_id; - int sub_label_text; - switch (state) { - case ActionState::kOff: - icon_enabled = false; - state_text_id = IDS_ASH_PHONE_HUB_QUICK_ACTIONS_DISABLED_STATE_TOOLTIP; - sub_label_text = IDS_ASH_PHONE_HUB_QUICK_ACTIONS_OFF_STATE; - break; - case ActionState::kConnecting: - icon_enabled = true; - state_text_id = IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTING_STATE_TOOLTIP; - sub_label_text = IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTING_STATE; - break; - case ActionState::kOn: - icon_enabled = true; - state_text_id = IDS_ASH_PHONE_HUB_QUICK_ACTIONS_ENABLED_STATE_TOOLTIP; - sub_label_text = IDS_ASH_PHONE_HUB_QUICK_ACTIONS_ON_STATE; - break; - } - - item_->SetToggled(icon_enabled); - item_->SetSubLabel(l10n_util::GetStringUTF16(sub_label_text)); - base::string16 tooltip_state = - l10n_util::GetStringFUTF16(state_text_id, item_->GetItemLabel()); - item_->SetIconTooltip( - l10n_util::GetStringFUTF16(IDS_ASH_PHONE_HUB_QUICK_ACTIONS_TOGGLE_TOOLTIP, - item_->GetItemLabel(), tooltip_state)); -} - -} // namespace ash
diff --git a/ash/system/phonehub/silence_phone_quick_action_controller.h b/ash/system/phonehub/silence_phone_quick_action_controller.h deleted file mode 100644 index bd8c3bcb..0000000 --- a/ash/system/phonehub/silence_phone_quick_action_controller.h +++ /dev/null
@@ -1,47 +0,0 @@ -// Copyright 2020 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 ASH_SYSTEM_PHONEHUB_SILENCE_PHONE_QUICK_ACTION_CONTROLLER_H_ -#define ASH_SYSTEM_PHONEHUB_SILENCE_PHONE_QUICK_ACTION_CONTROLLER_H_ - -#include "ash/system/phonehub/quick_action_controller_base.h" -#include "chromeos/components/phonehub/do_not_disturb_controller.h" - -namespace ash { - -// Controller of a quick action item that toggles silence phone mode. -class SilencePhoneQuickActionController - : public QuickActionControllerBase, - public chromeos::phonehub::DoNotDisturbController::Observer { - public: - explicit SilencePhoneQuickActionController( - chromeos::phonehub::DoNotDisturbController* dnd_controller); - ~SilencePhoneQuickActionController() override; - SilencePhoneQuickActionController(SilencePhoneQuickActionController&) = - delete; - SilencePhoneQuickActionController operator=( - SilencePhoneQuickActionController&) = delete; - - // QuickActionControllerBase: - QuickActionItem* CreateItem() override; - void OnButtonPressed(bool is_now_enabled) override; - - // chromeos::phonehub::DoNotDisturbController::Observer: - void OnDndStateChanged() override; - - private: - // All the possible states that the silence phone button can be viewed. Each - // state has a corresponding icon, labels and tooltip view. - enum class ActionState { kOff, kConnecting, kOn }; - - // Set the item (including icon, label and tooltips) to a certain state. - void SetState(ActionState state); - - chromeos::phonehub::DoNotDisturbController* dnd_controller_ = nullptr; - QuickActionItem* item_ = nullptr; -}; - -} // namespace ash - -#endif // ASH_SYSTEM_PHONEHUB_SILENCE_PHONE_QUICK_ACTION_CONTROLLER_H_
diff --git a/base/profiler/stack_sampling_profiler.cc b/base/profiler/stack_sampling_profiler.cc index 1c1e938e..572ba1f 100644 --- a/base/profiler/stack_sampling_profiler.cc +++ b/base/profiler/stack_sampling_profiler.cc
@@ -741,9 +741,9 @@ } // static -// The profiler is currently only implemented for Windows x64 and MacOSX. -// TODO(https://crbug.com/1004855): enable for Android arm. -bool StackSamplingProfiler::IsSupported() { +// The profiler is currently supported for Windows x64, MacOSX x64, and Android +// ARM32. +bool StackSamplingProfiler::IsSupportedForCurrentPlatform() { #if (defined(OS_WIN) && defined(ARCH_CPU_X86_64)) || \ (defined(OS_MAC) && defined(ARCH_CPU_X86_64)) || \ (defined(OS_ANDROID) && BUILDFLAG(ENABLE_ARM_CFI_TABLE))
diff --git a/base/profiler/stack_sampling_profiler.h b/base/profiler/stack_sampling_profiler.h index 076881a..e62dc2b 100644 --- a/base/profiler/stack_sampling_profiler.h +++ b/base/profiler/stack_sampling_profiler.h
@@ -92,7 +92,7 @@ // Returns true if the profiler is supported on the current platform // configuration. - static bool IsSupported(); + static bool IsSupportedForCurrentPlatform(); // Creates a profiler for the the thread associated with |thread_token|, // generated by GetSamplingProfilerCurrentThreadToken().
diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h index 8cf58e64..97830615 100644 --- a/base/trace_event/builtin_categories.h +++ b/base/trace_event/builtin_categories.h
@@ -166,7 +166,6 @@ X("WebCore") \ X("webrtc") \ X("xr") \ - X(TRACE_DISABLED_BY_DEFAULT("agent_scheduling_group")) \ X(TRACE_DISABLED_BY_DEFAULT("animation-worklet")) \ X(TRACE_DISABLED_BY_DEFAULT("audio")) \ X(TRACE_DISABLED_BY_DEFAULT("audio-worklet")) \
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 41f709c..6522dcb 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -0.20200928.2.2 +0.20200928.3.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index c7bcd2f5..6522dcb 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -0.20200928.2.1 +0.20200928.3.1
diff --git a/build/mac_toolchain.py b/build/mac_toolchain.py index 4874184..f5351a1d 100755 --- a/build/mac_toolchain.py +++ b/build/mac_toolchain.py
@@ -151,9 +151,10 @@ current_license_path = '/Library/Preferences/com.apple.dt.Xcode.plist' if os.path.exists(current_license_path): current_license_plist = plistlib.readPlist(current_license_path) - xcode_version = current_license_plist['IDEXcodeVersionForAgreedToGMLicense'] - if (pkg_resources.parse_version(xcode_version) >= - pkg_resources.parse_version(cipd_xcode_version)): + xcode_version = current_license_plist.get( + 'IDEXcodeVersionForAgreedToGMLicense') + if (xcode_version is not None and pkg_resources.parse_version(xcode_version) + >= pkg_resources.parse_version(cipd_xcode_version)): should_overwrite_license = False if not should_overwrite_license:
diff --git a/build/skia_gold_common/skia_gold_session.py b/build/skia_gold_common/skia_gold_session.py index 192e9ff99..dd98e31 100644 --- a/build/skia_gold_common/skia_gold_session.py +++ b/build/skia_gold_common/skia_gold_session.py
@@ -345,10 +345,7 @@ '--corpus', self._corpus, '--instance', - # TODO(skbug.com/10610): Decide whether to use the public or - # non-public instance once authentication is fixed for the non-public - # instance. - str(self._instance) + '-public', + self._GetDiffGoldInstance(), '--input', png_file, '--test', @@ -470,6 +467,17 @@ def _CreateDiffOutputDir(self): return tempfile.mkdtemp(dir=self._working_dir) + def _GetDiffGoldInstance(self): + """Gets the Skia Gold instance to use for the Diff step. + + This can differ based on how a particular instance is set up, mainly + depending on whether it is set up for internal results or not. + """ + # TODO(skbug.com/10610): Decide whether to use the public or + # non-public instance once authentication is fixed for the non-public + # instance. + return str(self._instance) + '-public' + def _StoreDiffLinks(self, image_name, output_manager, output_dir): """Stores the local diff files as links.
diff --git a/chrome/VERSION b/chrome/VERSION index 7caca3c..801f8a1 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=87 MINOR=0 -BUILD=4277 +BUILD=4278 PATCH=0
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManager.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManager.java index 92ea369..bc709c09 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManager.java
@@ -276,6 +276,7 @@ stopAndUnbindServiceInternal( stopForegroundNotification, mPinnedNotificationId, oldNotification); + mBoundService = null; mPinnedNotificationId = INVALID_NOTIFICATION_ID; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java index ba28469..f877926 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
@@ -708,6 +708,10 @@ WebContents paymentHandlerWebContents = mPaymentUIsManager.showPaymentHandlerUI( url, mComponentPaymentRequestImpl.isOffTheRecord()); if (paymentHandlerWebContents != null) { + ServiceWorkerPaymentAppBridge.onOpeningPaymentAppWindow( + /*paymentRequestWebContents=*/mWebContents, + /*paymentHandlerWebContents=*/paymentHandlerWebContents); + // UKM for payment app origin should get recorded only when the origin of the invoked // payment app is shown to the user. mJourneyLogger.setPaymentAppUkmSourceId(mInvokedPaymentApp.getUkmSourceId());
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentAppBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentAppBridge.java index 63764e7b3..7209934e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentAppBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentAppBridge.java
@@ -110,18 +110,20 @@ @Override public void onDidFinishNavigation(Tab tab, NavigationHandle navigationHandle) { // Notify closing payment app window so as to abort payment if unsecure. - WebContents webContents = tab.getWebContents(); - if (!SslValidityChecker.isValidPageInPaymentHandlerWindow(webContents)) { - onClosingPaymentAppWindowForInsecureNavigation(webContents); + WebContents paymentRequestWebContents = tab.getWebContents(); + if (!SslValidityChecker.isValidPageInPaymentHandlerWindow( + paymentRequestWebContents)) { + onClosingPaymentAppWindowForInsecureNavigation(paymentRequestWebContents); } } @Override public void onSSLStateUpdated(Tab tab) { // Notify closing payment app window so as to abort payment if unsecure. - WebContents webContents = tab.getWebContents(); - if (!SslValidityChecker.isValidPageInPaymentHandlerWindow(webContents)) { - onClosingPaymentAppWindowForInsecureNavigation(webContents); + WebContents paymentRequestWebContents = tab.getWebContents(); + if (!SslValidityChecker.isValidPageInPaymentHandlerWindow( + paymentRequestWebContents)) { + onClosingPaymentAppWindowForInsecureNavigation(paymentRequestWebContents); } } }); @@ -130,23 +132,39 @@ /** * Notify closing the opened payment app window for insecure navigation. * - * @param webContents The web contents in the opened window. + * @param paymentRequestWebContents The web contents in the opened window. */ - public static void onClosingPaymentAppWindowForInsecureNavigation(WebContents webContents) { - if (webContents.isDestroyed()) return; - ServiceWorkerPaymentAppBridgeJni.get().onClosingPaymentAppWindow( - webContents, PaymentEventResponseType.PAYMENT_HANDLER_INSECURE_NAVIGATION); + public static void onClosingPaymentAppWindowForInsecureNavigation( + WebContents paymentRequestWebContents) { + if (paymentRequestWebContents.isDestroyed()) return; + ServiceWorkerPaymentAppBridgeJni.get().onClosingPaymentAppWindow(paymentRequestWebContents, + PaymentEventResponseType.PAYMENT_HANDLER_INSECURE_NAVIGATION); } /** * Notify closing the opened payment app window. * - * @param webContents The web contents in the opened window. Can be null. + * @param paymentRequestWebContents The web contents in the opened window. Can be null. */ - public static void onClosingPaymentAppWindow(@Nullable WebContents webContents) { - if (webContents == null || webContents.isDestroyed()) return; + public static void onClosingPaymentAppWindow(@Nullable WebContents paymentRequestWebContents) { + if (paymentRequestWebContents == null || paymentRequestWebContents.isDestroyed()) return; ServiceWorkerPaymentAppBridgeJni.get().onClosingPaymentAppWindow( - webContents, PaymentEventResponseType.PAYMENT_HANDLER_WINDOW_CLOSING); + paymentRequestWebContents, PaymentEventResponseType.PAYMENT_HANDLER_WINDOW_CLOSING); + } + + /** + * Called when payment handler's window is being opened. + * + * @param paymentRequestWebContents The web contents of the merchant's frame, cannot be null. + * @param paymentHandlerWebContents The web contents of the payment handler, cannot be null. + */ + public static void onOpeningPaymentAppWindow( + WebContents paymentRequestWebContents, WebContents paymentHandlerWebContents) { + if (paymentHandlerWebContents == null || paymentHandlerWebContents.isDestroyed()) return; + if (paymentRequestWebContents == null || paymentRequestWebContents.isDestroyed()) return; + ServiceWorkerPaymentAppBridgeJni.get().onOpeningPaymentAppWindow( + /*paymentRequestWebContents=*/paymentRequestWebContents, + /*paymentHandlerWebContents=*/paymentHandlerWebContents); } /** @@ -189,7 +207,9 @@ interface Natives { void hasServiceWorkerPaymentApps(HasServiceWorkerPaymentAppsCallback callback); void getServiceWorkerPaymentAppsInfo(GetServiceWorkerPaymentAppsInfoCallback callback); - void onClosingPaymentAppWindow(WebContents webContents, int reason); + void onClosingPaymentAppWindow(WebContents paymentRequestWebContents, int reason); + void onOpeningPaymentAppWindow( + WebContents paymentRequestWebContents, WebContents paymentHandlerWebContents); long getSourceIdForPaymentAppFromScope(GURL swScope); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/handler/PaymentHandlerCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/handler/PaymentHandlerCoordinator.java index 8696f7b..f47e07c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/handler/PaymentHandlerCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/handler/PaymentHandlerCoordinator.java
@@ -79,8 +79,10 @@ PropertyModel model = new PropertyModel.Builder(PaymentHandlerProperties.ALL_KEYS).build(); PaymentHandlerMediator mediator = new PaymentHandlerMediator(model, this::hide, - mPaymentHandlerWebContents, uiObserver, activity.getActivityTab().getView(), - mToolbarCoordinator.getToolbarHeightPx(), activity.getLifecycleDispatcher(), + /*paymentRequestWebContents=*/paymentRequestWebContents, + /*paymentHandlerWebContents*/ mPaymentHandlerWebContents, uiObserver, + activity.getActivityTab().getView(), mToolbarCoordinator.getToolbarHeightPx(), + activity.getLifecycleDispatcher(), BottomSheetControllerProvider.from(activity.getWindowAndroid())); activity.getWindow().getDecorView().addOnLayoutChangeListener(mediator); BottomSheetController bottomSheetController =
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/handler/PaymentHandlerMediator.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/handler/PaymentHandlerMediator.java index 108f329..3172bc5 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/handler/PaymentHandlerMediator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/handler/PaymentHandlerMediator.java
@@ -46,11 +46,8 @@ private final PropertyModel mModel; // Whenever invoked, invoked outside of the WebContentsObserver callbacks. private final Runnable mHider; - // Postfixes with "Ref" to distinguish from mWebContent in WebContentsObserver. Although - // referencing the same object, mWebContentsRef is preferable to WebContents here because - // mWebContents (a weak ref) requires null checks, while mWebContentsRef is guaranteed to be not - // null. - private final WebContents mWebContentsRef; + private final WebContents mPaymentRequestWebContents; + private final WebContents mPaymentHandlerWebContents; private final PaymentHandlerUiObserver mPaymentHandlerUiObserver; // Used to postpone execution of a callback to avoid destroy objects (e.g., WebContents) in // their own methods. @@ -82,7 +79,8 @@ * payment handler component. * @param hider The callback to clean up {@link PaymentHandlerCoordinator} when the sheet is * hidden. - * @param webContents The web-contents that loads the payment app. + * @param paymentRequestWebContents The WebContents of the merchant's frame. + * @param paymentHandlerWebContents The WebContents of the payment handler. * @param observer The {@link PaymentHandlerUiObserver} that observes this Payment Handler UI. * @param tabView The view of the main tab. * @param toolbarViewHeightPx The height of the toolbar view in px. @@ -91,14 +89,16 @@ * @param sheetController A {@link BottomSheetController} to show UI in. */ /* package */ PaymentHandlerMediator(PropertyModel model, Runnable hider, - WebContents webContents, PaymentHandlerUiObserver observer, View tabView, - int toolbarViewHeightPx, ActivityLifecycleDispatcher activityLifeCycleDispatcher, + WebContents paymentRequestWebContents, WebContents paymentHandlerWebContents, + PaymentHandlerUiObserver observer, View tabView, int toolbarViewHeightPx, + ActivityLifecycleDispatcher activityLifeCycleDispatcher, BottomSheetController sheetController) { - super(webContents); - assert webContents != null; + super(paymentHandlerWebContents); + assert paymentHandlerWebContents != null; mTabView = tabView; mBottomSheetController = sheetController; - mWebContentsRef = webContents; + mPaymentRequestWebContents = paymentRequestWebContents; + mPaymentHandlerWebContents = paymentHandlerWebContents; mToolbarViewHeightPx = toolbarViewHeightPx; mModel = model; mModel.set(PaymentHandlerProperties.BACK_PRESS_CALLBACK, this::onSystemBackButtonClicked); @@ -166,7 +166,7 @@ private void showScrim() { // Using an empty scrim observer is to avoid the dismissal of the bottom-sheet on tapping. - ChromeActivity activity = ChromeActivity.fromWebContents(mWebContentsRef); + ChromeActivity activity = ChromeActivity.fromWebContents(mPaymentHandlerWebContents); assert activity != null; PropertyModel params = mBottomSheetController.createScrimParams(); @@ -206,7 +206,7 @@ switch (mCloseReason) { case CloseReason.INSECURE_NAVIGATION: ServiceWorkerPaymentAppBridge.onClosingPaymentAppWindowForInsecureNavigation( - mWebContentsRef); + mPaymentRequestWebContents); break; case CloseReason.USER: // Intentional fallthrough. @@ -214,7 +214,7 @@ // Intentional fallthrough. // TODO(crbug.com/1017926): Respond to service worker with the net error. case CloseReason.ACTIVITY_DIED: - ServiceWorkerPaymentAppBridge.onClosingPaymentAppWindow(mWebContentsRef); + ServiceWorkerPaymentAppBridge.onClosingPaymentAppWindow(mPaymentRequestWebContents); break; case CloseReason.OTHERS: // No need to notify ServiceWorkerPaymentAppBridge when merchant aborts the @@ -230,7 +230,7 @@ } private void hideScrim() { - ChromeActivity activity = ChromeActivity.fromWebContents(mWebContentsRef); + ChromeActivity activity = ChromeActivity.fromWebContents(mPaymentHandlerWebContents); // activity would be null when this method is triggered by activity being destroyed. if (activity == null) return; @@ -255,7 +255,7 @@ } private void closeIfInsecure() { - if (!SslValidityChecker.isValidPageInPaymentHandlerWindow(mWebContentsRef)) { + if (!SslValidityChecker.isValidPageInPaymentHandlerWindow(mPaymentHandlerWebContents)) { closeUIForInsecureNavigation(); } } @@ -284,7 +284,7 @@ } private void onSystemBackButtonClicked() { - NavigationController navigation = mWebContentsRef.getNavigationController(); + NavigationController navigation = mPaymentHandlerWebContents.getNavigationController(); if (navigation.canGoBack()) navigation.goBack(); } }
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 5f771866..d98f7f2 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -9970,6 +9970,9 @@ <message name="IDS_DEVICE_LOG_TYPE_FIDO" desc="Checkbox to enable showing events related to security keys, which is physical devices used by users to log in to websites. It's called FIDO in English because that's the name of the standards body that defines security keys"> FIDO </message> + <message name="IDS_DEVICE_LOG_TYPE_SERIAL" desc="Checkbox to enable showing events related to serial devices"> + Serial + </message> <message name="IDS_DEVICE_LOG_FILEINFO" desc="File info checkbox in device event log"> File Info </message>
diff --git a/chrome/app/generated_resources_grd/IDS_DEVICE_LOG_TYPE_SERIAL.png.sha1 b/chrome/app/generated_resources_grd/IDS_DEVICE_LOG_TYPE_SERIAL.png.sha1 new file mode 100644 index 0000000..f85c791 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_DEVICE_LOG_TYPE_SERIAL.png.sha1
@@ -0,0 +1 @@ +f1fef308c235b0bdb31b61a2ecf0ed32a0b9be78 \ No newline at end of file
diff --git a/chrome/app/os_settings_strings.grdp b/chrome/app/os_settings_strings.grdp index 664cc60..32b916b 100644 --- a/chrome/app/os_settings_strings.grdp +++ b/chrome/app/os_settings_strings.grdp
@@ -498,14 +498,11 @@ <!-- Device Page (OS Settings) --> <message name="IDS_OS_SETTINGS_TOUCHPAD_REVERSE_SCROLL_LABEL"> - Reverse scrolling <ph name="LINK_BEGIN"><a></ph>Learn more<ph name="LINK_END"></a></ph> + Enable reverse scrolling <ph name="LINK_BEGIN"><a></ph>Learn more<ph name="LINK_END"></a></ph> </message> <message name="IDS_SETTINGS_DEVICE_TITLE" desc="Name of the settings page which displays device and peripheral settings."> Device </message> - <message name="IDS_SETTINGS_SCROLL_LABEL" desc="In Device Settings, the title above the radio buttons to choose the scrolling behavior."> - Scrolling - </message> <!-- Personalization Page (OS settings) --> <message name="IDS_OS_SETTINGS_PERSONALIZATION" desc="Name of the OS settings page which displays personalization preferences."> @@ -1641,7 +1638,7 @@ Swap primary mouse button </message> <message name="IDS_SETTINGS_MOUSE_REVERSE_SCROLL_LABEL" desc="In Device Settings, the text next to the checkbox to set reverse scrolling."> - Reverse scrolling + Enable reverse scrolling <ph name="LINK_BEGIN"><a></ph>Learn more<ph name="LINK_END"></a></ph> </message> <message name="IDS_SETTINGS_MOUSE_ACCELERATION_LABEL" desc="In Device Settings, the text next to the checkbox to disable mouse acceleration."> Enable mouse acceleration
diff --git a/chrome/app/os_settings_strings_grdp/IDS_OS_SETTINGS_TOUCHPAD_REVERSE_SCROLL_LABEL.png.sha1 b/chrome/app/os_settings_strings_grdp/IDS_OS_SETTINGS_TOUCHPAD_REVERSE_SCROLL_LABEL.png.sha1 new file mode 100644 index 0000000..72e876b --- /dev/null +++ b/chrome/app/os_settings_strings_grdp/IDS_OS_SETTINGS_TOUCHPAD_REVERSE_SCROLL_LABEL.png.sha1
@@ -0,0 +1 @@ +d8b70907a64d121e2063d6faf229295b8e56089f \ No newline at end of file
diff --git a/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_MOUSE_REVERSE_SCROLL_LABEL.png.sha1 b/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_MOUSE_REVERSE_SCROLL_LABEL.png.sha1 new file mode 100644 index 0000000..4d64862f --- /dev/null +++ b/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_MOUSE_REVERSE_SCROLL_LABEL.png.sha1
@@ -0,0 +1 @@ +a5951a0be1d8db1eed35d1fc22331b1450bcf4f0 \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 0e1df5ea..51b25f1 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -4026,6 +4026,8 @@ "apps/app_service/extension_apps_chromeos.h", "apps/app_service/file_utils.cc", "apps/app_service/file_utils.h", + "apps/app_service/intent_util.cc", + "apps/app_service/intent_util.h", "apps/app_service/lacros_apps.cc", "apps/app_service/lacros_apps.h", "apps/app_service/menu_util.cc",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 92dea753..c487b04f 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -2961,6 +2961,12 @@ flag_descriptions::kPluginVmShowMicrophonePermissionsDescription, kOsCrOS, FEATURE_VALUE_TYPE( chromeos::features::kPluginVmShowMicrophonePermissions)}, + {"vm-camera-mic-indicators-and-notifications", + flag_descriptions::kVmCameraMicIndicatorsAndNotificationsName, + flag_descriptions::kVmCameraMicIndicatorsAndNotificationsDescription, + kOsCrOS, + FEATURE_VALUE_TYPE( + chromeos::features::kVmCameraMicIndicatorsAndNotifications)}, #if BUILDFLAG(USE_TCMALLOC) {"dynamic-tcmalloc-tuning", flag_descriptions::kDynamicTcmallocName, flag_descriptions::kDynamicTcmallocDescription, kOsCrOS,
diff --git a/chrome/browser/android/vr/arcore_device/arcore_device.cc b/chrome/browser/android/vr/arcore_device/arcore_device.cc index cd5b916..459c41d9 100644 --- a/chrome/browser/android/vr/arcore_device/arcore_device.cc +++ b/chrome/browser/android/vr/arcore_device/arcore_device.cc
@@ -33,10 +33,8 @@ namespace { -mojom::VRDisplayInfoPtr CreateVRDisplayInfo(mojom::XRDeviceId device_id, - const gfx::Size& frame_size) { +mojom::VRDisplayInfoPtr CreateVRDisplayInfo(const gfx::Size& frame_size) { mojom::VRDisplayInfoPtr device = mojom::VRDisplayInfo::New(); - device->id = device_id; device->webxr_default_framebuffer_scale = 1.0; device->left_eye = mojom::VREyeParameters::New(); device->right_eye = nullptr; @@ -80,7 +78,7 @@ // if initialization fails. Use an arbitrary but really low resolution to make // it obvious if we're using this data instead of the actual values we get // from the output drawing surface. - SetVRDisplayInfo(CreateVRDisplayInfo(GetId(), {16, 16})); + SetVRDisplayInfo(CreateVRDisplayInfo({16, 16})); } ArCoreDevice::ArCoreDevice() @@ -177,7 +175,7 @@ << frame_size.height() << " rotation=" << static_cast<int>(rotation); DCHECK(!session_state_->is_arcore_gl_initialized_); - auto display_info = CreateVRDisplayInfo(GetId(), frame_size); + auto display_info = CreateVRDisplayInfo(frame_size); SetVRDisplayInfo(std::move(display_info)); RequestArCoreGlInitialization(window, rotation, frame_size);
diff --git a/chrome/browser/apps/app_service/app_service_proxy.cc b/chrome/browser/apps/app_service/app_service_proxy.cc index e988089..3c047c2 100644 --- a/chrome/browser/apps/app_service/app_service_proxy.cc +++ b/chrome/browser/apps/app_service/app_service_proxy.cc
@@ -546,6 +546,11 @@ const apps::mojom::IntentPtr& intent, bool exclude_browsers) { std::vector<IntentLaunchInfo> intent_launch_info; + if (apps_util::OnlyShareToDrive(intent) || + !apps_util::IsIntentValid(intent)) { + return intent_launch_info; + } + if (app_service_.is_bound()) { cache_.ForEachApp([&intent_launch_info, &intent, &exclude_browsers](const apps::AppUpdate& update) {
diff --git a/chrome/browser/apps/app_service/file_utils.cc b/chrome/browser/apps/app_service/file_utils.cc index ed1e049..3c537ec 100644 --- a/chrome/browser/apps/app_service/file_utils.cc +++ b/chrome/browser/apps/app_service/file_utils.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/apps/app_service/file_utils.h" +#include "base/files/file_path.h" #include "chrome/browser/chromeos/file_manager/app_id.h" #include "chrome/browser/chromeos/file_manager/fileapi_util.h" #include "storage/browser/file_system/file_system_context.h" @@ -26,4 +27,17 @@ return file_system_urls; } +std::vector<GURL> GetFileUrls(Profile* profile, + const std::vector<base::FilePath>& file_paths) { + std::vector<GURL> file_urls; + for (auto& file_path : file_paths) { + GURL file_url; + if (file_manager::util::ConvertAbsoluteFilePathToFileSystemUrl( + profile, file_path, file_manager::kFileManagerAppId, &file_url)) { + file_urls.push_back(file_url); + } + } + return file_urls; +} + } // namespace apps
diff --git a/chrome/browser/apps/app_service/file_utils.h b/chrome/browser/apps/app_service/file_utils.h index 7383aea5..f4e624f8 100644 --- a/chrome/browser/apps/app_service/file_utils.h +++ b/chrome/browser/apps/app_service/file_utils.h
@@ -10,6 +10,10 @@ class Profile; class GURL; +namespace base { +class FilePath; +} + namespace storage { class FileSystemURL; } @@ -18,6 +22,10 @@ std::vector<storage::FileSystemURL> GetFileSystemURL( Profile* profile, const std::vector<GURL>& file_urls); + +// Convert absolute file path to filesystem: scheme url. +std::vector<GURL> GetFileUrls(Profile* profile, + const std::vector<base::FilePath>& file_paths); } // namespace apps #endif // CHROME_BROWSER_APPS_APP_SERVICE_FILE_UTILS_H_
diff --git a/chrome/browser/apps/app_service/intent_util.cc b/chrome/browser/apps/app_service/intent_util.cc new file mode 100644 index 0000000..facfd21 --- /dev/null +++ b/chrome/browser/apps/app_service/intent_util.cc
@@ -0,0 +1,22 @@ +// Copyright 2020 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/apps/app_service/intent_util.h" + +#include "chrome/browser/apps/app_service/file_utils.h" +#include "components/services/app_service/public/cpp/intent_util.h" + +namespace apps_util { + +// TODO(crbug.com/853604): Make this not link to file manager extension if +// possible. +apps::mojom::IntentPtr CreateShareIntentFromFiles( + Profile* profile, + const std::vector<base::FilePath>& file_paths, + const std::vector<std::string>& mime_types) { + auto file_urls = apps::GetFileUrls(profile, file_paths); + return CreateShareIntentFromFiles(file_urls, mime_types); +} + +} // namespace apps_util
diff --git a/chrome/browser/apps/app_service/intent_util.h b/chrome/browser/apps/app_service/intent_util.h new file mode 100644 index 0000000..1f50b06 --- /dev/null +++ b/chrome/browser/apps/app_service/intent_util.h
@@ -0,0 +1,29 @@ +// Copyright 2020 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_APPS_APP_SERVICE_INTENT_UTIL_H_ +#define CHROME_BROWSER_APPS_APP_SERVICE_INTENT_UTIL_H_ + +#include <vector> + +#include "components/services/app_service/public/mojom/types.mojom.h" + +class Profile; + +namespace base { +class FilePath; +} + +namespace apps_util { +// Create an intent struct from the file paths and mime types +// of a list of files. +// This util has to live under chrome/ because it uses fileapis +// and cannot be inlucded in components/. +apps::mojom::IntentPtr CreateShareIntentFromFiles( + Profile* profile, + const std::vector<base::FilePath>& file_paths, + const std::vector<std::string>& mime_types); +} // namespace apps_util + +#endif // CHROME_BROWSER_APPS_APP_SERVICE_INTENT_UTIL_H_
diff --git a/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl.cc b/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl.cc index 3c03087..d6406f0 100644 --- a/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl.cc +++ b/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl.cc
@@ -16,6 +16,7 @@ #include "chrome/browser/chromeos/android_sms/android_sms_urls.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/app_list_syncable_service.h" +#include "chrome/browser/web_applications/web_app_provider.h" #include "chromeos/components/multidevice/logging/logging.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" @@ -65,23 +66,42 @@ to_app_id); } +bool AndroidSmsAppManagerImpl::PwaDelegate::IsAppRegistryReady( + Profile* profile) { + auto* provider = web_app::WebAppProvider::Get(profile); + if (!provider) + return false; + + return provider->on_registry_ready().is_signaled(); +} + +void AndroidSmsAppManagerImpl::PwaDelegate::ExecuteOnAppRegistryReady( + Profile* profile, + base::OnceClosure task) { + auto* provider = web_app::WebAppProvider::Get(profile); + if (!provider) + return; + + provider->on_registry_ready().Post(FROM_HERE, std::move(task)); +} + AndroidSmsAppManagerImpl::AndroidSmsAppManagerImpl( Profile* profile, AndroidSmsAppSetupController* setup_controller, PrefService* pref_service, app_list::AppListSyncableService* app_list_syncable_service, - scoped_refptr<base::TaskRunner> task_runner) + std::unique_ptr<PwaDelegate> test_pwa_delegate) : profile_(profile), setup_controller_(setup_controller), app_list_syncable_service_(app_list_syncable_service), - pref_service_(pref_service), - installed_url_at_last_notify_(GetCurrentAppUrl()), - pwa_delegate_(std::make_unique<PwaDelegate>()) { + pref_service_(pref_service) { + pwa_delegate_ = test_pwa_delegate ? std::move(test_pwa_delegate) + : std::make_unique<PwaDelegate>(); // Post a task to complete initialization. This portion of the flow must be - // posted asynchronously because it accesses the networking stack, which is - // not completely loaded until after this class is instantiated. - task_runner->PostTask( - FROM_HERE, + // posted asynchronously because it accesses the networking stack and apps + // registry, which might not be loaded until later. + pwa_delegate_->ExecuteOnAppRegistryReady( + profile_, base::BindOnce(&AndroidSmsAppManagerImpl::CompleteAsyncInitialization, weak_ptr_factory_.GetWeakPtr())); } @@ -140,6 +160,21 @@ !setup_controller_->GetPwa(url); } +bool AndroidSmsAppManagerImpl::IsAppInstalled() { + if (GetInstalledPwaDomain()) + return true; + return false; +} + +bool AndroidSmsAppManagerImpl::IsAppRegistryReady() { + return pwa_delegate_->IsAppRegistryReady(profile_); +} + +void AndroidSmsAppManagerImpl::ExecuteOnAppRegistryReady( + base::OnceClosure task) { + pwa_delegate_->ExecuteOnAppRegistryReady(profile_, std::move(task)); +} + base::Optional<PwaDomain> AndroidSmsAppManagerImpl::GetInstalledPwaDomain() { for (auto* it = std::begin(kDomains); it != std::end(kDomains); ++it) { if (setup_controller_->GetPwa( @@ -152,6 +187,9 @@ } void AndroidSmsAppManagerImpl::CompleteAsyncInitialization() { + // Must wait until the app registry is ready before querying the current url. + last_installed_url_ = GetCurrentAppUrl(); + base::Optional<PwaDomain> domain = GetInstalledPwaDomain(); // If no app was installed before this object was created, there is nothing @@ -173,10 +211,10 @@ void AndroidSmsAppManagerImpl::NotifyInstalledAppUrlChangedIfNecessary() { base::Optional<GURL> installed_app_url = GetCurrentAppUrl(); - if (installed_url_at_last_notify_ == installed_app_url) + if (last_installed_url_ == installed_app_url) return; - installed_url_at_last_notify_ = installed_app_url; + last_installed_url_ = installed_app_url; NotifyInstalledAppUrlChanged(); } @@ -265,11 +303,6 @@ true /* use_install_url */, *domain))); } -void AndroidSmsAppManagerImpl::SetPwaDelegateForTesting( - std::unique_ptr<PwaDelegate> test_pwa_delegate) { - pwa_delegate_ = std::move(test_pwa_delegate); -} - } // namespace android_sms } // namespace chromeos
diff --git a/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl.h b/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl.h index 5d2e85b..ca187d1 100644 --- a/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl.h +++ b/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl.h
@@ -35,19 +35,6 @@ class AndroidSmsAppManagerImpl : public AndroidSmsAppManager { public: - AndroidSmsAppManagerImpl( - Profile* profile, - AndroidSmsAppSetupController* setup_controller, - PrefService* pref_service, - app_list::AppListSyncableService* app_list_syncable_service, - scoped_refptr<base::TaskRunner> task_runner = - base::ThreadTaskRunnerHandle::Get()); - ~AndroidSmsAppManagerImpl() override; - static void RegisterProfilePrefs(PrefRegistrySimple* registry); - - private: - friend class AndroidSmsAppManagerImplTest; - // Thin wrapper around static PWA functions which is stubbed out for tests. class PwaDelegate { public: @@ -58,8 +45,24 @@ const std::string& from_app_id, const std::string& to_app_id, app_list::AppListSyncableService* app_list_syncable_service); + virtual bool IsAppRegistryReady(Profile* profile); + virtual void ExecuteOnAppRegistryReady(Profile* profile, + base::OnceClosure task); }; + AndroidSmsAppManagerImpl( + Profile* profile, + AndroidSmsAppSetupController* setup_controller, + PrefService* pref_service, + app_list::AppListSyncableService* app_list_syncable_service, + std::unique_ptr<PwaDelegate> test_pwa_delegate = nullptr); + ~AndroidSmsAppManagerImpl() override; + + static void RegisterProfilePrefs(PrefRegistrySimple* registry); + + private: + friend class AndroidSmsAppManagerImplTest; + // AndroidSmsAppManager: base::Optional<GURL> GetCurrentAppUrl() override; @@ -68,6 +71,9 @@ void SetUpAndLaunchAndroidSmsApp() override; void TearDownAndroidSmsApp() override; bool HasAppBeenManuallyUninstalledByUser() override; + bool IsAppInstalled() override; + bool IsAppRegistryReady() override; + void ExecuteOnAppRegistryReady(base::OnceClosure task) override; base::Optional<PwaDomain> GetInstalledPwaDomain(); void CompleteAsyncInitialization(); @@ -79,8 +85,6 @@ bool success); void HandleAppSetupFinished(); - void SetPwaDelegateForTesting(std::unique_ptr<PwaDelegate> test_pwa_delegate); - Profile* profile_; AndroidSmsAppSetupController* setup_controller_; app_list::AppListSyncableService* app_list_syncable_service_; @@ -93,9 +97,9 @@ // successfully. bool is_app_launch_pending_ = false; - // The installed app URL during the last time that - // NotifyInstalledAppUrlChanged() was invoked. - base::Optional<GURL> installed_url_at_last_notify_; + // The installed app URL, initialized when app registry is ready and updated + // any time NotifyInstalledAppUrlChanged() is invoked. + base::Optional<GURL> last_installed_url_; std::unique_ptr<PwaDelegate> pwa_delegate_; base::WeakPtrFactory<AndroidSmsAppManagerImpl> weak_ptr_factory_{this};
diff --git a/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl_unittest.cc b/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl_unittest.cc index 69c82dd..447caa0 100644 --- a/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl_unittest.cc +++ b/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl_unittest.cc
@@ -83,10 +83,21 @@ return true; } + bool IsAppRegistryReady(Profile* profile) override { return true; } + + void ExecuteOnAppRegistryReady(Profile* profile, + base::OnceClosure task) override { + test_task_runner_->PostTask(FROM_HERE, std::move(task)); + } + + void RunPendingTasks() { test_task_runner_->RunUntilIdle(); } + private: std::vector<std::string> opened_app_ids_; std::vector<std::pair<std::string, std::string>> transfer_item_attribute_params_; + scoped_refptr<base::TestSimpleTaskRunner> test_task_runner_ = + base::MakeRefCounted<base::TestSimpleTaskRunner>(); DISALLOW_COPY_AND_ASSIGN(TestPwaDelegate); }; @@ -99,20 +110,16 @@ fake_android_sms_app_setup_controller_ = std::make_unique<FakeAndroidSmsAppSetupController>(); - test_task_runner_ = base::MakeRefCounted<base::TestSimpleTaskRunner>(); test_pref_service_ = std::make_unique<sync_preferences::TestingPrefServiceSyncable>(); AndroidSmsAppManagerImpl::RegisterProfilePrefs( test_pref_service_->registry()); + auto test_pwa_delegate = std::make_unique<TestPwaDelegate>(); + test_pwa_delegate_ = test_pwa_delegate.get(); android_sms_app_manager_ = std::make_unique<AndroidSmsAppManagerImpl>( &profile_, fake_android_sms_app_setup_controller_.get(), test_pref_service_.get(), nullptr /* app_list_syncable_service */, - test_task_runner_); - - auto test_pwa_delegate = std::make_unique<TestPwaDelegate>(); - test_pwa_delegate_ = test_pwa_delegate.get(); - android_sms_app_manager_->SetPwaDelegateForTesting( std::move(test_pwa_delegate)); test_observer_ = std::make_unique<TestObserver>(); @@ -123,7 +130,7 @@ android_sms_app_manager_->RemoveObserver(test_observer_.get()); } - void CompleteAsyncInitialization() { test_task_runner_->RunUntilIdle(); } + void CompleteAsyncInitialization() { test_pwa_delegate_->RunPendingTasks(); } TestPwaDelegate* test_pwa_delegate() { return test_pwa_delegate_; } @@ -149,7 +156,6 @@ test_pref_service_; std::unique_ptr<FakeAndroidSmsAppSetupController> fake_android_sms_app_setup_controller_; - scoped_refptr<base::TestSimpleTaskRunner> test_task_runner_; TestPwaDelegate* test_pwa_delegate_; std::unique_ptr<TestObserver> test_observer_;
diff --git a/chrome/browser/chromeos/android_sms/android_sms_pairing_state_tracker_impl.cc b/chrome/browser/chromeos/android_sms/android_sms_pairing_state_tracker_impl.cc index 08faf76..730ab965 100644 --- a/chrome/browser/chromeos/android_sms/android_sms_pairing_state_tracker_impl.cc +++ b/chrome/browser/chromeos/android_sms/android_sms_pairing_state_tracker_impl.cc
@@ -96,11 +96,17 @@ } GURL AndroidSmsPairingStateTrackerImpl::GetPairingUrl() { - base::Optional<GURL> app_url = android_sms_app_manager_->GetCurrentAppUrl(); - if (app_url) - return *app_url; + // If the app registry is not ready, we can't see check what is currently + // installed. + if (android_sms_app_manager_->IsAppRegistryReady()) { + base::Optional<GURL> app_url = android_sms_app_manager_->GetCurrentAppUrl(); + if (app_url) + return *app_url; + } - // If no app is installed, default to the normal messages URL. + // If no app is installed or the app registry is not ready, default to the + // expected messages URL. This will only be incorrect if a migration must + // happen. return GetAndroidMessagesURL(); }
diff --git a/chrome/browser/chromeos/android_sms/pairing_lost_notifier.cc b/chrome/browser/chromeos/android_sms/pairing_lost_notifier.cc index 8aaf14c6..856477cc 100644 --- a/chrome/browser/chromeos/android_sms/pairing_lost_notifier.cc +++ b/chrome/browser/chromeos/android_sms/pairing_lost_notifier.cc
@@ -47,7 +47,12 @@ pref_service_(pref_service), android_sms_app_helper_delegate_(android_sms_app_helper_delegate) { multidevice_setup_client_->AddObserver(this); - HandleMessagesFeatureState(); + + // Wait until the app registry is loaded before querying for installed PWA + // info. + android_sms_app_helper_delegate_->ExecuteOnAppRegistryReady( + base::BindOnce(&PairingLostNotifier::HandleMessagesFeatureState, + weak_ptr_factory_.GetWeakPtr())); } PairingLostNotifier::~PairingLostNotifier() { @@ -61,15 +66,27 @@ } void PairingLostNotifier::HandleMessagesFeatureState() { + if (!android_sms_app_helper_delegate_->IsAppRegistryReady()) { + return; + } + multidevice_setup::mojom::FeatureState state = multidevice_setup_client_->GetFeatureStates() .find(multidevice_setup::mojom::Feature::kMessages) ->second; - // If Messages is currently enabled or disabled, the user has completed the - // setup process. - if (state == multidevice_setup::mojom::FeatureState::kDisabledByUser || - state == multidevice_setup::mojom::FeatureState::kEnabledByUser) { + // If the feature is disabled we should never show any notifications or + // track the pairing state. To avoid showing the notification immediately + // if the feature is ever enabled in the future, the pref should also be + // cleared. + if (state == multidevice_setup::mojom::FeatureState::kDisabledByUser) { + pref_service_->SetBoolean(kWasPreviouslySetUpPrefName, false); + ClosePairingLostNotificationIfVisible(); + return; + } + + // If Messages is enabled, the user has completed the setup process. + if (state == multidevice_setup::mojom::FeatureState::kEnabledByUser) { HandleSetUpFeatureState(); return; }
diff --git a/chrome/browser/chromeos/android_sms/pairing_lost_notifier_unittest.cc b/chrome/browser/chromeos/android_sms/pairing_lost_notifier_unittest.cc index 16218bec..64319eb 100644 --- a/chrome/browser/chromeos/android_sms/pairing_lost_notifier_unittest.cc +++ b/chrome/browser/chromeos/android_sms/pairing_lost_notifier_unittest.cc
@@ -39,6 +39,7 @@ PairingLostNotifier::RegisterProfilePrefs(test_pref_service_->registry()); fake_android_sms_app_helper_delegate_ = std::make_unique<multidevice_setup::FakeAndroidSmsAppHelperDelegate>(); + fake_android_sms_app_helper_delegate_->set_is_app_registry_ready(true); pairing_lost_notifier_ = std::make_unique<PairingLostNotifier>( profile(), fake_multidevice_setup_client_.get(),
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_sharesheet.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_sharesheet.cc index 92c6bb4..47486db 100644 --- a/chrome/browser/chromeos/extensions/file_manager/private_api_sharesheet.cc +++ b/chrome/browser/chromeos/extensions/file_manager/private_api_sharesheet.cc
@@ -117,15 +117,31 @@ base::File::Error error) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - bool result = false; - if (error != base::File::FILE_OK) { LOG(ERROR) << "Error reading file properties in Drive: " << error; Respond(ArgumentList(extensions::api::file_manager_private_internal:: - SharesheetHasTargets::Results::Create(result))); + SharesheetHasTargets::Results::Create(false))); return; } + is_directory_collector_ = + std::make_unique<app_file_handler_util::IsDirectoryCollector>( + chrome_details_.GetProfile()); + is_directory_collector_->CollectForEntriesPaths( + std::vector<base::FilePath>{file_system_urls_[0].path()}, + base::BindOnce(&FileManagerPrivateInternalSharesheetHasTargetsFunction:: + OnIsDirectoryCollected, + this, std::move(mime_types), std::move(properties))); +} + +void FileManagerPrivateInternalSharesheetHasTargetsFunction:: + OnIsDirectoryCollected( + std::unique_ptr<std::vector<std::string>> mime_types, + std::unique_ptr<api::file_manager_private::EntryProperties> properties, + std::unique_ptr<std::set<base::FilePath>> path_directory_set) { + bool is_directory = path_directory_set->find(file_system_urls_[0].path()) != + path_directory_set->end(); + sharesheet::SharesheetService* sharesheet_service = sharesheet::SharesheetServiceFactory::GetForProfile( chrome_details_.GetProfile()); @@ -133,9 +149,9 @@ (properties->can_share && *properties->can_share && properties->share_url) ? GURL(*properties->share_url) : GURL(); - result = sharesheet_service->HasShareTargets( + bool result = sharesheet_service->HasShareTargets( apps_util::CreateShareIntentFromDriveFile(urls_[0], (*mime_types)[0], - share_url), + share_url, is_directory), contains_hosted_document_); Respond(ArgumentList(extensions::api::file_manager_private_internal:: SharesheetHasTargets::Results::Create(result))); @@ -233,6 +249,23 @@ return; } + is_directory_collector_ = + std::make_unique<app_file_handler_util::IsDirectoryCollector>( + chrome_details_.GetProfile()); + is_directory_collector_->CollectForEntriesPaths( + std::vector<base::FilePath>{file_system_urls_[0].path()}, + base::BindOnce(&FileManagerPrivateInternalInvokeSharesheetFunction:: + OnIsDirectoryCollected, + this, std::move(mime_types), std::move(properties))); +} + +void FileManagerPrivateInternalInvokeSharesheetFunction::OnIsDirectoryCollected( + std::unique_ptr<std::vector<std::string>> mime_types, + std::unique_ptr<api::file_manager_private::EntryProperties> properties, + std::unique_ptr<std::set<base::FilePath>> path_directory_set) { + bool is_directory = path_directory_set->find(file_system_urls_[0].path()) != + path_directory_set->end(); + auto* profile = chrome_details_.GetProfile(); sharesheet::SharesheetService* sharesheet_service = sharesheet::SharesheetServiceFactory::GetForProfile(profile); @@ -245,10 +278,11 @@ (properties->can_share && *properties->can_share && properties->share_url) ? GURL(*properties->share_url) : GURL(); - sharesheet_service->ShowBubble(GetSenderWebContents(), - apps_util::CreateShareIntentFromDriveFile( - urls_[0], (*mime_types)[0], share_url), - contains_hosted_document_); + sharesheet_service->ShowBubble( + GetSenderWebContents(), + apps_util::CreateShareIntentFromDriveFile(urls_[0], (*mime_types)[0], + share_url, is_directory), + contains_hosted_document_); Respond(NoArguments()); }
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_sharesheet.h b/chrome/browser/chromeos/extensions/file_manager/private_api_sharesheet.h index 7483eb52..a44d793 100644 --- a/chrome/browser/chromeos/extensions/file_manager/private_api_sharesheet.h +++ b/chrome/browser/chromeos/extensions/file_manager/private_api_sharesheet.h
@@ -29,6 +29,7 @@ } // namespace api namespace app_file_handler_util { +class IsDirectoryCollector; class MimeTypeCollector; } // namespace app_file_handler_util @@ -57,8 +58,15 @@ std::unique_ptr<api::file_manager_private::EntryProperties> properties, base::File::Error error); + void OnIsDirectoryCollected( + std::unique_ptr<std::vector<std::string>> mime_types, + std::unique_ptr<api::file_manager_private::EntryProperties> properties, + std::unique_ptr<std::set<base::FilePath>> path_directory_set); + std::unique_ptr<app_file_handler_util::MimeTypeCollector> mime_type_collector_; + std::unique_ptr<app_file_handler_util::IsDirectoryCollector> + is_directory_collector_; std::vector<GURL> urls_; const ChromeExtensionFunctionDetails chrome_details_; std::vector<storage::FileSystemURL> file_system_urls_; @@ -89,8 +97,15 @@ std::unique_ptr<api::file_manager_private::EntryProperties> properties, base::File::Error error); + void OnIsDirectoryCollected( + std::unique_ptr<std::vector<std::string>> mime_types, + std::unique_ptr<api::file_manager_private::EntryProperties> properties, + std::unique_ptr<std::set<base::FilePath>> path_directory_set); + std::unique_ptr<app_file_handler_util::MimeTypeCollector> mime_type_collector_; + std::unique_ptr<app_file_handler_util::IsDirectoryCollector> + is_directory_collector_; std::vector<GURL> urls_; const ChromeExtensionFunctionDetails chrome_details_; std::vector<storage::FileSystemURL> file_system_urls_;
diff --git a/chrome/browser/chromeos/login/demo_mode/demo_setup_browsertest.cc b/chrome/browser/chromeos/login/demo_mode/demo_setup_browsertest.cc index 8eb64e0..354ac9a 100644 --- a/chrome/browser/chromeos/login/demo_mode/demo_setup_browsertest.cc +++ b/chrome/browser/chromeos/login/demo_mode/demo_setup_browsertest.cc
@@ -129,7 +129,7 @@ if (screen == ArcTermsOfServiceScreenView::kScreenId) return "$('arc-tos-root')"; if (screen == DemoSetupScreenView::kScreenId) - return "$('demo-setup-content')"; + return "$('demo-setup')"; NOTREACHED() << "This OOBE screen is not a part of Demo Mode setup flow"; return std::string(); } @@ -1238,7 +1238,7 @@ // Checks how many steps have been rendered in the demo setup screen. int CountNumberOfStepsInUi() { const std::string query = - "$('demo-setup-content').$$('oobe-dialog').querySelectorAll('progress-" + "$('demo-setup').$$('oobe-dialog').querySelectorAll('progress-" "list-item').length"; return test::OobeJS().GetInt(query); @@ -1247,7 +1247,7 @@ // Checks how many steps are marked as pending in the demo setup screen. int CountPendingStepsInUi() { const std::string query = - "Object.values($('demo-setup-content').$$('oobe-dialog')." + "Object.values($('demo-setup').$$('oobe-dialog')." "querySelectorAll('progress-list-item')).filter(node => " "node.shadowRoot.querySelector('#icon-pending:not([hidden])')).length"; @@ -1257,7 +1257,7 @@ // Checks how many steps are marked as active in the demo setup screen. int CountActiveStepsInUi() { const std::string query = - "Object.values($('demo-setup-content').$$('oobe-dialog')." + "Object.values($('demo-setup').$$('oobe-dialog')." "querySelectorAll('progress-list-item')).filter(node => " "node.shadowRoot.querySelector('#icon-active:not([hidden])')).length"; @@ -1267,7 +1267,7 @@ // Checks how many steps are marked as complete in the demo setup screen. int CountCompletedStepsInUi() { const std::string query = - "Object.values($('demo-setup-content').$$('oobe-dialog')." + "Object.values($('demo-setup').$$('oobe-dialog')." "querySelectorAll('progress-list-item')).filter(node => " "node.shadowRoot.querySelector('#icon-completed:not([hidden])'))." "length";
diff --git a/chrome/browser/chromeos/login/users/avatar/user_image_manager_browsertest.cc b/chrome/browser/chromeos/login/users/avatar/user_image_manager_browsertest.cc index bbcb3c6f..3177418 100644 --- a/chrome/browser/chromeos/login/users/avatar/user_image_manager_browsertest.cc +++ b/chrome/browser/chromeos/login/users/avatar/user_image_manager_browsertest.cc
@@ -298,7 +298,7 @@ const user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); ASSERT_TRUE(user); - UserImageManagerImpl* uim = reinterpret_cast<UserImageManagerImpl*>( + UserImageManagerImpl* uim = static_cast<UserImageManagerImpl*>( ChromeUserManager::Get()->GetUserImageManager(user->GetAccountId())); if (uim->job_.get()) { run_loop_.reset(new base::RunLoop);
diff --git a/chrome/browser/chromeos/plugin_vm/plugin_vm_manager_impl.cc b/chrome/browser/chromeos/plugin_vm/plugin_vm_manager_impl.cc index 4b7d016..a960805d 100644 --- a/chrome/browser/chromeos/plugin_vm/plugin_vm_manager_impl.cc +++ b/chrome/browser/chromeos/plugin_vm/plugin_vm_manager_impl.cc
@@ -350,7 +350,7 @@ base::BindOnce(&PluginVmManagerImpl::OnInstallPluginVmDlc, weak_ptr_factory_.GetWeakPtr(), std::move(success_callback), std::move(error_callback)), - chromeos::DlcserviceClient::IgnoreProgress); + base::DoNothing()); } void PluginVmManagerImpl::OnInstallPluginVmDlc(
diff --git a/chrome/browser/chromeos/printing/printer_configurer.cc b/chrome/browser/chromeos/printing/printer_configurer.cc index 114210a8..d007a54 100644 --- a/chrome/browser/chromeos/printing/printer_configurer.cc +++ b/chrome/browser/chromeos/printing/printer_configurer.cc
@@ -52,15 +52,36 @@ case debugd::CupsResult::CUPS_INVALID_PPD: PRINTER_LOG(EVENT) << printer.make_and_model() << " PPD Invalid"; return PrinterSetupResult::kInvalidPpd; - case debugd::CupsResult::CUPS_AUTOCONF_FAILURE: - PRINTER_LOG(EVENT) << printer.make_and_model() << " Autoconf failed"; - // There are other reasons autoconf fails but this is the most likely. - return PrinterSetupResult::kPrinterUnreachable; case debugd::CupsResult::CUPS_LPADMIN_FAILURE: - // Printers should always be configurable by lpadmin. PRINTER_LOG(ERROR) << printer.make_and_model() - << " lpadmin could not add the printer"; + << " lpadmin-manual failed"; return PrinterSetupResult::kFatalError; + case debugd::CupsResult::CUPS_AUTOCONF_FAILURE: + PRINTER_LOG(EVENT) << printer.make_and_model() + << " lpadmin-autoconf failed"; + return PrinterSetupResult::kFatalError; + case debugd::CupsResult::CUPS_BAD_URI: + PRINTER_LOG(EVENT) << printer.make_and_model() << " Bad URI"; + return PrinterSetupResult::kBadUri; + case debugd::CupsResult::CUPS_IO_ERROR: + PRINTER_LOG(EVENT) << printer.make_and_model() << " I/O error"; + return PrinterSetupResult::kIoError; + case debugd::CupsResult::CUPS_MEMORY_ALLOC_ERROR: + PRINTER_LOG(EVENT) << printer.make_and_model() + << " Memory allocation error"; + return PrinterSetupResult::kMemoryAllocationError; + case debugd::CupsResult::CUPS_PRINTER_UNREACHABLE: + PRINTER_LOG(EVENT) << printer.make_and_model() + << " Printer is ureachable"; + return PrinterSetupResult::kPrinterUnreachable; + case debugd::CupsResult::CUPS_PRINTER_WRONG_RESPONSE: + PRINTER_LOG(EVENT) << printer.make_and_model() + << " Unexpected response from printer"; + return PrinterSetupResult::kPrinterSentWrongResponse; + case debugd::CupsResult::CUPS_PRINTER_NOT_AUTOCONF: + PRINTER_LOG(EVENT) << printer.make_and_model() + << "Printer is not autoconfigurable"; + return PrinterSetupResult::kPrinterIsNotAutoconfigurable; case debugd::CupsResult::CUPS_FATAL: default: // We have no idea. It must be fatal. @@ -248,56 +269,58 @@ return eula_url.ReplaceComponents(replacements); } -std::ostream& operator<<(std::ostream& out, const PrinterSetupResult& result) { +std::string ResultCodeToMessage(const PrinterSetupResult result) { switch (result) { - case kFatalError: - out << "fatal error"; - break; - case kSuccess: - out << "add success"; - break; - case kEditSuccess: - out << "edit success"; - break; - case kPrinterUnreachable: - out << "printer unreachable"; - break; - case kDbusError: - out << "failed to connect over dbus"; - break; - case kNativePrintersNotAllowed: - out << "native printers denied by policy"; - break; - case kInvalidPrinterUpdate: - out << "printer edits would make printer unusable"; - break; - case kComponentUnavailable: - out << "component driver was requested but installation failed."; - break; - case kPpdTooLarge: - out << "PPD too large"; - break; - case kInvalidPpd: - out << "PPD rejected by cupstestppd"; - break; - case kPpdNotFound: - out << "could not find PPD"; - break; - case kPpdUnretrievable: - out << "failed to download PPD"; - break; - case kDbusNoReply: - out << "no reply from debugd"; - break; - case kDbusTimeout: - out << "timeout in D-Bus"; - break; - case kMaxValue: - out << "unexpected result"; - break; + // Success. + case PrinterSetupResult::kSuccess: + return "Printer successfully configured."; + case PrinterSetupResult::kEditSuccess: + return "Printer successfully updated."; + // Invalid configuration. + case PrinterSetupResult::kNativePrintersNotAllowed: + return "Unable to add or edit printer due to enterprise policy."; + case PrinterSetupResult::kBadUri: + return "Invalid URI."; + case PrinterSetupResult::kInvalidPrinterUpdate: + return "Requested printer changes would make printer unusable."; + // Problem with a printer. + case PrinterSetupResult::kPrinterUnreachable: + return "Could not contact printer for configuration."; + case PrinterSetupResult::kPrinterSentWrongResponse: + return "Printer sent unexpected response."; + case PrinterSetupResult::kPrinterIsNotAutoconfigurable: + return "Printer is not autoconfigurable."; + // Problem with a PPD file. + case PrinterSetupResult::kPpdTooLarge: + return "PPD is too large."; + case PrinterSetupResult::kInvalidPpd: + return "Provided PPD is invalid."; + case PrinterSetupResult::kPpdNotFound: + return "Could not locate requested PPD. Check printer configuration."; + case PrinterSetupResult::kPpdUnretrievable: + return "Could not retrieve PPD from server. Check Internet connection."; + // Cannot load a required compomonent. + case PrinterSetupResult::kComponentUnavailable: + return "Could not install component."; + // Problem with D-Bus. + case PrinterSetupResult::kDbusError: + return "D-Bus error occurred. Reboot required."; + case PrinterSetupResult::kDbusNoReply: + return "Couldn't talk to debugd over D-Bus."; + case PrinterSetupResult::kDbusTimeout: + return "Timed out trying to reach debugd over D-Bus."; + // Problem reported by OS. + case PrinterSetupResult::kIoError: + return "I/O error occurred."; + case PrinterSetupResult::kMemoryAllocationError: + return "Memory allocation error occurred."; + // Unknown problem. + case PrinterSetupResult::kFatalError: + return "Unknown error occurred."; + // This is not supposed to happen. + case PrinterSetupResult::kMaxValue: + return "The error code is invalid."; } - - return out; } } // namespace chromeos
diff --git a/chrome/browser/chromeos/printing/printer_configurer.h b/chrome/browser/chromeos/printing/printer_configurer.h index 2ee4ab4..7ec39ff 100644 --- a/chrome/browser/chromeos/printing/printer_configurer.h +++ b/chrome/browser/chromeos/printing/printer_configurer.h
@@ -28,14 +28,20 @@ kNativePrintersNotAllowed = 4, // Tried adding/editing printers policy set kInvalidPrinterUpdate = 5, // Tried updating printer with invalid values kComponentUnavailable = 6, // Could not install component - kEditSuccess = 7, // Printer editted successfully - // Space left for additional errors + kEditSuccess = 7, // Printer edited successfully + kPrinterSentWrongResponse = 8, // Printer sent unexpected response + kPrinterIsNotAutoconfigurable = 9, // Printer requires PPD // PPD errors kPpdTooLarge = 10, // PPD exceeds size limit kInvalidPpd = 11, // PPD rejected by cupstestppd kPpdNotFound = 12, // Could not find PPD kPpdUnretrievable = 13, // Could not download PPD + + // Other errors + kIoError = 14, // I/O error in CUPS + kMemoryAllocationError = 15, // Memory allocation error in Cups + kBadUri = 16, // Printer's URI is incorrect // Space left for additional errors // Specific DBus errors. This must stay in sync with the DbusLibraryError @@ -95,8 +101,8 @@ DISALLOW_COPY_AND_ASSIGN(PrinterConfigurer); }; -// Stream operator for ease of logging |result|. -std::ostream& operator<<(std::ostream& out, const PrinterSetupResult& result); +// Return a message for |result| that can be used in device-log. +std::string ResultCodeToMessage(const PrinterSetupResult result); } // namespace chromeos
diff --git a/chrome/browser/chromeos/smb_client/smb_file_system.cc b/chrome/browser/chromeos/smb_client/smb_file_system.cc index c69e2a8..7cc03bf 100644 --- a/chrome/browser/chromeos/smb_client/smb_file_system.cc +++ b/chrome/browser/chromeos/smb_client/smb_file_system.cc
@@ -108,15 +108,6 @@ } } -// Metrics recording. -void RecordReadDirectoryCount(int count) { - UMA_HISTOGRAM_COUNTS_100000("NativeSmbFileShare.ReadDirectoryCount", count); -} - -void RecordReadDirectoryDuration(const base::TimeDelta& delta) { - UMA_HISTOGRAM_TIMES("NativeSmbFileShare.ReadDirectoryDuration", delta); -} - } // namespace namespace smb_client { @@ -641,9 +632,6 @@ uint32_t batch_size = kReadDirectoryInitialBatchSize; storage::AsyncFileUtil::EntryList entry_list; - RecordReadDirectoryCount(entries.entries_size()); - RecordReadDirectoryDuration(metrics_timer.Elapsed()); - // Loop through the entries and send when the desired batch size is hit. for (const smbprovider::DirectoryEntryProto& entry : entries.entries()) { entry_list.emplace_back(base::FilePath(entry.name()), @@ -821,10 +809,6 @@ std::move(metrics_timer)); return; } - - // Read Directory is complete, record metrics. - RecordReadDirectoryCount(entries_count); - RecordReadDirectoryDuration(metrics_timer.Elapsed()); } AbortCallback SmbFileSystem::HandleSyncRedundantGetMetadata(
diff --git a/chrome/browser/extensions/api/automation/automation_apitest.cc b/chrome/browser/extensions/api/automation/automation_apitest.cc index 515b4629..a626e913 100644 --- a/chrome/browser/extensions/api/automation/automation_apitest.cc +++ b/chrome/browser/extensions/api/automation/automation_apitest.cc
@@ -4,11 +4,13 @@ #include "base/command_line.h" #include "base/files/file_path.h" +#include "base/json/json_reader.h" #include "base/location.h" #include "base/path_service.h" #include "base/single_thread_task_runner.h" #include "base/strings/string_number_conversions.h" #include "base/test/scoped_feature_list.h" +#include "base/test/trace_event_analyzer.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" #include "chrome/browser/extensions/extension_apitest.h" @@ -21,6 +23,7 @@ #include "content/public/browser/ax_event_notification_details.h" #include "content/public/browser/render_widget_host.h" #include "content/public/browser/render_widget_host_view.h" +#include "content/public/browser/tracing_controller.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_features.h" #include "content/public/test/browser_test.h" @@ -473,6 +476,73 @@ << message_; } +IN_PROC_BROWSER_TEST_F(AutomationApiTest, TextareaAppendPerf) { + StartEmbeddedTestServer(); + + { + base::RunLoop wait_for_tracing; + content::TracingController::GetInstance()->StartTracing( + base::trace_event::TraceConfig( + R"({"included_categories": ["accessibility"])"), + wait_for_tracing.QuitClosure()); + wait_for_tracing.Run(); + } + + ASSERT_TRUE( + RunExtensionSubtest("automation/tests/tabs", "textarea_append_perf.html")) + << message_; + + std::string trace_output; + { + base::RunLoop wait_for_tracing; + content::TracingController::GetInstance()->StopTracing( + content::TracingController::CreateStringEndpoint(base::BindOnce( + [](base::OnceClosure quit_closure, std::string* output, + std::unique_ptr<std::string> trace_str) { + *output = *trace_str; + std::move(quit_closure).Run(); + }, + wait_for_tracing.QuitClosure(), &trace_output))); + wait_for_tracing.Run(); + } + + base::Optional<base::Value> trace_data = base::JSONReader::Read(trace_output); + ASSERT_TRUE(trace_data); + + const base::Value* trace_events = trace_data->FindListKey("traceEvents"); + ASSERT_TRUE(trace_events && trace_events->is_list()); + + int renderer_total_dur = 0; + int automation_total_dur = 0; + for (const base::Value& event : trace_events->GetList()) { + const std::string* cat = event.FindStringKey("cat"); + if (!cat || *cat != "accessibility") + continue; + + const std::string* name = event.FindStringKey("name"); + if (!name) + continue; + + base::Optional<int> dur = event.FindIntKey("dur"); + if (!dur) + continue; + + if (*name == "AutomationAXTreeWrapper::OnAccessibilityEvents") + automation_total_dur += *dur; + else if (*name == "RenderAccessibilityImpl::SendPendingAccessibilityEvents") + renderer_total_dur += *dur; + } + + ASSERT_GT(automation_total_dur, 0); + ASSERT_GT(renderer_total_dur, 0); + LOG(INFO) << "Total duration in automation: " << automation_total_dur; + LOG(INFO) << "Total duration in renderer: " << renderer_total_dur; + + // Assert that the time spent in automation isn't more than 2x + // the time spent in the renderer code. + ASSERT_LT(automation_total_dur, renderer_total_dur * 2); +} + #endif // defined(OS_CHROMEOS) } // namespace extensions
diff --git a/chrome/browser/extensions/extension_navigation_throttle_unittest.cc b/chrome/browser/extensions/extension_navigation_throttle_unittest.cc index c5387dc..07ac81c 100644 --- a/chrome/browser/extensions/extension_navigation_throttle_unittest.cc +++ b/chrome/browser/extensions/extension_navigation_throttle_unittest.cc
@@ -157,16 +157,12 @@ ASSERT_EQ(1u, entries.size()); EXPECT_EQ(source_id, entries[0].source); ASSERT_EQ(1u, entries[0].metrics.size()); - EXPECT_EQ( - blink::IdentifiableSurface::FromTypeAndInput( - blink::IdentifiableSurface::Type::kExtensionFileAccess, - blink::IdentifiabilityDigestOfBytes(base::as_bytes(base::make_span( - ExtensionSet::GetExtensionIdByURL(extension_url))))) - .ToUkmMetricHash(), - entries[0].metrics[0].surface.ToUkmMetricHash()); - EXPECT_EQ( - blink::IdentifiabilityDigestHelper(expected), - static_cast<uint64_t>(entries[0].metrics[0].value.ToUkmMetricValue())); + EXPECT_EQ(blink::IdentifiableSurface::FromTypeAndToken( + blink::IdentifiableSurface::Type::kExtensionFileAccess, + base::as_bytes(base::make_span( + ExtensionSet::GetExtensionIdByURL(extension_url)))), + entries[0].metrics[0].surface); + EXPECT_EQ(blink::IdentifiableToken(expected), entries[0].metrics[0].value); } private:
diff --git a/chrome/browser/extensions/extension_protocols_unittest.cc b/chrome/browser/extensions/extension_protocols_unittest.cc index 50201e03..e56815b0 100644 --- a/chrome/browser/extensions/extension_protocols_unittest.cc +++ b/chrome/browser/extensions/extension_protocols_unittest.cc
@@ -321,15 +321,11 @@ ASSERT_EQ(1u, entries.size()); EXPECT_EQ(test_ukm_id_, entries[0].source); ASSERT_EQ(1u, entries[0].metrics.size()); - EXPECT_EQ(blink::IdentifiableSurface::FromTypeAndInput( + EXPECT_EQ(blink::IdentifiableSurface::FromTypeAndToken( blink::IdentifiableSurface::Type::kExtensionFileAccess, - blink::IdentifiabilityDigestOfBytes( - base::as_bytes(base::make_span(extension->id())))) - .ToUkmMetricHash(), - entries[0].metrics[0].surface.ToUkmMetricHash()); - EXPECT_EQ( - blink::IdentifiabilityDigestHelper(expected), - static_cast<uint64_t>(entries[0].metrics[0].value.ToUkmMetricValue())); + base::as_bytes(base::make_span(extension->id()))), + entries[0].metrics[0].surface); + EXPECT_EQ(blink::IdentifiableToken(expected), entries[0].metrics[0].value); } protected:
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 783b5bf6..e4478c8 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -4588,6 +4588,11 @@ "expiry_milestone": 90 }, { + "name": "vm-camera-mic-indicators-and-notifications", + "owners": [ "lxj", "joelhockey", "timloh" ], + "expiry_milestone": 90 + }, + { "name": "wallet-service-use-sandbox", "owners": [ "jsaul@google.com", "payments-autofill-team@google.com" ], // This flag is used by testing teams to run Google Payments calls against
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 39009ac..ccfdb997 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -4394,6 +4394,11 @@ "Always show virtual keyboard regardless of having a physical keyboard " "present"; +const char kVmCameraMicIndicatorsAndNotificationsName[] = + "VM camera/mic indicators/notifications"; +const char kVmCameraMicIndicatorsAndNotificationsDescription[] = + "Show VM camera/mic indicators/notifications"; + const char kWifiSyncAndroidName[] = "Sync Wi-Fi network configurations with Android"; const char kWifiSyncAndroidDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 12bbe90c..d2699ef 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -2556,6 +2556,9 @@ extern const char kVirtualKeyboardName[]; extern const char kVirtualKeyboardDescription[]; +extern const char kVmCameraMicIndicatorsAndNotificationsName[]; +extern const char kVmCameraMicIndicatorsAndNotificationsDescription[]; + extern const char kWifiSyncAndroidName[]; extern const char kWifiSyncAndroidDescription[];
diff --git a/chrome/browser/history/history_tab_helper.cc b/chrome/browser/history/history_tab_helper.cc index 7c936dd..6c7b318 100644 --- a/chrome/browser/history/history_tab_helper.cc +++ b/chrome/browser/history/history_tab_helper.cc
@@ -10,11 +10,13 @@ #include "base/stl_util.h" #include "build/build_config.h" #include "chrome/browser/history/history_service_factory.h" +#include "chrome/browser/prerender/prerender_manager_factory.h" #include "chrome/browser/profiles/profile.h" #include "components/history/content/browser/history_context_helper.h" #include "components/history/core/browser/history_constants.h" #include "components/history/core/browser/history_service.h" #include "components/ntp_snippets/features.h" +#include "components/prerender/browser/prerender_manager.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/render_frame_host.h" @@ -41,8 +43,7 @@ HistoryTabHelper::HistoryTabHelper(WebContents* web_contents) : content::WebContentsObserver(web_contents) {} -HistoryTabHelper::~HistoryTabHelper() { -} +HistoryTabHelper::~HistoryTabHelper() {} void HistoryTabHelper::UpdateHistoryForNavigation( const history::HistoryAddPageArgs& add_page_args) { @@ -51,8 +52,7 @@ hs->AddPage(add_page_args); } -history::HistoryAddPageArgs -HistoryTabHelper::CreateHistoryAddPageArgs( +history::HistoryAddPageArgs HistoryTabHelper::CreateHistoryAddPageArgs( const GURL& virtual_url, base::Time timestamp, int nav_entry_id, @@ -133,6 +133,17 @@ if (navigation_handle->GetWebContents()->IsPortal()) return; + // Prerenders should not update history. Prerenders will have their own + // WebContents with all observers (including |this|), and go through the + // normal flow of a navigation, including commit. + prerender::PrerenderManager* prerender_manager = + prerender::PrerenderManagerFactory::GetForBrowserContext( + web_contents()->GetBrowserContext()); + if (prerender_manager && + prerender_manager->IsWebContentsPrerendering(web_contents())) { + return; + } + // Most of the time, the displayURL matches the loaded URL, but for about: // URLs, we use a data: URL as the real value. We actually want to save the // about: URL to the history db and keep the data: URL hidden. This is what
diff --git a/chrome/browser/payments/android/service_worker_payment_app_bridge.cc b/chrome/browser/payments/android/service_worker_payment_app_bridge.cc index 8cdceb8..53161f31 100644 --- a/chrome/browser/payments/android/service_worker_payment_app_bridge.cc +++ b/chrome/browser/payments/android/service_worker_payment_app_bridge.cc
@@ -121,16 +121,35 @@ static void JNI_ServiceWorkerPaymentAppBridge_OnClosingPaymentAppWindow( JNIEnv* env, - const JavaParamRef<jobject>& jweb_contents, + const JavaParamRef<jobject>& payment_request_jweb_contents, jint reason) { - content::WebContents* web_contents = - content::WebContents::FromJavaWebContents(jweb_contents); - DCHECK(web_contents); // Verified in Java before invoking this function. - content::PaymentAppProvider::GetOrCreateForWebContents(web_contents) + content::WebContents* payment_request_web_contents = + content::WebContents::FromJavaWebContents(payment_request_jweb_contents); + DCHECK(payment_request_web_contents); // Verified in Java before invoking + // this function. + content::PaymentAppProvider::GetOrCreateForWebContents( + payment_request_web_contents) ->OnClosingOpenedWindow( static_cast<payments::mojom::PaymentEventResponseType>(reason)); } +static void JNI_ServiceWorkerPaymentAppBridge_OnOpeningPaymentAppWindow( + JNIEnv* env, + const JavaParamRef<jobject>& payment_request_jweb_contents, + const JavaParamRef<jobject>& payment_handler_jweb_contents) { + content::WebContents* payment_request_web_contents = + content::WebContents::FromJavaWebContents(payment_request_jweb_contents); + content::WebContents* payment_handler_web_contents = + content::WebContents::FromJavaWebContents(payment_handler_jweb_contents); + DCHECK(payment_request_web_contents); // Verified in Java before invoking + // this function. + DCHECK(payment_handler_web_contents); // Verified in Java before invoking + // this function. + content::PaymentAppProvider::GetOrCreateForWebContents( + payment_request_web_contents) + ->SetOpenedWindow(payment_handler_web_contents); +} + static jlong JNI_ServiceWorkerPaymentAppBridge_GetSourceIdForPaymentAppFromScope( JNIEnv* env,
diff --git a/chrome/browser/prerender/isolated/isolated_prerender_browsertest.cc b/chrome/browser/prerender/isolated/isolated_prerender_browsertest.cc index 99f58a9c..8fd76a9a 100644 --- a/chrome/browser/prerender/isolated/isolated_prerender_browsertest.cc +++ b/chrome/browser/prerender/isolated/isolated_prerender_browsertest.cc
@@ -13,6 +13,7 @@ #include "base/containers/unique_ptr_adapters.h" #include "base/optional.h" #include "base/run_loop.h" +#include "base/stl_util.h" #include "base/strings/string_split.h" #include "base/strings/utf_string_conversions.h" #include "base/test/metrics/histogram_tester.h" @@ -23,6 +24,8 @@ #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.h" #include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings_factory.h" +#include "chrome/browser/history/history_service_factory.h" +#include "chrome/browser/history/history_test_utils.h" #include "chrome/browser/navigation_predictor/navigation_predictor_keyed_service.h" #include "chrome/browser/navigation_predictor/navigation_predictor_keyed_service_factory.h" #include "chrome/browser/net/profile_network_context_service.h" @@ -2342,6 +2345,9 @@ ui_test_utils::NavigateToURL(browser(), starting_page); WaitForUpdatedCustomProxyConfig(); + ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( + browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS)); + IsolatedPrerenderTabHelper* tab_helper = IsolatedPrerenderTabHelper::FromWebContents(GetWebContents()); @@ -2373,6 +2379,11 @@ // This run loop will quit when a NSP finishes. nsp_run_loop.Run(); + // Regression test for crbug/1131712. + WaitForHistoryBackendToRun(browser()->profile()); + ui_test_utils::HistoryEnumerator enumerator(browser()->profile()); + EXPECT_FALSE(base::Contains(enumerator.urls(), eligible_link)); + std::vector<net::test_server::HttpRequest> origin_requests_after_prerender = origin_server_requests(); std::vector<net::test_server::HttpRequest> proxy_requests_after_prerender =
diff --git a/chrome/browser/resources/chromeos/login/BUILD.gn b/chrome/browser/resources/chromeos/login/BUILD.gn index 5300a1f6..f803539 100644 --- a/chrome/browser/resources/chromeos/login/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/BUILD.gn
@@ -111,6 +111,8 @@ js_library("demo_setup") { deps = [ + "components:login_screen_behavior", + "components:multi_step_behavior", "components:oobe_dialog_host_behavior", "components:oobe_i18n_behavior", ]
diff --git a/chrome/browser/resources/chromeos/login/debug/debug.js b/chrome/browser/resources/chromeos/login/debug/debug.js index 40c072c..d6ac6ee4 100644 --- a/chrome/browser/resources/chromeos/login/debug/debug.js +++ b/chrome/browser/resources/chromeos/login/debug/debug.js
@@ -234,9 +234,16 @@ id: 'demo-setup', kind: ScreenKind.OTHER, suffix: 'demo', + handledSteps: 'progress,error', states: [ { - id: 'progress', + id: 'download-resources', + trigger: (screen) => { + screen.setCurrentSetupStep('downloadResources'); + }, + }, + { + id: 'enrollment', trigger: (screen) => { screen.setCurrentSetupStep('enrollment'); },
diff --git a/chrome/browser/resources/chromeos/login/demo_setup.html b/chrome/browser/resources/chromeos/login/demo_setup.html index cd73511..14a637a 100644 --- a/chrome/browser/resources/chromeos/login/demo_setup.html +++ b/chrome/browser/resources/chromeos/login/demo_setup.html
@@ -1,10 +1,10 @@ -<dom-module id="demo-setup-md"> +<dom-module id="demo-setup"> <template> <style include="oobe-dialog-host"></style> <link rel="stylesheet" href="demo_setup.css"> - <oobe-dialog id="demoSetupProgressDialog" role="dialog" has-buttons hidden - title-key="demoSetupProgressScreenTitle"> + <oobe-dialog id="demoSetupProgressDialog" role="dialog" has-buttons + title-key="demoSetupProgressScreenTitle" for-step="progress"> <hd-iron-icon slot="oobe-icon" icon1x="oobe-32:computer" icon2x="oobe-64:computer"> </hd-iron-icon> @@ -34,9 +34,9 @@ </div> </oobe-dialog> - <oobe-dialog id="demoSetupErrorDialog" role="dialog" has-buttons hidden + <oobe-dialog id="demoSetupErrorDialog" role="dialog" has-buttons aria-label$="[[i18nDynamic(locale, 'demoSetupErrorScreenTitle')]]" - title-key="demoSetupErrorScreenTitle"> + title-key="demoSetupErrorScreenTitle" for-step="error"> <hd-iron-icon slot="oobe-icon" icon1x="oobe-32:computer" icon2x="oobe-64:computer"> </hd-iron-icon>
diff --git a/chrome/browser/resources/chromeos/login/demo_setup.js b/chrome/browser/resources/chromeos/login/demo_setup.js index d755964c..ff1c0f9 100644 --- a/chrome/browser/resources/chromeos/login/demo_setup.js +++ b/chrome/browser/resources/chromeos/login/demo_setup.js
@@ -7,10 +7,30 @@ * screen. */ -Polymer({ - is: 'demo-setup-md', +'use strict'; - behaviors: [OobeI18nBehavior, OobeDialogHostBehavior], +(function() { + +/** + * UI mode for the dialog. + * @enum {string} + */ +const UIState = { + PROGRESS: 'progress', + ERROR: 'error', +}; + +Polymer({ + is: 'demo-setup', + + behaviors: [ + OobeI18nBehavior, + OobeDialogHostBehavior, + LoginScreenBehavior, + MultiStepBehavior, + ], + + EXTERNAL_API: ['setCurrentSetupStep', 'onSetupSucceeded', 'onSetupFailed'], properties: { /** Object mapping step strings to step indices */ @@ -39,15 +59,6 @@ value: false, }, - /** Ordered array of screen ids that are a part of demo setup flow. */ - screens_: { - type: Array, - readonly: true, - value() { - return ['demoSetupProgressDialog', 'demoSetupErrorDialog']; - }, - }, - /** Feature flag to display progress bar instead of spinner during setup. */ showStepsInDemoModeSetup_: { type: Boolean, @@ -58,10 +69,26 @@ } }, + defaultUIStep() { + return UIState.PROGRESS; + }, + + UI_STEPS: UIState, + + ready() { + this.initializeLoginScreen('DemoSetupScreen', { + resetAllowed: false, + }); + }, + + onBeforeShow() { + this.reset(); + }, + /** Resets demo setup flow to the initial screen and starts setup. */ reset() { - this.showScreen_('demoSetupProgressDialog'); - chrome.send('login.DemoSetupScreen.userActed', ['start-setup']); + this.setUIStep(UIState.PROGRESS); + this.userActed('start-setup'); }, /** Called after resources are updated. */ @@ -94,41 +121,7 @@ onSetupFailed(message, isPowerwashRequired) { this.errorMessage_ = message; this.isPowerwashRequired_ = isPowerwashRequired; - this.showScreen_('demoSetupErrorDialog'); - }, - - /** - * Shows screen with the given id. Method exposed for testing environment. - * @param {string} id Screen id. - */ - showScreenForTesting(id) { - this.showScreen_(id); - }, - - /** - * Shows screen with the given id. - * @param {string} id Screen id. - * @private - */ - showScreen_(id) { - this.hideScreens_(); - - var screen = this.$[id]; - assert(screen); - screen.hidden = false; - screen.show(); - }, - - /** - * Hides all screens to help switching from one screen to another. - * @private - */ - hideScreens_() { - for (let id of this.screens_) { - var screen = this.$[id]; - assert(screen); - screen.hidden = true; - } + this.setUIStep(UIState.ERROR); }, /** @@ -144,7 +137,7 @@ * @private */ onPowerwashClicked_() { - chrome.send('login.DemoSetupScreen.userActed', ['powerwash']); + this.userActed('powerwash'); }, /** @@ -155,7 +148,7 @@ // TODO(wzang): Remove this after crbug.com/900640 is fixed. if (this.isPowerwashRequired_) return; - chrome.send('login.DemoSetupScreen.userActed', ['close-setup']); + this.userActed('close-setup'); }, /** @@ -189,4 +182,6 @@ stepIsCompleted_(stepName, setupSteps, currentStepIndex) { return currentStepIndex > setupSteps[stepName]; }, + }); +})();
diff --git a/chrome/browser/resources/chromeos/login/oobe.js b/chrome/browser/resources/chromeos/login/oobe.js index dc91299..e6af9ac 100644 --- a/chrome/browser/resources/chromeos/login/oobe.js +++ b/chrome/browser/resources/chromeos/login/oobe.js
@@ -33,7 +33,6 @@ // <include src="../../gaia_auth_host/authenticator.js"> // <include src="oobe_screen_auto_enrollment_check.js"> -// <include src="oobe_screen_demo_setup.js"> // <include src="oobe_screen_demo_preferences.js"> // <include src="oobe_screen_enable_debugging.js"> // <include src="multi_tap_detector.js"> @@ -55,7 +54,6 @@ login.ArcTermsOfServiceScreen.register(); login.AppLaunchSplashScreen.register(); login.FatalErrorScreen.register(); - login.DemoSetupScreen.register(); login.DemoPreferencesScreen.register(); login.DiscoverScreen.register(); login.AssistantOptInFlowScreen.register();
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_demo_setup.html b/chrome/browser/resources/chromeos/login/oobe_screen_demo_setup.html deleted file mode 100644 index 42ff9cc..0000000 --- a/chrome/browser/resources/chromeos/login/oobe_screen_demo_setup.html +++ /dev/null
@@ -1,3 +0,0 @@ -<div class="step hidden right" id="demo-setup" role="group" hidden> - <demo-setup-md id="demo-setup-content"></demo-setup-md> -</div> \ No newline at end of file
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_demo_setup.js b/chrome/browser/resources/chromeos/login/oobe_screen_demo_setup.js deleted file mode 100644 index fecae8e..0000000 --- a/chrome/browser/resources/chromeos/login/oobe_screen_demo_setup.js +++ /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. - -/** - * @fileoverview Demo mode setup screen implementation. - */ - -login.createScreen('DemoSetupScreen', 'demo-setup', function() { - return { - EXTERNAL_API: ['setCurrentSetupStep', 'onSetupSucceeded', 'onSetupFailed'], - - /** - * Demo setup module. - * @private - */ - demoSetupModule_: null, - - - /** @override */ - decorate() { - this.demoSetupModule_ = $('demo-setup-content'); - }, - - /** Returns a control which should receive an initial focus. */ - get defaultControl() { - return this.demoSetupModule_; - }, - - /** Called after resources are updated. */ - updateLocalizedContent() { - this.demoSetupModule_.updateLocalizedContent(); - }, - - /** @override */ - onBeforeShow() { - this.demoSetupModule_.reset(); - }, - - /** - * Called at the beginning of a setup step. - * @param {number} currentStepIndex - */ - setCurrentSetupStep(currentStepIndex) { - this.demoSetupModule_.setCurrentSetupStep(currentStepIndex); - }, - - /** Called when demo mode setup succeeded. */ - onSetupSucceeded() { - this.demoSetupModule_.onSetupSucceeded(); - }, - - /** - * Called when demo mode setup failed. - * @param {string} message Error message to be displayed to the user. - * @param {boolean} isPowerwashRequired Whether powerwash is required to - * recover from the error. - */ - onSetupFailed(message, isPowerwashRequired) { - this.demoSetupModule_.onSetupFailed(message, isPowerwashRequired); - }, - }; -});
diff --git a/chrome/browser/resources/chromeos/login/structure/screens_oobe.html b/chrome/browser/resources/chromeos/login/structure/screens_oobe.html index d7899dc..842e7ba 100644 --- a/chrome/browser/resources/chromeos/login/structure/screens_oobe.html +++ b/chrome/browser/resources/chromeos/login/structure/screens_oobe.html
@@ -10,7 +10,7 @@ <hid-detection id="hid-detection" class="step hidden"> </hid-detection> <include src="../oobe_screen_enable_debugging.html"> -<include src="../oobe_screen_demo_setup.html"> +<demo-setup id="demo-setup" class="step hidden" hidden></demo-setup> <oobe-network id="network-selection" class="step hidden" hidden> </oobe-network> <oobe-eula-md id="oobe-eula-md" class="step hidden" hidden></oobe-eula-md>
diff --git a/chrome/browser/resources/device_log_ui/device_log_ui.html b/chrome/browser/resources/device_log_ui/device_log_ui.html index 1360c4d..49c93f9 100644 --- a/chrome/browser/resources/device_log_ui/device_log_ui.html +++ b/chrome/browser/resources/device_log_ui/device_log_ui.html
@@ -68,6 +68,10 @@ <input id="log-type-fido" type="checkbox"> <span>$i18n{logTypeFidoText}</span> </label> + <label> + <input id="log-type-serial" type="checkbox"> + <span>$i18n{logTypeSerialText}</span> + </label> </div> <div id="log-container"></div> </body>
diff --git a/chrome/browser/resources/print_preview/data/printer_status_cros.js b/chrome/browser/resources/print_preview/data/printer_status_cros.js index 88b0ff87..0a8ac4a0 100644 --- a/chrome/browser/resources/print_preview/data/printer_status_cros.js +++ b/chrome/browser/resources/print_preview/data/printer_status_cros.js
@@ -1,6 +1,7 @@ // Copyright 2020 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 {assertNotReached} from 'chrome://resources/js/assert.m.js'; /** * These values must be kept in sync with the Reason enum in @@ -139,4 +140,21 @@ return PrinterState.GOOD; } return PrinterState.ERROR; +} + +/** + * @param {?PrinterStatusReason} printerStatusReason + * @return {string} + */ +export function getPrinterStatusIcon(printerStatusReason) { + switch (computePrinterState(printerStatusReason)) { + case PrinterState.GOOD: + return 'print-preview:printer-status-green'; + case PrinterState.ERROR: + return 'print-preview:printer-status-red'; + case PrinterState.UNKNOWN: + return 'print-preview:printer-status-grey'; + default: + assertNotReached(); + } } \ No newline at end of file
diff --git a/chrome/browser/resources/print_preview/ui/destination_dropdown_cros.html b/chrome/browser/resources/print_preview/ui/destination_dropdown_cros.html index cb2b3b2..64b1c1d5 100644 --- a/chrome/browser/resources/print_preview/ui/destination_dropdown_cros.html +++ b/chrome/browser/resources/print_preview/ui/destination_dropdown_cros.html
@@ -104,14 +104,7 @@ aria-description$="[[destinationStatusText]]"> <div id="destination-display-container"> <div id="destination-icon-box"> - <iron-icon icon="[[destinationIcon]]" - hidden="[[isCurrentDestinationCrosLocal]]"> - </iron-icon> - <printer-status-icon-cros id="destination-badge" - hidden="[[!isCurrentDestinationCrosLocal]]" - icon-location="[[IconLocation.DISPLAY]]" - printer-state="[[computePrinterState_( value.printerStatusReason)]]"> - </printer-status-icon-cros> + <iron-icon icon="[[destinationIcon]]"></iron-icon> </div> <div id="destination-display" title="[[value.displayName]]"> [[value.displayName]] @@ -131,11 +124,9 @@ highlightedIndex_)]]" aria-description$="[[getPrinterStatusErrorString_( item.printerStatusReason)]]"> - <printer-status-icon-cros icon-location="[[IconLocation.DROPDOWN]]" - printer-state="[[computePrinterState_( - item.printerStatusReason)]]" - class$="[[getHighlightedClass_(item.key, highlightedIndex_)]]"> - </printer-status-icon-cros> + <iron-icon icon="[[getPrinterStatusIcon_( + item.printerStatusReason)]]"> + </iron-icon> <span class="printer-display-name">[[item.displayName]]</span> </button> </template>
diff --git a/chrome/browser/resources/print_preview/ui/destination_dropdown_cros.js b/chrome/browser/resources/print_preview/ui/destination_dropdown_cros.js index d519d24..bdd1551 100644 --- a/chrome/browser/resources/print_preview/ui/destination_dropdown_cros.js +++ b/chrome/browser/resources/print_preview/ui/destination_dropdown_cros.js
@@ -9,13 +9,12 @@ import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import './print_preview_vars_css.js'; -import './printer_status_icon_cros.js'; import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js'; import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {Destination, DestinationOrigin} from '../data/destination.js'; -import {computePrinterState, ERROR_STRING_KEY_MAP, IconLocation, PrinterState, PrinterStatusReason} from '../data/printer_status_cros.js'; +import {ERROR_STRING_KEY_MAP, getPrinterStatusIcon, PrinterStatusReason} from '../data/printer_status_cros.js'; Polymer({ is: 'print-preview-destination-dropdown-cros', @@ -52,17 +51,12 @@ destinationIcon: String, - isCurrentDestinationCrosLocal: Boolean, - /** * Index of the highlighted item in the dropdown. * @private */ highlightedIndex_: Number, - /** Mirroring the enum so that it can be used from HTML bindings. */ - IconLocation: Object, - /** @private */ dropdownLength_: { type: Number, @@ -80,7 +74,6 @@ /** @override */ attached() { this.updateTabIndex_(); - this.IconLocation = IconLocation; }, /** @@ -261,15 +254,6 @@ }, /** - * @param {?PrinterStatusReason} printerStatusReason - * @return {number} - * @private - */ - computePrinterState_(printerStatusReason) { - return computePrinterState(printerStatusReason); - }, - - /** * Sets tabindex to -1 when dropdown is disabled to prevent the dropdown from * being focusable. * @private @@ -340,4 +324,13 @@ const errorStringKey = ERROR_STRING_KEY_MAP.get(printerStatusReason); return errorStringKey ? this.i18n(errorStringKey) : ''; }, + + /** + * @param {!PrinterStatusReason} printerStatusReason + * @return {string} + * @private + */ + getPrinterStatusIcon_(printerStatusReason) { + return getPrinterStatusIcon(printerStatusReason); + } });
diff --git a/chrome/browser/resources/print_preview/ui/destination_list_item.html b/chrome/browser/resources/print_preview/ui/destination_list_item.html index 087535b..77ff3c74 100644 --- a/chrome/browser/resources/print_preview/ui/destination_list_item.html +++ b/chrome/browser/resources/print_preview/ui/destination_list_item.html
@@ -67,23 +67,12 @@ } <if expr="chromeos"> - printer-status-icon-cros { - padding-inline-end: 12px; - } - :host([is-destination-cros-local_]) .connection-status { color: var(--google-red-600); } </if> </style> - <iron-icon icon$="[[destination.icon]]" - hidden="[[isDestinationCrosLocal_]]"> - </iron-icon> -<if expr="chromeos"> - <printer-status-icon-cros icon-location="[[iconLocation_.DROPDOWN]]" - printer-state="[[printerState_]]" hidden="[[!isDestinationCrosLocal_]]"> - </printer-status-icon-cros> -</if> + <iron-icon icon="[[destinationIcon_]]"></iron-icon> <span class="name searchable">[[destination.displayName]]</span> <span class="search-hint searchable" hidden="[[!searchHint_]]"> [[searchHint_]]
diff --git a/chrome/browser/resources/print_preview/ui/destination_list_item.js b/chrome/browser/resources/print_preview/ui/destination_list_item.js index 1fbae47..9077750 100644 --- a/chrome/browser/resources/print_preview/ui/destination_list_item.js +++ b/chrome/browser/resources/print_preview/ui/destination_list_item.js
@@ -8,9 +8,6 @@ import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import './icons.js'; import './print_preview_vars_css.js'; -// <if expr="chromeos"> -import './printer_status_icon_cros.js'; -// </if> import '../strings.m.js'; import {assert} from 'chrome://resources/js/assert.m.js'; @@ -22,7 +19,7 @@ import {Destination, DestinationOrigin} from '../data/destination.js'; // <if expr="chromeos"> -import {computePrinterState, ERROR_STRING_KEY_MAP, IconLocation, PrinterState, PrinterStatusReason} from '../data/printer_status_cros.js'; +import {ERROR_STRING_KEY_MAP, getPrinterStatusIcon, PrinterStatusReason} from '../data/printer_status_cros.js'; // </if> import {updateHighlights} from './highlight_utils.js'; @@ -54,6 +51,13 @@ searchQuery: Object, /** @private */ + destinationIcon_: { + type: String, + computed: 'computeDestinationIcon_(destination, ' + + 'destination.printerStatusReason)', + }, + + /** @private */ stale_: { type: Boolean, reflectToAttribute: true, @@ -63,21 +67,21 @@ searchHint_: String, /** @private */ + statusText_: { + type: String, + computed: + 'computeStatusText_(destination, destination.printerStatusReason)', + }, + + // <if expr="chromeos"> + /** @private */ isDestinationCrosLocal_: { type: Boolean, computed: 'computeIsDestinationCrosLocal_(destination)', reflectToAttribute: true, }, - /** @private */ - statusText_: { - type: String, - computed: - 'computeStatusText_(destination, destination.printerStatusReason,' + - 'isDestinationCrosLocal_)', - }, - // <if expr="chromeos"> /** @private {!DestinationConfigStatus} */ configurationStatus_: { type: Number, @@ -88,15 +92,6 @@ * Mirroring the enum so that it can be used from HTML bindings. * @private */ - iconLocation_: { - type: Object, - value: IconLocation, - }, - - /** - * Mirroring the enum so that it can be used from HTML bindings. - * @private - */ statusEnum_: { type: Object, value: DestinationConfigStatus, @@ -110,12 +105,6 @@ }, readOnly: true, }, - - /** @private */ - printerState_: { - type: Number, - value: PrinterState.UNKNOWN, - } // </if> }, @@ -209,26 +198,6 @@ }, /** - * True when the destination is a CrOS local printer. - * @return {boolean} - * @private - */ - computeIsDestinationCrosLocal_: function() { - if (!isChromeOS) { - return false; - } - - // <if expr="chromeos"> - if (!this.printerStatusFlagEnabled_) { - return false; - } - - return this.destination && - this.destination.origin === DestinationOrigin.CROS; - // </if> - }, - - /** * @return {string} If the destination is a local CrOS printer, this returns * the error text associated with the printer status. For all other * printers this returns the connection status text. @@ -240,7 +209,8 @@ } // <if expr="chromeos"> - if (this.isDestinationCrosLocal_) { + if (this.printerStatusFlagEnabled_ && + this.destination.origin === DestinationOrigin.CROS) { const printerStatusReason = this.destination.printerStatusReason; if (!printerStatusReason || printerStatusReason === PrinterStatusReason.NO_ERROR || @@ -258,7 +228,40 @@ ''; }, + /** + * @return {string} + * @private + */ + computeDestinationIcon_: function() { + if (!this.destination) { + return ''; + } + + // <if expr="chromeos"> + if (this.printerStatusFlagEnabled_ && + this.destination.origin === DestinationOrigin.CROS) { + return getPrinterStatusIcon(this.destination.printerStatusReason); + } + // </if> + + return this.destination.icon; + }, + // <if expr="chromeos"> + /** + * True when the destination is a CrOS local printer. + * @return {boolean} + * @private + */ + computeIsDestinationCrosLocal_: function() { + if (!this.printerStatusFlagEnabled_) { + return false; + } + + return this.destination && + this.destination.origin === DestinationOrigin.CROS; + }, + /** @private */ requestPrinterStatus_() { if (!this.printerStatusFlagEnabled_) { @@ -280,9 +283,7 @@ */ onPrinterStatusReceived_(destinationKey) { if (this.destination.key === destinationKey) { - this.printerState_ = - computePrinterState(this.destination.printerStatusReason); - // Notify printerStatusReason to trigger |statusText_| update. + // Notify printerStatusReason to trigger icon and status text update. this.notifyPath(`destination.printerStatusReason`); } },
diff --git a/chrome/browser/resources/print_preview/ui/destination_select_cros.html b/chrome/browser/resources/print_preview/ui/destination_select_cros.html index 5d53269..8539140 100644 --- a/chrome/browser/resources/print_preview/ui/destination_select_cros.html +++ b/chrome/browser/resources/print_preview/ui/destination_select_cros.html
@@ -49,7 +49,6 @@ no-destinations="[[noDestinations]]" pdf-printer-disabled="[[pdfPrinterDisabled]]" destination-icon="[[destinationIcon_]]" disabled="[[disabled]]" - is-current-destination-cros-local="[[isCurrentDestinationCrosLocal_]]" on-dropdown-value-selected="onDropdownValueSelected_" destination-status-text="[[statusText_]]"> </print-preview-destination-dropdown-cros>
diff --git a/chrome/browser/resources/print_preview/ui/destination_select_cros.js b/chrome/browser/resources/print_preview/ui/destination_select_cros.js index 439dab4f..cee3c311 100644 --- a/chrome/browser/resources/print_preview/ui/destination_select_cros.js +++ b/chrome/browser/resources/print_preview/ui/destination_select_cros.js
@@ -22,7 +22,7 @@ import {Base, html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {CloudOrigins, Destination, DestinationOrigin, PDF_DESTINATION_KEY, RecentDestination, SAVE_TO_DRIVE_CROS_DESTINATION_KEY} from '../data/destination.js'; -import {ERROR_STRING_KEY_MAP, getStatusReasonFromPrinterStatus, PrinterStatus, PrinterStatusReason, PrinterStatusSeverity} from '../data/printer_status_cros.js'; +import {ERROR_STRING_KEY_MAP, getPrinterStatusIcon, PrinterStatusReason} from '../data/printer_status_cros.js'; import {getSelectDropdownBackground} from '../print_preview_utils.js'; import {SelectBehavior} from './select_behavior.js'; @@ -87,7 +87,8 @@ /** @private {string} */ destinationIcon_: { type: String, - computed: 'computeDestinationIcon_(selectedValue, destination)', + computed: + 'computeDestinationIcon_(selectedValue, destination, destination.printerStatusReason)', }, /** @private */ @@ -155,6 +156,11 @@ // If the destination matches the selected value, pull the icon from the // destination. if (this.destination && this.destination.key === this.selectedValue) { + if (this.printerStatusFlagEnabled_ && + this.isCurrentDestinationCrosLocal_) { + return getPrinterStatusIcon(this.destination.printerStatusReason); + } + return this.destination.icon; }
diff --git a/chrome/browser/resources/print_preview/ui/icons.html b/chrome/browser/resources/print_preview/ui/icons.html index bfa7a18..faa0f28c 100644 --- a/chrome/browser/resources/print_preview/ui/icons.html +++ b/chrome/browser/resources/print_preview/ui/icons.html
@@ -32,6 +32,21 @@ <path d="M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-8.5 11l-1.1-2.14 2.84-4.96 1.5 2.66L12.25 17h-.75zm6.8 0h-5.55l1.4-2.5h5.11l.26.46L18.3 17zm-4.55-8h2.39l2.84 5h-2.93l-2.56-4.54.26-.46z"></path> </g> + <if expr="chromeos"> + <g id="printer-status-green"> + <path d="M19,8 C20.66,8 22,9.34 22,11 L22,11 L22.0008411,12.1834702 C20.9260374,10.5660653 19.0875152,9.5 17,9.5 C14.2041481,9.5 11.8549346,11.412286 11.1889599,14.0002575 L8,14 L8,19 L12.1267078,19.0009178 C12.7530956,19.8713157 13.6069102,20.5670952 14.6011413,21.0012461 L6,21 L6,17 L2,17 L2,11 C2,9.34 3.34,8 5,8 L5,8 Z M18,3 L18,7 L6,7 L6,3 L18,3 Z"></path> + <circle fill="#188038" cx="17" cy="15.5" r="3.5"></circle> + </g> + <g id="printer-status-grey"> + <path d="M19,8 C20.66,8 22,9.34 22,11 L22,11 L22.0008411,12.1834702 C20.9260374,10.5660653 19.0875152,9.5 17,9.5 C14.2041481,9.5 11.8549346,11.412286 11.1889599,14.0002575 L8,14 L8,19 L12.1267078,19.0009178 C12.7530956,19.8713157 13.6069102,20.5670952 14.6011413,21.0012461 L6,21 L6,17 L2,17 L2,11 C2,9.34 3.34,8 5,8 L5,8 Z M18,3 L18,7 L6,7 L6,3 L18,3 Z"></path> + <circle fill="#9aa0a6" cx="17" cy="15.5" r="3.5"></circle> + </g> + <g id="printer-status-red"> + <path d="M19,8 C20.66,8 22,9.34 22,11 L22,11 L22.0008411,12.1834702 C20.9260374,10.5660653 19.0875152,9.5 17,9.5 C14.2041481,9.5 11.8549346,11.412286 11.1889599,14.0002575 L8,14 L8,19 L12.1267078,19.0009178 C12.7530956,19.8713157 13.6069102,20.5670952 14.6011413,21.0012461 L6,21 L6,17 L2,17 L2,11 C2,9.34 3.34,8 5,8 L5,8 Z M18,3 L18,7 L6,7 L6,3 L18,3 Z"></path> + <circle fill="#d93025" cx="17" cy="15.5" r="3.5"></circle> + </g> + </if> + <!-- These icons are copied from Polymer's iron-icons and kept in sorted order. See http://goo.gl/Y1OdAq for instructions on adding additional icons.
diff --git a/chrome/browser/resources/settings/chromeos/device_page/pointers.html b/chrome/browser/resources/settings/chromeos/device_page/pointers.html index 38889df..8bef25bb 100644 --- a/chrome/browser/resources/settings/chromeos/device_page/pointers.html +++ b/chrome/browser/resources/settings/chromeos/device_page/pointers.html
@@ -87,12 +87,22 @@ </settings-slider> </div> </template> - <settings-toggle-button id="mouseReverseScroll" - class="hr" - pref="{{prefs.settings.mouse.reverse_scroll}}" - label="$i18n{mouseReverseScroll}" - deep-link-focus-id$="[[Setting.kMouseReverseScrolling]]"> - </settings-toggle-button> + <div class="settings-box" id="mouseReverseScrollRow" + on-click="onMouseReverseScrollRowClicked_"> + <div class="start settings-box-text"> + <settings-localized-link + on-click="onLearnMoreLinkClicked_" + id="enableMouseReverseScrollingLabel" + localized-string="$i18n{mouseReverseScroll}" + link-url="$i18n{naturalScrollLearnMoreLink}"> + </settings-localized-link> + </div> + <cr-toggle id="mouseReverseScroll" + checked="{{prefs.settings.mouse.reverse_scroll.value}}" + aria-labelledby="enableMouseReverseScrollingLabel" + deep-link-focus-id$="[[Setting.kMouseReverseScrolling]]"> + </cr-toggle> + </div> </div> </div> <div id="touchpad" hidden$="[[!hasTouchpad]]"> @@ -152,7 +162,7 @@ </div> </template> <div class="settings-box" id="reverseScrollRow" - on-click="onReverseScrollRowClicked_"> + on-click="onTouchpadReverseScrollRowClicked_"> <div class="start settings-box-text"> <settings-localized-link on-click="onLearnMoreLinkClicked_"
diff --git a/chrome/browser/resources/settings/chromeos/device_page/pointers.js b/chrome/browser/resources/settings/chromeos/device_page/pointers.js index f45c3f0..bf73bb3 100644 --- a/chrome/browser/resources/settings/chromeos/device_page/pointers.js +++ b/chrome/browser/resources/settings/chromeos/device_page/pointers.js
@@ -145,7 +145,14 @@ }, /** @private */ - onReverseScrollRowClicked_: function() { + onMouseReverseScrollRowClicked_: function() { + this.setPrefValue( + 'settings.mouse.reverse_scroll', + !this.getPref('settings.mouse.reverse_scroll').value); + }, + + /** @private */ + onTouchpadReverseScrollRowClicked_: function() { this.setPrefValue( 'settings.touchpad.natural_scroll', !this.getPref('settings.touchpad.natural_scroll').value);
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn index 437a93ab..2a1f9fb 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn
@@ -204,7 +204,7 @@ ":network_proxy_section.m", ":network_summary.m", ":network_summary_item.m", -# ":tether_connection_dialog.m" + ":tether_connection_dialog.m" ] } @@ -357,7 +357,16 @@ js_library("tether_connection_dialog.m") { sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/internet_page/tether_connection_dialog.m.js" ] deps = [ - # TODO: Fill those in. + "//chrome/browser/resources/settings/chromeos:os_route.m", + "//chromeos/services/network_config/public/mojom:mojom_js_library_for_compile", + "//third_party/polymer/v3_0/components-chromium/iron-icon:iron-icon", + "//third_party/polymer/v3_0/components-chromium/iron-flex-layout:iron-flex-layout", + "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", + "//ui/webui/resources/cr_components/chromeos/network:network_icon.m", + "//ui/webui/resources/cr_components/chromeos/network:onc_mojo.m", + "//ui/webui/resources/cr_elements/cr_button:cr_button.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/js:i18n_behavior.m", ] extra_deps = [ ":tether_connection_dialog_module" ] } @@ -449,6 +458,10 @@ js_file = "tether_connection_dialog.js" html_file = "tether_connection_dialog.html" html_type = "dom-module" + auto_imports = os_settings_auto_imports + namespace_rewrites = [ + "cros_network_config.mojom.m.js|cros_network_config.mojom-lite.js" + ] } polymer_modulizer("cellular_setup_dialog") {
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/tether_connection_dialog.html b/chrome/browser/resources/settings/chromeos/internet_page/tether_connection_dialog.html index 6450c4df..c2cc0772 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/tether_connection_dialog.html +++ b/chrome/browser/resources/settings/chromeos/internet_page/tether_connection_dialog.html
@@ -1,13 +1,17 @@ <link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/cr_components/chromeos/network/network_icon.html"> +<link rel="import" href="chrome://resources/cr_components/chromeos/network/onc_mojo.html"> <link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html"> <link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html"> <link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> +<link rel="import" href="chrome://resources/mojo/chromeos/services/network_config/public/mojom/cros_network_config.mojom.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> +<link rel="import" href="chrome://resources/html/i18n_behavior.html"> +<link rel="import" href="chrome://resources/html/util.html"> <link rel="import" href="../../chromeos/os_icons.html"> -<link rel="import" href="../os_route.html"> <link rel="import" href="../../settings_shared_css.html"> +<link rel="import" href="../os_route.html"> <dom-module id="tether-connection-dialog"> <template> @@ -81,10 +85,10 @@ <div id="host-device-text-container"> <span id="host-device-text-name" aria-describedby="host-device-signal-strength-icon - host-device-text-battery"> + hostDeviceTextBattery"> [[getDeviceName_(managedProperties)]] </span> - <span id="host-device-text-battery" class="secondary" + <span id="hostDeviceTextBattery" class="secondary" aria-hidden="true"> [[getBatteryPercentageString_(managedProperties)]] </span>
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/tether_connection_dialog.js b/chrome/browser/resources/settings/chromeos/internet_page/tether_connection_dialog.js index 33d5ae3c..c395b197 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/tether_connection_dialog.js +++ b/chrome/browser/resources/settings/chromeos/internet_page/tether_connection_dialog.js
@@ -2,12 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -(function() { -'use strict'; - -const mojom = chromeos.networkConfig.mojom; - - /** * Maps signal strength from [0, 100] to [0, 4] which represents the number * of bars in the signal icon displayed to the user. This is used to select @@ -85,7 +79,8 @@ }, /** - * @param {!mojom.ManagedProperties|undefined} managedProperties + * @param {!chromeos.networkConfig.mojom.ManagedProperties|undefined} + * managedProperties * @return {boolean} * @private */ @@ -97,7 +92,8 @@ }, /** - * @param {!mojom.ManagedProperties|undefined} managedProperties + * @param {!chromeos.networkConfig.mojom.ManagedProperties|undefined} + * managedProperties * @return {string} The battery percentage integer value converted to a * string. Note that this will not return a string with a "%" suffix. * @private @@ -112,7 +108,8 @@ * Retrieves an image that corresponds to signal strength of the tether host. * Custom icons are used here instead of a <network-icon> because this * dialog uses a special color scheme. - * @param {!mojom.ManagedProperties|undefined} managedProperties + * @param {!chromeos.networkConfig.mojom.ManagedProperties|undefined} + * managedProperties * @return {string} The name of the icon to be used to represent the network's * signal strength. */ @@ -126,7 +123,8 @@ /** * Retrieves a localized accessibility label for the signal strength. - * @param {!mojom.ManagedProperties|undefined} managedProperties + * @param {!chromeos.networkConfig.mojom.ManagedProperties|undefined} + * managedProperties * @return {string} The localized signal strength label. */ getSignalStrengthLabel_(managedProperties) { @@ -139,7 +137,8 @@ }, /** - * @param {!mojom.ManagedProperties|undefined} managedProperties + * @param {!chromeos.networkConfig.mojom.ManagedProperties|undefined} + * managedProperties * @return {string} * @private */ @@ -148,7 +147,8 @@ }, /** - * @param {!mojom.ManagedProperties|undefined} managedProperties + * @param {!chromeos.networkConfig.mojom.ManagedProperties|undefined} + * managedProperties * @return {string} * @private */ @@ -161,7 +161,8 @@ }, /** - * @param {!mojom.ManagedProperties|undefined} managedProperties + * @param {!chromeos.networkConfig.mojom.ManagedProperties|undefined} + * managedProperties * @return {string} * @private */ @@ -174,7 +175,8 @@ }, /** - * @param {!mojom.ManagedProperties|undefined} managedProperties + * @param {!chromeos.networkConfig.mojom.ManagedProperties|undefined} + * managedProperties * @return {string} * @private */ @@ -187,7 +189,8 @@ }, /** - * @param {!mojom.ManagedProperties|undefined} managedProperties + * @param {!chromeos.networkConfig.mojom.ManagedProperties|undefined} + * managedProperties * @return {string} * @private */ @@ -199,4 +202,3 @@ ''; }, }); -})();
diff --git a/chrome/browser/resources/settings/chromeos/os_settings.js b/chrome/browser/resources/settings/chromeos/os_settings.js index de2c4f6..341f6a4 100644 --- a/chrome/browser/resources/settings/chromeos/os_settings.js +++ b/chrome/browser/resources/settings/chromeos/os_settings.js
@@ -13,6 +13,7 @@ import './internet_page/network_proxy_section.m.js'; import './internet_page/network_summary.m.js'; import './internet_page/network_summary_item.m.js'; +import './internet_page/tether_connection_dialog.m.js'; import './nearby_share_page/nearby_share_receive_dialog.m.js'; import './nearby_share_page/nearby_share_subpage.m.js'; import './multidevice_page/multidevice_page.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_settings_resources_v3.grdp b/chrome/browser/resources/settings/chromeos/os_settings_resources_v3.grdp index fd33baf..de2f3d8e4 100644 --- a/chrome/browser/resources/settings/chromeos/os_settings_resources_v3.grdp +++ b/chrome/browser/resources/settings/chromeos/os_settings_resources_v3.grdp
@@ -75,6 +75,11 @@ use_base_dir="false" compress="false" type="BINDATA" /> + <include name="IDR_OS_SETTINGS_TETHER_CONNECTION_DIALOG_M_JS" + file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/internet_page/tether_connection_dialog.m.js" + use_base_dir="false" + compress="false" + type="BINDATA" /> <include name="IDR_OS_SETTINGS_PERSONALIZATION_PAGE_M_JS" file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/personalization_page/personalization_page.m.js" use_base_dir="false"
diff --git a/chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win.cc b/chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win.cc index 0bd2291..204f236 100644 --- a/chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win.cc +++ b/chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win.cc
@@ -242,12 +242,11 @@ using ModuleState = ClientIncidentReport_EnvironmentData_Process_ModuleState; for (size_t i = 0; i < num_modules_to_verify; ++i) { - std::unique_ptr<ModuleState> module_state(new ModuleState()); + auto module_state = std::make_unique<ModuleState>(); int num_bytes_different = 0; - bool scan_complete = VerifyModule(modules_to_verify[i], - module_state.get(), - &num_bytes_different); + VerifyModule(modules_to_verify[i], module_state.get(), + &num_bytes_different); if (module_state->modified_state() == ModuleState::MODULE_STATE_UNMODIFIED) continue; @@ -258,12 +257,6 @@ num_bytes_different); } - if (!scan_complete) { - UMA_HISTOGRAM_EXACT_LINEAR( - "ModuleIntegrityVerification.RelocationsUnordered", i, - num_modules_to_verify); - } - process->mutable_module_state()->AddAllocated(module_state.release()); } #endif // _WIN64
diff --git a/chrome/browser/sharesheet/share_action.cc b/chrome/browser/sharesheet/share_action.cc index 66b3715..599625b9 100644 --- a/chrome/browser/sharesheet/share_action.cc +++ b/chrome/browser/sharesheet/share_action.cc
@@ -4,11 +4,20 @@ #include "chrome/browser/sharesheet/share_action.h" +#if defined(OS_CHROMEOS) +#include "components/services/app_service/public/cpp/intent_util.h" +#endif + namespace sharesheet { bool ShareAction::ShouldShowAction(const apps::mojom::IntentPtr& intent, bool contains_hosted_document) { +#if defined(OS_CHROMEOS) + return !contains_hosted_document && !apps_util::OnlyShareToDrive(intent) && + apps_util::IsIntentValid(intent); +#else return !contains_hosted_document; +#endif } } // namespace sharesheet
diff --git a/chrome/browser/ssl/ssl_browsertest.cc b/chrome/browser/ssl/ssl_browsertest.cc index f67a56f4..da3d3cc0 100644 --- a/chrome/browser/ssl/ssl_browsertest.cc +++ b/chrome/browser/ssl/ssl_browsertest.cc
@@ -4410,7 +4410,7 @@ Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); StatefulSSLHostStateDelegate* state = - reinterpret_cast<StatefulSSLHostStateDelegate*>( + static_cast<StatefulSSLHostStateDelegate*>( profile->GetSSLHostStateDelegate()); // First check that frame requests revoke the decision. @@ -4457,7 +4457,7 @@ WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); StatefulSSLHostStateDelegate* state = - reinterpret_cast<StatefulSSLHostStateDelegate*>( + static_cast<StatefulSSLHostStateDelegate*>( profile->GetSSLHostStateDelegate()); // Proceed through the interstitial, accepting the broken cert. @@ -8132,7 +8132,7 @@ net::ERR_CERTIFICATE_TRANSPARENCY_REQUIRED); StatefulSSLHostStateDelegate* state = - reinterpret_cast<StatefulSSLHostStateDelegate*>( + static_cast<StatefulSSLHostStateDelegate*>( browser()->profile()->GetSSLHostStateDelegate()); state->ResetRecurrentErrorCountForTesting();
diff --git a/chrome/browser/ui/app_list/search/chrome_search_result.cc b/chrome/browser/ui/app_list/search/chrome_search_result.cc index 9702173e..2d67afd 100644 --- a/chrome/browser/ui/app_list/search/chrome_search_result.cc +++ b/chrome/browser/ui/app_list/search/chrome_search_result.cc
@@ -109,6 +109,11 @@ SetSearchResultMetadata(); } +void ChromeSearchResult::SetIsAnswer(bool is_answer) { + metadata_->is_answer = is_answer; + SetSearchResultMetadata(); +} + void ChromeSearchResult::SetQueryUrl(const GURL& url) { metadata_->query_url = url; auto* updater = model_updater();
diff --git a/chrome/browser/ui/app_list/search/chrome_search_result.h b/chrome/browser/ui/app_list/search/chrome_search_result.h index 769be45..6ed602f7 100644 --- a/chrome/browser/ui/app_list/search/chrome_search_result.h +++ b/chrome/browser/ui/app_list/search/chrome_search_result.h
@@ -26,7 +26,6 @@ class AppContextMenu; } // namespace app_list - // ChromeSearchResult consists of an icon, title text and details text. Title // and details text can have tagged ranges that are displayed differently from // default style. @@ -67,6 +66,7 @@ double display_score() const { return metadata_->display_score; } bool is_installing() const { return metadata_->is_installing; } bool is_recommendation() const { return metadata_->is_recommendation; } + bool is_answer() const { return metadata_->is_answer; } const base::Optional<GURL>& query_url() const { return metadata_->query_url; } const base::Optional<std::string>& equivalent_result_id() const { return metadata_->equivalent_result_id; @@ -97,6 +97,7 @@ void SetActions(const Actions& actions); void SetIsOmniboxSearch(bool is_omnibox_search); void SetIsRecommendation(bool is_recommendation); + void SetIsAnswer(bool is_answer); void SetIsInstalling(bool is_installing); void SetQueryUrl(const GURL& url); void SetEquivalentResutlId(const std::string& equivlanet_result_id);
diff --git a/chrome/browser/ui/app_list/search/files/drive_zero_state_provider.cc b/chrome/browser/ui/app_list/search/files/drive_zero_state_provider.cc index f232c3a..8f409b0d 100644 --- a/chrome/browser/ui/app_list/search/files/drive_zero_state_provider.cc +++ b/chrome/browser/ui/app_list/search/files/drive_zero_state_provider.cc
@@ -29,8 +29,17 @@ constexpr char kSchema[] = "drive_zero_state://"; +// Given an absolute path representing a file in the user's Drive, returns a +// reparented version of the path within the user's drive fs mount. +base::FilePath ReparentToDriveMount( + const base::FilePath& path, + const drive::DriveIntegrationService* drive_service) { + DCHECK(path.IsAbsolute()); + return drive_service->GetMountPointPath().Append(path.value()); } +} // namespace + DriveZeroStateProvider::DriveZeroStateProvider( Profile* profile, SearchController* search_controller, @@ -82,6 +91,7 @@ // - the |file_tasks_notifier_| is unavailable, as we stat files using it. const bool drive_fs_mounted = drive_service_ && drive_service_->IsMounted(); if (!query.empty() || !drive_fs_mounted || !file_tasks_notifier_) { + // TODO(crbug.com/1034842): Log error metrics. return; } @@ -90,8 +100,10 @@ // Get the most recent results from the cache. cache_results_ = item_suggest_cache_.GetResults(); - if (!cache_results_) + if (!cache_results_) { + // TODO(crbug.com/1034842): Log error metrics. return; + } std::vector<std::string> item_ids; for (const auto& result : cache_results_->results) { @@ -105,8 +117,10 @@ void DriveZeroStateProvider::OnFilePathsLocated( base::Optional<std::vector<drivefs::mojom::FilePathOrErrorPtr>> paths) { - if (!paths) + if (!paths) { + // TODO(crbug.com/1034842): Log error metrics. return; + } DCHECK(cache_results_); DCHECK_EQ(cache_results_->results.size(), paths->size()); @@ -117,16 +131,24 @@ int item_index = 0; SearchProvider::Results provider_results; for (int i = 0; i < static_cast<int>(paths->size()); ++i) { - if ((*paths)[i]->get_error() != drive::FILE_ERROR_OK) + const auto& path_or_error = paths.value()[i]; + if (path_or_error->is_error()) { + // TODO(crbug.com/1034842): Log error metrics. continue; + } const double score = 1.0 - (item_index / total_items); ++item_index; // TODO(crbug.com/1034842): Use |cache_results_| to attach the session id to // the result. + provider_results.emplace_back( - MakeResult((*paths)[i]->get_path(), score, /*is_chip=*/false)); + MakeResult(path_or_error->get_path(), score, /*is_chip=*/false)); + if (suggested_files_enabled_) { + provider_results.emplace_back( + MakeResult(path_or_error->get_path(), score, /*is_chip=*/true)); + } } cache_results_.reset(); @@ -138,7 +160,8 @@ const float relevance, const bool is_chip) { return std::make_unique<FileResult>( - kSchema, filepath, ash::AppListSearchResultType::kDriveQuickAccessChip, + kSchema, ReparentToDriveMount(filepath, drive_service_), + ash::AppListSearchResultType::kDriveQuickAccessChip, is_chip ? ash::SearchResultDisplayType::kChip : ash::SearchResultDisplayType::kList, relevance, profile_);
diff --git a/chrome/browser/ui/app_list/search/files/item_suggest_cache.cc b/chrome/browser/ui/app_list/search/files/item_suggest_cache.cc index bee6dc3..a5faf46 100644 --- a/chrome/browser/ui/app_list/search/files/item_suggest_cache.cc +++ b/chrome/browser/ui/app_list/search/files/item_suggest_cache.cc
@@ -30,8 +30,8 @@ namespace app_list { namespace { -// Maximum accepted size of an ItemSuggest response. 10 KB. -constexpr int kMaxResponseSize = 10 * 1024; +// Maximum accepted size of an ItemSuggest response. 1MB. +constexpr int kMaxResponseSize = 1024 * 1024; // TODO(crbug.com/1034842): Investigate: // - enterprise policies that should limit this traffic. @@ -69,42 +69,48 @@ 'platform_type': 'CHROME_OS', 'scenario_type': 'CHROME_OS_ZSS_FILES' }, - 'max_suggestions': 10, - 'type_detail_fields': [] + 'max_suggestions': 10 })"; bool IsDisabledByPolicy(const Profile* profile) { return profile->GetPrefs()->GetBoolean(drive::prefs::kDisableDrive); } -//---------------- -// Error utilities -//---------------- +//------------------ +// Metrics utilities +//------------------ -// Possible error states of the item suggest cache. -enum class Error { +// TODO(crbug.com/1034842): Add unit tests for histograms + +// Possible outcomes of a call to the ItemSuggest API. These values persist to +// logs. Entries should not be renumbered and numeric values should never be +// reused. +enum class Status { + kOk = 0, kDisabledByExperiment = 1, kDisabledByPolicy = 2, kInvalidServerUrl = 3, kNoIdentityManager = 4, kGoogleAuthError = 5, kNetError = 6, - k3xxError = 7, - k4xxError = 8, - k5xxError = 9, - kEmptyResponse = 10, - kNoResultsInResponse = 11, - kJsonParseFailure = 12, - kJsonConversionFailure = 13, + kResponseTooLarge = 7, + k3xxStatus = 8, + k4xxStatus = 9, + k5xxStatus = 10, + kEmptyResponse = 11, + kNoResultsInResponse = 12, + kJsonParseFailure = 13, + kJsonConversionFailure = 14, kMaxValue = kJsonConversionFailure, }; -void LogError(Error error) { - // TODO(crbug.com/1034842): Implement. +void LogStatus(Status status) { + UMA_HISTOGRAM_ENUMERATION("Apps.AppList.ItemSuggestCache.Status", status); } void LogResponseSize(const int size) { - // TODO(crbug.com/1034842): Implement. + UMA_HISTOGRAM_COUNTS_100000("Apps.AppList.ItemSuggestCache.ResponseSize", + size); } //--------------- @@ -233,21 +239,21 @@ if (url_loader_) { return; } else if (!enabled_) { - LogError(Error::kDisabledByExperiment); + LogStatus(Status::kDisabledByExperiment); return; } else if (IsDisabledByPolicy(profile_)) { - LogError(Error::kDisabledByPolicy); + LogStatus(Status::kDisabledByPolicy); return; } else if (!server_url_.SchemeIs(url::kHttpsScheme) || !google_util::IsGoogleAssociatedDomainUrl(server_url_)) { - LogError(Error::kInvalidServerUrl); + LogStatus(Status::kInvalidServerUrl); return; } signin::IdentityManager* identity_manager = IdentityManagerFactory::GetForProfile(profile_); if (!identity_manager) { - LogError(Error::kNoIdentityManager); + LogStatus(Status::kNoIdentityManager); return; } @@ -268,7 +274,7 @@ token_fetcher_.reset(); if (error.state() != GoogleServiceAuthError::NONE) { - LogError(Error::kGoogleAuthError); + LogStatus(Status::kGoogleAuthError); return; } @@ -292,21 +298,25 @@ const int net_error = url_loader_->NetError(); if (net_error != net::OK) { if (!url_loader_->ResponseInfo() || !url_loader_->ResponseInfo()->headers) { - LogError(Error::kNetError); + if (net_error == net::ERR_INSUFFICIENT_RESOURCES) { + LogStatus(Status::kResponseTooLarge); + } else { + LogStatus(Status::kNetError); + } } else { const int status = url_loader_->ResponseInfo()->headers->response_code(); if (status >= 500) { - LogError(Error::k5xxError); + LogStatus(Status::k5xxStatus); } else if (status >= 400) { - LogError(Error::k4xxError); + LogStatus(Status::k4xxStatus); } else if (status >= 300) { - LogError(Error::k3xxError); + LogStatus(Status::k3xxStatus); } } return; } else if (!json_response || json_response->empty()) { - LogError(Error::kEmptyResponse); + LogStatus(Status::kEmptyResponse); return; } @@ -323,7 +333,7 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!result.value) { - LogError(Error::kJsonParseFailure); + LogStatus(Status::kJsonParseFailure); return; } @@ -332,10 +342,11 @@ // results. const auto& results = ConvertResults(&result.value.value()); if (!results) { - LogError(Error::kJsonConversionFailure); + LogStatus(Status::kJsonConversionFailure); } else if (results->results.empty()) { - LogError(Error::kNoResultsInResponse); + LogStatus(Status::kNoResultsInResponse); } else { + LogStatus(Status::kOk); results_ = std::move(results.value()); } }
diff --git a/chrome/browser/ui/app_list/search/omnibox_result.cc b/chrome/browser/ui/app_list/search/omnibox_result.cc index 8356a32c..bc192589 100644 --- a/chrome/browser/ui/app_list/search/omnibox_result.cc +++ b/chrome/browser/ui/app_list/search/omnibox_result.cc
@@ -7,9 +7,12 @@ #include <stddef.h> #include "ash/public/cpp/app_list/app_list_config.h" +#include "ash/public/cpp/app_list/app_list_features.h" #include "ash/public/cpp/app_list/vector_icons/vector_icons.h" #include "base/metrics/histogram_macros.h" +#include "base/strings/strcat.h" #include "base/strings/string_split.h" +#include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/browser/profiles/profile.h" @@ -125,6 +128,16 @@ return ash::kDomainIcon; } +base::string16 ImageLineToString16(const SuggestionAnswer::ImageLine& line) { + std::vector<base::string16> text; + for (const auto& text_field : line.text_fields()) { + text.push_back(text_field.text()); + } + // TODO(crbug.com/1130372): Use placeholders or a l10n-friendly way to + // construct this string instead of concatenation. + return base::JoinString(text, base::ASCIIToUTF16(" ")); +} + } // namespace OmniboxResult::OmniboxResult(Profile* profile, @@ -147,6 +160,12 @@ set_result_subtype(static_cast<int>(match_.type)); SetMetricsType(GetSearchResultType()); + if (ShouldDisplayAsAnswer()) { + SetIsAnswer(match_.answer.has_value()); + // The answer subtype overrides the match subtype. + set_result_subtype(static_cast<int>(match_.answer->type())); + } + // Derive relevance from omnibox relevance and normalize it to [0, 1]. // The magic number 1500 is the highest score of an omnibox result. // See comments in autocomplete_provider.h. @@ -263,7 +282,19 @@ // details. const bool use_directly = !IsUrlResultWithDescription(); ChromeSearchResult::Tags title_tags; - if (use_directly) { + if (ShouldDisplayAsAnswer()) { + const auto* additional_text = match_.answer->first_line().additional_text(); + const bool has_additional_text = + additional_text && !additional_text->text().empty(); + // TODO(crbug.com/1130372): Use placeholders or a l10n-friendly way to + // construct this string instead of concatenation. + SetTitle(has_additional_text + ? base::StrCat({match_.contents, base::ASCIIToUTF16(" "), + additional_text->text()}) + : match_.contents); + ACMatchClassificationsToTags(match_.contents, match_.contents_class, + &title_tags); + } else if (use_directly) { SetTitle(match_.contents); ACMatchClassificationsToTags(match_.contents, match_.contents_class, &title_tags); @@ -275,7 +306,10 @@ SetTitleTags(title_tags); ChromeSearchResult::Tags details_tags; - if (use_directly) { + if (ShouldDisplayAsAnswer()) { + // Answer results will contain the answer in the second line. + SetDetails(ImageLineToString16(match_.answer->second_line())); + } else if (use_directly) { if (AutocompleteMatch::IsSearchType(match_.type)) { SetAccessibleName(l10n_util::GetStringFUTF16( IDS_APP_LIST_QUERY_SEARCH_ACCESSIBILITY_NAME, title(), @@ -343,4 +377,8 @@ : OmniboxResultType::kQuerySuggestion); } +bool OmniboxResult::ShouldDisplayAsAnswer() { + return app_list_features::IsOmniboxRichEntitiesEnabled() && is_answer(); +} + } // namespace app_list
diff --git a/chrome/browser/ui/app_list/search/omnibox_result.h b/chrome/browser/ui/app_list/search/omnibox_result.h index 9a0709c..314a9ae 100644 --- a/chrome/browser/ui/app_list/search/omnibox_result.h +++ b/chrome/browser/ui/app_list/search/omnibox_result.h
@@ -60,6 +60,10 @@ ash::SearchResultType GetSearchResultType() const; + // Whether or not the result is an answer and rich entities are enabled. + // TODO(crbug/1130372): Remove this when rich entities are enabled by default. + bool ShouldDisplayAsAnswer(); + Profile* profile_; AppListControllerDelegate* list_controller_; AutocompleteController* autocomplete_controller_;
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc index aa7e147..6897d6b 100644 --- a/chrome/browser/ui/browser_command_controller.cc +++ b/chrome/browser/ui/browser_command_controller.cc
@@ -83,7 +83,7 @@ #endif #if defined(OS_LINUX) && !defined(OS_CHROMEOS) -#include "ui/base/ime/linux/text_edit_key_bindings_delegate_auralinux.h" // nogncheck +#include "ui/base/ime/linux/text_edit_key_bindings_delegate_auralinux.h" #endif #if defined(USE_OZONE)
diff --git a/chrome/browser/ui/global_media_controls/media_notification_service_factory.cc b/chrome/browser/ui/global_media_controls/media_notification_service_factory.cc index 8921b02..6b287ea 100644 --- a/chrome/browser/ui/global_media_controls/media_notification_service_factory.cc +++ b/chrome/browser/ui/global_media_controls/media_notification_service_factory.cc
@@ -35,7 +35,7 @@ KeyedService* MediaNotificationServiceFactory::BuildServiceInstanceFor( content::BrowserContext* context) const { bool show_from_all_profiles = false; -#if defined(CHROME_OS) +#if defined(OS_CHROMEOS) show_from_all_profiles = true; #endif return new MediaNotificationService(Profile::FromBrowserContext(context),
diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc index e051847..e948beb 100644 --- a/chrome/browser/ui/views/download/download_item_view.cc +++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -145,7 +145,7 @@ public: METADATA_HEADER(TransparentButton); - explicit TransparentButton(DownloadItemView* parent) : Button(parent) { + explicit TransparentButton(DownloadItemView* parent) : Button(nullptr) { SetFocusForPlatform(); views::InstallRectHighlightPathGenerator(this); SetInkDropMode(InkDropMode::ON); @@ -256,6 +256,8 @@ // views to localize functionality and simplify this class. open_button_ = AddChildView(std::make_unique<TransparentButton>(this)); + open_button_->set_callback(base::BindRepeating( + &DownloadItemView::OpenButtonPressed, base::Unretained(this))); file_name_label_ = AddChildView(std::make_unique<views::StyledLabel>()); file_name_label_->SetTextContext(CONTEXT_DOWNLOAD_SHELF); @@ -278,17 +280,27 @@ deep_scanning_label_->set_can_process_events_within_subtree(false); open_now_button_ = AddChildView(std::make_unique<views::MdTextButton>( - this, l10n_util::GetStringUTF16(IDS_OPEN_DOWNLOAD_NOW))); + base::BindRepeating(&DownloadItemView::OpenDownloadDuringAsyncScanning, + base::Unretained(this)), + l10n_util::GetStringUTF16(IDS_OPEN_DOWNLOAD_NOW))); - save_button_ = AddChildView(std::make_unique<views::MdTextButton>(this)); + save_button_ = AddChildView(std::make_unique<views::MdTextButton>( + base::BindRepeating(&DownloadItemView::SaveOrDiscardButtonPressed, + base::Unretained(this), DownloadCommands::KEEP))); discard_button_ = AddChildView(std::make_unique<views::MdTextButton>( - this, l10n_util::GetStringUTF16(IDS_DISCARD_DOWNLOAD))); + base::BindRepeating(&DownloadItemView::SaveOrDiscardButtonPressed, + base::Unretained(this), DownloadCommands::DISCARD), + l10n_util::GetStringUTF16(IDS_DISCARD_DOWNLOAD))); scan_button_ = AddChildView(std::make_unique<views::MdTextButton>( - this, l10n_util::GetStringUTF16(IDS_SCAN_DOWNLOAD))); + base::BindRepeating(&DownloadItemView::ExecuteCommand, + base::Unretained(this), DownloadCommands::DEEP_SCAN), + l10n_util::GetStringUTF16(IDS_SCAN_DOWNLOAD))); - dropdown_button_ = AddChildView(views::CreateVectorImageButton(this)); + dropdown_button_ = + AddChildView(views::CreateVectorImageButton(base::BindRepeating( + &DownloadItemView::DropdownButtonPressed, base::Unretained(this)))); dropdown_button_->SetAccessibleName(l10n_util::GetStringUTF16( IDS_DOWNLOAD_ITEM_DROPDOWN_BUTTON_ACCESSIBLE_TEXT)); dropdown_button_->SetBorder(views::CreateEmptyBorder(gfx::Insets(10))); @@ -405,37 +417,6 @@ node_data->SetDescription(base::string16()); } -void DownloadItemView::ButtonPressed(views::Button* sender, - const ui::Event& event) { - if (sender == open_button_) { - if (mode_ == Mode::kNormal) { - complete_animation_.End(); - announce_accessible_alert_soon_ = true; - model_->OpenDownload(); - // WARNING: |this| may be deleted! - } else { - ShowOpenDialog( - shelf_->browser()->tab_strip_model()->GetActiveWebContents()); - } - } else if (sender == open_now_button_) { - OpenDownloadDuringAsyncScanning(); - } else if (sender == scan_button_) { - ExecuteCommand(DownloadCommands::DEEP_SCAN); - } else if (sender == dropdown_button_) { - SetDropdownPressed(true); - ShowContextMenuImpl(dropdown_button_->GetBoundsInScreen(), - ui::GetMenuSourceTypeForEvent(event)); - } else { - const auto command = (sender == save_button_) ? DownloadCommands::KEEP - : DownloadCommands::DISCARD; - if (is_mixed_content(mode_)) - ExecuteCommand(command); - else - MaybeSubmitDownloadToFeedbackService(command); - // WARNING: |this| may be deleted! - } -} - void DownloadItemView::ShowContextMenuForViewImpl( View* source, const gfx::Point& point, @@ -1141,6 +1122,33 @@ GetThemeProvider()->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT)); } +void DownloadItemView::OpenButtonPressed() { + if (mode_ == Mode::kNormal) { + complete_animation_.End(); + announce_accessible_alert_soon_ = true; + model_->OpenDownload(); + // WARNING: |this| may be deleted! + } else { + ShowOpenDialog( + shelf_->browser()->tab_strip_model()->GetActiveWebContents()); + } +} + +void DownloadItemView::SaveOrDiscardButtonPressed( + DownloadCommands::Command command) { + if (is_mixed_content(mode_)) + ExecuteCommand(command); + else + MaybeSubmitDownloadToFeedbackService(command); + // WARNING: |this| may be deleted! +} + +void DownloadItemView::DropdownButtonPressed(const ui::Event& event) { + SetDropdownPressed(true); + ShowContextMenuImpl(dropdown_button_->GetBoundsInScreen(), + ui::GetMenuSourceTypeForEvent(event)); +} + void DownloadItemView::ShowOpenDialog(content::WebContents* web_contents) { if (mode_ == Mode::kDeepScanning) { TabModalConfirmDialog::Create(
diff --git a/chrome/browser/ui/views/download/download_item_view.h b/chrome/browser/ui/views/download/download_item_view.h index 108df896..e3a1921f 100644 --- a/chrome/browser/ui/views/download/download_item_view.h +++ b/chrome/browser/ui/views/download/download_item_view.h
@@ -63,7 +63,6 @@ // The DownloadItemView lives in the Browser, and has a corresponding // DownloadController that receives / writes data which lives in the Renderer. class DownloadItemView : public views::View, - public views::ButtonListener, public views::ContextMenuController, public DownloadUIModel::Observer, public views::AnimationDelegateViews { @@ -84,9 +83,6 @@ base::string16 GetTooltipText(const gfx::Point& p) const override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override; - // views::ButtonListener: - void ButtonPressed(views::Button* sender, const ui::Event& event) override; - // views::ContextMenuController: void ShowContextMenuForViewImpl(View* source, const gfx::Point& point, @@ -196,6 +192,11 @@ // Sets |dropdown_button_| to have the correct image for the current state. void UpdateDropdownButtonImage(); + // Called when various buttons are pressed. + void OpenButtonPressed(); + void SaveOrDiscardButtonPressed(DownloadCommands::Command command); + void DropdownButtonPressed(const ui::Event& event); + // Shows an appropriate prompt dialog when the user hits the "open" button // when not in normal mode. void ShowOpenDialog(content::WebContents* web_contents);
diff --git a/chrome/browser/ui/views/download/download_shelf_view.cc b/chrome/browser/ui/views/download/download_shelf_view.cc index 6299c6ae..46aa0af0 100644 --- a/chrome/browser/ui/views/download/download_shelf_view.cc +++ b/chrome/browser/ui/views/download/download_shelf_view.cc
@@ -72,10 +72,12 @@ SetVisible(false); show_all_view_ = AddChildView(std::make_unique<views::MdTextButton>( - this, l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS))); + base::BindRepeating(&chrome::ShowDownloads, browser), + l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS))); show_all_view_->SizeToPreferredSize(); - close_button_ = AddChildView(views::CreateVectorImageButton(this)); + close_button_ = AddChildView(views::CreateVectorImageButton( + base::BindRepeating(&DownloadShelf::Close, base::Unretained(this)))); close_button_->SetAccessibleName( l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); close_button_->SetFocusForPlatform(); @@ -235,16 +237,6 @@ SetVisible(false); } -void DownloadShelfView::ButtonPressed(views::Button* button, - const ui::Event& event) { - if (button == close_button_) { - Close(); - } else { - DCHECK_EQ(show_all_view_, button); - chrome::ShowDownloads(browser()); - } -} - void DownloadShelfView::MouseMovedOutOfHost() { Close(); }
diff --git a/chrome/browser/ui/views/download/download_shelf_view.h b/chrome/browser/ui/views/download/download_shelf_view.h index dc88ff0..07495a6d 100644 --- a/chrome/browser/ui/views/download/download_shelf_view.h +++ b/chrome/browser/ui/views/download/download_shelf_view.h
@@ -34,7 +34,6 @@ class DownloadShelfView : public DownloadShelf, public views::AccessiblePaneView, public views::AnimationDelegateViews, - public views::ButtonListener, public views::MouseWatcherListener { public: DownloadShelfView(Browser* browser, BrowserView* parent); @@ -55,9 +54,6 @@ void AnimationProgressed(const gfx::Animation* animation) override; void AnimationEnded(const gfx::Animation* animation) override; - // views::ButtonListener: - void ButtonPressed(views::Button* button, const ui::Event& event) override; - // views::MouseWatcherListener: void MouseMovedOutOfHost() override;
diff --git a/chrome/browser/ui/views/hung_plugin_tab_helper_unittest.cc b/chrome/browser/ui/views/hung_plugin_tab_helper_unittest.cc index 76910780..feaa74c 100644 --- a/chrome/browser/ui/views/hung_plugin_tab_helper_unittest.cc +++ b/chrome/browser/ui/views/hung_plugin_tab_helper_unittest.cc
@@ -11,6 +11,8 @@ #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/views/chrome_test_views_delegate.h" #include "ui/events/event.h" +#include "ui/views/controls/button/md_text_button.h" +#include "ui/views/test/button_test_api.h" class HungPluginInfoBarObserver : public infobars::InfoBarManager::Observer { public: @@ -38,59 +40,15 @@ seen_removal_ = true; } -class HungPluginMockInfoBar : public ConfirmInfoBar { - public: - explicit HungPluginMockInfoBar( - std::unique_ptr<ConfirmInfoBarDelegate> delegate); - - private: - // ConfirmInfoBar: - void ButtonPressed(views::Button* sender, const ui::Event& event) override; -}; - -HungPluginMockInfoBar::HungPluginMockInfoBar( - std::unique_ptr<ConfirmInfoBarDelegate> delegate) - : ConfirmInfoBar(std::move(delegate)) {} - -void HungPluginMockInfoBar::ButtonPressed(views::Button* sender, - const ui::Event& event) { - DCHECK(owner()); - HungPluginInfoBarObserver observer(owner()); - if (GetDelegate()->Accept()) { +void RemoveOnlyOnce(ConfirmInfoBar* infobar) { + DCHECK(infobar->owner()); + HungPluginInfoBarObserver observer(infobar->owner()); + if (infobar->GetDelegate()->Accept()) { ASSERT_FALSE(observer.seen_removal()); - RemoveSelf(); + infobar->RemoveSelf(); } } -class HungPluginMockInfoBarService : public InfoBarService { - public: - // Creates a HungPluginMockInfoBarService and attaches it as the - // InfoBarService for |web_contents|. - static void CreateForWebContents(content::WebContents* web_contents); - - std::unique_ptr<infobars::InfoBar> CreateConfirmInfoBar( - std::unique_ptr<ConfirmInfoBarDelegate> delegate) override; - - private: - using InfoBarService::InfoBarService; -}; - -void HungPluginMockInfoBarService::CreateForWebContents( - content::WebContents* web_contents) { - DCHECK(web_contents); - const void* user_data_key = UserDataKey(); - DCHECK(!web_contents->GetUserData(user_data_key)); - web_contents->SetUserData( - user_data_key, - base::WrapUnique(new HungPluginMockInfoBarService(web_contents))); -} - -std::unique_ptr<infobars::InfoBar> -HungPluginMockInfoBarService::CreateConfirmInfoBar( - std::unique_ptr<ConfirmInfoBarDelegate> delegate) { - return std::make_unique<HungPluginMockInfoBar>(std::move(delegate)); -} - class HungPluginTabHelperTest : public ChromeRenderViewHostTestHarness { public: void SetUp() override; @@ -103,24 +61,26 @@ ChromeRenderViewHostTestHarness::SetUp(); HungPluginTabHelper::CreateForWebContents(web_contents()); - HungPluginMockInfoBarService::CreateForWebContents(web_contents()); + InfoBarService::CreateForWebContents(web_contents()); } class DummyEvent : public ui::Event { public: - DummyEvent(); + DummyEvent() : Event(ui::ET_UNKNOWN, base::TimeTicks(), ui::EF_NONE) {} }; -DummyEvent::DummyEvent() : Event(ui::ET_UNKNOWN, base::TimeTicks(), 0) {} - // Regression test for https://crbug.com/969099 . TEST_F(HungPluginTabHelperTest, DontRemoveTwice) { HungPluginTabHelper::FromWebContents(web_contents()) ->PluginHungStatusChanged(0, base::FilePath(), true); InfoBarService* infobar_service = InfoBarService::FromWebContents(web_contents()); + ASSERT_TRUE(infobar_service); ASSERT_EQ(1u, infobar_service->infobar_count()); - static_cast<InfoBarView*>(infobar_service->infobar_at(0)) - ->ButtonPressed(nullptr, DummyEvent()); + auto* infobar = static_cast<ConfirmInfoBar*>(infobar_service->infobar_at(0)); + views::MdTextButton* ok_button = infobar->ok_button_for_testing(); + ok_button->set_callback( + base::BindRepeating(&RemoveOnlyOnce, base::Unretained(infobar))); + views::test::ButtonTestApi(ok_button).NotifyClick(DummyEvent()); EXPECT_EQ(0u, infobar_service->infobar_count()); }
diff --git a/chrome/browser/ui/views/infobars/confirm_infobar.cc b/chrome/browser/ui/views/infobars/confirm_infobar.cc index 573e265..0f2cb47 100644 --- a/chrome/browser/ui/views/infobars/confirm_infobar.cc +++ b/chrome/browser/ui/views/infobars/confirm_infobar.cc
@@ -36,9 +36,24 @@ label_->SetElideBehavior(delegate_ptr->GetMessageElideBehavior()); AddChildView(label_); + const auto create_button = [this](ConfirmInfoBarDelegate::InfoBarButton type, + void (ConfirmInfoBar::*click_function)()) { + auto* button = AddChildView(std::make_unique<views::MdTextButton>( + base::BindRepeating(click_function, base::Unretained(this)), + GetDelegate()->GetButtonLabel(type))); + button->SetProperty( + views::kMarginsKey, + gfx::Insets(ChromeLayoutProvider::Get()->GetDistanceMetric( + DISTANCE_TOAST_CONTROL_VERTICAL), + 0)); + button->SizeToPreferredSize(); + return button; + }; + const auto buttons = delegate_ptr->GetButtons(); if (buttons & ConfirmInfoBarDelegate::BUTTON_OK) { - ok_button_ = CreateButton(ConfirmInfoBarDelegate::BUTTON_OK); + ok_button_ = create_button(ConfirmInfoBarDelegate::BUTTON_OK, + &ConfirmInfoBar::OkButtonPressed); ok_button_->SetProminent(true); if (delegate_ptr->OKButtonTriggersUACPrompt()) { elevation_icon_setter_ = std::make_unique<ElevationIconSetter>( @@ -48,7 +63,8 @@ } if (buttons & ConfirmInfoBarDelegate::BUTTON_CANCEL) { - cancel_button_ = CreateButton(ConfirmInfoBarDelegate::BUTTON_CANCEL); + cancel_button_ = create_button(ConfirmInfoBarDelegate::BUTTON_CANCEL, + &ConfirmInfoBar::CancelButtonPressed); if (buttons == ConfirmInfoBarDelegate::BUTTON_CANCEL) cancel_button_->SetProminent(true); } @@ -92,43 +108,27 @@ link_->SetPosition(gfx::Point(EndX() - link_->width(), OffsetY(link_))); } -void ConfirmInfoBar::ButtonPressed(views::Button* sender, - const ui::Event& event) { +void ConfirmInfoBar::OkButtonPressed() { if (!owner()) return; // We're closing; don't call anything, it might access the owner. - ConfirmInfoBarDelegate* delegate = GetDelegate(); - if (sender == ok_button_) { - if (delegate->Accept()) - RemoveSelf(); - } else if (sender == cancel_button_) { - if (delegate->Cancel()) - RemoveSelf(); - } else { - InfoBarView::ButtonPressed(sender, event); - } + if (GetDelegate()->Accept()) + RemoveSelf(); } -int ConfirmInfoBar::ContentMinimumWidth() const { - return label_->GetMinimumSize().width() + link_->GetMinimumSize().width() + - NonLabelWidth(); +void ConfirmInfoBar::CancelButtonPressed() { + if (!owner()) + return; // We're closing; don't call anything, it might access the owner. + if (GetDelegate()->Cancel()) + RemoveSelf(); } ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() { return delegate()->AsConfirmInfoBarDelegate(); } -views::MdTextButton* ConfirmInfoBar::CreateButton( - ConfirmInfoBarDelegate::InfoBarButton type) { - auto button = std::make_unique<views::MdTextButton>( - this, GetDelegate()->GetButtonLabel(type)); - button->SetProperty( - views::kMarginsKey, - gfx::Insets(ChromeLayoutProvider::Get()->GetDistanceMetric( - DISTANCE_TOAST_CONTROL_VERTICAL), - 0)); - auto* button_ptr = AddChildView(std::move(button)); - button_ptr->SizeToPreferredSize(); - return button_ptr; +int ConfirmInfoBar::ContentMinimumWidth() const { + return label_->GetMinimumSize().width() + link_->GetMinimumSize().width() + + NonLabelWidth(); } int ConfirmInfoBar::NonLabelWidth() const {
diff --git a/chrome/browser/ui/views/infobars/confirm_infobar.h b/chrome/browser/ui/views/infobars/confirm_infobar.h index 9ad0b2e..e5b69a17 100644 --- a/chrome/browser/ui/views/infobars/confirm_infobar.h +++ b/chrome/browser/ui/views/infobars/confirm_infobar.h
@@ -13,7 +13,6 @@ class ElevationIconSetter; namespace views { -class Button; class Label; class MdTextButton; } @@ -28,17 +27,18 @@ // InfoBarView: void Layout() override; - void ButtonPressed(views::Button* sender, const ui::Event& event) override; + + ConfirmInfoBarDelegate* GetDelegate(); + + views::MdTextButton* ok_button_for_testing() { return ok_button_; } protected: // InfoBarView: int ContentMinimumWidth() const override; - ConfirmInfoBarDelegate* GetDelegate(); - private: - // Creates a button suitable for use as either OK or Cancel. - views::MdTextButton* CreateButton(ConfirmInfoBarDelegate::InfoBarButton type); + void OkButtonPressed(); + void CancelButtonPressed(); // Returns the width of all content other than the label and link. Layout() // uses this to determine how much space the label and link can take.
diff --git a/chrome/browser/ui/views/infobars/infobar_view.cc b/chrome/browser/ui/views/infobars/infobar_view.cc index 547aba1..8701890 100644 --- a/chrome/browser/ui/views/infobars/infobar_view.cc +++ b/chrome/browser/ui/views/infobars/infobar_view.cc
@@ -116,7 +116,8 @@ } if (this->delegate()->IsCloseable()) { - auto close_button = views::CreateVectorImageButton(this); + auto close_button = views::CreateVectorImageButton(base::BindRepeating( + &InfoBarView::CloseButtonPressed, base::Unretained(this))); // This is the wrong color, but allows the button's size to be computed // correctly. We'll reset this with the correct color in OnThemeChanged(). views::SetImageFromVectorIcon(close_button.get(), @@ -250,16 +251,6 @@ RecalculateHeight(); } -void InfoBarView::ButtonPressed(views::Button* sender, - const ui::Event& event) { - if (!owner()) - return; // We're closing; don't call anything, it might access the owner. - if (sender == close_button_) { - delegate()->InfoBarDismissed(); - RemoveSelf(); - } -} - void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) { views::ExternalFocusTracker::OnWillChangeFocus(focused_before, focused_now); @@ -408,3 +399,10 @@ if (delegate()->LinkClicked(ui::DispositionFromEventFlags(event.flags()))) RemoveSelf(); } + +void InfoBarView::CloseButtonPressed() { + if (!owner()) + return; // We're closing; don't call anything, it might access the owner. + delegate()->InfoBarDismissed(); + RemoveSelf(); +}
diff --git a/chrome/browser/ui/views/infobars/infobar_view.h b/chrome/browser/ui/views/infobars/infobar_view.h index 530999a..323f034 100644 --- a/chrome/browser/ui/views/infobars/infobar_view.h +++ b/chrome/browser/ui/views/infobars/infobar_view.h
@@ -10,9 +10,9 @@ #include "components/infobars/core/infobar.h" #include "components/infobars/core/infobar_container.h" #include "third_party/skia/include/core/SkPath.h" -#include "ui/views/controls/button/button.h" #include "ui/views/controls/menu/menu_types.h" #include "ui/views/focus/external_focus_tracker.h" +#include "ui/views/view.h" namespace views { class ImageButton; @@ -24,7 +24,6 @@ class InfoBarView : public infobars::InfoBar, public views::View, - public views::ButtonListener, public views::ExternalFocusTracker { public: explicit InfoBarView(std::unique_ptr<infobars::InfoBarDelegate> delegate); @@ -42,11 +41,6 @@ void OnPaint(gfx::Canvas* canvas) override; void OnThemeChanged() override; - // views::ButtonListener: - // NOTE: This must not be called if we're unowned. (Subclasses should ignore - // calls to ButtonPressed() in this case.) - void ButtonPressed(views::Button* sender, const ui::Event& event) override; - // views::ExternalFocusTracker: void OnWillChangeFocus(View* focused_before, View* focused_now) override; @@ -111,6 +105,8 @@ // Callback used by the link created by CreateLink(). void LinkClicked(const ui::Event& event); + void CloseButtonPressed(); + // The optional icon at the left edge of the InfoBar. views::ImageView* icon_ = nullptr;
diff --git a/chrome/browser/ui/webui/chromeos/crostini_upgrader/crostini_upgrader_dialog_browsertest.cc b/chrome/browser/ui/webui/chromeos/crostini_upgrader/crostini_upgrader_dialog_browsertest.cc index 0df942b..f6560a6 100644 --- a/chrome/browser/ui/webui/chromeos/crostini_upgrader/crostini_upgrader_dialog_browsertest.cc +++ b/chrome/browser/ui/webui/chromeos/crostini_upgrader/crostini_upgrader_dialog_browsertest.cc
@@ -43,7 +43,7 @@ chromeos::CrostiniUpgraderDialog* GetCrostiniUpgraderDialog() { auto url = GURL{chrome::kChromeUICrostiniUpgraderUrl}; - return reinterpret_cast<chromeos::CrostiniUpgraderDialog*>( + return static_cast<chromeos::CrostiniUpgraderDialog*>( chromeos::SystemWebDialogDelegate::FindInstance(url.spec())); }
diff --git a/chrome/browser/ui/webui/device_log_ui.cc b/chrome/browser/ui/webui/device_log_ui.cc index fac445e..8a9a1a10 100644 --- a/chrome/browser/ui/webui/device_log_ui.cc +++ b/chrome/browser/ui/webui/device_log_ui.cc
@@ -89,6 +89,7 @@ {"logTypeHidText", IDS_DEVICE_LOG_TYPE_HID}, {"logTypePrinterText", IDS_DEVICE_LOG_TYPE_PRINTER}, {"logTypeFidoText", IDS_DEVICE_LOG_TYPE_FIDO}, + {"logTypeSerialText", IDS_DEVICE_LOG_TYPE_SERIAL}, {"logEntryFormat", IDS_DEVICE_LOG_ENTRY}, }; AddLocalizedStringsBulk(html, kStrings);
diff --git a/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc b/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc index c77c732..8fcb2a3a 100644 --- a/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc +++ b/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc
@@ -302,31 +302,33 @@ FetchCapabilities(printer, GetNativePrinterPolicies(), std::move(cb)); return; } - case chromeos::PrinterSetupResult::kPpdNotFound: - LOG(WARNING) << "Could not find PPD. Check printer configuration."; - // Prompt user to update configuration. - // TODO(skau): Fill me in - break; - case chromeos::PrinterSetupResult::kPpdUnretrievable: - LOG(WARNING) << "Could not download PPD. Check Internet connection."; - // Could not download PPD. Connect to Internet. - // TODO(skau): Fill me in - break; case chromeos::PrinterSetupResult::kPrinterUnreachable: + case chromeos::PrinterSetupResult::kPrinterSentWrongResponse: + case chromeos::PrinterSetupResult::kPpdNotFound: + case chromeos::PrinterSetupResult::kPpdUnretrievable: + // Prompt user to update configuration or check internet connection. + // TODO(skau): Fill me in + LOG(WARNING) << ResultCodeToMessage(result); + break; + case chromeos::PrinterSetupResult::kFatalError: case chromeos::PrinterSetupResult::kDbusError: - case chromeos::PrinterSetupResult::kComponentUnavailable: + case chromeos::PrinterSetupResult::kNativePrintersNotAllowed: case chromeos::PrinterSetupResult::kPpdTooLarge: case chromeos::PrinterSetupResult::kInvalidPpd: - case chromeos::PrinterSetupResult::kFatalError: - case chromeos::PrinterSetupResult::kNativePrintersNotAllowed: - case chromeos::PrinterSetupResult::kInvalidPrinterUpdate: + case chromeos::PrinterSetupResult::kIoError: + case chromeos::PrinterSetupResult::kMemoryAllocationError: + case chromeos::PrinterSetupResult::kBadUri: case chromeos::PrinterSetupResult::kDbusNoReply: case chromeos::PrinterSetupResult::kDbusTimeout: - case chromeos::PrinterSetupResult::kEditSuccess: - LOG(ERROR) << "Unexpected error in printer setup. " << result; + LOG(ERROR) << ResultCodeToMessage(result); break; + case chromeos::PrinterSetupResult::kInvalidPrinterUpdate: + case chromeos::PrinterSetupResult::kEditSuccess: + case chromeos::PrinterSetupResult::kPrinterIsNotAutoconfigurable: + case chromeos::PrinterSetupResult::kComponentUnavailable: case chromeos::PrinterSetupResult::kMaxValue: - NOTREACHED() << "This value is not expected"; + LOG(ERROR) << "Unexpected error in printer setup: " + << ResultCodeToMessage(result); break; }
diff --git a/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc b/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc index dfe4750..cedaa49 100644 --- a/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc +++ b/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
@@ -761,47 +761,30 @@ } return; case PrinterSetupResult::kEditSuccess: - PRINTER_LOG(USER) << "Printer updated"; + PRINTER_LOG(USER) << ResultCodeToMessage(result_code); printers_manager_->SavePrinter(printer); return; - case PrinterSetupResult::kPpdNotFound: - PRINTER_LOG(ERROR) << "Could not locate requested PPD"; - break; - case PrinterSetupResult::kPpdTooLarge: - PRINTER_LOG(ERROR) << "PPD is too large"; - break; - case PrinterSetupResult::kPpdUnretrievable: - PRINTER_LOG(ERROR) << "Could not retrieve PPD from server"; - break; - case PrinterSetupResult::kInvalidPpd: - PRINTER_LOG(ERROR) << "Provided PPD is invalid."; - break; + case PrinterSetupResult::kNativePrintersNotAllowed: + case PrinterSetupResult::kBadUri: + case PrinterSetupResult::kInvalidPrinterUpdate: case PrinterSetupResult::kPrinterUnreachable: - PRINTER_LOG(ERROR) << "Could not contact printer for configuration"; + case PrinterSetupResult::kPrinterSentWrongResponse: + case PrinterSetupResult::kPrinterIsNotAutoconfigurable: + case PrinterSetupResult::kPpdTooLarge: + case PrinterSetupResult::kInvalidPpd: + case PrinterSetupResult::kPpdNotFound: + case PrinterSetupResult::kPpdUnretrievable: + case PrinterSetupResult::kDbusError: + case PrinterSetupResult::kDbusNoReply: + case PrinterSetupResult::kDbusTimeout: + case PrinterSetupResult::kIoError: + case PrinterSetupResult::kMemoryAllocationError: + case PrinterSetupResult::kFatalError: + PRINTER_LOG(ERROR) << ResultCodeToMessage(result_code); break; case PrinterSetupResult::kComponentUnavailable: - LOG(WARNING) << "Could not install component"; - break; - case PrinterSetupResult::kDbusError: - case PrinterSetupResult::kFatalError: - PRINTER_LOG(ERROR) << "Unrecoverable error. Reboot required."; - break; - case PrinterSetupResult::kNativePrintersNotAllowed: - PRINTER_LOG(ERROR) - << "Unable to add or edit printer due to enterprise policy."; - break; - case PrinterSetupResult::kInvalidPrinterUpdate: - PRINTER_LOG(ERROR) - << "Requested printer changes would make printer unusable"; - break; - case PrinterSetupResult::kDbusNoReply: - PRINTER_LOG(ERROR) << "Couldn't talk to debugd over D-Bus."; - break; - case PrinterSetupResult::kDbusTimeout: - PRINTER_LOG(ERROR) << "Timed out trying to reach debugd over D-Bus."; - break; case PrinterSetupResult::kMaxValue: - NOTREACHED() << "This is not an expected value"; + NOTREACHED() << ResultCodeToMessage(result_code); break; } // Log an event that tells us this printer setup failed, so we can get
diff --git a/chrome/browser/ui/webui/settings/chromeos/device_section.cc b/chrome/browser/ui/webui/settings/chromeos/device_section.cc index 2505f57b..a30dc06a 100644 --- a/chrome/browser/ui/webui/settings/chromeos/device_section.cc +++ b/chrome/browser/ui/webui/settings/chromeos/device_section.cc
@@ -787,7 +787,6 @@ void DeviceSection::AddLoadTimeData(content::WebUIDataSource* html_source) { static constexpr webui::LocalizedString kDeviceStrings[] = { {"devicePageTitle", IDS_SETTINGS_DEVICE_TITLE}, - {"scrollLabel", IDS_SETTINGS_SCROLL_LABEL}, {"touchPadScrollLabel", IDS_OS_SETTINGS_TOUCHPAD_REVERSE_SCROLL_LABEL}, }; AddLocalizedStringsBulk(html_source, kDeviceStrings);
diff --git a/chrome/browser/ui/webui/tab_search/tab_search_page_handler.cc b/chrome/browser/ui/webui/tab_search/tab_search_page_handler.cc index 696b7ad7..b503418 100644 --- a/chrome/browser/ui/webui/tab_search/tab_search_page_handler.cc +++ b/chrome/browser/ui/webui/tab_search/tab_search_page_handler.cc
@@ -185,12 +185,8 @@ if (tab_renderer_data.favicon.isNull()) { tab_data->is_default_favicon = true; } else { - // Only send favicon_url for OTR profile where chrome://favicon2 is not - // available. - if (browser_->profile()->IsOffTheRecord()) { - tab_data->favicon_url = webui::EncodePNGAndMakeDataURI( - tab_renderer_data.favicon, web_ui_->GetDeviceScaleFactor()); - } + tab_data->favicon_url = webui::EncodePNGAndMakeDataURI( + tab_renderer_data.favicon, web_ui_->GetDeviceScaleFactor()); tab_data->is_default_favicon = tab_renderer_data.favicon.BackedBySameObjectAs( favicon::GetDefaultFavicon().AsImageSkia());
diff --git a/chrome/browser/ui/webui/tab_search/tab_search_page_handler_unittest.cc b/chrome/browser/ui/webui/tab_search/tab_search_page_handler_unittest.cc index f82df3df..8d335a6 100644 --- a/chrome/browser/ui/webui/tab_search/tab_search_page_handler_unittest.cc +++ b/chrome/browser/ui/webui/tab_search/tab_search_page_handler_unittest.cc
@@ -61,7 +61,7 @@ EXPECT_FALSE(tab->pinned); EXPECT_EQ(title, tab->title); EXPECT_EQ(url, tab->url); - EXPECT_FALSE(tab->favicon_url.has_value()); + EXPECT_TRUE(tab->favicon_url.has_value()); EXPECT_TRUE(tab->is_default_favicon); EXPECT_TRUE(tab->show_icon); EXPECT_GT(tab->last_active_time_ticks, base::TimeTicks()); @@ -367,23 +367,4 @@ handler()->CloseUI(); } -// OTR profile should have a non-empty base64 favicon_url for each tab -TEST_F(TabSearchPageHandlerTest, OTRProfileFaviconTest) { - AddTabWithTitle(browser3(), GURL(kTabUrl1), kTabName1); - BrowserList::SetLastActive(browser3()); - ASSERT_TRUE(browser3()->profile()->IsOffTheRecord()); - tab_search::mojom::PageHandler::GetProfileTabsCallback callback = - base::BindLambdaForTesting( - [&](tab_search::mojom::ProfileTabsPtr profile_tabs) { - ASSERT_EQ(1u, profile_tabs->windows.size()); - auto* window1 = profile_tabs->windows[0].get(); - ASSERT_EQ(1u, window1->tabs.size()); - ASSERT_TRUE(window1->tabs[0]->favicon_url.has_value()); - }); - testing::StrictMock<MockPage> page; - auto handler = std::make_unique<TestTabSearchPageHandler>( - page.BindAndGetRemote(), web_ui(), handler_delegate()); - handler->GetProfileTabs(std::move(callback)); -} - } // namespace
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index 0408b0df..9210e94 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-master-1601315959-4ec2d6a153e04750c200a2fe71bb63fd4f2d802c.profdata +chrome-linux-master-1601337561-307983a438d89a0d060ed0a79e008eada61629c3.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index 482145f..8b06fed 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-master-1601315959-5577f3dbf01608bf6e215c63714e131a2bd389f7.profdata +chrome-mac-master-1601337561-8feee235133953607f7453082566ed5b7d8ffb34.profdata
diff --git a/chrome/chrome_repack_locales.gni b/chrome/chrome_repack_locales.gni index b714d4e..e303c7f 100644 --- a/chrome/chrome_repack_locales.gni +++ b/chrome/chrome_repack_locales.gni
@@ -67,7 +67,7 @@ source_patterns += [ "${root_gen_dir}/ash/shortcut_viewer/strings/shortcut_viewer_strings_", "${root_gen_dir}/ash/strings/ash_strings_", - "${root_gen_dir}/chromeos/components/camera_app_ui/resources/src/strings/chromeos_camera_app_strings_", + "${root_gen_dir}/chromeos/components/camera_app_ui/resources/strings/chromeos_camera_app_strings_", "${root_gen_dir}/chromeos/strings/chromeos_strings_", "${root_gen_dir}/remoting/resources/", "${root_gen_dir}/ui/chromeos/strings/ui_chromeos_strings_", @@ -75,7 +75,7 @@ deps += [ "//ash/shortcut_viewer/strings", "//ash/strings", - "//chromeos/components/camera_app_ui/resources/src/strings", + "//chromeos/components/camera_app_ui/resources/strings", "//chromeos/strings", "//remoting/resources", "//ui/chromeos/strings",
diff --git a/chrome/common/profiler/BUILD.gn b/chrome/common/profiler/BUILD.gn index a877a32..4a3c69b 100644 --- a/chrome/common/profiler/BUILD.gn +++ b/chrome/common/profiler/BUILD.gn
@@ -15,6 +15,8 @@ "main_thread_stack_sampling_profiler.cc", "thread_profiler.cc", "thread_profiler_configuration.cc", + "thread_profiler_platform_configuration.cc", + "thread_profiler_platform_configuration.h", ] deps = [
diff --git a/chrome/common/profiler/stack_sampling_browsertest.cc b/chrome/common/profiler/stack_sampling_browsertest.cc index c417f8f..99b2bfb 100644 --- a/chrome/common/profiler/stack_sampling_browsertest.cc +++ b/chrome/common/profiler/stack_sampling_browsertest.cc
@@ -132,7 +132,7 @@ // DCHECK that that remains the case so these tests are re-enabled when the // sampling profiler is re-enabled there. if (base::mac::IsAtLeastOS11()) { - DCHECK(!base::StackSamplingProfiler::IsSupported()); + DCHECK(!base::StackSamplingProfiler::IsSupportedForCurrentPlatform()); return true; } #endif
diff --git a/chrome/common/profiler/thread_profiler_configuration.cc b/chrome/common/profiler/thread_profiler_configuration.cc index 39c8e26..cb4038f 100644 --- a/chrome/common/profiler/thread_profiler_configuration.cc +++ b/chrome/common/profiler/thread_profiler_configuration.cc
@@ -11,15 +11,12 @@ #include "build/build_config.h" #include "chrome/common/channel_info.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/profiler/thread_profiler_platform_configuration.h" #include "components/version_info/version_info.h" #include "content/public/common/content_switches.h" #include "extensions/buildflags/buildflags.h" #include "sandbox/policy/sandbox.h" -#if defined(OS_ANDROID) -#include "chrome/android/modules/stack_unwinder/public/module.h" -#endif - #if defined(OS_WIN) #include "base/win/static_constants.h" #endif @@ -66,21 +63,6 @@ switches::kStartStackProfilerBrowserTest; } -bool IsProfilerEnabledForChannel() { -#if defined(OS_ANDROID) - // Profiling is only enable in it's own dedicated browser tests on Android. - // TODO(crbug.com/1004855): Remove this logic to launch profiler. - return IsBrowserTestModeEnabled(); -#elif BUILDFLAG(GOOGLE_CHROME_BRANDING) - // Only run on canary and dev. - const version_info::Channel channel = chrome::GetChannel(); - return channel == version_info::Channel::CANARY || - channel == version_info::Channel::DEV; -#else - return true; -#endif -} - bool ShouldEnableProfilerForNextRendererProcess() { // Ensure deterministic behavior for testing the profiler itself. if (IsBrowserTestModeEnabled()) @@ -93,7 +75,11 @@ } // namespace ThreadProfilerConfiguration::ThreadProfilerConfiguration() - : configuration_(GenerateConfiguration()) {} + : platform_configuration_(ThreadProfilerPlatformConfiguration::Create( + IsBrowserTestModeEnabled())), + configuration_(GenerateConfiguration(*platform_configuration_)) {} + +ThreadProfilerConfiguration::~ThreadProfilerConfiguration() = default; base::StackSamplingProfiler::SamplingParams ThreadProfilerConfiguration::GetSamplingParams() const { @@ -129,10 +115,10 @@ std::string* group_name) const { DCHECK(IsBrowserProcess()); - if (!base::StackSamplingProfiler::IsSupported()) + if (!platform_configuration_->IsSupported(BUILDFLAG(GOOGLE_CHROME_BRANDING), + chrome::GetChannel())) { return false; - if (!IsProfilerEnabledForChannel()) - return false; + } *trial_name = "SyntheticStackProfilingConfiguration"; *group_name = std::string(); @@ -220,37 +206,31 @@ // static ThreadProfilerConfiguration::ProfileConfiguration -ThreadProfilerConfiguration::GenerateConfiguration() { +ThreadProfilerConfiguration::GenerateConfiguration( + const ThreadProfilerPlatformConfiguration& platform_configuration) { if (!IsBrowserProcess()) return PROFILE_FROM_COMMAND_LINE; - if (!base::StackSamplingProfiler::IsSupported()) + const version_info::Channel channel = chrome::GetChannel(); + if (!platform_configuration.IsSupported(BUILDFLAG(GOOGLE_CHROME_BRANDING), + channel)) { return PROFILE_DISABLED; - if (!IsProfilerEnabledForChannel()) - return PROFILE_DISABLED; - -#if defined(OS_ANDROID) - // Allow profiling if the Android Java/native unwinder module is available at - // initialization time. Otherwise request that it be installed for use on the - // next run of Chrome and disable profiling. - if (!stack_unwinder::Module::IsInstalled()) { -#if BUILDFLAG(GOOGLE_CHROME_BRANDING) - // We only want to incur the cost of universally downloading the module in - // early channels, where profiling will occur over substantially all of the - // population. When supporting later channels in the future we will enable - // profiling for only a fraction of users and only download for those users. - const version_info::Channel channel = chrome::GetChannel(); - if (channel == version_info::Channel::CANARY || - channel == version_info::Channel::DEV) { - stack_unwinder::Module::RequestInstallation(); - } -#else - // This is a development build. The module is only available in the Play - // Store for releases so don't try to install it. -#endif - return PROFILE_DISABLED_MODULE_NOT_INSTALLED; } -#endif + + using RuntimeModuleState = + ThreadProfilerPlatformConfiguration::RuntimeModuleState; + switch (platform_configuration.GetRuntimeModuleState( + BUILDFLAG(GOOGLE_CHROME_BRANDING), channel)) { + case RuntimeModuleState::kModuleAbsentButAvailable: + platform_configuration.RequestRuntimeModuleInstall(); + FALLTHROUGH; + case RuntimeModuleState::kModuleNotAvailable: + return PROFILE_DISABLED_MODULE_NOT_INSTALLED; + + case RuntimeModuleState::kModuleNotRequired: + case RuntimeModuleState::kModulePresent: + break; + } switch (chrome::GetChannel()) { // Enable the profiler unconditionally for development/waterfall builds.
diff --git a/chrome/common/profiler/thread_profiler_configuration.h b/chrome/common/profiler/thread_profiler_configuration.h index 1625e183..a92fb2e2 100644 --- a/chrome/common/profiler/thread_profiler_configuration.h +++ b/chrome/common/profiler/thread_profiler_configuration.h
@@ -15,6 +15,8 @@ class CommandLine; } // namespace base +class ThreadProfilerPlatformConfiguration; + // ThreadProfilerConfiguration chooses a configuration for the enable state of // the stack sampling profiler across all processes. This configuration is // determined once at browser process startup. Configurations for child @@ -22,6 +24,7 @@ class ThreadProfilerConfiguration { public: ThreadProfilerConfiguration(); + ~ThreadProfilerConfiguration(); // Get the stack sampling params to use. base::StackSamplingProfiler::SamplingParams GetSamplingParams() const; @@ -72,11 +75,15 @@ const std::vector<Variation>& variations); // Generates sampling profiler configurations for all processes. - static ProfileConfiguration GenerateConfiguration(); + static ProfileConfiguration GenerateConfiguration( + const ThreadProfilerPlatformConfiguration& platform_configuration); // NOTE: all state in this class must be const and initialized at construction // time to ensure thread-safe access post-construction. + const std::unique_ptr<ThreadProfilerPlatformConfiguration> + platform_configuration_; + // In the browser process this represents the configuration to use across all // Chrome processes. In the child processes it is always // PROFILE_FROM_COMMAND_LINE.
diff --git a/chrome/common/profiler/thread_profiler_platform_configuration.cc b/chrome/common/profiler/thread_profiler_platform_configuration.cc new file mode 100644 index 0000000..8118d2d --- /dev/null +++ b/chrome/common/profiler/thread_profiler_platform_configuration.cc
@@ -0,0 +1,163 @@ +// Copyright 2020 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/common/profiler/thread_profiler_platform_configuration.h" + +#include "base/command_line.h" +#include "base/profiler/stack_sampling_profiler.h" +#include "build/build_config.h" +#include "content/public/common/content_switches.h" + +#if defined(OS_ANDROID) +#include "chrome/android/modules/stack_unwinder/public/module.h" +#endif + +namespace { + +// The default configuration to use in the absence of special circumstances on a +// specific platform. +class DefaultPlatformConfiguration + : public ThreadProfilerPlatformConfiguration { + public: + explicit DefaultPlatformConfiguration(bool browser_test_mode_enabled); + + // ThreadProfilerPlatformConfiguration: + RuntimeModuleState GetRuntimeModuleState( + bool is_chrome_branded, + version_info::Channel channel) const override; + + protected: + bool IsSupportedForChannel(bool is_chrome_branded, + version_info::Channel channel) const override; + + bool browser_test_mode_enabled() const { return browser_test_mode_enabled_; } + + private: + const bool browser_test_mode_enabled_; +}; + +DefaultPlatformConfiguration::DefaultPlatformConfiguration( + bool browser_test_mode_enabled) + : browser_test_mode_enabled_(browser_test_mode_enabled) {} + +ThreadProfilerPlatformConfiguration::RuntimeModuleState +DefaultPlatformConfiguration::GetRuntimeModuleState( + bool is_chrome_branded, + version_info::Channel channel) const { + return RuntimeModuleState::kModuleNotRequired; +} + +bool DefaultPlatformConfiguration::IsSupportedForChannel( + bool is_chrome_branded, + version_info::Channel channel) const { + // The profiler is always supported for local builds and the CQ. + if (!is_chrome_branded) + return true; + + // Canary and dev are the only channels currently supported in release + // builds. + return channel == version_info::Channel::CANARY || + channel == version_info::Channel::DEV; +} + +#if defined(OS_ANDROID) +bool IsBrowserProcess() { + return base::CommandLine::ForCurrentProcess() + ->GetSwitchValueASCII(switches::kProcessType) + .empty(); +} + +// The configuration to use for the Android platform. Applies to ARM32 which is +// the only Android architecture currently supported by StackSamplingProfiler. +// Defined in terms of DefaultPlatformConfiguration where Android does not +// differ from the default case. +class AndroidPlatformConfiguration : public DefaultPlatformConfiguration { + public: + explicit AndroidPlatformConfiguration(bool browser_test_mode_enabled); + + // DefaultPlatformConfiguration: + RuntimeModuleState GetRuntimeModuleState( + bool is_chrome_branded, + version_info::Channel channel) const override; + + void RequestRuntimeModuleInstall() const override; + + protected: + bool IsSupportedForChannel(bool is_chrome_branded, + version_info::Channel channel) const override; +}; + +AndroidPlatformConfiguration::AndroidPlatformConfiguration( + bool browser_test_mode_enabled) + : DefaultPlatformConfiguration(browser_test_mode_enabled) {} + +ThreadProfilerPlatformConfiguration::RuntimeModuleState +AndroidPlatformConfiguration::GetRuntimeModuleState( + bool is_chrome_branded, + version_info::Channel channel) const { + // The module will be present in releases due to having been installed via + // RequestRuntimeModuleInstall(), and in local/CQ builds of bundle targets + // where the module was installed with the bundle. + if (stack_unwinder::Module::IsInstalled()) + return RuntimeModuleState::kModulePresent; + + if (is_chrome_branded) { + // We only want to incur the cost of universally downloading the module in + // early channels, where profiling will occur over substantially all of + // the population. When supporting later channels in the future we will + // enable profiling for only a fraction of users and only download for + // those users. + if (channel == version_info::Channel::CANARY || + channel == version_info::Channel::DEV) { + return RuntimeModuleState::kModuleAbsentButAvailable; + } + + return RuntimeModuleState::kModuleNotAvailable; + } + + // This is a local or CQ build of a bundle where the module was not + // installed with the bundle, or an apk where the module is not included. + // The module is installable from the Play Store only for released Chrome so + // is not available in this build. + return RuntimeModuleState::kModuleNotAvailable; +} + +void AndroidPlatformConfiguration::RequestRuntimeModuleInstall() const { + // The install can only be done in the browser process. + CHECK(IsBrowserProcess()); + + // The install occurs asynchronously, with the module available at the first + // run of Chrome following install. + stack_unwinder::Module::RequestInstallation(); +} + +bool AndroidPlatformConfiguration::IsSupportedForChannel( + bool is_chrome_branded, + version_info::Channel channel) const { + // On Android profiling is only enabled in its own dedicated browser tests + // in local builds and the CQ. + // TODO(https://crbug.com/1004855): Enable across all browser tests. + return browser_test_mode_enabled(); +} +#endif // defined(OS_ANDROID) + +} // namespace + +// static +std::unique_ptr<ThreadProfilerPlatformConfiguration> +ThreadProfilerPlatformConfiguration::Create(bool browser_test_mode_enabled) { +#if defined(OS_ANDROID) + using PlatformConfiguration = AndroidPlatformConfiguration; +#else + using PlatformConfiguration = DefaultPlatformConfiguration; +#endif + return std::make_unique<PlatformConfiguration>(browser_test_mode_enabled); +} + +bool ThreadProfilerPlatformConfiguration::IsSupported( + bool is_chrome_branded, + version_info::Channel channel) const { + return base::StackSamplingProfiler::IsSupportedForCurrentPlatform() && + IsSupportedForChannel(is_chrome_branded, channel); +}
diff --git a/chrome/common/profiler/thread_profiler_platform_configuration.h b/chrome/common/profiler/thread_profiler_platform_configuration.h new file mode 100644 index 0000000..95479798 --- /dev/null +++ b/chrome/common/profiler/thread_profiler_platform_configuration.h
@@ -0,0 +1,68 @@ +// Copyright 2020 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_COMMON_PROFILER_THREAD_PROFILER_PLATFORM_CONFIGURATION_H_ +#define CHROME_COMMON_PROFILER_THREAD_PROFILER_PLATFORM_CONFIGURATION_H_ + +#include <memory> + +#include "components/version_info/version_info.h" + +// Encapsulates the platform-specific configuration for the ThreadProfiler. +// +// The interface functions this class make a distinction between 'supported' and +// 'enabled' state. Supported means the profiler can be run in *some* +// circumstances for *some* fraction of the population on the +// platform/branding/channel combination. This state is intended to enable +// experiment reporting. This avoids spamming UMA with experiment state on +// platforms/channels where the profiler is not being run. +// +// Enabled means we chose to the run the profiler on at least some threads on a +// platform/branding/channel combination that is configured for profiling. The +// overall enable/disable state should be reported to UMA in this case. +class ThreadProfilerPlatformConfiguration { + public: + // State of the runtime module used by the profiler on the platform (if any). + // Android in particular requires use of a dynamic feature modules to provide + // the native unwinder. + enum class RuntimeModuleState { + // States that allow profiling. + kModuleNotRequired, // No module is required. + kModulePresent, // The module is present for use. + + // States that don't allow profiling in this run of Chrome. + kModuleAbsentButAvailable, // A module is not present but is installable. + kModuleNotAvailable, // A module is necessary but not available. + }; + + virtual ~ThreadProfilerPlatformConfiguration() = default; + + // Create the platform configuration. + static std::unique_ptr<ThreadProfilerPlatformConfiguration> Create( + bool browser_test_mode_enabled); + + // True if the platform supports the StackSamplingProfiler and the profiler is + // to be run for the channel/chrome branding. + bool IsSupported(bool is_chrome_branded, version_info::Channel channel) const; + + // Returns the current state of the runtime support module for the + // channel/chrome branding on the platform. Runtime module state is valid only + // if IsSupported(). + virtual RuntimeModuleState GetRuntimeModuleState( + bool is_chrome_branded, + version_info::Channel channel) const = 0; + + // Request install of the runtime support module. May be invoked only if + // GetRuntimeModuleState() returns kModuleAbsentButAvailable. + virtual void RequestRuntimeModuleInstall() const {} + + protected: + // True if the profiler is to be run for the channel/chrome branding on the + // platform. Does not need to check whether the StackSamplingProfiler is + // supported on the platform since that's done in IsSupported(). + virtual bool IsSupportedForChannel(bool is_chrome_branded, + version_info::Channel channel) const = 0; +}; + +#endif // CHROME_COMMON_PROFILER_THREAD_PROFILER_PLATFORM_CONFIGURATION_H_
diff --git a/chrome/common/profiler/thread_profiler_platform_configuration_unittest.cc b/chrome/common/profiler/thread_profiler_platform_configuration_unittest.cc new file mode 100644 index 0000000..1b09af2 --- /dev/null +++ b/chrome/common/profiler/thread_profiler_platform_configuration_unittest.cc
@@ -0,0 +1,133 @@ +// Copyright 2020 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/common/profiler/thread_profiler_platform_configuration.h" + +#include "base/profiler/profiler_buildflags.h" +#include "build/build_config.h" +#include "components/version_info/version_info.h" +#include "testing/gtest/include/gtest/gtest.h" + +#if (defined(OS_WIN) && defined(ARCH_CPU_X86_64)) || \ + (defined(OS_MAC) && defined(ARCH_CPU_X86_64)) || \ + (defined(OS_ANDROID) && BUILDFLAG(ENABLE_ARM_CFI_TABLE)) +#define THREAD_PROFILER_SUPPORTED_ON_PLATFORM true +#else +#define THREAD_PROFILER_SUPPORTED_ON_PLATFORM false +#endif + +class ThreadProfilerPlatformConfigurationTest : public ::testing::Test { + public: + // The browser_test_mode_enabled=true scenario is already covered by the + // browser tests so doesn't require separate testing here. + ThreadProfilerPlatformConfigurationTest() + : config_(ThreadProfilerPlatformConfiguration::Create( + /*browser_test_mode_enabled=*/false)) {} + + const std::unique_ptr<ThreadProfilerPlatformConfiguration>& config() { + return config_; + } + + private: + const std::unique_ptr<ThreadProfilerPlatformConfiguration> config_; +}; + +#if THREAD_PROFILER_SUPPORTED_ON_PLATFORM +#define MAYBE_PLATFORM_CONFIG_TEST_F(suite, test) TEST_F(suite, test) +#else +#define MAYBE_PLATFORM_CONFIG_TEST_F(suite, test) TEST_F(suite, DISABLED_##test) +#endif + +TEST_F(ThreadProfilerPlatformConfigurationTest, IsSupported) { +#if !THREAD_PROFILER_SUPPORTED_ON_PLATFORM + EXPECT_FALSE(config()->IsSupported(/*is_chrome_branded=*/true, + version_info::Channel::UNKNOWN)); + EXPECT_FALSE(config()->IsSupported(/*is_chrome_branded=*/true, + version_info::Channel::CANARY)); + EXPECT_FALSE(config()->IsSupported(/*is_chrome_branded=*/true, + version_info::Channel::DEV)); + EXPECT_FALSE(config()->IsSupported(/*is_chrome_branded=*/true, + version_info::Channel::BETA)); + EXPECT_FALSE(config()->IsSupported(/*is_chrome_branded=*/true, + version_info::Channel::STABLE)); + + EXPECT_FALSE(config()->IsSupported(/*is_chrome_branded=*/false, + version_info::Channel::UNKNOWN)); +#elif defined(OS_ANDROID) + EXPECT_FALSE(config()->IsSupported(/*is_chrome_branded=*/true, + version_info::Channel::UNKNOWN)); + EXPECT_FALSE(config()->IsSupported(/*is_chrome_branded=*/true, + version_info::Channel::CANARY)); + EXPECT_FALSE(config()->IsSupported(/*is_chrome_branded=*/true, + version_info::Channel::DEV)); + EXPECT_FALSE(config()->IsSupported(/*is_chrome_branded=*/true, + version_info::Channel::BETA)); + EXPECT_FALSE(config()->IsSupported(/*is_chrome_branded=*/true, + version_info::Channel::STABLE)); + + EXPECT_FALSE(config()->IsSupported(/*is_chrome_branded=*/false, + version_info::Channel::UNKNOWN)); +#else + EXPECT_FALSE(config()->IsSupported(/*is_chrome_branded=*/true, + version_info::Channel::UNKNOWN)); + EXPECT_TRUE(config()->IsSupported(/*is_chrome_branded=*/true, + version_info::Channel::CANARY)); + EXPECT_TRUE(config()->IsSupported(/*is_chrome_branded=*/true, + version_info::Channel::DEV)); + EXPECT_FALSE(config()->IsSupported(/*is_chrome_branded=*/true, + version_info::Channel::BETA)); + EXPECT_FALSE(config()->IsSupported(/*is_chrome_branded=*/true, + version_info::Channel::STABLE)); + + EXPECT_TRUE(config()->IsSupported(/*is_chrome_branded=*/false, + version_info::Channel::UNKNOWN)); +#endif +} + +MAYBE_PLATFORM_CONFIG_TEST_F(ThreadProfilerPlatformConfigurationTest, + GetRuntimeModuleState) { + using RuntimeModuleState = + ThreadProfilerPlatformConfiguration::RuntimeModuleState; +#if defined(OS_ANDROID) + EXPECT_EQ(RuntimeModuleState::kModuleNotAvailable, + config()->GetRuntimeModuleState(/*is_chrome_branded=*/true, + version_info::Channel::UNKNOWN)); + EXPECT_EQ(RuntimeModuleState::kModuleAbsentButAvailable, + config()->GetRuntimeModuleState(/*is_chrome_branded=*/true, + version_info::Channel::CANARY)); + EXPECT_EQ(RuntimeModuleState::kModuleAbsentButAvailable, + config()->GetRuntimeModuleState(/*is_chrome_branded=*/true, + version_info::Channel::DEV)); + EXPECT_EQ(RuntimeModuleState::kModuleNotAvailable, + config()->GetRuntimeModuleState(/*is_chrome_branded=*/true, + version_info::Channel::BETA)); + EXPECT_EQ(RuntimeModuleState::kModuleNotAvailable, + config()->GetRuntimeModuleState(/*is_chrome_branded=*/true, + version_info::Channel::STABLE)); + + EXPECT_EQ(RuntimeModuleState::kModuleNotAvailable, + config()->GetRuntimeModuleState(/*is_chrome_branded=*/true, + version_info::Channel::UNKNOWN)); +#else + EXPECT_EQ(RuntimeModuleState::kModuleNotRequired, + config()->GetRuntimeModuleState(/*is_chrome_branded=*/true, + version_info::Channel::UNKNOWN)); + EXPECT_EQ(RuntimeModuleState::kModuleNotRequired, + config()->GetRuntimeModuleState(/*is_chrome_branded=*/true, + version_info::Channel::CANARY)); + EXPECT_EQ(RuntimeModuleState::kModuleNotRequired, + config()->GetRuntimeModuleState(/*is_chrome_branded=*/true, + version_info::Channel::DEV)); + EXPECT_EQ(RuntimeModuleState::kModuleNotRequired, + config()->GetRuntimeModuleState(/*is_chrome_branded=*/true, + version_info::Channel::BETA)); + EXPECT_EQ(RuntimeModuleState::kModuleNotRequired, + config()->GetRuntimeModuleState(/*is_chrome_branded=*/true, + version_info::Channel::STABLE)); + + EXPECT_EQ(RuntimeModuleState::kModuleNotRequired, + config()->GetRuntimeModuleState(/*is_chrome_branded=*/true, + version_info::Channel::UNKNOWN)); +#endif +}
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 1b4a7d1..7983783 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -3773,6 +3773,7 @@ "../common/mac/mock_launchd.mm", "../common/net/safe_search_util_unittest.cc", "../common/pref_names_util_unittest.cc", + "../common/profiler/thread_profiler_platform_configuration_unittest.cc", "../common/profiler/thread_profiler_unittest.cc", "../common/qr_code_generator/qr_code_generator_unittest.cc", "../renderer/chrome_content_renderer_client_unittest.cc",
diff --git a/chrome/test/data/extensions/api_test/automation/sites/textarea_append.html b/chrome/test/data/extensions/api_test/automation/sites/textarea_append.html new file mode 100644 index 0000000..96a3e97 --- /dev/null +++ b/chrome/test/data/extensions/api_test/automation/sites/textarea_append.html
@@ -0,0 +1,37 @@ +<!-- + * Copyright 2020 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. +--> +<html> +<head> +<title>Automation Tests - TextArea Append Perf</title> +</head> +<body> + +<button>Go</button> +<textarea id="testElement" spellcheck=false style="height:90vh"></textarea> +<a id="done" href="#">Done</a> + +<script> + let button = document.body.querySelector('button'); + button.addEventListener('click', () => { + // Fill the textarea with 10 lines of random numbers, + // 10 times, and then focus the 'done' link. + let testElement = document.getElementById('testElement'); + function go(iteration) { + if (iteration == 10) { + document.getElementById('done').focus(); + } else { + testElement.textContent += new Array(100).fill(0).map( + (_, i) => Math.floor(100*Math.random())).join('\n'); + setTimeout(() => { + go(iteration + 1); + }, 0); + } + } + go(0); + }); +</script> +</body> +</html>
diff --git a/chrome/test/data/extensions/api_test/automation/tests/tabs/textarea_append_perf.html b/chrome/test/data/extensions/api_test/automation/tests/tabs/textarea_append_perf.html new file mode 100644 index 0000000..9fce7bcb --- /dev/null +++ b/chrome/test/data/extensions/api_test/automation/tests/tabs/textarea_append_perf.html
@@ -0,0 +1,7 @@ +<!-- + * Copyright 2020 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. +--> +<script src="common.js"></script> +<script src="textarea_append_perf.js"></script>
diff --git a/chrome/test/data/extensions/api_test/automation/tests/tabs/textarea_append_perf.js b/chrome/test/data/extensions/api_test/automation/tests/tabs/textarea_append_perf.js new file mode 100644 index 0000000..6899413 --- /dev/null +++ b/chrome/test/data/extensions/api_test/automation/tests/tabs/textarea_append_perf.js
@@ -0,0 +1,24 @@ +// Copyright 2020 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. + +var allTests = [ + function testTextareaAppend() { + let runButton = rootNode.find({ role: 'button'}); + assertEq('button', runButton.role); + + let doneLink = rootNode.find({ role: 'link'}); + assertEq('link', doneLink.role); + + rootNode.addEventListener('childrenChanged', (evt) => { + }); + + doneLink.addEventListener('focus', () => { + chrome.test.succeed(); + }); + + runButton.doDefault(); + } +]; + +setUpAndRunTests(allTests, 'textarea_append.html');
diff --git a/chrome/test/data/webui/BUILD.gn b/chrome/test/data/webui/BUILD.gn index 0c7d9cf..bd46696 100644 --- a/chrome/test/data/webui/BUILD.gn +++ b/chrome/test/data/webui/BUILD.gn
@@ -327,6 +327,7 @@ "$root_gen_dir/chrome/test/data/webui/settings/chromeos/test_os_reset_browser_proxy.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/test_os_sync_browser_proxy.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/test_wallpaper_browser_proxy.m.js", + "$root_gen_dir/chrome/test/data/webui/settings/chromeos/tether_connection_dialog_test.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/timezone_selector_test.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/timezone_subpage_test.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/test_cups_printers_browser_proxy.m.js",
diff --git a/chrome/test/data/webui/print_preview/destination_dropdown_cros_test.js b/chrome/test/data/webui/print_preview/destination_dropdown_cros_test.js index ad1a82a3..3681179f 100644 --- a/chrome/test/data/webui/print_preview/destination_dropdown_cros_test.js +++ b/chrome/test/data/webui/print_preview/destination_dropdown_cros_test.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {Destination, DestinationConnectionStatus, DestinationOrigin, DestinationType, NativeLayer, NativeLayerImpl, PrinterState, PrinterStatusReason, PrinterStatusSeverity} from 'chrome://print/print_preview.js'; +import {Destination, DestinationConnectionStatus, DestinationOrigin, DestinationType} from 'chrome://print/print_preview.js'; import {assert} from 'chrome://resources/js/assert.m.js'; import {keyDownOn, move} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; @@ -10,7 +10,6 @@ import {assertEquals, assertFalse, assertTrue} from '../chai_assert.js'; import {eventToPromise} from '../test_util.m.js'; -import {NativeLayerStub} from './native_layer_stub.js'; import {getGoogleDriveDestination, getSaveAsPdfDestination} from './print_preview_test_utils.js'; window.destination_dropdown_cros_test = {}; @@ -27,8 +26,6 @@ EnterOpensCloses: 'enter opens and closes dropdown', HighlightedFollowsMouse: 'highlighted follows mouse', Disabled: 'disabled', - NewStatusUpdatesDestinationIcon: 'new status updates destination icon', - ChangingDestinationUpdatesIcon: 'changing destination updates icon', HighlightedWhenOpened: 'highlighted when opened', }; @@ -36,9 +33,6 @@ /** @type {!PrintPreviewDestinationDropdownCrosElement} */ let dropdown; - /** @type {?NativeLayerStub} */ - let nativeLayer = null; - /** @param {!Array<!Destination>} items */ function setItemList(items) { dropdown.itemList = items; @@ -98,42 +92,10 @@ DestinationConnectionStatus.ONLINE); } - function setNativeLayerPrinterStatusMap() { - [{ - printerId: 'One', - statusReasons: [{ - reason: PrinterStatusReason.NO_ERROR, - severity: PrinterStatusSeverity.UNKNOWN_SEVERITY - }], - }, - { - printerId: 'Two', - statusReasons: [{ - reason: PrinterStatusReason.OUT_OF_INK, - severity: PrinterStatusSeverity.ERROR - }], - }, - { - printerId: 'Three', - statusReasons: [{ - reason: PrinterStatusReason.UNKNOWN_REASON, - severity: PrinterStatusSeverity.UNKNOWN_SEVERITY - }], - }] - .forEach( - status => - nativeLayer.addPrinterStatusToMap(status.printerId, status)); - } - /** @override */ setup(function() { document.body.innerHTML = ''; - // Stub out native layer. - nativeLayer = new NativeLayerStub(); - NativeLayerImpl.instance_ = nativeLayer; - setNativeLayerPrinterStatusMap(); - dropdown = /** @type {!PrintPreviewDestinationDropdownCrosElement} */ (document.createElement('print-preview-destination-dropdown-cros')); @@ -300,53 +262,6 @@ }); test( - assert(destination_dropdown_cros_test.TestNames - .NewStatusUpdatesDestinationIcon), - function() { - const destinationBadge = dropdown.$$('#destination-badge'); - dropdown.value = createDestination('Two', DestinationOrigin.CROS); - assertEquals(PrinterState.UNKNOWN, destinationBadge.printerState); - - return dropdown.value.requestPrinterStatus().then(() => { - // After printer stauts is updated the state will still be UNKNOWN. - assertEquals(PrinterState.UNKNOWN, destinationBadge.printerState); - - // Only after the path is notified will the state update to ERROR. - dropdown.notifyPath(`value.printerStatusReason`); - assertEquals(PrinterState.ERROR, destinationBadge.printerState); - }); - }); - - test( - assert(destination_dropdown_cros_test.TestNames - .ChangingDestinationUpdatesIcon), - function() { - const goodDestination = - createDestination('One', DestinationOrigin.CROS); - const errorDestination = - createDestination('Two', DestinationOrigin.CROS); - const unknownDestination = - createDestination('Three', DestinationOrigin.CROS); - const destinationBadge = dropdown.$$('#destination-badge'); - - return goodDestination.requestPrinterStatus() - .then(() => { - dropdown.value = goodDestination; - assertEquals(PrinterState.GOOD, destinationBadge.printerState); - return errorDestination.requestPrinterStatus(); - }) - .then(() => { - dropdown.value = errorDestination; - assertEquals(PrinterState.ERROR, destinationBadge.printerState); - return unknownDestination.requestPrinterStatus(); - }) - .then(() => { - dropdown.value = unknownDestination; - assertEquals(PrinterState.UNKNOWN, destinationBadge.printerState); - }); - }); - - test( assert(destination_dropdown_cros_test.TestNames.HighlightedWhenOpened), function() { const destinationTwo = createDestination('Two', DestinationOrigin.CROS);
diff --git a/chrome/test/data/webui/print_preview/destination_item_test_cros.js b/chrome/test/data/webui/print_preview/destination_item_test_cros.js index c89b8668..dd7a822 100644 --- a/chrome/test/data/webui/print_preview/destination_item_test_cros.js +++ b/chrome/test/data/webui/print_preview/destination_item_test_cros.js
@@ -70,11 +70,11 @@ test( assert(destination_item_test_cros.TestNames.NewStatusUpdatesIcon), function() { - const statusIcon = listItem.$$('printer-status-icon-cros'); - assertEquals(PrinterState.UNKNOWN, statusIcon.printerState); + const icon = listItem.$$('iron-icon'); + assertEquals('print-preview:printer-status-grey', icon.icon); return listItem.destination.requestPrinterStatus().then(() => { - assertEquals(PrinterState.GOOD, statusIcon.printerState); + assertEquals('print-preview:printer-status-green', icon.icon); }); }); @@ -82,8 +82,8 @@ assert( destination_item_test_cros.TestNames.ChangingDestinationUpdatesIcon), function() { - const statusIcon = listItem.$$('printer-status-icon-cros'); - assertEquals(PrinterState.UNKNOWN, statusIcon.printerState); + const icon = listItem.$$('iron-icon'); + assertEquals('print-preview:printer-status-grey', icon.icon); listItem.destination = new Destination( 'Two', DestinationType.LOCAL, DestinationOrigin.CROS, @@ -91,7 +91,7 @@ {description: 'ABC'}); return waitBeforeNextRender(listItem).then(() => { - assertEquals(PrinterState.ERROR, statusIcon.printerState); + assertEquals('print-preview:printer-status-red', icon.icon); }); }); @@ -102,8 +102,8 @@ assert( destination_item_test_cros.TestNames.OnlyUpdateMatchingDestination), function() { - const statusIcon = listItem.$$('printer-status-icon-cros'); - assertEquals(PrinterState.UNKNOWN, statusIcon.printerState); + const icon = listItem.$$('iron-icon'); + assertEquals('print-preview:printer-status-grey', icon.icon); const firstDestinationStatusRequestPromise = listItem.destination.requestPrinterStatus(); @@ -117,7 +117,7 @@ return firstDestinationStatusRequestPromise.then(() => { // PrinterState should stay the same because the destination in the // status request response doesn't match. - assertEquals(PrinterState.UNKNOWN, statusIcon.printerState); + assertEquals('print-preview:printer-status-grey', icon.icon); }); }); });
diff --git a/chrome/test/data/webui/print_preview/destination_select_test_cros.js b/chrome/test/data/webui/print_preview/destination_select_test_cros.js index b7cdf4dc..7cdbd98 100644 --- a/chrome/test/data/webui/print_preview/destination_select_test_cros.js +++ b/chrome/test/data/webui/print_preview/destination_select_test_cros.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {Destination, DestinationConnectionStatus, DestinationOrigin, DestinationType, getSelectDropdownBackground, NativeLayer, NativeLayerImpl, PrinterState, PrinterStatus, PrinterStatusReason, PrinterStatusSeverity, SAVE_TO_DRIVE_CROS_DESTINATION_KEY} from 'chrome://print/print_preview.js'; +import {Destination, DestinationConnectionStatus, DestinationOrigin, DestinationType, getSelectDropdownBackground, NativeLayer, NativeLayerImpl, PrinterStatus, PrinterStatusReason, PrinterStatusSeverity, SAVE_TO_DRIVE_CROS_DESTINATION_KEY} from 'chrome://print/print_preview.js'; import {assert} from 'chrome://resources/js/assert.m.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {Base, flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; @@ -199,33 +199,33 @@ .then(() => { const dropdown = destinationSelect.$$('#dropdown'); assertEquals( - PrinterState.GOOD, + 'print-preview:printer-status-green', dropdown.$$(`#${escapeForwardSlahes(destination1.key)}`) - .firstChild.printerState); + .firstChild.icon); assertEquals( - PrinterState.GOOD, + 'print-preview:printer-status-green', dropdown.$$(`#${escapeForwardSlahes(destination2.key)}`) - .firstChild.printerState); + .firstChild.icon); assertEquals( - PrinterState.GOOD, + 'print-preview:printer-status-green', dropdown.$$(`#${escapeForwardSlahes(destination3.key)}`) - .firstChild.printerState); + .firstChild.icon); assertEquals( - PrinterState.ERROR, + 'print-preview:printer-status-red', dropdown.$$(`#${escapeForwardSlahes(destination4.key)}`) - .firstChild.printerState); + .firstChild.icon); assertEquals( - PrinterState.ERROR, + 'print-preview:printer-status-red', dropdown.$$(`#${escapeForwardSlahes(destination5.key)}`) - .firstChild.printerState); + .firstChild.icon); assertEquals( - PrinterState.ERROR, + 'print-preview:printer-status-red', dropdown.$$(`#${escapeForwardSlahes(destination6.key)}`) - .firstChild.printerState); + .firstChild.icon); assertEquals( - PrinterState.UNKNOWN, + 'print-preview:printer-status-grey', dropdown.$$(`#${escapeForwardSlahes(destination7.key)}`) - .firstChild.printerState); + .firstChild.icon); }); }); @@ -311,6 +311,8 @@ return waitBeforeNextRender(destinationSelect).then(() => { const localCrosPrinter = createDestination('ID1', 'One', DestinationOrigin.CROS); + const localNonCrosPrinter = + createDestination('ID2', 'Two', DestinationOrigin.LOCAL); const saveToDrive = getGoogleDriveDestination('account'); const saveAsPdf = getSaveAsPdfDestination(); @@ -323,6 +325,11 @@ destinationSelect.destination = localCrosPrinter; destinationSelect.updateDestination(); + assertEquals( + 'print-preview:printer-status-grey', dropdown.destinationIcon); + + destinationSelect.destination = localNonCrosPrinter; + destinationSelect.updateDestination(); assertEquals('print-preview:print', dropdown.destinationIcon); destinationSelect.destination = saveToDrive;
diff --git a/chrome/test/data/webui/print_preview/print_preview_ui_browsertest.js b/chrome/test/data/webui/print_preview/print_preview_ui_browsertest.js index 46b4881..bf74d99 100644 --- a/chrome/test/data/webui/print_preview/print_preview_ui_browsertest.js +++ b/chrome/test/data/webui/print_preview/print_preview_ui_browsertest.js
@@ -1439,20 +1439,6 @@ }); TEST_F( - 'PrintPreviewDestinationDropdownCrosTest', - 'NewStatusUpdatesDestinationIcon', function() { - this.runMochaTest(destination_dropdown_cros_test.TestNames - .NewStatusUpdatesDestinationIcon); - }); - -TEST_F( - 'PrintPreviewDestinationDropdownCrosTest', 'ChangingDestinationUpdatesIcon', - function() { - this.runMochaTest(destination_dropdown_cros_test.TestNames - .ChangingDestinationUpdatesIcon); - }); - -TEST_F( 'PrintPreviewDestinationDropdownCrosTest', 'HighlightedWhenOpened', function() { this.runMochaTest(
diff --git a/chrome/test/data/webui/settings/chromeos/BUILD.gn b/chrome/test/data/webui/settings/chromeos/BUILD.gn index 94af9a1..1d7cfec34 100644 --- a/chrome/test/data/webui/settings/chromeos/BUILD.gn +++ b/chrome/test/data/webui/settings/chromeos/BUILD.gn
@@ -78,6 +78,7 @@ "test_os_reset_browser_proxy.js", "test_wallpaper_browser_proxy.js", "test_os_sync_browser_proxy.js", + "tether_connection_dialog_test.js", "timezone_selector_test.js", "timezone_subpage_test.js", "test_cups_printers_browser_proxy.js",
diff --git a/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js b/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js index cceb0dd2..fac2067 100644 --- a/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js +++ b/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js
@@ -1217,6 +1217,20 @@ }); // eslint-disable-next-line no-var +var OSSettingsTetherConnectionDialogTest = class extends OSSettingsBrowserTest { + /** @override */ + get extraLibraries() { + return super.extraLibraries.concat([ + 'tether_connection_dialog_test.js', + ]); + } +}; + +TEST_F('OSSettingsTetherConnectionDialogTest', 'All', () => { + mocha.run(); +}); + +// eslint-disable-next-line no-var var OSSettingsPeoplePageAccountManagerTest = class extends OSSettingsBrowserTest { /** @override */
diff --git a/chrome/test/data/webui/settings/chromeos/os_settings_v3_browsertest.js b/chrome/test/data/webui/settings/chromeos/os_settings_v3_browsertest.js index a04490f2..db135520 100644 --- a/chrome/test/data/webui/settings/chromeos/os_settings_v3_browsertest.js +++ b/chrome/test/data/webui/settings/chromeos/os_settings_v3_browsertest.js
@@ -122,6 +122,7 @@ ['FilesPage', 'os_files_page_test.m.js'], ['ResetPage', 'os_reset_page_test.m.js'], ['SmartInputsPage', 'smart_inputs_page_test.m.js'], + ['TetherConnectionDialog', 'tether_connection_dialog_test.m.js'], ['TimezoneSelector', 'timezone_selector_test.m.js'], ['TimezoneSubpage', 'timezone_subpage_test.m.js'], ['CupsPrinterPage', 'cups_printer_page_tests.m.js'],
diff --git a/chrome/test/data/webui/settings/chromeos/tether_connection_dialog_test.js b/chrome/test/data/webui/settings/chromeos/tether_connection_dialog_test.js new file mode 100644 index 0000000..f5481d61 --- /dev/null +++ b/chrome/test/data/webui/settings/chromeos/tether_connection_dialog_test.js
@@ -0,0 +1,38 @@ +// Copyright 2020 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. + +// clang-format off +// #import 'chrome://os-settings/chromeos/os_settings.js'; + +// #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +// clang-format on + +suite('TetherConnectionDialog', function() { + /** @type {!TetherConnectionDialogElement|undefined} */ + let tetherDialog; + + setup(function() { + tetherDialog = document.createElement('tether-connection-dialog'); + document.body.appendChild(tetherDialog); + Polymer.dom.flush(); + }); + + test('Battery percentage', function() { + tetherDialog.managedProperties = { + name: { + activeValue: 'name', + }, + typeProperties: { + tether: { + batteryPercentage: 75, + signalStrength: 0, + }, + }, + }; + Polymer.dom.flush(); + + const batteryEl = tetherDialog.$.hostDeviceTextBattery; + assertEquals('75% Battery', batteryEl.innerText.trim()); + }); +});
diff --git a/chromeos/components/camera_app_ui/BUILD.gn b/chromeos/components/camera_app_ui/BUILD.gn index e809c82..9db82cb 100644 --- a/chromeos/components/camera_app_ui/BUILD.gn +++ b/chromeos/components/camera_app_ui/BUILD.gn
@@ -22,7 +22,7 @@ deps = [ ":mojo_bindings", ":mojo_bindings_js", - "resources/src/strings", + "resources/strings", "//ash/public/cpp", "//chromeos/components/web_applications", "//chromeos/constants",
diff --git a/chromeos/components/camera_app_ui/camera_app_ui.gni b/chromeos/components/camera_app_ui/camera_app_ui.gni index 37b3bb8..c916d611 100644 --- a/chromeos/components/camera_app_ui/camera_app_ui.gni +++ b/chromeos/components/camera_app_ui/camera_app_ui.gni
@@ -5,5 +5,5 @@ # The directory where to store generated resource files for strings. It is # used by SWA version of CCA. gen_camera_app_dir = - "$root_gen_dir/chromeos/components/camera_app_ui/resources/src" + "$root_gen_dir/chromeos/components/camera_app_ui/resources" }
diff --git a/chromeos/components/camera_app_ui/resources.h b/chromeos/components/camera_app_ui/resources.h index 1bfed387..609ecef 100644 --- a/chromeos/components/camera_app_ui/resources.h +++ b/chromeos/components/camera_app_ui/resources.h
@@ -5,7 +5,7 @@ #ifndef CHROMEOS_COMPONENTS_CAMERA_APP_UI_RESOURCES_H_ #define CHROMEOS_COMPONENTS_CAMERA_APP_UI_RESOURCES_H_ -#include "chromeos/components/camera_app_ui/resources/src/strings/grit/chromeos_camera_app_strings.h" +#include "chromeos/components/camera_app_ui/resources/strings/grit/chromeos_camera_app_strings.h" #include "chromeos/grit/chromeos_camera_app_resources.h" #include "chromeos/grit/chromeos_camera_app_resources_map.h" #include "mojo/public/js/grit/mojo_bindings_resources.h" @@ -109,30 +109,30 @@ const char* path; int id; } kGritResourceMap[] = { - {"src/js/browser_proxy/browser_proxy.js", + {"js/browser_proxy/browser_proxy.js", IDR_CAMERA_WEBUI_BROWSER_PROXY_JS}, - {"src/js/mojo/camera_intent.mojom-lite.js", + {"js/mojo/camera_intent.mojom-lite.js", IDR_CAMERA_CAMERA_INTENT_MOJOM_LITE_JS}, - {"src/js/mojo/image_capture.mojom-lite.js", + {"js/mojo/image_capture.mojom-lite.js", IDR_CAMERA_IMAGE_CAPTURE_MOJOM_LITE_JS}, - {"src/js/mojo/camera_common.mojom-lite.js", + {"js/mojo/camera_common.mojom-lite.js", IDR_CAMERA_CAMERA_COMMON_MOJOM_LITE_JS}, - {"src/js/mojo/camera_metadata.mojom-lite.js", + {"js/mojo/camera_metadata.mojom-lite.js", IDR_CAMERA_CAMERA_METADATA_MOJOM_LITE_JS}, - {"src/js/mojo/camera_metadata_tags.mojom-lite.js", + {"js/mojo/camera_metadata_tags.mojom-lite.js", IDR_CAMERA_CAMERA_METADATA_TAGS_MOJOM_LITE_JS}, - {"src/js/mojo/camera_app.mojom-lite.js", + {"js/mojo/camera_app.mojom-lite.js", IDR_CAMERA_CAMERA_APP_MOJOM_LITE_JS}, - {"src/js/mojo/mojo_bindings_lite.js", IDR_MOJO_MOJO_BINDINGS_LITE_JS}, - {"src/js/mojo/camera_app_helper.mojom-lite.js", + {"js/mojo/mojo_bindings_lite.js", IDR_MOJO_MOJO_BINDINGS_LITE_JS}, + {"js/mojo/camera_app_helper.mojom-lite.js", IDR_CAMERA_CAMERA_APP_HELPER_MOJOM_LITE_JS}, - {"src/js/mojo/time.mojom-lite.js", IDR_CAMERA_TIME_MOJOM_LITE_JS}, - {"src/js/mojo/idle_manager.mojom-lite.js", + {"js/mojo/time.mojom-lite.js", IDR_CAMERA_TIME_MOJOM_LITE_JS}, + {"js/mojo/idle_manager.mojom-lite.js", IDR_CAMERA_IDLE_MANAGER_MOJOM_LITE_JS}, - {"src/js/mojo/camera_app.mojom-lite.js", + {"js/mojo/camera_app.mojom-lite.js", IDR_CAMERA_CAMERA_APP_MOJOM_LITE_JS}, - {"src/js/mojo/geometry.mojom-lite.js", IDR_CAMERA_GEOMETRY_MOJOM_LITE_JS}, - {"src/js/mojo/range.mojom-lite.js", IDR_CAMERA_RANGE_MOJOM_LITE_JS}, + {"js/mojo/geometry.mojom-lite.js", IDR_CAMERA_GEOMETRY_MOJOM_LITE_JS}, + {"js/mojo/range.mojom-lite.js", IDR_CAMERA_RANGE_MOJOM_LITE_JS}, }; } // namespace chromeos
diff --git a/chromeos/components/camera_app_ui/resources/.eslintignore b/chromeos/components/camera_app_ui/resources/.eslintignore index d25f4df..6b1bef1 100644 --- a/chromeos/components/camera_app_ui/resources/.eslintignore +++ b/chromeos/components/camera_app_ui/resources/.eslintignore
@@ -1 +1 @@ -src/js/lib/* +js/lib/*
diff --git a/chromeos/components/camera_app_ui/resources/BUILD.gn b/chromeos/components/camera_app_ui/resources/BUILD.gn index 2a8f4fa7..6a048ad9 100644 --- a/chromeos/components/camera_app_ui/resources/BUILD.gn +++ b/chromeos/components/camera_app_ui/resources/BUILD.gn
@@ -5,14 +5,14 @@ import("//chromeos/components/camera_app_ui/camera_app_ui.gni") group("closure_compile") { - deps = [ "src/js:closure_compile" ] + deps = [ "js:closure_compile" ] } group("chrome_camera_app") { # According to crbug.com/855747, we should list all the files we want to copy # rather than list only the folders to avoid potential building issue and ease # the difficulty to diagnose. - deps = [ "src/strings" ] + deps = [ "strings" ] data_deps = [ ":chrome_camera_app_base", @@ -34,61 +34,61 @@ } copy("chrome_camera_app_base") { - sources = [ "src/manifest.json" ] + sources = [ "manifest.json" ] outputs = [ "$out_camera_app_dir/{{source_file_part}}" ] } copy("chrome_camera_app_css") { - sources = [ "src/css/main.css" ] + sources = [ "css/main.css" ] outputs = [ "$out_camera_app_dir/css/{{source_file_part}}" ] } copy("chrome_camera_app_images") { sources = [ - "src/images/camera_app_icons_128.png", - "src/images/camera_app_icons_48.png", - "src/images/camera_button_fps_30.svg", - "src/images/camera_button_fps_60.svg", - "src/images/camera_button_grid_off.svg", - "src/images/camera_button_grid_on.svg", - "src/images/camera_button_mic_off.svg", - "src/images/camera_button_mic_on.svg", - "src/images/camera_button_mirror_off.svg", - "src/images/camera_button_mirror_on.svg", - "src/images/camera_button_settings.svg", - "src/images/camera_button_switch_device.svg", - "src/images/camera_button_switch_photo.svg", - "src/images/camera_button_switch_video.svg", - "src/images/camera_button_timer_off.svg", - "src/images/camera_button_timer_on_10s.svg", - "src/images/camera_button_timer_on_3s.svg", - "src/images/camera_focus_aim.svg", - "src/images/camera_intent_play_video.svg", - "src/images/camera_intent_result_cancel.svg", - "src/images/camera_intent_result_confirm.svg", - "src/images/camera_intro_banner_close.svg", - "src/images/camera_intro_banner_icon.svg", - "src/images/camera_mode_photo.svg", - "src/images/camera_mode_portrait.svg", - "src/images/camera_mode_square.svg", - "src/images/camera_mode_video.svg", - "src/images/camera_shutter_photo_start.svg", - "src/images/camera_shutter_photo_start_active.svg", - "src/images/camera_shutter_photo_start_hover.svg", - "src/images/camera_shutter_photo_stop.svg", - "src/images/camera_shutter_photo_stop_hover.svg", - "src/images/camera_shutter_video_pause.svg", - "src/images/settings_button_back.svg", - "src/images/settings_button_expand.svg", - "src/images/settings_expert.svg", - "src/images/settings_feedback.svg", - "src/images/settings_grid_type.svg", - "src/images/settings_help.svg", - "src/images/settings_resolution.svg", - "src/images/settings_timer_duration.svg", - "src/images/spinner.svg", + "images/camera_app_icons_128.png", + "images/camera_app_icons_48.png", + "images/camera_button_fps_30.svg", + "images/camera_button_fps_60.svg", + "images/camera_button_grid_off.svg", + "images/camera_button_grid_on.svg", + "images/camera_button_mic_off.svg", + "images/camera_button_mic_on.svg", + "images/camera_button_mirror_off.svg", + "images/camera_button_mirror_on.svg", + "images/camera_button_settings.svg", + "images/camera_button_switch_device.svg", + "images/camera_button_switch_photo.svg", + "images/camera_button_switch_video.svg", + "images/camera_button_timer_off.svg", + "images/camera_button_timer_on_10s.svg", + "images/camera_button_timer_on_3s.svg", + "images/camera_focus_aim.svg", + "images/camera_intent_play_video.svg", + "images/camera_intent_result_cancel.svg", + "images/camera_intent_result_confirm.svg", + "images/camera_intro_banner_close.svg", + "images/camera_intro_banner_icon.svg", + "images/camera_mode_photo.svg", + "images/camera_mode_portrait.svg", + "images/camera_mode_square.svg", + "images/camera_mode_video.svg", + "images/camera_shutter_photo_start.svg", + "images/camera_shutter_photo_start_active.svg", + "images/camera_shutter_photo_start_hover.svg", + "images/camera_shutter_photo_stop.svg", + "images/camera_shutter_photo_stop_hover.svg", + "images/camera_shutter_video_pause.svg", + "images/settings_button_back.svg", + "images/settings_button_expand.svg", + "images/settings_expert.svg", + "images/settings_feedback.svg", + "images/settings_grid_type.svg", + "images/settings_help.svg", + "images/settings_resolution.svg", + "images/settings_timer_duration.svg", + "images/spinner.svg", ] outputs = [ "$out_camera_app_dir/images/{{source_file_part}}" ] @@ -96,26 +96,26 @@ copy("chrome_camera_app_js") { sources = [ - "src/js/async_job_queue.js", - "src/js/background.js", - "src/js/background_ops.js", - "src/js/chrome_util.js", - "src/js/dom.js", - "src/js/error.js", - "src/js/gallerybutton.js", - "src/js/init.js", - "src/js/intent.js", - "src/js/main.js", - "src/js/metrics.js", - "src/js/nav.js", - "src/js/perf.js", - "src/js/sound.js", - "src/js/state.js", - "src/js/toast.js", - "src/js/tooltip.js", - "src/js/type.js", - "src/js/util.js", - "src/js/waitable_event.js", + "js/async_job_queue.js", + "js/background.js", + "js/background_ops.js", + "js/chrome_util.js", + "js/dom.js", + "js/error.js", + "js/gallerybutton.js", + "js/init.js", + "js/intent.js", + "js/main.js", + "js/metrics.js", + "js/nav.js", + "js/perf.js", + "js/sound.js", + "js/state.js", + "js/toast.js", + "js/tooltip.js", + "js/type.js", + "js/util.js", + "js/waitable_event.js", ] outputs = [ "$out_camera_app_dir/js/{{source_file_part}}" ] @@ -124,8 +124,8 @@ copy("chrome_camera_app_js_browser_proxy") { sources = [ # TODO(b/129956426): Remove dependency used only in closure compiler check. - "src/js/browser_proxy/browser_proxy.js", - "src/js/browser_proxy/browser_proxy_interface.js", + "js/browser_proxy/browser_proxy.js", + "js/browser_proxy/browser_proxy_interface.js", ] outputs = [ "$out_camera_app_dir/js/browser_proxy/{{source_file_part}}" ] @@ -133,9 +133,9 @@ copy("chrome_camera_app_js_device") { sources = [ - "src/js/device/camera3_device_info.js", - "src/js/device/constraints_preferrer.js", - "src/js/device/device_info_updater.js", + "js/device/camera3_device_info.js", + "js/device/constraints_preferrer.js", + "js/device/device_info_updater.js", ] outputs = [ "$out_camera_app_dir/js/device/{{source_file_part}}" ] @@ -143,10 +143,10 @@ copy("chrome_camera_app_js_lib") { sources = [ - "src/js/lib/analytics.js", - "src/js/lib/comlink.js", - "src/js/lib/ffmpeg.js", - "src/js/lib/ffmpeg.wasm", + "js/lib/analytics.js", + "js/lib/comlink.js", + "js/lib/ffmpeg.js", + "js/lib/ffmpeg.wasm", ] outputs = [ "$out_camera_app_dir/js/lib/{{source_file_part}}" ] @@ -154,17 +154,17 @@ copy("chrome_camera_app_js_models") { sources = [ - "src/js/models/async_writer.js", - "src/js/models/chrome_file_system_entry.js", - "src/js/models/file_namer.js", - "src/js/models/file_system.js", - "src/js/models/file_system_entry.js", - "src/js/models/file_util.js", - "src/js/models/lazy_directory_entry.js", - "src/js/models/mp4_video_processor.js", - "src/js/models/nop_video_processor.js", - "src/js/models/result_saver.js", - "src/js/models/video_saver.js", + "js/models/async_writer.js", + "js/models/chrome_file_system_entry.js", + "js/models/file_namer.js", + "js/models/file_system.js", + "js/models/file_system_entry.js", + "js/models/file_util.js", + "js/models/lazy_directory_entry.js", + "js/models/mp4_video_processor.js", + "js/models/nop_video_processor.js", + "js/models/result_saver.js", + "js/models/video_saver.js", ] outputs = [ "$out_camera_app_dir/js/models/{{source_file_part}}" ] @@ -172,9 +172,9 @@ copy("chrome_camera_app_js_mojo") { sources = [ - "src/js/mojo/chrome_helper.js", - "src/js/mojo/device_operator.js", - "src/js/mojo/image_capture.js", + "js/mojo/chrome_helper.js", + "js/mojo/device_operator.js", + "js/mojo/image_capture.js", ] outputs = [ "$out_camera_app_dir/js/mojo/{{source_file_part}}" ] @@ -182,12 +182,12 @@ copy("chrome_camera_app_js_views") { sources = [ - "src/js/views/camera.js", - "src/js/views/camera_intent.js", - "src/js/views/dialog.js", - "src/js/views/settings.js", - "src/js/views/view.js", - "src/js/views/warning.js", + "js/views/camera.js", + "js/views/camera_intent.js", + "js/views/dialog.js", + "js/views/settings.js", + "js/views/view.js", + "js/views/warning.js", ] outputs = [ "$out_camera_app_dir/js/views/{{source_file_part}}" ] @@ -195,11 +195,11 @@ copy("chrome_camera_app_js_views_camera") { sources = [ - "src/js/views/camera/layout.js", - "src/js/views/camera/options.js", - "src/js/views/camera/preview.js", - "src/js/views/camera/review_result.js", - "src/js/views/camera/timertick.js", + "js/views/camera/layout.js", + "js/views/camera/options.js", + "js/views/camera/preview.js", + "js/views/camera/review_result.js", + "js/views/camera/timertick.js", ] outputs = [ "$out_camera_app_dir/js/views/camera/{{source_file_part}}" ] @@ -207,13 +207,13 @@ copy("chrome_camera_app_js_views_camera_mode") { sources = [ - "src/js/views/camera/mode/index.js", - "src/js/views/camera/mode/mode_base.js", - "src/js/views/camera/mode/photo.js", - "src/js/views/camera/mode/portrait.js", - "src/js/views/camera/mode/record_time.js", - "src/js/views/camera/mode/square.js", - "src/js/views/camera/mode/video.js", + "js/views/camera/mode/index.js", + "js/views/camera/mode/mode_base.js", + "js/views/camera/mode/photo.js", + "js/views/camera/mode/portrait.js", + "js/views/camera/mode/record_time.js", + "js/views/camera/mode/square.js", + "js/views/camera/mode/video.js", ] outputs = [ "$out_camera_app_dir/js/views/camera/mode/{{source_file_part}}" ] @@ -221,13 +221,13 @@ copy("chrome_camera_app_sounds") { sources = [ - "src/sounds/record_end.ogg", - "src/sounds/record_pause.ogg", - "src/sounds/record_start.ogg", - "src/sounds/shutter.ogg", - "src/sounds/tick_final.ogg", - "src/sounds/tick_inc.ogg", - "src/sounds/tick_start.ogg", + "sounds/record_end.ogg", + "sounds/record_pause.ogg", + "sounds/record_start.ogg", + "sounds/shutter.ogg", + "sounds/tick_final.ogg", + "sounds/tick_inc.ogg", + "sounds/tick_start.ogg", ] outputs = [ "$out_camera_app_dir/sounds/{{source_file_part}}" ] @@ -235,8 +235,8 @@ copy("chrome_camera_app_views") { sources = [ - "src/views/background.html", - "src/views/main.html", + "views/background.html", + "views/main.html", ] outputs = [ "$out_camera_app_dir/views/{{source_file_part}}" ]
diff --git a/chromeos/components/camera_app_ui/resources/src/LICENSE b/chromeos/components/camera_app_ui/resources/LICENSE similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/LICENSE rename to chromeos/components/camera_app_ui/resources/LICENSE
diff --git a/chromeos/components/camera_app_ui/resources/camera_app_resources.grd b/chromeos/components/camera_app_ui/resources/camera_app_resources.grd index 28bd0890..0b92c6c 100644 --- a/chromeos/components/camera_app_ui/resources/camera_app_resources.grd +++ b/chromeos/components/camera_app_ui/resources/camera_app_resources.grd
@@ -12,68 +12,68 @@ </outputs> <release seq="1"> <structures> - <structure name="IDR_CAMERA_ANALYTICS_JS" file="src/js/lib/analytics.js" type="chrome_html" /> - <structure name="IDR_CAMERA_ASYNC_JOB_QUEUE_JS" file="src/js/async_job_queue.js" type="chrome_html" /> - <structure name="IDR_CAMERA_ASYNC_WRITER_JS" file="src/js/models/async_writer.js" type="chrome_html" /> - <structure name="IDR_CAMERA_BACKGROUND_JS" file="src/js/background.js" type="chrome_html" /> - <structure name="IDR_CAMERA_BACKGROUND_OPS_JS" file="src/js/background_ops.js" type="chrome_html" /> - <structure name="IDR_CAMERA_BROWSER_PROXY_INTERFACE_JS" file="src/js/browser_proxy/browser_proxy_interface.js" type="chrome_html" /> - <structure name="IDR_CAMERA_CAMERA3_DEVICE_INFO_JS" file="src/js/device/camera3_device_info.js" type="chrome_html" /> - <structure name="IDR_CAMERA_CAMERA_INTENT_JS" file="src/js/views/camera_intent.js" type="chrome_html" /> - <structure name="IDR_CAMERA_CAMERA_JS" file="src/js/views/camera.js" type="chrome_html" /> - <structure name="IDR_CAMERA_CHROME_FILE_SYSTEM_ENTRY_JS" file="src/js/models/chrome_file_system_entry.js" type="chrome_html" /> - <structure name="IDR_CAMERA_CHROME_HELPER_JS" file="src/js/mojo/chrome_helper.js" type="chrome_html" /> - <structure name="IDR_CAMERA_CHROME_UTIL_JS" file="src/js/chrome_util.js" type="chrome_html" /> - <structure name="IDR_CAMERA_COMLINK_JS" file="src/js/lib/comlink.js" type="chrome_html" /> - <structure name="IDR_CAMERA_CONSTRAINTS_PREFERRER_JS" file="src/js/device/constraints_preferrer.js" type="chrome_html" /> - <structure name="IDR_CAMERA_DEVICE_INFO_UPDATER_JS" file="src/js/device/device_info_updater.js" type="chrome_html" /> - <structure name="IDR_CAMERA_DEVICE_OPERATOR_JS" file="src/js/mojo/device_operator.js" type="chrome_html" /> - <structure name="IDR_CAMERA_DIALOG_JS" file="src/js/views/dialog.js" type="chrome_html" /> - <structure name="IDR_CAMERA_DOM_JS" file="src/js/dom.js" type="chrome_html" /> - <structure name="IDR_CAMERA_ERROR_JS" file="src/js/error.js" type="chrome_html" /> - <structure name="IDR_CAMERA_FILE_NAMER_JS" file="src/js/models/file_namer.js" type="chrome_html" /> - <structure name="IDR_CAMERA_FILE_SYSTEM_ENTRY_JS" file="src/js/models/file_system_entry.js" type="chrome_html" /> - <structure name="IDR_CAMERA_FILE_SYSTEM_JS" file="src/js/models/file_system.js" type="chrome_html" /> - <structure name="IDR_CAMERA_FILE_UTIL_JS" file="src/js/models/file_util.js" type="chrome_html" /> - <structure name="IDR_CAMERA_GALLERYBUTTON_JS" file="src/js/gallerybutton.js" type="chrome_html" /> - <structure name="IDR_CAMERA_IMAGECAPTURE_JS" file="src/js/mojo/image_capture.js" type="chrome_html" /> - <structure name="IDR_CAMERA_INIT_JS" file="src/js/init.js" type="chrome_html" /> - <structure name="IDR_CAMERA_INTENT_JS" file="src/js/intent.js" type="chrome_html" /> - <structure name="IDR_CAMERA_LAYOUT_JS" file="src/js/views/camera/layout.js" type="chrome_html" /> - <structure name="IDR_CAMERA_LAZY_DIRECTORY_ENTRY_JS" file="src/js/models/lazy_directory_entry.js" type="chrome_html" /> - <structure name="IDR_CAMERA_MAIN_CSS" file="src/css/main.css" type="chrome_html" /> - <structure name="IDR_CAMERA_MAIN_HTML" file="src/views/main.html" type="chrome_html" /> - <structure name="IDR_CAMERA_MAIN_JS" file="src/js/main.js" type="chrome_html" /> - <structure name="IDR_CAMERA_METRICS_JS" file="src/js/metrics.js" type="chrome_html" /> - <structure name="IDR_CAMERA_MODE_MODE_BASE_JS" file="src/js/views/camera/mode/mode_base.js" type="chrome_html" /> - <structure name="IDR_CAMERA_MODE_INDEX_JS" file="src/js/views/camera/mode/index.js" type="chrome_html" /> - <structure name="IDR_CAMERA_MODE_PHOTO_JS" file="src/js/views/camera/mode/photo.js" type="chrome_html" /> - <structure name="IDR_CAMERA_MODE_PORTRAIT_JS" file="src/js/views/camera/mode/portrait.js" type="chrome_html" /> - <structure name="IDR_CAMERA_MODE_RECORD_TIME_JS" file="src/js/views/camera/mode/record_time.js" type="chrome_html" /> - <structure name="IDR_CAMERA_MODE_SQUARE_JS" file="src/js/views/camera/mode/square.js" type="chrome_html" /> - <structure name="IDR_CAMERA_MODE_VIDEO_JS" file="src/js/views/camera/mode/video.js" type="chrome_html" /> - <structure name="IDR_CAMERA_MP4_VIDEO_PROCESSOR_JS" file="src/js/models/mp4_video_processor.js" type="chrome_html" /> - <structure name="IDR_CAMERA_NATIVE_FILE_SYSTEM_ENTRY_JS" file="src/js/models/native_file_system_entry.js" type="chrome_html" /> - <structure name="IDR_CAMERA_NAV_JS" file="src/js/nav.js" type="chrome_html" /> - <structure name="IDR_CAMERA_NOP_VIDEO_PROCESSOR_JS" file="src/js/models/nop_video_processor.js" type="chrome_html" /> - <structure name="IDR_CAMERA_OPTIONS_JS" file="src/js/views/camera/options.js" type="chrome_html" /> - <structure name="IDR_CAMERA_PERF_JS" file="src/js/perf.js" type="chrome_html" /> - <structure name="IDR_CAMERA_PREVIEW_JS" file="src/js/views/camera/preview.js" type="chrome_html" /> - <structure name="IDR_CAMERA_RESULT_SAVER_JS" file="src/js/models/result_saver.js" type="chrome_html" /> - <structure name="IDR_CAMERA_REVIEW_RESULT_JS" file="src/js/views/camera/review_result.js" type="chrome_html" /> - <structure name="IDR_CAMERA_SETTINGS_JS" file="src/js/views/settings.js" type="chrome_html" /> - <structure name="IDR_CAMERA_SOUND_JS" file="src/js/sound.js" type="chrome_html" /> - <structure name="IDR_CAMERA_STATE_JS" file="src/js/state.js" type="chrome_html" /> - <structure name="IDR_CAMERA_TIMERTICK_JS" file="src/js/views/camera/timertick.js" type="chrome_html" /> - <structure name="IDR_CAMERA_TOAST_JS" file="src/js/toast.js" type="chrome_html" /> - <structure name="IDR_CAMERA_TOOLTIP_JS" file="src/js/tooltip.js" type="chrome_html" /> - <structure name="IDR_CAMERA_TYPE_JS" file="src/js/type.js" type="chrome_html" /> - <structure name="IDR_CAMERA_UTIL_JS" file="src/js/util.js" type="chrome_html" /> - <structure name="IDR_CAMERA_VIDEO_SAVER_JS" file="src/js/models/video_saver.js" type="chrome_html" /> - <structure name="IDR_CAMERA_VIEW_JS" file="src/js/views/view.js" type="chrome_html" /> - <structure name="IDR_CAMERA_WAITABLE_EVENT_JS" file="src/js/waitable_event.js" type="chrome_html" /> - <structure name="IDR_CAMERA_WARNING_JS" file="src/js/views/warning.js" type="chrome_html" /> - <structure name="IDR_CAMERA_WEBUI_BROWSER_PROXY_JS" file="src/js/browser_proxy/webui_browser_proxy.js" type="chrome_html" /> + <structure name="IDR_CAMERA_ANALYTICS_JS" file="js/lib/analytics.js" type="chrome_html" /> + <structure name="IDR_CAMERA_ASYNC_JOB_QUEUE_JS" file="js/async_job_queue.js" type="chrome_html" /> + <structure name="IDR_CAMERA_ASYNC_WRITER_JS" file="js/models/async_writer.js" type="chrome_html" /> + <structure name="IDR_CAMERA_BACKGROUND_JS" file="js/background.js" type="chrome_html" /> + <structure name="IDR_CAMERA_BACKGROUND_OPS_JS" file="js/background_ops.js" type="chrome_html" /> + <structure name="IDR_CAMERA_BROWSER_PROXY_INTERFACE_JS" file="js/browser_proxy/browser_proxy_interface.js" type="chrome_html" /> + <structure name="IDR_CAMERA_CAMERA3_DEVICE_INFO_JS" file="js/device/camera3_device_info.js" type="chrome_html" /> + <structure name="IDR_CAMERA_CAMERA_INTENT_JS" file="js/views/camera_intent.js" type="chrome_html" /> + <structure name="IDR_CAMERA_CAMERA_JS" file="js/views/camera.js" type="chrome_html" /> + <structure name="IDR_CAMERA_CHROME_FILE_SYSTEM_ENTRY_JS" file="js/models/chrome_file_system_entry.js" type="chrome_html" /> + <structure name="IDR_CAMERA_CHROME_HELPER_JS" file="js/mojo/chrome_helper.js" type="chrome_html" /> + <structure name="IDR_CAMERA_CHROME_UTIL_JS" file="js/chrome_util.js" type="chrome_html" /> + <structure name="IDR_CAMERA_COMLINK_JS" file="js/lib/comlink.js" type="chrome_html" /> + <structure name="IDR_CAMERA_CONSTRAINTS_PREFERRER_JS" file="js/device/constraints_preferrer.js" type="chrome_html" /> + <structure name="IDR_CAMERA_DEVICE_INFO_UPDATER_JS" file="js/device/device_info_updater.js" type="chrome_html" /> + <structure name="IDR_CAMERA_DEVICE_OPERATOR_JS" file="js/mojo/device_operator.js" type="chrome_html" /> + <structure name="IDR_CAMERA_DIALOG_JS" file="js/views/dialog.js" type="chrome_html" /> + <structure name="IDR_CAMERA_DOM_JS" file="js/dom.js" type="chrome_html" /> + <structure name="IDR_CAMERA_ERROR_JS" file="js/error.js" type="chrome_html" /> + <structure name="IDR_CAMERA_FILE_NAMER_JS" file="js/models/file_namer.js" type="chrome_html" /> + <structure name="IDR_CAMERA_FILE_SYSTEM_ENTRY_JS" file="js/models/file_system_entry.js" type="chrome_html" /> + <structure name="IDR_CAMERA_FILE_SYSTEM_JS" file="js/models/file_system.js" type="chrome_html" /> + <structure name="IDR_CAMERA_FILE_UTIL_JS" file="js/models/file_util.js" type="chrome_html" /> + <structure name="IDR_CAMERA_GALLERYBUTTON_JS" file="js/gallerybutton.js" type="chrome_html" /> + <structure name="IDR_CAMERA_IMAGECAPTURE_JS" file="js/mojo/image_capture.js" type="chrome_html" /> + <structure name="IDR_CAMERA_INIT_JS" file="js/init.js" type="chrome_html" /> + <structure name="IDR_CAMERA_INTENT_JS" file="js/intent.js" type="chrome_html" /> + <structure name="IDR_CAMERA_LAYOUT_JS" file="js/views/camera/layout.js" type="chrome_html" /> + <structure name="IDR_CAMERA_LAZY_DIRECTORY_ENTRY_JS" file="js/models/lazy_directory_entry.js" type="chrome_html" /> + <structure name="IDR_CAMERA_MAIN_CSS" file="css/main.css" type="chrome_html" /> + <structure name="IDR_CAMERA_MAIN_HTML" file="views/main.html" type="chrome_html" /> + <structure name="IDR_CAMERA_MAIN_JS" file="js/main.js" type="chrome_html" /> + <structure name="IDR_CAMERA_METRICS_JS" file="js/metrics.js" type="chrome_html" /> + <structure name="IDR_CAMERA_MODE_MODE_BASE_JS" file="js/views/camera/mode/mode_base.js" type="chrome_html" /> + <structure name="IDR_CAMERA_MODE_INDEX_JS" file="js/views/camera/mode/index.js" type="chrome_html" /> + <structure name="IDR_CAMERA_MODE_PHOTO_JS" file="js/views/camera/mode/photo.js" type="chrome_html" /> + <structure name="IDR_CAMERA_MODE_PORTRAIT_JS" file="js/views/camera/mode/portrait.js" type="chrome_html" /> + <structure name="IDR_CAMERA_MODE_RECORD_TIME_JS" file="js/views/camera/mode/record_time.js" type="chrome_html" /> + <structure name="IDR_CAMERA_MODE_SQUARE_JS" file="js/views/camera/mode/square.js" type="chrome_html" /> + <structure name="IDR_CAMERA_MODE_VIDEO_JS" file="js/views/camera/mode/video.js" type="chrome_html" /> + <structure name="IDR_CAMERA_MP4_VIDEO_PROCESSOR_JS" file="js/models/mp4_video_processor.js" type="chrome_html" /> + <structure name="IDR_CAMERA_NATIVE_FILE_SYSTEM_ENTRY_JS" file="js/models/native_file_system_entry.js" type="chrome_html" /> + <structure name="IDR_CAMERA_NAV_JS" file="js/nav.js" type="chrome_html" /> + <structure name="IDR_CAMERA_NOP_VIDEO_PROCESSOR_JS" file="js/models/nop_video_processor.js" type="chrome_html" /> + <structure name="IDR_CAMERA_OPTIONS_JS" file="js/views/camera/options.js" type="chrome_html" /> + <structure name="IDR_CAMERA_PERF_JS" file="js/perf.js" type="chrome_html" /> + <structure name="IDR_CAMERA_PREVIEW_JS" file="js/views/camera/preview.js" type="chrome_html" /> + <structure name="IDR_CAMERA_RESULT_SAVER_JS" file="js/models/result_saver.js" type="chrome_html" /> + <structure name="IDR_CAMERA_REVIEW_RESULT_JS" file="js/views/camera/review_result.js" type="chrome_html" /> + <structure name="IDR_CAMERA_SETTINGS_JS" file="js/views/settings.js" type="chrome_html" /> + <structure name="IDR_CAMERA_SOUND_JS" file="js/sound.js" type="chrome_html" /> + <structure name="IDR_CAMERA_STATE_JS" file="js/state.js" type="chrome_html" /> + <structure name="IDR_CAMERA_TIMERTICK_JS" file="js/views/camera/timertick.js" type="chrome_html" /> + <structure name="IDR_CAMERA_TOAST_JS" file="js/toast.js" type="chrome_html" /> + <structure name="IDR_CAMERA_TOOLTIP_JS" file="js/tooltip.js" type="chrome_html" /> + <structure name="IDR_CAMERA_TYPE_JS" file="js/type.js" type="chrome_html" /> + <structure name="IDR_CAMERA_UTIL_JS" file="js/util.js" type="chrome_html" /> + <structure name="IDR_CAMERA_VIDEO_SAVER_JS" file="js/models/video_saver.js" type="chrome_html" /> + <structure name="IDR_CAMERA_VIEW_JS" file="js/views/view.js" type="chrome_html" /> + <structure name="IDR_CAMERA_WAITABLE_EVENT_JS" file="js/waitable_event.js" type="chrome_html" /> + <structure name="IDR_CAMERA_WARNING_JS" file="js/views/warning.js" type="chrome_html" /> + <structure name="IDR_CAMERA_WEBUI_BROWSER_PROXY_JS" file="js/browser_proxy/webui_browser_proxy.js" type="chrome_html" /> </structures> <includes> <!-- Mojo Lite Bindings --> @@ -124,56 +124,56 @@ <!-- TODO(crbug.com/980846): Add FFMpeg library here with comrpession enabled once video recording is ready to test in SWA --> - <include name="IDR_CAMERA_RECORD_END_OGG" file="src/sounds/record_end.ogg" type="BINDATA" /> - <include name="IDR_CAMERA_RECORD_PAUSE_OGG" file="src/sounds/record_pause.ogg" type="BINDATA" /> - <include name="IDR_CAMERA_RECORD_START_OGG" file="src/sounds/record_start.ogg" type="BINDATA" /> - <include name="IDR_CAMERA_SHUTTER_OGG" file="src/sounds/shutter.ogg" type="BINDATA" /> - <include name="IDR_CAMERA_TICK_FINAL_OGG" file="src/sounds/tick_final.ogg" type="BINDATA" /> - <include name="IDR_CAMERA_TICK_INC_OGG" file="src/sounds/tick_inc.ogg" type="BINDATA" /> - <include name="IDR_CAMERA_TICK_START_OGG" file="src/sounds/tick_start.ogg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_MODE_SQUARE_SVG" file="src/images/camera_mode_square.svg" type="BINDATA" /> - <include name="IDR_CAMERA_SETTINGS_BUTTON_BACK_SVG" file="src/images/settings_button_back.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_MODE_PORTRAIT_SVG" file="src/images/camera_mode_portrait.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_BUTTON_TIMER_ON_3S_SVG" file="src/images/camera_button_timer_on_3s.svg" type="BINDATA" /> - <include name="IDR_CAMERA_SPINNER_SVG" file="src/images/spinner.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_BUTTON_GRID_OFF_SVG" file="src/images/camera_button_grid_off.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_BUTTON_MIC_ON_SVG" file="src/images/camera_button_mic_on.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_MODE_VIDEO_SVG" file="src/images/camera_mode_video.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_SHUTTER_PHOTO_STOP_SVG" file="src/images/camera_shutter_photo_stop.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_BUTTON_MIC_OFF_SVG" file="src/images/camera_button_mic_off.svg" type="BINDATA" /> - <include name="IDR_CAMERA_SETTINGS_EXPERT_SVG" file="src/images/settings_expert.svg" type="BINDATA" /> - <include name="IDR_CAMERA_SETTINGS_RESOLUTION_SVG" file="src/images/settings_resolution.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_APP_ICONS_48_PNG" file="src/images/camera_app_icons_48.png" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_BUTTON_TIMER_OFF_SVG" file="src/images/camera_button_timer_off.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_SHUTTER_PHOTO_START_ACTIVE_SVG" file="src/images/camera_shutter_photo_start_active.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_APP_ICONS_128_PNG" file="src/images/camera_app_icons_128.png" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_APP_ICONS_192_PNG" file="src/images/camera_app_icons_192.png" type="BINDATA" /> - <include name="IDR_CAMERA_SETTINGS_TIMER_DURATION_SVG" file="src/images/settings_timer_duration.svg" type="BINDATA" /> - <include name="IDR_CAMERA_SETTINGS_HELP_SVG" file="src/images/settings_help.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_BUTTON_MIRROR_ON_SVG" file="src/images/camera_button_mirror_on.svg" type="BINDATA" /> - <include name="IDR_CAMERA_SETTINGS_BUTTON_EXPAND_SVG" file="src/images/settings_button_expand.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_BUTTON_GRID_ON_SVG" file="src/images/camera_button_grid_on.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_BUTTON_SWITCH_DEVICE_SVG" file="src/images/camera_button_switch_device.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_SHUTTER_PHOTO_STOP_HOVER_SVG" file="src/images/camera_shutter_photo_stop_hover.svg" type="BINDATA" /> - <include name="IDR_CAMERA_SETTINGS_GRID_TYPE_SVG" file="src/images/settings_grid_type.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_BUTTON_MIRROR_OFF_SVG" file="src/images/camera_button_mirror_off.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_SHUTTER_PHOTO_START_SVG" file="src/images/camera_shutter_photo_start.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_BUTTON_SWITCH_PHOTO_SVG" file="src/images/camera_button_switch_photo.svg" type="BINDATA" /> - <include name="IDR_CAMERA_SETTINGS_FEEDBACK_SVG" file="src/images/settings_feedback.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_BUTTON_SWITCH_VIDEO_SVG" file="src/images/camera_button_switch_video.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_SHUTTER_PHOTO_START_HOVER_SVG" file="src/images/camera_shutter_photo_start_hover.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_SHUTTER_VIDEO_PAUSE_SVG" file="src/images/camera_shutter_video_pause.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_BUTTON_TIMER_ON_10S_SVG" file="src/images/camera_button_timer_on_10s.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_MODE_PHOTO_SVG" file="src/images/camera_mode_photo.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_FOCUS_AIM_SVG" file="src/images/camera_focus_aim.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_BUTTON_SETTINGS_SVG" file="src/images/camera_button_settings.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_INTENT_PLAY_VIDEO_SVG" file="src/images/camera_intent_play_video.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_BUTTON_FPS_30_SVG" file="src/images/camera_button_fps_30.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_BUTTON_FPS_60_SVG" file="src/images/camera_button_fps_60.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_INTENT_RESULT_CANCEL_SVG" file="src/images/camera_intent_result_cancel.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_INTENT_RESULT_CONFIRM_SVG" file="src/images/camera_intent_result_confirm.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_INTRO_BANNER_ICON_SVG" file="src/images/camera_intro_banner_icon.svg" type="BINDATA" /> - <include name="IDR_CAMERA_CAMERA_INTRO_BANNER_CLOSE_SVG" file="src/images/camera_intro_banner_close.svg" type="BINDATA" /> + <include name="IDR_CAMERA_RECORD_END_OGG" file="sounds/record_end.ogg" type="BINDATA" /> + <include name="IDR_CAMERA_RECORD_PAUSE_OGG" file="sounds/record_pause.ogg" type="BINDATA" /> + <include name="IDR_CAMERA_RECORD_START_OGG" file="sounds/record_start.ogg" type="BINDATA" /> + <include name="IDR_CAMERA_SHUTTER_OGG" file="sounds/shutter.ogg" type="BINDATA" /> + <include name="IDR_CAMERA_TICK_FINAL_OGG" file="sounds/tick_final.ogg" type="BINDATA" /> + <include name="IDR_CAMERA_TICK_INC_OGG" file="sounds/tick_inc.ogg" type="BINDATA" /> + <include name="IDR_CAMERA_TICK_START_OGG" file="sounds/tick_start.ogg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_MODE_SQUARE_SVG" file="images/camera_mode_square.svg" type="BINDATA" /> + <include name="IDR_CAMERA_SETTINGS_BUTTON_BACK_SVG" file="images/settings_button_back.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_MODE_PORTRAIT_SVG" file="images/camera_mode_portrait.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_BUTTON_TIMER_ON_3S_SVG" file="images/camera_button_timer_on_3s.svg" type="BINDATA" /> + <include name="IDR_CAMERA_SPINNER_SVG" file="images/spinner.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_BUTTON_GRID_OFF_SVG" file="images/camera_button_grid_off.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_BUTTON_MIC_ON_SVG" file="images/camera_button_mic_on.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_MODE_VIDEO_SVG" file="images/camera_mode_video.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_SHUTTER_PHOTO_STOP_SVG" file="images/camera_shutter_photo_stop.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_BUTTON_MIC_OFF_SVG" file="images/camera_button_mic_off.svg" type="BINDATA" /> + <include name="IDR_CAMERA_SETTINGS_EXPERT_SVG" file="images/settings_expert.svg" type="BINDATA" /> + <include name="IDR_CAMERA_SETTINGS_RESOLUTION_SVG" file="images/settings_resolution.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_APP_ICONS_48_PNG" file="images/camera_app_icons_48.png" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_BUTTON_TIMER_OFF_SVG" file="images/camera_button_timer_off.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_SHUTTER_PHOTO_START_ACTIVE_SVG" file="images/camera_shutter_photo_start_active.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_APP_ICONS_128_PNG" file="images/camera_app_icons_128.png" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_APP_ICONS_192_PNG" file="images/camera_app_icons_192.png" type="BINDATA" /> + <include name="IDR_CAMERA_SETTINGS_TIMER_DURATION_SVG" file="images/settings_timer_duration.svg" type="BINDATA" /> + <include name="IDR_CAMERA_SETTINGS_HELP_SVG" file="images/settings_help.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_BUTTON_MIRROR_ON_SVG" file="images/camera_button_mirror_on.svg" type="BINDATA" /> + <include name="IDR_CAMERA_SETTINGS_BUTTON_EXPAND_SVG" file="images/settings_button_expand.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_BUTTON_GRID_ON_SVG" file="images/camera_button_grid_on.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_BUTTON_SWITCH_DEVICE_SVG" file="images/camera_button_switch_device.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_SHUTTER_PHOTO_STOP_HOVER_SVG" file="images/camera_shutter_photo_stop_hover.svg" type="BINDATA" /> + <include name="IDR_CAMERA_SETTINGS_GRID_TYPE_SVG" file="images/settings_grid_type.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_BUTTON_MIRROR_OFF_SVG" file="images/camera_button_mirror_off.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_SHUTTER_PHOTO_START_SVG" file="images/camera_shutter_photo_start.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_BUTTON_SWITCH_PHOTO_SVG" file="images/camera_button_switch_photo.svg" type="BINDATA" /> + <include name="IDR_CAMERA_SETTINGS_FEEDBACK_SVG" file="images/settings_feedback.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_BUTTON_SWITCH_VIDEO_SVG" file="images/camera_button_switch_video.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_SHUTTER_PHOTO_START_HOVER_SVG" file="images/camera_shutter_photo_start_hover.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_SHUTTER_VIDEO_PAUSE_SVG" file="images/camera_shutter_video_pause.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_BUTTON_TIMER_ON_10S_SVG" file="images/camera_button_timer_on_10s.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_MODE_PHOTO_SVG" file="images/camera_mode_photo.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_FOCUS_AIM_SVG" file="images/camera_focus_aim.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_BUTTON_SETTINGS_SVG" file="images/camera_button_settings.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_INTENT_PLAY_VIDEO_SVG" file="images/camera_intent_play_video.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_BUTTON_FPS_30_SVG" file="images/camera_button_fps_30.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_BUTTON_FPS_60_SVG" file="images/camera_button_fps_60.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_INTENT_RESULT_CANCEL_SVG" file="images/camera_intent_result_cancel.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_INTENT_RESULT_CONFIRM_SVG" file="images/camera_intent_result_confirm.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_INTRO_BANNER_ICON_SVG" file="images/camera_intro_banner_icon.svg" type="BINDATA" /> + <include name="IDR_CAMERA_CAMERA_INTRO_BANNER_CLOSE_SVG" file="images/camera_intro_banner_close.svg" type="BINDATA" /> </includes> </release> </grit>
diff --git a/chromeos/components/camera_app_ui/resources/src/css/main.css b/chromeos/components/camera_app_ui/resources/css/main.css similarity index 91% rename from chromeos/components/camera_app_ui/resources/src/css/main.css rename to chromeos/components/camera_app_ui/resources/css/main.css index 8542922..082b2c63 100644 --- a/chromeos/components/camera_app_ui/resources/src/css/main.css +++ b/chromeos/components/camera_app_ui/resources/css/main.css
@@ -225,7 +225,7 @@ } #play-result-video { - background-image: url(../images/camera_intent_play_video.svg); + background-image: url(/images/camera_intent_play_video.svg); height: 80px; width: 80px; } @@ -253,11 +253,11 @@ } #confirm-result { - background-image: url(../images/camera_intent_result_confirm.svg); + background-image: url(/images/camera_intent_result_confirm.svg); } #cancel-result { - background-image: url(../images/camera_intent_result_cancel.svg); + background-image: url(/images/camera_intent_result_cancel.svg); } .mode-item { @@ -354,25 +354,25 @@ #start-takephoto, #video-snapshot { - background-image: url(../images/camera_shutter_photo_start.svg); + background-image: url(/images/camera_shutter_photo_start.svg); } #start-takephoto:hover, #video-snapshot:hover { - background-image: url(../images/camera_shutter_photo_start_hover.svg); + background-image: url(/images/camera_shutter_photo_start_hover.svg); } #start-takephoto:active, #video-snapshot:active { - background-image: url(../images/camera_shutter_photo_start_active.svg); + background-image: url(/images/camera_shutter_photo_start_active.svg); } #stop-takephoto { - background-image: url(../images/camera_shutter_photo_stop.svg); + background-image: url(/images/camera_shutter_photo_stop.svg); } #stop-takephoto:hover { - background-image: url(../images/camera_shutter_photo_stop_hover.svg); + background-image: url(/images/camera_shutter_photo_stop_hover.svg); } #recordvideo { @@ -462,7 +462,7 @@ #pause-recordvideo .two-bars { --bar-size: 20px; - background-image: url(../images/camera_shutter_video_pause.svg); + background-image: url(/images/camera_shutter_video_pause.svg); height: var(--bar-size); left: calc(50% - var(--bar-size) / 2); position: absolute; @@ -493,22 +493,22 @@ } #camera-mode { - background-image: url(../images/camera_mode_photo.svg); + background-image: url(/images/camera_mode_photo.svg); height: 40px; visibility: hidden; width: 40px; } body.video #camera-mode { - background-image: url(../images/camera_mode_video.svg); + background-image: url(/images/camera_mode_video.svg); } body.square #camera-mode { - background-image: url(../images/camera_mode_square.svg); + background-image: url(/images/camera_mode_square.svg); } body.portrait #camera-mode { - background-image: url(../images/camera_mode_portrait.svg); + background-image: url(/images/camera_mode_portrait.svg); } body.mode-switching:not(.streaming) #camera-mode { @@ -530,7 +530,7 @@ } #switch-device { - background-image: url(../images/camera_button_switch_device.svg); + background-image: url(/images/camera_button_switch_device.svg); height: var(--big-icon); width: var(--big-icon); } @@ -591,39 +591,39 @@ } body._3sec #toggle-timer:checked { - background-image: url(../images/camera_button_timer_on_3s.svg); + background-image: url(/images/camera_button_timer_on_3s.svg); } body._10sec #toggle-timer:checked { - background-image: url(../images/camera_button_timer_on_10s.svg); + background-image: url(/images/camera_button_timer_on_10s.svg); } #toggle-timer { - background-image: url(../images/camera_button_timer_off.svg); + background-image: url(/images/camera_button_timer_off.svg); } #toggle-grid:checked { - background-image: url(../images/camera_button_grid_on.svg); + background-image: url(/images/camera_button_grid_on.svg); } #toggle-grid { - background-image: url(../images/camera_button_grid_off.svg); + background-image: url(/images/camera_button_grid_off.svg); } #toggle-mirror:checked { - background-image: url(../images/camera_button_mirror_on.svg); + background-image: url(/images/camera_button_mirror_on.svg); } #toggle-mirror { - background-image: url(../images/camera_button_mirror_off.svg); + background-image: url(/images/camera_button_mirror_off.svg); } #toggle-mic:checked { - background-image: url(../images/camera_button_mic_on.svg); + background-image: url(/images/camera_button_mic_on.svg); } #toggle-mic { - background-image: url(../images/camera_button_mic_off.svg); + background-image: url(/images/camera_button_mic_off.svg); } body:not(.multi-fps) #toggle-fps, @@ -632,15 +632,15 @@ } body._30fps #toggle-fps { - background-image: url(../images/camera_button_fps_30.svg); + background-image: url(/images/camera_button_fps_30.svg); } body._60fps #toggle-fps { - background-image: url(../images/camera_button_fps_60.svg); + background-image: url(/images/camera_button_fps_60.svg); } #open-settings { - background-image: url(../images/camera_button_settings.svg); + background-image: url(/images/camera_button_settings.svg); } body.should-handle-intent-result #open-settings { @@ -1149,7 +1149,7 @@ } #banner-title-icon { - background-image: url(../images/camera_intro_banner_icon.svg); + background-image: url(/images/camera_intro_banner_icon.svg); display: inline-block; height: 20px; margin-right: 10px; @@ -1168,7 +1168,7 @@ } #banner-close { - background-image: url(../images/camera_intro_banner_close.svg); + background-image: url(/images/camera_intro_banner_close.svg); display: block; height: 20px; position: absolute; @@ -1337,7 +1337,7 @@ } .menu-header .icon { - background-image: url(../images/settings_button_back.svg); + background-image: url(/images/settings_button_back.svg); } .menu-header .icon:hover { @@ -1345,11 +1345,11 @@ } #settings-gridtype .icon { - background-image: url(../images/settings_grid_type.svg); + background-image: url(/images/settings_grid_type.svg); } #settings-timerdur .icon { - background-image: url(../images/settings_timer_duration.svg); + background-image: url(/images/settings_timer_duration.svg); } body.no-resolution-settings #settings-resolution { @@ -1357,19 +1357,19 @@ } #settings-resolution .icon { - background-image: url(../images/settings_resolution.svg); + background-image: url(/images/settings_resolution.svg); } #settings-expert .icon { - background-image: url(../images/settings_expert.svg); + background-image: url(/images/settings_expert.svg); } #settings-feedback .icon { - background-image: url(../images/settings_feedback.svg); + background-image: url(/images/settings_feedback.svg); } #settings-help .icon { - background-image: url(../images/settings_help.svg); + background-image: url(/images/settings_help.svg); } #settings-gridtype .icon.end, @@ -1377,7 +1377,7 @@ #settings-resolution .icon.end, #settings-expert .icon.end, .resol-item.multi-option .icon.end { - background-image: url(../images/settings_button_expand.svg); + background-image: url(/images/settings_button_expand.svg); } #view-warning, @@ -1476,7 +1476,7 @@ } #spinner { - background-image: url(../images/spinner.svg); + background-image: url(/images/spinner.svg); height: 32px; visibility: hidden; width: 32px; @@ -1484,7 +1484,7 @@ } #view-splash { - background: no-repeat center url(../images/camera_mode_photo.svg), black; + background: no-repeat center url(/images/camera_mode_photo.svg), black; z-index: 2; }
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_app_icons_128.png b/chromeos/components/camera_app_ui/resources/images/camera_app_icons_128.png similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_app_icons_128.png rename to chromeos/components/camera_app_ui/resources/images/camera_app_icons_128.png Binary files differ
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_app_icons_192.png b/chromeos/components/camera_app_ui/resources/images/camera_app_icons_192.png similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_app_icons_192.png rename to chromeos/components/camera_app_ui/resources/images/camera_app_icons_192.png Binary files differ
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_app_icons_48.png b/chromeos/components/camera_app_ui/resources/images/camera_app_icons_48.png similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_app_icons_48.png rename to chromeos/components/camera_app_ui/resources/images/camera_app_icons_48.png Binary files differ
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_button_fps_30.svg b/chromeos/components/camera_app_ui/resources/images/camera_button_fps_30.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_button_fps_30.svg rename to chromeos/components/camera_app_ui/resources/images/camera_button_fps_30.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_button_fps_60.svg b/chromeos/components/camera_app_ui/resources/images/camera_button_fps_60.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_button_fps_60.svg rename to chromeos/components/camera_app_ui/resources/images/camera_button_fps_60.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_button_grid_off.svg b/chromeos/components/camera_app_ui/resources/images/camera_button_grid_off.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_button_grid_off.svg rename to chromeos/components/camera_app_ui/resources/images/camera_button_grid_off.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_button_grid_on.svg b/chromeos/components/camera_app_ui/resources/images/camera_button_grid_on.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_button_grid_on.svg rename to chromeos/components/camera_app_ui/resources/images/camera_button_grid_on.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_button_mic_off.svg b/chromeos/components/camera_app_ui/resources/images/camera_button_mic_off.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_button_mic_off.svg rename to chromeos/components/camera_app_ui/resources/images/camera_button_mic_off.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_button_mic_on.svg b/chromeos/components/camera_app_ui/resources/images/camera_button_mic_on.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_button_mic_on.svg rename to chromeos/components/camera_app_ui/resources/images/camera_button_mic_on.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_button_mirror_off.svg b/chromeos/components/camera_app_ui/resources/images/camera_button_mirror_off.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_button_mirror_off.svg rename to chromeos/components/camera_app_ui/resources/images/camera_button_mirror_off.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_button_mirror_on.svg b/chromeos/components/camera_app_ui/resources/images/camera_button_mirror_on.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_button_mirror_on.svg rename to chromeos/components/camera_app_ui/resources/images/camera_button_mirror_on.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_button_settings.svg b/chromeos/components/camera_app_ui/resources/images/camera_button_settings.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_button_settings.svg rename to chromeos/components/camera_app_ui/resources/images/camera_button_settings.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_button_switch_device.svg b/chromeos/components/camera_app_ui/resources/images/camera_button_switch_device.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_button_switch_device.svg rename to chromeos/components/camera_app_ui/resources/images/camera_button_switch_device.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_button_switch_photo.svg b/chromeos/components/camera_app_ui/resources/images/camera_button_switch_photo.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_button_switch_photo.svg rename to chromeos/components/camera_app_ui/resources/images/camera_button_switch_photo.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_button_switch_video.svg b/chromeos/components/camera_app_ui/resources/images/camera_button_switch_video.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_button_switch_video.svg rename to chromeos/components/camera_app_ui/resources/images/camera_button_switch_video.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_button_timer_off.svg b/chromeos/components/camera_app_ui/resources/images/camera_button_timer_off.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_button_timer_off.svg rename to chromeos/components/camera_app_ui/resources/images/camera_button_timer_off.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_button_timer_on_10s.svg b/chromeos/components/camera_app_ui/resources/images/camera_button_timer_on_10s.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_button_timer_on_10s.svg rename to chromeos/components/camera_app_ui/resources/images/camera_button_timer_on_10s.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_button_timer_on_3s.svg b/chromeos/components/camera_app_ui/resources/images/camera_button_timer_on_3s.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_button_timer_on_3s.svg rename to chromeos/components/camera_app_ui/resources/images/camera_button_timer_on_3s.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_focus_aim.svg b/chromeos/components/camera_app_ui/resources/images/camera_focus_aim.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_focus_aim.svg rename to chromeos/components/camera_app_ui/resources/images/camera_focus_aim.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_intent_play_video.svg b/chromeos/components/camera_app_ui/resources/images/camera_intent_play_video.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_intent_play_video.svg rename to chromeos/components/camera_app_ui/resources/images/camera_intent_play_video.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_intent_result_cancel.svg b/chromeos/components/camera_app_ui/resources/images/camera_intent_result_cancel.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_intent_result_cancel.svg rename to chromeos/components/camera_app_ui/resources/images/camera_intent_result_cancel.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_intent_result_confirm.svg b/chromeos/components/camera_app_ui/resources/images/camera_intent_result_confirm.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_intent_result_confirm.svg rename to chromeos/components/camera_app_ui/resources/images/camera_intent_result_confirm.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_intro_banner_close.svg b/chromeos/components/camera_app_ui/resources/images/camera_intro_banner_close.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_intro_banner_close.svg rename to chromeos/components/camera_app_ui/resources/images/camera_intro_banner_close.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_intro_banner_icon.svg b/chromeos/components/camera_app_ui/resources/images/camera_intro_banner_icon.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_intro_banner_icon.svg rename to chromeos/components/camera_app_ui/resources/images/camera_intro_banner_icon.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_mode_photo.svg b/chromeos/components/camera_app_ui/resources/images/camera_mode_photo.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_mode_photo.svg rename to chromeos/components/camera_app_ui/resources/images/camera_mode_photo.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_mode_portrait.svg b/chromeos/components/camera_app_ui/resources/images/camera_mode_portrait.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_mode_portrait.svg rename to chromeos/components/camera_app_ui/resources/images/camera_mode_portrait.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_mode_square.svg b/chromeos/components/camera_app_ui/resources/images/camera_mode_square.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_mode_square.svg rename to chromeos/components/camera_app_ui/resources/images/camera_mode_square.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_mode_video.svg b/chromeos/components/camera_app_ui/resources/images/camera_mode_video.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_mode_video.svg rename to chromeos/components/camera_app_ui/resources/images/camera_mode_video.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_start.svg b/chromeos/components/camera_app_ui/resources/images/camera_shutter_photo_start.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_start.svg rename to chromeos/components/camera_app_ui/resources/images/camera_shutter_photo_start.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_start_active.svg b/chromeos/components/camera_app_ui/resources/images/camera_shutter_photo_start_active.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_start_active.svg rename to chromeos/components/camera_app_ui/resources/images/camera_shutter_photo_start_active.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_start_hover.svg b/chromeos/components/camera_app_ui/resources/images/camera_shutter_photo_start_hover.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_start_hover.svg rename to chromeos/components/camera_app_ui/resources/images/camera_shutter_photo_start_hover.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_stop.svg b/chromeos/components/camera_app_ui/resources/images/camera_shutter_photo_stop.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_stop.svg rename to chromeos/components/camera_app_ui/resources/images/camera_shutter_photo_stop.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_stop_hover.svg b/chromeos/components/camera_app_ui/resources/images/camera_shutter_photo_stop_hover.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_stop_hover.svg rename to chromeos/components/camera_app_ui/resources/images/camera_shutter_photo_stop_hover.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/camera_shutter_video_pause.svg b/chromeos/components/camera_app_ui/resources/images/camera_shutter_video_pause.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/camera_shutter_video_pause.svg rename to chromeos/components/camera_app_ui/resources/images/camera_shutter_video_pause.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/settings_button_back.svg b/chromeos/components/camera_app_ui/resources/images/settings_button_back.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/settings_button_back.svg rename to chromeos/components/camera_app_ui/resources/images/settings_button_back.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/settings_button_expand.svg b/chromeos/components/camera_app_ui/resources/images/settings_button_expand.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/settings_button_expand.svg rename to chromeos/components/camera_app_ui/resources/images/settings_button_expand.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/settings_expert.svg b/chromeos/components/camera_app_ui/resources/images/settings_expert.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/settings_expert.svg rename to chromeos/components/camera_app_ui/resources/images/settings_expert.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/settings_feedback.svg b/chromeos/components/camera_app_ui/resources/images/settings_feedback.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/settings_feedback.svg rename to chromeos/components/camera_app_ui/resources/images/settings_feedback.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/settings_grid_type.svg b/chromeos/components/camera_app_ui/resources/images/settings_grid_type.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/settings_grid_type.svg rename to chromeos/components/camera_app_ui/resources/images/settings_grid_type.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/settings_help.svg b/chromeos/components/camera_app_ui/resources/images/settings_help.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/settings_help.svg rename to chromeos/components/camera_app_ui/resources/images/settings_help.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/settings_resolution.svg b/chromeos/components/camera_app_ui/resources/images/settings_resolution.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/settings_resolution.svg rename to chromeos/components/camera_app_ui/resources/images/settings_resolution.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/settings_timer_duration.svg b/chromeos/components/camera_app_ui/resources/images/settings_timer_duration.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/settings_timer_duration.svg rename to chromeos/components/camera_app_ui/resources/images/settings_timer_duration.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/images/spinner.svg b/chromeos/components/camera_app_ui/resources/images/spinner.svg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/images/spinner.svg rename to chromeos/components/camera_app_ui/resources/images/spinner.svg
diff --git a/chromeos/components/camera_app_ui/resources/src/js/BUILD.gn b/chromeos/components/camera_app_ui/resources/js/BUILD.gn similarity index 98% rename from chromeos/components/camera_app_ui/resources/src/js/BUILD.gn rename to chromeos/components/camera_app_ui/resources/js/BUILD.gn index 272c529..81951a70 100644 --- a/chromeos/components/camera_app_ui/resources/src/js/BUILD.gn +++ b/chromeos/components/camera_app_ui/resources/js/BUILD.gn
@@ -15,7 +15,7 @@ "jscomp_error=conformanceViolations", "hide_warnings_for=mojo/public/js/", "hide_warnings_for=gen/", - "hide_warnings_for=src/js/lib/", + "hide_warnings_for=js/lib/", ] deps = [ ":compile_resources" ] }
diff --git a/chromeos/components/camera_app_ui/resources/src/js/async_job_queue.js b/chromeos/components/camera_app_ui/resources/js/async_job_queue.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/async_job_queue.js rename to chromeos/components/camera_app_ui/resources/js/async_job_queue.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/background.js b/chromeos/components/camera_app_ui/resources/js/background.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/background.js rename to chromeos/components/camera_app_ui/resources/js/background.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/background_ops.js b/chromeos/components/camera_app_ui/resources/js/background_ops.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/background_ops.js rename to chromeos/components/camera_app_ui/resources/js/background_ops.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/browser_proxy/browser_proxy.js b/chromeos/components/camera_app_ui/resources/js/browser_proxy/browser_proxy.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/browser_proxy/browser_proxy.js rename to chromeos/components/camera_app_ui/resources/js/browser_proxy/browser_proxy.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/browser_proxy/browser_proxy_interface.js b/chromeos/components/camera_app_ui/resources/js/browser_proxy/browser_proxy_interface.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/browser_proxy/browser_proxy_interface.js rename to chromeos/components/camera_app_ui/resources/js/browser_proxy/browser_proxy_interface.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/browser_proxy/webui_browser_proxy.js b/chromeos/components/camera_app_ui/resources/js/browser_proxy/webui_browser_proxy.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/browser_proxy/webui_browser_proxy.js rename to chromeos/components/camera_app_ui/resources/js/browser_proxy/webui_browser_proxy.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/chrome_util.js b/chromeos/components/camera_app_ui/resources/js/chrome_util.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/chrome_util.js rename to chromeos/components/camera_app_ui/resources/js/chrome_util.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/device/camera3_device_info.js b/chromeos/components/camera_app_ui/resources/js/device/camera3_device_info.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/device/camera3_device_info.js rename to chromeos/components/camera_app_ui/resources/js/device/camera3_device_info.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/device/constraints_preferrer.js b/chromeos/components/camera_app_ui/resources/js/device/constraints_preferrer.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/device/constraints_preferrer.js rename to chromeos/components/camera_app_ui/resources/js/device/constraints_preferrer.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/device/device_info_updater.js b/chromeos/components/camera_app_ui/resources/js/device/device_info_updater.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/device/device_info_updater.js rename to chromeos/components/camera_app_ui/resources/js/device/device_info_updater.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/dom.js b/chromeos/components/camera_app_ui/resources/js/dom.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/dom.js rename to chromeos/components/camera_app_ui/resources/js/dom.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/error.js b/chromeos/components/camera_app_ui/resources/js/error.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/error.js rename to chromeos/components/camera_app_ui/resources/js/error.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/externs/chrome.js b/chromeos/components/camera_app_ui/resources/js/externs/chrome.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/externs/chrome.js rename to chromeos/components/camera_app_ui/resources/js/externs/chrome.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/externs/conformance_config.textproto b/chromeos/components/camera_app_ui/resources/js/externs/conformance_config.textproto similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/externs/conformance_config.textproto rename to chromeos/components/camera_app_ui/resources/js/externs/conformance_config.textproto
diff --git a/chromeos/components/camera_app_ui/resources/src/js/externs/swa.js b/chromeos/components/camera_app_ui/resources/js/externs/swa.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/externs/swa.js rename to chromeos/components/camera_app_ui/resources/js/externs/swa.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/externs/universal_analytics_api.js b/chromeos/components/camera_app_ui/resources/js/externs/universal_analytics_api.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/externs/universal_analytics_api.js rename to chromeos/components/camera_app_ui/resources/js/externs/universal_analytics_api.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/externs/w3c_api.js b/chromeos/components/camera_app_ui/resources/js/externs/w3c_api.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/externs/w3c_api.js rename to chromeos/components/camera_app_ui/resources/js/externs/w3c_api.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/gallerybutton.js b/chromeos/components/camera_app_ui/resources/js/gallerybutton.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/gallerybutton.js rename to chromeos/components/camera_app_ui/resources/js/gallerybutton.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/init.js b/chromeos/components/camera_app_ui/resources/js/init.js similarity index 87% rename from chromeos/components/camera_app_ui/resources/src/js/init.js rename to chromeos/components/camera_app_ui/resources/js/init.js index 8617431d..0304b5da 100644 --- a/chromeos/components/camera_app_ui/resources/src/js/init.js +++ b/chromeos/components/camera_app_ui/resources/js/init.js
@@ -5,6 +5,6 @@ document.addEventListener('DOMContentLoaded', () => { const mainScript = document.createElement('script'); mainScript.setAttribute('type', 'module'); - mainScript.setAttribute('src', '../js/main.js'); + mainScript.setAttribute('src', '/js/main.js'); document.head.appendChild(mainScript); });
diff --git a/chromeos/components/camera_app_ui/resources/src/js/intent.js b/chromeos/components/camera_app_ui/resources/js/intent.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/intent.js rename to chromeos/components/camera_app_ui/resources/js/intent.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/lib/.clang-format b/chromeos/components/camera_app_ui/resources/js/lib/.clang-format similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/lib/.clang-format rename to chromeos/components/camera_app_ui/resources/js/lib/.clang-format
diff --git a/chromeos/components/camera_app_ui/resources/src/js/lib/README.md b/chromeos/components/camera_app_ui/resources/js/lib/README.md similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/lib/README.md rename to chromeos/components/camera_app_ui/resources/js/lib/README.md
diff --git a/chromeos/components/camera_app_ui/resources/src/js/lib/analytics.js b/chromeos/components/camera_app_ui/resources/js/lib/analytics.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/lib/analytics.js rename to chromeos/components/camera_app_ui/resources/js/lib/analytics.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/lib/build_ffmpeg.sh b/chromeos/components/camera_app_ui/resources/js/lib/build_ffmpeg.sh similarity index 97% rename from chromeos/components/camera_app_ui/resources/src/js/lib/build_ffmpeg.sh rename to chromeos/components/camera_app_ui/resources/js/lib/build_ffmpeg.sh index 8379faf..2015f11 100755 --- a/chromeos/components/camera_app_ui/resources/src/js/lib/build_ffmpeg.sh +++ b/chromeos/components/camera_app_ui/resources/js/lib/build_ffmpeg.sh
@@ -122,7 +122,7 @@ # locate ffmpeg directory in chromium source tree local ffmpeg_dir - ffmpeg_dir=$(realpath ../../../../../../../third_party/ffmpeg) + ffmpeg_dir=$(realpath ../../../../../../third_party/ffmpeg) [[ -d "$ffmpeg_dir" ]] || die "ffmpeg not found" # copy ffmpeg/ into a temporary directory to patch and build
diff --git a/chromeos/components/camera_app_ui/resources/src/js/lib/comlink.js b/chromeos/components/camera_app_ui/resources/js/lib/comlink.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/lib/comlink.js rename to chromeos/components/camera_app_ui/resources/js/lib/comlink.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/lib/ffmpeg.js b/chromeos/components/camera_app_ui/resources/js/lib/ffmpeg.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/lib/ffmpeg.js rename to chromeos/components/camera_app_ui/resources/js/lib/ffmpeg.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/lib/ffmpeg.patch b/chromeos/components/camera_app_ui/resources/js/lib/ffmpeg.patch similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/lib/ffmpeg.patch rename to chromeos/components/camera_app_ui/resources/js/lib/ffmpeg.patch
diff --git a/chromeos/components/camera_app_ui/resources/src/js/lib/ffmpeg.wasm b/chromeos/components/camera_app_ui/resources/js/lib/ffmpeg.wasm similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/lib/ffmpeg.wasm rename to chromeos/components/camera_app_ui/resources/js/lib/ffmpeg.wasm Binary files differ
diff --git a/chromeos/components/camera_app_ui/resources/src/js/main.js b/chromeos/components/camera_app_ui/resources/js/main.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/main.js rename to chromeos/components/camera_app_ui/resources/js/main.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/metrics.js b/chromeos/components/camera_app_ui/resources/js/metrics.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/metrics.js rename to chromeos/components/camera_app_ui/resources/js/metrics.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/models/async_writer.js b/chromeos/components/camera_app_ui/resources/js/models/async_writer.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/models/async_writer.js rename to chromeos/components/camera_app_ui/resources/js/models/async_writer.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/models/chrome_file_system_entry.js b/chromeos/components/camera_app_ui/resources/js/models/chrome_file_system_entry.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/models/chrome_file_system_entry.js rename to chromeos/components/camera_app_ui/resources/js/models/chrome_file_system_entry.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/models/file_namer.js b/chromeos/components/camera_app_ui/resources/js/models/file_namer.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/models/file_namer.js rename to chromeos/components/camera_app_ui/resources/js/models/file_namer.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/models/file_system.js b/chromeos/components/camera_app_ui/resources/js/models/file_system.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/models/file_system.js rename to chromeos/components/camera_app_ui/resources/js/models/file_system.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/models/file_system_entry.js b/chromeos/components/camera_app_ui/resources/js/models/file_system_entry.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/models/file_system_entry.js rename to chromeos/components/camera_app_ui/resources/js/models/file_system_entry.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/models/file_util.js b/chromeos/components/camera_app_ui/resources/js/models/file_util.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/models/file_util.js rename to chromeos/components/camera_app_ui/resources/js/models/file_util.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/models/lazy_directory_entry.js b/chromeos/components/camera_app_ui/resources/js/models/lazy_directory_entry.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/models/lazy_directory_entry.js rename to chromeos/components/camera_app_ui/resources/js/models/lazy_directory_entry.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/models/mp4_video_processor.js b/chromeos/components/camera_app_ui/resources/js/models/mp4_video_processor.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/models/mp4_video_processor.js rename to chromeos/components/camera_app_ui/resources/js/models/mp4_video_processor.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/models/native_file_system_entry.js b/chromeos/components/camera_app_ui/resources/js/models/native_file_system_entry.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/models/native_file_system_entry.js rename to chromeos/components/camera_app_ui/resources/js/models/native_file_system_entry.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/models/nop_video_processor.js b/chromeos/components/camera_app_ui/resources/js/models/nop_video_processor.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/models/nop_video_processor.js rename to chromeos/components/camera_app_ui/resources/js/models/nop_video_processor.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/models/result_saver.js b/chromeos/components/camera_app_ui/resources/js/models/result_saver.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/models/result_saver.js rename to chromeos/components/camera_app_ui/resources/js/models/result_saver.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/models/video_saver.js b/chromeos/components/camera_app_ui/resources/js/models/video_saver.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/models/video_saver.js rename to chromeos/components/camera_app_ui/resources/js/models/video_saver.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/mojo/chrome_helper.js b/chromeos/components/camera_app_ui/resources/js/mojo/chrome_helper.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/mojo/chrome_helper.js rename to chromeos/components/camera_app_ui/resources/js/mojo/chrome_helper.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/mojo/device_operator.js b/chromeos/components/camera_app_ui/resources/js/mojo/device_operator.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/mojo/device_operator.js rename to chromeos/components/camera_app_ui/resources/js/mojo/device_operator.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/mojo/image_capture.js b/chromeos/components/camera_app_ui/resources/js/mojo/image_capture.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/mojo/image_capture.js rename to chromeos/components/camera_app_ui/resources/js/mojo/image_capture.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/nav.js b/chromeos/components/camera_app_ui/resources/js/nav.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/nav.js rename to chromeos/components/camera_app_ui/resources/js/nav.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/perf.js b/chromeos/components/camera_app_ui/resources/js/perf.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/perf.js rename to chromeos/components/camera_app_ui/resources/js/perf.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/sound.js b/chromeos/components/camera_app_ui/resources/js/sound.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/sound.js rename to chromeos/components/camera_app_ui/resources/js/sound.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/state.js b/chromeos/components/camera_app_ui/resources/js/state.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/state.js rename to chromeos/components/camera_app_ui/resources/js/state.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/toast.js b/chromeos/components/camera_app_ui/resources/js/toast.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/toast.js rename to chromeos/components/camera_app_ui/resources/js/toast.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/tooltip.js b/chromeos/components/camera_app_ui/resources/js/tooltip.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/tooltip.js rename to chromeos/components/camera_app_ui/resources/js/tooltip.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/type.js b/chromeos/components/camera_app_ui/resources/js/type.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/type.js rename to chromeos/components/camera_app_ui/resources/js/type.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/util.js b/chromeos/components/camera_app_ui/resources/js/util.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/util.js rename to chromeos/components/camera_app_ui/resources/js/util.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/camera.js b/chromeos/components/camera_app_ui/resources/js/views/camera.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/camera.js rename to chromeos/components/camera_app_ui/resources/js/views/camera.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/camera/layout.js b/chromeos/components/camera_app_ui/resources/js/views/camera/layout.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/camera/layout.js rename to chromeos/components/camera_app_ui/resources/js/views/camera/layout.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/camera/mode/index.js b/chromeos/components/camera_app_ui/resources/js/views/camera/mode/index.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/camera/mode/index.js rename to chromeos/components/camera_app_ui/resources/js/views/camera/mode/index.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/camera/mode/mode_base.js b/chromeos/components/camera_app_ui/resources/js/views/camera/mode/mode_base.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/camera/mode/mode_base.js rename to chromeos/components/camera_app_ui/resources/js/views/camera/mode/mode_base.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/camera/mode/photo.js b/chromeos/components/camera_app_ui/resources/js/views/camera/mode/photo.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/camera/mode/photo.js rename to chromeos/components/camera_app_ui/resources/js/views/camera/mode/photo.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/camera/mode/portrait.js b/chromeos/components/camera_app_ui/resources/js/views/camera/mode/portrait.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/camera/mode/portrait.js rename to chromeos/components/camera_app_ui/resources/js/views/camera/mode/portrait.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/camera/mode/record_time.js b/chromeos/components/camera_app_ui/resources/js/views/camera/mode/record_time.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/camera/mode/record_time.js rename to chromeos/components/camera_app_ui/resources/js/views/camera/mode/record_time.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/camera/mode/square.js b/chromeos/components/camera_app_ui/resources/js/views/camera/mode/square.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/camera/mode/square.js rename to chromeos/components/camera_app_ui/resources/js/views/camera/mode/square.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/camera/mode/video.js b/chromeos/components/camera_app_ui/resources/js/views/camera/mode/video.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/camera/mode/video.js rename to chromeos/components/camera_app_ui/resources/js/views/camera/mode/video.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/camera/options.js b/chromeos/components/camera_app_ui/resources/js/views/camera/options.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/camera/options.js rename to chromeos/components/camera_app_ui/resources/js/views/camera/options.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/camera/preview.js b/chromeos/components/camera_app_ui/resources/js/views/camera/preview.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/camera/preview.js rename to chromeos/components/camera_app_ui/resources/js/views/camera/preview.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/camera/review_result.js b/chromeos/components/camera_app_ui/resources/js/views/camera/review_result.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/camera/review_result.js rename to chromeos/components/camera_app_ui/resources/js/views/camera/review_result.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/camera/timertick.js b/chromeos/components/camera_app_ui/resources/js/views/camera/timertick.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/camera/timertick.js rename to chromeos/components/camera_app_ui/resources/js/views/camera/timertick.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/camera_intent.js b/chromeos/components/camera_app_ui/resources/js/views/camera_intent.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/camera_intent.js rename to chromeos/components/camera_app_ui/resources/js/views/camera_intent.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/dialog.js b/chromeos/components/camera_app_ui/resources/js/views/dialog.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/dialog.js rename to chromeos/components/camera_app_ui/resources/js/views/dialog.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/settings.js b/chromeos/components/camera_app_ui/resources/js/views/settings.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/settings.js rename to chromeos/components/camera_app_ui/resources/js/views/settings.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/view.js b/chromeos/components/camera_app_ui/resources/js/views/view.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/view.js rename to chromeos/components/camera_app_ui/resources/js/views/view.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/views/warning.js b/chromeos/components/camera_app_ui/resources/js/views/warning.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/views/warning.js rename to chromeos/components/camera_app_ui/resources/js/views/warning.js
diff --git a/chromeos/components/camera_app_ui/resources/src/js/waitable_event.js b/chromeos/components/camera_app_ui/resources/js/waitable_event.js similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/js/waitable_event.js rename to chromeos/components/camera_app_ui/resources/js/waitable_event.js
diff --git a/chromeos/components/camera_app_ui/resources/src/manifest.json b/chromeos/components/camera_app_ui/resources/manifest.json similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/manifest.json rename to chromeos/components/camera_app_ui/resources/manifest.json
diff --git a/chromeos/components/camera_app_ui/resources/src/sounds/record_end.ogg b/chromeos/components/camera_app_ui/resources/sounds/record_end.ogg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/sounds/record_end.ogg rename to chromeos/components/camera_app_ui/resources/sounds/record_end.ogg Binary files differ
diff --git a/chromeos/components/camera_app_ui/resources/src/sounds/record_pause.ogg b/chromeos/components/camera_app_ui/resources/sounds/record_pause.ogg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/sounds/record_pause.ogg rename to chromeos/components/camera_app_ui/resources/sounds/record_pause.ogg Binary files differ
diff --git a/chromeos/components/camera_app_ui/resources/src/sounds/record_start.ogg b/chromeos/components/camera_app_ui/resources/sounds/record_start.ogg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/sounds/record_start.ogg rename to chromeos/components/camera_app_ui/resources/sounds/record_start.ogg Binary files differ
diff --git a/chromeos/components/camera_app_ui/resources/src/sounds/shutter.ogg b/chromeos/components/camera_app_ui/resources/sounds/shutter.ogg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/sounds/shutter.ogg rename to chromeos/components/camera_app_ui/resources/sounds/shutter.ogg Binary files differ
diff --git a/chromeos/components/camera_app_ui/resources/src/sounds/tick_final.ogg b/chromeos/components/camera_app_ui/resources/sounds/tick_final.ogg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/sounds/tick_final.ogg rename to chromeos/components/camera_app_ui/resources/sounds/tick_final.ogg Binary files differ
diff --git a/chromeos/components/camera_app_ui/resources/src/sounds/tick_inc.ogg b/chromeos/components/camera_app_ui/resources/sounds/tick_inc.ogg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/sounds/tick_inc.ogg rename to chromeos/components/camera_app_ui/resources/sounds/tick_inc.ogg Binary files differ
diff --git a/chromeos/components/camera_app_ui/resources/src/sounds/tick_start.ogg b/chromeos/components/camera_app_ui/resources/sounds/tick_start.ogg similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/sounds/tick_start.ogg rename to chromeos/components/camera_app_ui/resources/sounds/tick_start.ogg Binary files differ
diff --git a/chromeos/components/camera_app_ui/resources/src/views/background.html b/chromeos/components/camera_app_ui/resources/src/views/background.html deleted file mode 100644 index f932251..0000000 --- a/chromeos/components/camera_app_ui/resources/src/views/background.html +++ /dev/null
@@ -1,12 +0,0 @@ -<!doctype html> -<!-- Copyright 2019 The Chromium Authors. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. --> -<html> - <head> - <script src="../js/mojo/mojo_bindings_lite.js"></script> - <script src="../js/mojo/camera_intent.mojom-lite.js"></script> - <script src="../js/mojo/camera_app_helper.mojom-lite.js"></script> - <script type="module" src="../js/background.js"></script> - </head> -</html>
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/BUILD.gn b/chromeos/components/camera_app_ui/resources/strings/BUILD.gn similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/BUILD.gn rename to chromeos/components/camera_app_ui/resources/strings/BUILD.gn
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings.grd b/chromeos/components/camera_app_ui/resources/strings/camera_strings.grd similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings.grd rename to chromeos/components/camera_app_ui/resources/strings/camera_strings.grd
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_af.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_af.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_af.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_af.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_am.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_am.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_am.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_am.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ar.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_ar.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ar.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_ar.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_as.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_as.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_as.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_as.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_az.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_az.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_az.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_az.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_be.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_be.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_be.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_be.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_bg.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_bg.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_bg.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_bg.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_bn.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_bn.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_bn.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_bn.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_bs.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_bs.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_bs.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_bs.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ca.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_ca.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ca.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_ca.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_cs.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_cs.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_cs.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_cs.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_da.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_da.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_da.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_da.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_de.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_de.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_de.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_de.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_el.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_el.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_el.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_el.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_en-GB.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_en-GB.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_en-GB.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_en-GB.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_es-419.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_es-419.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_es-419.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_es-419.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_es.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_es.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_es.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_es.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_et.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_et.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_et.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_et.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_eu.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_eu.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_eu.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_eu.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fa.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_fa.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fa.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_fa.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fi.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_fi.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fi.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_fi.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fil.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_fil.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fil.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_fil.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fr-CA.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_fr-CA.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fr-CA.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_fr-CA.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fr.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_fr.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fr.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_fr.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_gl.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_gl.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_gl.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_gl.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_BANNER_CLOSE_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_BANNER_CLOSE_BUTTON.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_BANNER_CLOSE_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_BANNER_CLOSE_BUTTON.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_BANNER_MSG.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_BANNER_MSG.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_BANNER_MSG.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_BANNER_MSG.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_BANNER_TITLE.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_BANNER_TITLE.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_BANNER_TITLE.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_BANNER_TITLE.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_CAMERA_RESOLUTION_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_CAMERA_RESOLUTION_BUTTON.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_CAMERA_RESOLUTION_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_CAMERA_RESOLUTION_BUTTON.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_ERROR_MSG_EXPERT_MODE_NOT_SUPPORTED.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_ERROR_MSG_EXPERT_MODE_NOT_SUPPORTED.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_ERROR_MSG_EXPERT_MODE_NOT_SUPPORTED.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_ERROR_MSG_EXPERT_MODE_NOT_SUPPORTED.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_ERROR_MSG_TAKE_PORTRAIT_PHOTO_FAILED.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_ERROR_MSG_TAKE_PORTRAIT_PHOTO_FAILED.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_ERROR_MSG_TAKE_PORTRAIT_PHOTO_FAILED.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_ERROR_MSG_TAKE_PORTRAIT_PHOTO_FAILED.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_EXPERT_MODE_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_EXPERT_MODE_BUTTON.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_EXPERT_MODE_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_EXPERT_MODE_BUTTON.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_EXPERT_PREVIEW_METADATA.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_EXPERT_PREVIEW_METADATA.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_EXPERT_PREVIEW_METADATA.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_EXPERT_PREVIEW_METADATA.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_EXPERT_SAVE_METADATA.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_EXPERT_SAVE_METADATA.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_EXPERT_SAVE_METADATA.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_EXPERT_SAVE_METADATA.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_FEEDBACK_DESCRIPTION_PLACEHOLDER.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_FEEDBACK_DESCRIPTION_PLACEHOLDER.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_FEEDBACK_DESCRIPTION_PLACEHOLDER.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_FEEDBACK_DESCRIPTION_PLACEHOLDER.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_BACK_CAMERA.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_LABEL_BACK_CAMERA.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_BACK_CAMERA.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_LABEL_BACK_CAMERA.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_EXTERNAL_CAMERA.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_LABEL_EXTERNAL_CAMERA.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_EXTERNAL_CAMERA.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_LABEL_EXTERNAL_CAMERA.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_FRONT_CAMERA.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_LABEL_FRONT_CAMERA.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_FRONT_CAMERA.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_LABEL_FRONT_CAMERA.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_RECORD_VIDEO_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_LABEL_SWITCH_RECORD_VIDEO_BUTTON.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_RECORD_VIDEO_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_LABEL_SWITCH_RECORD_VIDEO_BUTTON.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_PHOTO_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_PHOTO_BUTTON.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_PHOTO_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_PHOTO_BUTTON.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_PORTRAIT_PHOTO_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_PORTRAIT_PHOTO_BUTTON.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_PORTRAIT_PHOTO_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_PORTRAIT_PHOTO_BUTTON.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_SQUARE_PHOTO_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_SQUARE_PHOTO_BUTTON.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_SQUARE_PHOTO_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_SQUARE_PHOTO_BUTTON.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_VIDEO_RESOLUTION.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_LABEL_VIDEO_RESOLUTION.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_VIDEO_RESOLUTION.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_LABEL_VIDEO_RESOLUTION.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_PHOTO_RESOLUTION_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_PHOTO_RESOLUTION_BUTTON.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_PHOTO_RESOLUTION_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_PHOTO_RESOLUTION_BUTTON.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_RECORD_VIDEO_PAUSED_MSG.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_RECORD_VIDEO_PAUSED_MSG.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_RECORD_VIDEO_PAUSED_MSG.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_RECORD_VIDEO_PAUSED_MSG.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_RECORD_VIDEO_PAUSE_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_RECORD_VIDEO_PAUSE_BUTTON.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_RECORD_VIDEO_PAUSE_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_RECORD_VIDEO_PAUSE_BUTTON.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_RECORD_VIDEO_RESUME_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_RECORD_VIDEO_RESUME_BUTTON.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_RECORD_VIDEO_RESUME_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_RECORD_VIDEO_RESUME_BUTTON.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_TAKE_VIDEO_SNAPSHOT_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_TAKE_VIDEO_SNAPSHOT_BUTTON.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_TAKE_VIDEO_SNAPSHOT_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_TAKE_VIDEO_SNAPSHOT_BUTTON.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_TOGGLE_60FPS_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_TOGGLE_60FPS_BUTTON.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_TOGGLE_60FPS_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_TOGGLE_60FPS_BUTTON.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_VIDEO_RESOLUTION_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_VIDEO_RESOLUTION_BUTTON.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_VIDEO_RESOLUTION_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_VIDEO_RESOLUTION_BUTTON.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_30FPS.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/ID_LABEL_30FPS.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_30FPS.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/ID_LABEL_30FPS.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_60FPS.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/ID_LABEL_60FPS.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_60FPS.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/ID_LABEL_60FPS.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_DETAIL_PHOTO_RESOLUTION.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/ID_LABEL_DETAIL_PHOTO_RESOLUTION.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_DETAIL_PHOTO_RESOLUTION.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/ID_LABEL_DETAIL_PHOTO_RESOLUTION.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_PHOTO_RESOLUTION.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/ID_LABEL_PHOTO_RESOLUTION.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_PHOTO_RESOLUTION.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/ID_LABEL_PHOTO_RESOLUTION.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_VIDEO_RESOLUTION.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/ID_LABEL_VIDEO_RESOLUTION.png.sha1 similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_VIDEO_RESOLUTION.png.sha1 rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/ID_LABEL_VIDEO_RESOLUTION.png.sha1
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_gu.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_gu.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_gu.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_gu.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_hi.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_hi.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_hi.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_hi.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_hr.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_hr.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_hr.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_hr.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_hu.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_hu.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_hu.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_hu.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_hy.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_hy.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_hy.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_hy.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_id.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_id.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_id.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_id.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_is.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_is.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_is.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_is.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_it.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_it.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_it.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_it.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_iw.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_iw.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_iw.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_iw.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ja.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_ja.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ja.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_ja.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ka.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_ka.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ka.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_ka.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_kk.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_kk.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_kk.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_kk.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_km.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_km.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_km.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_km.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_kn.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_kn.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_kn.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_kn.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ko.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_ko.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ko.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_ko.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ky.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_ky.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ky.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_ky.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_lo.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_lo.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_lo.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_lo.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_lt.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_lt.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_lt.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_lt.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_lv.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_lv.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_lv.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_lv.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_mk.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_mk.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_mk.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_mk.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ml.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_ml.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ml.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_ml.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_mn.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_mn.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_mn.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_mn.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_mr.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_mr.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_mr.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_mr.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ms.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_ms.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ms.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_ms.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_my.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_my.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_my.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_my.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ne.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_ne.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ne.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_ne.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_nl.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_nl.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_nl.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_nl.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_no.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_no.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_no.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_no.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_or.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_or.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_or.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_or.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_pa.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_pa.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_pa.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_pa.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_pl.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_pl.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_pl.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_pl.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_pt-BR.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_pt-BR.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_pt-BR.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_pt-BR.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_pt-PT.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_pt-PT.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_pt-PT.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_pt-PT.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ro.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_ro.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ro.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_ro.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ru.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_ru.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ru.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_ru.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_si.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_si.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_si.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_si.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sk.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_sk.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sk.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_sk.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sl.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_sl.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sl.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_sl.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sq.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_sq.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sq.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_sq.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sr-Latn.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_sr-Latn.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sr-Latn.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_sr-Latn.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sr.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_sr.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sr.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_sr.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sv.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_sv.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sv.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_sv.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sw.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_sw.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sw.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_sw.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ta.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_ta.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ta.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_ta.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_te.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_te.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_te.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_te.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_th.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_th.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_th.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_th.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_tr.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_tr.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_tr.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_tr.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_uk.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_uk.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_uk.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_uk.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ur.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_ur.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ur.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_ur.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_uz.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_uz.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_uz.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_uz.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_vi.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_vi.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_vi.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_vi.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_zh-CN.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_zh-CN.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_zh-CN.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_zh-CN.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_zh-HK.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_zh-HK.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_zh-HK.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_zh-HK.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_zh-TW.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_zh-TW.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_zh-TW.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_zh-TW.xtb
diff --git a/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_zu.xtb b/chromeos/components/camera_app_ui/resources/strings/camera_strings_zu.xtb similarity index 100% rename from chromeos/components/camera_app_ui/resources/src/strings/camera_strings_zu.xtb rename to chromeos/components/camera_app_ui/resources/strings/camera_strings_zu.xtb
diff --git a/chromeos/components/camera_app_ui/resources/utils/cca.py b/chromeos/components/camera_app_ui/resources/utils/cca.py index fa4d888..8b5539d 100755 --- a/chromeos/components/camera_app_ui/resources/utils/cca.py +++ b/chromeos/components/camera_app_ui/resources/utils/cca.py
@@ -37,7 +37,7 @@ grit_cmd = [ os.path.join(get_chromium_root(), 'tools/grit/grit.py'), '-i', - 'src/strings/camera_strings.grd', + 'strings/camera_strings.grd', 'build', '-o', 'build/strings', @@ -151,7 +151,14 @@ build_mojom_bindings(mojom_bindings) shutil.rmtree('build/camera', ignore_errors=True) - dir_util.copy_tree('src', 'build/camera') + + dir_list = [src for src in os.listdir('.') if os.path.isdir(src)] + for d in dir_list: + if d == 'build': + continue + dir_util.copy_tree(d, os.path.join('build/camera', d)) + shutil.copy2('manifest.json', 'build/camera/manifest.json') + for f in mojo_files: shutil.copy2(os.path.join('build/mojo', f), 'build/camera/js/mojo') dir_util.copy_tree('build/strings', 'build/camera') @@ -163,7 +170,7 @@ commit_hash = subprocess.check_output(git_cmd, text=True).strip()[:8] timestamp = time.strftime("%F %T") - with open('src/manifest.json') as f: + with open('manifest.json') as f: manifest = json.load(f) manifest['version_name'] = f'Dev {commit_hash} @ {timestamp}' if key is not None: @@ -236,7 +243,7 @@ node = os.path.join(root, 'third_party/node/linux/node-linux-x64/bin/node') eslint = os.path.join( root, 'third_party/node/node_modules/eslint/bin/eslint.js') - subprocess.call([node, eslint, 'src/js']) + subprocess.call([node, eslint, 'js']) def parse_args(args):
diff --git a/chromeos/components/camera_app_ui/resources/views/background.html b/chromeos/components/camera_app_ui/resources/views/background.html new file mode 100644 index 0000000..f1ec880f --- /dev/null +++ b/chromeos/components/camera_app_ui/resources/views/background.html
@@ -0,0 +1,12 @@ +<!doctype html> +<!-- Copyright 2019 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> +<html> + <head> + <script src="/js/mojo/mojo_bindings_lite.js"></script> + <script src="/js/mojo/camera_intent.mojom-lite.js"></script> + <script src="/js/mojo/camera_app_helper.mojom-lite.js"></script> + <script type="module" src="/js/background.js"></script> + </head> +</html>
diff --git a/chromeos/components/camera_app_ui/resources/src/views/main.html b/chromeos/components/camera_app_ui/resources/views/main.html similarity index 92% rename from chromeos/components/camera_app_ui/resources/src/views/main.html rename to chromeos/components/camera_app_ui/resources/views/main.html index 88b620e..ad272db 100644 --- a/chromeos/components/camera_app_ui/resources/src/views/main.html +++ b/chromeos/components/camera_app_ui/resources/views/main.html
@@ -8,20 +8,20 @@ name by JavaScript --> <title></title> <meta charset="utf-8"> - <link rel="stylesheet" href="../css/main.css"> - <script src="../js/mojo/mojo_bindings_lite.js"></script> - <script src="../js/mojo/time.mojom-lite.js"></script> - <script src="../js/mojo/idle_manager.mojom-lite.js"></script> - <script src="../js/mojo/camera_metadata_tags.mojom-lite.js"></script> - <script src="../js/mojo/camera_metadata.mojom-lite.js"></script> - <script src="../js/mojo/camera_common.mojom-lite.js"></script> - <script src="../js/mojo/image_capture.mojom-lite.js"></script> - <script src="../js/mojo/geometry.mojom-lite.js"></script> - <script src="../js/mojo/range.mojom-lite.js"></script> - <script src="../js/mojo/camera_intent.mojom-lite.js"></script> - <script src="../js/mojo/camera_app.mojom-lite.js"></script> - <script src="../js/mojo/camera_app_helper.mojom-lite.js"></script> - <script type="module" src="../js/init.js"></script> + <link rel="stylesheet" href="/css/main.css"> + <script src="/js/mojo/mojo_bindings_lite.js"></script> + <script src="/js/mojo/time.mojom-lite.js"></script> + <script src="/js/mojo/idle_manager.mojom-lite.js"></script> + <script src="/js/mojo/camera_metadata_tags.mojom-lite.js"></script> + <script src="/js/mojo/camera_metadata.mojom-lite.js"></script> + <script src="/js/mojo/camera_common.mojom-lite.js"></script> + <script src="/js/mojo/image_capture.mojom-lite.js"></script> + <script src="/js/mojo/geometry.mojom-lite.js"></script> + <script src="/js/mojo/range.mojom-lite.js"></script> + <script src="/js/mojo/camera_intent.mojom-lite.js"></script> + <script src="/js/mojo/camera_app.mojom-lite.js"></script> + <script src="/js/mojo/camera_app_helper.mojom-lite.js"></script> + <script type="module" src="/js/init.js"></script> </head> <body class="sound mirror mic _3x3"> <div id="view-camera"> @@ -70,7 +70,7 @@ </div> <div id="preview-focus"> <object id="preview-focus-aim" type="image/svg+xml" - data="../images/camera_focus_aim.svg" + data="/images/camera_focus_aim.svg" tabindex="-1" hidden></object> </div> <div class="centered-overlay" id="camera-mode"></div> @@ -395,16 +395,16 @@ </div> <div class="centered-overlay" id="toast" aria-live="polite"></div> <div id="tooltip" aria-hidden="true"></div> - <audio id="sound-tick-final" src="../sounds/tick_final.ogg" + <audio id="sound-tick-final" src="/sounds/tick_final.ogg" data-timeout="1000"> - <audio id="sound-tick-inc" src="../sounds/tick_inc.ogg" data-timeout="1000"> - <audio id="sound-tick-start" src="../sounds/tick_start.ogg" + <audio id="sound-tick-inc" src="/sounds/tick_inc.ogg" data-timeout="1000"> + <audio id="sound-tick-start" src="/sounds/tick_start.ogg" data-timeout="1000"> - <audio id="sound-shutter" src="../sounds/shutter.ogg" data-timeout="350"> - <audio id="sound-rec-start" src="../sounds/record_start.ogg" + <audio id="sound-shutter" src="/sounds/shutter.ogg" data-timeout="350"> + <audio id="sound-rec-start" src="/sounds/record_start.ogg" data-timeout="300"> - <audio id="sound-rec-end" src="../sounds/record_end.ogg" data-timeout="450"> - <audio id="sound-rec-pause" src="../sounds/record_pause.ogg" + <audio id="sound-rec-end" src="/sounds/record_end.ogg" data-timeout="450"> + <audio id="sound-rec-pause" src="/sounds/record_pause.ogg" data-timeout="500"> <template id="resolution-item-template"> <label class="menu-item circle resolution-option">
diff --git a/chromeos/components/camera_app_ui/url_constants.cc b/chromeos/components/camera_app_ui/url_constants.cc index b1883e29..6a25ec23 100644 --- a/chromeos/components/camera_app_ui/url_constants.cc +++ b/chromeos/components/camera_app_ui/url_constants.cc
@@ -8,7 +8,7 @@ const char kChromeUICameraAppHost[] = "camera-app"; const char kChromeUICameraAppMainURL[] = - "chrome://camera-app/src/views/main.html"; + "chrome://camera-app/views/main.html"; const char kChromeUICameraAppURL[] = "chrome://camera-app/"; } // namespace chromeos
diff --git a/chromeos/components/phonehub/fake_onboarding_ui_tracker.h b/chromeos/components/phonehub/fake_onboarding_ui_tracker.h index c28bc25..c6535f3 100644 --- a/chromeos/components/phonehub/fake_onboarding_ui_tracker.h +++ b/chromeos/components/phonehub/fake_onboarding_ui_tracker.h
@@ -22,7 +22,7 @@ bool ShouldShowOnboardingUi() const override; void DismissSetupUi() override; - bool should_show_onboarding_ui_; + bool should_show_onboarding_ui_ = false; }; } // namespace phonehub
diff --git a/chromeos/constants/chromeos_features.cc b/chromeos/constants/chromeos_features.cc index 0cc3dbe..69de49cf 100644 --- a/chromeos/constants/chromeos_features.cc +++ b/chromeos/constants/chromeos_features.cc
@@ -597,6 +597,10 @@ const base::Feature kVirtualKeyboardBorderedKey{ "VirtualKeyboardBorderedKey", base::FEATURE_ENABLED_BY_DEFAULT}; +// Enable or disable the camera/mic indicators/notifications for VMs. +const base::Feature kVmCameraMicIndicatorsAndNotifications{ + "VmCameraMicIndicatorsAndNotifications", base::FEATURE_DISABLED_BY_DEFAULT}; + // Controls whether to enable syncing of Wi-Fi configurations between // ChromeOS and a connected Android phone. const base::Feature kWifiSyncAndroid{"WifiSyncAndroid",
diff --git a/chromeos/constants/chromeos_features.h b/chromeos/constants/chromeos_features.h index 2212bdf94..68d8ed9 100644 --- a/chromeos/constants/chromeos_features.h +++ b/chromeos/constants/chromeos_features.h
@@ -268,6 +268,8 @@ COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kVirtualKeyboardBorderedKey; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) +extern const base::Feature kVmCameraMicIndicatorsAndNotifications; +COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kWifiSyncAndroid; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kImeMozcProto;
diff --git a/chromeos/dbus/dlcservice/dlcservice_client.cc b/chromeos/dbus/dlcservice/dlcservice_client.cc index 212e492f..d408231b5 100644 --- a/chromeos/dbus/dlcservice/dlcservice_client.cc +++ b/chromeos/dbus/dlcservice/dlcservice_client.cc
@@ -427,9 +427,6 @@ DISALLOW_COPY_AND_ASSIGN(DlcserviceClientImpl); }; -const DlcserviceClient::ProgressCallback DlcserviceClient::IgnoreProgress = - base::BindRepeating([](double) {}); - DlcserviceClient::DlcserviceClient() { CHECK(!g_instance); g_instance = this;
diff --git a/chromeos/dbus/dlcservice/dlcservice_client.h b/chromeos/dbus/dlcservice/dlcservice_client.h index 2da59ef..d7d9d4bc 100644 --- a/chromeos/dbus/dlcservice/dlcservice_client.h +++ b/chromeos/dbus/dlcservice/dlcservice_client.h
@@ -83,10 +83,6 @@ const std::string& err, const dlcservice::DlcsWithContent& dlcs_with_content)>; - // The callback to use for |Install()|, if the caller wants to ignore the - // progress updates. - static const ProgressCallback IgnoreProgress; - // Installs the DLC passed in while reporting progress through the progress // callback and only calls install callback on install success/failure. virtual void Install(const std::string& dlc_id,
diff --git a/chromeos/dbus/dlcservice/dlcservice_client_unittest.cc b/chromeos/dbus/dlcservice/dlcservice_client_unittest.cc index 4d02cb05..aa3a72c 100644 --- a/chromeos/dbus/dlcservice/dlcservice_client_unittest.cc +++ b/chromeos/dbus/dlcservice/dlcservice_client_unittest.cc
@@ -12,6 +12,7 @@ #include <vector> #include "base/bind.h" +#include "base/bind_helpers.h" #include "base/run_loop.h" #include "base/test/task_environment.h" #include "dbus/mock_bus.h" @@ -282,8 +283,7 @@ base::BindOnce([](const DlcserviceClient::InstallResult& install_result) { EXPECT_EQ(dlcservice::kErrorNone, install_result.error); }); - client_->Install("foo-dlc", std::move(install_callback), - DlcserviceClient::IgnoreProgress); + client_->Install("foo-dlc", std::move(install_callback), base::DoNothing()); base::RunLoop().RunUntilIdle(); } @@ -302,8 +302,7 @@ base::BindOnce([](const DlcserviceClient::InstallResult& install_result) { EXPECT_EQ(dlcservice::kErrorInternal, install_result.error); }); - client_->Install("foo-dlc", std::move(install_callback), - DlcserviceClient::IgnoreProgress); + client_->Install("foo-dlc", std::move(install_callback), base::DoNothing()); base::RunLoop().RunUntilIdle(); } @@ -373,8 +372,7 @@ base::BindOnce([](const DlcserviceClient::InstallResult& install_result) { EXPECT_EQ(dlcservice::kErrorNone, install_result.error); }); - client_->Install("foo-dlc", std::move(install_callback), - DlcserviceClient::IgnoreProgress); + client_->Install("foo-dlc", std::move(install_callback), base::DoNothing()); base::RunLoop().RunUntilIdle(); } @@ -395,8 +393,7 @@ }, &counter); responses_.push_back(dbus::Response::CreateEmpty()); - client_->Install({}, std::move(install_callback), - DlcserviceClient::IgnoreProgress); + client_->Install({}, std::move(install_callback), base::DoNothing()); } base::RunLoop().RunUntilIdle(); EXPECT_EQ(0u, counter.load());
diff --git a/chromeos/services/machine_learning/public/cpp/handwriting_model_loader.cc b/chromeos/services/machine_learning/public/cpp/handwriting_model_loader.cc index cc3add6d..4c758bf 100644 --- a/chromeos/services/machine_learning/public/cpp/handwriting_model_loader.cc +++ b/chromeos/services/machine_learning/public/cpp/handwriting_model_loader.cc
@@ -7,6 +7,7 @@ #include <string> #include <utility> +#include "base/bind_helpers.h" #include "base/command_line.h" #include "base/metrics/histogram_macros.h" #include "chromeos/services/machine_learning/public/cpp/service_connection.h" @@ -93,7 +94,7 @@ kLibHandwritingDlcId, base::BindOnce(&OnInstallDlcComplete, std::move(spec), std::move(receiver), std::move(callback)), - chromeos::DlcserviceClient::IgnoreProgress); + base::DoNothing()); return; } }
diff --git a/chromeos/services/multidevice_setup/android_sms_app_installing_status_observer.cc b/chromeos/services/multidevice_setup/android_sms_app_installing_status_observer.cc index b791f74b..e924183 100644 --- a/chromeos/services/multidevice_setup/android_sms_app_installing_status_observer.cc +++ b/chromeos/services/multidevice_setup/android_sms_app_installing_status_observer.cc
@@ -9,11 +9,19 @@ #include "chromeos/services/multidevice_setup/host_status_provider.h" #include "chromeos/services/multidevice_setup/public/cpp/android_sms_app_helper_delegate.h" #include "chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h" +#include "components/prefs/pref_registry_simple.h" +#include "components/prefs/pref_service.h" namespace chromeos { namespace multidevice_setup { +namespace { + +const char kShouldAttemptReenable[] = "android_sms.should_attempt_reenable"; + +} // namespace + // static AndroidSmsAppInstallingStatusObserver::Factory* AndroidSmsAppInstallingStatusObserver::Factory::test_factory_ = nullptr; @@ -23,14 +31,15 @@ AndroidSmsAppInstallingStatusObserver::Factory::Create( HostStatusProvider* host_status_provider, FeatureStateManager* feature_state_manager, - AndroidSmsAppHelperDelegate* android_sms_app_helper_delegate) { + AndroidSmsAppHelperDelegate* android_sms_app_helper_delegate, + PrefService* pref_service) { if (test_factory_) { test_factory_->CreateInstance(host_status_provider, feature_state_manager, std::move(android_sms_app_helper_delegate)); } return base::WrapUnique(new AndroidSmsAppInstallingStatusObserver( host_status_provider, feature_state_manager, - std::move(android_sms_app_helper_delegate))); + std::move(android_sms_app_helper_delegate), pref_service)); } // static @@ -47,16 +56,29 @@ feature_state_manager_->RemoveObserver(this); } +// static +void AndroidSmsAppInstallingStatusObserver::RegisterPrefs( + PrefRegistrySimple* registry) { + registry->RegisterBooleanPref(kShouldAttemptReenable, true); +} + AndroidSmsAppInstallingStatusObserver::AndroidSmsAppInstallingStatusObserver( HostStatusProvider* host_status_provider, FeatureStateManager* feature_state_manager, - AndroidSmsAppHelperDelegate* android_sms_app_helper_delegate) + AndroidSmsAppHelperDelegate* android_sms_app_helper_delegate, + PrefService* pref_service) : host_status_provider_(host_status_provider), feature_state_manager_(feature_state_manager), - android_sms_app_helper_delegate_(android_sms_app_helper_delegate) { + android_sms_app_helper_delegate_(android_sms_app_helper_delegate), + pref_service_(pref_service) { host_status_provider_->AddObserver(this); feature_state_manager_->AddObserver(this); - UpdatePwaInstallationState(); + + // Wait until the app registry has been loaded before updating installation + // status. + android_sms_app_helper_delegate_->ExecuteOnAppRegistryReady(base::BindOnce( + &AndroidSmsAppInstallingStatusObserver::UpdatePwaInstallationState, + weak_ptr_factory_.GetWeakPtr())); } bool AndroidSmsAppInstallingStatusObserver:: @@ -79,7 +101,47 @@ return true; } +void AndroidSmsAppInstallingStatusObserver::ReenableIfAppropriate() { + if (!pref_service_->GetBoolean(kShouldAttemptReenable)) { + return; + } + + // This is a one-time attempt, flip the pref to prevent later tries. + pref_service_->SetBoolean(kShouldAttemptReenable, false); + + if (host_status_provider_->GetHostWithStatus().host_status() != + mojom::HostStatus::kHostVerified) { + PA_LOG(INFO) << "Can't reenable Messages, no verified host."; + return; + } + + if (feature_state_manager_->GetFeatureStates()[mojom::Feature::kMessages] != + mojom::FeatureState::kDisabledByUser) { + PA_LOG(INFO) + << "Can't reenable Messages, feature is not in disabled state."; + return; + } + + if (!android_sms_app_helper_delegate_->IsAppInstalled()) { + PA_LOG(INFO) << "Can't reenable Messages, app not installed."; + return; + } + + PA_LOG(INFO) << "Performing one-time re-enable."; + feature_state_manager_->SetFeatureEnabledState(mojom::Feature::kMessages, + true); +} + void AndroidSmsAppInstallingStatusObserver::UpdatePwaInstallationState() { + if (!android_sms_app_helper_delegate_->IsAppRegistryReady()) { + PA_LOG(INFO) << "App registry is not ready."; + return; + } + + // TODO(crbug/1131140): Remove in M-89. This is needed to correct a bug + // introduced in M-85 and is not permanently. + ReenableIfAppropriate(); + if (!DoesFeatureStateAllowInstallation()) { PA_LOG(INFO) << "Feature state does not allow installation, tearing down App.";
diff --git a/chromeos/services/multidevice_setup/android_sms_app_installing_status_observer.h b/chromeos/services/multidevice_setup/android_sms_app_installing_status_observer.h index 8c2316e..6f392774 100644 --- a/chromeos/services/multidevice_setup/android_sms_app_installing_status_observer.h +++ b/chromeos/services/multidevice_setup/android_sms_app_installing_status_observer.h
@@ -10,6 +10,9 @@ #include "chromeos/services/multidevice_setup/feature_state_manager.h" #include "chromeos/services/multidevice_setup/host_status_provider.h" +class PrefRegistrySimple; +class PrefService; + namespace chromeos { namespace multidevice_setup { @@ -27,7 +30,8 @@ static std::unique_ptr<AndroidSmsAppInstallingStatusObserver> Create( HostStatusProvider* host_status_provider, FeatureStateManager* feature_state_manager, - AndroidSmsAppHelperDelegate* android_sms_app_helper_delegate); + AndroidSmsAppHelperDelegate* android_sms_app_helper_delegate, + PrefService* pref_service); static void SetFactoryForTesting(Factory* test_factory); protected: @@ -44,11 +48,14 @@ ~AndroidSmsAppInstallingStatusObserver() override; + static void RegisterPrefs(PrefRegistrySimple* registry); + private: AndroidSmsAppInstallingStatusObserver( HostStatusProvider* host_status_provider, FeatureStateManager* feature_state_manager, - AndroidSmsAppHelperDelegate* android_sms_app_helper_delegate); + AndroidSmsAppHelperDelegate* android_sms_app_helper_delegate, + PrefService* pref_service); // HostStatusProvider::Observer: void OnHostStatusChange(const HostStatusProvider::HostStatusWithDevice& @@ -60,10 +67,14 @@ bool DoesFeatureStateAllowInstallation(); void UpdatePwaInstallationState(); + void ReenableIfAppropriate(); HostStatusProvider* host_status_provider_; FeatureStateManager* feature_state_manager_; AndroidSmsAppHelperDelegate* android_sms_app_helper_delegate_; + PrefService* pref_service_; + base::WeakPtrFactory<AndroidSmsAppInstallingStatusObserver> weak_ptr_factory_{ + this}; DISALLOW_COPY_AND_ASSIGN(AndroidSmsAppInstallingStatusObserver); };
diff --git a/chromeos/services/multidevice_setup/android_sms_app_installing_status_observer_unittest.cc b/chromeos/services/multidevice_setup/android_sms_app_installing_status_observer_unittest.cc index 0af2524..506cc74 100644 --- a/chromeos/services/multidevice_setup/android_sms_app_installing_status_observer_unittest.cc +++ b/chromeos/services/multidevice_setup/android_sms_app_installing_status_observer_unittest.cc
@@ -11,6 +11,7 @@ #include "chromeos/services/multidevice_setup/fake_host_status_provider.h" #include "chromeos/services/multidevice_setup/public/cpp/fake_android_sms_app_helper_delegate.h" #include "chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h" +#include "components/sync_preferences/testing_pref_service_syncable.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos { @@ -21,6 +22,7 @@ const char kFakePhoneKey[] = "fake-phone-key"; const char kFakePhoneName[] = "Phony Phone"; +const char kShouldAttemptReenable[] = "android_sms.should_attempt_reenable"; } // namespace @@ -37,15 +39,22 @@ std::make_unique<FakeAndroidSmsAppHelperDelegate>(); fake_host_status_provider_ = std::make_unique<FakeHostStatusProvider>(); fake_feature_state_manager_ = std::make_unique<FakeFeatureStateManager>(); + test_pref_service_ = + std::make_unique<sync_preferences::TestingPrefServiceSyncable>(); + AndroidSmsAppInstallingStatusObserver::RegisterPrefs( + test_pref_service_->registry()); android_sms_app_installing_status_observer_ = AndroidSmsAppInstallingStatusObserver::Factory::Create( fake_host_status_provider_.get(), fake_feature_state_manager_.get(), - fake_android_sms_app_helper_delegate_.get()); + fake_android_sms_app_helper_delegate_.get(), + test_pref_service_.get()); + } + void Initialize() { + fake_android_sms_app_helper_delegate_->set_is_app_registry_ready(true); SetMessagesFeatureState(mojom::FeatureState::kEnabledByUser); SetHostWithStatus(mojom::HostStatus::kHostVerified, GetFakePhone()); fake_app_helper_delegate()->Reset(); - EXPECT_FALSE(fake_app_helper_delegate()->has_installed_app()); } void SetHostWithStatus( @@ -70,11 +79,26 @@ feature_state); } + mojom::FeatureState GetMessagesFeatureState() { + return fake_feature_state_manager_->GetFeatureState( + mojom::Feature::kMessages); + } + + FakeAndroidSmsAppHelperDelegate* fake_android_sms_app_helper_delegate() { + return fake_android_sms_app_helper_delegate_.get(); + } + + sync_preferences::TestingPrefServiceSyncable* test_pref_service() { + return test_pref_service_.get(); + } + private: std::unique_ptr<FakeHostStatusProvider> fake_host_status_provider_; std::unique_ptr<FakeFeatureStateManager> fake_feature_state_manager_; std::unique_ptr<FakeAndroidSmsAppHelperDelegate> fake_android_sms_app_helper_delegate_; + std::unique_ptr<sync_preferences::TestingPrefServiceSyncable> + test_pref_service_; std::unique_ptr<AndroidSmsAppInstallingStatusObserver> android_sms_app_installing_status_observer_; @@ -85,6 +109,7 @@ TEST_F(MultiDeviceSetupAndroidSmsAppInstallingStatusObserverTest, InstallsAfterHostPending) { + Initialize(); EXPECT_FALSE(fake_app_helper_delegate()->has_installed_app()); SetHostWithStatus(mojom::HostStatus::kEligibleHostExistsButNoHostSet, @@ -99,6 +124,7 @@ TEST_F(MultiDeviceSetupAndroidSmsAppInstallingStatusObserverTest, InstallsAfterHostVerified) { + Initialize(); SetHostWithStatus(mojom::HostStatus::kNoEligibleHosts, base::nullopt /* host_device */); EXPECT_FALSE(fake_app_helper_delegate()->has_installed_app()); @@ -109,6 +135,7 @@ TEST_F(MultiDeviceSetupAndroidSmsAppInstallingStatusObserverTest, DoesNotInstallsAfterHostVerifiedIfNotAllowed) { + Initialize(); SetMessagesFeatureState(mojom::FeatureState::kProhibitedByPolicy); fake_app_helper_delegate()->Reset(); EXPECT_FALSE(fake_app_helper_delegate()->has_installed_app()); @@ -123,6 +150,7 @@ TEST_F(MultiDeviceSetupAndroidSmsAppInstallingStatusObserverTest, DoesNotInstallAfterHostVerifiedIfUninstalledByUser) { + Initialize(); fake_app_helper_delegate()->Reset(); fake_app_helper_delegate()->set_has_app_been_manually_uninstalled(true); @@ -135,7 +163,22 @@ } TEST_F(MultiDeviceSetupAndroidSmsAppInstallingStatusObserverTest, + DoesNotDisableFeatureIfAppRegistryNotReady) { + Initialize(); + SetHostWithStatus(mojom::HostStatus::kNoEligibleHosts, + base::nullopt /* host_device */); + fake_app_helper_delegate()->Reset(); + fake_app_helper_delegate()->set_has_app_been_manually_uninstalled(true); + fake_app_helper_delegate()->set_is_app_registry_ready(false); + SetMessagesFeatureState(mojom::FeatureState::kEnabledByUser); + + SetHostWithStatus(mojom::HostStatus::kHostVerified, GetFakePhone()); + EXPECT_EQ(GetMessagesFeatureState(), mojom::FeatureState::kEnabledByUser); +} + +TEST_F(MultiDeviceSetupAndroidSmsAppInstallingStatusObserverTest, DoesNotInstallsAfterHostVerifiedIfNotSupportedByPhone) { + Initialize(); SetMessagesFeatureState(mojom::FeatureState::kNotSupportedByPhone); fake_app_helper_delegate()->Reset(); EXPECT_FALSE(fake_app_helper_delegate()->has_installed_app()); @@ -164,6 +207,7 @@ TEST_F(MultiDeviceSetupAndroidSmsAppInstallingStatusObserverTest, InstallsWhenFeatureBecomesEnabled) { + Initialize(); SetMessagesFeatureState(mojom::FeatureState::kNotSupportedByChromebook); EXPECT_FALSE(fake_app_helper_delegate()->has_installed_app()); SetMessagesFeatureState(mojom::FeatureState::kEnabledByUser); @@ -172,6 +216,7 @@ TEST_F(MultiDeviceSetupAndroidSmsAppInstallingStatusObserverTest, CleansUpPwaInstallationWhenDisabled) { + Initialize(); SetMessagesFeatureState(mojom::FeatureState::kNotSupportedByChromebook); EXPECT_FALSE(fake_app_helper_delegate()->has_installed_app()); SetMessagesFeatureState(mojom::FeatureState::kEnabledByUser); @@ -185,6 +230,7 @@ TEST_F(MultiDeviceSetupAndroidSmsAppInstallingStatusObserverTest, DoesNotInstallWhenFeatureIsDisabledByUser) { + Initialize(); EXPECT_FALSE(fake_app_helper_delegate()->has_installed_app()); SetMessagesFeatureState(mojom::FeatureState::kDisabledByUser); EXPECT_FALSE(fake_app_helper_delegate()->has_installed_app()); @@ -192,6 +238,7 @@ TEST_F(MultiDeviceSetupAndroidSmsAppInstallingStatusObserverTest, DoesNotInstallWhenSuiteIsDisabledByUser) { + Initialize(); EXPECT_FALSE(fake_app_helper_delegate()->has_installed_app()); SetMessagesFeatureState(mojom::FeatureState::kUnavailableSuiteDisabled); EXPECT_FALSE(fake_app_helper_delegate()->has_installed_app()); @@ -199,6 +246,7 @@ TEST_F(MultiDeviceSetupAndroidSmsAppInstallingStatusObserverTest, DoesNotInstallIfNotVerified) { + Initialize(); SetHostWithStatus(mojom::HostStatus::kNoEligibleHosts, base::nullopt /* host_device */); EXPECT_FALSE(fake_app_helper_delegate()->has_installed_app()); @@ -206,6 +254,57 @@ EXPECT_FALSE(fake_app_helper_delegate()->has_installed_app()); } +// This test covers the temporary fix to re-enable users who were affected by +// crbug.com/1131140 which caused Messages to become disabled during login due +// to the app being incorrectly considered uninstalled. +TEST_F(MultiDeviceSetupAndroidSmsAppInstallingStatusObserverTest, + ReenablesMessages_WhenDisabledByBug) { + // Don't call Initialize(), instead simulate the class starting disabled. + SetMessagesFeatureState(mojom::FeatureState::kDisabledByUser); + fake_app_helper_delegate()->set_has_installed_app(true); + fake_android_sms_app_helper_delegate()->set_is_app_registry_ready(true); + SetHostWithStatus(mojom::HostStatus::kHostVerified, GetFakePhone()); + + EXPECT_EQ(mojom::FeatureState::kEnabledByUser, GetMessagesFeatureState()); + EXPECT_FALSE(test_pref_service()->GetBoolean(kShouldAttemptReenable)); +} + +TEST_F(MultiDeviceSetupAndroidSmsAppInstallingStatusObserverTest, + DoesntReenableMessages_WhenNoHostSet) { + // Don't call Initialize(), instead simulate the class starting disabled. + SetMessagesFeatureState(mojom::FeatureState::kDisabledByUser); + fake_app_helper_delegate()->set_has_installed_app(true); + fake_android_sms_app_helper_delegate()->set_is_app_registry_ready(true); + SetHostWithStatus(mojom::HostStatus::kEligibleHostExistsButNoHostSet, + base::nullopt /* host_device */); + + EXPECT_EQ(mojom::FeatureState::kDisabledByUser, GetMessagesFeatureState()); + EXPECT_FALSE(test_pref_service()->GetBoolean(kShouldAttemptReenable)); +} + +TEST_F(MultiDeviceSetupAndroidSmsAppInstallingStatusObserverTest, + DoesntReenableMessages_WhenAppNotInstalled) { + // Don't call Initialize(), instead simulate the class starting disabled. + SetMessagesFeatureState(mojom::FeatureState::kDisabledByUser); + fake_app_helper_delegate()->set_has_installed_app(false); + fake_android_sms_app_helper_delegate()->set_is_app_registry_ready(true); + SetHostWithStatus(mojom::HostStatus::kHostVerified, GetFakePhone()); + + EXPECT_EQ(mojom::FeatureState::kDisabledByUser, GetMessagesFeatureState()); + EXPECT_FALSE(test_pref_service()->GetBoolean(kShouldAttemptReenable)); +} + +TEST_F(MultiDeviceSetupAndroidSmsAppInstallingStatusObserverTest, + DoesntTryReenableMessages_WhenRegistryNotReady) { + // Don't call Initialize(), instead simulate the class starting disabled. + SetMessagesFeatureState(mojom::FeatureState::kDisabledByUser); + fake_app_helper_delegate()->set_has_installed_app(true); + SetHostWithStatus(mojom::HostStatus::kHostVerified, GetFakePhone()); + + EXPECT_EQ(mojom::FeatureState::kDisabledByUser, GetMessagesFeatureState()); + EXPECT_TRUE(test_pref_service()->GetBoolean(kShouldAttemptReenable)); +} + } // namespace multidevice_setup } // namespace chromeos
diff --git a/chromeos/services/multidevice_setup/fake_feature_state_manager.cc b/chromeos/services/multidevice_setup/fake_feature_state_manager.cc index e3b8fc6..cd65148 100644 --- a/chromeos/services/multidevice_setup/fake_feature_state_manager.cc +++ b/chromeos/services/multidevice_setup/fake_feature_state_manager.cc
@@ -31,6 +31,11 @@ FakeFeatureStateManager::~FakeFeatureStateManager() = default; +mojom::FeatureState FakeFeatureStateManager::GetFeatureState( + mojom::Feature feature) { + return feature_states_map_[feature]; +} + void FakeFeatureStateManager::SetFeatureState(mojom::Feature feature, mojom::FeatureState state) { if (feature_states_map_[feature] == state)
diff --git a/chromeos/services/multidevice_setup/fake_feature_state_manager.h b/chromeos/services/multidevice_setup/fake_feature_state_manager.h index 9a6969c..8248204 100644 --- a/chromeos/services/multidevice_setup/fake_feature_state_manager.h +++ b/chromeos/services/multidevice_setup/fake_feature_state_manager.h
@@ -21,6 +21,7 @@ FakeFeatureStateManager(); ~FakeFeatureStateManager() override; + mojom::FeatureState GetFeatureState(mojom::Feature feature); void SetFeatureState(mojom::Feature feature, mojom::FeatureState state); void SetFeatureStates(const FeatureStatesMap& feature_states_map);
diff --git a/chromeos/services/multidevice_setup/multidevice_setup_impl.cc b/chromeos/services/multidevice_setup/multidevice_setup_impl.cc index d287fe5..abbfdded 100644 --- a/chromeos/services/multidevice_setup/multidevice_setup_impl.cc +++ b/chromeos/services/multidevice_setup/multidevice_setup_impl.cc
@@ -147,7 +147,8 @@ ? AndroidSmsAppInstallingStatusObserver::Factory::Create( host_status_provider_.get(), feature_state_manager_.get(), - android_sms_app_helper_delegate) + android_sms_app_helper_delegate, + pref_service) : nullptr), auth_token_validator_(auth_token_validator) { host_status_provider_->AddObserver(this);
diff --git a/chromeos/services/multidevice_setup/multidevice_setup_service.cc b/chromeos/services/multidevice_setup/multidevice_setup_service.cc index c04f3f4..6c50c355 100644 --- a/chromeos/services/multidevice_setup/multidevice_setup_service.cc +++ b/chromeos/services/multidevice_setup/multidevice_setup_service.cc
@@ -7,6 +7,7 @@ #include "base/bind.h" #include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/services/multidevice_setup/account_status_change_delegate_notifier_impl.h" +#include "chromeos/services/multidevice_setup/android_sms_app_installing_status_observer.h" #include "chromeos/services/multidevice_setup/device_reenroller.h" #include "chromeos/services/multidevice_setup/grandfathered_easy_unlock_host_disabler.h" #include "chromeos/services/multidevice_setup/host_backend_delegate_impl.h" @@ -33,6 +34,7 @@ WifiSyncFeatureManagerImpl::RegisterPrefs(registry); HostVerifierImpl::RegisterPrefs(registry); GrandfatheredEasyUnlockHostDisabler::RegisterPrefs(registry); + AndroidSmsAppInstallingStatusObserver::RegisterPrefs(registry); RegisterFeaturePrefs(registry); }
diff --git a/chromeos/services/multidevice_setup/public/cpp/android_sms_app_helper_delegate.h b/chromeos/services/multidevice_setup/public/cpp/android_sms_app_helper_delegate.h index e288793c..8240f6b7 100644 --- a/chromeos/services/multidevice_setup/public/cpp/android_sms_app_helper_delegate.h +++ b/chromeos/services/multidevice_setup/public/cpp/android_sms_app_helper_delegate.h
@@ -28,6 +28,13 @@ // Returns true if the app was ever installed successfully since the feature // was enabled and then been manually uninstalled by the user. virtual bool HasAppBeenManuallyUninstalledByUser() = 0; + // Returns whether the PWA is currently installed. + virtual bool IsAppInstalled() = 0; + // Returns true when details about installed PWAs is available to query. + virtual bool IsAppRegistryReady() = 0; + // Takes a task to run when the app registry is available. If already + // available it will execute asynchronously. + virtual void ExecuteOnAppRegistryReady(base::OnceClosure task) = 0; protected: AndroidSmsAppHelperDelegate() = default;
diff --git a/chromeos/services/multidevice_setup/public/cpp/fake_android_sms_app_helper_delegate.cc b/chromeos/services/multidevice_setup/public/cpp/fake_android_sms_app_helper_delegate.cc index c7378feec..705fc5c 100644 --- a/chromeos/services/multidevice_setup/public/cpp/fake_android_sms_app_helper_delegate.cc +++ b/chromeos/services/multidevice_setup/public/cpp/fake_android_sms_app_helper_delegate.cc
@@ -39,6 +39,19 @@ return has_app_been_manually_uninstalled_; } +bool FakeAndroidSmsAppHelperDelegate::IsAppInstalled() { + return has_installed_app_; +} + +bool FakeAndroidSmsAppHelperDelegate::IsAppRegistryReady() { + return is_app_registry_ready_; +} + +void FakeAndroidSmsAppHelperDelegate::ExecuteOnAppRegistryReady( + base::OnceClosure task) { + std::move(task).Run(); +} + } // namespace multidevice_setup } // namespace chromeos
diff --git a/chromeos/services/multidevice_setup/public/cpp/fake_android_sms_app_helper_delegate.h b/chromeos/services/multidevice_setup/public/cpp/fake_android_sms_app_helper_delegate.h index a184d015..42a06be6 100644 --- a/chromeos/services/multidevice_setup/public/cpp/fake_android_sms_app_helper_delegate.h +++ b/chromeos/services/multidevice_setup/public/cpp/fake_android_sms_app_helper_delegate.h
@@ -19,6 +19,10 @@ ~FakeAndroidSmsAppHelperDelegate() override; bool has_installed_app() const { return has_installed_app_; } + void set_has_installed_app(bool has_installed_app) { + has_installed_app_ = has_installed_app; + } + bool has_launched_app() const { return has_launched_app_; } bool is_default_to_persist_cookie_set() const { return is_default_to_persist_cookie_set_; @@ -29,6 +33,10 @@ has_app_been_manually_uninstalled_ = has_app_been_manually_uninstalled; } + void set_is_app_registry_ready(bool is_app_registry_ready) { + is_app_registry_ready_ = is_app_registry_ready; + } + // Sets all booleans representing recorded actions to false. void Reset(); @@ -38,11 +46,15 @@ void SetUpAndLaunchAndroidSmsApp() override; void TearDownAndroidSmsApp() override; bool HasAppBeenManuallyUninstalledByUser() override; + bool IsAppInstalled() override; + bool IsAppRegistryReady() override; + void ExecuteOnAppRegistryReady(base::OnceClosure task) override; bool has_installed_app_ = false; bool has_launched_app_ = false; bool is_default_to_persist_cookie_set_ = false; bool has_app_been_manually_uninstalled_ = false; + bool is_app_registry_ready_ = false; DISALLOW_COPY_AND_ASSIGN(FakeAndroidSmsAppHelperDelegate); };
diff --git a/components/arc/mojom/video_encode_accelerator.mojom b/components/arc/mojom/video_encode_accelerator.mojom index e5b901e..3bd387e 100644 --- a/components/arc/mojom/video_encode_accelerator.mojom +++ b/components/arc/mojom/video_encode_accelerator.mojom
@@ -158,7 +158,6 @@ // Interface for clients that use VideoEncodeAccelerator. These callbacks will // not be made unless VideoEncodeAccelerator::Initialize() has returned // successfully. -// Next MinVersion: 1 // Next Method ID: 3 interface VideoEncodeClient { // Callback to tell the client what size of frames and buffers to provide
diff --git a/components/certificate_transparency/chrome_ct_policy_enforcer_unittest.cc b/components/certificate_transparency/chrome_ct_policy_enforcer_unittest.cc index 03b849d..d072578 100644 --- a/components/certificate_transparency/chrome_ct_policy_enforcer_unittest.cc +++ b/components/certificate_transparency/chrome_ct_policy_enforcer_unittest.cc
@@ -16,6 +16,7 @@ #include "crypto/rsa_private_key.h" #include "crypto/sha2.h" #include "net/cert/ct_policy_status.h" +#include "net/cert/ct_verify_result.h" #include "net/cert/x509_certificate.h" #include "net/cert/x509_util.h" #include "net/log/net_log_with_source.h"
diff --git a/components/device_event_log/device_event_log.h b/components/device_event_log/device_event_log.h index df61ef2..40d22e5 100644 --- a/components/device_event_log/device_event_log.h +++ b/components/device_event_log/device_event_log.h
@@ -65,6 +65,12 @@ #define PRINTER_LOG(level) \ DEVICE_LOG(::device_event_log::LOG_TYPE_PRINTER, \ ::device_event_log::LOG_LEVEL_##level) +#define SERIAL_LOG(level) \ + DEVICE_LOG(::device_event_log::LOG_TYPE_SERIAL, \ + ::device_event_log::LOG_LEVEL_##level) +#define SERIAL_PLOG(level) \ + DEVICE_PLOG(::device_event_log::LOG_TYPE_SERIAL, \ + ::device_event_log::LOG_LEVEL_##level) #if defined(OS_ANDROID) && defined(OFFICIAL_BUILD) // FIDO_LOG is discarded for release Android builds in order to reduce binary @@ -121,8 +127,10 @@ LOG_TYPE_PRINTER = 7, // Security key events. LOG_TYPE_FIDO = 8, + // Serial port related events (i.e. services/device/serial). + LOG_TYPE_SERIAL = 9, // Used internally, must be the last type (may be changed). - LOG_TYPE_UNKNOWN = 9 + LOG_TYPE_UNKNOWN = 10 }; // Used to specify the detail level for logging. In GetAsString, used to
diff --git a/components/device_event_log/device_event_log_impl.cc b/components/device_event_log/device_event_log_impl.cc index b691f67b..5f4db33 100644 --- a/components/device_event_log/device_event_log_impl.cc +++ b/components/device_event_log/device_event_log_impl.cc
@@ -37,6 +37,7 @@ const char* kLogTypeMemoryDesc = "Memory"; const char* kLogTypePrinterDesc = "Printer"; const char* kLogTypeFidoDesc = "FIDO"; +const char* kLogTypeSerialDesc = "Serial"; enum class ShowTime { kNone, @@ -64,6 +65,8 @@ return kLogTypePrinterDesc; case LOG_TYPE_FIDO: return kLogTypeFidoDesc; + case LOG_TYPE_SERIAL: + return kLogTypeSerialDesc; case LOG_TYPE_UNKNOWN: break; }
diff --git a/components/dom_distiller/DEPS b/components/dom_distiller/DEPS index 4371aab..1decc3b 100644 --- a/components/dom_distiller/DEPS +++ b/components/dom_distiller/DEPS
@@ -18,6 +18,7 @@ "+services/network/test", "+ui/base/l10n", "+ui/base/resource", + "+ui/base/template_expressions.h", "+ui/gfx", # The dom distiller is a layered component; subdirectories must explicitly
diff --git a/components/dom_distiller/core/html/dom_distiller_viewer.html b/components/dom_distiller/core/html/dom_distiller_viewer.html index 764aca5b..b791d0eb 100644 --- a/components/dom_distiller/core/html/dom_distiller_viewer.html +++ b/components/dom_distiller/core/html/dom_distiller_viewer.html
@@ -9,56 +9,56 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"> <meta name="theme-color" id="theme-color"> - <title>$1</title> + <title>$i18n{title}</title> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <!-- Placeholder for CSS. --> - $2 + $1 </head> -<body class="$3"> +<body class="$2"> <div id="content-wrap"> <div id="main-content"> <div id="settings-container" class="desktop-only"> <button id="settings-toggle" type="button" - aria-label="Customize appearance" tabindex=0> + aria-label="$i18n{customizeAppearance}" tabindex=0> <i class="material-icons"></i> </button> <div id="dialog-backdrop"></div> <dialog id="settings-dialog"> <div id="settings-header"> - <h1>Customize appearance</h1> + <h1>$i18n{customizeAppearance}</h1> </div> <div id="settings-fields"> <div class="setting font-family-container"> <label id="font-family-label" class="screen-reader-only"> - Font style + $i18n{fontStyle} </label> <select id="font-family-selection" aria-labelledby="font-family-label" name="font-family"> - <option value="sans-serif" selected>Sans-serif Font</option> - <option value="serif">Serif Font</option> - <option value="monospace">Monospace Font</option> + <option value="sans-serif" selected>$i18n{sansSerifFont}</option> + <option value="serif">$i18n{serifFont}</option> + <option value="monospace">$i18n{monospaceFont}</option> </select> <i class="material-icons" id="arrow-drop-down"></i> </div> <div class="setting"> <fieldset id="theme-selection"> <legend class="screen-reader-only"> - Page Color + $i18n{pageColor} </legend> <ul> <li class="theme-option"> <input type="radio" name="theme" value="light" - aria-label="light" id="theme-option-light" class="light" checked> + aria-label="$i18n{light}" id="theme-option-light" class="light" checked> <div class="checkmark"><i class="material-icons" aria-hidden="true"></i></div> </li> <li class="theme-option"> <input type="radio" name="theme" value="sepia" - aria-label="sepia" id="theme-option-sepia" class="sepia"> + aria-label="$i18n{sepia}" id="theme-option-sepia" class="sepia"> <div class="checkmark"><i class="material-icons" aria-hidden="true"></i></div> </li> <li class="theme-option"> <input type="radio" name="theme" value="dark" - aria-label="dark" id="theme-option-dark" class="dark"> + aria-label="$i18n{dark}" id="theme-option-dark" class="dark"> <div class="checkmark"><i class="material-icons" aria-hidden="true"></i></div> </li> </ul> @@ -66,7 +66,7 @@ </div> <div class="setting" id="font-size-wrapper"> <label id="font-size-label" class="screen-reader-only"> - Font Size + $i18n{fontSize} </label> <input aria-labelledby="font-size-label" id="font-size-selection" @@ -77,13 +77,13 @@ max="9" value="2"> <div class="label-container"> - <span id="slider-label-min">Small</span> - <span id="slider-label-max">Large</span> + <span id="slider-label-min">$i18n{small}</span> + <span id="slider-label-max">$i18n{large}</span> </div> </div> </div> - <button id="close-settings-button" type="button" aria-label="Close" - tabindex=0> + <button id="close-settings-button" type="button" + aria-label="$i18n{close}" tabindex=0> <i class="material-icons">close</i> </button> </dialog> @@ -93,16 +93,16 @@ <div id="title-collapse"> <div class="vertical-center-outer"> <div class="vertical-center-inner"> - <h1 id="title-holder"><noscript>$4</noscript></h1> + <h1 id="title-holder"><noscript>$i18n{title}</noscript></h1> </div> </div> </div> </header> - <div id="content"><noscript>$5</noscript></div> + <div id="content"><noscript>$3</noscript></div> </article> <div id="loading-indicator" class="visible"> <!-- SVG material loading spinner. --> - $6 + $4 </div> </div> </div>
diff --git a/components/dom_distiller/core/viewer.cc b/components/dom_distiller/core/viewer.cc index 2a14183..69285f5 100644 --- a/components/dom_distiller/core/viewer.cc +++ b/components/dom_distiller/core/viewer.cc
@@ -27,6 +27,7 @@ #include "net/base/escape.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/base/template_expressions.h" #include "url/gurl.h" namespace dom_distiller { @@ -112,6 +113,47 @@ std::string html_template = ui::ResourceBundle::GetSharedInstance().LoadDataResourceString( IDR_DOM_DISTILLER_VIEWER_HTML); + + // Replace placeholders of the form $i18n{foo} with translated strings + // using ReplaceTemplateExpressions. Do this step first because + // ReplaceStringPlaceholders, below, considers $i18n to be an error. + ui::TemplateReplacements i18n_replacements; + i18n_replacements["title"] = + l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_LOADING_TITLE); + i18n_replacements["customizeAppearance"] = + l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_CUSTOMIZE_APPEARANCE); + i18n_replacements["fontStyle"] = + l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_FONT_STYLE); + i18n_replacements["sansSerifFont"] = + l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_SANS_SERIF_FONT); + i18n_replacements["serifFont"] = + l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_SERIF_FONT); + i18n_replacements["monospaceFont"] = + l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_MONOSPACE_FONT); + i18n_replacements["pageColor"] = + l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR); + i18n_replacements["light"] = + l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR_LIGHT); + i18n_replacements["sepia"] = + l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR_SEPIA); + i18n_replacements["dark"] = + l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR_DARK); + i18n_replacements["fontSize"] = + l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_FONT_SIZE); + i18n_replacements["small"] = + l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_FONT_SIZE_SMALL); + i18n_replacements["large"] = + l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_FONT_SIZE_LARGE); + i18n_replacements["close"] = + l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_CLOSE); + + html_template = + ui::ReplaceTemplateExpressions(html_template, i18n_replacements); + + // There shouldn't be any unsubstituted i18n placeholders left. + DCHECK_EQ(html_template.find("$i18n"), std::string::npos); + + // Now do other non-i18n string replacements. std::vector<std::string> substitutions; std::ostringstream css; @@ -126,19 +168,14 @@ svg << "<img src=\"/" << kViewerLoadingImagePath << "\">"; #endif // defined(OS_IOS) - substitutions.push_back( - l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_LOADING_TITLE)); // $1 - - substitutions.push_back(css.str()); // $2 + substitutions.push_back(css.str()); // $1 substitutions.push_back(GetThemeCssClass(theme) + " " + - GetFontCssClass(font_family)); // $3 + GetFontCssClass(font_family)); // $2 - substitutions.push_back( - l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_LOADING_TITLE)); // $4 substitutions.push_back(l10n_util::GetStringUTF8( - IDS_DOM_DISTILLER_JAVASCRIPT_DISABLED_CONTENT)); // $5 + IDS_DOM_DISTILLER_JAVASCRIPT_DISABLED_CONTENT)); // $3 - substitutions.push_back(svg.str()); // $6 + substitutions.push_back(svg.str()); // $4 return base::ReplaceStringPlaceholders(html_template, substitutions, nullptr); }
diff --git a/components/dom_distiller_strings.grdp b/components/dom_distiller_strings.grdp index dd091320..b67a6fde 100644 --- a/components/dom_distiller_strings.grdp +++ b/components/dom_distiller_strings.grdp
@@ -43,6 +43,45 @@ </message> </else> </if> + <message name="IDS_DOM_DISTILLER_VIEWER_CUSTOMIZE_APPEARANCE" desc="Title of the Reader Mode dialog where you can customize the font, style, and color of the Reader Mode page.."> + Customize appearance + </message> + <message name="IDS_DOM_DISTILLER_VIEWER_FONT_STYLE" desc="The label for the control where the user can choose their desired font style in Reader Mode."> + Font style + </message> + <message name="IDS_DOM_DISTILLER_VIEWER_SANS_SERIF_FONT" desc="The sans-serif style of font that users can choose in Reader Mode."> + Sans-serif Font + </message> + <message name="IDS_DOM_DISTILLER_VIEWER_SERIF_FONT" desc="The serif style of font that users can choose in Reader Mode."> + Serif Font + </message> + <message name="IDS_DOM_DISTILLER_VIEWER_MONOSPACE_FONT" desc="The monospace style of font that users can choose in Reader Mode."> + Monospace Font + </message> + <message name="IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR" desc="The label for the control where the user can choose their desired page color for Reader Mode."> + Page Color + </message> + <message name="IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR_LIGHT" desc="The description for the option to make the page color light (as opposed to dark) in Reader Mode."> + Light + </message> + <message name="IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR_SEPIA" desc="The description for the option to make the page color sepia (a shade of brown) in Reader Mode."> + Sepia + </message> + <message name="IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR_DARK" desc="The description for the option to make the page color dark in Reader Mode."> + Dark + </message> + <message name="IDS_DOM_DISTILLER_VIEWER_FONT_SIZE" desc="The label for the control where the user can choose their desired font size for Reader Mode."> + Font Size + </message> + <message name="IDS_DOM_DISTILLER_VIEWER_FONT_SIZE_SMALL" desc="The label for the range of a slider representing small font sizes in Reader Mode."> + Small + </message> + <message name="IDS_DOM_DISTILLER_VIEWER_FONT_SIZE_LARGE" desc="The label for the range of a slider representing large font sizes in Reader Mode."> + Large + </message> + <message name="IDS_DOM_DISTILLER_VIEWER_CLOSE" desc="The label for the button that closes the customize appearance dialog for Reader Mode."> + Close + </message> <message name="IDS_DOM_DISTILLER_VIEWER_NO_DATA_CONTENT" desc="The text to show in place of reading list article content if there is no data found."> No data found. </message>
diff --git a/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_CLOSE.png.sha1 b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_CLOSE.png.sha1 new file mode 100644 index 0000000..1f78dd8 --- /dev/null +++ b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_CLOSE.png.sha1
@@ -0,0 +1 @@ +e3b9f126b6ec1116dd2b5ed36fd23c0b98e0f7cf \ No newline at end of file
diff --git a/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_CUSTOMIZE_APPEARANCE.png.sha1 b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_CUSTOMIZE_APPEARANCE.png.sha1 new file mode 100644 index 0000000..d6b74022 --- /dev/null +++ b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_CUSTOMIZE_APPEARANCE.png.sha1
@@ -0,0 +1 @@ +ee6f5f1558036ef8b87746d602dd61f411df5188 \ No newline at end of file
diff --git a/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_FONT_SIZE.png.sha1 b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_FONT_SIZE.png.sha1 new file mode 100644 index 0000000..d6b74022 --- /dev/null +++ b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_FONT_SIZE.png.sha1
@@ -0,0 +1 @@ +ee6f5f1558036ef8b87746d602dd61f411df5188 \ No newline at end of file
diff --git a/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_FONT_SIZE_LARGE.png.sha1 b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_FONT_SIZE_LARGE.png.sha1 new file mode 100644 index 0000000..d6b74022 --- /dev/null +++ b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_FONT_SIZE_LARGE.png.sha1
@@ -0,0 +1 @@ +ee6f5f1558036ef8b87746d602dd61f411df5188 \ No newline at end of file
diff --git a/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_FONT_SIZE_SMALL.png.sha1 b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_FONT_SIZE_SMALL.png.sha1 new file mode 100644 index 0000000..d6b74022 --- /dev/null +++ b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_FONT_SIZE_SMALL.png.sha1
@@ -0,0 +1 @@ +ee6f5f1558036ef8b87746d602dd61f411df5188 \ No newline at end of file
diff --git a/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_FONT_STYLE.png.sha1 b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_FONT_STYLE.png.sha1 new file mode 100644 index 0000000..6d82fe7 --- /dev/null +++ b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_FONT_STYLE.png.sha1
@@ -0,0 +1 @@ +3913144a7b57eb096bd775090d6a098ba80a6d19 \ No newline at end of file
diff --git a/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_MONOSPACE_FONT.png.sha1 b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_MONOSPACE_FONT.png.sha1 new file mode 100644 index 0000000..91446ee4 --- /dev/null +++ b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_MONOSPACE_FONT.png.sha1
@@ -0,0 +1 @@ +9c2b401290f547dd7881b3fba4dc4f8a9106a9dc \ No newline at end of file
diff --git a/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR.png.sha1 b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR.png.sha1 new file mode 100644 index 0000000..72bd8f38 --- /dev/null +++ b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR.png.sha1
@@ -0,0 +1 @@ +2c8af3dc54c3b3d9258baba2dff70b6335a9c7b0 \ No newline at end of file
diff --git a/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR_DARK.png.sha1 b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR_DARK.png.sha1 new file mode 100644 index 0000000..72bd8f38 --- /dev/null +++ b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR_DARK.png.sha1
@@ -0,0 +1 @@ +2c8af3dc54c3b3d9258baba2dff70b6335a9c7b0 \ No newline at end of file
diff --git a/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR_LIGHT.png.sha1 b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR_LIGHT.png.sha1 new file mode 100644 index 0000000..72bd8f38 --- /dev/null +++ b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR_LIGHT.png.sha1
@@ -0,0 +1 @@ +2c8af3dc54c3b3d9258baba2dff70b6335a9c7b0 \ No newline at end of file
diff --git a/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR_SEPIA.png.sha1 b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR_SEPIA.png.sha1 new file mode 100644 index 0000000..72bd8f38 --- /dev/null +++ b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_PAGE_COLOR_SEPIA.png.sha1
@@ -0,0 +1 @@ +2c8af3dc54c3b3d9258baba2dff70b6335a9c7b0 \ No newline at end of file
diff --git a/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_SANS_SERIF_FONT.png.sha1 b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_SANS_SERIF_FONT.png.sha1 new file mode 100644 index 0000000..9cecd36 --- /dev/null +++ b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_SANS_SERIF_FONT.png.sha1
@@ -0,0 +1 @@ +4cd2bec75fce4060dca74320fba44c89b6597fbb \ No newline at end of file
diff --git a/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_SERIF_FONT.png.sha1 b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_SERIF_FONT.png.sha1 new file mode 100644 index 0000000..6d82fe7 --- /dev/null +++ b/components/dom_distiller_strings_grdp/IDS_DOM_DISTILLER_VIEWER_SERIF_FONT.png.sha1
@@ -0,0 +1 @@ +3913144a7b57eb096bd775090d6a098ba80a6d19 \ No newline at end of file
diff --git a/components/services/app_service/public/cpp/intent_util.cc b/components/services/app_service/public/cpp/intent_util.cc index c815d89..005baf6 100644 --- a/components/services/app_service/public/cpp/intent_util.cc +++ b/components/services/app_service/public/cpp/intent_util.cc
@@ -156,11 +156,14 @@ apps::mojom::IntentPtr CreateShareIntentFromDriveFile( const GURL& filesystem_url, const std::string& mime_type, - const GURL& drive_share_url) { + const GURL& drive_share_url, + bool is_directory) { auto intent = apps::mojom::Intent::New(); intent->action = kIntentActionSend; - intent->mime_type = mime_type; - intent->file_urls = std::vector<GURL>{filesystem_url}; + if (!is_directory) { + intent->mime_type = mime_type; + intent->file_urls = std::vector<GURL>{filesystem_url}; + } if (!drive_share_url.is_empty()) { intent->drive_share_url = drive_share_url; } @@ -306,4 +309,27 @@ #undef GET_CHAR } +bool OnlyShareToDrive(const apps::mojom::IntentPtr& intent) { + if (intent->action == kIntentActionSend || + intent->action == kIntentActionSendMultiple) { + if (intent->drive_share_url.has_value() && + !intent->share_text.has_value() && !intent->file_urls.has_value()) { + return true; + } + } + return false; +} + +bool IsIntentValid(const apps::mojom::IntentPtr& intent) { + // TODO(crbug.com/853604):Add more checks here to make this a general intent + // validity check. Check if this is a share intent with no file or text. + if (intent->action == kIntentActionSend || + intent->action == kIntentActionSendMultiple) { + if (!intent->share_text.has_value() && !intent->file_urls.has_value()) { + return false; + } + } + return true; +} + } // namespace apps_util
diff --git a/components/services/app_service/public/cpp/intent_util.h b/components/services/app_service/public/cpp/intent_util.h index fbb97bb..eebb78e 100644 --- a/components/services/app_service/public/cpp/intent_util.h +++ b/components/services/app_service/public/cpp/intent_util.h
@@ -33,7 +33,8 @@ apps::mojom::IntentPtr CreateShareIntentFromDriveFile( const GURL& filesystem_url, const std::string& mime_type, - const GURL& drive_share_url); + const GURL& drive_share_url, + bool is_directory); // Create an intent struct from URL. apps::mojom::IntentPtr CreateShareIntentFromText(const std::string& share_text); @@ -63,6 +64,12 @@ // See // https://android.googlesource.com/platform/frameworks/base.git/+/e93165456c3c28278f275566bd90bfbcf1a0e5f7/core/java/android/os/PatternMatcher.java#186 bool MatchGlob(const std::string& value, const std::string& pattern); + +// Check if the intent only mean to share to Google Drive. +bool OnlyShareToDrive(const apps::mojom::IntentPtr& intent); + +// Check the if the intent is valid, e.g. action matches content. +bool IsIntentValid(const apps::mojom::IntentPtr& intent); } // namespace apps_util #endif // COMPONENTS_SERVICES_APP_SERVICE_PUBLIC_CPP_INTENT_UTIL_H_
diff --git a/components/variations/net/variations_http_headers.cc b/components/variations/net/variations_http_headers.cc index e71505f9..5ff5a3db 100644 --- a/components/variations/net/variations_http_headers.cc +++ b/components/variations/net/variations_http_headers.cc
@@ -196,7 +196,8 @@ const network::ResourceRequest& resource_request) { bool use_first_party_visibility = IsFirstPartyContext(owner, resource_request) && - base::FeatureList::IsEnabled(internal::kRestrictGoogleWebVisibility); + VariationsIdsProvider::GetInstance() + ->IsRestrictGoogleWebVisibilityEnabled(); return use_first_party_visibility ? variations::mojom::GoogleWebVisibility::FIRST_PARTY
diff --git a/components/variations/variations_ids_provider.cc b/components/variations/variations_ids_provider.cc index 9752559..b0a531d 100644 --- a/components/variations/variations_ids_provider.cc +++ b/components/variations/variations_ids_provider.cc
@@ -215,8 +215,13 @@ if (variation_ids_cache_initialized_) return; - // Register for additional cache updates. This is done first to avoid a race - // that could cause registered FieldTrials to be missed. + // Must be done before AddObserver() to avoid deadlock in + // OnFieldTrialGroupFinalized(). + is_restrict_google_web_visibility_enabled_ = + base::FeatureList::IsEnabled(internal::kRestrictGoogleWebVisibility); + + // Register for additional cache updates. This is done before initializing the + // cache to avoid a race that could cause registered FieldTrials to be missed. bool success = base::FieldTrialList::AddObserver(this); DCHECK(success); @@ -290,8 +295,7 @@ proto.add_variation_id(entry.first); break; case GOOGLE_WEB_PROPERTIES_FIRST_PARTY: - if (base::FeatureList::IsEnabled( - internal::kRestrictGoogleWebVisibility)) { + if (IsRestrictGoogleWebVisibilityEnabled()) { if (is_first_party_context) proto.add_variation_id(entry.first); } else { @@ -305,8 +309,7 @@ proto.add_trigger_variation_id(entry.first); break; case GOOGLE_WEB_PROPERTIES_TRIGGER_FIRST_PARTY: - if (base::FeatureList::IsEnabled( - internal::kRestrictGoogleWebVisibility)) { + if (IsRestrictGoogleWebVisibilityEnabled()) { if (is_first_party_context) proto.add_trigger_variation_id(entry.first); } else {
diff --git a/components/variations/variations_ids_provider.h b/components/variations/variations_ids_provider.h index 0dbfc80..14afd29 100644 --- a/components/variations/variations_ids_provider.h +++ b/components/variations/variations_ids_provider.h
@@ -126,6 +126,12 @@ // Resets any cached state for tests. void ResetForTesting(); + // Returns true if kRestrictGoogleWebVisibility is enabled and false + // otherwise. + bool IsRestrictGoogleWebVisibilityEnabled() { + return is_restrict_google_web_visibility_enabled_; + } + private: friend struct base::DefaultSingletonTraits<VariationsIdsProvider>; @@ -221,6 +227,9 @@ // Whether or not we've initialized the caches. bool variation_ids_cache_initialized_; + // Denotes whether kRestrictGoogleWebVisibility is enabled. + bool is_restrict_google_web_visibility_enabled_ = false; + // Keep a cache of variation IDs that are transmitted in headers to Google. // This consists of a list of valid IDs, and the actual transmitted header. std::set<VariationIDEntry> variation_ids_set_;
diff --git a/content/browser/accessibility/accessibility_event_recorder.cc b/content/browser/accessibility/accessibility_event_recorder.cc index 1a636008..ff5d956 100644 --- a/content/browser/accessibility/accessibility_event_recorder.cc +++ b/content/browser/accessibility/accessibility_event_recorder.cc
@@ -21,7 +21,7 @@ std::unique_ptr<AccessibilityEventRecorder> AccessibilityEventRecorder::Create( BrowserAccessibilityManager* manager, base::ProcessId pid, - const base::StringPiece& application_name_match_pattern) { + const AccessibilityTreeFormatter::TreeSelector& selector) { return std::make_unique<AccessibilityEventRecorder>(manager); }
diff --git a/content/browser/accessibility/accessibility_event_recorder.h b/content/browser/accessibility/accessibility_event_recorder.h index dfed6174..59aec348 100644 --- a/content/browser/accessibility/accessibility_event_recorder.h +++ b/content/browser/accessibility/accessibility_event_recorder.h
@@ -14,6 +14,7 @@ #include "base/macros.h" #include "base/process/process_handle.h" #include "content/common/content_export.h" +#include "content/public/browser/accessibility_tree_formatter.h" namespace content { @@ -43,15 +44,14 @@ static std::unique_ptr<AccessibilityEventRecorder> Create( BrowserAccessibilityManager* manager = nullptr, base::ProcessId pid = 0, - const base::StringPiece& application_name_match_pattern = - base::StringPiece()); + const AccessibilityTreeFormatter::TreeSelector& selector = {}); // Get a set of factory methods to create event-recorders, one for each test // pass; see |DumpAccessibilityTestBase|. using EventRecorderFactory = std::unique_ptr<AccessibilityEventRecorder> (*)( BrowserAccessibilityManager* manager, base::ProcessId pid, - const base::StringPiece& application_name_match_pattern); + const AccessibilityTreeFormatter::TreeSelector& selector); struct TestPass { const char* name; EventRecorderFactory create_recorder;
diff --git a/content/browser/accessibility/accessibility_event_recorder_auralinux.cc b/content/browser/accessibility/accessibility_event_recorder_auralinux.cc index bfe6f5a..bd32b239 100644 --- a/content/browser/accessibility/accessibility_event_recorder_auralinux.cc +++ b/content/browser/accessibility/accessibility_event_recorder_auralinux.cc
@@ -35,7 +35,7 @@ explicit AccessibilityEventRecorderAuraLinux( BrowserAccessibilityManager* manager, base::ProcessId pid, - const base::StringPiece& application_name_match_pattern); + const AccessibilityTreeFormatter::TreeSelector& selector); ~AccessibilityEventRecorderAuraLinux() override; void ProcessATKEvent(const char* event, @@ -98,9 +98,9 @@ std::unique_ptr<AccessibilityEventRecorder> AccessibilityEventRecorder::Create( BrowserAccessibilityManager* manager, base::ProcessId pid, - const base::StringPiece& application_name_match_pattern) { - return std::make_unique<AccessibilityEventRecorderAuraLinux>( - manager, pid, application_name_match_pattern); + const AccessibilityTreeFormatter::TreeSelector& selector) { + return std::make_unique<AccessibilityEventRecorderAuraLinux>(manager, pid, + selector); } std::vector<AccessibilityEventRecorder::TestPass> @@ -120,10 +120,10 @@ AccessibilityEventRecorderAuraLinux::AccessibilityEventRecorderAuraLinux( BrowserAccessibilityManager* manager, base::ProcessId pid, - const base::StringPiece& application_name_match_pattern) + const AccessibilityTreeFormatter::TreeSelector& selector) : AccessibilityEventRecorder(manager), pid_(pid), - application_name_match_pattern_(application_name_match_pattern) { + application_name_match_pattern_(selector.pattern) { CHECK(!instance_) << "There can be only one instance of" << " AccessibilityEventRecorder at a time.";
diff --git a/content/browser/accessibility/accessibility_event_recorder_mac.mm b/content/browser/accessibility/accessibility_event_recorder_mac.mm index bb92209..191279ce 100644 --- a/content/browser/accessibility/accessibility_event_recorder_mac.mm +++ b/content/browser/accessibility/accessibility_event_recorder_mac.mm
@@ -62,10 +62,10 @@ std::unique_ptr<AccessibilityEventRecorder> AccessibilityEventRecorder::Create( BrowserAccessibilityManager* manager, base::ProcessId pid, - const base::StringPiece& application_name_match_pattern) { - if (!application_name_match_pattern.empty()) { - LOG(ERROR) << "Recording accessibility events from an application name " - "match pattern not supported on this platform yet."; + const AccessibilityTreeFormatter::TreeSelector& selector) { + if (!selector.empty()) { + LOG(ERROR) << "Recording accessibility events by an application selector " + "is not supported on this platform yet."; NOTREACHED(); }
diff --git a/content/browser/accessibility/accessibility_event_recorder_uia_win.cc b/content/browser/accessibility/accessibility_event_recorder_uia_win.cc index 8f52006..8ed50d1 100644 --- a/content/browser/accessibility/accessibility_event_recorder_uia_win.cc +++ b/content/browser/accessibility/accessibility_event_recorder_uia_win.cc
@@ -50,9 +50,9 @@ AccessibilityEventRecorderUia::CreateUia( BrowserAccessibilityManager* manager, base::ProcessId pid, - const base::StringPiece& application_name_match_pattern) { - return std::make_unique<AccessibilityEventRecorderUia>( - manager, pid, application_name_match_pattern); + const AccessibilityTreeFormatter::TreeSelector& selector) { + return std::make_unique<AccessibilityEventRecorderUia>(manager, pid, + selector.pattern); } AccessibilityEventRecorderUia::AccessibilityEventRecorderUia(
diff --git a/content/browser/accessibility/accessibility_event_recorder_uia_win.h b/content/browser/accessibility/accessibility_event_recorder_uia_win.h index 54b8e0d..338f15a 100644 --- a/content/browser/accessibility/accessibility_event_recorder_uia_win.h +++ b/content/browser/accessibility/accessibility_event_recorder_uia_win.h
@@ -34,7 +34,7 @@ static std::unique_ptr<AccessibilityEventRecorder> CreateUia( BrowserAccessibilityManager* manager, base::ProcessId pid, - const base::StringPiece& application_name_match_pattern); + const AccessibilityTreeFormatter::TreeSelector& selector); // Called to ensure the event recorder has finished recording async events. void FlushAsyncEvents() override;
diff --git a/content/browser/accessibility/accessibility_event_recorder_win.cc b/content/browser/accessibility/accessibility_event_recorder_win.cc index 7d8ee27..a9b5cbb 100644 --- a/content/browser/accessibility/accessibility_event_recorder_win.cc +++ b/content/browser/accessibility/accessibility_event_recorder_win.cc
@@ -126,14 +126,14 @@ std::unique_ptr<AccessibilityEventRecorder> AccessibilityEventRecorder::Create( BrowserAccessibilityManager* manager, base::ProcessId pid, - const base::StringPiece& application_name_match_pattern) { - if (!application_name_match_pattern.empty()) { + const AccessibilityTreeFormatter::TreeSelector& selector) { + if (!selector.pattern.empty()) { LOG(FATAL) << "Recording accessibility events from an application name " "match pattern not supported on this platform yet."; } - return std::make_unique<AccessibilityEventRecorderWin>( - manager, pid, application_name_match_pattern); + return std::make_unique<AccessibilityEventRecorderWin>(manager, pid, + selector.pattern); } std::vector<AccessibilityEventRecorder::TestPass>
diff --git a/content/browser/accessibility/dump_accessibility_events_browsertest.cc b/content/browser/accessibility/dump_accessibility_events_browsertest.cc index 7363d2c..14e6232 100644 --- a/content/browser/accessibility/dump_accessibility_events_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_events_browsertest.cc
@@ -140,8 +140,7 @@ // Create a new Event Recorder for the run std::unique_ptr<AccessibilityEventRecorder> event_recorder = event_recorder_factory_( - web_contents->GetRootBrowserAccessibilityManager(), pid, - base::StringPiece{}); + web_contents->GetRootBrowserAccessibilityManager(), pid, {}); event_recorder->set_only_web_events(true); waiter.reset(new AccessibilityNotificationWaiter(
diff --git a/content/browser/loader/quic_transport_browsertest.cc b/content/browser/loader/quic_transport_browsertest.cc index 73ec95f2..1c71486b3 100644 --- a/content/browser/loader/quic_transport_browsertest.cc +++ b/content/browser/loader/quic_transport_browsertest.cc
@@ -188,8 +188,8 @@ async function run() { const transport = new WebTransport('quic-transport://localhost:%d/echo'); - const writer = transport.sendDatagrams().getWriter(); - const reader = transport.receiveDatagrams().getReader(); + const writer = transport.writableDatagrams.getWriter(); + const reader = transport.readableDatagrams.getReader(); const data = new Uint8Array([65, 66, 67]); const id = setInterval(() => {
diff --git a/content/browser/navigation_browsertest.cc b/content/browser/navigation_browsertest.cc index 1349d691..ed4a7d9 100644 --- a/content/browser/navigation_browsertest.cc +++ b/content/browser/navigation_browsertest.cc
@@ -69,6 +69,7 @@ #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/controllable_http_response.h" #include "net/test/embedded_test_server/embedded_test_server.h" +#include "net/test/embedded_test_server/http_response.h" #include "net/test/url_request/url_request_failed_job.h" #include "services/network/public/cpp/features.h" #include "services/network/public/mojom/url_loader.mojom.h" @@ -3552,6 +3553,32 @@ loop.Run(); } +using MediaNavigationBrowserTest = NavigationBaseBrowserTest; + +// Media navigations synchronously complete the time of the `CommitNavigation` +// IPC call. Ensure that the renderer does not crash if the media navigation +// results in an HTTP error with no body, since the renderer will reentrantly +// commit an error page while handling the `CommitNavigation` IPC. +IN_PROC_BROWSER_TEST_F(MediaNavigationBrowserTest, FailedNavigation) { + embedded_test_server()->RegisterRequestHandler(base::BindRepeating( + [](const net::test_server::HttpRequest& request) + -> std::unique_ptr<net::test_server::HttpResponse> { + auto response = std::make_unique<net::test_server::BasicHttpResponse>(); + response->set_code(net::HTTP_NOT_FOUND); + response->set_content_type("video/mp4"); + return response; + })); + ASSERT_TRUE(embedded_test_server()->Start()); + + const GURL error_url(embedded_test_server()->GetURL("/moo.mp4")); + EXPECT_FALSE(NavigateToURL(shell(), error_url)); + EXPECT_EQ(error_url, + shell()->web_contents()->GetMainFrame()->GetLastCommittedURL()); + NavigationEntry* entry = + shell()->web_contents()->GetController().GetLastCommittedEntry(); + EXPECT_EQ(PAGE_TYPE_ERROR, entry->GetPageType()); +} + class DocumentPolicyBrowserTest : public NavigationBaseBrowserTest { public: DocumentPolicyBrowserTest() {
diff --git a/content/browser/payments/payment_app_provider_impl.cc b/content/browser/payments/payment_app_provider_impl.cc index 41d9054..9c2a1cbc 100644 --- a/content/browser/payments/payment_app_provider_impl.cc +++ b/content/browser/payments/payment_app_provider_impl.cc
@@ -104,19 +104,21 @@ // static PaymentAppProvider* PaymentAppProvider::GetOrCreateForWebContents( - WebContents* web_contents) { - return PaymentAppProviderImpl::GetOrCreateForWebContents(web_contents); + WebContents* payment_request_web_contents) { + return PaymentAppProviderImpl::GetOrCreateForWebContents( + payment_request_web_contents); } // static PaymentAppProviderImpl* PaymentAppProviderImpl::GetOrCreateForWebContents( - WebContents* web_contents) { + WebContents* payment_request_web_contents) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - auto* data = PaymentAppProviderImpl::FromWebContents(web_contents); + auto* data = + PaymentAppProviderImpl::FromWebContents(payment_request_web_contents); if (!data) - PaymentAppProviderImpl::CreateForWebContents(web_contents); + PaymentAppProviderImpl::CreateForWebContents(payment_request_web_contents); - return PaymentAppProviderImpl::FromWebContents(web_contents); + return PaymentAppProviderImpl::FromWebContents(payment_request_web_contents); } void PaymentAppProviderImpl::InvokePaymentApp( @@ -125,7 +127,7 @@ PaymentRequestEventDataPtr event_data, InvokePaymentAppCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - DCHECK(web_contents_); + DCHECK(payment_request_web_contents_); scoped_refptr<DevToolsBackgroundServicesContextImpl> dev_tools = GetDevTools(sw_origin); @@ -148,7 +150,7 @@ StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>( BrowserContext::GetDefaultStoragePartition( - web_contents_->GetBrowserContext())); + payment_request_web_contents_->GetBrowserContext())); scoped_refptr<ServiceWorkerContextWrapper> service_worker_context = partition->GetServiceWorkerContext(); @@ -173,7 +175,7 @@ RegistrationIdCallback registration_id_callback, InvokePaymentAppCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - DCHECK(web_contents_); + DCHECK(payment_request_web_contents_); if (!sw_js_url.is_valid() || !sw_scope.is_valid() || method.empty()) { GetUIThreadTaskRunner({})->PostTask( @@ -196,8 +198,8 @@ } PaymentAppInstaller::Install( - web_contents_, app_name, string_encoded_icon, sw_js_url, sw_scope, - sw_use_cache, method, supported_delegations, + payment_request_web_contents_, app_name, string_encoded_icon, sw_js_url, + sw_scope, sw_use_cache, method, supported_delegations, base::BindOnce(&PaymentAppProviderImpl::OnInstallPaymentApp, weak_ptr_factory_.GetWeakPtr(), url::Origin::Create(sw_scope), std::move(event_data), @@ -214,7 +216,7 @@ PaymentAppProvider::UpdatePaymentAppIconCallback callback) { StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>( BrowserContext::GetDefaultStoragePartition( - web_contents_->GetBrowserContext())); + payment_request_web_contents_->GetBrowserContext())); scoped_refptr<PaymentAppContextImpl> payment_app_context = partition->GetPaymentAppContext(); @@ -232,7 +234,7 @@ CanMakePaymentEventDataPtr event_data, CanMakePaymentCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - DCHECK(web_contents_); + DCHECK(payment_request_web_contents_); scoped_refptr<DevToolsBackgroundServicesContextImpl> dev_tools = GetDevTools(sw_origin); @@ -255,7 +257,7 @@ StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>( BrowserContext::GetDefaultStoragePartition( - web_contents_->GetBrowserContext())); + payment_request_web_contents_->GetBrowserContext())); scoped_refptr<ServiceWorkerContextWrapper> service_worker_context = partition->GetServiceWorkerContext(); @@ -274,7 +276,7 @@ const std::string& payment_request_id, AbortCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - DCHECK(web_contents_); + DCHECK(payment_request_web_contents_); scoped_refptr<DevToolsBackgroundServicesContextImpl> dev_tools = GetDevTools(sw_origin); @@ -287,7 +289,7 @@ StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>( BrowserContext::GetDefaultStoragePartition( - web_contents_->GetBrowserContext())); + payment_request_web_contents_->GetBrowserContext())); scoped_refptr<ServiceWorkerContextWrapper> service_worker_context = partition->GetServiceWorkerContext(); @@ -300,15 +302,16 @@ std::move(service_worker_context), std::move(callback))); } -void PaymentAppProviderImpl::SetOpenedWindow() { +void PaymentAppProviderImpl::SetOpenedWindow( + WebContents* payment_handler_web_contents) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - DCHECK(web_contents_); + DCHECK(payment_handler_web_contents); CloseOpenedWindow(); DCHECK(!payment_handler_window_); - payment_handler_window_ = - std::make_unique<PaymentHandlerWindowObserver>(web_contents_); + payment_handler_window_ = std::make_unique<PaymentHandlerWindowObserver>( + payment_handler_web_contents); } void PaymentAppProviderImpl::CloseOpenedWindow() { @@ -338,9 +341,9 @@ scoped_refptr<DevToolsBackgroundServicesContextImpl> PaymentAppProviderImpl::GetDevTools(const url::Origin& sw_origin) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - DCHECK(web_contents_); + DCHECK(payment_request_web_contents_); auto* storage_partition = BrowserContext::GetStoragePartitionForSite( - web_contents_->GetBrowserContext(), sw_origin.GetURL(), + payment_request_web_contents_->GetBrowserContext(), sw_origin.GetURL(), /*can_create=*/true); if (!storage_partition) return nullptr; @@ -362,7 +365,7 @@ StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>( BrowserContext::GetDefaultStoragePartition( - web_contents_->GetBrowserContext())); + payment_request_web_contents_->GetBrowserContext())); scoped_refptr<ServiceWorkerContextWrapper> service_worker_context = partition->GetServiceWorkerContext(); @@ -381,7 +384,7 @@ InvokePaymentAppCallback callback, int64_t registration_id) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - DCHECK(web_contents_); + DCHECK(payment_request_web_contents_); if (registration_id >= 0) { std::move(registration_id_callback).Run(registration_id); @@ -394,11 +397,12 @@ } } -PaymentAppProviderImpl::PaymentAppProviderImpl(WebContents* web_contents) - : web_contents_(web_contents), +PaymentAppProviderImpl::PaymentAppProviderImpl( + WebContents* payment_request_web_contents) + : payment_request_web_contents_(payment_request_web_contents), event_dispatcher_( std::make_unique<ServiceWorkerCoreThreadEventDispatcher>( - web_contents_)) { + payment_request_web_contents_)) { event_dispatcher_->set_payment_app_provider(weak_ptr_factory_.GetWeakPtr()); } @@ -408,8 +412,8 @@ } PaymentAppProviderImpl::PaymentHandlerWindowObserver:: - PaymentHandlerWindowObserver(WebContents* web_contents) - : WebContentsObserver(web_contents) {} + PaymentHandlerWindowObserver(WebContents* payment_handler_web_contents) + : WebContentsObserver(payment_handler_web_contents) {} PaymentAppProviderImpl::PaymentHandlerWindowObserver:: ~PaymentHandlerWindowObserver() = default;
diff --git a/content/browser/payments/payment_app_provider_impl.h b/content/browser/payments/payment_app_provider_impl.h index bf4c7ed3..d10b528d1 100644 --- a/content/browser/payments/payment_app_provider_impl.h +++ b/content/browser/payments/payment_app_provider_impl.h
@@ -20,7 +20,7 @@ public: ~PaymentAppProviderImpl() override; static PaymentAppProviderImpl* GetOrCreateForWebContents( - WebContents* web_contents); + WebContents* payment_request_web_contents); // Disallow copy and assign. PaymentAppProviderImpl(const PaymentAppProviderImpl& other) = delete; @@ -60,13 +60,13 @@ const url::Origin& sw_origin, const std::string& payment_request_id, AbortCallback callback) override; - void SetOpenedWindow() override; + void SetOpenedWindow(WebContents* payment_handler_web_contents) override; void CloseOpenedWindow() override; void OnClosingOpenedWindow( payments::mojom::PaymentEventResponseType reason) override; private: - explicit PaymentAppProviderImpl(WebContents* web_contents); + explicit PaymentAppProviderImpl(WebContents* payment_request_web_contents); friend class WebContentsUserData<PaymentAppProviderImpl>; WEB_CONTENTS_USER_DATA_KEY_DECL(); @@ -86,14 +86,15 @@ // Note that constructor of WebContentsObserver is protected. class PaymentHandlerWindowObserver : public WebContentsObserver { public: - explicit PaymentHandlerWindowObserver(WebContents* web_contents); + explicit PaymentHandlerWindowObserver( + WebContents* payment_handler_web_contents); ~PaymentHandlerWindowObserver() override; }; std::unique_ptr<PaymentHandlerWindowObserver> payment_handler_window_; // Owns this object. - WebContents* web_contents_; + WebContents* payment_request_web_contents_; // It should be accessed only on the service worker core thread. std::unique_ptr<ServiceWorkerCoreThreadEventDispatcher> event_dispatcher_;
diff --git a/content/browser/renderer_host/media/in_process_video_capture_provider.cc b/content/browser/renderer_host/media/in_process_video_capture_provider.cc index 9fdeae4..81d36bf 100644 --- a/content/browser/renderer_host/media/in_process_video_capture_provider.cc +++ b/content/browser/renderer_host/media/in_process_video_capture_provider.cc
@@ -23,6 +23,11 @@ InProcessVideoCaptureProvider::~InProcessVideoCaptureProvider() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + if (video_capture_system_ && !device_task_runner_->BelongsToCurrentThread()) { + device_task_runner_->DeleteSoon(FROM_HERE, + std::move(video_capture_system_)); + } } // static
diff --git a/content/browser/renderer_host/media/in_process_video_capture_provider.h b/content/browser/renderer_host/media/in_process_video_capture_provider.h index fa45fbc..26414a9 100644 --- a/content/browser/renderer_host/media/in_process_video_capture_provider.h +++ b/content/browser/renderer_host/media/in_process_video_capture_provider.h
@@ -38,7 +38,7 @@ private: // Can be nullptr. - const std::unique_ptr<media::VideoCaptureSystem> video_capture_system_; + std::unique_ptr<media::VideoCaptureSystem> video_capture_system_; // The message loop of media stream device thread, where VCD's live. const scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; base::RepeatingCallback<void(const std::string&)> emit_log_message_cb_;
diff --git a/content/browser/renderer_host/media/video_capture_manager_unittest.cc b/content/browser/renderer_host/media/video_capture_manager_unittest.cc index d08354ed..d8a2423 100644 --- a/content/browser/renderer_host/media/video_capture_manager_unittest.cc +++ b/content/browser/renderer_host/media/video_capture_manager_unittest.cc
@@ -280,7 +280,7 @@ ASSERT_GE(devices_.size(), 2u); } - void TearDown() override {} + void TearDown() override { task_environment_.RunUntilIdle(); } void OnGotControllerCallback( VideoCaptureControllerID id, @@ -348,12 +348,12 @@ } #endif + BrowserTaskEnvironment task_environment_; ScreenlockMonitorTestSource* screenlock_monitor_source_; std::unique_ptr<ScreenlockMonitor> screenlock_monitor_; std::map<VideoCaptureControllerID, VideoCaptureController*> controllers_; scoped_refptr<VideoCaptureManager> vcm_; std::unique_ptr<MockMediaStreamProviderListener> listener_; - BrowserTaskEnvironment task_environment_; std::unique_ptr<MockFrameObserver> frame_observer_; WrappedDeviceFactory* video_capture_device_factory_; blink::MediaStreamDevices devices_;
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index ee4f51d6..c0a9ce8 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -117,8 +117,8 @@ #endif #if defined(OS_LINUX) && !defined(OS_CHROMEOS) -#include "ui/base/ime/linux/text_edit_command_auralinux.h" // nogncheck -#include "ui/base/ime/linux/text_edit_key_bindings_delegate_auralinux.h" // nogncheck +#include "ui/base/ime/linux/text_edit_command_auralinux.h" +#include "ui/base/ime/linux/text_edit_key_bindings_delegate_auralinux.h" #endif #if defined(OS_CHROMEOS)
diff --git a/content/browser/renderer_host/render_widget_host_view_child_frame_browsertest.cc b/content/browser/renderer_host/render_widget_host_view_child_frame_browsertest.cc index 7852b2e8..72c4579 100644 --- a/content/browser/renderer_host/render_widget_host_view_child_frame_browsertest.cc +++ b/content/browser/renderer_host/render_widget_host_view_child_frame_browsertest.cc
@@ -538,9 +538,28 @@ std::vector<gfx::Rect> expected_segments; expected_segments.emplace_back(0, 0, emulated_display_feature.offset, root_view_size.height()); - expected_segments.emplace_back( - emulated_display_feature.offset + emulated_display_feature.mask_length, 0, - emulated_display_feature.offset, root_view_size.height()); + const int second_segment_offset = + emulated_display_feature.offset + emulated_display_feature.mask_length; + expected_segments.emplace_back(second_segment_offset, 0, + root_view_size.width() - second_segment_offset, + root_view_size.height()); + + base::Optional<blink::VisualProperties> properties = + oopchild->current_frame_host() + ->GetRenderWidgetHost() + ->GetLastVisualPropertiesSentToRendererForTesting(); + EXPECT_TRUE(properties); + EXPECT_TRUE(properties->local_surface_id); + viz::LocalSurfaceId oopchild_initial_lsid = + properties->local_surface_id.value(); + + properties = oopdescendant->current_frame_host() + ->GetRenderWidgetHost() + ->GetLastVisualPropertiesSentToRendererForTesting(); + EXPECT_TRUE(properties); + EXPECT_TRUE(properties->local_surface_id); + viz::LocalSurfaceId oopdescendant_initial_lsid = + properties->local_surface_id.value(); { // Watch for visual properties changes, first to the child oop-iframe, then @@ -555,9 +574,11 @@ oopchild->current_frame_host() ->GetRenderWidgetHost() ->GetLastVisualPropertiesSentToRendererForTesting(); - if (properties && - properties->root_widget_window_segments == expected_segments) + if (properties && properties->local_surface_id && + oopchild_initial_lsid < properties->local_surface_id) { + EXPECT_EQ(properties->root_widget_window_segments, expected_segments); break; + } base::RunLoop().RunUntilIdle(); } while (true) { @@ -565,9 +586,11 @@ oopdescendant->current_frame_host() ->GetRenderWidgetHost() ->GetLastVisualPropertiesSentToRendererForTesting(); - if (properties && - properties->root_widget_window_segments == expected_segments) + if (properties && properties->local_surface_id && + oopdescendant_initial_lsid < properties->local_surface_id) { + EXPECT_EQ(properties->root_widget_window_segments, expected_segments); break; + } base::RunLoop().RunUntilIdle(); } }
diff --git a/content/browser/resources/conversions/conversion_internals.css b/content/browser/resources/conversions/conversion_internals.css index 43039824..87cb09c 100644 --- a/content/browser/resources/conversions/conversion_internals.css +++ b/content/browser/resources/conversions/conversion_internals.css
@@ -36,6 +36,7 @@ border: 1px solid #cecece; border-radius: 3px; line-height: 1.5; + overflow-x: scroll; padding: 19px; }
diff --git a/content/browser/service_worker/service_worker_client_utils.cc b/content/browser/service_worker/service_worker_client_utils.cc index 41c31fd..c5a105f 100644 --- a/content/browser/service_worker/service_worker_client_utils.cc +++ b/content/browser/service_worker/service_worker_client_utils.cc
@@ -209,13 +209,6 @@ new OpenURLObserver(web_contents, rfhi->frame_tree_node()->frame_tree_node_id(), std::move(callback)); - - if (type == WindowType::PAYMENT_HANDLER_WINDOW) { - // Set the opened web_contents to payment app provider to manage its life - // cycle. - PaymentAppProvider::GetOrCreateForWebContents(web_contents) - ->SetOpenedWindow(); - } } void OpenWindowOnUI(
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 64a5c06..fb9bdd76 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4166,8 +4166,7 @@ auto* ax_mgr = GetOrCreateRootBrowserAccessibilityManager(); DCHECK(ax_mgr); base::ProcessId pid = base::Process::Current().Pid(); - event_recorder_ = content::AccessibilityEventRecorder::Create( - ax_mgr, pid, base::StringPiece{}); + event_recorder_ = content::AccessibilityEventRecorder::Create(ax_mgr, pid); event_recorder_->ListenToEvents(*callback); } else { if (event_recorder_) {
diff --git a/content/browser/web_package/signed_exchange_handler.cc b/content/browser/web_package/signed_exchange_handler.cc index 66ab29d..debde4c 100644 --- a/content/browser/web_package/signed_exchange_handler.cc +++ b/content/browser/web_package/signed_exchange_handler.cc
@@ -80,8 +80,9 @@ return version == SignedExchangeVersion::kB3; } -using VerifyCallback = - base::OnceCallback<void(int32_t, const net::CertVerifyResult&)>; +using VerifyCallback = base::OnceCallback<void(int32_t, + const net::CertVerifyResult&, + const net::ct::CTVerifyResult&)>; void VerifyCert(const scoped_refptr<net::X509Certificate>& certificate, const GURL& url, @@ -90,7 +91,8 @@ int frame_tree_node_id, VerifyCallback callback) { VerifyCallback wrapped_callback = mojo::WrapCallbackWithDefaultInvokeIfNotRun( - std::move(callback), net::ERR_FAILED, net::CertVerifyResult()); + std::move(callback), net::ERR_FAILED, net::CertVerifyResult(), + net::ct::CTVerifyResult()); network::mojom::NetworkContext* network_context = g_network_context_for_testing; @@ -595,13 +597,14 @@ void SignedExchangeHandler::OnVerifyCert( int32_t error_code, - const net::CertVerifyResult& cv_result) { + const net::CertVerifyResult& cv_result, + const net::ct::CTVerifyResult& ct_result) { TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), "SignedExchangeHandler::OnCertVerifyComplete"); // net::Error codes are negative, so we put - in front of it. base::UmaHistogramSparse(kHistogramCertVerificationResult, -error_code); UMA_HISTOGRAM_ENUMERATION(kHistogramCTVerificationResult, - cv_result.policy_compliance, + ct_result.policy_compliance, net::ct::CTPolicyCompliance::CT_POLICY_COUNT); if (error_code != net::OK) { @@ -611,7 +614,7 @@ error_message = base::StringPrintf( "CT verification failed. result: %s, policy compliance: %d", net::ErrorToShortString(error_code).c_str(), - cv_result.policy_compliance); + ct_result.policy_compliance); result = SignedExchangeLoadResult::kCTVerificationError; } else { error_message = @@ -687,8 +690,7 @@ ssl_info.public_key_hashes = cv_result.public_key_hashes; ssl_info.ocsp_result = cv_result.ocsp_result; ssl_info.is_fatal_cert_error = net::IsCertStatusError(ssl_info.cert_status); - ssl_info.signed_certificate_timestamps = cv_result.scts; - ssl_info.ct_policy_compliance = cv_result.policy_compliance; + ssl_info.UpdateCertificateTransparencyInfo(ct_result); if (devtools_proxy_) { devtools_proxy_->OnSignedExchangeReceived(
diff --git a/content/browser/web_package/signed_exchange_handler.h b/content/browser/web_package/signed_exchange_handler.h index 89d9340..d0fd6571 100644 --- a/content/browser/web_package/signed_exchange_handler.h +++ b/content/browser/web_package/signed_exchange_handler.h
@@ -143,7 +143,9 @@ const net::X509Certificate* verified_cert); bool CheckOCSPStatus(const net::OCSPVerifyResult& ocsp_result); - void OnVerifyCert(int32_t error_code, const net::CertVerifyResult& cv_result); + void OnVerifyCert(int32_t error_code, + const net::CertVerifyResult& cv_result, + const net::ct::CTVerifyResult& ct_result); std::unique_ptr<net::SourceStream> CreateResponseBodyStream(); const bool is_secure_transport_;
diff --git a/content/browser/web_package/signed_exchange_handler_unittest.cc b/content/browser/web_package/signed_exchange_handler_unittest.cc index 36b72d9a..4082c0c 100644 --- a/content/browser/web_package/signed_exchange_handler_unittest.cc +++ b/content/browser/web_package/signed_exchange_handler_unittest.cc
@@ -931,6 +931,7 @@ net::CERT_STATUS_IS_EV); EXPECT_FALSE(resource_response().ssl_info->cert_status & net::CERT_STATUS_CT_COMPLIANCE_FAILED); + EXPECT_TRUE(resource_response().ssl_info->ct_policy_compliance_required); EXPECT_EQ(net::ct::CTPolicyCompliance::CT_POLICY_COMPLIES_VIA_SCTS, resource_response().ssl_info->ct_policy_compliance); ExpectHistogramValues( @@ -972,6 +973,7 @@ net::CERT_STATUS_IS_EV); EXPECT_TRUE(resource_response().ssl_info->cert_status & net::CERT_STATUS_CT_COMPLIANCE_FAILED); + EXPECT_FALSE(resource_response().ssl_info->ct_policy_compliance_required); EXPECT_EQ(net::ct::CTPolicyCompliance::CT_POLICY_NOT_ENOUGH_SCTS, resource_response().ssl_info->ct_policy_compliance); ExpectHistogramValues(
diff --git a/content/browser/xr/service/browser_xr_runtime_impl.cc b/content/browser/xr/service/browser_xr_runtime_impl.cc index 02a6c9e..60a383a5 100644 --- a/content/browser/xr/service/browser_xr_runtime_impl.cc +++ b/content/browser/xr/service/browser_xr_runtime_impl.cc
@@ -111,17 +111,12 @@ } device::mojom::VRDisplayInfoPtr ValidateVRDisplayInfo( - const device::mojom::VRDisplayInfo* info, - device::mojom::XRDeviceId id) { + const device::mojom::VRDisplayInfo* info) { if (!info) return nullptr; device::mojom::VRDisplayInfoPtr ret = device::mojom::VRDisplayInfo::New(); - // Rather than just cloning everything, we copy over each field and validate - // individually. This ensures new fields don't bypass validation. - ret->id = id; - // Maximum 1000km translation. if (info->stage_parameters && IsValidTransform(info->stage_parameters->mojo_from_floor, 1000000)) { @@ -215,7 +210,7 @@ : id_(id), device_data_(std::move(device_data)), runtime_(std::move(runtime)), - display_info_(ValidateVRDisplayInfo(display_info.get(), id)) { + display_info_(ValidateVRDisplayInfo(display_info.get())) { DVLOG(2) << __func__ << ": id=" << id; // Unretained is safe because we are calling through an InterfacePtr we own, // so we won't be called after runtime_ is destroyed. @@ -357,7 +352,7 @@ void BrowserXRRuntimeImpl::OnDisplayInfoChanged( device::mojom::VRDisplayInfoPtr vr_device_info) { bool had_display_info = !!display_info_; - display_info_ = ValidateVRDisplayInfo(vr_device_info.get(), id_); + display_info_ = ValidateVRDisplayInfo(vr_device_info.get()); if (had_display_info) { for (VRServiceImpl* service : services_) { service->OnDisplayInfoChanged();
diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc index ffd8b37..06e3dc8 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc
@@ -344,6 +344,7 @@ {"FeaturePolicyForClientHints", features::kFeaturePolicyForClientHints}, {"EditingNG", blink::features::kEditingNG}, + {"FlexAspectRatio", blink::features::kFlexAspectRatio}, {"FontAccess", blink::features::kFontAccess}, {"FontSrcLocalMatching", features::kFontSrcLocalMatching}, {"ForceSynchronousHTMLParsing", @@ -369,7 +370,6 @@ {"RawClipboard", blink::features::kRawClipboard}, {"ShadowDOMV0", blink::features::kWebComponentsV0}, {"StorageAccessAPI", blink::features::kStorageAccessAPI}, - {"TransferableStreams", blink::features::kTransferableStreams}, {"TrustedDOMTypes", features::kTrustedDOMTypes}, {"UserAgentClientHint", features::kUserAgentClientHint}, {"WebAppManifestDisplayOverride",
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn index b8bb970..d4fd9853 100644 --- a/content/common/BUILD.gn +++ b/content/common/BUILD.gn
@@ -456,7 +456,6 @@ "native_types.mojom", "navigation_client.mojom", "navigation_params.mojom", - "page_state.mojom", "prefetched_signed_exchange_info.mojom", "render_accessibility.mojom", "render_message_filter.mojom",
diff --git a/content/common/page_state_serialization.cc b/content/common/page_state_serialization.cc index 5bf64a2..f88b601 100644 --- a/content/common/page_state_serialization.cc +++ b/content/common/page_state_serialization.cc
@@ -13,14 +13,12 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" -#include "content/common/page_state.mojom.h" #include "content/public/common/referrer.h" #include "ipc/ipc_message_utils.h" #include "mojo/public/cpp/base/string16_mojom_traits.h" #include "mojo/public/cpp/base/time_mojom_traits.h" #include "services/network/public/cpp/resource_request_body.h" #include "third_party/blink/public/common/unique_name/unique_name_helper.h" -#include "third_party/blink/public/platform/web_history_scroll_restoration_type.h" #include "ui/display/display.h" #include "ui/display/screen.h" #include "ui/gfx/geometry/mojom/geometry_mojom_traits.h" @@ -28,15 +26,6 @@ namespace content { -#define STATIC_ASSERT_ENUM(a, b) \ - static_assert(static_cast<int>(a) == static_cast<int>(b), \ - "mismatching enums: " #a) - -STATIC_ASSERT_ENUM(history::mojom::ScrollRestorationType::kAuto, - blink::kWebHistoryScrollRestorationAuto); -STATIC_ASSERT_ENUM(history::mojom::ScrollRestorationType::kManual, - blink::kWebHistoryScrollRestorationManual); - namespace { #if defined(OS_ANDROID) @@ -566,7 +555,7 @@ if (obj->version >= 22) { state->scroll_restoration_type = - static_cast<blink::WebHistoryScrollRestorationType>(ReadInteger(obj)); + static_cast<blink::mojom::ScrollRestorationType>(ReadInteger(obj)); } bool has_state_object = ReadBoolean(obj); @@ -653,7 +642,7 @@ WriteReal(state.visual_viewport_scroll_offset.y(), obj); } - WriteInteger(state.scroll_restoration_type, obj); + WriteInteger(static_cast<int>(state.scroll_restoration_type), obj); bool has_state_object = state.state_object.has_value(); WriteBoolean(has_state_object, obj); @@ -685,9 +674,9 @@ // "Modern" read/write functions start here. These are probably what you want. void WriteResourceRequestBody(const network::ResourceRequestBody& request_body, - history::mojom::RequestBody* mojo_body) { + blink::mojom::RequestBody* mojo_body) { for (const auto& element : *request_body.elements()) { - history::mojom::ElementPtr data_element = history::mojom::Element::New(); + blink::mojom::ElementPtr data_element = blink::mojom::Element::New(); switch (element.type()) { case network::mojom::DataElementType::kBytes: { data_element->set_bytes(std::vector<unsigned char>( @@ -696,7 +685,7 @@ break; } case network::mojom::DataElementType::kFile: { - history::mojom::FilePtr file = history::mojom::File::New( + blink::mojom::FilePtr file = blink::mojom::File::New( element.path().AsUTF16Unsafe(), element.offset(), element.length(), element.expected_modification_time()); data_element->set_file(std::move(file)); @@ -720,27 +709,27 @@ } void ReadResourceRequestBody( - history::mojom::RequestBody* mojo_body, + blink::mojom::RequestBody* mojo_body, const scoped_refptr<network::ResourceRequestBody>& request_body) { for (const auto& element : mojo_body->elements) { - history::mojom::Element::Tag tag = element->which(); + blink::mojom::Element::Tag tag = element->which(); switch (tag) { - case history::mojom::Element::Tag::BYTES: + case blink::mojom::Element::Tag::BYTES: AppendDataToRequestBody( request_body, reinterpret_cast<const char*>(element->get_bytes().data()), element->get_bytes().size()); break; - case history::mojom::Element::Tag::FILE: { - history::mojom::File* file = element->get_file().get(); + case blink::mojom::Element::Tag::FILE: { + blink::mojom::File* file = element->get_file().get(); AppendFileRangeToRequestBody(request_body, file->path, file->offset, file->length, file->modification_time); break; } - case history::mojom::Element::Tag::BLOB_UUID: + case blink::mojom::Element::Tag::BLOB_UUID: AppendBlobToRequestBody(request_body, element->get_blob_uuid()); break; - case history::mojom::Element::Tag::DEPRECATED_FILE_SYSTEM_FILE: + case blink::mojom::Element::Tag::DEPRECATED_FILE_SYSTEM_FILE: // No longer supported. break; } @@ -749,9 +738,9 @@ } void WriteHttpBody(const ExplodedHttpBody& http_body, - history::mojom::HttpBody* mojo_body) { + blink::mojom::HttpBody* mojo_body) { if (http_body.request_body != nullptr) { - mojo_body->request_body = history::mojom::RequestBody::New(); + mojo_body->request_body = blink::mojom::RequestBody::New(); mojo_body->contains_passwords = http_body.contains_passwords; mojo_body->http_content_type = http_body.http_content_type; WriteResourceRequestBody(*http_body.request_body, @@ -759,7 +748,7 @@ } } -void ReadHttpBody(history::mojom::HttpBody* mojo_body, +void ReadHttpBody(blink::mojom::HttpBody* mojo_body, ExplodedHttpBody* http_body) { http_body->contains_passwords = mojo_body->contains_passwords; http_body->http_content_type = mojo_body->http_content_type; @@ -772,7 +761,7 @@ } void WriteFrameState(const ExplodedFrameState& state, - history::mojom::FrameState* frame) { + blink::mojom::FrameState* frame) { frame->url_string = state.url_string; frame->referrer = state.referrer; if (state.initiator_origin.has_value()) @@ -785,11 +774,11 @@ } frame->scroll_restoration_type = - static_cast<history::mojom::ScrollRestorationType>( + static_cast<blink::mojom::ScrollRestorationType>( state.scroll_restoration_type); if (state.did_save_scroll_or_scale_state) { - frame->view_state = history::mojom::ViewState::New(); + frame->view_state = blink::mojom::ViewState::New(); frame->view_state->scroll_offset = state.scroll_offset; frame->view_state->visual_viewport_scroll_offset = state.visual_viewport_scroll_offset; @@ -810,20 +799,19 @@ frame->referrer_policy = state.referrer_policy; - frame->http_body = history::mojom::HttpBody::New(); + frame->http_body = blink::mojom::HttpBody::New(); WriteHttpBody(state.http_body, frame->http_body.get()); // Subitems const std::vector<ExplodedFrameState>& children = state.children; for (const auto& child : children) { - history::mojom::FrameStatePtr child_frame = - history::mojom::FrameState::New(); + blink::mojom::FrameStatePtr child_frame = blink::mojom::FrameState::New(); WriteFrameState(child, child_frame.get()); frame->children.push_back(std::move(child_frame)); } } -void ReadFrameState(history::mojom::FrameState* frame, +void ReadFrameState(blink::mojom::FrameState* frame, ExplodedFrameState* state) { state->url_string = frame->url_string; state->referrer = frame->referrer; @@ -840,7 +828,7 @@ } state->scroll_restoration_type = - static_cast<blink::WebHistoryScrollRestorationType>( + static_cast<blink::mojom::ScrollRestorationType>( frame->scroll_restoration_type); if (frame->view_state) { @@ -882,9 +870,9 @@ if (obj->parse_error) return; - history::mojom::PageStatePtr page; + blink::mojom::PageStatePtr page; obj->parse_error = - !(history::mojom::PageState::Deserialize(tmp, length, &page)); + !(blink::mojom::PageState::Deserialize(tmp, length, &page)); if (obj->parse_error) return; @@ -902,15 +890,15 @@ void WriteMojoPageState(const ExplodedPageState& state, SerializeObject* obj) { WriteInteger(obj->version, obj); - history::mojom::PageStatePtr page = history::mojom::PageState::New(); + blink::mojom::PageStatePtr page = blink::mojom::PageState::New(); for (const auto& referenced_file : state.referenced_files) { page->referenced_files.push_back(referenced_file.value()); } - page->top = history::mojom::FrameState::New(); + page->top = blink::mojom::FrameState::New(); WriteFrameState(state.top, page->top.get()); - std::vector<uint8_t> page_bytes = history::mojom::PageState::Serialize(&page); + std::vector<uint8_t> page_bytes = blink::mojom::PageState::Serialize(&page); obj->pickle.WriteData(reinterpret_cast<char*>(page_bytes.data()), page_bytes.size()); } @@ -958,14 +946,7 @@ ExplodedHttpBody::~ExplodedHttpBody() { } -ExplodedFrameState::ExplodedFrameState() - : scroll_restoration_type(blink::kWebHistoryScrollRestorationAuto), - did_save_scroll_or_scale_state(true), - item_sequence_number(0), - document_sequence_number(0), - page_scale_factor(0.0), - referrer_policy(network::mojom::ReferrerPolicy::kDefault), - scroll_anchor_simhash(0) {} +ExplodedFrameState::ExplodedFrameState() = default; ExplodedFrameState::ExplodedFrameState(const ExplodedFrameState& other) { assign(other);
diff --git a/content/common/page_state_serialization.h b/content/common/page_state_serialization.h index c61a6c3..63c4145d 100644 --- a/content/common/page_state_serialization.h +++ b/content/common/page_state_serialization.h
@@ -16,7 +16,7 @@ #include "content/common/content_export.h" #include "services/network/public/cpp/resource_request_body.h" #include "services/network/public/mojom/referrer_policy.mojom.h" -#include "third_party/blink/public/platform/web_history_scroll_restoration_type.h" +#include "third_party/blink/public/mojom/page_state/page_state.mojom.h" #include "third_party/blink/public/platform/web_http_body.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/point_f.h" @@ -43,18 +43,20 @@ base::Optional<base::string16> target; base::Optional<base::string16> state_object; std::vector<base::Optional<base::string16>> document_state; - blink::WebHistoryScrollRestorationType scroll_restoration_type; - bool did_save_scroll_or_scale_state; + blink::mojom::ScrollRestorationType scroll_restoration_type = + blink::mojom::ScrollRestorationType::kAuto; + bool did_save_scroll_or_scale_state = true; gfx::PointF visual_viewport_scroll_offset; gfx::Point scroll_offset; - int64_t item_sequence_number; - int64_t document_sequence_number; - double page_scale_factor; - network::mojom::ReferrerPolicy referrer_policy; + int64_t item_sequence_number = 0; + int64_t document_sequence_number = 0; + double page_scale_factor = 0.f; + network::mojom::ReferrerPolicy referrer_policy = + network::mojom::ReferrerPolicy::kDefault; ExplodedHttpBody http_body; base::Optional<base::string16> scroll_anchor_selector; gfx::PointF scroll_anchor_offset; - uint64_t scroll_anchor_simhash; + uint64_t scroll_anchor_simhash = 0; std::vector<ExplodedFrameState> children; ExplodedFrameState();
diff --git a/content/common/page_state_serialization_unittest.cc b/content/common/page_state_serialization_unittest.cc index 251ef06..849f85f 100644 --- a/content/common/page_state_serialization_unittest.cc +++ b/content/common/page_state_serialization_unittest.cc
@@ -117,7 +117,7 @@ frame_state->document_state.push_back( base::UTF8ToUTF16("dev.chromium.org")); frame_state->scroll_restoration_type = - blink::kWebHistoryScrollRestorationManual; + blink::mojom::ScrollRestorationType::kManual; frame_state->visual_viewport_scroll_offset = gfx::PointF(10, 15); frame_state->scroll_offset = gfx::Point(0, 100); frame_state->item_sequence_number = 1; @@ -176,7 +176,7 @@ if (!is_child) frame_state->target = base::UTF8ToUTF16("target"); frame_state->scroll_restoration_type = - blink::kWebHistoryScrollRestorationAuto; + blink::mojom::ScrollRestorationType::kAuto; frame_state->visual_viewport_scroll_offset = gfx::PointF(-1, -1); frame_state->scroll_offset = gfx::Point(42, -42); frame_state->item_sequence_number = 123; @@ -638,7 +638,8 @@ TEST_F(PageStateSerializationTest, BackwardsCompat_ScrollRestorationType) { ExplodedPageState state; - state.top.scroll_restoration_type = blink::kWebHistoryScrollRestorationManual; + state.top.scroll_restoration_type = + blink::mojom::ScrollRestorationType::kManual; ExplodedPageState saved_state; ReadBackwardsCompatPageState("scroll_restoration_type", 26, &saved_state);
diff --git a/content/public/browser/accessibility_tree_formatter.h b/content/public/browser/accessibility_tree_formatter.h index 0bc5c96..5094e23 100644 --- a/content/public/browser/accessibility_tree_formatter.h +++ b/content/public/browser/accessibility_tree_formatter.h
@@ -113,6 +113,7 @@ int types; std::string pattern; + TreeSelector() : types(None) {} TreeSelector(int types, const std::string& pattern) : types(types), pattern(pattern) {}
diff --git a/content/public/browser/payment_app_provider.h b/content/public/browser/payment_app_provider.h index 730311d..dd557f6b 100644 --- a/content/public/browser/payment_app_provider.h +++ b/content/public/browser/payment_app_provider.h
@@ -32,7 +32,7 @@ // This static function is actually implemented in PaymentAppProviderImpl.cc. // Please see: content/browser/payments/payment_app_provider_impl.cc static PaymentAppProvider* GetOrCreateForWebContents( - WebContents* web_contents); + WebContents* payment_request_web_contents); using RegistrationIdCallback = base::OnceCallback<void(int64_t registration_id)>; @@ -84,7 +84,7 @@ // opened window for payment handler at any moment in a browser context. The // previously opened window in the same browser context will be closed after // calling this interface. - virtual void SetOpenedWindow() = 0; + virtual void SetOpenedWindow(WebContents* payment_handler_web_contents) = 0; virtual void CloseOpenedWindow() = 0; // Notify the opened payment handler window is closing or closed by user so as
diff --git a/content/public/common/common_param_traits_macros.h b/content/public/common/common_param_traits_macros.h index 72f5625b..52b5381 100644 --- a/content/public/common/common_param_traits_macros.h +++ b/content/public/common/common_param_traits_macros.h
@@ -20,11 +20,11 @@ #include "third_party/blink/public/common/security/security_style.h" #include "third_party/blink/public/common/web_preferences/web_preferences.h" #include "third_party/blink/public/mojom/devtools/console_message.mojom.h" +#include "third_party/blink/public/mojom/page_state/page_state.mojom.h" #include "third_party/blink/public/mojom/permissions/permission_status.mojom.h" #include "third_party/blink/public/mojom/renderer_preferences.mojom.h" #include "third_party/blink/public/mojom/v8_cache_options.mojom.h" #include "third_party/blink/public/mojom/window_features/window_features.mojom.h" -#include "third_party/blink/public/platform/web_history_scroll_restoration_type.h" #include "third_party/blink/public/platform/web_rect.h" #include "third_party/blink/public/platform/web_url_request.h" #include "ui/accessibility/ax_param_traits.h" @@ -49,8 +49,8 @@ blink::mojom::ConsoleMessageLevel::kError) IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::ReferrerPolicy, network::mojom::ReferrerPolicy::kMaxValue) -IPC_ENUM_TRAITS_MAX_VALUE(blink::WebHistoryScrollRestorationType, - blink::kWebHistoryScrollRestorationManual) +IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::ScrollRestorationType, + blink::mojom::ScrollRestorationType::kMaxValue) IPC_ENUM_TRAITS_MAX_VALUE(blink::SecurityStyle, blink::SecurityStyle::kMaxValue) IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::PermissionStatus, blink::mojom::PermissionStatus::LAST)
diff --git a/content/renderer/accessibility/blink_ax_tree_source.cc b/content/renderer/accessibility/blink_ax_tree_source.cc index 4c630fe0..00a5587d 100644 --- a/content/renderer/accessibility/blink_ax_tree_source.cc +++ b/content/renderer/accessibility/blink_ax_tree_source.cc
@@ -104,43 +104,6 @@ } } - void AddIntAttribute(blink::WebAXIntAttribute attribute, - int32_t value) override { - switch (attribute) { - case blink::WebAXIntAttribute::kAriaColumnCount: - dst_->AddIntAttribute(ax::mojom::IntAttribute::kAriaColumnCount, value); - break; - case blink::WebAXIntAttribute::kAriaRowCount: - dst_->AddIntAttribute(ax::mojom::IntAttribute::kAriaRowCount, value); - break; - default: - NOTREACHED(); - } - } - - void AddUIntAttribute(blink::WebAXUIntAttribute attribute, - uint32_t value) override { - switch (attribute) { - case blink::WebAXUIntAttribute::kAriaColumnIndex: - dst_->AddIntAttribute(ax::mojom::IntAttribute::kAriaCellColumnIndex, - value); - break; - case blink::WebAXUIntAttribute::kAriaColumnSpan: - dst_->AddIntAttribute(ax::mojom::IntAttribute::kAriaCellColumnSpan, - value); - break; - case blink::WebAXUIntAttribute::kAriaRowIndex: - dst_->AddIntAttribute(ax::mojom::IntAttribute::kAriaCellRowIndex, - value); - break; - case blink::WebAXUIntAttribute::kAriaRowSpan: - dst_->AddIntAttribute(ax::mojom::IntAttribute::kAriaCellRowSpan, value); - break; - default: - NOTREACHED(); - } - } - void AddStringAttribute(blink::WebAXStringAttribute attribute, const blink::WebString& value) override { switch (attribute) { @@ -207,8 +170,7 @@ // which means that when walking up the parent chain from |child|, // |ancestor| is the *first* ancestor that isn't marked as // accessibilityIsIgnored(). -bool IsParentUnignoredOf(WebAXObject ancestor, - WebAXObject child) { +bool IsParentUnignoredOf(WebAXObject ancestor, WebAXObject child) { WebAXObject parent = ParentObjectUnignored(child); return parent.Equals(ancestor); } @@ -323,8 +285,7 @@ ::switches::kEnableExperimentalAccessibilityLabelsDebugging); } -BlinkAXTreeSource::~BlinkAXTreeSource() { -} +BlinkAXTreeSource::~BlinkAXTreeSource() {} void BlinkAXTreeSource::Freeze() { CHECK(!frozen_); @@ -478,9 +439,8 @@ WebAXObject anchor_object, focus_object; int anchor_offset, focus_offset; ax::mojom::TextAffinity anchor_affinity, focus_affinity; - root().Selection(is_selection_backward, anchor_object, anchor_offset, - anchor_affinity, focus_object, focus_offset, - focus_affinity); + root().Selection(is_selection_backward, anchor_object, anchor_offset, + anchor_affinity, focus_object, focus_offset, focus_affinity); if (!anchor_object.IsNull() && !focus_object.IsNull() && anchor_offset >= 0 && focus_offset >= 0) { int32_t anchor_id = anchor_object.AxID(); @@ -634,7 +594,6 @@ } SerializeListAttributes(src, dst); - SerializeTableAttributes(src, dst); } if (accessibility_mode_.has_mode(ui::AXMode::kPDF)) { @@ -930,63 +889,6 @@ dst->AddIntAttribute(ax::mojom::IntAttribute::kPosInSet, src.PosInSet()); } -void BlinkAXTreeSource::SerializeTableAttributes(WebAXObject src, - ui::AXNodeData* dst) const { - const bool is_table_like_role = ui::IsTableLike(dst->role); - if (is_table_like_role) { - int aria_colcount = src.AriaColumnCount(); - if (aria_colcount) { - dst->AddIntAttribute(ax::mojom::IntAttribute::kAriaColumnCount, - aria_colcount); - } - - int aria_rowcount = src.AriaRowCount(); - if (aria_rowcount) { - dst->AddIntAttribute(ax::mojom::IntAttribute::kAriaRowCount, - aria_rowcount); - } - } - - if (ui::IsTableRow(dst->role)) { - WebAXObject header = src.RowHeader(); - if (!header.IsDetached()) { - // TODO(accessibility): these should be computed by ui::AXTableInfo and - // removed here. - dst->AddIntAttribute(ax::mojom::IntAttribute::kTableRowHeaderId, - header.AxID()); - } - } - - if (ui::IsCellOrTableHeader(dst->role)) { - dst->AddIntAttribute(ax::mojom::IntAttribute::kTableCellColumnSpan, - src.CellColumnSpan()); - dst->AddIntAttribute(ax::mojom::IntAttribute::kTableCellRowSpan, - src.CellRowSpan()); - } - - if (ui::IsCellOrTableHeader(dst->role) || ui::IsTableRow(dst->role)) { - // aria-rowindex and aria-colindex are supported on cells, headers and - // rows. - int aria_rowindex = src.AriaRowIndex(); - if (aria_rowindex) { - dst->AddIntAttribute(ax::mojom::IntAttribute::kAriaCellRowIndex, - aria_rowindex); - } - - int aria_colindex = src.AriaColumnIndex(); - if (aria_colindex) { - dst->AddIntAttribute(ax::mojom::IntAttribute::kAriaCellColumnIndex, - aria_colindex); - } - } - - if (ui::IsTableHeader(dst->role) && - src.SortDirection() != ax::mojom::SortDirection::kNone) { - dst->AddIntAttribute(ax::mojom::IntAttribute::kSortDirection, - static_cast<int32_t>(src.SortDirection())); - } -} - void BlinkAXTreeSource::SerializeScrollAttributes(WebAXObject src, ui::AXNodeData* dst) const { // Only mark as scrollable if user has actual scrollbars to use.
diff --git a/content/renderer/accessibility/blink_ax_tree_source.h b/content/renderer/accessibility/blink_ax_tree_source.h index 7faf163..3e19e9b 100644 --- a/content/renderer/accessibility/blink_ax_tree_source.h +++ b/content/renderer/accessibility/blink_ax_tree_source.h
@@ -152,8 +152,6 @@ ui::AXNodeData* dst) const; void SerializeListAttributes(blink::WebAXObject src, ui::AXNodeData* dst) const; - void SerializeTableAttributes(blink::WebAXObject src, - ui::AXNodeData* dst) const; void SerializeScrollAttributes(blink::WebAXObject src, ui::AXNodeData* dst) const; void SerializeChooserPopupAttributes(blink::WebAXObject src,
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index c1a21e9..c1e18ed 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -4550,11 +4550,27 @@ navigation_params->service_worker_network_provider = ServiceWorkerNetworkProviderForFrame::CreateInvalidInstance(); - CHECK_EQ(NavigationCommitState::kNone, navigation_commit_state_); - AssertNavigationCommits assert_navigation_commits(this); - frame_->CommitNavigation(std::move(navigation_params), BuildDocumentState()); + // TODO(dcheng): Remove this strange case. Typically, loading finishes + // asynchronously, so this will not be called while `CommitNavigation()` + // is on the stack. However, completion for media files is synchronously + // signalled in `blink::DocumentLoader::StartLoadingResponse()`. To prevent + // the CHECK in `AssertNavigationCommits` from tripping, temporarily reset the + // state and restore it after the reentrant `CommitNavigation()` completes. + bool reentrantly_committing = + (NavigationCommitState::kNone != navigation_commit_state_); + if (reentrantly_committing) { + CHECK_EQ(NavigationCommitState::kDidCommit, navigation_commit_state_); + navigation_commit_state_ = NavigationCommitState::kNone; + } + { + AssertNavigationCommits assert_navigation_commits(this); + frame_->CommitNavigation(std::move(navigation_params), + BuildDocumentState()); + } // WARNING: The previous call may have have deleted |this|. // Do not use |this| or |frame_| here without checking |weak_self|. + if (weak_self && reentrantly_committing) + navigation_commit_state_ = NavigationCommitState::kDidCommit; } void RenderFrameImpl::RunScriptsAtDocumentIdle() {
diff --git a/content/renderer/render_process_impl.cc b/content/renderer/render_process_impl.cc index 884a616..7ab6623 100644 --- a/content/renderer/render_process_impl.cc +++ b/content/renderer/render_process_impl.cc
@@ -36,6 +36,7 @@ #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" #include "content/public/renderer/content_renderer_client.h" +#include "services/network/public/cpp/features.h" #include "services/service_manager/embedder/switches.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/web/web_frame.h" @@ -146,15 +147,28 @@ SetV8FlagIfFeature(blink::features::kTopLevelAwait, "--harmony-top-level-await"); - if (base::FeatureList::IsEnabled(features::kWebAssemblyThreads)) { - constexpr char kFlags[] = - "--harmony-sharedarraybuffer " - "--experimental-wasm-threads"; + constexpr char kAtomicsFlag[] = "--harmony-atomics"; + v8::V8::SetFlagsFromString(kAtomicsFlag, sizeof(kAtomicsFlag)); - v8::V8::SetFlagsFromString(kFlags, sizeof(kFlags)); + // SharedArrayBuffers require the feature flag, or site isolation. On Android, + // the feature is disabled by default, so site isolation is required. On + // desktop, site isolation is optional while we migrate existing apps to use + // COOP+COEP. + bool enableSharedArrayBuffer = false; + if (base::FeatureList::IsEnabled(features::kWebAssemblyThreads)) { + constexpr char kWasmThreadsFlag[] = "--experimental-wasm-threads"; + v8::V8::SetFlagsFromString(kWasmThreadsFlag, sizeof(kWasmThreadsFlag)); + enableSharedArrayBuffer = true; } else { + enableSharedArrayBuffer = + base::FeatureList::IsEnabled(features::kSharedArrayBuffer) || + base::FeatureList::IsEnabled(network::features::kCrossOriginIsolated); + } + + if (enableSharedArrayBuffer) { SetV8FlagIfFeature(features::kSharedArrayBuffer, "--harmony-sharedarraybuffer"); + } else { SetV8FlagIfNotFeature(features::kSharedArrayBuffer, "--no-harmony-sharedarraybuffer"); }
diff --git a/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt index a3cbcc3d..361a7b8 100644 --- a/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt
@@ -232,12 +232,6 @@ crbug.com/1008450 [ android use-vulkan skia-renderer ] Pixel_Video_BackdropFilter [ Skip ] crbug.com/1008450 [ android skia-renderer ] Pixel_Video_MP4_Rounded_Corner [ Skip ] -# Test is producing a large number of visually identical images with minor (eg. -# between one and four pixels off by a tiny bit) pixel diffs on Windows with -# GLRenderer. There are too many images to add to gold so just disable test -# until we can drop GLRenderer from FYI bots. -crbug.com/1068301 [ win no-skia-renderer ] Pixel_DirectComposition_Video_MP4_Rounded_Corner [ Skip ] - # Produces blank images on Intel HD 630 w/ Mesa 19.0.2 crbug.com/976861 [ linux intel-0x5912 no-use-skia-dawn ] Pixel_OffscreenCanvasTransferToImageBitmap [ Skip ]
diff --git a/content/web_test/renderer/web_ax_object_proxy.cc b/content/web_test/renderer/web_ax_object_proxy.cc index 9344e2be..c74fe0b9 100644 --- a/content/web_test/renderer/web_ax_object_proxy.cc +++ b/content/web_test/renderer/web_ax_object_proxy.cc
@@ -620,8 +620,6 @@ ~SparseAttributeAdapter() override {} std::map<blink::WebAXBoolAttribute, bool> bool_attributes; - std::map<blink::WebAXIntAttribute, int32_t> int_attributes; - std::map<blink::WebAXUIntAttribute, int32_t> uint_attributes; std::map<blink::WebAXStringAttribute, blink::WebString> string_attributes; std::map<blink::WebAXObjectAttribute, blink::WebAXObject> object_attributes; std::map<blink::WebAXObjectVectorAttribute, @@ -634,16 +632,6 @@ bool_attributes[attribute] = value; } - void AddIntAttribute(blink::WebAXIntAttribute attribute, - int32_t value) override { - int_attributes[attribute] = value; - } - - void AddUIntAttribute(blink::WebAXUIntAttribute attribute, - uint32_t value) override { - uint_attributes[attribute] = value; - } - void AddStringAttribute(blink::WebAXStringAttribute attribute, const blink::WebString& value) override { string_attributes[attribute] = value; @@ -1419,50 +1407,46 @@ int32_t WebAXObjectProxy::AriaColumnCount() { blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - SparseAttributeAdapter attribute_adapter; - accessibility_object_.GetSparseAXAttributes(attribute_adapter); - return attribute_adapter - .int_attributes[blink::WebAXIntAttribute::kAriaColumnCount]; + ui::AXNodeData node_data; + accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); + return node_data.GetIntAttribute(ax::mojom::IntAttribute::kAriaColumnCount); } uint32_t WebAXObjectProxy::AriaColumnIndex() { blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - SparseAttributeAdapter attribute_adapter; - accessibility_object_.GetSparseAXAttributes(attribute_adapter); - return attribute_adapter - .uint_attributes[blink::WebAXUIntAttribute::kAriaColumnIndex]; + ui::AXNodeData node_data; + accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); + return node_data.GetIntAttribute( + ax::mojom::IntAttribute::kAriaCellColumnIndex); } uint32_t WebAXObjectProxy::AriaColumnSpan() { blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - SparseAttributeAdapter attribute_adapter; - accessibility_object_.GetSparseAXAttributes(attribute_adapter); - return attribute_adapter - .uint_attributes[blink::WebAXUIntAttribute::kAriaColumnSpan]; + ui::AXNodeData node_data; + accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); + return node_data.GetIntAttribute( + ax::mojom::IntAttribute::kAriaCellColumnSpan); } int32_t WebAXObjectProxy::AriaRowCount() { blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - SparseAttributeAdapter attribute_adapter; - accessibility_object_.GetSparseAXAttributes(attribute_adapter); - return attribute_adapter - .int_attributes[blink::WebAXIntAttribute::kAriaRowCount]; + ui::AXNodeData node_data; + accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); + return node_data.GetIntAttribute(ax::mojom::IntAttribute::kAriaRowCount); } uint32_t WebAXObjectProxy::AriaRowIndex() { blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - SparseAttributeAdapter attribute_adapter; - accessibility_object_.GetSparseAXAttributes(attribute_adapter); - return attribute_adapter - .uint_attributes[blink::WebAXUIntAttribute::kAriaRowIndex]; + ui::AXNodeData node_data; + accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); + return node_data.GetIntAttribute(ax::mojom::IntAttribute::kAriaCellRowIndex); } uint32_t WebAXObjectProxy::AriaRowSpan() { blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - SparseAttributeAdapter attribute_adapter; - accessibility_object_.GetSparseAXAttributes(attribute_adapter); - return attribute_adapter - .uint_attributes[blink::WebAXUIntAttribute::kAriaRowSpan]; + ui::AXNodeData node_data; + accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); + return node_data.GetIntAttribute(ax::mojom::IntAttribute::kAriaCellRowSpan); } std::string WebAXObjectProxy::Live() {
diff --git a/device/vr/android/gvr/gvr_device.cc b/device/vr/android/gvr/gvr_device.cc index 1dff5189..db3ea3a 100644 --- a/device/vr/android/gvr/gvr_device.cc +++ b/device/vr/android/gvr/gvr_device.cc
@@ -98,14 +98,11 @@ return eye_params; } -mojom::VRDisplayInfoPtr CreateVRDisplayInfo(gvr::GvrApi* gvr_api, - mojom::XRDeviceId device_id) { +mojom::VRDisplayInfoPtr CreateVRDisplayInfo(gvr::GvrApi* gvr_api) { TRACE_EVENT0("input", "GvrDelegate::CreateVRDisplayInfo"); mojom::VRDisplayInfoPtr device = mojom::VRDisplayInfo::New(); - device->id = device_id; - gvr::BufferViewportList gvr_buffer_viewports = gvr_api->CreateEmptyBufferViewportList(); gvr_buffer_viewports.SetToRecommendedBufferViewports(); @@ -270,7 +267,7 @@ void GvrDevice::OnDisplayConfigurationChanged(JNIEnv* env, const JavaRef<jobject>& obj) { DCHECK(gvr_api_); - SetVRDisplayInfo(CreateVRDisplayInfo(gvr_api_.get(), GetId())); + SetVRDisplayInfo(CreateVRDisplayInfo(gvr_api_.get())); } void GvrDevice::Init(base::OnceCallback<void(bool)> on_finished) { @@ -294,7 +291,7 @@ jlong context = Java_NonPresentingGvrContext_getNativeGvrContext( env, non_presenting_context_); gvr_api_ = gvr::GvrApi::WrapNonOwned(reinterpret_cast<gvr_context*>(context)); - SetVRDisplayInfo(CreateVRDisplayInfo(gvr_api_.get(), GetId())); + SetVRDisplayInfo(CreateVRDisplayInfo(gvr_api_.get())); if (paused_) { PauseTracking();
diff --git a/device/vr/oculus/oculus_device.cc b/device/vr/oculus/oculus_device.cc index 1aa88489..252c26ac 100644 --- a/device/vr/oculus/oculus_device.cc +++ b/device/vr/oculus/oculus_device.cc
@@ -59,10 +59,8 @@ return eye_parameters; } -mojom::VRDisplayInfoPtr CreateVRDisplayInfo(mojom::XRDeviceId id, - ovrSession session) { +mojom::VRDisplayInfoPtr CreateVRDisplayInfo(ovrSession session) { mojom::VRDisplayInfoPtr display_info = mojom::VRDisplayInfo::New(); - display_info->id = id; ovrHmdDesc hmdDesc = ovr_GetHmdDesc(session); display_info->left_eye = GetEyeDetails(session, hmdDesc, ovrEye_Left); @@ -174,7 +172,7 @@ return false; } - SetVRDisplayInfo(CreateVRDisplayInfo(GetId(), session_)); + SetVRDisplayInfo(CreateVRDisplayInfo(session_)); have_real_display_info_ = true; } return have_real_display_info_;
diff --git a/device/vr/openxr/openxr_device.cc b/device/vr/openxr/openxr_device.cc index dd2542e..bab86430 100644 --- a/device/vr/openxr/openxr_device.cc +++ b/device/vr/openxr/openxr_device.cc
@@ -27,11 +27,9 @@ // However our mojo interface expects display info right away to support WebVR. // We create a fake display info to use, then notify the client that the display // info changed when we get real data. -mojom::VRDisplayInfoPtr CreateFakeVRDisplayInfo(device::mojom::XRDeviceId id) { +mojom::VRDisplayInfoPtr CreateFakeVRDisplayInfo() { mojom::VRDisplayInfoPtr display_info = mojom::VRDisplayInfo::New(); - display_info->id = id; - display_info->left_eye = mojom::VREyeParameters::New(); display_info->right_eye = mojom::VREyeParameters::New(); @@ -61,7 +59,7 @@ : VRDeviceBase(device::mojom::XRDeviceId::OPENXR_DEVICE_ID), instance_(openxr_statics->GetXrInstance()), weak_ptr_factory_(this) { - mojom::VRDisplayInfoPtr display_info = CreateFakeVRDisplayInfo(GetId()); + mojom::VRDisplayInfoPtr display_info = CreateFakeVRDisplayInfo(); SetVRDisplayInfo(std::move(display_info)); #if defined(OS_WIN)
diff --git a/device/vr/openxr/openxr_render_loop.cc b/device/vr/openxr/openxr_render_loop.cc index 6d37f40..de8f53b 100644 --- a/device/vr/openxr/openxr_render_loop.cc +++ b/device/vr/openxr/openxr_render_loop.cc
@@ -168,8 +168,6 @@ current_display_info_->left_eye = mojom::VREyeParameters::New(); } - current_display_info_->id = device::mojom::XRDeviceId::OPENXR_DEVICE_ID; - gfx::Size view_size = openxr_->GetViewSize(); current_display_info_->left_eye->render_width = view_size.width(); current_display_info_->right_eye->render_width = view_size.width();
diff --git a/device/vr/orientation/orientation_device.cc b/device/vr/orientation/orientation_device.cc index 571f36d..0c1ca10 100644 --- a/device/vr/orientation/orientation_device.cc +++ b/device/vr/orientation/orientation_device.cc
@@ -27,12 +27,6 @@ namespace { static constexpr int kDefaultPumpFrequencyHz = 60; -mojom::VRDisplayInfoPtr CreateVRDisplayInfo(mojom::XRDeviceId id) { - mojom::VRDisplayInfoPtr display_info = mojom::VRDisplayInfo::New(); - display_info->id = id; - return display_info; -} - display::Display::Rotation GetRotation() { display::Screen* screen = display::Screen::GetScreen(); if (!screen) { @@ -54,7 +48,7 @@ base::BindOnce(&VROrientationDevice::SensorReady, base::Unretained(this))); - SetVRDisplayInfo(CreateVRDisplayInfo(GetId())); + SetVRDisplayInfo(mojom::VRDisplayInfo::New()); } VROrientationDevice::~VROrientationDevice() {
diff --git a/device/vr/public/mojom/vr_service.mojom b/device/vr/public/mojom/vr_service.mojom index d715e03..917d3192 100644 --- a/device/vr/public/mojom/vr_service.mojom +++ b/device/vr/public/mojom/vr_service.mojom
@@ -298,7 +298,6 @@ }; struct VRDisplayInfo { - XRDeviceId id; VRStageParameters? stage_parameters; // Parameters required to distort a scene for viewing in a VR headset. Only // required for devices which have the can_present capability.
diff --git a/device/vr/test/fake_vr_device.cc b/device/vr/test/fake_vr_device.cc index 48fb681..2d8ad8e 100644 --- a/device/vr/test/fake_vr_device.cc +++ b/device/vr/test/fake_vr_device.cc
@@ -17,8 +17,6 @@ mojom::VRDisplayInfoPtr FakeVRDevice::InitBasicDevice() { mojom::VRDisplayInfoPtr display_info = mojom::VRDisplayInfo::New(); - display_info->id = GetId(); - display_info->left_eye = InitEye(45, -0.03f, 1024); display_info->right_eye = InitEye(45, 0.03f, 1024); return display_info;
diff --git a/device/vr/vr_device_base.cc b/device/vr/vr_device_base.cc index 099ac435..d72cb09 100644 --- a/device/vr/vr_device_base.cc +++ b/device/vr/vr_device_base.cc
@@ -66,7 +66,6 @@ void VRDeviceBase::SetVRDisplayInfo(mojom::VRDisplayInfoPtr display_info) { DCHECK(display_info); - DCHECK(display_info->id == id_); display_info_ = std::move(display_info); if (listener_)
diff --git a/device/vr/vr_device_base_unittest.cc b/device/vr/vr_device_base_unittest.cc index 7a911a2..c72e8dd 100644 --- a/device/vr/vr_device_base_unittest.cc +++ b/device/vr/vr_device_base_unittest.cc
@@ -72,16 +72,10 @@ std::unique_ptr<VRDeviceBaseForTesting> MakeVRDevice() { std::unique_ptr<VRDeviceBaseForTesting> device = std::make_unique<VRDeviceBaseForTesting>(); - device->SetVRDisplayInfoForTest(MakeVRDisplayInfo(device->GetId())); + device->SetVRDisplayInfoForTest(mojom::VRDisplayInfo::New()); return device; } - mojom::VRDisplayInfoPtr MakeVRDisplayInfo(mojom::XRDeviceId device_id) { - mojom::VRDisplayInfoPtr display_info = mojom::VRDisplayInfo::New(); - display_info->id = device_id; - return display_info; - } - base::test::SingleThreadTaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(VRDeviceTest); @@ -99,7 +93,7 @@ base::DoNothing()); // TODO: consider getting initial info base::RunLoop().RunUntilIdle(); EXPECT_CALL(listener, DoOnChanged(testing::_)).Times(1); - device->SetVRDisplayInfoForTest(MakeVRDisplayInfo(device->GetId())); + device->SetVRDisplayInfoForTest(mojom::VRDisplayInfo::New()); base::RunLoop().RunUntilIdle(); }
diff --git a/device/vr/windows_mixed_reality/mixed_reality_device.cc b/device/vr/windows_mixed_reality/mixed_reality_device.cc index 24fe7d01..4a1dde0d 100644 --- a/device/vr/windows_mixed_reality/mixed_reality_device.cc +++ b/device/vr/windows_mixed_reality/mixed_reality_device.cc
@@ -27,9 +27,8 @@ // However our mojo interface expects display info right away to support WebVR. // We create a fake display info to use, then notify the client that the display // info changed when we get real data. -mojom::VRDisplayInfoPtr CreateFakeVRDisplayInfo(device::mojom::XRDeviceId id) { +mojom::VRDisplayInfoPtr CreateFakeVRDisplayInfo() { mojom::VRDisplayInfoPtr display_info = mojom::VRDisplayInfo::New(); - display_info->id = id; display_info->left_eye = mojom::VREyeParameters::New(); display_info->right_eye = mojom::VREyeParameters::New(); @@ -56,7 +55,7 @@ MixedRealityDevice::MixedRealityDevice() : VRDeviceBase(device::mojom::XRDeviceId::WINDOWS_MIXED_REALITY_ID) { - SetVRDisplayInfo(CreateFakeVRDisplayInfo(GetId())); + SetVRDisplayInfo(CreateFakeVRDisplayInfo()); } MixedRealityDevice::~MixedRealityDevice() {
diff --git a/device/vr/windows_mixed_reality/mixed_reality_renderloop.cc b/device/vr/windows_mixed_reality/mixed_reality_renderloop.cc index 7524e7b..77d83ab1 100644 --- a/device/vr/windows_mixed_reality/mixed_reality_renderloop.cc +++ b/device/vr/windows_mixed_reality/mixed_reality_renderloop.cc
@@ -671,8 +671,6 @@ if (!current_display_info_) { current_display_info_ = mojom::VRDisplayInfo::New(); - current_display_info_->id = - device::mojom::XRDeviceId::WINDOWS_MIXED_REALITY_ID; changed = true; }
diff --git a/docs/workflow/debugging-with-swarming.md b/docs/workflow/debugging-with-swarming.md index 553c54a..ace0bb8 100644 --- a/docs/workflow/debugging-with-swarming.md +++ b/docs/workflow/debugging-with-swarming.md
@@ -152,10 +152,15 @@ ## Authenticating -You may need to log in to `https://isolateserver.appspot.com` to do this: +You may need to log in to `https://chromium-swarm.appspot.com` to do this +(for now you need to authenticate with python too, +TODO(https://crbug.com/984869): remove this): + ``` $ tools/luci-go/isolate login +$ python tools/swarming_client/auth.py login \ + --service=https://chromium-swarm.appspot.com ``` Use your google.com account for this.
diff --git a/extensions/common/identifiability_metrics.cc b/extensions/common/identifiability_metrics.cc index fe6835a5..dd1128ae 100644 --- a/extensions/common/identifiability_metrics.cc +++ b/extensions/common/identifiability_metrics.cc
@@ -7,16 +7,14 @@ #include "extensions/common/extension_set.h" #include "services/metrics/public/cpp/ukm_recorder.h" #include "third_party/blink/public/common/privacy_budget/identifiability_metric_builder.h" -#include "third_party/blink/public/common/privacy_budget/identifiability_metrics.h" namespace extensions { blink::IdentifiableSurface SurfaceForExtension( blink::IdentifiableSurface::Type type, const ExtensionId& extension_id) { - return blink::IdentifiableSurface::FromTypeAndInput( - type, blink::IdentifiabilityDigestOfBytes( - base::as_bytes(base::make_span(extension_id)))); + return blink::IdentifiableSurface::FromTypeAndToken( + type, base::as_bytes(base::make_span(extension_id))); } void RecordExtensionResourceAccessResult(base::UkmSourceId ukm_source_id, @@ -30,7 +28,7 @@ .Set(SurfaceForExtension( blink::IdentifiableSurface::Type::kExtensionFileAccess, extension_id), - blink::IdentifiabilityDigestHelper(result)) + result) .Record(ukm::UkmRecorder::Get()); } @@ -42,7 +40,7 @@ .Set(SurfaceForExtension( blink::IdentifiableSurface::Type::kExtensionContentScript, extension_id), - blink::IdentifiabilityDigestHelper(true)) + /* Succeeded= */ true) .Record(ukm::UkmRecorder::Get()); } @@ -54,7 +52,7 @@ .Set(SurfaceForExtension( blink::IdentifiableSurface::Type::kExtensionCancelRequest, extension_id), - blink::IdentifiabilityDigestHelper(true)) + /* Succeeded= */ true) .Record(ukm::UkmRecorder::Get()); }
diff --git a/extensions/renderer/api/automation/automation_ax_tree_wrapper.cc b/extensions/renderer/api/automation/automation_ax_tree_wrapper.cc index a374f7dd..1fffef3 100644 --- a/extensions/renderer/api/automation/automation_ax_tree_wrapper.cc +++ b/extensions/renderer/api/automation/automation_ax_tree_wrapper.cc
@@ -44,6 +44,9 @@ bool AutomationAXTreeWrapper::OnAccessibilityEvents( const ExtensionMsg_AccessibilityEventBundleParams& event_bundle, bool is_active_profile) { + TRACE_EVENT0("accessibility", + "AutomationAXTreeWrapper::OnAccessibilityEvents"); + base::Optional<gfx::Rect> previous_accessibility_focused_global_bounds = owner_->GetAccessibilityFocusedLocation();
diff --git a/fuchsia/cast_streaming/BUILD.gn b/fuchsia/cast_streaming/BUILD.gn index 94d567cc..d68ca36 100644 --- a/fuchsia/cast_streaming/BUILD.gn +++ b/fuchsia/cast_streaming/BUILD.gn
@@ -15,6 +15,7 @@ "//media/mojo/mojom", "//mojo/public/cpp/system", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.web", + "//third_party/openscreen/src/cast/common:public", "//third_party/openscreen/src/cast/streaming:receiver", "//third_party/openscreen/src/platform:api", "//third_party/openscreen/src/util",
diff --git a/fuchsia/cast_streaming/cast_message_port_impl.cc b/fuchsia/cast_streaming/cast_message_port_impl.cc index 0e82945..680e7bf 100644 --- a/fuchsia/cast_streaming/cast_message_port_impl.cc +++ b/fuchsia/cast_streaming/cast_message_port_impl.cc
@@ -85,13 +85,13 @@ // Creates a WebMessage out of the |sender_id|, |message_namespace| and // |message|. -fuchsia::web::WebMessage CreateWebMessage(absl::string_view sender_id, - absl::string_view message_namespace, - absl::string_view message) { +fuchsia::web::WebMessage CreateWebMessage(const std::string& sender_id, + const std::string& message_namespace, + const std::string& message) { base::Value value(base::Value::Type::DICTIONARY); - value.SetStringKey(kKeyNamespace, std::string(message_namespace)); - value.SetStringKey(kKeySenderId, std::string(sender_id)); - value.SetStringKey(kKeyData, std::string(message)); + value.SetStringKey(kKeyNamespace, message_namespace); + value.SetStringKey(kKeySenderId, sender_id); + value.SetStringKey(kKeyData, message); std::string json_message; CHECK(base::JSONWriter::Write(value, &json_message)); @@ -148,7 +148,8 @@ } void CastMessagePortImpl::SetClient( - openscreen::cast::MessagePort::Client* client) { + openscreen::cast::MessagePort::Client* client, + std::string client_sender_id) { DVLOG(2) << __func__; DCHECK_NE(!client_, !client); client_ = client; @@ -156,9 +157,14 @@ MaybeCloseWithEpitaph(ZX_OK); } -void CastMessagePortImpl::PostMessage(absl::string_view sender_id, - absl::string_view message_namespace, - absl::string_view message) { +void CastMessagePortImpl::ResetClient() { + client_ = nullptr; + MaybeCloseWithEpitaph(ZX_OK); +} + +void CastMessagePortImpl::PostMessage(const std::string& sender_id, + const std::string& message_namespace, + const std::string& message) { DVLOG(3) << __func__; if (!message_port_binding_.is_bound()) return;
diff --git a/fuchsia/cast_streaming/cast_message_port_impl.h b/fuchsia/cast_streaming/cast_message_port_impl.h index e5ce884..f591d6c 100644 --- a/fuchsia/cast_streaming/cast_message_port_impl.h +++ b/fuchsia/cast_streaming/cast_message_port_impl.h
@@ -9,7 +9,7 @@ #include <lib/fidl/cpp/binding.h> #include "base/containers/circular_deque.h" -#include "third_party/openscreen/src/cast/streaming/message_port.h" +#include "third_party/openscreen/src/cast/common/public/message_port.h" namespace cast_streaming { @@ -26,10 +26,11 @@ CastMessagePortImpl& operator=(const CastMessagePortImpl&) = delete; // openscreen::cast::MessagePort implementation. - void SetClient(Client* client) final; - void PostMessage(absl::string_view sender_id, - absl::string_view message_namespace, - absl::string_view message) final; + void SetClient(Client* client, std::string client_sender_id) final; + void ResetClient() final; + void PostMessage(const std::string& sender_id, + const std::string& message_namespace, + const std::string& message) final; private: // Sends one message in |pending_fidl_messages_| if
diff --git a/fuchsia/cast_streaming/cast_streaming_session.cc b/fuchsia/cast_streaming/cast_streaming_session.cc index 14613e1..3e5d348a 100644 --- a/fuchsia/cast_streaming/cast_streaming_session.cc +++ b/fuchsia/cast_streaming/cast_streaming_session.cc
@@ -50,15 +50,14 @@ cast_message_port_impl_(std::move(message_port_request)), // TODO(crbug.com/1087520): Add streaming session Constraints and // DisplayDescription. - receiver_session_( - this, - &environment_, - &cast_message_port_impl_, - openscreen::cast::ReceiverSession::Preferences( - {openscreen::cast::ReceiverSession::VideoCodec::kH264, - openscreen::cast::ReceiverSession::VideoCodec::kVp8}, - {openscreen::cast::ReceiverSession::AudioCodec::kAac, - openscreen::cast::ReceiverSession::AudioCodec::kOpus})), + receiver_session_(this, + &environment_, + &cast_message_port_impl_, + openscreen::cast::ReceiverSession::Preferences( + {openscreen::cast::VideoCodec::kH264, + openscreen::cast::VideoCodec::kVp8}, + {openscreen::cast::AudioCodec::kAac, + openscreen::cast::AudioCodec::kOpus})), client_(client) { DCHECK(task_runner); DCHECK(client_);
diff --git a/google_apis/gcm/engine/checkin_request.cc b/google_apis/gcm/engine/checkin_request.cc index 7094057..09abcb73 100644 --- a/google_apis/gcm/engine/checkin_request.cc +++ b/google_apis/gcm/engine/checkin_request.cc
@@ -138,7 +138,7 @@ checkin_proto::AndroidCheckinProto* checkin = request.mutable_checkin(); checkin->mutable_chrome_build()->CopyFrom(request_info_.chrome_build_proto); -#if defined(CHROME_OS) +#if defined(OS_CHROMEOS) checkin->set_type(checkin_proto::DEVICE_CHROME_OS); #else checkin->set_type(checkin_proto::DEVICE_CHROME_BROWSER);
diff --git a/google_apis/gcm/engine/checkin_request_unittest.cc b/google_apis/gcm/engine/checkin_request_unittest.cc index 92087f9f..455d4a9 100644 --- a/google_apis/gcm/engine/checkin_request_unittest.cc +++ b/google_apis/gcm/engine/checkin_request_unittest.cc
@@ -153,7 +153,7 @@ EXPECT_EQ(kEmailAddress, request_proto.account_cookie(0)); EXPECT_EQ(kTokenValue, request_proto.account_cookie(1)); -#if defined(CHROME_OS) +#if defined(OS_CHROMEOS) EXPECT_EQ(checkin_proto::DEVICE_CHROME_OS, request_proto.checkin().type()); #else EXPECT_EQ(checkin_proto::DEVICE_CHROME_BROWSER,
diff --git a/gpu/vulkan/x/vulkan_surface_x11.cc b/gpu/vulkan/x/vulkan_surface_x11.cc index 5b18ec84..9fd781db 100644 --- a/gpu/vulkan/x/vulkan_surface_x11.cc +++ b/gpu/vulkan/x/vulkan_surface_x11.cc
@@ -113,10 +113,10 @@ gfx::OverlayTransform pre_transform) { DCHECK_EQ(pre_transform, gfx::OVERLAY_TRANSFORM_NONE); - Display* display = gfx::GetXDisplay(); - XResizeWindow(display, static_cast<uint32_t>(window_), size.width(), - size.height()); - XFlush(display); + auto* connection = x11::Connection::Get(); + connection->ConfigureWindow( + {.window = window_, .width = size.width(), .height = size.height()}); + connection->Flush(); return VulkanSurface::Reshape(size, pre_transform); }
diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn index f5279e1..5e4dc90 100644 --- a/media/audio/BUILD.gn +++ b/media/audio/BUILD.gn
@@ -41,7 +41,6 @@ visibility = [ ":wav_audio_handler_fuzzer", "//media", - "//media/renderers", # TODO(dalecurtis): CoreAudioUtil::IsCoreAudioSupported() should probably @@ -85,6 +84,8 @@ "audio_manager.h", "audio_manager_base.cc", "audio_manager_base.h", + "audio_opus_encoder.cc", + "audio_opus_encoder.h", "audio_output_delegate.cc", "audio_output_delegate.h", "audio_output_device.cc", @@ -103,6 +104,8 @@ "audio_output_resampler.h", "audio_output_stream_sink.cc", "audio_output_stream_sink.h", + "audio_pcm_encoder.cc", + "audio_pcm_encoder.h", "audio_sink_parameters.cc", "audio_sink_parameters.h", "audio_source_diverter.h", @@ -144,6 +147,7 @@ "//base", "//build:chromecast_buildflags", "//media/base", + "//third_party/opus:opus", "//url", ] libs = [] @@ -269,10 +273,10 @@ ] deps += [ "//chromeos/audio" ] } else if (is_linux) { - sources += [ - "cras/audio_manager_cras.cc", - "cras/audio_manager_cras.h", - ] + sources += [ + "cras/audio_manager_cras.cc", + "cras/audio_manager_cras.h", + ] } } @@ -379,6 +383,7 @@ "audio_debug_recording_helper_unittest.cc", "audio_debug_recording_manager_unittest.cc", "audio_debug_recording_session_impl_unittest.cc", + "audio_encoders_unittest.cc", "audio_input_device_unittest.cc", "audio_input_stream_data_interceptor_unittest.cc", "audio_input_unittest.cc", @@ -398,6 +403,7 @@ "//media:test_support", "//testing/gmock", "//testing/gtest", + "//third_party/opus:opus", "//url", ]
diff --git a/media/audio/audio_encoders_unittest.cc b/media/audio/audio_encoders_unittest.cc new file mode 100644 index 0000000..78b4d4ef --- /dev/null +++ b/media/audio/audio_encoders_unittest.cc
@@ -0,0 +1,211 @@ +// Copyright 2020 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 <cstring> +#include <memory> +#include <utility> +#include <vector> + +#include "base/bind.h" +#include "base/time/time.h" +#include "media/audio/audio_opus_encoder.h" +#include "media/audio/audio_pcm_encoder.h" +#include "media/audio/simple_sources.h" +#include "media/base/audio_encoder.h" +#include "media/base/audio_parameters.h" +#include "media/base/status.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/opus/src/include/opus.h" + +namespace media { + +namespace { + +constexpr int kAudioSampleRate = 48000; + +constexpr base::TimeDelta kBufferDuration = + base::TimeDelta::FromMilliseconds(10); + +// This is the preferred opus buffer duration (60 ms), which corresponds to a +// value of 2880 frames per buffer (|kOpusFramesPerBuffer|). +constexpr base::TimeDelta kOpusBufferDuration = + base::TimeDelta::FromMilliseconds(60); +constexpr int kOpusFramesPerBuffer = kOpusBufferDuration.InMicroseconds() * + kAudioSampleRate / + base::Time::kMicrosecondsPerSecond; + +struct TestAudioParams { + const media::AudioParameters::Format format; + const media::ChannelLayout channel_layout; + const int sample_rate; +}; + +constexpr TestAudioParams kTestAudioParams[] = { + {media::AudioParameters::AUDIO_PCM_LOW_LATENCY, + media::CHANNEL_LAYOUT_STEREO, kAudioSampleRate}, + // Change to mono: + {media::AudioParameters::AUDIO_PCM_LOW_LATENCY, media::CHANNEL_LAYOUT_MONO, + kAudioSampleRate}, + // Different sampling rate as well: + {media::AudioParameters::AUDIO_PCM_LOW_LATENCY, media::CHANNEL_LAYOUT_MONO, + 24000}, + {media::AudioParameters::AUDIO_PCM_LOW_LATENCY, + media::CHANNEL_LAYOUT_STEREO, 8000}, + // Using a non-default Opus sampling rate (48, 24, 16, 12, or 8 kHz). + {media::AudioParameters::AUDIO_PCM_LOW_LATENCY, media::CHANNEL_LAYOUT_MONO, + 22050}, + {media::AudioParameters::AUDIO_PCM_LOW_LATENCY, + media::CHANNEL_LAYOUT_STEREO, 44100}, + {media::AudioParameters::AUDIO_PCM_LOW_LATENCY, + media::CHANNEL_LAYOUT_STEREO, 96000}, + {media::AudioParameters::AUDIO_PCM_LOW_LATENCY, media::CHANNEL_LAYOUT_MONO, + kAudioSampleRate}, + {media::AudioParameters::AUDIO_PCM_LOW_LATENCY, + media::CHANNEL_LAYOUT_STEREO, kAudioSampleRate}, +}; + +} // namespace + +class AudioEncodersTest : public ::testing::TestWithParam<TestAudioParams> { + public: + AudioEncodersTest() + : input_params_(GetParam().format, + GetParam().channel_layout, + GetParam().sample_rate, + GetParam().sample_rate / 100), + audio_source_(input_params_.channels(), + /*freq=*/440, + input_params_.sample_rate()) {} + AudioEncodersTest(const AudioEncodersTest&) = delete; + AudioEncodersTest& operator=(const AudioEncodersTest&) = delete; + ~AudioEncodersTest() override = default; + + const AudioParameters& input_params() const { return input_params_; } + const AudioEncoder* encoder() const { return encoder_.get(); } + int encode_callback_count() const { return encode_callback_count_; } + + void SetEncoder(std::unique_ptr<AudioEncoder> encoder) { + encoder_ = std::move(encoder); + encode_callback_count_ = 0; + } + + // Produces an audio data that corresponds to a |kBufferDuration| and the + // sample rate of the current |input_params_|. The produced data is send to + // |encoder_| to be encoded, and the number of frames generated is returned. + int ProduceAudioAndEncode() { + DCHECK(encoder_); + const int num_frames = + input_params_.sample_rate() * kBufferDuration.InSecondsF(); + current_audio_bus_ = + media::AudioBus::Create(input_params_.channels(), num_frames); + const auto capture_time = base::TimeTicks::Now(); + audio_source_.OnMoreData(base::TimeDelta(), capture_time, 0, + current_audio_bus_.get()); + encoder_->EncodeAudio(*current_audio_bus_, capture_time); + return num_frames; + } + + // Used to verify we get no errors. + void OnErrorCallback(Status error) { FAIL() << error.message(); } + + // Used as the callback of the PCM encoder. + void VerifyPcmEncoding(EncodedAudioBuffer output) { + DCHECK(current_audio_bus_); + ++encode_callback_count_; + // Verify that PCM doesn't change the input; i.e. it's just a pass through. + size_t uncompressed_size = current_audio_bus_->frames() * + current_audio_bus_->channels() * sizeof(float); + ASSERT_EQ(uncompressed_size, output.encoded_data_size); + std::unique_ptr<uint8_t[]> uncompressed_audio_data( + new uint8_t[uncompressed_size]); + current_audio_bus_->ToInterleaved<Float32SampleTypeTraits>( + current_audio_bus_->frames(), + reinterpret_cast<float*>(uncompressed_audio_data.get())); + EXPECT_EQ(std::memcmp(uncompressed_audio_data.get(), + output.encoded_data.get(), uncompressed_size), + 0); + } + + // Used as the callback of the Opus encoder. + void VerifyOpusEncoding(OpusDecoder* opus_decoder, + EncodedAudioBuffer output) { + DCHECK(current_audio_bus_); + DCHECK(opus_decoder); + + ++encode_callback_count_; + // Use the provied |opus_decoder| to decode the |encoded_data| and check we + // get the expected number of frames per buffer. + std::vector<float> buffer(kOpusFramesPerBuffer * output.params.channels()); + EXPECT_EQ(kOpusFramesPerBuffer, + opus_decode_float(opus_decoder, output.encoded_data.get(), + output.encoded_data_size, buffer.data(), + kOpusFramesPerBuffer, 0)); + } + + private: + // The input params as initialized from the test's parameter. + const AudioParameters input_params_; + + // The audio source used to fill in the data of the |current_audio_bus_|. + media::SineWaveAudioSource audio_source_; + + // The encoder the test is verifying. + std::unique_ptr<AudioEncoder> encoder_; + + // The audio bus that was most recently generated and sent to the |encoder_| + // by ProduceAudioAndEncode(). + std::unique_ptr<media::AudioBus> current_audio_bus_; + + // The number of encoder callbacks received. + int encode_callback_count_ = 0; +}; + +TEST_P(AudioEncodersTest, PcmEncoder) { + SetEncoder(std::make_unique<AudioPcmEncoder>( + input_params(), + base::BindRepeating(&AudioEncodersTest::VerifyPcmEncoding, + base::Unretained(this)), + base::BindRepeating(&AudioEncodersTest::OnErrorCallback, + base::Unretained(this)))); + + constexpr int kCount = 6; + for (int i = 0; i < kCount; ++i) + ProduceAudioAndEncode(); + + EXPECT_EQ(kCount, encode_callback_count()); +} + +TEST_P(AudioEncodersTest, OpusEncoder) { + int error; + OpusDecoder* opus_decoder = + opus_decoder_create(kAudioSampleRate, input_params().channels(), &error); + ASSERT_TRUE(error == OPUS_OK && opus_decoder); + + SetEncoder(std::make_unique<AudioOpusEncoder>( + input_params(), + base::BindRepeating(&AudioEncodersTest::VerifyOpusEncoding, + base::Unretained(this), opus_decoder), + base::BindRepeating(&AudioEncodersTest::OnErrorCallback, + base::Unretained(this)), + /*opus_bitrate=*/0)); + + // The opus encoder encodes in multiple of 60 ms. Wait for the total number of + // frames that will be generated in 60 ms at the input sampling rate. + const int frames_in_60_ms = + kOpusBufferDuration.InSecondsF() * input_params().sample_rate(); + int total_frames = 0; + while (total_frames < frames_in_60_ms) + total_frames += ProduceAudioAndEncode(); + + EXPECT_EQ(1, encode_callback_count()); + + opus_decoder_destroy(opus_decoder); + opus_decoder = nullptr; +} + +INSTANTIATE_TEST_SUITE_P(All, + AudioEncodersTest, + testing::ValuesIn(kTestAudioParams)); + +} // namespace media
diff --git a/media/audio/audio_opus_encoder.cc b/media/audio/audio_opus_encoder.cc new file mode 100644 index 0000000..2861653 --- /dev/null +++ b/media/audio/audio_opus_encoder.cc
@@ -0,0 +1,243 @@ +// Copyright 2020 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 "media/audio/audio_opus_encoder.h" + +#include <utility> + +#include "base/bind.h" +#include "base/logging.h" +#include "base/stl_util.h" +#include "base/strings/stringprintf.h" +#include "media/base/status.h" +#include "media/base/status_codes.h" + +namespace media { + +namespace { + +// Recommended value for opus_encode_float(), according to documentation in +// third_party/opus/src/include/opus.h, so that the Opus encoder does not +// degrade the audio due to memory constraints, and is independent of the +// duration of the encoded buffer. +constexpr int kOpusMaxDataBytes = 4000; + +// Opus preferred sampling rate for encoding. This is also the one WebM likes +// to have: https://wiki.xiph.org/MatroskaOpus. +constexpr int kOpusPreferredSamplingRate = 48000; + +// For Opus, we try to encode 60ms, the maximum Opus buffer, for quality +// reasons. +constexpr int kOpusPreferredBufferDurationMs = 60; + +// The amount of Frames in a 60 ms buffer @ 48000 samples/second. +constexpr int kOpusPreferredFramesPerBuffer = + kOpusPreferredSamplingRate * kOpusPreferredBufferDurationMs / + base::Time::kMillisecondsPerSecond; + +// Deletes the libopus encoder instance pointed to by |encoder_ptr|. +inline void OpusEncoderDeleter(OpusEncoder* encoder_ptr) { + opus_encoder_destroy(encoder_ptr); +} + +// Adjusts the given input |params| to have a frames-per-buffer value that +// matches that of the FIFO which buffers the input audio before sending it to +// the converter. +AudioParameters AdjustInputParamsForOpus(const AudioParameters& params) { + auto adjusted_params = params; + adjusted_params.set_frames_per_buffer(params.sample_rate() * + kOpusPreferredBufferDurationMs / + base::Time::kMillisecondsPerSecond); + return adjusted_params; +} + +// Creates the audio parameters of the converted audio format that Opus prefers, +// which will be used as the input to the libopus encoder. +AudioParameters CreateOpusInputParams(const AudioParameters& input_params) { + // third_party/libopus supports up to 2 channels (see implementation of + // opus_encoder_create()): force |converted_params| to at most those. + // Also, the libopus encoder can accept sample rates of 8, 12, 16, 24, and the + // default preferred 48 kHz. If the input sample rate is anything else, we'll + // use 48 kHz. + const int input_rate = input_params.sample_rate(); + const int used_rate = (input_rate == 8000 || input_rate == 12000 || + input_rate == 16000 || input_rate == 24000) + ? input_rate + : kOpusPreferredSamplingRate; + const int frames_per_buffer = used_rate * kOpusPreferredBufferDurationMs / + base::Time::kMillisecondsPerSecond; + + const auto converted_params = + AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, + GuessChannelLayout(std::min(input_params.channels(), 2)), + used_rate, frames_per_buffer); + DVLOG(1) << "|input_params|:" << input_params.AsHumanReadableString() + << " -->|converted_params|:" + << converted_params.AsHumanReadableString(); + DCHECK(converted_params.IsValid()); + + return converted_params; +} + +// Creates and returns the libopus encoder instance. Returns nullptr if the +// encoder creation fails. +OwnedOpusEncoder CreateOpusEncoder( + const AudioEncoder::StatusCB& status_callback, + const AudioParameters& params, + int32_t bitrate) { + int opus_result; + OwnedOpusEncoder encoder( + opus_encoder_create(params.sample_rate(), params.channels(), + OPUS_APPLICATION_AUDIO, &opus_result), + OpusEncoderDeleter); + + if (opus_result < 0) { + status_callback.Run(Status( + StatusCode::kEncoderInitializationError, + base::StringPrintf( + "Couldn't init Opus encoder: %s, sample rate: %d, channels: %d", + opus_strerror(opus_result), params.sample_rate(), + params.channels()))); + } + + if (encoder && + opus_encoder_ctl(encoder.get(), OPUS_SET_BITRATE(bitrate)) != OPUS_OK) { + status_callback.Run( + Status(StatusCode::kEncoderInitializationError, + base::StringPrintf("Failed to set Opus bitrate: %d", bitrate))); + encoder.reset(); + } + + return encoder; +} + +// Tries to encode |in_data|'s |num_samples| into |out_data|. |out_data| is +// always resized to |kOpusMaxDataBytes| but only filled with |*out_size| actual +// encoded data if encoding was successful. Returns true if encoding is +// successful, in which case |*out_size| is guaranteed to be > 1. Returns false +// if an error occurs or the packet does not need to be transmitted. +// |status_callback| will be used to report any errors. +bool DoEncode(const AudioEncoder::StatusCB& status_callback, + OpusEncoder* opus_encoder, + float* in_data, + int num_samples, + std::unique_ptr<uint8_t[]>* out_data, + size_t* out_size) { + DCHECK(opus_encoder); + DCHECK(in_data); + DCHECK(out_data); + DCHECK(out_size); + DCHECK_LE(num_samples, kOpusPreferredFramesPerBuffer); + + out_data->reset(new uint8_t[kOpusMaxDataBytes]); + const opus_int32 result = opus_encode_float( + opus_encoder, in_data, num_samples, out_data->get(), kOpusMaxDataBytes); + + if (result > 1) { + // TODO(ajose): Investigate improving this. http://crbug.com/547918 + *out_size = result; + return true; + } + + // If |result| in {0,1}, do nothing; the documentation says that a return + // value of zero or one means the packet does not need to be transmitted. + // Otherwise, we have an error. + if (result < 0) { + status_callback.Run( + Status(StatusCode::kEncoderFailedEncode, opus_strerror(result))); + } + + return false; +} + +// During this object's lifetime, it will use its |audio_bus_| to provide input +// to its |converter_|. +class ScopedConverterInputProvider : public AudioConverter::InputCallback { + public: + ScopedConverterInputProvider(AudioConverter* converter, + const AudioBus* audio_bus) + : converter_(converter), audio_bus_(audio_bus) { + DCHECK(converter_); + DCHECK(audio_bus_); + converter_->AddInput(this); + } + ScopedConverterInputProvider(const ScopedConverterInputProvider&) = delete; + ScopedConverterInputProvider& operator=(const ScopedConverterInputProvider&) = + delete; + ~ScopedConverterInputProvider() override { converter_->RemoveInput(this); } + + // AudioConverted::InputCallback: + double ProvideInput(AudioBus* audio_bus, uint32_t frames_delayed) override { + audio_bus_->CopyTo(audio_bus); + return 1.0f; + } + + private: + AudioConverter* const converter_; + const AudioBus* const audio_bus_; +}; + +} // namespace + +AudioOpusEncoder::AudioOpusEncoder(const AudioParameters& input_params, + EncodeCB encode_callback, + StatusCB status_callback, + int32_t opus_bitrate) + : AudioEncoder(AdjustInputParamsForOpus(input_params), + std::move(encode_callback), + std::move(status_callback)), + bits_per_second_(opus_bitrate > 0 ? opus_bitrate : OPUS_AUTO), + converted_params_(CreateOpusInputParams(audio_input_params())), + converter_(audio_input_params(), + converted_params_, + /*disable_fifo=*/false), + fifo_(base::BindRepeating(&AudioOpusEncoder::OnFifoOutput, + base::Unretained(this))), + converted_audio_bus_( + AudioBus::Create(converted_params_.channels(), + converted_params_.frames_per_buffer())), + buffer_(converted_params_.channels() * + converted_params_.frames_per_buffer()), + opus_encoder_(CreateOpusEncoder(this->status_callback(), + converted_params_, + bits_per_second_)) { + converter_.PrimeWithSilence(); + fifo_.Reset(converter_.GetMaxInputFramesRequested( + converted_params_.frames_per_buffer())); +} + +AudioOpusEncoder::~AudioOpusEncoder() = default; + +void AudioOpusEncoder::EncodeAudioImpl(const AudioBus& audio_bus, + base::TimeTicks capture_time) { + // Initializing the opus encoder may have failed. + if (!opus_encoder_) + return; + + // The |fifo_| won't trigger OnFifoOutput() until we have enough frames + // suitable for the converter. + fifo_.Push(audio_bus); +} + +void AudioOpusEncoder::OnFifoOutput(const AudioBus& output_bus, + int frame_delay) { + // Provides input to the converter from |output_bus| within this scope only. + ScopedConverterInputProvider provider(&converter_, &output_bus); + converter_.Convert(converted_audio_bus_.get()); + converted_audio_bus_->ToInterleaved<Float32SampleTypeTraits>( + converted_audio_bus_->frames(), buffer_.data()); + + std::unique_ptr<uint8_t[]> encoded_data; + size_t encoded_data_size; + if (DoEncode(status_callback(), opus_encoder_.get(), buffer_.data(), + converted_params_.frames_per_buffer(), &encoded_data, + &encoded_data_size)) { + DCHECK_GT(encoded_data_size, 1u); + encode_callback().Run(EncodedAudioBuffer( + converted_params_, std::move(encoded_data), encoded_data_size, + ComputeTimestamp(output_bus.frames(), last_capture_time()))); + } +} + +} // namespace media
diff --git a/media/audio/audio_opus_encoder.h b/media/audio/audio_opus_encoder.h new file mode 100644 index 0000000..d4919ab --- /dev/null +++ b/media/audio/audio_opus_encoder.h
@@ -0,0 +1,77 @@ +// Copyright 2020 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 MEDIA_AUDIO_AUDIO_OPUS_ENCODER_H_ +#define MEDIA_AUDIO_AUDIO_OPUS_ENCODER_H_ + +#include <memory> +#include <vector> + +#include "media/base/audio_bus.h" +#include "media/base/audio_converter.h" +#include "media/base/audio_encoder.h" +#include "media/base/audio_push_fifo.h" +#include "third_party/opus/src/include/opus.h" + +namespace media { + +using OpusEncoderDeleterType = void (*)(OpusEncoder* encoder_ptr); +using OwnedOpusEncoder = std::unique_ptr<OpusEncoder, OpusEncoderDeleterType>; + +// Performs Opus encoding of the input audio. The input audio is converted to a +// a format suitable for Opus before it is passed to the libopus encoder +// instance to do the actual encoding. +class MEDIA_EXPORT AudioOpusEncoder : public AudioEncoder { + public: + AudioOpusEncoder(const AudioParameters& input_params, + EncodeCB encode_callback, + StatusCB status_callback, + int32_t opus_bitrate); + AudioOpusEncoder(const AudioOpusEncoder&) = delete; + AudioOpusEncoder& operator=(const AudioOpusEncoder&) = delete; + ~AudioOpusEncoder() override; + + protected: + // AudioEncoder: + void EncodeAudioImpl(const AudioBus& audio_bus, + base::TimeTicks capture_time) override; + + private: + // Called synchronously by |fifo_| once enough audio frames have been + // buffered. + void OnFifoOutput(const AudioBus& output_bus, int frame_delay); + + // Target bitrate for Opus. If 0, Opus-provided automatic bitrate is used. + // Note: As of 2013-10-31, the encoder in "auto bitrate" mode would use a + // variable bitrate up to 102 kbps for 2-channel, 48 kHz audio and a 10 ms + // buffer duration. The Opus library authors may, of course, adjust this in + // later versions. + const int32_t bits_per_second_; + + // Output parameters after audio conversion. This may differ from the input + // params in the number of channels, sample rate, and the frames per buffer. + // (See CreateOpusInputParams() in the .cc file for details). + AudioParameters converted_params_; + + // Sample rate adapter from the input audio to what OpusEncoder desires. + AudioConverter converter_; + + // Buffer for holding the original input audio before it goes to the + // converter. + AudioPushFifo fifo_; + + // This is the destination AudioBus where the |converter_| teh audio into. + std::unique_ptr<AudioBus> converted_audio_bus_; + + // Buffer for passing AudioBus data from the converter to the encoder. + std::vector<float> buffer_; + + // The actual libopus encoder instance. This is nullptr if creating the + // encoder fails. + OwnedOpusEncoder opus_encoder_; +}; + +} // namespace media + +#endif // MEDIA_AUDIO_AUDIO_OPUS_ENCODER_H_
diff --git a/media/audio/audio_pcm_encoder.cc b/media/audio/audio_pcm_encoder.cc new file mode 100644 index 0000000..103378a3 --- /dev/null +++ b/media/audio/audio_pcm_encoder.cc
@@ -0,0 +1,30 @@ +// Copyright 2020 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 "media/audio/audio_pcm_encoder.h" + +#include <utility> + +namespace media { + +AudioPcmEncoder::AudioPcmEncoder(const AudioParameters& input_params, + EncodeCB encode_callback, + StatusCB status_callback) + : AudioEncoder(input_params, + std::move(encode_callback), + std::move(status_callback)) {} + +void AudioPcmEncoder::EncodeAudioImpl(const AudioBus& audio_bus, + base::TimeTicks capture_time) { + const size_t size = audio_bus.frames() * audio_bus.channels() * sizeof(float); + std::unique_ptr<uint8_t[]> encoded_data(new uint8_t[size]); + audio_bus.ToInterleaved<Float32SampleTypeTraits>( + audio_bus.frames(), reinterpret_cast<float*>(encoded_data.get())); + + encode_callback().Run( + EncodedAudioBuffer(audio_input_params(), std::move(encoded_data), size, + ComputeTimestamp(audio_bus.frames(), capture_time))); +} + +} // namespace media
diff --git a/media/audio/audio_pcm_encoder.h b/media/audio/audio_pcm_encoder.h new file mode 100644 index 0000000..af3a519 --- /dev/null +++ b/media/audio/audio_pcm_encoder.h
@@ -0,0 +1,31 @@ +// Copyright 2020 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 MEDIA_AUDIO_AUDIO_PCM_ENCODER_H_ +#define MEDIA_AUDIO_AUDIO_PCM_ENCODER_H_ + +#include "media/base/audio_encoder.h" + +namespace media { + +// Defines a PCM encoder, which just passes back the raw uncompressed signed +// 16-bit linear audio data. +class MEDIA_EXPORT AudioPcmEncoder : public AudioEncoder { + public: + AudioPcmEncoder(const AudioParameters& input_params, + EncodeCB encode_callback, + StatusCB status_callback); + AudioPcmEncoder(const AudioPcmEncoder&) = delete; + AudioPcmEncoder& operator=(const AudioPcmEncoder&) = delete; + ~AudioPcmEncoder() override = default; + + protected: + // AudioEncoder: + void EncodeAudioImpl(const AudioBus& audio_bus, + base::TimeTicks capture_time) override; +}; + +} // namespace media + +#endif // MEDIA_AUDIO_AUDIO_PCM_ENCODER_H_
diff --git a/media/base/BUILD.gn b/media/base/BUILD.gn index fc8480d..d8a06df7 100644 --- a/media/base/BUILD.gn +++ b/media/base/BUILD.gn
@@ -57,6 +57,8 @@ "audio_decoder_config.h", "audio_discard_helper.cc", "audio_discard_helper.h", + "audio_encoder.cc", + "audio_encoder.h", "audio_fifo.cc", "audio_fifo.h", "audio_hash.cc",
diff --git a/media/base/audio_encoder.cc b/media/base/audio_encoder.cc new file mode 100644 index 0000000..0a9ca22e --- /dev/null +++ b/media/base/audio_encoder.cc
@@ -0,0 +1,71 @@ +// Copyright 2020 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 "media/base/audio_encoder.h" + +#include "base/logging.h" +#include "base/time/time.h" +#include "media/base/audio_timestamp_helper.h" + +namespace media { + +// ----------------------------------------------------------------------------- +// EncodedAudioBuffer: + +EncodedAudioBuffer::EncodedAudioBuffer(const AudioParameters& params, + std::unique_ptr<uint8_t[]> data, + size_t size, + base::TimeTicks timestamp) + : params(params), + encoded_data(std::move(data)), + encoded_data_size(size), + timestamp(timestamp) {} + +EncodedAudioBuffer::EncodedAudioBuffer(EncodedAudioBuffer&&) = default; + +EncodedAudioBuffer::~EncodedAudioBuffer() = default; + +// ----------------------------------------------------------------------------- +// AudioEncoder: + +AudioEncoder::AudioEncoder(const AudioParameters& input_params, + EncodeCB encode_callback, + StatusCB status_callback) + : audio_input_params_(input_params), + encode_callback_(std::move(encode_callback)), + status_callback_(std::move(status_callback)) { + DCHECK(audio_input_params_.IsValid()); + DCHECK(!encode_callback_.is_null()); + DCHECK(!status_callback_.is_null()); + DETACH_FROM_THREAD(thread_checker_); +} + +AudioEncoder::~AudioEncoder() = default; + +void AudioEncoder::EncodeAudio(const AudioBus& audio_bus, + base::TimeTicks capture_time) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_EQ(audio_bus.channels(), audio_input_params_.channels()); + DCHECK(!capture_time.is_null()); + + DLOG_IF(ERROR, + !last_capture_time_.is_null() && + ((capture_time - last_capture_time_).InSecondsF() > + 1.5f * audio_bus.frames() / audio_input_params().sample_rate())) + << "Possibly frames were skipped, which may result in inaccuarate " + "timestamp calculation."; + + last_capture_time_ = capture_time; + + EncodeAudioImpl(audio_bus, capture_time); +} + +base::TimeTicks AudioEncoder::ComputeTimestamp( + int num_frames, + base::TimeTicks capture_time) const { + return capture_time - AudioTimestampHelper::FramesToTime( + num_frames, audio_input_params_.sample_rate()); +} + +} // namespace media
diff --git a/media/base/audio_encoder.h b/media/base/audio_encoder.h new file mode 100644 index 0000000..e7ad866 --- /dev/null +++ b/media/base/audio_encoder.h
@@ -0,0 +1,112 @@ +// Copyright 2020 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 MEDIA_BASE_AUDIO_ENCODER_H_ +#define MEDIA_BASE_AUDIO_ENCODER_H_ + +#include <memory> + +#include "base/callback.h" +#include "base/threading/thread_checker.h" +#include "base/time/time.h" +#include "media/base/audio_bus.h" +#include "media/base/audio_parameters.h" +#include "media/base/media_export.h" +#include "media/base/status.h" + +namespace media { + +// Defines a move-only wrapper to hold the encoded audio data. +struct MEDIA_EXPORT EncodedAudioBuffer { + EncodedAudioBuffer(const AudioParameters& params, + std::unique_ptr<uint8_t[]> data, + size_t size, + base::TimeTicks timestamp); + EncodedAudioBuffer(EncodedAudioBuffer&&); + ~EncodedAudioBuffer(); + + // The audio parameters the encoder used to encode the input audio. They may + // differ from the original parameters given to the encoder initially, as the + // encoder may convert the audio to a format more suitable for encoding. + const AudioParameters params; + + // The buffer containing the encoded data. + std::unique_ptr<uint8_t[]> encoded_data; + + // The size of the encoded data in the above buffer. Note that this is not + // necessarily equal to the capacity of the buffer. Some encoders allocate a + // bigger buffer and fill it only with |encoded_data_size| data without + // bothering to allocate another shrunk buffer and copy the data in, since the + // number of encoded bytes may not be known in advance. + const size_t encoded_data_size; + + // The capture time of the first sample of the current AudioBus. + const base::TimeTicks timestamp; +}; + +// Defines an interface for audio encoders. Concrete encoders must implement the +// EncodeAudioImpl() function. +class MEDIA_EXPORT AudioEncoder { + public: + // Signature of the callback invoked to provide the encoded audio data. It is + // invoked on the same thread on which EncodeAudio() is called. The utility + // media::BindToCurrentLoop() can be used to create a callback that will be + // invoked on the same thread it is constructed on. + using EncodeCB = base::RepeatingCallback<void(EncodedAudioBuffer output)>; + + // Signature of the callback to report errors. + using StatusCB = base::RepeatingCallback<void(Status error)>; + + // Constructs the encoder given the audio parameters of the input to this + // encoder, and a callback to trigger to provide the encoded audio data. + // |input_params| must be valid, and |encode_callback| and |status_callback| + // must not be null callbacks. All calls to EncodeAudio() must happen on the + // same thread (usually an encoder thread), but the encoder itself can be + // constructed on any thread. + AudioEncoder(const AudioParameters& input_params, + EncodeCB encode_callback, + StatusCB status_callback); + AudioEncoder(const AudioEncoder&) = delete; + AudioEncoder& operator=(const AudioEncoder&) = delete; + virtual ~AudioEncoder(); + + const AudioParameters& audio_input_params() const { + return audio_input_params_; + } + + // Performs various checks before calling EncodeAudioImpl() which does the + // actual encoding. + void EncodeAudio(const AudioBus& audio_bus, base::TimeTicks capture_time); + + protected: + const EncodeCB& encode_callback() const { return encode_callback_; } + const StatusCB& status_callback() const { return status_callback_; } + base::TimeTicks last_capture_time() const { return last_capture_time_; } + + virtual void EncodeAudioImpl(const AudioBus& audio_bus, + base::TimeTicks capture_time) = 0; + + // Computes the timestamp of an AudioBus which has |num_frames| and was + // captured at |capture_time|. This timestamp is the capture time of the first + // sample in that AudioBus. + base::TimeTicks ComputeTimestamp(int num_frames, + base::TimeTicks capture_time) const; + + private: + const AudioParameters audio_input_params_; + + const EncodeCB encode_callback_; + + const StatusCB status_callback_; + + // The capture time of the most recent |audio_bus| delivered to + // EncodeAudio(). + base::TimeTicks last_capture_time_; + + THREAD_CHECKER(thread_checker_); +}; + +} // namespace media + +#endif // MEDIA_BASE_AUDIO_ENCODER_H_
diff --git a/media/base/user_input_monitor_linux.cc b/media/base/user_input_monitor_linux.cc index 7c80a06..59e655f 100644 --- a/media/base/user_input_monitor_linux.cc +++ b/media/base/user_input_monitor_linux.cc
@@ -179,7 +179,7 @@ // Register OnConnectionData() to be called every time there is something to // read from |connection_|. watch_controller_ = base::FileDescriptorWatcher::WatchReadable( - XConnectionNumber(connection_->display()), + connection_->GetFd(), base::BindRepeating(&UserInputMonitorLinuxCore::OnConnectionData, base::Unretained(this)));
diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc index 602adfb8..98a11672 100644 --- a/media/gpu/v4l2/v4l2_video_decoder.cc +++ b/media/gpu/v4l2/v4l2_video_decoder.cc
@@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/task/post_task.h" +#include "media/base/limits.h" #include "media/base/video_types.h" #include "media/base/video_util.h" #include "media/gpu/chromeos/dmabuf_video_frame_pool.h" @@ -38,6 +39,11 @@ V4L2_PIX_FMT_H264, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, }; +// Number of output buffers to use for each VD stage above what's required by +// the decoder (e.g. DPB size, in H264). We need limits::kMaxVideoFrames to +// fill up the GpuVideoDecode pipeline, and +1 for a frame in transit. +constexpr size_t kDpbOutputBufferExtraCount = limits::kMaxVideoFrames + 1; + } // namespace // static @@ -514,7 +520,8 @@ base::BindOnce(&V4L2VideoDecoderBackend::OnChangeResolutionDone, base::Unretained(backend_.get()), false)); - num_output_frames_ = num_output_frames; + DCHECK_GT(num_output_frames, 0u); + num_output_frames_ = num_output_frames + kDpbOutputBufferExtraCount; // Stateful decoders require the input queue to keep running during resolution // changes, but stateless ones require it to be stopped. @@ -525,9 +532,8 @@ SetState(State::kError); return; } - DCHECK_GT(num_output_frames, 0u); - if (!backend_->ApplyResolution(pic_size, visible_rect, num_output_frames)) { + if (!backend_->ApplyResolution(pic_size, visible_rect, num_output_frames_)) { SetState(State::kError); return; }
diff --git a/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc b/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc index e25779ff..f959ec6 100644 --- a/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc +++ b/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc
@@ -498,7 +498,7 @@ } auto ctrl = device_->GetCtrl(V4L2_CID_MIN_BUFFERS_FOR_CAPTURE); - constexpr size_t DEFAULT_NUM_OUTPUT_BUFFERS = 12; + constexpr size_t DEFAULT_NUM_OUTPUT_BUFFERS = 7; const size_t num_output_buffers = ctrl ? ctrl->value : DEFAULT_NUM_OUTPUT_BUFFERS; if (!ctrl)
diff --git a/mojo/public/tools/bindings/generators/js_templates/lite/struct_definition.tmpl b/mojo/public/tools/bindings/generators/js_templates/lite/struct_definition.tmpl index dc7283f..1d6acbc 100644 --- a/mojo/public/tools/bindings/generators/js_templates/lite/struct_definition.tmpl +++ b/mojo/public/tools/bindings/generators/js_templates/lite/struct_definition.tmpl
@@ -45,7 +45,7 @@ {{module.namespace}}.{{struct.name}} = class { constructor() { {%- for packed_field in struct.packed.packed_fields %} - /** @type { {{packed_field.field.kind|lite_closure_field_type}} } */ + /** @export { {{packed_field.field.kind|lite_closure_field_type}} } */ this.{{packed_field.field.name}}; {%- endfor %} }
diff --git a/net/BUILD.gn b/net/BUILD.gn index 3eaf834..017e7416 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn
@@ -188,6 +188,8 @@ "cert/ct_policy_enforcer.h", "cert/ct_policy_status.h", "cert/ct_verifier.h", + "cert/ct_verify_result.cc", + "cert/ct_verify_result.h", "cert/do_nothing_ct_verifier.cc", "cert/do_nothing_ct_verifier.h", "cert/internal/cert_error_id.cc",
diff --git a/net/cert/cert_verify_result.cc b/net/cert/cert_verify_result.cc index f3c8740..5d88b7fb 100644 --- a/net/cert/cert_verify_result.cc +++ b/net/cert/cert_verify_result.cc
@@ -8,8 +8,6 @@ #include "base/values.h" #include "net/base/net_errors.h" -#include "net/cert/ct_policy_status.h" -#include "net/cert/ct_signed_certificate_timestamp_log_param.h" #include "net/cert/x509_certificate.h" #include "net/cert/x509_certificate_net_log_param.h" @@ -40,9 +38,6 @@ public_key_hashes = other.public_key_hashes; ocsp_result = other.ocsp_result; - scts = other.scts; - policy_compliance = other.policy_compliance; - ClearAllUserData(); CloneDataFrom(other); @@ -63,10 +58,6 @@ public_key_hashes.clear(); ocsp_result = OCSPVerifyResult(); - scts.clear(); - policy_compliance = - ct::CTPolicyCompliance::CT_POLICY_COMPLIANCE_DETAILS_NOT_AVAILABLE; - ClearAllUserData(); } @@ -98,8 +89,6 @@ hashes.Append(public_key_hash.ToString()); results.SetKey("public_key_hashes", std::move(hashes)); - results.SetKey("scts", net::NetLogSignedCertificateTimestampParams(&scts)); - return std::move(results); }
diff --git a/net/cert/cert_verify_result.h b/net/cert/cert_verify_result.h index 35dee119..5663b28 100644 --- a/net/cert/cert_verify_result.h +++ b/net/cert/cert_verify_result.h
@@ -11,19 +11,13 @@ #include "base/supports_user_data.h" #include "net/base/net_export.h" #include "net/cert/cert_status_flags.h" -#include "net/cert/ct_policy_status.h" #include "net/cert/ocsp_verify_result.h" -#include "net/cert/signed_certificate_timestamp_and_status.h" #include "net/cert/x509_cert_types.h" namespace base { class Value; } -namespace ct { -enum class CTPolicyCompliance; -} // namespace ct - namespace net { class X509Certificate; @@ -103,16 +97,6 @@ // Verification of stapled OCSP response, if present. OCSPVerifyResult ocsp_result; - - // `scts` contains the result of verifying any provided or embedded SCTs for - // this certificate against the set of known logs. Consumers should not simply - // check this for the presence of a successfully verified SCT to determine CT - // compliance. Instead look at `policy_compliance`. - SignedCertificateTimestampAndStatusList scts; - - // The result of evaluating whether the certificate complies with the - // Certificate Transparency policy. - ct::CTPolicyCompliance policy_compliance; }; } // namespace net
diff --git a/net/cert/ct_verify_result.cc b/net/cert/ct_verify_result.cc new file mode 100644 index 0000000..9da8828d --- /dev/null +++ b/net/cert/ct_verify_result.cc
@@ -0,0 +1,35 @@ +// Copyright 2013 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 "net/cert/ct_verify_result.h" + +#include "net/cert/ct_policy_status.h" + +namespace net { + +namespace ct { + +CTVerifyResult::CTVerifyResult() + : policy_compliance( + ct::CTPolicyCompliance::CT_POLICY_COMPLIANCE_DETAILS_NOT_AVAILABLE), + policy_compliance_required(false) {} + +CTVerifyResult::CTVerifyResult(const CTVerifyResult& other) = default; + +CTVerifyResult::~CTVerifyResult() = default; + +SCTList SCTsMatchingStatus( + const SignedCertificateTimestampAndStatusList& sct_and_status_list, + SCTVerifyStatus match_status) { + SCTList result; + for (const auto& sct_and_status : sct_and_status_list) + if (sct_and_status.status == match_status) + result.push_back(sct_and_status.sct); + + return result; +} + +} // namespace ct + +} // namespace net
diff --git a/net/cert/ct_verify_result.h b/net/cert/ct_verify_result.h new file mode 100644 index 0000000..742ec65 --- /dev/null +++ b/net/cert/ct_verify_result.h
@@ -0,0 +1,49 @@ +// Copyright 2013 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 NET_CERT_CT_VERIFY_RESULT_H_ +#define NET_CERT_CT_VERIFY_RESULT_H_ + +#include <vector> + +#include "net/base/net_export.h" +#include "net/cert/signed_certificate_timestamp_and_status.h" + +namespace net { + +namespace ct { + +enum class CTPolicyCompliance; + +// Holds Signed Certificate Timestamps, depending on their verification +// results, and information about CT policies that were applied on the +// connection. +struct NET_EXPORT CTVerifyResult { + CTVerifyResult(); + CTVerifyResult(const CTVerifyResult& other); + ~CTVerifyResult(); + + // All SCTs and their statuses + SignedCertificateTimestampAndStatusList scts; + + // The result of evaluating whether the connection complies with the + // CT certificate policy. + CTPolicyCompliance policy_compliance; + // True if the connection was required to comply with the CT certificate + // policy. This value is not meaningful if |policy_compliance| is + // COMPLIANCE_DETAILS_NOT_AVAILABLE. + bool policy_compliance_required; +}; + +// Returns a list of SCTs from |sct_and_status_list| whose status matches +// |match_status|. +SCTList NET_EXPORT SCTsMatchingStatus( + const SignedCertificateTimestampAndStatusList& sct_and_status_list, + SCTVerifyStatus match_status); + +} // namespace ct + +} // namespace net + +#endif // NET_CERT_CT_VERIFY_RESULT_H_
diff --git a/net/quic/crypto/proof_verifier_chromium.cc b/net/quic/crypto/proof_verifier_chromium.cc index 2253e208..f8629d7d 100644 --- a/net/quic/crypto/proof_verifier_chromium.cc +++ b/net/quic/crypto/proof_verifier_chromium.cc
@@ -43,6 +43,7 @@ quic::ProofVerifyDetails* ProofVerifyDetailsChromium::Clone() const { ProofVerifyDetailsChromium* other = new ProofVerifyDetailsChromium; other->cert_verify_result = cert_verify_result; + other->ct_verify_result = ct_verify_result; return other; } @@ -241,7 +242,7 @@ // external communication. cert_transparency_verifier_->Verify( hostname, cert_.get(), std::string(), cert_sct, - &verify_details_->cert_verify_result.scts, net_log_); + &verify_details_->ct_verify_result.scts, net_log_); // We call VerifySignature first to avoid copying of server_config and // signature. @@ -290,7 +291,7 @@ // external communication. cert_transparency_verifier_->Verify( hostname, cert_.get(), std::string(), cert_sct, - &verify_details_->cert_verify_result.scts, net_log_); + &verify_details_->ct_verify_result.scts, net_log_); return VerifyCert(hostname, port, ocsp_response, cert_sct, error_details, verify_details, std::move(callback)); @@ -420,18 +421,16 @@ // If the connection was good, check HPKP and CT status simultaneously, // but prefer to treat the HPKP error as more serious, if there was one. if (result == OK) { - ct::SCTList verified_scts; - for (const auto& sct_and_status : cert_verify_result.scts) { - if (sct_and_status.status == ct::SCT_STATUS_OK) - verified_scts.push_back(sct_and_status.sct); - } - verify_details_->cert_verify_result.policy_compliance = + ct::SCTList verified_scts = ct::SCTsMatchingStatus( + verify_details_->ct_verify_result.scts, ct::SCT_STATUS_OK); + + verify_details_->ct_verify_result.policy_compliance = policy_enforcer_->CheckCompliance( cert_verify_result.verified_cert.get(), verified_scts, net_log_); if (verify_details_->cert_verify_result.cert_status & CERT_STATUS_IS_EV) { - if (verify_details_->cert_verify_result.policy_compliance != + if (verify_details_->ct_verify_result.policy_compliance != ct::CTPolicyCompliance::CT_POLICY_COMPLIES_VIA_SCTS && - verify_details_->cert_verify_result.policy_compliance != + verify_details_->ct_verify_result.policy_compliance != ct::CTPolicyCompliance::CT_POLICY_BUILD_NOT_TIMELY) { verify_details_->cert_verify_result.cert_status |= CERT_STATUS_CT_COMPLIANCE_FAILED; @@ -444,7 +443,7 @@ if (verify_details_->cert_verify_result.is_issued_by_known_root) { UMA_HISTOGRAM_ENUMERATION( "Net.CertificateTransparency.EVCompliance2.QUIC", - cert_verify_result.policy_compliance, + verify_details_->ct_verify_result.policy_compliance, ct::CTPolicyCompliance::CT_POLICY_COUNT); } } @@ -454,7 +453,7 @@ if (verify_details_->cert_verify_result.is_issued_by_known_root) { UMA_HISTOGRAM_ENUMERATION( "Net.CertificateTransparency.ConnectionComplianceStatus2.QUIC", - verify_details_->cert_verify_result.policy_compliance, + verify_details_->ct_verify_result.policy_compliance, ct::CTPolicyCompliance::CT_POLICY_COUNT); } @@ -465,11 +464,12 @@ cert_verify_result.is_issued_by_known_root, cert_verify_result.public_key_hashes, cert_verify_result.verified_cert.get(), cert_.get(), - cert_verify_result.scts, + verify_details_->ct_verify_result.scts, TransportSecurityState::ENABLE_EXPECT_CT_REPORTS, - cert_verify_result.policy_compliance, + verify_details_->ct_verify_result.policy_compliance, proof_verifier_->network_isolation_key_); if (ct_requirement_status != TransportSecurityState::CT_NOT_REQUIRED) { + verify_details_->ct_verify_result.policy_compliance_required = true; if (verify_details_->cert_verify_result.is_issued_by_known_root) { // Record the CT compliance of connections for which compliance is // required; this helps answer the question: "Of all connections that @@ -478,16 +478,19 @@ UMA_HISTOGRAM_ENUMERATION( "Net.CertificateTransparency.CTRequiredConnectionComplianceStatus2." "QUIC", - cert_verify_result.policy_compliance, + verify_details_->ct_verify_result.policy_compliance, ct::CTPolicyCompliance::CT_POLICY_COUNT); } + } else { + verify_details_->ct_verify_result.policy_compliance_required = false; } if (sct_auditing_delegate_ && sct_auditing_delegate_->IsSCTAuditingEnabled()) { sct_auditing_delegate_->MaybeEnqueueReport( HostPortPair(hostname_, port_), - cert_verify_result.verified_cert.get(), cert_verify_result.scts); + cert_verify_result.verified_cert.get(), + verify_details_->ct_verify_result.scts); } switch (ct_requirement_status) {
diff --git a/net/quic/crypto/proof_verifier_chromium.h b/net/quic/crypto/proof_verifier_chromium.h index 8468a9d..4884840 100644 --- a/net/quic/crypto/proof_verifier_chromium.h +++ b/net/quic/crypto/proof_verifier_chromium.h
@@ -15,6 +15,7 @@ #include "net/base/net_export.h" #include "net/base/network_isolation_key.h" #include "net/cert/cert_verify_result.h" +#include "net/cert/ct_verify_result.h" #include "net/cert/x509_certificate.h" #include "net/log/net_log_with_source.h" #include "net/third_party/quiche/src/quic/core/crypto/proof_verifier.h" @@ -40,6 +41,7 @@ quic::ProofVerifyDetails* Clone() const override; CertVerifyResult cert_verify_result; + ct::CTVerifyResult ct_verify_result; // pinning_failure_log contains a message produced by // TransportSecurityState::PKPState::CheckPublicKeyPins in the event of a
diff --git a/net/quic/crypto/proof_verifier_chromium_test.cc b/net/quic/crypto/proof_verifier_chromium_test.cc index cc3852a0..b176100 100644 --- a/net/quic/crypto/proof_verifier_chromium_test.cc +++ b/net/quic/crypto/proof_verifier_chromium_test.cc
@@ -190,17 +190,17 @@ void CheckSCT(bool sct_expected_ok) { ProofVerifyDetailsChromium* proof_details = reinterpret_cast<ProofVerifyDetailsChromium*>(details_.get()); - const CertVerifyResult& cert_verify_result = - proof_details->cert_verify_result; + const ct::CTVerifyResult& ct_verify_result = + proof_details->ct_verify_result; if (sct_expected_ok) { - EXPECT_TRUE(ct::CheckForSingleVerifiedSCTInResult(cert_verify_result.scts, + ASSERT_TRUE(ct::CheckForSingleVerifiedSCTInResult(ct_verify_result.scts, kLogDescription)); - EXPECT_TRUE(ct::CheckForSCTOrigin( - cert_verify_result.scts, + ASSERT_TRUE(ct::CheckForSCTOrigin( + ct_verify_result.scts, ct::SignedCertificateTimestamp::SCT_FROM_TLS_EXTENSION)); } else { - ASSERT_EQ(1U, cert_verify_result.scts.size()); - EXPECT_EQ(ct::SCT_STATUS_LOG_UNKNOWN, cert_verify_result.scts[0].status); + EXPECT_EQ(1U, ct_verify_result.scts.size()); + EXPECT_EQ(ct::SCT_STATUS_LOG_UNKNOWN, ct_verify_result.scts[0].status); } } @@ -1066,6 +1066,112 @@ } } +// Tests that when CT is required but the connection is not compliant, the +// relevant flag is set in the CTVerifyResult. +TEST_F(ProofVerifierChromiumTest, CTRequirementsFlagNotMet) { + dummy_result_.is_issued_by_known_root = true; + MockCertVerifier dummy_verifier; + dummy_verifier.AddResultForCert(test_cert_.get(), dummy_result_, OK); + + // Set up CT. + MockRequireCTDelegate require_ct_delegate; + transport_security_state_.SetRequireCTDelegate(&require_ct_delegate); + EXPECT_CALL(require_ct_delegate, IsCTRequiredForHost(_, _, _)) + .WillRepeatedly(Return(TransportSecurityState::RequireCTDelegate:: + CTRequirementLevel::REQUIRED)); + EXPECT_CALL(ct_policy_enforcer_, CheckCompliance(_, _, _)) + .WillRepeatedly( + Return(ct::CTPolicyCompliance::CT_POLICY_NOT_DIVERSE_SCTS)); + + ProofVerifierChromium proof_verifier( + &dummy_verifier, &ct_policy_enforcer_, &transport_security_state_, + ct_verifier_.get(), nullptr, {}, NetworkIsolationKey()); + + { + std::unique_ptr<DummyProofVerifierCallback> callback( + new DummyProofVerifierCallback); + proof_verifier.VerifyProof( + kTestHostname, kTestPort, kTestConfig, kTestTransportVersion, + kTestChloHash, certs_, kTestEmptySCT, GetTestSignature(), + verify_context_.get(), &error_details_, &details_, std::move(callback)); + + // The flag should be set in the CTVerifyResult. + ProofVerifyDetailsChromium* proof_details = + reinterpret_cast<ProofVerifyDetailsChromium*>(details_.get()); + const ct::CTVerifyResult& ct_verify_result = + proof_details->ct_verify_result; + EXPECT_TRUE(ct_verify_result.policy_compliance_required); + } + + { + std::unique_ptr<DummyProofVerifierCallback> callback( + new DummyProofVerifierCallback); + proof_verifier.VerifyCertChain( + kTestHostname, kTestPort, certs_, kTestEmptyOCSPResponse, kTestEmptySCT, + verify_context_.get(), &error_details_, &details_, std::move(callback)); + + // The flag should be set in the CTVerifyResult. + ProofVerifyDetailsChromium* proof_details = + reinterpret_cast<ProofVerifyDetailsChromium*>(details_.get()); + const ct::CTVerifyResult& ct_verify_result = + proof_details->ct_verify_result; + EXPECT_TRUE(ct_verify_result.policy_compliance_required); + } +} + +// Tests that when CT is required and the connection is compliant, the relevant +// flag is set in the CTVerifyResult. +TEST_F(ProofVerifierChromiumTest, CTRequirementsFlagMet) { + dummy_result_.is_issued_by_known_root = true; + MockCertVerifier dummy_verifier; + dummy_verifier.AddResultForCert(test_cert_.get(), dummy_result_, OK); + + // Set up CT. + MockRequireCTDelegate require_ct_delegate; + transport_security_state_.SetRequireCTDelegate(&require_ct_delegate); + EXPECT_CALL(require_ct_delegate, IsCTRequiredForHost(_, _, _)) + .WillRepeatedly(Return(TransportSecurityState::RequireCTDelegate:: + CTRequirementLevel::REQUIRED)); + EXPECT_CALL(ct_policy_enforcer_, CheckCompliance(_, _, _)) + .WillRepeatedly( + Return(ct::CTPolicyCompliance::CT_POLICY_COMPLIES_VIA_SCTS)); + + ProofVerifierChromium proof_verifier( + &dummy_verifier, &ct_policy_enforcer_, &transport_security_state_, + ct_verifier_.get(), nullptr, {}, NetworkIsolationKey()); + + { + std::unique_ptr<DummyProofVerifierCallback> callback( + new DummyProofVerifierCallback); + proof_verifier.VerifyProof( + kTestHostname, kTestPort, kTestConfig, kTestTransportVersion, + kTestChloHash, certs_, kTestEmptySCT, GetTestSignature(), + verify_context_.get(), &error_details_, &details_, std::move(callback)); + + // The flag should be set in the CTVerifyResult. + ProofVerifyDetailsChromium* proof_details = + reinterpret_cast<ProofVerifyDetailsChromium*>(details_.get()); + const ct::CTVerifyResult& ct_verify_result = + proof_details->ct_verify_result; + EXPECT_TRUE(ct_verify_result.policy_compliance_required); + } + + { + std::unique_ptr<DummyProofVerifierCallback> callback( + new DummyProofVerifierCallback); + proof_verifier.VerifyCertChain( + kTestHostname, kTestPort, certs_, kTestEmptyOCSPResponse, kTestEmptySCT, + verify_context_.get(), &error_details_, &details_, std::move(callback)); + + // The flag should be set in the CTVerifyResult. + ProofVerifyDetailsChromium* proof_details = + reinterpret_cast<ProofVerifyDetailsChromium*>(details_.get()); + const ct::CTVerifyResult& ct_verify_result = + proof_details->ct_verify_result; + EXPECT_TRUE(ct_verify_result.policy_compliance_required); + } +} + TEST_F(ProofVerifierChromiumTest, UnknownRootRejected) { dummy_result_.is_issued_by_known_root = false;
diff --git a/net/quic/quic_chromium_client_session.cc b/net/quic/quic_chromium_client_session.cc index cf052b6..6e08826 100644 --- a/net/quic/quic_chromium_client_session.cc +++ b/net/quic/quic_chromium_client_session.cc
@@ -29,7 +29,6 @@ #include "net/base/network_isolation_key.h" #include "net/base/privacy_mode.h" #include "net/base/url_util.h" -#include "net/cert/signed_certificate_timestamp_and_status.h" #include "net/http/transport_security_state.h" #include "net/log/net_log_event_type.h" #include "net/log/net_log_source_type.h" @@ -1300,8 +1299,7 @@ ssl_info->pinning_failure_log = pinning_failure_log_; ssl_info->is_fatal_cert_error = is_fatal_cert_error_; - ssl_info->signed_certificate_timestamps = cert_verify_result_->scts; - ssl_info->ct_policy_compliance = cert_verify_result_->policy_compliance; + ssl_info->UpdateCertificateTransparencyInfo(*ct_verify_result_); const auto& crypto_params = crypto_stream_->crypto_negotiated_params(); uint16_t cipher_suite; @@ -2525,6 +2523,9 @@ cert_verify_result_.reset( new CertVerifyResult(verify_details_chromium->cert_verify_result)); pinning_failure_log_ = verify_details_chromium->pinning_failure_log; + std::unique_ptr<ct::CTVerifyResult> ct_verify_result_copy( + new ct::CTVerifyResult(verify_details_chromium->ct_verify_result)); + ct_verify_result_ = std::move(ct_verify_result_copy); logger_->OnCertificateVerified(*cert_verify_result_); pkp_bypassed_ = verify_details_chromium->pkp_bypassed; is_fatal_cert_error_ = verify_details_chromium->is_fatal_cert_error;
diff --git a/net/quic/quic_chromium_client_session.h b/net/quic/quic_chromium_client_session.h index 7883a77f..c4d7513 100644 --- a/net/quic/quic_chromium_client_session.h +++ b/net/quic/quic_chromium_client_session.h
@@ -28,6 +28,7 @@ #include "net/base/net_error_details.h" #include "net/base/net_export.h" #include "net/base/proxy_server.h" +#include "net/cert/ct_verify_result.h" #include "net/log/net_log_with_source.h" #include "net/quic/quic_chromium_client_stream.h" #include "net/quic/quic_chromium_packet_reader.h" @@ -870,6 +871,7 @@ SSLConfigService* ssl_config_service_; std::unique_ptr<QuicServerInfo> server_info_; std::unique_ptr<CertVerifyResult> cert_verify_result_; + std::unique_ptr<ct::CTVerifyResult> ct_verify_result_; std::string pinning_failure_log_; bool pkp_bypassed_; bool is_fatal_cert_error_;
diff --git a/net/quic/quic_chromium_client_session_test.cc b/net/quic/quic_chromium_client_session_test.cc index 31cb60f..17b0895 100644 --- a/net/quic/quic_chromium_client_session_test.cc +++ b/net/quic/quic_chromium_client_session_test.cc
@@ -334,8 +334,9 @@ details.cert_verify_result.verified_cert = ImportCertFromFile(GetTestCertsDirectory(), "spdy_pooling.pem"); details.cert_verify_result.is_issued_by_known_root = true; - details.cert_verify_result.policy_compliance = + details.ct_verify_result.policy_compliance = ct::CTPolicyCompliance::CT_POLICY_COMPLIES_VIA_SCTS; + details.ct_verify_result.policy_compliance_required = true; CompleteCryptoHandshake(); session_->OnProofVerifyDetailsAvailable(details); @@ -350,8 +351,10 @@ EXPECT_EQ(details.cert_verify_result.cert_status, ssl_info.cert_status); EXPECT_EQ(details.cert_verify_result.is_issued_by_known_root, ssl_info.is_issued_by_known_root); - EXPECT_EQ(details.cert_verify_result.policy_compliance, + EXPECT_EQ(details.ct_verify_result.policy_compliance, ssl_info.ct_policy_compliance); + EXPECT_EQ(details.ct_verify_result.policy_compliance_required, + ssl_info.ct_policy_compliance_required); } // Just like GetSSLInfo1, but uses different values. @@ -370,8 +373,9 @@ details.cert_verify_result.verified_cert = ImportCertFromFile(GetTestCertsDirectory(), "spdy_pooling.pem"); details.cert_verify_result.is_issued_by_known_root = false; - details.cert_verify_result.policy_compliance = + details.ct_verify_result.policy_compliance = ct::CTPolicyCompliance::CT_POLICY_NOT_ENOUGH_SCTS; + details.ct_verify_result.policy_compliance_required = false; CompleteCryptoHandshake(); session_->OnProofVerifyDetailsAvailable(details); @@ -386,8 +390,10 @@ EXPECT_EQ(details.cert_verify_result.cert_status, ssl_info.cert_status); EXPECT_EQ(details.cert_verify_result.is_issued_by_known_root, ssl_info.is_issued_by_known_root); - EXPECT_EQ(details.cert_verify_result.policy_compliance, + EXPECT_EQ(details.ct_verify_result.policy_compliance, ssl_info.ct_policy_compliance); + EXPECT_EQ(details.ct_verify_result.policy_compliance_required, + ssl_info.ct_policy_compliance_required); } TEST_P(QuicChromiumClientSessionTest, IsFatalErrorNotSetForNonFatalError) { @@ -1684,7 +1690,7 @@ ImportCertFromFile(GetTestCertsDirectory(), "spdy_pooling.pem"); ASSERT_TRUE(details.cert_verify_result.verified_cert.get()); details.cert_verify_result.is_issued_by_known_root = true; - details.cert_verify_result.policy_compliance = + details.ct_verify_result.policy_compliance = ct::CTPolicyCompliance::CT_POLICY_NOT_ENOUGH_SCTS; CompleteCryptoHandshake();
diff --git a/net/socket/ssl_client_socket_impl.cc b/net/socket/ssl_client_socket_impl.cc index f8aca964..cf4e52b 100644 --- a/net/socket/ssl_client_socket_impl.cc +++ b/net/socket/ssl_client_socket_impl.cc
@@ -45,7 +45,6 @@ #include "net/cert/ct_verifier.h" #include "net/cert/internal/parse_certificate.h" #include "net/cert/sct_auditing_delegate.h" -#include "net/cert/sct_status_flags.h" #include "net/cert/x509_certificate_net_log_param.h" #include "net/cert/x509_util.h" #include "net/der/parse_values.h" @@ -605,8 +604,7 @@ ssl_info->pinning_failure_log = pinning_failure_log_; ssl_info->ocsp_result = server_cert_verify_result_.ocsp_result; ssl_info->is_fatal_cert_error = is_fatal_cert_error_; - ssl_info->signed_certificate_timestamps = server_cert_verify_result_.scts; - ssl_info->ct_policy_compliance = server_cert_verify_result_.policy_compliance; + AddCTInfoToSSLInfo(ssl_info); const SSL_CIPHER* cipher = SSL_get_current_cipher(ssl_.get()); CHECK(cipher); @@ -1544,21 +1542,19 @@ // external communication. context_->cert_transparency_verifier()->Verify( host_and_port().host(), server_cert_verify_result_.verified_cert.get(), - ocsp_response, sct_list, &server_cert_verify_result_.scts, net_log_); + ocsp_response, sct_list, &ct_verify_result_.scts, net_log_); - ct::SCTList verified_scts; - for (const auto& sct_and_status : server_cert_verify_result_.scts) { - if (sct_and_status.status == ct::SCT_STATUS_OK) - verified_scts.push_back(sct_and_status.sct); - } - server_cert_verify_result_.policy_compliance = + ct::SCTList verified_scts = + ct::SCTsMatchingStatus(ct_verify_result_.scts, ct::SCT_STATUS_OK); + + ct_verify_result_.policy_compliance = context_->ct_policy_enforcer()->CheckCompliance( server_cert_verify_result_.verified_cert.get(), verified_scts, net_log_); if (server_cert_verify_result_.cert_status & CERT_STATUS_IS_EV) { - if (server_cert_verify_result_.policy_compliance != + if (ct_verify_result_.policy_compliance != ct::CTPolicyCompliance::CT_POLICY_COMPLIES_VIA_SCTS && - server_cert_verify_result_.policy_compliance != + ct_verify_result_.policy_compliance != ct::CTPolicyCompliance::CT_POLICY_BUILD_NOT_TIMELY) { server_cert_verify_result_.cert_status |= CERT_STATUS_CT_COMPLIANCE_FAILED; @@ -1570,7 +1566,7 @@ // compliance. if (server_cert_verify_result_.is_issued_by_known_root) { UMA_HISTOGRAM_ENUMERATION("Net.CertificateTransparency.EVCompliance2.SSL", - server_cert_verify_result_.policy_compliance, + ct_verify_result_.policy_compliance, ct::CTPolicyCompliance::CT_POLICY_COUNT); } } @@ -1580,7 +1576,7 @@ if (server_cert_verify_result_.is_issued_by_known_root) { UMA_HISTOGRAM_ENUMERATION( "Net.CertificateTransparency.ConnectionComplianceStatus2.SSL", - server_cert_verify_result_.policy_compliance, + ct_verify_result_.policy_compliance, ct::CTPolicyCompliance::CT_POLICY_COUNT); } @@ -1589,11 +1585,12 @@ host_and_port_, server_cert_verify_result_.is_issued_by_known_root, server_cert_verify_result_.public_key_hashes, server_cert_verify_result_.verified_cert.get(), server_cert_.get(), - server_cert_verify_result_.scts, + ct_verify_result_.scts, TransportSecurityState::ENABLE_EXPECT_CT_REPORTS, - server_cert_verify_result_.policy_compliance, + ct_verify_result_.policy_compliance, ssl_config_.network_isolation_key); if (ct_requirement_status != TransportSecurityState::CT_NOT_REQUIRED) { + ct_verify_result_.policy_compliance_required = true; if (server_cert_verify_result_.is_issued_by_known_root) { // Record the CT compliance of connections for which compliance is // required; this helps answer the question: "Of all connections that are @@ -1601,16 +1598,18 @@ UMA_HISTOGRAM_ENUMERATION( "Net.CertificateTransparency.CTRequiredConnectionComplianceStatus2." "SSL", - server_cert_verify_result_.policy_compliance, + ct_verify_result_.policy_compliance, ct::CTPolicyCompliance::CT_POLICY_COUNT); } + } else { + ct_verify_result_.policy_compliance_required = false; } if (context_->sct_auditing_delegate() && context_->sct_auditing_delegate()->IsSCTAuditingEnabled()) { context_->sct_auditing_delegate()->MaybeEnqueueReport( host_and_port_, server_cert_verify_result_.verified_cert.get(), - server_cert_verify_result_.scts); + ct_verify_result_.scts); } switch (ct_requirement_status) { @@ -1706,6 +1705,10 @@ return 1; } +void SSLClientSocketImpl::AddCTInfoToSSLInfo(SSLInfo* ssl_info) const { + ssl_info->UpdateCertificateTransparencyInfo(ct_verify_result_); +} + SSLClientSessionCache::Key SSLClientSocketImpl::GetSessionCacheKey( base::Optional<IPAddress> dest_ip_addr) const { SSLClientSessionCache::Key key;
diff --git a/net/socket/ssl_client_socket_impl.h b/net/socket/ssl_client_socket_impl.h index d0113326..7388274 100644 --- a/net/socket/ssl_client_socket_impl.h +++ b/net/socket/ssl_client_socket_impl.h
@@ -22,6 +22,7 @@ #include "net/base/io_buffer.h" #include "net/cert/cert_verifier.h" #include "net/cert/cert_verify_result.h" +#include "net/cert/ct_verify_result.h" #include "net/log/net_log_with_source.h" #include "net/socket/next_proto.h" #include "net/socket/socket_bio_adapter.h" @@ -157,6 +158,14 @@ // Called from the SSL layer whenever a new session is established. int NewSessionCallback(SSL_SESSION* session); + // Adds the Certificate Transparency info from ct_verify_result_ to + // |ssl_info|. + // SCTs are held in three separate vectors in ct_verify_result, each + // vetor representing a particular verification state, this method associates + // each of the SCTs with the corresponding SCTVerifyStatus as it adds it to + // the |ssl_info|.signed_certificate_timestamps list. + void AddCTInfoToSSLInfo(SSLInfo* ssl_info) const; + // Returns a session cache key for this socket. SSLClientSessionCache::Key GetSessionCacheKey( base::Optional<IPAddress> dest_ip_addr) const; @@ -246,6 +255,9 @@ // Result from Cert Verifier. int cert_verification_result_; + // Certificate Transparency: Verifier and result holder. + ct::CTVerifyResult ct_verify_result_; + // OpenSSL stuff bssl::UniquePtr<SSL> ssl_;
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc index 0a3fe64d..9063ef48 100644 --- a/net/socket/ssl_client_socket_unittest.cc +++ b/net/socket/ssl_client_socket_unittest.cc
@@ -4319,6 +4319,76 @@ static_cast<int>(ct::CTPolicyCompliance::CT_POLICY_NOT_ENOUGH_SCTS), 1); } +// Test that when CT is required (in this case, by an Expect-CT opt-in) but the +// connection is not compliant, the relevant flag is set on the SSLInfo. +TEST_P(SSLClientSocketVersionTest, CTRequirementsFlagNotMet) { + ASSERT_TRUE( + StartEmbeddedTestServer(EmbeddedTestServer::CERT_OK, GetServerConfig())); + scoped_refptr<X509Certificate> server_cert = + embedded_test_server()->GetCertificate(); + + // Certificate is trusted and chains to a public root. + CertVerifyResult verify_result; + verify_result.is_issued_by_known_root = true; + verify_result.verified_cert = server_cert; + verify_result.public_key_hashes = + MakeHashValueVector(kGoodHashValueVectorInput); + cert_verifier_->AddResultForCert(server_cert.get(), verify_result, OK); + + // Set up the Expect-CT opt-in. + const base::Time current_time(base::Time::Now()); + const base::Time expiry = current_time + base::TimeDelta::FromSeconds(1000); + transport_security_state_->AddExpectCT(host_port_pair().host(), expiry, + true /* enforce */, GURL(), + NetworkIsolationKey()); + + EXPECT_CALL(*ct_policy_enforcer_, CheckCompliance(server_cert.get(), _, _)) + .WillRepeatedly( + Return(ct::CTPolicyCompliance::CT_POLICY_NOT_ENOUGH_SCTS)); + + SSLConfig ssl_config; + int rv; + ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); + SSLInfo ssl_info; + ASSERT_TRUE(sock_->GetSSLInfo(&ssl_info)); + EXPECT_TRUE(ssl_info.ct_policy_compliance_required); +} + +// Test that when CT is required (in this case, by an Expect-CT opt-in) and the +// connection is compliant, the relevant flag is set on the SSLInfo. +TEST_P(SSLClientSocketVersionTest, CTRequirementsFlagMet) { + ASSERT_TRUE( + StartEmbeddedTestServer(EmbeddedTestServer::CERT_OK, GetServerConfig())); + scoped_refptr<X509Certificate> server_cert = + embedded_test_server()->GetCertificate(); + + // Certificate is trusted and chains to a public root. + CertVerifyResult verify_result; + verify_result.is_issued_by_known_root = true; + verify_result.verified_cert = server_cert; + verify_result.public_key_hashes = + MakeHashValueVector(kGoodHashValueVectorInput); + cert_verifier_->AddResultForCert(server_cert.get(), verify_result, OK); + + // Set up the Expect-CT opt-in. + const base::Time current_time(base::Time::Now()); + const base::Time expiry = current_time + base::TimeDelta::FromSeconds(1000); + transport_security_state_->AddExpectCT(host_port_pair().host(), expiry, + true /* enforce */, GURL(), + NetworkIsolationKey()); + + EXPECT_CALL(*ct_policy_enforcer_, CheckCompliance(server_cert.get(), _, _)) + .WillRepeatedly( + Return(ct::CTPolicyCompliance::CT_POLICY_COMPLIES_VIA_SCTS)); + + SSLConfig ssl_config; + int rv; + ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); + SSLInfo ssl_info; + ASSERT_TRUE(sock_->GetSSLInfo(&ssl_info)); + EXPECT_TRUE(ssl_info.ct_policy_compliance_required); +} + // Test that when CT is required (in this case, by a CT delegate), the CT // required histogram is not recorded for a locally installed root. TEST_P(SSLClientSocketVersionTest, CTRequiredHistogramNonCompliantLocalRoot) {
diff --git a/net/ssl/ssl_info.cc b/net/ssl/ssl_info.cc index 744b285..0ca220a 100644 --- a/net/ssl/ssl_info.cc +++ b/net/ssl/ssl_info.cc
@@ -20,4 +20,14 @@ *this = SSLInfo(); } +void SSLInfo::UpdateCertificateTransparencyInfo( + const ct::CTVerifyResult& ct_verify_result) { + signed_certificate_timestamps.insert(signed_certificate_timestamps.end(), + ct_verify_result.scts.begin(), + ct_verify_result.scts.end()); + + ct_policy_compliance = ct_verify_result.policy_compliance; + ct_policy_compliance_required = ct_verify_result.policy_compliance_required; +} + } // namespace net
diff --git a/net/ssl/ssl_info.h b/net/ssl/ssl_info.h index e7e14ec..b8fe946 100644 --- a/net/ssl/ssl_info.h +++ b/net/ssl/ssl_info.h
@@ -13,6 +13,7 @@ #include "net/base/net_export.h" #include "net/cert/cert_status_flags.h" #include "net/cert/ct_policy_status.h" +#include "net/cert/ct_verify_result.h" #include "net/cert/ocsp_verify_result.h" #include "net/cert/sct_status_flags.h" #include "net/cert/signed_certificate_timestamp_and_status.h" @@ -44,6 +45,16 @@ bool is_valid() const { return cert.get() != nullptr; } + // Adds the SignedCertificateTimestamps and policy compliance details + // from ct_verify_result to |signed_certificate_timestamps| and + // |ct_policy_compliance_details|. SCTs are held in three separate + // vectors in ct_verify_result, each vetor representing a particular + // verification state, this method associates each of the SCTs with + // the corresponding SCTVerifyStatus as it adds it to the + // |signed_certificate_timestamps| list. + void UpdateCertificateTransparencyInfo( + const ct::CTVerifyResult& ct_verify_result); + // The SSL certificate. scoped_refptr<X509Certificate> cert; @@ -108,6 +119,11 @@ ct::CTPolicyCompliance ct_policy_compliance = ct::CTPolicyCompliance::CT_POLICY_COMPLIANCE_DETAILS_NOT_AVAILABLE; + // True if the connection was required to comply with the CT cert policy. Only + // meaningful if |ct_policy_compliance| is not + // COMPLIANCE_DETAILS_NOT_AVAILABLE. + bool ct_policy_compliance_required = false; + // OCSP stapling details. OCSPVerifyResult ocsp_result;
diff --git a/net/test/ct_test_util.cc b/net/test/ct_test_util.cc index 3ca286b..d01b59ca1 100644 --- a/net/test/ct_test_util.cc +++ b/net/test/ct_test_util.cc
@@ -15,6 +15,7 @@ #include "base/strings/stringprintf.h" #include "net/base/hex_utils.h" #include "net/cert/ct_serialization.h" +#include "net/cert/ct_verify_result.h" #include "net/cert/merkle_tree_leaf.h" #include "net/cert/signed_tree_head.h" #include "net/cert/x509_certificate.h"
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index ac868d1..f5e754f 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc
@@ -149,6 +149,15 @@ "Net.CertificateTransparency.RequestComplianceStatus", ssl_info.ct_policy_compliance, net::ct::CTPolicyCompliance::CT_POLICY_COUNT); + // Record the CT compliance of each request which was required to be CT + // compliant. This gives a picture of the sites that are supposed to be + // compliant and how well they do at actually being compliant. + if (ssl_info.ct_policy_compliance_required) { + UMA_HISTOGRAM_ENUMERATION( + "Net.CertificateTransparency.CTRequiredRequestComplianceStatus", + ssl_info.ct_policy_compliance, + net::ct::CTPolicyCompliance::CT_POLICY_COUNT); + } } template <typename CookieWithMetadata>
diff --git a/net/url_request/url_request_http_job_unittest.cc b/net/url_request/url_request_http_job_unittest.cc index 2ea016c..723a911 100644 --- a/net/url_request/url_request_http_job_unittest.cc +++ b/net/url_request/url_request_http_job_unittest.cc
@@ -88,6 +88,8 @@ const char kCTComplianceHistogramName[] = "Net.CertificateTransparency.RequestComplianceStatus"; +const char kCTRequiredHistogramName[] = + "Net.CertificateTransparency.CTRequiredRequestComplianceStatus"; // Inherit from URLRequestHttpJob to expose the priority and some // other hidden functions. @@ -1038,6 +1040,7 @@ ssl_socket_data.ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem"); ssl_socket_data.ssl_info.is_issued_by_known_root = true; + ssl_socket_data.ssl_info.ct_policy_compliance_required = false; ssl_socket_data.ssl_info.ct_policy_compliance = ct::CTPolicyCompliance::CT_POLICY_NOT_DIVERSE_SCTS; @@ -1083,6 +1086,7 @@ ssl_socket_data.ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem"); ssl_socket_data.ssl_info.is_issued_by_known_root = true; + ssl_socket_data.ssl_info.ct_policy_compliance_required = false; ssl_socket_data.ssl_info.ct_policy_compliance = ct::CTPolicyCompliance::CT_POLICY_NOT_DIVERSE_SCTS; @@ -1109,6 +1113,9 @@ kCTComplianceHistogramName, static_cast<int32_t>(ct::CTPolicyCompliance::CT_POLICY_NOT_DIVERSE_SCTS), 1); + // CTRequiredRequestComplianceStatus should *not* have been recorded because + // it is only recorded for requests which are required to be compliant. + histograms.ExpectTotalCount(kCTRequiredHistogramName, 0); } // Tests that the CT compliance histograms are not recorded for @@ -1119,6 +1126,7 @@ ssl_socket_data.ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem"); ssl_socket_data.ssl_info.is_issued_by_known_root = false; + ssl_socket_data.ssl_info.ct_policy_compliance_required = false; ssl_socket_data.ssl_info.ct_policy_compliance = ct::CTPolicyCompliance::CT_POLICY_NOT_DIVERSE_SCTS; @@ -1142,6 +1150,7 @@ EXPECT_THAT(delegate.request_status(), IsOk()); histograms.ExpectTotalCount(kCTComplianceHistogramName, 0); + histograms.ExpectTotalCount(kCTRequiredHistogramName, 0); } // Tests that the CT compliance histogram is recorded when CT is required but @@ -1152,6 +1161,7 @@ ssl_socket_data.ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem"); ssl_socket_data.ssl_info.is_issued_by_known_root = true; + ssl_socket_data.ssl_info.ct_policy_compliance_required = true; ssl_socket_data.ssl_info.ct_policy_compliance = ct::CTPolicyCompliance::CT_POLICY_NOT_DIVERSE_SCTS; @@ -1178,6 +1188,10 @@ kCTComplianceHistogramName, static_cast<int32_t>(ct::CTPolicyCompliance::CT_POLICY_NOT_DIVERSE_SCTS), 1); + histograms.ExpectUniqueSample( + kCTRequiredHistogramName, + static_cast<int32_t>(ct::CTPolicyCompliance::CT_POLICY_NOT_DIVERSE_SCTS), + 1); } // Tests that the CT compliance histograms are not recorded when there is an @@ -1188,6 +1202,7 @@ ssl_socket_data.ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem"); ssl_socket_data.ssl_info.is_issued_by_known_root = true; + ssl_socket_data.ssl_info.ct_policy_compliance_required = true; ssl_socket_data.ssl_info.ct_policy_compliance = ct::CTPolicyCompliance::CT_POLICY_NOT_DIVERSE_SCTS; ssl_socket_data.ssl_info.cert_status = net::CERT_STATUS_DATE_INVALID; @@ -1212,6 +1227,7 @@ EXPECT_THAT(delegate.request_status(), IsOk()); histograms.ExpectTotalCount(kCTComplianceHistogramName, 0); + histograms.ExpectTotalCount(kCTRequiredHistogramName, 0); } TEST_F(URLRequestHttpJobWithMockSocketsTest, EncodingAdvertisementOnRange) {
diff --git a/remoting/host/clipboard_x11.cc b/remoting/host/clipboard_x11.cc index f3d4669..c19f785 100644 --- a/remoting/host/clipboard_x11.cc +++ b/remoting/host/clipboard_x11.cc
@@ -77,7 +77,7 @@ base::Unretained(this))); x_connection_watch_controller_ = base::FileDescriptorWatcher::WatchReadable( - XConnectionNumber(connection_->display()), + connection_->GetFd(), base::BindRepeating(&ClipboardX11::PumpXEvents, base::Unretained(this))); PumpXEvents(); }
diff --git a/remoting/host/desktop_resizer_x11.cc b/remoting/host/desktop_resizer_x11.cc index 58eafa6..0a10dd7 100644 --- a/remoting/host/desktop_resizer_x11.cc +++ b/remoting/host/desktop_resizer_x11.cc
@@ -180,7 +180,7 @@ // Grab the X server while we're changing the display resolution. This ensures // that the display configuration doesn't change under our feet. - ScopedXGrabServer grabber(connection_.display()); + ScopedXGrabServer grabber(&connection_); if (exact_resize_) SetResolutionNewMode(resolution);
diff --git a/remoting/host/input_monitor/local_hotkey_input_monitor_x11.cc b/remoting/host/input_monitor/local_hotkey_input_monitor_x11.cc index 4b2ee0e2..4cf9cc8 100644 --- a/remoting/host/input_monitor/local_hotkey_input_monitor_x11.cc +++ b/remoting/host/input_monitor/local_hotkey_input_monitor_x11.cc
@@ -162,7 +162,7 @@ // Register OnConnectionData() to be called every time there is // something to read from |connection_|. controller_ = base::FileDescriptorWatcher::WatchReadable( - XConnectionNumber(connection_->display()), + connection_->GetFd(), base::BindRepeating(&Core::OnConnectionData, base::Unretained(this))); // Fetch pending events if any.
diff --git a/remoting/host/input_monitor/local_mouse_input_monitor_x11.cc b/remoting/host/input_monitor/local_mouse_input_monitor_x11.cc index a0ef345b..b009fc282 100644 --- a/remoting/host/input_monitor/local_mouse_input_monitor_x11.cc +++ b/remoting/host/input_monitor/local_mouse_input_monitor_x11.cc
@@ -156,7 +156,7 @@ // Register OnConnectionData() to be called every time there is // something to read from |connection_|. controller_ = base::FileDescriptorWatcher::WatchReadable( - XConnectionNumber(connection_->display()), + connection_->GetFd(), base::BindRepeating(&Core::OnConnectionData, base::Unretained(this))); // Fetch pending events if any.
diff --git a/remoting/host/keyboard_layout_monitor_linux.cc b/remoting/host/keyboard_layout_monitor_linux.cc index fbc4534..22d6866 100644 --- a/remoting/host/keyboard_layout_monitor_linux.cc +++ b/remoting/host/keyboard_layout_monitor_linux.cc
@@ -162,7 +162,7 @@ }); connection_->Flush(); controller_ = base::FileDescriptorWatcher::WatchReadable( - XConnectionNumber(connection_->display()), + connection_->GetFd(), base::BindRepeating(&GdkLayoutMonitorOnGtkThread::OnConnectionData, base::Unretained(this))); }
diff --git a/remoting/host/linux/x11_util.cc b/remoting/host/linux/x11_util.cc index 1b1b186..805fe46 100644 --- a/remoting/host/linux/x11_util.cc +++ b/remoting/host/linux/x11_util.cc
@@ -36,13 +36,14 @@ return 0; } -ScopedXGrabServer::ScopedXGrabServer(Display* display) : display_(display) { - XGrabServer(display_); +ScopedXGrabServer::ScopedXGrabServer(x11::Connection* connection) + : connection_(connection) { + connection_->GrabServer({}); } ScopedXGrabServer::~ScopedXGrabServer() { - XUngrabServer(display_); - XFlush(display_); + connection_->UngrabServer({}); + connection_->Flush(); } bool IgnoreXServerGrabs(x11::Connection* connection, bool ignore) {
diff --git a/remoting/host/linux/x11_util.h b/remoting/host/linux/x11_util.h index 5390f12..83e7462 100644 --- a/remoting/host/linux/x11_util.h +++ b/remoting/host/linux/x11_util.h
@@ -44,21 +44,19 @@ DISALLOW_COPY_AND_ASSIGN(ScopedXErrorHandler); }; - // Grab/release the X server within a scope. This can help avoid race // conditions that would otherwise lead to X errors. class ScopedXGrabServer { public: - ScopedXGrabServer(Display* display); + explicit ScopedXGrabServer(x11::Connection* connection); ~ScopedXGrabServer(); private: - Display* display_; + x11::Connection* connection_; DISALLOW_COPY_AND_ASSIGN(ScopedXGrabServer); }; - // Make a connection to the X Server impervious to X Server grabs. Returns // true if successful or false if the required XTEST extension is not present. bool IgnoreXServerGrabs(x11::Connection* connection, bool ignore);
diff --git a/services/device/serial/BUILD.gn b/services/device/serial/BUILD.gn index e621836a..94aeb94c4 100644 --- a/services/device/serial/BUILD.gn +++ b/services/device/serial/BUILD.gn
@@ -58,6 +58,7 @@ deps = [ "//base", + "//components/device_event_log", "//device/bluetooth:bluetooth", "//device/bluetooth/public/cpp", "//mojo/public/cpp/bindings",
diff --git a/services/device/serial/DEPS b/services/device/serial/DEPS index 96812db..2128f6a 100644 --- a/services/device/serial/DEPS +++ b/services/device/serial/DEPS
@@ -1,5 +1,6 @@ include_rules = [ "+chromeos/dbus", + "+components/device_event_log", "+net/base", "+services/device/public/mojom", "+third_party/re2",
diff --git a/services/device/serial/serial_device_enumerator.cc b/services/device/serial/serial_device_enumerator.cc index 9e0e851..f1d3606 100644 --- a/services/device/serial/serial_device_enumerator.cc +++ b/services/device/serial/serial_device_enumerator.cc
@@ -8,6 +8,7 @@ #include "base/unguessable_token.h" #include "build/build_config.h" +#include "components/device_event_log/device_event_log.h" #if defined(OS_LINUX) || defined(OS_CHROMEOS) #include "services/device/serial/serial_device_enumerator_linux.h" @@ -91,6 +92,9 @@ auto it = ports_.find(token); DCHECK(it != ports_.end()); mojom::SerialPortInfoPtr port = std::move(it->second); + + SERIAL_LOG(EVENT) << "Serial device removed: path=" << port->path; + ports_.erase(it); for (auto& observer : observer_list_)
diff --git a/services/device/serial/serial_device_enumerator_linux.cc b/services/device/serial/serial_device_enumerator_linux.cc index febf405..af1af25 100644 --- a/services/device/serial/serial_device_enumerator_linux.cc +++ b/services/device/serial/serial_device_enumerator_linux.cc
@@ -17,6 +17,7 @@ #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "base/threading/scoped_blocking_call.h" +#include "components/device_event_log/device_event_log.h" #include "device/udev_linux/udev.h" namespace device { @@ -190,6 +191,11 @@ if (serial_number) info->serial_number = serial_number; + SERIAL_LOG(EVENT) << "Serial device added: path=" << info->path + << " vid=" << (vendor_id ? vendor_id : "(none)") + << " pid=" << (product_id ? product_id : "(none)") + << " serial=" << info->serial_number.value_or("(none)"); + paths_.insert(std::make_pair(syspath, token)); AddPort(std::move(info)); }
diff --git a/services/device/serial/serial_device_enumerator_mac.cc b/services/device/serial/serial_device_enumerator_mac.cc index 48223e6..cb96717 100644 --- a/services/device/serial/serial_device_enumerator_mac.cc +++ b/services/device/serial/serial_device_enumerator_mac.cc
@@ -27,6 +27,7 @@ #include "base/strings/stringprintf.h" #include "base/strings/sys_string_conversions.h" #include "base/threading/scoped_blocking_call.h" +#include "components/device_event_log/device_event_log.h" namespace device { @@ -230,13 +231,15 @@ auto token = base::UnguessableToken::Create(); info->token = token; - VLOG(1) << "Found serial device: dialin=" - << dialin_device.value_or("(none)") - << " callout=" << callout_device.value_or("(none)") - << " vid=" << vendor_id_str.value_or("(none)") - << " pid=" << product_id_str.value_or("(none)") - << " usb_serial=" << info->serial_number.value_or("(none)") - << " usb_driver=" << info->usb_driver_name.value_or("(none)"); + SERIAL_LOG(EVENT) << "Serial device added: dialin=" + << dialin_device.value_or("(none)") + << " callout=" << callout_device.value_or("(none)") + << " vid=" << vendor_id_str.value_or("(none)") + << " pid=" << product_id_str.value_or("(none)") + << " usb_serial=" + << info->serial_number.value_or("(none)") + << " usb_driver=" + << info->usb_driver_name.value_or("(none)"); entries_.insert({entry_id, token}); AddPort(std::move(info));
diff --git a/services/device/serial/serial_device_enumerator_win.cc b/services/device/serial/serial_device_enumerator_win.cc index ab7e412a..c64e04e0 100644 --- a/services/device/serial/serial_device_enumerator_win.cc +++ b/services/device/serial/serial_device_enumerator_win.cc
@@ -31,6 +31,7 @@ #include "base/threading/scoped_blocking_call.h" #include "base/win/registry.h" #include "base/win/scoped_devinfo.h" +#include "components/device_event_log/device_event_log.h" #include "services/device/public/cpp/device_features.h" #include "third_party/re2/src/re2/re2.h" @@ -317,10 +318,10 @@ product_id_str = base::StringPrintf("%04X", product_id); } - VLOG(1) << "Found serial device: path=" << info->path - << " instance_id=" << info->device_instance_id - << " vid=" << vendor_id_str.value_or("(none)") - << " pid=" << product_id_str.value_or("(none)"); + SERIAL_LOG(EVENT) << "Serial device added: path=" << info->path + << " instance_id=" << info->device_instance_id + << " vid=" << vendor_id_str.value_or("(none)") + << " pid=" << product_id_str.value_or("(none)"); paths_.insert(std::make_pair(*path, token)); AddPort(std::move(info));
diff --git a/services/device/serial/serial_io_handler.cc b/services/device/serial/serial_io_handler.cc index 54e2551..5e1411a 100644 --- a/services/device/serial/serial_io_handler.cc +++ b/services/device/serial/serial_io_handler.cc
@@ -16,6 +16,7 @@ #include "base/task/task_traits.h" #include "base/task/thread_pool.h" #include "build/build_config.h" +#include "components/device_event_log/device_event_log.h" #if defined(OS_CHROMEOS) #include "chromeos/dbus/permission_broker/permission_broker_client.h" @@ -98,8 +99,8 @@ const std::string& error_message) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(open_complete_); - LOG(ERROR) << "Permission broker failed to open '" << port_ - << "': " << error_name << ": " << error_message; + SERIAL_LOG(ERROR) << "Permission broker failed to open '" << port_ + << "': " << error_name << ": " << error_message; std::move(open_complete_).Run(false); } @@ -143,8 +144,8 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(open_complete_); if (!file.IsValid()) { - LOG(ERROR) << "Failed to open serial port: " - << base::File::ErrorToString(file.error_details()); + SERIAL_LOG(ERROR) << "Failed to open serial port: " + << base::File::ErrorToString(file.error_details()); std::move(open_complete_).Run(false); return; }
diff --git a/services/device/serial/serial_io_handler_posix.cc b/services/device/serial/serial_io_handler_posix.cc index ad3ae50..e768f572 100644 --- a/services/device/serial/serial_io_handler_posix.cc +++ b/services/device/serial/serial_io_handler_posix.cc
@@ -14,6 +14,7 @@ #include "base/files/file_util.h" #include "base/posix/eintr_wrapper.h" #include "build/build_config.h" +#include "components/device_event_log/device_event_log.h" #if defined(OS_LINUX) || defined(OS_CHROMEOS) #include <asm-generic/ioctls.h> @@ -171,7 +172,7 @@ struct termios config; if (tcgetattr(file().GetPlatformFile(), &config) != 0) { #endif - VPLOG(1) << "Failed to get port configuration"; + SERIAL_PLOG(DEBUG) << "Failed to get port configuration"; return false; } @@ -277,7 +278,7 @@ #else if (tcsetattr(file().GetPlatformFile(), TCSANOW, &config) != 0) { #endif - VPLOG(1) << "Failed to set port attributes"; + SERIAL_PLOG(DEBUG) << "Failed to set port attributes"; return false; } @@ -285,7 +286,7 @@ if (need_iossiospeed) { speed_t bitrate = options().bitrate; if (ioctl(file().GetPlatformFile(), IOSSIOSPEED, &bitrate) == -1) { - VPLOG(1) << "Failed to set custom baud rate"; + SERIAL_PLOG(DEBUG) << "Failed to set custom baud rate"; return false; } } @@ -330,7 +331,7 @@ mojom::SerialReceiveError::DEVICE_LOST); StopWatchingFileRead(); } else { - VPLOG(1) << "Read failed"; + SERIAL_PLOG(DEBUG) << "Read failed"; RunReadCompleted(within_read, 0, mojom::SerialReceiveError::SYSTEM_ERROR); } @@ -387,7 +388,7 @@ WriteCompleted(0, mojom::SerialSendError::DISCONNECTED); StopWatchingFileWrite(); } else { - VPLOG(1) << "Write failed"; + SERIAL_PLOG(DEBUG) << "Write failed"; WriteCompleted(0, mojom::SerialSendError::SYSTEM_ERROR); } } else { @@ -458,19 +459,19 @@ } if (tcflush(file().GetPlatformFile(), queue_selector) != 0) - VPLOG(1) << "Failed to flush port"; + SERIAL_PLOG(DEBUG) << "Failed to flush port"; } void SerialIoHandlerPosix::Drain() { if (tcdrain(file().GetPlatformFile()) != 0) - VPLOG(1) << "Failed to drain port"; + SERIAL_PLOG(DEBUG) << "Failed to drain port"; } mojom::SerialPortControlSignalsPtr SerialIoHandlerPosix::GetControlSignals() const { int status; if (ioctl(file().GetPlatformFile(), TIOCMGET, &status) == -1) { - VPLOG(1) << "Failed to get port control signals"; + SERIAL_PLOG(DEBUG) << "Failed to get port control signals"; return mojom::SerialPortControlSignalsPtr(); } @@ -505,24 +506,24 @@ } if (set && ioctl(file().GetPlatformFile(), TIOCMBIS, &set) != 0) { - VPLOG(1) << "Failed to set port control signals"; + SERIAL_PLOG(DEBUG) << "Failed to set port control signals"; return false; } if (clear && ioctl(file().GetPlatformFile(), TIOCMBIC, &clear) != 0) { - VPLOG(1) << "Failed to clear port control signals"; + SERIAL_PLOG(DEBUG) << "Failed to clear port control signals"; return false; } if (signals.has_brk) { if (signals.brk) { if (ioctl(file().GetPlatformFile(), TIOCSBRK, 0) != 0) { - VPLOG(1) << "Failed to set break"; + SERIAL_PLOG(DEBUG) << "Failed to set break"; return false; } } else { if (ioctl(file().GetPlatformFile(), TIOCCBRK, 0) != 0) { - VPLOG(1) << "Failed to clear break"; + SERIAL_PLOG(DEBUG) << "Failed to clear break"; return false; } } @@ -539,7 +540,7 @@ struct termios config; if (tcgetattr(file().GetPlatformFile(), &config) == -1) { #endif - VPLOG(1) << "Failed to get port info"; + SERIAL_PLOG(DEBUG) << "Failed to get port info"; return mojom::SerialConnectionInfoPtr(); }
diff --git a/services/device/serial/serial_io_handler_win.cc b/services/device/serial/serial_io_handler_win.cc index ca90b1ca..04eb76a8 100644 --- a/services/device/serial/serial_io_handler_win.cc +++ b/services/device/serial/serial_io_handler_win.cc
@@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/sequence_checker.h" #include "base/task/current_thread.h" +#include "components/device_event_log/device_event_log.h" namespace device { @@ -158,7 +159,7 @@ COMMTIMEOUTS timeouts = {0}; timeouts.ReadIntervalTimeout = 1; if (!::SetCommTimeouts(file().GetPlatformFile(), &timeouts)) { - VPLOG(1) << "Failed to set serial timeouts"; + SERIAL_PLOG(DEBUG) << "Failed to set serial timeouts"; return false; } @@ -208,21 +209,21 @@ DCHECK(file().IsValid()); if (!PurgeComm(file().GetPlatformFile(), PURGE_RXABORT)) - VPLOG(1) << "RX abort failed"; + SERIAL_PLOG(DEBUG) << "RX abort failed"; } void SerialIoHandlerWin::CancelWriteImpl() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(file().IsValid()); if (!PurgeComm(file().GetPlatformFile(), PURGE_TXABORT)) - VPLOG(1) << "TX abort failed"; + SERIAL_PLOG(DEBUG) << "TX abort failed"; } bool SerialIoHandlerWin::ConfigurePortImpl() { DCB config = {0}; config.DCBlength = sizeof(config); if (!GetCommState(file().GetPlatformFile(), &config)) { - VPLOG(1) << "Failed to get serial port info"; + SERIAL_PLOG(DEBUG) << "Failed to get serial port info"; return false; } @@ -258,7 +259,7 @@ } if (!SetCommState(file().GetPlatformFile(), &config)) { - VPLOG(1) << "Failed to set serial port info"; + SERIAL_PLOG(DEBUG) << "Failed to set serial port info"; return false; } return true; @@ -286,7 +287,8 @@ error == ERROR_DEVICE_REMOVED) { ReadCompleted(0, mojom::SerialReceiveError::DEVICE_LOST); } else { - VLOG(1) << "Read failed: " << logging::SystemErrorCodeToString(error); + SERIAL_LOG(DEBUG) << "Read failed: " + << logging::SystemErrorCodeToString(error); ReadCompleted(0, mojom::SerialReceiveError::SYSTEM_ERROR); } } else if (context == write_context_.get()) { @@ -298,7 +300,8 @@ } else if (error == ERROR_GEN_FAILURE) { WriteCompleted(0, mojom::SerialSendError::DISCONNECTED); } else { - VLOG(1) << "Write failed: " << logging::SystemErrorCodeToString(error); + SERIAL_LOG(DEBUG) << "Write failed: " + << logging::SystemErrorCodeToString(error); WriteCompleted(0, mojom::SerialSendError::SYSTEM_ERROR); if (error == ERROR_GEN_FAILURE && IsReadPending()) { // For devices using drivers such as FTDI, CP2xxx, when device is @@ -321,7 +324,7 @@ void SerialIoHandlerWin::ClearPendingError() { DWORD errors; if (!ClearCommError(file().GetPlatformFile(), &errors, nullptr)) { - VPLOG(1) << "Failed to clear communication error"; + SERIAL_PLOG(DEBUG) << "Failed to clear communication error"; return; } @@ -357,19 +360,19 @@ } if (!PurgeComm(file().GetPlatformFile(), flags)) - VPLOG(1) << "Failed to flush serial port"; + SERIAL_PLOG(DEBUG) << "Failed to flush serial port"; } void SerialIoHandlerWin::Drain() { if (!FlushFileBuffers(file().GetPlatformFile())) - VPLOG(1) << "Failed to drain serial port"; + SERIAL_PLOG(DEBUG) << "Failed to drain serial port"; } mojom::SerialPortControlSignalsPtr SerialIoHandlerWin::GetControlSignals() const { DWORD status; if (!GetCommModemStatus(file().GetPlatformFile(), &status)) { - VPLOG(1) << "Failed to get port control signals"; + SERIAL_PLOG(DEBUG) << "Failed to get port control signals"; return mojom::SerialPortControlSignalsPtr(); } @@ -385,18 +388,18 @@ const mojom::SerialHostControlSignals& signals) { if (signals.has_dtr && !EscapeCommFunction(file().GetPlatformFile(), signals.dtr ? SETDTR : CLRDTR)) { - VPLOG(1) << "Failed to configure DTR signal"; + SERIAL_PLOG(DEBUG) << "Failed to configure data-terminal-ready signal"; return false; } if (signals.has_rts && !EscapeCommFunction(file().GetPlatformFile(), signals.rts ? SETRTS : CLRRTS)) { - VPLOG(1) << "Failed to configure RTS signal"; + SERIAL_PLOG(DEBUG) << "Failed to configure request-to-send signal"; return false; } if (signals.has_brk && !EscapeCommFunction(file().GetPlatformFile(), signals.brk ? SETBREAK : CLRBREAK)) { - VPLOG(1) << "Failed to configure break signal"; + SERIAL_PLOG(DEBUG) << "Failed to configure break signal"; return false; } @@ -407,7 +410,7 @@ DCB config = {0}; config.DCBlength = sizeof(config); if (!GetCommState(file().GetPlatformFile(), &config)) { - VPLOG(1) << "Failed to get serial port info"; + SERIAL_PLOG(DEBUG) << "Failed to get serial port info"; return mojom::SerialConnectionInfoPtr(); } auto info = mojom::SerialConnectionInfo::New();
diff --git a/services/network/network_context.cc b/services/network/network_context.cc index f7d84ab0..4de2f631 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc
@@ -49,6 +49,7 @@ #include "net/cert/caching_cert_verifier.h" #include "net/cert/cert_verifier.h" #include "net/cert/coalescing_cert_verifier.h" +#include "net/cert/ct_verify_result.h" #include "net/cert_net/cert_net_fetcher_url_request.h" #include "net/cookies/cookie_monster.h" #include "net/dns/host_cache.h" @@ -2352,6 +2353,7 @@ auto pending_cert_verify = std::move(iter->second); cert_verifier_requests_.erase(iter); + net::ct::CTVerifyResult ct_verify_result; #if BUILDFLAG(IS_CT_SUPPORTED) if (result == net::OK) { net::X509Certificate* verified_cert = @@ -2359,17 +2361,15 @@ url_request_context_->cert_transparency_verifier()->Verify( pending_cert_verify->url.host(), verified_cert, pending_cert_verify->ocsp_result, pending_cert_verify->sct_list, - &pending_cert_verify->result->scts, + &ct_verify_result.scts, net::NetLogWithSource::Make( network_service_ ? url_request_context_->net_log() : nullptr, net::NetLogSourceType::CERT_VERIFIER_JOB)); - net::ct::SCTList verified_scts; - for (const auto& sct_and_status : pending_cert_verify->result->scts) { - if (sct_and_status.status == net::ct::SCT_STATUS_OK) - verified_scts.push_back(sct_and_status.sct); - } - pending_cert_verify->result->policy_compliance = + net::ct::SCTList verified_scts = net::ct::SCTsMatchingStatus( + ct_verify_result.scts, net::ct::SCT_STATUS_OK); + + ct_verify_result.policy_compliance = url_request_context_->ct_policy_enforcer()->CheckCompliance( verified_cert, verified_scts, net::NetLogWithSource::Make( @@ -2379,9 +2379,9 @@ // TODO(https://crbug.com/803774): We should determine whether EV & SXG // should be a thing (due to the online/offline signing difference) if (pending_cert_verify->result->cert_status & net::CERT_STATUS_IS_EV && - pending_cert_verify->result->policy_compliance != + ct_verify_result.policy_compliance != net::ct::CTPolicyCompliance::CT_POLICY_COMPLIES_VIA_SCTS && - pending_cert_verify->result->policy_compliance != + ct_verify_result.policy_compliance != net::ct::CTPolicyCompliance::CT_POLICY_BUILD_NOT_TIMELY) { pending_cert_verify->result->cert_status |= net::CERT_STATUS_CT_COMPLIANCE_FAILED; @@ -2396,17 +2396,16 @@ net::HostPortPair::FromURL(pending_cert_verify->url), pending_cert_verify->result->is_issued_by_known_root, pending_cert_verify->result->public_key_hashes, verified_cert, - pending_cert_verify->certificate.get(), - pending_cert_verify->result->scts, + pending_cert_verify->certificate.get(), ct_verify_result.scts, net::TransportSecurityState::ENABLE_EXPECT_CT_REPORTS, - pending_cert_verify->result->policy_compliance, + ct_verify_result.policy_compliance, net::NetworkIsolationKey::Todo()); if (url_request_context_->sct_auditing_delegate() && url_request_context_->sct_auditing_delegate()->IsSCTAuditingEnabled()) { url_request_context_->sct_auditing_delegate()->MaybeEnqueueReport( net::HostPortPair::FromURL(pending_cert_verify->url), verified_cert, - pending_cert_verify->result->scts); + ct_verify_result.scts); } switch (ct_requirement_status) { @@ -2414,22 +2413,26 @@ result = net::ERR_CERTIFICATE_TRANSPARENCY_REQUIRED; break; case net::TransportSecurityState::CT_REQUIREMENTS_MET: + ct_verify_result.policy_compliance_required = true; break; case net::TransportSecurityState::CT_NOT_REQUIRED: // CT is not required if the certificate does not chain to a publicly // trusted root certificate. - if (!pending_cert_verify->result->is_issued_by_known_root) + if (!pending_cert_verify->result->is_issued_by_known_root) { + ct_verify_result.policy_compliance_required = false; break; + } // For old certificates (issued before 2018-05-01), // CheckCTRequirements() may return CT_NOT_REQUIRED, so we check the // compliance status here. // TODO(https://crbug.com/851778): Remove this condition once we require // signing certificates to have CanSignHttpExchanges extension, because // such certificates should be naturally after 2018-05-01. - if (pending_cert_verify->result->policy_compliance == + if (ct_verify_result.policy_compliance == net::ct::CTPolicyCompliance::CT_POLICY_COMPLIES_VIA_SCTS || - pending_cert_verify->result->policy_compliance == + ct_verify_result.policy_compliance == net::ct::CTPolicyCompliance::CT_POLICY_BUILD_NOT_TIMELY) { + ct_verify_result.policy_compliance_required = true; break; } // Require CT compliance, by overriding CT_NOT_REQUIRED and treat it as @@ -2440,7 +2443,7 @@ #endif // BUILDFLAG(IS_CT_SUPPORTED) std::move(pending_cert_verify->callback) - .Run(result, *pending_cert_verify->result.get()); + .Run(result, *pending_cert_verify->result.get(), ct_verify_result); } #if defined(OS_CHROMEOS)
diff --git a/services/network/public/cpp/data_element.cc b/services/network/public/cpp/data_element.cc index f6fd523..545797e 100644 --- a/services/network/public/cpp/data_element.cc +++ b/services/network/public/cpp/data_element.cc
@@ -20,7 +20,6 @@ DataElement::DataElement() : type_(mojom::DataElementType::kUnknown), - bytes_(nullptr), offset_(0), length_(std::numeric_limits<uint64_t>::max()) {}
diff --git a/services/network/public/cpp/data_element.h b/services/network/public/cpp/data_element.h index 9c011753e1a..42e096a 100644 --- a/services/network/public/cpp/data_element.h +++ b/services/network/public/cpp/data_element.h
@@ -51,8 +51,7 @@ mojom::DataElementType type() const { return type_; } const char* bytes() const { - return bytes_ ? reinterpret_cast<const char*>(bytes_) - : reinterpret_cast<const char*>(buf_.data()); + return reinterpret_cast<const char*>(buf_.data()); } const base::FilePath& path() const { return path_; } const std::string& blob_uuid() const { return blob_uuid_; } @@ -62,14 +61,9 @@ return expected_modification_time_; } - // For use with SetToAllocatedBytes. Should only be used after calling - // SetToAllocatedBytes. - char* mutable_bytes() { return reinterpret_cast<char*>(&buf_[0]); } - // Sets TYPE_BYTES data. This copies the given data into the element. void SetToBytes(const char* bytes, int bytes_len) { type_ = mojom::DataElementType::kBytes; - bytes_ = nullptr; buf_.assign(reinterpret_cast<const uint8_t*>(bytes), reinterpret_cast<const uint8_t*>(bytes + bytes_len)); length_ = buf_.size(); @@ -78,7 +72,6 @@ // Sets TYPE_BYTES data. This moves the given data vector into the element. void SetToBytes(std::vector<uint8_t> bytes) { type_ = mojom::DataElementType::kBytes; - bytes_ = nullptr; buf_ = std::move(bytes); length_ = buf_.size(); } @@ -89,7 +82,6 @@ type_ = mojom::DataElementType::kBytes; buf_.clear(); length_ = 0; - bytes_ = nullptr; } // Copies and appends the given data into the element. SetToEmptyBytes or @@ -97,37 +89,11 @@ void AppendBytes(const char* bytes, int bytes_len) { DCHECK_EQ(type_, mojom::DataElementType::kBytes); DCHECK_NE(length_, std::numeric_limits<uint64_t>::max()); - DCHECK(!bytes_); buf_.insert(buf_.end(), reinterpret_cast<const uint8_t*>(bytes), reinterpret_cast<const uint8_t*>(bytes + bytes_len)); length_ = buf_.size(); } - // Sets TYPE_BYTES data. This does NOT copy the given data and the caller - // should make sure the data is alive when this element is accessed. - // You cannot use AppendBytes with this method. - void SetToSharedBytes(const char* bytes, int bytes_len) { - type_ = mojom::DataElementType::kBytes; - bytes_ = reinterpret_cast<const uint8_t*>(bytes); - length_ = bytes_len; - } - - // Sets TYPE_BYTES data. This allocates the space for the bytes in the - // internal vector but does not populate it with anything. The caller can - // then use the bytes() method to access this buffer and populate it. - void SetToAllocatedBytes(size_t bytes_len) { - type_ = mojom::DataElementType::kBytes; - bytes_ = nullptr; - buf_.resize(bytes_len); - length_ = bytes_len; - } - - // Sets TYPE_FILE data. - void SetToFilePath(const base::FilePath& path) { - SetToFilePathRange(path, 0, std::numeric_limits<uint64_t>::max(), - base::Time()); - } - // Sets TYPE_BLOB data. void SetToBlob(const std::string& uuid) { SetToBlobRange(uuid, 0, std::numeric_limits<uint64_t>::max()); @@ -181,8 +147,6 @@ mojom::DataElementType type_; // For TYPE_BYTES. std::vector<uint8_t> buf_; - // For TYPE_BYTES. - const uint8_t* bytes_; // For TYPE_FILE. base::FilePath path_; // For TYPE_BLOB.
diff --git a/services/network/public/cpp/net_ipc_param_traits.cc b/services/network/public/cpp/net_ipc_param_traits.cc index 9567cfd..bb2f1be 100644 --- a/services/network/public/cpp/net_ipc_param_traits.cc +++ b/services/network/public/cpp/net_ipc_param_traits.cc
@@ -74,8 +74,6 @@ WriteParam(m, p.is_issued_by_known_root); WriteParam(m, p.is_issued_by_additional_trust_anchor); WriteParam(m, p.ocsp_result); - WriteParam(m, p.scts); - WriteParam(m, p.policy_compliance); } bool ParamTraits<net::CertVerifyResult>::Read(const base::Pickle* m, @@ -89,8 +87,7 @@ ReadParam(m, iter, &r->public_key_hashes) && ReadParam(m, iter, &r->is_issued_by_known_root) && ReadParam(m, iter, &r->is_issued_by_additional_trust_anchor) && - ReadParam(m, iter, &r->ocsp_result) && ReadParam(m, iter, &r->scts) && - ReadParam(m, iter, &r->policy_compliance); + ReadParam(m, iter, &r->ocsp_result); } void ParamTraits<net::CertVerifyResult>::Log(const param_type& p, @@ -98,6 +95,26 @@ l->append("<CertVerifyResult>"); } +void ParamTraits<net::ct::CTVerifyResult>::Write(base::Pickle* m, + const param_type& p) { + WriteParam(m, p.scts); + WriteParam(m, p.policy_compliance); + WriteParam(m, p.policy_compliance_required); +} + +bool ParamTraits<net::ct::CTVerifyResult>::Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r) { + return ReadParam(m, iter, &r->scts) && + ReadParam(m, iter, &r->policy_compliance) && + ReadParam(m, iter, &r->policy_compliance_required); +} + +void ParamTraits<net::ct::CTVerifyResult>::Log(const param_type& p, + std::string* l) { + l->append("<CTVerifyResult>"); +} + void ParamTraits<net::HashValue>::Write(base::Pickle* m, const param_type& p) { WriteParam(m, p.ToString()); }
diff --git a/services/network/public/cpp/net_ipc_param_traits.h b/services/network/public/cpp/net_ipc_param_traits.h index 53f7441..c3835ff3 100644 --- a/services/network/public/cpp/net_ipc_param_traits.h +++ b/services/network/public/cpp/net_ipc_param_traits.h
@@ -21,6 +21,7 @@ #include "net/base/request_priority.h" #include "net/cert/cert_verify_result.h" #include "net/cert/ct_policy_status.h" +#include "net/cert/ct_verify_result.h" #include "net/cert/signed_certificate_timestamp.h" #include "net/cert/signed_certificate_timestamp_and_status.h" #include "net/cert/x509_certificate.h" @@ -81,6 +82,16 @@ }; template <> +struct COMPONENT_EXPORT(NETWORK_CPP_BASE) ParamTraits<net::ct::CTVerifyResult> { + typedef net::ct::CTVerifyResult param_type; + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +template <> struct COMPONENT_EXPORT(NETWORK_CPP_BASE) ParamTraits<net::HashValue> { typedef net::HashValue param_type; static void Write(base::Pickle* m, const param_type& p);
diff --git a/services/network/public/cpp/url_request_mojom_traits.h b/services/network/public/cpp/url_request_mojom_traits.h index b3f1996..ea30287 100644 --- a/services/network/public/cpp/url_request_mojom_traits.h +++ b/services/network/public/cpp/url_request_mojom_traits.h
@@ -308,12 +308,8 @@ const network::DataElement& element) { return element.type_; } - static std::vector<uint8_t> buf(const network::DataElement& element) { - if (element.bytes_) { - return std::vector<uint8_t>(element.bytes_, - element.bytes_ + element.length_); - } - return std::move(element.buf_); + static const std::vector<uint8_t>& buf(const network::DataElement& element) { + return element.buf_; } static const base::FilePath& path(const network::DataElement& element) { return element.path_;
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom index 184e48c..dfeaf3c 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom
@@ -1295,7 +1295,8 @@ url.mojom.Url url, string ocsp_response, string sct_list) => (int32 error_code, - CertVerifyResult cv_result); + CertVerifyResult cv_result, + CTVerifyResult ct_result); // Parses response headers and returns a structured version to the caller. // This call originates from the browser process. Used for navigations when
diff --git a/services/network/public/mojom/network_param.mojom b/services/network/public/mojom/network_param.mojom index 8f9f5d0..41f3103 100644 --- a/services/network/public/mojom/network_param.mojom +++ b/services/network/public/mojom/network_param.mojom
@@ -14,6 +14,9 @@ struct CertVerifyResult; [Native] +struct CTVerifyResult; + +[Native] struct HttpResponseHeaders; struct HttpVersion {
diff --git a/services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler.cc b/services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler.cc index 48d2076..1a4fe1e5 100644 --- a/services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler.cc +++ b/services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler.cc
@@ -686,7 +686,7 @@ // On Android the sampling profiler is implemented by tracing service and is // not yet supported by base::StackSamplingProfiler. So, only check this if // service does not support unwinding in current platform. - if (!base::StackSamplingProfiler::IsSupported()) + if (!base::StackSamplingProfiler::IsSupportedForCurrentPlatform()) return; #endif // !(ANDROID_ARM64_UNWINDING_SUPPORTED || // ANDROID_CFI_UNWINDING_SUPPORTED)
diff --git a/services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler_unittest.cc b/services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler_unittest.cc index 8ca971b..630df7a 100644 --- a/services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler_unittest.cc +++ b/services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler_unittest.cc
@@ -190,7 +190,7 @@ // DCHECK here so that when the sampling profiler is re-enabled on macOS 11, // these tests are also re-enabled. if (base::mac::IsAtLeastOS11()) { - DCHECK(!base::StackSamplingProfiler::IsSupported()); + DCHECK(!base::StackSamplingProfiler::IsSupportedForCurrentPlatform()); return true; } #endif
diff --git a/testing/buildbot/chromium.ci.json b/testing/buildbot/chromium.ci.json index 5a8f7b9..025740b2 100644 --- a/testing/buildbot/chromium.ci.json +++ b/testing/buildbot/chromium.ci.json
@@ -145563,49 +145563,22 @@ ] }, "Win10 FYI x64 SkiaRenderer GL (NVIDIA)": { - "gtest_tests": [ - { - "args": [ - "--enable-features=UseSkiaRenderer", - "--test-launcher-filter-file=../../testing/buildbot/filters/skia_renderer.content_browsertests.filter" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "name": "skia_renderer_content_browsertests", - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "content_browsertests", - "test_id_prefix": "ninja://content/test:content_browsertests/" - } - ], "isolated_scripts": [ { "args": [ - "context_lost", + "noop_sleep", "--show-stdout", "--browser=release_x64", "--passthrough", "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer" + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" ], "isolate_name": "telemetry_gpu_integration_test", "merge": { "args": [], "script": "//testing/merge_scripts/standard_isolated_script_merge.py" }, - "name": "gl_renderer_context_lost_tests", + "name": "noop_sleep_tests", "should_retry_with_patch": false, "swarming": { "can_use_on_swarming_builders": true, @@ -145621,254 +145594,6 @@ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "depth_capture", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gl_renderer_depth_capture_tests", - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "gpu_process", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gl_renderer_gpu_process_launch_tests", - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "hardware_accelerated_feature", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gl_renderer_hardware_accelerated_feature_tests", - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "maps", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer", - "--dont-restore-color-profile-after-test", - "--test-machine-name", - "${buildername}", - "--git-revision=${got_revision}" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gl_renderer_maps_pixel_tests", - "precommit_args": [ - "--gerrit-issue=${patch_issue}", - "--gerrit-patchset=${patch_set}", - "--buildbucket-id=${buildbucket_build_id}" - ], - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chrome-gpu-gold@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "pixel", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer", - "--dont-restore-color-profile-after-test", - "--test-machine-name", - "${buildername}", - "--git-revision=${got_revision}" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gl_renderer_pixel_skia_gold_tests", - "precommit_args": [ - "--gerrit-issue=${patch_issue}", - "--gerrit-patchset=${patch_set}", - "--buildbucket-id=${buildbucket_build_id}" - ], - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chrome-gpu-gold@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "screenshot_sync", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer", - "--dont-restore-color-profile-after-test" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gl_renderer_screenshot_sync_tests", - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "--num-retries=3", - "--additional-driver-flag=--enable-gpu-rasterization", - "--additional-driver-flag=--enable-features=UseSkiaRenderer", - "--additional-driver-flag=--use-gl=any", - "--additional-driver-flag=--force-gpu-rasterization", - "--additional-driver-flag=--enable-oop-rasterization", - "--additional-driver-flag=--disable-software-compositing-fallback", - "--additional-driver-flag=--disable-headless-mode", - "--no-xvfb", - "--fuzzy-diff", - "--skipped=always", - "--test-list=../../testing/buildbot/filters/gpu.skiarenderer_vulkan_blink_web_tests.filter", - "--additional-expectations=../../third_party/blink/web_tests/FlagExpectations/enable-features=UseSkiaRenderer", - "--additional-expectations=../../third_party/blink/web_tests/FlagExpectations/enable-gpu-rasterization", - "--additional-expectations=../../third_party/blink/web_tests/FlagExpectations/use-gl=any", - "--target", - "Release_x64" - ], - "isolate_name": "blink_web_tests", - "merge": { - "args": [ - "--verbose" - ], - "script": "//third_party/blink/tools/merge_web_test_results.py" - }, - "name": "skia_renderer_gl_blink_web_tests", - "results_handler": "layout tests", - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://:blink_web_tests/" } ] }, @@ -156253,38 +155978,6 @@ }, { "args": [ - "screenshot_sync", - "--show-stdout", - "--browser=debug_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer", - "--dont-restore-color-profile-after-test" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gl_renderer_screenshot_sync_tests", - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=debug_x64", @@ -156758,39 +156451,6 @@ }, { "args": [ - "screenshot_sync", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer", - "--dont-restore-color-profile-after-test" - ], - "isolate_name": "telemetry_gpu_integration_test", - "isolate_profile_data": true, - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gl_renderer_screenshot_sync_tests", - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release_x64",
diff --git a/testing/buildbot/chromium.gpu.fyi.json b/testing/buildbot/chromium.gpu.fyi.json index c0560c9..ed4be086 100644 --- a/testing/buildbot/chromium.gpu.fyi.json +++ b/testing/buildbot/chromium.gpu.fyi.json
@@ -32431,49 +32431,22 @@ ] }, "Win10 FYI x64 SkiaRenderer GL (NVIDIA)": { - "gtest_tests": [ - { - "args": [ - "--enable-features=UseSkiaRenderer", - "--test-launcher-filter-file=../../testing/buildbot/filters/skia_renderer.content_browsertests.filter" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "name": "skia_renderer_content_browsertests", - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "content_browsertests", - "test_id_prefix": "ninja://content/test:content_browsertests/" - } - ], "isolated_scripts": [ { "args": [ - "context_lost", + "noop_sleep", "--show-stdout", "--browser=release_x64", "--passthrough", "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer" + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" ], "isolate_name": "telemetry_gpu_integration_test", "merge": { "args": [], "script": "//testing/merge_scripts/standard_isolated_script_merge.py" }, - "name": "gl_renderer_context_lost_tests", + "name": "noop_sleep_tests", "should_retry_with_patch": false, "swarming": { "can_use_on_swarming_builders": true, @@ -32489,254 +32462,6 @@ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "depth_capture", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gl_renderer_depth_capture_tests", - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "gpu_process", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gl_renderer_gpu_process_launch_tests", - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "hardware_accelerated_feature", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gl_renderer_hardware_accelerated_feature_tests", - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "maps", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer", - "--dont-restore-color-profile-after-test", - "--test-machine-name", - "${buildername}", - "--git-revision=${got_revision}" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gl_renderer_maps_pixel_tests", - "precommit_args": [ - "--gerrit-issue=${patch_issue}", - "--gerrit-patchset=${patch_set}", - "--buildbucket-id=${buildbucket_build_id}" - ], - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chrome-gpu-gold@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "pixel", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer", - "--dont-restore-color-profile-after-test", - "--test-machine-name", - "${buildername}", - "--git-revision=${got_revision}" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gl_renderer_pixel_skia_gold_tests", - "precommit_args": [ - "--gerrit-issue=${patch_issue}", - "--gerrit-patchset=${patch_set}", - "--buildbucket-id=${buildbucket_build_id}" - ], - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chrome-gpu-gold@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "screenshot_sync", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer", - "--dont-restore-color-profile-after-test" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gl_renderer_screenshot_sync_tests", - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "--num-retries=3", - "--additional-driver-flag=--enable-gpu-rasterization", - "--additional-driver-flag=--enable-features=UseSkiaRenderer", - "--additional-driver-flag=--use-gl=any", - "--additional-driver-flag=--force-gpu-rasterization", - "--additional-driver-flag=--enable-oop-rasterization", - "--additional-driver-flag=--disable-software-compositing-fallback", - "--additional-driver-flag=--disable-headless-mode", - "--no-xvfb", - "--fuzzy-diff", - "--skipped=always", - "--test-list=../../testing/buildbot/filters/gpu.skiarenderer_vulkan_blink_web_tests.filter", - "--additional-expectations=../../third_party/blink/web_tests/FlagExpectations/enable-features=UseSkiaRenderer", - "--additional-expectations=../../third_party/blink/web_tests/FlagExpectations/enable-gpu-rasterization", - "--additional-expectations=../../third_party/blink/web_tests/FlagExpectations/use-gl=any", - "--target", - "Release_x64" - ], - "isolate_name": "blink_web_tests", - "merge": { - "args": [ - "--verbose" - ], - "script": "//third_party/blink/tools/merge_web_test_results.py" - }, - "name": "skia_renderer_gl_blink_web_tests", - "results_handler": "layout tests", - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://:blink_web_tests/" } ] },
diff --git a/testing/buildbot/chromium.gpu.json b/testing/buildbot/chromium.gpu.json index 48a58f1..ec90881 100644 --- a/testing/buildbot/chromium.gpu.json +++ b/testing/buildbot/chromium.gpu.json
@@ -4694,38 +4694,6 @@ }, { "args": [ - "screenshot_sync", - "--show-stdout", - "--browser=debug_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer", - "--dont-restore-color-profile-after-test" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gl_renderer_screenshot_sync_tests", - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=debug_x64", @@ -5199,39 +5167,6 @@ }, { "args": [ - "screenshot_sync", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --disable-features=UseSkiaRenderer", - "--dont-restore-color-profile-after-test" - ], - "isolate_name": "telemetry_gpu_integration_test", - "isolate_profile_data": true, - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gl_renderer_screenshot_sync_tests", - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release_x64",
diff --git a/testing/buildbot/test_suite_exceptions.pyl b/testing/buildbot/test_suite_exceptions.pyl index 77160232..d1fc5839 100644 --- a/testing/buildbot/test_suite_exceptions.pyl +++ b/testing/buildbot/test_suite_exceptions.pyl
@@ -2392,16 +2392,6 @@ } } }, - 'skia_renderer_gl_blink_web_tests': { - 'modifications': { - 'Win10 FYI x64 SkiaRenderer GL (NVIDIA)': { - 'args': [ - '--target', - 'Release_x64', - ], - }, - }, - }, 'storage_service_content_browsertests': { 'modifications': { 'Linux Tests (dbg)(1)': {
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index b88d535d..b5e6239 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -2361,78 +2361,6 @@ }, }, - 'gpu_gl_renderer_full_telemetry_tests': { - 'context_lost': { - 'name': 'gl_renderer_context_lost_tests', - 'args': [ - '--extra-browser-args=--disable-features=UseSkiaRenderer', - ], - }, - 'depth_capture': { - 'name': 'gl_renderer_depth_capture_tests', - 'args': [ - '--extra-browser-args=--disable-features=UseSkiaRenderer', - ], - }, - 'gpu_process': { - 'name': 'gl_renderer_gpu_process_launch_tests', - 'args': [ - '--extra-browser-args=--disable-features=UseSkiaRenderer', - ], - }, - 'hardware_accelerated_feature': { - 'name': 'gl_renderer_hardware_accelerated_feature_tests', - 'args': [ - '--extra-browser-args=--disable-features=UseSkiaRenderer', - ], - }, - 'maps': { - 'name': 'gl_renderer_maps_pixel_tests', - 'args': [ - '--dont-restore-color-profile-after-test', - '--test-machine-name', - '${buildername}', - '--extra-browser-args=--disable-features=UseSkiaRenderer', - ], - 'android_args': [ - # TODO(crbug.com/1093085): Remove this once we fix the tests. - '--extra-browser-args=--force-online-connection-state-for-indicator', - ], - 'mixins': [ - 'chrome-gpu-gold-service-account', - 'skia_gold_test', - ], - }, - 'pixel': { - 'name': 'gl_renderer_pixel_skia_gold_tests', - 'args': [ - '--dont-restore-color-profile-after-test', - '--test-machine-name', - '${buildername}', - '--extra-browser-args=--disable-features=UseSkiaRenderer', - ], - 'android_args': [ - # TODO(crbug.com/1093085): Remove this once we fix the tests. - '--extra-browser-args=--force-online-connection-state-for-indicator', - ], - 'mixins': [ - 'chrome-gpu-gold-service-account', - 'skia_gold_test', - ], - }, - 'screenshot_sync': { - 'name': 'gl_renderer_screenshot_sync_tests', - 'args': [ - '--dont-restore-color-profile-after-test', - '--extra-browser-args=--disable-features=UseSkiaRenderer', - ], - 'android_args': [ - # TODO(crbug.com/1093085): Remove this once we fix the tests. - '--extra-browser-args=--force-online-connection-state-for-indicator', - ], - }, - }, - # Very small set of test that exercise GLRenderer and produce pixels for CQ. # For use where SkiaRenderer is enabled by field trial or default. 'gpu_gl_renderer_small_telemetry_tests': { @@ -3987,19 +3915,6 @@ }, }, - 'skia_renderer_gtests': { - 'skia_renderer_content_browsertests': { - 'args': [ - '--enable-features=UseSkiaRenderer', - '--test-launcher-filter-file=../../testing/buildbot/filters/skia_renderer.content_browsertests.filter', - ], - 'swarming': { - 'shards': 1, - }, - 'test': 'content_browsertests', - }, - }, - 'skia_renderer_isolated_scripts': { 'non_skia_renderer_swiftshader_blink_web_tests': { # layout test failures are retried 3 times when '--test-list' is not @@ -5128,7 +5043,6 @@ 'gpu_common_and_optional_telemetry_tests', 'gpu_passthrough_telemetry_tests', 'gpu_webgl_conformance_d3d11_passthrough_telemetry_tests', - 'gpu_gl_renderer_small_telemetry_tests', ], 'gpu_dawn_asan_isolated_scripts': [
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index c5799f70..103d421c 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -4065,14 +4065,7 @@ 'win10_nvidia_quadro_p400_stable', ], 'test_suites': { - # UseSkiaRenderer is enabled through fieldtrial_testing_config.json on - # Windows. Telemetry tests now run with SkiaRenderer by default, so - # this bot runs them with GLRenderer to maintain coverage. Other - # content based tests still run with GLRenderer by default so this bot - # runs them with SkiaRenderer. - 'gtest_tests': 'skia_renderer_gtests', - 'isolated_scripts': 'gpu_blink_web_tests_skia_renderer', - 'gpu_telemetry_tests': 'gpu_gl_renderer_full_telemetry_tests', + 'gpu_telemetry_tests': 'gpu_noop_sleep_telemetry_test', }, }, 'Win10 FYI x64 dEQP Release (Intel HD 630)': {
diff --git a/testing/scripts/check_static_initializers.py b/testing/scripts/check_static_initializers.py index 8e1859f..c7b15d8 100755 --- a/testing/scripts/check_static_initializers.py +++ b/testing/scripts/check_static_initializers.py
@@ -36,8 +36,6 @@ 'debugallocation_shim.cc', # TODO(crbug.com/973552): Remove. 'iostream.cpp', # TODO(crbug.com/973554): Remove. 'spinlock.cc', # TODO(crbug.com/973556): Remove. - 'dlcservice_client.cc', # TODO(crbug.com/537099): Remove. - 'hud_display.cc', # TODO(crbug.com/537099): Remove. 'int256.cc', # TODO(crbug.com/537099): Remove. 'native_message_host_chromeos.cc', # TODO(crbug.com/537099): Remove. 'protobuf_http_status.cc', # TODO(crbug.com/537099): Remove.
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index bd81bc491..b1e15ab 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -6943,27 +6943,6 @@ ] } ], - "TransferableStreams": [ - { - "platforms": [ - "android", - "android_weblayer", - "android_webview", - "chromeos", - "linux", - "mac", - "windows" - ], - "experiments": [ - { - "name": "Enabled", - "enable_features": [ - "TransferableStreams" - ] - } - ] - } - ], "TranslateCompactUI": [ { "platforms": [
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc index c6db67a..4e71d1e9 100644 --- a/third_party/blink/common/features.cc +++ b/third_party/blink/common/features.cc
@@ -567,6 +567,8 @@ const base::FeatureParam<int> kFontPreloadingDelaysRenderingParam{ &kFontPreloadingDelaysRendering, "delay-in-ms", 50}; +const base::Feature kFlexAspectRatio{"FlexAspectRatio", + base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kFlexNG{"FlexNG", base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kKeepScriptResourceAlive{"KeepScriptResourceAlive", @@ -748,11 +750,6 @@ const base::Feature kContentCaptureUserActivatedDelay = { "ContentCaptureUserActivatedDelay", base::FEATURE_DISABLED_BY_DEFAULT}; -// Enable ReadableStream, WritableStream and TransformStream objects to be -// transferred with postMessage(). -const base::Feature kTransferableStreams{"TransferableStreams", - base::FEATURE_DISABLED_BY_DEFAULT}; - // Dispatches a fake fetch event to a service worker to check the offline // capability of the site before promoting installation. // See https://crbug.com/965802 for more details.
diff --git a/third_party/blink/common/privacy_budget/identifiability_metrics_unittest.cc b/third_party/blink/common/privacy_budget/identifiability_metrics_unittest.cc index 167b92a..ab14e10 100644 --- a/third_party/blink/common/privacy_budget/identifiability_metrics_unittest.cc +++ b/third_party/blink/common/privacy_budget/identifiability_metrics_unittest.cc
@@ -41,104 +41,4 @@ IdentifiabilityDigestOfBytes(kOneByte)); } -TEST(IdentifiabilityMetricsTest, PassInt) { - EXPECT_EQ(UINT64_C(5), IdentifiabilityDigestHelper(5)); -} - -TEST(IdentifiabilityMetricsTest, PassChar) { - EXPECT_EQ(UINT64_C(97), IdentifiabilityDigestHelper('a')); -} - -TEST(IdentifiabilityMetricsTest, PassBool) { - EXPECT_EQ(UINT64_C(1), IdentifiabilityDigestHelper(true)); -} - -TEST(IdentifiabilityMetricsTest, PassLong) { - EXPECT_EQ(UINT64_C(5), IdentifiabilityDigestHelper(5L)); -} - -TEST(IdentifiabilityMetricsTest, PassUint16) { - EXPECT_EQ(UINT64_C(5), IdentifiabilityDigestHelper(static_cast<uint16_t>(5))); -} - -TEST(IdentifiabilityMetricsTest, PassSizeT) { - EXPECT_EQ(UINT64_C(1), IdentifiabilityDigestHelper(sizeof(char))); -} - -TEST(IdentifiabilityMetricsTest, PassFloat) { - EXPECT_NE(UINT64_C(0), IdentifiabilityDigestHelper(5.0f)); -} - -TEST(IdentifiabilityMetricsTest, PassDouble) { - EXPECT_NE(UINT64_C(0), IdentifiabilityDigestHelper(5.0)); -} - -// Use an arbitrary, large number to make accidental matches unlikely. -enum SimpleEnum { kSimpleValue = 2730421 }; - -TEST(IdentifiabilityMetricsTest, PassEnum) { - EXPECT_EQ(UINT64_C(2730421), IdentifiabilityDigestHelper(kSimpleValue)); -} - -namespace { - -// Use an arbitrary, large number to make accidental matches unlikely. -enum Simple64Enum : uint64_t { kSimple64Value = 4983422 }; - -// Use an arbitrary, large number to make accidental matches unlikely. -enum class SimpleEnumClass { kSimpleValue = 3498249 }; - -// Use an arbitrary, large number to make accidental matches unlikely. -enum class SimpleEnumClass64 : uint64_t { kSimple64Value = 4398372 }; - -constexpr uint64_t kExpectedCombinationResult = UINT64_C(0xa5e30a57547cd49b); - -} // namespace - -TEST(IdentifiabilityMetricsTest, PassEnum64) { - EXPECT_EQ(UINT64_C(4983422), IdentifiabilityDigestHelper(kSimple64Value)); -} - -TEST(IdentifiabilityMetricsTest, PassEnumClass) { - EXPECT_EQ(UINT64_C(3498249), - IdentifiabilityDigestHelper(SimpleEnumClass::kSimpleValue)); -} - -TEST(IdentifiabilityMetricsTest, PassEnumClass64) { - EXPECT_EQ(UINT64_C(4398372), - IdentifiabilityDigestHelper(SimpleEnumClass64::kSimple64Value)); -} - -TEST(IdentifiabilityMetricsTest, PassSpan) { - const int data[] = {1, 2, 3}; - EXPECT_EQ(UINT64_C(0xb0dd8c7041b0a8bb), - IdentifiabilityDigestHelper(base::make_span(data))); -} - -TEST(IdentifiabilityMetricsTest, PassSpanDouble) { - const double data[] = {1.0, 2.0, 3.0}; - EXPECT_EQ(UINT64_C(0x95f52e9784f9582a), - IdentifiabilityDigestHelper(base::make_span(data))); -} - -TEST(IdentifiabilityMetricsTest, Combination) { - const int data[] = {1, 2, 3}; - EXPECT_EQ(kExpectedCombinationResult, - IdentifiabilityDigestHelper( - 5, 'a', true, static_cast<uint16_t>(5), sizeof(char), - kSimpleValue, kSimple64Value, SimpleEnumClass::kSimpleValue, - SimpleEnumClass64::kSimple64Value, base::make_span(data))); -} - -TEST(IdentifiabilityMetricsTest, CombinationWithFloats) { - const int data[] = {1, 2, 3}; - const int data_doubles[] = {1.0, 2.0, 3.0}; - EXPECT_NE(kExpectedCombinationResult, - IdentifiabilityDigestHelper( - 5, 'a', true, static_cast<uint16_t>(5), sizeof(char), - kSimpleValue, kSimple64Value, SimpleEnumClass::kSimpleValue, - SimpleEnumClass64::kSimple64Value, 5.0f, 5.0, - base::make_span(data), base::make_span(data_doubles))); -} - } // namespace blink
diff --git a/third_party/blink/public/BUILD.gn b/third_party/blink/public/BUILD.gn index 1592910..234ca9fe 100644 --- a/third_party/blink/public/BUILD.gn +++ b/third_party/blink/public/BUILD.gn
@@ -213,7 +213,6 @@ "platform/web_frame_request_blocker.h", "platform/web_gesture_curve.h", "platform/web_graphics_context_3d_provider.h", - "platform/web_history_scroll_restoration_type.h", "platform/web_http_body.h", "platform/web_http_header_visitor.h", "platform/web_http_load_info.h",
diff --git a/third_party/blink/public/common/features.h b/third_party/blink/public/common/features.h index 74cf5f4..61a9a903 100644 --- a/third_party/blink/public/common/features.h +++ b/third_party/blink/public/common/features.h
@@ -177,6 +177,7 @@ BLINK_COMMON_EXPORT extern const base::FeatureParam<int> kFontPreloadingDelaysRenderingParam; +BLINK_COMMON_EXPORT extern const base::Feature kFlexAspectRatio; BLINK_COMMON_EXPORT extern const base::Feature kFlexNG; BLINK_COMMON_EXPORT extern const base::Feature kKeepScriptResourceAlive; @@ -302,8 +303,6 @@ BLINK_COMMON_EXPORT extern const base::Feature kContentCaptureUserActivatedDelay; -BLINK_COMMON_EXPORT extern const base::Feature kTransferableStreams; - BLINK_COMMON_EXPORT extern const base::Feature kCheckOfflineCapability; BLINK_COMMON_EXPORT extern const base::Feature
diff --git a/third_party/blink/public/common/fetch/fetch_api_request_body_mojom_traits.h b/third_party/blink/public/common/fetch/fetch_api_request_body_mojom_traits.h index e06627a..4ad1306 100644 --- a/third_party/blink/public/common/fetch/fetch_api_request_body_mojom_traits.h +++ b/third_party/blink/public/common/fetch/fetch_api_request_body_mojom_traits.h
@@ -55,12 +55,8 @@ const network::DataElement& element) { return element.type_; } - static std::vector<uint8_t> buf(const network::DataElement& element) { - if (element.bytes_) { - return std::vector<uint8_t>(element.bytes_, - element.bytes_ + element.length_); - } - return std::move(element.buf_); + static const std::vector<uint8_t>& buf(const network::DataElement& element) { + return element.buf_; } static const base::FilePath& path(const network::DataElement& element) { return element.path_;
diff --git a/third_party/blink/public/common/privacy_budget/identifiability_metrics.h b/third_party/blink/public/common/privacy_budget/identifiability_metrics.h index c3b02b0..d87d78e7 100644 --- a/third_party/blink/public/common/privacy_budget/identifiability_metrics.h +++ b/third_party/blink/public/common/privacy_budget/identifiability_metrics.h
@@ -37,80 +37,6 @@ BLINK_COMMON_EXPORT uint64_t IdentifiabilityDigestOfBytes(base::span<const uint8_t> in); -// A family of helper function overloads that produce digests for basic types. -// If sizeof(in) <= 64, the underlying bits are used directly; no hash is -// invoked. -// -// The set of supported types can be extended by declaring overloads of -// IdentifiabilityDigestHelper(); such declarations should be made in a header -// included before this header so that they can be used by the span and -// parameter pack overloads of IdentifiabilityDigestHelper. -// -// TODO(asanka): Remove once callers have been migrated to -// IdentifiabilityToken(). - -// Integer version. -template <typename T, - typename std::enable_if_t<std::is_integral<T>::value>* = nullptr> -uint64_t IdentifiabilityDigestHelper(T in) { - static_assert(sizeof(in) <= sizeof(uint64_t), - "The input type must be smaller than 64 bits."); - return in; -} - -// Floating-point version. Note that this doesn't account for endianness, and -// that integer and floating point endianness need not match for a given -// architecture. -template < - typename T, - typename std::enable_if_t<std::is_floating_point<T>::value>* = nullptr> -uint64_t IdentifiabilityDigestHelper(T in) { - static_assert(sizeof(in) <= sizeof(uint64_t), - "The input type must be smaller than 64 bits."); - uint64_t result = 0; - std::memcpy(&result, &in, sizeof(in)); - return result; -} - -// Enum version. This just casts to the underlying type of the enum, which is -// then converted to uint64_t. -template <typename T, - typename std::enable_if_t<std::is_enum<T>::value>* = nullptr> -uint64_t IdentifiabilityDigestHelper(T in) { - static_assert(sizeof(in) <= sizeof(uint64_t), - "The input type must be smaller than 64 bits."); - return static_cast<typename std::underlying_type<T>::type>(in); -} - -// Computes a combined digest for a span of elements. T can be any type -// supported by a IdentifiabilityDigestHelper overload declared before this -// function. -template <typename T, size_t Extent> -uint64_t IdentifiabilityDigestHelper(base::span<T, Extent> span) { - uint64_t cur_digest = 0; - for (const auto& element : span) { - uint64_t digests[2]; - digests[0] = cur_digest; - digests[1] = IdentifiabilityDigestHelper(element); - cur_digest = IdentifiabilityDigestOfBytes( - base::make_span(reinterpret_cast<uint8_t*>(digests), sizeof(digests))); - } - return cur_digest; -} - -// Computes a combined digest value for a series of elements passed in as -// arguments. This declaration must appear after any other -// IdentifiabilityDigestHelper() -// overloads. -template <typename T, typename... Targs> -uint64_t IdentifiabilityDigestHelper(T in, Targs... extra_in) { - uint64_t digests[2]; - digests[0] = IdentifiabilityDigestHelper(in); - digests[1] = IdentifiabilityDigestHelper(extra_in...); - return IdentifiabilityDigestOfBytes( - base::make_span(reinterpret_cast<uint8_t*>(digests), sizeof(digests))); -} - // The zero-length digest, i.e. the digest computed for no bytes. static constexpr uint64_t kIdentifiabilityDigestOfNoBytes = 0x9ae16a3b2f90404fULL;
diff --git a/third_party/blink/public/common/privacy_budget/identifiable_surface.h b/third_party/blink/public/common/privacy_budget/identifiable_surface.h index a6568cb..66ee87a9 100644 --- a/third_party/blink/public/common/privacy_budget/identifiable_surface.h +++ b/third_party/blink/public/common/privacy_budget/identifiable_surface.h
@@ -178,6 +178,12 @@ // Extension cancelled a network request. Input is the extension ID. kExtensionCancelRequest = 15, + // WebGLRenderingContext.getShaderPrecisionFormat() is a high entropy API + // that leaks entropy about the underlying GL implementation. + // The output is keyed on two enums, but for the identifiability study we + // will key this type on a digest of both the enums' values. + kWebGLShaderPrecisionFormat = 16, + // We can use values up to and including |kMax|. kMax = (1 << kTypeBits) - 1 };
diff --git a/third_party/blink/public/mojom/BUILD.gn b/third_party/blink/public/mojom/BUILD.gn index c8447d2..f260bf6 100644 --- a/third_party/blink/public/mojom/BUILD.gn +++ b/third_party/blink/public/mojom/BUILD.gn
@@ -120,6 +120,7 @@ "page/page_visibility_state.mojom", "page/record_content_to_visible_time_request.mojom", "page/widget.mojom", + "page_state/page_state.mojom", "payments/payment_app.mojom", "payments/payment_credential.mojom", "peerconnection/peer_connection_tracker.mojom",
diff --git a/third_party/blink/public/mojom/page_state/OWNERS b/third_party/blink/public/mojom/page_state/OWNERS new file mode 100644 index 0000000..08850f4 --- /dev/null +++ b/third_party/blink/public/mojom/page_state/OWNERS
@@ -0,0 +1,2 @@ +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS
diff --git a/content/common/page_state.mojom b/third_party/blink/public/mojom/page_state/page_state.mojom similarity index 87% rename from content/common/page_state.mojom rename to third_party/blink/public/mojom/page_state/page_state.mojom index ef6e9e5..b8da3cc 100644 --- a/content/common/page_state.mojom +++ b/third_party/blink/public/mojom/page_state/page_state.mojom
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -module content.history.mojom; +module blink.mojom; // WARNING: Please read the comments below, before including other Mojo types. import "mojo/public/mojom/base/string16.mojom"; @@ -44,7 +44,7 @@ // Next Ordinal: 4 // FileSystemFile is no longer supported. -[Stable] +[Stable, RenamedFrom="content.history.mojom.DEPRECATED_FileSystemFile"] struct DEPRECATED_FileSystemFile { url.mojom.Url filesystem_url@0; uint64 offset@1; @@ -53,7 +53,7 @@ }; // Next Ordinal: 4 -[Stable] +[Stable, RenamedFrom="content.history.mojom.File"] struct File { mojo_base.mojom.String16 path@0; uint64 offset@1; @@ -62,7 +62,7 @@ }; // Next Ordinal: 4 -[Stable] +[Stable, RenamedFrom="content.history.mojom.Element"] union Element { string blob_uuid@0; array<uint8> bytes@1; @@ -72,7 +72,7 @@ }; // Next Ordinal: 3 -[Stable] +[Stable, RenamedFrom="content.history.mojom.RequestBody"] struct RequestBody { array<Element> elements@0; int64 identifier@1; @@ -80,23 +80,21 @@ }; // Next Ordinal: 3 -[Stable] +[Stable, RenamedFrom="content.history.mojom.HttpBody"] struct HttpBody { mojo_base.mojom.String16? http_content_type@0; RequestBody? request_body@1; bool contains_passwords@2 = false; }; -// This enum's values must match blink::WebHistoryScrollRestorationType. This -// is enforced with static asserts in page_state_serialization.cc. -[Stable, Extensible] +[Stable, Extensible, RenamedFrom="content.history.mojom.ScrollRestorationType"] enum ScrollRestorationType { kAuto = 0, kManual = 1 }; // Next Ordinal: 6 -[Stable] +[Stable, RenamedFrom="content.history.mojom.ViewState"] struct ViewState { gfx.mojom.PointF visual_viewport_scroll_offset@0; gfx.mojom.Point scroll_offset@1; @@ -108,7 +106,7 @@ }; // Next Ordinal: 13 -[Stable] +[Stable, RenamedFrom="content.history.mojom.FrameState"] struct FrameState { mojo_base.mojom.String16? url_string@0; mojo_base.mojom.String16? referrer@1; @@ -126,7 +124,7 @@ }; // Next Ordinal: 2 -[Stable] +[Stable, RenamedFrom="content.history.mojom.PageState"] struct PageState { array<mojo_base.mojom.String16?> referenced_files@0; FrameState top@1;
diff --git a/third_party/blink/public/platform/web_history_scroll_restoration_type.h b/third_party/blink/public/platform/web_history_scroll_restoration_type.h deleted file mode 100644 index 1b06d5f..0000000 --- a/third_party/blink/public/platform/web_history_scroll_restoration_type.h +++ /dev/null
@@ -1,43 +0,0 @@ -/* - * Copyright (C) 2015 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_HISTORY_SCROLL_RESTORATION_TYPE_H_ -#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_HISTORY_SCROLL_RESTORATION_TYPE_H_ - -namespace blink { - -// Represents scroll restoration type for history item. -enum WebHistoryScrollRestorationType { - kWebHistoryScrollRestorationAuto, - kWebHistoryScrollRestorationManual -}; - -} // namespace blink -#endif
diff --git a/third_party/blink/public/web/web_ax_object.h b/third_party/blink/public/web/web_ax_object.h index e72ca89e..91b822f 100644 --- a/third_party/blink/public/web/web_ax_object.h +++ b/third_party/blink/public/web/web_ax_object.h
@@ -68,8 +68,6 @@ virtual ~WebAXSparseAttributeClient() = default; virtual void AddBoolAttribute(WebAXBoolAttribute, bool) = 0; - virtual void AddIntAttribute(WebAXIntAttribute, int32_t) = 0; - virtual void AddUIntAttribute(WebAXUIntAttribute, uint32_t) = 0; virtual void AddStringAttribute(WebAXStringAttribute, const WebString&) = 0; virtual void AddObjectAttribute(WebAXObjectAttribute, const WebAXObject&) = 0; virtual void AddObjectVectorAttribute(WebAXObjectVectorAttribute, @@ -332,10 +330,6 @@ BLINK_EXPORT bool ScrollToGlobalPoint(const gfx::Point&) const; // For a table - BLINK_EXPORT int AriaColumnCount() const; - BLINK_EXPORT unsigned AriaColumnIndex() const; - BLINK_EXPORT int AriaRowCount() const; - BLINK_EXPORT unsigned AriaRowIndex() const; BLINK_EXPORT unsigned ColumnCount() const; BLINK_EXPORT unsigned RowCount() const; BLINK_EXPORT WebAXObject CellForColumnAndRow(unsigned column,
diff --git a/third_party/blink/public/web/web_history_item.h b/third_party/blink/public/web/web_history_item.h index f4c2f0a..fc386c2 100644 --- a/third_party/blink/public/web/web_history_item.h +++ b/third_party/blink/public/web/web_history_item.h
@@ -32,8 +32,8 @@ #define THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_HISTORY_ITEM_H_ #include "services/network/public/mojom/referrer_policy.mojom-shared.h" +#include "third_party/blink/public/mojom/page_state/page_state.mojom-shared.h" #include "third_party/blink/public/platform/web_common.h" -#include "third_party/blink/public/platform/web_history_scroll_restoration_type.h" #include "third_party/blink/public/platform/web_private_ptr.h" #include "third_party/blink/public/platform/web_scroll_anchor_data.h" #include "third_party/blink/public/platform/web_string.h" @@ -102,8 +102,8 @@ BLINK_EXPORT int64_t DocumentSequenceNumber() const; BLINK_EXPORT void SetDocumentSequenceNumber(int64_t); - BLINK_EXPORT WebHistoryScrollRestorationType ScrollRestorationType() const; - BLINK_EXPORT void SetScrollRestorationType(WebHistoryScrollRestorationType); + BLINK_EXPORT mojom::ScrollRestorationType ScrollRestorationType() const; + BLINK_EXPORT void SetScrollRestorationType(mojom::ScrollRestorationType); BLINK_EXPORT WebSerializedScriptValue StateObject() const; BLINK_EXPORT void SetStateObject(const WebSerializedScriptValue&);
diff --git a/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc b/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc index c1a34bc..942c967 100644 --- a/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc +++ b/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc
@@ -55,7 +55,6 @@ #include "third_party/blink/renderer/platform/file_metadata.h" #include "third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.h" #include "third_party/blink/renderer/platform/heap/heap.h" -#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" #include "third_party/blink/renderer/platform/wtf/date_math.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkImage.h" @@ -1879,8 +1878,6 @@ // Sanity check for transferring ReadableStreams. This is mostly tested via // web tests. TEST(V8ScriptValueSerializerTest, RoundTripReadableStream) { - ScopedTransferableStreamsForTest enable_transferable_streams(true); - V8TestingScope scope; auto* isolate = scope.GetIsolate(); auto* script_state = scope.GetScriptState(); @@ -1903,8 +1900,6 @@ } TEST(V8ScriptValueSerializerTest, TransformStreamIntegerOverflow) { - ScopedTransferableStreamsForTest enable_transferable_streams(true); - V8TestingScope scope; auto* isolate = scope.GetIsolate(); auto* script_state = scope.GetScriptState();
diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn index d761213..7a14170 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn
@@ -1182,7 +1182,6 @@ "layout/layout_block_test.cc", "layout/layout_box_model_object_test.cc", "layout/layout_box_test.cc", - "layout/layout_count_test.cc", "layout/layout_embedded_content_test.cc", "layout/layout_flexible_box_test.cc", "layout/layout_geometry_map_test.cc",
diff --git a/third_party/blink/renderer/core/aom/accessible_node.cc b/third_party/blink/renderer/core/aom/accessible_node.cc index 67b70d48..acbfae1 100644 --- a/third_party/blink/renderer/core/aom/accessible_node.cc +++ b/third_party/blink/renderer/core/aom/accessible_node.cc
@@ -470,14 +470,6 @@ client->AddFloatProperty(item.first, item.second); shadowed_aria_attributes.insert(GetCorrespondingARIAAttribute(item.first)); } - for (auto& item : int_properties_) { - client->AddIntProperty(item.first, item.second); - shadowed_aria_attributes.insert(GetCorrespondingARIAAttribute(item.first)); - } - for (auto& item : uint_properties_) { - client->AddUIntProperty(item.first, item.second); - shadowed_aria_attributes.insert(GetCorrespondingARIAAttribute(item.first)); - } for (auto& item : relation_properties_) { if (!item.second) continue;
diff --git a/third_party/blink/renderer/core/aom/accessible_node.h b/third_party/blink/renderer/core/aom/accessible_node.h index e812ecd..843898d 100644 --- a/third_party/blink/renderer/core/aom/accessible_node.h +++ b/third_party/blink/renderer/core/aom/accessible_node.h
@@ -95,8 +95,6 @@ public: virtual void AddStringProperty(AOMStringProperty, const String&) = 0; virtual void AddBooleanProperty(AOMBooleanProperty, bool) = 0; - virtual void AddIntProperty(AOMIntProperty, int32_t) = 0; - virtual void AddUIntProperty(AOMUIntProperty, uint32_t) = 0; virtual void AddFloatProperty(AOMFloatProperty, float) = 0; virtual void AddRelationProperty(AOMRelationProperty, const AccessibleNode&) = 0;
diff --git a/third_party/blink/renderer/core/css/view-source.css b/third_party/blink/renderer/core/css/view-source.css index b61ac78..699f4b0 100644 --- a/third_party/blink/renderer/core/css/view-source.css +++ b/third_party/blink/renderer/core/css/view-source.css
@@ -29,9 +29,8 @@ table { width: 100%; border-spacing: 0; - white-space: pre-wrap !important; + white-space: pre; margin: 0; - word-break: break-word; font-size: initial; font-family: monospace; tab-size: 4;
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index 8ab4256..cc64b6a 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc
@@ -66,6 +66,7 @@ #include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h" #include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h" #include "third_party/blink/public/mojom/insecure_input/insecure_input_service.mojom-blink.h" +#include "third_party/blink/public/mojom/page_state/page_state.mojom-blink.h" #include "third_party/blink/public/mojom/ukm/ukm.mojom-blink.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/task_type.h" @@ -2668,8 +2669,8 @@ if (!View()->GetScrollableArea()->HasPendingHistoryRestoreScrollOffset()) return; - bool should_restore_scroll = - history_item->ScrollRestorationType() != kScrollRestorationManual; + bool should_restore_scroll = history_item->ScrollRestorationType() != + mojom::blink::ScrollRestorationType::kManual; auto& scroll_offset = history_item->GetViewState()->scroll_offset_; // This tries to balance:
diff --git a/third_party/blink/renderer/core/exported/web_frame_test.cc b/third_party/blink/renderer/core/exported/web_frame_test.cc index eac586c..6d42d4ec 100644 --- a/third_party/blink/renderer/core/exported/web_frame_test.cc +++ b/third_party/blink/renderer/core/exported/web_frame_test.cc
@@ -66,6 +66,7 @@ #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h" #include "third_party/blink/public/mojom/frame/find_in_page.mojom-blink.h" #include "third_party/blink/public/mojom/frame/frame_owner_element_type.mojom-blink.h" +#include "third_party/blink/public/mojom/page_state/page_state.mojom-blink.h" #include "third_party/blink/public/mojom/scroll/scrollbar_mode.mojom-blink.h" #include "third_party/blink/public/platform/web_cache.h" #include "third_party/blink/public/platform/web_float_rect.h" @@ -13062,22 +13063,22 @@ tester.ExpectTotalCount(histogramName, 0); document_loader.UpdateForSameDocumentNavigation( ToKURL("about:blank"), kSameDocumentNavigationHistoryApi, message, - kScrollRestorationAuto, WebFrameLoadType::kReplaceCurrentItem, - frame->GetDocument()); + mojom::blink::ScrollRestorationType::kAuto, + WebFrameLoadType::kReplaceCurrentItem, frame->GetDocument()); // The bucket index corresponds to the definition of // |SinglePageAppNavigationType|. tester.ExpectBucketCount(histogramName, kSPANavTypeHistoryPushStateOrReplaceState, 1); document_loader.UpdateForSameDocumentNavigation( ToKURL("about:blank"), kSameDocumentNavigationDefault, message, - kScrollRestorationManual, WebFrameLoadType::kBackForward, - frame->GetDocument()); + mojom::blink::ScrollRestorationType::kManual, + WebFrameLoadType::kBackForward, frame->GetDocument()); tester.ExpectBucketCount(histogramName, kSPANavTypeSameDocumentBackwardOrForward, 1); document_loader.UpdateForSameDocumentNavigation( ToKURL("about:blank"), kSameDocumentNavigationDefault, message, - kScrollRestorationManual, WebFrameLoadType::kReplaceCurrentItem, - frame->GetDocument()); + mojom::blink::ScrollRestorationType::kManual, + WebFrameLoadType::kReplaceCurrentItem, frame->GetDocument()); tester.ExpectBucketCount(histogramName, kSPANavTypeOtherFragmentNavigation, 1); // kSameDocumentNavigationHistoryApi and WebFrameLoadType::kBackForward is an
diff --git a/third_party/blink/renderer/core/exported/web_history_item.cc b/third_party/blink/renderer/core/exported/web_history_item.cc index f6c3cb34..1511a61e 100644 --- a/third_party/blink/renderer/core/exported/web_history_item.cc +++ b/third_party/blink/renderer/core/exported/web_history_item.cc
@@ -151,15 +151,14 @@ private_->SetDocumentSequenceNumber(document_sequence_number); } -WebHistoryScrollRestorationType WebHistoryItem::ScrollRestorationType() const { - return static_cast<WebHistoryScrollRestorationType>( - private_->ScrollRestorationType()); +mojom::blink::ScrollRestorationType WebHistoryItem::ScrollRestorationType() + const { + return private_->ScrollRestorationType(); } void WebHistoryItem::SetScrollRestorationType( - WebHistoryScrollRestorationType type) { - private_->SetScrollRestorationType( - static_cast<HistoryScrollRestorationType>(type)); + mojom::blink::ScrollRestorationType type) { + private_->SetScrollRestorationType(type); } WebSerializedScriptValue WebHistoryItem::StateObject() const {
diff --git a/third_party/blink/renderer/core/frame/history.cc b/third_party/blink/renderer/core/frame/history.cc index e62e5e6..49b0c1b 100644 --- a/third_party/blink/renderer/core/frame/history.cc +++ b/third_party/blink/renderer/core/frame/history.cc
@@ -140,8 +140,9 @@ return; } - HistoryScrollRestorationType scroll_restoration = - value == "manual" ? kScrollRestorationManual : kScrollRestorationAuto; + mojom::blink::ScrollRestorationType scroll_restoration = + value == "manual" ? mojom::blink::ScrollRestorationType::kManual + : mojom::blink::ScrollRestorationType::kAuto; if (scroll_restoration == ScrollRestorationInternal()) return; @@ -159,12 +160,15 @@ "fully active"); return "auto"; } - return ScrollRestorationInternal() == kScrollRestorationManual ? "manual" - : "auto"; + return ScrollRestorationInternal() == + mojom::blink::ScrollRestorationType::kManual + ? "manual" + : "auto"; } -HistoryScrollRestorationType History::ScrollRestorationInternal() const { - constexpr HistoryScrollRestorationType default_type = kScrollRestorationAuto; +mojom::blink::ScrollRestorationType History::ScrollRestorationInternal() const { + constexpr mojom::blink::ScrollRestorationType default_type = + mojom::blink::ScrollRestorationType::kAuto; LocalFrame* frame = GetFrame(); if (!frame) @@ -321,12 +325,13 @@ return true; } -void History::StateObjectAdded(scoped_refptr<SerializedScriptValue> data, - const String& /* title */, - const String& url_string, - HistoryScrollRestorationType restoration_type, - WebFrameLoadType type, - ExceptionState& exception_state) { +void History::StateObjectAdded( + scoped_refptr<SerializedScriptValue> data, + const String& /* title */, + const String& url_string, + mojom::blink::ScrollRestorationType restoration_type, + WebFrameLoadType type, + ExceptionState& exception_state) { if (!GetFrame() || !GetFrame()->GetPage() || !GetFrame()->Loader().GetDocumentLoader()) { exception_state.ThrowSecurityError(
diff --git a/third_party/blink/renderer/core/frame/history.h b/third_party/blink/renderer/core/frame/history.h index f925c003..a228714 100644 --- a/third_party/blink/renderer/core/frame/history.h +++ b/third_party/blink/renderer/core/frame/history.h
@@ -27,6 +27,7 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_HISTORY_H_ #include "base/gtest_prod_util.h" +#include "third_party/blink/public/mojom/page_state/page_state.mojom-blink.h" #include "third_party/blink/public/web/web_frame_load_type.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" #include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h" @@ -91,11 +92,11 @@ void StateObjectAdded(scoped_refptr<SerializedScriptValue>, const String& title, const String& url, - HistoryScrollRestorationType, + mojom::blink::ScrollRestorationType, WebFrameLoadType, ExceptionState&); SerializedScriptValue* StateInternal() const; - HistoryScrollRestorationType ScrollRestorationInternal() const; + mojom::blink::ScrollRestorationType ScrollRestorationInternal() const; scoped_refptr<SerializedScriptValue> last_state_object_requested_; };
diff --git a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc index bd0c13e..3346572 100644 --- a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc +++ b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc
@@ -260,8 +260,8 @@ } void HTMLCanvasElement::RecordIdentifiabilityMetric( - const blink::IdentifiableSurface& surface, - int64_t value) const { + IdentifiableSurface surface, + IdentifiableToken value) const { blink::IdentifiabilityMetricBuilder(GetDocument().UkmSourceID()) .Set(surface, value) .Record(GetDocument().UkmRecorder()); @@ -335,11 +335,10 @@ if (!context_) { if (IsUserInIdentifiabilityStudy()) { RecordIdentifiabilityMetric( - blink::IdentifiableSurface::FromTypeAndInput( + IdentifiableSurface::FromTypeAndToken( blink::IdentifiableSurface::Type::kWebFeature, - static_cast<uint64_t>( - blink::WebFeature::kCanvasRenderingContext)), - blink::IdentifiabilityDigestHelper(context_type)); + blink::WebFeature::kCanvasRenderingContext), + context_type); } UMA_HISTOGRAM_ENUMERATION("Blink.Canvas.ContextType", context_type); }
diff --git a/third_party/blink/renderer/core/html/canvas/html_canvas_element.h b/third_party/blink/renderer/core/html/canvas/html_canvas_element.h index b12e4ff..f610dbf 100644 --- a/third_party/blink/renderer/core/html/canvas/html_canvas_element.h +++ b/third_party/blink/renderer/core/html/canvas/html_canvas_element.h
@@ -320,8 +320,8 @@ private: void Dispose(); - void RecordIdentifiabilityMetric(const blink::IdentifiableSurface& surface, - int64_t value) const; + void RecordIdentifiabilityMetric(IdentifiableSurface surface, + IdentifiableToken value) const; // If the user is enrolled in the identifiability study, report the canvas // type, and if applicable, canvas digest, taint bits, and
diff --git a/third_party/blink/renderer/core/layout/layout_block_flow.cc b/third_party/blink/renderer/core/layout/layout_block_flow.cc index cf2a532..28d5e90 100644 --- a/third_party/blink/renderer/core/layout/layout_block_flow.cc +++ b/third_party/blink/renderer/core/layout/layout_block_flow.cc
@@ -87,12 +87,6 @@ ASSERT_SIZE(LayoutBlockFlow::MarginValues, LayoutUnit[4]); -typedef HashMap<LayoutBlockFlow*, int> LayoutPassCountMap; -static LayoutPassCountMap& GetLayoutPassCountMap() { - DEFINE_STATIC_LOCAL(LayoutPassCountMap, map, ()); - return map; -} - // Caches all our current margin collapsing state. class MarginInfo { // Collapsing flags for whether we can collapse our margins with our @@ -452,9 +446,6 @@ DCHECK(NeedsLayout()); DCHECK(IsInlineBlockOrInlineTable() || !IsInline()); - if (RuntimeEnabledFeatures::TrackLayoutPassesPerBlockEnabled()) - IncrementLayoutPassCount(); - ClearOffsetMappingIfNeeded(); if (!relayout_children && SimplifiedLayout()) @@ -4951,21 +4942,6 @@ invalidation_reason); } -void LayoutBlockFlow::IncrementLayoutPassCount() { - NOT_DESTROYED(); - int layout_pass_count = 0; - HashMap<LayoutBlockFlow*, int>::iterator layout_count_iterator = - GetLayoutPassCountMap().find(this); - if (layout_count_iterator != GetLayoutPassCountMap().end()) - layout_pass_count = layout_count_iterator->value; - GetLayoutPassCountMap().Set(this, ++layout_pass_count); -} - -int LayoutBlockFlow::GetLayoutPassCountForTesting() { - NOT_DESTROYED(); - return GetLayoutPassCountMap().find(this)->value; -} - LayoutBlockFlow::LayoutBlockFlowRareData::LayoutBlockFlowRareData( const LayoutBlockFlow* block) : margins_(PositiveMarginBeforeDefault(block),
diff --git a/third_party/blink/renderer/core/layout/layout_block_flow.h b/third_party/blink/renderer/core/layout/layout_block_flow.h index 84974278..ef7a7e60 100644 --- a/third_party/blink/renderer/core/layout/layout_block_flow.h +++ b/third_party/blink/renderer/core/layout/layout_block_flow.h
@@ -877,11 +877,6 @@ bool ShouldTruncateOverflowingText() const; - int GetLayoutPassCountForTesting(); - - // This is public only for use by LayoutNG, so that NGBlockNode can call it. - void IncrementLayoutPassCount(); - protected: LayoutUnit MaxPositiveMarginBefore() const { NOT_DESTROYED();
diff --git a/third_party/blink/renderer/core/layout/layout_count_test.cc b/third_party/blink/renderer/core/layout/layout_count_test.cc deleted file mode 100644 index 257a3f5..0000000 --- a/third_party/blink/renderer/core/layout/layout_count_test.cc +++ /dev/null
@@ -1,24 +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 "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/core/layout/layout_block_flow.h" -#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h" - -namespace blink { - -class LayoutCountTest : public RenderingTest {}; - -TEST_F(LayoutCountTest, SimpleBlockLayoutIsOnePass) { - ScopedTrackLayoutPassesPerBlockForTest track_layout_passes_per_block(true); - SetBodyInnerHTML( - "<!DOCTYPE html>" - " <div id='block' style='height:1000px'>Item</div>"); - - auto* block = To<LayoutBlockFlow>( - GetDocument().getElementById("block")->GetLayoutObject()); - ASSERT_EQ(block->GetLayoutPassCountForTesting(), 1); -} - -} // namespace blink
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_fragment_item.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_fragment_item.cc index 02aa3e0..269ab46 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_fragment_item.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_fragment_item.cc
@@ -547,7 +547,9 @@ if (IsText()) { // Re-computing text item is not necessary, because all changes that needs - // to re-compute ink overflow invalidate layout. + // to re-compute ink overflow invalidate layout. Except for box shadows, + // text decorations and outlines that are invalidated before this point in + // the code. if (IsInkOverflowComputed()) { *self_and_contents_rect_out = SelfInkOverflow(); return;
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc index 814d947..4eeb392 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc
@@ -420,10 +420,6 @@ if (!CanUseNewLayout()) return RunLegacyLayout(constraint_space); - auto* block_flow = DynamicTo<LayoutBlockFlow>(box_); - if (RuntimeEnabledFeatures::TrackLayoutPassesPerBlockEnabled() && block_flow) - block_flow->IncrementLayoutPassCount(); - // The exclusion space internally is a pointer to a shared vector, and // equality of exclusion spaces is performed using pointer comparison on this // internal shared vector. @@ -476,6 +472,8 @@ NGLayoutAlgorithmParams params(*this, *fragment_geometry, constraint_space, break_token, early_break); + auto* block_flow = DynamicTo<LayoutBlockFlow>(box_); + // Try to perform "simplified" layout. if (cache_status == NGLayoutCacheStatus::kNeedsSimplifiedLayout && !GetFlowThread(block_flow)) {
diff --git a/third_party/blink/renderer/core/layout/ng/ng_ink_overflow.cc b/third_party/blink/renderer/core/layout/ng/ng_ink_overflow.cc index 56b954b..42f5fa8 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_ink_overflow.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_ink_overflow.cc
@@ -7,6 +7,8 @@ #include "third_party/blink/renderer/core/layout/geometry/logical_rect.h" #include "third_party/blink/renderer/core/layout/geometry/writing_mode_converter.h" #include "third_party/blink/renderer/core/layout/line/line_orientation_utils.h" +#include "third_party/blink/renderer/core/layout/ng/ng_text_decoration_offset.h" +#include "third_party/blink/renderer/core/paint/text_decoration_info.h" #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/platform/wtf/size_assertions.h" @@ -333,6 +335,14 @@ ink_overflow.Inflate(LayoutUnit::FromFloatCeil(stroke_width / 2.0f)); } + // Following effects, such as shadows, operate on the text decorations, + // so compute text decoration overflow first. + if (!style.AppliedTextDecorations().IsEmpty() && font.PrimaryFont()) { + LayoutRect decoration_rect = + ComputeTextDecorationOverflow(text_info, style, ink_overflow); + ink_overflow.Unite(decoration_rect); + } + const WritingMode writing_mode = style.GetWritingMode(); if (style.GetTextEmphasisMark() != TextEmphasisMark::kNone) { LayoutUnit emphasis_mark_height = @@ -372,4 +382,93 @@ return local_ink_overflow; } +LayoutRect NGInkOverflow::ComputeTextDecorationOverflow( + const NGTextFragmentPaintInfo& text_info, + const ComputedStyle& style, + const LayoutRect& ink_overflow) { + // Use a zero offset because all offsets are applied to the ink overflow + // after it has been computed. + PhysicalOffset offset; + TextDecorationInfo decoration_info(offset, offset, ink_overflow.Width(), + style.GetFontBaseline(), style, nullptr); + NGTextDecorationOffset decoration_offset(decoration_info.Style(), style, + nullptr); + const Vector<AppliedTextDecoration>& decorations = + style.AppliedTextDecorations(); + + // text-underline-position may flip underline and overline. + ResolvedUnderlinePosition underline_position = + decoration_info.UnderlinePosition(); + bool flip_underline_and_overline = false; + if (underline_position == ResolvedUnderlinePosition::kOver) { + flip_underline_and_overline = true; + underline_position = ResolvedUnderlinePosition::kUnder; + } + + FloatRect accumulated_bound; + for (size_t applied_decoration_index = 0; + applied_decoration_index < decorations.size(); + ++applied_decoration_index) { + const AppliedTextDecoration& decoration = + decorations[applied_decoration_index]; + TextDecoration lines = decoration.Lines(); + bool has_underline = EnumHasFlags(lines, TextDecoration::kUnderline); + bool has_overline = EnumHasFlags(lines, TextDecoration::kOverline); + if (flip_underline_and_overline) + std::swap(has_underline, has_overline); + + decoration_info.SetDecorationIndex(applied_decoration_index); + + float resolved_thickness = decoration_info.ResolvedThickness(); + + if (has_underline) { + const int paint_underline_offset = + decoration_offset.ComputeUnderlineOffset( + underline_position, decoration_info.Style().ComputedFontSize(), + decoration_info.FontData()->GetFontMetrics(), + decoration.UnderlineOffset(), resolved_thickness); + decoration_info.SetPerLineData( + TextDecoration::kUnderline, paint_underline_offset, + TextDecorationInfo::DoubleOffsetFromThickness(resolved_thickness), 1); + accumulated_bound.Unite( + decoration_info.BoundsForLine(TextDecoration::kUnderline)); + } + if (has_overline) { + FontVerticalPositionType position = + flip_underline_and_overline ? FontVerticalPositionType::TopOfEmHeight + : FontVerticalPositionType::TextTop; + const int paint_overline_offset = + decoration_offset.ComputeUnderlineOffsetForUnder( + decoration_info.Style().TextUnderlineOffset(), + decoration_info.Style().ComputedFontSize(), resolved_thickness, + position); + decoration_info.SetPerLineData( + TextDecoration::kOverline, paint_overline_offset, + -TextDecorationInfo::DoubleOffsetFromThickness(resolved_thickness), + 1); + accumulated_bound.Unite( + decoration_info.BoundsForLine(TextDecoration::kOverline)); + } + if (EnumHasFlags(lines, TextDecoration::kLineThrough)) { + // For increased line thickness, the line-through decoration needs to grow + // in both directions from its origin, subtract half the thickness to keep + // it centered at the same origin. + const float line_through_offset = + 2 * decoration_info.Baseline() / 3 - resolved_thickness / 2; + // Floor double_offset in order to avoid double-line gap to appear + // of different size depending on position where the double line + // is drawn because of rounding downstream in + // GraphicsContext::DrawLineForText. + decoration_info.SetPerLineData( + TextDecoration::kLineThrough, line_through_offset, + floorf(TextDecorationInfo::DoubleOffsetFromThickness( + resolved_thickness)), + 0); + accumulated_bound.Unite( + decoration_info.BoundsForLine(TextDecoration::kLineThrough)); + } + } + return EnclosingLayoutRect(accumulated_bound); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/ng/ng_ink_overflow.h b/third_party/blink/renderer/core/layout/ng/ng_ink_overflow.h index d66fb60..6299a9f 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_ink_overflow.h +++ b/third_party/blink/renderer/core/layout/ng/ng_ink_overflow.h
@@ -127,6 +127,11 @@ #endif private: + static LayoutRect ComputeTextDecorationOverflow( + const NGTextFragmentPaintInfo& text_info, + const ComputedStyle& style, + const LayoutRect& ink_overflow); + PhysicalRect FromOutsets(const PhysicalSize& size) const; void CheckType(Type type) const;
diff --git a/third_party/blink/renderer/core/loader/document_loader.cc b/third_party/blink/renderer/core/loader/document_loader.cc index 7e460b3c..5cb39730 100644 --- a/third_party/blink/renderer/core/loader/document_loader.cc +++ b/third_party/blink/renderer/core/loader/document_loader.cc
@@ -461,7 +461,7 @@ const KURL& new_url, SameDocumentNavigationSource same_document_navigation_source, scoped_refptr<SerializedScriptValue> data, - HistoryScrollRestorationType scroll_restoration_type, + mojom::blink::ScrollRestorationType scroll_restoration_type, WebFrameLoadType type, bool is_content_initiated) { SinglePageAppNavigationType single_page_app_navigation_type = @@ -1044,8 +1044,8 @@ if (extra_data) GetLocalFrameClient().UpdateDocumentLoader(this, std::move(extra_data)); UpdateForSameDocumentNavigation(url, kSameDocumentNavigationDefault, nullptr, - kScrollRestorationAuto, frame_load_type, - is_content_initiated); + mojom::blink::ScrollRestorationType::kAuto, + frame_load_type, is_content_initiated); initial_scroll_state_.was_scrolled_by_user = false;
diff --git a/third_party/blink/renderer/core/loader/document_loader.h b/third_party/blink/renderer/core/loader/document_loader.h index bf803b3a..9b05016c 100644 --- a/third_party/blink/renderer/core/loader/document_loader.h +++ b/third_party/blink/renderer/core/loader/document_loader.h
@@ -40,6 +40,7 @@ #include "third_party/blink/public/common/loader/loading_behavior_flag.h" #include "third_party/blink/public/mojom/loader/content_security_notifier.mojom-blink.h" #include "third_party/blink/public/mojom/loader/mhtml_load_result.mojom-blink-forward.h" +#include "third_party/blink/public/mojom/page_state/page_state.mojom-blink.h" #include "third_party/blink/public/mojom/timing/worker_timing_container.mojom-blink-forward.h" #include "third_party/blink/public/platform/scheduler/web_scoped_virtual_time_pauser.h" #include "third_party/blink/public/platform/web_navigation_body_loader.h" @@ -156,7 +157,7 @@ void UpdateForSameDocumentNavigation(const KURL&, SameDocumentNavigationSource, scoped_refptr<SerializedScriptValue>, - HistoryScrollRestorationType, + mojom::blink::ScrollRestorationType, WebFrameLoadType, bool is_content_initiated); const ResourceResponse& GetResponse() const { return response_; }
diff --git a/third_party/blink/renderer/core/loader/frame_loader.cc b/third_party/blink/renderer/core/loader/frame_loader.cc index c36bf3a..2a6b072 100644 --- a/third_party/blink/renderer/core/loader/frame_loader.cc +++ b/third_party/blink/renderer/core/loader/frame_loader.cc
@@ -1263,7 +1263,7 @@ void FrameLoader::RestoreScrollPositionAndViewState( WebFrameLoadType load_type, const HistoryItem::ViewState& view_state, - HistoryScrollRestorationType scroll_restoration_type) { + mojom::blink::ScrollRestorationType scroll_restoration_type) { LocalFrameView* view = frame_->View(); if (!view || !view->LayoutViewport() || !frame_->IsAttached() || frame_->GetDocument()->IsInitialEmptyDocument()) { @@ -1273,9 +1273,11 @@ return; view->LayoutViewport()->SetPendingHistoryRestoreScrollOffset( - view_state, scroll_restoration_type != kScrollRestorationManual); + view_state, + scroll_restoration_type != mojom::blink::ScrollRestorationType::kManual); view->GetScrollableArea()->SetPendingHistoryRestoreScrollOffset( - view_state, scroll_restoration_type != kScrollRestorationManual); + view_state, + scroll_restoration_type != mojom::blink::ScrollRestorationType::kManual); view->ScheduleAnimation(); } @@ -1379,7 +1381,7 @@ const bool uses_manual_scroll_restoration = GetDocumentLoader()->GetHistoryItem() && GetDocumentLoader()->GetHistoryItem()->ScrollRestorationType() == - kScrollRestorationManual; + mojom::blink::ScrollRestorationType::kManual; // If we restored a scroll position from history, we shouldn't clobber it // with the fragment. @@ -1850,8 +1852,4 @@ return csp; } -STATIC_ASSERT_ENUM(kWebHistoryScrollRestorationManual, - kScrollRestorationManual); -STATIC_ASSERT_ENUM(kWebHistoryScrollRestorationAuto, kScrollRestorationAuto); - } // namespace blink
diff --git a/third_party/blink/renderer/core/loader/frame_loader.h b/third_party/blink/renderer/core/loader/frame_loader.h index 7fd4ea30..955aa8a67 100644 --- a/third_party/blink/renderer/core/loader/frame_loader.h +++ b/third_party/blink/renderer/core/loader/frame_loader.h
@@ -40,6 +40,7 @@ #include "services/network/public/mojom/web_sandbox_flags.mojom-blink-forward.h" #include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include "third_party/blink/public/mojom/loader/request_context_frame_type.mojom-blink-forward.h" +#include "third_party/blink/public/mojom/page_state/page_state.mojom-blink.h" #include "third_party/blink/public/platform/scheduler/web_scoped_virtual_time_pauser.h" #include "third_party/blink/public/web/web_document_loader.h" #include "third_party/blink/public/web/web_frame_load_type.h" @@ -257,7 +258,7 @@ void RestoreScrollPositionAndViewState(WebFrameLoadType, const HistoryItem::ViewState&, - HistoryScrollRestorationType); + mojom::blink::ScrollRestorationType); void DetachDocumentLoader(Member<DocumentLoader>&, bool flush_microtask_queue = false);
diff --git a/third_party/blink/renderer/core/loader/frame_loader_types.h b/third_party/blink/renderer/core/loader/frame_loader_types.h index 5922922e..d98fe09 100644 --- a/third_party/blink/renderer/core/loader/frame_loader_types.h +++ b/third_party/blink/renderer/core/loader/frame_loader_types.h
@@ -48,11 +48,6 @@ kSameDocumentNavigationHistoryApi, }; -enum HistoryScrollRestorationType { - kScrollRestorationAuto, - kScrollRestorationManual -}; - enum class SavePreviousDocumentResources { kNever, kUntilOnDOMContentLoaded,
diff --git a/third_party/blink/renderer/core/loader/history_item.cc b/third_party/blink/renderer/core/loader/history_item.cc index 1efec647..3b04003 100644 --- a/third_party/blink/renderer/core/loader/history_item.cc +++ b/third_party/blink/renderer/core/loader/history_item.cc
@@ -47,8 +47,7 @@ HistoryItem::HistoryItem() : item_sequence_number_(GenerateSequenceNumber()), - document_sequence_number_(GenerateSequenceNumber()), - scroll_restoration_type_(kScrollRestorationAuto) {} + document_sequence_number_(GenerateSequenceNumber()) {} HistoryItem::~HistoryItem() = default;
diff --git a/third_party/blink/renderer/core/loader/history_item.h b/third_party/blink/renderer/core/loader/history_item.h index e800cd9e..775b192 100644 --- a/third_party/blink/renderer/core/loader/history_item.h +++ b/third_party/blink/renderer/core/loader/history_item.h
@@ -28,6 +28,7 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_HISTORY_ITEM_H_ #include "base/optional.h" +#include "third_party/blink/public/mojom/page_state/page_state.mojom-blink.h" #include "third_party/blink/public/platform/web_scroll_anchor_data.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/loader/frame_loader_types.h" @@ -105,10 +106,10 @@ } int64_t DocumentSequenceNumber() const { return document_sequence_number_; } - void SetScrollRestorationType(HistoryScrollRestorationType type) { + void SetScrollRestorationType(mojom::blink::ScrollRestorationType type) { scroll_restoration_type_ = type; } - HistoryScrollRestorationType ScrollRestorationType() { + mojom::blink::ScrollRestorationType ScrollRestorationType() { return scroll_restoration_type_; } @@ -143,7 +144,8 @@ // Type of the scroll restoration for the history item determines if scroll // position should be restored when it is loaded during history traversal. - HistoryScrollRestorationType scroll_restoration_type_; + mojom::blink::ScrollRestorationType scroll_restoration_type_ = + mojom::blink::ScrollRestorationType::kAuto; // Support for HTML5 History scoped_refptr<SerializedScriptValue> state_object_;
diff --git a/third_party/blink/renderer/core/paint/ng/ng_text_fragment_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_text_fragment_painter.cc index 966dd99..0dd47164 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_text_fragment_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_text_fragment_painter.cc
@@ -668,16 +668,11 @@ !text_item.IsEllipsis()) { PhysicalOffset local_origin = box_rect.offset; LayoutUnit width = box_rect.Width(); - const NGPhysicalBoxFragment* decorating_box = nullptr; - const ComputedStyle* decorating_box_style = - decorating_box ? &decorating_box->Style() : nullptr; decoration_info.emplace(box_rect.offset, local_origin, width, - style.GetFontBaseline(), style, - decorating_box_style); - - NGTextDecorationOffset decoration_offset( - decoration_info->Style(), text_item.Style(), decorating_box); + style.GetFontBaseline(), style, nullptr); + NGTextDecorationOffset decoration_offset(decoration_info->Style(), + text_item.Style(), nullptr); text_painter.PaintDecorationsExceptLineThrough( decoration_offset, decoration_info.value(), paint_info, style.AppliedTextDecorations(), text_style,
diff --git a/third_party/blink/renderer/core/paint/text_decoration_info.cc b/third_party/blink/renderer/core/paint/text_decoration_info.cc index b795232..a826e439a 100644 --- a/third_party/blink/renderer/core/paint/text_decoration_info.cc +++ b/third_party/blink/renderer/core/paint/text_decoration_info.cc
@@ -249,9 +249,8 @@ FloatPoint start_point = StartPoint(line); switch (DecorationStyle()) { case ETextDecorationStyle::kDotted: - case ETextDecorationStyle::kDashed: { + case ETextDecorationStyle::kDashed: return BoundsForDottedOrDashed(line); - } case ETextDecorationStyle::kWavy: return BoundsForWavy(line); case ETextDecorationStyle::kDouble:
diff --git a/third_party/blink/renderer/core/paint/text_decoration_info.h b/third_party/blink/renderer/core/paint/text_decoration_info.h index d498b49..2309e5a 100644 --- a/third_party/blink/renderer/core/paint/text_decoration_info.h +++ b/third_party/blink/renderer/core/paint/text_decoration_info.h
@@ -84,10 +84,6 @@ FloatPoint StartPoint(TextDecoration line) const; float DoubleOffset(TextDecoration line) const; - // Computed bounds for all the decorations in the style passed at - // construction. - FloatRect Bounds() const; - // Compute bounds for the given line and the current decoration. FloatRect BoundsForLine(TextDecoration line) const; @@ -95,6 +91,10 @@ // current decoration. base::Optional<Path> PrepareWavyStrokePath(TextDecoration line) const; + static float DoubleOffsetFromThickness(float thickness_pixels) { + return thickness_pixels + 1.0f; + } + private: float ComputeUnderlineThickness( const TextDecorationThickness& applied_decoration_thickness,
diff --git a/third_party/blink/renderer/core/paint/text_painter_base.cc b/third_party/blink/renderer/core/paint/text_painter_base.cc index 804f68cd..d08b405 100644 --- a/third_party/blink/renderer/core/paint/text_painter_base.cc +++ b/third_party/blink/renderer/core/paint/text_painter_base.cc
@@ -31,10 +31,6 @@ // implementation. constexpr float kDecorationClipMaxDilation = 13; -float DoubleOffsetFromThickness(float thickness_pixels) { - return thickness_pixels + 1.0f; -} - } // anonymous namespace TextPainterBase::TextPainterBase(GraphicsContext& context, @@ -247,7 +243,7 @@ decoration.UnderlineOffset(), resolved_thickness); decoration_info.SetPerLineData( TextDecoration::kUnderline, paint_underline_offset, - DoubleOffsetFromThickness(resolved_thickness), 1); + TextDecorationInfo::DoubleOffsetFromThickness(resolved_thickness), 1); PaintDecorationUnderOrOverLine(context, decoration_info, TextDecoration::kUnderline); } @@ -263,7 +259,8 @@ position); decoration_info.SetPerLineData( TextDecoration::kOverline, paint_overline_offset, - -DoubleOffsetFromThickness(resolved_thickness), 1); + -TextDecorationInfo::DoubleOffsetFromThickness(resolved_thickness), + 1); PaintDecorationUnderOrOverLine(context, decoration_info, TextDecoration::kOverline); } @@ -314,7 +311,9 @@ // GraphicsContext::DrawLineForText. decoration_info.SetPerLineData( TextDecoration::kLineThrough, line_through_offset, - floorf(DoubleOffsetFromThickness(resolved_thickness)), 0); + floorf(TextDecorationInfo::DoubleOffsetFromThickness( + resolved_thickness)), + 0); AppliedDecorationPainter decoration_painter(context, decoration_info, TextDecoration::kLineThrough); // No skip: ink for line-through,
diff --git a/third_party/blink/renderer/core/streams/readable_stream_test.cc b/third_party/blink/renderer/core/streams/readable_stream_test.cc index fe5038d..eb23100 100644 --- a/third_party/blink/renderer/core/streams/readable_stream_test.cc +++ b/third_party/blink/renderer/core/streams/readable_stream_test.cc
@@ -21,7 +21,6 @@ #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/bindings/string_resource.h" #include "third_party/blink/renderer/platform/heap/handle.h" -#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "v8/include/v8.h" @@ -354,8 +353,6 @@ } TEST_F(ReadableStreamTest, Serialize) { - ScopedTransferableStreamsForTest enabled(true); - V8TestingScope scope; auto* script_state = scope.GetScriptState(); auto* isolate = scope.GetIsolate();
diff --git a/third_party/blink/renderer/core/streams/writable_stream_test.cc b/third_party/blink/renderer/core/streams/writable_stream_test.cc index df68988..dcfec54e 100644 --- a/third_party/blink/renderer/core/streams/writable_stream_test.cc +++ b/third_party/blink/renderer/core/streams/writable_stream_test.cc
@@ -14,7 +14,6 @@ #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/bindings/v8_binding.h" #include "third_party/blink/renderer/platform/heap/handle.h" -#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "v8/include/v8.h" @@ -48,8 +47,6 @@ } TEST(WritableStreamTest, Serialize) { - ScopedTransferableStreamsForTest enable_transferable_streams(true); - V8TestingScope scope; auto* script_state = scope.GetScriptState();
diff --git a/third_party/blink/renderer/core/style/style_difference.h b/third_party/blink/renderer/core/style/style_difference.h index 8d85f5c3..b249a43 100644 --- a/third_party/blink/renderer/core/style/style_difference.h +++ b/third_party/blink/renderer/core/style/style_difference.h
@@ -27,7 +27,7 @@ kCSSClipChanged = 1 << 5, // The object needs to issue paint invalidations if it is affected by text // decorations or properties dependent on color (e.g., border or outline). - // TextDecorationis changes must also invalidate ink overflow. + // TextDecoration changes must also invalidate ink overflow. kTextDecorationOrColorChanged = 1 << 6, kBlendModeChanged = 1 << 7, kMaskChanged = 1 << 8,
diff --git a/third_party/blink/renderer/core/workers/OWNERS b/third_party/blink/renderer/core/workers/OWNERS index aaadbd31..2cdf64f5 100644 --- a/third_party/blink/renderer/core/workers/OWNERS +++ b/third_party/blink/renderer/core/workers/OWNERS
@@ -1,3 +1,4 @@ +bashi@chromium.org falken@chromium.org hiroshige@chromium.org japhet@chromium.org
diff --git a/third_party/blink/renderer/modules/accessibility/accessibility_object_model_test.cc b/third_party/blink/renderer/modules/accessibility/accessibility_object_model_test.cc index b1e28d4..8286fb52 100644 --- a/third_party/blink/renderer/modules/accessibility/accessibility_object_model_test.cc +++ b/third_party/blink/renderer/modules/accessibility/accessibility_object_model_test.cc
@@ -285,16 +285,6 @@ bool_attributes.insert(attribute, value); } - void AddIntAttribute(AXIntAttribute attribute, int32_t value) override { - ASSERT_TRUE(int_attributes.find(attribute) == int_attributes.end()); - int_attributes.insert(attribute, value); - } - - void AddUIntAttribute(AXUIntAttribute attribute, uint32_t value) override { - ASSERT_TRUE(uint_attributes.find(attribute) == uint_attributes.end()); - uint_attributes.insert(attribute, value); - } - void AddStringAttribute(AXStringAttribute attribute, const String& value) override { ASSERT_TRUE(string_attributes.find(attribute) == string_attributes.end());
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object.cc b/third_party/blink/renderer/modules/accessibility/ax_object.cc index 53296948..29f501be 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object.cc
@@ -831,7 +831,8 @@ } } - if (accessibility_mode.has_mode(ui::AXMode::kPDF)) { + if (accessibility_mode.has_mode(ui::AXMode::kScreenReader) || + accessibility_mode.has_mode(ui::AXMode::kPDF)) { // The DOMNodeID from Blink. Currently only populated when using // the accessibility tree for PDF exporting. Warning, this is totally // unrelated to the accessibility node ID, or the ID attribute for an @@ -841,7 +842,12 @@ node_data->AddIntAttribute(ax::mojom::blink::IntAttribute::kDOMNodeId, dom_node_id); } - // None of the following attributes are needed for PDF accessibility. + + SerializeTableAttributes(node_data); + } + + if (accessibility_mode.has_mode(ui::AXMode::kPDF)) { + // Return early. None of the following attributes are needed for PDFs. return; } @@ -873,6 +879,94 @@ ax::mojom::blink::StringAttribute::kUrl, Url().GetString().Utf8()); } + + SerializePartialSparseAttributes(node_data); +} + +void AXObject::SerializeTableAttributes(ui::AXNodeData* node_data) { + if (ui::IsTableLike(RoleValue())) { + int aria_colcount = AriaColumnCount(); + if (aria_colcount) { + node_data->AddIntAttribute( + ax::mojom::blink::IntAttribute::kAriaColumnCount, aria_colcount); + } + int aria_rowcount = AriaRowCount(); + if (aria_rowcount) { + node_data->AddIntAttribute(ax::mojom::blink::IntAttribute::kAriaRowCount, + aria_rowcount); + } + } + + if (ui::IsTableRow(RoleValue())) { + AXObject* header = HeaderObject(); + if (header && !header->IsDetached()) { + // TODO(accessibility): these should be computed by ui::AXTableInfo and + // removed here. + node_data->AddIntAttribute( + ax::mojom::blink::IntAttribute::kTableRowHeaderId, + header->AXObjectID()); + } + } + + if (ui::IsCellOrTableHeader(RoleValue())) { + node_data->AddIntAttribute( + ax::mojom::blink::IntAttribute::kTableCellColumnSpan, ColumnSpan()); + node_data->AddIntAttribute( + ax::mojom::blink::IntAttribute::kTableCellRowSpan, RowSpan()); + } + + if (ui::IsCellOrTableHeader(RoleValue()) || ui::IsTableRow(RoleValue())) { + // aria-rowindex and aria-colindex are supported on cells, headers and + // rows. + int aria_rowindex = AriaRowIndex(); + if (aria_rowindex) { + node_data->AddIntAttribute( + ax::mojom::blink::IntAttribute::kAriaCellRowIndex, aria_rowindex); + } + + int aria_colindex = AriaColumnIndex(); + if (aria_colindex) { + node_data->AddIntAttribute( + ax::mojom::blink::IntAttribute::kAriaCellColumnIndex, aria_colindex); + } + } + + if (ui::IsTableHeader(RoleValue()) && + GetSortDirection() != ax::mojom::blink::SortDirection::kNone) { + node_data->AddIntAttribute(ax::mojom::blink::IntAttribute::kSortDirection, + static_cast<int32_t>(GetSortDirection())); + } +} + +void AXObject::SerializePartialSparseAttributes(ui::AXNodeData* node_data) { + Element* element = GetElement(); + if (!element) + return; + + TempSetterMap& setter_map = GetTempSetterMap(node_data); + AttributeCollection attributes = element->AttributesWithoutUpdate(); + HashSet<QualifiedName> set_attributes; + for (const Attribute& attr : attributes) { + set_attributes.insert(attr.GetName()); + AXSparseSetterFunc callback = setter_map.at(attr.GetName()); + + if (callback) + callback.Run(node_data, attr.Value()); + } + + if (!element->DidAttachInternals()) + return; + const auto& internals_attributes = + element->EnsureElementInternals().GetAttributes(); + for (const QualifiedName& attr : internals_attributes.Keys()) { + if (set_attributes.Contains(attr)) + continue; + + AXSparseSetterFunc callback = setter_map.at(attr); + + if (callback) + callback.Run(node_data, internals_attributes.at(attr)); + } } void AXObject::TruncateAndAddStringAttribute( @@ -1243,7 +1337,7 @@ #if DCHECK_IS_ON() // Required in order to get Lifecycle().ToString() DCHECK(!GetDocument() || GetDocument()->Lifecycle().GetState() >= - DocumentLifecycle::kLayoutClean) + DocumentLifecycle::kAfterPerformLayout) << "Unclean document at lifecycle " << GetDocument()->Lifecycle().ToString(); #endif
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object.h b/third_party/blink/renderer/modules/accessibility/ax_object.h index 8b5be69..298c3265 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object.h +++ b/third_party/blink/renderer/modules/accessibility/ax_object.h
@@ -83,8 +83,6 @@ class AXSparseAttributeClient { public: virtual void AddBoolAttribute(AXBoolAttribute, bool) = 0; - virtual void AddIntAttribute(AXIntAttribute, int32_t) = 0; - virtual void AddUIntAttribute(AXUIntAttribute, uint32_t) = 0; virtual void AddStringAttribute(AXStringAttribute, const String&) = 0; virtual void AddObjectAttribute(AXObjectAttribute, AXObject&) = 0; virtual void AddObjectVectorAttribute(AXObjectVectorAttribute, @@ -1318,6 +1316,11 @@ // functions called here may only search up the tree (ancestors), not down. void UpdateCachedAttributeValuesIfNeeded() const; + // Helpers for serialization. + // TODO(meredithl): Serialize all sparse/table attributes and rename. + void SerializePartialSparseAttributes(ui::AXNodeData* node_data); + void SerializeTableAttributes(ui::AXNodeData* node_data); + private: void UpdateDistributionForFlatTreeTraversal() const; bool IsARIAControlledByTextboxWithActiveDescendant() const;
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc index 0ecd9fe..301893b 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc
@@ -532,7 +532,8 @@ #if DCHECK_IS_ON() Document* document = &node->GetDocument(); DCHECK(document); - DCHECK(document->Lifecycle().GetState() >= DocumentLifecycle::kLayoutClean) + DCHECK(document->Lifecycle().GetState() >= + DocumentLifecycle::kAfterPerformLayout) << "Unclean document at lifecycle " << document->Lifecycle().ToString(); #endif // DCHECK_IS_ON() @@ -574,7 +575,8 @@ #if DCHECK_IS_ON() Document* document = &layout_object->GetDocument(); DCHECK(document); - DCHECK(document->Lifecycle().GetState() >= DocumentLifecycle::kLayoutClean) + DCHECK(document->Lifecycle().GetState() >= + DocumentLifecycle::kAfterPerformLayout) << "Unclean document at lifecycle " << document->Lifecycle().ToString(); #endif // DCHECK_IS_ON() @@ -2369,21 +2371,14 @@ void AXObjectCacheImpl::HandleLayoutComplete(Document* document) { SCOPED_DISALLOW_LIFECYCLE_TRANSITION(*document); - DeferTreeUpdate(&AXObjectCacheImpl::HandleLayoutCompleteWithCleanLayout, - document); -} - -void AXObjectCacheImpl::HandleLayoutCompleteWithCleanLayout( - Node* document_node) { - DCHECK(document_node); - DCHECK(IsA<Document>(document_node)); -#if DCHECK_IS_ON() - Document* document = To<Document>(document_node); - DCHECK(document->Lifecycle().GetState() >= DocumentLifecycle::kLayoutClean) - << "Unclean document at lifecycle " << document->Lifecycle().ToString(); -#endif // DCHECK_IS_ON() - PostNotification(GetOrCreate(document_node), - ax::mojom::blink::Event::kLayoutComplete); + if (document->Lifecycle().GetState() >= + DocumentLifecycle::kAfterPerformLayout) { + PostNotification(GetOrCreate(document), + ax::mojom::blink::Event::kLayoutComplete); + } else { + DeferTreeUpdate(&AXObjectCacheImpl::EnsurePostNotification, document, + ax::mojom::blink::Event::kLayoutComplete); + } } void AXObjectCacheImpl::HandleScrolledToAnchor(const Node* anchor_node) {
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.h b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.h index 1efcae6..bcd69f0 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.h +++ b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.h
@@ -210,7 +210,6 @@ void HandleAriaSelectedChangedWithCleanLayout(Node*); void HandleNodeLostFocusWithCleanLayout(Node*); void HandleNodeGainedFocusWithCleanLayout(Node*); - void HandleLayoutCompleteWithCleanLayout(Node*); void HandleLoadCompleteWithCleanLayout(Node*); void UpdateCacheAfterNodeIsAttachedWithCleanLayout(Node*); void DidShowMenuListPopupWithCleanLayout(Node*);
diff --git a/third_party/blink/renderer/modules/accessibility/ax_sparse_attribute_setter.cc b/third_party/blink/renderer/modules/accessibility/ax_sparse_attribute_setter.cc index 03304d21..9b37988 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_sparse_attribute_setter.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_sparse_attribute_setter.cc
@@ -5,9 +5,16 @@ #include "third_party/blink/renderer/modules/accessibility/ax_sparse_attribute_setter.h" #include "third_party/blink/renderer/core/dom/qualified_name.h" #include "third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.h" +#include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink { +void SetIntAttribute(ax::mojom::blink::IntAttribute attribute, + ui::AXNodeData* node_data, + const AtomicString& value) { + node_data->AddIntAttribute(attribute, value.ToInt()); +} + class BoolAttributeSetter : public AXSparseAttributeSetter { public: BoolAttributeSetter(AXBoolAttribute attribute) : attribute_(attribute) {} @@ -26,34 +33,6 @@ } }; -class IntAttributeSetter : public AXSparseAttributeSetter { - public: - IntAttributeSetter(AXIntAttribute attribute) : attribute_(attribute) {} - - private: - AXIntAttribute attribute_; - - void Run(const AXObject& obj, - AXSparseAttributeClient& attribute_map, - const AtomicString& value) override { - attribute_map.AddIntAttribute(attribute_, value.ToInt()); - } -}; - -class UIntAttributeSetter : public AXSparseAttributeSetter { - public: - UIntAttributeSetter(AXUIntAttribute attribute) : attribute_(attribute) {} - - private: - AXUIntAttribute attribute_; - - void Run(const AXObject& obj, - AXSparseAttributeClient& attribute_map, - const AtomicString& value) override { - attribute_map.AddUIntAttribute(attribute_, value.ToInt()); - } -}; - class StringAttributeSetter : public AXSparseAttributeSetter { public: StringAttributeSetter(AXStringAttribute attribute) : attribute_(attribute) {} @@ -188,28 +167,45 @@ ax_sparse_attribute_setter_map.Set( html_names::kAriaBusyAttr, new BoolAttributeSetter(AXBoolAttribute::kAriaBusy)); - ax_sparse_attribute_setter_map.Set( - html_names::kAriaColcountAttr, - new IntAttributeSetter(AXIntAttribute::kAriaColumnCount)); - ax_sparse_attribute_setter_map.Set( - html_names::kAriaColindexAttr, - new UIntAttributeSetter(AXUIntAttribute::kAriaColumnIndex)); - ax_sparse_attribute_setter_map.Set( - html_names::kAriaColspanAttr, - new UIntAttributeSetter(AXUIntAttribute::kAriaColumnSpan)); - ax_sparse_attribute_setter_map.Set( - html_names::kAriaRowcountAttr, - new IntAttributeSetter(AXIntAttribute::kAriaRowCount)); - ax_sparse_attribute_setter_map.Set( - html_names::kAriaRowindexAttr, - new UIntAttributeSetter(AXUIntAttribute::kAriaRowIndex)); - ax_sparse_attribute_setter_map.Set( - html_names::kAriaRowspanAttr, - new UIntAttributeSetter(AXUIntAttribute::kAriaRowSpan)); } return ax_sparse_attribute_setter_map; } +// TODO(meredithl): move the rest of the sparse attributes to this map. +TempSetterMap& GetTempSetterMap(ui::AXNodeData* node_data) { + DEFINE_STATIC_LOCAL(TempSetterMap, temp_setter_map, ()); + if (temp_setter_map.IsEmpty()) { + temp_setter_map.Set( + html_names::kAriaColcountAttr, + WTF::BindRepeating(&SetIntAttribute, + ax::mojom::blink::IntAttribute::kAriaColumnCount)); + temp_setter_map.Set( + html_names::kAriaColindexAttr, + WTF::BindRepeating( + &SetIntAttribute, + ax::mojom::blink::IntAttribute::kAriaCellColumnIndex)); + temp_setter_map.Set( + html_names::kAriaColspanAttr, + WTF::BindRepeating( + &SetIntAttribute, + ax::mojom::blink::IntAttribute::kAriaCellColumnSpan)); + temp_setter_map.Set( + html_names::kAriaRowcountAttr, + WTF::BindRepeating(&SetIntAttribute, + ax::mojom::blink::IntAttribute::kAriaRowCount)); + temp_setter_map.Set( + html_names::kAriaRowindexAttr, + WTF::BindRepeating(&SetIntAttribute, + ax::mojom::blink::IntAttribute::kAriaCellRowIndex)); + temp_setter_map.Set( + html_names::kAriaRowspanAttr, + WTF::BindRepeating(&SetIntAttribute, + ax::mojom::blink::IntAttribute::kAriaCellRowSpan)); + } + + return temp_setter_map; +} + void AXSparseAttributeAOMPropertyClient::AddStringProperty( AOMStringProperty property, const String& value) { @@ -241,13 +237,6 @@ sparse_attribute_client_.AddBoolAttribute(attribute, value); } -void AXSparseAttributeAOMPropertyClient::AddIntProperty(AOMIntProperty property, - int32_t value) {} - -void AXSparseAttributeAOMPropertyClient::AddUIntProperty( - AOMUIntProperty property, - uint32_t value) {} - void AXSparseAttributeAOMPropertyClient::AddFloatProperty( AOMFloatProperty property, float value) {}
diff --git a/third_party/blink/renderer/modules/accessibility/ax_sparse_attribute_setter.h b/third_party/blink/renderer/modules/accessibility/ax_sparse_attribute_setter.h index 75f088f..4f0f1bb9 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_sparse_attribute_setter.h +++ b/third_party/blink/renderer/modules/accessibility/ax_sparse_attribute_setter.h
@@ -9,6 +9,7 @@ #include "third_party/blink/renderer/core/aom/accessible_node_list.h" #include "third_party/blink/renderer/modules/accessibility/ax_object.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +#include "ui/accessibility/ax_node_data.h" namespace blink { @@ -31,8 +32,21 @@ // That way we only need to iterate over the list of attributes once, // rather than calling getAttribute() once for each possible obscure // accessibility attribute. +// TODO(meredithl): Migrate this to the temp setter for crbug/1068668 AXSparseAttributeSetterMap& GetSparseAttributeSetterMap(); +// A map from attribute name to a callback that sets the |value| for that +// attribute on an AXNodeData. This is designed to replace the above sparse +// attribute setter. This name is temporary, the above name of +// AXSparseAttributeSetterMap will be used once all sparse attributes are +// migrated. +using AXSparseSetterFunc = + base::RepeatingCallback<void(ui::AXNodeData* node_data, + const AtomicString& value)>; +using TempSetterMap = HashMap<QualifiedName, AXSparseSetterFunc>; + +TempSetterMap& GetTempSetterMap(ui::AXNodeData* node_data); + // An implementation of AOMPropertyClient that calls // AXSparseAttributeClient for an AOM property. class AXSparseAttributeAOMPropertyClient : public AOMPropertyClient { @@ -45,8 +59,6 @@ void AddStringProperty(AOMStringProperty, const String& value) override; void AddBooleanProperty(AOMBooleanProperty, bool value) override; - void AddIntProperty(AOMIntProperty, int32_t value) override; - void AddUIntProperty(AOMUIntProperty, uint32_t value) override; void AddFloatProperty(AOMFloatProperty, float value) override; void AddRelationProperty(AOMRelationProperty, const AccessibleNode& value) override;
diff --git a/third_party/blink/renderer/modules/accessibility/inspector_accessibility_agent.cc b/third_party/blink/renderer/modules/accessibility/inspector_accessibility_agent.cc index f3358f5..e39ebff5 100644 --- a/third_party/blink/renderer/modules/accessibility/inspector_accessibility_agent.cc +++ b/third_party/blink/renderer/modules/accessibility/inspector_accessibility_agent.cc
@@ -24,16 +24,16 @@ namespace blink { -using protocol::Accessibility::AXPropertyName; +using protocol::Maybe; +using protocol::Response; using protocol::Accessibility::AXNode; using protocol::Accessibility::AXNodeId; using protocol::Accessibility::AXProperty; -using protocol::Accessibility::AXValueSource; -using protocol::Accessibility::AXValueType; +using protocol::Accessibility::AXPropertyName; using protocol::Accessibility::AXRelatedNode; using protocol::Accessibility::AXValue; -using protocol::Maybe; -using protocol::Response; +using protocol::Accessibility::AXValueSource; +using protocol::Accessibility::AXValueType; namespace AXPropertyNameEnum = protocol::Accessibility::AXPropertyNameEnum; namespace { @@ -402,10 +402,6 @@ } } - void AddIntAttribute(AXIntAttribute attribute, int32_t value) override {} - - void AddUIntAttribute(AXUIntAttribute attribute, uint32_t value) override {} - void AddStringAttribute(AXStringAttribute attribute, const String& value) override { switch (attribute) {
diff --git a/third_party/blink/renderer/modules/exported/web_ax_object.cc b/third_party/blink/renderer/modules/exported/web_ax_object.cc index db13a8e..7fe2931c 100644 --- a/third_party/blink/renderer/modules/exported/web_ax_object.cc +++ b/third_party/blink/renderer/modules/exported/web_ax_object.cc
@@ -101,16 +101,6 @@ value); } - void AddIntAttribute(AXIntAttribute attribute, int32_t value) override { - attribute_map_.AddIntAttribute(static_cast<WebAXIntAttribute>(attribute), - value); - } - - void AddUIntAttribute(AXUIntAttribute attribute, uint32_t value) override { - attribute_map_.AddUIntAttribute(static_cast<WebAXUIntAttribute>(attribute), - value); - } - void AddStringAttribute(AXStringAttribute attribute, const String& value) override { attribute_map_.AddStringAttribute( @@ -1190,34 +1180,6 @@ return private_->AccessibilityIsIncludedInTree(); } -int WebAXObject::AriaColumnCount() const { - if (IsDetached()) - return 0; - - return private_->IsTableLikeRole() ? private_->AriaColumnCount() : 0; -} - -unsigned WebAXObject::AriaColumnIndex() const { - if (IsDetached()) - return 0; - - return private_->AriaColumnIndex(); -} - -int WebAXObject::AriaRowCount() const { - if (IsDetached()) - return 0; - - return private_->IsTableLikeRole() ? private_->AriaRowCount() : 0; -} - -unsigned WebAXObject::AriaRowIndex() const { - if (IsDetached()) - return 0; - - return private_->AriaRowIndex(); -} - unsigned WebAXObject::ColumnCount() const { if (IsDetached()) return false;
diff --git a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc index c0f0705..1579bc4 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc +++ b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
@@ -3318,6 +3318,32 @@ } } +void WebGLRenderingContextBase::RecordShaderPrecisionFormatForStudy( + GLenum shader_type, + GLenum precision_type, + WebGLShaderPrecisionFormat* format) { + if (!IdentifiabilityStudySettings::Get()->IsTypeAllowed( + blink::IdentifiableSurface::Type::kWebGLShaderPrecisionFormat)) + return; + + if (const auto& ukm_params = GetUkmParameters()) { + IdentifiableTokenBuilder builder; + auto surface_token = + builder.AddValue(shader_type).AddValue(precision_type).GetToken(); + auto sample_token = builder.AddValue(format->rangeMin()) + .AddValue(format->rangeMax()) + .AddValue(format->precision()) + .GetToken(); + + blink::IdentifiabilityMetricBuilder(ukm_params->source_id) + .Set(blink::IdentifiableSurface::FromTypeAndToken( + blink::IdentifiableSurface::Type::kWebGLShaderPrecisionFormat, + surface_token), + sample_token) + .Record(ukm_params->ukm_recorder); + } +} + ScriptValue WebGLRenderingContextBase::getParameter(ScriptState* script_state, GLenum pname) { if (isContextLost()) @@ -3821,8 +3847,10 @@ GLint precision = 0; ContextGL()->GetShaderPrecisionFormat(shader_type, precision_type, range, &precision); - return MakeGarbageCollected<WebGLShaderPrecisionFormat>(range[0], range[1], - precision); + auto* result = MakeGarbageCollected<WebGLShaderPrecisionFormat>( + range[0], range[1], precision); + RecordShaderPrecisionFormatForStudy(shader_type, precision_type, result); + return result; } String WebGLRenderingContextBase::getShaderSource(WebGLShader* shader) {
diff --git a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h index 743111c..772943d 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h +++ b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h
@@ -1790,6 +1790,10 @@ void RecordIdentifiableGLParameterDigest(GLenum pname, IdentifiableToken value); + void RecordShaderPrecisionFormatForStudy(GLenum shader_type, + GLenum precision_type, + WebGLShaderPrecisionFormat* format); + static bool webgl_context_limits_initialized_; static unsigned max_active_webgl_contexts_; static unsigned max_active_webgl_contexts_on_worker_;
diff --git a/third_party/blink/renderer/modules/webtransport/web_transport.h b/third_party/blink/renderer/modules/webtransport/web_transport.h index 39db70a0..44c332b 100644 --- a/third_party/blink/renderer/modules/webtransport/web_transport.h +++ b/third_party/blink/renderer/modules/webtransport/web_transport.h
@@ -33,22 +33,26 @@ ~WebTransport() override; // WebTransport IDL implementation. - ScriptPromise createSendStream(ScriptState* script_state, - ExceptionState& exception_state) { + ScriptPromise createUnidirectionalStream(ScriptState* script_state, + ExceptionState& exception_state) { return quic_transport_->createSendStream(script_state, exception_state); } - ReadableStream* receiveStreams() { return quic_transport_->receiveStreams(); } + ReadableStream* incomingUnidirectionalStreams() { + return quic_transport_->receiveStreams(); + } ScriptPromise createBidirectionalStream(ScriptState* script_state, ExceptionState& exception_state) { return quic_transport_->createBidirectionalStream(script_state, exception_state); } - ReadableStream* receiveBidirectionalStreams() { + ReadableStream* incomingBidirectionalStreams() { return quic_transport_->receiveBidirectionalStreams(); } - WritableStream* sendDatagrams() { return quic_transport_->sendDatagrams(); } - ReadableStream* receiveDatagrams() { + WritableStream* writableDatagrams() { + return quic_transport_->sendDatagrams(); + } + ReadableStream* readableDatagrams() { return quic_transport_->receiveDatagrams(); } void close(const WebTransportCloseInfo* close_info) {
diff --git a/third_party/blink/renderer/modules/webtransport/web_transport.idl b/third_party/blink/renderer/modules/webtransport/web_transport.idl index 62d3b61..f1407d9 100644 --- a/third_party/blink/renderer/modules/webtransport/web_transport.idl +++ b/third_party/blink/renderer/modules/webtransport/web_transport.idl
@@ -10,17 +10,15 @@ ] interface WebTransport { [CallWith=ScriptState, RaisesException, MeasureAs=WebTransport] constructor(USVString url, optional QuicTransportOptions options = {}); [CallWith=ScriptState, RaisesException] Promise<SendStream> - createSendStream(); - // TODO(ricea): This should probably be changed to an attribute in the - // standard. - ReadableStream receiveStreams(); + createUnidirectionalStream(); + readonly attribute ReadableStream incomingUnidirectionalStreams; [CallWith=ScriptState, RaisesException] Promise<BidirectionalStream> createBidirectionalStream(); - ReadableStream receiveBidirectionalStreams(); + readonly attribute ReadableStream incomingBidirectionalStreams; - WritableStream sendDatagrams(); - ReadableStream receiveDatagrams(); + readonly attribute WritableStream writableDatagrams; + readonly attribute ReadableStream readableDatagrams; void close(optional WebTransportCloseInfo closeInfo = {}); readonly attribute Promise<void> ready;
diff --git a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder_factory.cc b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder_factory.cc index 180f83d..8a03ff7 100644 --- a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder_factory.cc +++ b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder_factory.cc
@@ -169,6 +169,8 @@ } } + cricket::AddH264ConstrainedBaselineProfileToSupportedFormats( + &supported_formats.sdp_formats); return supported_formats; }
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index c6775387..2b2a8e32 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -825,7 +825,7 @@ }, { name: "FlexAspectRatio", - status: "experimental", + status: "stable", }, { name: "FocuslessSpatialNavigation", @@ -1868,14 +1868,9 @@ origin_trial_feature_name: "ForceTouchEventFeatureDetectionForInspector", status: "stable", }, - // When enabled, tracks the number of times each LayoutBlock - // goes through layout. For testing purposes only. - { - name: "TrackLayoutPassesPerBlock", - }, { name: "TransferableStreams", - status: "experimental", + status: "stable", origin_trial_feature_name: "RTCInsertableStreams", implied_by: ["RTCInsertableStreams"], },
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/agent_group_scheduler_impl.h b/third_party/blink/renderer/platform/scheduler/main_thread/agent_group_scheduler_impl.h index 3aaac3e..e27cfab 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/agent_group_scheduler_impl.h +++ b/third_party/blink/renderer/platform/scheduler/main_thread/agent_group_scheduler_impl.h
@@ -23,8 +23,6 @@ class PLATFORM_EXPORT AgentGroupSchedulerImpl : public blink::AgentGroupScheduler { public: - static AgentGroupSchedulerImpl* GetCurrent(); - static void SetCurrent(AgentGroupSchedulerImpl*); explicit AgentGroupSchedulerImpl( MainThreadSchedulerImpl& main_thread_scheduler); AgentGroupSchedulerImpl(const AgentGroupSchedulerImpl&) = delete;
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.cc b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.cc index d9dc7dc..fbfae95 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.cc
@@ -2350,26 +2350,18 @@ helper_.CheckOnValidThread(); if (current_agent_group_scheduler_) { TRACE_EVENT_NESTABLE_ASYNC_END0( - TRACE_DISABLED_BY_DEFAULT("agent_scheduling_group"), "ASG_scope", this); + TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), "ASG_scope", this); } else { TRACE_EVENT_NESTABLE_ASYNC_END0( - TRACE_DISABLED_BY_DEFAULT("agent_scheduling_group"), "MTS_scope", this); + TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), "MTS_scope", this); } current_agent_group_scheduler_ = agent_group_scheduler_impl; if (current_agent_group_scheduler_) { TRACE_EVENT_NESTABLE_ASYNC_BEGIN0( - TRACE_DISABLED_BY_DEFAULT("agent_scheduling_group"), "ASG_scope", this); + TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), "ASG_scope", this); } else { TRACE_EVENT_NESTABLE_ASYNC_BEGIN0( - TRACE_DISABLED_BY_DEFAULT("agent_scheduling_group"), "MTS_scope", this); - } - if (agent_group_scheduler_impl) { - sequence_manager_->SetDefaultTaskRunner( - agent_group_scheduler_impl->DefaultTaskRunner()); - } else { - // If there is no proper AgentGroupScheduler, it means that the - // current scheduler is MainThreadScheduler. - sequence_manager_->SetDefaultTaskRunner(helper_.DefaultTaskRunner()); + TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), "MTS_scope", this); } }
diff --git a/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py b/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py index 37e012b..06d8f2b 100755 --- a/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py +++ b/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py
@@ -477,13 +477,20 @@ 'ui::AXEventIntent', 'ui::AXMode', 'ui::AXNodeData', - 'ui::IsDialog', - 'ui::IsContainerWithSelectableChildren', 'ax::mojom::BoolAttribute', 'ax::mojom::HasPopup', 'ax::mojom::State', 'ax::mojom::Restriction', + # Accessibility helper functions - mostly used in Blink for + # serialization. + 'ui::IsDialog', + 'ui::IsContainerWithSelectableChildren', + 'ui::IsTableLike', + 'ui::IsTableRow', + 'ui::IsCellOrTableHeader', + 'ui::IsTableHeader', + # Blink uses UKM for logging e.g. always-on leak detection (crbug/757374) 'ukm::.+',
diff --git a/third_party/blink/web_tests/VirtualTestSuites b/third_party/blink/web_tests/VirtualTestSuites index fc82e58a..bb128b29 100644 --- a/third_party/blink/web_tests/VirtualTestSuites +++ b/third_party/blink/web_tests/VirtualTestSuites
@@ -111,7 +111,6 @@ "prefix": "stable", "bases": ["fast/css3-text/css3-text-decoration/stable", "fast/dom/Window", - "http/tests/streams/transferable/enabled", "http/tests/navigation", "http/tests/origin_trials/feature-policy-reporting", "http/tests/sendbeacon", @@ -279,7 +278,7 @@ { "prefix": "dark-mode-images-grayscale", "bases": ["dark-mode/images"], - "args": ["--blink-settings=forceDarkModeEnabled=true,forceDarkModeImagePolicy=0,forceDarkModeImageStyle=1"] + "args": ["--blink-settings=forceDarkModeEnabled=true,forceDarkModeImagePolicy=0,forceDarkModeImageGrayscale=1.0"] }, { "prefix": "presentation",
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json index 0af9f0e9..6c65566 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json
@@ -57959,6 +57959,58 @@ {} ] ], + "flex-aspect-ratio-img-column-012.html": [ + "e78ededfb2b2c5872e782b4c51d896c8f495e45b", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square-only.html", + "==" + ] + ], + {} + ] + ], + "flex-aspect-ratio-img-column-013.html": [ + "81640d518c97c19388d3a53f35ed6aad1e3c48d5", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square-only.html", + "==" + ] + ], + {} + ] + ], + "flex-aspect-ratio-img-column-014.html": [ + "b4f2b223cf6fcc7b60a3217b2042e435d52ef0fd", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], + "flex-aspect-ratio-img-column-015.html": [ + "688955db0e70fcb0aa728465dfb557c218e9dfd4", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], "flex-aspect-ratio-img-row-001.html": [ "14fabf760ca4293abf5af9e618b2e2ed627be2b2", [ @@ -63605,6 +63657,32 @@ {} ] ], + "svg-root-as-flex-item-004.html": [ + "1321433634599bf4c185b4882d6ca3bee4b71e2b", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], + "svg-root-as-flex-item-005.html": [ + "19501347662f387141f0eb0dbb16c23906c35589", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], "table-as-item-auto-min-width.html": [ "66a77327f0f25e07db87e342ebb590358d045f7a", [ @@ -156640,6 +156718,32 @@ {} ] ], + "legacy-scriptminsize-attribute.html": [ + "ef861c8e79b87b598df9d01f3cbf70caf6c8c23e", + [ + null, + [ + [ + "/mathml/relations/css-styling/legacy-scriptminsize-attribute-ref.html", + "==" + ] + ], + {} + ] + ], + "legacy-scriptsizemultiplier-attribute.html": [ + "66e0da17693be608076218df744e309d02d1207c", + [ + null, + [ + [ + "/mathml/relations/css-styling/legacy-scriptsizemultiplier-attribute-ref.html", + "==" + ] + ], + {} + ] + ], "lengths-1.html": [ "9b0c27a26715dd2724360b841b3c581d0e967811", [ @@ -227838,6 +227942,14 @@ "111ea79e243a83880783b5ab46ae6d989ead1f32", [] ], + "legacy-scriptminsize-attribute-ref.html": [ + "8e3d7b1c21907400af22f5df001515a2372ba2d2", + [] + ], + "legacy-scriptsizemultiplier-attribute-ref.html": [ + "422325da28185bf5b77946192760e0deaeaf6324", + [] + ], "lengths-1-ref.html": [ "9fca6f49632ca080ee1b2a32a9ce2d251241dfcc", [] @@ -281855,7 +281967,7 @@ ], "math-script-level-and-math-style": { "math-script-level-001.tentative.html": [ - "f2ae5bf35bd24413bfd3feeee1215c74218dc753", + "9dff79025acf8d934ac96e3720b308c969d5189e", [ null, {} @@ -390628,6 +390740,13 @@ {} ] ], + "modify.tentative.html": [ + "c4436fcafeb5e43ea43948183d3e64842abb8be6", + [ + null, + {} + ] + ], "removeAllRanges.html": [ "026280d6b8c252c8c9486977d31a32d6d211f701", [
diff --git a/third_party/blink/web_tests/external/wpt/css/css-fonts/math-script-level-and-math-style/math-script-level-001.tentative.html b/third_party/blink/web_tests/external/wpt/css/css-fonts/math-script-level-and-math-style/math-script-level-001.tentative.html index f2ae5bf3..9dff7902 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-fonts/math-script-level-and-math-style/math-script-level-001.tentative.html +++ b/third_party/blink/web_tests/external/wpt/css/css-fonts/math-script-level-and-math-style/math-script-level-001.tentative.html
@@ -34,6 +34,18 @@ assert_equals(mathDepth("specifiedAdd10From5"), "15"); assert_equals(mathDepth("specifiedAdd-15From5"), "-10"); }, "Specified math-depth: add(<integer>)"); + test(function() { + assert_equals(mathDepth("invalidKeywordFrom3"), "3"); + assert_equals(mathDepth("invalidFloatFrom3"), "3"); + assert_equals(mathDepth("invalidCalcFrom3"), "3"); + assert_equals(mathDepth("invalidAddCalcFrom3"), "3"); + assert_equals(mathDepth("invalidAddFloatFrom3"), "3"); + }, "Specified math-depth: invalid expressions"); + test(function() { + const cssVariable = 3; + assert_equals(mathDepth("specifiedCalcFrom9"), `${Math.round(cssVariable/2)+10}`); + assert_equals(mathDepth("specifiedAddCalcFrom9"), `${9+(3*4-5)}`); + }, "Specified math-depth: calc() expressions"); done(); }); </script> @@ -60,5 +72,16 @@ <div id="specifiedAdd10From5" style="math-depth: add(10)"></div> <div id="specifiedAdd-15From5" style="math-depth: add(-15)"></div> </div> + <div style="math-depth: 3;"> + <div id="invalidKeywordFrom3" style="math-depth: auto"></div> + <div id="invalidFloatFrom3" style="math-depth: 3.14"></div> + <div id="invalidCalcFrom3" style="math-depth: 1,2"></div> + <div id="invalidAddCalcFrom3" style="math-depth: add(3,4)"></div> + <div id="invalidAddFloatFrom3" style="math-depth: add(3.14)"></div> + </div> + <div style="math-depth: 9;"> + <div id="specifiedCalcFrom9" style="--css-variable: 3; math-depth: calc(var(--css-variable)/2 + 10)"></div> + <div id="specifiedAddCalcFrom9" style="math-depth: add(calc(3*4 - 5))"></div> + </div> </body> </html>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/reference/text-decoration-invalidation-dashed-ref.html b/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/reference/text-decoration-invalidation-dashed-ref.html new file mode 100644 index 0000000..64356838 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/reference/text-decoration-invalidation-dashed-ref.html
@@ -0,0 +1,54 @@ +<!DOCTYPE html> +<html> +<head> +<title>CSS Text Decoration Test: text-decoration-style: dashed invalidation on style change, reference</title> +<link rel="help" href="https://drafts.csswg.org/css-text-decor-4/"> +<link rel="author" title="Stephen Chenney" href="mailto:schenney@chromium.org"> +<style> + div { + display: block; + margin-top: 30px; + margin-bottom: 30px; + will-change: transform; + } + .underline { + text-decoration-line: underline; + text-decoration-color: green; + text-decoration-style: dashed; + text-decoration-thickness: 5px; + } + .overline { + text-decoration-line: overline; + text-decoration-color: green; + text-decoration-style: dashed; + text-decoration-thickness: 5px; + } + .throughline { + text-decoration-line: line-through; + text-decoration-color: green; + text-decoration-style: dashed; + text-decoration-thickness: 5px; + } +</style> +</head> +<body> +<div id="top-underline-div"> +There should be no sign of an underline when the test completes. +</div> +<div id="bottom-underline-div" class="underline"> +There should be a 5px green dashed underline when the test completes. +</div> +<div id="top-overline-div"> +There should be no sign of an overline when the test completes. +</div> +<div id="bottom-overline-div" class="overline"> +There should be a 5px green dashed overline when the test completes. +</div> +<div id="top-throughline-div"> +There should be no sign of an through-line when the test completes. +</div> +<div id="bottom-throughline-div" class="throughline"> +There should be a 5px green dashed through-line when the test completes. +</div> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/reference/text-decoration-invalidation-double-ref.html b/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/reference/text-decoration-invalidation-double-ref.html new file mode 100644 index 0000000..5b0542d --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/reference/text-decoration-invalidation-double-ref.html
@@ -0,0 +1,54 @@ +<!DOCTYPE html> +<html> +<head> +<title>CSS Text Decoration Test: text-decoration-style: double invalidation on style change, reference</title> +<link rel="help" href="https://drafts.csswg.org/css-text-decor-4/"> +<link rel="author" title="Stephen Chenney" href="mailto:schenney@chromium.org"> +<style> + div { + display: block; + margin-top: 30px; + margin-bottom: 30px; + will-change: transform; + } + .underline { + text-decoration-line: underline; + text-decoration-color: green; + text-decoration-style: double; + text-decoration-thickness: 5px; + } + .overline { + text-decoration-line: overline; + text-decoration-color: green; + text-decoration-style: double; + text-decoration-thickness: 5px; + } + .throughline { + text-decoration-line: line-through; + text-decoration-color: green; + text-decoration-style: double; + text-decoration-thickness: 5px; + } +</style> +</head> +<body> +<div id="top-underline-div"> +There should be no sign of an underline when the test completes. +</div> +<div id="bottom-underline-div" class="underline"> +There should be a 5px green double underline when the test completes. +</div> +<div id="top-overline-div"> +There should be no sign of an overline when the test completes. +</div> +<div id="bottom-overline-div" class="overline"> +There should be a 5px green double overline when the test completes. +</div> +<div id="top-throughline-div"> +There should be no sign of an through-line when the test completes. +</div> +<div id="bottom-throughline-div" class="throughline"> +There should be a 5px green double through-line when the test completes. +</div> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/reference/text-decoration-invalidation-solid-ref.html b/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/reference/text-decoration-invalidation-solid-ref.html new file mode 100644 index 0000000..65fedfb --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/reference/text-decoration-invalidation-solid-ref.html
@@ -0,0 +1,54 @@ +<!DOCTYPE html> +<html> +<head> +<title>CSS Text Decoration Test: text-decoration-style: solid invalidation on style change, reference</title> +<link rel="help" href="https://drafts.csswg.org/css-text-decor-4/"> +<link rel="author" title="Stephen Chenney" href="mailto:schenney@chromium.org"> +<style> + div { + display: block; + margin-top: 30px; + margin-bottom: 30px; + will-change: transform; + } + .underline { + text-decoration-line: underline; + text-decoration-color: green; + text-decoration-style: solid; + text-decoration-thickness: 5px; + } + .overline { + text-decoration-line: overline; + text-decoration-color: green; + text-decoration-style: solid; + text-decoration-thickness: 5px; + } + .throughline { + text-decoration-line: line-through; + text-decoration-color: green; + text-decoration-style: solid; + text-decoration-thickness: 5px; + } +</style> +</head> +<body> +<div id="top-underline-div"> +There should be no sign of an underline when the test completes. +</div> +<div id="bottom-underline-div" class="underline"> +There should be a 5px green solid underline when the test completes. +</div> +<div id="top-overline-div"> +There should be no sign of an overline when the test completes. +</div> +<div id="bottom-overline-div" class="overline"> +There should be a 5px green solid overline when the test completes. +</div> +<div id="top-throughline-div"> +There should be no sign of an through-line when the test completes. +</div> +<div id="bottom-throughline-div" class="throughline"> +There should be a 5px green solid through-line when the test completes. +</div> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/reference/text-decoration-invalidation-wavy-ref.html b/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/reference/text-decoration-invalidation-wavy-ref.html new file mode 100644 index 0000000..eea8254 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/reference/text-decoration-invalidation-wavy-ref.html
@@ -0,0 +1,54 @@ +<!DOCTYPE html> +<html> +<head> +<title>CSS Text Decoration Test: text-decoration-style: solid invalidation on style change, reference</title> +<link rel="help" href="https://drafts.csswg.org/css-text-decor-4/"> +<link rel="author" title="Stephen Chenney" href="mailto:schenney@chromium.org"> +<style> + div { + display: block; + margin-top: 30px; + margin-bottom: 30px; + will-change: transform; + } + .underline { + text-decoration-line: underline; + text-decoration-color: green; + text-decoration-style: wavy; + text-decoration-thickness: 5px; + } + .overline { + text-decoration-line: overline; + text-decoration-color: green; + text-decoration-style: wavy; + text-decoration-thickness: 5px; + } + .throughline { + text-decoration-line: line-through; + text-decoration-color: green; + text-decoration-style: wavy; + text-decoration-thickness: 5px; + } +</style> +</head> +<body> +<div id="top-underline-div"> +There should be no sign of an underline when the test completes. +</div> +<div id="bottom-underline-div" class="underline"> +There should be a 5px green wavy underline when the test completes. +</div> +<div id="top-overline-div"> +There should be no sign of an overline when the test completes. +</div> +<div id="bottom-overline-div" class="overline"> +There should be a 5px green wavy overline when the test completes. +</div> +<div id="top-throughline-div"> +There should be no sign of an through-line when the test completes. +</div> +<div id="bottom-throughline-div" class="throughline"> +There should be a 5px green wavy through-line when the test completes. +</div> +</body> +</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/text-decoration-invalidation-dashed.html b/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/text-decoration-invalidation-dashed.html new file mode 100644 index 0000000..b92f3ddc --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/text-decoration-invalidation-dashed.html
@@ -0,0 +1,72 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<title>CSS Text Decoration Test: text-decoration-style: dashed invalidation on style change</title> +<link rel="help" href="https://drafts.csswg.org/css-text-decor-4/"> +<meta name="assert" content="text-decoration-style: dashed should be correctly invalidated on style change."> +<link rel="author" title="Stephen Chenney" href="mailto:schenney@chromium.org"> +<link rel="match" href="reference/text-decoration-invalidation-dashed-ref.html"> +<style> + div { + display: block; + margin-top: 30px; + margin-bottom: 30px; + will-change: transform; + } + .underline { + text-decoration-line: underline; + text-decoration-color: green; + text-decoration-style: dashed; + text-decoration-thickness: 5px; + } + .overline { + text-decoration-line: overline; + text-decoration-color: green; + text-decoration-style: dashed; + text-decoration-thickness: 5px; + } + .throughline { + text-decoration-line: line-through; + text-decoration-color: green; + text-decoration-style: dashed; + text-decoration-thickness: 5px; + } +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/rendering-utils.js"></script> +</head> +<body> +<div id="top-underline-div" class="underline"> +There should be no sign of an underline when the test completes. +</div> +<div id="bottom-underline-div" > +There should be a 5px green dashed underline when the test completes. +</div> +<div id="top-overline-div" class="overline"> +There should be no sign of an overline when the test completes. +</div> +<div id="bottom-overline-div" > +There should be a 5px green dashed overline when the test completes. +</div> +<div id="top-throughline-div" class="throughline"> +There should be no sign of an through-line when the test completes. +</div> +<div id="bottom-throughline-div" > +There should be a 5px green dashed through-line when the test completes. +</div> +</body> +<script> +async function runTest() { + document.getElementById('top-underline-div').classList.remove("underline"); + document.getElementById('bottom-underline-div').classList.add("underline"); + document.getElementById('top-overline-div').classList.remove("overline"); + document.getElementById('bottom-overline-div').classList.add("overline"); + document.getElementById('top-throughline-div').classList.remove("throughline"); + document.getElementById('bottom-throughline-div').classList.add("throughline"); + takeScreenshot(); +} +onload = () => { + waitForAtLeastOneFrame().then(() => { runTest() }); +} +</script> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/text-decoration-invalidation-double.html b/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/text-decoration-invalidation-double.html new file mode 100644 index 0000000..eb7ec18 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/text-decoration-invalidation-double.html
@@ -0,0 +1,72 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<title>CSS Text Decoration Test: text-decoration-style: double invalidation on style change</title> +<link rel="help" href="https://drafts.csswg.org/css-text-decor-4/"> +<meta name="assert" content="text-decoration-style: double should be correctly invalidated on style change."> +<link rel="author" title="Stephen Chenney" href="mailto:schenney@chromium.org"> +<link rel="match" href="reference/text-decoration-invalidation-double-ref.html"> +<style> + div { + display: block; + margin-top: 30px; + margin-bottom: 30px; + will-change: transform; + } + .underline { + text-decoration-line: underline; + text-decoration-color: green; + text-decoration-style: double; + text-decoration-thickness: 5px; + } + .overline { + text-decoration-line: overline; + text-decoration-color: green; + text-decoration-style: double; + text-decoration-thickness: 5px; + } + .throughline { + text-decoration-line: line-through; + text-decoration-color: green; + text-decoration-style: double; + text-decoration-thickness: 5px; + } +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/rendering-utils.js"></script> +</head> +<body> +<div id="top-underline-div" class="underline"> +There should be no sign of an underline when the test completes. +</div> +<div id="bottom-underline-div" > +There should be a 5px green double underline when the test completes. +</div> +<div id="top-overline-div" class="overline"> +There should be no sign of an overline when the test completes. +</div> +<div id="bottom-overline-div" > +There should be a 5px green double overline when the test completes. +</div> +<div id="top-throughline-div" class="throughline"> +There should be no sign of an through-line when the test completes. +</div> +<div id="bottom-throughline-div" > +There should be a 5px green double through-line when the test completes. +</div> +</body> +<script> +async function runTest() { + document.getElementById('top-underline-div').classList.remove("underline"); + document.getElementById('bottom-underline-div').classList.add("underline"); + document.getElementById('top-overline-div').classList.remove("overline"); + document.getElementById('bottom-overline-div').classList.add("overline"); + document.getElementById('top-throughline-div').classList.remove("throughline"); + document.getElementById('bottom-throughline-div').classList.add("throughline"); + takeScreenshot(); +} +onload = () => { + waitForAtLeastOneFrame().then(() => { runTest() }); +} +</script> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/text-decoration-invalidation-solid.html b/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/text-decoration-invalidation-solid.html new file mode 100644 index 0000000..4956557a --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/text-decoration-invalidation-solid.html
@@ -0,0 +1,72 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<title>CSS Text Decoration Test: text-decoration-style: solid invalidation on style change</title> +<link rel="help" href="https://drafts.csswg.org/css-text-decor-4/"> +<meta name="assert" content="text-decoration-style: solid should be correctly invalidated on style change."> +<link rel="author" title="Stephen Chenney" href="mailto:schenney@chromium.org"> +<link rel="match" href="reference/text-decoration-invalidation-solid-ref.html"> +<style> + div { + display: block; + margin-top: 30px; + margin-bottom: 30px; + will-change: transform; + } + .underline { + text-decoration-line: underline; + text-decoration-color: green; + text-decoration-style: solid; + text-decoration-thickness: 5px; + } + .overline { + text-decoration-line: overline; + text-decoration-color: green; + text-decoration-style: solid; + text-decoration-thickness: 5px; + } + .throughline { + text-decoration-line: line-through; + text-decoration-color: green; + text-decoration-style: solid; + text-decoration-thickness: 5px; + } +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/rendering-utils.js"></script> +</head> +<body> +<div id="top-underline-div" class="underline"> +There should be no sign of an underline when the test completes. +</div> +<div id="bottom-underline-div" > +There should be a 5px green solid underline when the test completes. +</div> +<div id="top-overline-div" class="overline"> +There should be no sign of an overline when the test completes. +</div> +<div id="bottom-overline-div" > +There should be a 5px green solid overline when the test completes. +</div> +<div id="top-throughline-div" class="throughline"> +There should be no sign of an through-line when the test completes. +</div> +<div id="bottom-throughline-div" > +There should be a 5px green solid through-line when the test completes. +</div> +</body> +<script> +async function runTest() { + document.getElementById('top-underline-div').classList.remove("underline"); + document.getElementById('bottom-underline-div').classList.add("underline"); + document.getElementById('top-overline-div').classList.remove("overline"); + document.getElementById('bottom-overline-div').classList.add("overline"); + document.getElementById('top-throughline-div').classList.remove("throughline"); + document.getElementById('bottom-throughline-div').classList.add("throughline"); + takeScreenshot(); +} +onload = () => { + waitForAtLeastOneFrame().then(() => { runTest() }); +} +</script> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/text-decoration-invalidation-wavy.html b/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/text-decoration-invalidation-wavy.html new file mode 100644 index 0000000..cc3af52b --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text-decor/invalidation/text-decoration-invalidation-wavy.html
@@ -0,0 +1,72 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<title>CSS Text Decoration Test: text-decoration-style: wavy invalidation on style change</title> +<link rel="help" href="https://drafts.csswg.org/css-text-decor-4/"> +<meta name="assert" content="text-decoration-style: wavy should be correctly invalidated on style change."> +<link rel="author" title="Stephen Chenney" href="mailto:schenney@chromium.org"> +<link rel="match" href="reference/text-decoration-invalidation-wavy-ref.html"> +<style> + div { + display: block; + margin-top: 30px; + margin-bottom: 30px; + will-change: transform; + } + .underline { + text-decoration-line: underline; + text-decoration-color: green; + text-decoration-style: wavy; + text-decoration-thickness: 5px; + } + .overline { + text-decoration-line: overline; + text-decoration-color: green; + text-decoration-style: wavy; + text-decoration-thickness: 5px; + } + .throughline { + text-decoration-line: line-through; + text-decoration-color: green; + text-decoration-style: wavy; + text-decoration-thickness: 5px; + } +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/rendering-utils.js"></script> +</head> +<body> +<div id="top-underline-div" class="underline"> +There should be no sign of an underline when the test completes. +</div> +<div id="bottom-underline-div" > +There should be a 5px green wavy underline when the test completes. +</div> +<div id="top-overline-div" class="overline"> +There should be no sign of an overline when the test completes. +</div> +<div id="bottom-overline-div" > +There should be a 5px green wavy overline when the test completes. +</div> +<div id="top-throughline-div" class="throughline"> +There should be no sign of an through-line when the test completes. +</div> +<div id="bottom-throughline-div" > +There should be a 5px green wavy through-line when the test completes. +</div> +</body> +<script> +async function runTest() { + document.getElementById('top-underline-div').classList.remove("underline"); + document.getElementById('bottom-underline-div').classList.add("underline"); + document.getElementById('top-overline-div').classList.remove("overline"); + document.getElementById('bottom-overline-div').classList.add("overline"); + document.getElementById('top-throughline-div').classList.remove("throughline"); + document.getElementById('bottom-throughline-div').classList.add("throughline"); + takeScreenshot(); +} +onload = () => { + waitForAtLeastOneFrame().then(() => { runTest() }); +} +</script> +</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/legacy-scriptminsize-attribute-ref.html b/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/legacy-scriptminsize-attribute-ref.html new file mode 100644 index 0000000..8e3d7b1c --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/legacy-scriptminsize-attribute-ref.html
@@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>legacy scriptminsize attribute (reference)</title> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + math { + /* Ahem font does not have a MATH table so the font-size scale factor + is always 0.71^{computed - inherited math script level} */ + font: 100px/1 Ahem; + } +</style> +</head> +<body> + <p>Test passes if you see a square of size 71px.</p> + <div> + <math> + <mstyle> + <mstyle scriptlevel="1"> + <mn>X</mn> + </mstyle> + </mstyle> + </math> + </div> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/legacy-scriptminsize-attribute.html b/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/legacy-scriptminsize-attribute.html new file mode 100644 index 0000000..ef861c8e --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/legacy-scriptminsize-attribute.html
@@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>legacy scriptminsize attribute</title> +<link rel="help" href="https://www.w3.org/TR/MathML3/chapter3.html#presm.mstyle.attrs"> +<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling"> +<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#text-mtext"> +<link rel="match" href="legacy-scriptminsize-attribute-ref.html"/> +<meta name="assert" content="Verify scriptminsize attribute is no longer parsed."> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + math { + /* Ahem font does not have a MATH table so the font-size scale factor + is always 0.71^{computed - inherited math script level} */ + font: 100px/1 Ahem; + } +</style> +</head> +<body> + <p>Test passes if you see a square of size 71px.</p> + <div> + <math> + <mstyle scriptminsize="100px"> + <mstyle scriptlevel="1"> + <mn>X</mn> + </mstyle> + </mstyle> + </math> + </div> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/legacy-scriptsizemultiplier-attribute-ref.html b/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/legacy-scriptsizemultiplier-attribute-ref.html new file mode 100644 index 0000000..422325da --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/legacy-scriptsizemultiplier-attribute-ref.html
@@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>legacy scriptsizemultiplier attribute (reference)</title> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + math { + /* Ahem font does not have a MATH table so the font-size scale factor + is always 0.71^{computed - inherited math script level} */ + font: 100px/1 Ahem; + } +</style> +</head> +<body> + <p>Test passes if you see a square of size 71px.</p> + <div> + <math> + <mstyle> + <mstyle scriptlevel="1"> + <mn>X</mn> + </mstyle> + </mstyle> + </math> + </div> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/legacy-scriptsizemultiplier-attribute.html b/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/legacy-scriptsizemultiplier-attribute.html new file mode 100644 index 0000000..66e0da1 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/legacy-scriptsizemultiplier-attribute.html
@@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>legacy scriptsizemultiplier attribute</title> +<link rel="help" href="https://www.w3.org/TR/MathML3/chapter3.html#presm.mstyle.attrs"> +<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling"> +<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#text-mtext"> +<link rel="match" href="legacy-scriptsizemultiplier-attribute-ref.html"/> +<meta name="assert" content="Verify scriptsizemultiplier attribute is no longer parsed."> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + math { + /* Ahem font does not have a MATH table so the font-size scale factor + is always 0.71^{computed - inherited math script level} */ + font: 100px/1 Ahem; + } +</style> +</head> +<body> + <p>Test passes if you see a square of size 71px.</p> + <div> + <math> + <mstyle scriptsizemultiplier="1"> + <mstyle scriptlevel="1"> + <mn>X</mn> + </mstyle> + </mstyle> + </math> + </div> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/selection/modify.tentative.html b/third_party/blink/web_tests/external/wpt/selection/modify.tentative.html new file mode 100644 index 0000000..c4436fca --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/selection/modify.tentative.html
@@ -0,0 +1,21 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Selection.modify() tests</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> + +<div>Test, these are <strong id="strong"> strong </strong> <em id="em"> italic </em> normal.</div> + +<script> +const selection = getSelection(); +test(() => { + selection.collapse(strong.childNodes[0], 4); + selection.modify("extend", "backward", "word") + assert_equals(selection.focusNode, strong.childNodes[0]); + assert_equals(selection.focusOffset, 1); + selection.collapse(em.childNodes[0], 4); + selection.modify("extend", "backward", "word") + assert_equals(selection.focusNode, em.childNodes[0]); + assert_equals(selection.focusOffset, 1); +}, "Stop at previous word boundary when whitespaces are trimmed"); +</script>
diff --git a/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt index 42bd99c..5e6426db 100644 --- a/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt +++ b/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -3804,15 +3804,15 @@ interface WebTransport attribute @@toStringTag getter closed + getter incomingBidirectionalStreams + getter incomingUnidirectionalStreams + getter readableDatagrams getter ready + getter writableDatagrams method close method constructor method createBidirectionalStream - method createSendStream - method receiveBidirectionalStreams - method receiveDatagrams - method receiveStreams - method sendDatagrams + method createUnidirectionalStream interface WindowClient : Client attribute @@toStringTag getter focused
diff --git a/third_party/blink/web_tests/http/tests/streams/transferable/enabled/enabled.html b/third_party/blink/web_tests/http/tests/streams/transferable/enabled/enabled.html deleted file mode 100644 index e5d62ef8..0000000 --- a/third_party/blink/web_tests/http/tests/streams/transferable/enabled/enabled.html +++ /dev/null
@@ -1,25 +0,0 @@ -<!DOCTYPE html> -<meta charset="utf-8"> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script> -// Quick test for whether transferable streams are enabled or not, since it -// doesn't affect the symbols visible on the global object. When not enabled, -// all the tests should fail. This will help prevent accidentally shipping the -// feature. - -test(() => { - const rs = new ReadableStream(); - postMessage(rs, '*', [rs]); -}, 'postMessage of a ReadableStream should work'); - -test(() => { - const ws = new WritableStream(); - postMessage(ws, '*', [ws]); -}, 'postMessage of a WritableStream should work'); - -test(() => { - const ts = new TransformStream(); - postMessage(ts, '*', [ts]); -}, 'postMessage of a TransformStream should work'); -</script>
diff --git a/third_party/blink/web_tests/paint/invalidation/text-decoration-invalidation.html b/third_party/blink/web_tests/paint/invalidation/text-decoration-invalidation.html deleted file mode 100644 index feddcfc..0000000 --- a/third_party/blink/web_tests/paint/invalidation/text-decoration-invalidation.html +++ /dev/null
@@ -1,33 +0,0 @@ -<!DOCTYPE html> -<style> - div { - display: block; - width: 400px; - height: 100px; - color: blue; - } - #underlineHover:hover { - text-decoration: underline; - } - #underlineNoHover:hover { - text-decoration: underline; - } -</style> - -<div id="underlineHover"> -<span>When</span> <span>hovered, </span><span>there</span> <span>should</span> <span> be </span> <span>no</span> <span>gaps</span> <span>in</span> <span>the</span> <span>underline.</span> -</div> - -<div id="underlineNoHover"> -<span>When</span> <span>not hovered, </span><span>there</span> <span>should</span> <span> be </span> <span>no</span> <span>underlines.</span> -</div> - -<script src="../../resources/run-after-layout-and-paint.js"></script> -<script> -if (window.eventSender) - eventSender.mouseMoveTo(underlineNoHover.offsetLeft + 10, underlineNoHover.offsetTop + 10); -runAfterLayoutAndPaint(function() { - if (window.eventSender) - eventSender.mouseMoveTo(underlineHover.offsetLeft + 10, underlineHover.offsetTop + 10); -}, true); -</script>
diff --git a/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/README.txt b/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/README.txt index 03639add..57b7a47 100644 --- a/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/README.txt +++ b/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/README.txt
@@ -1,4 +1,4 @@ # This suite runs the tests in web_tests/dark-mode/images with -# --blink-settings=forceDarkModeEnabled=true,forceDarkModeImagePolicy=0,forceDarkModeImageStyle=1 +# --blink-settings=forceDarkModeEnabled=true,forceDarkModeImagePolicy=0,forceDarkModeImageGrayscale=1.0 # See the virtual_test_suites() method in tools/blinkpy/web_tests/port/base.py.
diff --git a/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/desaturate-before-inversion-expected.png b/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/desaturate-before-inversion-expected.png index 4178f5b6..e119d2e 100644 --- a/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/desaturate-before-inversion-expected.png +++ b/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/desaturate-before-inversion-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/gradient-expected.png b/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/gradient-expected.png index c024f62a..82de5789 100644 --- a/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/gradient-expected.png +++ b/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/gradient-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/image-expected.png b/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/image-expected.png index 2a73df1..b3c8a60 100644 --- a/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/image-expected.png +++ b/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/image-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/svg-as-image-expected.png b/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/svg-as-image-expected.png index 30de046..8194cc4 100644 --- a/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/svg-as-image-expected.png +++ b/third_party/blink/web_tests/virtual/dark-mode-images-grayscale/dark-mode/images/svg-as-image-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/stable/http/tests/streams/transferable/enabled/README.txt b/third_party/blink/web_tests/virtual/stable/http/tests/streams/transferable/enabled/README.txt deleted file mode 100644 index 510fe6a6..0000000 --- a/third_party/blink/web_tests/virtual/stable/http/tests/streams/transferable/enabled/README.txt +++ /dev/null
@@ -1,3 +0,0 @@ -This test exists to ensure that transferable streams are not shipped by -accident. If all three subtests are failing, then transferable streams are not -enabled.
diff --git a/third_party/blink/web_tests/virtual/stable/http/tests/streams/transferable/enabled/enabled-expected.txt b/third_party/blink/web_tests/virtual/stable/http/tests/streams/transferable/enabled/enabled-expected.txt deleted file mode 100644 index ff5aa73b..0000000 --- a/third_party/blink/web_tests/virtual/stable/http/tests/streams/transferable/enabled/enabled-expected.txt +++ /dev/null
@@ -1,6 +0,0 @@ -This is a testharness.js-based test. -FAIL postMessage of a ReadableStream should work Failed to execute 'postMessage' on 'Window': Value at index 0 does not have a transferable type. -FAIL postMessage of a WritableStream should work Failed to execute 'postMessage' on 'Window': Value at index 0 does not have a transferable type. -FAIL postMessage of a TransformStream should work Failed to execute 'postMessage' on 'Window': Value at index 0 does not have a transferable type. -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt index 95cd442d..effac28 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -3900,15 +3900,15 @@ [Worker] interface WebTransport [Worker] attribute @@toStringTag [Worker] getter closed +[Worker] getter incomingBidirectionalStreams +[Worker] getter incomingUnidirectionalStreams +[Worker] getter readableDatagrams [Worker] getter ready +[Worker] getter writableDatagrams [Worker] method close [Worker] method constructor [Worker] method createBidirectionalStream -[Worker] method createSendStream -[Worker] method receiveBidirectionalStreams -[Worker] method receiveDatagrams -[Worker] method receiveStreams -[Worker] method sendDatagrams +[Worker] method createUnidirectionalStream [Worker] interface Worker : EventTarget [Worker] attribute @@toStringTag [Worker] getter onerror
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt index f4eccd8..acc0701 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt
@@ -11209,15 +11209,15 @@ interface WebTransport attribute @@toStringTag getter closed + getter incomingBidirectionalStreams + getter incomingUnidirectionalStreams + getter readableDatagrams getter ready + getter writableDatagrams method close method constructor method createBidirectionalStream - method createSendStream - method receiveBidirectionalStreams - method receiveDatagrams - method receiveStreams - method sendDatagrams + method createUnidirectionalStream interface WheelEvent : MouseEvent attribute @@toStringTag attribute DOM_DELTA_LINE
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt index da511fa..657fb0bc 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -3681,15 +3681,15 @@ [Worker] interface WebTransport [Worker] attribute @@toStringTag [Worker] getter closed +[Worker] getter incomingBidirectionalStreams +[Worker] getter incomingUnidirectionalStreams +[Worker] getter readableDatagrams [Worker] getter ready +[Worker] getter writableDatagrams [Worker] method close [Worker] method constructor [Worker] method createBidirectionalStream -[Worker] method createSendStream -[Worker] method receiveBidirectionalStreams -[Worker] method receiveDatagrams -[Worker] method receiveStreams -[Worker] method sendDatagrams +[Worker] method createUnidirectionalStream [Worker] interface WorkerGlobalScope : EventTarget [Worker] attribute @@toStringTag [Worker] getter addressSpace
diff --git a/third_party/instrumented_libraries/BUILD.gn b/third_party/instrumented_libraries/BUILD.gn index aa0965dd..b832aa3 100644 --- a/third_party/instrumented_libraries/BUILD.gn +++ b/third_party/instrumented_libraries/BUILD.gn
@@ -120,6 +120,7 @@ ":libtasn1-6", ":libunity9", ":libva1", + ":libwayland-client0", ":libx11-6", ":libxau6", ":libxcb1", @@ -627,12 +628,16 @@ extra_configure_flags = [ "--disable-static" ] pre_build = "scripts/pre-build/libnih1.sh" + + patch = "patches/libnih1.diff" } instrumented_library("libnih-dbus1") { extra_configure_flags = [ "--disable-static" ] pre_build = "scripts/pre-build/libnih1.sh" + + patch = "patches/libnih1.diff" } instrumented_library("libnspr4") { @@ -727,6 +732,14 @@ pre_build = "scripts/pre-build/libva1.sh" } + instrumented_library("libwayland-client0") { + extra_configure_flags = [ + "--disable-static", + "--disable-scanner", + "--disable-documentation", + ] + } + instrumented_library("libx11-6") { extra_configure_flags = [ "--disable-specs",
diff --git a/third_party/instrumented_libraries/binaries/msan-chained-origins-trusty.tgz.sha1 b/third_party/instrumented_libraries/binaries/msan-chained-origins-trusty.tgz.sha1 index d04a2e5c4..b3b796270 100644 --- a/third_party/instrumented_libraries/binaries/msan-chained-origins-trusty.tgz.sha1 +++ b/third_party/instrumented_libraries/binaries/msan-chained-origins-trusty.tgz.sha1
@@ -1 +1 @@ -92ab0ac3915bc2b50e6a8d7a990522d7355d1ef0 \ No newline at end of file +f1e29227f344393fbe410520d9b1b2331017fb52 \ No newline at end of file
diff --git a/third_party/instrumented_libraries/binaries/msan-no-origins-trusty.tgz.sha1 b/third_party/instrumented_libraries/binaries/msan-no-origins-trusty.tgz.sha1 index 0a4c487..88a6143 100644 --- a/third_party/instrumented_libraries/binaries/msan-no-origins-trusty.tgz.sha1 +++ b/third_party/instrumented_libraries/binaries/msan-no-origins-trusty.tgz.sha1
@@ -1 +1 @@ -b02322f976be38aa177febfc8616546b7a23b25e \ No newline at end of file +c67514475887c122e02905a4f184128e3488c07d \ No newline at end of file
diff --git a/third_party/instrumented_libraries/patches/libcups2.diff b/third_party/instrumented_libraries/patches/libcups2.diff index 49b262f..6131bb9 100644 --- a/third_party/instrumented_libraries/patches/libcups2.diff +++ b/third_party/instrumented_libraries/patches/libcups2.diff
@@ -29,3 +29,18 @@ # # Make everything... +diff -ru cups-1.7.2.bak/scheduler/conf.h cups-1.7.2/scheduler/conf.h +--- cups-1.7.2.bak/scheduler/conf.h 2020-09-28 13:36:59.018017680 -0700 ++++ cups-1.7.2/scheduler/conf.h 2020-09-28 13:36:47.393946500 -0700 +@@ -266,9 +266,9 @@ + #ifdef HAVE_GSSAPI + VAR char *GSSServiceName VALUE(NULL); + /* GSS service name */ +-int HaveServerCreds VALUE(0); ++__attribute__((weak)) int HaveServerCreds VALUE(0); + /* Do we have server credentials? */ +-gss_cred_id_t ServerCreds; /* Server's GSS credentials */ ++__attribute__((weak)) gss_cred_id_t ServerCreds; /* Server's GSS credentials */ + #endif /* HAVE_GSSAPI */ + +
diff --git a/third_party/instrumented_libraries/patches/libnih1.diff b/third_party/instrumented_libraries/patches/libnih1.diff new file mode 100644 index 0000000..8eab4d59 --- /dev/null +++ b/third_party/instrumented_libraries/patches/libnih1.diff
@@ -0,0 +1,12 @@ +diff -ru libnih-1.0.3.bak/nih-dbus-tool/output.h libnih-1.0.3/nih-dbus-tool/output.h +--- libnih-1.0.3.bak/nih-dbus-tool/output.h 2020-09-28 13:19:09.795416156 -0700 ++++ libnih-1.0.3/nih-dbus-tool/output.h 2020-09-28 13:19:29.139536349 -0700 +@@ -27,7 +27,7 @@ + + NIH_BEGIN_EXTERN + +-char *output_package; ++extern char *output_package; + + int output (const char *source_path, int source_fd, + const char *header_path, int header_fd,
diff --git a/third_party/instrumented_libraries/scripts/install-build-deps.sh b/third_party/instrumented_libraries/scripts/install-build-deps.sh index 3d669b32..c41f651 100755 --- a/third_party/instrumented_libraries/scripts/install-build-deps.sh +++ b/third_party/instrumented_libraries/scripts/install-build-deps.sh
@@ -52,6 +52,7 @@ libpixman-1-0 \ libpng12-0 \ libunity9 \ +libwayland-client0\ libx11-6 \ libxau6 \ libxcb1 \
diff --git a/tools/accessibility/inspect/BUILD.gn b/tools/accessibility/inspect/BUILD.gn index b5ffb664..7d939f0 100644 --- a/tools/accessibility/inspect/BUILD.gn +++ b/tools/accessibility/inspect/BUILD.gn
@@ -8,6 +8,7 @@ sources = [ "ax_dump_events.cc", "ax_event_server.cc", + "ax_utils.cc", ] deps = [
diff --git a/tools/accessibility/inspect/ax_dump_events.cc b/tools/accessibility/inspect/ax_dump_events.cc index 97265bb..580581d4 100644 --- a/tools/accessibility/inspect/ax_dump_events.cc +++ b/tools/accessibility/inspect/ax_dump_events.cc
@@ -14,11 +14,12 @@ #include "base/strings/string_number_conversions.h" #include "base/task/single_thread_task_executor.h" #include "tools/accessibility/inspect/ax_event_server.h" +#include "tools/accessibility/inspect/ax_utils.h" namespace { constexpr char kPidSwitch[] = "pid"; -constexpr char kPatternSwitch[] = "pattern"; +constexpr char kHelpSwitch[] = "help"; // Convert from string to int, whether in 0x hex format or decimal format. bool StringToInt(std::string str, int* result) { @@ -38,21 +39,40 @@ printf("%s", str.substr(message_start).c_str()); return true; } + +void PrintHelp() { + printf( + "ax_dump_evemts is a tool designed to dump platform accessible events " + "of running applications.\n"); + printf("\nusage: ax_dump_events <options>\n"); + printf("options:\n"); + printf( + " --pid\t\tprocess id of an application to dump accessible tree for\n"); + tools::PrintHelpForTreeSelectors(); +} + } // namespace int main(int argc, char** argv) { logging::SetLogMessageHandler(AXDumpEventsLogMessageHandler); base::CommandLine::Init(argc, argv); + const base::CommandLine* command_line = + base::CommandLine::ForCurrentProcess(); + + if (command_line->HasSwitch(kHelpSwitch)) { + PrintHelp(); + return 0; + } const std::string pid_str = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(kPidSwitch); - const std::string pattern_str = - base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - kPatternSwitch); - if (pid_str.empty() && pattern_str.empty()) { - LOG(ERROR) << "* Error: No process id provided via --pid=[process-id] or" - " application name pattern via --pattern=[pattern]."; + const tools::TreeSelector selector = + tools::TreeSelectorFromCommandLine(command_line); + + if (pid_str.empty() && selector.empty()) { + LOG(ERROR) << "* Error: no application was identified to dump events for. " + "Run with --help for help."; return 1; } @@ -66,7 +86,7 @@ base::AtExitManager exit_manager; base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); - const auto server = std::make_unique<tools::AXEventServer>(pid, pattern_str); + const auto server = std::make_unique<tools::AXEventServer>(pid, selector); base::RunLoop().Run(); return 0; }
diff --git a/tools/accessibility/inspect/ax_event_server.cc b/tools/accessibility/inspect/ax_event_server.cc index eafdc7ee..36b89e20a 100644 --- a/tools/accessibility/inspect/ax_event_server.cc +++ b/tools/accessibility/inspect/ax_event_server.cc
@@ -4,24 +4,17 @@ #include "tools/accessibility/inspect/ax_event_server.h" -#include <iostream> -#include <sstream> -#include <string> - #include "base/bind.h" namespace tools { -AXEventServer::AXEventServer(base::ProcessId pid, - const base::StringPiece& pattern) +AXEventServer::AXEventServer( + base::ProcessId pid, + const content::AccessibilityTreeFormatter::TreeSelector& selector) : recorder_( - content::AccessibilityEventRecorder::Create(nullptr, pid, pattern)) { + content::AccessibilityEventRecorder::Create(nullptr, pid, selector)) { recorder_->ListenToEvents( base::BindRepeating(&AXEventServer::OnEvent, base::Unretained(this))); - - std::stringstream output; - output << "Events for process id: " << pid; - printf("%s", output.str().c_str()); } AXEventServer::~AXEventServer() = default;
diff --git a/tools/accessibility/inspect/ax_event_server.h b/tools/accessibility/inspect/ax_event_server.h index a5c10f8..4a50fee 100644 --- a/tools/accessibility/inspect/ax_event_server.h +++ b/tools/accessibility/inspect/ax_event_server.h
@@ -17,13 +17,11 @@ class AXEventServer final { public: - // `application_name_match_pattern` is a matching pattern, which may contain - // wildcard characters, to be matched against the accessibility application - // name. Only events that match the pattern will be shown. If the pattern is - // empty, it is unused. + // Dumps events into console for application identified either by process id + // or tree selector. explicit AXEventServer( base::ProcessId pid, - const base::StringPiece& application_name_match_pattern); + const content::AccessibilityTreeFormatter::TreeSelector& selector); ~AXEventServer(); private:
diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec index 8a1313e8..3ea5e383 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec
@@ -325,7 +325,7 @@ "includes": [2505], "structures": [2510], }, - "chromeos/components/camera_app_ui/resources/src/strings/camera_strings.grd": { + "chromeos/components/camera_app_ui/resources/strings/camera_strings.grd": { "messages": [2515], }, "chromeos/components/diagnostics_ui/resources/diagnostics_app_resources.grd": {
diff --git a/tools/gritsettings/translation_expectations.pyl b/tools/gritsettings/translation_expectations.pyl index b1b9b33..fa4af554 100644 --- a/tools/gritsettings/translation_expectations.pyl +++ b/tools/gritsettings/translation_expectations.pyl
@@ -41,7 +41,7 @@ "chrome/browser/ui/android/strings/android_chrome_strings.grd", "chrome/credential_provider/gaiacp/gaia_resources.grd", "chromeos/chromeos_strings.grd", - "chromeos/components/camera_app_ui/resources/src/strings/camera_strings.grd", + "chromeos/components/camera_app_ui/resources/strings/camera_strings.grd", "components/autofill/android/java/strings/autofill_strings.grd", "components/browser_ui/strings/android/browser_ui_strings.grd", "components/components_chromium_strings.grd",
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 2184c5a4..a55f662 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -38524,6 +38524,24 @@ <int value="2" label="Saved via list pref"/> </enum> +<enum name="ItemSuggestCacheStatus"> + <int value="0" label="Ok"/> + <int value="1" label="Disabled by experiment"/> + <int value="2" label="Disabled by policy"/> + <int value="3" label="Invalid server URL"/> + <int value="4" label="No identity manager"/> + <int value="5" label="Google auth error"/> + <int value="6" label="Net error"/> + <int value="7" label="Response too large"/> + <int value="8" label="3xx status"/> + <int value="9" label="4xx status"/> + <int value="10" label="5xx status"/> + <int value="11" label="Empty response"/> + <int value="12" label="No results in response"/> + <int value="13" label="JSON parse failure"/> + <int value="14" label="JSON conversion failure"/> +</enum> + <enum name="JavaScriptDialogDismissalCause"> <int value="0" label="Tab closed">The tab owning the dialog was closed</int> <int value="1" label="New dialog"> @@ -41483,6 +41501,8 @@ <int value="-1472825316" label="ContextualSearchLongpressResolve:enabled"/> <int value="-1471021059" label="OmniboxUIExperimentShowSuggestionFavicons:disabled"/> + <int value="-1469555275" + label="VmCameraMicIndicatorsAndNotifications:enabled"/> <int value="-1469536698" label="ChromeHomeDoodle:enabled"/> <int value="-1469228683" label="QuickUnlockPinSignin:disabled"/> <int value="-1468126425" label="ResourceLoadScheduler:disabled"/> @@ -42771,6 +42791,8 @@ <int value="-177974995" label="CrostiniShowMicSetting:disabled"/> <int value="-177085741" label="EnableEphemeralGuestProfilesOnDesktop:disabled"/> + <int value="-176524053" + label="VmCameraMicIndicatorsAndNotifications:disabled"/> <int value="-175666252" label="Portals:disabled"/> <int value="-174829803" label="TabOutlinesInLowContrastThemes:enabled"/> <int value="-174706795" @@ -48332,6 +48354,9 @@ </enum> <enum name="ModuleIndex"> + <obsolete> + Removed in M87. + </obsolete> <int value="0" label="chrome.dll"/> <int value="1" label="chrome_elf.dll"/> <int value="2" label="ntdll.dll"/> @@ -58411,10 +58436,15 @@ <int value="5" label="Invalid values are used to update printer"/> <int value="6" label="Could not install component"/> <int value="7" label="Edit success"/> + <int value="8" label="Printer sent unexpected response"/> + <int value="9" label="Printer requires PPD"/> <int value="10" label="PPD exceeds size limit"/> <int value="11" label="PPD Rejected by cupstestppd"/> <int value="12" label="Could not find PPD"/> <int value="13" label="Failed to download PPD"/> + <int value="14" label="I/O error in CUPS"/> + <int value="15" label="Memory allocation error in Cups"/> + <int value="16" label="Printer's URI is incorrect"/> <int value="64" label="No reply from debugd over D-Bus"/> <int value="65" label="Generic D-Bus timeout"/> </enum>
diff --git a/tools/metrics/histograms/histograms_xml/apps/histograms.xml b/tools/metrics/histograms/histograms_xml/apps/histograms.xml index ef7905f..c389212 100644 --- a/tools/metrics/histograms/histograms_xml/apps/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/apps/histograms.xml
@@ -276,6 +276,30 @@ </summary> </histogram> +<histogram name="Apps.AppList.ItemSuggestCache.ResponseSize" units="bytes" + expires_after="2021-03-15"> + <owner>tby@chromium.org</owner> + <owner>jiameng@chromium.org</owner> + <owner>thanhdng@chromium.org</owner> + <owner>wrong@chromium.org</owner> + <summary> + Records the size of a response from the ItemSuggest API. Reported once per + successful response. Will not be reported if the response exceeds the + maximum size, instead check Apps.AppList.ItemSuggestCache.Status. + </summary> +</histogram> + +<histogram name="Apps.AppList.ItemSuggestCache.Status" + enum="ItemSuggestCacheStatus" expires_after="2021-03-15"> + <owner>tby@chromium.org</owner> + <owner>jiameng@chromium.org</owner> + <owner>thanhdng@chromium.org</owner> + <owner>wrong@chromium.org</owner> + <summary> + Records the outcome of a call to ItemSuggest. Reported once per call. + </summary> +</histogram> + <histogram name="Apps.AppList.LauncherSearchProvider.QueryTime" units="ms" expires_after="2020-12-31"> <owner>jennyz@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/net/OWNERS b/tools/metrics/histograms/histograms_xml/net/OWNERS new file mode 100644 index 0000000..5362c4d --- /dev/null +++ b/tools/metrics/histograms/histograms_xml/net/OWNERS
@@ -0,0 +1,10 @@ +# Networking Metrics Owners + +dschinazi@chromium.org +eroman@chromium.org + +# If none of these reviewers are available, please send CLs to +# <chromium-metrics-reviews@google.com>. See tools/metrics/histograms/OWNERS +# for details. + +# COMPONENT: Internals>Metrics
diff --git a/tools/metrics/histograms/histograms_xml/others/histograms.xml b/tools/metrics/histograms/histograms_xml/others/histograms.xml index 21427dd..ba10b33 100644 --- a/tools/metrics/histograms/histograms_xml/others/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/others/histograms.xml
@@ -8223,6 +8223,9 @@ <histogram name="ModuleIntegrityVerification.RelocationsUnordered" enum="ModuleIndex" expires_after="M85"> + <obsolete> + Removed in M87. + </obsolete> <owner>grt@chromium.org</owner> <summary> Logged when the relocations in a module are not ordered causing the module @@ -8573,6 +8576,9 @@ <histogram name="NativeSmbFileShare.ReadDirectoryCount" units="units" expires_after="M85"> + <obsolete> + Removed in M87. No longer used with smbfs. + </obsolete> <owner>zentaro@chromium.org</owner> <summary> The number of entries read when calling ReadDirectory. This is recorded @@ -8582,6 +8588,9 @@ <histogram name="NativeSmbFileShare.ReadDirectoryDuration" units="ms" expires_after="M85"> + <obsolete> + Removed in M87. No longer used with smbfs. + </obsolete> <owner>zentaro@chromium.org</owner> <summary> The duration of ReadDirectory call to SmbProvider in milliseconds. This is @@ -8590,8 +8599,9 @@ </histogram> <histogram name="NativeSmbFileShare.RemountResult" - enum="NativeSmbFileShare_MountResult" expires_after="M85"> - <owner>zentaro@chromium.org</owner> + enum="NativeSmbFileShare_MountResult" expires_after="M94"> + <owner>simmonsjosh@google.com</owner> + <owner>src/chrome/browser/chromeos/smb_client/OWNERS</owner> <summary> The result of the Remount operation during startup. This is recorded after the D-Bus call to Remount returns.
diff --git a/ui/base/ime/chromeos/extension_ime_util.h b/ui/base/ime/chromeos/extension_ime_util.h index 247a10c..380cfa8 100644 --- a/ui/base/ime/chromeos/extension_ime_util.h +++ b/ui/base/ime/chromeos/extension_ime_util.h
@@ -77,9 +77,9 @@ IsExtensionIME(const std::string& input_method_id); // Returns true if |input_method_id| is component extension IME ID. This -// function does not check |input_method_id| is really whitelisted one or not. -// If you want to check |input_method_id| is whitelisted component extension -// IME, please use ComponentExtensionIMEManager::IsWhitelisted instead. +// function does not check |input_method_id| is really allowlisted one or not. +// If you want to check |input_method_id| is allowlisted component extension +// IME, please use ComponentExtensionIMEManager::Isallowlisted instead. bool COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) IsComponentExtensionIME(const std::string& input_method_id);
diff --git a/ui/base/ime/chromeos/ime_keyboard.h b/ui/base/ime/chromeos/ime_keyboard.h index cdb86eb8..cbf8c58 100644 --- a/ui/base/ime/chromeos/ime_keyboard.h +++ b/ui/base/ime/chromeos/ime_keyboard.h
@@ -54,12 +54,12 @@ // Updates keyboard LEDs on all keyboards. // XKB asymmetrically propagates keyboard modifier indicator state changes to // slave keyboards. If the state change is initiated from a client to the - // "core/master keyboard", XKB changes global state and pushes an indication - // change down to all keyboards. If the state change is initiated by one slave + // "core keyboard", XKB changes global state and pushes an indication change + // down to all keyboards. If the state change is initiated by one slave // (physical) keyboard, it changes global state but only pushes an indicator // state change down to that one keyboard. // This function changes LEDs on all keyboards by explicitly updating the - // core/master keyboard. + // core keyboard. virtual void ReapplyCurrentModifierLockStatus() = 0; // Disables the num lock.
diff --git a/ui/base/ime/chromeos/input_method_util.h b/ui/base/ime/chromeos/input_method_util.h index ad2118c..dbae206 100644 --- a/ui/base/ime/chromeos/input_method_util.h +++ b/ui/base/ime/chromeos/input_method_util.h
@@ -77,7 +77,7 @@ // Note that the function might return false or |language_code| is unknown. // // The retured input method IDs are sorted by populalirty per - // chromeos/platform/assets/input_methods/whitelist.txt. + // chromeos/platform/assets/input_methods/allowlist.txt. bool GetInputMethodIdsFromLanguageCode( const std::string& language_code, InputMethodType type,
diff --git a/ui/base/ime/init/input_method_factory.cc b/ui/base/ime/init/input_method_factory.cc index 0eaea0f4..07ee458fb 100644 --- a/ui/base/ime/init/input_method_factory.cc +++ b/ui/base/ime/init/input_method_factory.cc
@@ -20,9 +20,7 @@ #include "ui/base/ime/mac/input_method_mac.h" #elif defined(USE_X11) || defined(USE_OZONE) #if defined(USE_X11) -// TODO(crbug.com/1085700): Remove nogncheck when we can build both Ozone -// Wayland and X11 on Linux codesearch-gen bots. -#include "ui/base/ime/linux/input_method_auralinux.h" // nogncheck +#include "ui/base/ime/linux/input_method_auralinux.h" #endif // defined(USE_X11) #if defined(USE_OZONE) #include "ui/ozone/public/ozone_platform.h"
diff --git a/ui/base/ime/init/input_method_initializer.cc b/ui/base/ime/init/input_method_initializer.cc index d182f5f..92d616a1 100644 --- a/ui/base/ime/init/input_method_initializer.cc +++ b/ui/base/ime/init/input_method_initializer.cc
@@ -12,9 +12,7 @@ #include "ui/base/ime/chromeos/ime_bridge.h" #elif defined(USE_AURA) && defined(OS_LINUX) #include "base/check.h" -// TODO(crbug.com/1085700): Remove nogncheck when we can build both Ozone -// Wayland and X11 on Linux codesearch-gen bots. -#include "ui/base/ime/linux/fake_input_method_context_factory.h" // nogncheck +#include "ui/base/ime/linux/fake_input_method_context_factory.h" #elif defined(OS_WIN) #include "ui/base/ime/init/input_method_factory.h" #include "ui/base/ime/win/tsf_bridge.h"
diff --git a/ui/base/ime/linux/BUILD.gn b/ui/base/ime/linux/BUILD.gn index b5a2b41..aee5960 100644 --- a/ui/base/ime/linux/BUILD.gn +++ b/ui/base/ime/linux/BUILD.gn
@@ -4,14 +4,7 @@ import("//build/config/linux/pangocairo/pangocairo.gni") -# Allows base/ime/linux to be built if it's just for making kythe annotations. -# This is used to generate cross references in codesearch. References are -# generated by building the ozone wayland backend on ChromiumOS, which -# normally we would not want to compile base/ime/linux for. We can't build -# both ozone and x11 on Linux yet, but when we can we should remove this. -# TODO(crbug.com/1085700): Remove || enable_kythe_annotations here. -import("//build/toolchain/kythe.gni") -assert((is_linux && !is_chromeos) || enable_kythe_annotations) +assert(is_linux && !is_chromeos) component("linux") { output_name = "ui_base_ime_linux"
diff --git a/ui/base/ime/mojom/virtual_keyboard_types.mojom b/ui/base/ime/mojom/virtual_keyboard_types.mojom index 50651ab12..41c36bd 100644 --- a/ui/base/ime/mojom/virtual_keyboard_types.mojom +++ b/ui/base/ime/mojom/virtual_keyboard_types.mojom
@@ -5,14 +5,14 @@ module ui.mojom; // This mode corresponds to virtualkeyboardpolicy -// https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/master/VirtualKeyboardPolicy/explainer.md +// https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/VirtualKeyboardPolicy/explainer.md enum VirtualKeyboardPolicy { AUTO, MANUAL, }; // This mode corresponds to VirtualKeyboard API show/hide. -// https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/master/VirtualKeyboardPolicy/explainer.md +// https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/VirtualKeyboardPolicy/explainer.md enum VirtualKeyboardVisibilityRequest { NONE, SHOW,
diff --git a/ui/base/x/x11_shm_image_pool.cc b/ui/base/x/x11_shm_image_pool.cc index 940e6fc..91dd0122 100644 --- a/ui/base/x/x11_shm_image_pool.cc +++ b/ui/base/x/x11_shm_image_pool.cc
@@ -70,11 +70,11 @@ // codepath. It may be possible in contrived cases for there to be a // false-positive, but in that case we'll just fallback to the non-SHM // codepath. - char* display_string = XDisplayString(connection->display()); + const std::string& display_string = connection->DisplayString(); char* host = nullptr; int display_id = 0; int screen = 0; - if (xcb_parse_display(display_string, &host, &display_id, &screen)) { + if (xcb_parse_display(display_string.c_str(), &host, &display_id, &screen)) { std::string name = host; free(host); if (IsRemoteHost(name))
diff --git a/ui/base/x/xwmstartupcheck/xwmstartupcheck.cc b/ui/base/x/xwmstartupcheck/xwmstartupcheck.cc index 3c55fbc..c5a03fd 100644 --- a/ui/base/x/xwmstartupcheck/xwmstartupcheck.cc +++ b/ui/base/x/xwmstartupcheck/xwmstartupcheck.cc
@@ -57,7 +57,7 @@ connection.MapWindow({dummy_window}); connection.Flush(); - int display_fd = XConnectionNumber(connection.display()); + int display_fd = connection.GetFd(); // Set deadline as 30s. struct timespec now, deadline;
diff --git a/ui/events/platform/x11/x11_event_watcher_fdwatch.cc b/ui/events/platform/x11/x11_event_watcher_fdwatch.cc index d97b6ca..b41eba6 100644 --- a/ui/events/platform/x11/x11_event_watcher_fdwatch.cc +++ b/ui/events/platform/x11/x11_event_watcher_fdwatch.cc
@@ -22,7 +22,7 @@ DCHECK(event_source_->connection()) << "Unable to get connection to X server"; - int fd = XConnectionNumber(event_source_->connection()->display()); + int fd = event_source_->connection()->GetFd(); base::CurrentUIThread::Get()->WatchFileDescriptor( fd, true, base::MessagePumpForUI::WATCH_READ, &watcher_controller_, this); started_ = true;
diff --git a/ui/events/platform/x11/x11_event_watcher_glib.cc b/ui/events/platform/x11/x11_event_watcher_glib.cc index 9665cf4..04dd0f1 100644 --- a/ui/events/platform/x11/x11_event_watcher_glib.cc +++ b/ui/events/platform/x11/x11_event_watcher_glib.cc
@@ -60,12 +60,12 @@ if (started_) return; - XDisplay* display = event_source_->connection()->display(); - if (!display) + auto* connection = event_source_->connection(); + if (!connection->Ready()) return; x_poll_ = std::make_unique<GPollFD>(); - x_poll_->fd = XConnectionNumber(display); + x_poll_->fd = connection->GetFd(); x_poll_->events = G_IO_IN; x_poll_->revents = 0;
diff --git a/ui/events/test/events_test_utils_x11.cc b/ui/events/test/events_test_utils_x11.cc index 3f716d2f..5ffe5e0 100644 --- a/ui/events/test/events_test_utils_x11.cc +++ b/ui/events/test/events_test_utils_x11.cc
@@ -120,8 +120,7 @@ event.detail = tracking_id; event.event_x = ToFp1616(location.x()), event.event_y = ToFp1616(location.y()), - event.event = - static_cast<x11::Window>(XDefaultRootWindow(gfx::GetXDisplay())); + event.event = x11::Connection::Get()->default_root(); event.button_mask = {0, 0}; return x11::Event(std::move(event)); }
diff --git a/ui/file_manager/file_manager/foreground/elements/xf_panel_item.js b/ui/file_manager/file_manager/foreground/elements/xf_panel_item.js index d02a568..c0feccb 100644 --- a/ui/file_manager/file_manager/foreground/elements/xf_panel_item.js +++ b/ui/file_manager/file_manager/foreground/elements/xf_panel_item.js
@@ -200,12 +200,12 @@ :host([detailed-summary][data-category='collapsed']) #indicator { margin-inline-end: 20px; - width: 28px; + min-width: 28px; } :host([detailed-summary][data-category='expanded']) #indicator { margin-inline-end: 18px; - width: 32px; + min-width: 32px; } :host([detailed-summary]) #primary-action {
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js index 011c0e65..8a67c26 100644 --- a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js +++ b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
@@ -1588,7 +1588,9 @@ const entries = fileManager.selectionHandler.selection.entries; if (!util.isSharesheetEnabled() || !entries || entries.length === 0 || - entries.some(entry => entry.isDirectory)) { + (entries.some(entry => entry.isDirectory) && + (!CommandUtil.isDriveEntries(entries, fileManager.volumeManager) || + entries.length > 1))) { event.canExecute = false; event.command.setHidden(true); event.command.disabled = true;
diff --git a/ui/file_manager/file_manager/foreground/js/search_controller.js b/ui/file_manager/file_manager/foreground/js/search_controller.js index acf19ed..164f414 100644 --- a/ui/file_manager/file_manager/foreground/js/search_controller.js +++ b/ui/file_manager/file_manager/foreground/js/search_controller.js
@@ -95,6 +95,9 @@ this.searchBox_.inputElement.focus(); this.searchBox_.inputElement.value = searchQuery; this.onTextChange_(); + if (this.isOnDrive_) { + this.onItemSelect_(); + } } /**
diff --git a/ui/file_manager/image_loader/image_loader_util.js b/ui/file_manager/image_loader/image_loader_util.js index b54847b..b5db852 100644 --- a/ui/file_manager/image_loader/image_loader_util.js +++ b/ui/file_manager/image_loader/image_loader_util.js
@@ -26,11 +26,6 @@ return true; } - // Non-standard color space has to be converted. - if (request.colorSpace && request.colorSpace !== ColorSpace.SRGB) { - return true; - } - // No changes required. return false; }; @@ -198,15 +193,13 @@ ]; /** - * Converts the canvas of color space into sRGB. + * Converts the canvas of color space into sRGB. TODO(noel): the Chrome <canvas> + * is color managed today. Is this code still needed? * @param {HTMLCanvasElement} target Target canvas. - * @param {ColorSpace} colorSpace Current color space. + * @param {string} colorSpace Current color space. */ ImageLoaderUtil.convertColorSpace = function(target, colorSpace) { - if (colorSpace === ColorSpace.SRGB) { - return; - } - if (colorSpace === ColorSpace.ADOBE_RGB) { + if (colorSpace === 'adobeRgb') { const matrix = ImageLoaderUtil.MATRIX_FROM_ADOBE_TO_STANDARD; const context = assertInstanceof(target.getContext('2d'), CanvasRenderingContext2D); @@ -218,17 +211,17 @@ let adobeG = data[i + 1] / 255; let adobeB = data[i + 2] / 255; - // Revert gannma transformation. + // Apply adobeRgb inverse gamma to convert to linear color. adobeR = adobeR <= 0.0556 ? adobeR / 32 : Math.pow(adobeR, 2.2); adobeG = adobeG <= 0.0556 ? adobeG / 32 : Math.pow(adobeG, 2.2); adobeB = adobeB <= 0.0556 ? adobeB / 32 : Math.pow(adobeB, 2.2); - // Convert color space. + // Matrix convert linear adobeRgb color to linear sRgb color. let sR = matrix[0] * adobeR + matrix[1] * adobeG + matrix[2] * adobeB; let sG = matrix[3] * adobeR + matrix[4] * adobeG + matrix[5] * adobeB; let sB = matrix[6] * adobeR + matrix[7] * adobeG + matrix[8] * adobeB; - // Gannma transformation. + // Convert linear color to sRgb gamma color. sR = sR <= 0.0031308 ? 12.92 * sR : 1.055 * Math.pow(sR, 1 / 2.4) - 0.055; sG = sG <= 0.0031308 ? 12.92 * sG : 1.055 * Math.pow(sG, 1 / 2.4) - 0.055; sB = sB <= 0.0031308 ? 12.92 * sB : 1.055 * Math.pow(sB, 1 / 2.4) - 0.055;
diff --git a/ui/file_manager/image_loader/image_request_task.js b/ui/file_manager/image_loader/image_request_task.js index f0ab35d..cc39051 100644 --- a/ui/file_manager/image_loader/image_request_task.js +++ b/ui/file_manager/image_loader/image_request_task.js
@@ -60,14 +60,22 @@ this.contentType_ = null; /** - * IFD data of the fetched image. Only RAW images provide non-null ifd - * data at this time; images on Drive might provide ifd in future. + * IFD data of the fetched image. Only RAW images provide a non-null + * ifd at this time. Drive images might provide an ifd in future. * @type {?string} * @private */ this.ifd_ = null; /** + * The color space of the fetched image. Only RAW images provide a + * color space at this time, being 'sRgb' or 'adobeRgb'. + * @type {?string} + * @private + */ + this.colorSpace_ = null; + + /** * Used to download remote images using http:// or https:// protocols. * @type {XMLHttpRequest} * @private @@ -336,9 +344,7 @@ function(data) { this.request_.orientation = ImageOrientation.fromExifOrientation(data.orientation); - const isAdobeRgb = data.colorSpace === 'adobeRgb'; - this.request_.colorSpace = - isAdobeRgb ? ColorSpace.ADOBE_RGB : ColorSpace.SRGB; + this.colorSpace_ = data.colorSpace; this.ifd_ = data.ifd; this.contentType_ = data.mimeType; const blob = new Blob([data.thumbnail], {type: data.mimeType}); @@ -560,24 +566,27 @@ }; /** - * Handler, when contents are loaded into the image element. Performs resizing - * and finalizes the request process. + * Handler, when contents are loaded into the image element. Performs image + * processing operations if needed, and finalizes the request process. * @private */ ImageRequestTask.prototype.onImageLoad_ = function() { + const imageColorSpace = this.colorSpace_ || 'sRgb'; + // Perform processing if the url is not a data url, or if there are some // operations requested. + let imageChanged = false; if (!(this.request_.url.match(/^data/) || this.request_.url.match(/^drivefs:/)) || ImageLoaderUtil.shouldProcess( - this.image_.width, this.image_.height, this.request_)) { + this.image_.width, this.image_.height, this.request_) || + (imageColorSpace !== 'sRgb')) { ImageLoaderUtil.resizeAndCrop(this.image_, this.canvas_, this.request_); - ImageLoaderUtil.convertColorSpace( - this.canvas_, this.request_.colorSpace || ColorSpace.SRGB); - this.sendImage_(true); // Image changed. - } else { - this.sendImage_(false); // Image not changed. + ImageLoaderUtil.convertColorSpace(this.canvas_, imageColorSpace); + imageChanged = true; // The image is now on the <canvas>. } + + this.sendImage_(imageChanged); this.cleanup_(); this.downloadCallback_(); };
diff --git a/ui/file_manager/image_loader/load_image_request.js b/ui/file_manager/image_loader/load_image_request.js index 404ac91..e5fc9b9 100644 --- a/ui/file_manager/image_loader/load_image_request.js +++ b/ui/file_manager/image_loader/load_image_request.js
@@ -5,16 +5,6 @@ 'use strict'; /** - * Color space. - * - * @enum {string} - */ -const ColorSpace = { - SRGB: 'sRgb', - ADOBE_RGB: 'adobeRgb' -}; - -/** * Response status. * * @enum {string} @@ -143,13 +133,6 @@ this.cache; /** @type {number|undefined} */ this.priority; - - /** - * ColorSpace, only used for piex images. - * - * @type{ColorSpace|undefined} - */ - this.colorSpace; } /**
diff --git a/ui/gfx/x/connection.cc b/ui/gfx/x/connection.cc index 9f48339a..50550838 100644 --- a/ui/gfx/x/connection.cc +++ b/ui/gfx/x/connection.cc
@@ -232,7 +232,14 @@ } Connection::Connection(const std::string& address) - : XProto(this), display_(OpenNewXDisplay(address)) { + : XProto(this), + display_(OpenNewXDisplay(address)), + display_string_(address) { + char* host = nullptr; + int display = 0; + xcb_parse_display(address.c_str(), &host, &display, &default_screen_id_); + if (host) + free(host); if (display_) { XSetEventQueueOwner(display_, XCBOwnsEventQueue); @@ -298,12 +305,22 @@ requests_.front().sequence) >= 0; } +int Connection::GetFd() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + return Ready() ? xcb_get_file_descriptor(XcbConnection()) : -1; +} + +const std::string& Connection::DisplayString() const { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + return display_string_; +} + int Connection::DefaultScreenId() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // This is not part of the setup data as the server has no concept of a // default screen. Instead, it's part of the display name. Eg in // "localhost:0.0", the screen ID is the second "0". - return XDefaultScreen(display_); + return default_screen_id_; } bool Connection::Ready() const { @@ -339,7 +356,7 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); while (auto* event = xcb_poll_for_event(XcbConnection())) { events_.emplace_back(base::MakeRefCounted<MallocedRefCountedMemory>(event), - this); + this, true); } } @@ -350,10 +367,9 @@ events_.pop_front(); return event; } - auto* xcb_event = xcb_wait_for_event(XcbConnection()); - if (xcb_event) { + if (auto* xcb_event = xcb_wait_for_event(XcbConnection())) { return Event(base::MakeRefCounted<MallocedRefCountedMemory>(xcb_event), - this); + this, true); } return Event(); } @@ -396,7 +412,7 @@ std::unique_ptr<Connection> Connection::Clone() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return std::make_unique<Connection>(display_ ? XDisplayString(display_) : ""); + return std::make_unique<Connection>(display_string_); } void Connection::DetachFromSequence() {
diff --git a/ui/gfx/x/connection.h b/ui/gfx/x/connection.h index 4803db72..1e0fa6c2 100644 --- a/ui/gfx/x/connection.h +++ b/ui/gfx/x/connection.h
@@ -79,6 +79,12 @@ return *default_root_visual_; } + // Returns the underlying socket's FD if the connection is valid, or -1 + // otherwise. + int GetFd(); + + const std::string& DisplayString() const; + int DefaultScreenId() const; template <typename T> @@ -172,6 +178,8 @@ uint32_t extended_max_request_length_ = 0; + std::string display_string_; + int default_screen_id_ = 0; Setup setup_; Screen* default_screen_ = nullptr; Depth* default_root_depth_ = nullptr;
diff --git a/ui/gfx/x/event.h b/ui/gfx/x/event.h index 44a56013..7e3d41dc 100644 --- a/ui/gfx/x/event.h +++ b/ui/gfx/x/event.h
@@ -25,7 +25,7 @@ class COMPONENT_EXPORT(X11) Event { public: template <typename T> - explicit Event(T&& xproto_event) { + explicit Event(T&& xproto_event, bool sequence_valid = true) { using DecayT = std::decay_t<T>; sequence_valid_ = true; sequence_ = xproto_event.sequence; @@ -34,6 +34,7 @@ auto* event = new DecayT(std::forward<T>(xproto_event)); event_ = event; window_ = event->GetWindow(); + sequence_valid_ = sequence_valid; } Event();
diff --git a/ui/gfx/x/x11.h b/ui/gfx/x/x11.h index 2f57527a..3eeaeda 100644 --- a/ui/gfx/x/x11.h +++ b/ui/gfx/x/x11.h
@@ -47,29 +47,6 @@ unsigned char minor_code; }; -using XRectangle = struct _XRectangle { - short x, y; - unsigned short width, height; -}; - -using XSetWindowAttributes = struct { - Pixmap background_pixmap; - unsigned long background_pixel; - Pixmap border_pixmap; - unsigned long border_pixel; - int bit_gravity; - int win_gravity; - int backing_store; - unsigned long backing_planes; - unsigned long backing_pixel; - Bool save_under; - long event_mask; - long do_not_propagate_mask; - Bool override_redirect; - Colormap colormap; - Cursor cursor; -}; - using XModifierKeymap = struct { int max_keypermod; KeyCode* modifiermap; @@ -81,12 +58,9 @@ Status XInitThreads(void); Display* XOpenDisplay(const char*); int XCloseDisplay(Display*); -char* XDisplayString(Display*); int XFlush(Display*); xcb_connection_t* XGetXCBConnection(Display* dpy); void XSetEventQueueOwner(Display* dpy, enum XEventQueueOwner owner); -int XDefaultScreen(Display*); -Window XDefaultRootWindow(Display*); unsigned long XLastKnownRequestProcessed(Display*); int (*XSynchronize(Display*, Bool))(Display*); int XGetErrorDatabaseText(Display*, @@ -98,26 +72,11 @@ int XGetErrorText(Display*, int, char*, int); XErrorHandler XSetErrorHandler(XErrorHandler); XIOErrorHandler XSetIOErrorHandler(XIOErrorHandler); -void XLockDisplay(Display*); -extern void XUnlockDisplay(Display*); -int XConnectionNumber(Display*); -int XSelectInput(Display*, Window, long); -int XSetWindowBackgroundPixmap(Display*, Window, Pixmap); -int XResizeWindow(Display*, Window, unsigned int, unsigned int); -int XMapWindow(Display*, Window); KeyCode XKeysymToKeycode(Display*, KeySym); char* XKeysymToString(KeySym); XModifierKeymap* XGetModifierMapping(Display*); int XFreeModifiermap(XModifierKeymap*); -int XGrabServer(Display*); -int XUngrabServer(Display*); -unsigned long XBlackPixel(Display*, int); int XStoreName(Display*, Window, const char*); -Status XIconifyWindow(Display*, Window, int); -int XConvertSelection(Display*, Atom, Atom, Atom, Window, Time); -Window XGetSelectionOwner(Display*, Atom); -int XSetSelectionOwner(Display*, Atom, Window, Time); -Status XInternAtoms(Display*, char**, int, Bool, Atom*); int XDisplayKeycodes(Display*, int*, int*); KeySym* XGetKeyboardMapping(Display*, KeyCode, int, int*); KeySym XStringToKeysym(const char*);
diff --git a/ui/gfx/x/x11_path.cc b/ui/gfx/x/x11_path.cc index 937e2060..987d583 100644 --- a/ui/gfx/x/x11_path.cc +++ b/ui/gfx/x/x11_path.cc
@@ -17,11 +17,6 @@ auto result = std::make_unique<std::vector<x11::Rectangle>>(); for (SkRegion::Iterator i(region); !i.done(); i.next()) { - XRectangle rect; - rect.x = i.rect().x(); - rect.y = i.rect().y(); - rect.width = i.rect().width(); - rect.height = i.rect().height(); result->push_back({ .x = i.rect().x(), .y = i.rect().y(),
diff --git a/ui/gfx/x/x11_types.cc b/ui/gfx/x/x11_types.cc index 79b23c9..3e09d3e 100644 --- a/ui/gfx/x/x11_types.cc +++ b/ui/gfx/x/x11_types.cc
@@ -19,8 +19,4 @@ return x11::Connection::Get()->display(); } -XDisplay* CloneXDisplay(XDisplay* display) { - return XOpenDisplay(XDisplayString(display)); -} - } // namespace gfx
diff --git a/ui/gfx/x/x11_types.h b/ui/gfx/x/x11_types.h index 149bb88..4b6b9ec 100644 --- a/ui/gfx/x/x11_types.h +++ b/ui/gfx/x/x11_types.h
@@ -40,10 +40,6 @@ // Get the XDisplay singleton. Prefer x11::Connection::Get() instead. GFX_EXPORT XDisplay* GetXDisplay(); -// Given a connection to an X server, opens a new parallel connection to the -// same X server. It's the caller's responsibility to call XCloseDisplay(). -GFX_EXPORT XDisplay* CloneXDisplay(XDisplay* display); - } // namespace gfx #endif // UI_GFX_X_X11_UTIL_H_
diff --git a/ui/gl/gl_bindings.cc b/ui/gl/gl_bindings.cc index 6dfbab9d..a55dac8a 100644 --- a/ui/gl/gl_bindings.cc +++ b/ui/gl/gl_bindings.cc
@@ -73,9 +73,9 @@ #if defined(USE_GLX) std::string DriverGLX::GetPlatformExtensions() { - Display* display = gfx::GetXDisplay(); - const int screen = (display == EGL_NO_DISPLAY ? 0 : XDefaultScreen(display)); - const char* str = glXQueryExtensionsString(display, screen); + auto* connection = x11::Connection::Get(); + const int screen = connection ? connection->DefaultScreenId() : 0; + const char* str = glXQueryExtensionsString(connection->display(), screen); return str ? std::string(str) : ""; } #endif
diff --git a/ui/gl/gl_image_glx.cc b/ui/gl/gl_image_glx.cc index d236c8e..47e7d9ef 100644 --- a/ui/gl/gl_image_glx.cc +++ b/ui/gl/gl_image_glx.cc
@@ -43,11 +43,11 @@ auto fbconfig_id = GLVisualPickerGLX::GetInstance()->GetFbConfigForFormat(format_); - auto* display = gfx::GetXDisplay(); + auto* connection = x11::Connection::Get(); int attrs[] = {GLX_FBCONFIG_ID, static_cast<uint32_t>(fbconfig_id), 0}; int nitems; - gfx::XScopedPtr<GLXFBConfig> configs( - glXChooseFBConfig(display, XDefaultScreen(display), attrs, &nitems)); + gfx::XScopedPtr<GLXFBConfig> configs(glXChooseFBConfig( + connection->display(), connection->DefaultScreenId(), attrs, &nitems)); if (!nitems) return false;
diff --git a/ui/gl/gl_surface_egl_x11.cc b/ui/gl/gl_surface_egl_x11.cc index ac6252e..9a90d99e 100644 --- a/ui/gl/gl_surface_egl_x11.cc +++ b/ui/gl/gl_surface_egl_x11.cc
@@ -86,8 +86,11 @@ // views::DesktopWindowTreeHostX11::InitX11Window back to None for the // XWindow associated to this surface after the first SwapBuffers has // happened, to avoid showing a weird white background while resizing. - if (GetXNativeConnection()->display() && !has_swapped_buffers_) { - XSetWindowBackgroundPixmap(GetXNativeConnection()->display(), window_, 0); + if (GetXNativeConnection()->Ready() && !has_swapped_buffers_) { + GetXNativeConnection()->ChangeWindowAttributes({ + .window = static_cast<x11::Window>(window_), + .background_pixmap = x11::Pixmap::None, + }); GetXNativeConnection()->Flush(); has_swapped_buffers_ = true; }
diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc index db7294f5..ab3b32e0 100644 --- a/ui/gl/gl_surface_glx.cc +++ b/ui/gl/gl_surface_glx.cc
@@ -555,12 +555,12 @@ // static std::string GLSurfaceGLX::QueryGLXExtensions() { - Display* display = gfx::GetXDisplay(); - const int screen = (display ? XDefaultScreen(display) : 0); - const char* extensions = glXQueryExtensionsString(display, screen); - if (extensions) { + auto* connection = x11::Connection::Get(); + const int screen = connection ? connection->DefaultScreenId() : 0; + const char* extensions = + glXQueryExtensionsString(connection->display(), screen); + if (extensions) return std::string(extensions); - } return ""; } @@ -739,8 +739,8 @@ bool has_alpha) { size_ = size; glXWaitGL(); - XResizeWindow(gfx::GetXDisplay(), static_cast<uint32_t>(window_), - size.width(), size.height()); + x11::Connection::Get()->ConfigureWindow( + {.window = window_, .width = size.width(), .height = size.height()}); glXWaitX(); return true; } @@ -756,16 +756,18 @@ GLSurfacePresentationHelper::ScopedSwapBuffers scoped_swap_buffers( presentation_helper_.get(), std::move(callback)); - XDisplay* display = gfx::GetXDisplay(); - glXSwapBuffers(display, GetDrawableHandle()); + auto* connection = x11::Connection::Get(); + glXSwapBuffers(connection->display(), GetDrawableHandle()); // We need to restore the background pixel that we set to WhitePixel on // views::DesktopWindowTreeHostX11::InitX11Window back to None for the // XWindow associated to this surface after the first SwapBuffers has // happened, to avoid showing a weird white background while resizing. if (!has_swapped_buffers_) { - XSetWindowBackgroundPixmap(display, static_cast<uint32_t>(parent_window_), - 0); + connection->ChangeWindowAttributes({ + .window = static_cast<x11::Window>(parent_window_), + .background_pixmap = x11::Pixmap::None, + }); has_swapped_buffers_ = true; }
diff --git a/ui/gtk/x/gtk_event_loop_x11.cc b/ui/gtk/x/gtk_event_loop_x11.cc index 3629dadc..b4ba3eb5 100644 --- a/ui/gtk/x/gtk_event_loop_x11.cc +++ b/ui/gtk/x/gtk_event_loop_x11.cc
@@ -10,6 +10,7 @@ #include <xcb/xproto.h> #include "base/memory/singleton.h" +#include "ui/base/x/x11_util.h" #include "ui/events/platform/x11/x11_event_source.h" #include "ui/gfx/x/event.h" #include "ui/gfx/x/x11.h" @@ -73,23 +74,19 @@ // case. ibus-gtk is used through gtk-immodule to support IMEs. auto* conn = x11::Connection::Get(); - XDisplay* display = conn->display(); - xcb_generic_event_t generic_event; - memset(&generic_event, 0, sizeof(generic_event)); - auto* key_event = reinterpret_cast<xcb_key_press_event_t*>(&generic_event); - key_event->response_type = gdk_event_key.type == GDK_KEY_PRESS - ? x11::KeyEvent::Press - : x11::KeyEvent::Release; - if (gdk_event_key.send_event) - key_event->response_type |= x11::kSendEventMask; - key_event->event = gdk_x11_window_get_xid(gdk_event_key.window); - key_event->root = XDefaultRootWindow(display); - key_event->time = gdk_event_key.time; - key_event->detail = gdk_event_key.hardware_keycode; - key_event->same_screen = true; - - x11::Event event(&generic_event, conn, false); + x11::KeyEvent key{ + .opcode = gdk_event_key.type == GDK_KEY_PRESS ? x11::KeyEvent::Press + : x11::KeyEvent::Release, + .send_event = gdk_event_key.send_event, + .detail = static_cast<x11::KeyCode>(gdk_event_key.hardware_keycode), + .time = static_cast<x11::Time>(gdk_event_key.time), + .root = ui::GetX11RootWindow(), + .event = static_cast<x11::Window>( + gdk_x11_window_get_xid(gdk_event_key.window)), + .same_screen = true, + }; + x11::Event event(key, false); // The key state is 16 bits on the wire, but ibus-gtk adds additional flags // that may be outside this range, so set the state after conversion from
diff --git a/ui/ozone/ozone.gni b/ui/ozone/ozone.gni index 59437918..7a4976c 100644 --- a/ui/ozone/ozone.gni +++ b/ui/ozone/ozone.gni
@@ -4,7 +4,6 @@ import("//build/config/chromecast_build.gni") import("//build/config/ui.gni") -import("//build/toolchain/kythe.gni") import("//build/toolchain/toolchain.gni") declare_args() { @@ -70,12 +69,6 @@ ozone_platform = "x11" ozone_platform_drm = true ozone_platform_x11 = true - - # Enable the Ozone Wayland platform for ChromiumOS codesearch-gen bots - # so we get cross-references in codesearch. We can remove this once - # we can compile both x11 and Ozone on desktop Linux Chrome. - # TODO(crbug.com/1085700): Remove enable_kythe_annotations here. - ozone_platform_wayland = enable_kythe_annotations } else if (is_desktop_linux) { ozone_platform = "x11" ozone_platform_wayland = true
diff --git a/ui/ozone/platform/wayland/host/xdg_surface_wrapper_impl.cc b/ui/ozone/platform/wayland/host/xdg_surface_wrapper_impl.cc index 040874c2..6ee18c65 100644 --- a/ui/ozone/platform/wayland/host/xdg_surface_wrapper_impl.cc +++ b/ui/ozone/platform/wayland/host/xdg_surface_wrapper_impl.cc
@@ -4,6 +4,7 @@ #include "ui/ozone/platform/wayland/host/xdg_surface_wrapper_impl.h" +#include <xdg-decoration-unstable-v1-client-protocol.h> #include <xdg-shell-client-protocol.h> #include <xdg-shell-unstable-v6-client-protocol.h> @@ -205,7 +206,10 @@ void XDGSurfaceWrapperImpl::SetTopLevelDecorationMode( zxdg_toplevel_decoration_v1_mode requested_mode) { - zxdg_toplevel_decoration_mode_ = requested_mode; + if (requested_mode == decoration_mode_) + return; + + decoration_mode_ = requested_mode; zxdg_toplevel_decoration_v1_set_mode(zxdg_toplevel_decoration_.get(), requested_mode); }
diff --git a/ui/ozone/platform/wayland/host/xdg_surface_wrapper_impl.h b/ui/ozone/platform/wayland/host/xdg_surface_wrapper_impl.h index feefd98..da94577 100644 --- a/ui/ozone/platform/wayland/host/xdg_surface_wrapper_impl.h +++ b/ui/ozone/platform/wayland/host/xdg_surface_wrapper_impl.h
@@ -9,7 +9,9 @@ #include <xdg-decoration-unstable-v1-client-protocol.h> -#include "base/macros.h" +#include <cstdint> +#include <string> + #include "base/strings/string16.h" #include "ui/ozone/platform/wayland/common/wayland_object.h" @@ -27,6 +29,8 @@ public: XDGSurfaceWrapperImpl(WaylandWindow* wayland_window, WaylandConnection* connection); + XDGSurfaceWrapperImpl(const XDGSurfaceWrapperImpl&) = delete; + XDGSurfaceWrapperImpl& operator=(const XDGSurfaceWrapperImpl&) = delete; ~XDGSurfaceWrapperImpl() override; // ShellSurfaceWrapper overrides: @@ -103,9 +107,11 @@ wl::Object<zxdg_toplevel_decoration_v1> zxdg_toplevel_decoration_; bool surface_for_popup_ = false; - enum zxdg_toplevel_decoration_v1_mode zxdg_toplevel_decoration_mode_; - DISALLOW_COPY_AND_ASSIGN(XDGSurfaceWrapperImpl); + // Keeps track of the decoration mode currently in use if xdg-decoration + // protocol extension is available, otherwise CLIENT_SIDE is assumed. + enum zxdg_toplevel_decoration_v1_mode decoration_mode_ = + ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE; }; } // namespace ui
diff --git a/ui/ozone/platform/x11/ozone_platform_x11.cc b/ui/ozone/platform/x11/ozone_platform_x11.cc index 322a7cb..3d9e737c0c 100644 --- a/ui/ozone/platform/x11/ozone_platform_x11.cc +++ b/ui/ozone/platform/x11/ozone_platform_x11.cc
@@ -16,6 +16,7 @@ #include "ui/base/cursor/cursor_factory.h" #include "ui/base/dragdrop/os_exchange_data_provider_factory.h" #include "ui/base/dragdrop/os_exchange_data_provider_factory_ozone.h" +#include "ui/base/ime/linux/linux_input_method_context_factory.h" #include "ui/base/x/x11_cursor_factory.h" #include "ui/base/x/x11_error_handler.h" #include "ui/base/x/x11_util.h" @@ -44,8 +45,7 @@ #include "ui/base/dragdrop/os_exchange_data_provider_non_backed.h" #include "ui/base/ime/chromeos/input_method_chromeos.h" #else -#include "ui/base/ime/linux/input_method_auralinux.h" // nogncheck -#include "ui/base/ime/linux/linux_input_method_context_factory.h" // nogncheck +#include "ui/base/ime/linux/input_method_auralinux.h" #include "ui/ozone/platform/x11/x11_os_exchange_data_provider_ozone.h" #endif
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc index 72edb60..bd1a7e40 100644 --- a/ui/views/controls/textfield/textfield.cc +++ b/ui/views/controls/textfield/textfield.cc
@@ -66,8 +66,8 @@ #endif #if defined(OS_LINUX) && !defined(OS_CHROMEOS) -#include "ui/base/ime/linux/text_edit_command_auralinux.h" // nogncheck -#include "ui/base/ime/linux/text_edit_key_bindings_delegate_auralinux.h" // nogncheck +#include "ui/base/ime/linux/text_edit_command_auralinux.h" +#include "ui/base/ime/linux/text_edit_key_bindings_delegate_auralinux.h" #endif #if defined(USE_X11)
diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc index abbc8e7..eee49b41 100644 --- a/ui/views/controls/textfield/textfield_unittest.cc +++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -65,7 +65,7 @@ #endif #if defined(OS_LINUX) && !defined(OS_CHROMEOS) -#include "ui/base/ime/linux/text_edit_key_bindings_delegate_auralinux.h" // nogncheck +#include "ui/base/ime/linux/text_edit_key_bindings_delegate_auralinux.h" #endif #if defined(OS_CHROMEOS)
diff --git a/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc b/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc index a34b08a..6d96811 100644 --- a/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc +++ b/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc
@@ -96,6 +96,12 @@ DISALLOW_COPY_AND_ASSIGN(StackingClientListWaiter); }; +void IconifyWindow(x11::Connection* connection, x11::Window window) { + ui::SendClientMessage(window, ui::GetX11RootWindow(), + gfx::GetAtom("WM_CHANGE_STATE"), + {ui::WM_STATE_ICONIC, 0, 0, 0, 0}); +} + } // namespace class X11TopmostWindowFinderTest : public test::DesktopWidgetTestInteractive { @@ -160,7 +166,7 @@ // Shows |window| and sets its bounds. void ShowAndSetXWindowBounds(x11::Window window, const gfx::Rect& bounds) { - XMapWindow(xdisplay(), static_cast<uint32_t>(window)); + connection()->MapWindow({window}); connection()->ConfigureWindow({ .window = window, @@ -285,7 +291,7 @@ EXPECT_EQ(x11_window1, FindTopmostXWindowAt(150, 150)); { MinimizeWaiter minimize_waiter(x11_window1); - XIconifyWindow(xdisplay(), static_cast<uint32_t>(x11_window1), 0); + IconifyWindow(connection(), x11_window1); minimize_waiter.Wait(); } EXPECT_NE(x11_window1, FindTopmostXWindowAt(150, 150)); @@ -296,7 +302,7 @@ EXPECT_EQ(x11_window2, FindTopmostXWindowAt(350, 150)); { MinimizeWaiter minimize_waiter(x11_window2); - XIconifyWindow(xdisplay(), static_cast<uint32_t>(x11_window2), 0); + IconifyWindow(connection(), x11_window2); minimize_waiter.Wait(); } EXPECT_NE(x11_window1, FindTopmostXWindowAt(350, 150));