diff --git a/AUTHORS b/AUTHORS index d0d2926..90495c6 100644 --- a/AUTHORS +++ b/AUTHORS
@@ -633,6 +633,7 @@ Mark Seaborn <mrs@mythic-beasts.com> Martijn Croonen <martijn@martijnc.be> Martin Bednorz <m.s.bednorz@gmail.com> +Martin Persson <mnpn03@gmail.com> Martin Rogalla <martin@martinrogalla.com> Martina Kollarova <martina.kollarova@intel.com> Masahiro Yado <yado.masa@gmail.com>
diff --git a/DEPS b/DEPS index 9149e5c..3674b70 100644 --- a/DEPS +++ b/DEPS
@@ -182,11 +182,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': '47b06754624e7745c6911d4c77adbd41dbc63ee8', + 'skia_revision': 'f9ffdd6942f9b3ae2b6b3cfadbff314a96e376e5', # 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': '9b08c186c5e3e12215c16ae2f65b7bfe836856d9', + 'v8_revision': '926f4bf2884d84aab00450eadaf1ec138827a33d', # 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. @@ -194,7 +194,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': 'd80adf4e137da54db7e755b9f1d153117f6fc5f2', + 'angle_revision': '38e96a12f1830451c2330d76779571c7e17dae40', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -245,7 +245,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': '69b4144bb101fbdfdda6ffb5257e89a3f28cb1cb', + 'catapult_revision': '03e7ff403592957f00e5af8c9ebe93d5939e335c', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -253,7 +253,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': '8667db035ed2cbd4fdd503b78f9c9465f2a08bc5', + 'devtools_frontend_revision': '12e579fd19256116a44e4ede0a5f66f9d781e7f3', # 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. @@ -289,7 +289,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'spv_tools_revision': '74130f2d3ab1b97c9fc042d8e7822a362a4cadb6', + 'spv_tools_revision': '7c213720bb46ea9a81caa9f8dc24df0f1957de05', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -305,7 +305,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': 'a2fe305797833acfa4fa3866b06f369c243c8bce', + 'dawn_revision': 'ee0516e3989ff6a7047083c7f317210245375b79', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -528,7 +528,7 @@ }, 'src/ios/third_party/material_components_ios/src': { - 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + 'da469c7660721d69f187f56db73ca76bc8868102', + 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '86f5ae1f4a19e8f73af4cb30e2c9d3f10f53e875', 'condition': 'checkout_ios', }, @@ -1224,7 +1224,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '3755aca72039c54e42fded4b16a1f2ac2c48fbf5', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '080c1b433d370e62a2cdd9912f473391f7d40da9', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1302,7 +1302,7 @@ 'packages': [ { 'package': 'fuchsia/third_party/aemu/linux-amd64', - 'version': 'WCiGqc2IsqMVCcj8UruU8vGLvhfosP46CB3tAy6N2boC' + 'version': 'pcue74MrtwdptQfnABqz12W-F6Br8-PlTN1pD5o_aQsC' }, ], 'condition': 'host_os == "linux" and checkout_fuchsia', @@ -1452,7 +1452,7 @@ }, 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '506d4eb7e4ef214ec29fd86ea51a6edaeecb81c3', + Var('webrtc_git') + '/src.git' + '@' + '10ef84728937fe73e7d8118c9c187601033450f3', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1524,7 +1524,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@84f0a85ccafe7a4046fd7dbe5eecbdbe79a2b1c2', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@c8d842d5c5c3b21bb0759e6f29c1c8d95432bc1b', 'condition': 'checkout_src_internal', },
diff --git a/android_webview/browser/icon_helper.cc b/android_webview/browser/icon_helper.cc index 6b9489bb..6e0323014 100644 --- a/android_webview/browser/icon_helper.cc +++ b/android_webview/browser/icon_helper.cc
@@ -60,6 +60,7 @@ } void IconHelper::DidUpdateFaviconURL( + content::RenderFrameHost* render_frame_host, const std::vector<blink::mojom::FaviconURLPtr>& candidates) { DCHECK_CURRENTLY_ON(BrowserThread::UI); for (const auto& candidate : candidates) {
diff --git a/android_webview/browser/icon_helper.h b/android_webview/browser/icon_helper.h index b32155ce..a8818623 100644 --- a/android_webview/browser/icon_helper.h +++ b/android_webview/browser/icon_helper.h
@@ -45,6 +45,7 @@ // From WebContentsObserver void DidUpdateFaviconURL( + content::RenderFrameHost* render_frame_host, const std::vector<blink::mojom::FaviconURLPtr>& candidates) override; void DidStartNavigation(content::NavigationHandle* navigation) override;
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_af.xtb b/ash/shortcut_viewer/strings/ash_components_strings_af.xtb index bd9ed51..484893d7 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_af.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_af.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Zoem aansig in</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Selekteer teks tot by die einde van die reël</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> of <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Klik ikone 1-8 op jou rak</translation> <translation id="6435207348963613811">Kleurmerk die vorige item op jou rak</translation> <translation id="6445033640292336367">Skuif die oortjie terug na sy oorspronklike plek</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_am.xtb b/ash/shortcut_viewer/strings/ash_components_strings_am.xtb index 498875f..9fec9a81 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_am.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_am.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">ማሳያን ማጉላት</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">ጽሑፍን እስከ የመስመሩ መጨረሻ ይምረጡ</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> ወይም <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">በእርስዎ መደርደሪያ ላይ 1-8 አዶዎችን ጠቅ ያድርጉ</translation> <translation id="6435207348963613811">በእርስዎ መደርደሪያ ላይ ቀዳሚውን ንጥል ያድምቁ</translation> <translation id="6445033640292336367">ትሩን ወደ የመጀመሪያው አቀማመጡ ይመልሱ</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_ar.xtb b/ash/shortcut_viewer/strings/ash_components_strings_ar.xtb index 40d046c..0604cb2 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_ar.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_ar.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">تكبير العرض</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">تحديد النص حتى نهاية السطر</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> أو <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">النقر على الرموز 1-8 على الرف</translation> <translation id="6435207348963613811">تمييز العنصر السابق على الرف</translation> <translation id="6445033640292336367">إرجاع علامة التبويب إلى موضعها الأصلي</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_as.xtb b/ash/shortcut_viewer/strings/ash_components_strings_as.xtb index 1dd80066..3f0d9a77 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_as.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_as.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">’জুম ইন কৰক’ প্ৰদর্শন কৰক</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">শাৰীটোৰ একেবাৰে শেষলৈ পাঠ বাছনি কৰক</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> বা <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">আপোনাৰ শ্বেল্ফৰ আইকন ১ৰ পৰা ৮লৈ ক্লিক কৰক</translation> <translation id="6435207348963613811">আপোনাৰ শ্বেল্ফৰ পূৰ্বৱৰ্তী বস্তুটো হাইলাইট কৰক</translation> <translation id="6445033640292336367">টেবটোক তাৰ প্ৰকৃত স্থানলৈ উভতাই নিয়ে</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_az.xtb b/ash/shortcut_viewer/strings/ash_components_strings_az.xtb index 6d7512a..233592b 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_az.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_az.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Ekranı Böyüdün</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Sətrin sonundakı mətni seçin</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> və ya <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Rəfdə 1-8 işarələrinə klikləyin</translation> <translation id="6435207348963613811">Rəfdə öncəki elementi vurğulayın</translation> <translation id="6445033640292336367">Tabı orijinal vəziyyətinə qaytarın</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_be.xtb b/ash/shortcut_viewer/strings/ash_components_strings_be.xtb index 772c957e..930eda7 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_be.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_be.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Павялічыць маштаб дысплэя</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Вылучыць тэкст да канца радка</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> або <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Націснуць на значкі 1-8 на паліцы</translation> <translation id="6435207348963613811">Вылучыць папярэдні элемент на паліцы</translation> <translation id="6445033640292336367">Вярнуць укладку ў зыходнае становішча</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_bg.xtb b/ash/shortcut_viewer/strings/ash_components_strings_bg.xtb index 6df649e..4c35a5a 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_bg.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_bg.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Увеличаване на мащаба на екрана</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Избиране на текста до края на реда</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> или <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Кликване върху иконите от 1 до 8 в лавицата</translation> <translation id="6435207348963613811">Поставяне на фокуса върху предишния елемент в лавицата</translation> <translation id="6445033640292336367">Връщане на раздела на първоначалната му позиция</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_bn.xtb b/ash/shortcut_viewer/strings/ash_components_strings_bn.xtb index 23f1dac..05c2b6f1 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_bn.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_bn.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">ডিসপ্লের জুম বাড়ান</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">লাইনের শেষে টেক্সট বেছে নিন</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> অথবা <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">আপনার শেল্ফে ১-৮টি আইকন ক্লিক করুন</translation> <translation id="6435207348963613811">আপনার শেল্ফে আগের আইটেমটি হাইলাইট করুন</translation> <translation id="6445033640292336367">ট্যাবটিকে তার আসল অবস্থানে ফেরত নিয়ে যান</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_bs.xtb b/ash/shortcut_viewer/strings/ash_components_strings_bs.xtb index 21f08250..b97e34b 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_bs.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_bs.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Uvećanje ekrana</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Odaberi tekst na kraju reda</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> ili <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Klik na ikone od 1 do 8 na polici</translation> <translation id="6435207348963613811">Isticanje prethodne stavke na polici</translation> <translation id="6445033640292336367">Vrati karticu u izvorni položaj</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_ca.xtb b/ash/shortcut_viewer/strings/ash_components_strings_ca.xtb index e454f83..1130546 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_ca.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_ca.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Amplia el contingut de la pantalla</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Selecciona text fins al final de la línia</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> o <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Fes clic a les icones de l'1 al 8 del prestatge</translation> <translation id="6435207348963613811">Destaca l'element anterior del prestatge</translation> <translation id="6445033640292336367">Torna a col·locar la pestanya a la posició original</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_cs.xtb b/ash/shortcut_viewer/strings/ash_components_strings_cs.xtb index 945f9b8b..7eb09108 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_cs.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_cs.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Přiblížit zobrazení</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Vybrat text až do konce řádku</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> nebo <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Kliknout na položky 1–8 na poličce</translation> <translation id="6435207348963613811">Zvýraznit předchozí položku na poličce</translation> <translation id="6445033640292336367">Vrátit kartu na původní pozici</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_da.xtb b/ash/shortcut_viewer/strings/ash_components_strings_da.xtb index b39ba18..6fcd372 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_da.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_da.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Zoom ind på skærmen</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Markér teksten til slutningen af linjen</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> eller <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Klik på ikon 1-8 på din hylde</translation> <translation id="6435207348963613811">Fremhæv det forrige element på din hylde</translation> <translation id="6445033640292336367">Flyt fanen tilbage til sin udgangsposition</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_de.xtb b/ash/shortcut_viewer/strings/ash_components_strings_de.xtb index dac0e410..e4869071 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_de.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_de.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Display heranzoomen</translation> <translation id="6359811074279051077">"<ph name="MODIFIER" />" <ph name="SEPARATOR" /> "<ph name="KEY" />"</translation> <translation id="6395172954772765143">Text bis zum Zeilenende markieren</translation> -<translation id="6419237577786823024">"<ph name="CTRL1" />" <ph name="SEPARATOR1" /> "<ph name="LEFT" />" oder "<ph name="CTRL2" />" <ph name="SEPARATOR2" /> "<ph name="RIGHT" />"</translation> <translation id="6425378783626925378">Auf Symbole 1 bis 8 in der Ablage klicken</translation> <translation id="6435207348963613811">Vorheriges Element in der Ablage markieren</translation> <translation id="6445033640292336367">Tab zur Ausgangsposition zurückschieben</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_el.xtb b/ash/shortcut_viewer/strings/ash_components_strings_el.xtb index d290984d..852f695 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_el.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_el.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Μεγέθυνση οθόνης</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Επιλογή κειμένου έως το τέλος της γραμμής</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> ή <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Κλικ στα εικονίδια 1-8 στο ράφι σας</translation> <translation id="6435207348963613811">Επισήμανση του προηγούμενου στοιχείου στο ράφι σας</translation> <translation id="6445033640292336367">Επαναφορά της καρτέλας στην αρχική της θέση</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_en-GB.xtb b/ash/shortcut_viewer/strings/ash_components_strings_en-GB.xtb index ff76d46..64e14835 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_en-GB.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_en-GB.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Display zoom in</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Select text to the end of the line</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> or <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Click icons 1-8 on your shelf</translation> <translation id="6435207348963613811">Highlight the previous item on your shelf</translation> <translation id="6445033640292336367">Return the tab to its original position</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_es-419.xtb b/ash/shortcut_viewer/strings/ash_components_strings_es-419.xtb index 683de2d..9bce1b2 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_es-419.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_es-419.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Acercar la pantalla</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Seleccionar el texto hasta el final de la línea</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> o <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Hacer clic en los íconos 1 a 8 de la biblioteca</translation> <translation id="6435207348963613811">Destacar el elemento anterior en la biblioteca</translation> <translation id="6445033640292336367">Volver a colocar la pestaña en su posición original</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_es.xtb b/ash/shortcut_viewer/strings/ash_components_strings_es.xtb index aef6734..f8e0db8 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_es.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_es.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Ampliar el contenido de la pantalla</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Seleccionar texto hasta el final de la línea</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> o <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Hacer clic en un icono del 1 al 8 de la estantería</translation> <translation id="6435207348963613811">Destacar el elemento anterior de la estantería</translation> <translation id="6445033640292336367">Volver a colocar la pestaña en su posición original</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_et.xtb b/ash/shortcut_viewer/strings/ash_components_strings_et.xtb index d2563c3..b4a93a3 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_et.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_et.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Ekraanil sissesuumimine</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /> <ph name="SEPARATOR" /> <ph name="KEY" /></translation> <translation id="6395172954772765143">Teksti valimine kuni rea lõpuni</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /> <ph name="SEPARATOR1" /> <ph name="LEFT" /> või <ph name="CTRL2" /> <ph name="SEPARATOR2" /> <ph name="RIGHT" /></translation> <translation id="6425378783626925378">Riiulis ikoonidel 1–8 klõpsamine</translation> <translation id="6435207348963613811">Riiulis eelmise üksuse esiletõstmine</translation> <translation id="6445033640292336367">Vahelehe tagastamine algsesse asukohta</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_eu.xtb b/ash/shortcut_viewer/strings/ash_components_strings_eu.xtb index e4ee0bf..2753bbee 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_eu.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_eu.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Bistaratzea handitzea</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Hautatu lerroaren amaierako testua</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> edo <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Egin klik biltegiko 1-8 ikonoetan</translation> <translation id="6435207348963613811">Nabarmendu biltegiko aurreko elementua</translation> <translation id="6445033640292336367">Leheneratu fitxa jatorrizko posiziora</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_fa.xtb b/ash/shortcut_viewer/strings/ash_components_strings_fa.xtb index a072eb7..767c14e 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_fa.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_fa.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">بزرگنمایی صفحهنمایش</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">انتخاب نوشتار تا انتهای خط</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> یا <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">کلیک کردن نمادهای ۱ تا ۸ در قفسه</translation> <translation id="6435207348963613811">برجستهسازی مورد قبلی روی قفسه شما</translation> <translation id="6445033640292336367">برگرداندن برگه به جای اول</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_fi.xtb b/ash/shortcut_viewer/strings/ash_components_strings_fi.xtb index 1013e3db..c3298d5 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_fi.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_fi.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Näytön lähennys</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Valitse teksti rivin loppuun asti</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> tai <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Klikkaa hyllyn kuvakkeita 1–8</translation> <translation id="6435207348963613811">Korosta hyllyn edellinen kohde</translation> <translation id="6445033640292336367">Palauta välilehti alkuperäiseen sijaintiin</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_fil.xtb b/ash/shortcut_viewer/strings/ash_components_strings_fil.xtb index e241aac..b16e547 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_fil.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_fil.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Ipakita ang Pag-zoom in</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Piliin ang text hanggang sa dulo ng linya</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> o <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">I-click ang icon 1-8 sa iyong shelf</translation> <translation id="6435207348963613811">I-highlight ang nakaraang item sa iyong shelf</translation> <translation id="6445033640292336367">Ibalik ang tab sa orihinal nitong posisyon</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_fr-CA.xtb b/ash/shortcut_viewer/strings/ash_components_strings_fr-CA.xtb index f80555d..321cc1a 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_fr-CA.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_fr-CA.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Zoom avant de l'affichage</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Sélectionner le texte jusqu'à la fin de la ligne</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> ou <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Cliquer sur les icônes 1 à 8 de votre étagère</translation> <translation id="6435207348963613811">Mettre en évidence l'élément précédent de votre étagère</translation> <translation id="6445033640292336367">Retourner un onglet à sa position d'origine</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_fr.xtb b/ash/shortcut_viewer/strings/ash_components_strings_fr.xtb index 6704039..37b31c8 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_fr.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_fr.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Zoom avant de l'écran</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Sélectionner du texte jusqu'à la fin de la ligne</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> ou <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Cliquer sur les icônes de 1 à 8 de l'étagère</translation> <translation id="6435207348963613811">Mettre en surbrillance l'élément précédent sur l'étagère</translation> <translation id="6445033640292336367">Replacer l'onglet à sa position initiale</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_gl.xtb b/ash/shortcut_viewer/strings/ash_components_strings_gl.xtb index 31c2bad..3b00e58 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_gl.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_gl.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Achega o zoom da pantalla</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Selecciona texto ao final da liña</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> ou <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Fai clic nas iconas do 1 ao 8 do estante</translation> <translation id="6435207348963613811">Destaca o elemento anterior do estante</translation> <translation id="6445033640292336367">Devolve a pestana á súa posición orixinal</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_gu.xtb b/ash/shortcut_viewer/strings/ash_components_strings_gu.xtb index 4493ddd..44e9e4fc 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_gu.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_gu.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">ઝૂમ વધારવાનું બતાવો</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">પંક્તિના અંતે આવેલી ટેક્સ્ટ પસંદ કરો</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> અથવા <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">તમારા શેલ્ફ પરના 1-8 આઇકન પર ક્લિક કરો</translation> <translation id="6435207348963613811">તમારા શેલ્ફ પરની પાછલી આઇટમને હાઇલાઇટ કરો</translation> <translation id="6445033640292336367">ટૅબને તેની ઑરિજિનલ સ્થિતિમાં પાછી લાવો</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_hi.xtb b/ash/shortcut_viewer/strings/ash_components_strings_hi.xtb index a887198..1919c8c 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_hi.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_hi.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">'ज़ूम इन करें' दिखाएं</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">पंक्ति के आखिर तक का लेख चुनें</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> या <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">अपनी शेल्फ़ पर 1 से 8 तक आइकॉन पर क्लिक करें</translation> <translation id="6435207348963613811">अपनी शेल्फ़ पर पिछला आइटम हाइलाइट करें</translation> <translation id="6445033640292336367">टैब को उसकी मूल जगह पर वापस ले जाएं</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_hr.xtb b/ash/shortcut_viewer/strings/ash_components_strings_hr.xtb index adde8248..cbe7b573 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_hr.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_hr.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Povećanje prikaza</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Odabir teksta do kraja retka</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> ili <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Klik na ikone od 1 do 8 na polici</translation> <translation id="6435207348963613811">Isticanje prethodne stavke na polici</translation> <translation id="6445033640292336367">Vraćanje kartice na izvorni položaj</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_hu.xtb b/ash/shortcut_viewer/strings/ash_components_strings_hu.xtb index 6b4afa6..8afeb878 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_hu.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_hu.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Kijelző nagyítása</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Szöveg kijelölése a sor végéig</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> vagy <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">A polcon lévő ikonokra kattintás (1–8-ig)</translation> <translation id="6435207348963613811">Az előző elem kiemelése a polcon</translation> <translation id="6445033640292336367">A lap visszahelyezése az eredeti helyére</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_hy.xtb b/ash/shortcut_viewer/strings/ash_components_strings_hy.xtb index 409ab03..3776dfe 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_hy.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_hy.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Մեծացնել էկրանի մասշտաբը</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Նշել տեքստը մինչև տողի վերջը</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> կամ <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Սեղմել 1-8 պատկերակները դարակում</translation> <translation id="6435207348963613811">Նշել նախորդ տարրը դարակում</translation> <translation id="6445033640292336367">Վերադարձնել ներդիրը սկզբնական դիրքի</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_id.xtb b/ash/shortcut_viewer/strings/ash_components_strings_id.xtb index ef52e31..be87ecfa 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_id.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_id.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Menampilkan fitur Perbesar</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Memilih teks sampai akhir baris</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> atau <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Mengklik ikon 1-8 di rak</translation> <translation id="6435207348963613811">Menandai item sebelumnya di rak</translation> <translation id="6445033640292336367">Mengembalikan tab ke posisi semula</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_is.xtb b/ash/shortcut_viewer/strings/ash_components_strings_is.xtb index fb8d47a..133ecc58 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_is.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_is.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Stækka skjá</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Velja texta að enda línunnar</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> eða <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Smella á tákn 1–8 á hillu</translation> <translation id="6435207348963613811">Auðkenna fyrra atriði á hillu</translation> <translation id="6445033640292336367">Færa flipa aftur á upphaflegan stað</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_it.xtb b/ash/shortcut_viewer/strings/ash_components_strings_it.xtb index 0183b68..3d3f559 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_it.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_it.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Aumenta lo zoom dello schermo</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Seleziona il testo alla fine della riga</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> o <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Consente di fare clic sulle icone 1-8 nella shelf</translation> <translation id="6435207348963613811">Mette in evidenza l'elemento precedente sulla shelf</translation> <translation id="6445033640292336367">Ripristina la posizione originale della scheda</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_iw.xtb b/ash/shortcut_viewer/strings/ash_components_strings_iw.xtb index 56aac940..0332d3b 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_iw.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_iw.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">התקרבות לתצוגה</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">בחירת הטקסט עד סוף השורה</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> או <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">לחיצה על הסמלים 1 עד 8 במדף</translation> <translation id="6435207348963613811">הדגשת הפריט הקודם במדף</translation> <translation id="6445033640292336367">החזרת הכרטיסייה למיקום המקורי שלה</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_ja.xtb b/ash/shortcut_viewer/strings/ash_components_strings_ja.xtb index 6b0cf03a..473031f 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_ja.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_ja.xtb
@@ -142,7 +142,6 @@ <translation id="6340769215862220182">ディスプレイをズームイン</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /> キーを押す</translation> <translation id="6395172954772765143">行末までのテキストを選択する</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" />キーまたは <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" />キーを押す</translation> <translation id="6425378783626925378">シェルフの 1~8 番目のアイコンをクリックする</translation> <translation id="6435207348963613811">シェルフの前のアイテムをハイライト表示する</translation> <translation id="6445033640292336367">タブを元の位置に戻す</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_ka.xtb b/ash/shortcut_viewer/strings/ash_components_strings_ka.xtb index d29aa44..cbb8795b5 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_ka.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_ka.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">ეკრანის მასშტაბის გადიდება</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">ტექსტის არჩევა ხაზის ბოლოში</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> ან <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">თაროზე 1-დან 8-მდე ხატულებზე დაწკაპუნება</translation> <translation id="6435207348963613811">თაროზე წინა ერთეულის გამოყოფა</translation> <translation id="6445033640292336367">ჩანართის დაბრუნება თავდაპირველ პოზიციაზე</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_kk.xtb b/ash/shortcut_viewer/strings/ash_components_strings_kk.xtb index 98716ca..caa36d9 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_kk.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_kk.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Дисплейді ұлғайту</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Жолдың соңына енгізілетін мәтінді таңдау</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> немесе <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Сөредегі 1-8 арасындағы белгішелерді басу</translation> <translation id="6435207348963613811">Сөредегі алдыңғы элементті бөлектеу</translation> <translation id="6445033640292336367">Қойындыны бастапқы орнына қайтару</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_km.xtb b/ash/shortcut_viewer/strings/ash_components_strings_km.xtb index 28fa4fa..2566dab 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_km.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_km.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">ពង្រីកការបង្ហាញ</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">ជ្រើសរើសអត្ថបទរហូតដល់ចុងបន្ទាត់</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> ឬ <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">ចុចរូបតំណាង 1-8 នៅលើធ្នើរបស់អ្នក</translation> <translation id="6435207348963613811">រំលេចធាតុពីមុននៅលើធ្នើរបស់អ្នក</translation> <translation id="6445033640292336367">ផ្លាស់ទីផ្ទាំងទៅទីតាំងដើមរបស់វាវិញ</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_kn.xtb b/ash/shortcut_viewer/strings/ash_components_strings_kn.xtb index 4c93d08..ad6aaffd 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_kn.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_kn.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">ಡಿಸ್ಪ್ಲೇ ಅನ್ನು ಝೂಮ್ ಇನ್ ಮಾಡಿ</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">ಸಾಲಿನ ಕೊನೆಯವರೆಗಿನ ಪಠ್ಯವನ್ನು ಆಯ್ಕೆಮಾಡಿ</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> ಅಥವಾ <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">ನಿಮ್ಮ ಶೆಲ್ಫ್ನಲ್ಲಿರುವ 1-8 ಐಟಂಗಳನ್ನು ಕ್ಲಿಕ್ ಮಾಡಿ</translation> <translation id="6435207348963613811">ನಿಮ್ಮ ಶೆಲ್ಫ್ನಲ್ಲಿರುವ ಹಿಂದಿನ ಐಟಂ ಅನ್ನು ಹೈಲೈಟ್ ಮಾಡಿ</translation> <translation id="6445033640292336367">ಟ್ಯಾಬ್ ಅನ್ನು ಅದರ ಮೂಲ ಸ್ಥಿತಿಗೆ ಹಿಂತಿರುಗಿಸಿ</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_ko.xtb b/ash/shortcut_viewer/strings/ash_components_strings_ko.xtb index 07428438..edaf794 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_ko.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_ko.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">화면 확대</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">텍스트 행 끝부분까지 선택</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> 또는 <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">실행기의 아이콘 1~8 클릭</translation> <translation id="6435207348963613811">실행기의 이전 항목 강조표시</translation> <translation id="6445033640292336367">탭을 원래 위치로 되돌림</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_ky.xtb b/ash/shortcut_viewer/strings/ash_components_strings_ky.xtb index b7da6a6..b43f4ab 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_ky.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_ky.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Дисплейдин масштабын чоңойтуу</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Текстти саптын аягына чейин тандоо</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> же <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Текчедеги 1-8 сүрөтчөлөрүн чыкылдатуу</translation> <translation id="6435207348963613811">Текчедеги мурунку элементти бөлүп көрсөтүү</translation> <translation id="6445033640292336367">Өтмөктү баштапкы абалына кайтаруу</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_lo.xtb b/ash/shortcut_viewer/strings/ash_components_strings_lo.xtb index 1fe71b7..f889025e 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_lo.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_lo.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">ຊູມຈໍສະແດງຜົນເຂົ້າ</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">ເລືອກຂໍ້ຄວາມຫາຈຸດສິ້ນສຸດແຖວ</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> ຫຼື <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">ຄລິກໄອຄອນ 1-8 ໃນຖ້ານຂອງທ່ານ</translation> <translation id="6435207348963613811">ໄຮໄລ້ລາຍການຜ່ານມາໃນຖ້ານຂອງທ່ານ</translation> <translation id="6445033640292336367">ນຳແຖບກັບຄືນສູ່ຕຳແໜ່ງເດີມຂອງທ່ານ</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_lt.xtb b/ash/shortcut_viewer/strings/ash_components_strings_lt.xtb index 19fc9ff..7b49949e 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_lt.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_lt.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Artinti ekraną</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Pasirinkti tekstą iki eilutės pabaigos</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> arba <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Spustelėti 1–8 piktogramas lentynoje</translation> <translation id="6435207348963613811">Paryškinti ankstesnį elementą lentynoje</translation> <translation id="6445033640292336367">Grąžinti skirtuką į pradinę padėtį</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_lv.xtb b/ash/shortcut_viewer/strings/ash_components_strings_lv.xtb index 009168ba..b07dd40 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_lv.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_lv.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Tuvināt displeja attēlu</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Atlasīt tekstu līdz rindiņas beigām</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> vai <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Noklikšķināt uz 1.–8. ikonas plauktā</translation> <translation id="6435207348963613811">Izcelt iepriekšējo plauktā esošo vienumu</translation> <translation id="6445033640292336367">Novietot cilni sākotnējā pozīcijā</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_mk.xtb b/ash/shortcut_viewer/strings/ash_components_strings_mk.xtb index e2aa889..3f29eba9 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_mk.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_mk.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Зумирајте го екранот</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Изберете текст на крајот од редот</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> или <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Кликнете на иконите од 1 до 8 на полицата</translation> <translation id="6435207348963613811">Нагласете ја претходната ставка на полицата</translation> <translation id="6445033640292336367">Вратете ја картичката во нејзината првобитна позиција</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_ml.xtb b/ash/shortcut_viewer/strings/ash_components_strings_ml.xtb index 5446d6a8..356c6170 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_ml.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_ml.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">സൂം ഇൻ ഡിസ്പ്ലേ ചെയ്യുക</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">വരിയുടെ അവസാനം വരെയുള്ള ടെക്സ്റ്റ് തിരഞ്ഞെടുക്കുക</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> അല്ലെങ്കിൽ <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">നിങ്ങളുടെ ഷെൽഫിലെ 1-8 വരെയുള്ള ചിഹ്നങ്ങളിൽ ക്ലിക്ക് ചെയ്യുക</translation> <translation id="6435207348963613811">നിങ്ങളുടെ ഷെൽഫിലെ മുമ്പത്തെ ഇനം ഹൈലൈറ്റ് ചെയ്യുക</translation> <translation id="6445033640292336367">ടാബിനെ, അതിന്റെ യഥാർത്ഥ സ്ഥാനത്തേക്ക് തിരികെ കൊണ്ടുവരിക</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_mn.xtb b/ash/shortcut_viewer/strings/ash_components_strings_mn.xtb index b43034a..77a803d 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_mn.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_mn.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Дэлгэцийг томруулж харуулах</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Мөрийн төгсгөл хэсэгт текст сонгох</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> эсвэл <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Тавиур дээрх 1-8 гэсэн дүрс тэмдгийг дарах</translation> <translation id="6435207348963613811">Тавиур дээрх өмнөх зүйлийг тодруулах</translation> <translation id="6445033640292336367">Чихтэй хуудсыг үндсэн байрлалд нь буцаах</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_mr.xtb b/ash/shortcut_viewer/strings/ash_components_strings_mr.xtb index 678d0d3..5643d23 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_mr.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_mr.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">झूम इन प्रदर्शित करा</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">रेषेच्या शेवटी असलेला मजकूर निवडा</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> किंवा <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">तुमच्या शेल्फवरील १-८ आयकनवर क्लिक करा</translation> <translation id="6435207348963613811">तुमच्या शेल्फवरील आधीचे आयटम हायलाइट करा</translation> <translation id="6445033640292336367">टॅबला त्याच्या मूळ स्थितीत परत न्या</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_ms.xtb b/ash/shortcut_viewer/strings/ash_components_strings_ms.xtb index 34f4f038..454c5d8 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_ms.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_ms.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Paparkan Zum masuk</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Pilih teks di penghujung baris</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> atau <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Klik ikon 1-8 pada rak anda</translation> <translation id="6435207348963613811">Serlahkan item sebelumnya pada rak anda</translation> <translation id="6445033640292336367">Kembalikan tab ke kedudukan asal</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_my.xtb b/ash/shortcut_viewer/strings/ash_components_strings_my.xtb index af9d738..9d0dd067 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_my.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_my.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">မျက်နှာပြင် ဇူးမ်ဆွဲရန်</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">စာကြောင်း၏ အဆုံးကို ရွေးချယ်ရန်</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> သို့မဟုတ် <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">သင်၏ စင်ပေါ်ရှိ သင်္ကေတ ၁−၈ ကို နှိပ်ရန်</translation> <translation id="6435207348963613811">သင်၏ စင်ပေါ်ရှိ ယခင်အကြောင်းအရာကို ထင်သာအောင် ပြုလုပ်ရန်</translation> <translation id="6445033640292336367">ဝဘ်ကို ၎င်း၏မူလနေရာသို့ ပြန်ရွှေ့ရန်</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_ne.xtb b/ash/shortcut_viewer/strings/ash_components_strings_ne.xtb index 985a5f5..1a9a0360 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_ne.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_ne.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">जुम इन गर्ने विकल्प देखाउनुहोस्</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">हरफको अन्त्यसम्मको पाठ चयन गर्नुहोस्</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> वा <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">आफ्नो सेल्फमा भएका १ देखि ८ सम्मका आइकनहरूमा क्लिक गर्नुहोस्</translation> <translation id="6435207348963613811">आफ्नो सेल्फमा भएको अघिल्लो वस्तुलाई हाइलाइट गर्नुहोस्</translation> <translation id="6445033640292336367">ट्याबलाई यसको मूल स्थितिमा फर्काउनुहोस्</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_nl.xtb b/ash/shortcut_viewer/strings/ash_components_strings_nl.xtb index 2624406..ffd540b 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_nl.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_nl.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Inzoomen scherm</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Tekst tot het einde van de regel selecteren</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> of <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Klikken op pictogram 1-8 op de plank</translation> <translation id="6435207348963613811">Het vorige item op de plank markeren</translation> <translation id="6445033640292336367">Het tabblad terugzetten op zijn oorspronkelijke positie</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_no.xtb b/ash/shortcut_viewer/strings/ash_components_strings_no.xtb index c0d80060..45ee6e4 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_no.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_no.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Zoom inn skjerm</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Merk teksten til slutten av linjen</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> eller <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Klikk på ikon 1–8 på hyllen</translation> <translation id="6435207348963613811">Fremhev det forrige elementet på hyllen</translation> <translation id="6445033640292336367">Flytt fanen tilbake til den opprinnelige plasseringen</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_or.xtb b/ash/shortcut_viewer/strings/ash_components_strings_or.xtb index 9c50d07e8..8d973e8 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_or.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_or.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">ଜୁମ୍ ଇନ୍ ପ୍ରଦର୍ଶନ କରନ୍ତୁ</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">ଲାଇନ୍ର ଶେଷକୁ ଟେକ୍ସଟ୍ ଚୟନ କରନ୍ତୁ</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> କିମ୍ବା <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">ଆପଣଙ୍କର ସେଲ୍ଫରେ 1-8 ମଧ୍ୟରେ ଥିବା ଆଇକନ୍ଗୁଡ଼ିକୁ କ୍ଲିକ୍ କରନ୍ତୁ</translation> <translation id="6435207348963613811">ଆପଣଙ୍କର ସେଲ୍ଫରେ ପୂର୍ବବର୍ତ୍ତୀ ଆଇଟମ୍ ହାଇଲାଇଟ୍ କରନ୍ତୁ</translation> <translation id="6445033640292336367">ଟାବ୍କୁ ଏହାର ମୂଳ ସ୍ଥିତିକୁ ଫେରାନ୍ତୁ</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_pa.xtb b/ash/shortcut_viewer/strings/ash_components_strings_pa.xtb index 53b8865..9a1e5e6f 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_pa.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_pa.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">ਡਿਸਪਲੇ ਦਾ ਜ਼ੂਮ ਵਧਾਓ</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">ਲਾਈਨ ਦੇ ਅਖੀਰ ਤੱਕ ਲਿਖਤ ਨੂੰ ਚੁਣੋ</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> ਜਾਂ <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">ਆਪਣੀ ਸ਼ੈਲਫ਼ 'ਤੇ 1-8 ਪ੍ਰਤੀਕਾਂ 'ਤੇ ਕਲਿੱਕ ਕਰੋ</translation> <translation id="6435207348963613811">ਆਪਣੀ ਸ਼ੈਲਫ਼ 'ਤੇ ਪਿਛਲੀ ਆਈਟਮ ਉਜਾਗਰ ਕਰੋ</translation> <translation id="6445033640292336367">ਟੈਬ ਨੂੰ ਮੂਲ ਜਗ੍ਹਾ 'ਤੇ ਵਾਪਸ ਲਿਆਓ</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_pl.xtb b/ash/shortcut_viewer/strings/ash_components_strings_pl.xtb index 0c4ab2f..da6f35fb 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_pl.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_pl.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Powiększ obraz na ekranie</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Zaznacz tekst do końca wiersza</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> lub <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Kliknij ikony 1–8 na półce</translation> <translation id="6435207348963613811">Zaznacz poprzedni element na półce</translation> <translation id="6445033640292336367">Przywróć kartę do pierwotnego położenia</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_pt-BR.xtb b/ash/shortcut_viewer/strings/ash_components_strings_pt-BR.xtb index bd974e71..c338303 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_pt-BR.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_pt-BR.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Aumentar zoom da tela</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Selecionar o texto até o fim da linha</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> ou <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Clicar nos ícones de 1 a 8 na estante</translation> <translation id="6435207348963613811">Destacar o item anterior na estante</translation> <translation id="6445033640292336367">Voltar a guia para a posição original</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_pt-PT.xtb b/ash/shortcut_viewer/strings/ash_components_strings_pt-PT.xtb index 4d7bd64e..136884f 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_pt-PT.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_pt-PT.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Aumentar zoom do ecrã</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Selecionar texto até ao fim da linha</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> ou <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" />.</translation> <translation id="6425378783626925378">Clicar nos ícones de 1 a 8 na prateleira</translation> <translation id="6435207348963613811">Realçar o item anterior na prateleira</translation> <translation id="6445033640292336367">Repor o separador na sua posição original</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_ro.xtb b/ash/shortcut_viewer/strings/ash_components_strings_ro.xtb index 8a1b511..a9ad579 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_ro.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_ro.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Mărire</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Selectează textul până la capătul rândului</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> sau <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Dă clic pe pictogramele 1 – 8 de pe raft</translation> <translation id="6435207348963613811">Evidențiază elementul anterior de pe raft</translation> <translation id="6445033640292336367">Readu fila în poziția inițială</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_ru.xtb b/ash/shortcut_viewer/strings/ash_components_strings_ru.xtb index a1356c8..941e016 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_ru.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_ru.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Увеличить масштаб экрана</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Выделить текст до конца строки</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> или <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Нажать значок на панели запуска (1-8)</translation> <translation id="6435207348963613811">Выделить предыдущий объект на панели запуска</translation> <translation id="6445033640292336367">Вернуть вкладку в исходное положение</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_si.xtb b/ash/shortcut_viewer/strings/ash_components_strings_si.xtb index ff0c73d..ab87d11 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_si.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_si.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">සංදර්ශකයේ විශාලනය</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">පේළියේ අවසානයට පෙළ තෝරන්න</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> හෝ <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">ඔබේ රාක්කයෙහි නිරූපක 1-8 ක්ලික් කරන්න</translation> <translation id="6435207348963613811">ඔබේ රාක්කයෙහි පෙර අයිතමය උද්දීපනය කරන්න</translation> <translation id="6445033640292336367">මුල් පිහිටුමට පටිත්ත ආපසු එවන්න</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_sk.xtb b/ash/shortcut_viewer/strings/ash_components_strings_sk.xtb index 0233af0..bdbc64c 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_sk.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_sk.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Priblíženie zobrazenia</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Výber textu do konca riadka</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> alebo <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Kliknutie na ikony 1 až 8 na poličke</translation> <translation id="6435207348963613811">Zvýraznenie predchádzajúcej položky na poličke</translation> <translation id="6445033640292336367">Vrátenie karty do pôvodnej pozície</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_sl.xtb b/ash/shortcut_viewer/strings/ash_components_strings_sl.xtb index 1568f5c..1548c8dd 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_sl.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_sl.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Povečava prikaza</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /> <ph name="SEPARATOR" /> <ph name="KEY" /></translation> <translation id="6395172954772765143">Izbira besedila do konca vrstice</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /> <ph name="SEPARATOR1" /> <ph name="LEFT" /> ali <ph name="CTRL2" /> <ph name="SEPARATOR2" /> <ph name="RIGHT" /></translation> <translation id="6425378783626925378">Klik ikone od 1 do 8 na polici</translation> <translation id="6435207348963613811">Označevanje prejšnjega elementa na polici</translation> <translation id="6445033640292336367">Premik zavihka na prvotno mesto</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_sq.xtb b/ash/shortcut_viewer/strings/ash_components_strings_sq.xtb index 0251def0..752fe5bb 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_sq.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_sq.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Zmadhimi i ekranit</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Zgjidh tekstin në fund të rreshtit</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> ose <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Kliko ikonat 1-8 në raft</translation> <translation id="6435207348963613811">Thekso artikullin e mëparshëm në raft</translation> <translation id="6445033640292336367">Ktheje skedën në pozicionin fillestar</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_sr-Latn.xtb b/ash/shortcut_viewer/strings/ash_components_strings_sr-Latn.xtb index 5512b7ed..ba8eefe 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_sr-Latn.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_sr-Latn.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Uvećajte prikaz</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Izaberite tekst do kraja reda</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> ili <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Kliknite na ikone od 1. do 8. na polici</translation> <translation id="6435207348963613811">Istaknite prethodnu stavku na polici</translation> <translation id="6445033640292336367">Vratite karticu na prvobitni položaj</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_sr.xtb b/ash/shortcut_viewer/strings/ash_components_strings_sr.xtb index 55f57e20..72c2645f 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_sr.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_sr.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Увећајте приказ</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Изаберите текст до краја реда</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> или <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Кликните на иконе од 1. до 8. на полици</translation> <translation id="6435207348963613811">Истакните претходну ставку на полици</translation> <translation id="6445033640292336367">Вратите картицу на првобитни положај</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_sv.xtb b/ash/shortcut_viewer/strings/ash_components_strings_sv.xtb index 789ed8c..ba2f17bb 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_sv.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_sv.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Zooma in</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Markera text till radens slut</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> eller <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Klicka på ikonerna 1–8 på hyllan</translation> <translation id="6435207348963613811">Markera föregående objekt på hyllan</translation> <translation id="6445033640292336367">Återställ flikens ursprungliga position</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_sw.xtb b/ash/shortcut_viewer/strings/ash_components_strings_sw.xtb index cd980ed..7fedd96e 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_sw.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_sw.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Vuta onyesho karibu</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Chagua maandishi katika sehemu ya mwisho wa mstari</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> au <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Bofya aikoni za 1-8 kwenye rafu yako</translation> <translation id="6435207348963613811">Angazia kipengee cha awali kwenye rafu yako</translation> <translation id="6445033640292336367">Rudisha kichupo kwenye nafasi yake halisi</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_ta.xtb b/ash/shortcut_viewer/strings/ash_components_strings_ta.xtb index 33c1def..5968e535 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_ta.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_ta.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">காட்சியைப் பெரிதாக்கும்</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">வரியின் இறுதியில் உள்ள உரையைத் தேர்ந்தெடுக்கும்</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> அல்லது <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">உங்கள் ஷெல்ஃபில் 1 முதல் 8 வரையுள்ள ஐகான்களைக் கிளிக் செய்யும்</translation> <translation id="6435207348963613811">உங்கள் ஷெல்ஃபில் முந்தைய உருப்படியைத் தனிப்படுத்தும்</translation> <translation id="6445033640292336367">தாவலை அதன் பழைய நிலையில் வைக்கும்</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_te.xtb b/ash/shortcut_viewer/strings/ash_components_strings_te.xtb index de5a03d..a26edc9 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_te.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_te.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">డిస్ప్లేని దగ్గరగా జూమ్ చేస్తుంది</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">పంక్తి ముగింపు వరకు వచనాన్ని ఎంచుకోండి</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> లేదా <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">మీ అరలో 1-8 చిహ్నాలను క్లిక్ చేయండి</translation> <translation id="6435207348963613811">మీ అరలోని మునుపటి అంశాన్ని హైలైట్ చేయండి</translation> <translation id="6445033640292336367">ట్యాబ్ను తిరిగి దాని వాస్తవ స్థానానికి తీసుకువెళ్లండి</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_th.xtb b/ash/shortcut_viewer/strings/ash_components_strings_th.xtb index de00e5b1..ae18d12 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_th.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_th.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">ซูมหน้าจอเข้า</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">เลือกข้อความไปจนสุดบรรทัด</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> หรือ <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">คลิกไอคอน 1-8 บนชั้นวาง</translation> <translation id="6435207348963613811">ไฮไลต์รายการก่อนหน้านี้บนชั้นวาง</translation> <translation id="6445033640292336367">นำแท็บกลับไปยังตำแหน่งเดิม</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_tr.xtb b/ash/shortcut_viewer/strings/ash_components_strings_tr.xtb index d11c140..9da5506 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_tr.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_tr.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Görüntüyü Yakınlaştır</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Metni satırın sonuna kadar seçer</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> veya <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Rafınızdaki 1-8. simgeyi tıklar</translation> <translation id="6435207348963613811">Rafınızdaki önceki öğeyi vurgular</translation> <translation id="6445033640292336367">Sekmeyi orijinal konumuna döndürür</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_uk.xtb b/ash/shortcut_viewer/strings/ash_components_strings_uk.xtb index 13774cf8..50aa2d6d 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_uk.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_uk.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Наближає екран</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Виділити текст до кінця рядка</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> або <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Натиснути значки 1–8 на полиці</translation> <translation id="6435207348963613811">Виділити попередній елемент на полиці</translation> <translation id="6445033640292336367">Повернути вкладку на початкове місце</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_ur.xtb b/ash/shortcut_viewer/strings/ash_components_strings_ur.xtb index af4862d..27b72af 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_ur.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_ur.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">زوم ان کو ڈسپلے کریں</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">لائن کے آخر تک کا متن منتخب کریں</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> یا <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">اپنی شیلف پر 1 سے 8 تک کے آئیکنز پر کلک کریں</translation> <translation id="6435207348963613811">اپنی شیلف پر پچھلا آئٹم نمایاں کریں</translation> <translation id="6445033640292336367">ٹیب کو اس کی اصل پوزیشن میں لوٹائیں</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_uz.xtb b/ash/shortcut_viewer/strings/ash_components_strings_uz.xtb index 8c87094..e9fd5350 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_uz.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_uz.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Ekran masshtabini kattalashtirish</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Matnni qator oxirigacha belgilash</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> yoki <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Javondagi ikonkalarni bosish (1 va 8 orasida)</translation> <translation id="6435207348963613811">Javondagi avvalgi elementni belgilash</translation> <translation id="6445033640292336367">Varaqni ilk joylashuvga qaytarish</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_vi.xtb b/ash/shortcut_viewer/strings/ash_components_strings_vi.xtb index 83845260..79cd5f2 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_vi.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_vi.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Phóng to màn hình</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Chọn văn bản ở cuối dòng</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> hoặc <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Nhấp vào các biểu tượng từ 1 đến 8 trên giá</translation> <translation id="6435207348963613811">Đánh dấu mục đứng trước trên giá</translation> <translation id="6445033640292336367">Đưa tab về vị trí ban đầu</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_zh-CN.xtb b/ash/shortcut_viewer/strings/ash_components_strings_zh-CN.xtb index 6d8f9e81..b29f30f 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_zh-CN.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_zh-CN.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">放大显示内容</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">选择直到行尾的文字</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> 或 <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">点击任务栏中的第 1-8 个图标</translation> <translation id="6435207348963613811">突出显示任务栏中的上一项</translation> <translation id="6445033640292336367">将标签页移回其原始位置</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_zh-HK.xtb b/ash/shortcut_viewer/strings/ash_components_strings_zh-HK.xtb index 3f2ec0c..5d9a918 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_zh-HK.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_zh-HK.xtb
@@ -142,7 +142,6 @@ <translation id="6340769215862220182">放大顯示</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /> 鍵</translation> <translation id="6395172954772765143">選取文字至本行結尾</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> 鍵或 <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /> 鍵</translation> <translation id="6425378783626925378">按一下檔案櫃中的第 1-8 個圖示</translation> <translation id="6435207348963613811">突顯檔案櫃中的上一個項目</translation> <translation id="6445033640292336367">讓分頁回到原位</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_zh-TW.xtb b/ash/shortcut_viewer/strings/ash_components_strings_zh-TW.xtb index 064b3df..d8d8ebd 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_zh-TW.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_zh-TW.xtb
@@ -142,7 +142,6 @@ <translation id="6340769215862220182">放大畫面</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /> 鍵</translation> <translation id="6395172954772765143">選取文字至本行結尾</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> 鍵或 <ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /> 鍵</translation> <translation id="6425378783626925378">點選檔案櫃中的第 1-8 個圖示</translation> <translation id="6435207348963613811">醒目顯示檔案櫃中的上一個項目</translation> <translation id="6445033640292336367">讓分頁回到原始位置</translation>
diff --git a/ash/shortcut_viewer/strings/ash_components_strings_zu.xtb b/ash/shortcut_viewer/strings/ash_components_strings_zu.xtb index 1ff55ec30..2a4208d6 100644 --- a/ash/shortcut_viewer/strings/ash_components_strings_zu.xtb +++ b/ash/shortcut_viewer/strings/ash_components_strings_zu.xtb
@@ -141,7 +141,6 @@ <translation id="6340769215862220182">Ukusondeza isithombe kwesiboniso</translation> <translation id="6359811074279051077"><ph name="MODIFIER" /><ph name="SEPARATOR" /><ph name="KEY" /></translation> <translation id="6395172954772765143">Khetha umbhalo ukuya ekupheleni komugqa</translation> -<translation id="6419237577786823024"><ph name="CTRL1" /><ph name="SEPARATOR1" /><ph name="LEFT" /> noma i-<ph name="CTRL2" /><ph name="SEPARATOR2" /><ph name="RIGHT" /></translation> <translation id="6425378783626925378">Chofoza izithonjana ezingu-1-8 kushelufu lakho</translation> <translation id="6435207348963613811">Gqamisa into yangaphambilini kushelufu lakho</translation> <translation id="6445033640292336367">Buyisela ithebhu kusimo sayo sangempela</translation>
diff --git a/base/power_monitor/power_monitor.cc b/base/power_monitor/power_monitor.cc index 491c621..f76c409 100644 --- a/base/power_monitor/power_monitor.cc +++ b/base/power_monitor/power_monitor.cc
@@ -80,10 +80,8 @@ void PowerMonitor::NotifyThermalStateChange( PowerObserver::DeviceThermalState new_state) { DCHECK(IsInitialized()); -#if DCHECK_IS_ON() DVLOG(1) << "ThermalStateChange: " << PowerMonitorSource::DeviceThermalStateToString(new_state); -#endif GetInstance()->observers_->Notify( FROM_HERE, &PowerObserver::OnThermalStateChange, new_state); }
diff --git a/base/power_monitor/power_monitor_source.cc b/base/power_monitor/power_monitor_source.cc index 07cd073..b25506f 100644 --- a/base/power_monitor/power_monitor_source.cc +++ b/base/power_monitor/power_monitor_source.cc
@@ -75,9 +75,8 @@ on_battery_power_ = on_battery_power; } -#if DCHECK_IS_ON() // static -std::string PowerMonitorSource::DeviceThermalStateToString( +const char* PowerMonitorSource::DeviceThermalStateToString( PowerObserver::DeviceThermalState state) { switch (state) { case PowerObserver::DeviceThermalState::kUnknown: @@ -94,6 +93,5 @@ NOTREACHED(); return "Unknown"; } -#endif } // namespace base
diff --git a/base/power_monitor/power_monitor_source.h b/base/power_monitor/power_monitor_source.h index ad3290f..dc57c67 100644 --- a/base/power_monitor/power_monitor_source.h +++ b/base/power_monitor/power_monitor_source.h
@@ -31,10 +31,8 @@ // Is the computer currently on battery power. Can be called on any thread. bool IsOnBatteryPower(); -#if DCHECK_IS_ON() - static std::string DeviceThermalStateToString( + static const char* DeviceThermalStateToString( PowerObserver::DeviceThermalState state); -#endif protected: friend class PowerMonitorTest;
diff --git a/base/power_monitor/thermal_state_observer_mac.h b/base/power_monitor/thermal_state_observer_mac.h index 2b37038..a7b1c18 100644 --- a/base/power_monitor/thermal_state_observer_mac.h +++ b/base/power_monitor/thermal_state_observer_mac.h
@@ -27,7 +27,8 @@ private: FRIEND_TEST_ALL_PREFIXES(ThermalStateObserverMacTest, StateChange); - PowerObserver::DeviceThermalState state_for_testing_; + PowerObserver::DeviceThermalState state_for_testing_ = + PowerObserver::DeviceThermalState::kUnknown; id thermal_state_update_observer_; };
diff --git a/base/power_monitor/thermal_state_observer_mac.mm b/base/power_monitor/thermal_state_observer_mac.mm index d4632a3..63fd4f8 100644 --- a/base/power_monitor/thermal_state_observer_mac.mm +++ b/base/power_monitor/thermal_state_observer_mac.mm
@@ -43,10 +43,8 @@ state = NSProcessInfoThermalStateToDeviceThermalState(nsinfo_state); if (state_for_testing_ != PowerObserver::DeviceThermalState::kUnknown) state = state_for_testing_; -#if DCHECK_IS_ON() DVLOG(1) << __func__ << ": " << PowerMonitorSource::DeviceThermalStateToString(state); -#endif state_update_callback.Run(state); };
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index d7513d4..2854eb4f 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -0.20200605.3.1 +0.20200608.1.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index d3910068..2854eb4f 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -0.20200605.2.2 +0.20200608.1.1
diff --git a/cc/metrics/frame_sequence_tracker_collection.cc b/cc/metrics/frame_sequence_tracker_collection.cc index a9bee14..7bc06fa 100644 --- a/cc/metrics/frame_sequence_tracker_collection.cc +++ b/cc/metrics/frame_sequence_tracker_collection.cc
@@ -193,43 +193,9 @@ tracker.second->ReportFramePresented(frame_token, feedback); for (auto& tracker : custom_frame_trackers_) tracker.second->ReportFramePresented(frame_token, feedback); - for (auto& tracker : removal_trackers_) tracker->ReportFramePresented(frame_token, feedback); - for (auto& tracker : removal_trackers_) { - if (tracker->termination_status() == - FrameSequenceTracker::TerminationStatus::kReadyForTermination) { - // The tracker is ready to be terminated. - // For non kCustom typed trackers, take the metrics from the tracker. - // merge with any outstanding metrics from previous trackers of the same - // type. If there are enough frames to report the metrics, then report the - // metrics and destroy it. Otherwise, retain it to be merged with - // follow-up sequences. - // For kCustom typed trackers, |metrics| invokes AddCustomTrackerResult - // on its destruction, which add its data to |custom_tracker_results_| - // to be picked up by caller. - auto metrics = tracker->TakeMetrics(); - if (metrics->type() == FrameSequenceTrackerType::kCustom) - continue; - - auto key = std::make_pair(metrics->type(), metrics->GetEffectiveThread()); - if (accumulated_metrics_.contains(key)) { - metrics->Merge(std::move(accumulated_metrics_[key])); - accumulated_metrics_.erase(key); - } - - if (metrics->HasEnoughDataForReporting()) { - // Do this before ReportMetrics() which clears the throughput data. - if (metrics->type() == FrameSequenceTrackerType::kUniversal) - throughput_ukm_reporter_->ComputeUniversalThroughput(metrics.get()); - metrics->ReportMetrics(); - } - if (metrics->HasDataLeftForReporting()) - accumulated_metrics_[key] = std::move(metrics); - } - } - DestroyTrackers(); } @@ -267,6 +233,39 @@ } void FrameSequenceTrackerCollection::DestroyTrackers() { + for (auto& tracker : removal_trackers_) { + if (tracker->termination_status() == + FrameSequenceTracker::TerminationStatus::kReadyForTermination) { + // The tracker is ready to be terminated. + // For non kCustom typed trackers, take the metrics from the tracker. + // merge with any outstanding metrics from previous trackers of the same + // type. If there are enough frames to report the metrics, then report the + // metrics and destroy it. Otherwise, retain it to be merged with + // follow-up sequences. + // For kCustom typed trackers, |metrics| invokes AddCustomTrackerResult + // on its destruction, which add its data to |custom_tracker_results_| + // to be picked up by caller. + auto metrics = tracker->TakeMetrics(); + if (metrics->type() == FrameSequenceTrackerType::kCustom) + continue; + + auto key = std::make_pair(metrics->type(), metrics->GetEffectiveThread()); + if (accumulated_metrics_.contains(key)) { + metrics->Merge(std::move(accumulated_metrics_[key])); + accumulated_metrics_.erase(key); + } + + if (metrics->HasEnoughDataForReporting()) { + // Do this before ReportMetrics() which clears the throughput data. + if (metrics->type() == FrameSequenceTrackerType::kUniversal) + throughput_ukm_reporter_->ComputeUniversalThroughput(metrics.get()); + metrics->ReportMetrics(); + } + if (metrics->HasDataLeftForReporting()) + accumulated_metrics_[key] = std::move(metrics); + } + } + base::EraseIf( removal_trackers_, [](const std::unique_ptr<FrameSequenceTracker>& tracker) {
diff --git a/cc/metrics/frame_sequence_tracker_unittest.cc b/cc/metrics/frame_sequence_tracker_unittest.cc index 33d707d9..6394e2b 100644 --- a/cc/metrics/frame_sequence_tracker_unittest.cc +++ b/cc/metrics/frame_sequence_tracker_unittest.cc
@@ -1959,4 +1959,61 @@ EXPECT_EQ(1u, results[3].frames_expected); } +TEST_F(FrameSequenceTrackerTest, MergeTrackers) { + // Generate two sequences of scrolls: first with only 1 frame, and then with + // 99 frames. Verify that the two scrolls are merged to report a single + // metric. + base::HistogramTester histogram_tester; + const char first_sequence[] = "b(1)s(1)e(1,0)P(1)"; + GenerateSequence(first_sequence); + EXPECT_EQ(ImplThroughput().frames_expected, 1u); + EXPECT_EQ(ImplThroughput().frames_produced, 1u); + collection_.StopSequence(FrameSequenceTrackerType::kTouchScroll); + + const char metric[] = + "Graphics.Smoothness.PercentDroppedFrames.CompositorThread.TouchScroll"; + histogram_tester.ExpectTotalCount(metric, 0u); + EXPECT_FALSE(TrackerExists(FrameSequenceTrackerType::kTouchScroll)); + + CreateNewTracker(); + const char second_sequence[] = "b(2)s(2)e(2,0)P(2)b(100)s(3)e(100,0)P(3)"; + GenerateSequence(second_sequence); + EXPECT_EQ(ImplThroughput().frames_expected, 99u); + EXPECT_EQ(ImplThroughput().frames_produced, 2u); + collection_.StopSequence(FrameSequenceTrackerType::kTouchScroll); + EXPECT_FALSE(TrackerExists(FrameSequenceTrackerType::kTouchScroll)); + histogram_tester.ExpectTotalCount(metric, 1u); + EXPECT_THAT(histogram_tester.GetAllSamples(metric), + testing::ElementsAre(base::Bucket(97, 1))); +} + +TEST_F(FrameSequenceTrackerTest, MergeTrackersPresentAfterStopSequence) { + // Generate two sequences of scrolls: first with only 1 frame, and then with + // 99 frames. Verify that the two scrolls are merged to report a single + // metric. For the second sequence, the last frame is presented after the + // sequence ends. + base::HistogramTester histogram_tester; + const char first_sequence[] = "b(1)s(1)e(1,0)P(1)"; + GenerateSequence(first_sequence); + EXPECT_EQ(ImplThroughput().frames_expected, 1u); + EXPECT_EQ(ImplThroughput().frames_produced, 1u); + collection_.StopSequence(FrameSequenceTrackerType::kTouchScroll); + + const char metric[] = + "Graphics.Smoothness.PercentDroppedFrames.CompositorThread.TouchScroll"; + histogram_tester.ExpectTotalCount(metric, 0u); + EXPECT_FALSE(TrackerExists(FrameSequenceTrackerType::kTouchScroll)); + + CreateNewTracker(); + const char second_sequence[] = "b(2)s(2)e(2,0)P(2)b(100)s(3)e(100,0)"; + GenerateSequence(second_sequence); + EXPECT_EQ(ImplThroughput().frames_expected, 99u); + EXPECT_EQ(ImplThroughput().frames_produced, 1u); + collection_.StopSequence(FrameSequenceTrackerType::kTouchScroll); + GenerateSequence("P(3)"); + histogram_tester.ExpectTotalCount(metric, 1u); + EXPECT_THAT(histogram_tester.GetAllSamples(metric), + testing::ElementsAre(base::Bucket(97, 1))); +} + } // namespace cc
diff --git a/cc/trees/proxy_impl.cc b/cc/trees/proxy_impl.cc index e573d42..63dd6db3 100644 --- a/cc/trees/proxy_impl.cc +++ b/cc/trees/proxy_impl.cc
@@ -723,9 +723,6 @@ base::AutoReset<bool> mark_inside(&inside_draw_, true); - if (host_impl_->pending_tree()) - host_impl_->pending_tree()->UpdateDrawProperties(); - // This method is called on a forced draw, regardless of whether we are able // to produce a frame, as the calling site on main thread is blocked until its // request completes, and we signal completion here. If CanDraw() is false, we @@ -776,6 +773,12 @@ proxy_main_weak_ptr_)); } + // The tile visibility/priority of the pending tree needs to be updated so + // that it doesn't get activated before the raster is complete. But this needs + // to happen after the draw, off of the critical path to draw. + if (host_impl_->pending_tree()) + host_impl_->pending_tree()->UpdateDrawProperties(); + DCHECK_NE(INVALID_RESULT, result); return result; }
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni index e9c4c91f..f20c887f 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni
@@ -739,7 +739,6 @@ "java/src/org/chromium/chrome/browser/fullscreen/ChromeFullscreenManager.java", "java/src/org/chromium/chrome/browser/fullscreen/FullscreenHtmlApiHandler.java", "java/src/org/chromium/chrome/browser/fullscreen/FullscreenOptions.java", - "java/src/org/chromium/chrome/browser/fullscreen/TabGestureStateListener.java", "java/src/org/chromium/chrome/browser/gcore/ChromeGoogleApiClient.java", "java/src/org/chromium/chrome/browser/gcore/ChromeGoogleApiClientImpl.java", "java/src/org/chromium/chrome/browser/gcore/ConnectedTask.java", @@ -1530,6 +1529,7 @@ "java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java", "java/src/org/chromium/chrome/browser/tab/TabContextMenuPopulator.java", "java/src/org/chromium/chrome/browser/tab/TabFavicon.java", + "java/src/org/chromium/chrome/browser/tab/TabGestureStateListener.java", "java/src/org/chromium/chrome/browser/tab/TabHelpers.java", "java/src/org/chromium/chrome/browser/tab/TabIdManager.java", "java/src/org/chromium/chrome/browser/tab/TabImpl.java",
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/running_in_chrome.md b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/running_in_chrome.md index 9a4d674..1fa45eb 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/running_in_chrome.md +++ b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/running_in_chrome.md
@@ -9,56 +9,56 @@ (The behaviour described here is carried out independently for each TWA the user installs and runs.) -## Status +## Chrome before version 84 -This is a work is progress and this file will be updated as implementation is -carried out. -At present, the old behavior is on by default and the new behavior can be -enabled with the `"TrustedWebActivityNewDisclosure"` feature. - -Of the new behavior, only the *If notifications are not enabled* part has -been implemented. -The corresponding bug is [here](https://crbug.com/1068106). - -## Chrome before XX - -From Chrome 72 (when TWAs were launched) to Chrome XX, we informed the users by +From Chrome 72 (when TWAs were launched) to Chrome 84, we informed the users by showing them a "Running in Chrome" Infobar. This Infobar would be shown to the users the first time they launched the TWA and would persist until they dismissed it. -## Chrome since XX +## Chrome since version 84 Developers found the previous behavior intrusive and annoying, reducing the amount of the screen that shows the webpage. The new behavior now depends on whether the user has notifications for Chrome enabled. -### If Chrome's notifications are enabled +### If notifications are enabled The first time a user opens a TWA in Chrome, they will get a silent, high -priority notification informing them that their data is shared with Chrome. +priority notification informing them that their data is being shared. If the user taps on the notification or dismisses it, they won't trigger this behavior again. If the user does not interact with the notification, the next time they open a TWA, they will get a similar notification, except it will now be low priority. -### If Chrome's notifications are not enabled +### If notifications are not enabled The first time a user opens a TWA in Chrome, they will see a Snackbar informing them that their data is shared with Chrome. If the user interacts with the Snackbar, it is gone for good, if they do not, it returns the next time the TWA is launched. -A Snackbar is different from an Infobar (what we showed previously) in that a +A Snackbar is different from an Infobar (what was shown before Chrome 84) in that a Snackbar will dismiss itself after some time (in this case, 7 seconds) whereas an Infobar will not. ## Code -The old behavior is managed by the `TrustedWebActivityDisclosureController`, -which communicates through the `TrustedWebActivityModel` to the -`TrustedWebActivityDisclosureView`. +The `TrustedWebActivityDisclosureController` determines whether a disclosure should be shown (eg, +checking if a disclosure has already been accepted). +This state is pushed into the `TrustedWebActivityModel`. -When the new behavior is enabled, the `TrustedWebActivityDisclosureView` is -replaced by the `NewSnackbarDisclosure`. +One of three View classes will then read from the `TrustedWebActivityModel`, depending on which UI +is appropriate: + +* The `DisclosureNotification` if notifications are enabled. +* The `DisclosureSnackbar` if notifications are not enabled. +* The `DisclosureInfobar` containing the old behavior which is only kept around as a fall back in + case the new behavior breaks something. + +The `DisclosureUiPicker` is responsible for choosing which View to instantiate. + +## Links + +* [Bug for the Running in Chrome v2 implementation.](https://crbug.com/1068106) \ No newline at end of file
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java index d72b9a0c..2f9ae11 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java
@@ -1091,9 +1091,9 @@ TabCreatorManager tabCreatorManager, TabContentManager tabContentManager, ViewGroup androidContentContainer, ContextualSearchManagementDelegate contextualSearchManager) { - assert mLayoutManager != null; + assert mLayoutManager != null && mControlContainer != null; mLayoutManager.init(tabModelSelector, tabCreatorManager, tabContentManager, - androidContentContainer, contextualSearchManager, + androidContentContainer, mControlContainer, contextualSearchManager, mCompositorView.getResourceManager().getDynamicResourceLoader()); mTabModelSelector = tabModelSelector;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManager.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManager.java index 21eb50eb..35c5027c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManager.java
@@ -51,6 +51,7 @@ import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver; import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver; import org.chromium.chrome.browser.tabmodel.TabModelUtils; +import org.chromium.chrome.browser.toolbar.ControlContainer; import org.chromium.chrome.browser.toolbar.ToolbarColors; import org.chromium.components.embedder_support.util.UrlConstants; import org.chromium.ui.base.LocalizationUtils; @@ -362,15 +363,18 @@ * @param creator A {@link TabCreatorManager} instance. * @param content A {@link TabContentManager} instance. * @param androidContentContainer A {@link ViewGroup} for Android views to be bound to. + * @param controlContainer A {@link ControlContainer} for browser controls' layout. * @param contextualSearchDelegate A {@link ContextualSearchManagementDelegate} instance. * @param dynamicResourceLoader A {@link DynamicResourceLoader} instance. */ public void init(TabModelSelector selector, TabCreatorManager creator, TabContentManager content, ViewGroup androidContentContainer, + ControlContainer controlContainer, ContextualSearchManagementDelegate contextualSearchDelegate, DynamicResourceLoader dynamicResourceLoader) { LayoutRenderHost renderHost = mHost.getLayoutRenderHost(); - mToolbarOverlay = new ToolbarSceneLayer(mContext, this, renderHost); + mToolbarOverlay = new ToolbarSceneLayer( + mContext, this, renderHost, controlContainer, selector::getCurrentTab); // Initialize Layouts mStaticLayout.onFinishNativeInitialization();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChrome.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChrome.java index da91e6f..d6cd237 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChrome.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChrome.java
@@ -34,6 +34,7 @@ import org.chromium.chrome.browser.tasks.tab_management.TabManagementDelegate; import org.chromium.chrome.browser.tasks.tab_management.TabManagementModuleProvider; import org.chromium.chrome.browser.tasks.tab_management.TabUiFeatureUtilities; +import org.chromium.chrome.browser.toolbar.ControlContainer; import org.chromium.chrome.browser.util.ChromeAccessibilityUtil; import org.chromium.chrome.features.start_surface.StartSurface; import org.chromium.chrome.features.start_surface.StartSurfaceConfiguration; @@ -138,6 +139,7 @@ @Override public void init(TabModelSelector selector, TabCreatorManager creator, TabContentManager content, ViewGroup androidContentContainer, + ControlContainer controlContainer, ContextualSearchManagementDelegate contextualSearchDelegate, DynamicResourceLoader dynamicResourceLoader) { Context context = mHost.getContext(); @@ -151,8 +153,8 @@ mOverviewLayout = new StackLayout(context, this, renderHost); } - super.init(selector, creator, content, androidContentContainer, contextualSearchDelegate, - dynamicResourceLoader); + super.init(selector, creator, content, androidContentContainer, controlContainer, + contextualSearchDelegate, dynamicResourceLoader); // TODO: TitleCache should be a part of the ResourceManager. mTitleCache = mHost.getTitleCache();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromePhone.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromePhone.java index f4b34b8..b1f6dcef 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromePhone.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromePhone.java
@@ -17,6 +17,7 @@ import org.chromium.chrome.browser.tabmodel.TabCreatorManager; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelUtils; +import org.chromium.chrome.browser.toolbar.ControlContainer; import org.chromium.chrome.features.start_surface.StartSurface; import org.chromium.ui.resources.dynamics.DynamicResourceLoader; @@ -42,6 +43,7 @@ @Override public void init(TabModelSelector selector, TabCreatorManager creator, TabContentManager content, ViewGroup androidContentContainer, + ControlContainer controlContainer, ContextualSearchManagementDelegate contextualSearchDelegate, DynamicResourceLoader dynamicResourceLoader) { Context context = mHost.getContext(); @@ -53,8 +55,8 @@ // Set up layout parameters mStaticLayout.setLayoutHandlesTabLifecycles(false); - super.init(selector, creator, content, androidContentContainer, contextualSearchDelegate, - dynamicResourceLoader); + super.init(selector, creator, content, androidContentContainer, controlContainer, + contextualSearchDelegate, dynamicResourceLoader); mToolbarSwipeLayout.setMovesToolbar(true);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromeTablet.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromeTablet.java index cfb8d14..ace5df03 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromeTablet.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromeTablet.java
@@ -19,6 +19,7 @@ import org.chromium.chrome.browser.tabmodel.TabModel; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver; +import org.chromium.chrome.browser.toolbar.ControlContainer; import org.chromium.ui.resources.dynamics.DynamicResourceLoader; import java.util.List; @@ -113,14 +114,15 @@ @Override public void init(TabModelSelector selector, TabCreatorManager creator, TabContentManager content, ViewGroup androidContentContainer, + ControlContainer controlContainer, ContextualSearchManagementDelegate contextualSearchDelegate, DynamicResourceLoader dynamicResourceLoader) { if (mTabStripLayoutHelperManager != null) { mTabStripLayoutHelperManager.setTabModelSelector(selector, creator); } - super.init(selector, creator, content, androidContentContainer, contextualSearchDelegate, - dynamicResourceLoader); + super.init(selector, creator, content, androidContentContainer, controlContainer, + contextualSearchDelegate, dynamicResourceLoader); mTabObserver = new TabModelSelectorTabObserver(selector) { @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/ToolbarSceneLayer.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/ToolbarSceneLayer.java index e6ec2d42..ae7264e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/ToolbarSceneLayer.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/ToolbarSceneLayer.java
@@ -9,6 +9,7 @@ import org.chromium.base.annotations.JNINamespace; import org.chromium.base.annotations.NativeMethods; +import org.chromium.base.supplier.Supplier; import org.chromium.chrome.R; import org.chromium.chrome.browser.compositor.LayerTitleCache; import org.chromium.chrome.browser.compositor.layouts.Layout.ViewportMode; @@ -19,6 +20,7 @@ import org.chromium.chrome.browser.compositor.overlays.SceneOverlay; import org.chromium.chrome.browser.device.DeviceClassManager; import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager; +import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.toolbar.ControlContainer; import org.chromium.chrome.browser.toolbar.ToolbarColors; import org.chromium.components.browser_ui.widget.ClipDrawableProgressBar.DrawingInfo; @@ -47,16 +49,26 @@ /** A LayoutRenderHost for accessing drawing information about the toolbar. */ private LayoutRenderHost mRenderHost; + /** A Layout for browser controls. */ + private final ControlContainer mToolbarContainer; + + /** Provides current tab. */ + private final Supplier<Tab> mCurrentTab; + /** * @param context An Android context to use. * @param provider A LayoutProvider for accessing the current layout. * @param renderHost A LayoutRenderHost for accessing drawing information about the toolbar. + * @param toolbarContainer A Layout for browser controls. + * @param currentTab A supplier for the current tab. */ - public ToolbarSceneLayer(Context context, LayoutProvider provider, - LayoutRenderHost renderHost) { + public ToolbarSceneLayer(Context context, LayoutProvider provider, LayoutRenderHost renderHost, + ControlContainer toolbarContainer, Supplier<Tab> currentTab) { mContext = context; mLayoutProvider = provider; mRenderHost = renderHost; + mToolbarContainer = toolbarContainer; + mCurrentTab = currentTab; } /** @@ -78,10 +90,9 @@ if (!DeviceClassManager.enableFullscreen()) return; if (fullscreenManager == null) return; - ControlContainer toolbarContainer = fullscreenManager.getControlContainer(); - if (!isTablet && toolbarContainer != null) { + if (!isTablet && mToolbarContainer != null) { if (mProgressBarDrawingInfo == null) mProgressBarDrawingInfo = new DrawingInfo(); - toolbarContainer.getProgressBarDrawingInfo(mProgressBarDrawingInfo); + mToolbarContainer.getProgressBarDrawingInfo(mProgressBarDrawingInfo); } else { assert mProgressBarDrawingInfo == null; } @@ -92,9 +103,8 @@ boolean showShadow = fullscreenManager.drawControlsAsTexture() || forceHideAndroidBrowserControls; - int textBoxColor = - ToolbarColors.getTextBoxColorForToolbarBackground(mContext.getResources(), - fullscreenManager.getTab(), browserControlsBackgroundColor); + int textBoxColor = ToolbarColors.getTextBoxColorForToolbarBackground( + mContext.getResources(), mCurrentTab.get(), browserControlsBackgroundColor); int textBoxResourceId = R.drawable.modern_location_bar; // The content offset is passed to the toolbar layer so that it can position itself at the
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/ChromeFullscreenManager.java b/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/ChromeFullscreenManager.java index 04f57a3..298fe57 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/ChromeFullscreenManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/ChromeFullscreenManager.java
@@ -220,6 +220,12 @@ protected void onObservingDifferentTab(Tab tab) { setTab(tab); } + + @Override + public void onContentViewScrollingStateChanged(boolean scrolling) { + mContentViewScrolling = scrolling; + if (!scrolling) updateVisuals(); + } }; mTabFullscreenObserver = new TabModelSelectorTabObserver(modelSelector) { @@ -310,7 +316,8 @@ * @return The currently selected tab for fullscreen. */ @Nullable - public Tab getTab() { + @VisibleForTesting + Tab getTab() { return mTab; } @@ -318,14 +325,10 @@ Tab previousTab = getTab(); mTab = tab; if (previousTab != tab) { - if (previousTab != null) { - TabGestureStateListener.from(previousTab).setFullscreenManager(null); - } updateViewStateListener(); if (tab != null) { mBrowserVisibilityDelegate.showControlsTransient(); updateMultiTouchZoomSupport(!getPersistentFullscreenMode()); - TabGestureStateListener.from(tab).setFullscreenManager(this); if (tab.isUserInteractable()) restoreControlsPositions(); } } @@ -659,14 +662,6 @@ return mRendererBottomControlsMinHeightOffset; } - /** - * @return The toolbar control container, may be null. - */ - @Nullable - public ControlContainer getControlContainer() { - return mControlContainer; - } - private void updateControlOffset() { if (mControlsPosition == ControlsPosition.NONE) return; @@ -757,7 +752,7 @@ * Updates the current ContentView's children and any popups with the correct offsets based on * the current fullscreen state. */ - public void updateContentViewChildrenState() { + private void updateContentViewChildrenState() { ViewGroup view = getContentView(); if (view == null) return; @@ -835,7 +830,7 @@ * NB: this only affects the Android controls. For controlling composited toolbar visibility, * implement {@link BrowserControlsVisibilityDelegate#canShowBrowserControls()}. */ - public int hideAndroidControls() { + private int hideAndroidControls() { return mHidingTokenHolder.acquireToken(); } @@ -927,7 +922,7 @@ * Updates the positions of the browser controls and content to the default non fullscreen * values. */ - public void setPositionsForTabToNonFullscreen() { + private void setPositionsForTabToNonFullscreen() { Tab tab = getTab(); if (tab == null || TabBrowserControlsConstraintsHelper.getConstraints(tab) @@ -953,7 +948,7 @@ * @param topControlsMinHeightOffset The Y offset for the top controls min-height in px. * @param bottomControlsMinHeightOffset The Y offset for the bottom controls min-height in px. */ - public void setPositionsForTab(int topControlsOffset, int bottomControlsOffset, + private void setPositionsForTab(int topControlsOffset, int bottomControlsOffset, int topContentOffset, int topControlsMinHeightOffset, int bottomControlsMinHeightOffset) { // This min/max logic is here to handle changes in the browser controls height. For example, @@ -1004,14 +999,6 @@ } /** - * Called when scrolling state of the ContentView changed. - */ - public void onContentViewScrollingStateChanged(boolean scrolling) { - mContentViewScrolling = scrolling; - if (!scrolling) updateVisuals(); - } - - /** * Called when offset values related with fullscreen functionality has been changed by the * compositor. * @param topControlsOffsetY The Y offset of the top controls in physical pixels.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/HistoryNavigationCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/HistoryNavigationCoordinator.java index 546e3bd..0dc6f60 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/HistoryNavigationCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/HistoryNavigationCoordinator.java
@@ -30,6 +30,8 @@ */ public class HistoryNavigationCoordinator implements InsetObserverView.WindowInsetObserver, Destroyable, PauseResumeWithNativeObserver { + private final Runnable mUpdateNavigationStateRunnable = this::onNavigationStateChanged; + private CompositorViewHolder mCompositorViewHolder; private HistoryNavigationLayout mNavigationLayout; private InsetObserverView mInsetObserverView; @@ -224,7 +226,7 @@ public void onResumeWithNative() { // Check the enabled status again since the system gesture settings might have changed. // Post the task to work around wrong gesture insets returned from the framework. - mNavigationLayout.post(this::onNavigationStateChanged); + mNavigationLayout.post(mUpdateNavigationStateRunnable); } @Override @@ -245,6 +247,7 @@ mCompositorViewHolder = null; } if (mNavigationLayout != null) { + mNavigationLayout.removeCallbacks(mUpdateNavigationStateRunnable); mNavigationLayout.destroy(); mNavigationLayout = null; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/TabGestureStateListener.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabGestureStateListener.java similarity index 82% rename from chrome/android/java/src/org/chromium/chrome/browser/fullscreen/TabGestureStateListener.java rename to chrome/android/java/src/org/chromium/chrome/browser/tab/TabGestureStateListener.java index c9478d6..4ad747c6 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/TabGestureStateListener.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabGestureStateListener.java
@@ -2,10 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -package org.chromium.chrome.browser.fullscreen; +package org.chromium.chrome.browser.tab; -import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.browser.tab.TabWebContentsUserData; +import org.chromium.base.ObserverList.RewindableIterator; import org.chromium.content_public.browser.GestureListenerManager; import org.chromium.content_public.browser.GestureStateListener; import org.chromium.content_public.browser.WebContents; @@ -21,7 +20,6 @@ private final Tab mTab; private GestureStateListener mGestureListener; - private ChromeFullscreenManager mFullscreenManager; /** * Creates TabGestureStateListener and lets the WebContentsUserData of the Tab manage it. @@ -41,14 +39,6 @@ mTab = tab; } - /** - * Set {@link FullscreenManager} instance. This is non-null for active tab. - * @param manager FullscreenManager instance. - */ - void setFullscreenManager(ChromeFullscreenManager manager) { - mFullscreenManager = manager; - } - @Override public void initWebContents(WebContents webContents) { GestureListenerManager manager = GestureListenerManager.fromWebContents(webContents); @@ -74,9 +64,11 @@ } private void onScrollingStateChanged() { - if (mFullscreenManager == null) return; boolean scrolling = manager != null ? manager.isScrollInProgress() : false; - mFullscreenManager.onContentViewScrollingStateChanged(scrolling); + RewindableIterator<TabObserver> observers = ((TabImpl) mTab).getTabObservers(); + while (observers.hasNext()) { + observers.next().onContentViewScrollingStateChanged(scrolling); + } } }; manager.addListener(mGestureListener);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabHelpers.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabHelpers.java index a72b4d3..b4f6b972 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabHelpers.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabHelpers.java
@@ -57,5 +57,6 @@ TabFavicon.from(tab); TrustedCdn.from(tab); TabAssociatedApp.from(tab); + TabGestureStateListener.from(tab); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java index 39783e6..e81579f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java
@@ -1470,4 +1470,12 @@ public HomeButton getHomeButtonForTesting() { return mToolbar.getToolbarLayoutForTesting().getHomeButtonForTesting(); } + + /** + * @return View for toolbar container. + */ + @VisibleForTesting + public View getContainerViewForTesting() { + return mControlContainer.getView(); + } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java index fd4796e..ce33d47 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java
@@ -1587,9 +1587,9 @@ final long duration = 500; View toolbarRoot = mActivityTestRule.getActivity() - .getFullscreenManager() - .getControlContainer() - .getView(); + .getRootUiCoordinatorForTesting() + .getToolbarManager() + .getContainerViewForTesting(); TouchCommon.performDrag(toolbarRoot, fromX, toX, y, y, stepCount, duration); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerTest.java index 6cf0c04..b8b49e51 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerTest.java
@@ -161,7 +161,7 @@ mManagerPhone = new LayoutManagerChromePhone(layoutManagerHost, null); mManager = mManagerPhone; CompositorAnimationHandler.setTestingMode(true); - mManager.init(mTabModelSelector, null, null, container, null, null); + mManager.init(mTabModelSelector, null, null, container, null, null, null); initializeMotionEvent(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogTest.java index 454d2473..37072435 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogTest.java
@@ -4,6 +4,11 @@ package org.chromium.chrome.browser.download.dialogs; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verify; + import android.support.test.filters.MediumTest; import org.junit.Assert; @@ -15,12 +20,16 @@ import org.mockito.MockitoAnnotations; import org.chromium.base.test.util.CommandLineFlags; +import org.chromium.chrome.browser.download.R; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; +import org.chromium.components.browser_ui.widget.RadioButtonWithDescription; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.ui.modaldialog.DialogDismissalCause; +import org.chromium.ui.modaldialog.ModalDialogManager; import org.chromium.ui.modaldialog.ModalDialogProperties; +import org.chromium.ui.modelutil.PropertyModel; /** * Test to verify download later dialog. @@ -32,18 +41,37 @@ public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private DownloadLaterDialogCoordinator mDialogCoordinator; + private PropertyModel mModel; @Mock - private ModalDialogProperties.Controller mController; + private DownloadLaterDialogController mController; + + @Mock + private ModalDialogProperties.Controller mModalDialogController; + + private ModalDialogManager getModalDialogManager() { + return mActivityTestRule.getActivity().getModalDialogManager(); + } + + private DownloadLaterDialogView getDownloadLaterDialogView() { + return (DownloadLaterDialogView) getModalDialogManager().getCurrentDialogForTest().get( + ModalDialogProperties.CUSTOM_VIEW); + } @Before public void setUp() { MockitoAnnotations.initMocks(this); mActivityTestRule.startMainActivityOnBlankPage(); TestThreadUtils.runOnUiThreadBlocking(() -> { - Assert.assertNotNull("controller should not be null", mController); + Assert.assertNotNull(mController); + mModel = new PropertyModel.Builder(DownloadLaterDialogProperties.ALL_KEYS) + .with(DownloadLaterDialogProperties.DOWNLOAD_TIME_INITIAL_SELECTION, + DownloadLaterDialogChoice.ON_WIFI) + .with(DownloadLaterDialogProperties.CONTROLLER, mController) + .build(); + mDialogCoordinator = new DownloadLaterDialogCoordinator(mActivityTestRule.getActivity(), - mActivityTestRule.getActivity().getModalDialogManager(), mController); + getModalDialogManager(), mModel, mModalDialogController); }); } @@ -54,7 +82,8 @@ mDialogCoordinator.showDialog(); Assert.assertTrue(mActivityTestRule.getActivity().getModalDialogManager().isShowing()); mDialogCoordinator.dismissDialog(DialogDismissalCause.UNKNOWN); - Assert.assertFalse(mActivityTestRule.getActivity().getModalDialogManager().isShowing()); + Assert.assertFalse(getModalDialogManager().isShowing()); + verify(mModalDialogController).onDismiss(any(), anyInt()); }); } @@ -63,8 +92,32 @@ public void testShowDialogThenDestroy() { TestThreadUtils.runOnUiThreadBlocking(() -> { mDialogCoordinator.showDialog(); - Assert.assertTrue(mActivityTestRule.getActivity().getModalDialogManager().isShowing()); + Assert.assertTrue(getModalDialogManager().isShowing()); mDialogCoordinator.destroy(); }); } + + @Test + @MediumTest + public void testSelectRadioButton() { + TestThreadUtils.runOnUiThreadBlocking(() -> { + mDialogCoordinator.showDialog(); + + // Verify the initial selection of the dialog. The controller should not get an event + // for the initial setup. + RadioButtonWithDescription onWifiButton = + (RadioButtonWithDescription) getDownloadLaterDialogView().findViewById( + org.chromium.chrome.browser.download.R.id.on_wifi); + Assert.assertTrue(onWifiButton.isChecked()); + + // Simulate a click on another radio button, the event should be propagated to + // controller. + RadioButtonWithDescription downloadNowButton = + getDownloadLaterDialogView().findViewById(R.id.download_now); + Assert.assertNotNull(downloadNowButton); + downloadNowButton.setChecked(true); + getDownloadLaterDialogView().onCheckedChanged(null, -1); + verify(mController).onChoiceChanged(eq(DownloadLaterDialogChoice.DOWNLOAD_NOW)); + }); + } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/ExpandablePaymentHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/ExpandablePaymentHandlerTest.java index 43703e4..3f7cf127 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/ExpandablePaymentHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/ExpandablePaymentHandlerTest.java
@@ -1,26 +1,46 @@ -package org.chromium.chrome.browser.payments; - // 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 android.support.test.filters.MediumTest; +package org.chromium.chrome.browser.payments; +import static android.support.test.espresso.Espresso.onView; +import static android.support.test.espresso.action.ViewActions.click; +import static android.support.test.espresso.action.ViewActions.swipeDown; +import static android.support.test.espresso.assertion.ViewAssertions.doesNotExist; +import static android.support.test.espresso.assertion.ViewAssertions.matches; +import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; +import static android.support.test.espresso.matcher.ViewMatchers.withContentDescription; +import static android.support.test.espresso.matcher.ViewMatchers.withId; +import static android.support.test.espresso.matcher.ViewMatchers.withText; + +import static org.hamcrest.Matchers.startsWith; + +import android.support.test.InstrumentationRegistry; +import android.support.test.filters.SmallTest; +import android.support.test.uiautomator.UiDevice; + +import org.junit.Assert; import org.junit.Before; +import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; +import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.payments.handler.PaymentHandlerCoordinator; import org.chromium.chrome.browser.payments.handler.PaymentHandlerCoordinator.PaymentHandlerUiObserver; -import org.chromium.chrome.test.ChromeActivityTestRule; +import org.chromium.chrome.browser.payments.handler.PaymentHandlerCoordinator.PaymentHandlerWebContentsObserver; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; -import org.chromium.content_public.browser.test.util.Criteria; +import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.test.util.CriteriaHelper; +import org.chromium.net.test.EmbeddedTestServer; +import org.chromium.net.test.ServerCertificate; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import org.chromium.url.GURL; /** @@ -29,43 +49,248 @@ @RunWith(ChromeJUnit4ClassRunner.class) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class ExpandablePaymentHandlerTest { - @Rule - public ChromeActivityTestRule<ChromeActivity> mRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + // Disable animations to reduce flakiness. + @ClassRule + public static DisableAnimationsTestRule sNoAnimationsRule = new DisableAnimationsTestRule(); - private boolean mUiShown = false; + // Open a tab on the blank page first to initiate the native bindings required by the test + // server. + @Rule + public PaymentRequestTestRule mRule = new PaymentRequestTestRule("about:blank"); + + // Host the tests on https://127.0.0.1, because file:// URLs cannot have service workers. + private EmbeddedTestServer mServer; + private GURL mDefaultPaymentAppUrl; + private boolean mUiShownCalled = false; + private boolean mUiClosedCalled = false; + private boolean mWebContentsInitializedCallbackInvoked = false; + private UiDevice mDevice; + private boolean mDefaultIsIncognito = false; + private ChromeActivity mDefaultActivity; @Before - public void setUp() { - mRule.startMainActivityOnBlankPage(); + public void setUp() throws Throwable { + mServer = EmbeddedTestServer.createAndStartHTTPSServer( + InstrumentationRegistry.getContext(), ServerCertificate.CERT_OK); + mDefaultPaymentAppUrl = new GURL(mServer.getURL( + "/components/test/data/payments/maxpay.com/payment_handler_window.html")); + mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); + mDefaultActivity = mRule.getActivity(); } - @Test - @MediumTest - @Feature({"Payments"}) - public void testShow() throws Throwable { - PaymentHandlerCoordinator paymentHandler = new PaymentHandlerCoordinator(); - PaymentHandlerUiObserver uiObserver = new PaymentHandlerUiObserver() { + private PaymentHandlerWebContentsObserver defaultWebContentObserver() { + return new PaymentHandlerWebContentsObserver() { @Override - public void onPaymentHandlerUiClosed() {} + public void onWebContentsInitialized(WebContents webContents) { + mWebContentsInitializedCallbackInvoked = true; + } + }; + } + + private PaymentHandlerUiObserver defaultUiObserver() { + return new PaymentHandlerUiObserver() { + @Override + public void onPaymentHandlerUiClosed() { + mUiClosedCalled = true; + } @Override public void onPaymentHandlerUiShown() { - mUiShown = true; + mUiShownCalled = true; } }; - mRule.runOnUiThread( - () - -> paymentHandler.show(mRule.getActivity(), - new GURL("https://maxpay.com/pay"), /*isIncognito=*/false, - /*webContentsObserver=*/(webContents) -> {}, uiObserver)); - CriteriaHelper.pollInstrumentationThread(new Criteria() { - @Override - public boolean isSatisfied() { - return mUiShown; - } - }); + } + + private void waitForUiShown() { + CriteriaHelper.pollInstrumentationThread(() -> mUiShownCalled); + } + + private void waitForTitleShown(WebContents paymentAppWebContents) { + CriteriaHelper.pollInstrumentationThread( + () -> paymentAppWebContents.getTitle().equals("Max Pay")); + } + + private void waitForUiClosed() { + CriteriaHelper.pollInstrumentationThread(() -> mUiClosedCalled); + } + + @Test + @SmallTest + @Feature({"Payments"}) + public void testOpenClose() throws Throwable { + PaymentHandlerCoordinator paymentHandler = new PaymentHandlerCoordinator(); + mRule.runOnUiThread(() + -> paymentHandler.show(mDefaultActivity, mDefaultPaymentAppUrl, + /*isIncognito=*/true, defaultWebContentObserver(), + defaultUiObserver())); + waitForUiShown(); mRule.runOnUiThread(() -> paymentHandler.hide()); + waitForUiClosed(); + } + + @Test + @SmallTest + @Feature({"Payments"}) + public void testSwipeDownCloseUI() throws Throwable { + PaymentHandlerCoordinator paymentHandler = new PaymentHandlerCoordinator(); + mRule.runOnUiThread(() + -> paymentHandler.show(mDefaultActivity, mDefaultPaymentAppUrl, + mDefaultIsIncognito, defaultWebContentObserver(), + defaultUiObserver())); + waitForUiShown(); + + onView(withId(R.id.bottom_sheet_control_container)).perform(swipeDown()); + waitForUiClosed(); + } + + @Test + @SmallTest + @Feature({"Payments"}) + public void testClickCloseButtonCloseUI() throws Throwable { + PaymentHandlerCoordinator paymentHandler = new PaymentHandlerCoordinator(); + mRule.runOnUiThread(() + -> paymentHandler.show(mDefaultActivity, mDefaultPaymentAppUrl, + mDefaultIsIncognito, defaultWebContentObserver(), + defaultUiObserver())); + waitForUiShown(); + + onView(withId(R.id.close)).perform(click()); + waitForUiClosed(); + } + + @Test + @SmallTest + @Feature({"Payments"}) + public void testWebContentsInitializedCallbackInvoked() throws Throwable { + PaymentHandlerCoordinator paymentHandler = new PaymentHandlerCoordinator(); + mRule.runOnUiThread(() + -> paymentHandler.show(mDefaultActivity, mDefaultPaymentAppUrl, + mDefaultIsIncognito, defaultWebContentObserver(), + defaultUiObserver())); + waitForUiShown(); + + Assert.assertTrue(mWebContentsInitializedCallbackInvoked); + + mRule.runOnUiThread(() -> paymentHandler.hide()); + waitForUiClosed(); + } + + @Test + @SmallTest + @Feature({"Payments"}) + public void testWebContentsDestroy() throws Throwable { + PaymentHandlerCoordinator paymentHandler = new PaymentHandlerCoordinator(); + mRule.runOnUiThread(() + -> paymentHandler.show(mDefaultActivity, mDefaultPaymentAppUrl, + mDefaultIsIncognito, defaultWebContentObserver(), + defaultUiObserver())); + waitForUiShown(); + + Assert.assertFalse(paymentHandler.getWebContentsForTest().isDestroyed()); + mRule.runOnUiThread(() -> paymentHandler.hide()); + waitForUiClosed(); + Assert.assertTrue(paymentHandler.getWebContentsForTest().isDestroyed()); + } + + @Test + @SmallTest + @Feature({"Payments"}) + public void testIncognitoTrue() throws Throwable { + PaymentHandlerCoordinator paymentHandler = new PaymentHandlerCoordinator(); + mRule.runOnUiThread(() + -> paymentHandler.show(mDefaultActivity, mDefaultPaymentAppUrl, + /*isIncognito=*/true, defaultWebContentObserver(), + defaultUiObserver())); + waitForUiShown(); + + Assert.assertTrue(paymentHandler.getWebContentsForTest().isIncognito()); + + mRule.runOnUiThread(() -> paymentHandler.hide()); + waitForUiClosed(); + } + + @Test + @SmallTest + @Feature({"Payments"}) + public void testIncognitoFalse() throws Throwable { + PaymentHandlerCoordinator paymentHandler = new PaymentHandlerCoordinator(); + mRule.runOnUiThread(() + -> paymentHandler.show(mDefaultActivity, mDefaultPaymentAppUrl, + /*isIncognito=*/false, defaultWebContentObserver(), + defaultUiObserver())); + waitForUiShown(); + + Assert.assertFalse(paymentHandler.getWebContentsForTest().isIncognito()); + + mRule.runOnUiThread(() -> paymentHandler.hide()); + waitForUiClosed(); + } + + @Test + @SmallTest + @Feature({"Payments"}) + public void testUiElements() throws Throwable { + PaymentHandlerCoordinator paymentHandler = new PaymentHandlerCoordinator(); + mRule.runOnUiThread(() + -> paymentHandler.show(mDefaultActivity, mDefaultPaymentAppUrl, + mDefaultIsIncognito, defaultWebContentObserver(), + defaultUiObserver())); + waitForUiShown(); + + onView(withId(R.id.bottom_sheet)) + .check(matches( + withContentDescription("Payment handler sheet. Swipe down to close."))); + + CriteriaHelper.pollInstrumentationThread( + () -> paymentHandler.getWebContentsForTest().getTitle().equals("Max Pay")); + + onView(withId(R.id.title)) + .check(matches(isDisplayed())) + .check(matches(withText("Max Pay"))); + onView(withId(R.id.bottom_sheet)) + .check(matches(isDisplayed())) + .check(matches( + withContentDescription("Payment handler sheet. Swipe down to close."))); + onView(withId(R.id.close)) + .check(matches(isDisplayed())) + .check(matches(withContentDescription("Close"))); + onView(withId(R.id.security_icon)) + .check(matches(isDisplayed())) + .check(matches(withContentDescription("Connection is secure. Site information"))); + // Not verifying the port number because it's indefinite in tests. + onView(withId(R.id.origin)) + .check(matches(isDisplayed())) + .check(matches(withText(startsWith("127.0.0.1:")))); + + mRule.runOnUiThread(() -> paymentHandler.hide()); + waitForUiClosed(); + } + + @Test + @SmallTest + @Feature({"Payments"}) + public void testOpenPageInfoDialog() throws Throwable { + PaymentHandlerCoordinator paymentHandler = new PaymentHandlerCoordinator(); + mRule.runOnUiThread(() + -> paymentHandler.show(mDefaultActivity, mDefaultPaymentAppUrl, + mDefaultIsIncognito, defaultWebContentObserver(), + defaultUiObserver())); + waitForTitleShown(paymentHandler.getWebContentsForTest()); + + onView(withId(R.id.security_icon)).perform(click()); + + String paymentAppUrl = mServer.getURL( + "/components/test/data/payments/maxpay.com/payment_handler_window.html"); + onView(withId(R.id.page_info_url)) + .check(matches(isDisplayed())) + .check(matches(withText(paymentAppUrl))); + + mDevice.pressBack(); + + onView(withId(R.id.page_info_url)).check(doesNotExist()); + + mRule.runOnUiThread(() -> paymentHandler.hide()); + waitForUiClosed(); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/photo_picker/PhotoPickerDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/photo_picker/PhotoPickerDialogTest.java index d513b24..d999937 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/photo_picker/PhotoPickerDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/photo_picker/PhotoPickerDialogTest.java
@@ -56,7 +56,6 @@ * Tests for the PhotoPickerDialog class. */ @RunWith(ChromeJUnit4ClassRunner.class) -@MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP) // See crbug.com/888931 for details. @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class PhotoPickerDialogTest implements PhotoPickerListener, SelectionObserver<PickerBitmap>, DecoderServiceHost.DecoderStatusCallback, @@ -449,7 +448,7 @@ @Test @LargeTest - @DisableIf.Build(sdk_is_less_than = Build.VERSION_CODES.N) // Video is only supported on N+. + @MinAndroidSdkLevel(Build.VERSION_CODES.N) // Video is only supported on N+. public void testVideoPlayerPlayAndRestart() throws Throwable { // Requesting to play a video is not a case of an accidental disk read on the UI thread. StrictMode.ThreadPolicy oldPolicy = TestThreadUtils.runOnUiThreadBlocking( @@ -515,7 +514,8 @@ @Test @LargeTest @DisableAnimationsTestRule.EnsureAnimationsOn - @DisableIf.Build(sdk_is_less_than = Build.VERSION_CODES.N) // Video is only supported on N+. + @MinAndroidSdkLevel(Build.VERSION_CODES.N) // Video is only supported on N+. + @DisableIf.Build(supported_abis_includes = "x86", message = "https://crbug.com/1092104") public void testVideoPlayerAnimations() throws Throwable { PickerVideoPlayer.setShortAnimationTimesForTesting(true);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsClientTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsClientTest.java index 856d57f8..d431468 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsClientTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsClientTest.java
@@ -48,6 +48,8 @@ ChromeSiteSettingsClient client = new ChromeSiteSettingsClient(mActivityTestRule.getActivity()); + // Hold the Bitmap in an array because it gets assigned to in a closure, and all captured + // variables have to be effectively final. Bitmap[] holder = new Bitmap[1]; CallbackHelper helper = new CallbackHelper(); PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> {
diff --git a/chrome/app/BUILD.gn b/chrome/app/BUILD.gn index 7d10296d6..b7f41ec3 100644 --- a/chrome/app/BUILD.gn +++ b/chrome/app/BUILD.gn
@@ -238,7 +238,6 @@ "//chromeos/services/media_perception/public/mojom", "//chromeos/services/multidevice_setup/public/mojom", "//chromeos/services/network_config/public/mojom", - "//components/chromeos_camera/common:camera_app_helper", "//media/capture/video/chromeos/mojom:cros_camera", ] }
diff --git a/chrome/app/resources/generated_resources_ar.xtb b/chrome/app/resources/generated_resources_ar.xtb index faf6f85..b26d01d 100644 --- a/chrome/app/resources/generated_resources_ar.xtb +++ b/chrome/app/resources/generated_resources_ar.xtb
@@ -4652,7 +4652,7 @@ <translation id="6985607387932385770">الطابعات</translation> <translation id="6988094684494323731">جارٍ بدء تشغيل حاوية نظام التشغيل Linux</translation> <translation id="6990778048354947307">مظهر معتم</translation> -<translation id="6991665348624301627">تحديد وجهة</translation> +<translation id="6991665348624301627">اختيار وجهة</translation> <translation id="6992554835374084304">تفعيل التدقيق الإملائي المُحسَّن</translation> <translation id="6994069045767983299">قلب الألوان</translation> <translation id="6995899638241819463">التحذير إذا تم الكشف عن كلمات المرور في عملية اختراق بيانات</translation>
diff --git a/chrome/app/resources/generated_resources_iw.xtb b/chrome/app/resources/generated_resources_iw.xtb index 1c8eda8..0320259 100644 --- a/chrome/app/resources/generated_resources_iw.xtb +++ b/chrome/app/resources/generated_resources_iw.xtb
@@ -2181,6 +2181,7 @@ <translation id="3732857534841813090">הצגת מידע קשור על ידי Google Assistant</translation> <translation id="3733127536501031542">שרת SSL עם הגברה</translation> <translation id="3735740477244556633">מיון לפי</translation> +<translation id="3738213647660363521">צבע סמן בהתאמה אישית</translation> <translation id="3738924763801731196"><ph name="OID" />:</translation> <translation id="3739254215541673094">לפתוח את <ph name="APPLICATION" />?</translation> <translation id="3742055079367172538">צילום המסך בוצע</translation> @@ -3289,6 +3290,7 @@ <translation id="52232769093306234">האריזה נכשלה.</translation> <translation id="5225324770654022472">הצג קיצורי יישומים</translation> <translation id="5227679487546032910">דמות ברירת מחדל כחלחלה</translation> +<translation id="5228088094491423618">כתוביות מיידיות</translation> <translation id="5228579091201413441">הפעל סנכרון</translation> <translation id="5229189185761556138">נהל שיטות קלט</translation> <translation id="5230516054153933099">חלון</translation> @@ -6341,6 +6343,7 @@ <translation id="9121814364785106365">פתח ככרטיסייה מוצמדת</translation> <translation id="9122176249172999202"><ph name="IDS_SHORT_PRODUCT_NAME" /> הושהה</translation> <translation id="9124003689441359348">כאן יופיעו הסיסמאות ששמרת</translation> +<translation id="9126149354162942022">צבע הסמן</translation> <translation id="9128317794749765148">לא ניתן היה להשלים את ההגדרה</translation> <translation id="9128870381267983090">התחבר לרשת</translation> <translation id="9130015405878219958">הוזן מצב לא חוקי.</translation>
diff --git a/chrome/app/resources/generated_resources_mk.xtb b/chrome/app/resources/generated_resources_mk.xtb index 147b56e..c1c1550 100644 --- a/chrome/app/resources/generated_resources_mk.xtb +++ b/chrome/app/resources/generated_resources_mk.xtb
@@ -2183,6 +2183,7 @@ <translation id="3732857534841813090">Прикажување поврзани информации од „Помошникот на Google“</translation> <translation id="3733127536501031542">ССЛ-сервер со покачување</translation> <translation id="3735740477244556633">Подреди по</translation> +<translation id="3738213647660363521">Приспособена боја на курсор</translation> <translation id="3738924763801731196"><ph name="OID" />:</translation> <translation id="3739254215541673094">Да се отвори <ph name="APPLICATION" />?</translation> <translation id="3742055079367172538">Направена е слика од екранот</translation> @@ -3291,6 +3292,7 @@ <translation id="52232769093306234">Пакувањето не успеа.</translation> <translation id="5225324770654022472">Покажи кратенка за апликации</translation> <translation id="5227679487546032910">Стандарден синозелен аватар</translation> +<translation id="5228088094491423618">Автоматски титлови</translation> <translation id="5228579091201413441">Овозможи синхронизација</translation> <translation id="5229189185761556138">Управувајте со методите за внесување</translation> <translation id="5230516054153933099">Прозорец</translation> @@ -6344,6 +6346,7 @@ <translation id="9121814364785106365">Отвори како прикачена картичка</translation> <translation id="9122176249172999202"><ph name="IDS_SHORT_PRODUCT_NAME" /> е на пауза</translation> <translation id="9124003689441359348">Зачуваните лозинки ќе се појават тука</translation> +<translation id="9126149354162942022">Боја на курсор</translation> <translation id="9128317794749765148">Поставувањето не можеше да се заврши</translation> <translation id="9128870381267983090">Поврзете се на мрежа</translation> <translation id="9130015405878219958">Внесен е неважечки режим.</translation>
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index 202d0234..acb015f 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -500,6 +500,15 @@ <message translateable="false" name="IDS_SETTINGS_PASSWORD_DELETED_PASSWORD_FROM_ACCOUNT_AND_DEVICE" desc="Label for an undo tooltip following deletion of a password from the account and the device."> Password deleted from your Google Account and this device </message> + <message name="IDS_SETTINGS_DEVICE_PASSWORDS_LINK_LABEL_SINGULAR" desc="The label for the link on settings leading to the 'device passwords' page, when there is 1 device password."> + You have 1 password saved on this device + </message> + <message name="IDS_SETTINGS_DEVICE_PASSWORDS_LINK_LABEL_PLURAL" desc="The label for the link on settings leading to the 'device passwords' page, when there is more than 1 device password."> + You have <ph name="NUMBER_OF_DEVICE_PASSWORDS">$1<ex>2</ex></ph> passwords saved on this device + </message> + <message name="IDS_SETTINGS_DEVICE_PASSWORDS_LINK_SUB_LABEL" desc="The sub-label for the link on settings leading to the 'device passwords' page."> + Save all your passwords in your Google Account, so you can use them on all your devices + </message> <message name="IDS_SETTINGS_PASSWORDS_MANAGE_PASSWORDS" desc="Shown in the passwords section of settings. Descriptive text to inform that passwords can be accessed online. Has a link."> View and manage saved passwords in your <ph name="BEGIN_LINK"><a is="action-link" href="$1" target="_blank"></ph>Google Account<ph name="END_LINK"></a></ph> </message>
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_DEVICE_PASSWORDS_LINK_LABEL_PLURAL.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_DEVICE_PASSWORDS_LINK_LABEL_PLURAL.png.sha1 new file mode 100644 index 0000000..b542b46b --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_DEVICE_PASSWORDS_LINK_LABEL_PLURAL.png.sha1
@@ -0,0 +1 @@ +5fd06cd94a1ed3799b1255fcce176240ec7c0e4e \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_DEVICE_PASSWORDS_LINK_LABEL_SINGULAR.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_DEVICE_PASSWORDS_LINK_LABEL_SINGULAR.png.sha1 new file mode 100644 index 0000000..768e0da5 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_DEVICE_PASSWORDS_LINK_LABEL_SINGULAR.png.sha1
@@ -0,0 +1 @@ +05437d4c175654f3739e031c851b1cee1979d27f \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_DEVICE_PASSWORDS_LINK_SUB_LABEL.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_DEVICE_PASSWORDS_LINK_SUB_LABEL.png.sha1 new file mode 100644 index 0000000..b542b46b --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_DEVICE_PASSWORDS_LINK_SUB_LABEL.png.sha1
@@ -0,0 +1 @@ +5fd06cd94a1ed3799b1255fcce176240ec7c0e4e \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 70c74fa..9669fcd6 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -2380,6 +2380,8 @@ "android/autofill_assistant/ui_controller_android.h", "android/autofill_assistant/ui_controller_android_utils.cc", "android/autofill_assistant/ui_controller_android_utils.h", + "android/autofill_assistant/view_handler_android.cc", + "android/autofill_assistant/view_handler_android.h", "android/background_sync_launcher_android.cc", "android/background_sync_launcher_android.h", "android/background_tab_manager.cc",
diff --git a/chrome/browser/android/autofill_assistant/generic_ui_controller_android.cc b/chrome/browser/android/autofill_assistant/generic_ui_controller_android.cc index 104345ac..001c286de 100644 --- a/chrome/browser/android/autofill_assistant/generic_ui_controller_android.cc +++ b/chrome/browser/android/autofill_assistant/generic_ui_controller_android.cc
@@ -11,6 +11,7 @@ #include "chrome/browser/android/autofill_assistant/generic_ui_interactions_android.h" #include "chrome/browser/android/autofill_assistant/interaction_handler_android.h" #include "chrome/browser/android/autofill_assistant/ui_controller_android_utils.h" +#include "chrome/browser/android/autofill_assistant/view_handler_android.h" #include "components/autofill_assistant/browser/event_handler.h" #include "components/autofill_assistant/browser/generic_ui_java_generated_enums.h" #include "components/autofill_assistant/browser/ui_delegate.h" @@ -26,7 +27,7 @@ const base::android::ScopedJavaGlobalRef<jobject>& jdelegate, const ViewProto& proto, InteractionHandlerAndroid* interaction_handler, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views); + ViewHandlerAndroid* view_handler); base::android::ScopedJavaLocalRef<jobject> CreateJavaDrawable( JNIEnv* env, @@ -131,12 +132,12 @@ const base::android::ScopedJavaLocalRef<jstring>& jidentifier, const VerticalExpanderViewProto& proto, InteractionHandlerAndroid* interaction_handler, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views) { + ViewHandlerAndroid* view_handler) { base::android::ScopedJavaGlobalRef<jobject> jtitle_view = nullptr; if (proto.has_title_view()) { jtitle_view = CreateViewHierarchy(env, jcontext, jdelegate, proto.title_view(), - interaction_handler, views); + interaction_handler, view_handler); if (!jtitle_view) { return nullptr; } @@ -145,7 +146,7 @@ if (proto.has_collapsed_view()) { jcollapsed_view = CreateViewHierarchy(env, jcontext, jdelegate, proto.collapsed_view(), - interaction_handler, views); + interaction_handler, view_handler); if (!jcollapsed_view) { return nullptr; } @@ -154,7 +155,7 @@ if (proto.has_expanded_view()) { jexpanded_view = CreateViewHierarchy(env, jcontext, jdelegate, proto.expanded_view(), - interaction_handler, views); + interaction_handler, view_handler); if (!jexpanded_view) { return nullptr; } @@ -186,7 +187,7 @@ const base::android::ScopedJavaLocalRef<jstring>& jidentifier, const ToggleButtonViewProto& proto, InteractionHandlerAndroid* interaction_handler, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views) { + ViewHandlerAndroid* view_handler) { if (proto.model_identifier().empty()) { VLOG(1) << "Failed to create ToggleButtonViewProto: model_identifier not " "specified"; @@ -201,16 +202,16 @@ if (proto.has_left_content_view()) { jcontent_left_view = CreateViewHierarchy(env, jcontext, jdelegate, proto.left_content_view(), - interaction_handler, views); + interaction_handler, view_handler); if (!jcontent_left_view) { return nullptr; } } base::android::ScopedJavaGlobalRef<jobject> jcontent_right_view = nullptr; if (proto.has_right_content_view()) { - jcontent_right_view = CreateViewHierarchy(env, jcontext, jdelegate, - proto.right_content_view(), - interaction_handler, views); + jcontent_right_view = CreateViewHierarchy( + env, jcontext, jdelegate, proto.right_content_view(), + interaction_handler, view_handler); if (!jcontent_right_view) { return nullptr; } @@ -237,7 +238,7 @@ const base::android::ScopedJavaGlobalRef<jobject>& jdelegate, const ViewProto& proto, InteractionHandlerAndroid* interaction_handler, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views) { + ViewHandlerAndroid* view_handler) { auto jidentifier = base::android::ConvertUTF8ToJavaString(env, proto.identifier()); base::android::ScopedJavaLocalRef<jobject> jview = nullptr; @@ -268,7 +269,7 @@ case ViewProto::kVerticalExpanderView: { jview = CreateJavaVerticalExpander(env, jcontext, jdelegate, jidentifier, proto.vertical_expander_view(), - interaction_handler, views); + interaction_handler, view_handler); break; } case ViewProto::kTextInputView: { @@ -289,7 +290,7 @@ case ViewProto::kToggleButtonView: jview = CreateJavaToggleButton(env, jcontext, jdelegate, jidentifier, proto.toggle_button_view(), - interaction_handler, views); + interaction_handler, view_handler); break; case ViewProto::VIEW_NOT_SET: NOTREACHED(); @@ -330,7 +331,7 @@ bool CreateImplicitInteractionsForView( const ViewProto& proto, InteractionHandlerAndroid* interaction_handler, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views) { + ViewHandlerAndroid* view_handler) { switch (proto.view_case()) { case ViewProto::kTextInputView: { // Auto-update the text of the view whenever the corresponding value in @@ -386,10 +387,10 @@ } // Auto-update toggle state. auto model_identifier = proto.toggle_button_view().model_identifier(); - auto toggle_callback = - base::BindRepeating(&android_interactions::SetToggleButtonChecked, - interaction_handler->GetUserModel()->GetWeakPtr(), - proto.identifier(), model_identifier, views); + auto toggle_callback = base::BindRepeating( + &android_interactions::SetToggleButtonChecked, + interaction_handler->GetUserModel()->GetWeakPtr(), proto.identifier(), + model_identifier, view_handler); interaction_handler->AddInteraction( {EventProto::kOnValueChanged, model_identifier}, toggle_callback); if (proto.toggle_button_view().kind_case() != @@ -430,7 +431,7 @@ // Recursively runs through all views defined in |proto| in a depth-first // manner and inflates and configures each view. Implicit interactions will be // added to |interaction_handler|, and views with identifiers will be added to -// the |views| lookup map. Returns the root of the created java view hierarchy +// the |view_handler|. Returns the root of the created java view hierarchy // or null in case of error. base::android::ScopedJavaGlobalRef<jobject> CreateViewHierarchy( JNIEnv* env, @@ -438,9 +439,9 @@ const base::android::ScopedJavaGlobalRef<jobject>& jdelegate, const ViewProto& proto, InteractionHandlerAndroid* interaction_handler, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views) { + ViewHandlerAndroid* view_handler) { auto jview = CreateJavaView(env, jcontext, jdelegate, proto, - interaction_handler, views); + interaction_handler, view_handler); if (!jview) { VLOG(1) << "View inflation failed for '" << proto.identifier() << "'"; return nullptr; @@ -448,7 +449,7 @@ if (proto.view_case() == ViewProto::kViewContainer) { for (const auto& child : proto.view_container().views()) { auto jchild = CreateViewHierarchy(env, jcontext, jdelegate, child, - interaction_handler, views); + interaction_handler, view_handler); if (!jchild) { return nullptr; } @@ -456,15 +457,15 @@ } } - if (!CreateImplicitInteractionsForView(proto, interaction_handler, views)) { + if (!CreateImplicitInteractionsForView(proto, interaction_handler, + view_handler)) { VLOG(1) << "Implicit interaction creation failed for '" << proto.identifier() << "'"; return nullptr; } if (!proto.identifier().empty()) { - DCHECK(views->find(proto.identifier()) == views->end()); - views->emplace(proto.identifier(), jview); + view_handler->AddView(proto.identifier(), jview); } return jview; @@ -474,12 +475,10 @@ GenericUiControllerAndroid::GenericUiControllerAndroid( base::android::ScopedJavaGlobalRef<jobject> jroot_view, - std::unique_ptr< - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>> - views, + std::unique_ptr<ViewHandlerAndroid> view_handler, std::unique_ptr<InteractionHandlerAndroid> interaction_handler) : jroot_view_(jroot_view), - views_(std::move(views)), + view_handler_(std::move(view_handler)), interaction_handler_(std::move(interaction_handler)) {} GenericUiControllerAndroid::~GenericUiControllerAndroid() { @@ -496,18 +495,17 @@ UserModel* user_model, BasicInteractions* basic_interactions) { // Create view layout. - auto views = std::make_unique< - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>>(); + auto view_handler = std::make_unique<ViewHandlerAndroid>(); auto interaction_handler = std::make_unique<InteractionHandlerAndroid>( - event_handler, user_model, basic_interactions, views.get(), jcontext, - jdelegate); + event_handler, user_model, basic_interactions, view_handler.get(), + jcontext, jdelegate); JNIEnv* env = base::android::AttachCurrentThread(); auto jroot_view = proto.has_root_view() ? CreateViewHierarchy( env, base::android::ScopedJavaLocalRef<jobject>(jcontext), jdelegate, proto.root_view(), interaction_handler.get(), - views.get()) + view_handler.get()) : nullptr; // Create proto interactions (i.e., native -> java). @@ -518,8 +516,8 @@ } // Create java listeners (i.e., java -> native). - if (!android_events::CreateJavaListenersFromProto(env, views.get(), jdelegate, - proto.interactions())) { + if (!android_events::CreateJavaListenersFromProto( + env, view_handler.get(), jdelegate, proto.interactions())) { return nullptr; } @@ -529,7 +527,7 @@ /*force_notifications=*/true); return std::make_unique<GenericUiControllerAndroid>( - jroot_view, std::move(views), std::move(interaction_handler)); + jroot_view, std::move(view_handler), std::move(interaction_handler)); } } // namespace autofill_assistant
diff --git a/chrome/browser/android/autofill_assistant/generic_ui_controller_android.h b/chrome/browser/android/autofill_assistant/generic_ui_controller_android.h index 4f3de45d..e50dfc26 100644 --- a/chrome/browser/android/autofill_assistant/generic_ui_controller_android.h +++ b/chrome/browser/android/autofill_assistant/generic_ui_controller_android.h
@@ -19,6 +19,7 @@ class BasicInteractions; class EventHandler; class UserModel; +class ViewHandlerAndroid; class GenericUiControllerAndroid { public: @@ -39,19 +40,13 @@ GenericUiControllerAndroid( base::android::ScopedJavaGlobalRef<jobject> jroot_view, - std::unique_ptr< - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>> - views, + std::unique_ptr<ViewHandlerAndroid> view_handler, std::unique_ptr<InteractionHandlerAndroid> interaction_handler); ~GenericUiControllerAndroid(); private: base::android::ScopedJavaGlobalRef<jobject> jroot_view_; - - // Maps view-ids to android views. - std::unique_ptr< - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>> - views_; + std::unique_ptr<ViewHandlerAndroid> view_handler_; std::unique_ptr<InteractionHandlerAndroid> interaction_handler_; DISALLOW_COPY_AND_ASSIGN(GenericUiControllerAndroid);
diff --git a/chrome/browser/android/autofill_assistant/generic_ui_events_android.cc b/chrome/browser/android/autofill_assistant/generic_ui_events_android.cc index a745dd0..78e958d 100644 --- a/chrome/browser/android/autofill_assistant/generic_ui_events_android.cc +++ b/chrome/browser/android/autofill_assistant/generic_ui_events_android.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/android/autofill_assistant/generic_ui_events_android.h" #include "base/android/jni_string.h" #include "chrome/android/features/autofill_assistant/jni_headers/AssistantViewEvents_jni.h" +#include "chrome/browser/android/autofill_assistant/view_handler_android.h" namespace autofill_assistant { namespace android_events { @@ -25,22 +26,22 @@ bool CreateJavaListenersFromProto( JNIEnv* env, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views, + ViewHandlerAndroid* view_handler, base::android::ScopedJavaGlobalRef<jobject> jdelegate, const InteractionsProto& proto) { for (const auto& interaction_proto : proto.interactions()) { const auto& event_proto = interaction_proto.trigger_event(); switch (event_proto.kind_case()) { case EventProto::kOnViewClicked: { - auto jview = - views->find(event_proto.on_view_clicked().view_identifier()); - if (jview == views->end()) { + auto jview = view_handler->GetView( + event_proto.on_view_clicked().view_identifier()); + if (!jview.has_value()) { VLOG(1) << "Invalid click event, no view with id='" << event_proto.on_view_clicked().view_identifier() << "' found"; return false; } - SetOnClickListener(env, jview->second, jdelegate, + SetOnClickListener(env, *jview, jdelegate, event_proto.on_view_clicked()); break; }
diff --git a/chrome/browser/android/autofill_assistant/generic_ui_events_android.h b/chrome/browser/android/autofill_assistant/generic_ui_events_android.h index 6885a7f..4edaf05 100644 --- a/chrome/browser/android/autofill_assistant/generic_ui_events_android.h +++ b/chrome/browser/android/autofill_assistant/generic_ui_events_android.h
@@ -12,6 +12,8 @@ #include "components/autofill_assistant/browser/generic_ui.pb.h" namespace autofill_assistant { +class ViewHandlerAndroid; + namespace android_events { // Creates java listeners for all view events in |proto| such that |jdelegate| @@ -19,7 +21,7 @@ // success, false on failure. bool CreateJavaListenersFromProto( JNIEnv* env, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views, + ViewHandlerAndroid* view_handler, base::android::ScopedJavaGlobalRef<jobject> jdelegate, const InteractionsProto& proto);
diff --git a/chrome/browser/android/autofill_assistant/generic_ui_interactions_android.cc b/chrome/browser/android/autofill_assistant/generic_ui_interactions_android.cc index d49095f..bdfe7b0 100644 --- a/chrome/browser/android/autofill_assistant/generic_ui_interactions_android.cc +++ b/chrome/browser/android/autofill_assistant/generic_ui_interactions_android.cc
@@ -9,6 +9,7 @@ #include "chrome/android/features/autofill_assistant/jni_headers/AssistantViewInteractions_jni.h" #include "chrome/browser/android/autofill_assistant/generic_ui_controller_android.h" #include "chrome/browser/android/autofill_assistant/ui_controller_android_utils.h" +#include "chrome/browser/android/autofill_assistant/view_handler_android.h" #include "components/autofill_assistant/browser/user_model.h" namespace autofill_assistant { @@ -218,11 +219,10 @@ base::android::ConvertUTF8ToJavaString(env, proto.popup_identifier())); } -void SetViewText( - base::WeakPtr<UserModel> user_model, - const SetTextProto& proto, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views, - base::android::ScopedJavaGlobalRef<jobject> jdelegate) { +void SetViewText(base::WeakPtr<UserModel> user_model, + const SetTextProto& proto, + ViewHandlerAndroid* view_handler, + base::android::ScopedJavaGlobalRef<jobject> jdelegate) { if (!user_model) { return; } @@ -240,8 +240,8 @@ return; } - auto jview = views->find(proto.view_identifier()); - if (jview == views->end()) { + auto jview = view_handler->GetView(proto.view_identifier()); + if (!jview.has_value()) { DVLOG(2) << "Failed to set text for " << proto.view_identifier() << ": " << " view not found"; return; @@ -249,21 +249,20 @@ JNIEnv* env = base::android::AttachCurrentThread(); Java_AssistantViewInteractions_setViewText( - env, jview->second, + env, *jview, base::android::ConvertUTF8ToJavaString(env, text->strings().values(0)), jdelegate); } -void SetViewVisibility( - base::WeakPtr<UserModel> user_model, - const SetViewVisibilityProto& proto, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views) { +void SetViewVisibility(base::WeakPtr<UserModel> user_model, + const SetViewVisibilityProto& proto, + ViewHandlerAndroid* view_handler) { if (!user_model) { return; } - auto jview = views->find(proto.view_identifier()); - if (jview == views->end()) { + auto jview = view_handler->GetView(proto.view_identifier()); + if (!jview.has_value()) { DVLOG(2) << "Failed to set view visibility for " << proto.view_identifier() << ": view not found"; return; @@ -279,20 +278,19 @@ JNIEnv* env = base::android::AttachCurrentThread(); Java_AssistantViewInteractions_setViewVisibility( - env, jview->second, + env, *jview, ui_controller_android_utils::ToJavaValue(env, *visible_value)); } -void SetViewEnabled( - base::WeakPtr<UserModel> user_model, - const SetViewEnabledProto& proto, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views) { +void SetViewEnabled(base::WeakPtr<UserModel> user_model, + const SetViewEnabledProto& proto, + ViewHandlerAndroid* view_handler) { if (!user_model) { return; } - auto jview = views->find(proto.view_identifier()); - if (jview == views->end()) { + auto jview = view_handler->GetView(proto.view_identifier()); + if (!jview.has_value()) { DVLOG(2) << "Failed to enable/disable view " << proto.view_identifier() << ": view not found"; return; @@ -308,7 +306,7 @@ JNIEnv* env = base::android::AttachCurrentThread(); Java_AssistantViewInteractions_setViewEnabled( - env, jview->second, + env, *jview, ui_controller_android_utils::ToJavaValue(env, *enabled_value)); } @@ -322,17 +320,16 @@ basic_interactions->RunConditionalCallback(condition_identifier, callback); } -void SetToggleButtonChecked( - base::WeakPtr<UserModel> user_model, - const std::string& view_identifier, - const std::string& model_identifier, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views) { +void SetToggleButtonChecked(base::WeakPtr<UserModel> user_model, + const std::string& view_identifier, + const std::string& model_identifier, + ViewHandlerAndroid* view_handler) { if (!user_model) { return; } - auto jview = views->find(view_identifier); - if (jview == views->end()) { + auto jview = view_handler->GetView(view_identifier); + if (!jview.has_value()) { DVLOG(2) << "Failed to set toggle state for " << view_identifier << ": view not found"; return; @@ -348,19 +345,18 @@ JNIEnv* env = base::android::AttachCurrentThread(); if (!Java_AssistantViewInteractions_setToggleButtonChecked( - env, jview->second, + env, *jview, ui_controller_android_utils::ToJavaValue(env, *checked_value))) { DVLOG(2) << "Failed to set toggle state for " << view_identifier << ": JNI call failed"; } } -void ClearViewContainer( - const std::string& view_identifier, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views, - base::android::ScopedJavaGlobalRef<jobject> jdelegate) { - auto jview = views->find(view_identifier); - if (jview == views->end()) { +void ClearViewContainer(const std::string& view_identifier, + ViewHandlerAndroid* view_handler, + base::android::ScopedJavaGlobalRef<jobject> jdelegate) { + auto jview = view_handler->GetView(view_identifier); + if (!jview.has_value()) { DVLOG(2) << "Failed to clear view container " << view_identifier << ": view not found"; return; @@ -368,7 +364,7 @@ JNIEnv* env = base::android::AttachCurrentThread(); if (!Java_AssistantViewInteractions_clearViewContainer( - env, jview->second, + env, *jview, base::android::ConvertUTF8ToJavaString(env, view_identifier), jdelegate)) { DVLOG(2) << "Failed to clear view container " << view_identifier @@ -377,20 +373,19 @@ } } -bool AttachViewToParent( - base::android::ScopedJavaGlobalRef<jobject> jview, - const std::string& parent_view_identifier, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views) { - auto jparent_view = views->find(parent_view_identifier); - if (jparent_view == views->end()) { +bool AttachViewToParent(base::android::ScopedJavaGlobalRef<jobject> jview, + const std::string& parent_view_identifier, + ViewHandlerAndroid* view_handler) { + auto jparent_view = view_handler->GetView(parent_view_identifier); + if (!jparent_view.has_value()) { DVLOG(2) << "Failed to attach view to " << parent_view_identifier << ": parent not found"; return false; } JNIEnv* env = base::android::AttachCurrentThread(); - if (!Java_AssistantViewInteractions_attachViewToParent( - env, jparent_view->second, jview)) { + if (!Java_AssistantViewInteractions_attachViewToParent(env, *jparent_view, + jview)) { DVLOG(2) << "Failed to attach view to " << parent_view_identifier << ": JNI call failed"; return false;
diff --git a/chrome/browser/android/autofill_assistant/generic_ui_interactions_android.h b/chrome/browser/android/autofill_assistant/generic_ui_interactions_android.h index aeafe0f3..3e83021 100644 --- a/chrome/browser/android/autofill_assistant/generic_ui_interactions_android.h +++ b/chrome/browser/android/autofill_assistant/generic_ui_interactions_android.h
@@ -15,6 +15,8 @@ #include "components/autofill_assistant/browser/generic_ui.pb.h" namespace autofill_assistant { +class ViewHandlerAndroid; + namespace android_interactions { // Writes a value to the model. @@ -61,23 +63,20 @@ base::android::ScopedJavaGlobalRef<jobject> jdelegate); // Sets the text of a view. -void SetViewText( - base::WeakPtr<UserModel> user_model, - const SetTextProto& proto, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views, - base::android::ScopedJavaGlobalRef<jobject> jdelegate); +void SetViewText(base::WeakPtr<UserModel> user_model, + const SetTextProto& proto, + ViewHandlerAndroid* view_handler, + base::android::ScopedJavaGlobalRef<jobject> jdelegate); // Sets the visibility of a view. -void SetViewVisibility( - base::WeakPtr<UserModel> user_model, - const SetViewVisibilityProto& proto, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views); +void SetViewVisibility(base::WeakPtr<UserModel> user_model, + const SetViewVisibilityProto& proto, + ViewHandlerAndroid* view_handler); // Enables or disables a view. -void SetViewEnabled( - base::WeakPtr<UserModel> user_model, - const SetViewEnabledProto& proto, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views); +void SetViewEnabled(base::WeakPtr<UserModel> user_model, + const SetViewEnabledProto& proto, + ViewHandlerAndroid* view_handler); // A simple wrapper around a basic interaction, needed because we can't directly // bind a repeating callback to a method with non-void return value. @@ -87,23 +86,20 @@ InteractionHandlerAndroid::InteractionCallback callback); // Sets the checked state of a toggle button. -void SetToggleButtonChecked( - base::WeakPtr<UserModel> user_model, - const std::string& view_identifier, - const std::string& model_identifier, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views); +void SetToggleButtonChecked(base::WeakPtr<UserModel> user_model, + const std::string& view_identifier, + const std::string& model_identifier, + ViewHandlerAndroid* view_handler); // Removes all child views from |view_identifier|. -void ClearViewContainer( - const std::string& view_identifier, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views, - base::android::ScopedJavaGlobalRef<jobject> jdelegate); +void ClearViewContainer(const std::string& view_identifier, + ViewHandlerAndroid* view_handler, + base::android::ScopedJavaGlobalRef<jobject> jdelegate); // Attaches |jview| to a parent view. -bool AttachViewToParent( - base::android::ScopedJavaGlobalRef<jobject> jview, - const std::string& parent_view_identifier, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views); +bool AttachViewToParent(base::android::ScopedJavaGlobalRef<jobject> jview, + const std::string& parent_view_identifier, + ViewHandlerAndroid* view_handler); } // namespace android_interactions } // namespace autofill_assistant
diff --git a/chrome/browser/android/autofill_assistant/interaction_handler_android.cc b/chrome/browser/android/autofill_assistant/interaction_handler_android.cc index c60af1e..150be8c 100644 --- a/chrome/browser/android/autofill_assistant/interaction_handler_android.cc +++ b/chrome/browser/android/autofill_assistant/interaction_handler_android.cc
@@ -12,6 +12,7 @@ #include "base/strings/string_number_conversions.h" #include "chrome/browser/android/autofill_assistant/generic_ui_controller_android.h" #include "chrome/browser/android/autofill_assistant/generic_ui_interactions_android.h" +#include "chrome/browser/android/autofill_assistant/view_handler_android.h" #include "components/autofill_assistant/browser/basic_interactions.h" #include "components/autofill_assistant/browser/generic_ui.pb.h" #include "components/autofill_assistant/browser/ui_delegate.h" @@ -24,7 +25,6 @@ base::Optional<EventHandler::EventKey> CreateEventKeyFromProto( const EventProto& proto, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views, base::android::ScopedJavaGlobalRef<jobject> jdelegate) { switch (proto.kind_case()) { case EventProto::kOnValueChanged: @@ -89,13 +89,13 @@ EventHandler* event_handler, UserModel* user_model, BasicInteractions* basic_interactions, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views, + ViewHandlerAndroid* view_handler, base::android::ScopedJavaGlobalRef<jobject> jcontext, base::android::ScopedJavaGlobalRef<jobject> jdelegate) : event_handler_(event_handler), user_model_(user_model), basic_interactions_(basic_interactions), - views_(views), + view_handler_(view_handler), jcontext_(jcontext), jdelegate_(jdelegate) {} @@ -132,7 +132,7 @@ NOTREACHED() << "Interactions can not be added while listening to events!"; return false; } - auto key = CreateEventKeyFromProto(proto.trigger_event(), views_, jdelegate_); + auto key = CreateEventKeyFromProto(proto.trigger_event(), jdelegate_); if (!key) { VLOG(1) << "Invalid trigger event for interaction"; return false; @@ -265,7 +265,7 @@ } return base::Optional<InteractionCallback>(base::BindRepeating( &android_interactions::SetViewText, user_model_->GetWeakPtr(), - proto.set_text(), views_, jdelegate_)); + proto.set_text(), view_handler_, jdelegate_)); case CallbackProto::kToggleUserAction: if (proto.toggle_user_action().user_actions_model_identifier().empty()) { VLOG(1) << "Error creating ToggleUserAction interaction: " @@ -298,7 +298,7 @@ } return base::Optional<InteractionCallback>(base::BindRepeating( &android_interactions::SetViewVisibility, user_model_->GetWeakPtr(), - proto.set_view_visibility(), views_)); + proto.set_view_visibility(), view_handler_)); case CallbackProto::kSetViewEnabled: if (proto.set_view_enabled().view_identifier().empty()) { VLOG(1) << "Error creating SetViewEnabled interaction: " @@ -312,7 +312,7 @@ } return base::Optional<InteractionCallback>(base::BindRepeating( &android_interactions::SetViewEnabled, user_model_->GetWeakPtr(), - proto.set_view_enabled(), views_)); + proto.set_view_enabled(), view_handler_)); case CallbackProto::kShowGenericPopup: if (proto.show_generic_popup().popup_identifier().empty()) { VLOG(1) << "Error creating ShowGenericPopup interaction: " @@ -337,9 +337,10 @@ "view_identifier not set"; return base::nullopt; } - return base::Optional<InteractionCallback>(base::BindRepeating( - &android_interactions::ClearViewContainer, - proto.clear_view_container().view_identifier(), views_, jdelegate_)); + return base::Optional<InteractionCallback>( + base::BindRepeating(&android_interactions::ClearViewContainer, + proto.clear_view_container().view_identifier(), + view_handler_, jdelegate_)); case CallbackProto::KIND_NOT_SET: VLOG(1) << "Error creating interaction: kind not set"; return base::nullopt; @@ -383,8 +384,9 @@ return; } - if (!android_interactions::AttachViewToParent( - nested_ui->GetRootView(), proto.parent_view_identifier(), views_)) { + if (!android_interactions::AttachViewToParent(nested_ui->GetRootView(), + proto.parent_view_identifier(), + view_handler_)) { DeleteNestedUi(proto.generic_ui_identifier()); return; }
diff --git a/chrome/browser/android/autofill_assistant/interaction_handler_android.h b/chrome/browser/android/autofill_assistant/interaction_handler_android.h index 765c901..c5eb50a 100644 --- a/chrome/browser/android/autofill_assistant/interaction_handler_android.h +++ b/chrome/browser/android/autofill_assistant/interaction_handler_android.h
@@ -22,6 +22,7 @@ class BasicInteractions; class GenericUiControllerAndroid; class UserModel; +class ViewHandlerAndroid; // Receives incoming events and runs the corresponding set of callbacks. // @@ -33,13 +34,12 @@ public: using InteractionCallback = base::RepeatingCallback<void()>; - // Constructor. |event_handler|, |user_model|, |basic_interactions|, - // |views|, |jcontext| and |jdelegate| must outlive this instance. + // Constructor. All dependencies must outlive this instance. InteractionHandlerAndroid( EventHandler* event_handler, UserModel* user_model, BasicInteractions* basic_interactions, - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views, + ViewHandlerAndroid* view_handler, base::android::ScopedJavaGlobalRef<jobject> jcontext, base::android::ScopedJavaGlobalRef<jobject> jdelegate); ~InteractionHandlerAndroid() override; @@ -101,7 +101,7 @@ EventHandler* event_handler_ = nullptr; UserModel* user_model_ = nullptr; BasicInteractions* basic_interactions_ = nullptr; - std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>>* views_; + ViewHandlerAndroid* view_handler_; base::android::ScopedJavaGlobalRef<jobject> jcontext_ = nullptr; base::android::ScopedJavaGlobalRef<jobject> jdelegate_ = nullptr; bool is_listening_ = false;
diff --git a/chrome/browser/android/autofill_assistant/view_handler_android.cc b/chrome/browser/android/autofill_assistant/view_handler_android.cc new file mode 100644 index 0000000..49a72a5c --- /dev/null +++ b/chrome/browser/android/autofill_assistant/view_handler_android.cc
@@ -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. + +#include "chrome/browser/android/autofill_assistant/view_handler_android.h" + +namespace autofill_assistant { + +ViewHandlerAndroid::ViewHandlerAndroid() = default; +ViewHandlerAndroid::~ViewHandlerAndroid() = default; + +base::Optional<base::android::ScopedJavaGlobalRef<jobject>> +ViewHandlerAndroid::GetView(const std::string& view_identifier) const { + auto it = views_.find(view_identifier); + if (it == views_.end()) { + return base::nullopt; + } + return it->second; +} + +// Adds a view to the set of managed views. +void ViewHandlerAndroid::AddView( + const std::string& view_identifier, + base::android::ScopedJavaGlobalRef<jobject> jview) { + DCHECK(views_.find(view_identifier) == views_.end()); + views_.emplace(view_identifier, jview); +} + +} // namespace autofill_assistant
diff --git a/chrome/browser/android/autofill_assistant/view_handler_android.h b/chrome/browser/android/autofill_assistant/view_handler_android.h new file mode 100644 index 0000000..7bfc265 --- /dev/null +++ b/chrome/browser/android/autofill_assistant/view_handler_android.h
@@ -0,0 +1,40 @@ +// 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_ANDROID_AUTOFILL_ASSISTANT_VIEW_HANDLER_ANDROID_H_ +#define CHROME_BROWSER_ANDROID_AUTOFILL_ASSISTANT_VIEW_HANDLER_ANDROID_H_ + +#include <map> +#include <memory> +#include <string> + +#include "base/android/jni_android.h" +#include "base/optional.h" + +namespace autofill_assistant { + +// Manages a map of view-identifier -> android view instances. +class ViewHandlerAndroid { + public: + ViewHandlerAndroid(); + ~ViewHandlerAndroid(); + ViewHandlerAndroid(const ViewHandlerAndroid&) = delete; + ViewHandlerAndroid& operator=(const ViewHandlerAndroid&) = delete; + + // Returns the view associated with |view_identifier| or base::nullopt if + // there is no such view. + base::Optional<base::android::ScopedJavaGlobalRef<jobject>> GetView( + const std::string& view_identifier) const; + + // Adds a view to the set of managed views. + void AddView(const std::string& view_identifier, + base::android::ScopedJavaGlobalRef<jobject> jview); + + private: + std::map<std::string, base::android::ScopedJavaGlobalRef<jobject>> views_; +}; + +} // namespace autofill_assistant + +#endif // CHROME_BROWSER_ANDROID_AUTOFILL_ASSISTANT_VIEW_HANDLER_ANDROID_H_
diff --git a/chrome/browser/chromeos/arc/keymaster/arc_keymaster_bridge.cc b/chrome/browser/chromeos/arc/keymaster/arc_keymaster_bridge.cc index bb54484..d44f396 100644 --- a/chrome/browser/chromeos/arc/keymaster/arc_keymaster_bridge.cc +++ b/chrome/browser/chromeos/arc/keymaster/arc_keymaster_bridge.cc
@@ -14,6 +14,7 @@ #include "chromeos/dbus/dbus_thread_manager.h" #include "components/arc/arc_browser_context_keyed_service_factory_base.h" #include "components/arc/session/arc_bridge_service.h" +#include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/platform/platform_channel.h" #include "mojo/public/cpp/system/invitation.h" @@ -64,7 +65,7 @@ BootstrapMojoConnection(std::move(callback)); return; } - std::move(callback).Run(std::move(keymaster_server_proxy_)); + std::move(callback).Run(keymaster_server_proxy_.Unbind()); } void ArcKeymasterBridge::OnBootstrapMojoConnection(GetServerCallback callback, @@ -73,11 +74,11 @@ if (!result) { LOG(ERROR) << "Error bootstrapping Mojo in arc-keymasterd."; keymaster_server_proxy_.reset(); - std::move(callback).Run(nullptr); + std::move(callback).Run(mojo::NullRemote()); return; } DVLOG(1) << "Success bootstrapping Mojo in arc-keymasterd."; - std::move(callback).Run(std::move(keymaster_server_proxy_)); + std::move(callback).Run(keymaster_server_proxy_.Unbind()); } void ArcKeymasterBridge::BootstrapMojoConnection(GetServerCallback callback) { @@ -95,11 +96,11 @@ base::kNullProcessHandle, channel.TakeLocalEndpoint()); - keymaster_server_proxy_.Bind(mojo::InterfacePtrInfo<mojom::KeymasterServer>( - std::move(server_pipe), 0u)); + keymaster_server_proxy_.Bind( + mojo::PendingRemote<mojom::KeymasterServer>(std::move(server_pipe), 0u)); DVLOG(1) << "Bound remote KeymasterServer interface to pipe."; - keymaster_server_proxy_.set_connection_error_handler( - base::BindOnce(&mojo::InterfacePtr<mojom::KeymasterServer>::reset, + keymaster_server_proxy_.set_disconnect_handler( + base::BindOnce(&mojo::Remote<mojom::KeymasterServer>::reset, base::Unretained(&keymaster_server_proxy_))); chromeos::DBusThreadManager::Get() ->GetArcKeymasterClient()
diff --git a/chrome/browser/chromeos/arc/keymaster/arc_keymaster_bridge.h b/chrome/browser/chromeos/arc/keymaster/arc_keymaster_bridge.h index aa42431..e6ef65c 100644 --- a/chrome/browser/chromeos/arc/keymaster/arc_keymaster_bridge.h +++ b/chrome/browser/chromeos/arc/keymaster/arc_keymaster_bridge.h
@@ -10,6 +10,7 @@ #include "chrome/browser/chromeos/arc/keymaster/cert_store_bridge.h" #include "components/arc/mojom/keymaster.mojom.h" #include "components/keyed_service/core/keyed_service.h" +#include "mojo/public/cpp/bindings/remote.h" namespace content { class BrowserContext; @@ -46,7 +47,7 @@ ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager. // Points to a proxy bound to the implementation in arc-keymasterd. - mojom::KeymasterServerPtr keymaster_server_proxy_; + mojo::Remote<mojom::KeymasterServer> keymaster_server_proxy_; // Points to a proxy bound to the implementation in arc-keymasterd. std::unique_ptr<keymaster::CertStoreBridge> cert_store_bridge_;
diff --git a/chrome/browser/chromeos/arc/keymaster/cert_store_bridge.cc b/chrome/browser/chromeos/arc/keymaster/cert_store_bridge.cc index fb08dbe..dcda7c3 100644 --- a/chrome/browser/chromeos/arc/keymaster/cert_store_bridge.cc +++ b/chrome/browser/chromeos/arc/keymaster/cert_store_bridge.cc
@@ -9,9 +9,7 @@ #include "base/bind.h" #include "base/callback.h" #include "base/logging.h" - -#include "mojo/public/cpp/bindings/interface_ptr.h" -#include "mojo/public/cpp/bindings/interface_request.h" +#include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/platform/platform_channel.h" namespace arc { @@ -28,12 +26,11 @@ } void CertStoreBridge::GetSecurityTokenOperation( - mojom::SecurityTokenOperationRequest operation_request, + mojo::PendingReceiver<mojom::SecurityTokenOperation> operation_receiver, GetSecurityTokenOperationCallback callback) { VLOG(2) << "CertStoreBridge::GetSecurityTokenOperation"; security_token_operation_ = std::make_unique<SecurityTokenOperationBridge>( - context_, mojo::PendingReceiver<mojom::SecurityTokenOperation>( - std::move(operation_request))); + context_, std::move(operation_receiver)); std::move(callback).Run(); } @@ -44,12 +41,12 @@ invitation->AttachMessagePipe("arc-cert-store-pipe"); cert_store_proxy_.Bind( - mojo::InterfacePtrInfo<keymaster::mojom::CertStoreInstance>( - std::move(pipe), 0u)); + mojo::PendingRemote<keymaster::mojom::CertStoreInstance>(std::move(pipe), + 0u)); VLOG(2) << "Bound remote CertStoreInstance interface to pipe."; - cert_store_proxy_.set_connection_error_handler(base::BindOnce( - &mojo::InterfacePtr<keymaster::mojom::CertStoreInstance>::reset, - base::Unretained(&cert_store_proxy_))); + cert_store_proxy_.set_disconnect_handler( + base::BindOnce(&mojo::Remote<keymaster::mojom::CertStoreInstance>::reset, + base::Unretained(&cert_store_proxy_))); } void CertStoreBridge::OnBootstrapMojoConnection(bool result) { @@ -58,30 +55,30 @@ return; } - auto binding = - std::make_unique<mojo::Binding<keymaster::mojom::CertStoreHost>>(this); - mojo::InterfacePtr<keymaster::mojom::CertStoreHost> host_proxy; - binding->Bind(mojo::MakeRequest(&host_proxy)); + auto receiver = + std::make_unique<mojo::Receiver<keymaster::mojom::CertStoreHost>>(this); + mojo::PendingRemote<keymaster::mojom::CertStoreHost> host_proxy; + receiver->Bind(host_proxy.InitWithNewPipeAndPassReceiver()); cert_store_proxy_->Init( std::move(host_proxy), base::BindOnce(&CertStoreBridge::OnConnectionReady, - weak_ptr_factory_.GetWeakPtr(), std::move(binding))); + weak_ptr_factory_.GetWeakPtr(), std::move(receiver))); } void CertStoreBridge::OnConnectionReady( - std::unique_ptr<mojo::Binding<mojom::CertStoreHost>> binding) { + std::unique_ptr<mojo::Receiver<mojom::CertStoreHost>> receiver) { VLOG(2) << "CertStoreBridge::OnConnectionReady"; - DCHECK(!binding_); - binding->set_connection_error_handler(base::BindOnce( + DCHECK(!receiver_); + receiver->set_disconnect_handler(base::BindOnce( &CertStoreBridge::OnConnectionClosed, base::Unretained(this))); - binding_ = std::move(binding); + receiver_ = std::move(receiver); } void CertStoreBridge::OnConnectionClosed() { VLOG(2) << "CertStoreBridge::OnConnectionClosed"; - DCHECK(binding_); - binding_.reset(); + DCHECK(receiver_); + receiver_.reset(); } } // namespace keymaster
diff --git a/chrome/browser/chromeos/arc/keymaster/cert_store_bridge.h b/chrome/browser/chromeos/arc/keymaster/cert_store_bridge.h index e444798..0b9fd83 100644 --- a/chrome/browser/chromeos/arc/keymaster/cert_store_bridge.h +++ b/chrome/browser/chromeos/arc/keymaster/cert_store_bridge.h
@@ -10,7 +10,9 @@ #include "base/memory/weak_ptr.h" #include "chrome/browser/chromeos/arc/enterprise/cert_store/security_token_operation_bridge.h" #include "chrome/services/keymaster/public/mojom/cert_store.mojom.h" -#include "mojo/public/cpp/bindings/binding.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/receiver.h" +#include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/system/invitation.h" namespace content { @@ -36,22 +38,22 @@ // CertStoreHost overrides. void GetSecurityTokenOperation( - mojom::SecurityTokenOperationRequest operation_request, + mojo::PendingReceiver<mojom::SecurityTokenOperation> operation_receiver, GetSecurityTokenOperationCallback callback) override; private: void OnConnectionReady( - std::unique_ptr<mojo::Binding<mojom::CertStoreHost>> binding); + std::unique_ptr<mojo::Receiver<mojom::CertStoreHost>> receiver); void OnConnectionClosed(); content::BrowserContext* context_; // not owned. // Points to a proxy bound to the implementation in arc-keymasterd. - keymaster::mojom::CertStoreInstancePtr cert_store_proxy_; + mojo::Remote<keymaster::mojom::CertStoreInstance> cert_store_proxy_; std::unique_ptr<SecurityTokenOperationBridge> security_token_operation_; - std::unique_ptr<mojo::Binding<mojom::CertStoreHost>> binding_; + std::unique_ptr<mojo::Receiver<mojom::CertStoreHost>> receiver_; base::WeakPtrFactory<CertStoreBridge> weak_ptr_factory_; };
diff --git a/chrome/browser/chromeos/extensions/login_screen/OWNERS b/chrome/browser/chromeos/extensions/login_screen/OWNERS index 423efca..fc0c3ac 100644 --- a/chrome/browser/chromeos/extensions/login_screen/OWNERS +++ b/chrome/browser/chromeos/extensions/login_screen/OWNERS
@@ -1,3 +1,2 @@ hendrich@chromium.org jityao@google.com -voit@google.com
diff --git a/chrome/browser/chromeos/extensions/login_screen/login/login_apitest.cc b/chrome/browser/chromeos/extensions/login_screen/login/login_apitest.cc index d8bd524..e9eaefa 100644 --- a/chrome/browser/chromeos/extensions/login_screen/login/login_apitest.cc +++ b/chrome/browser/chromeos/extensions/login_screen/login/login_apitest.cc
@@ -462,8 +462,9 @@ kUnlockManagedGuestSessionNotManagedGuestSession); } +// TODO(https://crbug.com/1075511) Flaky test. IN_PROC_BROWSER_TEST_F(LoginApitestWithEnterpriseUser, - LockManagedGuestSessionNotManagedGuestSession) { + DISABLED_LockManagedGuestSessionNotManagedGuestSession) { LoginUser(); SetUpTestListeners(); SetUpInSessionExtension();
diff --git a/chrome/browser/chromeos/login/saml/OWNERS b/chrome/browser/chromeos/login/saml/OWNERS index b478ae4e..de3286e 100644 --- a/chrome/browser/chromeos/login/saml/OWNERS +++ b/chrome/browser/chromeos/login/saml/OWNERS
@@ -2,5 +2,4 @@ xiyuan@chromium.org # (in CET) -olsen@chromium.org rsorokin@chromium.org
diff --git a/chrome/browser/chromeos/service_sandbox_type.h b/chrome/browser/chromeos/service_sandbox_type.h index 1edd0eeb..f1703d03 100644 --- a/chrome/browser/chromeos/service_sandbox_type.h +++ b/chrome/browser/chromeos/service_sandbox_type.h
@@ -23,7 +23,7 @@ } // namespace chromeos template <> -content::SandboxType +inline content::SandboxType content::GetServiceSandboxType<chromeos::ime::mojom::InputEngineManager>() { if (chromeos::features::IsImeSandboxEnabled()) return content::SandboxType::kIme; @@ -31,4 +31,19 @@ return content::SandboxType::kUtility; } +// chromeos::tts::mojom::TtsService +namespace chromeos { +namespace tts { +namespace mojom { +class TtsService; +} // namespace mojom +} // namespace tts +} // namespace chromeos + +template <> +inline content::SandboxType +content::GetServiceSandboxType<chromeos::tts::mojom::TtsService>() { + return content::SandboxType::kTts; +} + #endif // CHROME_BROWSER_CHROMEOS_SERVICE_SANDBOX_TYPE_H_
diff --git a/chrome/browser/download/android/BUILD.gn b/chrome/browser/download/android/BUILD.gn index e6d547d..acad436 100644 --- a/chrome/browser/download/android/BUILD.gn +++ b/chrome/browser/download/android/BUILD.gn
@@ -22,6 +22,8 @@ "java/src/org/chromium/chrome/browser/download/MediaStoreHelper.java", "java/src/org/chromium/chrome/browser/download/MimeUtils.java", "java/src/org/chromium/chrome/browser/download/StringUtils.java", + "java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogChoice.java", + "java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogController.java", "java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogCoordinator.java", "java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogProperties.java", "java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogView.java",
diff --git a/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogChoice.java b/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogChoice.java new file mode 100644 index 0000000..e1ac5ee3 --- /dev/null +++ b/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogChoice.java
@@ -0,0 +1,27 @@ +// 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. + +package org.chromium.chrome.browser.download.dialogs; + +import androidx.annotation.IntDef; + +/** + * Defines the selection in download later dialog. + */ +@IntDef({DownloadLaterDialogChoice.DOWNLOAD_NOW, DownloadLaterDialogChoice.ON_WIFI, + DownloadLaterDialogChoice.DOWNLOAD_LATER}) +@interface DownloadLaterDialogChoice { + /** + * Download will be started right away. + */ + int DOWNLOAD_NOW = 0; + /** + * Download will be started only on WIFI. + */ + int ON_WIFI = 1; + /** + * Download will be started in the future.. + */ + int DOWNLOAD_LATER = 2; +}
diff --git a/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogController.java b/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogController.java new file mode 100644 index 0000000..9be3c41 --- /dev/null +++ b/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogController.java
@@ -0,0 +1,16 @@ +// 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. + +package org.chromium.chrome.browser.download.dialogs; + +/** + * Receives events from download later dialog. + */ +public interface DownloadLaterDialogController { + /** + * Called when the selection changed in the download later dialog. + * @param choice The selection of the download time in the download later dialog. + */ + void onChoiceChanged(@DownloadLaterDialogChoice int choice); +}
diff --git a/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogCoordinator.java b/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogCoordinator.java index 564a3b6..e5d4963 100644 --- a/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogCoordinator.java +++ b/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogCoordinator.java
@@ -24,28 +24,30 @@ private final DownloadLaterDialogView mCustomView; private final ModalDialogManager mModalDialogManager; private final PropertyModel mDialogModel; - private final ModalDialogProperties.Controller mController; private final PropertyModelChangeProcessor<PropertyModel, DownloadLaterDialogView, PropertyKey> mPropertyModelChangeProcessor; /** * The coordinator that bridges the download later diaog view logic to multiple data models. * @param activity The activity mainly to provide the {@link ModalDialogManager}. + * @param modalDialogManager Provides functionalities to access the dialog. + * @param model The data model for the download later dialog. + * @param modalDialogController The data model for modal dialog. */ public DownloadLaterDialogCoordinator(Activity activity, ModalDialogManager modalDialogManager, - ModalDialogProperties.Controller controller) { + PropertyModel model, ModalDialogProperties.Controller modalDialogController) { // Set up the download later UI MVC. - mDownloadLaterDialogModel = new PropertyModel(DownloadLaterDialogProperties.ALL_KEYS); + mDownloadLaterDialogModel = model; mCustomView = (DownloadLaterDialogView) LayoutInflater.from(activity).inflate( R.layout.download_later_dialog, null); + mCustomView.initialize(); mPropertyModelChangeProcessor = PropertyModelChangeProcessor.create(mDownloadLaterDialogModel, mCustomView, DownloadLaterDialogView.Binder::bind, true /*performInitialBind*/); // Set up the modal dialog. mModalDialogManager = modalDialogManager; - mController = controller; - mDialogModel = getModalDialogModel(activity); + mDialogModel = getModalDialogModel(activity, modalDialogController); } /** @@ -70,11 +72,11 @@ mPropertyModelChangeProcessor.destroy(); } - private PropertyModel getModalDialogModel(Context context) { - assert mController != null; + private PropertyModel getModalDialogModel( + Context context, ModalDialogProperties.Controller modalDialogController) { assert mCustomView != null; return new PropertyModel.Builder(ModalDialogProperties.ALL_KEYS) - .with(ModalDialogProperties.CONTROLLER, mController) + .with(ModalDialogProperties.CONTROLLER, modalDialogController) .with(ModalDialogProperties.CUSTOM_VIEW, mCustomView) .with(ModalDialogProperties.POSITIVE_BUTTON_TEXT, context.getResources(), R.string.duplicate_download_infobar_download_button)
diff --git a/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogProperties.java b/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogProperties.java index 33c2be8f..e6576a1 100644 --- a/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogProperties.java +++ b/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogProperties.java
@@ -11,9 +11,15 @@ * Contains all the properties for the download later dialog {@link PropertyModel}. */ public class DownloadLaterDialogProperties { - /** The selection to define when to start the download. */ - public static final PropertyModel.WritableIntPropertyKey DOWNLOAD_TIME_SELECTION = - new PropertyModel.WritableIntPropertyKey(); + /** The initial selection to define when to start the download. */ + public static final PropertyModel.ReadableIntPropertyKey DOWNLOAD_TIME_INITIAL_SELECTION = + new PropertyModel.ReadableIntPropertyKey(); - public static final PropertyKey[] ALL_KEYS = new PropertyKey[] {DOWNLOAD_TIME_SELECTION}; + /** The controller that receives events from the UI view layer. */ + public static final PropertyModel + .ReadableObjectPropertyKey<DownloadLaterDialogController> CONTROLLER = + new PropertyModel.ReadableObjectPropertyKey(); + + public static final PropertyKey[] ALL_KEYS = + new PropertyKey[] {DOWNLOAD_TIME_INITIAL_SELECTION, CONTROLLER}; }
diff --git a/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogView.java b/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogView.java index 2a063fc9..4add85f3 100644 --- a/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogView.java +++ b/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLaterDialogView.java
@@ -7,25 +7,88 @@ import android.content.Context; import android.util.AttributeSet; import android.widget.LinearLayout; +import android.widget.RadioGroup; import androidx.annotation.Nullable; +import org.chromium.chrome.browser.download.R; +import org.chromium.components.browser_ui.widget.RadioButtonWithDescription; import org.chromium.ui.modelutil.PropertyKey; import org.chromium.ui.modelutil.PropertyModel; /** * The custom view in the download later dialog. */ -public class DownloadLaterDialogView extends LinearLayout { +public class DownloadLaterDialogView + extends LinearLayout implements RadioGroup.OnCheckedChangeListener { + private RadioButtonWithDescription mDownloadNow; + private RadioButtonWithDescription mOnWifi; + private RadioButtonWithDescription mDownloadLater; + private RadioGroup mRadioGroup; + + private DownloadLaterDialogController mController; + /** * The view binder to propagate events from model to view. */ public static class Binder { public static void bind( - PropertyModel model, DownloadLaterDialogView view, PropertyKey propertyKey) {} + PropertyModel model, DownloadLaterDialogView view, PropertyKey propertyKey) { + if (propertyKey == DownloadLaterDialogProperties.DOWNLOAD_TIME_INITIAL_SELECTION) { + view.setChoice( + model.get(DownloadLaterDialogProperties.DOWNLOAD_TIME_INITIAL_SELECTION)); + } else if (propertyKey == DownloadLaterDialogProperties.CONTROLLER) { + view.setController(model.get(DownloadLaterDialogProperties.CONTROLLER)); + } + } } public DownloadLaterDialogView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } + + /** + * Initialize the internal objects. + */ + void initialize() { + mDownloadNow = (RadioButtonWithDescription) findViewById(R.id.download_now); + mOnWifi = (RadioButtonWithDescription) findViewById(R.id.on_wifi); + mDownloadLater = (RadioButtonWithDescription) findViewById(R.id.choose_date_time); + mRadioGroup = (RadioGroup) findViewById(R.id.radio_button_layout); + mRadioGroup.setOnCheckedChangeListener(this); + } + + void setChoice(@DownloadLaterDialogChoice int choice) { + switch (choice) { + case DownloadLaterDialogChoice.DOWNLOAD_NOW: + mDownloadNow.setChecked(true); + break; + case DownloadLaterDialogChoice.ON_WIFI: + mOnWifi.setChecked(true); + break; + case DownloadLaterDialogChoice.DOWNLOAD_LATER: + mDownloadLater.setChecked(true); + break; + } + } + + void setController(DownloadLaterDialogController controller) { + mController = controller; + } + + // RadioGroup.OnCheckedChangeListener overrides. + @Override + public void onCheckedChanged(RadioGroup radioGroup, int index) { + @DownloadLaterDialogChoice + int choice = DownloadLaterDialogChoice.DOWNLOAD_NOW; + if (mDownloadNow.isChecked()) { + choice = DownloadLaterDialogChoice.DOWNLOAD_NOW; + } else if (mOnWifi.isChecked()) { + choice = DownloadLaterDialogChoice.ON_WIFI; + } else if (mDownloadLater.isChecked()) { + choice = DownloadLaterDialogChoice.DOWNLOAD_LATER; + } + + if (mController != null) mController.onChoiceChanged(choice); + } }
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index dbb4454a..f14ca91 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn
@@ -1004,10 +1004,11 @@ "//ash/keyboard/ui:resources_grit_grit", "//ash/public/cpp", "//chrome/browser/chromeos/crostini:crostini_installer_types_mojom", - "//chrome/browser/resources/chromeos/camera:chrome_camera_app", "//chrome/browser/ui/webui/settings/chromeos/constants:mojom", "//chromeos", "//chromeos/attestation", + "//chromeos/components/camera_app_ui", + "//chromeos/components/camera_app_ui:mojo_bindings", "//chromeos/components/proximity_auth", "//chromeos/constants", "//chromeos/cryptohome", @@ -1023,11 +1024,11 @@ "//chromeos/services/machine_learning/public/cpp", "//chromeos/services/machine_learning/public/mojom", "//chromeos/services/media_perception/public/mojom", + "//chromeos/services/tts/public/mojom", "//chromeos/settings", "//chromeos/system", "//chromeos/tpm", "//components/arc", - "//components/chromeos_camera:camera_app_helper", "//components/constrained_window", "//components/drive", "//components/user_manager",
diff --git a/chrome/browser/extensions/chrome_extensions_browser_interface_binders.cc b/chrome/browser/extensions/chrome_extensions_browser_interface_binders.cc index 72c17d17b..54c74ff 100644 --- a/chrome/browser/extensions/chrome_extensions_browser_interface_binders.cc +++ b/chrome/browser/extensions/chrome_extensions_browser_interface_binders.cc
@@ -17,10 +17,14 @@ #include "extensions/common/permissions/permissions_data.h" #if defined(OS_CHROMEOS) +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/speech/extension_api/tts_engine_extension_observer.h" #include "chrome/common/extensions/extension_constants.h" +#include "chromeos/components/camera_app_ui/camera_app_helper.mojom.h" +#include "chromeos/components/camera_app_ui/camera_app_helper_impl.h" #include "chromeos/services/media_perception/public/mojom/media_perception.mojom.h" +#include "chromeos/services/tts/public/mojom/tts_service.mojom.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" -#include "components/chromeos_camera/camera_app_helper_impl.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/media_device_id.h" #include "content/public/browser/video_capture_service.h" @@ -127,6 +131,14 @@ mojo::MakeSelfOwnedReceiver(std::move(camera_app_helper), std::move(receiver)); } + +void BindTtsStream( + content::RenderFrameHost* render_frame_host, + mojo::PendingReceiver<chromeos::tts::mojom::TtsStream> receiver) { + TtsEngineExtensionObserver::GetInstance( + Profile::FromBrowserContext(render_frame_host->GetBrowserContext())) + ->BindTtsStream(std::move(receiver)); +} #endif } // namespace @@ -180,6 +192,11 @@ binder_map->Add<chromeos_camera::mojom::CameraAppHelper>( base::BindRepeating(&ConnectToCameraAppHelper)); } + + if (extension->id() == extension_misc::kGoogleSpeechSynthesisExtensionId) { + binder_map->Add<chromeos::tts::mojom::TtsStream>( + base::BindRepeating(&BindTtsStream)); + } #endif }
diff --git a/chrome/browser/favicon/content_favicon_driver_browsertest.cc b/chrome/browser/favicon/content_favicon_driver_browsertest.cc index 70b8de3..a9cd8b1e 100644 --- a/chrome/browser/favicon/content_favicon_driver_browsertest.cc +++ b/chrome/browser/favicon/content_favicon_driver_browsertest.cc
@@ -119,6 +119,7 @@ private: // content::WebContentsObserver: void DidUpdateFaviconURL( + content::RenderFrameHost* rfh, const std::vector<blink::mojom::FaviconURLPtr>& candidates) override { TestUrlAndTitle(); } @@ -194,6 +195,7 @@ } void DidUpdateFaviconURL( + content::RenderFrameHost* rfh, const std::vector<blink::mojom::FaviconURLPtr>& candidates) override { last_favicon_candidates_.clear(); for (const auto& candidate : candidates)
diff --git a/chrome/browser/installable/installable_manager.cc b/chrome/browser/installable/installable_manager.cc index a30f7f1..bd5cdae 100644 --- a/chrome/browser/installable/installable_manager.cc +++ b/chrome/browser/installable/installable_manager.cc
@@ -818,6 +818,7 @@ } void InstallableManager::DidUpdateWebManifestURL( + content::RenderFrameHost* rfh, const base::Optional<GURL>& manifest_url) { // A change in the manifest URL invalidates our entire internal state. Reset();
diff --git a/chrome/browser/installable/installable_manager.h b/chrome/browser/installable/installable_manager.h index 6b7f6c7..ad86644 100644 --- a/chrome/browser/installable/installable_manager.h +++ b/chrome/browser/installable/installable_manager.h
@@ -228,6 +228,7 @@ // content::WebContentsObserver overrides void DidFinishNavigation(content::NavigationHandle* handle) override; void DidUpdateWebManifestURL( + content::RenderFrameHost* rfh, const base::Optional<GURL>& manifest_url) override; void WebContentsDestroyed() override;
diff --git a/chrome/browser/resource_coordinator/local_site_characteristics_webcontents_observer.cc b/chrome/browser/resource_coordinator/local_site_characteristics_webcontents_observer.cc index b4c3fae..3a4a243 100644 --- a/chrome/browser/resource_coordinator/local_site_characteristics_webcontents_observer.cc +++ b/chrome/browser/resource_coordinator/local_site_characteristics_webcontents_observer.cc
@@ -159,6 +159,7 @@ } void LocalSiteCharacteristicsWebContentsObserver::DidUpdateFaviconURL( + content::RenderFrameHost* rfh, const std::vector<blink::mojom::FaviconURLPtr>& candidates) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/chrome/browser/resource_coordinator/local_site_characteristics_webcontents_observer.h b/chrome/browser/resource_coordinator/local_site_characteristics_webcontents_observer.h index 4f6523d..16b6a78 100644 --- a/chrome/browser/resource_coordinator/local_site_characteristics_webcontents_observer.h +++ b/chrome/browser/resource_coordinator/local_site_characteristics_webcontents_observer.h
@@ -38,6 +38,7 @@ content::NavigationHandle* navigation_handle) override; void TitleWasSet(content::NavigationEntry* entry) override; void DidUpdateFaviconURL( + content::RenderFrameHost* rfh, const std::vector<blink::mojom::FaviconURLPtr>& candidates) override; void OnAudioStateChanged(bool audible) override;
diff --git a/chrome/browser/resource_coordinator/local_site_characteristics_webcontents_observer_unittest.cc b/chrome/browser/resource_coordinator/local_site_characteristics_webcontents_observer_unittest.cc index 0f270af9a8..a8ddd6b 100644 --- a/chrome/browser/resource_coordinator/local_site_characteristics_webcontents_observer_unittest.cc +++ b/chrome/browser/resource_coordinator/local_site_characteristics_webcontents_observer_unittest.cc
@@ -181,7 +181,8 @@ // Send dummy events to simulate the initial title/favicon update (as these // are ignored). - observer()->DidUpdateFaviconURL(std::vector<blink::mojom::FaviconURLPtr>()); + observer()->DidUpdateFaviconURL(web_contents()->GetMainFrame(), + std::vector<blink::mojom::FaviconURLPtr>()); observer()->TitleWasSet(nullptr); EXPECT_CALL(*mock_writer, NotifySiteLoaded()); @@ -198,7 +199,7 @@ ::testing::Mock::VerifyAndClear(mock_writer); // Ensure that no event gets forwarded if the tab is not in background. - observer()->DidUpdateFaviconURL({}); + observer()->DidUpdateFaviconURL(web_contents()->GetMainFrame(), {}); ::testing::Mock::VerifyAndClear(mock_writer); observer()->TitleWasSet(nullptr); ::testing::Mock::VerifyAndClear(mock_writer); @@ -212,14 +213,14 @@ ::testing::Mock::VerifyAndClear(mock_writer); // Title and Favicon should be ignored during the post-loading grace period. - observer()->DidUpdateFaviconURL({}); + observer()->DidUpdateFaviconURL(web_contents()->GetMainFrame(), {}); observer()->TitleWasSet(nullptr); ::testing::Mock::VerifyAndClear(mock_writer); test_clock().Advance(kTitleOrFaviconChangePostLoadGracePeriod); EXPECT_CALL(*mock_writer, NotifyUpdatesFaviconInBackground()); - observer()->DidUpdateFaviconURL({}); + observer()->DidUpdateFaviconURL(web_contents()->GetMainFrame(), {}); ::testing::Mock::VerifyAndClear(mock_writer); EXPECT_CALL(*mock_writer, NotifyUpdatesTitleInBackground()); observer()->TitleWasSet(nullptr); @@ -238,7 +239,7 @@ // These events should be ignored during the post-background grace period. observer()->OnAudioStateChanged(true); - observer()->DidUpdateFaviconURL({}); + observer()->DidUpdateFaviconURL(web_contents()->GetMainFrame(), {}); observer()->TitleWasSet(nullptr); ::testing::Mock::VerifyAndClear(mock_writer); @@ -247,7 +248,7 @@ EXPECT_CALL(*mock_writer, NotifyUpdatesFaviconInBackground()); EXPECT_CALL(*mock_writer, NotifyUpdatesTitleInBackground()); observer()->OnAudioStateChanged(true); - observer()->DidUpdateFaviconURL({}); + observer()->DidUpdateFaviconURL(web_contents()->GetMainFrame(), {}); observer()->TitleWasSet(nullptr); ::testing::Mock::VerifyAndClear(mock_writer); @@ -260,7 +261,7 @@ // Send dummy events to simulate the initial title/favicon update (as these // are ignored). - observer()->DidUpdateFaviconURL({}); + observer()->DidUpdateFaviconURL(web_contents()->GetMainFrame(), {}); observer()->TitleWasSet(nullptr); TabLoadTracker::Get()->TransitionStateForTesting(web_contents(), @@ -272,7 +273,7 @@ web_contents()->WasHidden(); ::testing::Mock::VerifyAndClear(mock_writer); - observer()->DidUpdateFaviconURL({}); + observer()->DidUpdateFaviconURL(web_contents()->GetMainFrame(), {}); ::testing::Mock::VerifyAndClear(mock_writer); observer()->TitleWasSet(nullptr); ::testing::Mock::VerifyAndClear(mock_writer);
diff --git a/chrome/browser/resources/chromeos/BUILD.gn b/chrome/browser/resources/chromeos/BUILD.gn index e7537c8..32e0561ad 100644 --- a/chrome/browser/resources/chromeos/BUILD.gn +++ b/chrome/browser/resources/chromeos/BUILD.gn
@@ -54,29 +54,6 @@ ] } -grit("camera_resources") { - source = "camera/camera_resources.grd" - - defines = chrome_grit_defines - outputs = [ - "grit/camera_resources.h", - "grit/camera_resources_map.cc", - "grit/camera_resources_map.h", - "camera_resources.pak", - ] - output_dir = "$root_gen_dir/chrome" - - deps = [ - "//components/arc/mojom:camera_intent_js", - "//media/capture/video/chromeos/mojom:cros_camera_js", - ] - - grit_flags = [ - "-E", - "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), - ] -} - group("closure_compile") { deps = [ "accessibility/braille_ime:closure_compile", @@ -84,7 +61,6 @@ "accessibility/switch_access:closure_compile", "add_supervision:closure_compile", "bluetooth_pairing_dialog:closure_compile", - "camera/src/js:closure_compile", "crostini_installer:closure_compile", "edu_login:closure_compile", "emulator:closure_compile",
diff --git a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_hy.xtb b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_hy.xtb index c5629b14..e29056e 100644 --- a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_hy.xtb +++ b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_hy.xtb
@@ -380,7 +380,7 @@ <translation id="3897092660631435901">Ընտրացանկ</translation> <translation id="3907138069015388678">lstgrd</translation> <translation id="3909320334364316587">6-րդ մակարդակի նախորդ վերնագիրը</translation> -<translation id="3914173277599553213">Անհրաժեշտ</translation> +<translation id="3914173277599553213">Պարտադիր է</translation> <translation id="3914732343065571127">ChromeVox-ի հրահանգներ</translation> <translation id="3930383913623796990">Գարնանային կանաչ</translation> <translation id="3930498801443296724">Մեջբերում</translation>
diff --git a/chrome/browser/resources/chromeos/accessibility/switch_access/history.js b/chrome/browser/resources/chromeos/accessibility/switch_access/history.js index dc1cddf..34d8f11 100644 --- a/chrome/browser/resources/chromeos/accessibility/switch_access/history.js +++ b/chrome/browser/resources/chromeos/accessibility/switch_access/history.js
@@ -33,6 +33,7 @@ * automation node. * Erases the current history and replaces with the new data. * @param {!AutomationNode} node + * @return {boolean} Whether the history was rebuilt from the given node. */ buildFromAutomationNode(node) { // Create a list of ancestors. @@ -42,12 +43,18 @@ node = node.parent; } - this.dataStack_ = []; - let group = DesktopNode.build(NavigationManager.desktopNode); + let group = DesktopNode.build(ancestorStack.pop()); + const firstAncestor = ancestorStack[ancestorStack.length - 1]; + if (!SwitchAccessPredicate.isInterestingSubtree(firstAncestor)) { + // If the topmost ancestor (other than the desktop) is entirely + // uninteresting, we leave the history as is. + return false; + } + + const newDataStack = []; while (ancestorStack.length > 0) { const candidate = ancestorStack.pop(); - if (candidate.role === chrome.automation.RoleType.DESKTOP || - !SwitchAccessPredicate.isInteresting(candidate, group)) { + if (!SwitchAccessPredicate.isInteresting(candidate, group)) { continue; } @@ -55,13 +62,19 @@ if (!focus) { continue; } - this.dataStack_.push(new FocusData(group, focus)); + newDataStack.push(new FocusData(group, focus)); group = focus.asRootNode(); if (!group) { break; } } + + if (newDataStack.length === 0) { + return false; + } + this.dataStack_ = newDataStack; + return true; } /**
diff --git a/chrome/browser/resources/chromeos/accessibility/switch_access/navigation_manager.js b/chrome/browser/resources/chromeos/accessibility/switch_access/navigation_manager.js index 3162bbd..fbd2f34 100644 --- a/chrome/browser/resources/chromeos/accessibility/switch_access/navigation_manager.js +++ b/chrome/browser/resources/chromeos/accessibility/switch_access/navigation_manager.js
@@ -311,10 +311,9 @@ */ moveTo_(automationNode) { MenuManager.exit(); - this.history_.buildFromAutomationNode(automationNode); - if (!this.history_.peek().focus.isEquivalentTo(automationNode)) { + if (this.history_.buildFromAutomationNode(automationNode)) { + this.restoreFromHistory_(); } - this.restoreFromHistory_(); } /**
diff --git a/chrome/browser/resources/chromeos/camera/OWNERS b/chrome/browser/resources/chromeos/camera/OWNERS deleted file mode 100644 index a879800..0000000 --- a/chrome/browser/resources/chromeos/camera/OWNERS +++ /dev/null
@@ -1,6 +0,0 @@ -henryhsu@chromium.org -inker@chromium.org -jcliang@chromium.org -shik@chromium.org -wtlee@chromium.org -yuli@chromium.org
diff --git a/chrome/browser/resources/chromeos/password_change/OWNERS b/chrome/browser/resources/chromeos/password_change/OWNERS index e7edf2e6..a8183f4 100644 --- a/chrome/browser/resources/chromeos/password_change/OWNERS +++ b/chrome/browser/resources/chromeos/password_change/OWNERS
@@ -1,2 +1 @@ -olsen@chromium.org rsorokin@chromium.org
diff --git a/chrome/browser/resources/settings/autofill_page/passwords_section.html b/chrome/browser/resources/settings/autofill_page/passwords_section.html index a6924f1..89c6503 100644 --- a/chrome/browser/resources/settings/autofill_page/passwords_section.html +++ b/chrome/browser/resources/settings/autofill_page/passwords_section.html
@@ -53,6 +53,20 @@ margin-inline-end: 16px; width: 40px; } + + #devicePasswordsLinkIcon { + border-color: gray; + border-radius: 20px; + border-style: solid; + border-width: 1px; + height: 19px; + margin-inline-end: 16px; + padding-bottom: 10px; + padding-inline-end: 8px; + padding-inline-start: 8px; + padding-top: 11px; + width: 24px; + } </style> <settings-toggle-button id="passwordToggle" aria-label="$i18n{passwords}" no-extension-indicator @@ -148,23 +162,40 @@ </if> should-show-storage-details="[[shouldShowStorageDetails_]]"> <div slot="body" class="list-frame"> - <div class="cr-row first two-line list-item" - hidden$="[[!eligibleForAccountStorage_]]" + <div hidden$="[[!eligibleForAccountStorage_]]" id="accountStorageButtonsContainer"> - <div id="profileIcon" style="background-image: [[profileIcon_]]"> + <div class="cr-row first two-line list-item"> + <div id="profileIcon" style="background-image: [[profileIcon_]]"> + </div> + <div class="flex cr-padded-text"> + <div id="accountStorageBody"> [[accountStorageToggleBody_]] </div> + <div id="accountEmail" class="secondary">[[profileEmail_]]</div> + </div> + <cr-button on-click="onOptIn_" id="optInToAccountStorageButton" + hidden$="[[isOptedInForAccountStorage_]]"> + $i18n{optInAccountStorageLabel} + </cr-button> + <cr-button on-click="onOptOut_" id="optOutOfAccountStorageButton" + hidden$="[[!isOptedInForAccountStorage_]]"> + $i18n{optOutAccountStorageLabel} + </cr-button> </div> - <div class="flex cr-padded-text"> - <div id="accountStorageBody"> [[accountStorageToggleBody_]] </div> - <div id="accountEmail" class="secondary">[[profileEmail_]]</div> + <div id="devicePasswordsLink" class="cr-row first two-line list-item" + hidden$="[[!shouldShowDevicePasswordsLink_]]"> + <iron-icon id="devicePasswordsLinkIcon" icon="cr:computer"> + </iron-icon> + <div> + <div id="devicePasswordsLinkLabel"> + [[devicePasswordsLinkLabel_]] + </div> + <div class="cr-secondary-text"> + $i18n{devicePasswordsLinkSubLabel} + </div> + </div> + <cr-icon-button on-click="onDevicePasswordsLinkClicked_" + iron-icon="cr:arrow-right" > + </cr-icon-button> </div> - <cr-button on-click="onOptIn_" id="optInToAccountStorageButton" - hidden$="[[isOptedInForAccountStorage_]]"> - $i18n{optInAccountStorageLabel} - </cr-button> - <cr-button on-click="onOptOut_" id="optOutOfAccountStorageButton" - hidden$="[[!isOptedInForAccountStorage_]]"> - $i18n{optOutAccountStorageLabel} - </cr-button> </div> <div id="savedPasswordsHeaders" class="list-item column-header" hidden$="[[!hasSavedPasswords_]]" aria-hidden="true">
diff --git a/chrome/browser/resources/settings/autofill_page/passwords_section.js b/chrome/browser/resources/settings/autofill_page/passwords_section.js index bea137b..0373fb2 100644 --- a/chrome/browser/resources/settings/autofill_page/passwords_section.js +++ b/chrome/browser/resources/settings/autofill_page/passwords_section.js
@@ -155,6 +155,16 @@ 'computeHasSavedPasswords_(savedPasswords, savedPasswords.splices)', }, + /** + * Used to decide the text on the button leading to 'device passwords' page. + * @private + */ + numberOfDevicePasswords_: { + type: Number, + computed: 'computeNumberOfDevicePasswords_(savedPasswords, ' + + 'savedPasswords.splices)', + }, + /** @private */ hasPasswordExceptions_: { type: Boolean, @@ -179,6 +189,18 @@ 'eligibleForAccountStorage_, isOptedInForAccountStorage_)', }, + /** + * Whether the entry point leading to the device passwords page should be + * shown for a user who is already eligible for account storage. + * @private + */ + shouldShowDevicePasswordsLink_: { + type: Boolean, + value: false, + computed: 'computeShouldShowDevicePasswordsLink_(' + + 'isOptedInForAccountStorage_, numberOfDevicePasswords_)', + }, + /** @private */ hasLeakedCredentials_: { type: Boolean, @@ -216,6 +238,13 @@ }, /** @private */ + devicePasswordsLinkLabel_: { + type: String, + value: '', + computed: 'computeDevicePasswordsLinkLabel_(numberOfDevicePasswords_)', + }, + + /** @private */ profileEmail_: { type: String, value: '', @@ -382,6 +411,13 @@ PasswordManagerProxy.PasswordCheckReferrer.PASSWORD_SETTINGS); }, + /** + * Shows the 'device passwords' page. + */ + onDevicePasswordsLinkClicked_() { + Router.getInstance().navigateTo(routes.DEVICE_PASSWORDS); + }, + // <if expr="chromeos"> /** * When this event fired, it means that the password-prompt-dialog succeeded @@ -444,6 +480,14 @@ }, /** + * @return {number} + * @private + */ + computeNumberOfDevicePasswords_() { + return this.savedPasswords.filter(p => p.isPresentOnDevice()).length; + }, + + /** * @return {boolean} * @private */ @@ -472,6 +516,15 @@ * @return {boolean} * @private */ + computeShouldShowDevicePasswordsLink_() { + return this.isOptedInForAccountStorage_ && + (this.numberOfDevicePasswords_ > 0); + }, + + /** + * @return {boolean} + * @private + */ computeHidePasswordsLink_() { return !!this.syncStatus_ && !!this.syncStatus_.signedIn && !!this.syncPrefs_ && !!this.syncPrefs_.encryptAllData; @@ -634,6 +687,17 @@ }, /** + * @private + * @return {string} + */ + computeDevicePasswordsLinkLabel_() { + return this.numberOfDevicePasswords_ === 1 ? + this.i18n('devicePasswordsLinkLabelSingular') : + this.i18n( + 'devicePasswordsLinkLabelPlural', this.numberOfDevicePasswords_); + }, + + /** * Return the first available stored account. This is useful when trying to * figure out the account logged into the content area which seems to always * be first even if multiple accounts are available.
diff --git a/chrome/browser/speech/extension_api/tts_engine_extension_observer.cc b/chrome/browser/speech/extension_api/tts_engine_extension_observer.cc index 949f9e83..a5095b6db 100644 --- a/chrome/browser/speech/extension_api/tts_engine_extension_observer.cc +++ b/chrome/browser/speech/extension_api/tts_engine_extension_observer.cc
@@ -14,6 +14,7 @@ #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "components/keyed_service/core/keyed_service.h" +#include "content/public/browser/service_process_host.h" #include "content/public/browser/tts_controller.h" #include "extensions/browser/event_router.h" #include "extensions/browser/event_router_factory.h" @@ -133,6 +134,14 @@ return engine_extension_ids_; } +#if defined(OS_CHROMEOS) +void TtsEngineExtensionObserver::BindTtsStream( + mojo::PendingReceiver<chromeos::tts::mojom::TtsStream> receiver) { + if (tts_service_) + tts_service_->BindTtsStream(std::move(receiver)); +} +#endif // defined(OS_CHROMEOS) + void TtsEngineExtensionObserver::Shutdown() { extensions::EventRouter::Get(profile_)->UnregisterObserver(this); } @@ -170,10 +179,10 @@ engine_extension_ids_.insert(extension->id()); #if defined(OS_CHROMEOS) - if (chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled() && - // This check is important because we only ever want to increment once - // when this extension loads. - extension->id() == extension_misc::kGoogleSpeechSynthesisExtensionId) { + if (extension->id() != extension_misc::kGoogleSpeechSynthesisExtensionId) + return; + + if (chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled()) { UpdateGoogleSpeechSynthesisKeepAliveCount(browser_context, true /* increment */); } @@ -188,6 +197,12 @@ erase_count += engine_extension_ids_.erase(extension->id()); if (erase_count > 0) content::TtsController::GetInstance()->VoicesChanged(); + +#if defined(OS_CHROMEOS) + if (tts_service_ && + extension->id() == extension_misc::kGoogleSpeechSynthesisExtensionId) + tts_service_.reset(); +#endif // defined(OS_CHROMEOS) } #if defined(OS_CHROMEOS)
diff --git a/chrome/browser/speech/extension_api/tts_engine_extension_observer.h b/chrome/browser/speech/extension_api/tts_engine_extension_observer.h index 45c1f20..4066562 100644 --- a/chrome/browser/speech/extension_api/tts_engine_extension_observer.h +++ b/chrome/browser/speech/extension_api/tts_engine_extension_observer.h
@@ -14,6 +14,7 @@ #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" +#include "chromeos/services/tts/public/mojom/tts_service.mojom.h" #endif class Profile; @@ -32,6 +33,11 @@ Profile* profile() { return profile_; } +#if defined(OS_CHROMEOS) + void BindTtsStream( + mojo::PendingReceiver<chromeos::tts::mojom::TtsStream> receiver); +#endif // defined(OS_CHROMEOS) + // Implementation of KeyedService. void Shutdown() override; @@ -67,6 +73,8 @@ #if defined(OS_CHROMEOS) std::unique_ptr<chromeos::AccessibilityStatusSubscription> accessibility_status_subscription_; + + mojo::Remote<chromeos::tts::mojom::TtsService> tts_service_; #endif friend class TtsEngineExtensionObserverFactory;
diff --git a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/EmptyTabObserver.java b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/EmptyTabObserver.java index 896def65..210203d 100644 --- a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/EmptyTabObserver.java +++ b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/EmptyTabObserver.java
@@ -147,4 +147,7 @@ public void onBrowserControlsOffsetChanged(Tab tab, int topControlsOffsetY, int bottomControlsOffsetY, int contentOffsetY, int topControlsMinHeightOffsetY, int bottomControlsMinHeightOffsetY) {} + + @Override + public void onContentViewScrollingStateChanged(boolean scrolling) {} }
diff --git a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/TabObserver.java b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/TabObserver.java index f4145a3..ff92aa2 100644 --- a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/TabObserver.java +++ b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/TabObserver.java
@@ -337,4 +337,10 @@ void onBrowserControlsOffsetChanged(Tab tab, int topControlsOffsetY, int bottomControlsOffsetY, int contentOffsetY, int topControlsMinHeightOffsetY, int bottomControlsMinHeightOffsetY); + + /** + * Called when scrolling state of Tab's content view changes. + * @param scrolling {@code true} if scrolling started; {@code false} if stopped. + */ + void onContentViewScrollingStateChanged(boolean scrolling); }
diff --git a/chrome/browser/themes/theme_helper_win.cc b/chrome/browser/themes/theme_helper_win.cc index 531318f9..6aa2b3dea 100644 --- a/chrome/browser/themes/theme_helper_win.cc +++ b/chrome/browser/themes/theme_helper_win.cc
@@ -71,8 +71,18 @@ } if (DwmColorsAllowed(theme_supplier)) { - if (id == ThemeProperties::COLOR_ACCENT_BORDER) - return dwm_accent_border_color_; + // In Windows 10, native inactive borders are #555555 with 50% alpha. + // Prior to version 1809, native active borders use the accent color. + // In version 1809 and following, the active border is #262626 with 66% + // alpha unless the accent color is also used for the frame. + if (id == ThemeProperties::COLOR_ACCENT_BORDER_ACTIVE) { + return (base::win::GetVersion() >= base::win::Version::WIN10_RS5 && + !dwm_frame_color_) + ? SkColorSetARGB(0xa8, 0x26, 0x26, 0x26) + : dwm_accent_border_color_; + } + if (id == ThemeProperties::COLOR_ACCENT_BORDER_INACTIVE) + return SkColorSetARGB(0x80, 0x55, 0x55, 0x55); // When we're custom-drawing the titlebar we want to use either the colors // we calculated in OnDwmKeyUpdated() or the default colors. When we're not
diff --git a/chrome/browser/themes/theme_properties.h b/chrome/browser/themes/theme_properties.h index d0116b6a..0e8516b0 100644 --- a/chrome/browser/themes/theme_properties.h +++ b/chrome/browser/themes/theme_properties.h
@@ -203,8 +203,9 @@ COLOR_NTP_SHORTCUT, #if defined(OS_WIN) - // The color of the 1px border around the window on Windows 10. - COLOR_ACCENT_BORDER, + // The colors of the 1px border around the window on Windows 10. + COLOR_ACCENT_BORDER_ACTIVE, + COLOR_ACCENT_BORDER_INACTIVE, #endif // OS_WIN SHOULD_FILL_BACKGROUND_TAB_COLOR,
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index b94e5b2..13bd740 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -1756,8 +1756,6 @@ "webui/chromeos/bluetooth_dialog_localized_strings_provider.h", "webui/chromeos/bluetooth_pairing_dialog.cc", "webui/chromeos/bluetooth_pairing_dialog.h", - "webui/chromeos/camera/camera_ui.cc", - "webui/chromeos/camera/camera_ui.h", "webui/chromeos/cellular_setup/cellular_setup_dialog.cc", "webui/chromeos/cellular_setup/cellular_setup_dialog.h", "webui/chromeos/cellular_setup/cellular_setup_dialog_launcher.cc", @@ -2120,7 +2118,6 @@ "//chrome/browser/chromeos", "//chrome/browser/chromeos:backdrop_wallpaper_proto", "//chrome/browser/chromeos/net/network_health/public/mojom:mojom", - "//chrome/browser/resources/chromeos:camera_resources", "//chrome/browser/resources/chromeos:network_health_resources", "//chrome/browser/ui/webui/app_management:mojo_bindings", "//chrome/browser/ui/webui/chromeos/add_supervision:mojo_bindings", @@ -2134,6 +2131,7 @@ "//chromeos/assistant:buildflags", "//chromeos/audio", "//chromeos/components/account_manager", + "//chromeos/components/camera_app_ui", "//chromeos/components/help_app_ui", "//chromeos/components/media_app_ui", "//chromeos/components/multidevice",
diff --git a/chrome/browser/ui/bookmarks/bookmark_drag_drop.cc b/chrome/browser/ui/bookmarks/bookmark_drag_drop.cc index dc10b50..1e6cdf08 100644 --- a/chrome/browser/ui/bookmarks/bookmark_drag_drop.cc +++ b/chrome/browser/ui/bookmarks/bookmark_drag_drop.cc
@@ -68,7 +68,6 @@ } return ui::DragDropTypes::DRAG_NONE; } - RecordBookmarksAdded(profile); // Dropping a folder from different profile. Always accept. bookmarks::CloneBookmarkNode(model, data.elements, parent_node, index, true); return ui::DragDropTypes::DRAG_COPY;
diff --git a/chrome/browser/ui/bookmarks/bookmark_stats.cc b/chrome/browser/ui/bookmarks/bookmark_stats.cc index 2d9f2b1..e720b2a 100644 --- a/chrome/browser/ui/bookmarks/bookmark_stats.cc +++ b/chrome/browser/ui/bookmarks/bookmark_stats.cc
@@ -3,7 +3,6 @@ // found in the LICENSE file. #include "chrome/browser/ui/bookmarks/bookmark_stats.h" -#include "chrome/browser/profiles/profile.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" @@ -18,18 +17,10 @@ location == BOOKMARK_LAUNCH_LOCATION_BAR_SUBFOLDER; } -auto GetMetricProfile(const Profile* profile) { - DCHECK(profile); - DCHECK(profile->IsRegularProfile() || profile->IsIncognitoProfile()); - return profile->IsRegularProfile() - ? profile_metrics::BrowserProfileType::kRegular - : profile_metrics::BrowserProfileType::kIncognito; -} } // namespace -void RecordBookmarkLaunch(BookmarkLaunchLocation location, - profile_metrics::BrowserProfileType profile_type) { +void RecordBookmarkLaunch(BookmarkLaunchLocation location) { if (IsBookmarkBarLocation(location)) { base::RecordAction(base::UserMetricsAction("ClickedBookmarkBarURLButton")); } else if (location == BOOKMARK_LAUNCH_LOCATION_APP_MENU) { @@ -41,8 +32,6 @@ UMA_HISTOGRAM_ENUMERATION("Bookmarks.LaunchLocation", location, BOOKMARK_LAUNCH_LOCATION_LIMIT); - - UMA_HISTOGRAM_ENUMERATION("Bookmarks.UsageCountPerProfileType", profile_type); } void RecordBookmarkFolderLaunch(BookmarkLaunchLocation location) { @@ -63,19 +52,3 @@ base::UserMetricsAction("ClickedBookmarkBarAppsShortcutButton")); } } - -void RecordBookmarksAdded(const Profile* profile) { - profile_metrics::BrowserProfileType profile_type = GetMetricProfile(profile); - UMA_HISTOGRAM_ENUMERATION("Bookmarks.AddedPerProfileType", profile_type); -} - -void RecordBookmarkAllTabsWithTabsCount(const Profile* profile, int count) { - profile_metrics::BrowserProfileType profile_type = GetMetricProfile(profile); - if (profile_type == profile_metrics::BrowserProfileType::kRegular) { - UMA_HISTOGRAM_COUNTS_100("Bookmarks.BookmarkAllTabsWithTabsCount.Regular", - count); - } else { - UMA_HISTOGRAM_COUNTS_100("Bookmarks.BookmarkAllTabsWithTabsCount.Incognito", - count); - } -}
diff --git a/chrome/browser/ui/bookmarks/bookmark_stats.h b/chrome/browser/ui/bookmarks/bookmark_stats.h index 5a0ade9..e24a920 100644 --- a/chrome/browser/ui/bookmarks/bookmark_stats.h +++ b/chrome/browser/ui/bookmarks/bookmark_stats.h
@@ -5,10 +5,6 @@ #ifndef CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_STATS_H_ #define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_STATS_H_ -#include "components/profile_metrics/browser_profile_type.h" - -class Profile; - // This enum is used for the Bookmarks.EntryPoint histogram. // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. @@ -48,8 +44,7 @@ }; // Records the launch of a bookmark for UMA purposes. -void RecordBookmarkLaunch(BookmarkLaunchLocation location, - profile_metrics::BrowserProfileType profile_type); +void RecordBookmarkLaunch(BookmarkLaunchLocation location); // Records the user launching all bookmarks in a folder (via middle-click, etc.) // for UMA purposes. @@ -61,13 +56,4 @@ // Records the user opening the apps page for UMA purposes. void RecordBookmarkAppsPageOpen(BookmarkLaunchLocation location); -// Records the user adding a bookmark via star action, drag and drop, via -// Bookmark this tab... and Bookmark all tabs... buttons. For the Bookmark -// open tabs... the action is recorded only once and not as many times as -// count of tabs that were bookmarked. -void RecordBookmarksAdded(const Profile* profile); - -// Records the user bookmarking all tabs, along with the open tabs count. -void RecordBookmarkAllTabsWithTabsCount(const Profile* profile, int count); - #endif // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_STATS_H_
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc index 1f2c68d..27ec185 100644 --- a/chrome/browser/ui/browser_commands.cc +++ b/chrome/browser/ui/browser_commands.cc
@@ -985,9 +985,6 @@ // weird situations where the bubble is deleted as soon as it is shown. browser->window()->ShowBookmarkBubble(url, was_bookmarked_by_user); } - - if (!was_bookmarked_by_user && is_bookmarked_by_user) - RecordBookmarksAdded(browser->profile()); } bool CanBookmarkCurrentTab(const Browser* browser) { @@ -1001,10 +998,6 @@ void BookmarkAllTabs(Browser* browser) { base::RecordAction(UserMetricsAction("BookmarkAllTabs")); - RecordBookmarkAllTabsWithTabsCount(browser->profile(), - browser->tab_strip_model()->count()); - // We record the profile that invoked this option. - RecordBookmarksAdded(browser->profile()); chrome::ShowBookmarkAllTabsDialog(browser); }
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm index db13f0e..8a1ded0 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm
@@ -104,9 +104,7 @@ node->url(), Referrer(), disposition, ui::PAGE_TRANSITION_AUTO_BOOKMARK, false); browser->OpenURL(params); - RecordBookmarkLaunch( - BOOKMARK_LAUNCH_LOCATION_TOP_MENU, - ProfileMetrics::GetBrowserProfileType(_bridge->GetProfile())); + RecordBookmarkLaunch(BOOKMARK_LAUNCH_LOCATION_TOP_MENU); } - (IBAction)openBookmarkMenuItem:(id)sender {
diff --git a/chrome/browser/ui/omnibox/chrome_omnibox_client.cc b/chrome/browser/ui/omnibox/chrome_omnibox_client.cc index 777ce1a..6a131b3 100644 --- a/chrome/browser/ui/omnibox/chrome_omnibox_client.cc +++ b/chrome/browser/ui/omnibox/chrome_omnibox_client.cc
@@ -402,8 +402,7 @@ } void ChromeOmniboxClient::OnBookmarkLaunched() { - RecordBookmarkLaunch(BOOKMARK_LAUNCH_LOCATION_OMNIBOX, - ProfileMetrics::GetBrowserProfileType(profile_)); + RecordBookmarkLaunch(BOOKMARK_LAUNCH_LOCATION_OMNIBOX); } void ChromeOmniboxClient::DiscardNonCommittedNavigations() {
diff --git a/chrome/browser/ui/search/search_tab_helper.cc b/chrome/browser/ui/search/search_tab_helper.cc index 4402c13..0f1cf3d 100644 --- a/chrome/browser/ui/search/search_tab_helper.cc +++ b/chrome/browser/ui/search/search_tab_helper.cc
@@ -865,8 +865,7 @@ auto* bookmark_model = BookmarkModelFactory::GetForBrowserContext(profile()); if (bookmark_model->IsBookmarked(match.destination_url)) { - RecordBookmarkLaunch(BOOKMARK_LAUNCH_LOCATION_OMNIBOX, - ProfileMetrics::GetBrowserProfileType(profile())); + RecordBookmarkLaunch(BOOKMARK_LAUNCH_LOCATION_OMNIBOX); } const AutocompleteInput& input = autocomplete_controller_->input();
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc index 4c8560c..f3a3ade 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
@@ -1347,9 +1347,7 @@ disposition_from_event_flags, ui::PAGE_TRANSITION_AUTO_BOOKMARK, false); page_navigator_->OpenURL(params); - RecordBookmarkLaunch( - BOOKMARK_LAUNCH_LOCATION_ATTACHED_BAR, - ProfileMetrics::GetBrowserProfileType(browser_->profile())); + RecordBookmarkLaunch(BOOKMARK_LAUNCH_LOCATION_ATTACHED_BAR); } void BookmarkBarView::ShowContextMenuForViewImpl(
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc b/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc index 62f83ec..b174547 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc
@@ -183,8 +183,7 @@ std::vector<const BookmarkNode*> selection = {menu_id_to_node_map_[id]}; - RecordBookmarkLaunch(location_, - ProfileMetrics::GetBrowserProfileType(profile_)); + RecordBookmarkLaunch(location_); chrome::OpenAll(parent_->GetNativeWindow(), page_navigator_, selection, ui::DispositionFromEventFlags(mouse_event_flags), profile_);
diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc index d1ed766..25633ad 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
@@ -591,15 +591,14 @@ // ourselves, we can make the client surface fully opaque and avoid the // power consumption needed for DWM to blend the window contents. // - // So the accent border also has to be opaque. Native inactive borders are - // #555555 with 50% alpha. We can blend the titlebar color with this to - // approximate the native effect. + // So the accent border also has to be opaque. We can blend the titlebar + // color with the accent border to approximate the native effect. const SkColor titlebar_color = GetTitlebarColor(); - flags.setColor( - ShouldPaintAsActive() - ? GetThemeProvider()->GetColor(ThemeProperties::COLOR_ACCENT_BORDER) - : color_utils::AlphaBlend(SkColorSetRGB(0x55, 0x55, 0x55), - titlebar_color, 0.5f)); + const int color_id = ShouldPaintAsActive() + ? ThemeProperties::COLOR_ACCENT_BORDER_ACTIVE + : ThemeProperties::COLOR_ACCENT_BORDER_INACTIVE; + flags.setColor(color_utils::GetResultingPaintColor( + GetThemeProvider()->GetColor(color_id), titlebar_color)); canvas->DrawRect(gfx::RectF(0, 0, width() * scale, y), flags); const int titlebar_height =
diff --git a/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc b/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc index 4a8edb2b..ab8a793 100644 --- a/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc +++ b/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc
@@ -492,3 +492,98 @@ NoTrustedTypesViolationInLinuxProxyConfig) { CheckTrustedTypesViolation("chrome://linux-proxy-config"); } + +// Verify that there's no Trusted Types violation in +// chrome://indexeddb-internals +IN_PROC_BROWSER_TEST_F( + ChromeURLDataManagerTestWithWebUIReportOnlyTrustedTypesEnabled, + NoTrustedTypesViolationInIndexeddbInternals) { + CheckTrustedTypesViolation("chrome://indexeddb-internals"); +} + +// Verify that there's no Trusted Types violation in chrome://download-internals +IN_PROC_BROWSER_TEST_F( + ChromeURLDataManagerTestWithWebUIReportOnlyTrustedTypesEnabled, + NoTrustedTypesViolationInDownloadInternals) { + CheckTrustedTypesViolation("chrome://download-internals"); +} + +// Verify that there's no Trusted Types violation in chrome://invalidations +IN_PROC_BROWSER_TEST_F( + ChromeURLDataManagerTestWithWebUIReportOnlyTrustedTypesEnabled, + NoTrustedTypesViolationInInvalidations) { + CheckTrustedTypesViolation("chrome://invalidations"); +} + +// Verify that there's no Trusted Types violation in +// chrome://ntp-tiles-internals +IN_PROC_BROWSER_TEST_F( + ChromeURLDataManagerTestWithWebUIReportOnlyTrustedTypesEnabled, + NoTrustedTypesViolationInNTPTilesInternals) { + CheckTrustedTypesViolation("chrome://ntp-tiles-internals"); +} + +// Verify that there's no Trusted Types violation in +// chrome://serviceworker-internals +IN_PROC_BROWSER_TEST_F( + ChromeURLDataManagerTestWithWebUIReportOnlyTrustedTypesEnabled, + NoTrustedTypesViolationInServiceworkerInternals) { + CheckTrustedTypesViolation("chrome://serviceworker-internals"); +} + +// Verify that there's no Trusted Types violation in chrome://signin-internals +IN_PROC_BROWSER_TEST_F( + ChromeURLDataManagerTestWithWebUIReportOnlyTrustedTypesEnabled, + NoTrustedTypesViolationInSigninInternals) { + CheckTrustedTypesViolation("chrome://signin-internals"); +} + +// Verify that there's no Trusted Types violation in chrome://sync-internals +IN_PROC_BROWSER_TEST_F( + ChromeURLDataManagerTestWithWebUIReportOnlyTrustedTypesEnabled, + NoTrustedTypesViolationInSyncInternals) { + CheckTrustedTypesViolation("chrome://sync-internals"); +} + +// Verify that there's no Trusted Types violation in chrome://nacl +IN_PROC_BROWSER_TEST_F( + ChromeURLDataManagerTestWithWebUIReportOnlyTrustedTypesEnabled, + NoTrustedTypesViolationInNacl) { + CheckTrustedTypesViolation("chrome://nacl"); +} + +// Verify that there's no Trusted Types violation in chrome://conflicts +IN_PROC_BROWSER_TEST_F( + ChromeURLDataManagerTestWithWebUIReportOnlyTrustedTypesEnabled, + NoTrustedTypesViolationInConflicts) { + CheckTrustedTypesViolation("chrome://conflicts"); +} + +// Verify that there's no Trusted Types violation in chrome://components +IN_PROC_BROWSER_TEST_F( + ChromeURLDataManagerTestWithWebUIReportOnlyTrustedTypesEnabled, + NoTrustedTypesViolationInComponents) { + CheckTrustedTypesViolation("chrome://components"); +} + +// Verify that there's no Trusted Types violation in chrome://flags +IN_PROC_BROWSER_TEST_F( + ChromeURLDataManagerTestWithWebUIReportOnlyTrustedTypesEnabled, + NoTrustedTypesViolationInFlags) { + CheckTrustedTypesViolation("chrome://flags"); +} + +// Verify that there's no Trusted Types violation in chrome://gpu +IN_PROC_BROWSER_TEST_F( + ChromeURLDataManagerTestWithWebUIReportOnlyTrustedTypesEnabled, + NoTrustedTypesViolationInGPU) { + CheckTrustedTypesViolation("chrome://gpu"); +} + +// Verify that there's no Trusted Types violation in +// chrome://supervised-user-internals +IN_PROC_BROWSER_TEST_F( + ChromeURLDataManagerTestWithWebUIReportOnlyTrustedTypesEnabled, + NoTrustedTypesViolationInSupervisedUserInternals) { + CheckTrustedTypesViolation("chrome://supervised-user-internals"); +}
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index 9f85f4bd..0cf5a37 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -32,7 +32,6 @@ #include "chrome/browser/ui/webui/chromeos/account_manager/account_manager_error_ui.h" #include "chrome/browser/ui/webui/chromeos/account_manager/account_manager_welcome_ui.h" #include "chrome/browser/ui/webui/chromeos/account_manager/account_migration_welcome_ui.h" -#include "chrome/browser/ui/webui/chromeos/camera/camera_ui.h" #include "chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_ui.h" #include "chrome/browser/ui/webui/components/components_ui.h" #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" @@ -71,11 +70,14 @@ #include "chrome/browser/ui/webui/usb_internals/usb_internals_ui.h" #include "chrome/browser/ui/webui/user_actions/user_actions_ui.h" #include "chrome/browser/ui/webui/version_ui.h" +#include "chrome/browser/web_applications/system_web_app_manager.h" #include "chrome/common/buildflags.h" #include "chrome/common/chrome_features.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "chrome/common/webui_url_constants.h" +#include "chromeos/components/camera_app_ui/camera_app_ui.h" +#include "chromeos/components/camera_app_ui/url_constants.h" #include "components/favicon/core/favicon_service.h" #include "components/favicon_base/favicon_util.h" #include "components/favicon_base/select_favicon_frames.h" @@ -639,9 +641,10 @@ return &NewWebUI<SysInternalsUI>; if (url.host_piece() == chrome::kChromeUIAssistantOptInHost) return &NewWebUI<chromeos::AssistantOptInUI>; - if (url.host_piece() == chrome::kChromeUICameraHost && - chromeos::CameraUI::IsEnabled()) { - return &NewWebUI<chromeos::CameraUI>; + if (url.host_piece() == chromeos::kChromeUICameraAppHost && + web_app::SystemWebAppManager::IsAppEnabled( + web_app::SystemAppType::CAMERA)) { + return &NewWebUI<chromeos::CameraAppUI>; } if (url.host_piece() == chrome::kChromeUIArcGraphicsTracingHost)
diff --git a/chrome/browser/ui/webui/chromeos/camera/camera_ui.cc b/chrome/browser/ui/webui/chromeos/camera/camera_ui.cc deleted file mode 100644 index 9906f67..0000000 --- a/chrome/browser/ui/webui/chromeos/camera/camera_ui.cc +++ /dev/null
@@ -1,86 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/webui/chromeos/camera/camera_ui.h" - -#include <utility> - -#include "base/bind.h" -#include "base/feature_list.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/webui/webui_util.h" -#include "chrome/browser/web_applications/system_web_app_manager.h" -#include "chrome/common/url_constants.h" -#include "chrome/grit/browser_resources.h" -#include "chrome/grit/camera_resources.h" -#include "chrome/grit/camera_resources_map.h" -#include "chromeos/constants/chromeos_features.h" -#include "content/public/browser/web_ui_data_source.h" -#include "mojo/public/js/grit/mojo_bindings_resources.h" - -namespace chromeos { - -namespace { - -content::WebUIDataSource* CreateCameraUIHTMLSource() { - content::WebUIDataSource* source = - content::WebUIDataSource::Create(chrome::kChromeUICameraHost); - - // Add all settings resources. - webui::AddResourcePathsBulk( - source, base::make_span(kCameraResources, kCameraResourcesSize)); - - static constexpr webui::ResourcePath kAdditionalResources[] = { - // Add WebUI version of the CCA browser proxy. - {"src/js/browser_proxy/browser_proxy.js", IDR_CAMERA_WEBUI_BROWSER_PROXY}, - - // Add mojom-lite files under expected paths. - {"src/js/mojo/camera_intent.mojom-lite.js", - IDR_CAMERA_CAMERA_INTENT_MOJOM_LITE_JS}, - {"src/js/mojo/image_capture.mojom-lite.js", - IDR_CAMERA_IMAGE_CAPTURE_MOJOM_LITE_JS}, - {"src/js/mojo/camera_common.mojom-lite.js", - IDR_CAMERA_CAMERA_COMMON_MOJOM_LITE_JS}, - {"src/js/mojo/camera_metadata.mojom-lite.js", - IDR_CAMERA_CAMERA_METADATA_MOJOM_LITE_JS}, - {"src/js/mojo/camera_metadata_tags.mojom-lite.js", - IDR_CAMERA_CAMERA_METADATA_TAGS_MOJOM_LITE_JS}, - {"src/js/mojo/camera_app.mojom-lite.js", IDR_CAMERA_APP_MOJOM_LITE_JS}, - {"src/js/mojo/mojo_bindings_lite.js", IDR_MOJO_MOJO_BINDINGS_LITE_JS}, - - // Add System Web App resources. - {"pwa.html", IDR_PWA_HTML}, - }; - webui::AddResourcePathsBulk(source, kAdditionalResources); - - source->UseStringsJs(); - - return source; -} - -} // namespace - -/////////////////////////////////////////////////////////////////////////////// -// -// CameraUI -// -/////////////////////////////////////////////////////////////////////////////// - -CameraUI::CameraUI(content::WebUI* web_ui) : ui::MojoWebUIController(web_ui) { - Profile* profile = Profile::FromWebUI(web_ui); - - // Set up the data source. - content::WebUIDataSource* source = CreateCameraUIHTMLSource(); - content::WebUIDataSource::Add(profile, source); -} - -CameraUI::~CameraUI() = default; - -// static -bool CameraUI::IsEnabled() { - return web_app::SystemWebAppManager::IsAppEnabled( - web_app::SystemAppType::CAMERA); -} - -} // namespace chromeos
diff --git a/chrome/browser/ui/webui/chromeos/camera/camera_ui.h b/chrome/browser/ui/webui/chromeos/camera/camera_ui.h deleted file mode 100644 index 31dabca..0000000 --- a/chrome/browser/ui/webui/chromeos/camera/camera_ui.h +++ /dev/null
@@ -1,27 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_CAMERA_CAMERA_UI_H_ -#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_CAMERA_CAMERA_UI_H_ - -#include "base/macros.h" -#include "ui/webui/mojo_web_ui_controller.h" - -namespace chromeos { - -class CameraUI : public ui::MojoWebUIController { - public: - explicit CameraUI(content::WebUI* web_ui); - ~CameraUI() override; - - // True when the Camera as a System Web App flag is true. - static bool IsEnabled(); - - private: - DISALLOW_COPY_AND_ASSIGN(CameraUI); -}; - -} // namespace chromeos - -#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_CAMERA_CAMERA_UI_H_
diff --git a/chrome/browser/ui/webui/chromeos/in_session_password_change/OWNERS b/chrome/browser/ui/webui/chromeos/in_session_password_change/OWNERS index e7edf2e6..a8183f4 100644 --- a/chrome/browser/ui/webui/chromeos/in_session_password_change/OWNERS +++ b/chrome/browser/ui/webui/chromeos/in_session_password_change/OWNERS
@@ -1,2 +1 @@ -olsen@chromium.org rsorokin@chromium.org
diff --git a/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc b/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc index 970ee48..8884f89 100644 --- a/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc +++ b/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc
@@ -831,8 +831,7 @@ auto* bookmark_model = BookmarkModelFactory::GetForBrowserContext(profile_); if (bookmark_model->IsBookmarked(match.destination_url)) { - RecordBookmarkLaunch(BOOKMARK_LAUNCH_LOCATION_OMNIBOX, - ProfileMetrics::GetBrowserProfileType(profile_)); + RecordBookmarkLaunch(BOOKMARK_LAUNCH_LOCATION_OMNIBOX); } const AutocompleteInput& input = autocomplete_controller_->input();
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc index e27a689..271cdfc4 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -921,6 +921,12 @@ IDS_SETTINGS_PASSWORD_DELETED_PASSWORD_FROM_ACCOUNT}, {"passwordDeletedFromAccountAndDevice", IDS_SETTINGS_PASSWORD_DELETED_PASSWORD_FROM_ACCOUNT_AND_DEVICE}, + {"devicePasswordsLinkLabelSingular", + IDS_SETTINGS_DEVICE_PASSWORDS_LINK_LABEL_SINGULAR}, + {"devicePasswordsLinkLabelPlural", + IDS_SETTINGS_DEVICE_PASSWORDS_LINK_LABEL_PLURAL}, + {"devicePasswordsLinkSubLabel", + IDS_SETTINGS_DEVICE_PASSWORDS_LINK_SUB_LABEL}, {"passwordRowMoreActionsButton", IDS_SETTINGS_PASSWORD_ROW_MORE_ACTIONS}, {"passwordRowFederatedMoreActionsButton", IDS_SETTINGS_PASSWORD_ROW_FEDERATED_MORE_ACTIONS},
diff --git a/chrome/browser/web_applications/components/web_app_icon_downloader.cc b/chrome/browser/web_applications/components/web_app_icon_downloader.cc index 580c59f..7fd4d45 100644 --- a/chrome/browser/web_applications/components/web_app_icon_downloader.cc +++ b/chrome/browser/web_applications/components/web_app_icon_downloader.cc
@@ -153,6 +153,7 @@ } void WebAppIconDownloader::DidUpdateFaviconURL( + content::RenderFrameHost* rfh, const std::vector<blink::mojom::FaviconURLPtr>& candidates) { // Only consider the first candidates we are given. This prevents pages that // change their favicon from spamming us.
diff --git a/chrome/browser/web_applications/components/web_app_icon_downloader.h b/chrome/browser/web_applications/components/web_app_icon_downloader.h index f50077e..f21d5b3 100644 --- a/chrome/browser/web_applications/components/web_app_icon_downloader.h +++ b/chrome/browser/web_applications/components/web_app_icon_downloader.h
@@ -85,6 +85,7 @@ void DidFinishNavigation( content::NavigationHandle* navigation_handle) override; void DidUpdateFaviconURL( + content::RenderFrameHost* rfh, const std::vector<blink::mojom::FaviconURLPtr>& candidates) override; void CancelDownloads();
diff --git a/chrome/browser/web_applications/components/web_app_icon_downloader_unittest.cc b/chrome/browser/web_applications/components/web_app_icon_downloader_unittest.cc index 70deff5..75c9260 100644 --- a/chrome/browser/web_applications/components/web_app_icon_downloader_unittest.cc +++ b/chrome/browser/web_applications/components/web_app_icon_downloader_unittest.cc
@@ -93,7 +93,8 @@ void UpdateFaviconURLs( const std::vector<blink::mojom::FaviconURLPtr>& candidates) { - WebAppIconDownloader::DidUpdateFaviconURL(candidates); + WebAppIconDownloader::DidUpdateFaviconURL(web_contents()->GetMainFrame(), + candidates); } void set_initial_favicon_urls(
diff --git a/chrome/browser/web_applications/system_web_app_manager.cc b/chrome/browser/web_applications/system_web_app_manager.cc index 9969cea..0d86848 100644 --- a/chrome/browser/web_applications/system_web_app_manager.cc +++ b/chrome/browser/web_applications/system_web_app_manager.cc
@@ -94,8 +94,9 @@ } if (SystemWebAppManager::IsAppEnabled(SystemAppType::CAMERA)) { - infos.emplace(SystemAppType::CAMERA, - SystemAppInfo("Camera", GURL("chrome://camera/pwa.html"))); + infos.emplace( + SystemAppType::CAMERA, + SystemAppInfo("Camera", GURL("chrome://camera-app/pwa.html"))); infos.at(SystemAppType::CAMERA).uninstall_and_replace = { extension_misc::kCameraAppId}; }
diff --git a/chrome/chrome_paks.gni b/chrome/chrome_paks.gni index 6ff33889..e5fced5 100644 --- a/chrome/chrome_paks.gni +++ b/chrome/chrome_paks.gni
@@ -156,11 +156,11 @@ sources += [ "$root_gen_dir/ash/public/cpp/resources/ash_public_unscaled_resources.pak", "$root_gen_dir/chrome/browser/supervised_user/supervised_user_unscaled_resources.pak", - "$root_gen_dir/chrome/camera_resources.pak", "$root_gen_dir/chrome/cellular_setup_resources.pak", "$root_gen_dir/chrome/multidevice_setup_resources.pak", "$root_gen_dir/chrome/network_health_resources.pak", "$root_gen_dir/chrome/os_settings_resources.pak", + "$root_gen_dir/chromeos/chromeos_camera_app_resources.pak", "$root_gen_dir/chromeos/chromeos_help_app_bundle_resources.pak", "$root_gen_dir/chromeos/chromeos_help_app_resources.pak", "$root_gen_dir/chromeos/chromeos_media_app_bundle_resources.pak", @@ -173,12 +173,12 @@ deps += [ "//ash/public/cpp/resources:ash_public_unscaled_resources", "//chrome/browser/resources:os_settings_resources", - "//chrome/browser/resources/chromeos:camera_resources", "//chrome/browser/resources/chromeos:cellular_setup_resources", "//chrome/browser/resources/chromeos:multidevice_setup_resources", "//chrome/browser/resources/chromeos:network_health_resources", "//chrome/browser/supervised_user:supervised_user_unscaled_resources", "//chromeos/resources", + "//chromeos/resources:camera_app_resources", "//chromeos/resources:help_app_bundle_resources", "//chromeos/resources:help_app_resources", "//chromeos/resources:media_app_bundle_resources",
diff --git a/chrome/common/webui_url_constants.cc b/chrome/common/webui_url_constants.cc index 65f780e..8b63fe5 100644 --- a/chrome/common/webui_url_constants.cc +++ b/chrome/common/webui_url_constants.cc
@@ -28,7 +28,6 @@ const char kChromeUIBluetoothInternalsHost[] = "bluetooth-internals"; const char kChromeUIBookmarksHost[] = "bookmarks"; const char kChromeUIBookmarksURL[] = "chrome://bookmarks/"; -const char kChromeUICameraHost[] = "camera"; const char kChromeUICertificateViewerHost[] = "view-cert"; const char kChromeUICertificateViewerURL[] = "chrome://view-cert/"; const char kChromeUIChromeSigninHost[] = "chrome-signin";
diff --git a/chrome/common/webui_url_constants.h b/chrome/common/webui_url_constants.h index e5d95de..ca80dbb 100644 --- a/chrome/common/webui_url_constants.h +++ b/chrome/common/webui_url_constants.h
@@ -36,7 +36,6 @@ extern const char kChromeUIBluetoothInternalsHost[]; extern const char kChromeUIBookmarksHost[]; extern const char kChromeUIBookmarksURL[]; -extern const char kChromeUICameraHost[]; extern const char kChromeUICertificateViewerHost[]; extern const char kChromeUICertificateViewerURL[]; extern const char kChromeUIChromeSigninHost[];
diff --git a/chrome/install_static/google_chrome_install_modes.cc b/chrome/install_static/google_chrome_install_modes.cc index d858f23..827ba55d 100644 --- a/chrome/install_static/google_chrome_install_modes.cc +++ b/chrome/install_static/google_chrome_install_modes.cc
@@ -95,9 +95,9 @@ // {A2721D66-376E-4D2F-9F0F-9070E9A42B5F}. L"beta", // Forced channel name. ChannelStrategy::FIXED, - true, // Supports system-level installs. - true, // Supports in-product set as default browser UX. - true, // Supports retention experiments. + true, // Supports system-level installs. + true, // Supports in-product set as default browser UX. + true, // Supports retention experiments. icon_resources::kBetaApplicationIndex, // App icon resource index. IDR_X005_BETA, // App icon resource id. L"S-1-15-2-3251537155-1984446955-2931258699-841473695-1938553385-" @@ -135,9 +135,9 @@ // {BB2AA26B-343A-4072-8B6F-80557B8CE571}. L"dev", // Forced channel name. ChannelStrategy::FIXED, - true, // Supports system-level installs. - true, // Supports in-product set as default browser UX. - true, // Supports retention experiments. + true, // Supports system-level installs. + true, // Supports in-product set as default browser UX. + true, // Supports retention experiments. icon_resources::kDevApplicationIndex, // App icon resource index. IDR_X004_DEV, // App icon resource id. L"S-1-15-2-3251537155-1984446955-2931258699-841473695-1938553385-"
diff --git a/chrome/install_static/install_modes.h b/chrome/install_static/install_modes.h index 0f0eb2a4..a58f6ea 100644 --- a/chrome/install_static/install_modes.h +++ b/chrome/install_static/install_modes.h
@@ -35,7 +35,7 @@ // Include the brand-specific values. Each of these must define: // - enum InstallConstantIndex: named indices of the brand's kInstallModes // array. -// - NUM_INSTALL_MODES: the total numer of modes (i.e., the numer of items in +// - NUM_INSTALL_MODES: the total number of modes (i.e., the number of items in // kInstallModes. #if defined(GOOGLE_CHROME_BUILD) #include "chrome/install_static/google_chrome_install_modes.h"
diff --git a/chrome/install_static/install_modes_unittest.cc b/chrome/install_static/install_modes_unittest.cc index 5916c997..00641f8 100644 --- a/chrome/install_static/install_modes_unittest.cc +++ b/chrome/install_static/install_modes_unittest.cc
@@ -27,7 +27,7 @@ namespace { // A matcher that returns true if |arg| contains a character that is neither -// alpha-numeric nor a period. +// alphanumeric nor a period. MATCHER(ContainsIllegalProgIdChar, "") { const wchar_t* scan = arg; wint_t c; @@ -66,8 +66,9 @@ else ASSERT_THAT(mode.logo_suffix, StrNe(L"")); - // The modes must have an appguid if Google Update integration is supported. #if BUILDFLAG(USE_GOOGLE_UPDATE_INTEGRATION) + // The modes must have an appguid if Google Update integration is + // supported. ASSERT_THAT(mode.app_guid, StrNe(L"")); #else ASSERT_THAT(mode.app_guid, StrEq(L""));
diff --git a/chrome/install_static/install_util.h b/chrome/install_static/install_util.h index a2fb9161..7ee6e2b 100644 --- a/chrome/install_static/install_util.h +++ b/chrome/install_static/install_util.h
@@ -49,7 +49,8 @@ extern const wchar_t kUtilityProcess[]; // Used for suppressing warnings. -template <typename T> inline void IgnoreUnused(T) {} +template <typename T> +inline void IgnoreUnused(T) {} // Returns true if Chrome is running at system level. bool IsSystemInstall();
diff --git a/chrome/install_static/install_util_unittest.cc b/chrome/install_static/install_util_unittest.cc index 0f2b7772..a0615b8e 100644 --- a/chrome/install_static/install_util_unittest.cc +++ b/chrome/install_static/install_util_unittest.cc
@@ -101,7 +101,7 @@ value = GetSwitchValueFromCommandLine(L"\"blah --type=\t\t\t", L"type"); EXPECT_TRUE(value.empty()); - // Anything following "--" should be considered args and therfore ignored. + // Anything following "--" should be considered args and therefore ignored. value = GetSwitchValueFromCommandLine(L"blah -- --type=bleh", L"type"); EXPECT_TRUE(value.empty()); } @@ -171,8 +171,8 @@ EXPECT_EQ(L"C:\\with space\\b.exe", tokenized[0]); EXPECT_EQ(L"--stuff=d:\\stuff and things", tokenized[1]); - tokenized = TokenizeCommandLineToArray( - L"\"C:\\with space\\b.exe\" \\\\\\\"\""); + tokenized = + TokenizeCommandLineToArray(L"\"C:\\with space\\b.exe\" \\\\\\\"\""); ASSERT_EQ(2u, tokenized.size()); EXPECT_EQ(L"C:\\with space\\b.exe", tokenized[0]); EXPECT_EQ(L"\\\"", tokenized[1]); @@ -199,14 +199,12 @@ EXPECT_EQ(L"program.exe", tokenized[0]); EXPECT_EQ(L"C:\\Hello there.txt", tokenized[1]); - tokenized = - TokenizeCommandLineToArray(L"program.exe \"hello\\\"there\""); + tokenized = TokenizeCommandLineToArray(L"program.exe \"hello\\\"there\""); ASSERT_EQ(2u, tokenized.size()); EXPECT_EQ(L"program.exe", tokenized[0]); EXPECT_EQ(L"hello\"there", tokenized[1]); - tokenized = - TokenizeCommandLineToArray(L"program.exe \"hello\\\\\""); + tokenized = TokenizeCommandLineToArray(L"program.exe \"hello\\\\\""); ASSERT_EQ(2u, tokenized.size()); EXPECT_EQ(L"program.exe", tokenized[0]); EXPECT_EQ(L"hello\\", tokenized[1]); @@ -366,7 +364,9 @@ // The directory strings for the brand's install modes; parallel to // kInstallModes. static constexpr const wchar_t* kInstallDirs[] = { - L"Google\\Chrome", L"Google\\Chrome Beta", L"Google\\Chrome Dev", + L"Google\\Chrome", + L"Google\\Chrome Beta", + L"Google\\Chrome Dev", L"Google\\Chrome SxS", }; #else @@ -387,8 +387,10 @@ // The registry path strings for the brand's install modes; parallel to // kInstallModes. static constexpr const wchar_t* kRegistryPaths[] = { - L"Software\\Google\\Chrome", L"Software\\Google\\Chrome Beta", - L"Software\\Google\\Chrome Dev", L"Software\\Google\\Chrome SxS", + L"Software\\Google\\Chrome", + L"Software\\Google\\Chrome Beta", + L"Software\\Google\\Chrome Dev", + L"Software\\Google\\Chrome SxS", }; #else // The registry path strings for the brand's install modes; parallel to @@ -454,7 +456,10 @@ #if BUILDFLAG(GOOGLE_CHROME_BRANDING) // The base app ids for the brand's install modes; parallel to kInstallModes. static constexpr const wchar_t* kBaseAppIds[] = { - L"Chrome", L"ChromeBeta", L"ChromeDev", L"ChromeCanary", + L"Chrome", + L"ChromeBeta", + L"ChromeDev", + L"ChromeCanary", }; #else // The base app ids for the brand's install modes; parallel to kInstallModes.
diff --git a/chrome/install_static/policy_path_parser.cc b/chrome/install_static/policy_path_parser.cc index 274ad3af..d7343f9 100644 --- a/chrome/install_static/policy_path_parser.cc +++ b/chrome/install_static/policy_path_parser.cc
@@ -33,14 +33,13 @@ // Mapping from variable names to Windows CSIDL ids. constexpr WinFolderNamesToCSIDLMapping kWinFolderMapping[] = { - { kWinWindowsFolderVarName, CSIDL_WINDOWS}, - { kWinProgramFilesFolderVarName, CSIDL_PROGRAM_FILES}, - { kWinProgramDataFolderVarName, CSIDL_COMMON_APPDATA}, - { kWinProfileFolderVarName, CSIDL_PROFILE}, - { kWinLocalAppDataFolderVarName, CSIDL_LOCAL_APPDATA}, - { kWinRoamingAppDataFolderVarName, CSIDL_APPDATA}, - { kWinDocumentsFolderVarName, CSIDL_PERSONAL} -}; + {kWinWindowsFolderVarName, CSIDL_WINDOWS}, + {kWinProgramFilesFolderVarName, CSIDL_PROGRAM_FILES}, + {kWinProgramDataFolderVarName, CSIDL_COMMON_APPDATA}, + {kWinProfileFolderVarName, CSIDL_PROFILE}, + {kWinLocalAppDataFolderVarName, CSIDL_LOCAL_APPDATA}, + {kWinRoamingAppDataFolderVarName, CSIDL_APPDATA}, + {kWinDocumentsFolderVarName, CSIDL_PERSONAL}}; template <class FunctionType> struct ScopedFunctionHelper { @@ -54,7 +53,7 @@ function_name[2] && function_name[2] != ':') { function_name += 2; } - function_ = reinterpret_cast<FunctionType *>( + function_ = reinterpret_cast<FunctionType*>( GetProcAddress(library_, function_name)); assert(function_); } @@ -65,7 +64,8 @@ FreeLibrary(library_); } - template <class... Args> auto operator()(Args... a) { + template <class... Args> + auto operator()(Args... a) { return function_(a...); } @@ -74,20 +74,19 @@ FunctionType* function_; }; -#define SCOPED_LOAD_FUNCTION(library, function) \ +#define SCOPED_LOAD_FUNCTION(library, function) \ ScopedFunctionHelper<decltype(function)>(library, #function) } // namespace namespace install_static { -// Replaces all variable occurances in the policy string with the respective +// Replaces all variable occurrences in the policy string with the respective // system settings values. // Note that this uses GetProcAddress to load DLLs that cannot be loaded before // the blacklist in the DllMain of chrome_elf has been applied. This function // should only be used after DllMain() has run. -std::wstring ExpandPathVariables( - const std::wstring& untranslated_string) { +std::wstring ExpandPathVariables(const std::wstring& untranslated_string) { std::wstring result(untranslated_string); if (result.length() == 0) return result; @@ -140,14 +139,15 @@ position = result.find(kMachineNamePolicyVarName); if (position != std::wstring::npos) { DWORD return_length = 0; - ::GetComputerNameEx(ComputerNamePhysicalDnsHostname, NULL, &return_length); + ::GetComputerNameEx(ComputerNamePhysicalDnsHostname, nullptr, + &return_length); if (return_length != 0) { std::unique_ptr<WCHAR[]> machinename(new WCHAR[return_length]); - ::GetComputerNameEx(ComputerNamePhysicalDnsHostname, - machinename.get(), &return_length); + ::GetComputerNameEx(ComputerNamePhysicalDnsHostname, machinename.get(), + &return_length); std::wstring machinename_string(machinename.get()); - result.replace( - position, wcslen(kMachineNamePolicyVarName), machinename_string); + result.replace(position, wcslen(kMachineNamePolicyVarName), + machinename_string); } } auto wts_query_session_information = @@ -155,7 +155,7 @@ auto wts_free_memory = SCOPED_LOAD_FUNCTION(L"wtsapi32.dll", ::WTSFreeMemory); position = result.find(kWinClientName); if (position != std::wstring::npos) { - LPWSTR buffer = NULL; + LPWSTR buffer = nullptr; DWORD buffer_length = 0; if (wts_query_session_information(WTS_CURRENT_SERVER, WTS_CURRENT_SESSION, WTSClientName, &buffer, &buffer_length)) { @@ -166,7 +166,7 @@ } position = result.find(kWinSessionName); if (position != std::wstring::npos) { - LPWSTR buffer = NULL; + LPWSTR buffer = nullptr; DWORD buffer_length = 0; if (wts_query_session_information(WTS_CURRENT_SERVER, WTS_CURRENT_SESSION, WTSWinStationName, &buffer,
diff --git a/chrome/install_static/product_install_details_unittest.cc b/chrome/install_static/product_install_details_unittest.cc index d7e8537..b8b03e8 100644 --- a/chrome/install_static/product_install_details_unittest.cc +++ b/chrome/install_static/product_install_details_unittest.cc
@@ -32,11 +32,7 @@ TEST(ProductInstallDetailsTest, IsPathParentOf) { std::wstring path = L"C:\\Program Files\\Company\\Product\\Application\\foo"; static constexpr const wchar_t* kFalseExpectations[] = { - L"", - L"\\", - L"\\\\", - L"C:\\Program File", - L"C:\\Program Filesz", + L"", L"\\", L"\\\\", L"C:\\Program File", L"C:\\Program Filesz", }; for (const wchar_t* false_expectation : kFalseExpectations) { EXPECT_FALSE(IsPathParentOf( @@ -134,52 +130,72 @@ constexpr TestData kTestData[] = { { L"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", - STABLE_INDEX, true, L"", + STABLE_INDEX, + true, + L"", }, { L"C:\\Users\\user\\AppData\\Local\\Google\\Chrome\\Application" L"\\chrome.exe", - STABLE_INDEX, false, L"", + STABLE_INDEX, + false, + L"", }, { L"C:\\Program Files (x86)\\Google\\Chrome " L"Beta\\Application\\chrome.exe", - BETA_INDEX, true, L"beta", + BETA_INDEX, + true, + L"beta", }, { L"C:\\Users\\user\\AppData\\Local\\Google\\Chrome Beta\\Application" L"\\chrome.exe", - BETA_INDEX, false, L"beta", + BETA_INDEX, + false, + L"beta", }, { L"C:\\Program Files (x86)\\Google\\Chrome Dev\\Application\\chrome.exe", - DEV_INDEX, true, L"dev", + DEV_INDEX, + true, + L"dev", }, { L"C:\\Users\\user\\AppData\\Local\\Google\\Chrome Dev\\Application" L"\\chrome.exe", - DEV_INDEX, false, L"dev", + DEV_INDEX, + false, + L"dev", }, { L"C:\\Users\\user\\AppData\\Local\\Google\\Chrome SxS\\Application" L"\\chrome.exe", - CANARY_INDEX, false, L"canary", + CANARY_INDEX, + false, + L"canary", }, { L"C:\\Users\\user\\AppData\\Local\\Google\\CHROME SXS\\application" L"\\chrome.exe", - CANARY_INDEX, false, L"canary", + CANARY_INDEX, + false, + L"canary", }, }; #else // BUILDFLAG(GOOGLE_CHROME_BRANDING) constexpr TestData kTestData[] = { { L"C:\\Program Files (x86)\\Chromium\\Application\\chrome.exe", - CHROMIUM_INDEX, true, L"", + CHROMIUM_INDEX, + true, + L"", }, { L"C:\\Users\\user\\AppData\\Local\\Chromium\\Application\\chrome.exe", - CHROMIUM_INDEX, false, L"", + CHROMIUM_INDEX, + false, + L"", }, }; #endif // !BUILDFLAG(GOOGLE_CHROME_BRANDING) @@ -193,8 +209,7 @@ : test_data_(GetParam()), root_key_(test_data_.system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER), - nt_root_key_(test_data_.system_level ? nt::HKLM : nt::HKCU) { - } + nt_root_key_(test_data_.system_level ? nt::HKLM : nt::HKCU) {} ~MakeProductDetailsTest() { nt::SetTestingOverride(nt_root_key_, base::string16());
diff --git a/chrome/install_static/user_data_dir.cc b/chrome/install_static/user_data_dir.cc index 857685e9..1985502 100644 --- a/chrome/install_static/user_data_dir.cc +++ b/chrome/install_static/user_data_dir.cc
@@ -4,8 +4,8 @@ #include "chrome/install_static/user_data_dir.h" -#include <windows.h> #include <assert.h> +#include <windows.h> #include "chrome/chrome_elf/nt_registry/nt_registry.h" #include "chrome/install_static/install_details.h" @@ -42,7 +42,7 @@ // Second, try HKCU. if (nt::QueryRegValueSZ(nt::HKCU, nt::NONE, policies_path.c_str(), - kUserDataDirRegistryKeyName, &value)) { + kUserDataDirRegistryKeyName, &value)) { *user_data_dir = ExpandPathVariables(value); return; }
diff --git a/chrome/installer/gcapi/gcapi.cc b/chrome/installer/gcapi/gcapi.cc index 1aa3421..e502b40 100644 --- a/chrome/installer/gcapi/gcapi.cc +++ b/chrome/installer/gcapi/gcapi.cc
@@ -10,12 +10,13 @@ #include "chrome/installer/gcapi/gcapi.h" +#include <windows.h> + #include <sddl.h> #include <stddef.h> #include <stdint.h> #include <string.h> #define STRSAFE_NO_DEPRECATE -#include <windows.h> #include <objbase.h> #include <strsafe.h> #include <tlhelp32.h> @@ -47,12 +48,12 @@ #include "chrome/installer/util/util_constants.h" #include "google_update/google_update_idl.h" -using Microsoft::WRL::ComPtr; using base::Time; using base::TimeDelta; using base::win::RegKey; using base::win::ScopedCOMInitializer; using base::win::ScopedHandle; +using Microsoft::WRL::ComPtr; namespace { @@ -62,8 +63,7 @@ const wchar_t kNoChromeOfferUntil[] = L"SOFTWARE\\Google\\No Chrome Offer Until"; -const wchar_t kC1FPendingKey[] = - L"Software\\Google\\Common\\Rlz\\Events\\C"; +const wchar_t kC1FPendingKey[] = L"Software\\Google\\Common\\Rlz\\Events\\C"; const wchar_t kC1FSentKey[] = L"Software\\Google\\Common\\Rlz\\StatefulEvents\\C"; const wchar_t kC1FKey[] = L"C1F"; @@ -95,7 +95,8 @@ // Retrieve the language and codepage code if exists. buffer_size = 0; if (!::VerQueryValue(file_version_info, TEXT("\\VarFileInfo\\Translation"), - reinterpret_cast<LPVOID *>(&data), reinterpret_cast<UINT *>(&data_len))) + reinterpret_cast<LPVOID*>(&data), + reinterpret_cast<UINT*>(&data_len))) return false; if (data_len != 4) return false; @@ -106,22 +107,21 @@ // language codepage. memcpy(&lang, data, 4); ::StringCchPrintf(info_name, _countof(info_name), - L"\\StringFileInfo\\%02X%02X%02X%02X\\CompanyName", - (lang & 0xff00)>>8, (lang & 0xff), (lang & 0xff000000)>>24, - (lang & 0xff0000)>>16); + L"\\StringFileInfo\\%02X%02X%02X%02X\\CompanyName", + (lang & 0xff00) >> 8, (lang & 0xff), + (lang & 0xff000000) >> 24, (lang & 0xff0000) >> 16); data_len = 0; if (!::VerQueryValue(file_version_info, info_name, - reinterpret_cast<LPVOID *>(&data), reinterpret_cast<UINT *>(&data_len))) + reinterpret_cast<LPVOID*>(&data), + reinterpret_cast<UINT*>(&data_len))) return false; if (data_len <= 0 || data_len >= (out_len / sizeof(wchar_t))) return false; memset(buffer, 0, out_len); - ::StringCchCopyN(buffer, - (out_len / sizeof(wchar_t)), - reinterpret_cast<const wchar_t*>(data), - data_len); + ::StringCchCopyN(buffer, (out_len / sizeof(wchar_t)), + reinterpret_cast<const wchar_t*>(data), data_len); return true; } @@ -144,7 +144,7 @@ // Return true if we can re-offer Chrome; false, otherwise. // Each partner can only offer Chrome once every six months. bool CanReOfferChrome(BOOL set_flag) { - wchar_t filename[MAX_PATH+1]; + wchar_t filename[MAX_PATH + 1]; wchar_t company[MAX_PATH]; // If we cannot retrieve the version info of the executable or company @@ -171,8 +171,7 @@ if (::RegQueryValueEx(key, company, 0, &value_type, reinterpret_cast<LPBYTE>(&value_data), &value_length) == ERROR_SUCCESS && - REG_DWORD == value_type && - value_data > today) { + REG_DWORD == value_type && value_data > today) { // The time has not expired, we cannot offer Chrome. can_re_offer = false; } else { @@ -205,8 +204,8 @@ RegKey key; DWORD value; return key.Open(root, subkey, KEY_READ | KEY_WOW64_32KEY) == ERROR_SUCCESS && - key.ReadValueDW(kC1FKey, &value) == ERROR_SUCCESS && - value == static_cast<DWORD>(1); + key.ReadValueDW(kC1FKey, &value) == ERROR_SUCCESS && + value == static_cast<DWORD>(1); } bool IsC1FSent() { @@ -215,13 +214,13 @@ // in sent or pending state. Return true if there is a match for any of these // 4 states. return RegKeyHasC1F(HKEY_CURRENT_USER, kC1FSentKey) || - RegKeyHasC1F(HKEY_CURRENT_USER, kC1FPendingKey) || - RegKeyHasC1F(HKEY_LOCAL_MACHINE, kC1FSentKey) || - RegKeyHasC1F(HKEY_LOCAL_MACHINE, kC1FPendingKey); + RegKeyHasC1F(HKEY_CURRENT_USER, kC1FPendingKey) || + RegKeyHasC1F(HKEY_LOCAL_MACHINE, kC1FSentKey) || + RegKeyHasC1F(HKEY_LOCAL_MACHINE, kC1FPendingKey); } bool IsWindowsVersionSupported() { - OSVERSIONINFOEX version_info = { sizeof version_info }; + OSVERSIONINFOEX version_info = {sizeof version_info}; GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version_info)); // Windows 7 is version 6.1. @@ -238,11 +237,9 @@ bool VerifyAdminGroup() { SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; PSID Group; - BOOL check = ::AllocateAndInitializeSid(&NtAuthority, 2, - SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, - 0, 0, 0, - &Group); + BOOL check = ::AllocateAndInitializeSid( + &NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, + 0, 0, 0, 0, 0, &Group); if (check) { if (!::CheckTokenMembership(nullptr, Group, &check)) check = FALSE; @@ -262,7 +259,7 @@ KEY_READ | KEY_WRITE | KEY_WOW64_32KEY, nullptr, &key, &disposition) == ERROR_SUCCESS) { if (::RegSetValueEx(key, str, 0, REG_SZ, (LPBYTE)str, - (DWORD)lstrlen(str)) == ERROR_SUCCESS) { + (DWORD)lstrlen(str)) == ERROR_SUCCESS) { result = true; RegDeleteValue(key, str); } @@ -288,9 +285,8 @@ TOKEN_ELEVATION_TYPE elevation_type = TokenElevationTypeDefault; DWORD size_returned = 0; - if (!::GetTokenInformation(process_token, TokenElevationType, - &elevation_type, sizeof(elevation_type), - &size_returned)) { + if (!::GetTokenInformation(process_token, TokenElevationType, &elevation_type, + sizeof(elevation_type), &size_returned)) { ::CloseHandle(process_token); return false; } @@ -315,7 +311,7 @@ DWORD actual_size = 0; BYTE* token_user = new BYTE[size]; if ((::GetTokenInformation(process_token, TokenUser, token_user, size, - &actual_size)) && + &actual_size)) && (actual_size <= size)) { PSID sid = reinterpret_cast<TOKEN_USER*>(token_user)->User.Sid; if (::ConvertSidToStringSid(sid, user_sid)) @@ -402,7 +398,7 @@ // Only check that we have HKLM write permissions if we specify that // GCAPI is being invoked from an elevated shell, or in admin mode if (!VerifyHKLMAccess()) { - local_reasons |= GCCC_ERROR_ACCESSDENIED; + local_reasons |= GCCC_ERROR_ACCESSDENIED; } else if (is_windows_version_supported && !VerifyAdminGroup()) { // For Vista or later check for elevation since even for admin user we // could be running in non-elevated mode. We require integrity level High. @@ -451,10 +447,8 @@ wchar_t* exp_proc_sid; if (GetUserIdForProcess(pid, &exp_proc_sid)) { if (_wcsicmp(curr_proc_sid, exp_proc_sid) == 0) { - ScopedHandle process_handle( - ::OpenProcess(PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION, - TRUE, - pid)); + ScopedHandle process_handle(::OpenProcess( + PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION, TRUE, pid)); if (process_handle.IsValid()) { HANDLE process_token = nullptr; HANDLE user_token = nullptr; @@ -490,15 +484,16 @@ ComPtr<IProcessLauncher> ipl; if (SUCCEEDED(::CoCreateInstance(__uuidof(ProcessLauncherClass), nullptr, CLSCTX_LOCAL_SERVER, IID_PPV_ARGS(&ipl)))) { - if (SUCCEEDED(ipl->LaunchCmdLine( - chrome_command.GetCommandLineString().c_str()))) + if (SUCCEEDED( + ipl->LaunchCmdLine(chrome_command.GetCommandLineString().c_str()))) ret = true; ipl.Reset(); } else { // Couldn't get Omaha's process launcher, Omaha may not be installed at // system level. Try just running Chrome instead. ret = base::LaunchProcess(chrome_command.GetCommandLineString(), - base::LaunchOptions()).IsValid(); + base::LaunchOptions()) + .IsValid(); } if (impersonation_success) @@ -544,8 +539,8 @@ if (width == -1 && height == -1) set_window_flags |= SWP_NOSIZE; - SetWindowPosParams enum_params = { x, y, width, height, set_window_flags, - hwnd_insert_after, false }; + SetWindowPosParams enum_params = { + x, y, width, height, set_window_flags, hwnd_insert_after, false}; // Chrome may have been launched, but the window may not have appeared // yet. Wait for it to appear for 10 seconds, but exit if it takes longer @@ -655,9 +650,7 @@ int shell_mode, DWORD* error_code) { BOOL result = FALSE; - if (CanOfferReactivation(brand_code, - shell_mode, - error_code)) { + if (CanOfferReactivation(brand_code, shell_mode, error_code)) { if (SetReactivationBrandCode(brand_code, shell_mode)) { // Currently set this as a best-effort thing. We return TRUE if // reactivation succeeded regardless of the experiment label result. @@ -689,7 +682,7 @@ // a) Chrome should be installed; if (!IsChromeInstalled(HKEY_LOCAL_MACHINE) && (shell_mode != GCAPI_INVOKED_STANDARD_SHELL || - !IsChromeInstalled(HKEY_CURRENT_USER))) { + !IsChromeInstalled(HKEY_CURRENT_USER))) { if (error_code) *error_code = RELAUNCH_ERROR_NOTINSTALLED; return FALSE;
diff --git a/chrome/installer/gcapi/gcapi.h b/chrome/installer/gcapi/gcapi.h index c3bdc4c..10999a7 100644 --- a/chrome/installer/gcapi/gcapi.h +++ b/chrome/installer/gcapi/gcapi.h
@@ -8,32 +8,32 @@ #include <windows.h> // Error conditions for GoogleChromeCompatibilityCheck(). -#define GCCC_ERROR_USERLEVELALREADYPRESENT (1 << 0) -#define GCCC_ERROR_SYSTEMLEVELALREADYPRESENT (1 << 1) -#define GCCC_ERROR_ACCESSDENIED (1 << 2) -#define GCCC_ERROR_OSNOTSUPPORTED (1 << 3) -#define GCCC_ERROR_ALREADYOFFERED (1 << 4) -#define GCCC_ERROR_INTEGRITYLEVEL (1 << 5) +#define GCCC_ERROR_USERLEVELALREADYPRESENT (1 << 0) +#define GCCC_ERROR_SYSTEMLEVELALREADYPRESENT (1 << 1) +#define GCCC_ERROR_ACCESSDENIED (1 << 2) +#define GCCC_ERROR_OSNOTSUPPORTED (1 << 3) +#define GCCC_ERROR_ALREADYOFFERED (1 << 4) +#define GCCC_ERROR_INTEGRITYLEVEL (1 << 5) // Error conditions for CanReactivateChrome(). -#define REACTIVATE_ERROR_NOTINSTALLED (1 << 0) -#define REACTIVATE_ERROR_NOTDORMANT (1 << 1) -#define REACTIVATE_ERROR_ALREADY_REACTIVATED (1 << 2) -#define REACTIVATE_ERROR_INVALID_INPUT (1 << 3) -#define REACTIVATE_ERROR_REACTIVATION_FAILED (1 << 4) +#define REACTIVATE_ERROR_NOTINSTALLED (1 << 0) +#define REACTIVATE_ERROR_NOTDORMANT (1 << 1) +#define REACTIVATE_ERROR_ALREADY_REACTIVATED (1 << 2) +#define REACTIVATE_ERROR_INVALID_INPUT (1 << 3) +#define REACTIVATE_ERROR_REACTIVATION_FAILED (1 << 4) // Error conditions for CanOfferRelaunch(). -#define RELAUNCH_ERROR_NOTINSTALLED (1 << 0) -#define RELAUNCH_ERROR_INVALID_PARTNER (1 << 1) -#define RELAUNCH_ERROR_PINGS_SENT (1 << 2) -#define RELAUNCH_ERROR_NOTDORMANT (1 << 3) -#define RELAUNCH_ERROR_ALREADY_RELAUNCHED (1 << 4) -#define RELAUNCH_ERROR_INVALID_INPUT (1 << 5) -#define RELAUNCH_ERROR_RELAUNCH_FAILED (1 << 6) +#define RELAUNCH_ERROR_NOTINSTALLED (1 << 0) +#define RELAUNCH_ERROR_INVALID_PARTNER (1 << 1) +#define RELAUNCH_ERROR_PINGS_SENT (1 << 2) +#define RELAUNCH_ERROR_NOTDORMANT (1 << 3) +#define RELAUNCH_ERROR_ALREADY_RELAUNCHED (1 << 4) +#define RELAUNCH_ERROR_INVALID_INPUT (1 << 5) +#define RELAUNCH_ERROR_RELAUNCH_FAILED (1 << 6) // Flags to indicate how GCAPI is invoked -#define GCAPI_INVOKED_STANDARD_SHELL (1 << 0) -#define GCAPI_INVOKED_UAC_ELEVATION (1 << 1) +#define GCAPI_INVOKED_STANDARD_SHELL (1 << 0) +#define GCAPI_INVOKED_UAC_ELEVATION (1 << 1) #ifdef __cplusplus extern "C" { @@ -145,26 +145,22 @@ DWORD* error_code); // Function pointer type declarations to use with GetProcAddress. -typedef BOOL (__stdcall *GCCC_CompatibilityCheck)(BOOL, int, DWORD *); -typedef BOOL (__stdcall *GCCC_LaunchGC)(); -typedef BOOL (__stdcall *GCCC_LaunchGoogleChromeInBackground)(); -typedef BOOL (__stdcall *GCCC_LaunchGCWithDimensions)(int, int, int, int, bool); -typedef int (__stdcall *GCCC_GoogleChromeDaysSinceLastRun)(); -typedef BOOL (__stdcall *GCCC_CanOfferReactivation)(const wchar_t*, - int, - DWORD*); -typedef BOOL (__stdcall *GCCC_ReactivateChrome)(const wchar_t*, - int, - DWORD*); -typedef BOOL (__stdcall *GCCC_CanOfferRelaunch)(const wchar_t**, - int, - int, - DWORD*); -typedef BOOL (__stdcall *GCCC_SetRelaunchOffered)(const wchar_t**, - int, - const wchar_t*, - int, - DWORD*); +typedef BOOL(__stdcall* GCCC_CompatibilityCheck)(BOOL, int, DWORD*); +typedef BOOL(__stdcall* GCCC_LaunchGC)(); +typedef BOOL(__stdcall* GCCC_LaunchGoogleChromeInBackground)(); +typedef BOOL(__stdcall* GCCC_LaunchGCWithDimensions)(int, int, int, int, bool); +typedef int(__stdcall* GCCC_GoogleChromeDaysSinceLastRun)(); +typedef BOOL(__stdcall* GCCC_CanOfferReactivation)(const wchar_t*, int, DWORD*); +typedef BOOL(__stdcall* GCCC_ReactivateChrome)(const wchar_t*, int, DWORD*); +typedef BOOL(__stdcall* GCCC_CanOfferRelaunch)(const wchar_t**, + int, + int, + DWORD*); +typedef BOOL(__stdcall* GCCC_SetRelaunchOffered)(const wchar_t**, + int, + const wchar_t*, + int, + DWORD*); #ifdef __cplusplus } // extern "C"
diff --git a/chrome/installer/gcapi/gcapi_last_run_test.cc b/chrome/installer/gcapi/gcapi_last_run_test.cc index d069b8908..a9d0314 100644 --- a/chrome/installer/gcapi/gcapi_last_run_test.cc +++ b/chrome/installer/gcapi/gcapi_last_run_test.cc
@@ -21,7 +21,6 @@ using base::TimeDelta; using base::win::RegKey; - class GCAPILastRunTest : public ::testing::Test { protected: void SetUp() override { @@ -33,8 +32,7 @@ std::wstring reg_path(google_update::kRegPathClientState); reg_path += L"\\"; reg_path += google_update::kChromeUpgradeCode; - RegKey client_state(HKEY_CURRENT_USER, - reg_path.c_str(), + RegKey client_state(HKEY_CURRENT_USER, reg_path.c_str(), KEY_CREATE_SUB_KEY | KEY_WOW64_32KEY); ASSERT_TRUE(client_state.Valid()); @@ -43,8 +41,7 @@ std::wstring clients_path(google_update::kRegPathClients); clients_path += L"\\"; clients_path += google_update::kChromeUpgradeCode; - RegKey client_key(HKEY_CURRENT_USER, - clients_path.c_str(), + RegKey client_key(HKEY_CURRENT_USER, clients_path.c_str(), KEY_CREATE_SUB_KEY | KEY_SET_VALUE | KEY_WOW64_32KEY); ASSERT_TRUE(client_key.Valid()); client_key.WriteValue(L"pv", L"1.2.3.4"); @@ -60,12 +57,12 @@ path += L"\\"; path += google_update::kChromeUpgradeCode; - RegKey client_state( - HKEY_CURRENT_USER, path.c_str(), KEY_SET_VALUE | KEY_WOW64_32KEY); + RegKey client_state(HKEY_CURRENT_USER, path.c_str(), + KEY_SET_VALUE | KEY_WOW64_32KEY); return (client_state.Valid() && - client_state.WriteValue( - google_update::kRegLastRunTimeField, - last_run_time_string.c_str()) == ERROR_SUCCESS); + client_state.WriteValue(google_update::kRegLastRunTimeField, + last_run_time_string.c_str()) == + ERROR_SUCCESS); } private:
diff --git a/chrome/installer/gcapi/gcapi_omaha_experiment.cc b/chrome/installer/gcapi/gcapi_omaha_experiment.cc index a00de553..83c27a2 100644 --- a/chrome/installer/gcapi/gcapi_omaha_experiment.cc +++ b/chrome/installer/gcapi/gcapi_omaha_experiment.cc
@@ -27,8 +27,8 @@ // Returns the number of weeks since 2/3/2003. int GetCurrentRlzWeek(const base::Time& current_time) { - const base::Time::Exploded february_third_2003_exploded = - {2003, 2, 1, 3, 0, 0, 0, 0}; + const base::Time::Exploded february_third_2003_exploded = {2003, 2, 1, 3, + 0, 0, 0, 0}; base::Time f; bool conversion_success = base::Time::FromUTCExploded(february_third_2003_exploded, &f); @@ -60,9 +60,8 @@ label_and_separator.push_back('='); base::string16 new_labels; for (const base::string16& entry : entries) { - if (!entry.empty() && - !base::StartsWith(entry, label_and_separator, - base::CompareCase::SENSITIVE)) { + if (!entry.empty() && !base::StartsWith(entry, label_and_separator, + base::CompareCase::SENSITIVE)) { new_labels += entry; new_labels += kExperimentLabelSeparator; }
diff --git a/chrome/installer/gcapi/gcapi_reactivation.cc b/chrome/installer/gcapi/gcapi_reactivation.cc index 20a6202..0572fc97 100644 --- a/chrome/installer/gcapi/gcapi_reactivation.cc +++ b/chrome/installer/gcapi/gcapi_reactivation.cc
@@ -47,12 +47,12 @@ path += L"\\"; path += google_update::kChromeUpgradeCode; - RegKey client_state_key( - HKEY_CURRENT_USER, path.c_str(), KEY_SET_VALUE | KEY_WOW64_32KEY); + RegKey client_state_key(HKEY_CURRENT_USER, path.c_str(), + KEY_SET_VALUE | KEY_WOW64_32KEY); if (client_state_key.Valid()) { success = client_state_key.WriteValue( - google_update::kRegRLZReactivationBrandField, - brand_code.c_str()) == ERROR_SUCCESS; + google_update::kRegRLZReactivationBrandField, + brand_code.c_str()) == ERROR_SUCCESS; } if (success) { @@ -63,13 +63,10 @@ KEY_WRITE | KEY_WOW64_32KEY); if (reactivation_key.Valid()) { int64_t timestamp = Time::Now().ToInternalValue(); - reactivation_key.WriteValue(brand_code.c_str(), - ×tamp, - sizeof(timestamp), - REG_QWORD); + reactivation_key.WriteValue(brand_code.c_str(), ×tamp, + sizeof(timestamp), REG_QWORD); } } return success; } -
diff --git a/chrome/installer/gcapi/gcapi_reactivation_test.cc b/chrome/installer/gcapi/gcapi_reactivation_test.cc index b409aad..aeac25a 100644 --- a/chrome/installer/gcapi/gcapi_reactivation_test.cc +++ b/chrome/installer/gcapi/gcapi_reactivation_test.cc
@@ -36,12 +36,11 @@ std::wstring reg_path(google_update::kRegPathClients); reg_path += L"\\"; reg_path += google_update::kChromeUpgradeCode; - RegKey client_state(hive, - reg_path.c_str(), + RegKey client_state(hive, reg_path.c_str(), KEY_CREATE_SUB_KEY | KEY_SET_VALUE | KEY_WOW64_32KEY); return (client_state.Valid() && - client_state.WriteValue( - google_update::kRegVersionField, L"1.2.3.4") == ERROR_SUCCESS); + client_state.WriteValue(google_update::kRegVersionField, + L"1.2.3.4") == ERROR_SUCCESS); } bool SetLastRunTime(HKEY hive, int64_t last_run_time) { @@ -50,19 +49,18 @@ bool SetLastRunTimeString(HKEY hive, const base::string16& last_run_time_string) { - const wchar_t* base_path = - (hive == HKEY_LOCAL_MACHINE) ? - google_update::kRegPathClientStateMedium : - google_update::kRegPathClientState; + const wchar_t* base_path = (hive == HKEY_LOCAL_MACHINE) + ? google_update::kRegPathClientStateMedium + : google_update::kRegPathClientState; std::wstring path(base_path); path += L"\\"; path += google_update::kChromeUpgradeCode; RegKey client_state(hive, path.c_str(), KEY_SET_VALUE | KEY_WOW64_32KEY); return (client_state.Valid() && - client_state.WriteValue( - google_update::kRegLastRunTimeField, - last_run_time_string.c_str()) == ERROR_SUCCESS); + client_state.WriteValue(google_update::kRegLastRunTimeField, + last_run_time_string.c_str()) == + ERROR_SUCCESS); } bool HasExperimentLabels(HKEY hive) { @@ -70,18 +68,16 @@ client_state_path.push_back(L'\\'); client_state_path.append(google_update::kChromeUpgradeCode); - RegKey client_state_key(hive, - client_state_path.c_str(), + RegKey client_state_key(hive, client_state_path.c_str(), KEY_QUERY_VALUE | KEY_WOW64_32KEY); return client_state_key.Valid() && - client_state_key.HasValue(google_update::kExperimentLabels); + client_state_key.HasValue(google_update::kExperimentLabels); } std::wstring GetReactivationString(HKEY hive) { - const wchar_t* base_path = - (hive == HKEY_LOCAL_MACHINE) ? - google_update::kRegPathClientStateMedium : - google_update::kRegPathClientState; + const wchar_t* base_path = (hive == HKEY_LOCAL_MACHINE) + ? google_update::kRegPathClientStateMedium + : google_update::kRegPathClientState; std::wstring path(base_path); path += L"\\"; path += google_update::kChromeUpgradeCode; @@ -112,34 +108,30 @@ DWORD error; // We're not installed yet. Make sure CanOfferReactivation fails. - EXPECT_FALSE(CanOfferReactivation(L"GAGA", - GCAPI_INVOKED_STANDARD_SHELL, - &error)); + EXPECT_FALSE( + CanOfferReactivation(L"GAGA", GCAPI_INVOKED_STANDARD_SHELL, &error)); EXPECT_EQ(static_cast<DWORD>(REACTIVATE_ERROR_NOTINSTALLED), error); // Now pretend to be installed. CanOfferReactivation should pass. EXPECT_TRUE(SetChromeInstallMarker(HKEY_CURRENT_USER)); - EXPECT_TRUE(CanOfferReactivation(L"GAGA", - GCAPI_INVOKED_STANDARD_SHELL, - &error)); + EXPECT_TRUE( + CanOfferReactivation(L"GAGA", GCAPI_INVOKED_STANDARD_SHELL, &error)); // Now set a recent last_run value. CanOfferReactivation should fail again. Time hkcu_last_run = Time::NowFromSystemTime() - TimeDelta::FromDays(20); - EXPECT_TRUE(SetLastRunTime(HKEY_CURRENT_USER, - hkcu_last_run.ToInternalValue())); - EXPECT_FALSE(CanOfferReactivation(L"GAGA", - GCAPI_INVOKED_STANDARD_SHELL, - &error)); + EXPECT_TRUE( + SetLastRunTime(HKEY_CURRENT_USER, hkcu_last_run.ToInternalValue())); + EXPECT_FALSE( + CanOfferReactivation(L"GAGA", GCAPI_INVOKED_STANDARD_SHELL, &error)); EXPECT_EQ(static_cast<DWORD>(REACTIVATE_ERROR_NOTDORMANT), error); // Now set a last_run value that exceeds the threshold. hkcu_last_run = Time::NowFromSystemTime() - - TimeDelta::FromDays(kReactivationMinDaysDormant); - EXPECT_TRUE(SetLastRunTime(HKEY_CURRENT_USER, - hkcu_last_run.ToInternalValue())); - EXPECT_TRUE(CanOfferReactivation(L"GAGA", - GCAPI_INVOKED_STANDARD_SHELL, - &error)); + TimeDelta::FromDays(kReactivationMinDaysDormant); + EXPECT_TRUE( + SetLastRunTime(HKEY_CURRENT_USER, hkcu_last_run.ToInternalValue())); + EXPECT_TRUE( + CanOfferReactivation(L"GAGA", GCAPI_INVOKED_STANDARD_SHELL, &error)); // Test some invalid inputs EXPECT_FALSE( @@ -147,16 +139,14 @@ EXPECT_EQ(static_cast<DWORD>(REACTIVATE_ERROR_INVALID_INPUT), error); // One more valid one - EXPECT_TRUE(CanOfferReactivation(L"GAGA", - GCAPI_INVOKED_STANDARD_SHELL, - &error)); + EXPECT_TRUE( + CanOfferReactivation(L"GAGA", GCAPI_INVOKED_STANDARD_SHELL, &error)); // Check that the previous brands check works: - EXPECT_TRUE(SetReactivationBrandCode(L"GOOGOO", - GCAPI_INVOKED_STANDARD_SHELL)); - EXPECT_FALSE(CanOfferReactivation(L"GAGA", - GCAPI_INVOKED_STANDARD_SHELL, - &error)); + EXPECT_TRUE( + SetReactivationBrandCode(L"GOOGOO", GCAPI_INVOKED_STANDARD_SHELL)); + EXPECT_FALSE( + CanOfferReactivation(L"GAGA", GCAPI_INVOKED_STANDARD_SHELL, &error)); EXPECT_EQ(static_cast<DWORD>(REACTIVATE_ERROR_ALREADY_REACTIVATED), error); } @@ -167,31 +157,23 @@ EXPECT_TRUE(SetChromeInstallMarker(HKEY_CURRENT_USER)); Time hkcu_last_run = Time::NowFromSystemTime() - - TimeDelta::FromDays(kReactivationMinDaysDormant); - EXPECT_TRUE(SetLastRunTime(HKEY_CURRENT_USER, - hkcu_last_run.ToInternalValue())); + TimeDelta::FromDays(kReactivationMinDaysDormant); + EXPECT_TRUE( + SetLastRunTime(HKEY_CURRENT_USER, hkcu_last_run.ToInternalValue())); - EXPECT_TRUE(ReactivateChrome(L"GAGA", - GCAPI_INVOKED_STANDARD_SHELL, - &error)); + EXPECT_TRUE(ReactivateChrome(L"GAGA", GCAPI_INVOKED_STANDARD_SHELL, &error)); EXPECT_EQ(L"GAGA", GetReactivationString(HKEY_CURRENT_USER)); // Make sure we can't reactivate again: - EXPECT_FALSE(ReactivateChrome(L"GAGA", - GCAPI_INVOKED_STANDARD_SHELL, - &error)); + EXPECT_FALSE(ReactivateChrome(L"GAGA", GCAPI_INVOKED_STANDARD_SHELL, &error)); EXPECT_EQ(static_cast<DWORD>(REACTIVATE_ERROR_ALREADY_REACTIVATED), error); // Should not be able to reactivate under other brands: - EXPECT_FALSE(ReactivateChrome(L"MAMA", - GCAPI_INVOKED_STANDARD_SHELL, - &error)); + EXPECT_FALSE(ReactivateChrome(L"MAMA", GCAPI_INVOKED_STANDARD_SHELL, &error)); EXPECT_EQ(L"GAGA", GetReactivationString(HKEY_CURRENT_USER)); // Validate that previous_brands are rejected: - EXPECT_FALSE(ReactivateChrome(L"PFFT", - GCAPI_INVOKED_STANDARD_SHELL, - &error)); + EXPECT_FALSE(ReactivateChrome(L"PFFT", GCAPI_INVOKED_STANDARD_SHELL, &error)); EXPECT_EQ(static_cast<DWORD>(REACTIVATE_ERROR_ALREADY_REACTIVATED), error); EXPECT_EQ(L"GAGA", GetReactivationString(HKEY_CURRENT_USER)); } @@ -203,13 +185,11 @@ EXPECT_TRUE(SetChromeInstallMarker(HKEY_CURRENT_USER)); Time hkcu_last_run = Time::NowFromSystemTime() - - TimeDelta::FromDays(kReactivationMinDaysDormant); - EXPECT_TRUE(SetLastRunTime(HKEY_CURRENT_USER, - hkcu_last_run.ToInternalValue())); + TimeDelta::FromDays(kReactivationMinDaysDormant); + EXPECT_TRUE( + SetLastRunTime(HKEY_CURRENT_USER, hkcu_last_run.ToInternalValue())); - EXPECT_TRUE(ReactivateChrome(L"GAGA", - GCAPI_INVOKED_STANDARD_SHELL, - &error)); + EXPECT_TRUE(ReactivateChrome(L"GAGA", GCAPI_INVOKED_STANDARD_SHELL, &error)); EXPECT_EQ(L"GAGA", GetReactivationString(HKEY_CURRENT_USER)); EXPECT_TRUE(HasExperimentLabels(HKEY_CURRENT_USER));
diff --git a/chrome/installer/gcapi/gcapi_test.cc b/chrome/installer/gcapi/gcapi_test.cc index ffb733ca..fd80d1b 100644 --- a/chrome/installer/gcapi/gcapi_test.cc +++ b/chrome/installer/gcapi/gcapi_test.cc
@@ -24,7 +24,7 @@ TRUE, GCAPI_INVOKED_STANDARD_SHELL, &reason); if (result_flag_off != result_flag_on) - printf("Registry key flag is not being set properly."); + printf("Registry key flag is not being set properly."); printf("Static call returned result as %d and reason as %ld.\n", result_flag_on, reason); @@ -37,7 +37,7 @@ return; } - GCCC_CompatibilityCheck gccfn = (GCCC_CompatibilityCheck) GetProcAddress( + GCCC_CompatibilityCheck gccfn = (GCCC_CompatibilityCheck)GetProcAddress( module, "GoogleChromeCompatibilityCheck"); if (gccfn != nullptr) { DWORD reason = 0;
diff --git a/chrome/installer/gcapi/google_update_util.h b/chrome/installer/gcapi/google_update_util.h index 0a048ef..39cfeef 100644 --- a/chrome/installer/gcapi/google_update_util.h +++ b/chrome/installer/gcapi/google_update_util.h
@@ -17,11 +17,11 @@ // with the brand. bool GetBrand(base::string16* value); -// Reads Chrome's experiment lables into |experiment_lables|. +// Reads Chrome's experiment labels into |experiment_labels|. bool ReadExperimentLabels(bool system_install, base::string16* experiment_labels); -// Sets Chrome's experiment lables to |experiment_lables|. +// Sets Chrome's experiment labels to |experiment_labels|. bool SetExperimentLabels(bool system_install, const base::string16& experiment_labels);
diff --git a/chrome/installer/gcapi/resource.h b/chrome/installer/gcapi/resource.h index 45d46cb2..e2e12c3 100644 --- a/chrome/installer/gcapi/resource.h +++ b/chrome/installer/gcapi/resource.h
@@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef CHROME_INSTALLER_GCAPI_RESOURCE_H_ +#define CHROME_INSTALLER_GCAPI_RESOURCE_H_ + //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by gcapi_test.rc @@ -10,9 +13,11 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 #endif #endif + +#endif // CHROME_INSTALLER_GCAPI_RESOURCE_H_
diff --git a/chrome/installer/gcapi_mac/gcapi.h b/chrome/installer/gcapi_mac/gcapi.h index 7ec9ca5..9a5b0372 100644 --- a/chrome/installer/gcapi_mac/gcapi.h +++ b/chrome/installer/gcapi_mac/gcapi.h
@@ -6,11 +6,11 @@ #define CHROME_INSTALLER_GCAPI_MAC_GCAPI_H_ // Error conditions for GoogleChromeCompatibilityCheck(). -#define GCCC_ERROR_ALREADYPRESENT (1 << 0) -#define GCCC_ERROR_ACCESSDENIED (1 << 1) -#define GCCC_ERROR_OSNOTSUPPORTED (1 << 2) -#define GCCC_ERROR_ALREADYOFFERED (1 << 3) -#define GCCC_ERROR_INTEGRITYLEVEL (1 << 4) +#define GCCC_ERROR_ALREADYPRESENT (1 << 0) +#define GCCC_ERROR_ACCESSDENIED (1 << 1) +#define GCCC_ERROR_OSNOTSUPPORTED (1 << 2) +#define GCCC_ERROR_ALREADYOFFERED (1 << 3) +#define GCCC_ERROR_INTEGRITYLEVEL (1 << 4) #ifdef __cplusplus extern "C" {
diff --git a/chrome/installer/gcapi_mac/gcapi.mm b/chrome/installer/gcapi_mac/gcapi.mm index 4843e34..f5ec409 100644 --- a/chrome/installer/gcapi_mac/gcapi.mm +++ b/chrome/installer/gcapi_mac/gcapi.mm
@@ -79,8 +79,8 @@ if (!session_info_dict) return nullptr; // Possibly no screen plugged in. - CFNumberRef ns_uid = (CFNumberRef)CFDictionaryGetValue(session_info_dict, - kCGSessionUserIDKey); + CFNumberRef ns_uid = + (CFNumberRef)CFDictionaryGetValue(session_info_dict, kCGSessionUserIDKey); if (CFGetTypeID(ns_uid) != CFNumberGetTypeID()) return nullptr; @@ -92,9 +92,7 @@ return getpwuid(uid); } -enum TicketKind { - kSystemTicket, kUserTicket -}; +enum TicketKind { kSystemTicket, kUserTicket }; // Replaces "~~" with |home_dir|. NSString* AdjustHomedir(NSString* s, const char* home_dir) { @@ -106,7 +104,8 @@ // If |chrome_path| is not 0, |*chrome_path| is set to the path where chrome // is according to keystone. It's only set if that path exists on disk. -BOOL FindChromeTicket(TicketKind kind, const passwd* user, +BOOL FindChromeTicket(TicketKind kind, + const passwd* user, NSString** chrome_path) { if (chrome_path) *chrome_path = nil; @@ -116,7 +115,7 @@ arrayWithObjects:kSystemKsadminPath, kSystemKsadminPathOld, nil]; if (kind == kUserTicket) { [keystone_paths insertObject:AdjustHomedir(kUserKsadminPath, user->pw_dir) - atIndex:0]; + atIndex:0]; [keystone_paths insertObject:AdjustHomedir(kUserKsadminPathOld, user->pw_dir) atIndex:1]; @@ -136,15 +135,15 @@ [task setLaunchPath:ks_path]; NSArray* arguments = @[ - kind == kUserTicket ? @"--user-store" : @"--system-store", - @"--print-tickets", - @"--productid", - @"com.google.Chrome", + kind == kUserTicket ? @"--user-store" : @"--system-store", + @"--print-tickets", + @"--productid", + @"com.google.Chrome", ]; if (geteuid() == 0 && kind == kUserTicket) { NSString* run_as = [NSString stringWithUTF8String:user->pw_name]; [task setLaunchPath:@"/usr/bin/sudo"]; - arguments = [@[@"-u", run_as, ks_path] + arguments = [@[ @"-u", run_as, ks_path ] arrayByAddingObjectsFromArray:arguments]; } [task setArguments:arguments]; @@ -160,10 +159,10 @@ [task waitUntilExit]; ksadmin_ran_successfully = [task terminationStatus] == 0; - string = [[[NSString alloc] initWithData:data - encoding:NSUTF8StringEncoding] autorelease]; - } - @catch (id exception) { + string = + [[[NSString alloc] initWithData:data + encoding:NSUTF8StringEncoding] autorelease]; + } @catch (id exception) { // Most likely, ks_path didn't exist. } [task release]; @@ -244,14 +243,12 @@ // Tries to write |data| at |user_path|. // Returns the path where it wrote, or nil on failure. -NSString* WriteUserData(NSData* data, - NSString* user_path, - const passwd* user) { +NSString* WriteUserData(NSData* data, NSString* user_path, const passwd* user) { user_path = AdjustHomedir(user_path, user->pw_dir); - if (CreatePathToFile(user_path, user) && - [data writeToFile:user_path atomically:YES]) { + if (CreatePathToFile(user_path, user) && [data writeToFile:user_path + atomically:YES]) { chmod([user_path fileSystemRepresentation], kUserPermissions & ~0111); - chown([user_path fileSystemRepresentation], user->pw_uid, user->pw_gid); + chown([user_path fileSystemRepresentation], user -> pw_uid, user -> pw_gid); return user_path; } return nil; @@ -269,7 +266,7 @@ chmod([system_path fileSystemRepresentation], kAdminPermissions & ~0111); // Make sure the file is owned by group admin. if (group* group = getgrnam("admin")) - chown([system_path fileSystemRepresentation], 0, group->gr_gid); + chown([system_path fileSystemRepresentation], 0, group -> gr_gid); return system_path; } @@ -279,7 +276,7 @@ NSString* WriteBrandCode(const char* brand_code, const passwd* user) { NSDictionary* brand_dict = @{ - kBrandKey: [NSString stringWithUTF8String:brand_code], + kBrandKey : [NSString stringWithUTF8String:brand_code], }; NSData* contents = [NSPropertyListSerialization dataFromPropertyList:brand_dict @@ -294,8 +291,8 @@ const passwd* user) { NSData* contents = [NSData dataWithBytes:master_prefs_contents length:master_prefs_contents_size]; - return WriteData( - contents, kSystemMasterPrefsPath, kUserMasterPrefsPath, user) != nil; + return WriteData(contents, kSystemMasterPrefsPath, kUserMasterPrefsPath, + user) != nil; } NSString* PathToFramework(NSString* app_path, NSDictionary* info_plist) { @@ -309,8 +306,8 @@ } NSString* PathToInstallScript(NSString* app_path, NSDictionary* info_plist) { - return [PathToFramework(app_path, info_plist) stringByAppendingPathComponent: - @"Resources/install.sh"]; + return [PathToFramework(app_path, info_plist) + stringByAppendingPathComponent:@"Resources/install.sh"]; } bool isbrandchar(int c) { @@ -345,7 +342,7 @@ if ((local_reasons & GCCC_ERROR_ALREADYPRESENT) == 0) { if (![[NSFileManager defaultManager] isWritableFileAtPath:@"/Applications"]) - local_reasons |= GCCC_ERROR_ACCESSDENIED; + local_reasons |= GCCC_ERROR_ACCESSDENIED; } } @@ -404,16 +401,13 @@ stringByReplacingOccurrencesOfString:@"'" withString:single_quote_escape]; - NSString* install_script_execution = - [NSString stringWithFormat:@"exec '%@' '%@' '%@'", - install_script_quoted, - app_path_quoted, - install_path_quoted]; - [task setArguments: - @[run_as, @"-c", install_script_execution]]; + NSString* install_script_execution = [NSString + stringWithFormat:@"exec '%@' '%@' '%@'", install_script_quoted, + app_path_quoted, install_path_quoted]; + [task setArguments:@[ run_as, @"-c", install_script_execution ]]; } else { [task setLaunchPath:install_script]; - [task setArguments:@[app_path, kChromeInstallPath]]; + [task setArguments:@[ app_path, kChromeInstallPath ]]; } [task launch]; @@ -421,8 +415,7 @@ if ([task terminationStatus] != 0) { return 0; } - } - @catch (id exception) { + } @catch (id exception) { return 0; } @@ -432,9 +425,10 @@ [info_plist_brand respondsToSelector:@selector(UTF8String)]) brand_code = [info_plist_brand UTF8String]; - BOOL valid_brand_code = brand_code && strlen(brand_code) == 4 && - isbrandchar(brand_code[0]) && isbrandchar(brand_code[1]) && - isbrandchar(brand_code[2]) && isbrandchar(brand_code[3]); + BOOL valid_brand_code = + brand_code && strlen(brand_code) == 4 && isbrandchar(brand_code[0]) && + isbrandchar(brand_code[1]) && isbrandchar(brand_code[2]) && + isbrandchar(brand_code[3]); NSString* brand_path = nil; if (valid_brand_code)
diff --git a/chrome/installer/gcapi_mac/gcapi_example_client.mm b/chrome/installer/gcapi_mac/gcapi_example_client.mm index 7f3106e..9b24c7b 100644 --- a/chrome/installer/gcapi_mac/gcapi_example_client.mm +++ b/chrome/installer/gcapi_mac/gcapi_example_client.mm
@@ -11,16 +11,16 @@ void Usage() { fprintf(stderr, -"usage: gcapi_example [options]\n" -"\n" -"options:\n" -" --criteria-check exit after criteria check\n" -" --force-reinstall delete Google Chrome from Applications first\n" -" --install <path> copy <path> to /Applications/Google Chrome.app, set up\n" -" --brand <CODE> set brandcode to <CODE> during installation\n" -" --launch launch Google Chrome when all is done\n" -" --help print this message\n" -); + "usage: gcapi_example [options]\n" + "\n" + "options:\n" + " --criteria-check exit after criteria check\n" + " --force-reinstall delete Google Chrome from Applications first\n" + " --install <path> copy <path> to /Applications/Google " + "Chrome.app, set up\n" + " --brand <CODE> set brandcode to <CODE> during installation\n" + " --launch launch Google Chrome when all is done\n" + " --help print this message\n"); } int main(int argc, char* argv[]) { @@ -65,7 +65,8 @@ if (reinstall) { [[NSFileManager defaultManager] - removeItemAtPath:@"/Applications/Google Chrome.app" error:nil]; + removeItemAtPath:@"/Applications/Google Chrome.app" + error:nil]; } unsigned reasons;
diff --git a/chrome/installer/launcher_support/chrome_launcher_support.cc b/chrome/installer/launcher_support/chrome_launcher_support.cc index 0e5a5e25..36afdc9 100644 --- a/chrome/installer/launcher_support/chrome_launcher_support.cc +++ b/chrome/installer/launcher_support/chrome_launcher_support.cc
@@ -61,8 +61,8 @@ const wchar_t* app_guid, const wchar_t* value_name, base::string16* value) { - HKEY root_key = (level == USER_LEVEL_INSTALLATION) ? - HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; + HKEY root_key = (level == USER_LEVEL_INSTALLATION) ? HKEY_CURRENT_USER + : HKEY_LOCAL_MACHINE; base::string16 subkey(key_path); if (app_guid) subkey.append(1, L'\\').append(app_guid);
diff --git a/chrome/installer/linux/common/installer.include b/chrome/installer/linux/common/installer.include index 2c84038c..7c517f3d 100644 --- a/chrome/installer/linux/common/installer.include +++ b/chrome/installer/linux/common/installer.include
@@ -105,7 +105,7 @@ > "$TMPLOUT" <<< "$TMPLINCL" ) -# Setup the installation directory hierachy in the package staging area. +# Setup the installation directory hierarchy in the package staging area. prep_staging_common() { install -m 755 -d "${STAGEDIR}/${INSTALLDIR}" \ "${STAGEDIR}/usr/bin" \
diff --git a/chrome/installer/linux/debian/build.sh b/chrome/installer/linux/debian/build.sh index 29e94a6f..b5755a2 100755 --- a/chrome/installer/linux/debian/build.sh +++ b/chrome/installer/linux/debian/build.sh
@@ -35,7 +35,7 @@ rm -f "${DEB_CONTROL}" } -# Setup the installation directory hierachy in the package staging area. +# Setup the installation directory hierarchy in the package staging area. prep_staging_debian() { prep_staging_common install -m 755 -d "${STAGEDIR}/DEBIAN" \
diff --git a/chrome/installer/linux/rpm/build.sh b/chrome/installer/linux/rpm/build.sh index 7ee7cf9..074d57d 100755 --- a/chrome/installer/linux/rpm/build.sh +++ b/chrome/installer/linux/rpm/build.sh
@@ -24,7 +24,7 @@ process_template "${SCRIPTDIR}/chrome.spec.template" "${SPEC}" } -# Setup the installation directory hierachy in the package staging area. +# Setup the installation directory hierarchy in the package staging area. prep_staging_rpm() { prep_staging_common install -m 755 -d "${STAGEDIR}/etc/cron.daily"
diff --git a/chrome/installer/mac/sign_chrome.py b/chrome/installer/mac/sign_chrome.py index 5fcb89d..07b9034 100755 --- a/chrome/installer/mac/sign_chrome.py +++ b/chrome/installer/mac/sign_chrome.py
@@ -45,6 +45,7 @@ if development: class DevelopmentCodeSignConfig(config_class): + @property def codesign_requirements_basic(self): return ''
diff --git a/chrome/installer/mac/signing/model.py b/chrome/installer/mac/signing/model.py index 364e6340..4af09005 100644 --- a/chrome/installer/mac/signing/model.py +++ b/chrome/installer/mac/signing/model.py
@@ -271,10 +271,11 @@ return super(DistributionCodeSignConfig, self).packaging_basename - return DistributionCodeSignConfig( - base_config.identity, base_config.installer_identity, - base_config.notary_user, base_config.notary_password, - base_config.notary_asc_provider) + return DistributionCodeSignConfig(base_config.identity, + base_config.installer_identity, + base_config.notary_user, + base_config.notary_password, + base_config.notary_asc_provider) class Paths(object):
diff --git a/chrome/installer/mac/signing/modification_test.py b/chrome/installer/mac/signing/modification_test.py index 5f30778..6de52ed 100644 --- a/chrome/installer/mac/signing/modification_test.py +++ b/chrome/installer/mac/signing/modification_test.py
@@ -321,24 +321,28 @@ self.assertEqual(7, plistlib.writePlist.call_count) plistlib.writePlist.assert_has_calls([ - mock.call({ - 'CFBundleIdentifier': - 'test.signing.bundle_id.canary.AlertNotificationService.xpc' - }, '$W/App Product Canary.app/Contents/Frameworks/Product Framework.framework/XPCServices/AlertNotificationService.xpc/Contents/Info.plist' - ), - mock.call({ - 'CFBundleIdentifier': config.base_bundle_id, - 'CFBundleExecutable': config.app_product, - 'KSProductID': 'test.ksproduct.canary', - 'KSChannelID': 'canary', - 'KSChannelID-full': 'canary-full', - 'CrProductDirName': 'Acme/Product Canary', - 'CFBundleSignature': 'Mooo' - }, '$W/App Product Canary.app/Contents/Info.plist'), - mock.call({ - 'com.apple.application-identifier': - 'test.signing.bundle_id.canary' - }, '$W/app-entitlements.plist'), + mock.call( + { + 'CFBundleIdentifier': + 'test.signing.bundle_id.canary.AlertNotificationService.xpc' + }, + '$W/App Product Canary.app/Contents/Frameworks/Product Framework.framework/XPCServices/AlertNotificationService.xpc/Contents/Info.plist' + ), + mock.call( + { + 'CFBundleIdentifier': config.base_bundle_id, + 'CFBundleExecutable': config.app_product, + 'KSProductID': 'test.ksproduct.canary', + 'KSChannelID': 'canary', + 'KSChannelID-full': 'canary-full', + 'CrProductDirName': 'Acme/Product Canary', + 'CFBundleSignature': 'Mooo' + }, '$W/App Product Canary.app/Contents/Info.plist'), + mock.call( + { + 'com.apple.application-identifier': + 'test.signing.bundle_id.canary' + }, '$W/app-entitlements.plist'), mock.call({}, '$W/helper-gpu-entitlements.plist'), mock.call({}, '$W/helper-renderer-entitlements.plist'), mock.call({}, '$W/helper-plugin-entitlements.plist'),
diff --git a/chrome/installer/mac/signing/notarize_test.py b/chrome/installer/mac/signing/notarize_test.py index 00d8df7..b9d5e62 100644 --- a/chrome/installer/mac/signing/notarize_test.py +++ b/chrome/installer/mac/signing/notarize_test.py
@@ -179,11 +179,9 @@ @mock.patch('signing.commands.run_command_output') def test_bad_notarization_info(self, run_command_output, **kwargs): run_command_output.side_effect = subprocess.CalledProcessError( - 239, 'altool', _make_plist({ - 'product-errors': [{ - 'code': 9595 - }] - })) + 239, 'altool', _make_plist({'product-errors': [{ + 'code': 9595 + }]})) with self.assertRaises(subprocess.CalledProcessError): uuids = ['77c0ad17-479e-4b82-946a-73739cf6ca16'] @@ -193,11 +191,10 @@ @mock.patch.multiple('signing.commands', **{'run_command_output': mock.DEFAULT}) def test_timeout(self, **kwargs): - kwargs['run_command_output'].return_value = _make_plist({ - 'notarization-info': { + kwargs['run_command_output'].return_value = _make_plist( + {'notarization-info': { 'Status': 'in progress' - } - }) + }}) uuid = '0c652bb4-7d44-4904-8c59-1ee86a376ece' uuids = [uuid] with self.assertRaises(notarize.NotarizationError) as cm:
diff --git a/chrome/installer/mac/signing/parts_test.py b/chrome/installer/mac/signing/parts_test.py index 6fcb833..0247ab42 100644 --- a/chrome/installer/mac/signing/parts_test.py +++ b/chrome/installer/mac/signing/parts_test.py
@@ -259,5 +259,5 @@ def test_sanity_check_bad(self, read_plist, **kwargs): config = model.Distribution().to_config(test_config.TestConfig()) self.assertRaises( - ValueError, - lambda: parts.sign_chrome(self.paths, config, sign_framework=True)) + ValueError, lambda: parts.sign_chrome( + self.paths, config, sign_framework=True))
diff --git a/chrome/installer/mac/signing/pipeline_test.py b/chrome/installer/mac/signing/pipeline_test.py index c0d0970..6c9a8c1 100644 --- a/chrome/installer/mac/signing/pipeline_test.py +++ b/chrome/installer/mac/signing/pipeline_test.py
@@ -219,7 +219,8 @@ '$W/App Product Canary.app/Contents/Frameworks/Product Framework.framework', '$W/modified_unsigned_framework', dry_run=False), - mock.call.sign_chrome(paths, channel_dist_config, sign_framework=True), + mock.call.sign_chrome( + paths, channel_dist_config, sign_framework=True), mock.call.copy_dir_overwrite_and_count_changes( '$W/App Product Canary.app/Contents/Frameworks/Product Framework.framework', '$W/modified_unsigned_framework', @@ -419,10 +420,9 @@ self.assertEqual('$O/AppProduct-99.0.9999.99.pkg', pipeline._package_and_sign_pkg(paths, dist_config)) - manager.assert_has_calls([ - mock.call.run_command(mock.ANY), - mock.call.run_command(mock.ANY) - ]) + manager.assert_has_calls( + [mock.call.run_command(mock.ANY), + mock.call.run_command(mock.ANY)]) run_commands = [ call for call in manager.mock_calls if call[0] == 'run_command' @@ -512,10 +512,9 @@ self.assertEqual('$O/AppProduct-99.0.9999.99-ForCows.pkg', pipeline._package_and_sign_pkg(paths, dist_config)) - manager.assert_has_calls([ - mock.call.run_command(mock.ANY), - mock.call.run_command(mock.ANY) - ]) + manager.assert_has_calls( + [mock.call.run_command(mock.ANY), + mock.call.run_command(mock.ANY)]) run_commands = [ call for call in manager.mock_calls if call[0] == 'run_command' @@ -738,9 +737,9 @@ m: mock.DEFAULT for m in ('move_file', 'copy_files', 'run_command', 'make_dir', 'shutil') }) -@mock.patch.multiple( - 'signing.notarize', - **{m: mock.DEFAULT for m in ('submit', 'wait_for_results', 'staple')}) +@mock.patch.multiple('signing.notarize', **{ + m: mock.DEFAULT for m in ('submit', 'wait_for_results', 'staple') +}) @mock.patch.multiple( 'signing.pipeline', **{ m: mock.DEFAULT @@ -796,9 +795,7 @@ cwd='$W_1/AppProduct-99.0.9999.99'), mock.call.submit('$W_1/AppProduct-99.0.9999.99.zip', mock.ANY), mock.call.shutil.rmtree('$W_2'), - mock.call.wait_for_results({ - app_uuid: None - }.keys(), mock.ANY), + mock.call.wait_for_results({app_uuid: None}.keys(), mock.ANY), mock.call._staple_chrome( self.paths.replace_work('$W_1/AppProduct-99.0.9999.99'), mock.ANY), @@ -808,9 +805,7 @@ # Notarize the DMG. mock.call.submit('$O/AppProduct-99.0.9999.99.dmg', mock.ANY), - mock.call.wait_for_results({ - dmg_uuid: None - }.keys(), mock.ANY), + mock.call.wait_for_results({dmg_uuid: None}.keys(), mock.ANY), mock.call.staple('$O/AppProduct-99.0.9999.99.dmg'), mock.call.shutil.rmtree('$W_1'), @@ -859,9 +854,7 @@ cwd='$W_1/AppProduct-99.0.9999.99'), mock.call.submit('$W_1/AppProduct-99.0.9999.99.zip', mock.ANY), mock.call.shutil.rmtree('$W_2'), - mock.call.wait_for_results({ - app_uuid: None - }.keys(), mock.ANY), + mock.call.wait_for_results({app_uuid: None}.keys(), mock.ANY), mock.call._staple_chrome( self.paths.replace_work('$W_1/AppProduct-99.0.9999.99'), mock.ANY), @@ -871,9 +864,7 @@ # Notarize the DMG. mock.call.submit('$O/AppProduct-99.0.9999.99.pkg', mock.ANY), - mock.call.wait_for_results({ - pkg_uuid: None - }.keys(), mock.ANY), + mock.call.wait_for_results({pkg_uuid: None}.keys(), mock.ANY), mock.call.staple('$O/AppProduct-99.0.9999.99.pkg'), mock.call.shutil.rmtree('$W_1'), @@ -925,9 +916,7 @@ cwd='$W_1/AppProduct-99.0.9999.99'), mock.call.submit('$W_1/AppProduct-99.0.9999.99.zip', mock.ANY), mock.call.shutil.rmtree('$W_2'), - mock.call.wait_for_results({ - app_uuid: None - }.keys(), mock.ANY), + mock.call.wait_for_results({app_uuid: None}.keys(), mock.ANY), mock.call._staple_chrome( self.paths.replace_work('$W_1/AppProduct-99.0.9999.99'), mock.ANY), @@ -978,9 +967,7 @@ cwd='$W_1/AppProduct-99.0.9999.99'), mock.call.submit('$W_1/AppProduct-99.0.9999.99.zip', mock.ANY), mock.call.shutil.rmtree('$W_2'), - mock.call.wait_for_results({ - app_uuid: None - }.keys(), mock.ANY), + mock.call.wait_for_results({app_uuid: None}.keys(), mock.ANY), mock.call._staple_chrome( self.paths.replace_work('$W_1/AppProduct-99.0.9999.99'), mock.ANY), @@ -1028,8 +1015,9 @@ manager.assert_has_calls([ # First customize the distribution and sign it. - mock.call._customize_and_sign_chrome( - mock.ANY, mock.ANY, '$O/AppProduct-99.0.9999.99', mock.ANY), + mock.call._customize_and_sign_chrome(mock.ANY, mock.ANY, + '$O/AppProduct-99.0.9999.99', + mock.ANY), mock.call.shutil.rmtree('$W_2'), mock.call.shutil.rmtree('$W_1'),
diff --git a/chrome/installer/mini_installer/configuration_test.cc b/chrome/installer/mini_installer/configuration_test.cc index 9317977c..0e4f0ca 100644 --- a/chrome/installer/mini_installer/configuration_test.cc +++ b/chrome/installer/mini_installer/configuration_test.cc
@@ -31,9 +31,7 @@ env_->SetVar("GoogleUpdateIsMachine", value ? "1" : "0"); } - ~ScopedGoogleUpdateIsMachine() { - env_->UnSetVar("GoogleUpdateIsMachine"); - } + ~ScopedGoogleUpdateIsMachine() { env_->UnSetVar("GoogleUpdateIsMachine"); } private: std::unique_ptr<base::Environment> env_; @@ -101,9 +99,9 @@ TEST_F(MiniInstallerConfigurationTest, CommandLine) { static const wchar_t* const kCommandLines[] = { - L"", - L"spam.exe", - L"spam.exe --foo", + L"", + L"spam.exe", + L"spam.exe --foo", }; for (size_t i = 0; i < _countof(kCommandLines); ++i) { EXPECT_TRUE(std::wstring(kCommandLines[i]) == @@ -142,8 +140,8 @@ TEST_F(MiniInstallerConfigurationTest, HasInvalidSwitch) { EXPECT_FALSE(TestConfiguration(L"spam.exe").has_invalid_switch()); - EXPECT_TRUE(TestConfiguration(L"spam.exe --chrome-frame") - .has_invalid_switch()); + EXPECT_TRUE( + TestConfiguration(L"spam.exe --chrome-frame").has_invalid_switch()); } } // namespace mini_installer
diff --git a/chrome/installer/mini_installer/decompress.cc b/chrome/installer/mini_installer/decompress.cc index 2ece0c80..a9b97b69 100644 --- a/chrome/installer/mini_installer/decompress.cc +++ b/chrome/installer/mini_installer/decompress.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include <windows.h> // NOLINT + #include <fcntl.h> // for _O_* constants #include <fdi.h> #include <stddef.h> @@ -55,15 +56,13 @@ template <typename T> class scoped_ptr { public: - explicit scoped_ptr(T* a) : a_(a) { - } + explicit scoped_ptr(T* a) : a_(a) {} ~scoped_ptr() { if (a_) Free(a_); } - operator T*() { - return a_; - } + operator T*() { return a_; } + private: T* a_; }; @@ -170,14 +169,23 @@ HMODULE g_fdi = nullptr; // API prototypes. -typedef HFDI (DIAMONDAPI* FDICreateFn)(PFNALLOC alloc, PFNFREE free, - PFNOPEN open, PFNREAD read, - PFNWRITE write, PFNCLOSE close, - PFNSEEK seek, int cpu_type, PERF perf); -typedef BOOL (DIAMONDAPI* FDIDestroyFn)(HFDI fdi); -typedef BOOL (DIAMONDAPI* FDICopyFn)(HFDI fdi, char* cab, char* cab_path, - int flags, PFNFDINOTIFY notify, - PFNFDIDECRYPT decrypt, void* context); +typedef HFDI(DIAMONDAPI* FDICreateFn)(PFNALLOC alloc, + PFNFREE free, + PFNOPEN open, + PFNREAD read, + PFNWRITE write, + PFNCLOSE close, + PFNSEEK seek, + int cpu_type, + PERF perf); +typedef BOOL(DIAMONDAPI* FDIDestroyFn)(HFDI fdi); +typedef BOOL(DIAMONDAPI* FDICopyFn)(HFDI fdi, + char* cab, + char* cab_path, + int flags, + PFNFDINOTIFY notify, + PFNFDIDECRYPT decrypt, + void* context); FDICreateFn g_FDICreate = nullptr; FDIDestroyFn g_FDIDestroy = nullptr; FDICopyFn g_FDICopy = nullptr; @@ -190,16 +198,16 @@ // fails. // The cabinet.dll should be available on all supported versions of Windows. static const wchar_t* const candidate_paths[] = { - L"%WINDIR%\\system32\\cabinet.dll", - L"%SYSTEMROOT%\\system32\\cabinet.dll", - L"C:\\Windows\\system32\\cabinet.dll", + L"%WINDIR%\\system32\\cabinet.dll", + L"%SYSTEMROOT%\\system32\\cabinet.dll", + L"C:\\Windows\\system32\\cabinet.dll", }; wchar_t path[MAX_PATH] = {0}; for (size_t i = 0; i < _countof(candidate_paths); ++i) { path[0] = L'\0'; - DWORD result = ::ExpandEnvironmentStringsW(candidate_paths[i], - path, _countof(path)); + DWORD result = + ::ExpandEnvironmentStringsW(candidate_paths[i], path, _countof(path)); if (result > 0 && result <= _countof(path)) g_fdi = ::LoadLibraryExW(path, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH); @@ -214,8 +222,7 @@ reinterpret_cast<FDICreateFn>(::GetProcAddress(g_fdi, "FDICreate")); g_FDIDestroy = reinterpret_cast<FDIDestroyFn>(::GetProcAddress(g_fdi, "FDIDestroy")); - g_FDICopy = - reinterpret_cast<FDICopyFn>(::GetProcAddress(g_fdi, "FDICopy")); + g_FDICopy = reinterpret_cast<FDICopyFn>(::GetProcAddress(g_fdi, "FDICopy")); } return g_FDICreate && g_FDIDestroy && g_FDICopy;
diff --git a/chrome/installer/mini_installer/decompress_test.cc b/chrome/installer/mini_installer/decompress_test.cc index ba4056bb..3dd0c97d 100644 --- a/chrome/installer/mini_installer/decompress_test.cc +++ b/chrome/installer/mini_installer/decompress_test.cc
@@ -14,10 +14,10 @@ base::FilePath source_path; base::PathService::Get(base::DIR_SOURCE_ROOT, &source_path); source_path = source_path.Append(FILE_PATH_LITERAL("chrome")) - .Append(FILE_PATH_LITERAL("installer")) - .Append(FILE_PATH_LITERAL("test")) - .Append(FILE_PATH_LITERAL("data")) - .Append(FILE_PATH_LITERAL("SETUP.EX_")); + .Append(FILE_PATH_LITERAL("installer")) + .Append(FILE_PATH_LITERAL("test")) + .Append(FILE_PATH_LITERAL("data")) + .Append(FILE_PATH_LITERAL("SETUP.EX_")); // Prepare a temp folder that will be automatically deleted along with // our temporary test data.
diff --git a/chrome/installer/mini_installer/mini_installer.cc b/chrome/installer/mini_installer/mini_installer.cc index b21c4b9..1db1716 100644 --- a/chrome/installer/mini_installer/mini_installer.cc +++ b/chrome/installer/mini_installer/mini_installer.cc
@@ -279,8 +279,10 @@ // matching resource found, the callback is invoked and at this point we write // it to disk. We expect resource names to start with 'chrome' or 'setup'. Any // other name is treated as an error. -BOOL CALLBACK OnResourceFound(HMODULE module, const wchar_t* type, - wchar_t* name, LONG_PTR context) { +BOOL CALLBACK OnResourceFound(HMODULE module, + const wchar_t* type, + wchar_t* name, + LONG_PTR context) { if (!context) return FALSE; @@ -291,8 +293,7 @@ return FALSE; PathString full_path; - if (!full_path.assign(ctx->base_path) || - !full_path.append(name) || + if (!full_path.assign(ctx->base_path) || !full_path.append(name) || !resource.WriteToDisk(full_path.get())) return FALSE; @@ -322,10 +323,8 @@ PathString full_path; PEResource resource(name, type, module); - return (resource.IsValid() && - full_path.assign(base_path) && - full_path.append(name) && - resource.WriteToDisk(full_path.get())); + return (resource.IsValid() && full_path.assign(base_path) && + full_path.append(name) && resource.WriteToDisk(full_path.get())); } #endif @@ -342,21 +341,21 @@ // uncompressed 'BN' resources are also extracted. This is generally the set of // DLLs/resources needed by setup.exe to run. ProcessExitResult UnpackBinaryResources(const Configuration& configuration, - HMODULE module, const wchar_t* base_path, - PathString* archive_path, - PathString* setup_path) { + HMODULE module, + const wchar_t* base_path, + PathString* archive_path, + PathString* setup_path) { // Generate the setup.exe path where we patch/uncompress setup resource. PathString setup_dest_path; - if (!setup_dest_path.assign(base_path) || - !setup_dest_path.append(kSetupExe)) + if (!setup_dest_path.assign(base_path) || !setup_dest_path.append(kSetupExe)) return ProcessExitResult(PATH_STRING_OVERFLOW); // Prepare the input to OnResourceFound method that needs a location where // it will write all the resources. Context context = { - base_path, - archive_path, - setup_path, + base_path, + archive_path, + setup_path, }; // Get the resources of type 'B7' (7zip archive). @@ -492,8 +491,7 @@ // Append the command line param for the previous version of Chrome. if (configuration.previous_version() && - (!cmd_line.append(L" --") || - !cmd_line.append(kCmdPreviousVersion) || + (!cmd_line.append(L" --") || !cmd_line.append(kCmdPreviousVersion) || !cmd_line.append(L"=\"") || !cmd_line.append(configuration.previous_version()) || !cmd_line.append(L"\""))) { @@ -571,13 +569,15 @@ // The largest SID is under 200 characters, so 300 should give enough slack. StackString<300> sddl; - bool result = sddl.append(L"D:PAI" // Protected, auto-inherited DACL. + bool result = sddl.append( + L"D:PAI" // Protected, auto-inherited DACL. L"(A;;FA;;;BA)" // Admin: Full control. L"(A;OIIOCI;GA;;;BA)" L"(A;;FA;;;SY)" // System: Full control. L"(A;OIIOCI;GA;;;SY)" L"(A;OIIOCI;GA;;;CO)" // Owner: Full control. - L"(A;;FA;;;") && sddl.append(sid) && sddl.append(L")"); + L"(A;;FA;;;") && + sddl.append(sid) && sddl.append(L")"); if (result) { result = !!::ConvertStringSecurityDescriptorToSecurityDescriptor( sddl.get(), SDDL_REVISION_1, sd, nullptr); @@ -597,7 +597,8 @@ // delete it and create a directory in its place. So, we use our own mechanism // for creating a directory with a hopefully-unique name. In the case of a // collision, we retry a few times with a new name before failing. -bool CreateWorkDir(const wchar_t* base_path, PathString* work_dir, +bool CreateWorkDir(const wchar_t* base_path, + PathString* work_dir, ProcessExitResult* exit_code) { *exit_code = ProcessExitResult(PATH_STRING_OVERFLOW); if (!work_dir->assign(base_path) || !work_dir->append(kTempPrefix)) @@ -618,8 +619,8 @@ SECURITY_ATTRIBUTES sa = {}; sa.nLength = sizeof(SECURITY_ATTRIBUTES); if (!SetSecurityDescriptor(base_path, &sa.lpSecurityDescriptor)) { - *exit_code = ProcessExitResult(UNABLE_TO_SET_DIRECTORY_ACL, - ::GetLastError()); + *exit_code = + ProcessExitResult(UNABLE_TO_SET_DIRECTORY_ACL, ::GetLastError()); return false; } @@ -659,11 +660,12 @@ // Creates and returns a temporary directory in |work_dir| that can be used to // extract mini_installer payload. |work_dir| ends with a path separator. -bool GetWorkDir(HMODULE module, PathString* work_dir, +bool GetWorkDir(HMODULE module, + PathString* work_dir, ProcessExitResult* exit_code) { PathString base_path; - DWORD len = ::GetTempPath(static_cast<DWORD>(base_path.capacity()), - base_path.get()); + DWORD len = + ::GetTempPath(static_cast<DWORD>(base_path.capacity()), base_path.get()); if (!len || len >= base_path.capacity() || !CreateWorkDir(base_path.get(), work_dir, exit_code)) { // Problem creating the work dir under TEMP path, so try using the @@ -687,8 +689,7 @@ // Returns true for ".." and "." directories. bool IsCurrentOrParentDirectory(const wchar_t* dir) { - return dir && - dir[0] == L'.' && + return dir && dir[0] == L'.' && (dir[1] == L'\0' || (dir[1] == L'.' && dir[2] == L'\0')); } @@ -708,8 +709,9 @@ if (find != INVALID_HANDLE_VALUE) { do { // Use the short name if available to make the most of our buffer. - const wchar_t* name = find_data.cAlternateFileName[0] ? - find_data.cAlternateFileName : find_data.cFileName; + const wchar_t* name = find_data.cAlternateFileName[0] + ? find_data.cAlternateFileName + : find_data.cFileName; if (IsCurrentOrParentDirectory(name)) continue; @@ -753,8 +755,9 @@ do { if (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { // Use the short name if available to make the most of our buffer. - const wchar_t* name = find_data.cAlternateFileName[0] ? - find_data.cAlternateFileName : find_data.cFileName; + const wchar_t* name = find_data.cAlternateFileName[0] + ? find_data.cAlternateFileName + : find_data.cFileName; if (IsCurrentOrParentDirectory(name)) continue; if (path.assign(parent_dir) && path.append(name)) @@ -768,9 +771,9 @@ // installer runs have failed to clean up. void DeleteOldChromeTempDirectories() { static const wchar_t* const kDirectoryPrefixes[] = { - kTempPrefix, - L"chrome_" // Previous installers created directories with this prefix - // and there are still some lying around. + kTempPrefix, + L"chrome_" // Previous installers created directories with this prefix + // and there are still some lying around. }; PathString temp;
diff --git a/chrome/installer/mini_installer/mini_installer_exe_main.cc b/chrome/installer/mini_installer/mini_installer_exe_main.cc index 3523efa..a4679e2 100644 --- a/chrome/installer/mini_installer/mini_installer_exe_main.cc +++ b/chrome/installer/mini_installer/mini_installer_exe_main.cc
@@ -40,7 +40,7 @@ // This also avoids having to explicitly set the __sse2_available hack when // linking with both the x64 and x86 obj files which is required when not // linking with the std C lib in certain instances (including Chromium) with -// MSVC. __sse2_available determines whether to use SSE2 intructions with +// MSVC. __sse2_available determines whether to use SSE2 instructions with // std C lib routines, and is set by MSVC's std C lib implementation normally. extern "C" { #ifdef __clang__
diff --git a/chrome/installer/mini_installer/mini_installer_resource.h b/chrome/installer/mini_installer/mini_installer_resource.h index f739cd3..0a30a7ec 100644 --- a/chrome/installer/mini_installer/mini_installer_resource.h +++ b/chrome/installer/mini_installer/mini_installer_resource.h
@@ -2,26 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef CHROME_INSTALLER_MINI_INSTALLER_MINI_INSTALLER_RESOURCE_H_ +#define CHROME_INSTALLER_MINI_INSTALLER_MINI_INSTALLER_RESOURCE_H_ + //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by mini_installer.rc // -#define IDI_MINI_INSTALLER 107 -#define IDC_STATIC -1 +#define IDI_MINI_INSTALLER 107 +#define IDC_STATIC -1 // The identifier of the RCDATA resource holding the version of Chrome on which // a differential update is based. The resource is not present for full // installers. -#define ID_PREVIOUS_VERSION 1 +#define ID_PREVIOUS_VERSION 1 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 110 +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 #endif #endif + +#endif // CHROME_INSTALLER_MINI_INSTALLER_MINI_INSTALLER_RESOURCE_H_
diff --git a/chrome/installer/mini_installer/mini_string.cc b/chrome/installer/mini_installer/mini_string.cc index 8551baa..93ddf20 100644 --- a/chrome/installer/mini_installer/mini_string.cc +++ b/chrome/installer/mini_installer/mini_string.cc
@@ -161,8 +161,8 @@ } wchar_t* GetNameFromPathExt(wchar_t* path, size_t size) { - return const_cast<wchar_t*>(GetNameFromPathExt( - const_cast<const wchar_t*>(path), size)); + return const_cast<wchar_t*>( + GetNameFromPathExt(const_cast<const wchar_t*>(path), size)); } } // namespace mini_installer
diff --git a/chrome/installer/mini_installer/mini_string.h b/chrome/installer/mini_installer/mini_string.h index a1a3861..fb03c0d1 100644 --- a/chrome/installer/mini_installer/mini_string.h +++ b/chrome/installer/mini_installer/mini_string.h
@@ -62,7 +62,8 @@ // immediately followed by '-' or is at the end of the string. If |position| // is non-nullptr, the location of the tag is returned in |*position| on // success. -bool FindTagInStr(const wchar_t* str, const wchar_t* tag, +bool FindTagInStr(const wchar_t* str, + const wchar_t* tag, const wchar_t** position); // Takes the path to file and returns a pointer to the basename component. @@ -91,13 +92,9 @@ // Returns the number of reserved characters in this buffer, _including_ // the reserved char for the terminator. - size_t capacity() const { - return kCapacity; - } + size_t capacity() const { return kCapacity; } - wchar_t* get() { - return buffer_; - } + wchar_t* get() { return buffer_; } bool assign(const wchar_t* str) { return SafeStrCopy(buffer_, kCapacity, str); @@ -107,13 +104,9 @@ return SafeStrCat(buffer_, kCapacity, str); } - void clear() { - buffer_[0] = L'\0'; - } + void clear() { buffer_[0] = L'\0'; } - size_t length() const { - return SafeStrLen(buffer_, kCapacity); - } + size_t length() const { return SafeStrLen(buffer_, kCapacity); } // Does a case insensitive search for a substring. const wchar_t* findi(const wchar_t* find) const { @@ -121,14 +114,10 @@ } // Case insensitive string compare. - int comparei(const wchar_t* str) const { - return lstrcmpiW(buffer_, str); - } + int comparei(const wchar_t* str) const { return lstrcmpiW(buffer_, str); } // Case sensitive string compare. - int compare(const wchar_t* str) const { - return lstrcmpW(buffer_, str); - } + int compare(const wchar_t* str) const { return lstrcmpW(buffer_, str); } // Terminates the string at the specified location. // Note: this method has no effect if this object's length is less than
diff --git a/chrome/installer/mini_installer/mini_string_test.cc b/chrome/installer/mini_installer/mini_string_test.cc index b40b85e..09a3a185 100644 --- a/chrome/installer/mini_installer/mini_string_test.cc +++ b/chrome/installer/mini_installer/mini_string_test.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include <windows.h> + #include <stddef.h> #include <stdlib.h> @@ -19,7 +20,7 @@ void SetUp() override {} void TearDown() override {} }; -} +} // namespace // Tests the strcat/strcpy/length support of the StackString class. TEST_F(MiniInstallerStringTest, StackStringOverflow) {
diff --git a/chrome/installer/mini_installer/pe_resource.cc b/chrome/installer/mini_installer/pe_resource.cc index 4d9873e9..1fa0f8c4 100644 --- a/chrome/installer/mini_installer/pe_resource.cc +++ b/chrome/installer/mini_installer/pe_resource.cc
@@ -7,8 +7,7 @@ #include <algorithm> PEResource::PEResource(HRSRC resource, HMODULE module) - : resource_(resource), module_(module) { -} + : resource_(resource), module_(module) {} PEResource::PEResource(const wchar_t* name, const wchar_t* type, HMODULE module) : resource_(nullptr), module_(module) {
diff --git a/chrome/installer/mini_installer/pe_resource.h b/chrome/installer/mini_installer/pe_resource.h index 1f6e4769..1e61195 100644 --- a/chrome/installer/mini_installer/pe_resource.h +++ b/chrome/installer/mini_installer/pe_resource.h
@@ -6,6 +6,7 @@ #define CHROME_INSTALLER_MINI_INSTALLER_PE_RESOURCE_H_ #include <windows.h> + #include <stddef.h> // This class models a windows PE resource. It does not pretend to be a full @@ -15,7 +16,7 @@ class PEResource { public: // This ctor takes the handle to the resource and the module where it was - // found. Ownership of the resource is transfered to this object. + // found. Ownership of the resource is transferred to this object. PEResource(HRSRC resource, HMODULE module); // This ctor takes the resource name, the resource type and the module where
diff --git a/chrome/installer/mini_installer/regkey.cc b/chrome/installer/mini_installer/regkey.cc index 83d8ce6..ab0f8ab7 100644 --- a/chrome/installer/mini_installer/regkey.cc +++ b/chrome/installer/mini_installer/regkey.cc
@@ -27,7 +27,7 @@ result = ERROR_NOT_SUPPORTED; } else if (byte_length < 2) { *value = L'\0'; - } else if (value[byte_length/sizeof(wchar_t) - 1] != L'\0') { + } else if (value[byte_length / sizeof(wchar_t) - 1] != L'\0') { if ((byte_length / sizeof(wchar_t)) < value_size) value[byte_length / sizeof(wchar_t)] = L'\0'; else @@ -60,8 +60,7 @@ LONG RegKey::WriteDWValue(const wchar_t* value_name, DWORD value) { return ::RegSetValueEx(key_, value_name, 0, REG_DWORD, - reinterpret_cast<const BYTE*>(&value), - sizeof(value)); + reinterpret_cast<const BYTE*>(&value), sizeof(value)); } void RegKey::Close() { @@ -72,8 +71,10 @@ } // static -bool RegKey::ReadSZValue(HKEY root_key, const wchar_t *sub_key, - const wchar_t *value_name, wchar_t *value, +bool RegKey::ReadSZValue(HKEY root_key, + const wchar_t* sub_key, + const wchar_t* value_name, + wchar_t* value, size_t size) { RegKey key; return (key.Open(root_key, sub_key, KEY_QUERY_VALUE) == ERROR_SUCCESS &&
diff --git a/chrome/installer/mini_installer/regkey.h b/chrome/installer/mini_installer/regkey.h index 147518f3..639ba5e 100644 --- a/chrome/installer/mini_installer/regkey.h +++ b/chrome/installer/mini_installer/regkey.h
@@ -6,6 +6,7 @@ #define CHROME_INSTALLER_MINI_INSTALLER_REGKEY_H_ #include <windows.h> + #include <stddef.h> namespace mini_installer { @@ -44,8 +45,10 @@ // Helper function to read a value from registry. Returns true if value // is read successfully and stored in parameter value. Returns false // otherwise. |size| is measured in wchar_t units. - static bool ReadSZValue(HKEY root_key, const wchar_t *sub_key, - const wchar_t *value_name, wchar_t *value, + static bool ReadSZValue(HKEY root_key, + const wchar_t* sub_key, + const wchar_t* value_name, + wchar_t* value, size_t value_size); private:
diff --git a/chrome/installer/setup/archive_patch_helper.cc b/chrome/installer/setup/archive_patch_helper.cc index 5b34b44..f6c79090 100644 --- a/chrome/installer/setup/archive_patch_helper.cc +++ b/chrome/installer/setup/archive_patch_helper.cc
@@ -75,10 +75,9 @@ return false; } - courgette::Status result = - courgette::ApplyEnsemblePatch(patch_source_.value().c_str(), - last_uncompressed_file_.value().c_str(), - target_.value().c_str()); + courgette::Status result = courgette::ApplyEnsemblePatch( + patch_source_.value().c_str(), last_uncompressed_file_.value().c_str(), + target_.value().c_str()); if (result == courgette::C_OK) return true; @@ -127,11 +126,9 @@ if (result == OK) return true; - LOG(ERROR) - << "Failed to apply patch " << last_uncompressed_file_.value() - << " to file " << patch_source_.value() - << " and generating file " << target_.value() - << " using bsdiff. err=" << result; + LOG(ERROR) << "Failed to apply patch " << last_uncompressed_file_.value() + << " to file " << patch_source_.value() << " and generating file " + << target_.value() << " using bsdiff. err=" << result; // Ensure a partial output is not left behind. base::DeleteFile(target_, false);
diff --git a/chrome/installer/setup/archive_patch_helper.h b/chrome/installer/setup/archive_patch_helper.h index ac9b22f..3428e8e 100644 --- a/chrome/installer/setup/archive_patch_helper.h +++ b/chrome/installer/setup/archive_patch_helper.h
@@ -82,12 +82,8 @@ void set_patch_source(const base::FilePath& patch_source) { patch_source_ = patch_source; } - const base::FilePath& patch_source() const { - return patch_source_; - } - const base::FilePath& target() const { - return target_; - } + const base::FilePath& patch_source() const { return patch_source_; } + const base::FilePath& target() const { return target_; } // Returns the path of the last file extracted by Uncompress(). const base::FilePath& last_uncompressed_file() const {
diff --git a/chrome/installer/setup/archive_patch_helper_unittest.cc b/chrome/installer/setup/archive_patch_helper_unittest.cc index c90d150..6d544cf 100644 --- a/chrome/installer/setup/archive_patch_helper_unittest.cc +++ b/chrome/installer/setup/archive_patch_helper_unittest.cc
@@ -2,12 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/installer/setup/archive_patch_helper.h" + #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/path_service.h" #include "chrome/common/chrome_paths.h" -#include "chrome/installer/setup/archive_patch_helper.h" #include "testing/gtest/include/gtest/gtest.h" namespace { @@ -20,9 +21,7 @@ ASSERT_TRUE(base::PathExists(data_dir_)); } - static void TearDownTestCase() { - data_dir_.clear(); - } + static void TearDownTestCase() { data_dir_.clear(); } void SetUp() override { // Create a temp directory for testing.
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc index 10436fe..09ffe186 100644 --- a/chrome/installer/setup/install.cc +++ b/chrome/installer/setup/install.cc
@@ -5,6 +5,7 @@ #include "chrome/installer/setup/install.h" #include <windows.h> + #include <shlobj.h> #include <time.h> @@ -65,12 +66,13 @@ message.append("Failed: "); message.append( (operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || - operation == ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL) ? - "Creating " : "Overwriting "); + operation == ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL) + ? "Creating " + : "Overwriting "); if (failed && operation == ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING) message.append("(maybe the shortcut doesn't exist?) "); - message.append((properties.level == ShellUtil::CURRENT_USER) ? "per-user " : - "all-users "); + message.append((properties.level == ShellUtil::CURRENT_USER) ? "per-user " + : "all-users "); switch (location) { case ShellUtil::SHORTCUT_LOCATION_DESKTOP: message.append("Desktop "); @@ -352,8 +354,9 @@ } // Shortcuts are always installed per-user unless specified. - ShellUtil::ShellChange shortcut_level = (install_level == ALL_USERS ? - ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER); + ShellUtil::ShellChange shortcut_level = + (install_level == ALL_USERS ? ShellUtil::SYSTEM_LEVEL + : ShellUtil::CURRENT_USER); // |base_properties|: The basic properties to set on every shortcut installed // (to be refined on a per-shortcut basis).
diff --git a/chrome/installer/setup/install.h b/chrome/installer/setup/install.h index 6643199e..5a671036 100644 --- a/chrome/installer/setup/install.h +++ b/chrome/installer/setup/install.h
@@ -13,7 +13,7 @@ namespace base { class FilePath; class Version; -} +} // namespace base namespace installer { @@ -61,11 +61,10 @@ // created even if they don't exist. // If creating the Start menu shortcut is successful, it is also pinned to the // taskbar. -void CreateOrUpdateShortcuts( - const base::FilePath& target, - const MasterPreferences& prefs, - InstallShortcutLevel install_level, - InstallShortcutOperation install_operation); +void CreateOrUpdateShortcuts(const base::FilePath& target, + const MasterPreferences& prefs, + InstallShortcutLevel install_level, + InstallShortcutOperation install_operation); // This function installs or updates a new version of Chrome. It returns // install status (failed, new_install, updated etc).
diff --git a/chrome/installer/setup/install_unittest.cc b/chrome/installer/setup/install_unittest.cc index 4bb98069..c649bb8 100644 --- a/chrome/installer/setup/install_unittest.cc +++ b/chrome/installer/setup/install_unittest.cc
@@ -280,10 +280,10 @@ const char* pref_name; bool is_desired; } desired_prefs[] = { - { installer::master_preferences::kDoNotCreateDesktopShortcut, - do_not_create_desktop_shortcut }, - { installer::master_preferences::kDoNotCreateQuickLaunchShortcut, - do_not_create_quick_launch_shortcut }, + {installer::master_preferences::kDoNotCreateDesktopShortcut, + do_not_create_desktop_shortcut}, + {installer::master_preferences::kDoNotCreateQuickLaunchShortcut, + do_not_create_quick_launch_shortcut}, }; std::string master_prefs("{\"distribution\":{"); @@ -410,15 +410,15 @@ dummy_properties.set_app_id(L"El.Dummiest"); ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - user_desktop_shortcut_, dummy_properties, - base::win::SHORTCUT_CREATE_ALWAYS)); + user_desktop_shortcut_, dummy_properties, + base::win::SHORTCUT_CREATE_ALWAYS)); ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - user_quick_launch_shortcut_, dummy_properties, - base::win::SHORTCUT_CREATE_ALWAYS)); + user_quick_launch_shortcut_, dummy_properties, + base::win::SHORTCUT_CREATE_ALWAYS)); ASSERT_TRUE(base::CreateDirectory(user_start_menu_shortcut_.DirName())); ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - user_start_menu_shortcut_, dummy_properties, - base::win::SHORTCUT_CREATE_ALWAYS)); + user_start_menu_shortcut_, dummy_properties, + base::win::SHORTCUT_CREATE_ALWAYS)); installer::CreateOrUpdateShortcuts( chrome_exe_, *prefs_, installer::CURRENT_USER, @@ -441,8 +441,8 @@ dummy_properties.set_app_id(L"El.Dummiest"); ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - user_desktop_shortcut_, dummy_properties, - base::win::SHORTCUT_CREATE_ALWAYS)); + user_desktop_shortcut_, dummy_properties, + base::win::SHORTCUT_CREATE_ALWAYS)); ASSERT_TRUE(base::CreateDirectory(user_start_menu_shortcut_.DirName())); installer::CreateOrUpdateShortcuts( @@ -453,14 +453,15 @@ ASSERT_FALSE(base::PathExists(user_start_menu_shortcut_)); } -class MigrateShortcutTest : public InstallShortcutTest, - public testing::WithParamInterface< - testing::tuple< - installer::InstallShortcutOperation, - installer::InstallShortcutLevel>> { +class MigrateShortcutTest + : public InstallShortcutTest, + public testing::WithParamInterface< + testing::tuple<installer::InstallShortcutOperation, + installer::InstallShortcutLevel>> { public: - MigrateShortcutTest() : shortcut_operation_(testing::get<0>(GetParam())), - shortcut_level_(testing::get<1>(GetParam())) {} + MigrateShortcutTest() + : shortcut_operation_(testing::get<0>(GetParam())), + shortcut_level_(testing::get<1>(GetParam())) {} protected: const installer::InstallShortcutOperation shortcut_operation_; @@ -493,8 +494,8 @@ ASSERT_TRUE(base::CreateDirectory(start_menu_subdir_shortcut.DirName())); ASSERT_FALSE(base::PathExists(start_menu_subdir_shortcut)); ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - start_menu_subdir_shortcut, dummy_properties, - base::win::SHORTCUT_CREATE_ALWAYS)); + start_menu_subdir_shortcut, dummy_properties, + base::win::SHORTCUT_CREATE_ALWAYS)); ASSERT_TRUE(base::PathExists(start_menu_subdir_shortcut)); ASSERT_FALSE(base::PathExists(start_menu_shortcut)); @@ -524,13 +525,12 @@ dummy_properties.set_target(dummy_target); ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - system_desktop_shortcut_, dummy_properties, - base::win::SHORTCUT_CREATE_ALWAYS)); - ASSERT_TRUE(base::CreateDirectory( - system_start_menu_shortcut_.DirName())); + system_desktop_shortcut_, dummy_properties, + base::win::SHORTCUT_CREATE_ALWAYS)); + ASSERT_TRUE(base::CreateDirectory(system_start_menu_shortcut_.DirName())); ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - system_start_menu_shortcut_, dummy_properties, - base::win::SHORTCUT_CREATE_ALWAYS)); + system_start_menu_shortcut_, dummy_properties, + base::win::SHORTCUT_CREATE_ALWAYS)); installer::CreateOrUpdateShortcuts( chrome_exe_, *prefs_, installer::CURRENT_USER, @@ -561,8 +561,8 @@ dummy_properties.set_target(dummy_target); ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - system_desktop_shortcut_, dummy_properties, - base::win::SHORTCUT_CREATE_ALWAYS)); + system_desktop_shortcut_, dummy_properties, + base::win::SHORTCUT_CREATE_ALWAYS)); installer::CreateOrUpdateShortcuts( chrome_exe_, *prefs_, installer::CURRENT_USER,
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc index cf71dd6..c58bc8d9 100644 --- a/chrome/installer/setup/install_worker.cc +++ b/chrome/installer/setup/install_worker.cc
@@ -258,8 +258,7 @@ // never be. // TODO(grt): Touch the Start Menu shortcut after putting the manifest in // place to force the Start Menu to refresh Chrome's tile. - if (base::PathExists( - src_path.Append(installer::kVisualElementsManifest))) { + if (base::PathExists(src_path.Append(installer::kVisualElementsManifest))) { install_list->AddMoveTreeWorkItem( src_path.Append(installer::kVisualElementsManifest), target_path.Append(installer::kVisualElementsManifest), temp_path, @@ -268,8 +267,7 @@ // We do not want to have an old VisualElementsManifest pointing to an old // version directory. Delete it as there wasn't a new one to replace it. install_list->AddDeleteTreeWorkItem( - target_path.Append(installer::kVisualElementsManifest), - temp_path); + target_path.Append(installer::kVisualElementsManifest), temp_path); } // In the past, we copied rather than moved for system level installs so that @@ -473,21 +471,15 @@ AppendUninstallCommandLineFlags(installer_state, &uninstall_arguments); base::string16 update_state_key(install_static::GetClientStateKeyPath()); - install_list->AddCreateRegKeyWorkItem( - reg_root, update_state_key, KEY_WOW64_32KEY); - install_list->AddSetRegValueWorkItem(reg_root, - update_state_key, - KEY_WOW64_32KEY, - installer::kUninstallStringField, - installer_path.value(), - true); + install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key, + KEY_WOW64_32KEY); install_list->AddSetRegValueWorkItem( - reg_root, - update_state_key, - KEY_WOW64_32KEY, + reg_root, update_state_key, KEY_WOW64_32KEY, + installer::kUninstallStringField, installer_path.value(), true); + install_list->AddSetRegValueWorkItem( + reg_root, update_state_key, KEY_WOW64_32KEY, installer::kUninstallArgumentsField, - uninstall_arguments.GetCommandLineString(), - true); + uninstall_arguments.GetCommandLineString(), true); // MSI installations will manage their own uninstall shortcuts. if (!installer_state.is_msi()) { @@ -497,63 +489,42 @@ quoted_uninstall_cmd.AppendArguments(uninstall_arguments, false); base::string16 uninstall_reg = install_static::GetUninstallRegistryPath(); - install_list->AddCreateRegKeyWorkItem( - reg_root, uninstall_reg, KEY_WOW64_32KEY); + install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg, + KEY_WOW64_32KEY); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, KEY_WOW64_32KEY, installer::kUninstallDisplayNameField, InstallUtil::GetDisplayName(), true); install_list->AddSetRegValueWorkItem( - reg_root, - uninstall_reg, - KEY_WOW64_32KEY, + reg_root, uninstall_reg, KEY_WOW64_32KEY, installer::kUninstallStringField, - quoted_uninstall_cmd.GetCommandLineString(), - true); - install_list->AddSetRegValueWorkItem(reg_root, - uninstall_reg, - KEY_WOW64_32KEY, - L"InstallLocation", - install_path.value(), - true); + quoted_uninstall_cmd.GetCommandLineString(), true); + install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, + KEY_WOW64_32KEY, L"InstallLocation", + install_path.value(), true); base::string16 chrome_icon = ShellUtil::FormatIconLocation(install_path.Append(kChromeExe), install_static::GetIconResourceIndex()); - install_list->AddSetRegValueWorkItem(reg_root, - uninstall_reg, - KEY_WOW64_32KEY, - L"DisplayIcon", - chrome_icon, - true); - install_list->AddSetRegValueWorkItem(reg_root, - uninstall_reg, - KEY_WOW64_32KEY, - L"NoModify", - static_cast<DWORD>(1), - true); - install_list->AddSetRegValueWorkItem(reg_root, - uninstall_reg, - KEY_WOW64_32KEY, - L"NoRepair", - static_cast<DWORD>(1), - true); + install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, + KEY_WOW64_32KEY, L"DisplayIcon", + chrome_icon, true); + install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, + KEY_WOW64_32KEY, L"NoModify", + static_cast<DWORD>(1), true); + install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, + KEY_WOW64_32KEY, L"NoRepair", + static_cast<DWORD>(1), true); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, KEY_WOW64_32KEY, L"Publisher", InstallUtil::GetPublisherName(), true); - install_list->AddSetRegValueWorkItem(reg_root, - uninstall_reg, - KEY_WOW64_32KEY, - L"Version", - ASCIIToUTF16(new_version.GetString()), - true); - install_list->AddSetRegValueWorkItem(reg_root, - uninstall_reg, - KEY_WOW64_32KEY, - L"DisplayVersion", - ASCIIToUTF16(new_version.GetString()), - true); + install_list->AddSetRegValueWorkItem( + reg_root, uninstall_reg, KEY_WOW64_32KEY, L"Version", + ASCIIToUTF16(new_version.GetString()), true); + install_list->AddSetRegValueWorkItem( + reg_root, uninstall_reg, KEY_WOW64_32KEY, L"DisplayVersion", + ASCIIToUTF16(new_version.GetString()), true); // TODO(wfh): Ensure that this value is preserved in the 64-bit hive when // 64-bit installs place the uninstall information into the 64-bit registry. install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, @@ -564,19 +535,11 @@ if (version_components.size() == 4) { // Our version should be in major.minor.build.rev. install_list->AddSetRegValueWorkItem( - reg_root, - uninstall_reg, - KEY_WOW64_32KEY, - L"VersionMajor", - static_cast<DWORD>(version_components[2]), - true); + reg_root, uninstall_reg, KEY_WOW64_32KEY, L"VersionMajor", + static_cast<DWORD>(version_components[2]), true); install_list->AddSetRegValueWorkItem( - reg_root, - uninstall_reg, - KEY_WOW64_32KEY, - L"VersionMinor", - static_cast<DWORD>(version_components[3]), - true); + reg_root, uninstall_reg, KEY_WOW64_32KEY, L"VersionMinor", + static_cast<DWORD>(version_components[3]), true); } } } @@ -637,8 +600,8 @@ bool is_enterprise_version = base::win::OSInfo::GetInstance()->version_type() != base::win::SUITE_HOME; if (!(base::win::IsEnrolledToDomain() || - (base::win::IsDeviceRegisteredWithManagement() && - is_enterprise_version))) { + (base::win::IsDeviceRegisteredWithManagement() && + is_enterprise_version))) { return; } @@ -691,11 +654,11 @@ // |critical_version| will be valid only if this in-use update includes a // version considered critical relative to the version being updated. - base::Version critical_version(installer_state.DetermineCriticalVersion( - current_version, new_version)); + base::Version critical_version( + installer_state.DetermineCriticalVersion(current_version, new_version)); base::FilePath installer_path( - installer_state.GetInstallerDirectory(new_version).Append( - setup_path.BaseName())); + installer_state.GetInstallerDirectory(new_version) + .Append(setup_path.BaseName())); const base::string16 clients_key(install_static::GetClientsKeyPath()); @@ -990,24 +953,21 @@ const base::string16 active_setup_path(install_static::GetActiveSetupPath()); VLOG(1) << "Adding registration items for Active Setup."; - list->AddCreateRegKeyWorkItem( - root, active_setup_path, WorkItem::kWow64Default); + list->AddCreateRegKeyWorkItem(root, active_setup_path, + WorkItem::kWow64Default); list->AddSetRegValueWorkItem(root, active_setup_path, WorkItem::kWow64Default, L"", InstallUtil::GetDisplayName(), true); - base::FilePath active_setup_exe(installer_state.GetInstallerDirectory( - new_version).Append(kActiveSetupExe)); + base::FilePath active_setup_exe( + installer_state.GetInstallerDirectory(new_version) + .Append(kActiveSetupExe)); base::CommandLine cmd(active_setup_exe); cmd.AppendSwitch(installer::switches::kConfigureUserSettings); cmd.AppendSwitch(installer::switches::kVerboseLogging); cmd.AppendSwitch(installer::switches::kSystemLevel); InstallUtil::AppendModeSwitch(&cmd); - list->AddSetRegValueWorkItem(root, - active_setup_path, - WorkItem::kWow64Default, - L"StubPath", - cmd.GetCommandLineString(), - true); + list->AddSetRegValueWorkItem(root, active_setup_path, WorkItem::kWow64Default, + L"StubPath", cmd.GetCommandLineString(), true); // TODO(grt): http://crbug.com/75152 Write a reference to a localized // resource. @@ -1015,12 +975,8 @@ L"Localized Name", InstallUtil::GetDisplayName(), true); - list->AddSetRegValueWorkItem(root, - active_setup_path, - WorkItem::kWow64Default, - L"IsInstalled", - static_cast<DWORD>(1U), - true); + list->AddSetRegValueWorkItem(root, active_setup_path, WorkItem::kWow64Default, + L"IsInstalled", static_cast<DWORD>(1U), true); list->AddWorkItem(new UpdateActiveSetupVersionWorkItem( active_setup_path, UpdateActiveSetupVersionWorkItem::UPDATE));
diff --git a/chrome/installer/setup/install_worker.h b/chrome/installer/setup/install_worker.h index d43dcce..21c61e8 100644 --- a/chrome/installer/setup/install_worker.h +++ b/chrome/installer/setup/install_worker.h
@@ -17,7 +17,7 @@ class CommandLine; class FilePath; class Version; -} +} // namespace base namespace installer {
diff --git a/chrome/installer/setup/install_worker_unittest.cc b/chrome/installer/setup/install_worker_unittest.cc index adaca46c..9b1f84e 100644 --- a/chrome/installer/setup/install_worker_unittest.cc +++ b/chrome/installer/setup/install_worker_unittest.cc
@@ -69,7 +69,7 @@ const base::FilePath&, CopyOverWriteOption, const base::FilePath&)); - MOCK_METHOD1(AddCreateDirWorkItem, WorkItem* (const base::FilePath&)); + MOCK_METHOD1(AddCreateDirWorkItem, WorkItem*(const base::FilePath&)); MOCK_METHOD3(AddCreateRegKeyWorkItem, WorkItem*(HKEY, const std::wstring&, REGSAM)); MOCK_METHOD3(AddDeleteRegKeyWorkItem, @@ -153,8 +153,7 @@ class MockInstallationState : public InstallationState { public: // Included for testing. - void SetProductState(bool system_install, - const ProductState& product_state) { + void SetProductState(bool system_install, const ProductState& product_state) { ProductState& target = system_install ? system_chrome_ : user_chrome_; target.CopyFrom(product_state); } @@ -162,15 +161,11 @@ class MockInstallerState : public InstallerState { public: - void set_level(Level level) { - InstallerState::set_level(level); - } + void set_level(Level level) { InstallerState::set_level(level); } void set_operation(Operation operation) { operation_ = operation; } - void set_state_key(const std::wstring& state_key) { - state_key_ = state_key; - } + void set_state_key(const std::wstring& state_key) { state_key_ = state_key; } }; void AddChromeToInstallationState(bool system_level, @@ -259,8 +254,8 @@ base::FilePath(L"C:\\UnlikelyPath\\Temp\\chrome_123\\chrome.7z"); src_path_ = base::FilePath( L"C:\\UnlikelyPath\\Temp\\chrome_123\\source\\Chrome-bin"); - setup_path_ = base::FilePath( - L"C:\\UnlikelyPath\\Temp\\CR_123.tmp\\setup.exe"); + setup_path_ = + base::FilePath(L"C:\\UnlikelyPath\\Temp\\CR_123.tmp\\setup.exe"); temp_dir_ = base::FilePath(L"C:\\UnlikelyPath\\Temp\\chrome_123"); }
diff --git a/chrome/installer/setup/installer_crash_reporter_client.cc b/chrome/installer/setup/installer_crash_reporter_client.cc index 673a96b..61e3bdee 100644 --- a/chrome/installer/setup/installer_crash_reporter_client.cc +++ b/chrome/installer/setup/installer_crash_reporter_client.cc
@@ -20,8 +20,7 @@ InstallerCrashReporterClient::InstallerCrashReporterClient( bool is_per_user_install) - : is_per_user_install_(is_per_user_install) { -} + : is_per_user_install_(is_per_user_install) {} InstallerCrashReporterClient::~InstallerCrashReporterClient() = default; @@ -141,12 +140,12 @@ // read. If it is true, |enabled| contains the value set by policy. DWORD value = 0; base::win::RegKey policy_key; - static const HKEY kHives[] = { HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER }; + static const HKEY kHives[] = {HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER}; for (HKEY hive : kHives) { - if (policy_key.Open(hive, kRegistryChromePolicyKey, - KEY_READ) == ERROR_SUCCESS && - policy_key.ReadValueDW(kMetricsReportingEnabled, - &value) == ERROR_SUCCESS) { + if (policy_key.Open(hive, kRegistryChromePolicyKey, KEY_READ) == + ERROR_SUCCESS && + policy_key.ReadValueDW(kMetricsReportingEnabled, &value) == + ERROR_SUCCESS) { *enabled = value != 0; return true; }
diff --git a/chrome/installer/setup/installer_state.cc b/chrome/installer/setup/installer_state.cc index 9e7da95e..6883665 100644 --- a/chrome/installer/setup/installer_state.cc +++ b/chrome/installer/setup/installer_state.cc
@@ -55,8 +55,7 @@ set_level(level); } -InstallerState::~InstallerState() { -} +InstallerState::~InstallerState() {} void InstallerState::Initialize(const base::CommandLine& command_line, const MasterPreferences& prefs,
diff --git a/chrome/installer/setup/installer_state.h b/chrome/installer/setup/installer_state.h index 6c27654..8e13a24 100644 --- a/chrome/installer/setup/installer_state.h +++ b/chrome/installer/setup/installer_state.h
@@ -31,17 +31,9 @@ // the operations to be performed. class InstallerState { public: - enum Level { - UNKNOWN_LEVEL, - USER_LEVEL, - SYSTEM_LEVEL - }; + enum Level { UNKNOWN_LEVEL, USER_LEVEL, SYSTEM_LEVEL }; - enum Operation { - UNINITIALIZED, - SINGLE_INSTALL_OR_UPDATE, - UNINSTALL - }; + enum Operation { UNINITIALIZED, SINGLE_INSTALL_OR_UPDATE, UNINSTALL }; // Constructs an uninitialized instance; see Initialize(). InstallerState();
diff --git a/chrome/installer/setup/installer_state_unittest.cc b/chrome/installer/setup/installer_state_unittest.cc index fa7ad7c..f01a1e40 100644 --- a/chrome/installer/setup/installer_state_unittest.cc +++ b/chrome/installer/setup/installer_state_unittest.cc
@@ -5,6 +5,7 @@ #include "chrome/installer/setup/installer_state.h" #include <windows.h> + #include <stddef.h> #include <fstream> @@ -45,9 +46,7 @@ protected: InstallerStateTest() {} - void SetUp() override { - ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); - } + void SetUp() override { ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); } base::ScopedTempDir test_dir_; @@ -58,7 +57,7 @@ // An installer state on which we can access otherwise protected members. class MockInstallerState : public InstallerState { public: - MockInstallerState() : InstallerState() { } + MockInstallerState() : InstallerState() {} void set_target_path(const base::FilePath& target_path) { target_path_ = target_path; } @@ -70,8 +69,7 @@ TEST_F(InstallerStateTest, WithProduct) { const bool system_level = true; base::CommandLine cmd_line = base::CommandLine::FromString( - std::wstring(L"setup.exe") + - (system_level ? L" --system-level" : L"")); + std::wstring(L"setup.exe") + (system_level ? L" --system-level" : L"")); MasterPreferences prefs(cmd_line); InstallationState machine_state; machine_state.Initialize(); @@ -93,9 +91,9 @@ KEY_ALL_ACCESS); EXPECT_TRUE(chrome_key.Valid()); if (chrome_key.Valid()) { - chrome_key.WriteValue(google_update::kRegVersionField, - base::UTF8ToWide( - current_version.GetString()).c_str()); + chrome_key.WriteValue( + google_update::kRegVersionField, + base::UTF8ToWide(current_version.GetString()).c_str()); machine_state.Initialize(); // TODO(tommi): Also test for when there exists a new_chrome.exe. base::Version found_version(
diff --git a/chrome/installer/setup/memory_unittest.cc b/chrome/installer/setup/memory_unittest.cc index cdb7c45..c00d290 100644 --- a/chrome/installer/setup/memory_unittest.cc +++ b/chrome/installer/setup/memory_unittest.cc
@@ -31,8 +31,8 @@ // Make test size as large as possible minus a few pages so that alignment or // other rounding doesn't make it wrap. - const size_t kUnsafeMallocSize( - std::numeric_limits<std::size_t>::max() - 12 * 1024); + const size_t kUnsafeMallocSize(std::numeric_limits<std::size_t>::max() - + 12 * 1024); EXPECT_FALSE(base::UncheckedMalloc(kUnsafeMallocSize, &value)); EXPECT_EQ(nullptr, value);
diff --git a/chrome/installer/setup/setup_constants.h b/chrome/installer/setup/setup_constants.h index ac1ddcb..eeec2df 100644 --- a/chrome/installer/setup/setup_constants.h +++ b/chrome/installer/setup/setup_constants.h
@@ -4,8 +4,8 @@ // Defines all the command-line switches used by Chrome installer. -#ifndef CHROME_INSTALLER_SETUP_SETUP_CONSTANTS_H__ -#define CHROME_INSTALLER_SETUP_SETUP_CONSTANTS_H__ +#ifndef CHROME_INSTALLER_SETUP_SETUP_CONSTANTS_H_ +#define CHROME_INSTALLER_SETUP_SETUP_CONSTANTS_H_ #include "chrome/installer/setup/buildflags.h" @@ -48,4 +48,4 @@ } // namespace installer -#endif // CHROME_INSTALLER_SETUP_SETUP_CONSTANTS_H__ +#endif // CHROME_INSTALLER_SETUP_SETUP_CONSTANTS_H_
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index e2059a4a..437cbc3 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc
@@ -97,8 +97,8 @@ #include "chrome/installer/util/google_update_util.h" #endif -using installer::InstallerState; using installer::InstallationState; +using installer::InstallerState; using installer::MasterPreferences; using installer::ProductState; @@ -118,8 +118,8 @@ LONG result = 0; base::string16 existing; if ((result = key.Open(HKEY_LOCAL_MACHINE, path.c_str(), - KEY_QUERY_VALUE | KEY_SET_VALUE | wowkey)) - != ERROR_SUCCESS) { + KEY_QUERY_VALUE | KEY_SET_VALUE | wowkey)) != + ERROR_SUCCESS) { VLOG(1) << "Skipping DisplayVersion update because registry key " << path << " does not exist in " << (wowkey == KEY_WOW64_64KEY ? "64" : "32") << "bit hive"; @@ -130,20 +130,20 @@ << " not found under " << path; return result; } - if ((result = key.WriteValue(kDisplayVersion, value.c_str())) - != ERROR_SUCCESS) { + if ((result = key.WriteValue(kDisplayVersion, value.c_str())) != + ERROR_SUCCESS) { LOG(ERROR) << "Failed to set DisplayVersion: " << kDisplayVersion << " could not be written under " << path; return result; } - VLOG(1) << "Set DisplayVersion at " << path << " to " << value - << " from " << existing; + VLOG(1) << "Set DisplayVersion at " << path << " to " << value << " from " + << existing; return ERROR_SUCCESS; } LONG OverwriteDisplayVersions(const base::string16& product, const base::string16& value) { - // The version is held in two places. Frist change it in the MSI Installer + // The version is held in two places. First change it in the MSI Installer // registry entry. It is held under a "squashed guid" key. base::string16 reg_path = base::StringPrintf( L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\" @@ -160,8 +160,9 @@ LONG result2 = OverwriteDisplayVersion(reg_path, value, KEY_WOW64_64KEY); LONG result3 = OverwriteDisplayVersion(reg_path, value, KEY_WOW64_32KEY); - return result1 != ERROR_SUCCESS ? result1 : - (result2 != ERROR_SUCCESS ? result3 : ERROR_SUCCESS); + return result1 != ERROR_SUCCESS + ? result1 + : (result2 != ERROR_SUCCESS ? result3 : ERROR_SUCCESS); } void DelayedOverwriteDisplayVersions(const base::FilePath& setup_exe, @@ -202,8 +203,8 @@ command_line.GetSwitchValuePath(installer::switches::kInstallArchive)); bool compressed_archive_specified = !compressed_archive.empty(); if (!compressed_archive_specified) { - compressed_archive = setup_exe.DirName().Append( - installer::kChromeCompressedArchive); + compressed_archive = + setup_exe.DirName().Append(installer::kChromeCompressedArchive); } // Fail if no compressed archive is found. @@ -212,7 +213,7 @@ LOG(ERROR) << installer::switches::kInstallArchive << "=" << compressed_archive.value() << " not found."; } - return std::unique_ptr<installer::ArchivePatchHelper>(); + return nullptr; } // chrome.7z is either extracted directly from the compressed archive into the @@ -223,9 +224,9 @@ // Specify an empty path for the patch source since it isn't yet known that // one is needed. It will be supplied in UncompressAndPatchChromeArchive if it // is. - return std::unique_ptr<installer::ArchivePatchHelper>( - new installer::ArchivePatchHelper(working_directory, compressed_archive, - base::FilePath(), target, consumer)); + return std::make_unique<installer::ArchivePatchHelper>( + working_directory, compressed_archive, base::FilePath(), target, + consumer); } // Returns the MSI product ID from the ClientState key that is populated for MSI @@ -309,9 +310,8 @@ } // Find the installed version's archive to serve as the source for patching. - base::FilePath patch_source(installer::FindArchiveToPatch(original_state, - installer_state, - previous_version)); + base::FilePath patch_source(installer::FindArchiveToPatch( + original_state, installer_state, previous_version)); if (patch_source.empty()) { LOG(ERROR) << "Failed to find archive to patch."; *install_status = installer::DIFF_PATCH_SOURCE_MISSING; @@ -408,7 +408,7 @@ const base::FilePath& setup_exe, const InstallationState& original_state, InstallerState* installer_state) { - const base::FilePath &target_path = installer_state->target_path(); + const base::FilePath& target_path = installer_state->target_path(); base::FilePath chrome_exe(target_path.Append(installer::kChromeExe)); base::FilePath chrome_new_exe(target_path.Append(installer::kChromeNewExe)); base::FilePath chrome_old_exe(target_path.Append(installer::kChromeOldExe)); @@ -424,9 +424,9 @@ installer::SelfCleaningTempDir temp_path; if (!temp_path.Initialize(target_path.DirName(), installer::kInstallTempDir)) { - PLOG(ERROR) << "Failed to create Temp directory " - << target_path.DirName() - .Append(installer::kInstallTempDir).value(); + PLOG(ERROR) + << "Failed to create Temp directory " + << target_path.DirName().Append(installer::kInstallTempDir).value(); return installer::RENAME_FAILED; } std::unique_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList()); @@ -560,9 +560,8 @@ } VLOG(1) << "Created path " << temp_path->path().value(); - if (!base::CreateTemporaryDirInDir(temp_path->path(), - installer::kInstallSourceDir, - unpack_path)) { + if (!base::CreateTemporaryDirInDir( + temp_path->path(), installer::kInstallSourceDir, unpack_path)) { PLOG(ERROR) << "Could not create temporary path for unpacked archive."; return false; } @@ -587,8 +586,8 @@ installer::InstallStatus install_status = installer::UNINSTALL_SUCCESSFUL; const bool force = cmd_line.HasSwitch(installer::switches::kForceUninstall); - const bool remove_all = !cmd_line.HasSwitch( - installer::switches::kDoNotRemoveSharedItems); + const bool remove_all = + !cmd_line.HasSwitch(installer::switches::kDoNotRemoveSharedItems); const base::Version current_version( installer_state.GetCurrentVersion(original_state)); @@ -653,9 +652,9 @@ if (CheckPreInstallConditions(original_state, *installer_state, &install_status)) { VLOG(1) << "Installing to " << installer_state->target_path().value(); - install_status = InstallProductsHelper( - original_state, setup_exe, cmd_line, prefs, *installer_state, - installer_directory, &archive_type); + install_status = InstallProductsHelper(original_state, setup_exe, cmd_line, + prefs, *installer_state, + installer_directory, &archive_type); } else { // CheckPreInstallConditions must set the status on failure. DCHECK_NE(install_status, installer::UNKNOWN_STATUS); @@ -665,8 +664,8 @@ // about rollback here and we schedule for deletion on reboot if the delete // fails. As such, we do not use DeleteTreeWorkItem. if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { - base::FilePath prefs_path(cmd_line.GetSwitchValuePath( - installer::switches::kInstallerData)); + base::FilePath prefs_path( + cmd_line.GetSwitchValuePath(installer::switches::kInstallerData)); if (!base::DeleteFile(prefs_path, false)) { LOG(ERROR) << "Failed deleting master preferences file " << prefs_path.value() @@ -813,8 +812,8 @@ if (!temp_path.CreateUniqueTempDir()) { PLOG(ERROR) << "Could not create temporary path."; } else { - base::FilePath compressed_archive(cmd_line.GetSwitchValuePath( - installer::switches::kUpdateSetupExe)); + base::FilePath compressed_archive( + cmd_line.GetSwitchValuePath(installer::switches::kUpdateSetupExe)); VLOG(1) << "Opening archive " << compressed_archive.value(); // The top unpack failure result with 28 days aggregation (>=0.01%) // Setup.Install.LzmaUnPackResult_SetupExePatch @@ -935,8 +934,7 @@ // be used when setup.exe is launched with admin rights. We do not // make any user specific changes in this option. base::string16 suffix; - if (cmd_line.HasSwitch( - installer::switches::kRegisterChromeBrowserSuffix)) { + if (cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowserSuffix)) { suffix = cmd_line.GetSwitchValueNative( installer::switches::kRegisterChromeBrowserSuffix); } @@ -974,13 +972,11 @@ cmd_line.GetSwitchValuePath(installer::switches::kOutputFile)); if (patch_type_str == installer::kCourgette) { - *exit_code = installer::CourgettePatchFiles(input_file, - patch_file, - output_file); + *exit_code = + installer::CourgettePatchFiles(input_file, patch_file, output_file); } else if (patch_type_str == installer::kBsdiff) { - *exit_code = installer::BsdiffPatchFiles(input_file, - patch_file, - output_file); + *exit_code = + installer::BsdiffPatchFiles(input_file, patch_file, output_file); #if BUILDFLAG(ZUCCHINI) } else if (patch_type_str == installer::kZucchini) { *exit_code = @@ -992,16 +988,14 @@ } else if (cmd_line.HasSwitch(installer::switches::kReenableAutoupdates)) { // setup.exe has been asked to attempt to reenable updates for Chrome. bool updates_enabled = GoogleUpdateSettings::ReenableAutoupdates(); - *exit_code = updates_enabled ? installer::REENABLE_UPDATES_SUCCEEDED : - installer::REENABLE_UPDATES_FAILED; + *exit_code = updates_enabled ? installer::REENABLE_UPDATES_SUCCEEDED + : installer::REENABLE_UPDATES_FAILED; } else if (cmd_line.HasSwitch( installer::switches::kSetDisplayVersionProduct)) { - const base::string16 registry_product( - cmd_line.GetSwitchValueNative( - installer::switches::kSetDisplayVersionProduct)); - const base::string16 registry_value( - cmd_line.GetSwitchValueNative( - installer::switches::kSetDisplayVersionValue)); + const base::string16 registry_product(cmd_line.GetSwitchValueNative( + installer::switches::kSetDisplayVersionProduct)); + const base::string16 registry_value(cmd_line.GetSwitchValueNative( + installer::switches::kSetDisplayVersionValue)); *exit_code = OverwriteDisplayVersions(registry_product, registry_value); #if BUILDFLAG(GOOGLE_CHROME_BRANDING) } else if (cmd_line.HasSwitch(installer::switches::kStoreDMToken)) { @@ -1053,13 +1047,13 @@ // Uncompress and optionally patch the archive if an uncompressed archive was // not specified on the command line and a compressed archive is found. *archive_type = UNKNOWN_ARCHIVE_TYPE; - base::FilePath uncompressed_archive(cmd_line.GetSwitchValuePath( - switches::kUncompressedArchive)); + base::FilePath uncompressed_archive( + cmd_line.GetSwitchValuePath(switches::kUncompressedArchive)); if (uncompressed_archive.empty()) { base::Version previous_version; if (cmd_line.HasSwitch(installer::switches::kPreviousVersion)) { - previous_version = base::Version(cmd_line.GetSwitchValueASCII( - installer::switches::kPreviousVersion)); + previous_version = base::Version( + cmd_line.GetSwitchValueASCII(installer::switches::kPreviousVersion)); } std::unique_ptr<ArchivePatchHelper> archive_helper( @@ -1071,12 +1065,9 @@ if (archive_helper) { VLOG(1) << "Installing Chrome from compressed archive " << archive_helper->compressed_archive().value(); - if (!UncompressAndPatchChromeArchive(original_state, - installer_state, - archive_helper.get(), - archive_type, - &install_status, - previous_version)) { + if (!UncompressAndPatchChromeArchive(original_state, installer_state, + archive_helper.get(), archive_type, + &install_status, previous_version)) { DCHECK_NE(install_status, UNKNOWN_STATUS); return install_status; } @@ -1132,8 +1123,7 @@ } VLOG(1) << "unpacked to " << unpack_path.value(); - base::FilePath src_path( - unpack_path.Append(kInstallSourceChromeDir)); + base::FilePath src_path(unpack_path.Append(kInstallSourceChromeDir)); std::unique_ptr<base::Version> installer_version( GetMaxVersionFromArchiveDir(src_path)); if (!installer_version.get()) { @@ -1160,8 +1150,8 @@ } if (proceed_with_installation) { - base::FilePath prefs_source_path(cmd_line.GetSwitchValueNative( - switches::kInstallerData)); + base::FilePath prefs_source_path( + cmd_line.GetSwitchValueNative(switches::kInstallerData)); const base::Version current_version( installer_state.GetCurrentVersion(original_state)); @@ -1198,9 +1188,8 @@ prefs.GetBool(master_preferences::kDoNotRegisterForUpdateLaunch, &do_not_register_for_update_launch); - bool write_chrome_launch_string = - (!do_not_register_for_update_launch && - install_status != IN_USE_UPDATED); + bool write_chrome_launch_string = (!do_not_register_for_update_launch && + install_status != IN_USE_UPDATED); installer_state.WriteInstallerResult( install_status, install_msg_base, @@ -1226,8 +1215,8 @@ if (InstallUtil::GetInstallReturnCode(install_status) == 0) { // Update the DisplayVersion created by an MSI-based install. base::FilePath master_preferences_file( - installer_state.target_path().AppendASCII( - installer::kDefaultMasterPrefs)); + installer_state.target_path().AppendASCII( + installer::kDefaultMasterPrefs)); std::string install_id; if (prefs.GetString(installer::master_preferences::kMsiProductId, &install_id)) { @@ -1237,9 +1226,9 @@ // grandparent "msiexec" process has exited. base::FilePath new_setup = installer_state.GetInstallerDirectory(*installer_version) - .Append(kSetupExe); - DelayedOverwriteDisplayVersions( - new_setup, install_id, *installer_version); + .Append(kSetupExe); + DelayedOverwriteDisplayVersions(new_setup, install_id, + *installer_version); } else { // Only when called by the MSI installer do we need to delay setting // the DisplayVersion. In other runs, such as those done by the auto- @@ -1268,8 +1257,10 @@ } // namespace installer -int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, - wchar_t* command_line, int show_command) { +int WINAPI wWinMain(HINSTANCE instance, + HINSTANCE prev_instance, + wchar_t* command_line, + int show_command) { // Check to see if the CPU is supported before doing anything else. There's // very little than can safely be accomplished if the CPU isn't supported // since dependent libraries (e.g., base) may use invalid instructions. @@ -1461,9 +1452,8 @@ UninstallProducts(original_state, installer_state, setup_exe, cmd_line); } else { // If --uninstall option is not specified, we assume it is install case. - install_status = - InstallProducts(original_state, setup_exe, cmd_line, prefs, - &installer_state, &installer_directory); + install_status = InstallProducts(original_state, setup_exe, cmd_line, prefs, + &installer_state, &installer_directory); DoLegacyCleanups(installer_state, install_status); // It may be time to kick off an experiment if this was a successful update
diff --git a/chrome/installer/setup/setup_resource.h b/chrome/installer/setup/setup_resource.h index 93f82649..5861e6f 100644 --- a/chrome/installer/setup/setup_resource.h +++ b/chrome/installer/setup/setup_resource.h
@@ -2,19 +2,24 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef CHROME_INSTALLER_SETUP_SETUP_RESOURCE_H_ +#define CHROME_INSTALLER_SETUP_SETUP_RESOURCE_H_ + //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by setup.rc // -#define IDI_SETUP 101 +#define IDI_SETUP 101 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 #endif #endif + +#endif // CHROME_INSTALLER_SETUP_SETUP_RESOURCE_H_
diff --git a/chrome/installer/setup/setup_singleton.h b/chrome/installer/setup/setup_singleton.h index 4ec9722..ebfe4043 100644 --- a/chrome/installer/setup/setup_singleton.h +++ b/chrome/installer/setup/setup_singleton.h
@@ -17,7 +17,7 @@ namespace base { class CommandLine; class TimeDelta; -} +} // namespace base namespace installer {
diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc index 625cc98..e0d5e547 100644 --- a/chrome/installer/setup/setup_util.cc +++ b/chrome/installer/setup/setup_util.cc
@@ -196,24 +196,23 @@ int CourgettePatchFiles(const base::FilePath& src, const base::FilePath& patch, const base::FilePath& dest) { - VLOG(1) << "Applying Courgette patch " << patch.value() - << " to file " << src.value() - << " and generating file " << dest.value(); + VLOG(1) << "Applying Courgette patch " << patch.value() << " to file " + << src.value() << " and generating file " << dest.value(); if (src.empty() || patch.empty() || dest.empty()) return installer::PATCH_INVALID_ARGUMENTS; - const courgette::Status patch_status = - courgette::ApplyEnsemblePatch(src.value().c_str(), - patch.value().c_str(), - dest.value().c_str()); - const int exit_code = (patch_status != courgette::C_OK) ? - static_cast<int>(patch_status) + kCourgetteErrorOffset : 0; + const courgette::Status patch_status = courgette::ApplyEnsemblePatch( + src.value().c_str(), patch.value().c_str(), dest.value().c_str()); + const int exit_code = + (patch_status != courgette::C_OK) + ? static_cast<int>(patch_status) + kCourgetteErrorOffset + : 0; - LOG_IF(ERROR, exit_code) - << "Failed to apply Courgette patch " << patch.value() - << " to file " << src.value() << " and generating file " << dest.value() - << ". err=" << exit_code; + LOG_IF(ERROR, exit_code) << "Failed to apply Courgette patch " + << patch.value() << " to file " << src.value() + << " and generating file " << dest.value() + << ". err=" << exit_code; return exit_code; } @@ -221,21 +220,20 @@ int BsdiffPatchFiles(const base::FilePath& src, const base::FilePath& patch, const base::FilePath& dest) { - VLOG(1) << "Applying bsdiff patch " << patch.value() - << " to file " << src.value() - << " and generating file " << dest.value(); + VLOG(1) << "Applying bsdiff patch " << patch.value() << " to file " + << src.value() << " and generating file " << dest.value(); if (src.empty() || patch.empty() || dest.empty()) return installer::PATCH_INVALID_ARGUMENTS; const int patch_status = bsdiff::ApplyBinaryPatch(src, patch, dest); - const int exit_code = patch_status != bsdiff::OK ? - patch_status + kBsdiffErrorOffset : 0; + const int exit_code = + patch_status != bsdiff::OK ? patch_status + kBsdiffErrorOffset : 0; - LOG_IF(ERROR, exit_code) - << "Failed to apply bsdiff patch " << patch.value() - << " to file " << src.value() << " and generating file " << dest.value() - << ". err=" << exit_code; + LOG_IF(ERROR, exit_code) << "Failed to apply bsdiff patch " << patch.value() + << " to file " << src.value() + << " and generating file " << dest.value() + << ". err=" << exit_code; return exit_code; } @@ -266,7 +264,7 @@ base::Version* GetMaxVersionFromArchiveDir(const base::FilePath& chrome_path) { VLOG(1) << "Looking for Chrome version folder under " << chrome_path.value(); base::FileEnumerator version_enum(chrome_path, false, - base::FileEnumerator::DIRECTORIES); + base::FileEnumerator::DIRECTORIES); // TODO(tommi): The version directory really should match the version of // setup.exe. To begin with, we should at least DCHECK that that's true. @@ -293,8 +291,9 @@ const InstallerState& installer_state, const base::Version& desired_version) { if (desired_version.IsValid()) { - base::FilePath archive(installer_state.GetInstallerDirectory( - desired_version).Append(kChromeArchive)); + base::FilePath archive( + installer_state.GetInstallerDirectory(desired_version) + .Append(kChromeArchive)); return base::PathExists(archive) ? archive : base::FilePath(); } @@ -306,15 +305,15 @@ original_state.GetProductState(installer_state.system_install()); if (product) { patch_source = installer_state.GetInstallerDirectory(product->version()) - .Append(installer::kChromeArchive); + .Append(installer::kChromeArchive); if (base::PathExists(patch_source)) return patch_source; } std::unique_ptr<base::Version> version( installer::GetMaxVersionFromArchiveDir(installer_state.target_path())); if (version) { - patch_source = installer_state.GetInstallerDirectory(*version) - .Append(installer::kChromeArchive); + patch_source = installer_state.GetInstallerDirectory(*version).Append( + installer::kChromeArchive); if (base::PathExists(patch_source)) return patch_source; } @@ -331,7 +330,7 @@ if (!size || size >= MAX_PATH) return false; - STARTUPINFO startup = { sizeof(STARTUPINFO) }; + STARTUPINFO startup = {sizeof(STARTUPINFO)}; PROCESS_INFORMATION pi = {0}; BOOL ok = ::CreateProcess(nullptr, rundll32, nullptr, nullptr, FALSE, CREATE_SUSPENDED, nullptr, nullptr, &startup, &pi); @@ -343,22 +342,22 @@ // This runs before the main routine of the process runs, so it doesn't // matter much which executable we choose except that we don't want to // use e.g. a console app that causes a window to be created. - size = static_cast<DWORD>( - (path.value().length() + 1) * sizeof(path.value()[0])); + size = static_cast<DWORD>((path.value().length() + 1) * + sizeof(path.value()[0])); void* mem = ::VirtualAllocEx(pi.hProcess, nullptr, size, MEM_COMMIT, PAGE_READWRITE); if (mem) { SIZE_T written = 0; - ::WriteProcessMemory( - pi.hProcess, mem, path.value().c_str(), - (path.value().size() + 1) * sizeof(path.value()[0]), &written); + ::WriteProcessMemory(pi.hProcess, mem, path.value().c_str(), + (path.value().size() + 1) * sizeof(path.value()[0]), + &written); HMODULE kernel32 = ::GetModuleHandle(L"kernel32.dll"); - PAPCFUNC sleep = reinterpret_cast<PAPCFUNC>( - ::GetProcAddress(kernel32, "Sleep")); - PAPCFUNC delete_file = reinterpret_cast<PAPCFUNC>( - ::GetProcAddress(kernel32, "DeleteFileW")); - PAPCFUNC exit_process = reinterpret_cast<PAPCFUNC>( - ::GetProcAddress(kernel32, "ExitProcess")); + PAPCFUNC sleep = + reinterpret_cast<PAPCFUNC>(::GetProcAddress(kernel32, "Sleep")); + PAPCFUNC delete_file = + reinterpret_cast<PAPCFUNC>(::GetProcAddress(kernel32, "DeleteFileW")); + PAPCFUNC exit_process = + reinterpret_cast<PAPCFUNC>(::GetProcAddress(kernel32, "ExitProcess")); if (!sleep || !delete_file || !exit_process) { NOTREACHED(); ok = FALSE; @@ -407,19 +406,19 @@ bool ContainsUnsupportedSwitch(const base::CommandLine& cmd_line) { static const char* const kLegacySwitches[] = { - // Chrome Frame ready-mode. - "ready-mode", - "ready-mode-opt-in", - "ready-mode-temp-opt-out", - "ready-mode-end-temp-opt-out", - // Chrome Frame quick-enable. - "quick-enable-cf", - // Installation of Chrome Frame. - "chrome-frame", - "migrate-chrome-frame", - // Stand-alone App Launcher. - "app-host", - "app-launcher", + // Chrome Frame ready-mode. + "ready-mode", + "ready-mode-opt-in", + "ready-mode-temp-opt-out", + "ready-mode-end-temp-opt-out", + // Chrome Frame quick-enable. + "quick-enable-cf", + // Installation of Chrome Frame. + "chrome-frame", + "migrate-chrome-frame", + // Stand-alone App Launcher. + "app-host", + "app-launcher", }; for (size_t i = 0; i < base::size(kLegacySwitches); ++i) { if (cmd_line.HasSwitch(kLegacySwitches[i])) @@ -462,11 +461,12 @@ return base::ToLowerASCII(str); }); base::win::RegKey key; - LONG result = key.Open(root, path.c_str(), (KEY_ENUMERATE_SUB_KEYS | - KEY_QUERY_VALUE | KEY_SET_VALUE)); + LONG result = + key.Open(root, path.c_str(), + (KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE | KEY_SET_VALUE)); if (result != ERROR_SUCCESS) { - LOG_IF(ERROR, result != ERROR_FILE_NOT_FOUND) << "Failed to open " << path - << "; result = " << result; + LOG_IF(ERROR, result != ERROR_FILE_NOT_FOUND) + << "Failed to open " << path << "; result = " << result; return; } @@ -609,8 +609,7 @@ return age >= base::TimeDelta() ? age.InDays() : -1; } -void RecordUnPackMetrics(UnPackStatus unpack_status, - UnPackConsumer consumer) { +void RecordUnPackMetrics(UnPackStatus unpack_status, UnPackConsumer consumer) { std::string consumer_name; switch (consumer) { @@ -660,7 +659,9 @@ .Append(FILE_PATH_LITERAL("eventlog_provider.dll"))); static constexpr const wchar_t* kFileKeys[] = { - L"CategoryMessageFile", L"EventMessageFile", L"ParameterMessageFile", + L"CategoryMessageFile", + L"EventMessageFile", + L"ParameterMessageFile", }; for (const wchar_t* file_key : kFileKeys) { work_item_list->AddSetRegValueWorkItem(HKEY_LOCAL_MACHINE, reg_path,
diff --git a/chrome/installer/setup/setup_util.h b/chrome/installer/setup/setup_util.h index 09f2ea4..70def0d 100644 --- a/chrome/installer/setup/setup_util.h +++ b/chrome/installer/setup/setup_util.h
@@ -25,7 +25,7 @@ class CommandLine; class FilePath; class Version; -} +} // namespace base namespace installer { @@ -89,7 +89,7 @@ // Drops the process down to background processing mode on supported OSes if it // was launched below the normal process priority. Returns true when background -// procesing mode is entered. +// processing mode is entered. bool AdjustProcessPriority(); // Returns true if |install_status| represents a successful uninstall code. @@ -120,8 +120,7 @@ int GetInstallAge(const InstallerState& installer_state); // Records UMA metrics for unpack result. -void RecordUnPackMetrics(UnPackStatus unpack_status, - UnPackConsumer consumer); +void RecordUnPackMetrics(UnPackStatus unpack_status, UnPackConsumer consumer); // Register Chrome's EventLog message provider dll. void RegisterEventLogProvider(const base::FilePath& install_directory,
diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc index bfaccaf..95889be 100644 --- a/chrome/installer/setup/setup_util_unittest.cc +++ b/chrome/installer/setup/setup_util_unittest.cc
@@ -174,8 +174,8 @@ : original_priority_class_(original_priority_class) {} ScopedPriorityClass::~ScopedPriorityClass() { - BOOL result = ::SetPriorityClass(::GetCurrentProcess(), - original_priority_class_); + BOOL result = + ::SetPriorityClass(::GetCurrentProcess(), original_priority_class_); EXPECT_NE(FALSE, result); } @@ -277,8 +277,7 @@ // with a product being updated. class FindArchiveToPatchTest : public testing::Test { protected: - class FakeInstallationState : public installer::InstallationState { - }; + class FakeInstallationState : public installer::InstallationState {}; class FakeProductState : public installer::ProductState { public: @@ -315,22 +314,19 @@ // Prepare to update the product in the temp dir. installer_state_.reset(new installer::InstallerState( - kSystemInstall_ ? installer::InstallerState::SYSTEM_LEVEL : - installer::InstallerState::USER_LEVEL)); + kSystemInstall_ ? installer::InstallerState::SYSTEM_LEVEL + : installer::InstallerState::USER_LEVEL)); installer_state_->set_target_path_for_testing(test_dir_.GetPath()); // Create archives in the two version dirs. ASSERT_TRUE( base::CreateDirectory(GetProductVersionArchivePath().DirName())); ASSERT_EQ(1, base::WriteFile(GetProductVersionArchivePath(), "a", 1)); - ASSERT_TRUE( - base::CreateDirectory(GetMaxVersionArchivePath().DirName())); + ASSERT_TRUE(base::CreateDirectory(GetMaxVersionArchivePath().DirName())); ASSERT_EQ(1, base::WriteFile(GetMaxVersionArchivePath(), "b", 1)); } - void TearDown() override { - original_state_.reset(); - } + void TearDown() override { original_state_.reset(); } base::FilePath GetArchivePath(const base::Version& version) const { return test_dir_.GetPath() @@ -421,16 +417,16 @@ TEST_F(FindArchiveToPatchTest, DesiredVersionFound) { base::FilePath patch_source1(installer::FindArchiveToPatch( - *original_state_, *installer_state_, product_version_)); + *original_state_, *installer_state_, product_version_)); EXPECT_EQ(GetProductVersionArchivePath().value(), patch_source1.value()); base::FilePath patch_source2(installer::FindArchiveToPatch( - *original_state_, *installer_state_, max_version_)); + *original_state_, *installer_state_, max_version_)); EXPECT_EQ(GetMaxVersionArchivePath().value(), patch_source2.value()); } TEST_F(FindArchiveToPatchTest, DesiredVersionNotFound) { base::FilePath patch_source(installer::FindArchiveToPatch( - *original_state_, *installer_state_, base::Version("1.2.3.4"))); + *original_state_, *installer_state_, base::Version("1.2.3.4"))); EXPECT_EQ(base::FilePath().value(), patch_source.value()); } @@ -533,20 +529,23 @@ // These subkeys are added such that 1) keys to preserve are intermixed with // other keys, and 2) the case of the keys to preserve doesn't match the // values in |to_preserve_|. - ASSERT_EQ(ERROR_SUCCESS, RegKey(root_, path_.c_str(), KEY_WRITE) - .CreateKey(L"0sub", KEY_WRITE)); + ASSERT_EQ( + ERROR_SUCCESS, + RegKey(root_, path_.c_str(), KEY_WRITE).CreateKey(L"0sub", KEY_WRITE)); if (with_preserves) { ASSERT_EQ(ERROR_SUCCESS, RegKey(root_, path_.c_str(), KEY_WRITE) .CreateKey(L"1evreserp", KEY_WRITE)); } - ASSERT_EQ(ERROR_SUCCESS, RegKey(root_, path_.c_str(), KEY_WRITE) - .CreateKey(L"asub", KEY_WRITE)); + ASSERT_EQ( + ERROR_SUCCESS, + RegKey(root_, path_.c_str(), KEY_WRITE).CreateKey(L"asub", KEY_WRITE)); if (with_preserves) { ASSERT_EQ(ERROR_SUCCESS, RegKey(root_, path_.c_str(), KEY_WRITE) .CreateKey(L"preserve1", KEY_WRITE)); } - ASSERT_EQ(ERROR_SUCCESS, RegKey(root_, path_.c_str(), KEY_WRITE) - .CreateKey(L"sub1", KEY_WRITE)); + ASSERT_EQ( + ERROR_SUCCESS, + RegKey(root_, path_.c_str(), KEY_WRITE).CreateKey(L"sub1", KEY_WRITE)); } const HKEY root_ = HKEY_CURRENT_USER; @@ -612,14 +611,17 @@ RegKey key(root_, path_.c_str(), KEY_SET_VALUE); ASSERT_TRUE(key.Valid()); ASSERT_EQ(ERROR_SUCCESS, key.WriteValue(nullptr, 5U)); - ASSERT_EQ(1u, base::win::RegistryValueIterator(root_, path_.c_str()) - .ValueCount()); + ASSERT_EQ( + 1u, + base::win::RegistryValueIterator(root_, path_.c_str()).ValueCount()); ASSERT_EQ(ERROR_SUCCESS, key.WriteValue(L"foo", L"bar")); - ASSERT_EQ(2u, base::win::RegistryValueIterator(root_, path_.c_str()) - .ValueCount()); + ASSERT_EQ( + 2u, + base::win::RegistryValueIterator(root_, path_.c_str()).ValueCount()); ASSERT_EQ(ERROR_SUCCESS, key.WriteValue(L"baz", L"huh")); - ASSERT_EQ(3u, base::win::RegistryValueIterator(root_, path_.c_str()) - .ValueCount()); + ASSERT_EQ( + 3u, + base::win::RegistryValueIterator(root_, path_.c_str()).ValueCount()); } ASSERT_TRUE(RegKey(root_, path_.c_str(), KEY_WRITE).Valid());
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 9dfcd7d..1665b1a 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc
@@ -75,8 +75,8 @@ // TODO(erikwright): Shouldn't this still lead to // ScheduleParentAndGrandparentForDeletion? void DeleteInstallTempDir(const base::FilePath& target_path) { - base::FilePath temp_path(target_path.DirName().Append( - installer::kInstallTempDir)); + base::FilePath temp_path( + target_path.DirName().Append(installer::kInstallTempDir)); if (base::DirectoryExists(temp_path)) { SelfCleaningTempDir temp_dir; if (!temp_dir.Initialize(target_path.DirName(), @@ -105,10 +105,9 @@ } void ClearRlzProductState() { - const rlz_lib::AccessPoint points[] = {rlz_lib::CHROME_OMNIBOX, - rlz_lib::CHROME_HOME_PAGE, - rlz_lib::CHROME_APP_LIST, - rlz_lib::NO_ACCESS_POINT}; + const rlz_lib::AccessPoint points[] = { + rlz_lib::CHROME_OMNIBOX, rlz_lib::CHROME_HOME_PAGE, + rlz_lib::CHROME_APP_LIST, rlz_lib::NO_ACCESS_POINT}; rlz_lib::ClearProductState(rlz_lib::CHROME, points); @@ -125,8 +124,7 @@ // error. bool RemoveInstallerFiles(const base::FilePath& installer_directory) { base::FileEnumerator file_enumerator( - installer_directory, - false, + installer_directory, false, base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES); bool success = true; @@ -201,7 +199,7 @@ // ShellUtil::ShortcutLocations. VLOG(1) << "Retargeting shortcuts."; for (int location = ShellUtil::SHORTCUT_LOCATION_FIRST; - location < ShellUtil::NUM_SHORTCUT_LOCATIONS; ++location) { + location < ShellUtil::NUM_SHORTCUT_LOCATIONS; ++location) { if (!ShellUtil::RetargetShortcutsWithArgs( static_cast<ShellUtil::ShortcutLocation>(location), install_level, old_target_exe, new_target_exe)) { @@ -218,8 +216,9 @@ const base::FilePath& target_exe) { // The per-user shortcut for this user, if present on a system-level install, // has already been deleted in chrome_browser_main_win.cc::DoUninstallTasks(). - ShellUtil::ShellChange install_level = installer_state.system_install() ? - ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; + ShellUtil::ShellChange install_level = installer_state.system_install() + ? ShellUtil::SYSTEM_LEVEL + : ShellUtil::CURRENT_USER; // Delete and unpin all shortcuts that point to |target_exe| from all // ShellUtil::ShortcutLocations. @@ -322,8 +321,8 @@ std::vector<base::FilePath> setup_files; setup_files.push_back(setup_exe); #if defined(COMPONENT_BUILD) - base::FileEnumerator file_enumerator( - setup_exe.DirName(), false, base::FileEnumerator::FILES, L"*.dll"); + base::FileEnumerator file_enumerator(setup_exe.DirName(), false, + base::FileEnumerator::FILES, L"*.dll"); for (base::FilePath setup_dll = file_enumerator.Next(); !setup_dll.empty(); setup_dll = file_enumerator.Next()) { setup_files.push_back(setup_dll); @@ -352,8 +351,8 @@ return false; } - VLOG(1) << "Attempting to move " << setup_file.BaseName().value() << " to: " - << temp_file.value(); + VLOG(1) << "Attempting to move " << setup_file.BaseName().value() + << " to: " << temp_file.value(); if (!base::Move(setup_file, temp_file)) { PLOG(ERROR) << "Failed to move " << setup_file.BaseName().value() << " to " << temp_file.value(); @@ -392,7 +391,8 @@ // directory. For parents of the installer directory, we will later recurse // and delete all the children (that are not also parents/children of the // installer directory). - base::FileEnumerator file_enumerator(target_path, true, + base::FileEnumerator file_enumerator( + target_path, true, base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES); for (base::FilePath to_delete = file_enumerator.Next(); !to_delete.empty(); to_delete = file_enumerator.Next()) { @@ -478,10 +478,10 @@ // Chrome (only a risk if the suffix is empty). Don't delete the whole key // since other apps may have stored data there. std::vector<const wchar_t*> cleared_assocs; - if (installer_state.system_install() || - !browser_entry_suffix.empty() || + if (installer_state.system_install() || !browser_entry_suffix.empty() || !base::win::RegKey(HKEY_LOCAL_MACHINE, (classes_path + prog_id).c_str(), - KEY_QUERY_VALUE).Valid()) { + KEY_QUERY_VALUE) + .Valid()) { InstallUtil::ValueEquals prog_id_pred(prog_id); for (const wchar_t* const* filetype = &ShellUtil::kPotentialFileAssociations[0]; @@ -627,12 +627,12 @@ // For example Google\Chrome or Chromium const base::FilePath product_directory(application_directory.DirName()); if (!product_directory.empty()) { - result = DeleteEmptyDir(product_directory); - if (result == DELETE_SUCCEEDED) { - const base::FilePath vendor_directory(product_directory.DirName()); - if (!vendor_directory.empty()) - result = DeleteEmptyDir(vendor_directory); - } + result = DeleteEmptyDir(product_directory); + if (result == DELETE_SUCCEEDED) { + const base::FilePath vendor_directory(product_directory.DirName()); + if (!vendor_directory.empty()) + result = DeleteEmptyDir(vendor_directory); + } } } if (result == DELETE_NOT_EMPTY) @@ -757,8 +757,8 @@ open_with_list_key.append(L"OpenWithList"); open_with_list_key.push_back(base::FilePath::kSeparators[0]); open_with_list_key.append(installer::kChromeExe); - InstallUtil::DeleteRegistryKey( - root, open_with_list_key, WorkItem::kWow64Default); + InstallUtil::DeleteRegistryKey(root, open_with_list_key, + WorkItem::kWow64Default); open_with_progids_key.assign(file_assoc_key); open_with_progids_key.append(ShellUtil::kRegOpenWithProgids);
diff --git a/chrome/installer/setup/uninstall.h b/chrome/installer/setup/uninstall.h index 7f864974..0b17f86 100644 --- a/chrome/installer/setup/uninstall.h +++ b/chrome/installer/setup/uninstall.h
@@ -15,7 +15,7 @@ namespace base { class CommandLine; class FilePath; -} +} // namespace base namespace installer {
diff --git a/chrome/installer/setup/user_experiment.cc b/chrome/installer/setup/user_experiment.cc index 87112fe..7f381aa 100644 --- a/chrome/installer/setup/user_experiment.cc +++ b/chrome/installer/setup/user_experiment.cc
@@ -82,7 +82,7 @@ #endif // Returns the delay to be used between presentation retries. The default (five -// minutes) can be overidden via --experiment-retry-delay=SECONDS. +// minutes) can be overridden via --experiment-retry-delay=SECONDS. base::TimeDelta GetRetryDelay() { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); base::string16 value = @@ -495,7 +495,7 @@ DCHECK(participation == ExperimentStorage::kStudyOne || participation == ExperimentStorage::kStudyTwo); if (participation == ExperimentStorage::kStudyOne) { - // Evenly distrubute clients among the groups. + // Evenly distribute clients among the groups. return base::RandInt(0, ExperimentMetrics::kNumGroups - 1); }
diff --git a/chrome/installer/setup/user_hive_visitor.h b/chrome/installer/setup/user_hive_visitor.h index f883c88e..3e6c401 100644 --- a/chrome/installer/setup/user_hive_visitor.h +++ b/chrome/installer/setup/user_hive_visitor.h
@@ -11,7 +11,7 @@ namespace win { class RegKey; } -} +} // namespace base namespace installer {
diff --git a/chrome/installer/test/alternate_version_generator.cc b/chrome/installer/test/alternate_version_generator.cc index d8ce098..03d4520 100644 --- a/chrome/installer/test/alternate_version_generator.cc +++ b/chrome/installer/test/alternate_version_generator.cc
@@ -83,7 +83,7 @@ // contents) when the guard instance is destroyed. class ScopedTempDirectory { public: - ScopedTempDirectory() { } + ScopedTempDirectory() {} ~ScopedTempDirectory() { if (!directory_.empty() && !base::DeleteFileRecursively(directory_)) { LOG(DFATAL) << "Failed deleting temporary directory \"" @@ -126,8 +126,8 @@ static_cast<ULONGLONG>(c[3])); } - ChromeVersion() { } - explicit ChromeVersion(ULONGLONG value) : version_(value) { } + ChromeVersion() {} + explicit ChromeVersion(ULONGLONG value) : version_(value) {} WORD major() const { return static_cast<WORD>(version_ >> 48); } WORD minor() const { return static_cast<WORD>(version_ >> 32); } WORD build() const { return static_cast<WORD>(version_ >> 16); } @@ -176,8 +176,8 @@ if (exit_code) { if (!GetExitCodeProcess(process.Handle(), reinterpret_cast<DWORD*>(exit_code))) { - PLOG(DFATAL) << "Failed getting the exit code for \"" - << cmdline << "\"."; + PLOG(DFATAL) << "Failed getting the exit code for \"" << cmdline + << "\"."; result = false; } else { DCHECK_NE(*exit_code, static_cast<int>(STILL_ACTIVE)); @@ -245,8 +245,8 @@ if (dest_first == dest_last) break; changed = true; - if (memcpy_s(dest_first, dest_last - dest_first, - replacement_first, src_last - src_first) != 0) { + if (memcpy_s(dest_first, dest_last - dest_first, replacement_first, + src_last - src_first) != 0) { result = false; break; } @@ -294,12 +294,9 @@ DWORD high; DWORD low; }; - VersionPair cur_ver = { - ctx.current_version.high(), ctx.current_version.low() - }; - VersionPair new_ver = { - ctx.new_version.high(), ctx.new_version.low() - }; + VersionPair cur_ver = {ctx.current_version.high(), + ctx.current_version.low()}; + VersionPair new_ver = {ctx.new_version.high(), ctx.new_version.low()}; ReplaceAll(data, data + size, reinterpret_cast<const uint8_t*>(&cur_ver), reinterpret_cast<const uint8_t*>(&cur_ver) + sizeof(cur_ver), reinterpret_cast<const uint8_t*>(&new_ver), nullptr); @@ -531,13 +528,12 @@ bool CreateArchive(const base::FilePath& output_file, const base::FilePath& input_path, int compression_level) { - DCHECK(compression_level == 0 || - compression_level >= 1 && compression_level <= 9 && - (compression_level & 0x01) != 0); + DCHECK(compression_level == 0 || compression_level >= 1 && + compression_level <= 9 && + (compression_level & 0x01) != 0); base::string16 command_line(1, L'"'); - command_line - .append(Get7zaPath().Append(&k7zaExe[0]).value()) + command_line.append(Get7zaPath().Append(&k7zaExe[0]).value()) .append(L"\" a -bd -t7z \"") .append(output_file.value()) .append(L"\" \"") @@ -549,8 +545,8 @@ return false; if (exit_code != 0) { LOG(DFATAL) << Get7zaPath().Append(&k7zaExe[0]).value() - << " exited with code " << exit_code - << " while creating " << output_file.value(); + << " exited with code " << exit_code << " while creating " + << output_file.value(); return false; } return true; @@ -595,10 +591,9 @@ // Write out setup.ex_ if (!resource_loader.Load(&kSetupEx_[0], &kBl[0], &resource_data)) return false; - int written = - base::WriteFile(setup_ex_, - reinterpret_cast<const char*>(resource_data.first), - static_cast<int>(resource_data.second)); + int written = base::WriteFile( + setup_ex_, reinterpret_cast<const char*>(resource_data.first), + static_cast<int>(resource_data.second)); if (written != static_cast<int>(resource_data.second)) { LOG(DFATAL) << "Failed writing \"" << setup_ex_.value() << "\""; return false; @@ -632,12 +627,12 @@ base::FilePath setup_exe = setup_ex_.ReplaceExtension(&kExe[0]); base::string16 command_line; command_line.append(1, L'"') - .append(&kExpandExe[0]) - .append(L"\" \"") - .append(setup_ex_.value()) - .append(L"\" \"") - .append(setup_exe.value()) - .append(1, L'\"'); + .append(&kExpandExe[0]) + .append(L"\" \"") + .append(setup_ex_.value()) + .append(L"\" \"") + .append(setup_exe.value()) + .append(1, L'\"'); int exit_code; if (!RunProcessAndWait(nullptr, command_line, &exit_code)) return false; @@ -742,8 +737,8 @@ DCHECK_EQ(ctx.current_version_str.size(), ctx.new_version_str.size()); if (!base::CopyFile(original_file, target_file)) { - LOG(DFATAL) << "Failed copying \"" << original_file.value() - << "\" to \"" << target_file.value() << "\""; + LOG(DFATAL) << "Failed copying \"" << original_file.value() << "\" to \"" + << target_file.value() << "\""; return base::string16(); }
diff --git a/chrome/installer/test/alternate_version_generator.h b/chrome/installer/test/alternate_version_generator.h index 07c0f7a3..05e0757 100644 --- a/chrome/installer/test/alternate_version_generator.h +++ b/chrome/installer/test/alternate_version_generator.h
@@ -15,10 +15,7 @@ namespace upgrade_test { -enum Direction { - PREVIOUS_VERSION, - NEXT_VERSION -}; +enum Direction { PREVIOUS_VERSION, NEXT_VERSION }; // Generates an alternate mini_installer.exe using the one indicated by // |original_installer_path|, giving the new one a lower or higher version than
diff --git a/chrome/installer/test/alternate_version_generator_main.cc b/chrome/installer/test/alternate_version_generator_main.cc index 2541482..b582716 100644 --- a/chrome/installer/test/alternate_version_generator_main.cc +++ b/chrome/installer/test/alternate_version_generator_main.cc
@@ -71,24 +71,30 @@ fwprintf(stderr, L"\n"); } - fwprintf(stderr, -L"Usage: %s [ OPTIONS ]\n" -L" Where OPTIONS is one or more of:\n" -L" --help Display this help message.\n" -L" --force Overwrite any existing output files.\n" -L" --mini_installer=SRC_PATH Path to mini_installer.exe. Default value is\n" -L" \"mini_installer.exe\" in the same directory as\n" -L" this program.\n" -L" --out=OUT_PATH Path to output file. Default value is\n" -L" \"mini_installer_new.exe\" in the current\n" -L" directory.\n" -L" --previous OUT_PATH will have a lower version than\n" -L" SRC_PATH. By default, OUT_PATH will have a\n" -L" higher version.\n" -L" --7za_path=7ZA_PATH Path to the directory holding 7za.exe. Defaults\n" -L" to ..\\..\\third_party\\lzma_sdk\\Executable\n" -L" relative to this program's location.\n", - cmd_line.GetProgram().value().c_str()); + fwprintf( + stderr, + L"Usage: %s [ OPTIONS ]\n" + L" Where OPTIONS is one or more of:\n" + L" --help Display this help message.\n" + L" --force Overwrite any existing output files.\n" + L" --mini_installer=SRC_PATH Path to mini_installer.exe. Default value " + L"is\n" + L" \"mini_installer.exe\" in the same " + L"directory as\n" + L" this program.\n" + L" --out=OUT_PATH Path to output file. Default value is\n" + L" \"mini_installer_new.exe\" in the current\n" + L" directory.\n" + L" --previous OUT_PATH will have a lower version than\n" + L" SRC_PATH. By default, OUT_PATH will have " + L"a\n" + L" higher version.\n" + L" --7za_path=7ZA_PATH Path to the directory holding 7za.exe. " + L"Defaults\n" + L" to " + L"..\\..\\third_party\\lzma_sdk\\Executable\n" + L" relative to this program's location.\n", + cmd_line.GetProgram().value().c_str()); } // Gets the path to the source mini_installer.exe on which to operate, putting @@ -117,14 +123,15 @@ // Returns the direction in which the version should be adjusted. upgrade_test::Direction GetDirection(const base::CommandLine& cmd_line) { - return cmd_line.HasSwitch(switches::kPrevious) ? - upgrade_test::PREVIOUS_VERSION : upgrade_test::NEXT_VERSION; + return cmd_line.HasSwitch(switches::kPrevious) + ? upgrade_test::PREVIOUS_VERSION + : upgrade_test::NEXT_VERSION; } } // namespace // The main program. -int wmain(int argc, wchar_t *argv[]) { +int wmain(int argc, wchar_t* argv[]) { base::AtExitManager exit_manager; base::CommandLine::Init(0, nullptr); base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
diff --git a/chrome/installer/test/pe_image_resources.cc b/chrome/installer/test/pe_image_resources.cc index 177ee1c..f2340a8a 100644 --- a/chrome/installer/test/pe_image_resources.cc +++ b/chrome/installer/test/pe_image_resources.cc
@@ -38,26 +38,26 @@ if (!StructureAt(tree_base + directory_offset, tree_size - directory_offset, &resource_directory) || directory_offset + sizeof(IMAGE_RESOURCE_DIRECTORY) + - (resource_directory->NumberOfNamedEntries + - resource_directory->NumberOfIdEntries) * - sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY) > tree_size) { + (resource_directory->NumberOfNamedEntries + + resource_directory->NumberOfIdEntries) * + sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY) > + tree_size) { LOG(DFATAL) << "Insufficient room in resource segment for directory entry."; return false; } const IMAGE_RESOURCE_DIRECTORY_ENTRY* scan = reinterpret_cast<const IMAGE_RESOURCE_DIRECTORY_ENTRY*>( - tree_base + directory_offset + - sizeof(IMAGE_RESOURCE_DIRECTORY)); - const IMAGE_RESOURCE_DIRECTORY_ENTRY* end = scan + - resource_directory->NumberOfNamedEntries + + tree_base + directory_offset + sizeof(IMAGE_RESOURCE_DIRECTORY)); + const IMAGE_RESOURCE_DIRECTORY_ENTRY* end = + scan + resource_directory->NumberOfNamedEntries + resource_directory->NumberOfIdEntries; for (; success && scan != end; ++scan) { if ((scan->NameIsString != 0) != (scan - reinterpret_cast<const IMAGE_RESOURCE_DIRECTORY_ENTRY*>( - tree_base + directory_offset + - sizeof(IMAGE_RESOURCE_DIRECTORY)) < - resource_directory->NumberOfNamedEntries)) { + tree_base + directory_offset + + sizeof(IMAGE_RESOURCE_DIRECTORY)) < + resource_directory->NumberOfNamedEntries)) { LOG(DFATAL) << "Inconsistent number of named or numbered entries."; success = false; break; @@ -67,21 +67,21 @@ if (!StructureAt(tree_base + scan->NameOffset, tree_size - scan->NameOffset, &dir_string) || scan->NameOffset + sizeof(WORD) + - dir_string->Length * sizeof(wchar_t) > tree_size) { + dir_string->Length * sizeof(wchar_t) > + tree_size) { LOG(DFATAL) << "Insufficient room in resource segment for entry name."; success = false; break; } - path->push_back( - upgrade_test::EntryId(std::wstring(&dir_string->NameString[0], - dir_string->Length))); + path->push_back(upgrade_test::EntryId( + std::wstring(&dir_string->NameString[0], dir_string->Length))); } else { path->push_back(upgrade_test::EntryId(scan->Id)); } if (scan->DataIsDirectory) { - success = EnumResourcesWorker(image, tree_base, tree_size, - scan->OffsetToDirectory, path, callback, - context); + success = + EnumResourcesWorker(image, tree_base, tree_size, + scan->OffsetToDirectory, path, callback, context); } else { const IMAGE_RESOURCE_DATA_ENTRY* data_entry; if (StructureAt(tree_base + scan->OffsetToData, @@ -91,8 +91,9 @@ data_entry->Size <= tree_base + tree_size) { // Despite what winnt.h says, OffsetToData is an RVA. - callback(*path, reinterpret_cast<uint8_t*>( - image.RVAToAddr(data_entry->OffsetToData)), + callback(*path, + reinterpret_cast<uint8_t*>( + image.RVAToAddr(data_entry->OffsetToData)), data_entry->Size, data_entry->CodePage, context); } else { LOG(DFATAL) << "Insufficient room in resource segment for data entry."; @@ -110,15 +111,17 @@ namespace upgrade_test { // static -bool EnumResources(const base::win::PEImage& image, EnumResource_Fn callback, +bool EnumResources(const base::win::PEImage& image, + EnumResource_Fn callback, uintptr_t context) { DWORD resources_size = image.GetImageDirectoryEntrySize(IMAGE_DIRECTORY_ENTRY_RESOURCE); if (resources_size != 0) { EntryPath path_storage; return EnumResourcesWorker( - image, reinterpret_cast<uint8_t*>(image.GetImageDirectoryEntryAddr( - IMAGE_DIRECTORY_ENTRY_RESOURCE)), + image, + reinterpret_cast<uint8_t*>( + image.GetImageDirectoryEntryAddr(IMAGE_DIRECTORY_ENTRY_RESOURCE)), resources_size, 0, &path_storage, callback, context); } return true;
diff --git a/chrome/installer/test/pe_image_resources.h b/chrome/installer/test/pe_image_resources.h index 73de6b9..fc2aa2e 100644 --- a/chrome/installer/test/pe_image_resources.h +++ b/chrome/installer/test/pe_image_resources.h
@@ -9,6 +9,7 @@ #define CHROME_INSTALLER_TEST_PE_IMAGE_RESOURCES_H_ #include <windows.h> + #include <stddef.h> #include <stdint.h> @@ -17,7 +18,11 @@ #include "base/logging.h" -namespace base { namespace win { class PEImage; } } +namespace base { +namespace win { +class PEImage; +} +} // namespace base namespace upgrade_test { @@ -25,13 +30,14 @@ // entries. class EntryId { public: - explicit EntryId(WORD number) : number_(number) { } + explicit EntryId(WORD number) : number_(number) {} explicit EntryId(const std::wstring& name) : name_(name), number_() { DCHECK_NE(static_cast<std::wstring::size_type>(0), name.size()); } bool IsNamed() const { return !name_.empty(); } WORD number() const { return number_; } const std::wstring& name() const { return name_; } + private: std::wstring name_; WORD number_; @@ -58,7 +64,8 @@ // Enumerates all data entries in |image|'s resource directory. |callback| is // invoked (and provided with |context|) once per entry. Returns false if // some or all of the resource directory could not be parsed. -bool EnumResources(const base::win::PEImage& image, EnumResource_Fn callback, +bool EnumResources(const base::win::PEImage& image, + EnumResource_Fn callback, uintptr_t context); } // namespace upgrade_test
diff --git a/chrome/installer/test/resource_loader.h b/chrome/installer/test/resource_loader.h index c4890428..45ad6e7 100644 --- a/chrome/installer/test/resource_loader.h +++ b/chrome/installer/test/resource_loader.h
@@ -8,6 +8,7 @@ #define CHROME_INSTALLER_TEST_RESOURCE_LOADER_H_ #include <windows.h> + #include <stdint.h> #include <string>
diff --git a/chrome/installer/test/resource_updater.cc b/chrome/installer/test/resource_updater.cc index 7b0c94b..c1ed7d1 100644 --- a/chrome/installer/test/resource_updater.cc +++ b/chrome/installer/test/resource_updater.cc
@@ -5,6 +5,7 @@ #include "chrome/installer/test/resource_updater.h" #include <windows.h> + #include <stdint.h> #include "base/files/file_path.h" @@ -27,8 +28,8 @@ DCHECK_EQ(handle_, nullptr); handle_ = BeginUpdateResource(pe_image_path.value().c_str(), FALSE); if (handle_ == nullptr) { - PLOG(DFATAL) - << "BeginUpdateResource failed on \"" << pe_image_path.value() << "\""; + PLOG(DFATAL) << "BeginUpdateResource failed on \"" << pe_image_path.value() + << "\""; return false; } return true;
diff --git a/chrome/installer/test/resource_updater.h b/chrome/installer/test/resource_updater.h index 90ccb66..4b01f0f 100644 --- a/chrome/installer/test/resource_updater.h +++ b/chrome/installer/test/resource_updater.h
@@ -31,8 +31,10 @@ // Replaces the contents of the resource |name| of |type| and |language_id| // with the contents of |input_file|, returning true on success. - bool Update(const std::wstring& name, const std::wstring& type, - WORD language_id, const base::FilePath& input_file); + bool Update(const std::wstring& name, + const std::wstring& type, + WORD language_id, + const base::FilePath& input_file); // Commits all updates to the file on disk. bool Commit();
diff --git a/chrome/installer/test/run_all_tests.cc b/chrome/installer/test/run_all_tests.cc index cb05560..bfd40e7 100644 --- a/chrome/installer/test/run_all_tests.cc +++ b/chrome/installer/test/run_all_tests.cc
@@ -4,7 +4,7 @@ #include "base/test/test_suite.h" -int main(int argc, char **argv) { +int main(int argc, char** argv) { base::TestSuite test_suite(argc, argv); return test_suite.Run();
diff --git a/chrome/installer/test/upgrade_test.cc b/chrome/installer/test/upgrade_test.cc index d7fbe15c..8dcd341 100644 --- a/chrome/installer/test/upgrade_test.cc +++ b/chrome/installer/test/upgrade_test.cc
@@ -12,7 +12,7 @@ #include "testing/gtest/include/gtest/gtest.h" namespace { - const wchar_t kMiniInstallerExe[] = L"mini_installer.exe"; +const wchar_t kMiniInstallerExe[] = L"mini_installer.exe"; } // namespace // Boilerplate for a future upgrade scenario test. @@ -32,11 +32,11 @@ static void TearDownTestCase() { EXPECT_TRUE(base::DeleteFile(next_mini_installer_path_, false)); } + private: static base::FilePath next_mini_installer_path_; }; // class UpgradeTest base::FilePath UpgradeTest::next_mini_installer_path_; -TEST_F(UpgradeTest, DoNothing) { -} +TEST_F(UpgradeTest, DoNothing) {}
diff --git a/chrome/installer/util/advanced_firewall_manager_win.cc b/chrome/installer/util/advanced_firewall_manager_win.cc index 4c987c0b..bbd0e3c 100644 --- a/chrome/installer/util/advanced_firewall_manager_win.cc +++ b/chrome/installer/util/advanced_firewall_manager_win.cc
@@ -31,7 +31,7 @@ firewall_policy_ = nullptr; return false; } - hr = firewall_policy_->get_Rules(firewall_rules_.GetAddressOf()); + hr = firewall_policy_->get_Rules(&firewall_rules_); if (FAILED(hr)) { DLOG(ERROR) << logging::SystemErrorCodeToString(hr); firewall_rules_ = nullptr; @@ -49,10 +49,7 @@ return false; // The most-restrictive active profile takes precedence. const NET_FW_PROFILE_TYPE2 kProfileTypes[] = { - NET_FW_PROFILE2_PUBLIC, - NET_FW_PROFILE2_PRIVATE, - NET_FW_PROFILE2_DOMAIN - }; + NET_FW_PROFILE2_PUBLIC, NET_FW_PROFILE2_PRIVATE, NET_FW_PROFILE2_DOMAIN}; for (size_t i = 0; i < base::size(kProfileTypes); ++i) { if ((profile_types & kProfileTypes[i]) != 0) { VARIANT_BOOL enabled = VARIANT_TRUE; @@ -153,14 +150,14 @@ void AdvancedFirewallManager::GetAllRules( std::vector<Microsoft::WRL::ComPtr<INetFwRule>>* rules) { Microsoft::WRL::ComPtr<IUnknown> rules_enum_unknown; - HRESULT hr = firewall_rules_->get__NewEnum(rules_enum_unknown.GetAddressOf()); + HRESULT hr = firewall_rules_->get__NewEnum(&rules_enum_unknown); if (FAILED(hr)) { DLOG(ERROR) << logging::SystemErrorCodeToString(hr); return; } Microsoft::WRL::ComPtr<IEnumVARIANT> rules_enum; - hr = rules_enum_unknown.CopyTo(rules_enum.GetAddressOf()); + hr = rules_enum_unknown.As(&rules_enum); if (FAILED(hr)) { DLOG(ERROR) << logging::SystemErrorCodeToString(hr); return;
diff --git a/chrome/installer/util/advanced_firewall_manager_win.h b/chrome/installer/util/advanced_firewall_manager_win.h index 1f5f8f4b..18ffc8e 100644 --- a/chrome/installer/util/advanced_firewall_manager_win.h +++ b/chrome/installer/util/advanced_firewall_manager_win.h
@@ -6,6 +6,7 @@ #define CHROME_INSTALLER_UTIL_ADVANCED_FIREWALL_MANAGER_WIN_H_ #include <windows.h> + #include <netfw.h> #include <stdint.h> #include <wrl/client.h>
diff --git a/chrome/installer/util/app_command.cc b/chrome/installer/util/app_command.cc index 3100645c..20e036a 100644 --- a/chrome/installer/util/app_command.cc +++ b/chrome/installer/util/app_command.cc
@@ -17,30 +17,25 @@ // static // Associate bool member variables with registry entries. const AppCommand::NamedBoolVar AppCommand::kNameBoolVars[] = { - {&AppCommand::sends_pings_, - google_update::kRegSendsPingsField}, - {&AppCommand::is_web_accessible_, - google_update::kRegWebAccessibleField}, - {&AppCommand::is_auto_run_on_os_upgrade_, - google_update::kRegAutoRunOnOSUpgradeField}, - {&AppCommand::is_run_as_user_, - google_update::kRegRunAsUserField}, + {&AppCommand::sends_pings_, google_update::kRegSendsPingsField}, + {&AppCommand::is_web_accessible_, google_update::kRegWebAccessibleField}, + {&AppCommand::is_auto_run_on_os_upgrade_, + google_update::kRegAutoRunOnOSUpgradeField}, + {&AppCommand::is_run_as_user_, google_update::kRegRunAsUserField}, }; AppCommand::AppCommand() : sends_pings_(false), is_web_accessible_(false), is_auto_run_on_os_upgrade_(false), - is_run_as_user_(false) { -} + is_run_as_user_(false) {} AppCommand::AppCommand(const base::string16& command_line) : command_line_(command_line), sends_pings_(false), is_web_accessible_(false), is_auto_run_on_os_upgrade_(false), - is_run_as_user_(false) { -} + is_run_as_user_(false) {} bool AppCommand::Initialize(const base::win::RegKey& key) { if (!key.Valid()) { @@ -75,15 +70,13 @@ WorkItemList* item_list) const { // Command_path is derived from GetRegCommandKey which always returns // value from GetClientsKeyPath() which should be 32-bit hive. - item_list->AddCreateRegKeyWorkItem( - predefined_root, command_path, KEY_WOW64_32KEY) + item_list + ->AddCreateRegKeyWorkItem(predefined_root, command_path, KEY_WOW64_32KEY) ->set_log_message("creating AppCommand registry key"); - item_list->AddSetRegValueWorkItem(predefined_root, - command_path, - KEY_WOW64_32KEY, - google_update::kRegCommandLineField, - command_line_, - true) + item_list + ->AddSetRegValueWorkItem(predefined_root, command_path, KEY_WOW64_32KEY, + google_update::kRegCommandLineField, + command_line_, true) ->set_log_message("setting AppCommand CommandLine registry value"); for (size_t i = 0; i < base::size(kNameBoolVars); ++i) { @@ -93,15 +86,12 @@ // Adds a work item to set |var_name| to DWORD 1 if |var_data| is true; // adds a work item to remove |var_name| otherwise. if (var_data) { - item_list->AddSetRegValueWorkItem(predefined_root, - command_path, - KEY_WOW64_32KEY, - var_name, - static_cast<DWORD>(1), - true); + item_list->AddSetRegValueWorkItem(predefined_root, command_path, + KEY_WOW64_32KEY, var_name, + static_cast<DWORD>(1), true); } else { - item_list->AddDeleteRegValueWorkItem( - predefined_root, command_path, KEY_WOW64_32KEY, var_name); + item_list->AddDeleteRegValueWorkItem(predefined_root, command_path, + KEY_WOW64_32KEY, var_name); } } }
diff --git a/chrome/installer/util/app_command.h b/chrome/installer/util/app_command.h index 2456197..e6cfd3e 100644 --- a/chrome/installer/util/app_command.h +++ b/chrome/installer/util/app_command.h
@@ -15,7 +15,7 @@ namespace win { class RegKey; } -} +} // namespace base namespace installer {
diff --git a/chrome/installer/util/app_commands.cc b/chrome/installer/util/app_commands.cc index cb6f617..bd8e5b18 100644 --- a/chrome/installer/util/app_commands.cc +++ b/chrome/installer/util/app_commands.cc
@@ -13,11 +13,9 @@ namespace installer { -AppCommands::AppCommands() { -} +AppCommands::AppCommands() {} -AppCommands::~AppCommands() { -} +AppCommands::~AppCommands() {} bool AppCommands::Initialize(const base::win::RegKey& key, REGSAM wow64access) { if (!key.Valid()) { @@ -39,10 +37,9 @@ RegKey cmd_key; LONG result; AppCommand command; - for (RegistryKeyIterator key_iterator( - key.Handle(), kEmptyString, wow64access); - key_iterator.Valid(); - ++key_iterator) { + for (RegistryKeyIterator key_iterator(key.Handle(), kEmptyString, + wow64access); + key_iterator.Valid(); ++key_iterator) { const wchar_t* name = key_iterator.Name(); result = cmd_key.Open(key.Handle(), name, KEY_QUERY_VALUE); if (result != ERROR_SUCCESS) {
diff --git a/chrome/installer/util/app_commands.h b/chrome/installer/util/app_commands.h index b4dd8e6..3d10ba3e 100644 --- a/chrome/installer/util/app_commands.h +++ b/chrome/installer/util/app_commands.h
@@ -18,7 +18,7 @@ namespace win { class RegKey; } -} +} // namespace base namespace installer {
diff --git a/chrome/installer/util/beacons.cc b/chrome/installer/util/beacons.cc index d85934a..f99d107 100644 --- a/chrome/installer/util/beacons.cc +++ b/chrome/installer/util/beacons.cc
@@ -64,8 +64,7 @@ Initialize(name); } -Beacon::~Beacon() { -} +Beacon::~Beacon() {} void Beacon::Update() { const REGSAM kAccess = KEY_WOW64_32KEY | KEY_QUERY_VALUE | KEY_SET_VALUE;
diff --git a/chrome/installer/util/beacons_unittest.cc b/chrome/installer/util/beacons_unittest.cc index f92808b..d2982c772 100644 --- a/chrome/installer/util/beacons_unittest.cc +++ b/chrome/installer/util/beacons_unittest.cc
@@ -67,7 +67,7 @@ const base::char16 BeaconTest::kBeaconName[] = L"TestBeacon"; // Nothing in the regsitry, so the beacon should not exist. -TEST_P(BeaconTest, GetNonExistant) { +TEST_P(BeaconTest, GetNonExistent) { ASSERT_TRUE(beacon()->Get().is_null()); } @@ -123,12 +123,15 @@ #if BUILDFLAG(GOOGLE_CHROME_BRANDING) // Keys should not exist in the wrong root or in the right root but wrong key. - ASSERT_FALSE(base::win::RegKey(wrong_root, right_key.c_str(), - KEY_READ).Valid()) << right_key; - ASSERT_FALSE(base::win::RegKey(wrong_root, wrong_key.c_str(), - KEY_READ).Valid()) << wrong_key; - ASSERT_FALSE(base::win::RegKey(right_root, wrong_key.c_str(), - KEY_READ).Valid()) << wrong_key; + ASSERT_FALSE( + base::win::RegKey(wrong_root, right_key.c_str(), KEY_READ).Valid()) + << right_key; + ASSERT_FALSE( + base::win::RegKey(wrong_root, wrong_key.c_str(), KEY_READ).Valid()) + << wrong_key; + ASSERT_FALSE( + base::win::RegKey(right_root, wrong_key.c_str(), KEY_READ).Valid()) + << wrong_key; #else // The tests above are skipped for Chromium builds because they fail for two // reasons:
diff --git a/chrome/installer/util/callback_work_item_unittest.cc b/chrome/installer/util/callback_work_item_unittest.cc index e3a44da..49a6563a 100644 --- a/chrome/installer/util/callback_work_item_unittest.cc +++ b/chrome/installer/util/callback_work_item_unittest.cc
@@ -36,7 +36,7 @@ } // namespace -// Test that the callback is invoked correclty during Do() and Rollback(). +// Test that the callback is invoked correctly during Do() and Rollback(). TEST(CallbackWorkItemTest, TestForwardBackward) { TestCallbackState state = TCS_UNDEFINED;
diff --git a/chrome/installer/util/channel_info.cc b/chrome/installer/util/channel_info.cc index 6194266..d26ebf11 100644 --- a/chrome/installer/util/channel_info.cc +++ b/chrome/installer/util/channel_info.cc
@@ -26,12 +26,7 @@ kSfxFull, }; -enum ModifierIndex { - MOD_STATS_DEFAULT, - MOD_STAGE, - SFX_FULL, - NUM_MODIFIERS -}; +enum ModifierIndex { MOD_STATS_DEFAULT, MOD_STAGE, SFX_FULL, NUM_MODIFIERS }; static_assert(NUM_MODIFIERS == base::size(kModifiers), "kModifiers disagrees with ModifierIndex; they must match!"); @@ -139,15 +134,15 @@ bool ChannelInfo::Initialize(const RegKey& key) { LONG result = key.ReadValue(google_update::kRegApField, &value_); return result == ERROR_SUCCESS || result == ERROR_FILE_NOT_FOUND || - result == ERROR_INVALID_HANDLE; + result == ERROR_INVALID_HANDLE; } bool ChannelInfo::Write(RegKey* key) const { DCHECK(key); // Google Update deletes the value when it is empty, so we may as well, too. - LONG result = value_.empty() ? - key->DeleteValue(google_update::kRegApField) : - key->WriteValue(google_update::kRegApField, value_.c_str()); + LONG result = value_.empty() ? key->DeleteValue(google_update::kRegApField) + : key->WriteValue(google_update::kRegApField, + value_.c_str()); if (result != ERROR_SUCCESS) { LOG(ERROR) << "Failed writing channel info; result: " << result; return false;
diff --git a/chrome/installer/util/channel_info.h b/chrome/installer/util/channel_info.h index b59704b..d8b344a 100644 --- a/chrome/installer/util/channel_info.h +++ b/chrome/installer/util/channel_info.h
@@ -11,7 +11,7 @@ namespace win { class RegKey; } -} +} // namespace base namespace installer { @@ -19,7 +19,6 @@ // parameter ("ap") client state value for a product. class ChannelInfo { public: - // Initialize an instance from the "ap" value in a given registry key. // Returns false if the value is present but could not be read from the // registry. Returns true if the value was not present or could be read. @@ -33,9 +32,7 @@ const base::string16& value() const { return value_; } void set_value(const base::string16& value) { value_ = value; } - bool Equals(const ChannelInfo& other) const { - return value_ == other.value_; - } + bool Equals(const ChannelInfo& other) const { return value_ == other.value_; } // Removes the -stage: modifier, returning true if the value is modified. bool ClearStage();
diff --git a/chrome/installer/util/conditional_work_item_list.cc b/chrome/installer/util/conditional_work_item_list.cc index d3495e3..dc56210 100644 --- a/chrome/installer/util/conditional_work_item_list.cc +++ b/chrome/installer/util/conditional_work_item_list.cc
@@ -8,8 +8,7 @@ #include "base/logging.h" ConditionalWorkItemList::ConditionalWorkItemList(Condition* condition) - : condition_(condition) { -} + : condition_(condition) {} ConditionalWorkItemList::~ConditionalWorkItemList() {} @@ -19,8 +18,7 @@ VLOG(1) << "Beginning conditional work item list"; return WorkItemList::DoImpl(); } - VLOG(1) << "No work to do in condition work item list " - << log_message_; + VLOG(1) << "No work to do in condition work item list " << log_message_; return true; } @@ -36,11 +34,9 @@ } Not::Not(WorkItem::Condition* original_condition) - : original_condition_(original_condition) { -} + : original_condition_(original_condition) {} -Not::~Not() { -} +Not::~Not() {} bool Not::ShouldRun() const { return !original_condition_->ShouldRun();
diff --git a/chrome/installer/util/conditional_work_item_list.h b/chrome/installer/util/conditional_work_item_list.h index ba28ca2..280e25c 100644 --- a/chrome/installer/util/conditional_work_item_list.h +++ b/chrome/installer/util/conditional_work_item_list.h
@@ -33,7 +33,6 @@ std::unique_ptr<Condition> condition_; }; - // Pre-defined conditions: //------------------------------------------------------------------------------ class ConditionRunIfFileExists : public WorkItem::Condition {
diff --git a/chrome/installer/util/copy_tree_work_item.cc b/chrome/installer/util/copy_tree_work_item.cc index e799829..c3edc83 100644 --- a/chrome/installer/util/copy_tree_work_item.cc +++ b/chrome/installer/util/copy_tree_work_item.cc
@@ -9,8 +9,7 @@ #include "base/win/shlwapi.h" #include "chrome/installer/util/logging_installer.h" -CopyTreeWorkItem::~CopyTreeWorkItem() { -} +CopyTreeWorkItem::~CopyTreeWorkItem() {} CopyTreeWorkItem::CopyTreeWorkItem(const base::FilePath& source_path, const base::FilePath& dest_path, @@ -50,11 +49,10 @@ (!base::DirectoryExists(dest_path_)) && (IsFileInUse(dest_path_))) { // handle overwrite_option_ = NEW_NAME_IF_IN_USE case. - if (alternative_path_.empty() || - base::PathExists(alternative_path_) || + if (alternative_path_.empty() || base::PathExists(alternative_path_) || !base::CopyFile(source_path_, alternative_path_)) { - LOG(ERROR) << "failed to copy " << source_path_.value() - << " to " << alternative_path_.value(); + LOG(ERROR) << "failed to copy " << source_path_.value() << " to " + << alternative_path_.value(); return false; } else { copied_to_alternate_path_ = true; @@ -62,8 +60,7 @@ << " to alternative path " << alternative_path_.value(); return true; } - } else if ((dest_exist) && - (overwrite_option_ == WorkItem::IF_NOT_PRESENT)) { + } else if ((dest_exist) && (overwrite_option_ == WorkItem::IF_NOT_PRESENT)) { // handle overwrite_option_ = IF_NOT_PRESENT case. return true; } @@ -81,11 +78,11 @@ backup_path_.GetPath().Append(dest_path_.BaseName()); if (base::Move(dest_path_, backup)) { moved_to_backup_ = true; - VLOG(1) << "Moved destination " << dest_path_.value() << - " to backup path " << backup.value(); + VLOG(1) << "Moved destination " << dest_path_.value() + << " to backup path " << backup.value(); } else { - PLOG(ERROR) << "failed moving " << dest_path_.value() - << " to " << backup.value(); + PLOG(ERROR) << "failed moving " << dest_path_.value() << " to " + << backup.value(); return false; } } @@ -93,11 +90,11 @@ // In all cases that reach here, copy source to destination. if (base::CopyDirectory(source_path_, dest_path_, true)) { copied_to_dest_path_ = true; - VLOG(1) << "Copied source " << source_path_.value() - << " to destination " << dest_path_.value(); + VLOG(1) << "Copied source " << source_path_.value() << " to destination " + << dest_path_.value(); } else { - LOG(ERROR) << "failed copy " << source_path_.value() - << " to " << dest_path_.value(); + LOG(ERROR) << "failed copy " << source_path_.value() << " to " + << dest_path_.value(); return false; } @@ -116,8 +113,8 @@ if (moved_to_backup_) { base::FilePath backup(backup_path_.GetPath().Append(dest_path_.BaseName())); if (!base::Move(backup, dest_path_)) { - PLOG(ERROR) << "failed move " << backup.value() - << " to " << dest_path_.value(); + PLOG(ERROR) << "failed move " << backup.value() << " to " + << dest_path_.value(); } } if (copied_to_alternate_path_ &&
diff --git a/chrome/installer/util/copy_tree_work_item_unittest.cc b/chrome/installer/util/copy_tree_work_item_unittest.cc index f58cf39e..493fa2af 100644 --- a/chrome/installer/util/copy_tree_work_item_unittest.cc +++ b/chrome/installer/util/copy_tree_work_item_unittest.cc
@@ -309,8 +309,8 @@ base::CopyFile(exe_full_path, file_name_to); ASSERT_TRUE(base::PathExists(file_name_to)); - VLOG(1) << "copy ourself from " << exe_full_path.value() - << " to " << file_name_to.value(); + VLOG(1) << "copy ourself from " << exe_full_path.value() << " to " + << file_name_to.value(); // Run the executable in destination path STARTUPINFOW si = {sizeof(si)}; @@ -387,8 +387,8 @@ ASSERT_TRUE(base::PathExists(file_name_to)); ASSERT_FALSE(CopyTreeWorkItem::IsFileInUse(file_name_to)); - VLOG(1) << "copy ourself from " << exe_full_path.value() - << " to " << file_name_to.value(); + VLOG(1) << "copy ourself from " << exe_full_path.value() << " to " + << file_name_to.value(); // Run the executable in destination path STARTUPINFOW si = {sizeof(si)}; @@ -571,8 +571,8 @@ base::CopyFile(exe_full_path, file_name_to); ASSERT_TRUE(base::PathExists(file_name_to)); - VLOG(1) << "copy ourself from " << exe_full_path.value() - << " to " << file_name_to.value(); + VLOG(1) << "copy ourself from " << exe_full_path.value() << " to " + << file_name_to.value(); // Run the executable in destination path STARTUPINFOW si = {sizeof(si)}; @@ -664,15 +664,15 @@ file_name_to_1 = file_name_to_1.AppendASCII("1"); file_name_to_1 = file_name_to_1.AppendASCII("File_1.txt"); EXPECT_TRUE(base::PathExists(file_name_to_1)); - VLOG(1) << "compare " << file_name_from_1.value() - << " and " << file_name_to_1.value(); + VLOG(1) << "compare " << file_name_from_1.value() << " and " + << file_name_to_1.value(); EXPECT_TRUE(base::ContentsEqual(file_name_from_1, file_name_to_1)); base::FilePath file_name_to_2(dir_name_to); file_name_to_2 = file_name_to_2.AppendASCII("2"); file_name_to_2 = file_name_to_2.AppendASCII("File_2.txt"); EXPECT_TRUE(base::PathExists(file_name_to_2)); - VLOG(1) << "compare " << file_name_from_2.value() - << " and " << file_name_to_2.value(); + VLOG(1) << "compare " << file_name_from_2.value() << " and " + << file_name_to_2.value(); EXPECT_TRUE(base::ContentsEqual(file_name_from_2, file_name_to_2)); }
diff --git a/chrome/installer/util/create_dir_work_item.cc b/chrome/installer/util/create_dir_work_item.cc index 659aa01..1f446a09 100644 --- a/chrome/installer/util/create_dir_work_item.cc +++ b/chrome/installer/util/create_dir_work_item.cc
@@ -2,18 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/installer/util/create_dir_work_item.h" + #include "base/files/file_util.h" #include "base/logging.h" -#include "chrome/installer/util/create_dir_work_item.h" #include "chrome/installer/util/logging_installer.h" -CreateDirWorkItem::~CreateDirWorkItem() { -} +CreateDirWorkItem::~CreateDirWorkItem() {} CreateDirWorkItem::CreateDirWorkItem(const base::FilePath& path) - : path_(path), - rollback_needed_(false) { -} + : path_(path), rollback_needed_(false) {} void CreateDirWorkItem::GetTopDirToCreate() { if (base::PathExists(path_)) { @@ -52,7 +50,7 @@ return; // Delete all the directories we created to rollback. - // Note we can not recusively delete top_path_ since we don't want to + // Note we can not recursively delete top_path_ since we don't want to // delete non-empty directory. (We may have created a shared directory). // Instead we walk through path_ to top_path_ and delete directories // along the way.
diff --git a/chrome/installer/util/create_reg_key_work_item.cc b/chrome/installer/util/create_reg_key_work_item.cc index 109de6be..466ca7d 100644 --- a/chrome/installer/util/create_reg_key_work_item.cc +++ b/chrome/installer/util/create_reg_key_work_item.cc
@@ -22,8 +22,8 @@ base::FilePath directory = path.DirName(); // If there is no separator, we will get back kCurrentDirectory. // In this case, clear dir. - if (directory == path || directory.value() == - base::FilePath::kCurrentDirectory) + if (directory == path || + directory.value() == base::FilePath::kCurrentDirectory) dir->clear(); else *dir = directory.value(); @@ -31,8 +31,7 @@ } // namespace -CreateRegKeyWorkItem::~CreateRegKeyWorkItem() { -} +CreateRegKeyWorkItem::~CreateRegKeyWorkItem() {} CreateRegKeyWorkItem::CreateRegKeyWorkItem(HKEY predefined_root, const std::wstring& path, @@ -41,8 +40,7 @@ path_(path), wow64_access_(wow64_access), key_created_(false) { - DCHECK(wow64_access == 0 || - wow64_access == KEY_WOW64_32KEY || + DCHECK(wow64_access == 0 || wow64_access == KEY_WOW64_32KEY || wow64_access == KEY_WOW64_64KEY); } @@ -61,8 +59,7 @@ DWORD disposition; key_path.assign(key_list_[i - 1]); - if (key.CreateWithDisposition(predefined_root_, - key_path.c_str(), + if (key.CreateWithDisposition(predefined_root_, key_path.c_str(), &disposition, KEY_READ | wow64_access_) == ERROR_SUCCESS) { if (disposition == REG_OPENED_EXISTING_KEY) {
diff --git a/chrome/installer/util/create_reg_key_work_item.h b/chrome/installer/util/create_reg_key_work_item.h index 93b3a0e..ab2b8e9f 100644 --- a/chrome/installer/util/create_reg_key_work_item.h +++ b/chrome/installer/util/create_reg_key_work_item.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_INSTALLER_UTIL_CREATE_REG_KEY_WORK_ITEM_H__ -#define CHROME_INSTALLER_UTIL_CREATE_REG_KEY_WORK_ITEM_H__ +#ifndef CHROME_INSTALLER_UTIL_CREATE_REG_KEY_WORK_ITEM_H_ +#define CHROME_INSTALLER_UTIL_CREATE_REG_KEY_WORK_ITEM_H_ #include <windows.h> @@ -51,4 +51,4 @@ bool key_created_; }; -#endif // CHROME_INSTALLER_UTIL_CREATE_REG_KEY_WORK_ITEM_H__ +#endif // CHROME_INSTALLER_UTIL_CREATE_REG_KEY_WORK_ITEM_H_
diff --git a/chrome/installer/util/create_reg_key_work_item_unittest.cc b/chrome/installer/util/create_reg_key_work_item_unittest.cc index c44ceed5..509c2ae7 100644 --- a/chrome/installer/util/create_reg_key_work_item_unittest.cc +++ b/chrome/installer/util/create_reg_key_work_item_unittest.cc
@@ -27,8 +27,8 @@ RegKey key(HKEY_CURRENT_USER, L"", KEY_ALL_ACCESS); key.DeleteKey(test_root); ASSERT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, test_root, KEY_READ)); - ASSERT_EQ(ERROR_SUCCESS, key.Create(HKEY_CURRENT_USER, test_root, - KEY_READ)); + ASSERT_EQ(ERROR_SUCCESS, + key.Create(HKEY_CURRENT_USER, test_root, KEY_READ)); } void TearDown() override { logging::CloseLogFile(); @@ -45,8 +45,8 @@ base::FilePath parent_key(test_root); parent_key = parent_key.AppendASCII("a"); - ASSERT_EQ(ERROR_SUCCESS, - key.Create(HKEY_CURRENT_USER, parent_key.value().c_str(), KEY_READ)); + ASSERT_EQ(ERROR_SUCCESS, key.Create(HKEY_CURRENT_USER, + parent_key.value().c_str(), KEY_READ)); base::FilePath top_key_to_create(parent_key); top_key_to_create = top_key_to_create.AppendASCII("b"); @@ -61,16 +61,17 @@ EXPECT_TRUE(work_item->Do()); - EXPECT_EQ(ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, key_to_create.value().c_str(), KEY_READ)); + EXPECT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, + key_to_create.value().c_str(), KEY_READ)); work_item->Rollback(); // Rollback should delete all the keys up to top_key_to_create. - EXPECT_NE(ERROR_SUCCESS, + EXPECT_NE( + ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, top_key_to_create.value().c_str(), KEY_READ)); EXPECT_EQ(ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, parent_key.value().c_str(), KEY_READ)); + key.Open(HKEY_CURRENT_USER, parent_key.value().c_str(), KEY_READ)); } TEST_F(CreateRegKeyWorkItemTest, CreateExistingKey) { @@ -78,8 +79,8 @@ base::FilePath key_to_create(test_root); key_to_create = key_to_create.AppendASCII("aa"); - ASSERT_EQ(ERROR_SUCCESS, - key.Create(HKEY_CURRENT_USER, key_to_create.value().c_str(), KEY_READ)); + ASSERT_EQ(ERROR_SUCCESS, key.Create(HKEY_CURRENT_USER, + key_to_create.value().c_str(), KEY_READ)); std::unique_ptr<CreateRegKeyWorkItem> work_item( WorkItem::CreateCreateRegKeyWorkItem( @@ -87,15 +88,15 @@ EXPECT_TRUE(work_item->Do()); - EXPECT_EQ(ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, key_to_create.value().c_str(), KEY_READ)); + EXPECT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, + key_to_create.value().c_str(), KEY_READ)); work_item->Rollback(); // Rollback should not remove the key since it exists before // the CreateRegKeyWorkItem is called. - EXPECT_EQ(ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, key_to_create.value().c_str(), KEY_READ)); + EXPECT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, + key_to_create.value().c_str(), KEY_READ)); } TEST_F(CreateRegKeyWorkItemTest, CreateSharedKey) { @@ -115,26 +116,27 @@ EXPECT_TRUE(work_item->Do()); - EXPECT_EQ(ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, key_to_create_3.value().c_str(), KEY_READ)); + EXPECT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, + key_to_create_3.value().c_str(), KEY_READ)); // Create another key under key_to_create_2 base::FilePath key_to_create_4(key_to_create_2); key_to_create_4 = key_to_create_4.AppendASCII("ddd"); - ASSERT_EQ(ERROR_SUCCESS, + ASSERT_EQ( + ERROR_SUCCESS, key.Create(HKEY_CURRENT_USER, key_to_create_4.value().c_str(), KEY_READ)); work_item->Rollback(); // Rollback should delete key_to_create_3. - EXPECT_NE(ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, key_to_create_3.value().c_str(), KEY_READ)); + EXPECT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, + key_to_create_3.value().c_str(), KEY_READ)); // Rollback should not delete key_to_create_2 as it is shared. - EXPECT_EQ(ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, key_to_create_2.value().c_str(), KEY_READ)); - EXPECT_EQ(ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, key_to_create_4.value().c_str(), KEY_READ)); + EXPECT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, + key_to_create_2.value().c_str(), KEY_READ)); + EXPECT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, + key_to_create_4.value().c_str(), KEY_READ)); } TEST_F(CreateRegKeyWorkItemTest, RollbackWithMissingKey) { @@ -154,22 +156,22 @@ EXPECT_TRUE(work_item->Do()); - EXPECT_EQ(ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, key_to_create_3.value().c_str(), KEY_READ)); + EXPECT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, + key_to_create_3.value().c_str(), KEY_READ)); key.Close(); // now delete key_to_create_3 ASSERT_EQ(ERROR_SUCCESS, - RegDeleteKey(HKEY_CURRENT_USER, key_to_create_3.value().c_str())); - ASSERT_NE(ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, key_to_create_3.value().c_str(), KEY_READ)); + RegDeleteKey(HKEY_CURRENT_USER, key_to_create_3.value().c_str())); + ASSERT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, + key_to_create_3.value().c_str(), KEY_READ)); work_item->Rollback(); // key_to_create_3 has already been deleted, Rollback should delete // the rest. - ASSERT_NE(ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, key_to_create_1.value().c_str(), KEY_READ)); + ASSERT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, + key_to_create_1.value().c_str(), KEY_READ)); } TEST_F(CreateRegKeyWorkItemTest, RollbackWithSetValue) { @@ -185,14 +187,15 @@ EXPECT_TRUE(work_item->Do()); // Write a value under the key we just created. - EXPECT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, - key_to_create.value().c_str(), KEY_READ | KEY_SET_VALUE)); + EXPECT_EQ(ERROR_SUCCESS, + key.Open(HKEY_CURRENT_USER, key_to_create.value().c_str(), + KEY_READ | KEY_SET_VALUE)); EXPECT_EQ(ERROR_SUCCESS, key.WriteValue(L"name", L"value")); key.Close(); work_item->Rollback(); // Rollback should not remove the key. - EXPECT_EQ(ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, key_to_create.value().c_str(), KEY_READ)); + EXPECT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, + key_to_create.value().c_str(), KEY_READ)); }
diff --git a/chrome/installer/util/delete_after_reboot_helper.cc b/chrome/installer/util/delete_after_reboot_helper.cc index aa4bdbf8..980affb 100644 --- a/chrome/installer/util/delete_after_reboot_helper.cc +++ b/chrome/installer/util/delete_after_reboot_helper.cc
@@ -57,8 +57,8 @@ bool ScheduleFileSystemEntityForDeletion(const base::FilePath& path) { // Check if the file exists, return false if not. WIN32_FILE_ATTRIBUTE_DATA attrs = {0}; - if (!::GetFileAttributesEx(path.value().c_str(), - ::GetFileExInfoStandard, &attrs)) { + if (!::GetFileAttributesEx(path.value().c_str(), ::GetFileExInfoStandard, + &attrs)) { PLOG(WARNING) << path.value() << " does not exist."; return false; } @@ -166,7 +166,8 @@ // contains all of the strings extracted from |buffer|. // Returns S_OK on success, E_INVALIDARG if buffer does not meet tha above // specification. -HRESULT MultiSZBytesToStringArray(const char* buffer, size_t byte_count, +HRESULT MultiSZBytesToStringArray(const char* buffer, + size_t byte_count, std::vector<PendingMove>* value) { DCHECK(buffer); DCHECK(value); @@ -247,9 +248,8 @@ base::FilePath GetShortPathName(const base::FilePath& path) { std::wstring short_path; - DWORD length = GetShortPathName(path.value().c_str(), - base::WriteInto(&short_path, MAX_PATH), - MAX_PATH); + DWORD length = GetShortPathName( + path.value().c_str(), base::WriteInto(&short_path, MAX_PATH), MAX_PATH); DPLOG_IF(WARNING, length == 0 && GetLastError() != ERROR_PATH_NOT_FOUND) << __func__; if ((length == 0) || (length > MAX_PATH)) { @@ -281,9 +281,9 @@ std::vector<char> buffer; buffer.resize(1); DWORD type; - DWORD result = RegQueryValueEx(session_manager_handle, kPendingFileRenameOps, - 0, &type, reinterpret_cast<BYTE*>(&buffer[0]), - &buffer_size); + DWORD result = + RegQueryValueEx(session_manager_handle, kPendingFileRenameOps, 0, &type, + reinterpret_cast<BYTE*>(&buffer[0]), &buffer_size); if (result == ERROR_FILE_NOT_FOUND) { // No pending moves were found. @@ -307,9 +307,9 @@ // There are pending file renames. Read them in. buffer.resize(buffer_size); - result = RegQueryValueEx(session_manager_handle, kPendingFileRenameOps, - 0, &type, reinterpret_cast<LPBYTE>(&buffer[0]), - &buffer_size); + result = + RegQueryValueEx(session_manager_handle, kPendingFileRenameOps, 0, &type, + reinterpret_cast<LPBYTE>(&buffer[0]), &buffer_size); if (result != ERROR_SUCCESS) { DLOG(ERROR) << "Failed to read from " << kPendingFileRenameOps; return HRESULT_FROM_WIN32(result); @@ -318,8 +318,8 @@ // We now have a buffer of bytes that is actually a sequence of // null-terminated wchar_t strings terminated by an additional null character. // Stick this into a vector of strings for clarity. - HRESULT hr = MultiSZBytesToStringArray(&buffer[0], buffer.size(), - pending_moves); + HRESULT hr = + MultiSZBytesToStringArray(&buffer[0], buffer.size(), pending_moves); return hr; } @@ -344,8 +344,8 @@ base::saturated_cast<DWORD>(short_form_needle.value().size()); return ::CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, short_match_path.value().data(), prefix_len, - short_form_needle.value().data(), prefix_len) == - CSTR_EQUAL; + short_form_needle.value().data(), + prefix_len) == CSTR_EQUAL; } // Removes all pending moves for the given |directory| and any contained @@ -393,7 +393,7 @@ if (strings_to_keep.size() <= 1) { // We have only the trailing empty string. Don't bother writing that. return (session_manager_key.DeleteValue(kPendingFileRenameOps) == - ERROR_SUCCESS); + ERROR_SUCCESS); } std::vector<char> buffer; StringArrayToMultiSZBytes(strings_to_keep, &buffer); @@ -401,5 +401,6 @@ if (buffer.empty()) return false; return (session_manager_key.WriteValue(kPendingFileRenameOps, &buffer[0], - buffer.size(), REG_MULTI_SZ) == ERROR_SUCCESS); + buffer.size(), + REG_MULTI_SZ) == ERROR_SUCCESS); }
diff --git a/chrome/installer/util/delete_after_reboot_helper.h b/chrome/installer/util/delete_after_reboot_helper.h index aa0b3a01..16d6b981 100644 --- a/chrome/installer/util/delete_after_reboot_helper.h +++ b/chrome/installer/util/delete_after_reboot_helper.h
@@ -12,6 +12,7 @@ #include <vector> #include <windows.h> + #include <stddef.h> namespace base { @@ -57,7 +58,8 @@ // |buffer|. // Returns S_OK on success, E_INVALIDARG if buffer does not meet the above // specification. -HRESULT MultiSZBytesToStringArray(const char* buffer, size_t byte_count, +HRESULT MultiSZBytesToStringArray(const char* buffer, + size_t byte_count, std::vector<PendingMove>* value); // The inverse of MultiSZBytesToStringArray, this function converts a list
diff --git a/chrome/installer/util/delete_after_reboot_helper_unittest.cc b/chrome/installer/util/delete_after_reboot_helper_unittest.cc index 9b205faa..544ce74 100644 --- a/chrome/installer/util/delete_after_reboot_helper_unittest.cc +++ b/chrome/installer/util/delete_after_reboot_helper_unittest.cc
@@ -5,6 +5,7 @@ #include "chrome/installer/util/delete_after_reboot_helper.h" #include <windows.h> + #include <shlobj.h> #include <stddef.h> @@ -46,9 +47,9 @@ // Try and restore the pending moves value, if we have one. if (IsUserAnAdmin() && original_pending_moves_.size() > 1) { - base::win::RegKey session_manager_key( - HKEY_LOCAL_MACHINE, kSessionManagerKey, - KEY_CREATE_SUB_KEY | KEY_SET_VALUE); + base::win::RegKey session_manager_key(HKEY_LOCAL_MACHINE, + kSessionManagerKey, + KEY_CREATE_SUB_KEY | KEY_SET_VALUE); if (!session_manager_key.Handle()) { // Couldn't open / create the key. DLOG(ERROR) << "Failed to open session manager key for writing."; @@ -65,7 +66,7 @@ // Compares two buffers of size len. Returns true if they are equal, // false otherwise. Standard warnings about making sure the buffers // are at least len chars long apply. - template<class Type> + template <class Type> bool CompareBuffers(Type* buf1, Type* buf2, int len) { Type* comp1 = buf1; Type* comp2 = buf2; @@ -86,7 +87,7 @@ size_t length = 0; std::vector<PendingMove>::const_iterator iter(string_list.begin()); for (; iter != string_list.end(); ++iter) { - length += iter->first.size() + 1; // +1 for the null char. + length += iter->first.size() + 1; // +1 for the null char. length += iter->second.size() + 1; // +1 for the null char. } length++; // for the additional null char. @@ -110,17 +111,16 @@ DWORD length; size_t count; } tests[] = { - { L"basic", L"foo\0bar\0fee\0bee\0boo\0bong\0\0", 26 * sizeof(wchar_t), 3 }, - { L"empty", L"\0\0", 2 * sizeof(wchar_t), 1 }, - { L"deletes", L"foo\0\0bar\0\0bizz\0\0", 16 * sizeof(wchar_t), 3 }, + {L"basic", L"foo\0bar\0fee\0bee\0boo\0bong\0\0", 26 * sizeof(wchar_t), 3}, + {L"empty", L"\0\0", 2 * sizeof(wchar_t), 1}, + {L"deletes", L"foo\0\0bar\0\0bizz\0\0", 16 * sizeof(wchar_t), 3}, }; for (size_t i = 0; i < base::size(tests); i++) { std::vector<PendingMove> string_list; EXPECT_TRUE(SUCCEEDED( MultiSZBytesToStringArray(reinterpret_cast<const char*>(tests[i].str), - tests[i].length, - &string_list))) + tests[i].length, &string_list))) << tests[i].test_name; EXPECT_EQ(tests[i].count, string_list.size()) << tests[i].test_name; std::vector<char> buffer; @@ -139,14 +139,12 @@ for (size_t i = 0; i < base::size(failures); i++) { std::vector<PendingMove> string_list; EXPECT_FALSE(SUCCEEDED(MultiSZBytesToStringArray( - reinterpret_cast<const char*>(failures[i].str), - failures[i].length, + reinterpret_cast<const char*>(failures[i].str), failures[i].length, &string_list))) << failures[i].test_name; } } - TEST_F(DeleteAfterRebootHelperTest, TestFileDeleteScheduleAndUnschedule) { if (!IsUserAnAdmin()) { return; @@ -173,8 +171,8 @@ } // Check that each of the deletes we expect are there in order. - base::FilePath expected_paths[] = - { temp_file_, temp_subdir_file_, temp_subdir_, temp_dir_ }; + base::FilePath expected_paths[] = {temp_file_, temp_subdir_file_, + temp_subdir_, temp_dir_}; for (size_t i = 0; i < base::size(expected_paths); ++i) { EXPECT_FALSE(iter == pending_moves.end()); if (iter != pending_moves.end()) { @@ -227,8 +225,8 @@ } // Check that each of the deletes we expect are there in order. - base::FilePath expected_paths[] = - { temp_file_, temp_subdir_file_, temp_subdir_, temp_dir_ }; + base::FilePath expected_paths[] = {temp_file_, temp_subdir_file_, + temp_subdir_, temp_dir_}; for (size_t i = 0; i < base::size(expected_paths); ++i) { EXPECT_FALSE(iter == pending_moves.end()); if (iter != pending_moves.end()) { @@ -255,4 +253,3 @@ EXPECT_FALSE(MatchPendingDeletePath(short_temp_file, move_path)); } } -
diff --git a/chrome/installer/util/delete_reg_key_work_item.cc b/chrome/installer/util/delete_reg_key_work_item.cc index f937efe..598e563 100644 --- a/chrome/installer/util/delete_reg_key_work_item.cc +++ b/chrome/installer/util/delete_reg_key_work_item.cc
@@ -11,8 +11,7 @@ using base::win::RegKey; -DeleteRegKeyWorkItem::~DeleteRegKeyWorkItem() { -} +DeleteRegKeyWorkItem::~DeleteRegKeyWorkItem() {} DeleteRegKeyWorkItem::DeleteRegKeyWorkItem(HKEY predefined_root, const std::wstring& path, @@ -23,8 +22,7 @@ DCHECK(predefined_root); // It's a safe bet that we don't want to delete one of the root trees. DCHECK(!path.empty()); - DCHECK(wow64_access == 0 || - wow64_access == KEY_WOW64_32KEY || + DCHECK(wow64_access == 0 || wow64_access == KEY_WOW64_32KEY || wow64_access == KEY_WOW64_64KEY); } @@ -44,8 +42,8 @@ } // Delete the key. - if (!InstallUtil::DeleteRegistryKey( - predefined_root_, path_.c_str(), wow64_access_)) { + if (!InstallUtil::DeleteRegistryKey(predefined_root_, path_.c_str(), + wow64_access_)) { return false; } @@ -58,8 +56,7 @@ // Delete anything in the key before restoring the backup in case someone else // put new data in the key after Do(). - InstallUtil::DeleteRegistryKey(predefined_root_, - path_.c_str(), + InstallUtil::DeleteRegistryKey(predefined_root_, path_.c_str(), wow64_access_); // Restore the old contents. The restoration takes on its default security
diff --git a/chrome/installer/util/delete_reg_key_work_item_unittest.cc b/chrome/installer/util/delete_reg_key_work_item_unittest.cc index 9621d591..e5fe08d 100644 --- a/chrome/installer/util/delete_reg_key_work_item_unittest.cc +++ b/chrome/installer/util/delete_reg_key_work_item_unittest.cc
@@ -5,6 +5,7 @@ #include "chrome/installer/util/delete_reg_key_work_item.h" #include <windows.h> + #include <atlsecurity.h> // NOLINT #include <stddef.h> @@ -20,9 +21,7 @@ class DeleteRegKeyWorkItemTest : public testing::Test { protected: - static void TearDownTestCase() { - logging::CloseLogFile(); - } + static void TearDownTestCase() { logging::CloseLogFile(); } void SetUp() override { ASSERT_TRUE(test_data_.Initialize(HKEY_CURRENT_USER, L"SOFTWARE\\TmpTmp")); @@ -35,9 +34,8 @@ // nothing. TEST_F(DeleteRegKeyWorkItemTest, TestNoKey) { const std::wstring key_paths[] = { - std::wstring(test_data_.base_path() + L"\\NoKeyHere"), - std::wstring(test_data_.base_path() + L"\\NoKeyHere\\OrHere") - }; + std::wstring(test_data_.base_path() + L"\\NoKeyHere"), + std::wstring(test_data_.base_path() + L"\\NoKeyHere\\OrHere")}; RegKey key; for (size_t i = 0; i < base::size(key_paths); ++i) { const std::wstring& key_path = key_paths[i]; @@ -45,12 +43,12 @@ WorkItem::CreateDeleteRegKeyWorkItem(test_data_.root_key(), key_path, WorkItem::kWow64Default)); EXPECT_TRUE(item->Do()); - EXPECT_NE(ERROR_SUCCESS, key.Open(test_data_.root_key(), key_path.c_str(), - KEY_READ)); + EXPECT_NE(ERROR_SUCCESS, + key.Open(test_data_.root_key(), key_path.c_str(), KEY_READ)); item->Rollback(); item.reset(); - EXPECT_NE(ERROR_SUCCESS, key.Open(test_data_.root_key(), key_path.c_str(), - KEY_READ)); + EXPECT_NE(ERROR_SUCCESS, + key.Open(test_data_.root_key(), key_path.c_str(), KEY_READ)); } } @@ -62,12 +60,12 @@ WorkItem::CreateDeleteRegKeyWorkItem(test_data_.root_key(), key_path, WorkItem::kWow64Default)); EXPECT_TRUE(item->Do()); - EXPECT_NE(ERROR_SUCCESS, key.Open(test_data_.root_key(), key_path.c_str(), - KEY_READ)); + EXPECT_NE(ERROR_SUCCESS, + key.Open(test_data_.root_key(), key_path.c_str(), KEY_READ)); item->Rollback(); item.reset(); - EXPECT_EQ(ERROR_SUCCESS, key.Open(test_data_.root_key(), key_path.c_str(), - KEY_READ)); + EXPECT_EQ(ERROR_SUCCESS, + key.Open(test_data_.root_key(), key_path.c_str(), KEY_READ)); } // Test that deleting a key with subkeys and values succeeds, and that rollback @@ -79,8 +77,8 @@ WorkItem::CreateDeleteRegKeyWorkItem(test_data_.root_key(), key_path, WorkItem::kWow64Default)); EXPECT_TRUE(item->Do()); - EXPECT_NE(ERROR_SUCCESS, key.Open(test_data_.root_key(), key_path.c_str(), - KEY_READ)); + EXPECT_NE(ERROR_SUCCESS, + key.Open(test_data_.root_key(), key_path.c_str(), KEY_READ)); item->Rollback(); item.reset(); test_data_.ExpectMatchesNonEmptyKey(test_data_.root_key(), key_path.c_str()); @@ -93,17 +91,17 @@ TEST_F(DeleteRegKeyWorkItemTest, DISABLED_TestUndeletableKey) { RegKey key; std::wstring key_name(test_data_.base_path() + L"\\UndeletableKey"); - EXPECT_EQ(ERROR_SUCCESS, key.Create(test_data_.root_key(), key_name.c_str(), - KEY_WRITE)); + EXPECT_EQ(ERROR_SUCCESS, + key.Create(test_data_.root_key(), key_name.c_str(), KEY_WRITE)); EXPECT_EQ(ERROR_SUCCESS, key.WriteValue(nullptr, key_name.c_str())); DWORD dw_value = 1; RegKey subkey; RegKey subkey2; - EXPECT_EQ(ERROR_SUCCESS, subkey.Create(key.Handle(), L"Subkey", - KEY_WRITE | WRITE_DAC)); + EXPECT_EQ(ERROR_SUCCESS, + subkey.Create(key.Handle(), L"Subkey", KEY_WRITE | WRITE_DAC)); EXPECT_EQ(ERROR_SUCCESS, subkey.WriteValue(L"SomeValue", 1U)); - EXPECT_EQ(ERROR_SUCCESS, subkey2.Create(subkey.Handle(), L"Subkey2", - KEY_WRITE | WRITE_DAC)); + EXPECT_EQ(ERROR_SUCCESS, + subkey2.Create(subkey.Handle(), L"Subkey2", KEY_WRITE | WRITE_DAC)); EXPECT_EQ(ERROR_SUCCESS, subkey2.WriteValue(L"", 2U)); CSecurityDesc sec_desc; sec_desc.FromString(L"D:PAI(A;OICI;KR;;;BU)"); // builtin users read @@ -123,12 +121,12 @@ WorkItem::CreateDeleteRegKeyWorkItem(test_data_.root_key(), key_name, WorkItem::kWow64Default)); EXPECT_FALSE(item->Do()); - EXPECT_EQ(ERROR_SUCCESS, key.Open(test_data_.root_key(), key_name.c_str(), - KEY_QUERY_VALUE)); + EXPECT_EQ(ERROR_SUCCESS, + key.Open(test_data_.root_key(), key_name.c_str(), KEY_QUERY_VALUE)); item->Rollback(); item.reset(); - EXPECT_EQ(ERROR_SUCCESS, key.Open(test_data_.root_key(), key_name.c_str(), - KEY_QUERY_VALUE)); + EXPECT_EQ(ERROR_SUCCESS, + key.Open(test_data_.root_key(), key_name.c_str(), KEY_QUERY_VALUE)); std::wstring str_value; EXPECT_EQ(ERROR_SUCCESS, key.ReadValue(nullptr, &str_value)); EXPECT_EQ(key_name, str_value); @@ -138,9 +136,9 @@ EXPECT_EQ(1U, dw_value); // Give users all access to the subkey so it can be deleted. EXPECT_EQ(ERROR_SUCCESS, - RegSetKeySecurity(key.Handle(), DACL_SECURITY_INFORMATION, - const_cast<SECURITY_DESCRIPTOR*>( - sec_desc.GetPSECURITY_DESCRIPTOR()))); + RegSetKeySecurity(key.Handle(), DACL_SECURITY_INFORMATION, + const_cast<SECURITY_DESCRIPTOR*>( + sec_desc.GetPSECURITY_DESCRIPTOR()))); EXPECT_EQ(ERROR_SUCCESS, key.OpenKey(L"Subkey2", KEY_QUERY_VALUE)); EXPECT_EQ(ERROR_SUCCESS, key.ReadValueDW(L"", &dw_value)); EXPECT_EQ(2U, dw_value);
diff --git a/chrome/installer/util/delete_reg_value_work_item.cc b/chrome/installer/util/delete_reg_value_work_item.cc index 730ea24..0a887b7 100644 --- a/chrome/installer/util/delete_reg_value_work_item.cc +++ b/chrome/installer/util/delete_reg_value_work_item.cc
@@ -21,13 +21,11 @@ wow64_access_(wow64_access), status_(DELETE_VALUE), previous_type_(0) { - DCHECK(wow64_access == 0 || - wow64_access == KEY_WOW64_32KEY || + DCHECK(wow64_access == 0 || wow64_access == KEY_WOW64_32KEY || wow64_access == KEY_WOW64_64KEY); } -DeleteRegValueWorkItem::~DeleteRegValueWorkItem() { -} +DeleteRegValueWorkItem::~DeleteRegValueWorkItem() {} bool DeleteRegValueWorkItem::DoImpl() { DCHECK_EQ(DELETE_VALUE, status_); @@ -37,8 +35,7 @@ RegKey key; DWORD type = 0; DWORD size = 0; - LONG result = key.Open(predefined_root_, - key_path_.c_str(), + LONG result = key.Open(predefined_root_, key_path_.c_str(), KEY_READ | KEY_WRITE | wow64_access_); if (result == ERROR_SUCCESS) result = key.ReadValue(value_name_.c_str(), nullptr, &size, &type); @@ -88,17 +85,16 @@ DCHECK_EQ(VALUE_DELETED, status_); RegKey key; - LONG result = key.Open(predefined_root_, - key_path_.c_str(), + LONG result = key.Open(predefined_root_, key_path_.c_str(), KEY_READ | KEY_WRITE | wow64_access_); if (result == ERROR_SUCCESS) { // try to restore the previous value DWORD previous_size = static_cast<DWORD>(previous_value_.size()); const char* previous_value = previous_size ? &previous_value_[0] : nullptr; - result = key.WriteValue(value_name_.c_str(), previous_value, - previous_size, previous_type_); - VLOG_IF(1, result != ERROR_SUCCESS) << "rollback: restoring " - << value_name_ << " error: " << result; + result = key.WriteValue(value_name_.c_str(), previous_value, previous_size, + previous_type_); + VLOG_IF(1, result != ERROR_SUCCESS) + << "rollback: restoring " << value_name_ << " error: " << result; } else { VLOG(1) << "can not open " << key_path_ << " error: " << result; }
diff --git a/chrome/installer/util/delete_tree_work_item.cc b/chrome/installer/util/delete_tree_work_item.cc index d3a42ed..1d6a537 100644 --- a/chrome/installer/util/delete_tree_work_item.cc +++ b/chrome/installer/util/delete_tree_work_item.cc
@@ -67,7 +67,7 @@ moved_to_backup_ = true; return true; } - PLOG(ERROR) << "Failed to move " << root_path_.value() - << " to backup path " << backup.value(); + PLOG(ERROR) << "Failed to move " << root_path_.value() << " to backup path " + << backup.value(); return false; }
diff --git a/chrome/installer/util/duplicate_tree_detector.cc b/chrome/installer/util/duplicate_tree_detector.cc index 4a12ea3..34937d7 100644 --- a/chrome/installer/util/duplicate_tree_detector.cc +++ b/chrome/installer/util/duplicate_tree_detector.cc
@@ -35,11 +35,11 @@ // "identical" to all the entries in src_path. is_identical = true; - base::FileEnumerator path_enum(src_path, false /* not recursive */, + base::FileEnumerator path_enum( + src_path, false /* not recursive */, base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES); for (base::FilePath path = path_enum.Next(); - is_identical && !path.empty(); - path = path_enum.Next()) { + is_identical && !path.empty(); path = path_enum.Next()) { is_identical = IsIdenticalFileHierarchy(path, dest_path.Append(path.BaseName())); }
diff --git a/chrome/installer/util/duplicate_tree_detector_unittest.cc b/chrome/installer/util/duplicate_tree_detector_unittest.cc index bb34fec..457f82cc 100644 --- a/chrome/installer/util/duplicate_tree_detector_unittest.cc +++ b/chrome/installer/util/duplicate_tree_detector_unittest.cc
@@ -69,8 +69,7 @@ const wchar_t DuplicateTreeDetectorTest::text_content_1_[] = L"Gooooooooooooooooooooogle"; -const wchar_t DuplicateTreeDetectorTest::text_content_2_[] = - L"Overwrite Me"; +const wchar_t DuplicateTreeDetectorTest::text_content_2_[] = L"Overwrite Me"; const wchar_t DuplicateTreeDetectorTest::text_content_3_[] = L"I'd rather see your watermelon and raise you ham and a half."; @@ -122,9 +121,8 @@ temp_dest_dir_.GetPath()); base::FilePath existing_file(temp_dest_dir_.GetPath()); - existing_file = existing_file.AppendASCII("D1") - .AppendASCII("D2") - .AppendASCII("F2"); + existing_file = + existing_file.AppendASCII("D1").AppendASCII("D2").AppendASCII("F2"); CreateTextFile(existing_file.MaybeAsASCII(), text_content_3_); EXPECT_FALSE(installer::IsIdenticalFileHierarchy(temp_source_dir_.GetPath(),
diff --git a/chrome/installer/util/fake_installation_state.h b/chrome/installer/util/fake_installation_state.h index e7af25c9..3730047 100644 --- a/chrome/installer/util/fake_installation_state.h +++ b/chrome/installer/util/fake_installation_state.h
@@ -22,10 +22,9 @@ FakeProductState chrome_state; chrome_state.set_version(version); base::FilePath setup_exe(GetChromeInstallPath(system_install)); - setup_exe = setup_exe - .AppendASCII(version->GetString()) - .Append(kInstallerDir) - .Append(kSetupExe); + setup_exe = setup_exe.AppendASCII(version->GetString()) + .Append(kInstallerDir) + .Append(kSetupExe); chrome_state.SetUninstallProgram(setup_exe); chrome_state.AddUninstallSwitch(switches::kUninstall); SetProductState(system_install, chrome_state);
diff --git a/chrome/installer/util/firewall_manager_win.cc b/chrome/installer/util/firewall_manager_win.cc index a001e51..989dfdf 100644 --- a/chrome/installer/util/firewall_manager_win.cc +++ b/chrome/installer/util/firewall_manager_win.cc
@@ -41,9 +41,7 @@ kDefaultMdnsPort); } - void RemoveFirewallRules() override { - manager_.DeleteAllRules(); - } + void RemoveFirewallRules() override { manager_.DeleteAllRules(); } private: static base::string16 GetMdnsRuleName() { @@ -74,7 +72,6 @@ return nullptr; } -FirewallManager::FirewallManager() { -} +FirewallManager::FirewallManager() {} } // namespace installer
diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc index bededfd..c67b11cc 100644 --- a/chrome/installer/util/google_update_settings.cc +++ b/chrome/installer/util/google_update_settings.cc
@@ -240,16 +240,16 @@ ? install_static::GetClientStateMediumKeyPath() : install_static::GetClientStateKeyPath(); RegKey key; - LONG result = key.Create( - root_key, reg_path.c_str(), KEY_SET_VALUE | KEY_WOW64_32KEY); + LONG result = + key.Create(root_key, reg_path.c_str(), KEY_SET_VALUE | KEY_WOW64_32KEY); if (result != ERROR_SUCCESS) { LOG(ERROR) << "Failed opening key " << reg_path << " to set " << google_update::kRegUsageStatsField << "; result: " << result; } else { result = key.WriteValue(google_update::kRegUsageStatsField, value); - LOG_IF(ERROR, result != ERROR_SUCCESS) << "Failed setting " - << google_update::kRegUsageStatsField << " in key " << reg_path - << "; result: " << result; + LOG_IF(ERROR, result != ERROR_SUCCESS) + << "Failed setting " << google_update::kRegUsageStatsField << " in key " + << reg_path << "; result: " << result; } // When opting out, clear registry backup of client id and related values. @@ -279,7 +279,7 @@ if (!ReadUserGoogleUpdateStrKey(google_update::kRegMetricsId, &client_id_16) || client_id_16.empty()) { - return std::unique_ptr<metrics::ClientInfo>(); + return nullptr; } std::unique_ptr<metrics::ClientInfo> client_info(new metrics::ClientInfo); @@ -386,8 +386,10 @@ return ClearGoogleUpdateStrKey(google_update::kRegReferralField); } -void GoogleUpdateSettings::UpdateInstallStatus(bool system_install, - installer::ArchiveType archive_type, int install_return_code, +void GoogleUpdateSettings::UpdateInstallStatus( + bool system_install, + installer::ArchiveType archive_type, + int install_return_code, const base::string16& product_guid) { DCHECK(archive_type != installer::UNKNOWN_ARCHIVE_TYPE || install_return_code != 0); @@ -398,8 +400,7 @@ base::string16 reg_key(google_update::kRegPathClientState); reg_key.append(L"\\"); reg_key.append(product_guid); - LONG result = key.Open(reg_root, - reg_key.c_str(), + LONG result = key.Open(reg_root, reg_key.c_str(), KEY_QUERY_VALUE | KEY_SET_VALUE | KEY_WOW64_32KEY); if (result == ERROR_SUCCESS) channel_info.Initialize(key); @@ -411,8 +412,7 @@ // We have a modified channel_info value to write. // Create the app's ClientState key if it doesn't already exist. if (!key.Valid()) { - result = key.Open(reg_root, - google_update::kRegPathClientState, + result = key.Open(reg_root, google_update::kRegPathClientState, KEY_CREATE_SUB_KEY | KEY_WOW64_32KEY); if (result == ERROR_SUCCESS) result = key.CreateKey(product_guid.c_str(), @@ -444,7 +444,8 @@ } bool GoogleUpdateSettings::UpdateGoogleUpdateApKey( - installer::ArchiveType archive_type, int install_return_code, + installer::ArchiveType archive_type, + int install_return_code, installer::ChannelInfo* value) { DCHECK(archive_type != installer::UNKNOWN_ARCHIVE_TYPE || install_return_code != 0); @@ -494,7 +495,7 @@ // Google Update Group Policy settings are always in HKLM. // TODO(wfh): Check if policies should go into Wow6432Node or not. if (policy_key.Open(HKEY_LOCAL_MACHINE, kPoliciesKey, KEY_QUERY_VALUE) == - ERROR_SUCCESS) { + ERROR_SUCCESS) { DWORD value = 0; base::string16 app_update_override = base::StrCat({kUpdateOverrideValuePrefix, app_guid}); @@ -525,10 +526,10 @@ // disabled. RegKey policy_key; DWORD value = 0; - if (policy_key.Open(HKEY_LOCAL_MACHINE, kPoliciesKey, - KEY_QUERY_VALUE) == ERROR_SUCCESS && - policy_key.ReadValueDW(kCheckPeriodOverrideMinutes, - &value) == ERROR_SUCCESS && + if (policy_key.Open(HKEY_LOCAL_MACHINE, kPoliciesKey, KEY_QUERY_VALUE) == + ERROR_SUCCESS && + policy_key.ReadValueDW(kCheckPeriodOverrideMinutes, &value) == + ERROR_SUCCESS && (value == 0 || value > kCheckPeriodOverrideMinutesMax)) { return false; } @@ -593,8 +594,8 @@ // Check the auto-update check period override. If it is 0 or exceeds // the maximum timeout, delete the override value. - if (policy_key.ReadValueDW(kCheckPeriodOverrideMinutes, - &value) == ERROR_SUCCESS && + if (policy_key.ReadValueDW(kCheckPeriodOverrideMinutes, &value) == + ERROR_SUCCESS && (value == 0 || value > kCheckPeriodOverrideMinutesMax)) { ++needs_reset_count; if (policy_key.DeleteValue(kCheckPeriodOverrideMinutes) == ERROR_SUCCESS) @@ -659,8 +660,7 @@ base::string16 version; RegKey key; - if (key.Open(root_key, - google_update::kRegPathGoogleUpdate, + if (key.Open(root_key, google_update::kRegPathGoogleUpdate, KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS && key.ReadValue(google_update::kRegGoogleUpdateVersion, &version) == ERROR_SUCCESS) { @@ -675,8 +675,7 @@ const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; RegKey update_key; - if (update_key.Open(root_key, - google_update::kRegPathGoogleUpdate, + if (update_key.Open(root_key, google_update::kRegPathGoogleUpdate, KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS) { DWORD last_start; if (update_key.ReadValueDW(google_update::kRegLastStartedAUField, @@ -693,8 +692,7 @@ const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; RegKey update_key; - if (update_key.Open(root_key, - google_update::kRegPathGoogleUpdate, + if (update_key.Open(root_key, google_update::kRegPathGoogleUpdate, KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS) { DWORD last_check; if (update_key.ReadValueDW(google_update::kRegLastCheckedField, @@ -720,15 +718,14 @@ clientstate_reg_path.append(app_guid); RegKey clientstate; - if (clientstate.Open(root_key, - clientstate_reg_path.c_str(), + if (clientstate.Open(root_key, clientstate_reg_path.c_str(), KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS) { base::string16 version; DWORD dword_value; if ((clientstate.ReadValueDW(google_update::kRegLastCheckSuccessField, &dword_value) == ERROR_SUCCESS) && - (clientstate.ReadValue(google_update::kRegVersionField, - &version) == ERROR_SUCCESS)) { + (clientstate.ReadValue(google_update::kRegVersionField, &version) == + ERROR_SUCCESS)) { product_found = true; data->version = base::UTF16ToASCII(version); data->last_success = base::Time::FromTimeT(dword_value); @@ -798,8 +795,8 @@ : install_static::GetClientStateKeyPath()); RegKey client_state; - LONG result = client_state.Open( - reg_root, client_state_path.c_str(), KEY_QUERY_VALUE | KEY_WOW64_32KEY); + LONG result = client_state.Open(reg_root, client_state_path.c_str(), + KEY_QUERY_VALUE | KEY_WOW64_32KEY); if (result == ERROR_SUCCESS) { result = client_state.ReadValue(google_update::kExperimentLabels, experiment_labels);
diff --git a/chrome/installer/util/google_update_settings.h b/chrome/installer/util/google_update_settings.h index 230737da..0d411dc4 100644 --- a/chrome/installer/util/google_update_settings.h +++ b/chrome/installer/util/google_update_settings.h
@@ -26,7 +26,7 @@ namespace installer { class ChannelInfo; class InstallationState; -} +} // namespace installer // This class provides accessors to the Google Update group policies and // 'ClientState' information. The group policies are set using specific @@ -37,10 +37,10 @@ public: // Update policy constants defined by Google Update; do not change these. enum UpdatePolicy { - UPDATES_DISABLED = 0, - AUTOMATIC_UPDATES = 1, + UPDATES_DISABLED = 0, + AUTOMATIC_UPDATES = 1, MANUAL_UPDATES_ONLY = 2, - AUTO_UPDATES_ONLY = 3, + AUTO_UPDATES_ONLY = 3, UPDATE_POLICIES_COUNT };
diff --git a/chrome/installer/util/google_update_settings_unittest.cc b/chrome/installer/util/google_update_settings_unittest.cc index 251f7904..b4247ce 100644 --- a/chrome/installer/util/google_update_settings_unittest.cc +++ b/chrome/installer/util/google_update_settings_unittest.cc
@@ -76,8 +76,8 @@ // Validate that something is written. Only worry about the label itself. RegKey key; - HKEY root = install == SYSTEM_INSTALL ? - HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; + HKEY root = + install == SYSTEM_INSTALL ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; base::string16 state_key = install == SYSTEM_INSTALL ? install_static::GetClientStateMediumKeyPath() @@ -86,7 +86,7 @@ EXPECT_EQ(ERROR_SUCCESS, key.Open(root, state_key.c_str(), KEY_QUERY_VALUE)); EXPECT_EQ(ERROR_SUCCESS, - key.ReadValue(google_update::kExperimentLabels, &value)); + key.ReadValue(google_update::kExperimentLabels, &value)); EXPECT_EQ(kTestExperimentLabel, value); EXPECT_TRUE(GoogleUpdateSettings::ReadExperimentLabels(&value)); EXPECT_EQ(kTestExperimentLabel, value); @@ -98,7 +98,7 @@ EXPECT_EQ(ERROR_SUCCESS, key.Open(root, state_key.c_str(), KEY_QUERY_VALUE)); EXPECT_EQ(ERROR_FILE_NOT_FOUND, - key.ReadValue(google_update::kExperimentLabels, &value)); + key.ReadValue(google_update::kExperimentLabels, &value)); EXPECT_TRUE(GoogleUpdateSettings::ReadExperimentLabels(&value)); EXPECT_EQ(base::string16(), value); key.Close(); @@ -109,14 +109,11 @@ bool CreateApKey(WorkItemList* work_item_list, const base::string16& value) { HKEY reg_root = HKEY_CURRENT_USER; base::string16 reg_key = GetApKeyPath(); - work_item_list->AddCreateRegKeyWorkItem( - reg_root, reg_key, WorkItem::kWow64Default); - work_item_list->AddSetRegValueWorkItem(reg_root, - reg_key, - WorkItem::kWow64Default, - google_update::kRegApField, - value.c_str(), - true); + work_item_list->AddCreateRegKeyWorkItem(reg_root, reg_key, + WorkItem::kWow64Default); + work_item_list->AddSetRegValueWorkItem( + reg_root, reg_key, WorkItem::kWow64Default, google_update::kRegApField, + value.c_str(), true); if (!work_item_list->Do()) { work_item_list->Rollback(); return false; @@ -172,8 +169,8 @@ app_update_override.append(app_guid); DWORD value; - if (policy_key.ReadValueDW(app_update_override.c_str(), - &value) == ERROR_SUCCESS) { + if (policy_key.ReadValueDW(app_update_override.c_str(), &value) == + ERROR_SUCCESS) { return static_cast<GoogleUpdateSettings::UpdatePolicy>(value); } } @@ -196,9 +193,9 @@ GoogleUpdateSettings::kPoliciesKey, KEY_QUERY_VALUE) == ERROR_SUCCESS && policy_key.ReadValueDW(GoogleUpdateSettings::kUpdatePolicyValue, - &value) == ERROR_SUCCESS) ? - static_cast<GoogleUpdateSettings::UpdatePolicy>(value) : - GoogleUpdateSettings::UPDATE_POLICIES_COUNT; + &value) == ERROR_SUCCESS) + ? static_cast<GoogleUpdateSettings::UpdatePolicy>(value) + : GoogleUpdateSettings::UPDATE_POLICIES_COUNT; } bool SetUpdateTimeoutOverride(DWORD time_in_minutes) { @@ -226,24 +223,12 @@ // GoogleUpdateSettings::UpdateGoogleUpdateApKey. TEST_F(GoogleUpdateSettingsTest, UpdateGoogleUpdateApKey) { const installer::ArchiveType archive_types[] = { - installer::UNKNOWN_ARCHIVE_TYPE, - installer::FULL_ARCHIVE_TYPE, - installer::INCREMENTAL_ARCHIVE_TYPE - }; - const int results[] = { - installer::FIRST_INSTALL_SUCCESS, - installer::INSTALL_FAILED - }; - const wchar_t* const plain[] = { - L"", - L"1.1", - L"1.1-dev" - }; - const wchar_t* const full[] = { - L"-full", - L"1.1-full", - L"1.1-dev-full" - }; + installer::UNKNOWN_ARCHIVE_TYPE, installer::FULL_ARCHIVE_TYPE, + installer::INCREMENTAL_ARCHIVE_TYPE}; + const int results[] = {installer::FIRST_INSTALL_SUCCESS, + installer::INSTALL_FAILED}; + const wchar_t* const plain[] = {L"", L"1.1", L"1.1-dev"}; + const wchar_t* const full[] = {L"-full", L"1.1-full", L"1.1-dev-full"}; static_assert(base::size(full) == base::size(plain), "bad full array size"); const wchar_t* const* input_arrays[] = {plain, full}; ChannelInfo v; @@ -278,19 +263,16 @@ if (output == v.value()) { EXPECT_FALSE(GoogleUpdateSettings::UpdateGoogleUpdateApKey( archive_type, result, &v)) - << "archive_type: " << archive_type - << ", result: " << result + << "archive_type: " << archive_type << ", result: " << result << ", input ap value: " << input; } else { EXPECT_TRUE(GoogleUpdateSettings::UpdateGoogleUpdateApKey( archive_type, result, &v)) - << "archive_type: " << archive_type - << ", result: " << result + << "archive_type: " << archive_type << ", result: " << result << ", input ap value: " << input; } EXPECT_EQ(output, v.value()) - << "archive_type: " << archive_type - << ", result: " << result + << "archive_type: " << archive_type << ", result: " << result << ", input ap value: " << input; } } @@ -303,10 +285,9 @@ // Test incremental install failure ASSERT_TRUE(CreateApKey(work_item_list.get(), L"")) << "Failed to create ap key."; - GoogleUpdateSettings::UpdateInstallStatus(false, - installer::INCREMENTAL_ARCHIVE_TYPE, - installer::INSTALL_FAILED, - kTestProductGuid); + GoogleUpdateSettings::UpdateInstallStatus( + false, installer::INCREMENTAL_ARCHIVE_TYPE, installer::INSTALL_FAILED, + kTestProductGuid); EXPECT_STREQ(ReadApKeyValue().c_str(), L"-full"); work_item_list->Rollback(); @@ -314,10 +295,9 @@ // Test incremental install success ASSERT_TRUE(CreateApKey(work_item_list.get(), L"")) << "Failed to create ap key."; - GoogleUpdateSettings::UpdateInstallStatus(false, - installer::INCREMENTAL_ARCHIVE_TYPE, - installer::FIRST_INSTALL_SUCCESS, - kTestProductGuid); + GoogleUpdateSettings::UpdateInstallStatus( + false, installer::INCREMENTAL_ARCHIVE_TYPE, + installer::FIRST_INSTALL_SUCCESS, kTestProductGuid); EXPECT_STREQ(ReadApKeyValue().c_str(), L""); work_item_list->Rollback(); @@ -350,17 +330,16 @@ RegKey key; if (key.Open(HKEY_CURRENT_USER, reg_key.c_str(), KEY_ALL_ACCESS) != ERROR_SUCCESS) { - work_item_list->AddCreateRegKeyWorkItem( - reg_root, reg_key, WorkItem::kWow64Default); + work_item_list->AddCreateRegKeyWorkItem(reg_root, reg_key, + WorkItem::kWow64Default); ASSERT_TRUE(work_item_list->Do()) << "Failed to create ClientState key."; } else if (key.DeleteValue(google_update::kRegApField) == ERROR_SUCCESS) { ap_key_deleted = true; } // try differential installer - GoogleUpdateSettings::UpdateInstallStatus(false, - installer::INCREMENTAL_ARCHIVE_TYPE, - installer::INSTALL_FAILED, - kTestProductGuid); + GoogleUpdateSettings::UpdateInstallStatus( + false, installer::INCREMENTAL_ARCHIVE_TYPE, installer::INSTALL_FAILED, + kTestProductGuid); EXPECT_STREQ(ReadApKeyValue().c_str(), L"-full"); // try full installer now GoogleUpdateSettings::UpdateInstallStatus(false, installer::FULL_ARCHIVE_TYPE, @@ -368,7 +347,8 @@ kTestProductGuid); EXPECT_STREQ(ReadApKeyValue().c_str(), L""); // Now cleanup to leave the system in unchanged state. - // - Diff installer creates an ap key if it didnt exist, so delete this ap key + // - Diff installer creates an ap key if it didn't exist, so delete this ap + // key // - If we created any reg key path for ap, roll it back // - Finally restore the original value of ap key. key.Open(HKEY_CURRENT_USER, reg_key.c_str(), KEY_ALL_ACCESS); @@ -411,8 +391,7 @@ // There are no policies at all. EXPECT_EQ(ERROR_FILE_NOT_FOUND, RegKey().Open(HKEY_LOCAL_MACHINE, - GoogleUpdateSettings::kPoliciesKey, - KEY_QUERY_VALUE)); + GoogleUpdateSettings::kPoliciesKey, KEY_QUERY_VALUE)); bool is_overridden = true; EXPECT_EQ(GoogleUpdateSettings::kDefaultUpdatePolicy, GoogleUpdateSettings::GetAppUpdatePolicy(kTestProductGuid, @@ -422,12 +401,10 @@ // The policy key exists, but there are no values of interest present. EXPECT_EQ(ERROR_SUCCESS, RegKey().Create(HKEY_LOCAL_MACHINE, - GoogleUpdateSettings::kPoliciesKey, - KEY_SET_VALUE)); + GoogleUpdateSettings::kPoliciesKey, KEY_SET_VALUE)); EXPECT_EQ(ERROR_SUCCESS, RegKey().Open(HKEY_LOCAL_MACHINE, - GoogleUpdateSettings::kPoliciesKey, - KEY_QUERY_VALUE)); + GoogleUpdateSettings::kPoliciesKey, KEY_QUERY_VALUE)); is_overridden = true; EXPECT_EQ(GoogleUpdateSettings::kDefaultUpdatePolicy, GoogleUpdateSettings::GetAppUpdatePolicy(kTestProductGuid, @@ -442,9 +419,9 @@ TEST_F(GoogleUpdateSettingsTest, GetAppUpdatePolicyDefaultOverride) { EXPECT_EQ(ERROR_SUCCESS, RegKey(HKEY_LOCAL_MACHINE, GoogleUpdateSettings::kPoliciesKey, - KEY_SET_VALUE).WriteValue( - GoogleUpdateSettings::kUpdatePolicyValue, - static_cast<DWORD>(0))); + KEY_SET_VALUE) + .WriteValue(GoogleUpdateSettings::kUpdatePolicyValue, + static_cast<DWORD>(0))); bool is_overridden = true; EXPECT_EQ(GoogleUpdateSettings::UPDATES_DISABLED, GoogleUpdateSettings::GetAppUpdatePolicy(kTestProductGuid, @@ -453,9 +430,9 @@ EXPECT_EQ(ERROR_SUCCESS, RegKey(HKEY_LOCAL_MACHINE, GoogleUpdateSettings::kPoliciesKey, - KEY_SET_VALUE).WriteValue( - GoogleUpdateSettings::kUpdatePolicyValue, - static_cast<DWORD>(1))); + KEY_SET_VALUE) + .WriteValue(GoogleUpdateSettings::kUpdatePolicyValue, + static_cast<DWORD>(1))); is_overridden = true; EXPECT_EQ(GoogleUpdateSettings::AUTOMATIC_UPDATES, GoogleUpdateSettings::GetAppUpdatePolicy(kTestProductGuid, @@ -464,9 +441,9 @@ EXPECT_EQ(ERROR_SUCCESS, RegKey(HKEY_LOCAL_MACHINE, GoogleUpdateSettings::kPoliciesKey, - KEY_SET_VALUE).WriteValue( - GoogleUpdateSettings::kUpdatePolicyValue, - static_cast<DWORD>(2))); + KEY_SET_VALUE) + .WriteValue(GoogleUpdateSettings::kUpdatePolicyValue, + static_cast<DWORD>(2))); is_overridden = true; EXPECT_EQ(GoogleUpdateSettings::MANUAL_UPDATES_ONLY, GoogleUpdateSettings::GetAppUpdatePolicy(kTestProductGuid, @@ -475,9 +452,9 @@ EXPECT_EQ(ERROR_SUCCESS, RegKey(HKEY_LOCAL_MACHINE, GoogleUpdateSettings::kPoliciesKey, - KEY_SET_VALUE).WriteValue( - GoogleUpdateSettings::kUpdatePolicyValue, - static_cast<DWORD>(3))); + KEY_SET_VALUE) + .WriteValue(GoogleUpdateSettings::kUpdatePolicyValue, + static_cast<DWORD>(3))); is_overridden = true; EXPECT_EQ(GoogleUpdateSettings::AUTO_UPDATES_ONLY, GoogleUpdateSettings::GetAppUpdatePolicy(kTestProductGuid, @@ -487,9 +464,9 @@ // The default policy should be in force for bogus values. EXPECT_EQ(ERROR_SUCCESS, RegKey(HKEY_LOCAL_MACHINE, GoogleUpdateSettings::kPoliciesKey, - KEY_SET_VALUE).WriteValue( - GoogleUpdateSettings::kUpdatePolicyValue, - static_cast<DWORD>(4))); + KEY_SET_VALUE) + .WriteValue(GoogleUpdateSettings::kUpdatePolicyValue, + static_cast<DWORD>(4))); is_overridden = true; EXPECT_EQ(GoogleUpdateSettings::kDefaultUpdatePolicy, GoogleUpdateSettings::GetAppUpdatePolicy(kTestProductGuid, @@ -505,13 +482,13 @@ EXPECT_EQ(ERROR_SUCCESS, RegKey(HKEY_LOCAL_MACHINE, GoogleUpdateSettings::kPoliciesKey, - KEY_SET_VALUE).WriteValue( - GoogleUpdateSettings::kUpdatePolicyValue, - static_cast<DWORD>(1))); + KEY_SET_VALUE) + .WriteValue(GoogleUpdateSettings::kUpdatePolicyValue, + static_cast<DWORD>(1))); EXPECT_EQ(ERROR_SUCCESS, RegKey(HKEY_LOCAL_MACHINE, GoogleUpdateSettings::kPoliciesKey, - KEY_SET_VALUE).WriteValue(app_policy_value.c_str(), - static_cast<DWORD>(0))); + KEY_SET_VALUE) + .WriteValue(app_policy_value.c_str(), static_cast<DWORD>(0))); bool is_overridden = false; EXPECT_EQ(GoogleUpdateSettings::UPDATES_DISABLED, GoogleUpdateSettings::GetAppUpdatePolicy(kTestProductGuid, @@ -520,13 +497,13 @@ EXPECT_EQ(ERROR_SUCCESS, RegKey(HKEY_LOCAL_MACHINE, GoogleUpdateSettings::kPoliciesKey, - KEY_SET_VALUE).WriteValue( - GoogleUpdateSettings::kUpdatePolicyValue, - static_cast<DWORD>(0))); + KEY_SET_VALUE) + .WriteValue(GoogleUpdateSettings::kUpdatePolicyValue, + static_cast<DWORD>(0))); EXPECT_EQ(ERROR_SUCCESS, RegKey(HKEY_LOCAL_MACHINE, GoogleUpdateSettings::kPoliciesKey, - KEY_SET_VALUE).WriteValue(app_policy_value.c_str(), - static_cast<DWORD>(1))); + KEY_SET_VALUE) + .WriteValue(app_policy_value.c_str(), static_cast<DWORD>(1))); is_overridden = false; EXPECT_EQ(GoogleUpdateSettings::AUTOMATIC_UPDATES, GoogleUpdateSettings::GetAppUpdatePolicy(kTestProductGuid, @@ -535,8 +512,8 @@ EXPECT_EQ(ERROR_SUCCESS, RegKey(HKEY_LOCAL_MACHINE, GoogleUpdateSettings::kPoliciesKey, - KEY_SET_VALUE).WriteValue(app_policy_value.c_str(), - static_cast<DWORD>(2))); + KEY_SET_VALUE) + .WriteValue(app_policy_value.c_str(), static_cast<DWORD>(2))); is_overridden = false; EXPECT_EQ(GoogleUpdateSettings::MANUAL_UPDATES_ONLY, GoogleUpdateSettings::GetAppUpdatePolicy(kTestProductGuid, @@ -545,8 +522,8 @@ EXPECT_EQ(ERROR_SUCCESS, RegKey(HKEY_LOCAL_MACHINE, GoogleUpdateSettings::kPoliciesKey, - KEY_SET_VALUE).WriteValue(app_policy_value.c_str(), - static_cast<DWORD>(3))); + KEY_SET_VALUE) + .WriteValue(app_policy_value.c_str(), static_cast<DWORD>(3))); is_overridden = false; EXPECT_EQ(GoogleUpdateSettings::AUTO_UPDATES_ONLY, GoogleUpdateSettings::GetAppUpdatePolicy(kTestProductGuid, @@ -556,8 +533,8 @@ // The default policy should be in force for bogus values. EXPECT_EQ(ERROR_SUCCESS, RegKey(HKEY_LOCAL_MACHINE, GoogleUpdateSettings::kPoliciesKey, - KEY_SET_VALUE).WriteValue(app_policy_value.c_str(), - static_cast<DWORD>(4))); + KEY_SET_VALUE) + .WriteValue(app_policy_value.c_str(), static_cast<DWORD>(4))); is_overridden = true; EXPECT_EQ(GoogleUpdateSettings::UPDATES_DISABLED, GoogleUpdateSettings::GetAppUpdatePolicy(kTestProductGuid, @@ -690,7 +667,7 @@ GoogleUpdateSettings::kDownloadPreferencePolicyValue, L"a b")); EXPECT_TRUE(GoogleUpdateSettings::GetDownloadPreference().empty()); - // It contains non alpha-numeric characters. + // It contains non alphanumeric characters. EXPECT_EQ(ERROR_SUCCESS, policy_key.WriteValue( GoogleUpdateSettings::kDownloadPreferencePolicyValue, L"<a>")); @@ -779,7 +756,7 @@ // empty UninstallCmdLine value in the Software\Google\Update key. TEST_P(GetUninstallCommandLine, TestEmptyValue) { RegKey(root_key_, google_update::kRegPathGoogleUpdate, KEY_SET_VALUE) - .WriteValue(google_update::kRegUninstallCmdLine, L""); + .WriteValue(google_update::kRegUninstallCmdLine, L""); EXPECT_EQ(base::string16(), GoogleUpdateSettings::GetUninstallCommandLine(system_install_)); } @@ -850,11 +827,10 @@ .WriteValue(google_update::kRegGoogleUpdateVersion, kDummyVersion); base::Version expected(base::UTF16ToUTF8(kDummyVersion)); EXPECT_EQ(expected, - GoogleUpdateSettings::GetGoogleUpdateVersion(system_install_)); + GoogleUpdateSettings::GetGoogleUpdateVersion(system_install_)); // Make sure that there's no value in the other level (user or system). EXPECT_FALSE( - GoogleUpdateSettings::GetGoogleUpdateVersion(!system_install_) - .IsValid()); + GoogleUpdateSettings::GetGoogleUpdateVersion(!system_install_).IsValid()); } INSTANTIATE_TEST_SUITE_P(GetGoogleUpdateVersionAtLevel, @@ -874,31 +850,26 @@ static const UserLevelState kUserLevel; static const SystemLevelState kSystemLevel; - StatsState(const UserLevelState&, - StateSetting state_value) + StatsState(const UserLevelState&, StateSetting state_value) : system_level_(false), state_value_(state_value), - state_medium_value_(NO_SETTING) { - } + state_medium_value_(NO_SETTING) {} StatsState(const SystemLevelState&, StateSetting state_value, StateSetting state_medium_value) : system_level_(true), state_value_(state_value), - state_medium_value_(state_medium_value) { - } + state_medium_value_(state_medium_value) {} bool system_level() const { return system_level_; } HKEY root_key() const { return system_level_ ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; } StateSetting state_value() const { return state_value_; } - StateSetting state_medium_value() const { - return state_medium_value_; - } + StateSetting state_medium_value() const { return state_medium_value_; } bool is_consent_granted() const { - return (system_level_ && state_medium_value_ != NO_SETTING) ? - (state_medium_value_ == TRUE_SETTING) : - (state_value_ == TRUE_SETTING); + return (system_level_ && state_medium_value_ != NO_SETTING) + ? (state_medium_value_ == TRUE_SETTING) + : (state_value_ == TRUE_SETTING); } private: @@ -952,11 +923,9 @@ const base::string16& reg_key) { if (setting != StatsState::NO_SETTING) { DWORD value = setting != StatsState::FALSE_SETTING ? 1 : 0; - ASSERT_EQ( - ERROR_SUCCESS, - RegKey(root_key, reg_key.c_str(), - KEY_SET_VALUE).WriteValue(google_update::kRegUsageStatsField, - value)); + ASSERT_EQ(ERROR_SUCCESS, + RegKey(root_key, reg_key.c_str(), KEY_SET_VALUE) + .WriteValue(google_update::kRegUsageStatsField, value)); } } @@ -988,11 +957,9 @@ GetParam().system_level() ? install_static::GetClientStateMediumKeyPath() : install_static::GetClientStateKeyPath(); DWORD value = 0; - EXPECT_EQ( - ERROR_SUCCESS, - RegKey(GetParam().root_key(), reg_key.c_str(), - KEY_QUERY_VALUE).ReadValueDW(google_update::kRegUsageStatsField, - &value)); + EXPECT_EQ(ERROR_SUCCESS, + RegKey(GetParam().root_key(), reg_key.c_str(), KEY_QUERY_VALUE) + .ReadValueDW(google_update::kRegUsageStatsField, &value)); if (GetParam().is_consent_granted()) { EXPECT_FALSE(GoogleUpdateSettings::GetCollectStatsConsent()); EXPECT_EQ(0UL, value);
diff --git a/chrome/installer/util/google_update_util.cc b/chrome/installer/util/google_update_util.cc index 3d9aef5..8b53b77 100644 --- a/chrome/installer/util/google_update_util.cc +++ b/chrome/installer/util/google_update_util.cc
@@ -38,7 +38,7 @@ PLOG(ERROR) << "Failed to launch (" << cmd_string << ")"; } else if (!process.WaitForExitWithTimeout(timeout, &exit_code)) { // The GetExitCodeProcess failed or timed-out. - LOG(ERROR) <<"Command (" << cmd_string << ") is taking more than " + LOG(ERROR) << "Command (" << cmd_string << ") is taking more than " << timeout.InMilliseconds() << " milliseconds to complete."; } else if (exit_code != 0) { LOG(ERROR) << "Command (" << cmd_string << ") exited with code " @@ -58,8 +58,8 @@ if (cmd_string.empty()) { success = true; // Nothing to; vacuous success. } else { - success = LaunchProcessAndWaitWithTimeout(cmd_string, - base::TimeDelta::FromMilliseconds(kGoogleUpdateTimeoutMs)); + success = LaunchProcessAndWaitWithTimeout( + cmd_string, base::TimeDelta::FromMilliseconds(kGoogleUpdateTimeoutMs)); } return success; }
diff --git a/chrome/installer/util/html_dialog.h b/chrome/installer/util/html_dialog.h index 2892aac..c964af7 100644 --- a/chrome/installer/util/html_dialog.h +++ b/chrome/installer/util/html_dialog.h
@@ -19,13 +19,13 @@ class HTMLDialog { public: enum DialogResult { - HTML_DLG_ERROR = 0, // Dialog could not be shown. - HTML_DLG_ACCEPT = 1, // The user accepted (accept, ok, yes buttons). - HTML_DLG_DECLINE = 2, // The user declined (cancel, no, abort buttons). - HTML_DLG_RETRY = 3, // The user wants to retry the action. - HTML_DLG_IGNORE = 4, // The user wants to ignore the error and continue. - HTML_DLG_TIMEOUT = 5, // The dialog has timed out and defaults apply. - HTML_DLG_EXTRA = 6 // There is extra data as a string. See below. + HTML_DLG_ERROR = 0, // Dialog could not be shown. + HTML_DLG_ACCEPT = 1, // The user accepted (accept, ok, yes buttons). + HTML_DLG_DECLINE = 2, // The user declined (cancel, no, abort buttons). + HTML_DLG_RETRY = 3, // The user wants to retry the action. + HTML_DLG_IGNORE = 4, // The user wants to ignore the error and continue. + HTML_DLG_TIMEOUT = 5, // The dialog has timed out and defaults apply. + HTML_DLG_EXTRA = 6 // There is extra data as a string. See below. }; // Callbacks that allow to tweak the appearance of the dialog. @@ -38,8 +38,8 @@ // to customize the native |window| appearance. virtual void OnBeforeDisplay(void* window) = 0; - protected: - virtual ~CustomizationCallback() {} + protected: + virtual ~CustomizationCallback() {} }; virtual ~HTMLDialog() {} @@ -75,9 +75,9 @@ ~EulaHTMLDialog(); enum Outcome { - REJECTED, // Declined EULA, mapped from HTML_DLG_ACCEPT (1). - ACCEPTED, // Accepted EULA no opt-in, from HTML_DLG_DECLINE (2). - ACCEPTED_OPT_IN, // Accepted EULA and opt-in, from HTML_DLG_EXTRA (6). + REJECTED, // Declined EULA, mapped from HTML_DLG_ACCEPT (1). + ACCEPTED, // Accepted EULA no opt-in, from HTML_DLG_DECLINE (2). + ACCEPTED_OPT_IN, // Accepted EULA and opt-in, from HTML_DLG_EXTRA (6). }; // Shows the dialog and blocks for user input. The return value is one of
diff --git a/chrome/installer/util/html_dialog_impl.cc b/chrome/installer/util/html_dialog_impl.cc index 7597115..42ad40c 100644 --- a/chrome/installer/util/html_dialog_impl.cc +++ b/chrome/installer/util/html_dialog_impl.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include <windows.h> + #include <mshtmhst.h> #include <urlmon.h> @@ -41,7 +42,7 @@ HTMLDialogWin(const base::string16& url, const base::string16& param) : url_(url), param_(param) { if (!mshtml_) - mshtml_ = LoadLibrary(L"MSHTML.DLL"); + mshtml_ = LoadLibrary(L"MSHTML.DLL"); } DialogResult ShowModal(void* parent_window, @@ -98,9 +99,8 @@ int* result) { if (!mshtml_) return false; - SHOWHTMLDIALOGFN* show_html_dialog = - reinterpret_cast<SHOWHTMLDIALOGFN*>( - GetProcAddress(mshtml_, "ShowHTMLDialog")); + SHOWHTMLDIALOGFN* show_html_dialog = reinterpret_cast<SHOWHTMLDIALOGFN*>( + GetProcAddress(mshtml_, "ShowHTMLDialog")); if (!show_html_dialog) return false; @@ -150,8 +150,7 @@ // EulaHTMLDialog implementation --------------------------------------------- -void EulaHTMLDialog::Customizer::OnBeforeCreation(wchar_t** extra) { -} +void EulaHTMLDialog::Customizer::OnBeforeCreation(wchar_t** extra) {} // The customization of the window consists in removing the close button and // replacing the existing 'e' icon with the standard informational icon.
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc index 7362c52d..95b36eb 100644 --- a/chrome/installer/util/install_util.cc +++ b/chrome/installer/util/install_util.cc
@@ -78,8 +78,8 @@ WS_EX_TOOLWINDOW, L"STATIC", nullptr, WS_POPUP | WS_VISIBLE, 0, 0, 0, 0, nullptr, nullptr, ::GetModuleHandle(nullptr), nullptr); if (foreground_window) { - HMONITOR monitor = ::MonitorFromWindow(foreground_window, - MONITOR_DEFAULTTONEAREST); + HMONITOR monitor = + ::MonitorFromWindow(foreground_window, MONITOR_DEFAULTTONEAREST); if (monitor) { MONITORINFO mi = {0}; mi.cbSize = sizeof(mi); @@ -87,10 +87,8 @@ RECT screen_rect = mi.rcWork; int x_offset = (screen_rect.right - screen_rect.left) / 2; int y_offset = (screen_rect.bottom - screen_rect.top) / 2; - ::MoveWindow(foreground_window, - screen_rect.left + x_offset, - screen_rect.top + y_offset, - 0, 0, FALSE); + ::MoveWindow(foreground_window, screen_rect.left + x_offset, + screen_rect.top + y_offset, 0, 0, FALSE); } else { NOTREACHED() << "Unable to get default monitor"; } @@ -116,7 +114,7 @@ return key_path; } -// Retruns the registry key path and value name where the cloud management +// Reruns the registry key path and value name where the cloud management // enrollment option is stored. void GetCloudManagementBlockOnFailureRegistryPath(base::string16* key_path, base::string16* value_name) { @@ -128,8 +126,8 @@ void InstallUtil::TriggerActiveSetupCommand() { base::string16 active_setup_reg(install_static::GetActiveSetupPath()); - base::win::RegKey active_setup_key( - HKEY_LOCAL_MACHINE, active_setup_reg.c_str(), KEY_QUERY_VALUE); + base::win::RegKey active_setup_key(HKEY_LOCAL_MACHINE, + active_setup_reg.c_str(), KEY_QUERY_VALUE); base::string16 cmd_str; LONG read_status = active_setup_key.ReadValue(L"StubPath", &cmd_str); if (read_status != ERROR_SUCCESS) { @@ -268,35 +266,22 @@ const HKEY root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; DWORD installer_result = (GetInstallReturnCode(status) == 0) ? 0 : 1; install_list->AddCreateRegKeyWorkItem(root, state_key, KEY_WOW64_32KEY); - install_list->AddSetRegValueWorkItem(root, - state_key, - KEY_WOW64_32KEY, + install_list->AddSetRegValueWorkItem(root, state_key, KEY_WOW64_32KEY, installer::kInstallerResult, - installer_result, - true); - install_list->AddSetRegValueWorkItem(root, - state_key, - KEY_WOW64_32KEY, + installer_result, true); + install_list->AddSetRegValueWorkItem(root, state_key, KEY_WOW64_32KEY, installer::kInstallerError, - static_cast<DWORD>(status), - true); + static_cast<DWORD>(status), true); if (string_resource_id != 0) { base::string16 msg = installer::GetLocalizedString(string_resource_id); - install_list->AddSetRegValueWorkItem(root, - state_key, - KEY_WOW64_32KEY, + install_list->AddSetRegValueWorkItem(root, state_key, KEY_WOW64_32KEY, installer::kInstallerResultUIString, - msg, - true); + msg, true); } if (launch_cmd != nullptr && !launch_cmd->empty()) { install_list->AddSetRegValueWorkItem( - root, - state_key, - KEY_WOW64_32KEY, - installer::kInstallerSuccessLaunchCmdLine, - *launch_cmd, - true); + root, state_key, KEY_WOW64_32KEY, + installer::kInstallerSuccessLaunchCmdLine, *launch_cmd, true); } } @@ -401,8 +386,8 @@ REGSAM wow64_access, const base::string16& value_name) { RegKey key; - LONG result = key.Open(reg_root, key_path.c_str(), - KEY_SET_VALUE | wow64_access); + LONG result = + key.Open(reg_root, key_path.c_str(), KEY_SET_VALUE | wow64_access); if (result == ERROR_SUCCESS) result = key.DeleteValue(value_name.c_str()); if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) { @@ -430,10 +415,10 @@ key.ReadValue(value_name, &actual_value) == ERROR_SUCCESS && predicate.Evaluate(actual_value)) { key.Close(); - delete_result = DeleteRegistryKey(root_key, - key_to_delete_path, - wow64_access) - ? DELETED : DELETE_FAILED; + delete_result = + DeleteRegistryKey(root_key, key_to_delete_path, wow64_access) + ? DELETED + : DELETE_FAILED; } return delete_result; } @@ -451,8 +436,8 @@ RegKey key; base::string16 actual_value; if (key.Open(root_key, key_path, - KEY_QUERY_VALUE | KEY_SET_VALUE | wow64_access) - == ERROR_SUCCESS && + KEY_QUERY_VALUE | KEY_SET_VALUE | wow64_access) == + ERROR_SUCCESS && key.ReadValue(value_name, &actual_value) == ERROR_SUCCESS && predicate.Evaluate(actual_value)) { LONG result = key.DeleteValue(value_name); @@ -642,7 +627,7 @@ RegKey key; base::string16 value; for (const auto& key_and_value : - GetCloudManagementEnrollmentTokenRegistryPaths()) { + GetCloudManagementEnrollmentTokenRegistryPaths()) { if (key.Open(HKEY_LOCAL_MACHINE, key_and_value.first.c_str(), KEY_QUERY_VALUE) == ERROR_SUCCESS && key.ReadValue(key_and_value.second.c_str(), &value) == ERROR_SUCCESS) { @@ -706,22 +691,19 @@ } InstallUtil::ProgramCompare::ProgramCompare(const base::FilePath& path_to_match) - : path_to_match_(path_to_match), - file_info_() { + : path_to_match_(path_to_match), file_info_() { DCHECK(!path_to_match_.empty()); if (!OpenForInfo(path_to_match_, &file_)) { PLOG(WARNING) << "Failed opening " << path_to_match_.value() << "; falling back to path string comparisons."; } else if (!GetInfo(file_, &file_info_)) { - PLOG(WARNING) << "Failed getting information for " - << path_to_match_.value() + PLOG(WARNING) << "Failed getting information for " << path_to_match_.value() << "; falling back to path string comparisons."; file_.Close(); } } -InstallUtil::ProgramCompare::~ProgramCompare() { -} +InstallUtil::ProgramCompare::~ProgramCompare() {} bool InstallUtil::ProgramCompare::Evaluate(const base::string16& value) const { // Suss out the exe portion of the value, which is expected to be a command @@ -753,8 +735,7 @@ base::File file; BY_HANDLE_FILE_INFORMATION info = {}; - return (OpenForInfo(path, &file) && - GetInfo(file, &info) && + return (OpenForInfo(path, &file) && GetInfo(file, &info) && info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && info.nFileIndexHigh == file_info_.nFileIndexHigh && info.nFileIndexLow == file_info_.nFileIndexLow);
diff --git a/chrome/installer/util/install_util.h b/chrome/installer/util/install_util.h index 8efd618..0c1414d 100644 --- a/chrome/installer/util/install_util.h +++ b/chrome/installer/util/install_util.h
@@ -99,7 +99,8 @@ // Deletes the registry value named value_name at path key_path under the key // given by reg_root. - static bool DeleteRegistryValue(HKEY reg_root, const base::string16& key_path, + static bool DeleteRegistryValue(HKEY reg_root, + const base::string16& key_path, REGSAM wow64_access, const base::string16& value_name); @@ -107,15 +108,15 @@ // DeleteRegistryValueIf. class RegistryValuePredicate { public: - virtual ~RegistryValuePredicate() { } + virtual ~RegistryValuePredicate() {} virtual bool Evaluate(const base::string16& value) const = 0; }; // The result of a conditional delete operation (i.e., DeleteFOOIf). enum ConditionalDeleteResult { - NOT_FOUND, // The condition was not satisfied. - DELETED, // The condition was satisfied and the delete succeeded. - DELETE_FAILED // The condition was satisfied but the delete failed. + NOT_FOUND, // The condition was not satisfied. + DELETED, // The condition was satisfied and the delete succeeded. + DELETE_FAILED // The condition was satisfied but the delete failed. }; // Deletes the key |key_to_delete_path| under |root_key| iff the value @@ -144,10 +145,12 @@ class ValueEquals : public RegistryValuePredicate { public: explicit ValueEquals(const base::string16& value_to_match) - : value_to_match_(value_to_match) { } + : value_to_match_(value_to_match) {} bool Evaluate(const base::string16& value) const override; + protected: base::string16 value_to_match_; + private: DISALLOW_COPY_AND_ASSIGN(ValueEquals); }; @@ -264,5 +267,4 @@ DISALLOW_COPY_AND_ASSIGN(InstallUtil); }; - #endif // CHROME_INSTALLER_UTIL_INSTALL_UTIL_H_
diff --git a/chrome/installer/util/install_util_unittest.cc b/chrome/installer/util/install_util_unittest.cc index 56fc4b4..ee3aebf 100644 --- a/chrome/installer/util/install_util_unittest.cc +++ b/chrome/installer/util/install_util_unittest.cc
@@ -128,11 +128,12 @@ base::CommandLine command_line(base::CommandLine::NO_PROGRAM); std::pair<std::wstring, std::wstring> params[] = { - std::make_pair(std::wstring(L""), std::wstring(L"")), - std::make_pair(std::wstring(L""), std::wstring(L"--do-something --silly")), - std::make_pair(std::wstring(L"spam.exe"), std::wstring(L"")), - std::make_pair(std::wstring(L"spam.exe"), - std::wstring(L"--do-something --silly")), + std::make_pair(std::wstring(L""), std::wstring(L"")), + std::make_pair(std::wstring(L""), + std::wstring(L"--do-something --silly")), + std::make_pair(std::wstring(L"spam.exe"), std::wstring(L"")), + std::make_pair(std::wstring(L"spam.exe"), + std::wstring(L"--do-something --silly")), }; for (std::pair<std::wstring, std::wstring>& param : params) { InstallUtil::ComposeCommandLine(param.first, param.second, &command_line); @@ -299,16 +300,15 @@ MockRegistryValuePredicate pred; EXPECT_CALL(pred, Evaluate(StrEq(L"foosball!"))).WillOnce(Return(false)); - ASSERT_EQ(ERROR_SUCCESS, - RegKey(root, key_path.c_str(), - KEY_SET_VALUE).WriteValue(value_name, L"foosball!")); + ASSERT_EQ(ERROR_SUCCESS, RegKey(root, key_path.c_str(), KEY_SET_VALUE) + .WriteValue(value_name, L"foosball!")); EXPECT_EQ(InstallUtil::NOT_FOUND, InstallUtil::DeleteRegistryValueIf(root, key_path.c_str(), WorkItem::kWow64Default, value_name, pred)); EXPECT_TRUE(RegKey(root, key_path.c_str(), KEY_QUERY_VALUE).Valid()); - EXPECT_TRUE(RegKey(root, key_path.c_str(), - KEY_QUERY_VALUE).HasValue(value_name)); + EXPECT_TRUE( + RegKey(root, key_path.c_str(), KEY_QUERY_VALUE).HasValue(value_name)); } // Value exists, and matches: delete. @@ -316,16 +316,15 @@ MockRegistryValuePredicate pred; EXPECT_CALL(pred, Evaluate(StrEq(value))).WillOnce(Return(true)); - ASSERT_EQ(ERROR_SUCCESS, - RegKey(root, key_path.c_str(), - KEY_SET_VALUE).WriteValue(value_name, value)); + ASSERT_EQ(ERROR_SUCCESS, RegKey(root, key_path.c_str(), KEY_SET_VALUE) + .WriteValue(value_name, value)); EXPECT_EQ(InstallUtil::DELETED, InstallUtil::DeleteRegistryValueIf(root, key_path.c_str(), WorkItem::kWow64Default, value_name, pred)); EXPECT_TRUE(RegKey(root, key_path.c_str(), KEY_QUERY_VALUE).Valid()); - EXPECT_FALSE(RegKey(root, key_path.c_str(), - KEY_QUERY_VALUE).HasValue(value_name)); + EXPECT_FALSE( + RegKey(root, key_path.c_str(), KEY_QUERY_VALUE).HasValue(value_name)); } } @@ -336,16 +335,15 @@ MockRegistryValuePredicate pred; EXPECT_CALL(pred, Evaluate(StrEq(value))).WillOnce(Return(true)); - ASSERT_EQ(ERROR_SUCCESS, - RegKey(root, key_path.c_str(), - KEY_SET_VALUE).WriteValue(L"", value)); - EXPECT_EQ(InstallUtil::DELETED, - InstallUtil::DeleteRegistryValueIf(root, key_path.c_str(), - WorkItem::kWow64Default, L"", - pred)); + ASSERT_EQ( + ERROR_SUCCESS, + RegKey(root, key_path.c_str(), KEY_SET_VALUE).WriteValue(L"", value)); + EXPECT_EQ(InstallUtil::DELETED, InstallUtil::DeleteRegistryValueIf( + root, key_path.c_str(), + WorkItem::kWow64Default, L"", pred)); EXPECT_TRUE(RegKey(root, key_path.c_str(), KEY_QUERY_VALUE).Valid()); - EXPECT_FALSE(RegKey(root, key_path.c_str(), - KEY_QUERY_VALUE).HasValue(L"")); + EXPECT_FALSE( + RegKey(root, key_path.c_str(), KEY_QUERY_VALUE).HasValue(L"")); } } @@ -356,16 +354,16 @@ MockRegistryValuePredicate pred; EXPECT_CALL(pred, Evaluate(StrEq(value))).WillOnce(Return(true)); - ASSERT_EQ(ERROR_SUCCESS, - RegKey(root, key_path.c_str(), - KEY_SET_VALUE).WriteValue(L"", value)); + ASSERT_EQ( + ERROR_SUCCESS, + RegKey(root, key_path.c_str(), KEY_SET_VALUE).WriteValue(L"", value)); EXPECT_EQ( InstallUtil::DELETED, InstallUtil::DeleteRegistryValueIf( root, key_path.c_str(), WorkItem::kWow64Default, nullptr, pred)); EXPECT_TRUE(RegKey(root, key_path.c_str(), KEY_QUERY_VALUE).Valid()); - EXPECT_FALSE(RegKey(root, key_path.c_str(), - KEY_QUERY_VALUE).HasValue(L"")); + EXPECT_FALSE( + RegKey(root, key_path.c_str(), KEY_QUERY_VALUE).HasValue(L"")); } } } @@ -423,9 +421,9 @@ // Test where strings don't match, but the same file is indicated. std::wstring short_expect; - DWORD short_len = GetShortPathName(expect.value().c_str(), - base::WriteInto(&short_expect, MAX_PATH), - MAX_PATH); + DWORD short_len = + GetShortPathName(expect.value().c_str(), + base::WriteInto(&short_expect, MAX_PATH), MAX_PATH); ASSERT_NE(static_cast<DWORD>(0), short_len); ASSERT_GT(static_cast<DWORD>(MAX_PATH), short_len); short_expect.resize(short_len);
diff --git a/chrome/installer/util/installation_state.cc b/chrome/installer/util/installation_state.cc index 272f9a14..a8e4a96 100644 --- a/chrome/installer/util/installation_state.cc +++ b/chrome/installer/util/installation_state.cc
@@ -42,11 +42,9 @@ msi_(false), has_eula_accepted_(false), has_oem_install_(false), - has_usagestats_(false) { -} + has_usagestats_(false) {} -ProductState::~ProductState() { -} +ProductState::~ProductState() {} bool ProductState::Initialize(bool system_install) { static const DWORD kAccess = KEY_QUERY_VALUE | KEY_WOW64_32KEY; @@ -61,8 +59,8 @@ // Read from the Clients key. if (key.Open(root_key, clients_key.c_str(), kAccess) == ERROR_SUCCESS) { base::string16 version_str; - if (key.ReadValue(google_update::kRegVersionField, - &version_str) == ERROR_SUCCESS) { + if (key.ReadValue(google_update::kRegVersionField, &version_str) == + ERROR_SUCCESS) { version_.reset(new base::Version(base::UTF16ToASCII(version_str))); if (!version_->IsValid()) version_.reset(); @@ -71,8 +69,8 @@ // Attempt to read the other values even if the "pv" version value was // absent. Note that ProductState instances containing these values will // only be accessible via InstallationState::GetNonVersionedProductState. - if (key.ReadValue(google_update::kRegOldVersionField, - &version_str) == ERROR_SUCCESS) { + if (key.ReadValue(google_update::kRegOldVersionField, &version_str) == + ERROR_SUCCESS) { old_version_.reset(new base::Version(base::UTF16ToASCII(version_str))); if (!old_version_->IsValid()) old_version_.reset(); @@ -111,8 +109,9 @@ &eula_accepted_) == ERROR_SUCCESS); // "msi" may be absent, 0 or 1 DWORD dw_value = 0; - msi_ = (key.ReadValueDW(google_update::kRegMSIField, - &dw_value) == ERROR_SUCCESS) && (dw_value != 0); + msi_ = (key.ReadValueDW(google_update::kRegMSIField, &dw_value) == + ERROR_SUCCESS) && + (dw_value != 0); } // Read from the ClientStateMedium key. Values here override those in @@ -122,8 +121,8 @@ kAccess) == ERROR_SUCCESS) { DWORD dword_value = 0; - if (key.ReadValueDW(google_update::kRegUsageStatsField, - &dword_value) == ERROR_SUCCESS) { + if (key.ReadValueDW(google_update::kRegUsageStatsField, &dword_value) == + ERROR_SUCCESS) { has_usagestats_ = true; usagestats_ = dword_value; }
diff --git a/chrome/installer/util/l10n_string_util.cc b/chrome/installer/util/l10n_string_util.cc index 1ad0cc8..ebc8f16 100644 --- a/chrome/installer/util/l10n_string_util.cc +++ b/chrome/installer/util/l10n_string_util.cc
@@ -56,8 +56,7 @@ namespace installer { -TranslationDelegate::~TranslationDelegate() { -} +TranslationDelegate::~TranslationDelegate() {} void SetTranslationDelegate(TranslationDelegate* delegate) { g_translation_delegate = delegate; @@ -73,8 +72,8 @@ std::wstring localized_string; int message_id = base_message_id + GetLanguageSelector().offset(); - const ATLSTRINGRESOURCEIMAGE* image = AtlGetStringResourceImage( - _AtlBaseModule.GetModuleInstance(), message_id); + const ATLSTRINGRESOURCEIMAGE* image = + AtlGetStringResourceImage(_AtlBaseModule.GetModuleInstance(), message_id); if (image) { localized_string = std::wstring(image->achString, image->nLength); } else { @@ -120,8 +119,8 @@ DCHECK(std::numeric_limits<uint32_t>::max() > (url_path.size() * 3)); DWORD count = static_cast<DWORD>(url_path.size() * 3); std::unique_ptr<wchar_t[]> url_canon(new wchar_t[count]); - HRESULT hr = ::UrlCanonicalizeW(url_path.c_str(), url_canon.get(), - &count, URL_ESCAPE_UNSAFE); + HRESULT hr = ::UrlCanonicalizeW(url_path.c_str(), url_canon.get(), &count, + URL_ESCAPE_UNSAFE); if (SUCCEEDED(hr)) return std::wstring(url_canon.get()); return url_path;
diff --git a/chrome/installer/util/logging_installer.cc b/chrome/installer/util/logging_installer.cc index c97cad0..43989f2 100644 --- a/chrome/installer/util/logging_installer.cc +++ b/chrome/installer/util/logging_installer.cc
@@ -23,8 +23,11 @@ #include "chrome/installer/util/util_constants.h" // {93BCE0BF-3FAF-43b1-9E28-BEB6FAB5ECE7} -static const GUID kSetupTraceProvider = { 0x93bce0bf, 0x3faf, 0x43b1, - { 0x9e, 0x28, 0xbe, 0xb6, 0xfa, 0xb5, 0xec, 0xe7 } }; +static const GUID kSetupTraceProvider = { + 0x93bce0bf, + 0x3faf, + 0x43b1, + {0x9e, 0x28, 0xbe, 0xb6, 0xfa, 0xb5, 0xec, 0xe7}}; namespace installer { @@ -51,12 +54,11 @@ if (base::Move(log_file, tmp_log)) { int64_t offset = log_size - kTruncatedInstallerLogFileSize; std::string old_log_data(kTruncatedInstallerLogFileSize, 0); - int bytes_read = old_log_file.Read(offset, - &old_log_data[0], + int bytes_read = old_log_file.Read(offset, &old_log_data[0], kTruncatedInstallerLogFileSize); if (bytes_read > 0 && - (bytes_read == base::WriteFile(log_file, &old_log_data[0], - bytes_read) || + (bytes_read == + base::WriteFile(log_file, &old_log_data[0], bytes_read) || base::PathExists(log_file))) { result = LOGFILE_TRUNCATED; } @@ -71,7 +73,6 @@ return result; } - void InitInstallerLogging(const installer::MasterPreferences& prefs) { if (installer_logging_) return; @@ -79,8 +80,8 @@ installer_logging_ = true; bool value = false; - if (prefs.GetBool(installer::master_preferences::kDisableLogging, - &value) && value) { + if (prefs.GetBool(installer::master_preferences::kDisableLogging, &value) && + value) { return; } @@ -92,8 +93,8 @@ settings.log_file_path = log_file_path.value().c_str(); logging::InitLogging(settings); - if (prefs.GetBool(installer::master_preferences::kVerboseLogging, - &value) && value) { + if (prefs.GetBool(installer::master_preferences::kVerboseLogging, &value) && + value) { logging::SetMinLogLevel(logging::LOG_VERBOSE); } else { logging::SetMinLogLevel(logging::LOG_ERROR);
diff --git a/chrome/installer/util/logging_installer.h b/chrome/installer/util/logging_installer.h index c35302ae..32d68186 100644 --- a/chrome/installer/util/logging_installer.h +++ b/chrome/installer/util/logging_installer.h
@@ -5,7 +5,6 @@ #ifndef CHROME_INSTALLER_UTIL_LOGGING_INSTALLER_H_ #define CHROME_INSTALLER_UTIL_LOGGING_INSTALLER_H_ - namespace base { class FilePath; }
diff --git a/chrome/installer/util/logging_installer_unittest.cc b/chrome/installer/util/logging_installer_unittest.cc index 495ba69..b821db2f 100644 --- a/chrome/installer/util/logging_installer_unittest.cc +++ b/chrome/installer/util/logging_installer_unittest.cc
@@ -34,7 +34,7 @@ installer::TruncateLogFileIfNeeded(temp_file)); EXPECT_TRUE(base::GetFileSize(temp_file, &file_size)); - EXPECT_EQ(installer::kTruncatedInstallerLogFileSize , file_size); + EXPECT_EQ(installer::kTruncatedInstallerLogFileSize, file_size); // Check that the temporary file was deleted. EXPECT_FALSE(base::PathExists(temp_file.Append(L".tmp"))); @@ -110,8 +110,8 @@ // TruncateLogFileIfNeeded would like to move the log file to. uint32_t file_flags = base::File::FLAG_CREATE | base::File::FLAG_READ | base::File::FLAG_EXCLUSIVE_READ; - base::FilePath temp_file_move_dest( - temp_file.value() + FILE_PATH_LITERAL(".tmp")); + base::FilePath temp_file_move_dest(temp_file.value() + + FILE_PATH_LITERAL(".tmp")); base::File temp_move_destination_file(temp_file_move_dest, file_flags); ASSERT_TRUE(temp_move_destination_file.IsValid());
diff --git a/chrome/installer/util/lzma_util.cc b/chrome/installer/util/lzma_util.cc index 5c6b080..ac15c2a 100644 --- a/chrome/installer/util/lzma_util.cc +++ b/chrome/installer/util/lzma_util.cc
@@ -312,7 +312,7 @@ error_code_ = error_code; return UNPACK_EXTRACT_ERROR; } - } __except(FilterPageError(*mapped_file, GetExceptionCode(), + } __except (FilterPageError(*mapped_file, GetExceptionCode(), GetExceptionInformation(), &ntstatus)) { LOG(ERROR) << "EXCEPTION_IN_PAGE_ERROR while accessing mapped memory; "
diff --git a/chrome/installer/util/lzma_util_unittest.cc b/chrome/installer/util/lzma_util_unittest.cc index a586c5bf..ed2b5e8 100644 --- a/chrome/installer/util/lzma_util_unittest.cc +++ b/chrome/installer/util/lzma_util_unittest.cc
@@ -89,8 +89,8 @@ EXPECT_EQ(UNPACK_NO_ERROR, lzma_util.OpenArchive(archive)); EXPECT_EQ(UNPACK_NO_ERROR, lzma_util.UnPack(extract_dir, &unpacked_file)); EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("archive\\a.exe"))); - EXPECT_TRUE(base::PathExists( - extract_dir.AppendASCII("archive\\sub_dir\\text.txt"))); + EXPECT_TRUE( + base::PathExists(extract_dir.AppendASCII("archive\\sub_dir\\text.txt"))); } // Test the static method that can be used to unpack archives.
diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index a1a164e..6d2c49b 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc
@@ -92,15 +92,14 @@ InitializeFromString(prefs); } -MasterPreferences::~MasterPreferences() { -} +MasterPreferences::~MasterPreferences() = default; void MasterPreferences::InitializeFromCommandLine( const base::CommandLine& cmd_line) { #if defined(OS_WIN) if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { - base::FilePath prefs_path(cmd_line.GetSwitchValuePath( - installer::switches::kInstallerData)); + base::FilePath prefs_path( + cmd_line.GetSwitchValuePath(installer::switches::kInstallerData)); InitializeFromFilePath(prefs_path); } else { master_dictionary_.reset(new base::DictionaryValue()); @@ -142,8 +141,8 @@ } // See if the log file path was specified on the command line. - std::wstring str_value(cmd_line.GetSwitchValueNative( - installer::switches::kLogFile)); + std::wstring str_value( + cmd_line.GetSwitchValueNative(installer::switches::kLogFile)); if (!str_value.empty()) { name.assign(installer::master_preferences::kDistroDict); name.append(".").append(installer::master_preferences::kLogFile); @@ -282,8 +281,8 @@ bool MasterPreferences::GetExtensionsBlock( base::DictionaryValue** extensions) const { - return master_dictionary_->GetDictionary( - master_preferences::kExtensionsBlock, extensions); + return master_dictionary_->GetDictionary(master_preferences::kExtensionsBlock, + extensions); } std::string MasterPreferences::GetCompressedVariationsSeed() const {
diff --git a/chrome/installer/util/master_preferences.h b/chrome/installer/util/master_preferences.h index 53d56bd..fb5948e 100644 --- a/chrome/installer/util/master_preferences.h +++ b/chrome/installer/util/master_preferences.h
@@ -19,7 +19,7 @@ namespace base { class DictionaryValue; class FilePath; -} +} // namespace base namespace installer { @@ -141,7 +141,7 @@ // "ppflmjolhbonpkbkooiamcnenbmbjcbb": { // "location": 1, // "manifest": { - // "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4<rest of key ommited>", + // "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4<rest of key omitted>", // "name": "Google XYZ (Installing...)", // "permissions": [ "tabs", "http://xyz.google.com/" ], // "update_url": "http://fixme.com/fixme/fixme/crx", @@ -163,9 +163,7 @@ std::string GetVariationsSeedSignature() const; // Returns true iff the master preferences were successfully read from a file. - bool read_from_file() const { - return preferences_read_from_file_; - } + bool read_from_file() const { return preferences_read_from_file_; } // Returns a reference to this MasterPreferences' root dictionary of values. const base::DictionaryValue& master_dictionary() const {
diff --git a/chrome/installer/util/master_preferences_constants.cc b/chrome/installer/util/master_preferences_constants.cc index d255133..0cd56260 100644 --- a/chrome/installer/util/master_preferences_constants.cc +++ b/chrome/installer/util/master_preferences_constants.cc
@@ -6,30 +6,30 @@ namespace installer { namespace master_preferences { - const char kDisableLogging[] = "disable_logging"; - const char kDistroDict[] = "distribution"; - const char kDistroImportBookmarksFromFilePref[] = - "import_bookmarks_from_file"; - const char kDistroSuppressDefaultBrowserPromptPref[] = - "suppress_default_browser_prompt_for_version"; - const char kDoNotCreateAnyShortcuts[] = "do_not_create_any_shortcuts"; - const char kDoNotCreateDesktopShortcut[] = "do_not_create_desktop_shortcut"; - const char kDoNotCreateQuickLaunchShortcut[] = - "do_not_create_quick_launch_shortcut"; - const char kDoNotCreateTaskbarShortcut[] = "do_not_create_taskbar_shortcut"; - const char kDoNotLaunchChrome[] = "do_not_launch_chrome"; - const char kDoNotRegisterForUpdateLaunch[] = - "do_not_register_for_update_launch"; - const char kLogFile[] = "log_file"; - const char kMakeChromeDefault[] = "make_chrome_default"; - const char kMakeChromeDefaultForUser[] = "make_chrome_default_for_user"; - const char kMsi[] = "msi"; - const char kMsiProductId[] = "msi_product_id"; - const char kRequireEula[] = "require_eula"; - const char kSystemLevel[] = "system_level"; - const char kVerboseLogging[] = "verbose_logging"; - const char kExtensionsBlock[] = "extensions.settings"; - const char kAllowDowngrade[] = "allow_downgrade"; + +const char kDisableLogging[] = "disable_logging"; +const char kDistroDict[] = "distribution"; +const char kDistroImportBookmarksFromFilePref[] = "import_bookmarks_from_file"; +const char kDistroSuppressDefaultBrowserPromptPref[] = + "suppress_default_browser_prompt_for_version"; +const char kDoNotCreateAnyShortcuts[] = "do_not_create_any_shortcuts"; +const char kDoNotCreateDesktopShortcut[] = "do_not_create_desktop_shortcut"; +const char kDoNotCreateQuickLaunchShortcut[] = + "do_not_create_quick_launch_shortcut"; +const char kDoNotCreateTaskbarShortcut[] = "do_not_create_taskbar_shortcut"; +const char kDoNotLaunchChrome[] = "do_not_launch_chrome"; +const char kDoNotRegisterForUpdateLaunch[] = + "do_not_register_for_update_launch"; +const char kLogFile[] = "log_file"; +const char kMakeChromeDefault[] = "make_chrome_default"; +const char kMakeChromeDefaultForUser[] = "make_chrome_default_for_user"; +const char kMsi[] = "msi"; +const char kMsiProductId[] = "msi_product_id"; +const char kRequireEula[] = "require_eula"; +const char kSystemLevel[] = "system_level"; +const char kVerboseLogging[] = "verbose_logging"; +const char kExtensionsBlock[] = "extensions.settings"; +const char kAllowDowngrade[] = "allow_downgrade"; } // namespace master_preferences } // namespace installer
diff --git a/chrome/installer/util/master_preferences_dummy.cc b/chrome/installer/util/master_preferences_dummy.cc index 22a4652..3c9cb9f 100644 --- a/chrome/installer/util/master_preferences_dummy.cc +++ b/chrome/installer/util/master_preferences_dummy.cc
@@ -21,8 +21,7 @@ MasterPreferences::MasterPreferences(const base::FilePath& prefs_path) : distribution_(nullptr), preferences_read_from_file_(false) {} -MasterPreferences::~MasterPreferences() { -} +MasterPreferences::~MasterPreferences() {} bool MasterPreferences::GetBool(const std::string& name, bool* value) const { NOTREACHED();
diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc index c0f0d10..c276b30b 100644 --- a/chrome/installer/util/master_preferences_unittest.cc +++ b/chrome/installer/util/master_preferences_unittest.cc
@@ -32,9 +32,7 @@ env_->SetVar("GoogleUpdateIsMachine", value); } - ~ScopedGoogleUpdateIsMachine() { - env_->UnSetVar("GoogleUpdateIsMachine"); - } + ~ScopedGoogleUpdateIsMachine() { env_->UnSetVar("GoogleUpdateIsMachine"); } private: std::unique_ptr<base::Environment> env_; @@ -92,8 +90,8 @@ " }\n" "} \n"; - EXPECT_TRUE(base::WriteFile(prefs_file(), text, - static_cast<int>(strlen(text)))); + EXPECT_TRUE( + base::WriteFile(prefs_file(), text, static_cast<int>(strlen(text)))); installer::MasterPreferences prefs(prefs_file()); EXPECT_TRUE(prefs.read_from_file()); @@ -134,8 +132,8 @@ " }\n" "} \n"; - EXPECT_TRUE(base::WriteFile(prefs_file(), text, - static_cast<int>(strlen(text)))); + EXPECT_TRUE( + base::WriteFile(prefs_file(), text, static_cast<int>(strlen(text)))); installer::MasterPreferences prefs(prefs_file()); EXPECT_TRUE(prefs.read_from_file()); @@ -152,9 +150,9 @@ } const char* const missing_bools[] = { - installer::master_preferences::kDoNotRegisterForUpdateLaunch, - installer::master_preferences::kMakeChromeDefault, - installer::master_preferences::kMakeChromeDefaultForUser, + installer::master_preferences::kDoNotRegisterForUpdateLaunch, + installer::master_preferences::kMakeChromeDefault, + installer::master_preferences::kMakeChromeDefaultForUser, }; for (size_t i = 0; i < base::size(missing_bools); ++i) { @@ -169,19 +167,19 @@ TEST_F(MasterPreferencesTest, FirstRunTabs) { const char text[] = - "{ \n" - " \"distribution\": { \n" - " \"something here\": true\n" - " },\n" - " \"first_run_tabs\": [\n" - " \"http://google.com/f1\",\n" - " \"https://google.com/f2\",\n" - " \"new_tab_page\"\n" - " ]\n" - "} \n"; + "{ \n" + " \"distribution\": { \n" + " \"something here\": true\n" + " },\n" + " \"first_run_tabs\": [\n" + " \"http://google.com/f1\",\n" + " \"https://google.com/f2\",\n" + " \"new_tab_page\"\n" + " ]\n" + "} \n"; - EXPECT_TRUE(base::WriteFile(prefs_file(), text, - static_cast<int>(strlen(text)))); + EXPECT_TRUE( + base::WriteFile(prefs_file(), text, static_cast<int>(strlen(text)))); installer::MasterPreferences prefs(prefs_file()); typedef std::vector<std::string> TabsVector; TabsVector tabs = prefs.GetFirstRunTabs(); @@ -199,7 +197,8 @@ base::FilePath prefs_path; ASSERT_TRUE(base::PathService::Get(chrome::DIR_TEST_DATA, &prefs_path)); prefs_path = prefs_path.AppendASCII("extensions") - .AppendASCII("good").AppendASCII("Preferences"); + .AppendASCII("good") + .AppendASCII("Preferences"); installer::MasterPreferences prefs(prefs_path); base::DictionaryValue* extensions = nullptr; @@ -208,11 +207,11 @@ EXPECT_TRUE(extensions->GetInteger( "behllobkkfkfnphdnhnkndlbkcpglgmj.location", &location)); int state = 0; - EXPECT_TRUE(extensions->GetInteger( - "behllobkkfkfnphdnhnkndlbkcpglgmj.state", &state)); + EXPECT_TRUE( + extensions->GetInteger("behllobkkfkfnphdnhnkndlbkcpglgmj.state", &state)); std::string path; - EXPECT_TRUE(extensions->GetString( - "behllobkkfkfnphdnhnkndlbkcpglgmj.path", &path)); + EXPECT_TRUE( + extensions->GetString("behllobkkfkfnphdnhnkndlbkcpglgmj.path", &path)); std::string key; EXPECT_TRUE(extensions->GetString( "behllobkkfkfnphdnhnkndlbkcpglgmj.manifest.key", &key)); @@ -230,30 +229,30 @@ base::FilePath prefs_file; ASSERT_TRUE(base::CreateTemporaryFile(&prefs_file)); const char text[] = - "{ \n" - " \"distribution\": { \n" - " \"do_not_create_desktop_shortcut\": false,\n" - " \"do_not_create_quick_launch_shortcut\": false,\n" - " \"do_not_launch_chrome\": true,\n" - " \"system_level\": true,\n" - " \"verbose_logging\": false\n" - " }\n" - "} \n"; - EXPECT_TRUE(base::WriteFile(prefs_file, text, - static_cast<int>(strlen(text)))); + "{ \n" + " \"distribution\": { \n" + " \"do_not_create_desktop_shortcut\": false,\n" + " \"do_not_create_quick_launch_shortcut\": false,\n" + " \"do_not_launch_chrome\": true,\n" + " \"system_level\": true,\n" + " \"verbose_logging\": false\n" + " }\n" + "} \n"; + EXPECT_TRUE( + base::WriteFile(prefs_file, text, static_cast<int>(strlen(text)))); // Make sure command line values override the values in master preferences. - std::wstring cmd_str( - L"setup.exe --installerdata=\"" + prefs_file.value() + L"\""); + std::wstring cmd_str(L"setup.exe --installerdata=\"" + prefs_file.value() + + L"\""); cmd_str.append(L" --do-not-launch-chrome"); base::CommandLine cmd_line = base::CommandLine::FromString(cmd_str); installer::MasterPreferences prefs(cmd_line); // Check prefs that do not have any equivalent command line option. ExpectedBooleans expected_bool[] = { - { installer::master_preferences::kDoNotLaunchChrome, true }, - { installer::master_preferences::kSystemLevel, true }, - { installer::master_preferences::kVerboseLogging, false }, + {installer::master_preferences::kDoNotLaunchChrome, true}, + {installer::master_preferences::kSystemLevel, true}, + {installer::master_preferences::kVerboseLogging, false}, }; // Now check that prefs got merged correctly. @@ -272,7 +271,7 @@ cmd_line.ParseFromString(cmd_str); installer::MasterPreferences prefs2(cmd_line); ExpectedBooleans expected_bool2[] = { - { installer::master_preferences::kDoNotLaunchChrome, true }, + {installer::master_preferences::kDoNotLaunchChrome, true}, }; for (size_t i = 0; i < base::size(expected_bool2); ++i) { @@ -281,10 +280,10 @@ << expected_bool2[i].name; } - EXPECT_FALSE(prefs2.GetBool( - installer::master_preferences::kSystemLevel, &value)); - EXPECT_FALSE(prefs2.GetBool( - installer::master_preferences::kVerboseLogging, &value)); + EXPECT_FALSE( + prefs2.GetBool(installer::master_preferences::kSystemLevel, &value)); + EXPECT_FALSE( + prefs2.GetBool(installer::master_preferences::kVerboseLogging, &value)); } TEST_F(MasterPreferencesTest, TestDefaultInstallConfig) { @@ -358,23 +357,20 @@ " }" "}"; - installer::MasterPreferences prefs(kCreateAllShortcutsFalsePrefs); + installer::MasterPreferences prefs(kCreateAllShortcutsFalsePrefs); - bool do_not_create_desktop_shortcut = false; - bool do_not_create_quick_launch_shortcut = false; - bool do_not_create_taskbar_shortcut = false; - prefs.GetBool( - installer::master_preferences::kDoNotCreateDesktopShortcut, - &do_not_create_desktop_shortcut); - prefs.GetBool( - installer::master_preferences::kDoNotCreateQuickLaunchShortcut, - &do_not_create_quick_launch_shortcut); - prefs.GetBool( - installer::master_preferences::kDoNotCreateTaskbarShortcut, - &do_not_create_taskbar_shortcut); - EXPECT_FALSE(do_not_create_desktop_shortcut); - EXPECT_FALSE(do_not_create_quick_launch_shortcut); - EXPECT_FALSE(do_not_create_taskbar_shortcut); + bool do_not_create_desktop_shortcut = false; + bool do_not_create_quick_launch_shortcut = false; + bool do_not_create_taskbar_shortcut = false; + prefs.GetBool(installer::master_preferences::kDoNotCreateDesktopShortcut, + &do_not_create_desktop_shortcut); + prefs.GetBool(installer::master_preferences::kDoNotCreateQuickLaunchShortcut, + &do_not_create_quick_launch_shortcut); + prefs.GetBool(installer::master_preferences::kDoNotCreateTaskbarShortcut, + &do_not_create_taskbar_shortcut); + EXPECT_FALSE(do_not_create_desktop_shortcut); + EXPECT_FALSE(do_not_create_quick_launch_shortcut); + EXPECT_FALSE(do_not_create_taskbar_shortcut); } TEST_F(MasterPreferencesTest, DontEnforceLegacyCreateAllShortcutsNotSpecified) { @@ -385,23 +381,20 @@ " }" "}"; - installer::MasterPreferences prefs(kCreateAllShortcutsFalsePrefs); + installer::MasterPreferences prefs(kCreateAllShortcutsFalsePrefs); - bool do_not_create_desktop_shortcut = false; - bool do_not_create_quick_launch_shortcut = false; - bool do_not_create_taskbar_shortcut = false; - prefs.GetBool( - installer::master_preferences::kDoNotCreateDesktopShortcut, - &do_not_create_desktop_shortcut); - prefs.GetBool( - installer::master_preferences::kDoNotCreateQuickLaunchShortcut, - &do_not_create_quick_launch_shortcut); - prefs.GetBool( - installer::master_preferences::kDoNotCreateTaskbarShortcut, - &do_not_create_taskbar_shortcut); - EXPECT_FALSE(do_not_create_desktop_shortcut); - EXPECT_FALSE(do_not_create_quick_launch_shortcut); - EXPECT_FALSE(do_not_create_taskbar_shortcut); + bool do_not_create_desktop_shortcut = false; + bool do_not_create_quick_launch_shortcut = false; + bool do_not_create_taskbar_shortcut = false; + prefs.GetBool(installer::master_preferences::kDoNotCreateDesktopShortcut, + &do_not_create_desktop_shortcut); + prefs.GetBool(installer::master_preferences::kDoNotCreateQuickLaunchShortcut, + &do_not_create_quick_launch_shortcut); + prefs.GetBool(installer::master_preferences::kDoNotCreateTaskbarShortcut, + &do_not_create_taskbar_shortcut); + EXPECT_FALSE(do_not_create_desktop_shortcut); + EXPECT_FALSE(do_not_create_quick_launch_shortcut); + EXPECT_FALSE(do_not_create_taskbar_shortcut); } TEST_F(MasterPreferencesTest, GoogleUpdateIsMachine) {
diff --git a/chrome/installer/util/move_tree_work_item.cc b/chrome/installer/util/move_tree_work_item.cc index 18c323f..be14a73 100644 --- a/chrome/installer/util/move_tree_work_item.cc +++ b/chrome/installer/util/move_tree_work_item.cc
@@ -10,8 +10,7 @@ #include "chrome/installer/util/duplicate_tree_detector.h" #include "chrome/installer/util/logging_installer.h" -MoveTreeWorkItem::~MoveTreeWorkItem() { -} +MoveTreeWorkItem::~MoveTreeWorkItem() {} MoveTreeWorkItem::MoveTreeWorkItem(const base::FilePath& source_path, const base::FilePath& dest_path, @@ -23,8 +22,7 @@ moved_to_dest_path_(false), moved_to_backup_(false), source_moved_to_backup_(false), - duplicate_option_(duplicate_option) { -} + duplicate_option_(duplicate_option) {} bool MoveTreeWorkItem::DoImpl() { if (!base::PathExists(source_path_)) { @@ -68,9 +66,8 @@ << " for duplicate trees. Trying regular Move instead."; } } else { - VLOG(1) << "Source path " << source_path_.value() - << " differs from " << dest_path_.value() - << ", updating now."; + VLOG(1) << "Source path " << source_path_.value() << " differs from " + << dest_path_.value() << ", updating now."; } } @@ -79,8 +76,8 @@ VLOG(1) << "Moved destination " << dest_path_.value() << " to backup path " << backup.value(); } else { - PLOG(ERROR) << "failed moving " << dest_path_.value() - << " to " << backup.value(); + PLOG(ERROR) << "failed moving " << dest_path_.value() << " to " + << backup.value(); return false; } } @@ -88,11 +85,11 @@ // Now move source to destination. if (base::Move(source_path_, dest_path_)) { moved_to_dest_path_ = true; - VLOG(1) << "Moved source " << source_path_.value() - << " to destination " << dest_path_.value(); + VLOG(1) << "Moved source " << source_path_.value() << " to destination " + << dest_path_.value(); } else { - PLOG(ERROR) << "failed move " << source_path_.value() - << " to " << dest_path_.value(); + PLOG(ERROR) << "failed move " << source_path_.value() << " to " + << dest_path_.value(); return false; } @@ -101,8 +98,8 @@ void MoveTreeWorkItem::RollbackImpl() { if (moved_to_dest_path_ && !base::Move(dest_path_, source_path_)) { - PLOG(ERROR) << "Can not move " << dest_path_.value() - << " to " << source_path_.value(); + PLOG(ERROR) << "Can not move " << dest_path_.value() << " to " + << source_path_.value(); } if (moved_to_backup_ || source_moved_to_backup_) {
diff --git a/chrome/installer/util/product_state_unittest.cc b/chrome/installer/util/product_state_unittest.cc index 425d556..b657f57 100644 --- a/chrome/installer/util/product_state_unittest.cc +++ b/chrome/installer/util/product_state_unittest.cc
@@ -93,8 +93,8 @@ // Bogus version. { ProductState state; - LONG result = clients_.WriteValue(google_update::kRegVersionField, - L"goofy"); + LONG result = + clients_.WriteValue(google_update::kRegVersionField, L"goofy"); EXPECT_TRUE(result == ERROR_SUCCESS || result == ERROR_FILE_NOT_FOUND); EXPECT_FALSE(state.Initialize(system_install_)); } @@ -102,8 +102,8 @@ // Valid "pv" value. { ProductState state; - LONG result = clients_.WriteValue(google_update::kRegVersionField, - L"10.0.47.0"); + LONG result = + clients_.WriteValue(google_update::kRegVersionField, L"10.0.47.0"); EXPECT_TRUE(result == ERROR_SUCCESS || result == ERROR_FILE_NOT_FOUND); EXPECT_TRUE(state.Initialize(system_install_)); EXPECT_EQ("10.0.47.0", state.version().GetString()); @@ -135,8 +135,8 @@ // Bogus "opv" value. { ProductState state; - LONG result = clients_.WriteValue(google_update::kRegOldVersionField, - L"coming home"); + LONG result = + clients_.WriteValue(google_update::kRegOldVersionField, L"coming home"); EXPECT_TRUE(result == ERROR_SUCCESS || result == ERROR_FILE_NOT_FOUND); EXPECT_TRUE(state.Initialize(system_install_)); EXPECT_EQ(state.old_version(), nullptr); @@ -145,8 +145,8 @@ // Valid "opv" value. { ProductState state; - LONG result = clients_.WriteValue(google_update::kRegOldVersionField, - L"10.0.47.0"); + LONG result = + clients_.WriteValue(google_update::kRegOldVersionField, L"10.0.47.0"); EXPECT_TRUE(result == ERROR_SUCCESS || result == ERROR_FILE_NOT_FOUND); EXPECT_TRUE(state.Initialize(system_install_)); EXPECT_NE(state.old_version(), nullptr); @@ -335,8 +335,7 @@ { ProductState state; EXPECT_EQ(ERROR_SUCCESS, - client_state_.WriteValue(google_update::kRegMSIField, - L"bogus!")); + client_state_.WriteValue(google_update::kRegMSIField, L"bogus!")); EXPECT_TRUE(state.Initialize(system_install_)); EXPECT_FALSE(state.is_msi()); }
diff --git a/chrome/installer/util/product_unittest.cc b/chrome/installer/util/product_unittest.cc index 9ef8a87..2abe5ba 100644 --- a/chrome/installer/util/product_unittest.cc +++ b/chrome/installer/util/product_unittest.cc
@@ -52,9 +52,9 @@ const char kCurrentVersion[] = "1.2.3.4"; base::Version current_version(kCurrentVersion); - version_key.WriteValue(google_update::kRegVersionField, - base::UTF8ToWide( - current_version.GetString()).c_str()); + version_key.WriteValue( + google_update::kRegVersionField, + base::UTF8ToWide(current_version.GetString()).c_str()); machine_state.Initialize(); const installer::ProductState* chrome_state =
diff --git a/chrome/installer/util/registry_entry.h b/chrome/installer/util/registry_entry.h index bf54f007..6daf82c4 100644 --- a/chrome/installer/util/registry_entry.h +++ b/chrome/installer/util/registry_entry.h
@@ -6,6 +6,7 @@ #define CHROME_INSTALLER_UTIL_REGISTRY_ENTRY_H_ #include <windows.h> + #include <stdint.h> #include "base/macros.h"
diff --git a/chrome/installer/util/registry_key_backup.cc b/chrome/installer/util/registry_key_backup.cc index 65ce36f..c10d476 100644 --- a/chrome/installer/util/registry_key_backup.cc +++ b/chrome/installer/util/registry_key_backup.cc
@@ -93,11 +93,9 @@ // Copy constructible and assignable for use in STL containers. }; -ValueData::ValueData() : type_(REG_NONE) { -} +ValueData::ValueData() : type_(REG_NONE) {} -ValueData::~ValueData() { -} +ValueData::~ValueData() {} void ValueData::Initialize(const wchar_t* name_buffer, DWORD name_size, @@ -109,11 +107,9 @@ data_.assign(data, data + data_size); } -RegistryKeyBackup::KeyData::KeyData() { -} +RegistryKeyBackup::KeyData::KeyData() {} -RegistryKeyBackup::KeyData::~KeyData() { -} +RegistryKeyBackup::KeyData::~KeyData() {} bool RegistryKeyBackup::KeyData::Initialize(const RegKey& key) { std::vector<ValueData> values; @@ -143,7 +139,7 @@ DWORD value_type = REG_NONE; DWORD value_size = 0; - for (DWORD i = 0; i < num_values; ) { + for (DWORD i = 0; i < num_values;) { name_size = static_cast<DWORD>(name_buffer.size()); value_size = static_cast<DWORD>(value_buffer.size()); result = @@ -167,8 +163,8 @@ name_buffer.resize(name_size + 1); break; default: - LOG(ERROR) << "Failed backing up value " << i << ", result: " - << result; + LOG(ERROR) << "Failed backing up value " << i + << ", result: " << result; return false; } } @@ -183,7 +179,7 @@ DWORD name_size = 0; // Get the names of them. - for (DWORD i = 0; i < num_subkeys; ) { + for (DWORD i = 0; i < num_subkeys;) { name_size = static_cast<DWORD>(name_buffer.size()); result = RegEnumKeyEx(key.Handle(), i, &name_buffer[0], &name_size, nullptr, nullptr, nullptr, nullptr); @@ -258,13 +254,13 @@ result = subkey.Create(key->Handle(), name.c_str(), KEY_WRITE); if (result != ERROR_SUCCESS) { - LOG(ERROR) << "Failed creating subkey \"" << name << "\", result: " - << result; + LOG(ERROR) << "Failed creating subkey \"" << name + << "\", result: " << result; return false; } if (!it->second.WriteTo(&subkey)) { - LOG(ERROR) << "Failed writing subkey \"" << name << "\", result: " - << result; + LOG(ERROR) << "Failed writing subkey \"" << name + << "\", result: " << result; return false; } } @@ -272,18 +268,15 @@ return true; } -RegistryKeyBackup::RegistryKeyBackup() { -} +RegistryKeyBackup::RegistryKeyBackup() {} -RegistryKeyBackup::~RegistryKeyBackup() { -} +RegistryKeyBackup::~RegistryKeyBackup() {} bool RegistryKeyBackup::Initialize(HKEY root, const wchar_t* key_path, REGSAM wow64_access) { DCHECK(key_path); - DCHECK(wow64_access == 0 || - wow64_access == KEY_WOW64_32KEY || + DCHECK(wow64_access == 0 || wow64_access == KEY_WOW64_32KEY || wow64_access == KEY_WOW64_64KEY); RegKey key; @@ -311,8 +304,7 @@ const wchar_t* key_path, REGSAM wow64_access) const { DCHECK(key_path); - DCHECK(wow64_access == 0 || - wow64_access == KEY_WOW64_32KEY || + DCHECK(wow64_access == 0 || wow64_access == KEY_WOW64_32KEY || wow64_access == KEY_WOW64_64KEY); bool success = false;
diff --git a/chrome/installer/util/registry_key_backup.h b/chrome/installer/util/registry_key_backup.h index df4636f..b65e16fe 100644 --- a/chrome/installer/util/registry_key_backup.h +++ b/chrome/installer/util/registry_key_backup.h
@@ -34,9 +34,7 @@ // initialized from a non-existent key. bool WriteTo(HKEY root, const wchar_t* key_path, REGSAM wow64_acccess) const; - void swap(RegistryKeyBackup& other) { - key_data_.swap(other.key_data_); - } + void swap(RegistryKeyBackup& other) { key_data_.swap(other.key_data_); } private: class KeyData;
diff --git a/chrome/installer/util/registry_key_backup_unittest.cc b/chrome/installer/util/registry_key_backup_unittest.cc index 6559655..162b415 100644 --- a/chrome/installer/util/registry_key_backup_unittest.cc +++ b/chrome/installer/util/registry_key_backup_unittest.cc
@@ -17,9 +17,7 @@ class RegistryKeyBackupTest : public testing::Test { protected: - static void TearDownTestCase() { - logging::CloseLogFile(); - } + static void TearDownTestCase() { logging::CloseLogFile(); } void SetUp() override { ASSERT_TRUE(test_data_.Initialize(HKEY_CURRENT_USER, L"SOFTWARE\\TmpTmp")); @@ -34,11 +32,11 @@ TEST_F(RegistryKeyBackupTest, Uninitialized) { RegistryKeyBackup backup; - EXPECT_TRUE(backup.WriteTo(test_data_.root_key(), - destination_path_.c_str(), + EXPECT_TRUE(backup.WriteTo(test_data_.root_key(), destination_path_.c_str(), WorkItem::kWow64Default)); - EXPECT_FALSE(RegKey(test_data_.root_key(), destination_path_.c_str(), - KEY_READ).Valid()); + EXPECT_FALSE( + RegKey(test_data_.root_key(), destination_path_.c_str(), KEY_READ) + .Valid()); } // Test that initializing a backup with a non-existent key works, and that @@ -50,11 +48,11 @@ EXPECT_TRUE(backup.Initialize(test_data_.root_key(), non_existent_key_path.c_str(), WorkItem::kWow64Default)); - EXPECT_TRUE(backup.WriteTo(test_data_.root_key(), - destination_path_.c_str(), + EXPECT_TRUE(backup.WriteTo(test_data_.root_key(), destination_path_.c_str(), WorkItem::kWow64Default)); - EXPECT_FALSE(RegKey(test_data_.root_key(), destination_path_.c_str(), - KEY_READ).Valid()); + EXPECT_FALSE( + RegKey(test_data_.root_key(), destination_path_.c_str(), KEY_READ) + .Valid()); } // Test that reading some data then writing it out does the right thing. @@ -64,8 +62,7 @@ EXPECT_TRUE(backup.Initialize(test_data_.root_key(), test_data_.non_empty_key_path().c_str(), WorkItem::kWow64Default)); - EXPECT_TRUE(backup.WriteTo(test_data_.root_key(), - destination_path_.c_str(), + EXPECT_TRUE(backup.WriteTo(test_data_.root_key(), destination_path_.c_str(), WorkItem::kWow64Default)); test_data_.ExpectMatchesNonEmptyKey(test_data_.root_key(), destination_path_.c_str()); @@ -86,12 +83,11 @@ WorkItem::kWow64Default)); // Now make sure the one we started with is truly empty. - EXPECT_EQ(ERROR_SUCCESS, - RegKey(test_data_.root_key(), L"", KEY_QUERY_VALUE) - .DeleteKey(destination_path_.c_str())); - EXPECT_TRUE(backup.WriteTo(test_data_.root_key(), - destination_path_.c_str(), + EXPECT_EQ(ERROR_SUCCESS, RegKey(test_data_.root_key(), L"", KEY_QUERY_VALUE) + .DeleteKey(destination_path_.c_str())); + EXPECT_TRUE(backup.WriteTo(test_data_.root_key(), destination_path_.c_str(), WorkItem::kWow64Default)); - EXPECT_FALSE(RegKey(test_data_.root_key(), destination_path_.c_str(), - KEY_READ).Valid()); + EXPECT_FALSE( + RegKey(test_data_.root_key(), destination_path_.c_str(), KEY_READ) + .Valid()); }
diff --git a/chrome/installer/util/self_cleaning_temp_dir.cc b/chrome/installer/util/self_cleaning_temp_dir.cc index 8c21038..c562604 100644 --- a/chrome/installer/util/self_cleaning_temp_dir.cc +++ b/chrome/installer/util/self_cleaning_temp_dir.cc
@@ -32,12 +32,12 @@ } while (parent_dir != *base_dir && !base::PathExists(parent_dir)); LOG_IF(WARNING, !base::DirectoryExists(parent_dir)) << "A non-directory is at the base of the path leading to a desired " - "temp directory location: " << parent_dir.value(); + "temp directory location: " + << parent_dir.value(); } } -SelfCleaningTempDir::SelfCleaningTempDir() { -} +SelfCleaningTempDir::SelfCleaningTempDir() {} SelfCleaningTempDir::~SelfCleaningTempDir() { if (!path().empty() && !Delete()) @@ -95,7 +95,7 @@ do { if (!schedule_deletes && !RemoveDirectory(next_dir.value().c_str())) { PLOG_IF(WARNING, GetLastError() != ERROR_DIR_NOT_EMPTY) - << "Error removing directory " << next_dir.value().c_str(); + << "Error removing directory " << next_dir.value().c_str(); schedule_deletes = true; } if (schedule_deletes) {
diff --git a/chrome/installer/util/self_cleaning_temp_dir_unittest.cc b/chrome/installer/util/self_cleaning_temp_dir_unittest.cc index 736699f..434a401 100644 --- a/chrome/installer/util/self_cleaning_temp_dir_unittest.cc +++ b/chrome/installer/util/self_cleaning_temp_dir_unittest.cc
@@ -42,8 +42,7 @@ namespace installer { -class SelfCleaningTempDirTest : public testing::Test { -}; +class SelfCleaningTempDirTest : public testing::Test {}; // Test the implementation of GetTopDirToCreate when given the root of a // volume. @@ -53,7 +52,7 @@ EXPECT_TRUE(base_dir.empty()); } -// Test the implementation of GetTopDirToCreate when given a non-existant dir +// Test the implementation of GetTopDirToCreate when given a non-existent dir // under the root of a volume. TEST_F(SelfCleaningTempDirTest, TopLevelPlusOne) { base::FilePath base_dir;
diff --git a/chrome/installer/util/set_reg_value_work_item.cc b/chrome/installer/util/set_reg_value_work_item.cc index ee95d1ff..148afcc 100644 --- a/chrome/installer/util/set_reg_value_work_item.cc +++ b/chrome/installer/util/set_reg_value_work_item.cc
@@ -43,8 +43,7 @@ } // namespace -SetRegValueWorkItem::~SetRegValueWorkItem() { -} +SetRegValueWorkItem::~SetRegValueWorkItem() {} SetRegValueWorkItem::SetRegValueWorkItem(HKEY predefined_root, const std::wstring& key_path, @@ -60,8 +59,7 @@ type_(REG_SZ), previous_type_(0), status_(SET_VALUE) { - DCHECK(wow64_access == 0 || - wow64_access == KEY_WOW64_32KEY || + DCHECK(wow64_access == 0 || wow64_access == KEY_WOW64_32KEY || wow64_access == KEY_WOW64_64KEY); StringToBinaryData(value_data, &value_); } @@ -80,8 +78,7 @@ type_(REG_DWORD), previous_type_(0), status_(SET_VALUE) { - DCHECK(wow64_access == 0 || - wow64_access == KEY_WOW64_32KEY || + DCHECK(wow64_access == 0 || wow64_access == KEY_WOW64_32KEY || wow64_access == KEY_WOW64_64KEY); const uint8_t* data = reinterpret_cast<const uint8_t*>(&value_data); value_.assign(data, data + sizeof(value_data)); @@ -101,8 +98,7 @@ type_(REG_QWORD), previous_type_(0), status_(SET_VALUE) { - DCHECK(wow64_access == 0 || - wow64_access == KEY_WOW64_32KEY || + DCHECK(wow64_access == 0 || wow64_access == KEY_WOW64_32KEY || wow64_access == KEY_WOW64_64KEY); const uint8_t* data = reinterpret_cast<const uint8_t*>(&value_data); value_.assign(data, data + sizeof(value_data)); @@ -123,8 +119,7 @@ type_(REG_SZ), previous_type_(0), status_(SET_VALUE) { - DCHECK(wow64_access == 0 || - wow64_access == KEY_WOW64_32KEY || + DCHECK(wow64_access == 0 || wow64_access == KEY_WOW64_32KEY || wow64_access == KEY_WOW64_64KEY); // Nothing to do, |get_value_callback| will fill |value_| later. } @@ -204,8 +199,8 @@ } base::win::RegKey key; - LONG result = key.Open( - predefined_root_, key_path_.c_str(), KEY_SET_VALUE | wow64_access_); + LONG result = key.Open(predefined_root_, key_path_.c_str(), + KEY_SET_VALUE | wow64_access_); if (result != ERROR_SUCCESS) { VLOG(1) << "rollback: can not open " << key_path_ << " error: " << result; return;
diff --git a/chrome/installer/util/set_reg_value_work_item.h b/chrome/installer/util/set_reg_value_work_item.h index 4aa96d8..fa27db5 100644 --- a/chrome/installer/util/set_reg_value_work_item.h +++ b/chrome/installer/util/set_reg_value_work_item.h
@@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_INSTALLER_UTIL_SET_REG_VALUE_WORK_ITEM_H__ -#define CHROME_INSTALLER_UTIL_SET_REG_VALUE_WORK_ITEM_H__ +#ifndef CHROME_INSTALLER_UTIL_SET_REG_VALUE_WORK_ITEM_H_ +#define CHROME_INSTALLER_UTIL_SET_REG_VALUE_WORK_ITEM_H_ #include <windows.h> + #include <stdint.h> #include <string> @@ -99,4 +100,4 @@ SettingStatus status_; }; -#endif // CHROME_INSTALLER_UTIL_SET_REG_VALUE_WORK_ITEM_H__ +#endif // CHROME_INSTALLER_UTIL_SET_REG_VALUE_WORK_ITEM_H_
diff --git a/chrome/installer/util/set_reg_value_work_item_unittest.cc b/chrome/installer/util/set_reg_value_work_item_unittest.cc index 383279b..ac91369 100644 --- a/chrome/installer/util/set_reg_value_work_item_unittest.cc +++ b/chrome/installer/util/set_reg_value_work_item_unittest.cc
@@ -139,12 +139,9 @@ // Now test REG_DWORD value. // Write data to the value we are going to set. ASSERT_EQ(ERROR_SUCCESS, test_key_.WriteValue(kNameDword, kDword1)); - work_item.reset(WorkItem::CreateSetRegValueWorkItem(HKEY_CURRENT_USER, - kTestKey, - WorkItem::kWow64Default, - kNameDword, - kDword2, - false)); + work_item.reset(WorkItem::CreateSetRegValueWorkItem( + HKEY_CURRENT_USER, kTestKey, WorkItem::kWow64Default, kNameDword, kDword2, + false)); ASSERT_TRUE(work_item->Do()); DWORD read_dword; @@ -232,12 +229,9 @@ kNameStr, kDataStr1, false)); EXPECT_FALSE(work_item->Do()); - work_item.reset(WorkItem::CreateSetRegValueWorkItem(HKEY_CURRENT_USER, - non_existing.c_str(), - WorkItem::kWow64Default, - kNameStr, - kDword1, - false)); + work_item.reset(WorkItem::CreateSetRegValueWorkItem( + HKEY_CURRENT_USER, non_existing.c_str(), WorkItem::kWow64Default, + kNameStr, kDword1, false)); EXPECT_FALSE(work_item->Do()); }
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index b61dc7a6..51f0092 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc
@@ -80,7 +80,7 @@ // present. CONFIRM_PROGID_REGISTRATION = 0, // Confirm that Chrome is fully integrated with Windows (i.e. registered with - // Defaut Programs). These registrations can be in HKCU as of Windows 8. + // Default Programs). These registrations can be in HKCU as of Windows 8. // Note: Shell registration implies ProgId registration. CONFIRM_SHELL_REGISTRATION, // Same as CONFIRM_SHELL_REGISTRATION, but only look in HKLM (used when @@ -230,7 +230,7 @@ } // DelegateExecute ProgId. Needed for Chrome Metro in Windows 8. This is only -// needed for registring a web browser, not for general associations. +// needed for registering a web browser, not for general associations. std::vector<std::unique_ptr<RegistryEntry>> GetChromeDelegateExecuteEntries( const base::FilePath& chrome_exe, const ApplicationInfo& app_info) { @@ -719,13 +719,13 @@ cmd.AppendSwitchPath(installer::switches::kRegisterChromeBrowser, chrome_exe); if (!suffix.empty()) { - cmd.AppendSwitchNative( - installer::switches::kRegisterChromeBrowserSuffix, suffix); + cmd.AppendSwitchNative(installer::switches::kRegisterChromeBrowserSuffix, + suffix); } if (!protocol.empty()) { - cmd.AppendSwitchNative( - installer::switches::kRegisterURLProtocol, protocol); + cmd.AppendSwitchNative(installer::switches::kRegisterURLProtocol, + protocol); } DWORD ret_val = 0; @@ -802,7 +802,7 @@ OAIF_URL_PROTOCOL | OAIF_FORCE_REGISTRATION | OAIF_REGISTER_EXT; HRESULT hr = SHOpenWithDialog(nullptr, &open_as_info); DLOG_IF(WARNING, FAILED(hr)) << "Failed to set as default " << protocol - << " handler; hr=0x" << std::hex << hr; + << " handler; hr=0x" << std::hex << hr; if (FAILED(hr)) return false; SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr); @@ -1242,10 +1242,9 @@ // manner appropriate for the current version of Windows) to determine if // Chrome is the default handler for |protocols|. Returns IS_DEFAULT // only if Chrome is the default for all specified protocols. -ShellUtil::DefaultState ProbeProtocolHandlers( - const base::FilePath& chrome_exe, - const wchar_t* const* protocols, - size_t num_protocols) { +ShellUtil::DefaultState ProbeProtocolHandlers(const base::FilePath& chrome_exe, + const wchar_t* const* protocols, + size_t num_protocols) { #if DCHECK_IS_ON() DCHECK(!num_protocols || protocols); for (size_t i = 0; i < num_protocols; ++i) @@ -1362,8 +1361,7 @@ // icon index. Non-fatal if we fail to get the old icon. base::win::ShortcutProperties old_prop; if (base::win::ResolveShortcutProperties( - shortcut_path, - base::win::ShortcutProperties::PROPERTIES_ICON, + shortcut_path, base::win::ShortcutProperties::PROPERTIES_ICON, &old_prop)) { if (InstallUtil::ProgramCompare(old_target).EvaluatePath(old_prop.icon)) new_prop.set_icon(new_target, old_prop.icon_index); @@ -1372,14 +1370,14 @@ } bool result = base::win::CreateOrUpdateShortcutLink( - shortcut_path, new_prop, base::win::SHORTCUT_UPDATE_EXISTING); + shortcut_path, new_prop, base::win::SHORTCUT_UPDATE_EXISTING); LOG_IF(ERROR, !result) << "Failed to retarget " << shortcut_path.value(); return result; } bool ShortcutOpListOrRemoveUnknownArgs( bool do_removal, - std::vector<std::pair<base::FilePath, base::string16> >* shortcuts, + std::vector<std::pair<base::FilePath, base::string16>>* shortcuts, const base::FilePath& shortcut_path) { base::string16 args; if (!base::win::ResolveShortcut(shortcut_path, nullptr, &args)) @@ -1435,13 +1433,12 @@ } bool success = true; - base::FileEnumerator enumerator( - shortcut_folder, false, base::FileEnumerator::FILES, - base::string16(L"*") + installer::kLnkExt); + base::FileEnumerator enumerator(shortcut_folder, false, + base::FileEnumerator::FILES, + base::string16(L"*") + installer::kLnkExt); base::FilePath target_path; base::string16 args; - for (base::FilePath shortcut_path = enumerator.Next(); - !shortcut_path.empty(); + for (base::FilePath shortcut_path = enumerator.Next(); !shortcut_path.empty(); shortcut_path = enumerator.Next()) { if (cancel.get() && cancel->data.IsSet()) return false; @@ -1529,16 +1526,12 @@ const wchar_t* ShellUtil::kRegOpenWithProgids = L"OpenWithProgids"; ShellUtil::ShortcutProperties::ShortcutProperties(ShellChange level_in) - : level(level_in), - icon_index(0), - pin_to_taskbar(false), - options(0U) {} + : level(level_in), icon_index(0), pin_to_taskbar(false), options(0U) {} ShellUtil::ShortcutProperties::ShortcutProperties( const ShortcutProperties& other) = default; -ShellUtil::ShortcutProperties::~ShortcutProperties() { -} +ShellUtil::ShortcutProperties::~ShortcutProperties() {} ShellUtil::FileAssociationsAndAppName::FileAssociationsAndAppName() = default; @@ -1555,9 +1548,9 @@ bool ShellUtil::ShortcutLocationIsSupported(ShortcutLocation location) { switch (location) { - case SHORTCUT_LOCATION_DESKTOP: // Falls through. - case SHORTCUT_LOCATION_QUICK_LAUNCH: // Falls through. - case SHORTCUT_LOCATION_START_MENU_ROOT: // Falls through. + case SHORTCUT_LOCATION_DESKTOP: // Falls through. + case SHORTCUT_LOCATION_QUICK_LAUNCH: // Falls through. + case SHORTCUT_LOCATION_START_MENU_ROOT: // Falls through. case SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED: // Falls through. case SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR: // Falls through. case SHORTCUT_LOCATION_STARTUP: @@ -1580,8 +1573,8 @@ base::string16 folder_to_append; switch (location) { case SHORTCUT_LOCATION_DESKTOP: - dir_key = (level == CURRENT_USER) ? base::DIR_USER_DESKTOP : - base::DIR_COMMON_DESKTOP; + dir_key = (level == CURRENT_USER) ? base::DIR_USER_DESKTOP + : base::DIR_COMMON_DESKTOP; break; case SHORTCUT_LOCATION_QUICK_LAUNCH: // There is no support for a system-level Quick Launch shortcut. @@ -1589,17 +1582,17 @@ dir_key = base::DIR_USER_QUICK_LAUNCH; break; case SHORTCUT_LOCATION_START_MENU_ROOT: - dir_key = (level == CURRENT_USER) ? base::DIR_START_MENU : - base::DIR_COMMON_START_MENU; + dir_key = (level == CURRENT_USER) ? base::DIR_START_MENU + : base::DIR_COMMON_START_MENU; break; case SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED: - dir_key = (level == CURRENT_USER) ? base::DIR_START_MENU : - base::DIR_COMMON_START_MENU; + dir_key = (level == CURRENT_USER) ? base::DIR_START_MENU + : base::DIR_COMMON_START_MENU; folder_to_append = InstallUtil::GetChromeShortcutDirNameDeprecated(); break; case SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR: - dir_key = (level == CURRENT_USER) ? base::DIR_START_MENU : - base::DIR_COMMON_START_MENU; + dir_key = (level == CURRENT_USER) ? base::DIR_START_MENU + : base::DIR_COMMON_START_MENU; folder_to_append = InstallUtil::GetChromeAppsShortcutDirName(); break; case SHORTCUT_LOCATION_TASKBAR_PINS: @@ -1678,10 +1671,9 @@ return result; } -bool ShellUtil::CreateOrUpdateShortcut( - ShortcutLocation location, - const ShortcutProperties& properties, - ShortcutOperation operation) { +bool ShellUtil::CreateOrUpdateShortcut(ShortcutLocation location, + const ShortcutProperties& properties, + ShortcutOperation operation) { // Explicitly whitelist locations to which this is applicable. if (location != SHORTCUT_LOCATION_DESKTOP && location != SHORTCUT_LOCATION_QUICK_LAUNCH && @@ -1798,7 +1790,7 @@ // HKCU has precedence over HKLM for these registrations: http://goo.gl/xjczJ. // Look in HKCU second to override any identical values found in HKLM. - const HKEY roots[] = { HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER }; + const HKEY roots[] = {HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER}; for (const HKEY root : roots) { for (base::win::RegistryKeyIterator iter(root, base_key.c_str()); iter.Valid(); ++iter) { @@ -1936,7 +1928,7 @@ // re-run the installer or run with the --set-default-browser command line // flag. There is doubtless some other key we can hook into to cause "Repair" // to show up in Add/Remove programs for us. - static const wchar_t* const kChromeProtocols[] = { L"http", L"https" }; + static const wchar_t* const kChromeProtocols[] = {L"http", L"https"}; DefaultState default_state = ProbeProtocolHandlers( chrome_exe, kChromeProtocols, base::size(kChromeProtocols)); UpdateDefaultBrowserBeaconWithState(default_state); @@ -1954,7 +1946,7 @@ return UNKNOWN_DEFAULT; } - const wchar_t* const protocols[] = { protocol.c_str() }; + const wchar_t* const protocols[] = {protocol.c_str()}; return ProbeProtocolHandlers(chrome_exe, protocols, base::size(protocols)); } @@ -2072,7 +2064,7 @@ switch (GetInteractiveSetDefaultMode()) { case INTENT_PICKER: { // On Windows 8, you can't set yourself as the default handler - // programatically. In other words IApplicationAssociationRegistration + // programmatically. In other words IApplicationAssociationRegistration // has been rendered useless. What you can do is to launch // "Set Program Associations" section of the "Default Programs" // control panel, which is a mess, or pop the concise "How you want to @@ -2151,13 +2143,13 @@ return false; bool succeeded = true; - bool is_default = ( - GetChromeDefaultProtocolClientState(protocol) == IS_DEFAULT); + bool is_default = + (GetChromeDefaultProtocolClientState(protocol) == IS_DEFAULT); if (!is_default) { switch (GetInteractiveSetDefaultMode()) { case INTENT_PICKER: { // On Windows 8, you can't set yourself as the default handler - // programatically. In other words IApplicationAssociationRegistration + // programmatically. In other words IApplicationAssociationRegistration // has been rendered useless. What you can do is to launch // "Set Program Associations" section of the "Default Programs" // control panel, which is a mess, or pop the concise "How you want to @@ -2299,7 +2291,7 @@ if (!RegisterChromeBrowser(chrome_exe, suffix, false)) return false; - // Write in the capabillity for the protocol. + // Write in the capability for the protocol. std::vector<std::unique_ptr<RegistryEntry>> entries; GetProtocolCapabilityEntries(suffix, protocol, &entries); return AddRegistryEntries(root, entries); @@ -2361,7 +2353,7 @@ const base::FilePath& chrome_exe, bool do_removal, const scoped_refptr<SharedCancellationFlag>& cancel, - std::vector<std::pair<base::FilePath, base::string16> >* shortcuts) { + std::vector<std::pair<base::FilePath, base::string16>>* shortcuts) { if (!ShortcutLocationIsSupported(location)) return false; FilterTargetEq shortcut_filter(chrome_exe, true);
diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h index 3bee59a..a85900e 100644 --- a/chrome/installer/util/shell_util.h +++ b/chrome/installer/util/shell_util.h
@@ -10,6 +10,7 @@ #define CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ #include <windows.h> + #include <stddef.h> #include <stdint.h> @@ -31,7 +32,7 @@ namespace base { class AtomicFlag; class CommandLine; -} +} // namespace base // This is a utility class that provides common shell integration methods // that can be used by installer as well as Chrome. @@ -175,25 +176,17 @@ pin_to_taskbar = pin_to_taskbar_in; } - bool has_target() const { - return (options & PROPERTIES_TARGET) != 0; - } + bool has_target() const { return (options & PROPERTIES_TARGET) != 0; } - bool has_arguments() const { - return (options & PROPERTIES_ARGUMENTS) != 0; - } + bool has_arguments() const { return (options & PROPERTIES_ARGUMENTS) != 0; } bool has_description() const { return (options & PROPERTIES_DESCRIPTION) != 0; } - bool has_icon() const { - return (options & PROPERTIES_ICON) != 0; - } + bool has_icon() const { return (options & PROPERTIES_ICON) != 0; } - bool has_app_id() const { - return (options & PROPERTIES_APP_ID) != 0; - } + bool has_app_id() const { return (options & PROPERTIES_APP_ID) != 0; } bool has_shortcut_name() const { return (options & PROPERTIES_SHORTCUT_NAME) != 0; @@ -360,10 +353,9 @@ // SHORTCUT_LOCATION_QUICK_LAUNCH, SHORTCUT_LOCATION_START_MENU_ROOT, // SHORTCUT_LOCATION_START_MENU_CHROME_DIR, or // SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR. - static bool CreateOrUpdateShortcut( - ShortcutLocation location, - const ShortcutProperties& properties, - ShortcutOperation operation); + static bool CreateOrUpdateShortcut(ShortcutLocation location, + const ShortcutProperties& properties, + ShortcutOperation operation); // Returns the string "|icon_path|,|icon_index|" (see, for example, // http://msdn.microsoft.com/library/windows/desktop/dd391573.aspx). @@ -518,7 +510,7 @@ // best effort deal. // If write to HKLM is required, but fails, and: // - |elevate_if_not_admin| is true (and OS is Vista or above): - // tries to launch setup.exe with admin priviledges (by prompting the user + // tries to launch setup.exe with admin privileges (by prompting the user // with a UAC) to do these tasks. // - |elevate_if_not_admin| is false (or OS is XP): // adds the ProgId entries to HKCU. These entries will not make Chrome show @@ -582,11 +574,10 @@ // redirected to |new_target_exe|. // Returns true if all updates to matching shortcuts are successful, including // the vacuous case where no matching shortcuts are found. - static bool RetargetShortcutsWithArgs( - ShortcutLocation location, - ShellChange level, - const base::FilePath& old_target_exe, - const base::FilePath& new_target_exe); + static bool RetargetShortcutsWithArgs(ShortcutLocation location, + ShellChange level, + const base::FilePath& old_target_exe, + const base::FilePath& new_target_exe); typedef base::RefCountedData<base::AtomicFlag> SharedCancellationFlag; @@ -600,7 +591,7 @@ const base::FilePath& chrome_exe, bool do_removal, const scoped_refptr<SharedCancellationFlag>& cancel, - std::vector<std::pair<base::FilePath, base::string16> >* shortcuts); + std::vector<std::pair<base::FilePath, base::string16>>* shortcuts); // Sets |suffix| to the base 32 encoding of the md5 hash of this user's sid // preceded by a dot. @@ -685,5 +676,4 @@ DISALLOW_COPY_AND_ASSIGN(ShellUtil); }; - #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_
diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc index cfb46174..a70ae42 100644 --- a/chrome/installer/util/shell_util_unittest.cc +++ b/chrome/installer/util/shell_util_unittest.cc
@@ -153,9 +153,8 @@ // implicit default properties) for |dist|. // Note: This method doesn't verify the |pin_to_taskbar| property as it // implies real (non-mocked) state which is flaky to test. - void ValidateChromeShortcut( - ShellUtil::ShortcutLocation location, - const ShellUtil::ShortcutProperties& properties) { + void ValidateChromeShortcut(ShellUtil::ShortcutLocation location, + const ShellUtil::ShortcutProperties& properties) { base::FilePath expected_path(GetExpectedShortcutPath(location, properties)); base::win::ShortcutProperties expected_properties; @@ -664,14 +663,10 @@ ShellUtil::ShortcutProperties expected_properties4(test_properties_); // List the shortcuts. - std::vector<std::pair<base::FilePath, base::string16> > shortcuts; + std::vector<std::pair<base::FilePath, base::string16>> shortcuts; EXPECT_TRUE(ShellUtil::ShortcutListMaybeRemoveUnknownArgs( - ShellUtil::SHORTCUT_LOCATION_DESKTOP, - ShellUtil::CURRENT_USER, - chrome_exe_, - false, - nullptr, - &shortcuts)); + ShellUtil::SHORTCUT_LOCATION_DESKTOP, ShellUtil::CURRENT_USER, + chrome_exe_, false, nullptr, &shortcuts)); ASSERT_EQ(2u, shortcuts.size()); std::pair<base::FilePath, base::string16> shortcut3 = shortcuts[0].first == shortcut3_path ? shortcuts[0] : shortcuts[1]; @@ -685,17 +680,13 @@ // Clear shortcuts. shortcuts.clear(); EXPECT_TRUE(ShellUtil::ShortcutListMaybeRemoveUnknownArgs( - ShellUtil::SHORTCUT_LOCATION_DESKTOP, - ShellUtil::CURRENT_USER, - chrome_exe_, - true, - nullptr, - &shortcuts)); + ShellUtil::SHORTCUT_LOCATION_DESKTOP, ShellUtil::CURRENT_USER, + chrome_exe_, true, nullptr, &shortcuts)); ASSERT_EQ(2u, shortcuts.size()); - shortcut3 = shortcuts[0].first == shortcut3_path ? shortcuts[0] : - shortcuts[1]; - shortcut4 = shortcuts[0].first == shortcut4_path ? shortcuts[0] : - shortcuts[1]; + shortcut3 = + shortcuts[0].first == shortcut3_path ? shortcuts[0] : shortcuts[1]; + shortcut4 = + shortcuts[0].first == shortcut4_path ? shortcuts[0] : shortcuts[1]; EXPECT_EQ(shortcut3_path, shortcut3.first); EXPECT_EQ(L"foo.com", shortcut3.second); EXPECT_EQ(shortcut4_path, shortcut4.first); @@ -740,9 +731,8 @@ ++count; EXPECT_EQ(2, count); - base::FileEnumerator chrome_apps_file_counter(chrome_apps_shortcut_folder, - false, - base::FileEnumerator::FILES); + base::FileEnumerator chrome_apps_file_counter( + chrome_apps_shortcut_folder, false, base::FileEnumerator::FILES); count = 0; while (!chrome_apps_file_counter.Next().empty()) ++count; @@ -821,10 +811,9 @@ // .test2 files already have a default application. base::win::RegKey key; - ASSERT_EQ( - ERROR_SUCCESS, - key.Create( - HKEY_CURRENT_USER, L"Software\\Classes\\.test2", KEY_ALL_ACCESS)); + ASSERT_EQ(ERROR_SUCCESS, + key.Create(HKEY_CURRENT_USER, L"Software\\Classes\\.test2", + KEY_ALL_ACCESS)); EXPECT_EQ(ERROR_SUCCESS, key.WriteValue(L"", L"SomeOtherApp")); } @@ -856,23 +845,21 @@ // Ensure that the registry keys have been correctly set. base::win::RegKey key; std::wstring value; - ASSERT_EQ( - ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, L"Software\\Classes\\TestApp", KEY_READ)); + ASSERT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, + L"Software\\Classes\\TestApp", KEY_READ)); EXPECT_EQ(ERROR_SUCCESS, key.ReadValue(L"", &value)); EXPECT_EQ(L"Test File Type", value); EXPECT_EQ(ERROR_SUCCESS, key.ReadValue(L"FileExtensions", &value)); EXPECT_EQ(L".test1;.test2", value); ASSERT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, - L"Software\\Classes\\TestApp\\DefaultIcon", - KEY_READ)); + L"Software\\Classes\\TestApp\\DefaultIcon", KEY_READ)); EXPECT_EQ(ERROR_SUCCESS, key.ReadValue(L"", &value)); EXPECT_EQ(L"D:\\test.ico,0", value); - ASSERT_EQ(ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, - L"Software\\Classes\\TestApp\\shell\\open\\command", - KEY_READ)); + ASSERT_EQ( + ERROR_SUCCESS, + key.Open(HKEY_CURRENT_USER, + L"Software\\Classes\\TestApp\\shell\\open\\command", KEY_READ)); EXPECT_EQ(ERROR_SUCCESS, key.ReadValue(L"", &value)); EXPECT_EQ(L"\"C:\\test.exe\" --single-argument=%1", value); @@ -888,30 +875,26 @@ } // .test1 should be default-associated with our test app. - ASSERT_EQ( - ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, L"Software\\Classes\\.test1", KEY_READ)); + ASSERT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, + L"Software\\Classes\\.test1", KEY_READ)); EXPECT_EQ(ERROR_SUCCESS, key.ReadValue(L"", &value)); EXPECT_EQ(L"TestApp", value); ASSERT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, - L"Software\\Classes\\.test1\\OpenWithProgids", - KEY_READ)); + L"Software\\Classes\\.test1\\OpenWithProgids", KEY_READ)); EXPECT_TRUE(key.HasValue(L"TestApp")); EXPECT_EQ(ERROR_SUCCESS, key.ReadValue(L"TestApp", &value)); EXPECT_EQ(L"", value); // .test2 should still be associated with the other app (should not have been // overridden). But it should have our app in its Open With list. - ASSERT_EQ( - ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, L"Software\\Classes\\.test2", KEY_READ)); + ASSERT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, + L"Software\\Classes\\.test2", KEY_READ)); EXPECT_EQ(ERROR_SUCCESS, key.ReadValue(L"", &value)); EXPECT_EQ(L"SomeOtherApp", value); ASSERT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, - L"Software\\Classes\\.test2\\OpenWithProgids", - KEY_READ)); + L"Software\\Classes\\.test2\\OpenWithProgids", KEY_READ)); EXPECT_TRUE(key.HasValue(L"TestApp")); EXPECT_EQ(ERROR_SUCCESS, key.ReadValue(L"TestApp", &value)); EXPECT_EQ(L"", value); @@ -929,9 +912,8 @@ // The class key should have been completely deleted. base::win::RegKey key; std::wstring value; - ASSERT_NE( - ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, L"Software\\Classes\\TestApp", KEY_READ)); + ASSERT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, + L"Software\\Classes\\TestApp", KEY_READ)); // .test1 and .test2 should no longer be associated with the test app. ASSERT_EQ(ERROR_SUCCESS, @@ -949,9 +931,8 @@ EXPECT_FALSE(key.HasValue(L"")); // .test2 should still have the other app as its default handler. - ASSERT_EQ( - ERROR_SUCCESS, - key.Open(HKEY_CURRENT_USER, L"Software\\Classes\\.test2", KEY_READ)); + ASSERT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, + L"Software\\Classes\\.test2", KEY_READ)); EXPECT_EQ(ERROR_SUCCESS, key.ReadValue(L"", &value)); EXPECT_EQ(L"SomeOtherApp", value); } @@ -1027,9 +1008,9 @@ TEST(ShellUtilTest, BuildAppModelIdLongEverything) { std::vector<base::string16> components; - const base::string16 long_appname(L"Chrome.a_user_who_has_a_crazy_long_name_" - L"with_some_weird@symbols_in_" - L"it_" L"that_goes_over_64_characters"); + const base::string16 long_appname( + L"Chrome.a_user_who_has_a_crazy_long_name_with_some_weird@symbols_in_it_" + L"that_goes_over_64_characters"); components.push_back(long_appname); components.push_back( L"A_crazy_profile_name_not_even_sure_whether_that_is_possible");
diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc index 4e6edca..1debd28f 100644 --- a/chrome/installer/util/util_constants.cc +++ b/chrome/installer/util/util_constants.cc
@@ -11,7 +11,7 @@ // Allow an update of Chrome from a higher version to a lower version. // Ordinarily, such downgrades are disallowed. An administrator may wish to // allow them in circumstances where the potential loss of user data is -// permissable. +// permissible. const char kAllowDowngrade[] = "allow-downgrade"; // Create shortcuts for this user to point to a system-level install (which @@ -52,7 +52,7 @@ const char kEnableLogging[] = "enable-logging"; // Same as kConfigureUserSettings above; except the checks to know whether -// first run already occured are bypassed and shortcuts are created either way +// first run already occurred are bypassed and shortcuts are created either way // (kConfigureUserSettings also needs to be on the command-line for this to have // any effect). const char kForceConfigureUserSettings[] = "force-configure-user-settings";
diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h index 6e586f25..411645b 100644 --- a/chrome/installer/util/util_constants.h +++ b/chrome/installer/util/util_constants.h
@@ -19,45 +19,45 @@ // value in a comment for posterity's sake, but take the liberty of removing the // old doc string. enum InstallStatus { - FIRST_INSTALL_SUCCESS = 0, // First install of Chrome succeeded. - INSTALL_REPAIRED = 1, // Same version reinstalled for repair. - NEW_VERSION_UPDATED = 2, // Chrome successfully updated to new version. + FIRST_INSTALL_SUCCESS = 0, // First install of Chrome succeeded. + INSTALL_REPAIRED = 1, // Same version reinstalled for repair. + NEW_VERSION_UPDATED = 2, // Chrome successfully updated to new version. EXISTING_VERSION_LAUNCHED = 3, // No work done; launched existing Chrome. - HIGHER_VERSION_EXISTS = 4, // Higher version of Chrome already exists + HIGHER_VERSION_EXISTS = 4, // Higher version of Chrome already exists USER_LEVEL_INSTALL_EXISTS = 5, // User level install already exists. SYSTEM_LEVEL_INSTALL_EXISTS = 6, // Machine level install already exists. - INSTALL_FAILED = 7, // Install/update failed. - SETUP_PATCH_FAILED = 8, // Failed to patch setup.exe. - OS_NOT_SUPPORTED = 9, // Current OS not supported. - OS_ERROR = 10, // OS API call failed. - TEMP_DIR_FAILED = 11, // Unable to get Temp directory. - UNCOMPRESSION_FAILED = 12, // Failed to uncompress Chrome archive. - INVALID_ARCHIVE = 13, // Something wrong with the installer archive. - INSUFFICIENT_RIGHTS = 14, // User trying system level install is not Admin. + INSTALL_FAILED = 7, // Install/update failed. + SETUP_PATCH_FAILED = 8, // Failed to patch setup.exe. + OS_NOT_SUPPORTED = 9, // Current OS not supported. + OS_ERROR = 10, // OS API call failed. + TEMP_DIR_FAILED = 11, // Unable to get Temp directory. + UNCOMPRESSION_FAILED = 12, // Failed to uncompress Chrome archive. + INVALID_ARCHIVE = 13, // Something wrong with the installer archive. + INSUFFICIENT_RIGHTS = 14, // User trying system level install is not Admin. CHROME_NOT_INSTALLED = 15, // Chrome not installed (returned in case of // uninstall). - CHROME_RUNNING = 16, // Chrome currently running (when trying to + CHROME_RUNNING = 16, // Chrome currently running (when trying to // uninstall). - UNINSTALL_CONFIRMED = 17, // User has confirmed Chrome uninstall. + UNINSTALL_CONFIRMED = 17, // User has confirmed Chrome uninstall. UNINSTALL_DELETE_PROFILE = 18, // User okayed uninstall and profile deletion. - UNINSTALL_SUCCESSFUL = 19, // Chrome successfully uninstalled. - UNINSTALL_FAILED = 20, // Chrome uninstallation failed. - UNINSTALL_CANCELLED = 21, // User cancelled Chrome uninstallation. - UNKNOWN_STATUS = 22, // Unknown status (this should never happen). - RENAME_SUCCESSFUL = 23, // Rename of new_chrome.exe to chrome.exe worked. - RENAME_FAILED = 24, // Rename of new_chrome.exe failed. - EULA_REJECTED = 25, // EULA dialog was not accepted by user. - EULA_ACCEPTED = 26, // EULA dialog was accepted by user. + UNINSTALL_SUCCESSFUL = 19, // Chrome successfully uninstalled. + UNINSTALL_FAILED = 20, // Chrome uninstallation failed. + UNINSTALL_CANCELLED = 21, // User cancelled Chrome uninstallation. + UNKNOWN_STATUS = 22, // Unknown status (this should never happen). + RENAME_SUCCESSFUL = 23, // Rename of new_chrome.exe to chrome.exe worked. + RENAME_FAILED = 24, // Rename of new_chrome.exe failed. + EULA_REJECTED = 25, // EULA dialog was not accepted by user. + EULA_ACCEPTED = 26, // EULA dialog was accepted by user. EULA_ACCEPTED_OPT_IN = 27, // EULA accepted with the crash option selected. - INSTALL_DIR_IN_USE = 28, // Installation directory is in use by another + INSTALL_DIR_IN_USE = 28, // Installation directory is in use by another // process UNINSTALL_REQUIRES_REBOOT = 29, // Uninstallation required a reboot. - IN_USE_UPDATED = 30, // Chrome successfully updated but old version - // running. + IN_USE_UPDATED = 30, // Chrome successfully updated but old version + // running. SAME_VERSION_REPAIR_FAILED = 31, // Chrome repair failed as Chrome was // running. - REENTRY_SYS_UPDATE = 32, // Setup has been re-launched as the interactive - // user. + REENTRY_SYS_UPDATE = 32, // Setup has been re-launched as the interactive + // user. SXS_OPTION_NOT_SUPPORTED = 33, // The chrome-sxs option provided does not // work with other command line options. // NON_MULTI_INSTALLATION_EXISTS = 34, @@ -76,31 +76,31 @@ INVALID_STATE_FOR_OPTION = 47, // A non-install option was called with an // invalid installer state. // WAIT_FOR_EXISTING_FAILED = 48, - PATCH_INVALID_ARGUMENTS = 49, // The arguments of --patch were missing or - // they were invalid for any reason. + PATCH_INVALID_ARGUMENTS = 49, // The arguments of --patch were missing or + // they were invalid for any reason. DIFF_PATCH_SOURCE_MISSING = 50, // No previous version archive found for // differential update. // UNUSED_BINARIES = 51, // UNUSED_BINARIES_UNINSTALLED = 52, - UNSUPPORTED_OPTION = 53, // An unsupported legacy option was given. - CPU_NOT_SUPPORTED = 54, // Current OS not supported + UNSUPPORTED_OPTION = 53, // An unsupported legacy option was given. + CPU_NOT_SUPPORTED = 54, // Current OS not supported REENABLE_UPDATES_SUCCEEDED = 55, // Autoupdates are now enabled. - REENABLE_UPDATES_FAILED = 56, // Autoupdates could not be enabled. - UNPACKING_FAILED = 57, // Unpacking the (possibly patched) uncompressed - // archive failed. - IN_USE_DOWNGRADE = 58, // Successfully downgrade chrome but current - // version is still running. + REENABLE_UPDATES_FAILED = 56, // Autoupdates could not be enabled. + UNPACKING_FAILED = 57, // Unpacking the (possibly patched) uncompressed + // archive failed. + IN_USE_DOWNGRADE = 58, // Successfully downgrade chrome but current + // version is still running. OLD_VERSION_DOWNGRADE = 59, // Successfully downgrade chrome to an older // version. SETUP_SINGLETON_ACQUISITION_FAILED = 60, // The setup process could not // acquire the exclusive right to // modify the Chrome installation. - SETUP_SINGLETON_RELEASED = 61, // The task did not complete because + SETUP_SINGLETON_RELEASED = 61, // The task did not complete because // another process asked this // process to release the exclusive // right to modify the Chrome // installation. - DELETE_OLD_VERSIONS_SUCCESS = 62, // All files that belong to old + DELETE_OLD_VERSIONS_SUCCESS = 62, // All files that belong to old // versions of Chrome were // successfully deleted. DELETE_OLD_VERSIONS_TOO_MANY_ATTEMPTS = 63, // A --delete-old-versions @@ -108,12 +108,12 @@ // delete all files that belong // to old versions of Chrome too // many times without success. - STORE_DMTOKEN_FAILED = 64, // Failed to write the specified DMToken to the - // registry. + STORE_DMTOKEN_FAILED = 64, // Failed to write the specified DMToken to the + // registry. STORE_DMTOKEN_SUCCESS = 65, // Writing the specified DMToken to the registry // succeeded. - MAX_INSTALL_STATUS = 66, // When adding a new result, bump this and update - // the InstallStatus enum in histograms.xml. + MAX_INSTALL_STATUS = 66, // When adding a new result, bump this and update + // the InstallStatus enum in histograms.xml. }; // The type of an update archive.
diff --git a/chrome/installer/util/work_item.cc b/chrome/installer/util/work_item.cc index f03d12a..d089915 100644 --- a/chrome/installer/util/work_item.cc +++ b/chrome/installer/util/work_item.cc
@@ -62,8 +62,8 @@ const std::wstring& key_path, REGSAM wow64_access, const std::wstring& value_name) { - return new DeleteRegValueWorkItem( - predefined_root, key_path, wow64_access, value_name); + return new DeleteRegValueWorkItem(predefined_root, key_path, wow64_access, + value_name); } DeleteTreeWorkItem* WorkItem::CreateDeleteTreeWorkItem( @@ -77,9 +77,7 @@ const base::FilePath& dest_path, const base::FilePath& temp_path, MoveTreeOption duplicate_option) { - return new MoveTreeWorkItem(source_path, - dest_path, - temp_path, + return new MoveTreeWorkItem(source_path, dest_path, temp_path, duplicate_option); } @@ -90,12 +88,8 @@ const std::wstring& value_name, const std::wstring& value_data, bool overwrite) { - return new SetRegValueWorkItem(predefined_root, - key_path, - wow64_access, - value_name, - value_data, - overwrite); + return new SetRegValueWorkItem(predefined_root, key_path, wow64_access, + value_name, value_data, overwrite); } SetRegValueWorkItem* WorkItem::CreateSetRegValueWorkItem( @@ -105,12 +99,8 @@ const std::wstring& value_name, DWORD value_data, bool overwrite) { - return new SetRegValueWorkItem(predefined_root, - key_path, - wow64_access, - value_name, - value_data, - overwrite); + return new SetRegValueWorkItem(predefined_root, key_path, wow64_access, + value_name, value_data, overwrite); } SetRegValueWorkItem* WorkItem::CreateSetRegValueWorkItem( @@ -120,12 +110,8 @@ const std::wstring& value_name, int64_t value_data, bool overwrite) { - return new SetRegValueWorkItem(predefined_root, - key_path, - wow64_access, - value_name, - value_data, - overwrite); + return new SetRegValueWorkItem(predefined_root, key_path, wow64_access, + value_name, value_data, overwrite); } SetRegValueWorkItem* WorkItem::CreateSetRegValueWorkItem(
diff --git a/chrome/installer/util/work_item.h b/chrome/installer/util/work_item.h index 5d1bf81..9adf3bb 100644 --- a/chrome/installer/util/work_item.h +++ b/chrome/installer/util/work_item.h
@@ -10,6 +10,7 @@ #define CHROME_INSTALLER_UTIL_WORK_ITEM_H_ #include <windows.h> + #include <stdint.h> #include <string> @@ -69,16 +70,16 @@ static const REGSAM kWow64Default = 0; // Possible states enum CopyOverWriteOption { - ALWAYS, // Always overwrite regardless of what existed before. - NEVER, // Not used currently. - IF_DIFFERENT, // Overwrite if different. Currently only applies to file. + ALWAYS, // Always overwrite regardless of what existed before. + NEVER, // Not used currently. + IF_DIFFERENT, // Overwrite if different. Currently only applies to file. IF_NOT_PRESENT, // Copy only if file/directory do not exist already. NEW_NAME_IF_IN_USE // Copy to a new path if dest is in use(only files). }; // Options for the MoveTree work item. enum MoveTreeOption { - ALWAYS_MOVE, // Always attempt to do a move operation. + ALWAYS_MOVE, // Always attempt to do a move operation. CHECK_DUPLICATES // Only move if the move target is different. };
diff --git a/chrome/installer/util/work_item_list.cc b/chrome/installer/util/work_item_list.cc index 55cddd3..c3485a0 100644 --- a/chrome/installer/util/work_item_list.cc +++ b/chrome/installer/util/work_item_list.cc
@@ -149,12 +149,9 @@ const std::wstring& value_name, const std::wstring& value_data, bool overwrite) { - WorkItem* item = WorkItem::CreateSetRegValueWorkItem(predefined_root, - key_path, - wow64_access, - value_name, - value_data, - overwrite); + WorkItem* item = WorkItem::CreateSetRegValueWorkItem( + predefined_root, key_path, wow64_access, value_name, value_data, + overwrite); AddWorkItem(item); return item; } @@ -165,12 +162,9 @@ const std::wstring& value_name, DWORD value_data, bool overwrite) { - WorkItem* item = WorkItem::CreateSetRegValueWorkItem(predefined_root, - key_path, - wow64_access, - value_name, - value_data, - overwrite); + WorkItem* item = WorkItem::CreateSetRegValueWorkItem( + predefined_root, key_path, wow64_access, value_name, value_data, + overwrite); AddWorkItem(item); return item; } @@ -181,13 +175,10 @@ const std::wstring& value_name, int64_t value_data, bool overwrite) { - WorkItem* item = reinterpret_cast<WorkItem*>( - WorkItem::CreateSetRegValueWorkItem(predefined_root, - key_path, - wow64_access, - value_name, - value_data, - overwrite)); + WorkItem* item = + reinterpret_cast<WorkItem*>(WorkItem::CreateSetRegValueWorkItem( + predefined_root, key_path, wow64_access, value_name, value_data, + overwrite)); AddWorkItem(item); return item; }
diff --git a/chrome/installer/util/work_item_list.h b/chrome/installer/util/work_item_list.h index 7cec3d3..ac6f5c8 100644 --- a/chrome/installer/util/work_item_list.h +++ b/chrome/installer/util/work_item_list.h
@@ -6,6 +6,7 @@ #define CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_ #include <windows.h> + #include <stdint.h> #include <list>
diff --git a/chrome/renderer/BUILD.gn b/chrome/renderer/BUILD.gn index 2ea4897..48b7ecf 100644 --- a/chrome/renderer/BUILD.gn +++ b/chrome/renderer/BUILD.gn
@@ -37,7 +37,10 @@ "//url/mojom:url_mojom_origin_js", ] if (is_chromeos) { - deps += [ "//chromeos/services/ime/public/mojom:mojom_js" ] + deps += [ + "//chromeos/services/ime/public/mojom:mojom_js", + "//chromeos/services/tts/public/mojom:mojom_js", + ] } }
diff --git a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc index 6621279..457f188 100644 --- a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc +++ b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
@@ -179,6 +179,10 @@ IDR_IME_SERVICE_MOJOM_JS); source_map->RegisterSource("chromeos.ime.service", IDR_IME_SERVICE_BINDINGS_JS); + + source_map->RegisterSource("chromeos.tts.mojom.tts_stream.mojom", + IDR_TTS_STREAM_MOJOM_JS); + source_map->RegisterSource("chromeos.tts.stream", IDR_TTS_STREAM_BINDINGS_JS); #endif // defined(OS_CHROMEOS) source_map->RegisterSource("cast.streaming.rtpStream",
diff --git a/chrome/renderer/resources/extensions/chromeos_tts_stream_bindings.js b/chrome/renderer/resources/extensions/chromeos_tts_stream_bindings.js new file mode 100644 index 0000000..de636071 --- /dev/null +++ b/chrome/renderer/resources/extensions/chromeos_tts_stream_bindings.js
@@ -0,0 +1,19 @@ +// 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. + +'use strict'; + +if ((typeof mojo === 'undefined') || !mojo.bindingsLibraryInitialized) { + loadScript('mojo_bindings'); +} +mojo.config.autoLoadMojomDeps = false; + +loadScript('chromeos.tts.mojom.tts_stream.mojom'); + +(function() { + let ptr = new chromeos.tts.mojom.TtsStreamPtr; + Mojo.bindInterface( + chromeos.tts.mojom.TtsStream.name, mojo.makeRequest(ptr).handle); + exports.$set('returnValue', ptr); +})();
diff --git a/chrome/renderer/resources/renderer_resources.grd b/chrome/renderer/resources/renderer_resources.grd index 3f31e15..39e222a 100644 --- a/chrome/renderer/resources/renderer_resources.grd +++ b/chrome/renderer/resources/renderer_resources.grd
@@ -72,6 +72,9 @@ <!-- ChromeOS IME Mojo service and bindings. --> <include name="IDR_IME_SERVICE_BINDINGS_JS" file="extensions\chromeos_ime_service_bindings.js" type="BINDATA" /> <include name="IDR_IME_SERVICE_MOJOM_JS" file="${mojom_root}\chromeos/services/ime/public/mojom/input_engine.mojom.js" use_base_dir="false" type="BINDATA" /> + + <include name="IDR_TTS_STREAM_BINDINGS_JS" file="extensions\chromeos_tts_stream_bindings.js" type="BINDATA" /> + <include name="IDR_TTS_STREAM_MOJOM_JS" file="${mojom_root}\chromeos/services/tts/public/mojom/tts_service.mojom.js" use_base_dir="false" type="BINDATA" /> </if> <!-- Media Router Mojo service and bindings. --> <include name="IDR_MEDIA_CONTROLLER_MOJOM_JS" file="${mojom_root}\chrome\common\media_router\mojom\media_controller.mojom.js" use_base_dir="false" type="BINDATA" />
diff --git a/chrome/services/keymaster/public/mojom/cert_store.mojom b/chrome/services/keymaster/public/mojom/cert_store.mojom index 9a705c1..d5c0739 100644 --- a/chrome/services/keymaster/public/mojom/cert_store.mojom +++ b/chrome/services/keymaster/public/mojom/cert_store.mojom
@@ -37,14 +37,15 @@ // Next method ID: 1 interface CertStoreHost { // Returns an interface to SecurityTokenOperation. - GetSecurityTokenOperation@0(SecurityTokenOperation& operation) => (); + GetSecurityTokenOperation@0( + pending_receiver<SecurityTokenOperation> operation) => (); }; // Interface exposed by arc-keymaster daemon. // Next method ID: 1 interface CertStoreInstance { // Establishes full-duplex communication with the host. - Init@0(CertStoreHost host_ptr) => (); + Init@0(pending_remote<CertStoreHost> host_remote) => (); }; // Implemented in Chrome.
diff --git a/chrome/test/data/extensions/api_test/sync_file_system/request_file_system/test.js b/chrome/test/data/extensions/api_test/sync_file_system/request_file_system/test.js index 9adac48..babd60dc 100644 --- a/chrome/test/data/extensions/api_test/sync_file_system/request_file_system/test.js +++ b/chrome/test/data/extensions/api_test/sync_file_system/request_file_system/test.js
@@ -8,10 +8,11 @@ function requestFileSystem() { chrome.syncFileSystem.requestFileSystem( chrome.test.callbackPass(function(fs) { - chrome.test.assertEq('DOMFileSystem', fs.constructor.name); chrome.test.assertTrue(fs.name != undefined); chrome.test.assertEq(fs.name.length - syncableNameSuffix.length, fs.name.lastIndexOf(syncableNameSuffix)); + chrome.test.assertTrue(fs.root != undefined); + chrome.test.assertTrue(fs.root.isFile || fs.root.isDirectory); })); } ]);
diff --git a/chrome/test/data/webui/settings/passwords_section_test.js b/chrome/test/data/webui/settings/passwords_section_test.js index e8e714eb..d8d9a58 100644 --- a/chrome/test/data/webui/settings/passwords_section_test.js +++ b/chrome/test/data/webui/settings/passwords_section_test.js
@@ -1072,7 +1072,9 @@ assertTrue(bg.includes(iconDataUrl)); }); - test('enablingSyncHidesAccountStorageOptInButtons', function() { + // Test verifies that enabling sync hides the buttons for account storage + // opt-in/out and the 'device passwords' page. + test('enablingSyncHidesAccountStorageButtons', function() { // Feature flag enabled. loadTimeData.overrideValues({enableAccountStorage: true}); @@ -1097,6 +1099,54 @@ isDisplayed(passwordsSection.$.accountStorageButtonsContainer)); }); + // Test verifies that the button linking to the 'device passwords' page is + // only visible when there is at least one device password, and that it has + // the appropriate text. + test('verifyDevicePasswordsButtonVisibility', function() { + // Set up user eligible to passwords account storage, not opted in and + // with no device passwords. Button should be hidden. + loadTimeData.overrideValues({enableAccountStorage: true}); + const passwordList = + [createPasswordEntry({fromAccountStore: true, id: 10})]; + const passwordsSection = elementFactory.createPasswordsSection( + passwordManager, passwordList, []); + simulateSyncStatus({signedIn: false}); + simulateStoredAccounts([{ + fullName: 'john doe', + givenName: 'john', + email: 'john@gmail.com', + }]); + assertTrue(passwordsSection.$.devicePasswordsLink.hidden); + + // Opting in still doesn't display it because the user has no device + // passwords yet. + passwordManager.setIsOptedInForAccountStorageAndNotify(true); + assertTrue(passwordsSection.$.devicePasswordsLink.hidden); + + // Add a device password. The button shows up, with the text in singular + // form. + passwordList.unshift( + createPasswordEntry({fromAccountStore: false, id: 20})); + passwordManager.lastCallback.addSavedPasswordListChangedListener( + passwordList); + flush(); + assertFalse(passwordsSection.$.devicePasswordsLink.hidden); + assertEquals( + passwordsSection.i18n('devicePasswordsLinkLabelSingular'), + passwordsSection.$.devicePasswordsLinkLabel.innerText); + + // Add a second device password. The text nows says '2 passwords'. + passwordList.unshift( + createPasswordEntry({fromAccountStore: false, id: 30})); + passwordManager.lastCallback.addSavedPasswordListChangedListener( + passwordList); + flush(); + assertFalse(passwordsSection.$.devicePasswordsLink.hidden); + assertEquals( + passwordsSection.i18n('devicePasswordsLinkLabelPlural', 2), + passwordsSection.$.devicePasswordsLinkLabel.innerText); + }); + // Test verifies that the notification displayed after removing a password // informs whether the password was stored on the device, in the account or // in both, for users in account storage mode.
diff --git a/chrome/utility/BUILD.gn b/chrome/utility/BUILD.gn index 671a8f21..3c3fb97 100644 --- a/chrome/utility/BUILD.gn +++ b/chrome/utility/BUILD.gn
@@ -160,6 +160,8 @@ "//chromeos/assistant:buildflags", "//chromeos/services/ime:lib", "//chromeos/services/ime/public/mojom", + "//chromeos/services/tts", + "//chromeos/services/tts/public/mojom", ] if (enable_cros_libassistant) {
diff --git a/chrome/utility/DEPS b/chrome/utility/DEPS index 2228e7b..e25c4fb6 100644 --- a/chrome/utility/DEPS +++ b/chrome/utility/DEPS
@@ -21,6 +21,7 @@ "+chromeos/services/assistant", "+chromeos/services/ime/ime_service.h", "+chromeos/services/ime/public/mojom", + "+chromeos/services/tts", "+components/crash/core/common/crash_keys.h", "+components/mirroring/mojom", "+components/mirroring/service",
diff --git a/chrome/utility/services.cc b/chrome/utility/services.cc index 61a7bf55..7c84dbb 100644 --- a/chrome/utility/services.cc +++ b/chrome/utility/services.cc
@@ -84,6 +84,8 @@ #include "chromeos/assistant/buildflags.h" // nogncheck #include "chromeos/services/ime/ime_service.h" #include "chromeos/services/ime/public/mojom/input_engine.mojom.h" +#include "chromeos/services/tts/public/mojom/tts_service.mojom.h" +#include "chromeos/services/tts/tts_service.h" #if BUILDFLAG(ENABLE_CROS_LIBASSISTANT) #include "chromeos/services/assistant/audio_decoder/assistant_audio_decoder_factory.h" // nogncheck @@ -217,6 +219,11 @@ return std::make_unique<chromeos::ime::ImeService>(std::move(receiver)); } +auto RunTtsService( + mojo::PendingReceiver<chromeos::tts::mojom::TtsService> receiver) { + return std::make_unique<chromeos::tts::TtsService>(std::move(receiver)); +} + #if BUILDFLAG(ENABLE_CROS_LIBASSISTANT) auto RunAssistantAudioDecoder( mojo::PendingReceiver< @@ -295,6 +302,7 @@ #if defined(OS_CHROMEOS) RunImeService, + RunTtsService, #if BUILDFLAG(ENABLE_CROS_LIBASSISTANT) RunAssistantAudioDecoder, #endif
diff --git a/chromecast/browser/cast_web_contents_impl.cc b/chromecast/browser/cast_web_contents_impl.cc index 47a309b..a324304 100644 --- a/chromecast/browser/cast_web_contents_impl.cc +++ b/chromecast/browser/cast_web_contents_impl.cc
@@ -930,6 +930,7 @@ } void CastWebContentsImpl::DidUpdateFaviconURL( + content::RenderFrameHost* render_frame_host, const std::vector<blink::mojom::FaviconURLPtr>& candidates) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/chromecast/browser/cast_web_contents_impl.h b/chromecast/browser/cast_web_contents_impl.h index 0e1f8cfd..6c2a8cb 100644 --- a/chromecast/browser/cast_web_contents_impl.h +++ b/chromecast/browser/cast_web_contents_impl.h
@@ -126,6 +126,7 @@ void DidFirstVisuallyNonEmptyPaint() override; void WebContentsDestroyed() override; void DidUpdateFaviconURL( + content::RenderFrameHost* render_frame_host, const std::vector<blink::mojom::FaviconURLPtr>& candidates) override; void MediaStartedPlaying(const MediaPlayerInfo& video_type, const content::MediaPlayerId& id) override;
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index 54a9c33..6524b89 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -13270.0.0 \ No newline at end of file +13272.0.0 \ No newline at end of file
diff --git a/chromeos/components/BUILD.gn b/chromeos/components/BUILD.gn index 1a91679..bfdf700 100644 --- a/chromeos/components/BUILD.gn +++ b/chromeos/components/BUILD.gn
@@ -35,6 +35,7 @@ group("closure_compile") { testonly = true deps = [ + "//chromeos/components/camera_app_ui:closure_compile", "//chromeos/components/help_app_ui:closure_compile", "//chromeos/components/media_app_ui:closure_compile", "//chromeos/components/multidevice/debug_webui/resources:closure_compile",
diff --git a/chromeos/components/camera_app_ui/BUILD.gn b/chromeos/components/camera_app_ui/BUILD.gn new file mode 100644 index 0000000..44365f15 --- /dev/null +++ b/chromeos/components/camera_app_ui/BUILD.gn
@@ -0,0 +1,51 @@ +# 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("//mojo/public/tools/bindings/mojom.gni") +import("//third_party/closure_compiler/compile_js.gni") + +assert(is_chromeos, "Camera App is Chrome OS only") + +static_library("camera_app_ui") { + sources = [ + "camera_app_helper_impl.cc", + "camera_app_helper_impl.h", + "camera_app_ui.cc", + "camera_app_ui.h", + "url_constants.cc", + "url_constants.h", + ] + + deps = [ + ":mojo_bindings", + ":mojo_bindings_js", + "//ash/public/cpp", + "//chromeos/components/web_applications", + "//chromeos/constants", + "//chromeos/resources:camera_app_resources", + "//chromeos/strings", + "//chromeos/system", + "//content/public/browser", + "//content/public/common", + "//media/capture:capture_lib", + "//mojo/public/cpp/bindings", + "//mojo/public/cpp/platform", + "//mojo/public/js:resources_grit", + "//ui/resources:webui_resources_grd_grit", + "//ui/webui", + ] +} + +group("closure_compile") { + testonly = true + deps = [ + "resources:closure_compile", + ] +} + +mojom("mojo_bindings") { + sources = [ "camera_app_helper.mojom" ] + + deps = [ "//components/arc/mojom:camera_intent" ] +}
diff --git a/chromeos/components/camera_app_ui/DEPS b/chromeos/components/camera_app_ui/DEPS new file mode 100644 index 0000000..7d83b5e --- /dev/null +++ b/chromeos/components/camera_app_ui/DEPS
@@ -0,0 +1,6 @@ +include_rules = [ + "+ash/public/cpp", + "+content/public/browser", + "+ui/aura", + "+ui/webui", +]
diff --git a/chromeos/components/camera_app_ui/OWNERS b/chromeos/components/camera_app_ui/OWNERS new file mode 100644 index 0000000..29ab2a0 --- /dev/null +++ b/chromeos/components/camera_app_ui/OWNERS
@@ -0,0 +1,12 @@ +henryhsu@chromium.org +inker@chromium.org +jcliang@chromium.org +shik@chromium.org +wtlee@chromium.org +yuli@chromium.org + +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS + +# TEAM: chromeos-camera@chromium.org +# COMPONENT: Platform>Apps>Camera
diff --git a/components/chromeos_camera/common/camera_app_helper.mojom b/chromeos/components/camera_app_ui/camera_app_helper.mojom similarity index 100% rename from components/chromeos_camera/common/camera_app_helper.mojom rename to chromeos/components/camera_app_ui/camera_app_helper.mojom
diff --git a/components/chromeos_camera/camera_app_helper_impl.cc b/chromeos/components/camera_app_ui/camera_app_helper_impl.cc similarity index 96% rename from components/chromeos_camera/camera_app_helper_impl.cc rename to chromeos/components/camera_app_ui/camera_app_helper_impl.cc index cb4a5c8..80d3814 100644 --- a/components/chromeos_camera/camera_app_helper_impl.cc +++ b/chromeos/components/camera_app_ui/camera_app_helper_impl.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/chromeos_camera/camera_app_helper_impl.h" +#include "chromeos/components/camera_app_ui/camera_app_helper_impl.h" #include <utility>
diff --git a/components/chromeos_camera/camera_app_helper_impl.h b/chromeos/components/camera_app_ui/camera_app_helper_impl.h similarity index 87% rename from components/chromeos_camera/camera_app_helper_impl.h rename to chromeos/components/camera_app_ui/camera_app_helper_impl.h index b1b8f2c..b5d6eab 100644 --- a/components/chromeos_camera/camera_app_helper_impl.h +++ b/chromeos/components/camera_app_ui/camera_app_helper_impl.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_CHROMEOS_CAMERA_CAMERA_APP_HELPER_IMPL_H_ -#define COMPONENTS_CHROMEOS_CAMERA_CAMERA_APP_HELPER_IMPL_H_ +#ifndef CHROMEOS_COMPONENTS_CAMERA_APP_UI_CAMERA_APP_HELPER_IMPL_H_ +#define CHROMEOS_COMPONENTS_CAMERA_APP_UI_CAMERA_APP_HELPER_IMPL_H_ #include <vector> #include "ash/public/cpp/tablet_mode_observer.h" #include "base/macros.h" -#include "components/chromeos_camera/common/camera_app_helper.mojom.h" +#include "chromeos/components/camera_app_ui/camera_app_helper.mojom.h" #include "mojo/public/cpp/bindings/remote.h" namespace aura { @@ -57,4 +57,4 @@ } // namespace chromeos_camera -#endif // COMPONENTS_CHROMEOS_CAMERA_CAMERA_APP_HELPER_IMPL_H_ +#endif // CHROMEOS_COMPONENTS_CAMERA_APP_UI_CAMERA_APP_HELPER_IMPL_H_
diff --git a/chromeos/components/camera_app_ui/camera_app_ui.cc b/chromeos/components/camera_app_ui/camera_app_ui.cc new file mode 100644 index 0000000..9ffe7d4 --- /dev/null +++ b/chromeos/components/camera_app_ui/camera_app_ui.cc
@@ -0,0 +1,79 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/components/camera_app_ui/camera_app_ui.h" + +#include <utility> + +#include "base/bind.h" +#include "chromeos/components/camera_app_ui/url_constants.h" +#include "chromeos/grit/chromeos_camera_app_resources.h" +#include "chromeos/grit/chromeos_camera_app_resources_map.h" +#include "content/public/browser/web_contents.h" +#include "content/public/browser/web_ui_data_source.h" +#include "mojo/public/js/grit/mojo_bindings_resources.h" + +namespace chromeos { + +namespace { + +const struct { + const char* path; + int id; +} kGritResourceMap[] = { + {"src/js/browser_proxy/browser_proxy.js", IDR_CAMERA_WEBUI_BROWSER_PROXY}, + {"src/js/mojo/camera_intent.mojom-lite.js", + IDR_CAMERA_CAMERA_INTENT_MOJOM_LITE_JS}, + {"src/js/mojo/image_capture.mojom-lite.js", + IDR_CAMERA_IMAGE_CAPTURE_MOJOM_LITE_JS}, + {"src/js/mojo/camera_common.mojom-lite.js", + IDR_CAMERA_CAMERA_COMMON_MOJOM_LITE_JS}, + {"src/js/mojo/camera_metadata.mojom-lite.js", + IDR_CAMERA_CAMERA_METADATA_MOJOM_LITE_JS}, + {"src/js/mojo/camera_metadata_tags.mojom-lite.js", + IDR_CAMERA_CAMERA_METADATA_TAGS_MOJOM_LITE_JS}, + {"src/js/mojo/camera_app.mojom-lite.js", IDR_CAMERA_APP_MOJOM_LITE_JS}, + {"src/js/mojo/mojo_bindings_lite.js", IDR_MOJO_MOJO_BINDINGS_LITE_JS}, +}; + +content::WebUIDataSource* CreateCameraAppUIHTMLSource() { + content::WebUIDataSource* source = + content::WebUIDataSource::Create(kChromeUICameraAppHost); + + // Add all settings resources. + for (size_t i = 0; i < kChromeosCameraAppResourcesSize; i++) { + source->AddResourcePath(kChromeosCameraAppResources[i].name, + kChromeosCameraAppResources[i].value); + } + + for (const auto& res : kGritResourceMap) { + source->AddResourcePath(res.path, res.id); + } + + source->UseStringsJs(); + + return source; +} + +} // namespace + +/////////////////////////////////////////////////////////////////////////////// +// +// CameraAppUI +// +/////////////////////////////////////////////////////////////////////////////// + +CameraAppUI::CameraAppUI(content::WebUI* web_ui) + : ui::MojoWebUIController(web_ui) { + content::BrowserContext* browser_context = + web_ui->GetWebContents()->GetBrowserContext(); + + // Set up the data source. + content::WebUIDataSource* source = CreateCameraAppUIHTMLSource(); + content::WebUIDataSource::Add(browser_context, source); +} + +CameraAppUI::~CameraAppUI() = default; + +} // namespace chromeos
diff --git a/chromeos/components/camera_app_ui/camera_app_ui.h b/chromeos/components/camera_app_ui/camera_app_ui.h new file mode 100644 index 0000000..64bb1c2 --- /dev/null +++ b/chromeos/components/camera_app_ui/camera_app_ui.h
@@ -0,0 +1,24 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_COMPONENTS_CAMERA_APP_UI_CAMERA_APP_UI_H_ +#define CHROMEOS_COMPONENTS_CAMERA_APP_UI_CAMERA_APP_UI_H_ + +#include "base/macros.h" +#include "ui/webui/mojo_web_ui_controller.h" + +namespace chromeos { + +class CameraAppUI : public ui::MojoWebUIController { + public: + explicit CameraAppUI(content::WebUI* web_ui); + ~CameraAppUI() override; + + private: + DISALLOW_COPY_AND_ASSIGN(CameraAppUI); +}; + +} // namespace chromeos + +#endif // CHROMEOS_COMPONENTS_CAMERA_APP_UI_CAMERA_APP_UI_H_
diff --git a/chrome/browser/resources/chromeos/camera/.clang-format b/chromeos/components/camera_app_ui/resources/.clang-format similarity index 100% rename from chrome/browser/resources/chromeos/camera/.clang-format rename to chromeos/components/camera_app_ui/resources/.clang-format
diff --git a/chrome/browser/resources/chromeos/camera/.eslintignore b/chromeos/components/camera_app_ui/resources/.eslintignore similarity index 100% rename from chrome/browser/resources/chromeos/camera/.eslintignore rename to chromeos/components/camera_app_ui/resources/.eslintignore
diff --git a/chrome/browser/resources/chromeos/camera/.eslintrc.js b/chromeos/components/camera_app_ui/resources/.eslintrc.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/.eslintrc.js rename to chromeos/components/camera_app_ui/resources/.eslintrc.js
diff --git a/chrome/browser/resources/chromeos/camera/.style.yapf b/chromeos/components/camera_app_ui/resources/.style.yapf similarity index 100% rename from chrome/browser/resources/chromeos/camera/.style.yapf rename to chromeos/components/camera_app_ui/resources/.style.yapf
diff --git a/chrome/browser/resources/chromeos/camera/BUILD.gn b/chromeos/components/camera_app_ui/resources/BUILD.gn similarity index 94% rename from chrome/browser/resources/chromeos/camera/BUILD.gn rename to chromeos/components/camera_app_ui/resources/BUILD.gn index 2931d06..1c1d921 100644 --- a/chrome/browser/resources/chromeos/camera/BUILD.gn +++ b/chromeos/components/camera_app_ui/resources/BUILD.gn
@@ -13,7 +13,7 @@ # rather than list only the folders to avoid potential building issue and ease # the difficulty to diagnose. deps = [ - "//chrome/browser/resources/chromeos/camera/src/strings:camera_strings", + "src/strings:camera_strings", ] data_deps = [ @@ -222,8 +222,8 @@ copy("chrome_camera_app_mojo_generated") { sources = [ + "$root_gen_dir/chromeos/components/camera_app_ui/camera_app_helper.mojom-lite.js", "$root_gen_dir/components/arc/mojom/camera_intent.mojom-lite.js", - "$root_gen_dir/components/chromeos_camera/common/camera_app_helper.mojom-lite.js", "$root_gen_dir/media/capture/mojom/image_capture.mojom-lite.js", "$root_gen_dir/media/capture/video/chromeos/mojom/camera_app.mojom-lite.js", "$root_gen_dir/media/capture/video/chromeos/mojom/camera_common.mojom-lite.js", @@ -237,15 +237,10 @@ ] deps = [ - "//components/arc/mojom:camera_intent_js", - "//components/arc/mojom:mojom_js", - "//components/chromeos_camera/common:camera_app_helper_js", - "//media/capture/mojom:image_capture_js", + "//chromeos/components/camera_app_ui:mojo_bindings_js", "//media/capture/video/chromeos/mojom:cros_camera_js", "//mojo/public/js:bindings_lite", "//third_party/blink/public/mojom:mojom_platform_js", - "//ui/gfx/geometry/mojom:mojom_js", - "//ui/gfx/range/mojom:mojom_js", ] outputs = [ "$chrome_camera_app_dir/js/mojo/{{source_file_part}}" ]
diff --git a/chrome/browser/resources/chromeos/camera/PRESUBMIT.cfg b/chromeos/components/camera_app_ui/resources/PRESUBMIT.cfg similarity index 100% rename from chrome/browser/resources/chromeos/camera/PRESUBMIT.cfg rename to chromeos/components/camera_app_ui/resources/PRESUBMIT.cfg
diff --git a/chrome/browser/resources/chromeos/camera/README.md b/chromeos/components/camera_app_ui/resources/README.md similarity index 100% rename from chrome/browser/resources/chromeos/camera/README.md rename to chromeos/components/camera_app_ui/resources/README.md
diff --git a/chrome/browser/resources/chromeos/camera/camera_resources.grd b/chromeos/components/camera_app_ui/resources/camera_app_resources.grd similarity index 96% rename from chrome/browser/resources/chromeos/camera/camera_resources.grd rename to chromeos/components/camera_app_ui/resources/camera_app_resources.grd index 66dd27b0..486eebc 100644 --- a/chrome/browser/resources/chromeos/camera/camera_resources.grd +++ b/chromeos/components/camera_app_ui/resources/camera_app_resources.grd
@@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <grit latest_public_release="0" current_release="1" output_all_resource_defines="false"> <outputs> - <output filename="grit/camera_resources.h" type="rc_header"> + <output filename="grit/chromeos_camera_app_resources.h" type="rc_header"> <emit emit_type='prepend'></emit> </output> - <output filename="grit/camera_resources_map.cc" + <output filename="grit/chromeos_camera_app_resources_map.cc" type="resource_file_map_source" /> - <output filename="grit/camera_resources_map.h" + <output filename="grit/chromeos_camera_app_resources_map.h" type="resource_map_header" /> - <output filename="camera_resources.pak" type="data_package" /> + <output filename="chromeos_camera_app_resources.pak" type="data_package" /> </outputs> <release seq="1"> <structures> @@ -46,6 +46,7 @@ <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_PWA_HTML" file="pwa.html" type="chrome_html" /> <structure name="IDR_CAMERA_RECORDTIME_JS" file="src/js/views/camera/recordtime.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" />
diff --git a/chrome/browser/resources/chromeos/camera/cca b/chromeos/components/camera_app_ui/resources/cca similarity index 100% rename from chrome/browser/resources/chromeos/camera/cca rename to chromeos/components/camera_app_ui/resources/cca
diff --git a/chrome/browser/resources/chromeos/camera/manifest.json b/chromeos/components/camera_app_ui/resources/manifest.json similarity index 100% rename from chrome/browser/resources/chromeos/camera/manifest.json rename to chromeos/components/camera_app_ui/resources/manifest.json
diff --git a/chromeos/components/camera_app_ui/resources/pwa.html b/chromeos/components/camera_app_ui/resources/pwa.html new file mode 100644 index 0000000..9c99cdde --- /dev/null +++ b/chromeos/components/camera_app_ui/resources/pwa.html
@@ -0,0 +1,6 @@ +<!-- 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. --> +<!-- TODO(crbug/896575): Delete when manifest URL installs are implemented. --> +<!DOCTYPE html> +<link rel="manifest" href="manifest.json">
diff --git a/chrome/browser/resources/chromeos/camera/pylintrc b/chromeos/components/camera_app_ui/resources/pylintrc similarity index 100% rename from chrome/browser/resources/chromeos/camera/pylintrc rename to chromeos/components/camera_app_ui/resources/pylintrc
diff --git a/chrome/browser/resources/chromeos/camera/src/LICENSE b/chromeos/components/camera_app_ui/resources/src/LICENSE similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/LICENSE rename to chromeos/components/camera_app_ui/resources/src/LICENSE
diff --git a/chrome/browser/resources/chromeos/camera/src/css/main.css b/chromeos/components/camera_app_ui/resources/src/css/main.css similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/css/main.css rename to chromeos/components/camera_app_ui/resources/src/css/main.css
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_app_icons_128.png b/chromeos/components/camera_app_ui/resources/src/images/camera_app_icons_128.png similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_app_icons_128.png rename to chromeos/components/camera_app_ui/resources/src/images/camera_app_icons_128.png Binary files differ
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_app_icons_192.png b/chromeos/components/camera_app_ui/resources/src/images/camera_app_icons_192.png similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_app_icons_192.png rename to chromeos/components/camera_app_ui/resources/src/images/camera_app_icons_192.png Binary files differ
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_app_icons_48.png b/chromeos/components/camera_app_ui/resources/src/images/camera_app_icons_48.png similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_app_icons_48.png rename to chromeos/components/camera_app_ui/resources/src/images/camera_app_icons_48.png Binary files differ
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_button_fps_30.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_button_fps_30.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_button_fps_30.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_button_fps_30.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_button_fps_60.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_button_fps_60.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_button_fps_60.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_button_fps_60.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_button_grid_off.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_button_grid_off.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_button_grid_off.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_button_grid_off.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_button_grid_on.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_button_grid_on.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_button_grid_on.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_button_grid_on.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_button_mic_off.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_button_mic_off.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_button_mic_off.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_button_mic_off.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_button_mic_on.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_button_mic_on.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_button_mic_on.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_button_mic_on.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_button_mirror_off.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_button_mirror_off.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_button_mirror_off.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_button_mirror_off.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_button_mirror_on.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_button_mirror_on.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_button_mirror_on.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_button_mirror_on.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_button_settings.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_button_settings.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_button_settings.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_button_settings.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_button_switch_device.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_button_switch_device.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_button_switch_device.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_button_switch_device.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_button_switch_photo.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_button_switch_photo.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_button_switch_photo.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_button_switch_photo.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_button_switch_video.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_button_switch_video.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_button_switch_video.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_button_switch_video.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_button_timer_off.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_button_timer_off.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_button_timer_off.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_button_timer_off.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_button_timer_on_10s.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_button_timer_on_10s.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_button_timer_on_10s.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_button_timer_on_10s.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_button_timer_on_3s.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_button_timer_on_3s.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_button_timer_on_3s.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_button_timer_on_3s.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_focus_aim.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_focus_aim.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_focus_aim.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_focus_aim.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_intent_play_video.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_intent_play_video.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_intent_play_video.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_intent_play_video.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_intent_result_cancel.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_intent_result_cancel.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_intent_result_cancel.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_intent_result_cancel.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_intent_result_confirm.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_intent_result_confirm.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_intent_result_confirm.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_intent_result_confirm.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_mode_photo.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_mode_photo.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_mode_photo.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_mode_photo.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_mode_portrait.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_mode_portrait.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_mode_portrait.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_mode_portrait.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_mode_square.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_mode_square.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_mode_square.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_mode_square.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_mode_video.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_mode_video.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_mode_video.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_mode_video.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_shutter_photo_start.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_start.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_shutter_photo_start.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_start.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_shutter_photo_start_active.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_start_active.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_shutter_photo_start_active.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_start_active.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_shutter_photo_start_hover.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_start_hover.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_shutter_photo_start_hover.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_start_hover.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_shutter_photo_stop.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_stop.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_shutter_photo_stop.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_stop.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/camera_shutter_photo_stop_hover.svg b/chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_stop_hover.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/camera_shutter_photo_stop_hover.svg rename to chromeos/components/camera_app_ui/resources/src/images/camera_shutter_photo_stop_hover.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/settings_button_back.svg b/chromeos/components/camera_app_ui/resources/src/images/settings_button_back.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/settings_button_back.svg rename to chromeos/components/camera_app_ui/resources/src/images/settings_button_back.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/settings_button_expand.svg b/chromeos/components/camera_app_ui/resources/src/images/settings_button_expand.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/settings_button_expand.svg rename to chromeos/components/camera_app_ui/resources/src/images/settings_button_expand.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/settings_feedback.svg b/chromeos/components/camera_app_ui/resources/src/images/settings_feedback.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/settings_feedback.svg rename to chromeos/components/camera_app_ui/resources/src/images/settings_feedback.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/settings_grid_type.svg b/chromeos/components/camera_app_ui/resources/src/images/settings_grid_type.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/settings_grid_type.svg rename to chromeos/components/camera_app_ui/resources/src/images/settings_grid_type.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/settings_help.svg b/chromeos/components/camera_app_ui/resources/src/images/settings_help.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/settings_help.svg rename to chromeos/components/camera_app_ui/resources/src/images/settings_help.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/settings_resolution.svg b/chromeos/components/camera_app_ui/resources/src/images/settings_resolution.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/settings_resolution.svg rename to chromeos/components/camera_app_ui/resources/src/images/settings_resolution.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/settings_timer_duration.svg b/chromeos/components/camera_app_ui/resources/src/images/settings_timer_duration.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/settings_timer_duration.svg rename to chromeos/components/camera_app_ui/resources/src/images/settings_timer_duration.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/images/spinner.svg b/chromeos/components/camera_app_ui/resources/src/images/spinner.svg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/images/spinner.svg rename to chromeos/components/camera_app_ui/resources/src/images/spinner.svg
diff --git a/chrome/browser/resources/chromeos/camera/src/js/BUILD.gn b/chromeos/components/camera_app_ui/resources/src/js/BUILD.gn similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/BUILD.gn rename to chromeos/components/camera_app_ui/resources/src/js/BUILD.gn
diff --git a/chrome/browser/resources/chromeos/camera/src/js/background.js b/chromeos/components/camera_app_ui/resources/src/js/background.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/background.js rename to chromeos/components/camera_app_ui/resources/src/js/background.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/background_ops.js b/chromeos/components/camera_app_ui/resources/src/js/background_ops.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/background_ops.js rename to chromeos/components/camera_app_ui/resources/src/js/background_ops.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/browser_proxy/BUILD.gn b/chromeos/components/camera_app_ui/resources/src/js/browser_proxy/BUILD.gn similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/browser_proxy/BUILD.gn rename to chromeos/components/camera_app_ui/resources/src/js/browser_proxy/BUILD.gn
diff --git a/chrome/browser/resources/chromeos/camera/src/js/browser_proxy/browser_proxy.js b/chromeos/components/camera_app_ui/resources/src/js/browser_proxy/browser_proxy.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/browser_proxy/browser_proxy.js rename to chromeos/components/camera_app_ui/resources/src/js/browser_proxy/browser_proxy.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/browser_proxy/browser_proxy_interface.js b/chromeos/components/camera_app_ui/resources/src/js/browser_proxy/browser_proxy_interface.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/browser_proxy/browser_proxy_interface.js rename to chromeos/components/camera_app_ui/resources/src/js/browser_proxy/browser_proxy_interface.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/browser_proxy/webui_browser_proxy.js b/chromeos/components/camera_app_ui/resources/src/js/browser_proxy/webui_browser_proxy.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/browser_proxy/webui_browser_proxy.js rename to chromeos/components/camera_app_ui/resources/src/js/browser_proxy/webui_browser_proxy.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/chrome_util.js b/chromeos/components/camera_app_ui/resources/src/js/chrome_util.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/chrome_util.js rename to chromeos/components/camera_app_ui/resources/src/js/chrome_util.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/device/BUILD.gn b/chromeos/components/camera_app_ui/resources/src/js/device/BUILD.gn similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/device/BUILD.gn rename to chromeos/components/camera_app_ui/resources/src/js/device/BUILD.gn
diff --git a/chrome/browser/resources/chromeos/camera/src/js/device/camera3_device_info.js b/chromeos/components/camera_app_ui/resources/src/js/device/camera3_device_info.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/device/camera3_device_info.js rename to chromeos/components/camera_app_ui/resources/src/js/device/camera3_device_info.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/device/constraints_preferrer.js b/chromeos/components/camera_app_ui/resources/src/js/device/constraints_preferrer.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/device/constraints_preferrer.js rename to chromeos/components/camera_app_ui/resources/src/js/device/constraints_preferrer.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/device/device_info_updater.js b/chromeos/components/camera_app_ui/resources/src/js/device/device_info_updater.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/device/device_info_updater.js rename to chromeos/components/camera_app_ui/resources/src/js/device/device_info_updater.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/device/error.js b/chromeos/components/camera_app_ui/resources/src/js/device/error.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/device/error.js rename to chromeos/components/camera_app_ui/resources/src/js/device/error.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/error.js b/chromeos/components/camera_app_ui/resources/src/js/error.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/error.js rename to chromeos/components/camera_app_ui/resources/src/js/error.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/externs/BUILD.gn b/chromeos/components/camera_app_ui/resources/src/js/externs/BUILD.gn similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/externs/BUILD.gn rename to chromeos/components/camera_app_ui/resources/src/js/externs/BUILD.gn
diff --git a/chrome/browser/resources/chromeos/camera/src/js/externs/chrome.js b/chromeos/components/camera_app_ui/resources/src/js/externs/chrome.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/externs/chrome.js rename to chromeos/components/camera_app_ui/resources/src/js/externs/chrome.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/externs/universal_analytics_api.js b/chromeos/components/camera_app_ui/resources/src/js/externs/universal_analytics_api.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/externs/universal_analytics_api.js rename to chromeos/components/camera_app_ui/resources/src/js/externs/universal_analytics_api.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/externs/w3c_api.js b/chromeos/components/camera_app_ui/resources/src/js/externs/w3c_api.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/externs/w3c_api.js rename to chromeos/components/camera_app_ui/resources/src/js/externs/w3c_api.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/gallerybutton.js b/chromeos/components/camera_app_ui/resources/src/js/gallerybutton.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/gallerybutton.js rename to chromeos/components/camera_app_ui/resources/src/js/gallerybutton.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/intent.js b/chromeos/components/camera_app_ui/resources/src/js/intent.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/intent.js rename to chromeos/components/camera_app_ui/resources/src/js/intent.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/lib/.clang-format b/chromeos/components/camera_app_ui/resources/src/js/lib/.clang-format similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/lib/.clang-format rename to chromeos/components/camera_app_ui/resources/src/js/lib/.clang-format
diff --git a/chrome/browser/resources/chromeos/camera/src/js/lib/BUILD.gn b/chromeos/components/camera_app_ui/resources/src/js/lib/BUILD.gn similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/lib/BUILD.gn rename to chromeos/components/camera_app_ui/resources/src/js/lib/BUILD.gn
diff --git a/chrome/browser/resources/chromeos/camera/src/js/lib/README.md b/chromeos/components/camera_app_ui/resources/src/js/lib/README.md similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/lib/README.md rename to chromeos/components/camera_app_ui/resources/src/js/lib/README.md
diff --git a/chrome/browser/resources/chromeos/camera/src/js/lib/analytics.js b/chromeos/components/camera_app_ui/resources/src/js/lib/analytics.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/lib/analytics.js rename to chromeos/components/camera_app_ui/resources/src/js/lib/analytics.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/lib/build_ffmpeg.sh b/chromeos/components/camera_app_ui/resources/src/js/lib/build_ffmpeg.sh similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/lib/build_ffmpeg.sh rename to chromeos/components/camera_app_ui/resources/src/js/lib/build_ffmpeg.sh
diff --git a/chrome/browser/resources/chromeos/camera/src/js/lib/comlink.js b/chromeos/components/camera_app_ui/resources/src/js/lib/comlink.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/lib/comlink.js rename to chromeos/components/camera_app_ui/resources/src/js/lib/comlink.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/lib/ffmpeg.js b/chromeos/components/camera_app_ui/resources/src/js/lib/ffmpeg.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/lib/ffmpeg.js rename to chromeos/components/camera_app_ui/resources/src/js/lib/ffmpeg.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/lib/ffmpeg.patch b/chromeos/components/camera_app_ui/resources/src/js/lib/ffmpeg.patch similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/lib/ffmpeg.patch rename to chromeos/components/camera_app_ui/resources/src/js/lib/ffmpeg.patch
diff --git a/chrome/browser/resources/chromeos/camera/src/js/lib/ffmpeg.wasm b/chromeos/components/camera_app_ui/resources/src/js/lib/ffmpeg.wasm similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/lib/ffmpeg.wasm rename to chromeos/components/camera_app_ui/resources/src/js/lib/ffmpeg.wasm Binary files differ
diff --git a/chrome/browser/resources/chromeos/camera/src/js/main.js b/chromeos/components/camera_app_ui/resources/src/js/main.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/main.js rename to chromeos/components/camera_app_ui/resources/src/js/main.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/metrics.js b/chromeos/components/camera_app_ui/resources/src/js/metrics.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/metrics.js rename to chromeos/components/camera_app_ui/resources/src/js/metrics.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/models/BUILD.gn b/chromeos/components/camera_app_ui/resources/src/js/models/BUILD.gn similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/models/BUILD.gn rename to chromeos/components/camera_app_ui/resources/src/js/models/BUILD.gn
diff --git a/chrome/browser/resources/chromeos/camera/src/js/models/async_writer.js b/chromeos/components/camera_app_ui/resources/src/js/models/async_writer.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/models/async_writer.js rename to chromeos/components/camera_app_ui/resources/src/js/models/async_writer.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/models/filenamer.js b/chromeos/components/camera_app_ui/resources/src/js/models/filenamer.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/models/filenamer.js rename to chromeos/components/camera_app_ui/resources/src/js/models/filenamer.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/models/filesystem.js b/chromeos/components/camera_app_ui/resources/src/js/models/filesystem.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/models/filesystem.js rename to chromeos/components/camera_app_ui/resources/src/js/models/filesystem.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/models/mp4_video_processor.js b/chromeos/components/camera_app_ui/resources/src/js/models/mp4_video_processor.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/models/mp4_video_processor.js rename to chromeos/components/camera_app_ui/resources/src/js/models/mp4_video_processor.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/models/nop_video_processor.js b/chromeos/components/camera_app_ui/resources/src/js/models/nop_video_processor.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/models/nop_video_processor.js rename to chromeos/components/camera_app_ui/resources/src/js/models/nop_video_processor.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/models/result_saver.js b/chromeos/components/camera_app_ui/resources/src/js/models/result_saver.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/models/result_saver.js rename to chromeos/components/camera_app_ui/resources/src/js/models/result_saver.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/models/video_saver.js b/chromeos/components/camera_app_ui/resources/src/js/models/video_saver.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/models/video_saver.js rename to chromeos/components/camera_app_ui/resources/src/js/models/video_saver.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/mojo/BUILD.gn b/chromeos/components/camera_app_ui/resources/src/js/mojo/BUILD.gn similarity index 91% rename from chrome/browser/resources/chromeos/camera/src/js/mojo/BUILD.gn rename to chromeos/components/camera_app_ui/resources/src/js/mojo/BUILD.gn index b1bdcd32..39e91ba7 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/mojo/BUILD.gn +++ b/chromeos/components/camera_app_ui/resources/src/js/mojo/BUILD.gn
@@ -14,8 +14,8 @@ js_library("chrome_helper") { deps = [ + "//chromeos/components/camera_app_ui:mojo_bindings_js_library_for_compile", "//components/arc/mojom:camera_intent_js_library_for_compile", - "//components/chromeos_camera/common:camera_app_helper_js_library_for_compile", "//third_party/blink/public/mojom:mojom_platform_js_library_for_compile", ] externs_list = [ "$externs_path/pending.js" ]
diff --git a/chrome/browser/resources/chromeos/camera/src/js/mojo/chrome_helper.js b/chromeos/components/camera_app_ui/resources/src/js/mojo/chrome_helper.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/mojo/chrome_helper.js rename to chromeos/components/camera_app_ui/resources/src/js/mojo/chrome_helper.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/mojo/device_operator.js b/chromeos/components/camera_app_ui/resources/src/js/mojo/device_operator.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/mojo/device_operator.js rename to chromeos/components/camera_app_ui/resources/src/js/mojo/device_operator.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/mojo/image_capture.js b/chromeos/components/camera_app_ui/resources/src/js/mojo/image_capture.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/mojo/image_capture.js rename to chromeos/components/camera_app_ui/resources/src/js/mojo/image_capture.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/nav.js b/chromeos/components/camera_app_ui/resources/src/js/nav.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/nav.js rename to chromeos/components/camera_app_ui/resources/src/js/nav.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/perf.js b/chromeos/components/camera_app_ui/resources/src/js/perf.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/perf.js rename to chromeos/components/camera_app_ui/resources/src/js/perf.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/sound.js b/chromeos/components/camera_app_ui/resources/src/js/sound.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/sound.js rename to chromeos/components/camera_app_ui/resources/src/js/sound.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/state.js b/chromeos/components/camera_app_ui/resources/src/js/state.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/state.js rename to chromeos/components/camera_app_ui/resources/src/js/state.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/toast.js b/chromeos/components/camera_app_ui/resources/src/js/toast.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/toast.js rename to chromeos/components/camera_app_ui/resources/src/js/toast.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/tooltip.js b/chromeos/components/camera_app_ui/resources/src/js/tooltip.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/tooltip.js rename to chromeos/components/camera_app_ui/resources/src/js/tooltip.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/type.js b/chromeos/components/camera_app_ui/resources/src/js/type.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/type.js rename to chromeos/components/camera_app_ui/resources/src/js/type.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/util.js b/chromeos/components/camera_app_ui/resources/src/js/util.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/util.js rename to chromeos/components/camera_app_ui/resources/src/js/util.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/BUILD.gn b/chromeos/components/camera_app_ui/resources/src/js/views/BUILD.gn similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/views/BUILD.gn rename to chromeos/components/camera_app_ui/resources/src/js/views/BUILD.gn
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera.js b/chromeos/components/camera_app_ui/resources/src/js/views/camera.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/views/camera.js rename to chromeos/components/camera_app_ui/resources/src/js/views/camera.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera/BUILD.gn b/chromeos/components/camera_app_ui/resources/src/js/views/camera/BUILD.gn similarity index 94% rename from chrome/browser/resources/chromeos/camera/src/js/views/camera/BUILD.gn rename to chromeos/components/camera_app_ui/resources/src/js/views/camera/BUILD.gn index 97fdd2d..d898340d 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/views/camera/BUILD.gn +++ b/chromeos/components/camera_app_ui/resources/src/js/views/camera/BUILD.gn
@@ -50,7 +50,6 @@ "../..:type", "../..:util", "../../device:device_info_updater", - "//components/chromeos_camera/common:camera_app_helper_js_library_for_compile", ] }
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera/layout.js b/chromeos/components/camera_app_ui/resources/src/js/views/camera/layout.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/views/camera/layout.js rename to chromeos/components/camera_app_ui/resources/src/js/views/camera/layout.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera/modes.js b/chromeos/components/camera_app_ui/resources/src/js/views/camera/modes.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/views/camera/modes.js rename to chromeos/components/camera_app_ui/resources/src/js/views/camera/modes.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera/options.js b/chromeos/components/camera_app_ui/resources/src/js/views/camera/options.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/views/camera/options.js rename to chromeos/components/camera_app_ui/resources/src/js/views/camera/options.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera/preview.js b/chromeos/components/camera_app_ui/resources/src/js/views/camera/preview.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/views/camera/preview.js rename to chromeos/components/camera_app_ui/resources/src/js/views/camera/preview.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera/recordtime.js b/chromeos/components/camera_app_ui/resources/src/js/views/camera/recordtime.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/views/camera/recordtime.js rename to chromeos/components/camera_app_ui/resources/src/js/views/camera/recordtime.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera/review_result.js b/chromeos/components/camera_app_ui/resources/src/js/views/camera/review_result.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/views/camera/review_result.js rename to chromeos/components/camera_app_ui/resources/src/js/views/camera/review_result.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera/timertick.js b/chromeos/components/camera_app_ui/resources/src/js/views/camera/timertick.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/views/camera/timertick.js rename to chromeos/components/camera_app_ui/resources/src/js/views/camera/timertick.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera_intent.js b/chromeos/components/camera_app_ui/resources/src/js/views/camera_intent.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/views/camera_intent.js rename to chromeos/components/camera_app_ui/resources/src/js/views/camera_intent.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/dialog.js b/chromeos/components/camera_app_ui/resources/src/js/views/dialog.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/views/dialog.js rename to chromeos/components/camera_app_ui/resources/src/js/views/dialog.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/settings.js b/chromeos/components/camera_app_ui/resources/src/js/views/settings.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/views/settings.js rename to chromeos/components/camera_app_ui/resources/src/js/views/settings.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/view.js b/chromeos/components/camera_app_ui/resources/src/js/views/view.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/views/view.js rename to chromeos/components/camera_app_ui/resources/src/js/views/view.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/warning.js b/chromeos/components/camera_app_ui/resources/src/js/views/warning.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/views/warning.js rename to chromeos/components/camera_app_ui/resources/src/js/views/warning.js
diff --git a/chrome/browser/resources/chromeos/camera/src/js/waitable_event.js b/chromeos/components/camera_app_ui/resources/src/js/waitable_event.js similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/js/waitable_event.js rename to chromeos/components/camera_app_ui/resources/src/js/waitable_event.js
diff --git a/chrome/browser/resources/chromeos/camera/src/manifest.json b/chromeos/components/camera_app_ui/resources/src/manifest.json similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/manifest.json rename to chromeos/components/camera_app_ui/resources/src/manifest.json
diff --git a/chrome/browser/resources/chromeos/camera/src/sounds/record_end.ogg b/chromeos/components/camera_app_ui/resources/src/sounds/record_end.ogg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/sounds/record_end.ogg rename to chromeos/components/camera_app_ui/resources/src/sounds/record_end.ogg Binary files differ
diff --git a/chrome/browser/resources/chromeos/camera/src/sounds/record_start.ogg b/chromeos/components/camera_app_ui/resources/src/sounds/record_start.ogg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/sounds/record_start.ogg rename to chromeos/components/camera_app_ui/resources/src/sounds/record_start.ogg Binary files differ
diff --git a/chrome/browser/resources/chromeos/camera/src/sounds/shutter.ogg b/chromeos/components/camera_app_ui/resources/src/sounds/shutter.ogg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/sounds/shutter.ogg rename to chromeos/components/camera_app_ui/resources/src/sounds/shutter.ogg Binary files differ
diff --git a/chrome/browser/resources/chromeos/camera/src/sounds/tick_final.ogg b/chromeos/components/camera_app_ui/resources/src/sounds/tick_final.ogg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/sounds/tick_final.ogg rename to chromeos/components/camera_app_ui/resources/src/sounds/tick_final.ogg Binary files differ
diff --git a/chrome/browser/resources/chromeos/camera/src/sounds/tick_inc.ogg b/chromeos/components/camera_app_ui/resources/src/sounds/tick_inc.ogg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/sounds/tick_inc.ogg rename to chromeos/components/camera_app_ui/resources/src/sounds/tick_inc.ogg Binary files differ
diff --git a/chrome/browser/resources/chromeos/camera/src/sounds/tick_start.ogg b/chromeos/components/camera_app_ui/resources/src/sounds/tick_start.ogg similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/sounds/tick_start.ogg rename to chromeos/components/camera_app_ui/resources/src/sounds/tick_start.ogg Binary files differ
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/BUILD.gn b/chromeos/components/camera_app_ui/resources/src/strings/BUILD.gn similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/BUILD.gn rename to chromeos/components/camera_app_ui/resources/src/strings/BUILD.gn
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings.grd b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings.grd similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings.grd rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings.grd
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_af.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_af.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_af.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_af.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_am.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_am.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_am.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_am.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ar.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ar.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ar.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ar.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_as.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_as.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_as.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_as.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_az.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_az.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_az.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_az.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_be.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_be.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_be.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_be.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_bg.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_bg.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_bg.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_bg.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_bn.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_bn.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_bn.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_bn.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_bs.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_bs.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_bs.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_bs.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ca.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ca.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ca.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ca.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_cs.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_cs.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_cs.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_cs.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_da.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_da.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_da.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_da.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_de.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_de.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_de.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_de.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_el.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_el.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_el.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_el.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_en-GB.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_en-GB.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_en-GB.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_en-GB.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_es-419.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_es-419.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_es-419.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_es-419.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_es.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_es.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_es.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_es.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_et.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_et.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_et.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_et.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_eu.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_eu.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_eu.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_eu.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_fa.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fa.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_fa.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fa.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_fi.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fi.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_fi.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fi.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_fil.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fil.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_fil.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fil.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_fr-CA.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fr-CA.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_fr-CA.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fr-CA.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_fr.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fr.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_fr.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_fr.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_gl.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_gl.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_gl.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_gl.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_CAMERA_RESOLUTION_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_CAMERA_RESOLUTION_BUTTON.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_CAMERA_RESOLUTION_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_CAMERA_RESOLUTION_BUTTON.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_ERROR_MSG_EXPERT_MODE_NOT_SUPPORTED.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_ERROR_MSG_EXPERT_MODE_NOT_SUPPORTED.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_ERROR_MSG_EXPERT_MODE_NOT_SUPPORTED.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_ERROR_MSG_EXPERT_MODE_NOT_SUPPORTED.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_ERROR_MSG_TAKE_PORTRAIT_PHOTO_FAILED.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_ERROR_MSG_TAKE_PORTRAIT_PHOTO_FAILED.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_ERROR_MSG_TAKE_PORTRAIT_PHOTO_FAILED.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_ERROR_MSG_TAKE_PORTRAIT_PHOTO_FAILED.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_EXPERT_MODE_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_EXPERT_MODE_BUTTON.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_EXPERT_MODE_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_EXPERT_MODE_BUTTON.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_EXPERT_PREVIEW_METADATA.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_EXPERT_PREVIEW_METADATA.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_EXPERT_PREVIEW_METADATA.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_EXPERT_PREVIEW_METADATA.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_EXPERT_SAVE_METADATA.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_EXPERT_SAVE_METADATA.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_EXPERT_SAVE_METADATA.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_EXPERT_SAVE_METADATA.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_LABEL_BACK_CAMERA.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_BACK_CAMERA.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_LABEL_BACK_CAMERA.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_BACK_CAMERA.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_LABEL_EXTERNAL_CAMERA.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_EXTERNAL_CAMERA.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_LABEL_EXTERNAL_CAMERA.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_EXTERNAL_CAMERA.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_LABEL_FRONT_CAMERA.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_FRONT_CAMERA.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_LABEL_FRONT_CAMERA.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_FRONT_CAMERA.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_RECORD_VIDEO_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_RECORD_VIDEO_BUTTON.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_RECORD_VIDEO_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_RECORD_VIDEO_BUTTON.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_PHOTO_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_PHOTO_BUTTON.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_PHOTO_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_PHOTO_BUTTON.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_PORTRAIT_PHOTO_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_PORTRAIT_PHOTO_BUTTON.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_PORTRAIT_PHOTO_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_PORTRAIT_PHOTO_BUTTON.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_SQUARE_PHOTO_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_SQUARE_PHOTO_BUTTON.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_SQUARE_PHOTO_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_SWITCH_TAKE_SQUARE_PHOTO_BUTTON.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_LABEL_VIDEO_RESOLUTION.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_VIDEO_RESOLUTION.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_LABEL_VIDEO_RESOLUTION.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_LABEL_VIDEO_RESOLUTION.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_PHOTO_RESOLUTION_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_PHOTO_RESOLUTION_BUTTON.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_PHOTO_RESOLUTION_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_PHOTO_RESOLUTION_BUTTON.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_TOGGLE_60FPS_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_TOGGLE_60FPS_BUTTON.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_TOGGLE_60FPS_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_TOGGLE_60FPS_BUTTON.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_VIDEO_RESOLUTION_BUTTON.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_VIDEO_RESOLUTION_BUTTON.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/IDS_VIDEO_RESOLUTION_BUTTON.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/IDS_VIDEO_RESOLUTION_BUTTON.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/ID_LABEL_30FPS.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_30FPS.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/ID_LABEL_30FPS.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_30FPS.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/ID_LABEL_60FPS.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_60FPS.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/ID_LABEL_60FPS.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_60FPS.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/ID_LABEL_DETAIL_PHOTO_RESOLUTION.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_DETAIL_PHOTO_RESOLUTION.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/ID_LABEL_DETAIL_PHOTO_RESOLUTION.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_DETAIL_PHOTO_RESOLUTION.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/ID_LABEL_PHOTO_RESOLUTION.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_PHOTO_RESOLUTION.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/ID_LABEL_PHOTO_RESOLUTION.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_PHOTO_RESOLUTION.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/ID_LABEL_VIDEO_RESOLUTION.png.sha1 b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_VIDEO_RESOLUTION.png.sha1 similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_grd/ID_LABEL_VIDEO_RESOLUTION.png.sha1 rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_grd/ID_LABEL_VIDEO_RESOLUTION.png.sha1
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_gu.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_gu.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_gu.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_gu.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_hi.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_hi.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_hi.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_hi.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_hr.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_hr.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_hr.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_hr.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_hu.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_hu.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_hu.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_hu.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_hy.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_hy.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_hy.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_hy.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_id.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_id.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_id.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_id.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_is.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_is.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_is.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_is.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_it.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_it.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_it.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_it.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_iw.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_iw.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_iw.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_iw.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ja.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ja.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ja.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ja.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ka.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ka.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ka.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ka.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_kk.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_kk.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_kk.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_kk.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_km.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_km.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_km.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_km.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_kn.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_kn.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_kn.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_kn.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ko.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ko.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ko.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ko.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ky.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ky.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ky.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ky.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_lo.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_lo.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_lo.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_lo.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_lt.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_lt.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_lt.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_lt.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_lv.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_lv.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_lv.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_lv.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_mk.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_mk.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_mk.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_mk.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ml.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ml.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ml.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ml.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_mn.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_mn.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_mn.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_mn.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_mr.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_mr.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_mr.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_mr.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ms.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ms.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ms.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ms.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_my.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_my.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_my.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_my.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ne.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ne.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ne.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ne.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_nl.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_nl.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_nl.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_nl.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_no.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_no.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_no.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_no.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_or.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_or.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_or.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_or.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_pa.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_pa.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_pa.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_pa.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_pl.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_pl.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_pl.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_pl.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_pt-BR.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_pt-BR.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_pt-BR.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_pt-BR.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_pt-PT.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_pt-PT.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_pt-PT.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_pt-PT.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ro.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ro.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ro.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ro.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ru.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ru.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ru.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ru.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_si.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_si.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_si.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_si.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_sk.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sk.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_sk.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sk.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_sl.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sl.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_sl.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sl.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_sq.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sq.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_sq.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sq.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_sr-Latn.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sr-Latn.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_sr-Latn.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sr-Latn.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_sr.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sr.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_sr.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sr.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_sv.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sv.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_sv.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sv.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_sw.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sw.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_sw.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_sw.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ta.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ta.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ta.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ta.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_te.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_te.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_te.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_te.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_th.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_th.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_th.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_th.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_tr.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_tr.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_tr.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_tr.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_uk.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_uk.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_uk.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_uk.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ur.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ur.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_ur.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_ur.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_uz.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_uz.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_uz.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_uz.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_vi.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_vi.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_vi.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_vi.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_zh-CN.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_zh-CN.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_zh-CN.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_zh-CN.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_zh-HK.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_zh-HK.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_zh-HK.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_zh-HK.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_zh-TW.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_zh-TW.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_zh-TW.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_zh-TW.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/strings/camera_strings_zu.xtb b/chromeos/components/camera_app_ui/resources/src/strings/camera_strings_zu.xtb similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/strings/camera_strings_zu.xtb rename to chromeos/components/camera_app_ui/resources/src/strings/camera_strings_zu.xtb
diff --git a/chrome/browser/resources/chromeos/camera/src/views/background.html b/chromeos/components/camera_app_ui/resources/src/views/background.html similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/views/background.html rename to chromeos/components/camera_app_ui/resources/src/views/background.html
diff --git a/chrome/browser/resources/chromeos/camera/src/views/main.html b/chromeos/components/camera_app_ui/resources/src/views/main.html similarity index 100% rename from chrome/browser/resources/chromeos/camera/src/views/main.html rename to chromeos/components/camera_app_ui/resources/src/views/main.html
diff --git a/chrome/browser/resources/chromeos/camera/utils/cca.py b/chromeos/components/camera_app_ui/resources/utils/cca.py similarity index 98% rename from chrome/browser/resources/chromeos/camera/utils/cca.py rename to chromeos/components/camera_app_ui/resources/utils/cca.py index 1dc305a..fa4d888 100755 --- a/chrome/browser/resources/chromeos/camera/utils/cca.py +++ b/chromeos/components/camera_app_ui/resources/utils/cca.py
@@ -19,7 +19,7 @@ @functools.lru_cache(1) def get_chromium_root(): - path = os.path.realpath('../../../../../') + path = os.path.realpath('../../../../') assert os.path.basename(path) == 'src' return path @@ -284,7 +284,7 @@ def main(args): cca_root = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) - assert os.path.basename(cca_root) == 'camera' + assert os.path.basename(cca_root) == 'resources' os.chdir(cca_root) args = parse_args(args)
diff --git a/chrome/browser/resources/chromeos/camera/utils/dev/images/camera_app_icons_128.png b/chromeos/components/camera_app_ui/resources/utils/dev/images/camera_app_icons_128.png similarity index 100% rename from chrome/browser/resources/chromeos/camera/utils/dev/images/camera_app_icons_128.png rename to chromeos/components/camera_app_ui/resources/utils/dev/images/camera_app_icons_128.png Binary files differ
diff --git a/chrome/browser/resources/chromeos/camera/utils/dev/images/camera_app_icons_48.png b/chromeos/components/camera_app_ui/resources/utils/dev/images/camera_app_icons_48.png similarity index 100% rename from chrome/browser/resources/chromeos/camera/utils/dev/images/camera_app_icons_48.png rename to chromeos/components/camera_app_ui/resources/utils/dev/images/camera_app_icons_48.png Binary files differ
diff --git a/chromeos/components/camera_app_ui/url_constants.cc b/chromeos/components/camera_app_ui/url_constants.cc new file mode 100644 index 0000000..98812144 --- /dev/null +++ b/chromeos/components/camera_app_ui/url_constants.cc
@@ -0,0 +1,11 @@ +// 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 "chromeos/components/camera_app_ui/url_constants.h" + +namespace chromeos { + +const char kChromeUICameraAppHost[] = "camera-app"; + +} // namespace chromeos
diff --git a/chromeos/components/camera_app_ui/url_constants.h b/chromeos/components/camera_app_ui/url_constants.h new file mode 100644 index 0000000..87238fb9 --- /dev/null +++ b/chromeos/components/camera_app_ui/url_constants.h
@@ -0,0 +1,14 @@ +// 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 CHROMEOS_COMPONENTS_CAMERA_APP_UI_URL_CONSTANTS_H_ +#define CHROMEOS_COMPONENTS_CAMERA_APP_UI_URL_CONSTANTS_H_ + +namespace chromeos { + +extern const char kChromeUICameraAppHost[]; + +} // namespace chromeos + +#endif // CHROMEOS_COMPONENTS_CAMERA_APP_UI_URL_CONSTANTS_H_
diff --git a/chromeos/profiles/airmont.afdo.newest.txt b/chromeos/profiles/airmont.afdo.newest.txt index 0525975..b31fc9d 100644 --- a/chromeos/profiles/airmont.afdo.newest.txt +++ b/chromeos/profiles/airmont.afdo.newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-airmont-85-4147.21-1591007597-benchmark-85.0.4161.0-r1-redacted.afdo.xz +chromeos-chrome-amd64-airmont-85-4147.21-1591007597-benchmark-85.0.4163.0-r1-redacted.afdo.xz
diff --git a/chromeos/profiles/broadwell.afdo.newest.txt b/chromeos/profiles/broadwell.afdo.newest.txt index 82224c38..aaec57d4 100644 --- a/chromeos/profiles/broadwell.afdo.newest.txt +++ b/chromeos/profiles/broadwell.afdo.newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-broadwell-85-4147.10-1591010642-benchmark-85.0.4161.0-r1-redacted.afdo.xz +chromeos-chrome-amd64-broadwell-85-4147.10-1591010642-benchmark-85.0.4163.0-r1-redacted.afdo.xz
diff --git a/chromeos/profiles/silvermont.afdo.newest.txt b/chromeos/profiles/silvermont.afdo.newest.txt index bf769d1..511384a 100644 --- a/chromeos/profiles/silvermont.afdo.newest.txt +++ b/chromeos/profiles/silvermont.afdo.newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-silvermont-85-4147.21-1591004251-benchmark-85.0.4161.0-r1-redacted.afdo.xz +chromeos-chrome-amd64-silvermont-85-4147.21-1591004251-benchmark-85.0.4163.0-r1-redacted.afdo.xz
diff --git a/chromeos/resources/BUILD.gn b/chromeos/resources/BUILD.gn index 60b3e89b..1e0da57 100644 --- a/chromeos/resources/BUILD.gn +++ b/chromeos/resources/BUILD.gn
@@ -40,6 +40,31 @@ ] } +# Resources used by chrome://camera-app. +grit("camera_app_resources") { + source = "../components/camera_app_ui/resources/camera_app_resources.grd" + + outputs = [ + "grit/chromeos_camera_app_resources.h", + "grit/chromeos_camera_app_resources_map.cc", + "grit/chromeos_camera_app_resources_map.h", + "chromeos_camera_app_resources.pak", + ] + output_dir = "$root_gen_dir/chromeos" + + grit_flags = [ + "-E", + "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), + ] + + deps = [ + "//chromeos/components/camera_app_ui:mojo_bindings_js", + "//media/capture/video/chromeos/mojom:cros_camera_js", + "//mojo/public/js:bindings_lite", + "//third_party/blink/public/mojom:mojom_platform_js", + ] +} + # Resources used by chrome://help-app, and parts of the sandboxed app it hosts # that do not come from the app bundle (below). grit("help_app_resources") {
diff --git a/chromeos/services/tts/BUILD.gn b/chromeos/services/tts/BUILD.gn new file mode 100644 index 0000000..e74177d --- /dev/null +++ b/chromeos/services/tts/BUILD.gn
@@ -0,0 +1,57 @@ +# 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("//tools/generate_library_loader/generate_library_loader.gni") + +source_set("tts") { + sources = [ + "constants.cc", + "constants.h", + "tts_service.cc", + "tts_service.h", + ] + + deps = [ + ":libchrometts", + "//base", + "//chromeos/services/tts/public/mojom", + ] +} + +source_set("sandbox_hook") { + sources = [ + "tts_sandbox_hook.cc", + "tts_sandbox_hook.h", + ] + + deps = [ + ":libchrometts", + ":tts", + "//base", + "//sandbox/linux:sandbox_services", + "//services/service_manager/sandbox:sandbox", + ] +} + +generate_library_loader("libchrometts") { + name = "LibChromeTtsLoader" + output_h = "libchrometts.h" + output_cc = "libchrometts_loader.cc" + header = "<chrome_tts.h>" + bundled_header = "\"chromeos/services/tts/chrome_tts.h\"" + + functions = [ + "GoogleTtsInit", + "GoogleTtsShutdown", + "GoogleTtsInstallVoice", + "GoogleTtsInitBuffered", + "GoogleTtsReadBuffered", + "GoogleTtsFinalizeBuffered", + "GoogleTtsGetEventBufferPtr", + "GoogleTtsGetEventBufferLen", + "GoogleTtsGetTimepointsCount", + "GoogleTtsGetTimepointsTimeInSecsAtIndex", + "GoogleTtsGetTimepointsCharIndexAtIndex", + ] +}
diff --git a/chromeos/services/tts/DEPS b/chromeos/services/tts/DEPS new file mode 100644 index 0000000..bbe2c10 --- /dev/null +++ b/chromeos/services/tts/DEPS
@@ -0,0 +1,5 @@ +include_rules = [ + "+mojo/public", + "+sandbox", + "+services/service_manager/sandbox", +]
diff --git a/chromeos/services/tts/OWNERS b/chromeos/services/tts/OWNERS new file mode 100644 index 0000000..00700e03 --- /dev/null +++ b/chromeos/services/tts/OWNERS
@@ -0,0 +1,4 @@ +file://ui/accessibility/OWNERS + +# TEAM: chromium-accessibility@chromium.org +# COMPONENT: Internals>SpeechSynthesis
diff --git a/chromeos/services/tts/README.md b/chromeos/services/tts/README.md new file mode 100644 index 0000000..00dc5f1 --- /dev/null +++ b/chromeos/services/tts/README.md
@@ -0,0 +1,9 @@ +TtsService and TtsClient provide a private api to communicate with the +text-to-speech engine in Chrome OS. + +The TtsClient remote lives in an extension which can be found in the Chrome OS +repository at: +third_party/chromiumos-overlay/app-accessibility/googletts/ + +The TtsService runs in a sandboxed process running the native engine (in the +form of a shared object).
diff --git a/chromeos/services/tts/chrome_tts.h b/chromeos/services/tts/chrome_tts.h new file mode 100644 index 0000000..6f7bb98 --- /dev/null +++ b/chromeos/services/tts/chrome_tts.h
@@ -0,0 +1,34 @@ +// 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 CHROMEOS_SERVICES_TTS_CHROME_TTS_H_ +#define CHROMEOS_SERVICES_TTS_CHROME_TTS_H_ + +#include <cstddef> +#include <cstdint> + +bool GoogleTtsInit(const char* pipeline_path, const char* path_prefix); + +void GoogleTtsShutdown(); + +bool GoogleTtsInstallVoice(const char* voice_name, + const char* voice_bytes, + int size); + +bool GoogleTtsInitBuffered(const char* text_jspb, int text_jspb_len); + +int GoogleTtsReadBuffered(); + +void GoogleTtsFinalizeBuffered(); + +size_t GoogleTtsGetTimepointsCount(); + +float GoogleTtsGetTimepointsTimeInSecsAtIndex(size_t index); + +int GoogleTtsGetTimepointsCharIndexAtIndex(size_t index); + +char* GoogleTtsGetEventBufferPtr(); + +size_t GoogleTtsGetEventBufferLen(); +#endif // CHROMEOS_SERVICES_TTS_CHROME_TTS_H_
diff --git a/chromeos/services/tts/constants.cc b/chromeos/services/tts/constants.cc new file mode 100644 index 0000000..e64ea1a --- /dev/null +++ b/chromeos/services/tts/constants.cc
@@ -0,0 +1,13 @@ +// 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 "chromeos/services/tts/constants.h" + +namespace chromeos { +namespace tts { +const char kLibchromettsPath[] = + "/usr/share/chromeos-assets/speech_synthesis/patts/libchrometts.so"; +const char kTempDataDirectory[] = "/tmp/tts"; +} // namespace tts +} // namespace chromeos
diff --git a/chromeos/services/tts/constants.h b/chromeos/services/tts/constants.h new file mode 100644 index 0000000..99d130d6 --- /dev/null +++ b/chromeos/services/tts/constants.h
@@ -0,0 +1,18 @@ +// 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 CHROMEOS_SERVICES_TTS_CONSTANTS_H_ +#define CHROMEOS_SERVICES_TTS_CONSTANTS_H_ + +namespace chromeos { +namespace tts { +// The location of the Chrome text-to-speech engine library. +extern const char kLibchromettsPath[]; + +// The location of read-write text-to-speech data. +extern const char kTempDataDirectory[]; +} // namespace tts +} // namespace chromeos + +#endif // CHROMEOS_SERVICES_TTS_CONSTANTS_H_
diff --git a/chromeos/services/tts/public/mojom/BUILD.gn b/chromeos/services/tts/public/mojom/BUILD.gn new file mode 100644 index 0000000..b677781 --- /dev/null +++ b/chromeos/services/tts/public/mojom/BUILD.gn
@@ -0,0 +1,9 @@ +# 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("//mojo/public/tools/bindings/mojom.gni") + +mojom("mojom") { + sources = [ "tts_service.mojom" ] +}
diff --git a/chromeos/services/tts/public/mojom/OWNERS b/chromeos/services/tts/public/mojom/OWNERS new file mode 100644 index 0000000..08850f4 --- /dev/null +++ b/chromeos/services/tts/public/mojom/OWNERS
@@ -0,0 +1,2 @@ +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS
diff --git a/chromeos/services/tts/public/mojom/tts_service.mojom b/chromeos/services/tts/public/mojom/tts_service.mojom new file mode 100644 index 0000000..a8fd1cd --- /dev/null +++ b/chromeos/services/tts/public/mojom/tts_service.mojom
@@ -0,0 +1,85 @@ +// 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. + +module chromeos.tts.mojom; + +// Structure describing a point in time during speech synthesis. +struct Timepoint { + // The time, in seconds. + float time_sec; + + // The index in the text being spoken. + int32 char_index; +}; + +// A TTS event and associated metadata within a TTS stream. +struct TtsStreamItem { + // An internal serialized proto.speech.tts.TtsControllerEvent proto. + array<uint8> event_buffer_bytes; + + // Whether streaming is complete. + bool done; + + // A list of timepoints associated with the event above. + array<Timepoint> timepoints; +}; + +// The main interface to the TTS engine on Chrome OS. Only used by and private +// to the Chrome OS Google TTS engine component extension. TtsService lives in a +// tts-sandboxed process. TtsEngineExtensionObserver, the other end of this +// interface, in the browser process, brokers a connection between TtsService +// and the Google TTS engine component extension through a TtsStream, but does +// not participate otherwise. +interface TtsService { + // Binds a TtsStream to this service. + BindTtsStream(pending_receiver<TtsStream> receiver); +}; + +// Interface for the Google component TTS engine to control and consume a stream +// of TtsStreamItems produced by TtsService. There is only ever one TtsStream +// owned by the TtsService. +// +// The component extension sets up the stream's voice by doing: +// InstallVoice(data, "voice") +// InstallVoice(other_data, "other_voice") +// SelectVoice("other_voice") +// +// After reading from the stream (see below), the component extension can do: +// SelectVoice("voice") +// to change voices. +// +// The component extension calls the following three methods repeatedly, in +// order to read from the stream given text. For example, +// +// Init(<a proto containing text "Hello there.">) +// Read() +// Read() +// ... +// Finalize() +// Init(<proto containing text "Testing 1, 2, 3.") +// Read() +// Read() +// ... +// Finalize() +// +// Note that the component extension may call Finalize() early, if the TTS api +// wants to, for example, stop speech. +interface TtsStream { + // Forward and install the |voice_name| encoded by |voice_bytes|. + InstallVoice(string voice_name, array<uint8> voice_bytes) + => (bool success); + + // Selects a voice for streaming given a |voice_name|. + SelectVoice(string voice_name) => (bool success); + + // Initialize a new TTS stream given a serialized proto.speech.tts.Text proto. + Init(array<uint8> text_jspb) + => (bool success); + + // Read the next stream item. + Read() => (TtsStreamItem item); + + // Clean up and finish the current TTS stream. + Finalize(); +};
diff --git a/chromeos/services/tts/tts_sandbox_hook.cc b/chromeos/services/tts/tts_sandbox_hook.cc new file mode 100644 index 0000000..cd9fd0b --- /dev/null +++ b/chromeos/services/tts/tts_sandbox_hook.cc
@@ -0,0 +1,71 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/services/tts/tts_sandbox_hook.h" + +#include <dlfcn.h> +#include <vector> + +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "chromeos/services/tts/constants.h" +#include "sandbox/linux/syscall_broker/broker_command.h" +#include "sandbox/linux/syscall_broker/broker_file_permission.h" + +using sandbox::syscall_broker::BrokerFilePermission; +using sandbox::syscall_broker::MakeBrokerCommandSet; + +namespace chromeos { +namespace tts { + +void AddBundleFolder(std::vector<BrokerFilePermission>* permissions) { + base::FilePath bundle_dir = + base::FilePath(FILE_PATH_LITERAL(kLibchromettsPath)) + .AsEndingWithSeparator(); + permissions->push_back( + BrokerFilePermission::ReadOnlyRecursive(bundle_dir.value())); +} + +void AddTempDataDirectory(std::vector<BrokerFilePermission>* permissions) { + // TODO: figure out read-write directory for tts. + base::FilePath rw_dir = base::FilePath(FILE_PATH_LITERAL(kTempDataDirectory)) + .AsEndingWithSeparator(); + permissions->push_back( + BrokerFilePermission::ReadWriteCreateRecursive(rw_dir.value())); +} + +std::vector<BrokerFilePermission> GetTtsFilePermissions() { + std::vector<BrokerFilePermission> permissions; + AddBundleFolder(&permissions); + AddTempDataDirectory(&permissions); + return permissions; +} + +bool TtsPreSandboxHook(service_manager::SandboxLinux::Options options) { + if (!dlopen(kLibchromettsPath, RTLD_LAZY)) + LOG(ERROR) << "Unable to open libchrometts.so: " << dlerror(); + + // Ensure this directory is created. + base::FilePath temp_data_dir(kTempDataDirectory); + base::CreateDirectoryAndGetError(temp_data_dir, nullptr); + auto* instance = service_manager::SandboxLinux::GetInstance(); + instance->StartBrokerProcess(MakeBrokerCommandSet({ + sandbox::syscall_broker::COMMAND_ACCESS, + sandbox::syscall_broker::COMMAND_OPEN, + sandbox::syscall_broker::COMMAND_MKDIR, + sandbox::syscall_broker::COMMAND_STAT, + sandbox::syscall_broker::COMMAND_STAT64, + sandbox::syscall_broker::COMMAND_RENAME, + sandbox::syscall_broker::COMMAND_UNLINK, + }), + GetTtsFilePermissions(), + service_manager::SandboxLinux::PreSandboxHook(), + options); + + instance->EngageNamespaceSandboxIfPossible(); + return true; +} + +} // namespace tts +} // namespace chromeos
diff --git a/chromeos/services/tts/tts_sandbox_hook.h b/chromeos/services/tts/tts_sandbox_hook.h new file mode 100644 index 0000000..6480236 --- /dev/null +++ b/chromeos/services/tts/tts_sandbox_hook.h
@@ -0,0 +1,18 @@ +// 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 CHROMEOS_SERVICES_TTS_TTS_SANDBOX_HOOK_H_ +#define CHROMEOS_SERVICES_TTS_TTS_SANDBOX_HOOK_H_ + +#include "services/service_manager/sandbox/linux/sandbox_linux.h" + +namespace chromeos { +namespace tts { + +bool TtsPreSandboxHook(service_manager::SandboxLinux::Options options); + +} // namespace tts +} // namespace chromeos + +#endif // CHROMEOS_SERVICES_TTS_TTS_SANDBOX_HOOK_H_
diff --git a/chromeos/services/tts/tts_service.cc b/chromeos/services/tts/tts_service.cc new file mode 100644 index 0000000..363e2b71 --- /dev/null +++ b/chromeos/services/tts/tts_service.cc
@@ -0,0 +1,102 @@ +// 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 "chromeos/services/tts/tts_service.h" + +#include <dlfcn.h> + +#include "base/files/file_util.h" +#include "chromeos/services/tts/constants.h" + +namespace chromeos { +namespace tts { + +// TtsService is mostly glue code that adapts the TtsStream interface into a +// form needed by libchrometts.so. As is convention with shared objects, the +// lifetime of all arguments passed to the library is scoped to the function. +// +// To keep the library interface stable and prevent name mangling, all library +// methods utilize C features only. + +TtsService::TtsService(mojo::PendingReceiver<mojom::TtsService> receiver) + : service_receiver_(this, std::move(receiver)), stream_receiver_(this) { + bool loaded = libchrometts_.Load(kLibchromettsPath); + if (!loaded) + LOG(ERROR) << "Unable to load libchrometts.so: " << dlerror(); +} + +TtsService::~TtsService() = default; + +void TtsService::BindTtsStream( + mojo::PendingReceiver<mojom::TtsStream> receiver) { + stream_receiver_.Bind(std::move(receiver)); +} + +void TtsService::InstallVoice(const std::string& voice_name, + const std::vector<uint8_t>& voice_bytes, + InstallVoiceCallback callback) { + // Create a directory to place extracted voice data. + base::FilePath voice_data_path(kTempDataDirectory); + voice_data_path = voice_data_path.Append(voice_name); + if (base::DirectoryExists(voice_data_path)) { + std::move(callback).Run(true); + return; + } + + if (!base::CreateDirectoryAndGetError(voice_data_path, nullptr)) { + std::move(callback).Run(false); + return; + } + + std::move(callback).Run(libchrometts_.GoogleTtsInstallVoice( + voice_data_path.value().c_str(), (char*)&voice_bytes[0], + voice_bytes.size())); +} + +void TtsService::SelectVoice(const std::string& voice_name, + SelectVoiceCallback callback) { + base::FilePath path_prefix = + base::FilePath(kTempDataDirectory).Append(voice_name); + base::FilePath pipeline_path = path_prefix.Append("pipeline"); + std::move(callback).Run(libchrometts_.GoogleTtsInit( + pipeline_path.value().c_str(), path_prefix.value().c_str())); +} + +void TtsService::Init(const std::vector<uint8_t>& text_jspb, + InitCallback callback) { + std::move(callback).Run(libchrometts_.GoogleTtsInitBuffered( + (char*)&text_jspb[0], text_jspb.size())); +} + +void TtsService::Read(ReadCallback callback) { + int32_t status = libchrometts_.GoogleTtsReadBuffered(); + if (status == -1) { + std::move(callback).Run(mojom::TtsStreamItem::New( + std::vector<uint8_t>(), true, std::vector<mojom::TimepointPtr>())); + return; + } + + char* event = libchrometts_.GoogleTtsGetEventBufferPtr(); + std::vector<uint8_t> send_event(libchrometts_.GoogleTtsGetEventBufferLen()); + for (size_t i = 0; i < send_event.size(); i++) + send_event[i] = event[i]; + + std::vector<mojom::TimepointPtr> timepoints( + libchrometts_.GoogleTtsGetTimepointsCount()); + for (size_t i = 0; i < timepoints.size(); i++) { + timepoints[i] = mojom::Timepoint::New( + libchrometts_.GoogleTtsGetTimepointsTimeInSecsAtIndex(i), + libchrometts_.GoogleTtsGetTimepointsCharIndexAtIndex(i)); + } + + std::move(callback).Run(mojom::TtsStreamItem::New(send_event, status == 0, + std::move(timepoints))); +} + +void TtsService::Finalize() { + libchrometts_.GoogleTtsFinalizeBuffered(); +} + +} // namespace tts +} // namespace chromeos
diff --git a/chromeos/services/tts/tts_service.h b/chromeos/services/tts/tts_service.h new file mode 100644 index 0000000..957cff24 --- /dev/null +++ b/chromeos/services/tts/tts_service.h
@@ -0,0 +1,43 @@ +// 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 CHROMEOS_SERVICES_TTS_TTS_SERVICE_H_ +#define CHROMEOS_SERVICES_TTS_TTS_SERVICE_H_ + +#include "chromeos/services/tts/public/mojom/tts_service.mojom.h" +#include "library_loaders/libchrometts.h" +#include "mojo/public/cpp/bindings/receiver.h" + +namespace chromeos { +namespace tts { + +class TtsService : public mojom::TtsService, public mojom::TtsStream { + public: + explicit TtsService(mojo::PendingReceiver<mojom::TtsService> receiver); + ~TtsService() override; + + private: + // TtsService: + void BindTtsStream(mojo::PendingReceiver<mojom::TtsStream> receiver) override; + + // TtsStream: + void InstallVoice(const std::string& voice_name, + const std::vector<uint8_t>& voice_bytes, + InstallVoiceCallback callback) override; + void SelectVoice(const std::string& voice_name, + SelectVoiceCallback callback) override; + void Init(const std::vector<uint8_t>& text_jspb, + InitCallback callback) override; + void Read(ReadCallback callback) override; + void Finalize() override; + + LibChromeTtsLoader libchrometts_; + mojo::Receiver<mojom::TtsService> service_receiver_; + mojo::Receiver<mojom::TtsStream> stream_receiver_; +}; + +} // namespace tts +} // namespace chromeos + +#endif // CHROMEOS_SERVICES_TTS_TTS_SERVICE_H_
diff --git a/components/arc/mojom/BUILD.gn b/components/arc/mojom/BUILD.gn index 0778d56..c541f80 100644 --- a/components/arc/mojom/BUILD.gn +++ b/components/arc/mojom/BUILD.gn
@@ -69,7 +69,6 @@ ":camera_intent", ":media", ":notifications", - "//components/chromeos_camera/common:camera_app_helper", "//media/capture/video/chromeos/mojom:cros_camera", "//mojo/public/mojom/base", "//printing/mojom",
diff --git a/components/arc/mojom/keymaster.mojom b/components/arc/mojom/keymaster.mojom index 59035ac..6aa80cf 100644 --- a/components/arc/mojom/keymaster.mojom +++ b/components/arc/mojom/keymaster.mojom
@@ -12,7 +12,7 @@ // Host is implemented in Chrome. Listens until server and instance come online // and forwards a server handle to the instance. interface KeymasterHost { - GetServer@0() => (KeymasterServer server_ptr); + GetServer@0() => (pending_remote<KeymasterServer>? server_remote); }; // Instance is implemented in ARC. Retrieves a server pointer from the host and
diff --git a/components/autofill/core/browser/autofill_and_password_manager_internals/autofill_and_password_manager_internals.css b/components/autofill/core/browser/autofill_and_password_manager_internals/autofill_and_password_manager_internals.css index 4d4b7509..36b5c68b 100644 --- a/components/autofill/core/browser/autofill_and_password_manager_internals/autofill_and_password_manager_internals.css +++ b/components/autofill/core/browser/autofill_and_password_manager_internals/autofill_and_password_manager_internals.css
@@ -175,8 +175,8 @@ display: none; } -.hide-AddressProfileFormImport.log-entry[scope='AddressProfileFormImport'], -.hide-AddressProfileFormImport.log-entry[scope='AddressProfileFormImport'] + hr { +.hide-AddressProfileFormImport .log-entry[scope='AddressProfileFormImport'], +.hide-AddressProfileFormImport .log-entry[scope='AddressProfileFormImport'] + hr { display: none; }
diff --git a/components/chromeos_camera/BUILD.gn b/components/chromeos_camera/BUILD.gn index 045fab8..562adf8 100644 --- a/components/chromeos_camera/BUILD.gn +++ b/components/chromeos_camera/BUILD.gn
@@ -189,19 +189,6 @@ } } -source_set("camera_app_helper") { - sources = [ - "camera_app_helper_impl.cc", - "camera_app_helper_impl.h", - ] - - deps = [ - "common:camera_app_helper", - "//ash/public/cpp", - "//ui/aura", - ] -} - test("jpeg_decode_accelerator_unittest") { deps = [ ":mjpeg_decode_accelerator",
diff --git a/components/chromeos_camera/DEPS b/components/chromeos_camera/DEPS index ad030f9..995c9eb 100644 --- a/components/chromeos_camera/DEPS +++ b/components/chromeos_camera/DEPS
@@ -1,5 +1,4 @@ include_rules = [ - "+ash/public/cpp", "+media", "+mojo", "+third_party/libyuv",
diff --git a/components/chromeos_camera/common/BUILD.gn b/components/chromeos_camera/common/BUILD.gn index 0385972..d49f9e7 100644 --- a/components/chromeos_camera/common/BUILD.gn +++ b/components/chromeos_camera/common/BUILD.gn
@@ -17,8 +17,3 @@ "//ui/gfx/geometry/mojom", ] } - -mojom("camera_app_helper") { - sources = [ "camera_app_helper.mojom" ] - deps = [ "//components/arc/mojom:camera_intent" ] -}
diff --git a/components/favicon/content/content_favicon_driver.cc b/components/favicon/content/content_favicon_driver.cc index 9bf90aa1..8c0135b2 100644 --- a/components/favicon/content/content_favicon_driver.cc +++ b/components/favicon/content/content_favicon_driver.cc
@@ -167,6 +167,7 @@ } void ContentFaviconDriver::DidUpdateFaviconURL( + content::RenderFrameHost* rfh, const std::vector<blink::mojom::FaviconURLPtr>& candidates) { // Ignore the update if there is no last committed navigation entry. This can // occur when loading an initially blank page. @@ -192,6 +193,7 @@ } void ContentFaviconDriver::DidUpdateWebManifestURL( + content::RenderFrameHost* rfh, const base::Optional<GURL>& manifest_url) { // Ignore the update if there is no last committed navigation entry. This can // occur when loading an initially blank page.
diff --git a/components/favicon/content/content_favicon_driver.h b/components/favicon/content/content_favicon_driver.h index 24bcac5..28f59854 100644 --- a/components/favicon/content/content_favicon_driver.h +++ b/components/favicon/content/content_favicon_driver.h
@@ -71,8 +71,10 @@ // content::WebContentsObserver implementation. void DidUpdateFaviconURL( + content::RenderFrameHost* rfh, const std::vector<blink::mojom::FaviconURLPtr>& candidates) override; void DidUpdateWebManifestURL( + content::RenderFrameHost* rfh, const base::Optional<GURL>& manifest_url) override; void DidStartNavigation( content::NavigationHandle* navigation_handle) override;
diff --git a/components/favicon/content/content_favicon_driver_unittest.cc b/components/favicon/content/content_favicon_driver_unittest.cc index eb11ffbf..fc6f18a 100644 --- a/components/favicon/content/content_favicon_driver_unittest.cc +++ b/components/favicon/content/content_favicon_driver_unittest.cc
@@ -81,7 +81,7 @@ ContentFaviconDriver::FromWebContents(web_contents()); web_contents_tester()->NavigateAndCommit(page_url); static_cast<content::WebContentsObserver*>(favicon_driver) - ->DidUpdateFaviconURL(candidates); + ->DidUpdateFaviconURL(web_contents()->GetMainFrame(), candidates); base::RunLoop().RunUntilIdle(); } @@ -113,7 +113,7 @@ favicon_urls.push_back(blink::mojom::FaviconURL::New( kIconURL, blink::mojom::FaviconIconType::kFavicon, kEmptyIconSizes)); static_cast<content::WebContentsObserver*>(favicon_driver) - ->DidUpdateFaviconURL(favicon_urls); + ->DidUpdateFaviconURL(web_contents()->GetMainFrame(), favicon_urls); base::RunLoop().RunUntilIdle(); EXPECT_FALSE(web_contents_tester()->HasPendingDownloadImage(kIconURL)); @@ -164,8 +164,8 @@ blink::mojom::FaviconIconType::kFavicon, kEmptyIconSizes)); favicon::ContentFaviconDriver* driver = favicon::ContentFaviconDriver::FromWebContents(web_contents()); - static_cast<content::WebContentsObserver*>(driver) - ->DidUpdateFaviconURL(favicon_urls); + static_cast<content::WebContentsObserver*>(driver)->DidUpdateFaviconURL( + web_contents()->GetMainFrame(), favicon_urls); // Test that ContentFaviconDriver ignored the favicon url update. EXPECT_TRUE(driver->favicon_urls().empty());
diff --git a/components/page_load_metrics/browser/observers/back_forward_cache_page_load_metrics_observer.cc b/components/page_load_metrics/browser/observers/back_forward_cache_page_load_metrics_observer.cc index 86ca538..a2a59d3 100644 --- a/components/page_load_metrics/browser/observers/back_forward_cache_page_load_metrics_observer.cc +++ b/components/page_load_metrics/browser/observers/back_forward_cache_page_load_metrics_observer.cc
@@ -32,8 +32,8 @@ // the tab wasn't backgrounded between // |back_forward_cache_restore_navigation_start| and // |first_paint_after_restore|. + auto first_paint = timing.back_forward_cache_timing + ->first_paint_after_back_forward_cache_restore.back(); PAGE_LOAD_HISTOGRAM( - internal::kHistogramFirstPaintAfterBackForwardCacheRestore, - timing.back_forward_cache_timing - ->first_paint_after_back_forward_cache_restore.value()); + internal::kHistogramFirstPaintAfterBackForwardCacheRestore, first_paint); }
diff --git a/components/page_load_metrics/browser/page_load_metrics_test_waiter.cc b/components/page_load_metrics/browser/page_load_metrics_test_waiter.cc index ce64265..f2e30fd2 100644 --- a/components/page_load_metrics/browser/page_load_metrics_test_waiter.cc +++ b/components/page_load_metrics/browser/page_load_metrics_test_waiter.cc
@@ -246,8 +246,8 @@ matched_bits.Set(TimingField::kFirstInputOrScroll); if (timing.interactive_timing->first_input_delay) matched_bits.Set(TimingField::kFirstInputDelay); - if (timing.back_forward_cache_timing - ->first_paint_after_back_forward_cache_restore) { + if (!timing.back_forward_cache_timing + ->first_paint_after_back_forward_cache_restore.empty()) { matched_bits.Set(TimingField::kFirstPaintAfterBackForwardCacheRestore); }
diff --git a/components/page_load_metrics/browser/page_load_tracker.cc b/components/page_load_metrics/browser/page_load_tracker.cc index e2899eca..f0a830a 100644 --- a/components/page_load_metrics/browser/page_load_tracker.cc +++ b/components/page_load_metrics/browser/page_load_tracker.cc
@@ -144,13 +144,10 @@ observer->OnFirstPaintInPage(new_timing); } if (new_timing.back_forward_cache_timing - ->first_paint_after_back_forward_cache_restore != + ->first_paint_after_back_forward_cache_restore.size() != last_timing.back_forward_cache_timing - ->first_paint_after_back_forward_cache_restore) { - if (new_timing.back_forward_cache_timing - ->first_paint_after_back_forward_cache_restore) { - observer->OnFirstPaintAfterBackForwardCacheRestoreInPage(new_timing); - } + ->first_paint_after_back_forward_cache_restore.size()) { + observer->OnFirstPaintAfterBackForwardCacheRestoreInPage(new_timing); } if (new_timing.paint_timing->first_image_paint && !last_timing.paint_timing->first_image_paint) {
diff --git a/components/page_load_metrics/common/page_load_metrics.mojom b/components/page_load_metrics/common/page_load_metrics.mojom index 7150bd8..5af4c61 100644 --- a/components/page_load_metrics/common/page_load_metrics.mojom +++ b/components/page_load_metrics/common/page_load_metrics.mojom
@@ -345,7 +345,8 @@ // TimeDeltas below relative to the navigation restoring page from the back- // forward cache. struct BackForwardCacheTiming { - // Time when the first paint is performed after the last time when the - // page is restored from the back-forward cache. - mojo_base.mojom.TimeDelta? first_paint_after_back_forward_cache_restore; + // Times when the first paint is performed after the time when the page + // is restored from the back-forward cache. + array<mojo_base.mojom.TimeDelta> + first_paint_after_back_forward_cache_restore; };
diff --git a/components/page_load_metrics/common/page_load_timing.cc b/components/page_load_metrics/common/page_load_timing.cc index cb6db27..4bad911 100644 --- a/components/page_load_metrics/common/page_load_timing.cc +++ b/components/page_load_metrics/common/page_load_timing.cc
@@ -44,7 +44,7 @@ } bool IsEmpty(const page_load_metrics::mojom::BackForwardCacheTiming& timing) { - return !timing.first_paint_after_back_forward_cache_restore; + return timing.first_paint_after_back_forward_cache_restore.empty(); } bool IsEmpty(const page_load_metrics::mojom::PageLoadTiming& timing) {
diff --git a/components/page_load_metrics/renderer/metrics_render_frame_observer.cc b/components/page_load_metrics/renderer/metrics_render_frame_observer.cc index 0627f519..e349baa 100644 --- a/components/page_load_metrics/renderer/metrics_render_frame_observer.cc +++ b/components/page_load_metrics/renderer/metrics_render_frame_observer.cc
@@ -446,11 +446,19 @@ } if (perf.FirstPaint() > 0.0) timing->paint_timing->first_paint = ClampDelta(perf.FirstPaint(), start); - if (perf.FirstPaintAfterBackForwardCacheRestore() > 0.0) { - double start = perf.LastBackForwardCacheRestoreNavigationStart(); - timing->back_forward_cache_timing - ->first_paint_after_back_forward_cache_restore = - ClampDelta(perf.FirstPaintAfterBackForwardCacheRestore(), start); + if (!perf.BackForwardCacheRestore().empty()) { + blink::WebPerformance::BackForwardCacheRestoreTimings restore_timings = + perf.BackForwardCacheRestore(); + for (const auto& restore_timing : restore_timings) { + double navigation_start = restore_timing.navigation_start; + double first_paint = restore_timing.first_paint; + if (!first_paint) { + continue; + } + timing->back_forward_cache_timing + ->first_paint_after_back_forward_cache_restore.push_back( + ClampDelta(first_paint, navigation_start)); + } } if (perf.FirstImagePaint() > 0.0) { timing->paint_timing->first_image_paint =
diff --git a/components/pdf/renderer/pdf_accessibility_tree.cc b/components/pdf/renderer/pdf_accessibility_tree.cc index 4b6b326..e956bf4 100644 --- a/components/pdf/renderer/pdf_accessibility_tree.cc +++ b/components/pdf/renderer/pdf_accessibility_tree.cc
@@ -410,6 +410,29 @@ return false; } + const std::vector<ppapi::PdfAccessibilityButtonInfo>& buttons = + page_objects.form_fields.buttons; + if (!std::is_sorted( + buttons.begin(), buttons.end(), + CompareTextRuns<ppapi::PdfAccessibilityButtonInfo>)) { + return false; + } + for (const ppapi::PdfAccessibilityButtonInfo& button : + buttons) { + // Text run index of an |button| works on the same logic as the text run + // index of a |link| as mentioned above. + if (button.text_run_index > text_runs.size()) + return false; + + // For radio button or checkbox, value of |button.control_index| should + // always be less than |button.control_count|. + if ((button.type == PP_PrivateButtonType::PP_PRIVATEBUTTON_CHECKBOX || + button.type == PP_PrivateButtonType::PP_PRIVATEBUTTON_RADIOBUTTON) && + (button.control_index >= button.control_count)) { + return false; + } + } + return true; }
diff --git a/components/pdf/renderer/pdf_accessibility_tree_unittest.cc b/components/pdf/renderer/pdf_accessibility_tree_unittest.cc index be0cbf40..9c6bd74 100644 --- a/components/pdf/renderer/pdf_accessibility_tree_unittest.cc +++ b/components/pdf/renderer/pdf_accessibility_tree_unittest.cc
@@ -300,4 +300,122 @@ page_objects)); } +TEST(PdfAccessibilityTreeUnitTest, UnsortedButtonVector) { + std::vector<ppapi::PdfAccessibilityTextRunInfo> text_runs; + text_runs.emplace_back(kFirstTextRun); + text_runs.emplace_back(kSecondTextRun); + + std::vector<PP_PrivateAccessibilityCharInfo> chars( + std::begin(kDummyCharsData), std::end(kDummyCharsData)); + + ppapi::PdfAccessibilityPageObjects page_objects; + + { + // Add first button in the vector. + ppapi::PdfAccessibilityButtonInfo button; + button.text_run_index = 2; + page_objects.form_fields.buttons.push_back(std::move(button)); + } + + { + // Add second button in the vector. + ppapi::PdfAccessibilityButtonInfo button; + button.text_run_index = 0; + page_objects.form_fields.buttons.push_back(std::move(button)); + } + + EXPECT_FALSE(PdfAccessibilityTree::IsDataFromPluginValid(text_runs, chars, + page_objects)); +} + +TEST(PdfAccessibilityTreeUnitTest, OutOfBoundButton) { + std::vector<ppapi::PdfAccessibilityTextRunInfo> text_runs; + text_runs.emplace_back(kFirstTextRun); + text_runs.emplace_back(kSecondTextRun); + + std::vector<PP_PrivateAccessibilityCharInfo> chars( + std::begin(kDummyCharsData), std::end(kDummyCharsData)); + + ppapi::PdfAccessibilityPageObjects page_objects; + + { + ppapi::PdfAccessibilityButtonInfo button; + button.text_run_index = 3; + page_objects.form_fields.buttons.push_back(std::move(button)); + } + + EXPECT_FALSE(PdfAccessibilityTree::IsDataFromPluginValid(text_runs, chars, + page_objects)); +} + +TEST(PdfAccessibilityTreeUnitTest, OutOfBoundRadioButton) { + std::vector<ppapi::PdfAccessibilityTextRunInfo> text_runs; + text_runs.emplace_back(kFirstTextRun); + text_runs.emplace_back(kSecondTextRun); + + std::vector<PP_PrivateAccessibilityCharInfo> chars( + std::begin(kDummyCharsData), std::end(kDummyCharsData)); + + ppapi::PdfAccessibilityPageObjects page_objects; + + { + ppapi::PdfAccessibilityButtonInfo button; + button.type = PP_PrivateButtonType::PP_PRIVATEBUTTON_RADIOBUTTON; + button.text_run_index = 0; + button.control_index = 1; + button.control_count = 2; + page_objects.form_fields.buttons.push_back(std::move(button)); + } + + EXPECT_TRUE(PdfAccessibilityTree::IsDataFromPluginValid(text_runs, chars, + page_objects)); + + { + ppapi::PdfAccessibilityButtonInfo button; + button.type = PP_PrivateButtonType::PP_PRIVATEBUTTON_RADIOBUTTON; + button.text_run_index = 0; + button.control_index = 3; + button.control_count = 2; + page_objects.form_fields.buttons.push_back(std::move(button)); + } + + EXPECT_FALSE(PdfAccessibilityTree::IsDataFromPluginValid(text_runs, chars, + page_objects)); +} + +TEST(PdfAccessibilityTreeUnitTest, OutOfBoundCheckBox) { + std::vector<ppapi::PdfAccessibilityTextRunInfo> text_runs; + text_runs.emplace_back(kFirstTextRun); + text_runs.emplace_back(kSecondTextRun); + + std::vector<PP_PrivateAccessibilityCharInfo> chars( + std::begin(kDummyCharsData), std::end(kDummyCharsData)); + + ppapi::PdfAccessibilityPageObjects page_objects; + + { + ppapi::PdfAccessibilityButtonInfo button; + button.type = PP_PrivateButtonType::PP_PRIVATEBUTTON_CHECKBOX; + button.text_run_index = 0; + button.control_index = 1; + button.control_count = 2; + page_objects.form_fields.buttons.push_back(std::move(button)); + } + + EXPECT_TRUE(PdfAccessibilityTree::IsDataFromPluginValid(text_runs, chars, + page_objects)); + + { + ppapi::PdfAccessibilityButtonInfo button; + button.type = PP_PrivateButtonType::PP_PRIVATEBUTTON_CHECKBOX; + button.text_run_index = 0; + button.control_index = 3; + button.control_count = 2; + page_objects.form_fields.buttons.push_back(std::move(button)); + } + + EXPECT_FALSE(PdfAccessibilityTree::IsDataFromPluginValid(text_runs, chars, + page_objects)); +} + } // namespace pdf
diff --git a/components/performance_manager/performance_manager_tab_helper.cc b/components/performance_manager/performance_manager_tab_helper.cc index 6b783a5..c221742b 100644 --- a/components/performance_manager/performance_manager_tab_helper.cc +++ b/components/performance_manager/performance_manager_tab_helper.cc
@@ -432,6 +432,7 @@ } void PerformanceManagerTabHelper::DidUpdateFaviconURL( + content::RenderFrameHost* render_frame_host, const std::vector<blink::mojom::FaviconURLPtr>& candidates) { // TODO(siggi): This logic belongs in the policy layer rather than here. if (!first_time_favicon_set_) {
diff --git a/components/performance_manager/performance_manager_tab_helper.h b/components/performance_manager/performance_manager_tab_helper.h index 2ad85365..8ffb2c7e 100644 --- a/components/performance_manager/performance_manager_tab_helper.h +++ b/components/performance_manager/performance_manager_tab_helper.h
@@ -76,6 +76,7 @@ content::WebContents* inner_web_contents) override; void WebContentsDestroyed() override; void DidUpdateFaviconURL( + content::RenderFrameHost* render_frame_host, const std::vector<blink::mojom::FaviconURLPtr>& candidates) override; // WebContentsProxyImpl overrides.
diff --git a/components/policy/core/common/policy_loader_win_unittest.cc b/components/policy/core/common/policy_loader_win_unittest.cc index e174229..8d6d9cd 100644 --- a/components/policy/core/common/policy_loader_win_unittest.cc +++ b/components/policy/core/common/policy_loader_win_unittest.cc
@@ -460,8 +460,8 @@ ->AddWarning(IDS_POLICY_CONFLICT_DIFF_VALUE); PolicyMap::Entry conflict(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, - POLICY_SOURCE_PLATFORM, - std::make_unique<base::Value>("hkcu"), nullptr); + POLICY_SOURCE_PLATFORM, base::Value("hkcu"), + nullptr); expected.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) .GetMutable(test_keys::kKeyString) ->AddConflictingPolicy(std::move(conflict)); @@ -521,15 +521,15 @@ expected_policy.GetMutable("a")->AddWarning(IDS_POLICY_CONFLICT_DIFF_VALUE); expected_policy.GetMutable("a")->AddWarning(IDS_POLICY_CONFLICT_DIFF_VALUE); - PolicyMap::Entry a_conflict_1( - POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, - std::make_unique<base::Value>(kMachineRecommended), nullptr); - PolicyMap::Entry a_conflict_2( - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_PLATFORM, - std::make_unique<base::Value>(kUserMandatory), nullptr); - PolicyMap::Entry a_conflict_3( - POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, POLICY_SOURCE_PLATFORM, - std::make_unique<base::Value>(kUserRecommended), nullptr); + PolicyMap::Entry a_conflict_1(POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_PLATFORM, + base::Value(kMachineRecommended), nullptr); + PolicyMap::Entry a_conflict_2(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_PLATFORM, + base::Value(kUserMandatory), nullptr); + PolicyMap::Entry a_conflict_3(POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, + POLICY_SOURCE_PLATFORM, + base::Value(kUserRecommended), nullptr); expected_policy.GetMutable("a")->AddConflictingPolicy( std::move(a_conflict_1)); expected_policy.GetMutable("a")->AddConflictingPolicy( @@ -543,12 +543,12 @@ expected_policy.GetMutable("b")->AddWarning(IDS_POLICY_CONFLICT_DIFF_VALUE); expected_policy.GetMutable("b")->AddWarning(IDS_POLICY_CONFLICT_DIFF_VALUE); - PolicyMap::Entry b_conflict_1( - POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, - std::make_unique<base::Value>(kMachineRecommended), nullptr); - PolicyMap::Entry b_conflict_2( - POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, POLICY_SOURCE_PLATFORM, - std::make_unique<base::Value>(kUserRecommended), nullptr); + PolicyMap::Entry b_conflict_1(POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_PLATFORM, + base::Value(kMachineRecommended), nullptr); + PolicyMap::Entry b_conflict_2(POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, + POLICY_SOURCE_PLATFORM, + base::Value(kUserRecommended), nullptr); expected_policy.GetMutable("b")->AddConflictingPolicy( std::move(b_conflict_1)); expected_policy.GetMutable("b")->AddConflictingPolicy( @@ -560,9 +560,9 @@ nullptr); expected_policy.GetMutable("c")->AddWarning(IDS_POLICY_CONFLICT_DIFF_VALUE); - PolicyMap::Entry c_conflict_1( - POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, POLICY_SOURCE_PLATFORM, - std::make_unique<base::Value>(kUserRecommended), nullptr); + PolicyMap::Entry c_conflict_1(POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, + POLICY_SOURCE_PLATFORM, + base::Value(kUserRecommended), nullptr); expected_policy.GetMutable("c")->AddConflictingPolicy( std::move(c_conflict_1));
diff --git a/components/policy/core/common/policy_map.cc b/components/policy/core/common/policy_map.cc index 8ed7e32..2ca93953 100644 --- a/components/policy/core/common/policy_map.cc +++ b/components/policy/core/common/policy_map.cc
@@ -8,10 +8,10 @@ #include <utility> #include "base/callback.h" -#include "base/optional.h" #include "base/stl_util.h" #include "base/strings/strcat.h" #include "base/strings/utf_string_conversions.h" +#include "base/values.h" #include "components/policy/core/common/policy_merger.h" #include "components/strings/grit/components_strings.h" @@ -42,19 +42,6 @@ PolicyLevel level, PolicyScope scope, PolicySource source, - std::unique_ptr<base::Value> value, - std::unique_ptr<ExternalDataFetcher> external_data_fetcher) - : Entry(level, - scope, - source, - value ? base::make_optional<base::Value>(std::move(*value)) - : base::nullopt, - std::move(external_data_fetcher)) {} - -PolicyMap::Entry::Entry( - PolicyLevel level, - PolicyScope scope, - PolicySource source, base::Optional<base::Value> value, std::unique_ptr<ExternalDataFetcher> external_data_fetcher) : level(level), @@ -231,7 +218,8 @@ PolicySource source, std::unique_ptr<base::Value> value, std::unique_ptr<ExternalDataFetcher> external_data_fetcher) { - Entry entry(level, scope, source, std::move(value), + Entry entry(level, scope, source, + value ? base::make_optional(std::move(*value)) : base::nullopt, std::move(external_data_fetcher)); Set(policy, std::move(entry)); }
diff --git a/components/policy/core/common/policy_map.h b/components/policy/core/common/policy_map.h index ba9a716..baccfbf 100644 --- a/components/policy/core/common/policy_map.h +++ b/components/policy/core/common/policy_map.h
@@ -48,11 +48,6 @@ Entry(PolicyLevel level, PolicyScope scope, PolicySource source, - std::unique_ptr<base::Value> value, - std::unique_ptr<ExternalDataFetcher> external_data_fetcher); - Entry(PolicyLevel level, - PolicyScope scope, - PolicySource source, base::Optional<base::Value> value, std::unique_ptr<ExternalDataFetcher> external_data_fetcher); ~Entry();
diff --git a/components/policy/core/common/policy_map_unittest.cc b/components/policy/core/common/policy_map_unittest.cc index cad5dc6..535883b 100644 --- a/components/policy/core/common/policy_map_unittest.cc +++ b/components/policy/core/common/policy_map_unittest.cc
@@ -347,61 +347,58 @@ // Case 1 - kTestPolicyName1 // Enterprise default policies should not be merged with other sources. PolicyMap::Entry case1(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, - POLICY_SOURCE_PLATFORM, - std::make_unique<base::Value>(abc), nullptr); + POLICY_SOURCE_PLATFORM, base::Value(abc), nullptr); case1.AddConflictingPolicy(PolicyMap::Entry( POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_ACTIVE_DIRECTORY, - std::make_unique<base::Value>(cd), nullptr)); + base::Value(cd), nullptr)); - case1.AddConflictingPolicy( - PolicyMap::Entry(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, - POLICY_SOURCE_ENTERPRISE_DEFAULT, - std::make_unique<base::Value>(ef), nullptr)); + case1.AddConflictingPolicy(PolicyMap::Entry( + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_ENTERPRISE_DEFAULT, base::Value(ef), nullptr)); - case1.AddConflictingPolicy( - PolicyMap::Entry(POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, - POLICY_SOURCE_ENTERPRISE_DEFAULT, - std::make_unique<base::Value>(ef), nullptr)); + case1.AddConflictingPolicy(PolicyMap::Entry( + POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, + POLICY_SOURCE_ENTERPRISE_DEFAULT, base::Value(ef), nullptr)); PolicyMap::Entry expected_case1(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, - POLICY_SOURCE_MERGED, - std::make_unique<base::Value>(abcd), nullptr); + POLICY_SOURCE_MERGED, base::Value(abcd), + nullptr); expected_case1.AddConflictingPolicy(case1.DeepCopy()); // Case 2 - kTestPolicyName2 // Policies should only be merged with other policies with the same target, // level and scope. PolicyMap::Entry case2(POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, - POLICY_SOURCE_PRIORITY_CLOUD, - std::make_unique<base::Value>(int12), nullptr); + POLICY_SOURCE_PRIORITY_CLOUD, base::Value(int12), + nullptr); - case2.AddConflictingPolicy(PolicyMap::Entry( - POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, - std::make_unique<base::Value>(int34), nullptr)); + case2.AddConflictingPolicy( + PolicyMap::Entry(POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_PLATFORM, base::Value(int34), nullptr)); - case2.AddConflictingPolicy(PolicyMap::Entry( - POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, POLICY_SOURCE_PLATFORM, - std::make_unique<base::Value>(int56), nullptr)); + case2.AddConflictingPolicy( + PolicyMap::Entry(POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, + POLICY_SOURCE_PLATFORM, base::Value(int56), nullptr)); - PolicyMap::Entry expected_case2( - POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, POLICY_SOURCE_MERGED, - std::make_unique<base::Value>(int1234), nullptr); + PolicyMap::Entry expected_case2(POLICY_LEVEL_RECOMMENDED, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_MERGED, + base::Value(int1234), nullptr); expected_case2.AddConflictingPolicy(case2.DeepCopy()); // Case 3 - kTestPolicyName3 // Trivial case with 2 sources. PolicyMap::Entry case3(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, - POLICY_SOURCE_PRIORITY_CLOUD, - std::make_unique<base::Value>(ab), nullptr); + POLICY_SOURCE_PRIORITY_CLOUD, base::Value(ab), + nullptr); - case3.AddConflictingPolicy(PolicyMap::Entry( - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, - std::make_unique<base::Value>(cd), nullptr)); + case3.AddConflictingPolicy( + PolicyMap::Entry(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_PLATFORM, base::Value(cd), nullptr)); PolicyMap::Entry expected_case3(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, - POLICY_SOURCE_MERGED, - std::make_unique<base::Value>(abcd), nullptr); + POLICY_SOURCE_MERGED, base::Value(abcd), + nullptr); auto case3_blocked_by_group = expected_case3.DeepCopy(); case3_blocked_by_group.SetIgnoredByPolicyAtomicGroup(); expected_case3.AddConflictingPolicy(case3.DeepCopy()); @@ -409,11 +406,11 @@ // Case 4 - kTestPolicyName4 // Policies with a single source should stay the same. PolicyMap::Entry case4(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, - POLICY_SOURCE_ACTIVE_DIRECTORY, - std::make_unique<base::Value>(ef), nullptr); + POLICY_SOURCE_ACTIVE_DIRECTORY, base::Value(ef), + nullptr); PolicyMap::Entry expected_case4(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, - POLICY_SOURCE_MERGED, - std::make_unique<base::Value>(ef), nullptr); + POLICY_SOURCE_MERGED, base::Value(ef), + nullptr); expected_case4.AddConflictingPolicy(case4.DeepCopy()); // Case 5 - kTestPolicyName5 @@ -422,48 +419,46 @@ // is added to the entry and the policy stays intact. PolicyMap::Entry case5(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_ACTIVE_DIRECTORY, - std::make_unique<base::Value>("bad stuff"), nullptr); + base::Value("bad stuff"), nullptr); PolicyMap::Entry expected_case5(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_ACTIVE_DIRECTORY, - std::make_unique<base::Value>("bad stuff"), - nullptr); + base::Value("bad stuff"), nullptr); expected_case5.AddError(IDS_POLICY_LIST_MERGING_WRONG_POLICY_TYPE_SPECIFIED); // Case 6 - kTestPolicyName6 // User cloud policies should not be merged with other sources. PolicyMap::Entry case6(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, - POLICY_SOURCE_PLATFORM, - std::make_unique<base::Value>(ab), nullptr); - case6.AddConflictingPolicy(PolicyMap::Entry( - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, - std::make_unique<base::Value>(cd), nullptr)); - case6.AddConflictingPolicy(PolicyMap::Entry( - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_PRIORITY_CLOUD, - std::make_unique<base::Value>(ef), nullptr)); + POLICY_SOURCE_PLATFORM, base::Value(ab), nullptr); + case6.AddConflictingPolicy( + PolicyMap::Entry(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_CLOUD, base::Value(cd), nullptr)); + case6.AddConflictingPolicy( + PolicyMap::Entry(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_PRIORITY_CLOUD, base::Value(ef), nullptr)); PolicyMap::Entry expected_case6(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, - POLICY_SOURCE_MERGED, - std::make_unique<base::Value>(ab), nullptr); + POLICY_SOURCE_MERGED, base::Value(ab), + nullptr); expected_case6.AddConflictingPolicy(case6.DeepCopy()); // Case 7 - kTestPolicyName7 // Lists of dictionaries should not have duplicates. PolicyMap::Entry case7(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, - POLICY_SOURCE_PLATFORM, - std::make_unique<base::Value>(list_dict_abd), nullptr); + POLICY_SOURCE_PLATFORM, base::Value(list_dict_abd), + nullptr); case7.AddConflictingPolicy(PolicyMap::Entry( POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_ACTIVE_DIRECTORY, - std::make_unique<base::Value>(list_dict_abd), nullptr)); + base::Value(list_dict_abd), nullptr)); case7.AddConflictingPolicy( PolicyMap::Entry(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_DEVICE_LOCAL_ACCOUNT_OVERRIDE, - std::make_unique<base::Value>(list_dict_c), nullptr)); + base::Value(list_dict_c), nullptr)); - PolicyMap::Entry expected_case7( - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_MERGED, - std::make_unique<base::Value>(list_dict_abcd), nullptr); + PolicyMap::Entry expected_case7(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_MERGED, + base::Value(list_dict_abcd), nullptr); expected_case7.AddConflictingPolicy(case7.DeepCopy()); PolicyMap policy_not_merged; @@ -545,24 +540,19 @@ // Case 1: kTestPolicyName1 - Merging should only keep keys with the highest // priority PolicyMap::Entry case1(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, - POLICY_SOURCE_PRIORITY_CLOUD, - base::Value::ToUniquePtrValue(dict_a.Clone()), - nullptr); + POLICY_SOURCE_PRIORITY_CLOUD, dict_a.Clone(), nullptr); + case1.AddConflictingPolicy( + PolicyMap::Entry(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_PLATFORM, dict_b.Clone(), nullptr)); case1.AddConflictingPolicy(PolicyMap::Entry( - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, - base::Value::ToUniquePtrValue(dict_b.Clone()), nullptr)); - case1.AddConflictingPolicy( - PolicyMap::Entry(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, - POLICY_SOURCE_DEVICE_LOCAL_ACCOUNT_OVERRIDE, - base::Value::ToUniquePtrValue(dict_c.Clone()), nullptr)); - case1.AddConflictingPolicy( - PolicyMap::Entry(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, - POLICY_SOURCE_ACTIVE_DIRECTORY, - base::Value::ToUniquePtrValue(dict_d.Clone()), nullptr)); - case1.AddConflictingPolicy( - PolicyMap::Entry(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, - POLICY_SOURCE_ACTIVE_DIRECTORY, - base::Value::ToUniquePtrValue(dict_f.Clone()), nullptr)); + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_DEVICE_LOCAL_ACCOUNT_OVERRIDE, dict_c.Clone(), nullptr)); + case1.AddConflictingPolicy(PolicyMap::Entry( + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_ACTIVE_DIRECTORY, dict_d.Clone(), nullptr)); + case1.AddConflictingPolicy(PolicyMap::Entry( + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_ACTIVE_DIRECTORY, dict_f.Clone(), nullptr)); base::Value merged_dict_case1(base::Value::Type::DICTIONARY); merged_dict_case1.MergeDictionary(&dict_f); @@ -571,74 +561,68 @@ merged_dict_case1.MergeDictionary(&dict_b); merged_dict_case1.MergeDictionary(&dict_a); - PolicyMap::Entry expected_case1( - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_MERGED, - base::Value::ToUniquePtrValue(merged_dict_case1.Clone()), nullptr); + PolicyMap::Entry expected_case1(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_MERGED, + merged_dict_case1.Clone(), nullptr); expected_case1.AddConflictingPolicy(case1.DeepCopy()); // Case - kTestPolicyName2 // Policies should only be merged with other policies with the same target, // level and scope. PolicyMap::Entry case2(POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, - POLICY_SOURCE_PRIORITY_CLOUD, - base::Value::ToUniquePtrValue(dict_e.Clone()), - nullptr); + POLICY_SOURCE_PRIORITY_CLOUD, dict_e.Clone(), nullptr); - case2.AddConflictingPolicy(PolicyMap::Entry( - POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, - base::Value::ToUniquePtrValue(dict_f.Clone()), nullptr)); + case2.AddConflictingPolicy( + PolicyMap::Entry(POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_PLATFORM, dict_f.Clone(), nullptr)); - case2.AddConflictingPolicy(PolicyMap::Entry( - POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, POLICY_SOURCE_PLATFORM, - base::Value::ToUniquePtrValue(dict_a.Clone()), nullptr)); + case2.AddConflictingPolicy( + PolicyMap::Entry(POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, + POLICY_SOURCE_PLATFORM, dict_a.Clone(), nullptr)); base::Value merged_dict_case2(base::Value::Type::DICTIONARY); merged_dict_case2.MergeDictionary(&dict_f); merged_dict_case2.MergeDictionary(&dict_e); - PolicyMap::Entry expected_case2( - POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, POLICY_SOURCE_MERGED, - base::Value::ToUniquePtrValue(merged_dict_case2.Clone()), nullptr); + PolicyMap::Entry expected_case2(POLICY_LEVEL_RECOMMENDED, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_MERGED, + merged_dict_case2.Clone(), nullptr); expected_case2.AddConflictingPolicy(case2.DeepCopy()); // Case 3 - kTestPolicyName3 // Enterprise default policies should not be merged with other sources. - PolicyMap::Entry case3( - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_PLATFORM, - base::Value::ToUniquePtrValue(dict_a.Clone()), nullptr); + PolicyMap::Entry case3(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_PLATFORM, dict_a.Clone(), nullptr); case3.AddConflictingPolicy(PolicyMap::Entry( POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_ACTIVE_DIRECTORY, - base::Value::ToUniquePtrValue(dict_b.Clone()), nullptr)); + dict_b.Clone(), nullptr)); - case3.AddConflictingPolicy( - PolicyMap::Entry(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, - POLICY_SOURCE_ENTERPRISE_DEFAULT, - base::Value::ToUniquePtrValue(dict_e.Clone()), nullptr)); + case3.AddConflictingPolicy(PolicyMap::Entry( + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_ENTERPRISE_DEFAULT, dict_e.Clone(), nullptr)); - case3.AddConflictingPolicy( - PolicyMap::Entry(POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, - POLICY_SOURCE_ENTERPRISE_DEFAULT, - base::Value::ToUniquePtrValue(dict_f.Clone()), nullptr)); + case3.AddConflictingPolicy(PolicyMap::Entry( + POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, + POLICY_SOURCE_ENTERPRISE_DEFAULT, dict_f.Clone(), nullptr)); base::Value merged_dict_case3(base::Value::Type::DICTIONARY); merged_dict_case3.MergeDictionary(&dict_b); merged_dict_case3.MergeDictionary(&dict_a); - PolicyMap::Entry expected_case3( - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_MERGED, - base::Value::ToUniquePtrValue(merged_dict_case3.Clone()), nullptr); + PolicyMap::Entry expected_case3(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_MERGED, + merged_dict_case3.Clone(), nullptr); expected_case3.AddConflictingPolicy(case3.DeepCopy()); // Case 4 - kTestPolicyName4 // Policies with a single source should be merged. PolicyMap::Entry case4(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, - POLICY_SOURCE_ACTIVE_DIRECTORY, - base::Value::ToUniquePtrValue(dict_a.Clone()), + POLICY_SOURCE_ACTIVE_DIRECTORY, dict_a.Clone(), nullptr); - PolicyMap::Entry expected_case4( - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_MERGED, - base::Value::ToUniquePtrValue(dict_a.Clone()), nullptr); + PolicyMap::Entry expected_case4(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_MERGED, dict_a.Clone(), + nullptr); expected_case4.AddConflictingPolicy(case4.DeepCopy()); // Case 5 - kTestPolicyName5 @@ -647,29 +631,27 @@ // is added to the entry and the policy stays intact. PolicyMap::Entry case5(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_ACTIVE_DIRECTORY, - std::make_unique<base::Value>("bad stuff"), nullptr); + base::Value("bad stuff"), nullptr); PolicyMap::Entry expected_case5(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_ACTIVE_DIRECTORY, - std::make_unique<base::Value>("bad stuff"), - nullptr); + base::Value("bad stuff"), nullptr); expected_case5.AddError( IDS_POLICY_DICTIONARY_MERGING_WRONG_POLICY_TYPE_SPECIFIED); // Case 6 - kTestPolicyName6 // User cloud policies should not be merged with other sources. - PolicyMap::Entry case6( - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_PLATFORM, - base::Value::ToUniquePtrValue(dict_a.Clone()), nullptr); - case6.AddConflictingPolicy(PolicyMap::Entry( - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, - base::Value::ToUniquePtrValue(dict_e.Clone()), nullptr)); - case6.AddConflictingPolicy(PolicyMap::Entry( - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_PRIORITY_CLOUD, - base::Value::ToUniquePtrValue(dict_f.Clone()), nullptr)); - PolicyMap::Entry expected_case6( - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_MERGED, - base::Value::ToUniquePtrValue(dict_a.Clone()), nullptr); + PolicyMap::Entry case6(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_PLATFORM, dict_a.Clone(), nullptr); + case6.AddConflictingPolicy( + PolicyMap::Entry(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_CLOUD, dict_e.Clone(), nullptr)); + case6.AddConflictingPolicy( + PolicyMap::Entry(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_PRIORITY_CLOUD, dict_f.Clone(), nullptr)); + PolicyMap::Entry expected_case6(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_MERGED, dict_a.Clone(), + nullptr); expected_case6.AddConflictingPolicy(case6.DeepCopy()); // Case 7 - kTestPolicyName7 @@ -677,8 +659,7 @@ // If such a policy is explicitly in the list of policies to merge, an error // is added to the entry and the policy stays intact. PolicyMap::Entry case7(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, - POLICY_SOURCE_ACTIVE_DIRECTORY, - base::Value::ToUniquePtrValue(dict_a.Clone()), + POLICY_SOURCE_ACTIVE_DIRECTORY, dict_a.Clone(), nullptr); PolicyMap::Entry expected_case7 = case7.DeepCopy(); @@ -751,32 +732,30 @@ // Should not be affected by the atomic groups PolicyMap::Entry platform_user_mandatory( POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_PLATFORM, - std::make_unique<base::Value>(abc), nullptr); - - platform_user_mandatory.AddConflictingPolicy(PolicyMap::Entry( - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, - std::make_unique<base::Value>(cd), nullptr)); + base::Value(abc), nullptr); platform_user_mandatory.AddConflictingPolicy( PolicyMap::Entry(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, - POLICY_SOURCE_ENTERPRISE_DEFAULT, - std::make_unique<base::Value>(ef), nullptr)); + POLICY_SOURCE_CLOUD, base::Value(cd), nullptr)); - platform_user_mandatory.AddConflictingPolicy( - PolicyMap::Entry(POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, - POLICY_SOURCE_ENTERPRISE_DEFAULT, - std::make_unique<base::Value>(ef), nullptr)); + platform_user_mandatory.AddConflictingPolicy(PolicyMap::Entry( + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_ENTERPRISE_DEFAULT, base::Value(ef), nullptr)); + + platform_user_mandatory.AddConflictingPolicy(PolicyMap::Entry( + POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, + POLICY_SOURCE_ENTERPRISE_DEFAULT, base::Value(ef), nullptr)); // Case 2 - policy::key::kExtensionInstallBlacklist // This policy is part of the atomic group "Extensions" and has the highest // source in its group, its value should remain the same. PolicyMap::Entry cloud_machine_mandatory( POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, - POLICY_SOURCE_PRIORITY_CLOUD, std::make_unique<base::Value>(ab), nullptr); + POLICY_SOURCE_PRIORITY_CLOUD, base::Value(ab), nullptr); - cloud_machine_mandatory.AddConflictingPolicy(PolicyMap::Entry( - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, - std::make_unique<base::Value>(cd), nullptr)); + cloud_machine_mandatory.AddConflictingPolicy( + PolicyMap::Entry(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_PLATFORM, base::Value(cd), nullptr)); // Case 3 - policy::key::kExtensionInstallWhitelist // This policy is part of the atomic group "Extensions" and has a lower @@ -784,8 +763,7 @@ // its value should be ignored. PolicyMap::Entry ad_machine_mandatory( POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, - POLICY_SOURCE_ACTIVE_DIRECTORY, std::make_unique<base::Value>(ef), - nullptr); + POLICY_SOURCE_ACTIVE_DIRECTORY, base::Value(ef), nullptr); auto ad_machine_mandatory_ignored = ad_machine_mandatory.DeepCopy(); ad_machine_mandatory_ignored.SetIgnoredByPolicyAtomicGroup(); @@ -794,7 +772,7 @@ // source in its group, its value should remain the same. PolicyMap::Entry cloud_machine_recommended( POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, - POLICY_SOURCE_PRIORITY_CLOUD, std::make_unique<base::Value>(ab), nullptr); + POLICY_SOURCE_PRIORITY_CLOUD, base::Value(ab), nullptr); PolicyMap policy_not_merged; policy_not_merged.Set(kTestPolicyName1, platform_user_mandatory.DeepCopy()); @@ -957,8 +935,7 @@ TEST_F(PolicyMapTest, BlockedEntry) { PolicyMap::Entry entry_a(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, - POLICY_SOURCE_CLOUD, - std::make_unique<base::Value>("a"), nullptr); + POLICY_SOURCE_CLOUD, base::Value("a"), nullptr); PolicyMap::Entry entry_b = entry_a.DeepCopy(); entry_b.set_value(std::make_unique<base::Value>("b")); PolicyMap::Entry entry_c_blocked = entry_a.DeepCopy(); @@ -1010,8 +987,7 @@ TEST_F(PolicyMapTest, InvalidEntry) { PolicyMap::Entry entry_a(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, - POLICY_SOURCE_CLOUD, - std::make_unique<base::Value>("a"), nullptr); + POLICY_SOURCE_CLOUD, base::Value("a"), nullptr); PolicyMap::Entry entry_b_invalid = entry_a.DeepCopy(); entry_b_invalid.set_value(std::make_unique<base::Value>("b")); entry_b_invalid.SetInvalid();
diff --git a/components/policy/core/common/policy_service_impl_unittest.cc b/components/policy/core/common/policy_service_impl_unittest.cc index 08f0422..68ebe0d4 100644 --- a/components/policy/core/common/policy_service_impl_unittest.cc +++ b/components/policy/core/common/policy_service_impl_unittest.cc
@@ -106,7 +106,7 @@ class PolicyServiceTest : public testing::Test { public: - PolicyServiceTest() {} + PolicyServiceTest() = default; void SetUp() override { EXPECT_CALL(provider0_, IsInitializationComplete(_)) .WillRepeatedly(Return(true)); @@ -941,19 +941,16 @@ TEST_F(PolicyServiceTest, DictionaryPoliciesMerging) { const PolicyNamespace chrome_namespace(POLICY_DOMAIN_CHROME, std::string()); - std::unique_ptr<base::Value> dict1 = - std::make_unique<base::Value>(base::Value::Type::DICTIONARY); - dict1->SetBoolKey("google.com", false); - dict1->SetBoolKey("gmail.com", true); - std::unique_ptr<base::Value> dict2 = - std::make_unique<base::Value>(base::Value::Type::DICTIONARY); - dict2->SetBoolKey("example.com", true); - dict2->SetBoolKey("gmail.com", false); - std::unique_ptr<base::Value> result = - std::make_unique<base::Value>(base::Value::Type::DICTIONARY); - result->SetBoolKey("google.com", false); - result->SetBoolKey("gmail.com", false); - result->SetBoolKey("example.com", true); + base::Value dict1(base::Value::Type::DICTIONARY); + dict1.SetBoolKey("google.com", false); + dict1.SetBoolKey("gmail.com", true); + base::Value dict2 = base::Value(base::Value::Type::DICTIONARY); + dict2.SetBoolKey("example.com", true); + dict2.SetBoolKey("gmail.com", false); + base::Value result = base::Value(base::Value::Type::DICTIONARY); + result.SetBoolKey("google.com", false); + result.SetBoolKey("gmail.com", false); + result.SetBoolKey("example.com", true); std::unique_ptr<base::Value> policy = std::make_unique<base::Value>(base::Value::Type::LIST); @@ -1003,16 +1000,16 @@ TEST_F(PolicyServiceTest, ListsPoliciesMerging) { const PolicyNamespace chrome_namespace(POLICY_DOMAIN_CHROME, std::string()); - std::unique_ptr<base::ListValue> list1 = std::make_unique<base::ListValue>(); - list1->Append(base::Value("google.com")); - list1->Append(base::Value("gmail.com")); - std::unique_ptr<base::ListValue> list2 = std::make_unique<base::ListValue>(); - list2->Append(base::Value("example.com")); - list2->Append(base::Value("gmail.com")); - std::unique_ptr<base::ListValue> result = std::make_unique<base::ListValue>(); - result->Append(base::Value("google.com")); - result->Append(base::Value("gmail.com")); - result->Append(base::Value("example.com")); + base::Value list1(base::Value::Type::LIST); + list1.Append(base::Value("google.com")); + list1.Append(base::Value("gmail.com")); + base::Value list2 = base::Value(base::Value::Type::LIST); + list2.Append(base::Value("example.com")); + list2.Append(base::Value("gmail.com")); + base::Value result = base::Value(base::Value::Type::LIST); + result.Append(base::Value("google.com")); + result.Append(base::Value("gmail.com")); + result.Append(base::Value("example.com")); std::unique_ptr<base::ListValue> policy = std::make_unique<base::ListValue>(); policy->Append(base::Value(policy::key::kExtensionInstallForcelist)); @@ -1060,15 +1057,15 @@ TEST_F(PolicyServiceTest, GroupPoliciesMergingDisabledForCloudUsers) { const PolicyNamespace chrome_namespace(POLICY_DOMAIN_CHROME, std::string()); - std::unique_ptr<base::ListValue> list1 = std::make_unique<base::ListValue>(); - list1->Append(base::Value("google.com")); - std::unique_ptr<base::ListValue> list2 = std::make_unique<base::ListValue>(); - list2->Append(base::Value("example.com")); - std::unique_ptr<base::ListValue> list3 = std::make_unique<base::ListValue>(); - list3->Append(base::Value("example_xyz.com")); - std::unique_ptr<base::ListValue> result = std::make_unique<base::ListValue>(); - result->Append(base::Value("google.com")); - result->Append(base::Value("example.com")); + base::Value list1(base::Value::Type::LIST); + list1.Append(base::Value("google.com")); + base::Value list2(base::Value::Type::LIST); + list2.Append(base::Value("example.com")); + base::Value list3(base::Value::Type::LIST); + list3.Append(base::Value("example_xyz.com")); + base::Value result(base::Value::Type::LIST); + result.Append(base::Value("google.com")); + result.Append(base::Value("example.com")); std::unique_ptr<base::ListValue> policy = std::make_unique<base::ListValue>(); policy->Append(base::Value(policy::key::kExtensionInstallForcelist)); @@ -1085,9 +1082,9 @@ nullptr); policy_map1.Set(key::kExtensionInstallForcelist, entry_list_1.DeepCopy()); policy_map1.Set(key::kExtensionInstallBlacklist, entry_list_1.DeepCopy()); - PolicyMap::Entry atomic_policy_enabled( - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, - std::make_unique<base::Value>(true), nullptr); + PolicyMap::Entry atomic_policy_enabled(POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, + base::Value(true), nullptr); policy_map1.Set(key::kPolicyAtomicGroupsEnabled, atomic_policy_enabled.DeepCopy()); @@ -1131,15 +1128,15 @@ TEST_F(PolicyServiceTest, GroupPoliciesMergingEnabled) { const PolicyNamespace chrome_namespace(POLICY_DOMAIN_CHROME, std::string()); - std::unique_ptr<base::ListValue> list1 = std::make_unique<base::ListValue>(); - list1->Append(base::Value("google.com")); - std::unique_ptr<base::ListValue> list2 = std::make_unique<base::ListValue>(); - list2->Append(base::Value("example.com")); - std::unique_ptr<base::ListValue> list3 = std::make_unique<base::ListValue>(); - list3->Append(base::Value("example_xyz.com")); - std::unique_ptr<base::ListValue> result = std::make_unique<base::ListValue>(); - result->Append(base::Value("google.com")); - result->Append(base::Value("example.com")); + base::Value list1(base::Value::Type::LIST); + list1.Append(base::Value("google.com")); + base::Value list2(base::Value::Type::LIST); + list2.Append(base::Value("example.com")); + base::Value list3(base::Value::Type::LIST); + list3.Append(base::Value("example_xyz.com")); + base::Value result(base::Value::Type::LIST); + result.Append(base::Value("google.com")); + result.Append(base::Value("example.com")); std::unique_ptr<base::ListValue> policy = std::make_unique<base::ListValue>(); policy->Append(base::Value(policy::key::kExtensionInstallForcelist)); @@ -1158,7 +1155,7 @@ policy_map1.Set(key::kExtensionInstallBlacklist, entry_list_1.DeepCopy()); PolicyMap::Entry atomic_policy_enabled( POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_PLATFORM, - std::make_unique<base::Value>(true), nullptr); + base::Value(true), nullptr); policy_map1.Set(key::kPolicyAtomicGroupsEnabled, atomic_policy_enabled.DeepCopy());
diff --git a/components/policy/resources/policy_templates_de.xtb b/components/policy/resources/policy_templates_de.xtb index 48f94d0..e8a52d6 100644 --- a/components/policy/resources/policy_templates_de.xtb +++ b/components/policy/resources/policy_templates_de.xtb
@@ -1406,17 +1406,6 @@ Wenn diese Richtlinie nicht konfiguriert oder der Wert nach dem Ersetzen kein gültiger Hostname ist, wird in der DHCP-Anfrage kein Hostname festgelegt. </translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> -<translation id="3063659901357934128">Gestattet <ph name="PRODUCT_NAME" /> das Laden experimenteller Richtlinien. - - WARNUNG: Experimentelle Richtlinien werden nicht unterstützt und können ohne vorherige Ankündigung in künftigen Versionen des Browsers geändert oder entfernt werden! - - Die Entwicklung einer experimentellen Richtlinie ist möglicherweise noch nicht abgeschlossen. Auch kann sie bekannte oder unbekannte Mängel aufweisen. Sie kann unangekündigt geändert oder entfernt werden. Wenn Sie experimentelle Richtlinien aktivieren, besteht die Gefahr, Browserdaten zu verlieren oder Ihre Sicherheit und Privatsphäre zu gefährden. - - Steht eine Richtlinie nicht auf der Liste und wurde sie nicht offiziell veröffentlicht, dann wird ihr Wert in Beta- und stabilen Chrome-Versionen ignoriert. - - Steht eine Richtlinie auf der Liste, dann wird ihr Wert angewendet, auch wenn sie noch nicht offiziell veröffentlicht wurde. - - Diese Richtlinie hat keine Auswirkung auf bereits veröffentlichte Richtlinien.</translation> <translation id="3066446511111537292">Nutzern dieses Geräts erlauben, ADB-Sideloading zu verwenden</translation> <translation id="3069958900488014740">Erlaubt die Deaktivierung der WPAD-Optimierung (Web Proxy Auto-Discovery) in <ph name="PRODUCT_NAME" />.
diff --git a/components/policy/resources/policy_templates_es-419.xtb b/components/policy/resources/policy_templates_es-419.xtb index 8a6713e..ab9d0c0 100644 --- a/components/policy/resources/policy_templates_es-419.xtb +++ b/components/policy/resources/policy_templates_es-419.xtb
@@ -1403,17 +1403,6 @@ Si no se establece esta política, o si el valor que se obtiene después de la sustitución no es un nombre de host válido, no se establecerá ningún nombre de host en la solicitud de DHCP. </translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> -<translation id="3063659901357934128">Permite que <ph name="PRODUCT_NAME" /> cargue las políticas experimentales. - - ADVERTENCIA: Las políticas experimentales no son compatibles y pueden modificarse o quitarse sin previo aviso en futuras versiones del navegador. - - Es posible que una política experimental no esté terminada o tenga defectos conocidos o desconocidos. Esta política puede modificarse o quitarse sin previo aviso. Si habilitas las políticas experimentales, podrías perder datos de navegación o poner en riesgo tu seguridad o privacidad. - - Si una política no se encuentra en la lista y no se publicó oficialmente, se ignorará su valor en las versiones Beta y estable de Chrome. - - Si una política se encuentra en la lista, pero no se publicó oficialmente, se aplicará su valor. - - Esta política no prevalecerá sobre las políticas ya publicadas.</translation> <translation id="3066446511111537292">Permite que los usuarios afiliados de este dispositivo apliquen la transferencia de ADB</translation> <translation id="3069958900488014740">Permite desactivar la optimización de WPAD (Web Proxy Auto-Discovery) en <ph name="PRODUCT_NAME" />. @@ -2988,7 +2977,7 @@ Se planea quitar esta política en la versión <ph name="PRODUCT_NAME" /> 87 para Mac OS, cuando se quite la compatibilidad con el verificador de certificados heredado de Mac OS X. </translation> -<translation id="5494917047563607689">Si se establece en menos de 1 MB o no se establece, <ph name="PRODUCT_OS_NAME" /> usará el tamaño predeterminado para almacenar en caché las apps y extensiones cuando las instalan varios usuarios del mismo dispositivo. Esta acción evitará que cada usuario las tenga que volver a descargar.</translation> +<translation id="5494917047563607689">Si se establece en menos de 1 MB o no se establece, el <ph name="PRODUCT_OS_NAME" /> usará el tamaño predeterminado para almacenar en caché las apps y extensiones cuando las instalan varios usuarios del mismo dispositivo. Esta acción evitará que cada usuario las tenga que volver a descargar.</translation> <translation id="5498045818698736356">Especifica una lista de aplicaciones web que se instalan de manera silenciosa, sin interacción del usuario y que este no puede desinstalar ni inhabilitar. Cada elemento de la lista de la política es un objeto con un miembro obligatorio "url" y dos miembros opcionales: "default_launch_container" y "create_desktop_shortcut". "url" debe ser la URL de la aplicación web que se va a instalar, "launch_container" debe ser "window" o "tab" para indicar cómo se abrirá la app una vez que se instale, y "create_desktop_shortcut" debe ser verdadero para crear un acceso directo de escritorio en Linux y Windows. Si se omite "default_launch_container", se abrirá la app en una pestaña de forma predeterminada. Más allá del valor de "default_launch_container", los usuarios podrán cambiar el contenedor donde se abrirá la app. Si se omite "create_desktop_shortcuts", no se crearán accesos directos de escritorio. Consulta la política <ph name="PINNED_LAUNCHER_APPS_POLICY_NAME" /> para fijar apps a la biblioteca de ChromeOS.</translation>
diff --git a/components/policy/resources/policy_templates_es.xtb b/components/policy/resources/policy_templates_es.xtb index a104e98..ba253dc2 100644 --- a/components/policy/resources/policy_templates_es.xtb +++ b/components/policy/resources/policy_templates_es.xtb
@@ -1440,17 +1440,6 @@ Si no se asigna ningún valor a esta política o si el valor que se obtiene de la sustitución no es un nombre de host válido, no se establece ningún nombre de host en la solicitud DHCP. </translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> -<translation id="3063659901357934128">Permite a <ph name="PRODUCT_NAME" /> cargar políticas experimentales. - - ADVERTENCIA: No se ofrece asistencia para las políticas experimentales. Además, estas pueden modificarse o eliminarse sin previo aviso en futuras versiones del navegador. - - Las políticas experimentales pueden no haberse completado o tener defectos conocidos o desconocidos. Pueden también modificarse o eliminarse sin notificación previa. Si habilitas las políticas experimentales, podrías perder datos de navegación o poner en peligro tu seguridad o privacidad. - - Si una política no está en la lista y no se ha publicado oficialmente, su valor se ignorará en Chrome Beta y Chrome Stable. - - Si una política está en la lista, pero no se ha publicado oficialmente, su valor sí se aplicará. - - Esta política no tiene ningún efecto en las políticas ya publicadas.</translation> <translation id="3066446511111537292">Permite que los usuarios afiliados de este dispositivo usen la instalación de fuente desconocida adb</translation> <translation id="3069958900488014740">Permite desactivar la optimización de WPAD (detección automática de proxy web) en <ph name="PRODUCT_NAME" />.
diff --git a/components/policy/resources/policy_templates_fr.xtb b/components/policy/resources/policy_templates_fr.xtb index e26862a5..0bce207 100644 --- a/components/policy/resources/policy_templates_fr.xtb +++ b/components/policy/resources/policy_templates_fr.xtb
@@ -1449,17 +1449,6 @@ Si cette règle n'est pas définie ou si la valeur après substitution ne constitue pas un nom d'hôte valide, aucun nom d'hôte ne sera défini dans la requête DHCP. </translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> -<translation id="3063659901357934128">Permet à <ph name="PRODUCT_NAME" /> de charger des règles expérimentales. - - AVERTISSEMENT : Les règles expérimentales ne sont pas prises en charge et peuvent être modifiées ou supprimées sans préavis dans la future version du navigateur. - - Une règle expérimentale peut ne pas être terminée ou encore présenter des défauts connus ou inconnus. Elle peut être modifiée ou même supprimée sans aucune notification. En activant des règles expérimentales, vous pouvez perdre des données de navigateur, ou compromettre votre sécurité ou la confidentialité de vos données. - - Si une règle ne figure pas dans la liste et qu'elle n'est pas officiellement publiée, sa valeur est alors ignorée dans les versions bêta et stable de Chrome. - - Si une règle figure dans la liste et qu'elle n'est pas officiellement publiée, sa valeur est alors appliquée. - - Cette règle n'a aucune incidence sur les règles déjà publiées.</translation> <translation id="3066446511111537292">Permet aux utilisateurs affiliés de cet appareil d'utiliser le téléchargement indépendant adb</translation> <translation id="3069958900488014740">Permet la désactivation de l'optimisation WPAD (Web Proxy Auto-Discovery) dans <ph name="PRODUCT_NAME" />.
diff --git a/components/policy/resources/policy_templates_id.xtb b/components/policy/resources/policy_templates_id.xtb index 72f36d3..6953488 100644 --- a/components/policy/resources/policy_templates_id.xtb +++ b/components/policy/resources/policy_templates_id.xtb
@@ -1407,17 +1407,6 @@ Jika kebijakan ini tidak ditetapkan, atau nilai setelah substitusi bukan merupakan hostname yang valid, tidak ada hostname yang akan disetel dalam permintaan DHCP. </translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> -<translation id="3063659901357934128">Mengizinkan <ph name="PRODUCT_NAME" /> memuat kebijakan eksperimental. - - PERINGATAN: Kebijakan eksperimental tidak didukung dan dapat berubah atau dihapus tanpa pemberitahuan di versi browser mendatang. - - Kebijakan eksperimental mungkin tidak selesai atau masih terdapat kerusakan yang diketahui atau tidak diketahui. Kebijakan dapat berubah atau bahkan dihapus tanpa notifikasi apa pun. Jika mengaktifkan kebijakan eksperimental, Anda dapat kehilangan data penjelajahan atau membahayakan keamanan atau privasi Anda. - - Jika kebijakan tidak tercantum dalam daftar dan tidak dirilis secara resmi, nilainya akan diabaikan di Chrome Beta dan Chrome Stable. - - Jika kebijakan tercantum dalam daftar dan tidak dirilis secara resmi, nilainya akan diterapkan. - - Kebijakan ini tidak memengaruhi kebijakan yang sudah dirilis.</translation> <translation id="3066446511111537292">Izinkan pengguna terafiliasi di perangkat ini untuk menggunakan sideload ADB</translation> <translation id="3069958900488014740">Memungkinkan penonaktifan pengoptimalan WPAD (Web Proxy Auto-Discovery) di <ph name="PRODUCT_NAME" />.
diff --git a/components/policy/resources/policy_templates_it.xtb b/components/policy/resources/policy_templates_it.xtb index 1d4a3c3..f955d5e5 100644 --- a/components/policy/resources/policy_templates_it.xtb +++ b/components/policy/resources/policy_templates_it.xtb
@@ -1381,17 +1381,6 @@ Se questo criterio non è impostato o se il valore ottenuto in seguito alla sostituzione non è un nome host valido, non verrà impostato alcun nome host nella richiesta DHCP. </translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> -<translation id="3063659901357934128">Consente a <ph name="PRODUCT_NAME" /> di caricare criteri sperimentali. - - AVVISO: i criteri sperimentali non sono supportati e sono soggetti a modifiche o a rimozione senza preavviso nella versione successiva del browser. - - Un criterio sperimentale può non essere completo o avere ancora problemi noti o sconosciuti. Può essere modificato o anche rimosso senza preavviso. Attivando i criteri sperimentali, potresti perdere i dati del browser o compromettere la sicurezza o la privacy. - - Se un criterio non è nell'elenco e non è stato pubblicato ufficialmente, il suo valore sarà ignorato su Chrome Beta e Chrome Stable. - - Se un criterio è nell'elenco e non è stato pubblicato ufficialmente, il suo valore verrà applicato. - - Il criterio non ha effetto su quelli già pubblicati.</translation> <translation id="3066446511111537292">Consenti agli utenti affiliati di questo dispositivo di utilizzare il processo sideload ADB</translation> <translation id="3069958900488014740">Consente di disattivare l'ottimizzazione WPAD (Web Proxy Auto-Discovery) in <ph name="PRODUCT_NAME" />.
diff --git a/components/policy/resources/policy_templates_ja.xtb b/components/policy/resources/policy_templates_ja.xtb index 6edaeb6..5ef5f1d3 100644 --- a/components/policy/resources/policy_templates_ja.xtb +++ b/components/policy/resources/policy_templates_ja.xtb
@@ -1394,17 +1394,6 @@ このポリシーを設定しない場合、または変数の解決後の名前が有効なホスト名ではない場合、DHCP リクエストにホスト名は設定されません。 </translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> -<translation id="3063659901357934128"><ph name="PRODUCT_NAME" /> にテストポリシーの読み込みを許可します。 - - 警告: テストポリシーは、ブラウザの今後のバージョンではサポートされなくなり、事前の通知なく変更または削除される可能性があります。 - - テストポリシーは、完成していないか、既知または未知の不具合がある場合があり、通知なく変更または削除される可能性があります。また、テストポリシーを有効にすると、ブラウザのデータが失われたり、セキュリティやプライバシーが侵害されたりする可能性があります。 - - ポリシーがリストになく、正式なリリースでない場合、Chrome のベータ版と Stable(正式リリース)版ではポリシーの値は無視されます。 - - ポリシーがリストにある場合は、正式なリリースでなくても、ポリシーの値は適用されます。 - - このポリシーは、すでにリリース済みのポリシーには影響しません。</translation> <translation id="3066446511111537292">このデバイスの関連ユーザーに ADB サイドローディングの使用を許可します</translation> <translation id="3069958900488014740"><ph name="PRODUCT_NAME" /> で WPAD(ウェブプロキシ自動検出)の最適化を無効にできます。
diff --git a/components/policy/resources/policy_templates_ko.xtb b/components/policy/resources/policy_templates_ko.xtb index a746e47..cccbee2b 100644 --- a/components/policy/resources/policy_templates_ko.xtb +++ b/components/policy/resources/policy_templates_ko.xtb
@@ -1436,17 +1436,6 @@ 정책이 설정되어 있지 않거나 대체 후 값이 유효한 호스트 이름이 아닌 경우 DHCP 요청에서 어떠한 호스트 이름도 설정되지 않습니다. </translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> -<translation id="3063659901357934128"><ph name="PRODUCT_NAME" />에서 실험용 정책을 로드할 수 있도록 허용합니다. - - 경고: 실험용 정책은 지원되지 않으며 브라우저의 향후 버전에서 고지 없이 변경되거나 삭제될 수 있습니다. - - 실험용 정책은 미완성 상태일 수 있으며 알려지거나 알려지지 않은 결함을 포함할 수 있습니다. 공지 없이 변경되거나 삭제될 수도 있습니다. 실험용 정책을 사용 설정하면 인터넷 사용 기록이 손실되거나 보안이 악화되거나 개인 정보가 유출될 수도 있습니다. - - 정책이 목록에 포함되어 있지 않고 공식적으로 출시되지 않았다면 그 값은 Chrome 베타 및 정식 Chrome 버전에서 무시됩니다. - - 정책이 목록에 포함되어 있고 공식적으로 출시되지 않았다면 그 값이 적용됩니다. - - 이 정책은 이미 출시된 정책에는 영향을 미치지 않습니다.</translation> <translation id="3066446511111537292">기기의 연결된 사용자가 ADB 사이드로드를 사용하도록 허용</translation> <translation id="3069958900488014740"><ph name="PRODUCT_NAME" />에서 WPAD(Web Proxy Auto-Discovery) 최적화를 사용 중지하도록 허용합니다.
diff --git a/components/policy/resources/policy_templates_nl.xtb b/components/policy/resources/policy_templates_nl.xtb index 21304a2a..a95e485 100644 --- a/components/policy/resources/policy_templates_nl.xtb +++ b/components/policy/resources/policy_templates_nl.xtb
@@ -1424,17 +1424,6 @@ Als dit beleid niet is ingesteld of als de vervanging geen geldige hostnaam oplevert, wordt er geen hostnaam ingesteld in het DHCP-verzoek. </translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> -<translation id="3063659901357934128">Hiermee kan <ph name="PRODUCT_NAME" /> experimentele beleidsregels laden. - - WAARSCHUWING: Experimentele beleidsregels worden niet ondersteund en kunnen zonder kennisgeving worden gewijzigd of verwijderd uit toekomstige versies van de browser. - - Een experimentele beleidsregel is mogelijk niet compleet of kan bekende of onbekende fouten bevatten. De beleidsregel kan zonder kennisgeving worden gewijzigd of zelfs worden verwijderd. Door experimentele beleidsregels in te schakelen, kun je browsergegevens kwijtraken of je veiligheid of privacy in gevaar brengen. - - Als een beleidsregel niet in de lijst wordt vermeld en niet officieel is uitgebracht, wordt de waarde hiervan genegeerd in de bètaversie en de stabiele versie van Chrome. - - Als een beleidsregel in de lijst wordt vermeld en niet officieel is uitgebracht, wordt de waarde hiervan toegepast. - - Dit beleid heeft geen invloed op al uitgebrachte beleidsregels.</translation> <translation id="3066446511111537292">Toestaan dat gekoppelde gebruikers van dit apparaat ADB-sideloading gebruiken</translation> <translation id="3069958900488014740">Hiermee kan WPAD-optimalisatie (Web Proxy Auto-Discovery) worden uitgeschakeld in <ph name="PRODUCT_NAME" />.
diff --git a/components/policy/resources/policy_templates_pt-BR.xtb b/components/policy/resources/policy_templates_pt-BR.xtb index 8bb52787..af0da7d9 100644 --- a/components/policy/resources/policy_templates_pt-BR.xtb +++ b/components/policy/resources/policy_templates_pt-BR.xtb
@@ -1395,17 +1395,6 @@ Se esta política não for definida ou o valor depois da substituição não for um nome de host válido, nenhum nome de host será definido na solicitação de DHCP. </translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> -<translation id="3063659901357934128">Permite que o <ph name="PRODUCT_NAME" /> carregue políticas experimentais. - - ALERTA: políticas experimentais não são compatíveis e podem ser modificadas ou removidas sem aviso em uma versão futura do navegador. - - Uma política experimental pode não ter sido concluída ou pode ainda ter defeitos conhecidos ou desconhecidos. Ela pode ser modificada ou até removida sem aviso. Ao ativar políticas experimentais, você pode perder dados do navegador ou comprometer sua segurança ou privacidade. - - Se uma política não estiver na lista e não tiver sido lançada oficialmente, o valor dela será ignorado nas versões Beta e Stable do Chrome. - - Se uma política estiver na lista, mas não tiver sido lançada oficialmente, o valor dela será aplicado. - - Esta política não afeta políticas já lançadas.</translation> <translation id="3066446511111537292">Permite que usuários afiliados deste dispositivo usem sideload com adb</translation> <translation id="3069958900488014740">Permite desativar a otimização da descoberta automática de proxies da Web (WPAD, na sigla em inglês) no <ph name="PRODUCT_NAME" />.
diff --git a/components/policy/resources/policy_templates_ru.xtb b/components/policy/resources/policy_templates_ru.xtb index 07f1c07d..3acd367 100644 --- a/components/policy/resources/policy_templates_ru.xtb +++ b/components/policy/resources/policy_templates_ru.xtb
@@ -1412,17 +1412,6 @@ Если правило не настроено или значение не является допустимым именем хоста, то имя хоста не передается в DHCP-запросе. </translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> -<translation id="3063659901357934128">Позволяет <ph name="PRODUCT_NAME" /> загружать экспериментальные правила. - - ВНИМАНИЕ! Такие правила не поддерживаются и могут быть без уведомления изменены или удалены в будущей версии браузера. - - Экспериментальное правило может быть не закончено или содержать известные или неизвестные ошибки, а также быть изменено или даже удалено без уведомления. Если вы используете такие правила, то можете потерять данные о работе в браузере, а также подвергнуть риску свою безопасность и конфиденциальность. - - Если правила нет в списке и оно ещё не выпущено официально, заданное в нем значение будет проигнорировано в бета-версии и в стабильной версии Chrome. - - Если правило есть в списке, но оно ещё не выпущено официально, будет применяться указанное в нем значение. - - На уже выпущенные правила это правило не влияет.</translation> <translation id="3066446511111537292">Разрешить связанным пользователям устанавливать на устройство приложения из неизвестного источника с помощью adb</translation> <translation id="3069958900488014740">Позволяет отключить оптимизацию протокола WPAD (Web Proxy Auto-Discovery) в <ph name="PRODUCT_NAME" />.
diff --git a/components/policy/resources/policy_templates_th.xtb b/components/policy/resources/policy_templates_th.xtb index ee9aecb..f1fb04f 100644 --- a/components/policy/resources/policy_templates_th.xtb +++ b/components/policy/resources/policy_templates_th.xtb
@@ -1397,17 +1397,6 @@ หากไม่ได้ตั้งค่านโยบายนี้ หรือค่าหลังการแทนที่ไม่ใช่ชื่อโฮสต์ที่ถูกต้อง ก็จะไม่มีการกำหนดชื่อโฮสต์ในคำขอ DHCP </translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> -<translation id="3063659901357934128">อนุญาตให้ <ph name="PRODUCT_NAME" /> โหลดนโยบายทดลอง - - คำเตือน: เราไม่รองรับนโยบายทดลองและนโยบายอาจมีการเปลี่ยนแปลงหรือถูกนำออกโดยไม่ต้องแจ้งให้ทราบสำหรับเวอร์ชันในอนาคตของเบราว์เซอร์ - - นโยบายทดลองอาจยังไม่เสร็จสมบูรณ์หรือยังมีข้อบกพร่องที่ทราบแล้วหรือยังไม่ทราบ ระบบอาจเปลี่ยนแปลงหรือนำนโยบายออกโดยไม่มีการแจ้งให้ทราบ การเปิดใช้นโยบายทดลองอาจทำให้คุณสูญเสียข้อมูลในเบราว์เซอร์หรือทำให้เกิดความเสี่ยงต่อความปลอดภัยหรือความเป็นส่วนตัวของคุณ - - หากนโยบายไม่ได้อยู่ในรายการและยังไม่ได้เปิดตัวอย่างเป็นทางการ Chrome เวอร์ชันเบต้า และ Chrome เวอร์ชันเสถียรจะไม่สนใจค่าของนโยบาย - - หากนโยบายอยู่ในรายการและยังไม่ได้เปิดตัวอย่างเป็นทางการ ระบบจะใช้ค่าของนโยบาย - - นโยบายนี้ไม่มีผลต่อนโยบายที่เปิดตัวไปแล้ว</translation> <translation id="3066446511111537292">อนุญาตให้ผู้ใช้ที่เชื่อมโยงของอุปกรณ์นี้ใช้การโหลดจากแหล่งที่ไม่รู้จักของ ADB</translation> <translation id="3069958900488014740">อนุญาตให้ปิดการเพิ่มประสิทธิภาพ WPAD (การค้นหาเว็บพร็อกซีอัตโนมัติ) ใน <ph name="PRODUCT_NAME" />
diff --git a/components/policy/resources/policy_templates_tr.xtb b/components/policy/resources/policy_templates_tr.xtb index 50ed8ba5..1b11672 100644 --- a/components/policy/resources/policy_templates_tr.xtb +++ b/components/policy/resources/policy_templates_tr.xtb
@@ -1422,17 +1422,6 @@ Bu politika ayarlanmazsa veya değişiklikten sonraki değer, geçerli bir ana makine adı değilse DHCP isteğinde ana makine adı ayarlanmaz. </translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> -<translation id="3063659901357934128"><ph name="PRODUCT_NAME" /> ürününün deneysel politikaları yüklemesine izin verir. - - UYARI: Deneysel politikalar desteklenmez ve tarayıcının gelecekteki sürümünde bildirimde bulunmaksızın değiştirilebilir veya kaldırılabilir. - - Deneysel bir politika tamamlanmamış olabilir veya hâlâ bilinen ya da bilinmeyen kusurlar içerebilir. Herhangi bir bildirimde bulunulmadan değiştirilebilir, hatta kaldırılabilir. Deneysel politikaları etkinleştirdiğinizde tarayıcı verileri kaybolabilir ya da güvenliğiniz veya gizliliğiniz ihlal edilebilir. - - Listede olmayan bir politika resmi olarak yayınlanmadıysa Chrome'un Beta ve Kararlı sürümlerinde politikanın değeri göz ardı edilir. - - Listede yer alan bir politika resmi olarak yayınlanmadıysa politikanın değeri geçerli olur. - - Bu politikanın önceden yayınlanmış politikalar üzerinde bir etkisi yoktur.</translation> <translation id="3066446511111537292">Bu cihazın ilişkili kullanıcılarının ADB başka cihazdan yükleme işlevini kullanmalarına izin verir</translation> <translation id="3069958900488014740"><ph name="PRODUCT_NAME" /> ürününde WPAD (Otomatik Web Proxy Keşfi) optimizasyonunu kapatmanıza olanak verir.
diff --git a/components/policy/resources/policy_templates_uk.xtb b/components/policy/resources/policy_templates_uk.xtb index 535569f..160e3d2 100644 --- a/components/policy/resources/policy_templates_uk.xtb +++ b/components/policy/resources/policy_templates_uk.xtb
@@ -1427,17 +1427,6 @@ Якщо це правило не налаштовано або замінене значення не є іменем хосту, це означає, що в запиті DHCP не буде налаштовано ім'я хосту. </translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> -<translation id="3063659901357934128">Дозволяє продукту <ph name="PRODUCT_NAME" /> завантажувати експериментальні правила. - - ПОПЕРЕДЖЕННЯ: експериментальні правила не підтримуються. У наступних версіях веб-переглядача їх можуть змінити або видалити без попередження. - - Експериментальне правило може бути незавершеним або містити відомі й невідомі нам проблеми. Ми можемо змінити або видалити його без попередження. Увімкнувши експериментальні правила, ви можете втратити дані веб-перегляду та створити загрозу своїй безпеці чи конфіденційності. - - Якщо правила немає в списку й ми не випустили його офіційно, його значення ігноруватиметься в бета- й стабільній версії Chrome. - - Якщо правило є в списку, але ми не випустили його офіційно, його значення застосовуватиметься. - - Це правило не впливає на вже випущені правила.</translation> <translation id="3066446511111537292">Дозволити пов'язаним користувачам цього пристрою завантажувати додатки з невідомого джерела через ADB</translation> <translation id="3069958900488014740">Можна вимкнути оптимізацію WPAD (автоматичний пошук веб-проксі) у <ph name="PRODUCT_NAME" />.
diff --git a/components/policy/resources/policy_templates_vi.xtb b/components/policy/resources/policy_templates_vi.xtb index b4f7ff8..d3c017b 100644 --- a/components/policy/resources/policy_templates_vi.xtb +++ b/components/policy/resources/policy_templates_vi.xtb
@@ -1437,17 +1437,6 @@ Nếu bạn không đặt chính sách này hoặc giá trị sau khi thay thế không phải là tên máy chủ hợp lệ, thì tên máy chủ sẽ không được đặt trong yêu cầu DHCP. </translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> -<translation id="3063659901357934128">Cho phép <ph name="PRODUCT_NAME" /> tải các chính sách thử nghiệm. - - CẢNH BÁO: Phiên bản sau này của trình duyệt không hỗ trợ các chính sách thử nghiệm. Các chính sách này có thể bị thay đổi hoặc xóa bỏ mà không thông báo trước! - - Một chính sách thử nghiệm có thể chưa hoàn tất hoặc vẫn còn lỗi đã xác định hoặc không xác định. Chính sách này có thể bị thay đổi hoặc thậm chí bị xóa bỏ mà không thông báo trước. Khi bạn bật chính sách thử nghiệm, dữ liệu trên trình duyệt có thể bị mất hoặc tính bảo mật/quyền riêng tư của bạn có thể bị xâm phạm. - - Nếu một chính sách không có trong danh sách hoặc chưa được phát hành chính thức, thì Chrome phiên bản thử nghiệm và Chrome phiên bản ổn định sẽ bỏ qua giá trị của chính sách đó. - - Nếu một chính sách có trong danh sách và chưa được phát hành chính thức, thì giá trị của chính sách đó sẽ được áp dụng. - - Chính sách này không ảnh hưởng đến các chính sách đã phát hành.</translation> <translation id="3066446511111537292">Cho phép người dùng đã liên kết của thiết bị này sử dụng tính năng cài đặt không qua cửa hàng của Cầu gỡ lỗi Android (ADB)</translation> <translation id="3069958900488014740">Cho phép tắt tối ưu hóa WPAD (Tự động phát hiện proxy web) trong <ph name="PRODUCT_NAME" />. @@ -2623,7 +2612,7 @@ <translation id="500149597848135831">Cho phép tất cả các biến</translation> <translation id="5017369989680827157">Nếu bạn đặt chính sách này thành True hoặc không đặt chính sách này, thì người dùng sẽ có quyền kiểm soát tính năng Tự động điền cho địa chỉ trong giao diện người dùng. - Nếu bạn đặt chính sách này thành False, thì tính năng Tự động điền sẽ không bao giờ gợi ý hoặc điền địa thông tin địa chỉ hay lưu thông tin địa chỉ bổ sung mà người dùng gửi trong khi duyệt web.</translation> + Nếu bạn đặt chính sách này thành False, thì tính năng Tự động điền sẽ không bao giờ gợi ý hoặc điền thông tin địa chỉ hay lưu thông tin địa chỉ bổ sung mà người dùng gửi trong khi duyệt web.</translation> <translation id="5023555740504506178">Nếu bạn bật hoặc không định cấu hình (mặc định), thì trang web có thể dùng các API chia sẻ màn hình (ví dụ: getDisplayMedia() hoặc API tiện ích Chụp màn hình) để nhắc người dùng chọn thẻ, cửa sổ hoặc màn hình cần chụp.
diff --git a/components/policy/resources/policy_templates_zh-CN.xtb b/components/policy/resources/policy_templates_zh-CN.xtb index 1dbfe9a..51e74e15 100644 --- a/components/policy/resources/policy_templates_zh-CN.xtb +++ b/components/policy/resources/policy_templates_zh-CN.xtb
@@ -1358,17 +1358,6 @@ 如果此政策未设置,或替换后的值不是有效的主机名,系统将不会在 DHCP 请求中设置任何主机名。 </translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> -<translation id="3063659901357934128">允许 <ph name="PRODUCT_NAME" /> 加载实验性政策。 - - 警告:实验性政策不受支持,而且在未来版本的浏览器中可能会被更改或移除,恕不另行通知! - - 实验性政策可能尚未制定完毕,或者仍有已知或未知的缺陷。它可能会被更改甚至移除,而不显示任何通知。启用实验性政策可能会致使您丢失浏览器数据,或者致使您的安全或隐私受到威胁。 - - 如果所选政策不在列表中且未正式发布,那么在 Chrome Beta 版和 Chrome 稳定版中,系统会忽略其值。 - - 如果所选政策在列表中且未正式发布,系统会应用其值。 - - 此政策对已发布的政策没有任何影响。</translation> <translation id="3066446511111537292">允许此设备的关联用户使用 ADB 旁加载</translation> <translation id="3069958900488014740">允许停用 <ph name="PRODUCT_NAME" /> 中的 WPAD(网络代理自动发现)优化设置。
diff --git a/components/policy/resources/policy_templates_zh-TW.xtb b/components/policy/resources/policy_templates_zh-TW.xtb index 13adb92..bf67fd3f 100644 --- a/components/policy/resources/policy_templates_zh-TW.xtb +++ b/components/policy/resources/policy_templates_zh-TW.xtb
@@ -1385,17 +1385,6 @@ 如果不設定這項政策,或是替換後的值不是有效的主機名稱,系統將不會設定 DHCP 要求中的主機名稱。 </translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> -<translation id="3063659901357934128">允許 <ph name="PRODUCT_NAME" /> 載入實驗性政策。 - - 警告:實驗性政策不受支援,且在未來的瀏覽器版本中如有變動或遭到移除,恕不另行通知。 - - 實驗性政策可能尚未完成實驗階段,或仍有已知或未知的瑕疵。這類政策可能會在未通知的情況下進行變更,甚至是遭到移除。啟用實驗性政策可能會造成瀏覽器資料遺失,或對你的安全性或隱私權有不良影響。 - - 如果某項政策不在清單中,而且未正式發布,則 Chrome Beta 版和 Chrome 穩定版會忽略該政策的值。 - - 如果某項政策列於清單中,但並未正式發布,系統會套用該政策的值。 - - 這項政策不會影響已發布的政策。</translation> <translation id="3066446511111537292">允許這部裝置的相關使用者採用 ADB 側載</translation> <translation id="3069958900488014740">允許關閉 <ph name="PRODUCT_NAME" /> 的 WPAD (Web Proxy Auto Discovery) 最佳化設定。
diff --git a/components/strings/components_strings_ar.xtb b/components/strings/components_strings_ar.xtb index 8ba047c..8d7b6ec 100644 --- a/components/strings/components_strings_ar.xtb +++ b/components/strings/components_strings_ar.xtb
@@ -178,7 +178,7 @@ <translation id="1671391448414634642">ستتم ترجمة الصفحات باللغة <ph name="SOURCE_LANGUAGE" /> إلى اللغة <ph name="TARGET_LANGUAGE" /> من الآن فصاعدًا.</translation> <translation id="1676269943528358898">يستخدم <ph name="SITE" /> التشفير عادة لحماية معلوماتك. عندما حاول Google Chrome الاتصال بموقع <ph name="SITE" /> هذه المرة، أرجَع موقع الويب بيانات اعتماد غير عادية وغير صحيحة. وقد يحدث هذا عندما يحاول أحد المهاجمين التظاهر بأنه موقع <ph name="SITE" />، أو إذا قاطعت شاشة تسجيل دخول Wi-Fi الاتصال. ولكن لا تزال معلوماتك آمنة نظرًا لأن Google Chrome أوقَف الاتصال قبل تبادل أي بيانات.</translation> <translation id="1682696192498422849">حافة قصيرة أولًا</translation> -<translation id="168693727862418163">تعذّر على قيمة السياسة هذه التحقُّق باستخدام المخطط الخاص بها وسيتم تجاهلها.</translation> +<translation id="168693727862418163">تعذّر التحقُّق من قيمة السياسة هذه وفقًا لمخططها وسيتم تجاهلها.</translation> <translation id="168841957122794586">تحتوي شهادة الخادم على مفتاح ترميز ضعيف.</translation> <translation id="1697532407822776718">أنت الآن على أتم استعداد.</translation> <translation id="1703835215927279855">خطاب</translation>
diff --git a/components/strings/components_strings_iw.xtb b/components/strings/components_strings_iw.xtb index e5e21d1..c4a29df 100644 --- a/components/strings/components_strings_iw.xtb +++ b/components/strings/components_strings_iw.xtb
@@ -178,6 +178,7 @@ <translation id="1671391448414634642">דפים ב<ph name="SOURCE_LANGUAGE" /> יתורגמו מעכשיו ל<ph name="TARGET_LANGUAGE" />.</translation> <translation id="1676269943528358898">האתר <ph name="SITE" /> משתמש בדרך כלל בהצפנה כדי להגן על המידע שלך. כאשר Google Chrome ניסה הפעם להתחבר ל-<ph name="SITE" />, האתר שלח חזרה אישורים חריגים ושגויים. ייתכן שתוקף מנסה להתחזות לאתר <ph name="SITE" />, או שמסך כניסה ל-Wi-Fi הפריע לחיבור. המידע שלך עדיין מאובטח מכיוון ש-Google Chrome הפסיק את החיבור לפני חילופי הנתונים.</translation> <translation id="1682696192498422849">הקצה הקצר ראשון</translation> +<translation id="168693727862418163">אימות ערך המדיניות הזה נכשל בבדיקה מול הסכימה והמערכת תתעלם ממנו.</translation> <translation id="168841957122794586">אישור השרת מכיל מפתח הצפנה חלש.</translation> <translation id="1697532407822776718">הכל מוכן!</translation> <translation id="1703835215927279855">Letter</translation>
diff --git a/components/strings/components_strings_mk.xtb b/components/strings/components_strings_mk.xtb index d2df2d3..0ed29dd 100644 --- a/components/strings/components_strings_mk.xtb +++ b/components/strings/components_strings_mk.xtb
@@ -178,6 +178,7 @@ <translation id="1671391448414634642">Отсега, страниците на <ph name="SOURCE_LANGUAGE" /> ќе се преведуваат на <ph name="TARGET_LANGUAGE" />.</translation> <translation id="1676269943528358898"><ph name="SITE" /> обично користи шифрирање за да ги заштити вашите информации. Кога Google Chrome овој пат се обиде да се поврзе на <ph name="SITE" />, веб-сајтот врати невообичаени и неточни акредитиви. Ова може да се случи кога напаѓач се преправа дека е <ph name="SITE" /> или кога екран за најавување на Wi-Fi го прекинува поврзувањето. Вашите информации сѐ уште се безбедни, затоа што Google Chrome го запре поврзувањето пред да се разменат податоци.</translation> <translation id="1682696192498422849">Прво краткиот раб</translation> +<translation id="168693727862418163">Вредноста на правилото не можеше да се потврди според неговата шема и ќе биде игнорирана.</translation> <translation id="168841957122794586">Сертификатот на серверот содржи слаб криптографски клуч.</translation> <translation id="1697532407822776718">Подготвени сте.</translation> <translation id="1703835215927279855">Letter</translation>
diff --git a/components/strings/components_strings_zh-HK.xtb b/components/strings/components_strings_zh-HK.xtb index 51163d7..ed129c4b 100644 --- a/components/strings/components_strings_zh-HK.xtb +++ b/components/strings/components_strings_zh-HK.xtb
@@ -178,7 +178,7 @@ <translation id="1671391448414634642">從現在開始,來源語言為<ph name="SOURCE_LANGUAGE" />的網頁一律會翻譯成<ph name="TARGET_LANGUAGE" />。</translation> <translation id="1676269943528358898"><ph name="SITE" /> 通常會透過加密方式保護您的資料。Google Chrome 這次嘗試連線至 <ph name="SITE" /> 時,該網站傳回異常且錯誤的憑證。這可能是因為有攻擊者試圖偽裝成 <ph name="SITE" />,或 Wi-Fi 登入畫面導致連線中斷。請放心,Google Chrome 未有交換任何資料並已終止連線,所以您的資料仍然安全。</translation> <translation id="1682696192498422849">先從短邊開始</translation> -<translation id="168693727862418163">此政策的值未通過其綱要的驗證,因此會被忽略。</translation> +<translation id="168693727862418163">此政策的值無法通過其綱要 (schema) 的驗證,因此會被忽略。</translation> <translation id="168841957122794586">伺服器憑證含有防護力薄弱的加密編譯金鑰。</translation> <translation id="1697532407822776718">大功告成!</translation> <translation id="1703835215927279855">Letter</translation>
diff --git a/components/test/data/payments/maxpay.com/payment_handler_window.html b/components/test/data/payments/maxpay.com/payment_handler_window.html index fb7e5034..050c3bb 100644 --- a/components/test/data/payments/maxpay.com/payment_handler_window.html +++ b/components/test/data/payments/maxpay.com/payment_handler_window.html
@@ -4,9 +4,13 @@ Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> -<meta - name="viewport" - content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1"> +<head> + <meta charset="utf-8"> + <meta + name="viewport" + content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1"> + <title>Max Pay</title> +</head> <body> <button onclick="confirm()">confirm</button> <button onclick="cancel()">cancel</button>
diff --git a/content/browser/frame_host/render_frame_host_manager_unittest.cc b/content/browser/frame_host/render_frame_host_manager_unittest.cc index 241207e..7b557cdc 100644 --- a/content/browser/frame_host/render_frame_host_manager_unittest.cc +++ b/content/browser/frame_host/render_frame_host_manager_unittest.cc
@@ -251,6 +251,7 @@ } void DidUpdateFaviconURL( + RenderFrameHost* render_frame_host, const std::vector<blink::mojom::FaviconURLPtr>& candidates) override { favicon_received_ = true; }
diff --git a/content/browser/manifest/manifest_browsertest.cc b/content/browser/manifest/manifest_browsertest.cc index e77855b..cecb5b1 100644 --- a/content/browser/manifest/manifest_browsertest.cc +++ b/content/browser/manifest/manifest_browsertest.cc
@@ -131,12 +131,14 @@ // WebContentsObserver: void DidUpdateFaviconURL( + RenderFrameHost* rfh, const std::vector<blink::mojom::FaviconURLPtr>& candidates) override { manifests_reported_when_favicon_url_updated_.push_back( reported_manifest_urls_.size()); } void DidUpdateWebManifestURL( + RenderFrameHost* rfh, const base::Optional<GURL>& manifest_url) override { if (!manifest_url) { reported_manifest_urls_.emplace_back();
diff --git a/content/browser/manifest/manifest_manager_host.cc b/content/browser/manifest/manifest_manager_host.cc index 1bd88d91..2b847ca0 100644 --- a/content/browser/manifest/manifest_manager_host.cc +++ b/content/browser/manifest/manifest_manager_host.cc
@@ -86,12 +86,10 @@ if (!manifest_manager_frame_->IsCurrent()) return; - // TODO(yuzus): |NotifyManifestUrlChanged| should start taking a - // |RenderFrameHost| parameter. WebContents* web_contents = WebContents::FromRenderFrameHost(manifest_manager_frame_); static_cast<WebContentsImpl*>(web_contents) - ->NotifyManifestUrlChanged(manifest_url); + ->NotifyManifestUrlChanged(manifest_manager_frame_, manifest_url); } RENDER_DOCUMENT_HOST_USER_DATA_KEY_IMPL(ManifestManagerHost)
diff --git a/content/browser/media/session/media_session_impl.cc b/content/browser/media/session/media_session_impl.cc index 50dc90f7..a364a04 100644 --- a/content/browser/media/session/media_session_impl.cc +++ b/content/browser/media/session/media_session_impl.cc
@@ -296,6 +296,7 @@ } void MediaSessionImpl::DidUpdateFaviconURL( + RenderFrameHost* rfh, const std::vector<blink::mojom::FaviconURLPtr>& candidates) { std::vector<media_session::MediaImage> icons; @@ -860,7 +861,8 @@ delegate_->MediaSessionInfoChanged(GetMediaSessionInfoSync()); DCHECK(web_contents()); - DidUpdateFaviconURL(web_contents()->GetFaviconURLs()); + DidUpdateFaviconURL(web_contents()->GetMainFrame(), + web_contents()->GetFaviconURLs()); } AudioFocusDelegate::AudioFocusResult MediaSessionImpl::RequestSystemAudioFocus(
diff --git a/content/browser/media/session/media_session_impl.h b/content/browser/media/session/media_session_impl.h index 271de470e..a4c9bfe 100644 --- a/content/browser/media/session/media_session_impl.h +++ b/content/browser/media/session/media_session_impl.h
@@ -136,6 +136,7 @@ void OnWebContentsLostFocus(RenderWidgetHost*) override; void TitleWasSet(NavigationEntry* entry) override; void DidUpdateFaviconURL( + RenderFrameHost* rfh, const std::vector<blink::mojom::FaviconURLPtr>& candidates) override; void MediaPictureInPictureChanged(bool is_picture_in_picture) override;
diff --git a/content/browser/media/session/media_session_impl_browsertest.cc b/content/browser/media/session/media_session_impl_browsertest.cc index 77161c7..255ea2f 100644 --- a/content/browser/media/session/media_session_impl_browsertest.cc +++ b/content/browser/media/session/media_session_impl_browsertest.cc
@@ -2514,7 +2514,8 @@ GURL("https://www.example.org/favicon6.png"), blink::mojom::FaviconIconType::kTouchIcon, std::vector<gfx::Size>())); - media_session_->DidUpdateFaviconURL(favicons); + media_session_->DidUpdateFaviconURL(shell()->web_contents()->GetMainFrame(), + favicons); { std::vector<media_session::MediaImage> expected_images; @@ -2542,6 +2543,7 @@ { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); media_session_->DidUpdateFaviconURL( + shell()->web_contents()->GetMainFrame(), std::vector<blink::mojom::FaviconURLPtr>()); observer.WaitForExpectedImagesOfType( media_session::mojom::MediaSessionImageType::kSourceIcon, @@ -2556,7 +2558,8 @@ GURL("https://www.example.org/favicon1.png"), blink::mojom::FaviconIconType::kFavicon, std::vector<gfx::Size>())); - media_session_->DidUpdateFaviconURL(favicons); + media_session_->DidUpdateFaviconURL(shell()->web_contents()->GetMainFrame(), + favicons); { std::vector<media_session::MediaImage> expected_images; @@ -2607,6 +2610,7 @@ : WebContentsObserver(web_contents) {} void DidUpdateFaviconURL( + RenderFrameHost* render_frame_host, const std::vector<blink::mojom::FaviconURLPtr>& candidates) override { received_favicon_ = true; run_loop_.Quit();
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc index 0d288ae..0929cab 100644 --- a/content/browser/renderer_host/media/media_stream_manager.cc +++ b/content/browser/renderer_host/media/media_stream_manager.cc
@@ -19,6 +19,7 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/power_monitor/power_monitor.h" +#include "base/power_monitor/power_monitor_source.h" #include "base/rand_util.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" @@ -2097,6 +2098,14 @@ SendLogMessage(base::StringPrintf("OnResume([this=%p])", this)); } +void MediaStreamManager::OnThermalStateChange( + base::PowerObserver::DeviceThermalState new_state) { + const char* state_name = + base::PowerMonitorSource::DeviceThermalStateToString(new_state); + SendLogMessage(base::StringPrintf( + "OnThermalStateChange({this=%p}, {new_state=%s})", this, state_name)); +} + void MediaStreamManager::UseFakeUIFactoryForTests( base::RepeatingCallback<std::unique_ptr<FakeMediaStreamUIProxy>(void)> fake_ui_factory) {
diff --git a/content/browser/renderer_host/media/media_stream_manager.h b/content/browser/renderer_host/media/media_stream_manager.h index e3de974..4468b5c9 100644 --- a/content/browser/renderer_host/media/media_stream_manager.h +++ b/content/browser/renderer_host/media/media_stream_manager.h
@@ -279,6 +279,8 @@ // base::PowerObserver overrides. void OnSuspend() override; void OnResume() override; + void OnThermalStateChange( + base::PowerObserver::DeviceThermalState new_state) override; // Called by the tests to specify a factory for creating // FakeMediaStreamUIProxys to be used for generated streams.
diff --git a/content/browser/service_worker/service_worker_fetch_dispatcher.cc b/content/browser/service_worker/service_worker_fetch_dispatcher.cc index 8639b2a..727015d 100644 --- a/content/browser/service_worker/service_worker_fetch_dispatcher.cc +++ b/content/browser/service_worker/service_worker_fetch_dispatcher.cc
@@ -31,6 +31,7 @@ #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" +#include "content/public/browser/global_request_id.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/content_client.h" #include "content/public/common/navigation_policy.h" @@ -732,10 +733,6 @@ auto url_loader_client = std::make_unique<DelegatingURLLoaderClient>( std::move(inner_url_loader_client), resource_request); - // Get a unique request id across browser-initiated navigations and navigation - // preloads. - int request_id = GlobalRequestID::MakeBrowserInitiated().request_id; - // Start the network request for the URL using the network factory. // TODO(falken): What to do about routing_id. mojo::PendingRemote<network::mojom::URLLoaderClient> @@ -745,7 +742,8 @@ factory->CreateLoaderAndStart( url_loader.InitWithNewPipeAndPassReceiver(), -1 /* routing_id? */, - request_id, network::mojom::kURLLoadOptionNone, resource_request, + GlobalRequestID::MakeBrowserInitiated().request_id, + network::mojom::kURLLoadOptionNone, resource_request, std::move(url_loader_client_to_pass), net::MutableNetworkTrafficAnnotationTag( kNavigationPreloadTrafficAnnotation));
diff --git a/content/browser/service_worker/service_worker_single_script_update_checker.cc b/content/browser/service_worker/service_worker_single_script_update_checker.cc index 1b7e336..d2307f1 100644 --- a/content/browser/service_worker/service_worker_single_script_update_checker.cc +++ b/content/browser/service_worker/service_worker_single_script_update_checker.cc
@@ -216,14 +216,11 @@ std::move(compare_reader), std::move(copy_reader), std::move(writer), /*pause_when_not_identical=*/true); - // Get a unique request id across browser-initiated navigations and navigation - // preloads. - const int request_id = GlobalRequestID::MakeBrowserInitiated().request_id; network_loader_ = ServiceWorkerUpdatedScriptLoader:: ThrottlingURLLoaderCoreWrapper::CreateLoaderAndStart( loader_factory->Clone(), browser_context_getter, MSG_ROUTING_NONE, - request_id, options, resource_request, - network_client_receiver_.BindNewPipeAndPassRemote(), + GlobalRequestID::MakeBrowserInitiated().request_id, options, + resource_request, network_client_receiver_.BindNewPipeAndPassRemote(), kUpdateCheckTrafficAnnotation); DCHECK_EQ(network_loader_state_, ServiceWorkerUpdatedScriptLoader::LoaderState::kNotStarted);
diff --git a/content/browser/utility_process_host.cc b/content/browser/utility_process_host.cc index 5a084ad..6fd2230 100644 --- a/content/browser/utility_process_host.cc +++ b/content/browser/utility_process_host.cc
@@ -90,6 +90,7 @@ sandbox_type_ == service_manager::SandboxType::kVideoCapture || #if defined(OS_CHROMEOS) sandbox_type_ == service_manager::SandboxType::kIme || + sandbox_type_ == service_manager::SandboxType::kTts || #endif // OS_CHROMEOS sandbox_type_ == service_manager::SandboxType::kAudio || #if !defined(OS_MACOSX) @@ -208,6 +209,7 @@ if (sandbox_type_ == service_manager::SandboxType::kNetwork || #if defined(OS_CHROMEOS) sandbox_type_ == service_manager::SandboxType::kIme || + sandbox_type_ == service_manager::SandboxType::kTts || #endif // OS_CHROMEOS sandbox_type_ == service_manager::SandboxType::kAudio || sandbox_type_ == service_manager::SandboxType::kSpeechRecognition) {
diff --git a/content/browser/utility_process_sandbox_browsertest.cc b/content/browser/utility_process_sandbox_browsertest.cc index 0bf0d79..51cecca 100644 --- a/content/browser/utility_process_sandbox_browsertest.cc +++ b/content/browser/utility_process_sandbox_browsertest.cc
@@ -121,6 +121,7 @@ case SandboxType::kAudio: #if defined(OS_CHROMEOS) case SandboxType::kIme: + case SandboxType::kTts: #endif case SandboxType::kNetwork: case SandboxType::kSpeechRecognition: {
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 8a77eaf..e5575bae 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1287,9 +1287,10 @@ } void WebContentsImpl::NotifyManifestUrlChanged( + RenderFrameHost* rfh, const base::Optional<GURL>& manifest_url) { for (auto& observer : observers_) - observer.DidUpdateWebManifestURL(manifest_url); + observer.DidUpdateWebManifestURL(rfh, manifest_url); } WebUI* WebContentsImpl::GetWebUI() { @@ -5132,7 +5133,7 @@ favicon_urls_ = std::move(candidates); for (auto& observer : observers_) - observer.DidUpdateFaviconURL(favicon_urls_); + observer.DidUpdateFaviconURL(source, favicon_urls_); } void WebContentsImpl::SetIsOverlayContent(bool is_overlay_content) {
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index 64224ba..230fe78d 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h
@@ -309,7 +309,8 @@ // within it (recursively). std::vector<WebContentsImpl*> GetWebContentsAndAllInner(); - void NotifyManifestUrlChanged(const base::Optional<GURL>& manifest_url); + void NotifyManifestUrlChanged(RenderFrameHost* rfh, + const base::Optional<GURL>& manifest_url); #if defined(OS_ANDROID) void SetMainFrameImportance(ChildProcessImportance importance);
diff --git a/content/browser/worker_host/worker_script_fetcher.cc b/content/browser/worker_host/worker_script_fetcher.cc index 9a369db..1370acfc 100644 --- a/content/browser/worker_host/worker_script_fetcher.cc +++ b/content/browser/worker_host/worker_script_fetcher.cc
@@ -90,15 +90,11 @@ // workers (https://crbug.com/906991). int32_t routing_id = MSG_ROUTING_NONE; - // Get a unique request id across browser-initiated navigations and navigation - // preloads. - int request_id = GlobalRequestID::MakeBrowserInitiated().request_id; - url_loader_ = blink::ThrottlingURLLoader::CreateLoaderAndStart( std::move(shared_url_loader_factory), std::move(throttles), routing_id, - request_id, network::mojom::kURLLoadOptionNone, resource_request_.get(), - this, kWorkerScriptLoadTrafficAnnotation, - base::ThreadTaskRunnerHandle::Get()); + GlobalRequestID::MakeBrowserInitiated().request_id, + network::mojom::kURLLoadOptionNone, resource_request_.get(), this, + kWorkerScriptLoadTrafficAnnotation, base::ThreadTaskRunnerHandle::Get()); } void WorkerScriptFetcher::OnReceiveResponse(
diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h index 647ac77..0cab1ba9 100644 --- a/content/public/browser/web_contents_observer.h +++ b/content/public/browser/web_contents_observer.h
@@ -458,7 +458,9 @@ // the renderer process. If the instance is created after the page is loaded, // it is recommended to call WebContents::GetFaviconURLs() to get the current // list as this callback will not be executed unless there is an update. + // |render_frame_host| is the main render frame host. virtual void DidUpdateFaviconURL( + RenderFrameHost* render_frame_host, const std::vector<blink::mojom::FaviconURLPtr>& candidates) {} // Called when an audio change occurs to this WebContents. If |audible| is @@ -604,6 +606,7 @@ // document has both a manifest and a favicon, DidUpdateWebManifestURL() will // be invoked before DidUpdateFaviconURL(). virtual void DidUpdateWebManifestURL( + RenderFrameHost* target_frame, const base::Optional<GURL>& manifest_url) {} // DEPRECATED. Please register interface binders with BrowserInterfaceBroker
diff --git a/content/public/test/url_loader_interceptor.cc b/content/public/test/url_loader_interceptor.cc index 97c9f46..0dde003 100644 --- a/content/public/test/url_loader_interceptor.cc +++ b/content/public/test/url_loader_interceptor.cc
@@ -106,32 +106,6 @@ return parent_->Intercept(params); } - bool BeginNavigationCallback( - mojo::PendingReceiver<network::mojom::URLLoader>* receiver, - int32_t routing_id, - int32_t request_id, - uint32_t options, - const network::ResourceRequest& url_request, - mojo::PendingRemote<network::mojom::URLLoaderClient>* client, - const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) { - RequestParams params; - params.process_id = 0; - params.receiver = std::move(*receiver); - params.routing_id = routing_id; - params.request_id = request_id; - params.options = options; - params.url_request = url_request; - params.client.Bind(std::move(*client)); - params.traffic_annotation = traffic_annotation; - - if (Intercept(¶ms)) - return true; - - *receiver = std::move(params.receiver); - *client = params.client.Unbind(); - return false; - } - // Callback on IO thread whenever NavigationURLLoaderImpl needs a // URLLoaderFactory with a network::mojom::TrustedURLLoaderHeaderClient or // for a non-network-service scheme.
diff --git a/content/public/test/url_loader_interceptor.h b/content/public/test/url_loader_interceptor.h index eee861ac..5b4a9d39 100644 --- a/content/public/test/url_loader_interceptor.h +++ b/content/public/test/url_loader_interceptor.h
@@ -25,16 +25,12 @@ // Helper class to intercept URLLoaderFactory calls for tests. // This intercepts: // -frame requests (which start from the browser) -// -subresource requests from pages and dedicad workers and shared workers. -// -at ResourceMessageFilter for non network-service code path -// -by sending renderer an intermediate URLLoaderFactory for network-service -// code path, as that normally routes directly to the network process +// -subresource requests from pages, dedicated workers, and shared workers +// -by sending the renderer an intermediate URLLoaderFactory // -subresource requests from service workers and requests of non-installed // service worker scripts -// -at ResourceMessageFilter for non network-service code path -// -at EmbeddedWorkerInstance for network-service code path. +// -at EmbeddedWorkerInstance // -requests by the browser -// // -http(s)://mock.failed.request/foo URLs internally, copying the behavior // of net::URLRequestFailedJob // @@ -53,10 +49,9 @@ // -the callback is called on the UI or IO threads depending on the factory // that was hooked // -this is done to avoid changing message order -// -intercepting resource requests for subresources when the network service is -// enabled changes message order by definition (since they would normally go -// directly from renderer->network process, but now they're routed through the -// browser). +// -intercepting resource requests for subresources changes message order by +// definition (since they would normally go directly from renderer->network +// service, but now they're routed through the browser). class URLLoaderInterceptor { public: struct RequestParams { @@ -170,21 +165,8 @@ GetURLLoaderFactoryForBrowserProcess( mojo::PendingRemote<network::mojom::URLLoaderFactory> original_factory); - // Callback on IO thread whenever a NavigationURLLoaderImpl is loading a frame - // request through ResourceDispatcherHost (i.e. when the network service is - // disabled). - bool BeginNavigationCallback( - mojo::PendingReceiver<network::mojom::URLLoader>* receiver, - int32_t routing_id, - int32_t request_id, - uint32_t options, - const network::ResourceRequest& url_request, - mojo::PendingRemote<network::mojom::URLLoaderClient>* client, - const net::MutableNetworkTrafficAnnotationTag& traffic_annotation); - // Callback on UI thread whenever NavigationURLLoaderImpl needs a - // URLLoaderFactory with a network::mojom::TrustedURLLoaderHeaderClient or - // for a non-network-service scheme. + // URLLoaderFactory with a network::mojom::TrustedURLLoaderHeaderClient. void InterceptNavigationRequestCallback( mojo::PendingReceiver<network::mojom::URLLoaderFactory>* receiver);
diff --git a/content/renderer/media/audio/audio_renderer_mixer_manager.cc b/content/renderer/media/audio/audio_renderer_mixer_manager.cc index a530168..1466246 100644 --- a/content/renderer/media/audio/audio_renderer_mixer_manager.cc +++ b/content/renderer/media/audio/audio_renderer_mixer_manager.cc
@@ -98,30 +98,6 @@ return params; } -void LogMixerUmaHistogram(media::AudioLatency::LatencyType latency, int value) { - switch (latency) { - case media::AudioLatency::LATENCY_EXACT_MS: - UMA_HISTOGRAM_CUSTOM_COUNTS( - "Media.Audio.Render.AudioInputsPerMixer.LatencyExact", value, 1, 20, - 21); - return; - case media::AudioLatency::LATENCY_INTERACTIVE: - UMA_HISTOGRAM_CUSTOM_COUNTS( - "Media.Audio.Render.AudioInputsPerMixer.LatencyInteractive", value, 1, - 20, 21); - return; - case media::AudioLatency::LATENCY_RTC: - UMA_HISTOGRAM_CUSTOM_COUNTS( - "Media.Audio.Render.AudioInputsPerMixer.LatencyRtc", value, 1, 20, - 21); - return; - case media::AudioLatency::LATENCY_PLAYBACK: - return; - default: - NOTREACHED(); - } -} - } // namespace namespace content { @@ -193,9 +169,8 @@ const media::AudioParameters& mixer_output_params = GetMixerOutputParams(input_params, sink_info.output_params(), latency); - media::AudioRendererMixer* mixer = new media::AudioRendererMixer( - mixer_output_params, std::move(sink), - base::BindRepeating(&LogMixerUmaHistogram, latency)); + media::AudioRendererMixer* mixer = + new media::AudioRendererMixer(mixer_output_params, std::move(sink)); mixers_[key] = {mixer, 1}; DVLOG(1) << __func__ << " mixer: " << mixer << " latency: " << latency << "\n input: " << input_params.AsHumanReadableString()
diff --git a/content/shell/browser/web_test/web_test_control_host.cc b/content/shell/browser/web_test/web_test_control_host.cc index e8a8508..1eb39c8 100644 --- a/content/shell/browser/web_test/web_test_control_host.cc +++ b/content/shell/browser/web_test/web_test_control_host.cc
@@ -959,6 +959,7 @@ } void WebTestControlHost::DidUpdateFaviconURL( + RenderFrameHost* render_frame_host, const std::vector<blink::mojom::FaviconURLPtr>& candidates) { bool should_dump_icon_changes = false; accumulated_web_test_runtime_flags_changes_.GetBoolean(
diff --git a/content/shell/browser/web_test/web_test_control_host.h b/content/shell/browser/web_test/web_test_control_host.h index 979b1fd..7f2378d 100644 --- a/content/shell/browser/web_test/web_test_control_host.h +++ b/content/shell/browser/web_test/web_test_control_host.h
@@ -159,6 +159,7 @@ int error_code) override; void WebContentsDestroyed() override; void DidUpdateFaviconURL( + RenderFrameHost* render_frame_host, const std::vector<blink::mojom::FaviconURLPtr>& candidates) override; // RenderProcessHostObserver implementation.
diff --git a/content/test/data/fuzzer_corpus/code_cache_host_mojolpm_fuzzer/did_generate_cacheable_metadata_origin_a.textproto b/content/test/data/fuzzer_corpus/code_cache_host_mojolpm_fuzzer/did_generate_cacheable_metadata_origin_a.textproto new file mode 100644 index 0000000..b808eec --- /dev/null +++ b/content/test/data/fuzzer_corpus/code_cache_host_mojolpm_fuzzer/did_generate_cacheable_metadata_origin_a.textproto
@@ -0,0 +1,37 @@ +actions { + new_code_cache_host { + id: 1 + render_process_id: 0 + origin_id: ORIGIN_A + } +} +actions { + code_cache_host_call { + remote { + id: 1 + } + m_did_generate_cacheable_metadata { + m_cache_type: CodeCacheType_kJavascript + m_url { + new { + id: 1 + m_url: "http://aaa.com/test" + } + } + m_data { + new { + id: 1 + m_bytes { + } + } + } + m_expected_response_time { + } + } + } +} +sequences { + action_indexes: 0 + action_indexes: 1 +} +sequence_indexes: 0 \ No newline at end of file
diff --git a/content/test/data/fuzzer_corpus/code_cache_host_mojolpm_fuzzer/did_generate_cacheable_metadata_origin_b.textproto b/content/test/data/fuzzer_corpus/code_cache_host_mojolpm_fuzzer/did_generate_cacheable_metadata_origin_b.textproto new file mode 100644 index 0000000..5efb2be --- /dev/null +++ b/content/test/data/fuzzer_corpus/code_cache_host_mojolpm_fuzzer/did_generate_cacheable_metadata_origin_b.textproto
@@ -0,0 +1,37 @@ +actions { + new_code_cache_host { + id: 1 + render_process_id: 0 + origin_id: ORIGIN_B + } +} +actions { + code_cache_host_call { + remote { + id: 1 + } + m_did_generate_cacheable_metadata { + m_cache_type: CodeCacheType_kJavascript + m_url { + new { + id: 1 + m_url: "http://bbb.com/test" + } + } + m_data { + new { + id: 1 + m_bytes { + } + } + } + m_expected_response_time { + } + } + } +} +sequences { + action_indexes: 0 + action_indexes: 1 +} +sequence_indexes: 0 \ No newline at end of file
diff --git a/content/test/data/fuzzer_corpus/origin_trial_token_data/32 b/content/test/data/fuzzer_corpus/origin_trial_token_data/32 new file mode 100644 index 0000000..1a5e642 --- /dev/null +++ b/content/test/data/fuzzer_corpus/origin_trial_token_data/32
@@ -0,0 +1 @@ +{"origin":"https://example.com:443","isThirdParty":true,"usage":"subset", "feature":"WebBluetooth","expiry":1458766277}
diff --git a/content/test/data/fuzzer_corpus/origin_trial_token_data/33 b/content/test/data/fuzzer_corpus/origin_trial_token_data/33 new file mode 100644 index 0000000..ca944fdb --- /dev/null +++ b/content/test/data/fuzzer_corpus/origin_trial_token_data/33
@@ -0,0 +1 @@ +{"origin":"https://example.com:443","isThirdParty":false,"usage":"subset", "feature":"WebBluetooth","expiry":1458766277}
diff --git a/content/test/data/fuzzer_corpus/origin_trial_token_data/34 b/content/test/data/fuzzer_corpus/origin_trial_token_data/34 new file mode 100644 index 0000000..09232d5 --- /dev/null +++ b/content/test/data/fuzzer_corpus/origin_trial_token_data/34
@@ -0,0 +1 @@ +{"origin":"https://example.com:443","isThirdParty":true,"usage":"cycle", "feature":"WebBluetooth","expiry":1458766277}
diff --git a/content/test/data/fuzzer_corpus/origin_trial_token_data/35 b/content/test/data/fuzzer_corpus/origin_trial_token_data/35 new file mode 100644 index 0000000..236fe8b --- /dev/null +++ b/content/test/data/fuzzer_corpus/origin_trial_token_data/35
@@ -0,0 +1 @@ +{"origin":"https://example.com:443","isThirdParty":true,"usage":"", "feature":"WebBluetooth","expiry":1458766277}
diff --git a/content/test/data/fuzzer_dictionaries/origin_trial_token_fuzzer.dict b/content/test/data/fuzzer_dictionaries/origin_trial_token_fuzzer.dict index 77ff5f7b..371e1e42 100644 --- a/content/test/data/fuzzer_dictionaries/origin_trial_token_fuzzer.dict +++ b/content/test/data/fuzzer_dictionaries/origin_trial_token_fuzzer.dict
@@ -5,6 +5,7 @@ "\"origin\"" "\"isSubdomain\"" "\"isThirdParty\"" +"\"usage\"" "\"feature\"" "\"expiry\"" "https://" @@ -12,3 +13,5 @@ ":443" "true" "false" +"\"\"" +"\"subset\""
diff --git a/content/test/fuzzer/BUILD.gn b/content/test/fuzzer/BUILD.gn index 4658e6e3..0afcf69 100644 --- a/content/test/fuzzer/BUILD.gn +++ b/content/test/fuzzer/BUILD.gn
@@ -4,6 +4,7 @@ # Fuzzers for content/ components. +import("//mojo/public/tools/fuzzers/mojolpm.gni") import("//testing/libfuzzer/fuzzer_test.gni") import("//third_party/protobuf/proto_library.gni") @@ -161,6 +162,29 @@ ] } +mojolpm_fuzzer_test("code_cache_host_mojolpm_fuzzer") { + sources = [ "code_cache_host_mojolpm_fuzzer.cc" ] + + proto_source = "code_cache_host_mojolpm_fuzzer.proto" + testcase_proto_kind = "content.fuzzing.code_cache_host.proto.Testcase" + + deps = [ + "//base/test:test_support", + "//content/browser:for_content_tests", + "//content/public/browser:browser_sources", + "//content/test:test_support", + "//services/network:test_support", + "//storage/browser:test_support", + ] + + proto_deps = [ "//third_party/blink/public/mojom:mojom_platform_mojolpm" ] + + seed_corpus_sources = [ + "//content/test/data/fuzzer_corpus/code_cache_host_mojolpm_fuzzer/did_generate_cacheable_metadata_origin_a.textproto", + "//content/test/data/fuzzer_corpus/code_cache_host_mojolpm_fuzzer/did_generate_cacheable_metadata_origin_b.textproto", + ] +} + fuzzer_test("speech_audio_encoder_fuzzer") { sources = [ "../../browser/speech/audio_buffer.cc",
diff --git a/content/test/fuzzer/code_cache_host_mojolpm_fuzzer.cc b/content/test/fuzzer/code_cache_host_mojolpm_fuzzer.cc new file mode 100644 index 0000000..e36aa1e --- /dev/null +++ b/content/test/fuzzer/code_cache_host_mojolpm_fuzzer.cc
@@ -0,0 +1,362 @@ +// 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 <stdint.h> +#include <utility> + +#include "base/at_exit.h" +#include "base/base_switches.h" +#include "base/command_line.h" +#include "base/files/scoped_temp_dir.h" +#include "base/task/post_task.h" +#include "base/test/scoped_feature_list.h" +#include "base/test/test_switches.h" +#include "base/test/test_timeouts.h" +#include "base/threading/platform_thread.h" +#include "base/threading/thread.h" +#include "content/browser/code_cache/generated_code_cache_context.h" +#include "content/browser/renderer_host/code_cache_host_impl.h" +#include "content/browser/storage_partition_impl_map.h" +#include "content/public/browser/browser_task_traits.h" +#include "content/public/test/browser_task_environment.h" +#include "content/public/test/test_browser_context.h" +#include "content/public/test/test_content_client_initializer.h" +#include "content/test/fuzzer/code_cache_host_mojolpm_fuzzer.pb.h" +#include "mojo/core/embedder/embedder.h" +#include "storage/browser/quota/special_storage_policy.h" +#include "storage/browser/test/mock_special_storage_policy.h" +#include "third_party/blink/public/mojom/loader/code_cache.mojom-mojolpm.h" +#include "third_party/libprotobuf-mutator/src/src/libfuzzer/libfuzzer_macro.h" +#include "url/origin.h" + +using url::Origin; + +namespace content { + +const char* cmdline[] = {"code_cache_host_mojolpm_fuzzer", nullptr}; + +class ContentFuzzerEnvironment { + public: + ContentFuzzerEnvironment() + : fuzzer_thread_("fuzzer_thread"), + task_environment_( + (base::CommandLine::Init(1, cmdline), + TestTimeouts::Initialize(), + base::test::TaskEnvironment::MainThreadType::DEFAULT), + base::test::TaskEnvironment::ThreadPoolExecutionMode::ASYNC, + base::test::TaskEnvironment::ThreadingMode::MULTIPLE_THREADS, + content::BrowserTaskEnvironment::REAL_IO_THREAD) { + logging::SetMinLogLevel(logging::LOG_FATAL); + mojo::core::Init(); + fuzzer_thread_.StartAndWaitForTesting(); + } + + void RunThreadUntilIdle( + const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { + if (task_runner->RunsTasksInCurrentSequence()) { + base::RunLoop(base::RunLoop::Type::kNestableTasksAllowed).RunUntilIdle(); + } else { + base::WaitableEvent thread_idle( + base::WaitableEvent::ResetPolicy::MANUAL, + base::WaitableEvent::InitialState::NOT_SIGNALED); + task_runner->PostTask( + FROM_HERE, + base::BindOnce( + [](base::WaitableEvent* thread_idle) { + base::RunLoop(base::RunLoop::Type::kNestableTasksAllowed) + .RunUntilIdle(); + thread_idle->Signal(); + }, + base::Unretained(&thread_idle))); + thread_idle.Wait(); + } + } + + void RunUntilIdle() { RunThreadUntilIdle(fuzzer_thread_.task_runner()); } + + void RunUIThreadUntilIdle() { RunThreadUntilIdle(ui_task_runner()); } + + void RunIOThreadUntilIdle() { RunThreadUntilIdle(io_task_runner()); } + + scoped_refptr<base::SequencedTaskRunner> task_runner() { + return fuzzer_thread_.task_runner(); + } + + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner() { + if (!io_task_runner_) { + io_task_runner_ = base::CreateSingleThreadTaskRunner({BrowserThread::IO}); + } + return io_task_runner_; + } + + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() { + if (!ui_task_runner_) { + ui_task_runner_ = base::CreateSingleThreadTaskRunner({BrowserThread::UI}); + } + return ui_task_runner_; + } + + private: + base::AtExitManager at_exit_manager_; + std::unique_ptr<base::FieldTrialList> field_trial_list_; + base::test::ScopedFeatureList scoped_feature_list_; + base::Thread fuzzer_thread_; + BrowserTaskEnvironment task_environment_; + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; + TestContentClientInitializer content_client_initializer_; +}; + +ContentFuzzerEnvironment g_environment; + +ContentFuzzerEnvironment& SingletonEnvironment() { + return g_environment; +} + +scoped_refptr<base::SequencedTaskRunner> GetTaskRunner() { + return SingletonEnvironment().task_runner(); +} + +scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() { + return SingletonEnvironment().io_task_runner(); +} + +scoped_refptr<base::SingleThreadTaskRunner> GetUITaskRunner() { + return SingletonEnvironment().ui_task_runner(); +} + +void RunUntilIdle() { + SingletonEnvironment().RunUntilIdle(); +} + +void RunIOThreadUntilIdle() { + SingletonEnvironment().RunIOThreadUntilIdle(); +} + +void RunUIThreadUntilIdle() { + SingletonEnvironment().RunUIThreadUntilIdle(); +} + +class CodeCacheHostFuzzerContext : public mojolpm::Context { + const Origin kOriginA; + const Origin kOriginB; + const Origin kOriginOpaque; + const Origin kOriginEmpty; + + public: + CodeCacheHostFuzzerContext() + : kOriginA(url::Origin::Create(GURL("http://aaa.com/"))), + kOriginB(url::Origin::Create(GURL("http://bbb.com/"))), + kOriginOpaque(url::Origin::Create(GURL("opaque"))), + kOriginEmpty(url::Origin::Create(GURL("file://this_becomes_empty"))), + browser_context_() {} + + void InitializeServices() { + if (!initialized_) { + base::PostTask( + FROM_HERE, {BrowserThread::UI}, + base::BindOnce(&CodeCacheHostFuzzerContext::InitializeOnUIThread, + base::Unretained(this))); + RunUIThreadUntilIdle(); + + RunUntilIdle(); + + initialized_ = true; + } + } + + void InitializeOnUIThread() { + cache_storage_context_ = base::MakeRefCounted<CacheStorageContextImpl>(); + cache_storage_context_->Init(browser_context_.GetPath(), + browser_context_.GetSpecialStoragePolicy(), + nullptr); + + generated_code_cache_context_ = + base::MakeRefCounted<GeneratedCodeCacheContext>(); + generated_code_cache_context_->Initialize(browser_context_.GetPath(), + 65536); + } + + void CleanupServices() { + base::PostTask( + FROM_HERE, {BrowserThread::UI}, + base::BindOnce(&CodeCacheHostFuzzerContext::CleanupOnUIThread, + base::Unretained(this))); + RunUIThreadUntilIdle(); + + RunUntilIdle(); + + initialized_ = false; + } + + void CleanupOnUIThread() {} + + void AddCodeCacheHostImpl( + uint32_t id, + int renderer_id, + const Origin& origin, + mojo::PendingReceiver<::blink::mojom::CodeCacheHost>&& receiver, + base::WaitableEvent* receiver_bound) { + code_cache_hosts_[renderer_id] = std::make_unique<CodeCacheHostImpl>( + renderer_id, cache_storage_context_, generated_code_cache_context_, + std::move(receiver)); + + receiver_bound->Signal(); + } + + void AddCodeCacheHost( + uint32_t id, + int renderer_id, + content::fuzzing::code_cache_host::proto::NewCodeCacheHost::OriginId + origin_id) { + mojo::Remote<::blink::mojom::CodeCacheHost> remote; + auto receiver = remote.BindNewPipeAndPassReceiver(); + base::WaitableEvent receiver_bound; + + const Origin* origin = &kOriginA; + if (origin_id == 1) { + origin = &kOriginB; + } else if (origin_id == 2) { + origin = &kOriginOpaque; + } else if (origin_id == 3) { + origin = &kOriginEmpty; + } + + GetUITaskRunner()->PostTask( + FROM_HERE, + base::BindOnce(&CodeCacheHostFuzzerContext::AddCodeCacheHostImpl, + base::Unretained(this), id, renderer_id, *origin, + std::move(receiver), base::Unretained(&receiver_bound))); + + receiver_bound.Wait(); + + mojolpm::AddRemote(id, std::move(remote)); + } + + private: + TestBrowserContext browser_context_; + + bool initialized_ = false; + + scoped_refptr<CacheStorageContextImpl> cache_storage_context_; + scoped_refptr<GeneratedCodeCacheContext> generated_code_cache_context_; + + std::map<int, std::unique_ptr<CodeCacheHostImpl>> code_cache_hosts_; +}; +} // namespace content + +class CodeCacheHostTestcase : public mojolpm::TestcaseBase { + content::CodeCacheHostFuzzerContext& cch_context_; + const content::fuzzing::code_cache_host::proto::Testcase& testcase_; + int next_idx_ = 0; + int action_count_ = 0; + const int MAX_ACTION_COUNT = 512; + + public: + CodeCacheHostTestcase( + content::CodeCacheHostFuzzerContext& cch_context, + const content::fuzzing::code_cache_host::proto::Testcase& testcase); + ~CodeCacheHostTestcase() override; + bool IsFinished() override; + void NextAction() override; +}; + +CodeCacheHostTestcase::CodeCacheHostTestcase( + content::CodeCacheHostFuzzerContext& cch_context, + const content::fuzzing::code_cache_host::proto::Testcase& testcase) + : cch_context_(cch_context), testcase_(testcase) {} + +CodeCacheHostTestcase::~CodeCacheHostTestcase() {} + +bool CodeCacheHostTestcase::IsFinished() { + return next_idx_ >= testcase_.sequence_indexes_size(); +} + +void CodeCacheHostTestcase::NextAction() { + if (next_idx_ < testcase_.sequence_indexes_size()) { + auto sequence_idx = testcase_.sequence_indexes(next_idx_++); + const auto& sequence = + testcase_.sequences(sequence_idx % testcase_.sequences_size()); + for (auto action_idx : sequence.action_indexes()) { + if (!testcase_.actions_size() || ++action_count_ > MAX_ACTION_COUNT) { + return; + } + const auto& action = + testcase_.actions(action_idx % testcase_.actions_size()); + switch (action.action_case()) { + case content::fuzzing::code_cache_host::proto::Action:: + kNewCodeCacheHost: { + cch_context_.AddCodeCacheHost( + action.new_code_cache_host().id(), + action.new_code_cache_host().render_process_id(), + action.new_code_cache_host().origin_id()); + } break; + + case content::fuzzing::code_cache_host::proto::Action::kRunUntilIdle: { + if (action.run_until_idle().id()) { + content::RunUIThreadUntilIdle(); + } else { + content::RunIOThreadUntilIdle(); + } + } break; + + case content::fuzzing::code_cache_host::proto::Action:: + kCodeCacheHostCall: { + mojolpm::HandleRemoteMethodCall(action.code_cache_host_call()); + } break; + + case content::fuzzing::code_cache_host::proto::Action::ACTION_NOT_SET: + break; + } + } + } +} + +void run_testcase( + content::CodeCacheHostFuzzerContext* context, + const content::fuzzing::code_cache_host::proto::Testcase* testcase, + base::RepeatingClosure&& quit_closure) { + mojo::Message message; + auto dispatch_context = + std::make_unique<mojo::internal::MessageDispatchContext>(&message); + + CodeCacheHostTestcase cch_testcase(*context, *testcase); + context->StartTestcase(&cch_testcase, content::GetTaskRunner()); + + while (!context->IsFinished()) { + context->NextAction(); + content::RunUntilIdle(); + } + + content::RunIOThreadUntilIdle(); + content::RunUIThreadUntilIdle(); + + context->EndTestcase(); + + content::GetTaskRunner()->PostTask(FROM_HERE, std::move(quit_closure)); +} + +DEFINE_BINARY_PROTO_FUZZER( + const content::fuzzing::code_cache_host::proto::Testcase& testcase) { + if (!testcase.actions_size() || !testcase.sequences_size() || + !testcase.sequence_indexes_size()) { + return; + } + + content::CodeCacheHostFuzzerContext context; + context.InitializeServices(); + mojolpm::SetContext(&context); + + base::RunLoop ui_nested_runloop{base::RunLoop::Type::kNestableTasksAllowed}; + auto ui_nested_quit = ui_nested_runloop.QuitClosure(); + + content::GetTaskRunner()->PostTask( + FROM_HERE, + base::BindOnce(run_testcase, base::Unretained(&context), + base::Unretained(&testcase), std::move(ui_nested_quit))); + + ui_nested_runloop.Run(); + + context.CleanupServices(); +}
diff --git a/content/test/fuzzer/code_cache_host_mojolpm_fuzzer.proto b/content/test/fuzzer/code_cache_host_mojolpm_fuzzer.proto new file mode 100644 index 0000000..1212b8c4 --- /dev/null +++ b/content/test/fuzzer/code_cache_host_mojolpm_fuzzer.proto
@@ -0,0 +1,45 @@ +syntax = "proto2"; + +package content.fuzzing.code_cache_host.proto; + +import "third_party/blink/public/mojom/loader/code_cache.mojom.mojolpm.proto"; + +message NewCodeCacheHost { + enum OriginId { + ORIGIN_A = 0; + ORIGIN_B = 1; + ORIGIN_OPAQUE = 2; + ORIGIN_EMPTY = 3; + } + + required uint32 id = 1; + required uint32 render_process_id = 2; + required OriginId origin_id = 3; +} + +message RunUntilIdle { + enum ThreadId { + IO = 0; + UI = 1; + } + + required ThreadId id = 1; +} + +message Action { + oneof action { + NewCodeCacheHost new_code_cache_host = 1; + RunUntilIdle run_until_idle = 2; + mojolpm.blink.mojom.CodeCacheHost.RemoteMethodCall code_cache_host_call = 3; + } +} + +message Sequence { + repeated uint32 action_indexes = 1 [packed = true]; +} + +message Testcase { + repeated Action actions = 1; + repeated Sequence sequences = 2; + repeated uint32 sequence_indexes = 3 [packed = true]; +} \ No newline at end of file
diff --git a/content/utility/BUILD.gn b/content/utility/BUILD.gn index 5f891b01..1b4d1dc 100644 --- a/content/utility/BUILD.gn +++ b/content/utility/BUILD.gn
@@ -74,7 +74,10 @@ } if (is_chromeos) { - deps += [ "//chromeos/services/ime:sandbox_hook" ] + deps += [ + "//chromeos/services/ime:sandbox_hook", + "//chromeos/services/tts:sandbox_hook", + ] } # PAC execution is done in process on Android.
diff --git a/content/utility/DEPS b/content/utility/DEPS index ab7b7cf..ea50762 100644 --- a/content/utility/DEPS +++ b/content/utility/DEPS
@@ -4,6 +4,7 @@ "+content/public/utility", "+content/services/isolated_xr_device", "+chromeos/services/ime", + "+chromeos/services/tts", "+device/vr/buildflags", "+device/vr/public", "+services/audio",
diff --git a/content/utility/utility_main.cc b/content/utility/utility_main.cc index 58372b4a..780b86d 100644 --- a/content/utility/utility_main.cc +++ b/content/utility/utility_main.cc
@@ -31,6 +31,7 @@ #if defined(OS_CHROMEOS) #include "chromeos/services/ime/ime_sandbox_hook.h" +#include "chromeos/services/tts/tts_sandbox_hook.h" #endif #if defined(OS_MACOSX) @@ -89,6 +90,7 @@ sandbox_type == service_manager::SandboxType::kNetwork || #if defined(OS_CHROMEOS) sandbox_type == service_manager::SandboxType::kIme || + sandbox_type == service_manager::SandboxType::kTts || #endif // OS_CHROMEOS sandbox_type == service_manager::SandboxType::kAudio || sandbox_type == service_manager::SandboxType::kSpeechRecognition) { @@ -103,6 +105,8 @@ #if defined(OS_CHROMEOS) else if (sandbox_type == service_manager::SandboxType::kIme) pre_sandbox_hook = base::BindOnce(&chromeos::ime::ImePreSandboxHook); + else if (sandbox_type == service_manager::SandboxType::kTts) + pre_sandbox_hook = base::BindOnce(&chromeos::tts::TtsPreSandboxHook); #endif // OS_CHROMEOS service_manager::Sandbox::Initialize(
diff --git a/ios/third_party/material_components_ios/BUILD.gn b/ios/third_party/material_components_ios/BUILD.gn index 4e8430ebf..fd44b92 100644 --- a/ios/third_party/material_components_ios/BUILD.gn +++ b/ios/third_party/material_components_ios/BUILD.gn
@@ -395,7 +395,6 @@ "src/components/TextControls/src/BaseTextAreas/private/MDCBaseTextAreaTextView.h", "src/components/TextControls/src/BaseTextFields/MDCBaseTextField.h", "src/components/TextControls/src/BaseTextFields/MaterialTextControls+BaseTextFields.h", - "src/components/TextControls/src/BaseTextFields/private/MDCBaseTextFieldLayout.h", "src/components/TextControls/src/Enums/MDCTextControlLabelBehavior.h", "src/components/TextControls/src/Enums/MDCTextControlState.h", "src/components/TextControls/src/Enums/MaterialTextControls+Enums.h", @@ -415,6 +414,10 @@ "src/components/TextControls/src/OutlinedTextFields/MaterialTextControls+OutlinedTextFields.h", "src/components/TextControls/src/OutlinedTextFieldsTheming/MDCOutlinedTextField+MaterialTheming.h", "src/components/TextControls/src/OutlinedTextFieldsTheming/MaterialTextControls+OutlinedTextFieldsTheming.h", + "src/components/TextControls/src/UnderlinedTextFields/MDCUnderlinedTextField.h", + "src/components/TextControls/src/UnderlinedTextFields/MaterialTextControls+UnderlinedTextFields.h", + "src/components/TextControls/src/UnderlinedTextFieldsTheming/MDCUnderlinedTextField+MaterialTheming.h", + "src/components/TextControls/src/UnderlinedTextFieldsTheming/MaterialTextControls+UnderlinedTextFieldsTheming.h", "src/components/TextFields/src/ColorThemer/MDCFilledTextFieldColorThemer.h", "src/components/TextFields/src/ColorThemer/MaterialTextFields+ColorThemer.h", "src/components/TextFields/src/MDCIntrinsicHeightTextView.h", @@ -472,6 +475,7 @@ "src/components/private/Icons/icons/ic_check_circle/src/MaterialIcons+ic_check_circle.h", "src/components/private/Icons/icons/ic_chevron_right/src/MaterialIcons+ic_chevron_right.h", "src/components/private/Icons/icons/ic_color_lens/src/MaterialIcons+ic_color_lens.h", + "src/components/private/Icons/icons/ic_feedback/src/MaterialIcons+ic_feedback.h", "src/components/private/Icons/icons/ic_help_outline/src/MaterialIcons+ic_help_outline.h", "src/components/private/Icons/icons/ic_info/src/MaterialIcons+ic_info.h", "src/components/private/Icons/icons/ic_more_horiz/src/MaterialIcons+ic_more_horiz.h", @@ -512,11 +516,17 @@ "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlAssistiveLabelViewLayout.h", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlColorViewModel.h", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlGradientManager.h", + "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlHorizontalPositioningReference.h", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelAnimation.h", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelPosition.h", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlVerticalPositioningReference.h", "src/components/private/TextControlsPrivate/src/Shared/MaterialTextControlsPrivate+Shared.h", "src/components/private/TextControlsPrivate/src/Shared/UIBezierPath+MDCTextControlStyle.h", + "src/components/private/TextControlsPrivate/src/TextFields/MDCBaseTextFieldLayout.h", + "src/components/private/TextControlsPrivate/src/TextFields/MaterialTextControlsPrivate+TextFields.h", + "src/components/private/TextControlsPrivate/src/UnderlinedStyle/MDCTextControlStyleUnderlined.h", + "src/components/private/TextControlsPrivate/src/UnderlinedStyle/MDCTextControlVerticalPositioningReferenceUnderlined.h", + "src/components/private/TextControlsPrivate/src/UnderlinedStyle/MaterialTextControlsPrivate+UnderlinedStyle.h", "src/components/private/ThumbTrack/src/MDCNumericValueLabel.h", "src/components/private/ThumbTrack/src/MDCThumbTrack.h", "src/components/private/ThumbTrack/src/MDCThumbView.h", @@ -547,7 +557,7 @@ # List generated by the following commands: # $ cd src/ios/third_party/material_components_ios # $ find src -path 'src/components/*/src/*.h' -a \! -path '*Test*'|\ - # sed -e 's:\(.*\)/[^/]*: "\1",:'|sort -u + # sed -e 's:\(.*\)/[^/]*: "\1",:'|sort -u "src/components/ActionSheet/src", "src/components/ActionSheet/src/ActionSheetThemer", "src/components/ActionSheet/src/ColorThemer", @@ -654,7 +664,6 @@ "src/components/TextControls/src/BaseTextAreas", "src/components/TextControls/src/BaseTextAreas/private", "src/components/TextControls/src/BaseTextFields", - "src/components/TextControls/src/BaseTextFields/private", "src/components/TextControls/src/Enums", "src/components/TextControls/src/FilledTextAreas", "src/components/TextControls/src/FilledTextAreasTheming", @@ -664,6 +673,8 @@ "src/components/TextControls/src/OutlinedTextAreasTheming", "src/components/TextControls/src/OutlinedTextFields", "src/components/TextControls/src/OutlinedTextFieldsTheming", + "src/components/TextControls/src/UnderlinedTextFields", + "src/components/TextControls/src/UnderlinedTextFieldsTheming", "src/components/TextFields/src", "src/components/TextFields/src/ColorThemer", "src/components/TextFields/src/Theming", @@ -679,6 +690,7 @@ "src/components/private/Icons/icons/ic_check_circle/src", "src/components/private/Icons/icons/ic_chevron_right/src", "src/components/private/Icons/icons/ic_color_lens/src", + "src/components/private/Icons/icons/ic_feedback/src", "src/components/private/Icons/icons/ic_help_outline/src", "src/components/private/Icons/icons/ic_info/src", "src/components/private/Icons/icons/ic_more_horiz/src", @@ -697,6 +709,8 @@ "src/components/private/TextControlsPrivate/src/FilledStyle", "src/components/private/TextControlsPrivate/src/OutlinedStyle", "src/components/private/TextControlsPrivate/src/Shared", + "src/components/private/TextControlsPrivate/src/TextFields", + "src/components/private/TextControlsPrivate/src/UnderlinedStyle", "src/components/private/ThumbTrack/src", "src/components/private/ThumbTrack/src/private", "src/components/private/UIMetrics/src", @@ -1311,8 +1325,6 @@ "src/components/TextControls/src/BaseTextFields/MDCBaseTextField.h", "src/components/TextControls/src/BaseTextFields/MDCBaseTextField.m", "src/components/TextControls/src/BaseTextFields/MaterialTextControls+BaseTextFields.h", - "src/components/TextControls/src/BaseTextFields/private/MDCBaseTextFieldLayout.h", - "src/components/TextControls/src/BaseTextFields/private/MDCBaseTextFieldLayout.m", "src/components/TextControls/src/Enums/MDCTextControlLabelBehavior.h", "src/components/TextControls/src/Enums/MDCTextControlState.h", "src/components/TextControls/src/Enums/MDCTextControlState.m", @@ -1341,6 +1353,12 @@ "src/components/TextControls/src/OutlinedTextFieldsTheming/MDCOutlinedTextField+MaterialTheming.h", "src/components/TextControls/src/OutlinedTextFieldsTheming/MDCOutlinedTextField+MaterialTheming.m", "src/components/TextControls/src/OutlinedTextFieldsTheming/MaterialTextControls+OutlinedTextFieldsTheming.h", + "src/components/TextControls/src/UnderlinedTextFields/MDCUnderlinedTextField.h", + "src/components/TextControls/src/UnderlinedTextFields/MDCUnderlinedTextField.m", + "src/components/TextControls/src/UnderlinedTextFields/MaterialTextControls+UnderlinedTextFields.h", + "src/components/TextControls/src/UnderlinedTextFieldsTheming/MDCUnderlinedTextField+MaterialTheming.h", + "src/components/TextControls/src/UnderlinedTextFieldsTheming/MDCUnderlinedTextField+MaterialTheming.m", + "src/components/TextControls/src/UnderlinedTextFieldsTheming/MaterialTextControls+UnderlinedTextFieldsTheming.h", "src/components/TextFields/src/ColorThemer/MDCFilledTextFieldColorThemer.h", "src/components/TextFields/src/ColorThemer/MDCFilledTextFieldColorThemer.m", "src/components/TextFields/src/ColorThemer/MaterialTextFields+ColorThemer.h", @@ -1434,6 +1452,8 @@ "src/components/private/Icons/icons/ic_chevron_right/src/MaterialIcons+ic_chevron_right.m", "src/components/private/Icons/icons/ic_color_lens/src/MaterialIcons+ic_color_lens.h", "src/components/private/Icons/icons/ic_color_lens/src/MaterialIcons+ic_color_lens.m", + "src/components/private/Icons/icons/ic_feedback/src/MaterialIcons+ic_feedback.h", + "src/components/private/Icons/icons/ic_feedback/src/MaterialIcons+ic_feedback.m", "src/components/private/Icons/icons/ic_help_outline/src/MaterialIcons+ic_help_outline.h", "src/components/private/Icons/icons/ic_help_outline/src/MaterialIcons+ic_help_outline.m", "src/components/private/Icons/icons/ic_info/src/MaterialIcons+ic_info.h", @@ -1502,14 +1522,25 @@ "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlColorViewModel.m", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlGradientManager.h", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlGradientManager.m", + "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlHorizontalPositioningReference.h", + "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlHorizontalPositioningReference.m", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelAnimation.h", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelAnimation.m", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelPosition.h", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelPosition.m", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlVerticalPositioningReference.h", + "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlVerticalPositioningReference.m", "src/components/private/TextControlsPrivate/src/Shared/MaterialTextControlsPrivate+Shared.h", "src/components/private/TextControlsPrivate/src/Shared/UIBezierPath+MDCTextControlStyle.h", "src/components/private/TextControlsPrivate/src/Shared/UIBezierPath+MDCTextControlStyle.m", + "src/components/private/TextControlsPrivate/src/TextFields/MDCBaseTextFieldLayout.h", + "src/components/private/TextControlsPrivate/src/TextFields/MDCBaseTextFieldLayout.m", + "src/components/private/TextControlsPrivate/src/TextFields/MaterialTextControlsPrivate+TextFields.h", + "src/components/private/TextControlsPrivate/src/UnderlinedStyle/MDCTextControlStyleUnderlined.h", + "src/components/private/TextControlsPrivate/src/UnderlinedStyle/MDCTextControlStyleUnderlined.m", + "src/components/private/TextControlsPrivate/src/UnderlinedStyle/MDCTextControlVerticalPositioningReferenceUnderlined.h", + "src/components/private/TextControlsPrivate/src/UnderlinedStyle/MDCTextControlVerticalPositioningReferenceUnderlined.m", + "src/components/private/TextControlsPrivate/src/UnderlinedStyle/MaterialTextControlsPrivate+UnderlinedStyle.h", "src/components/private/ThumbTrack/src/MDCNumericValueLabel.h", "src/components/private/ThumbTrack/src/MDCNumericValueLabel.m", "src/components/private/ThumbTrack/src/MDCThumbTrack.h",
diff --git a/media/base/audio_renderer_mixer.cc b/media/base/audio_renderer_mixer.cc index d3c1bd8..d710930 100644 --- a/media/base/audio_renderer_mixer.cc +++ b/media/base/audio_renderer_mixer.cc
@@ -24,49 +24,15 @@ enum { kPauseDelaySeconds = 10 }; -// Tracks the maximum value of a counter and logs it into a UMA histogram upon -// each increase of the maximum. NOT thread-safe, make sure it is used under -// lock. -class AudioRendererMixer::UMAMaxValueTracker { - public: - UMAMaxValueTracker(UmaLogCallback log_callback) - : log_callback_(std::move(log_callback)), count_(0), max_count_(0) {} - - ~UMAMaxValueTracker() = default; - - // Increments the counter, updates the maximum. - void Increment() { - ++count_; - if (max_count_ < count_) { - max_count_ = count_; - log_callback_.Run(max_count_); - } - } - - // Decrements the counter. - void Decrement() { - DCHECK_GE(count_, 0); - --count_; - } - - private: - const UmaLogCallback log_callback_; - int count_; - int max_count_; - DISALLOW_COPY_AND_ASSIGN(UMAMaxValueTracker); -}; - AudioRendererMixer::AudioRendererMixer(const AudioParameters& output_params, - scoped_refptr<AudioRendererSink> sink, - UmaLogCallback log_callback) + scoped_refptr<AudioRendererSink> sink) : output_params_(output_params), audio_sink_(std::move(sink)), master_converter_(output_params, output_params, true), pause_delay_(base::TimeDelta::FromSeconds(kPauseDelaySeconds)), last_play_time_(base::TimeTicks::Now()), // Initialize |playing_| to true since Start() results in an auto-play. - playing_(true), - input_count_tracker_(new UMAMaxValueTracker(std::move(log_callback))) { + playing_(true) { DCHECK(audio_sink_); // If enabled we will disable the real audio output stream for muted/silent @@ -126,8 +92,6 @@ } converter->second->AddInput(input); } - - input_count_tracker_->Increment(); } void AudioRendererMixer::RemoveMixerInput( @@ -148,8 +112,6 @@ converters_.erase(converter); } } - - input_count_tracker_->Decrement(); } void AudioRendererMixer::AddErrorCallback(AudioRendererMixerInput* input) {
diff --git a/media/base/audio_renderer_mixer.h b/media/base/audio_renderer_mixer.h index b8917dc..db82cb3ea 100644 --- a/media/base/audio_renderer_mixer.h +++ b/media/base/audio_renderer_mixer.h
@@ -35,11 +35,8 @@ class MEDIA_EXPORT AudioRendererMixer : public AudioRendererSink::RenderCallback { public: - using UmaLogCallback = base::RepeatingCallback<void(int)>; - AudioRendererMixer(const AudioParameters& output_params, - scoped_refptr<AudioRendererSink> sink, - UmaLogCallback log_callback); + scoped_refptr<AudioRendererSink> sink); ~AudioRendererMixer() override; // Add or remove a mixer input from mixing; called by AudioRendererMixerInput. @@ -62,8 +59,6 @@ } private: - class UMAMaxValueTracker; - // AudioRendererSink::RenderCallback implementation. int Render(base::TimeDelta delay, base::TimeTicks delay_timestamp, @@ -115,10 +110,6 @@ base::TimeTicks last_play_time_ GUARDED_BY(lock_); bool playing_ GUARDED_BY(lock_); - // Tracks the maximum number of simultaneous mixer inputs and logs it into - // UMA histogram upon the destruction. - std::unique_ptr<UMAMaxValueTracker> input_count_tracker_ GUARDED_BY(lock_); - DISALLOW_COPY_AND_ASSIGN(AudioRendererMixer); };
diff --git a/media/base/audio_renderer_mixer_input_unittest.cc b/media/base/audio_renderer_mixer_input_unittest.cc index c94d73b9..39b9c75 100644 --- a/media/base/audio_renderer_mixer_input_unittest.cc +++ b/media/base/audio_renderer_mixer_input_unittest.cc
@@ -21,10 +21,6 @@ using testing::_; -namespace { -void LogUma(int value) {} -} - namespace media { static const int kSampleRate = 48000; @@ -67,8 +63,8 @@ EXPECT_CALL(*reinterpret_cast<MockAudioRendererSink*>(sink.get()), Start()); - mixers_[idx].reset(new AudioRendererMixer( - audio_parameters_, std::move(sink), base::BindRepeating(&LogUma))); + mixers_[idx] = std::make_unique<AudioRendererMixer>(audio_parameters_, + std::move(sink)); } EXPECT_CALL(*this, ReturnMixer(mixers_[idx].get())); return mixers_[idx].get();
diff --git a/media/base/audio_renderer_mixer_unittest.cc b/media/base/audio_renderer_mixer_unittest.cc index 14cdde6d..d979c59 100644 --- a/media/base/audio_renderer_mixer_unittest.cc +++ b/media/base/audio_renderer_mixer_unittest.cc
@@ -25,10 +25,6 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -namespace { -void LogUma(int value) {} -} - namespace media { // Parameters which control the many input case tests. @@ -77,8 +73,7 @@ EXPECT_CALL(*sink_.get(), Start()); EXPECT_CALL(*sink_.get(), Stop()); - mixer_.reset(new AudioRendererMixer(output_parameters_, sink_, - base::BindRepeating(&LogUma))); + mixer_ = std::make_unique<AudioRendererMixer>(output_parameters_, sink_); mixer_callback_ = sink_->callback(); audio_bus_ = AudioBus::Create(output_parameters_);
diff --git a/media/capture/video/chromeos/mojom/BUILD.gn b/media/capture/video/chromeos/mojom/BUILD.gn index f98d89e..cb72cea 100644 --- a/media/capture/video/chromeos/mojom/BUILD.gn +++ b/media/capture/video/chromeos/mojom/BUILD.gn
@@ -17,7 +17,6 @@ deps = [ "//components/chromeos_camera/common", "//media/capture/mojom:image_capture", - "//media/mojo/mojom", "//ui/gfx/geometry/mojom", "//ui/gfx/range/mojom", ]
diff --git a/media/gpu/video_encode_accelerator_perf_tests.cc b/media/gpu/video_encode_accelerator_perf_tests.cc index bede1f0..aee038d1 100644 --- a/media/gpu/video_encode_accelerator_perf_tests.cc +++ b/media/gpu/video_encode_accelerator_perf_tests.cc
@@ -118,11 +118,8 @@ // Create a new performance evaluator. PerformanceEvaluator() {} - // Interface BitstreamProcessor - void ProcessBitstreamBuffer( - int32_t bitstream_buffer_id, - const BitstreamBufferMetadata& metadata, - const base::UnsafeSharedMemoryRegion* shm) override; + void ProcessBitstream(scoped_refptr<BitstreamRef> bitstream, + size_t frame_index) override; bool WaitUntilDone() override { return true; } // Start/Stop collecting performance metrics. @@ -144,10 +141,9 @@ PerformanceMetrics perf_metrics_; }; -void PerformanceEvaluator::ProcessBitstreamBuffer( - int32_t bitstream_buffer_id, - const BitstreamBufferMetadata& metadata, - const base::UnsafeSharedMemoryRegion* shm) { +void PerformanceEvaluator::ProcessBitstream( + scoped_refptr<BitstreamRef> bitstream, + size_t frame_index) { base::TimeTicks now = base::TimeTicks::Now(); base::TimeDelta delivery_time = (now - prev_bitstream_delivery_time_); @@ -155,7 +151,8 @@ delivery_time.InMillisecondsF()); prev_bitstream_delivery_time_ = now; - base::TimeDelta encode_time = now.since_origin() - metadata.timestamp; + base::TimeDelta encode_time = + now.since_origin() - bitstream->metadata.timestamp; perf_metrics_.bitstream_encode_times_.push_back( encode_time.InMillisecondsF()); }
diff --git a/mojo/docs/mojolpm.md b/mojo/docs/mojolpm.md new file mode 100644 index 0000000..a3b1c8e2 --- /dev/null +++ b/mojo/docs/mojolpm.md
@@ -0,0 +1,471 @@ +# Getting started with MojoLPM + +*** note +**Note:** Using MojoLPM to fuzz your Mojo interfaces is intended to be simple, +but there are edge-cases that may require a very detailed understanding of the +Mojo implementation to fix. If you run into problems that you can't understand +readily, send an email to [markbrand@google.com] and cc `fuzzing@chromium.org` +and we'll try and help. + +**Prerequisites:** Knowledge of [libfuzzer] and basic understanding +of [Protocol Buffers] and [libprotobuf-mutator]. Basic understanding of +[testing in Chromium]. +*** + +This document will walk you through: +* An overview of MojoLPM and what it's used for. +* Adding a fuzzer to an existing Mojo interface using MojoLPM. + +[TOC] + +## Overview of MojoLPM + +MojoLPM is a toolchain for automatically generating structure-aware fuzzers for +Mojo interfaces using libprotobuf-mutator as the fuzzing engine. + +This tool works by using the existing "grammar" for the interface provided by +the .mojom files, and translating that into a Protocol Buffer format that can be +fuzzed by libprotobuf-mutator. These protocol buffers are then interpreted by +a generated runtime as a sequence of mojo method calls on the targeted +interface. + +The intention is that using these should be as simple as plugging the generated +code in to the existing unittests for those interfaces - so if you've already +implemented the necessary mocks to unittest your code, the majority of the work +needed to get quite effective fuzzing of your interfaces is already complete! + +## Choose the Mojo interface(s) to fuzz + +If you're a developer looking to add fuzzing support for an interface that +you're developing, then this should be very easy for you! + +If not, then a good starting point is to search for [interfaces] in codesearch. +The most interesting interfaces from a security perspective are those which are +implemented in the browser process and exposed to the renderer process, but +there isn't a very simple way to enumerate these, so you may need to look +through some of the source code to find an interesting one. + +For the rest of this guide, we'll write a new fuzzer for +`blink.mojom.CodeCacheHost`, which is defined in +`third_party/blink/public/mojom/loader/code_cache.mojom`. + +We then need to find the relevant GN build target for this mojo interface so +that we know how to refer to it later - in this case that is +`//third_party/blink/public/mojom:mojom_platform`. + +## Find the implementations of the interfaces + +If you are developing these interfaces, then you already know where to find the +implementations. + +Otherwise a good starting point is to search for references to +"public blink::mojom::CodeCacheHost". Usually there is only a single +implementation of a given Mojo interface (there are a few exceptions where the +interface abstracts platform specific details, but this is less common). This +leads us to `content/browser/renderer_host/code_cache_host_impl.h` and +`CodeCacheHostImpl`. + +## Find the unittest for the implementation + +Unfortunately, it doesn't look like `CodeCacheHostImpl` has a unittest, so we'll +have to go through the process of understanding how to create a valid instance +ourselves in order to fuzz this interface. + +Since this interface runs in the Browser process, and is part of `/content`, +we're going to create our new fuzzer in `/content/test/fuzzer`. + +## Add our testcase proto + +First we'll add a proto source file, `code_cache_host_mojolpm_fuzzer.proto`, +which is going to define the structure of our testcases. This is basically +boilerplate, but it allows creating fuzzers which interact with multiple Mojo +interfaces to uncover more complex issues. For our case, this will be a simple +file: + +``` +syntax = "proto2"; + +package content.fuzzing.code_cache_host.proto; + +import "third_party/blink/public/mojom/loader/code_cache.mojom.mojolpm.proto"; + +message NewCodeCacheHost { + required uint32 id = 1; +} + +message RunUntilIdle { + enum ThreadId { + IO = 0; + UI = 1; + } + + required ThreadId id = 1; +} + +message Action { + oneof action { + NewCodeCacheHost new_code_cache_host = 1; + RunUntilIdle run_until_idle = 2; + mojolpm.blink.mojom.CodeCacheHost.RemoteMethodCall code_cache_host_call = 3; + } +} + +message Sequence { + repeated uint32 action_indexes = 1 [packed=true]; +} + +message Testcase { + repeated Action actions = 1; + repeated Sequence sequences = 2; + repeated uint32 sequence_indexes = 3 [packed=true]; +} +``` + +This specifies all of the actions that the fuzzer will be able to take - it +will be able to create a new `CodeCacheHost` instance, perform sequences of +interface calls on those instances, and wait for various threads to be idle. + +In order to build this proto file, we'll need to copy it into the out/ directory +so that it can reference the proto files generated by MojoLPM - this will be +handled for us by the `mojolpm_fuzzer_test` build rule. + +## Add our fuzzer source + +Now we're ready to create the fuzzer c++ source file, +`code_cache_host_mojolpm_fuzzer.cc` and the fuzzer build target. This +target is going to depend on both our proto file, and on the c++ source file. +Most of the necessary dependencies will be handled for us, but we do still need +to add some directly. + +Note especially the dependency on `mojom_platform_mojolpm` in blink, this is an +autogenerated target where the target containing the generated fuzzer protocol +buffer descriptions will be the name of the mojom target with `_mojolpm` +appended. + +``` +mojolpm_fuzzer_test("code_cache_host_mojolpm_fuzzer") { + sources = [ + "code_cache_host_mojolpm_fuzzer.cc" + ] + + proto_source = "code_cache_host_mojolpm_fuzzer.proto" + + deps = [ + "//base/test:test_support", + "//content/browser:for_content_tests", + "//content/public/browser:browser_sources", + "//content/test:test_support", + "//services/network:test_support", + "//storage/browser:test_support", + ] + + proto_deps = [ + "//third_party/blink/public/mojom:mojom_platform_mojolpm", + ] +} +``` + +Now, the minimal source code to do load our testcases: + +```c++ +// 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 <stdint.h> +#include <utility> + +#include "code_cache_host_mojolpm_fuzzer.pb.h" +#include "mojo/core/embedder/embedder.h" +#include "third_party/blink/public/mojom/loader/code_cache.mojom-mojolpm.h" +#include "third_party/libprotobuf-mutator/src/src/libfuzzer/libfuzzer_macro.h" + +DEFINE_BINARY_PROTO_FUZZER( + const content::fuzzing::code_cache_host::proto::Testcase& testcase) { +} +``` + +You should now be able to build and run this fuzzer (it, of course, won't do +very much) to check that everything is lined up right so far. + +## Handle global process setup + +Now we need to add some basic setup code so that our process has something that +mostly resembles a normal Browser process; if you look in the file this is +`CodeCacheHostFuzzerEnvironment`, which adds a global environment instance that +will handle setting up this basic environment, which will be reused for all of +our testcases, since starting threads is expensive and slow. + +## Handle per-testcase setup + +We next need to handle the necessary setup to instantiate `CodeCacheHostImpl`, +so that we can actually run the testcases. At this point, we realise that it's +likely that we want to be able to have multiple `CodeCacheHostImpl`'s with +different render_process_ids and different backing origins, so we need to modify +our proto file to reflect this: + +``` +message NewCodeCacheHost { + enum OriginId { + ORIGIN_A = 0; + ORIGIN_B = 1; + ORIGIN_OPAQUE = 2; + ORIGIN_EMPTY = 3; + } + + required uint32 id = 1; + required uint32 render_process_id = 2; + required OriginId origin_id = 3; +} +``` + +Note that we're using an enum to represent the origin, rather than a string; +it's unlikely that the true value of the origin is going to be important, so +we've instead chosen a few select values based on the cases mentioned in the +source. + +The first thing that we need to do is set-up the basic Browser process +environment; this is what `ContentFuzzerEnvironment` is doing - this has a basic +setup suitable for fuzzing interfaces in `/content`. A few things to be careful +of are that we need to make sure that `mojo::core::Init()` is called (only once) +and we probably want as much freedom as possible in terms of scheduling, so we +want to use slightly different threading options than the average unittest. This +is a singleton type that will live for the entire duration of the fuzzer process +so we don't want to be holding any testcase-specific data here. + +The next thing that we need to do is to figure out the basic setup needed to +instantiate the interface we're interested in. Looking at the constructor for +`CodeCacheHostImpl` we need three things; a valid `render_process_id`, an +instance of `CacheStorageContextImpl` and an instance of +`GeneratedCodeCacheContext`. `CodeCacheHostFuzzerContext` is our container for +these per-testcase instances; and will handle creating and binding the instances +of the Mojo interfaces that we're going to fuzz. The most important thing to be +careful of here is that everything happens on the correct thread/sequence. Many +Browser-process objects have specific expectations, and will end up with very +different behaviour if they are created or used from the wrong context. + +## Integrate with the generated MojoLPM fuzzer code + +Finally, we need to do a little bit more plumbing, to rig up this infrastructure +that we've built together with the autogenerated code that MojoLPM gives us to +interpret and run our testcases. This is the `CodeCacheHostTestcase`, and the +part where the magic happens is here: + +```c++ +void CodeCacheHostTestcase::NextAction() { + if (next_idx_ < testcase_.sequence_indexes_size()) { + auto sequence_idx = testcase_.sequence_indexes(next_idx_++); + const auto& sequence = + testcase_.sequences(sequence_idx % testcase_.sequences_size()); + for (auto action_idx : sequence.action_indexes()) { + if (!testcase_.actions_size() || ++action_count_ > MAX_ACTION_COUNT) { + return; + } + const auto& action = + testcase_.actions(action_idx % testcase_.actions_size()); + switch (action.action_case()) { + case content::fuzzing::code_cache_host::proto::Action::kNewCodeCacheHost: { + cch_context_.AddCodeCacheHost( + action.new_code_cache_host().id(), + action.new_code_cache_host().render_process_id(), + action.new_code_cache_host().origin_id()); + } break; + + case content::fuzzing::code_cache_host::proto::Action::kRunUntilIdle: { + if (action.run_until_idle().id()) { + content::RunUIThreadUntilIdle(); + } else { + content::RunIOThreadUntilIdle(); + } + } break; + + case content::fuzzing::code_cache_host::proto::Action::kCodeCacheHostCall: { + mojolpm::HandleRemoteMethodCall(action.code_cache_host_call()); + } break; + + case content::fuzzing::code_cache_host::proto::Action::ACTION_NOT_SET: + break; + } + } + } +} +``` + +The key line here in integration with MojoLPM is the last case, +`kCodeCacheHostCall`, where we're asking MojoLPM to treat this incoming proto +entry as a call to a method on the `CodeCacheHost` interface. + +There's just a little bit more boilerplate in the bottom of the file to tidy up +concurrency loose ends, making sure that the fuzzer components are all running +on the correct threads; those are more-or-less common to any fuzzer using +MojoLPM. + +## Test it! + +Make a corpus directory and fire up your shiny new fuzzer! + +``` + ~/chromium/src% out/Default/code_cache_host_mojolpm_fuzzer /dev/shm/corpus +INFO: Seed: 3273881842 +INFO: Loaded 1 modules (1121912 inline 8-bit counters): 1121912 [0x559151a1aea8, 0x559151b2cd20), +INFO: Loaded 1 PC tables (1121912 PCs): 1121912 [0x559151b2cd20,0x559152c4b4a0), +INFO: 146 files found in /dev/shm/corpus +INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes +INFO: seed corpus: files: 146 min: 2b max: 268b total: 8548b rss: 88Mb +#147 INITED cov: 4633 ft: 10500 corp: 138/8041b exec/s: 0 rss: 91Mb +#152 NEW cov: 4633 ft: 10501 corp: 139/8139b lim: 4096 exec/s: 0 rss: 91Mb L: 98/268 MS: 8 Custom-ChangeByte-Custom-EraseBytes-Custom-ShuffleBytes-Custom-Custom- +#154 NEW cov: 4634 ft: 10510 corp: 140/8262b lim: 4096 exec/s: 0 rss: 91Mb L: 123/268 MS: 3 CustomCrossOver-ChangeBit-Custom- +#157 NEW cov: 4634 ft: 10512 corp: 141/8384b lim: 4096 exec/s: 0 rss: 91Mb L: 122/268 MS: 3 CustomCrossOver-Custom-CustomCrossOver- +#158 NEW cov: 4634 ft: 10514 corp: 142/8498b lim: 4096 exec/s: 0 rss: 91Mb L: 114/268 MS: 1 CustomCrossOver- +#159 NEW cov: 4634 ft: 10517 corp: 143/8601b lim: 4096 exec/s: 0 rss: 91Mb L: 103/268 MS: 1 Custom- +#160 NEW cov: 4634 ft: 10526 corp: 144/8633b lim: 4096 exec/s: 0 rss: 91Mb L: 32/268 MS: 1 Custom- +#164 NEW cov: 4634 ft: 10528 corp: 145/8851b lim: 4096 exec/s: 0 rss: 91Mb L: 218/268 MS: 4 CustomCrossOver-Custom-CustomCrossOver-Custom- +``` + +## Wait for it... + +Let the fuzzer run for a while, and keep periodically checking in in case it's +fallen over. It's likely you'll have made a few mistakes somewhere along the way +but hopefully soon you'll have the fuzzer running 'clean' for a few hours. + +If your coverage isn't going up at all, then you've probably made a mistake and +it likely isn't managing to actually interact with the interface you're trying +to fuzz - try using the code coverage output from the next step to debug what's +going wrong. + +## (Optional) Run coverage + +In many cases it's useful to check the code coverage to see if we can benefit +from adding some manual testcases to get deeper coverage. For this example I +used the following command: + +``` +python tools/code_coverage/coverage.py code_cache_host_mojolpm_fuzzer -b out/Coverage -o ManualReport -c "out/Coverage/code_cache_host_mojolpm_fuzzer -ignore_timeouts=1 -timeout=4 -runs=0 /dev/shm/corpus" -f content +``` + +With the CodeCacheHost, looking at the coverage after a few hours we could see +that there's definitely some room for improvement: + +```c++ +/* 55 */ base::Optional<GURL> GetSecondaryKeyForCodeCache(const GURL& resource_url, +/* 56 53.6k */ int render_process_id) { +/* 57 53.6k */ if (!resource_url.is_valid() || !resource_url.SchemeIsHTTPOrHTTPS()) +/* 58 53.6k */ return base::nullopt; +/* 59 0 */ +/* 60 0 */ GURL origin_lock = +/* 61 0 */ ChildProcessSecurityPolicyImpl::GetInstance()->GetOriginLock( +/* 62 0 */ render_process_id); +``` + +## (Optional) Improve corpus manually + +It's fairly easy to improve the corpus manually, since our corpus files are just +protobuf files that describe the sequence of interface calls to make. + +There are a couple of approaches that we can take here - we'll try building a +small manual seed corpus that we'll use to kick-start our fuzzer. Since it's +easier to edit text protos, MojoLPM can automatically convert our seed corpus +from text protos to binary protos during the build, making this slightly less +painful for us, and letting us store our corpus in-tree in a readable format. + +So, we'll create a new folder to hold this seed corpus, and craft our first +file: + +``` +actions { + new_code_cache_host { + id: 1 + render_process_id: 0 + origin_id: ORIGIN_A + } +} +actions { + code_cache_host_call { + remote { + id: 1 + } + m_did_generate_cacheable_metadata { + m_cache_type: CodeCacheType_kJavascript + m_url { + new { + id: 1 + m_url: "http://aaa.com/test" + } + } + m_data { + new { + id: 1 + m_bytes { + } + } + m_expected_response_time { + } + } + } +} +sequences { + action_indexes: 0 + action_indexes: 1 +} +sequence_indexes: 0 +``` + +We can then add some new entries to our build target to have the corpus +converted to binary proto directly during build. + +``` + testcase_proto_kind = "content.fuzzing.code_cache_host.proto.Testcase" + + seed_corpus_sources = [ + "code_cache_host_mojolpm_fuzzer_corpus/did_generate_cacheable_metadata.textproto", + ] +``` + +If we now run a new coverage report using this single file seed corpus: +(note that the binary corpus files will be output in your output directory, in +this case code_cache_host_mojolpm_fuzzer_seed_corpus.zip): + +``` +autoninja -C out/Coverage chrome +rm -rf /tmp/corpus; mkdir /tmp/corpus; unzip out/Coverage/code_cache_host_mojolpm_fuzzer_seed_corpus.zip -d /tmp/corpus +python tools/code_coverage/coverage.py code_cache_host_mojolpm_fuzzer -b out/Coverage -o ManualReport -c "out/Coverage/code_cache_host_mojolpm_fuzzer -ignore_timeouts=1 -timeout=4 -runs=0 /tmp/corpus" -f content +``` + +We can see that we're now getting some more coverage: + +```c++ +/* 118 */ void CodeCacheHostImpl::DidGenerateCacheableMetadata( +/* 119 */ blink::mojom::CodeCacheType cache_type, +/* 120 */ const GURL& url, +/* 121 */ base::Time expected_response_time, +/* 122 2 */ mojo_base::BigBuffer data) { +/* 123 2 */ if (!url.SchemeIsHTTPOrHTTPS()) { +/* 124 0 */ mojo::ReportBadMessage("Invalid URL scheme for code cache."); +/* 125 0 */ return; +/* 126 0 */ } +/* 127 2 */ +/* 128 2 */ DCHECK_CURRENTLY_ON(BrowserThread::UI); +/* 129 2 */ +/* 130 2 */ GeneratedCodeCache* code_cache = GetCodeCache(cache_type); +/* 131 2 */ if (!code_cache) +/* 132 0 */ return; +/* 133 2 */ +/* 134 2 */ base::Optional<GURL> origin_lock = +/* 135 2 */ GetSecondaryKeyForCodeCache(url, render_process_id_); +/* 136 2 */ if (!origin_lock) +/* 137 0 */ return; +/* 138 2 */ +/* 139 2 */ code_cache->WriteEntry(url, *origin_lock, expected_response_time, +/* 140 2 */ std::move(data)); +/* 141 2 */ } +``` + +Much better! + +[markbrand@google.com]: mailto:markbrand@google.com?subject=[MojoLPM%20Help]:%20&cc=fuzzing@chromium.org +[libfuzzer]: https://source.chromium.org/chromium/chromium/src/+/master:testing/libfuzzer/getting_started.md +[Protocol Buffers]: https://developers.google.com/protocol-buffers/docs/cpptutorial +[libprotobuf-mutator]: https://source.chromium.org/chromium/chromium/src/+/master:testing/libfuzzer/libprotobuf-mutator.md +[testing in Chromium]: https://source.chromium.org/chromium/chromium/src/+/master:docs/testing/testing_in_chromium.md +[interfaces]: https://source.chromium.org/search?q=interface%5Cs%2B%5Cw%2B%5Cs%2B%7B%20f:%5C.mojom$%20-f:test +
diff --git a/mojo/public/tools/fuzzers/mojolpm.gni b/mojo/public/tools/fuzzers/mojolpm.gni index 5e27504..82f66c1e 100644 --- a/mojo/public/tools/fuzzers/mojolpm.gni +++ b/mojo/public/tools/fuzzers/mojolpm.gni
@@ -71,26 +71,15 @@ "\"testcase_proto_kind\" must be defined for $target_name since \"seed_corpus_sources\" is defined.") if (enable_ipc_fuzzer) { - proto_copy_target_name = "${target_name}_proto_copy" proto_target_name = "${target_name}_proto" - proto_file_name = get_path_info(invoker.proto_source, "file") - proto_source_path = "$root_gen_dir/${proto_file_name}" - - copy(proto_copy_target_name) { - sources = [ invoker.proto_source ] - outputs = [ proto_source_path ] - testonly = true - } - proto_library(proto_target_name) { - sources = [ proto_source_path ] + sources = [ invoker.proto_source ] generate_python = false - proto_deps = [ - ":${proto_copy_target_name}", - "//mojo/public/tools/fuzzers:mojolpm_proto_copy", - ] + proto_deps = [ "//mojo/public/tools/fuzzers:mojolpm_proto_copy" ] + + import_dirs = [ root_gen_dir ] link_deps = [] @@ -109,18 +98,20 @@ protoc_convert(protoc_convert_target_name) { sources = invoker.seed_corpus_sources - inputs = [ proto_source_path ] + inputs = [ invoker.proto_source ] output_pattern = "${seed_corpus_path}/{{source_name_part}}.binarypb" args = [ "--encode=${invoker.testcase_proto_kind}", "-I", - rebase_path("$root_gen_dir"), + rebase_path(root_gen_dir), + "-I", + get_path_info(rebase_path(inputs[0]), "dir"), rebase_path(inputs[0]), ] - deps = [ ":${proto_copy_target_name}" ] + deps = [] if (defined(invoker.proto_deps)) { deps += invoker.proto_deps
diff --git a/pdf/pdfium/pdfium_assert_matching_enums.cc b/pdf/pdfium/pdfium_assert_matching_enums.cc index 136f7c8cd..fc52f80 100644 --- a/pdf/pdfium/pdfium_assert_matching_enums.cc +++ b/pdf/pdfium/pdfium_assert_matching_enums.cc
@@ -240,6 +240,10 @@ FORMTYPE_XFA_FOREGROUND); STATIC_ASSERT_ENUM(chrome_pdf::PDFEngine::FormType::kCount, FORMTYPE_COUNT); +STATIC_ASSERT_ENUM(PP_PRIVATEBUTTON_PUSHBUTTON, FPDF_FORMFIELD_PUSHBUTTON); +STATIC_ASSERT_ENUM(PP_PRIVATEBUTTON_CHECKBOX, FPDF_FORMFIELD_CHECKBOX); +STATIC_ASSERT_ENUM(PP_PRIVATEBUTTON_RADIOBUTTON, FPDF_FORMFIELD_RADIOBUTTON); + #if defined(OS_WIN) STATIC_ASSERT_ENUM(chrome_pdf::kEmf, FPDF_PRINTMODE_EMF); STATIC_ASSERT_ENUM(chrome_pdf::kTextOnly, FPDF_PRINTMODE_TEXTONLY);
diff --git a/ppapi/c/private/ppb_pdf.h b/ppapi/c/private/ppb_pdf.h index 50446d4..26703721 100644 --- a/ppapi/c/private/ppb_pdf.h +++ b/ppapi/c/private/ppb_pdf.h
@@ -124,6 +124,9 @@ uint32_t url_length; // Index of the link in the page. This will be used to identify the link on // which action has to be performed in the page. + // |index_in_page| is populated and used in plugin process to handle + // accessiility actions from mimehandler process. It's value should be + // validated in plugin before usage. uint32_t index_in_page; // Link can either be part of the page text or not. If the link is part of the // page text, then |text_run_index| denotes the text run which contains the @@ -167,6 +170,9 @@ uint32_t note_text_length; // Index of the highlight in the page annotation list. Used to identify the // annotation on which action needs to be performed. + // |index_in_page| is populated and used in plugin process to handle + // accessiility actions from mimehandler process. It's value should be + // validated in plugin before usage. uint32_t index_in_page; // Highlights are annotations over existing page text. |text_run_index| // denotes the index of the text run where the highlight starts and @@ -202,6 +208,9 @@ bool is_password; // Index of the text field in the collection of text fields in the page. Used // to identify the annotation on which action needs to be performed. + // |index_in_page| is populated and used in plugin process to handle + // accessiility actions from mimehandler process. It's value should be + // validated in plugin before usage. uint32_t index_in_page; // We anchor the text field to a text run index, this denotes the text run // before which the text field should be inserted in the accessibility tree. @@ -252,6 +261,9 @@ bool has_editable_text_box; // Index of the choice field in the collection of choice fields in the page. // Used to identify the annotation on which action needs to be performed. + // |index_in_page| is populated and used in plugin process to handle + // accessiility actions from mimehandler process. It's value should be + // validated in plugin before usage. uint32_t index_in_page; // We anchor the choice field to a text run index, this denotes the text run // before which the choice field should be inserted in the accessibility tree. @@ -260,6 +272,56 @@ struct PP_FloatRect bounds; }; +typedef enum { + PP_PRIVATEBUTTON_PUSHBUTTON = 1, + PP_PRIVATEBUTTON_FIRST = PP_PRIVATEBUTTON_PUSHBUTTON, + PP_PRIVATEBUTTON_CHECKBOX = 2, + PP_PRIVATEBUTTON_RADIOBUTTON = 3, + PP_PRIVATEBUTTON_LAST = PP_PRIVATEBUTTON_RADIOBUTTON +} PP_PrivateButtonType; + +// This holds button form field information provided by the PDF and will be +// used in accessibility to expose it. Needs to stay in sync with C++ versions +// (PdfAccessibilityButtonInfo and PrivateAccessibilityButtonInfo). +// This struct contains index states that should be validated using +// PdfAccessibilityTree::IsDataFromPluginValid() before usage. +struct PP_PrivateAccessibilityButtonInfo { + // Represents the name property of button, if present. + const char* name; + uint32_t name_length; + // Represents the value property of button, if present. + const char* value; + uint32_t value_length; + // Represents the button type. + PP_PrivateButtonType type; + // Represents if the button is non-editable. + bool is_read_only; + // Represents if the radio button or check box is checked or not. + bool is_checked; + // Represents count of controls in the control group. A group of interactive + // form annotations is collectively called a form control group. Here, an + // interactive form annotation, should be either a radio button or a checkbox. + // Value of |control_count| is >= 1. + uint32_t control_count; + // Represents index of the control in the control group. A group of + // interactive form annotations is collectively called a form control group. + // Here, an interactive form annotation, should be either a radio button or a + // checkbox. Value of |control_index| should always be less than + // |control_count|. + uint32_t control_index; + // Index of the button in the collection of buttons in the page. Used + // to identify the annotation on which action needs to be performed. + // |index_in_page| is populated and used in plugin process to handle + // accessiility actions from mimehandler process. It's value should be + // validated in plugin before usage. + uint32_t index_in_page; + // We anchor the button to a text run index, this denotes the text run + // before which the button should be inserted in the accessibility tree. + uint32_t text_run_index; + // Bounding box of the button. + struct PP_FloatRect bounds; +}; + // This holds form fields within a PDF page. Needs to stay in sync with C++ // versions (PdfAccessibilityFormFieldInfo and // PrivateAccessibilityFormFieldInfo). @@ -268,6 +330,8 @@ uint32_t text_field_count; struct PP_PrivateAccessibilityChoiceFieldInfo* choice_fields; uint32_t choice_field_count; + struct PP_PrivateAccessibilityButtonInfo* buttons; + uint32_t button_count; }; // This holds different PDF page objects - links, images, highlights and
diff --git a/ppapi/cpp/private/pdf.cc b/ppapi/cpp/private/pdf.cc index d08230e..ddfbde65 100644 --- a/ppapi/cpp/private/pdf.cc +++ b/ppapi/cpp/private/pdf.cc
@@ -113,6 +113,23 @@ info->bounds = choice_field.bounds; } +void ConvertPrivateAccessibilityButtonInfo( + const PDF::PrivateAccessibilityButtonInfo& button, + PP_PrivateAccessibilityButtonInfo* info) { + info->name = button.name.c_str(); + info->name_length = button.name.size(); + info->value = button.value.c_str(); + info->value_length = button.value.size(); + info->type = button.type; + info->is_read_only = button.is_read_only; + info->is_checked = button.is_checked; + info->control_count = button.control_count; + info->control_index = button.control_index; + info->index_in_page = button.index_in_page; + info->text_run_index = button.text_run_index; + info->bounds = button.bounds; +} + } // namespace // static @@ -344,6 +361,12 @@ &choice_field_option_info[i]); } + const std::vector<PrivateAccessibilityButtonInfo>& buttons = + page_objects.form_fields.buttons; + std::vector<PP_PrivateAccessibilityButtonInfo> button_info(buttons.size()); + for (size_t i = 0; i < buttons.size(); ++i) + ConvertPrivateAccessibilityButtonInfo(buttons[i], &button_info[i]); + PP_PrivateAccessibilityPageObjects pp_page_objects; pp_page_objects.links = link_info.data(); pp_page_objects.link_count = link_info.size(); @@ -355,6 +378,8 @@ pp_page_objects.form_fields.text_field_count = text_field_info.size(); pp_page_objects.form_fields.choice_fields = choice_field_info.data(); pp_page_objects.form_fields.choice_field_count = choice_field_info.size(); + pp_page_objects.form_fields.buttons = button_info.data(); + pp_page_objects.form_fields.button_count = button_info.size(); get_interface<PPB_PDF>()->SetAccessibilityPageInfo( instance.pp_instance(), page_info, text_run_info.data(), chars.data(),
diff --git a/ppapi/cpp/private/pdf.h b/ppapi/cpp/private/pdf.h index a951f668..0853430 100644 --- a/ppapi/cpp/private/pdf.h +++ b/ppapi/cpp/private/pdf.h
@@ -128,11 +128,42 @@ FloatRect bounds; }; + // C++ version of PP_PrivateAccessibilityButtonInfo. + // Needs to stay in sync with the C version. + struct PrivateAccessibilityButtonInfo { + std::string name; + std::string value; + // Represents the button type. + PP_PrivateButtonType type; + // Represents if the button is non-editable. + bool is_read_only; + // Represents if the radio button or check box is checked or not. + bool is_checked; + // Represents count of controls in the control group. A group of interactive + // form annotations is collectively called a form control group. Here, an + // interactive form annotation, should be either a radio button or a + // checkbox. Value of |control_count| is >= 1. + uint32_t control_count; + // Represents index of the control in the control group. A group of + // interactive form annotations is collectively called a form control group. + // Here, an interactive form annotation, should be either a radio button or + // a checkbox. Value of |control_index| should always be less than + // |control_count|. + uint32_t control_index; + // Index of this button in the collection of buttons in the page. + uint32_t index_in_page; + // We anchor the button to a text run index, this denotes the text run + // before which the button should be inserted in the accessibility tree. + uint32_t text_run_index; + FloatRect bounds; + }; + // C++ version of PP_PrivateAccessibilityFormFieldInfo. // Needs to stay in sync with the C version. struct PrivateAccessibilityFormFieldInfo { std::vector<PrivateAccessibilityTextFieldInfo> text_fields; std::vector<PrivateAccessibilityChoiceFieldInfo> choice_fields; + std::vector<PrivateAccessibilityButtonInfo> buttons; }; // C++ version of PP_PrivateAccessibilityPageObjects.
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index e2ba615..bf83177f 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h
@@ -160,6 +160,9 @@ IPC_ENUM_TRAITS_MAX_VALUE(PP_PdfAccessibilityAnnotationType, PP_PDF_ACCESSIBILITY_ANNOTATIONTYPE_LAST) IPC_ENUM_TRAITS_MAX_VALUE(PP_PrivateChoiceFieldType, PP_PRIVATECHOICEFIELD_LAST) +IPC_ENUM_TRAITS_MIN_MAX_VALUE(PP_PrivateButtonType, + PP_PRIVATEBUTTON_FIRST, + PP_PRIVATEBUTTON_LAST) IPC_STRUCT_TRAITS_BEGIN(PP_Point) IPC_STRUCT_TRAITS_MEMBER(x) @@ -365,9 +368,23 @@ IPC_STRUCT_TRAITS_MEMBER(bounds) IPC_STRUCT_TRAITS_END() +IPC_STRUCT_TRAITS_BEGIN(ppapi::PdfAccessibilityButtonInfo) + IPC_STRUCT_TRAITS_MEMBER(name) + IPC_STRUCT_TRAITS_MEMBER(value) + IPC_STRUCT_TRAITS_MEMBER(type) + IPC_STRUCT_TRAITS_MEMBER(is_read_only) + IPC_STRUCT_TRAITS_MEMBER(is_checked) + IPC_STRUCT_TRAITS_MEMBER(control_count) + IPC_STRUCT_TRAITS_MEMBER(control_index) + IPC_STRUCT_TRAITS_MEMBER(index_in_page) + IPC_STRUCT_TRAITS_MEMBER(text_run_index) + IPC_STRUCT_TRAITS_MEMBER(bounds) +IPC_STRUCT_TRAITS_END() + IPC_STRUCT_TRAITS_BEGIN(ppapi::PdfAccessibilityFormFieldInfo) IPC_STRUCT_TRAITS_MEMBER(text_fields) IPC_STRUCT_TRAITS_MEMBER(choice_fields) + IPC_STRUCT_TRAITS_MEMBER(buttons) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(ppapi::PdfAccessibilityPageObjects)
diff --git a/ppapi/shared_impl/pdf_accessibility_shared.cc b/ppapi/shared_impl/pdf_accessibility_shared.cc index 02fad3a..9615650 100644 --- a/ppapi/shared_impl/pdf_accessibility_shared.cc +++ b/ppapi/shared_impl/pdf_accessibility_shared.cc
@@ -120,6 +120,23 @@ } } +PdfAccessibilityButtonInfo::PdfAccessibilityButtonInfo() = default; + +PdfAccessibilityButtonInfo::~PdfAccessibilityButtonInfo() = default; + +PdfAccessibilityButtonInfo::PdfAccessibilityButtonInfo( + const PP_PrivateAccessibilityButtonInfo& button) + : name(std::string(button.name, button.name_length)), + value(std::string(button.value, button.value_length)), + type(button.type), + is_read_only(button.is_read_only), + is_checked(button.is_checked), + control_count(button.control_count), + control_index(button.control_index), + index_in_page(button.index_in_page), + text_run_index(button.text_run_index), + bounds(button.bounds) {} + PdfAccessibilityFormFieldInfo::PdfAccessibilityFormFieldInfo() = default; PdfAccessibilityFormFieldInfo::PdfAccessibilityFormFieldInfo( @@ -133,6 +150,11 @@ for (size_t i = 0; i < form_fields.choice_field_count; i++) { choice_fields.emplace_back(form_fields.choice_fields[i]); } + + buttons.reserve(form_fields.button_count); + for (size_t i = 0; i < form_fields.button_count; i++) { + buttons.emplace_back(form_fields.buttons[i]); + } } PdfAccessibilityFormFieldInfo::~PdfAccessibilityFormFieldInfo() = default;
diff --git a/ppapi/shared_impl/pdf_accessibility_shared.h b/ppapi/shared_impl/pdf_accessibility_shared.h index bd7baeb..b49ab5b 100644 --- a/ppapi/shared_impl/pdf_accessibility_shared.h +++ b/ppapi/shared_impl/pdf_accessibility_shared.h
@@ -137,6 +137,25 @@ PP_FloatRect bounds; }; +// Needs to stay in sync with PP_PrivateAccessibilityButtonInfo. +struct PPAPI_SHARED_EXPORT PdfAccessibilityButtonInfo { + PdfAccessibilityButtonInfo(); + explicit PdfAccessibilityButtonInfo( + const PP_PrivateAccessibilityButtonInfo& button); + ~PdfAccessibilityButtonInfo(); + + std::string name; + std::string value; + PP_PrivateButtonType type; + bool is_read_only; + bool is_checked; + uint32_t control_count; + uint32_t control_index; + uint32_t index_in_page; + uint32_t text_run_index; + PP_FloatRect bounds; +}; + // Needs to stay in sync with PP_PrivateAccessibilityFormFieldInfo. struct PPAPI_SHARED_EXPORT PdfAccessibilityFormFieldInfo { PdfAccessibilityFormFieldInfo(); @@ -146,6 +165,7 @@ std::vector<PdfAccessibilityTextFieldInfo> text_fields; std::vector<PdfAccessibilityChoiceFieldInfo> choice_fields; + std::vector<PdfAccessibilityButtonInfo> buttons; }; // Needs to stay in sync with PP_PrivateAccessibilityPageObjects.
diff --git a/ppapi/tests/test_post_message.cc b/ppapi/tests/test_post_message.cc index 1004490..da64c84 100644 --- a/ppapi/tests/test_post_message.cc +++ b/ppapi/tests/test_post_message.cc
@@ -607,10 +607,7 @@ // properties of the file system. pp::Var file_system_var(file_system); std::vector<std::string> properties_to_check; - properties_to_check.push_back( - "message_event.data.constructor.name === 'DOMFileSystem'"); - properties_to_check.push_back( - "message_event.data.root.constructor.name === 'DirectoryEntry'"); + properties_to_check.push_back("message_event.data.root.isDirectory"); properties_to_check.push_back( "message_event.data.name.indexOf(" " ':Temporary',"
diff --git a/services/service_manager/sandbox/BUILD.gn b/services/service_manager/sandbox/BUILD.gn index 0e9bfbf..21749ad 100644 --- a/services/service_manager/sandbox/BUILD.gn +++ b/services/service_manager/sandbox/BUILD.gn
@@ -79,6 +79,8 @@ sources += [ "linux/bpf_ime_policy_linux.cc", "linux/bpf_ime_policy_linux.h", + "linux/bpf_tts_policy_linux.cc", + "linux/bpf_tts_policy_linux.h", ] } if (is_mac) {
diff --git a/services/service_manager/sandbox/linux/bpf_tts_policy_linux.cc b/services/service_manager/sandbox/linux/bpf_tts_policy_linux.cc new file mode 100644 index 0000000..812072395 --- /dev/null +++ b/services/service_manager/sandbox/linux/bpf_tts_policy_linux.cc
@@ -0,0 +1,34 @@ +// 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 "services/service_manager/sandbox/linux/bpf_tts_policy_linux.h" + +#include <sys/socket.h> + +#include "sandbox/linux/bpf_dsl/bpf_dsl.h" +#include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h" +#include "sandbox/linux/syscall_broker/broker_process.h" +#include "sandbox/linux/system_headers/linux_syscalls.h" +#include "services/service_manager/sandbox/linux/sandbox_linux.h" + +using sandbox::bpf_dsl::Allow; +using sandbox::bpf_dsl::ResultExpr; +using sandbox::bpf_dsl::Trap; +using sandbox::syscall_broker::BrokerProcess; + +namespace service_manager { + +TtsProcessPolicy::TtsProcessPolicy() {} + +TtsProcessPolicy::~TtsProcessPolicy() {} + +ResultExpr TtsProcessPolicy::EvaluateSyscall(int sysno) const { + auto* broker_process = SandboxLinux::GetInstance()->broker_process(); + if (broker_process->IsSyscallAllowed(sysno)) + return Trap(BrokerProcess::SIGSYS_Handler, broker_process); + + return BPFBasePolicy::EvaluateSyscall(sysno); +} + +} // namespace service_manager
diff --git a/services/service_manager/sandbox/linux/bpf_tts_policy_linux.h b/services/service_manager/sandbox/linux/bpf_tts_policy_linux.h new file mode 100644 index 0000000..a562a68c --- /dev/null +++ b/services/service_manager/sandbox/linux/bpf_tts_policy_linux.h
@@ -0,0 +1,27 @@ +// 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 SERVICES_SERVICE_MANAGER_SANDBOX_LINUX_BPF_TTS_POLICY_LINUX_H_ +#define SERVICES_SERVICE_MANAGER_SANDBOX_LINUX_BPF_TTS_POLICY_LINUX_H_ + +#include "sandbox/linux/bpf_dsl/bpf_dsl.h" +#include "services/service_manager/sandbox/export.h" +#include "services/service_manager/sandbox/linux/bpf_base_policy_linux.h" + +namespace service_manager { + +class SERVICE_MANAGER_SANDBOX_EXPORT TtsProcessPolicy : public BPFBasePolicy { + public: + TtsProcessPolicy(); + ~TtsProcessPolicy() override; + + sandbox::bpf_dsl::ResultExpr EvaluateSyscall(int sysno) const override; + + private: + DISALLOW_COPY_AND_ASSIGN(TtsProcessPolicy); +}; + +} // namespace service_manager + +#endif // SERVICES_SERVICE_MANAGER_SANDBOX_LINUX_BPF_TTS_POLICY_LINUX_H_
diff --git a/services/service_manager/sandbox/linux/sandbox_seccomp_bpf_linux.cc b/services/service_manager/sandbox/linux/sandbox_seccomp_bpf_linux.cc index e2f2254..1c16d68 100644 --- a/services/service_manager/sandbox/linux/sandbox_seccomp_bpf_linux.cc +++ b/services/service_manager/sandbox/linux/sandbox_seccomp_bpf_linux.cc
@@ -54,6 +54,7 @@ #if defined(OS_CHROMEOS) #include "services/service_manager/sandbox/linux/bpf_ime_policy_linux.h" +#include "services/service_manager/sandbox/linux/bpf_tts_policy_linux.h" #endif // defined(OS_CHROMEOS) using sandbox::BaselinePolicy; @@ -185,6 +186,8 @@ #if defined(OS_CHROMEOS) case SandboxType::kIme: return std::make_unique<ImeProcessPolicy>(); + case SandboxType::kTts: + return std::make_unique<TtsProcessPolicy>(); #endif // defined(OS_CHROMEOS) case SandboxType::kZygoteIntermediateSandbox: case SandboxType::kNoSandbox: @@ -228,6 +231,7 @@ } break; #if defined(OS_CHROMEOS) case SandboxType::kIme: + case SandboxType::kTts: #endif // defined(OS_CHROMEOS) case SandboxType::kAudio: case SandboxType::kSharingService:
diff --git a/services/service_manager/sandbox/sandbox_type.cc b/services/service_manager/sandbox/sandbox_type.cc index 9ea1ccc..d8a3575 100644 --- a/services/service_manager/sandbox/sandbox_type.cc +++ b/services/service_manager/sandbox/sandbox_type.cc
@@ -57,6 +57,7 @@ #endif #if defined(OS_CHROMEOS) case SandboxType::kIme: + case SandboxType::kTts: #endif #if !defined(OS_MACOSX) case SandboxType::kSharingService: @@ -119,6 +120,7 @@ #endif // defined(OS_WIN) #if defined(OS_CHROMEOS) case SandboxType::kIme: + case SandboxType::kTts: #endif // defined(OS_CHROMEOS) #if !defined(OS_MACOSX) case SandboxType::kSharingService: @@ -241,6 +243,8 @@ #if defined(OS_CHROMEOS) case SandboxType::kIme: return switches::kImeSandbox; + case SandboxType::kTts: + return switches::kTtsSandbox; #endif // defined(OS_CHROMEOS) // The following are not utility processes so should not occur. case SandboxType::kRenderer: @@ -297,6 +301,8 @@ #if defined(OS_CHROMEOS) if (sandbox_string == switches::kImeSandbox) return SandboxType::kIme; + if (sandbox_string == switches::kTtsSandbox) + return SandboxType::kTts; #endif // defined(OS_CHROMEOS) return SandboxType::kUtility; }
diff --git a/services/service_manager/sandbox/sandbox_type.h b/services/service_manager/sandbox/sandbox_type.h index 0eb1e61..47d4fca 100644 --- a/services/service_manager/sandbox/sandbox_type.h +++ b/services/service_manager/sandbox/sandbox_type.h
@@ -69,6 +69,8 @@ #if defined(OS_CHROMEOS) kIme, + // Text-to-speech. + kTts, #endif // defined(OS_CHROMEOS) #if defined(OS_LINUX)
diff --git a/services/service_manager/sandbox/switches.cc b/services/service_manager/sandbox/switches.cc index 13467cf..7cbc8a7 100644 --- a/services/service_manager/sandbox/switches.cc +++ b/services/service_manager/sandbox/switches.cc
@@ -40,6 +40,7 @@ #if defined(OS_CHROMEOS) const char kImeSandbox[] = "ime"; +const char kTtsSandbox[] = "tts"; #endif // OS_CHROMEOS // Flags owned by the service manager sandbox.
diff --git a/services/service_manager/sandbox/switches.h b/services/service_manager/sandbox/switches.h index 0deedde..55608c3 100644 --- a/services/service_manager/sandbox/switches.h +++ b/services/service_manager/sandbox/switches.h
@@ -39,6 +39,7 @@ #if defined(OS_CHROMEOS) SERVICE_MANAGER_SANDBOX_EXPORT extern const char kImeSandbox[]; +SERVICE_MANAGER_SANDBOX_EXPORT extern const char kTtsSandbox[]; #endif // OS_CHROMEOS // Flags owned by the service manager sandbox.
diff --git a/testing/buildbot/filters/android.pie_arm64_rel.chrome_public_test_apk.filter b/testing/buildbot/filters/android.pie_arm64_rel.chrome_public_test_apk.filter index 23a92f27..e8b7a11 100644 --- a/testing/buildbot/filters/android.pie_arm64_rel.chrome_public_test_apk.filter +++ b/testing/buildbot/filters/android.pie_arm64_rel.chrome_public_test_apk.filter
@@ -1,6 +1,3 @@ -# crbug/1033877 --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantDirectActionHandlerTest.testReportAvailableDirectActions - # crbug/1036413 -org.chromium.chrome.browser.banners.AppBannerManagerTest.testBlockedAmbientBadgeDoesNotAppearAgainForMonths
diff --git a/testing/libfuzzer/README.md b/testing/libfuzzer/README.md index 29dc829..dc9f6cff 100644 --- a/testing/libfuzzer/README.md +++ b/testing/libfuzzer/README.md
@@ -36,6 +36,7 @@ *** * [Reproducing bugs] found by libFuzzer/AFL and reported by ClusterFuzz. +* [Fuzzing mojo interfaces] using automatically generated libprotobuf-mutator fuzzers. ## Further Reading
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 18ccea9..67cff2b6 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -5096,6 +5096,29 @@ ] } ], + "RenderDocument": [ + { + "platforms": [ + "android", + "android_webview", + "chromeos", + "linux", + "mac", + "windows" + ], + "experiments": [ + { + "name": "EnableForCrashedFrame", + "params": { + "level": "crashed-frame" + }, + "enable_features": [ + "RenderDocument" + ] + } + ] + } + ], "ReopenTabInProductHelp": [ { "platforms": [
diff --git a/third_party/blink/common/origin_trials/trial_token.cc b/third_party/blink/common/origin_trials/trial_token.cc index 0ebecd23..7204a38 100644 --- a/third_party/blink/common/origin_trials/trial_token.cc +++ b/third_party/blink/common/origin_trials/trial_token.cc
@@ -56,6 +56,8 @@ // enabled in the stable M50 release which would have used those tokens. const uint8_t kVersion2 = 2; +const char* kUsageSubset = "subset"; + } // namespace TrialToken::~TrialToken() = default; @@ -216,6 +218,7 @@ // Initialize optional version 3 fields to default values. bool is_third_party = false; + UsageRestriction usage = UsageRestriction::kNone; if (version == kVersion3) { // The |isThirdParty| flag is optional. If found, ensure it is a valid @@ -227,10 +230,27 @@ } is_third_party = is_third_party_value->GetBool(); } + + // The |usage| field is optional and can only be set if |isThirdParty| flag + // is true. If found, ensure its value is either empty or "subset". + std::string* usage_value = datadict->FindStringKey("usage"); + if (usage_value) { + if (!is_third_party) { + return nullptr; + } + if (usage_value->empty()) { + usage = UsageRestriction::kNone; + } else if (*usage_value == kUsageSubset) { + usage = UsageRestriction::kSubset; + } else { + return nullptr; + } + } } return base::WrapUnique(new TrialToken(origin, is_subdomain, *feature_name, - expiry_timestamp, is_third_party)); + expiry_timestamp, is_third_party, + usage)); } bool TrialToken::ValidateOrigin(const url::Origin& origin) const { @@ -272,11 +292,13 @@ bool match_subdomains, const std::string& feature_name, uint64_t expiry_timestamp, - bool is_third_party) + bool is_third_party, + UsageRestriction usage_restriction) : origin_(origin), match_subdomains_(match_subdomains), feature_name_(feature_name), expiry_time_(base::Time::FromDoubleT(expiry_timestamp)), - is_third_party_(is_third_party) {} + is_third_party_(is_third_party), + usage_restriction_(usage_restriction) {} } // namespace blink
diff --git a/third_party/blink/common/origin_trials/trial_token_unittest.cc b/third_party/blink/common/origin_trials/trial_token_unittest.cc index f38a744..7f7e4a1 100644 --- a/third_party/blink/common/origin_trials/trial_token_unittest.cc +++ b/third_party/blink/common/origin_trials/trial_token_unittest.cc
@@ -158,6 +158,44 @@ 0xb6, 0x0f, 0x83, 0x97, 0xca, 0x51, 0x76, 0xa5, 0x06, 0xd7, 0xd0, 0x61, 0x5a, 0x78, 0xb3, 0x9f, 0x94, 0xdb, 0x28, 0x03}; +// This is a good third party trial token with usage restriction set to subset, +// signed with the above test private key. Generate this token with the +// command: +// generate_token.py valid.example.com Frobulate --version 3 --is-third-party +// --expire-timestamp=1458766277 --usage-restriction subset +const char kSampleThirdPartyUsageSubsetToken[] = + "A27Ee1Bm6HYjEu2Zz1DbGNUaPuM8x0Tnk15Gyx8TRKZg72+JUXgCccMxlLIjVh4l" + "enOES58tfJxrRCorBAKmBwcAAACCeyJvcmlnaW4iOiAiaHR0cHM6Ly92YWxpZC5l" + "eGFtcGxlLmNvbTo0NDMiLCAiaXNUaGlyZFBhcnR5IjogdHJ1ZSwgInVzYWdlIjog" + "InN1YnNldCIsICJmZWF0dXJlIjogIkZyb2J1bGF0ZSIsICJleHBpcnkiOiAxNDU4" + "NzY2Mjc3fQ=="; +const uint8_t kSampleThirdPartyUsageSubsetTokenSignature[] = { + 0x6e, 0xc4, 0x7b, 0x50, 0x66, 0xe8, 0x76, 0x23, 0x12, 0xed, 0x99, + 0xcf, 0x50, 0xdb, 0x18, 0xd5, 0x1a, 0x3e, 0xe3, 0x3c, 0xc7, 0x44, + 0xe7, 0x93, 0x5e, 0x46, 0xcb, 0x1f, 0x13, 0x44, 0xa6, 0x60, 0xef, + 0x6f, 0x89, 0x51, 0x78, 0x02, 0x71, 0xc3, 0x31, 0x94, 0xb2, 0x23, + 0x56, 0x1e, 0x25, 0x7a, 0x73, 0x84, 0x4b, 0x9f, 0x2d, 0x7c, 0x9c, + 0x6b, 0x44, 0x2a, 0x2b, 0x04, 0x02, 0xa6, 0x07, 0x07}; + +// This is a good third party trial token with usage restriction set to none, +// signed with the above test private key. Generate this token with the +// command: +// generate_token.py valid.example.com Frobulate --version 3 --is-third-party +// --expire-timestamp=1458766277 --usage-restriction "" +const char kSampleThirdPartyUsageEmptyToken[] = + "A+gXf6yZgfN8NADWvnEhQ/GKycwCg34USmDlQ9UXTP6jDGJLBV+jI1npSUI0W/YW" + "hNyNYbzBaE2iCJSGCD56pwwAAAB8eyJvcmlnaW4iOiAiaHR0cHM6Ly92YWxpZC5l" + "eGFtcGxlLmNvbTo0NDMiLCAiaXNUaGlyZFBhcnR5IjogdHJ1ZSwgInVzYWdlIjog" + "IiIsICJmZWF0dXJlIjogIkZyb2J1bGF0ZSIsICJleHBpcnkiOiAxNDU4NzY2Mjc3" + "fQ=="; +const uint8_t kSampleThirdPartyUsageEmptyTokenSignature[] = { + 0xe8, 0x17, 0x7f, 0xac, 0x99, 0x81, 0xf3, 0x7c, 0x34, 0x00, 0xd6, + 0xbe, 0x71, 0x21, 0x43, 0xf1, 0x8a, 0xc9, 0xcc, 0x02, 0x83, 0x7e, + 0x14, 0x4a, 0x60, 0xe5, 0x43, 0xd5, 0x17, 0x4c, 0xfe, 0xa3, 0x0c, + 0x62, 0x4b, 0x05, 0x5f, 0xa3, 0x23, 0x59, 0xe9, 0x49, 0x42, 0x34, + 0x5b, 0xf6, 0x16, 0x84, 0xdc, 0x8d, 0x61, 0xbc, 0xc1, 0x68, 0x4d, + 0xa2, 0x08, 0x94, 0x86, 0x08, 0x3e, 0x7a, 0xa7, 0x0c}; + const char kExpectedFeatureName[] = "Frobulate"; // This is an excessively long feature name (100 characters). This is valid, as // there is no explicit limit on feature name length. Excessive refers to the @@ -233,6 +271,15 @@ "{\"origin\": \"https://valid.example.com:443\", \"isThirdParty\": true, " "\"feature\": \"Frobulate\", \"expiry\": 1458766277}"; +const char kSampleThirdPartyTokenUsageSubsetJSON[] = + "{\"origin\": \"https://valid.example.com:443\", \"isThirdParty\": true, " + "\"usage\": \"subset\", \"feature\": \"Frobulate\", \"expiry\": " + "1458766277}"; + +const char kSampleThirdPartyTokenUsageEmptyJSON[] = + "{\"origin\": \"https://valid.example.com:443\", \"isThirdParty\": true, " + "\"usage\": \"\", \"feature\": \"Frobulate\", \"expiry\": 1458766277}"; + // Various ill-formed trial tokens. These should all fail to parse. const char* kInvalidTokens[] = { // Empty String @@ -276,6 +323,14 @@ "\"a\", \"expiry\": 1458766277}", "{\"origin\": \"https://a.a\", \"isThirdParty\": 1, \"feature\": \"a\", " "\"expiry\": 1458766277}", + // Invalid value in usage field + "{\"origin\": \"https://a.a\", \"isThirdParty\": true, \"usage\": " + "\"cycle\", \"feature\": \"a\", " + "\"expiry\": 1458766277}", + // usage in non third party token + "{\"origin\": \"https://a.a\", \"isThirdParty\": false, \"usage\": " + "\"subset\", \"feature\": \"a\", " + "\"expiry\": 1458766277}", }; // Valid token JSON. The feature name matches matches kExpectedLongFeatureName @@ -652,6 +707,14 @@ expected_non_third_party_signature_(std::string( reinterpret_cast<const char*>(kSampleNonThirdPartyTokenSignature), base::size(kSampleNonThirdPartyTokenSignature))), + expected_third_party_usage_empty_signature_( + std::string(reinterpret_cast<const char*>( + kSampleThirdPartyUsageEmptyTokenSignature), + base::size(kSampleThirdPartyUsageEmptyTokenSignature))), + expected_third_party_usage_subset_signature_(std::string( + reinterpret_cast<const char*>( + kSampleThirdPartyUsageSubsetTokenSignature), + base::size(kSampleThirdPartyUsageSubsetTokenSignature))), correct_public_key_( base::StringPiece(reinterpret_cast<const char*>(kTestPublicKey), base::size(kTestPublicKey))), @@ -717,6 +780,8 @@ std::string expected_nonsubdomain_signature_; std::string expected_third_party_signature_; std::string expected_non_third_party_signature_; + std::string expected_third_party_usage_empty_signature_; + std::string expected_third_party_usage_subset_signature_; private: base::StringPiece correct_public_key_; @@ -805,6 +870,32 @@ EXPECT_EQ(expected_non_third_party_signature_, token_signature); } +TEST_F(TrialTokenTest, ExtractThirdPartyUsageEmptyValidSignature) { + std::string token_payload; + std::string token_signature; + uint8_t token_version; + OriginTrialTokenStatus status = + Extract(kSampleThirdPartyUsageEmptyToken, correct_public_key(), + &token_payload, &token_signature, &token_version); + ASSERT_EQ(OriginTrialTokenStatus::kSuccess, status); + EXPECT_EQ(kVersion3, token_version); + EXPECT_STREQ(kSampleThirdPartyTokenUsageEmptyJSON, token_payload.c_str()); + EXPECT_EQ(expected_third_party_usage_empty_signature_, token_signature); +} + +TEST_F(TrialTokenTest, ExtractThirdPartyUsageSubsetValidSignature) { + std::string token_payload; + std::string token_signature; + uint8_t token_version; + OriginTrialTokenStatus status = + Extract(kSampleThirdPartyUsageSubsetToken, correct_public_key(), + &token_payload, &token_signature, &token_version); + ASSERT_EQ(OriginTrialTokenStatus::kSuccess, status); + EXPECT_EQ(kVersion3, token_version); + EXPECT_STREQ(kSampleThirdPartyTokenUsageSubsetJSON, token_payload.c_str()); + EXPECT_EQ(expected_third_party_usage_subset_signature_, token_signature); +} + TEST_F(TrialTokenTest, ExtractInvalidSignature) { OriginTrialTokenStatus status = ExtractStatusOnly(kInvalidSignatureToken, correct_public_key()); @@ -1044,6 +1135,28 @@ EXPECT_EQ(expected_expiry_, token->expiry_time()); } +TEST_F(TrialTokenTest, ParseValidThirdPartyUsageSubsetToken) { + std::unique_ptr<TrialToken> token = + Parse(kSampleThirdPartyTokenUsageSubsetJSON, kVersion3); + ASSERT_TRUE(token); + EXPECT_EQ(kExpectedFeatureName, token->feature_name()); + EXPECT_TRUE(token->is_third_party()); + EXPECT_EQ(TrialToken::UsageRestriction::kSubset, token->usage_restriction()); + EXPECT_EQ(expected_origin_, token->origin()); + EXPECT_EQ(expected_expiry_, token->expiry_time()); +} + +TEST_F(TrialTokenTest, ParseValidThirdPartyUsageEmptyToken) { + std::unique_ptr<TrialToken> token = + Parse(kSampleThirdPartyTokenUsageEmptyJSON, kVersion3); + ASSERT_TRUE(token); + EXPECT_EQ(kExpectedFeatureName, token->feature_name()); + EXPECT_TRUE(token->is_third_party()); + EXPECT_EQ(TrialToken::UsageRestriction::kNone, token->usage_restriction()); + EXPECT_EQ(expected_origin_, token->origin()); + EXPECT_EQ(expected_expiry_, token->expiry_time()); +} + // Test overall extraction and parsing, to ensure output status matches returned // token, and signature is provided. // Test Version 2.
diff --git a/third_party/blink/public/common/origin_trials/trial_token.h b/third_party/blink/public/common/origin_trials/trial_token.h index eccae42..45f03137 100644 --- a/third_party/blink/public/common/origin_trials/trial_token.h +++ b/third_party/blink/public/common/origin_trials/trial_token.h
@@ -49,6 +49,8 @@ public: ~TrialToken(); + enum class UsageRestriction { kNone, kSubset }; + // If the string represents a signed well-formed token, a token object is // returned, and success is returned in the |out_status| parameter. Otherwise, // the |out_status| parameter indicates what was wrong with the string, and @@ -73,6 +75,7 @@ base::Time expiry_time() { return expiry_time_; } std::string signature() { return signature_; } bool is_third_party() const { return is_third_party_; } + UsageRestriction usage_restriction() { return usage_restriction_; } protected: // Tests can access the Parse method directly to validate it, and so are @@ -112,7 +115,8 @@ bool match_subdomains, const std::string& feature_name, uint64_t expiry_timestamp, - bool is_third_party); + bool is_third_party, + UsageRestriction usage_restriction); // The origin for which this token is valid. Must be a secure origin. url::Origin origin_; @@ -134,6 +138,12 @@ // https://docs.google.com/document/d/1xALH9W7rWmX0FpjudhDeS2TNTEOXuPn4Tlc9VmuPdHA // for more details. bool is_third_party_; + + // Indicates the alternative usage restriction mode imposed on the token. + // See design doc + // https://docs.google.com/document/d/1xALH9W7rWmX0FpjudhDeS2TNTEOXuPn4Tlc9VmuPdHA + // for more details. + UsageRestriction usage_restriction_; }; } // namespace blink
diff --git a/third_party/blink/public/mojom/web_feature/web_feature.mojom b/third_party/blink/public/mojom/web_feature/web_feature.mojom index 6c3ec32..d2eb725e 100644 --- a/third_party/blink/public/mojom/web_feature/web_feature.mojom +++ b/third_party/blink/public/mojom/web_feature/web_feature.mojom
@@ -2647,6 +2647,7 @@ kStorageAccessAPI_HasStorageAccess_Method = 3310, kStorageAccessAPI_requestStorageAccess_Method = 3311, kWebBluetoothWatchAdvertisements = 3312, + kRubyTextWithNonDefaultTextAlign = 3313, // Add new features immediately above this line. Don't change assigned // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/blink/public/web/web_performance.h b/third_party/blink/public/web/web_performance.h index 69075567..3bab802 100644 --- a/third_party/blink/public/web/web_performance.h +++ b/third_party/blink/public/web/web_performance.h
@@ -34,6 +34,7 @@ #include "base/time/time.h" #include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_private_ptr.h" +#include "third_party/blink/public/platform/web_vector.h" #include "third_party/blink/public/web/web_navigation_type.h" #if INSIDE_BLINK @@ -46,6 +47,14 @@ class WebPerformance { public: + struct BackForwardCacheRestoreTiming { + double navigation_start = 0; + double first_paint = 0; + }; + + using BackForwardCacheRestoreTimings = + WebVector<BackForwardCacheRestoreTiming>; + ~WebPerformance() { Reset(); } WebPerformance() = default; @@ -68,7 +77,7 @@ BLINK_EXPORT double InputForNavigationStart() const; BLINK_EXPORT double NavigationStart() const; BLINK_EXPORT base::TimeTicks NavigationStartAsMonotonicTime() const; - BLINK_EXPORT double LastBackForwardCacheRestoreNavigationStart() const; + BLINK_EXPORT BackForwardCacheRestoreTimings BackForwardCacheRestore() const; BLINK_EXPORT double UnloadEventEnd() const; BLINK_EXPORT double RedirectStart() const; BLINK_EXPORT double RedirectEnd() const; @@ -89,7 +98,6 @@ BLINK_EXPORT double LoadEventStart() const; BLINK_EXPORT double LoadEventEnd() const; BLINK_EXPORT double FirstPaint() const; - BLINK_EXPORT double FirstPaintAfterBackForwardCacheRestore() const; BLINK_EXPORT double FirstImagePaint() const; BLINK_EXPORT double FirstContentfulPaint() const; BLINK_EXPORT base::TimeTicks FirstContentfulPaintAsMonotonicTime() const;
diff --git a/third_party/blink/renderer/bindings/core/v8/script_controller.cc b/third_party/blink/renderer/bindings/core/v8/script_controller.cc index 0db9515..c97494b 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_controller.cc +++ b/third_party/blink/renderer/bindings/core/v8/script_controller.cc
@@ -347,7 +347,7 @@ const ScriptFetchOptions& fetch_options, ExecuteScriptPolicy policy) { if (policy == kDoNotExecuteScriptWhenScriptsDisabled && - !GetFrame()->GetDocument()->CanExecuteScripts(kAboutToExecuteScript)) + !GetFrame()->DomWindow()->CanExecuteScripts(kAboutToExecuteScript)) return v8::Local<v8::Value>(); // |context| should be initialized already due to the MainWorldProxy() call.
diff --git a/third_party/blink/renderer/bindings/core/v8/script_event_listener.cc b/third_party/blink/renderer/bindings/core/v8/script_event_listener.cc index c41765c..eda95fd 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_event_listener.cc +++ b/third_party/blink/renderer/bindings/core/v8/script_event_listener.cc
@@ -35,6 +35,7 @@ #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/qualified_name.h" +#include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "v8/include/v8.h" @@ -47,7 +48,7 @@ const AtomicString& value, JSEventHandler::HandlerType type) { DCHECK(node); - if (value.IsNull() || !node->GetDocument().GetExecutionContext()) + if (value.IsNull() || !node->GetExecutionContext()) return nullptr; // FIXME: Very strange: we initialize zero-based number with '1'. @@ -55,11 +56,9 @@ OrdinalNumber::First()); String source_url; - v8::Isolate* isolate = node->GetDocument().GetIsolate(); - if (LocalFrame* frame = node->GetDocument().GetFrame()) { ScriptController& script_controller = frame->GetScriptController(); - if (!node->GetDocument().CanExecuteScripts(kAboutToExecuteScript)) + if (!node->GetExecutionContext()->CanExecuteScripts(kAboutToExecuteScript)) return nullptr; position = script_controller.EventHandlerPosition(); source_url = node->GetDocument().Url().GetString(); @@ -72,6 +71,7 @@ // of the isolated world for the content script by design. DOMWrapperWorld& world = DOMWrapperWorld::MainWorld(); + v8::Isolate* isolate = node->GetExecutionContext()->GetIsolate(); return MakeGarbageCollected<JSEventHandlerForContentAttribute>( isolate, world, name.LocalName(), value, source_url, position, type); } @@ -86,7 +86,7 @@ if (value.IsNull()) return nullptr; - if (!frame->GetDocument()->CanExecuteScripts(kAboutToExecuteScript)) + if (!frame->DomWindow()->CanExecuteScripts(kAboutToExecuteScript)) return nullptr; TextPosition position = frame->GetScriptController().EventHandlerPosition();
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 e5ca782..0025284 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
@@ -1045,7 +1045,7 @@ // Make a 10x7 red ImageBitmap in P3 color space. SkImageInfo info = SkImageInfo::Make(10, 7, kRGBA_F16_SkColorType, kPremul_SkAlphaType, - SkColorSpace::MakeRGB(SkNamedTransferFn::kLinear, + SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, SkNamedGamut::kDisplayP3)); sk_sp<SkSurface> surface = SkSurface::MakeRaster(info); surface->getCanvas()->clear(SK_ColorRED); @@ -1068,7 +1068,7 @@ EXPECT_EQ(CanvasPixelFormat::kF16, color_params.PixelFormat()); // Check that the pixel at (3, 3) is red. We expect red in P3 to be - // {0x94, 0x3A, 0x3F, 0x28, 0x5F, 0x24, 0x00, 0x3C} when each color + // {0x57, 0x3B, 0x68, 0x32, 0x6E, 0x30, 0x00, 0x3C} when each color // component is presented as a half float in Skia. However, difference in // GPU hardware may result in small differences in lower significant byte in // Skia color conversion pipeline. Hence, we use a tolerance of 2 here. @@ -1077,7 +1077,7 @@ ->PaintImageForCurrentFrame() .GetSkImage() ->readPixels(info.makeWH(1, 1), &pixel, 8, 3, 3)); - uint8_t p3_red[8] = {0x94, 0x3A, 0x3F, 0x28, 0x5F, 0x24, 0x00, 0x3C}; + uint8_t p3_red[8] = {0x57, 0x3B, 0x68, 0x32, 0x6E, 0x30, 0x00, 0x3C}; bool approximate_match = true; uint8_t tolerance = 2; for (int i = 0; i < 8; i++) { @@ -1152,7 +1152,7 @@ uint8_t pixel[8] = {}; SkImageInfo info = SkImageInfo::Make(1, 1, kRGBA_F16_SkColorType, kPremul_SkAlphaType, - SkColorSpace::MakeRGB(SkNamedTransferFn::kLinear, + SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, SkNamedGamut::kDisplayP3)); ASSERT_TRUE(new_image_bitmap->BitmapImage() ->PaintImageForCurrentFrame()
diff --git a/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_accumulator.py b/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_accumulator.py index f72e41a..2c822edf 100644 --- a/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_accumulator.py +++ b/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_accumulator.py
@@ -25,11 +25,8 @@ def include_headers(self): return self._include_headers - def add_include_header(self, header): - self._include_headers.add(header) - def add_include_headers(self, headers): - self._include_headers.update(headers) + self._include_headers.update(filter(None, headers)) @staticmethod def require_include_headers(headers): @@ -39,11 +36,8 @@ def class_decls(self): return self._class_decls - def add_class_decl(self, class_name): - self._class_decls.add(class_name) - def add_class_decls(self, class_names): - self._class_decls.update(class_names) + self._class_decls.update(filter(None, class_names)) @staticmethod def require_class_decls(class_names): @@ -53,11 +47,8 @@ def struct_decls(self): return self._struct_decls - def add_struct_decl(self, struct_name): - self._struct_decls.add(struct_name) - def add_struct_decls(self, struct_names): - self._struct_decls.update(struct_names) + self._struct_decls.update(filter(None, struct_names)) @staticmethod def require_struct_decls(struct_names):
diff --git a/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py b/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py index 7021f1a..158d9001 100644 --- a/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py +++ b/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py
@@ -59,15 +59,21 @@ return LiteralNode(HeaderIncludeDirectives(accumulator)) -def component_export(component): +def component_export(component, for_testing): assert isinstance(component, web_idl.Component) + assert isinstance(for_testing, bool) + if for_testing: + return "" return name_style.macro(component, "EXPORT") -def component_export_header(component): +def component_export_header(component, for_testing): assert isinstance(component, web_idl.Component) + assert isinstance(for_testing, bool) + if for_testing: + return None if component == "core": return "third_party/blink/renderer/core/core_export.h" elif component == "modules":
diff --git a/third_party/blink/renderer/bindings/scripts/bind_gen/dictionary.py b/third_party/blink/renderer/bindings/scripts/bind_gen/dictionary.py index ec7dba17..18aea35 100644 --- a/third_party/blink/renderer/bindings/scripts/bind_gen/dictionary.py +++ b/third_party/blink/renderer/bindings/scripts/bind_gen/dictionary.py
@@ -120,6 +120,7 @@ assert isinstance(cg_context, CodeGenContext) dictionary = cg_context.dictionary + for_testing = dictionary.code_generator_info.for_testing header_includes = set() source_includes = set() @@ -132,7 +133,7 @@ "third_party/blink/renderer/platform/bindings/dictionary_base.h") header_includes.update([ - component_export_header(dictionary.components[0]), + component_export_header(dictionary.components[0], for_testing), "third_party/blink/renderer/bindings/core/v8/generated_code_helper.h", "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h", "v8/include/v8.h", @@ -856,9 +857,12 @@ def generate_dictionary(dictionary): + assert isinstance(dictionary, web_idl.Dictionary) + assert len(dictionary.components) == 1, ( "We don't support partial dictionaries across components yet.") component = dictionary.components[0] + for_testing = dictionary.code_generator_info.for_testing path_manager = PathManager(dictionary) class_name = name_style.class_(blink_class_name(dictionary)) @@ -889,10 +893,10 @@ source_blink_ns = CxxNamespaceNode(name_style.namespace("blink")) # Class definitions - class_def = CxxClassDefNode( - cg_context.class_name, - base_class_names=[cg_context.base_class_name], - export=component_export(component)) + class_def = CxxClassDefNode(cg_context.class_name, + base_class_names=[cg_context.base_class_name], + export=component_export( + component, for_testing)) class_def.set_base_template_vars(cg_context.template_bindings()) class_def.top_section.append( TextNode("using BaseClass = ${base_class_name};"))
diff --git a/third_party/blink/renderer/bindings/scripts/bind_gen/enumeration.py b/third_party/blink/renderer/bindings/scripts/bind_gen/enumeration.py index 0403eda3..4e03be8e 100644 --- a/third_party/blink/renderer/bindings/scripts/bind_gen/enumeration.py +++ b/third_party/blink/renderer/bindings/scripts/bind_gen/enumeration.py
@@ -237,9 +237,12 @@ def generate_enumeration(enumeration): + assert isinstance(enumeration, web_idl.Enumeration) + path_manager = PathManager(enumeration) assert path_manager.api_component == path_manager.impl_component api_component = path_manager.api_component + for_testing = enumeration.code_generator_info.for_testing # Class names class_name = blink_class_name(enumeration) @@ -266,11 +269,11 @@ source_blink_ns = CxxNamespaceNode(name_style.namespace("blink")) # Class definition - class_def = CxxClassDefNode( - cg_context.class_name, - base_class_names=["bindings::EnumerationBase"], - final=True, - export=component_export(api_component)) + class_def = CxxClassDefNode(cg_context.class_name, + base_class_names=["bindings::EnumerationBase"], + final=True, + export=component_export( + api_component, for_testing)) class_def.set_base_template_vars(cg_context.template_bindings()) # Implementation parts @@ -311,7 +314,7 @@ EmptyNode(), ]) header_node.accumulator.add_include_headers([ - component_export_header(api_component), + component_export_header(api_component, for_testing), "third_party/blink/renderer/bindings/core/v8/generated_code_helper.h", "third_party/blink/renderer/platform/bindings/enumeration_base.h", ])
diff --git a/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py b/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py index 29bc30d..3c8c3e85 100644 --- a/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py +++ b/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py
@@ -5868,6 +5868,16 @@ wrapper_type_info_def.append( F(pattern, FN_INSTALL_CONTEXT_DEPENDENT_PROPS)) pattern = """\ +// Construction of WrapperTypeInfo may require non-trivial initialization due +// to cross-component address resolution in order to load the pointer to the +// parent interface's WrapperTypeInfo. We ignore this issue because the issue +// happens only on component builds and the official release builds +// (statically-linked builds) are never affected by this issue. +#if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wglobal-constructors" +#endif + const WrapperTypeInfo ${class_name}::wrapper_type_info_{{ gin::kEmbedderBlink, ${class_name}::DomTemplate, @@ -5878,6 +5888,10 @@ {wrapper_class_id}, {active_script_wrappable_inheritance}, }}; + +#if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__) +#pragma clang diagnostic pop +#endif """ class_like = cg_context.class_like if has_context_dependent_props: @@ -6016,6 +6030,7 @@ api_component = path_manager.api_component impl_component = path_manager.impl_component is_cross_components = path_manager.is_cross_components + for_testing = interface.code_generator_info.for_testing # Class names api_class_name = v8_bridge_class_name(interface) @@ -6069,15 +6084,15 @@ blink_class_name(interface)), ], final=True, - export=component_export(api_component)) + export=component_export(api_component, for_testing)) api_class_def.set_base_template_vars(cg_context.template_bindings()) api_class_def.bottom_section.append( TextNode("friend class {};".format(blink_class_name(interface)))) if is_cross_components: - impl_class_def = CxxClassDefNode( - impl_class_name, - final=True, - export=component_export(impl_component)) + impl_class_def = CxxClassDefNode(impl_class_name, + final=True, + export=component_export( + impl_component, for_testing)) impl_class_def.set_base_template_vars(cg_context.template_bindings()) api_class_def.public_section.extend([ TextNode("// Cross-component implementation class"), @@ -6394,19 +6409,19 @@ ]) api_header_node.accumulator.add_include_headers([ interface.code_generator_info.blink_headers[0], - component_export_header(api_component), + component_export_header(api_component, for_testing), "third_party/blink/renderer/platform/bindings/v8_interface_bridge.h", ]) api_source_node.accumulator.add_include_headers([ "third_party/blink/renderer/bindings/core/v8/v8_dom_configuration.h", ]) if interface.inherited: - api_source_node.accumulator.add_include_header( - PathManager(interface.inherited).api_path(ext="h")) + api_source_node.accumulator.add_include_headers( + [PathManager(interface.inherited).api_path(ext="h")]) if is_cross_components: impl_header_node.accumulator.add_include_headers([ api_header_path, - component_export_header(impl_component), + component_export_header(impl_component, for_testing), ]) impl_source_node.accumulator.add_include_headers([ "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h", @@ -6570,7 +6585,7 @@ return_type="void") # Assemble the parts. - header_node.accumulator.add_class_decl("ScriptState") + header_node.accumulator.add_class_decls(["ScriptState"]) header_node.accumulator.add_include_headers([ "third_party/blink/renderer/platform/runtime_enabled_features.h", ]) @@ -6685,8 +6700,8 @@ for interface in set_of_interfaces: path_manager = PathManager(interface) - source_node.accumulator.add_include_header( - path_manager.api_path(ext="h")) + source_node.accumulator.add_include_headers( + [path_manager.api_path(ext="h")]) # The helper function globals = filter(lambda x: "Global" in x.extended_attributes, @@ -6703,8 +6718,7 @@ # simplify this implementation. helper_func_def.body.extend([ ListNode([ - TextNode("static constexpr const WrapperTypeInfo* " - "globals_body[] = {"), + TextNode("static const WrapperTypeInfo* globals_body[] = {"), ListNode(entries), TextNode("};"), ]), @@ -6826,8 +6840,8 @@ path_manager = PathManager(interface) if path_manager.is_cross_components: - source_node.accumulator.add_include_header( - path_manager.impl_path(ext="h")) + source_node.accumulator.add_include_headers( + [path_manager.impl_path(ext="h")]) class_name = v8_bridge_class_name(interface) init_calls.append(_format("{}::Impl::Init();", class_name))
diff --git a/third_party/blink/renderer/core/css/resolver/style_adjuster.cc b/third_party/blink/renderer/core/css/resolver/style_adjuster.cc index 264ff12..cfdcfed 100644 --- a/third_party/blink/renderer/core/css/resolver/style_adjuster.cc +++ b/third_party/blink/renderer/core/css/resolver/style_adjuster.cc
@@ -526,10 +526,10 @@ bool is_svg_root) { TouchAction inherited_action = parent_style.GetEffectiveTouchAction(); - bool is_replaced_canvas = - element && IsA<HTMLCanvasElement>(element) && - element->GetDocument().GetFrame() && - element->GetDocument().CanExecuteScripts(kNotAboutToExecuteScript); + bool is_replaced_canvas = element && IsA<HTMLCanvasElement>(element) && + element->GetExecutionContext() && + element->GetExecutionContext()->CanExecuteScripts( + kNotAboutToExecuteScript); bool is_non_replaced_inline_elements = style.IsDisplayInlineType() && !(style.IsDisplayReplacedType() || is_svg_root ||
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index d336892..08804b3 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc
@@ -978,9 +978,9 @@ } ContentSecurityPolicy* Document::GetContentSecurityPolicyForWorld() { - v8::Isolate* isolate = GetIsolate(); - if (!isolate) + if (!GetExecutionContext()) return GetContentSecurityPolicy(); + v8::Isolate* isolate = GetExecutionContext()->GetIsolate(); v8::HandleScope handle_scope(isolate); v8::Local<v8::Context> v8_context = isolate->GetCurrentContext(); @@ -1089,10 +1089,6 @@ GetExecutionContext()->SetReferrerPolicy(policy); } -v8::Isolate* Document::GetIsolate() const { - return GetExecutionContext() ? GetExecutionContext()->GetIsolate() : nullptr; -} - Agent* Document::GetAgent() const { return GetSecurityContext().GetAgent(); } @@ -7268,45 +7264,6 @@ GetContentSecurityPolicyDelegate()); } -bool Document::CanExecuteScripts(ReasonForCallingCanExecuteScripts reason) { - DCHECK(GetFrame()) - << "you are querying canExecuteScripts on a non-attached Document."; - - // Normally, scripts are not allowed in sandboxed contexts that disallow them. - // However, there is an exception for cases when the script should bypass the - // main world's CSP (such as for privileged isolated worlds). See - // https://crbug.com/811528. - if (IsSandboxed(network::mojom::blink::WebSandboxFlags::kScripts) && - !ContentSecurityPolicy::ShouldBypassMainWorld(domWindow())) { - // FIXME: This message should be moved off the console once a solution to - // https://bugs.webkit.org/show_bug.cgi?id=103274 exists. - if (reason == kAboutToExecuteScript) { - AddConsoleMessage(MakeGarbageCollected<ConsoleMessage>( - mojom::ConsoleMessageSource::kSecurity, - mojom::ConsoleMessageLevel::kError, - "Blocked script execution in '" + Url().ElidedString() + - "' because the document's frame is sandboxed and the " - "'allow-scripts' permission is not set.")); - } - return false; - } - - // No scripting on a detached frame. - if (!GetFrame()->Client()) - return false; - - WebContentSettingsClient* settings_client = - GetFrame()->GetContentSettingsClient(); - - Settings* settings = GetFrame()->GetSettings(); - bool script_enabled = settings && settings->GetScriptEnabled(); - if (settings_client) - script_enabled = settings_client->AllowScript(script_enabled); - if (!script_enabled && reason == kAboutToExecuteScript && settings_client) - settings_client->DidNotAllowScript(); - return script_enabled; -} - bool Document::AllowInlineEventHandler(Node* node, EventListener* listener, const String& context_url,
diff --git a/third_party/blink/renderer/core/dom/document.h b/third_party/blink/renderer/core/dom/document.h index f4e4c86..f38add6 100644 --- a/third_party/blink/renderer/core/dom/document.h +++ b/third_party/blink/renderer/core/dom/document.h
@@ -322,7 +322,6 @@ // should move to LocalDOMWindow. ContentSecurityPolicy* GetContentSecurityPolicyForWorld(); LocalDOMWindow* ExecutingWindow() const; - bool CanExecuteScripts(ReasonForCallingCanExecuteScripts); String OutgoingReferrer() const; network::mojom::ReferrerPolicy GetReferrerPolicy() const; @@ -357,7 +356,6 @@ bool IsSecureContext(String& error_message) const; void SetSecureContextModeForTesting(SecureContextMode); void SetReferrerPolicy(network::mojom::ReferrerPolicy); - v8::Isolate* GetIsolate() const; Agent* GetAgent() const; OriginTrialContext* GetOriginTrialContext() const;
diff --git a/third_party/blink/renderer/core/dom/document_test.cc b/third_party/blink/renderer/core/dom/document_test.cc index 6b5024f..ff5742f 100644 --- a/third_party/blink/renderer/core/dom/document_test.cc +++ b/third_party/blink/renderer/core/dom/document_test.cc
@@ -58,6 +58,7 @@ #include "third_party/blink/renderer/core/dom/text.h" #include "third_party/blink/renderer/core/execution_context/agent.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" +#include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame_view.h" #include "third_party/blink/renderer/core/frame/settings.h" #include "third_party/blink/renderer/core/frame/viewport_data.h" @@ -1094,19 +1095,19 @@ // Since the page is sandboxed, main world script execution shouldn't be // allowed. ScriptState::Scope scope(main_world_script_state); - EXPECT_FALSE(GetDocument().CanExecuteScripts(kAboutToExecuteScript)); + EXPECT_FALSE(frame->DomWindow()->CanExecuteScripts(kAboutToExecuteScript)); } { // Isolated worlds without a dedicated CSP should also not be allowed to // run scripts. ScriptState::Scope scope(isolated_world_without_csp_script_state); - EXPECT_FALSE(GetDocument().CanExecuteScripts(kAboutToExecuteScript)); + EXPECT_FALSE(frame->DomWindow()->CanExecuteScripts(kAboutToExecuteScript)); } { // An isolated world with a CSP should bypass the main world CSP, and be // able to run scripts. ScriptState::Scope scope(isolated_world_with_csp_script_state); - EXPECT_TRUE(GetDocument().CanExecuteScripts(kAboutToExecuteScript)); + EXPECT_TRUE(frame->DomWindow()->CanExecuteScripts(kAboutToExecuteScript)); } }
diff --git a/third_party/blink/renderer/core/editing/selection_modifier_line.cc b/third_party/blink/renderer/core/editing/selection_modifier_line.cc index 786f9af..c1f25a2 100644 --- a/third_party/blink/renderer/core/editing/selection_modifier_line.cc +++ b/third_party/blink/renderer/core/editing/selection_modifier_line.cc
@@ -200,11 +200,8 @@ if (only_editable_leaves && !IsEditable(cursor)) continue; - const LogicalRect fragment_logical_rect = - cursor.Current().RectInContainerBlock().ConvertToLogical( - line.Current().Style().GetWritingMode(), - line.Current().BaseDirection(), line.Current().Size(), - cursor.Current().Size()); + const LogicalRect fragment_logical_rect = line.Current().ConvertToLogical( + cursor.Current().RectInContainerBlock()); const LayoutUnit inline_min = fragment_logical_rect.offset.inline_offset; const LayoutUnit inline_max = fragment_logical_rect.offset.inline_offset + fragment_logical_rect.size.inline_size;
diff --git a/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc b/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc index 7993c70..26fa824 100644 --- a/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc +++ b/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc
@@ -383,17 +383,17 @@ if (text.parentElement()) parent_name = &(text.parentElement())->TagQName(); - if (parent_name && - (*parent_name == html_names::kScriptTag || - *parent_name == html_names::kStyleTag || - *parent_name == html_names::kXmpTag || - *parent_name == html_names::kIFrameTag || - *parent_name == html_names::kPlaintextTag || - *parent_name == html_names::kNoembedTag || - *parent_name == html_names::kNoframesTag || - (*parent_name == html_names::kNoscriptTag && - text.GetDocument().GetFrame() && - text.GetDocument().CanExecuteScripts(kNotAboutToExecuteScript)))) + if (parent_name && (*parent_name == html_names::kScriptTag || + *parent_name == html_names::kStyleTag || + *parent_name == html_names::kXmpTag || + *parent_name == html_names::kIFrameTag || + *parent_name == html_names::kPlaintextTag || + *parent_name == html_names::kNoembedTag || + *parent_name == html_names::kNoframesTag || + (*parent_name == html_names::kNoscriptTag && + text.GetExecutionContext() && + text.GetExecutionContext()->CanExecuteScripts( + kNotAboutToExecuteScript)))) return kEntityMaskInCDATA; return kEntityMaskInHTMLPCDATA; }
diff --git a/third_party/blink/renderer/core/editing/visible_units_line.cc b/third_party/blink/renderer/core/editing/visible_units_line.cc index 766bba9..832d8a2 100644 --- a/third_party/blink/renderer/core/editing/visible_units_line.cc +++ b/third_party/blink/renderer/core/editing/visible_units_line.cc
@@ -70,9 +70,7 @@ NGInlineCursor line_box = caret_position.cursor; line_box.MoveToContainingLine(); DCHECK(line_box.Current().IsLineBox()) << line_box; - const PhysicalOffset start_point = line_box.Current().LineStartPoint(); - return FromPositionInDOMTree<Strategy>( - line_box.PositionForPointInInlineBox(start_point)); + return FromPositionInDOMTree<Strategy>(line_box.PositionForStartOfLine()); } const InlineBox* inline_box = @@ -252,9 +250,7 @@ } NGInlineCursor line_box = caret_position.cursor; line_box.MoveToContainingLine(); - const PhysicalOffset end_point = line_box.Current().LineEndPoint(); - return FromPositionInDOMTree<Strategy>( - line_box.PositionForPointInInlineBox(end_point)); + return FromPositionInDOMTree<Strategy>(line_box.PositionForEndOfLine()); } const InlineBox* inline_box =
diff --git a/third_party/blink/renderer/core/exported/web_performance.cc b/third_party/blink/renderer/core/exported/web_performance.cc index 20d1859..5dad962 100644 --- a/third_party/blink/renderer/core/exported/web_performance.cc +++ b/third_party/blink/renderer/core/exported/web_performance.cc
@@ -69,9 +69,19 @@ return private_->timing()->NavigationStartAsMonotonicTime(); } -double WebPerformance::LastBackForwardCacheRestoreNavigationStart() const { - return MillisecondsToSeconds( - private_->timing()->LastBackForwardCacheRestoreNavigationStart()); +WebPerformance::BackForwardCacheRestoreTimings +WebPerformance::BackForwardCacheRestore() const { + PerformanceTiming::BackForwardCacheRestoreTimings restore_timings = + private_->timing()->BackForwardCacheRestore(); + + WebVector<BackForwardCacheRestoreTiming> timings(restore_timings.size()); + for (size_t i = 0; i < restore_timings.size(); i++) { + timings[i].navigation_start = + MillisecondsToSeconds(restore_timings[i].navigation_start); + timings[i].first_paint = + MillisecondsToSeconds(restore_timings[i].first_paint); + } + return timings; } double WebPerformance::InputForNavigationStart() const { @@ -159,11 +169,6 @@ return MillisecondsToSeconds(private_->timing()->FirstPaint()); } -double WebPerformance::FirstPaintAfterBackForwardCacheRestore() const { - return MillisecondsToSeconds( - private_->timing()->FirstPaintAfterBackForwardCacheRestore()); -} - double WebPerformance::FirstImagePaint() const { return MillisecondsToSeconds(private_->timing()->FirstImagePaint()); }
diff --git a/third_party/blink/renderer/core/exported/web_plugin_container_impl.cc b/third_party/blink/renderer/core/exported/web_plugin_container_impl.cc index de256a41..172a02a4 100644 --- a/third_party/blink/renderer/core/exported/web_plugin_container_impl.cc +++ b/third_party/blink/renderer/core/exported/web_plugin_container_impl.cc
@@ -490,14 +490,12 @@ } v8::Local<v8::Object> WebPluginContainerImpl::V8ObjectForElement() { - LocalFrame* frame = element_->GetDocument().GetFrame(); - if (!frame) + ExecutionContext* context = element_->GetExecutionContext(); + if (!context || !context->CanExecuteScripts(kNotAboutToExecuteScript)) return v8::Local<v8::Object>(); - if (!element_->GetDocument().CanExecuteScripts(kNotAboutToExecuteScript)) - return v8::Local<v8::Object>(); - - ScriptState* script_state = ToScriptStateForMainWorld(frame); + ScriptState* script_state = + ToScriptState(context, DOMWrapperWorld::MainWorld()); if (!script_state) return v8::Local<v8::Object>();
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc index 78b796c..a1cfb38 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -2436,7 +2436,7 @@ PaintTiming::From(*document).OnRestoredFromBackForwardCache(); DocumentLoader* loader = local_frame->Loader().GetDocumentLoader(); if (loader) { - loader->GetTiming().MarkLastBackForwardCacheRestoreNavigationStart( + loader->GetTiming().MarkBackForwardCacheRestoreNavigationStart( navigation_start); } }
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc index b6bb27b0..f413390 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
@@ -351,7 +351,36 @@ bool LocalDOMWindow::CanExecuteScripts( ReasonForCallingCanExecuteScripts reason) { - return document()->CanExecuteScripts(reason); + DCHECK(GetFrame()) + << "you are querying canExecuteScripts on a non-attached Window."; + + // Normally, scripts are not allowed in sandboxed contexts that disallow them. + // However, there is an exception for cases when the script should bypass the + // main world's CSP (such as for privileged isolated worlds). See + // https://crbug.com/811528. + if (IsSandboxed(network::mojom::blink::WebSandboxFlags::kScripts) && + !ContentSecurityPolicy::ShouldBypassMainWorld(this)) { + // FIXME: This message should be moved off the console once a solution to + // https://bugs.webkit.org/show_bug.cgi?id=103274 exists. + if (reason == kAboutToExecuteScript) { + AddConsoleMessage(MakeGarbageCollected<ConsoleMessage>( + mojom::blink::ConsoleMessageSource::kSecurity, + mojom::blink::ConsoleMessageLevel::kError, + "Blocked script execution in '" + Url().ElidedString() + + "' because the document's frame is sandboxed and the " + "'allow-scripts' permission is not set.")); + } + return false; + } + + WebContentSettingsClient* settings_client = + GetFrame()->GetContentSettingsClient(); + bool script_enabled = GetFrame()->GetSettings()->GetScriptEnabled(); + if (settings_client) + script_enabled = settings_client->AllowScript(script_enabled); + if (!script_enabled && reason == kAboutToExecuteScript && settings_client) + settings_client->DidNotAllowScript(); + return script_enabled; } void LocalDOMWindow::ExceptionThrown(ErrorEvent* event) {
diff --git a/third_party/blink/renderer/core/frame/mhtml_loading_test.cc b/third_party/blink/renderer/core/frame/mhtml_loading_test.cc index 2c22e85..5476dc5 100644 --- a/third_party/blink/renderer/core/frame/mhtml_loading_test.cc +++ b/third_party/blink/renderer/core/frame/mhtml_loading_test.cc
@@ -116,8 +116,8 @@ ASSERT_TRUE(GetPage()); LocalFrame* frame = To<LocalFrame>(GetPage()->MainFrame()); ASSERT_TRUE(frame); - Document* document = frame->GetDocument(); - ASSERT_TRUE(document); + LocalDOMWindow* window = frame->DomWindow(); + ASSERT_TRUE(window); // Full sandboxing with the exception to new top-level windows should be // turned on. @@ -125,36 +125,36 @@ ~(network::mojom::blink::WebSandboxFlags::kPopups | network::mojom::blink::WebSandboxFlags:: kPropagatesToAuxiliaryBrowsingContexts), - document->GetSandboxFlags()); + window->GetSandboxFlags()); // MHTML document should be loaded into unique origin. - EXPECT_TRUE(document->GetSecurityOrigin()->IsOpaque()); + EXPECT_TRUE(window->GetSecurityOrigin()->IsOpaque()); // Script execution should be disabled. - EXPECT_FALSE(document->CanExecuteScripts(kNotAboutToExecuteScript)); + EXPECT_FALSE(window->CanExecuteScripts(kNotAboutToExecuteScript)); // The element to be created by the script is not there. - EXPECT_FALSE(document->getElementById("mySpan")); + EXPECT_FALSE(window->document()->getElementById("mySpan")); // Make sure the subframe is also sandboxed. LocalFrame* child_frame = To<LocalFrame>(GetPage()->MainFrame()->Tree().FirstChild()); ASSERT_TRUE(child_frame); - Document* child_document = child_frame->GetDocument(); - ASSERT_TRUE(child_document); + LocalDOMWindow* child_window = child_frame->DomWindow(); + ASSERT_TRUE(child_window); EXPECT_EQ(network::mojom::blink::WebSandboxFlags::kAll & ~(network::mojom::blink::WebSandboxFlags::kPopups | network::mojom::blink::WebSandboxFlags:: kPropagatesToAuxiliaryBrowsingContexts), - child_document->GetSandboxFlags()); + child_window->GetSandboxFlags()); // MHTML document should be loaded into unique origin. - EXPECT_TRUE(child_document->GetSecurityOrigin()->IsOpaque()); + EXPECT_TRUE(child_window->GetSecurityOrigin()->IsOpaque()); // Script execution should be disabled. - EXPECT_FALSE(child_document->CanExecuteScripts(kNotAboutToExecuteScript)); + EXPECT_FALSE(child_window->CanExecuteScripts(kNotAboutToExecuteScript)); // The element to be created by the script is not there. - EXPECT_FALSE(child_document->getElementById("mySpan")); + EXPECT_FALSE(child_window->document()->getElementById("mySpan")); } TEST_F(MHTMLLoadingTest, EnforceSandboxFlagsInXSLT) { @@ -164,8 +164,8 @@ ASSERT_TRUE(GetPage()); LocalFrame* frame = To<LocalFrame>(GetPage()->MainFrame()); ASSERT_TRUE(frame); - Document* document = frame->GetDocument(); - ASSERT_TRUE(document); + LocalDOMWindow* window = frame->DomWindow(); + ASSERT_TRUE(window); // Full sandboxing with the exception to new top-level windows should be // turned on. @@ -173,12 +173,12 @@ ~(network::mojom::blink::WebSandboxFlags::kPopups | network::mojom::blink::WebSandboxFlags:: kPropagatesToAuxiliaryBrowsingContexts), - document->GetSandboxFlags()); + window->GetSandboxFlags()); // MHTML document should be loaded into unique origin. - EXPECT_TRUE(document->GetSecurityOrigin()->IsOpaque()); + EXPECT_TRUE(window->GetSecurityOrigin()->IsOpaque()); // Script execution should be disabled. - EXPECT_FALSE(document->CanExecuteScripts(kNotAboutToExecuteScript)); + EXPECT_FALSE(window->CanExecuteScripts(kNotAboutToExecuteScript)); } TEST_F(MHTMLLoadingTest, ShadowDom) {
diff --git a/third_party/blink/renderer/core/html/canvas/canvas_rendering_context.cc b/third_party/blink/renderer/core/html/canvas/canvas_rendering_context.cc index 55f89813..50af5f3 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_rendering_context.cc +++ b/third_party/blink/renderer/core/html/canvas/canvas_rendering_context.cc
@@ -43,18 +43,13 @@ CanvasColorParams::GetNativeCanvasPixelFormat(), kNonOpaque), creation_attributes_(attrs) { - // Supported color spaces and pixel formats: sRGB in uint8, e-sRGB in f16, - // linear sRGB and p3 and rec2020 with linear gamma transfer function in f16. - // For wide gamut color spaces, user must explicitly request half float - // storage. Otherwise, we fall back to sRGB in uint8. Invalid requests fall - // back to sRGB in uint8 too. - if (creation_attributes_.pixel_format == kF16CanvasPixelFormatName) { + if (creation_attributes_.pixel_format == kF16CanvasPixelFormatName) color_params_.SetCanvasPixelFormat(CanvasPixelFormat::kF16); - if (creation_attributes_.color_space == kRec2020CanvasColorSpaceName) - color_params_.SetCanvasColorSpace(CanvasColorSpace::kRec2020); - else if (creation_attributes_.color_space == kP3CanvasColorSpaceName) - color_params_.SetCanvasColorSpace(CanvasColorSpace::kP3); - } + + if (creation_attributes_.color_space == kRec2020CanvasColorSpaceName) + color_params_.SetCanvasColorSpace(CanvasColorSpace::kRec2020); + else if (creation_attributes_.color_space == kP3CanvasColorSpaceName) + color_params_.SetCanvasColorSpace(CanvasColorSpace::kP3); if (!creation_attributes_.alpha) color_params_.SetOpacityMode(kOpaque);
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 23d0daa2..eec0ce2c 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
@@ -178,8 +178,8 @@ LayoutObject* HTMLCanvasElement::CreateLayoutObject(const ComputedStyle& style, LegacyLayout legacy) { - LocalFrame* frame = GetDocument().GetFrame(); - if (frame && GetDocument().CanExecuteScripts(kNotAboutToExecuteScript)) { + if (GetExecutionContext() && + GetExecutionContext()->CanExecuteScripts(kNotAboutToExecuteScript)) { // Allocation of a layout object indicates that the canvas doesn't // have display:none set, so is conceptually being displayed. if (context_) {
diff --git a/third_party/blink/renderer/core/html/html_frame_element_base.cc b/third_party/blink/renderer/core/html/html_frame_element_base.cc index ac51562..c872dc0f 100644 --- a/third_party/blink/renderer/core/html/html_frame_element_base.cc +++ b/third_party/blink/renderer/core/html/html_frame_element_base.cc
@@ -67,7 +67,7 @@ // frame. NB: This check can be invoked without any JS on the stack for some // parser operations. In such case, we use the origin of the frame element's // containing document as the caller context. - v8::Isolate* isolate = GetDocument().GetIsolate(); + v8::Isolate* isolate = GetExecutionContext()->GetIsolate(); LocalDOMWindow* accessing_window = isolate->InContext() ? CurrentDOMWindow(isolate) : GetDocument().domWindow();
diff --git a/third_party/blink/renderer/core/html/html_no_script_element.cc b/third_party/blink/renderer/core/html/html_no_script_element.cc index 64ecf0c..e2d87dc 100644 --- a/third_party/blink/renderer/core/html/html_no_script_element.cc +++ b/third_party/blink/renderer/core/html/html_no_script_element.cc
@@ -42,7 +42,7 @@ bool HTMLNoScriptElement::LayoutObjectIsNeeded( const ComputedStyle& style) const { - if (GetDocument().CanExecuteScripts(kNotAboutToExecuteScript)) + if (GetExecutionContext()->CanExecuteScripts(kNotAboutToExecuteScript)) return false; return Element::LayoutObjectIsNeeded(style); }
diff --git a/third_party/blink/renderer/core/html/media/html_media_element.cc b/third_party/blink/renderer/core/html/media/html_media_element.cc index 401c698..80ae139 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.cc +++ b/third_party/blink/renderer/core/html/media/html_media_element.cc
@@ -2643,8 +2643,8 @@ return true; } - LocalFrame* frame = GetDocument().GetFrame(); - if (frame && !GetDocument().CanExecuteScripts(kNotAboutToExecuteScript)) { + ExecutionContext* context = GetExecutionContext(); + if (context && !context->CanExecuteScripts(kNotAboutToExecuteScript)) { if (record_metrics == RecordMetricsBehavior::kDoRecord) RecordShowControlsUsage(this, MediaControlsShow::kNoScript); return true;
diff --git a/third_party/blink/renderer/core/html/media/html_media_element_event_listeners_test.cc b/third_party/blink/renderer/core/html/media/html_media_element_event_listeners_test.cc index faeb17ce..fdc3a070 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element_event_listeners_test.cc +++ b/third_party/blink/renderer/core/html/media/html_media_element_event_listeners_test.cc
@@ -37,8 +37,8 @@ // exception of the mocked methods). class FakeWebMediaPlayer final : public EmptyWebMediaPlayer { public: - FakeWebMediaPlayer(WebMediaPlayerClient* client, Document* document) - : client_(client), document_(document) {} + FakeWebMediaPlayer(WebMediaPlayerClient* client, ExecutionContext* context) + : client_(client), context_(context) {} MOCK_METHOD1(SetIsEffectivelyFullscreen, void(blink::WebFullscreenVideoStatus)); @@ -86,7 +86,7 @@ return; } - document_->GetTaskRunner(TaskType::kInternalMediaRealTime) + context_->GetTaskRunner(TaskType::kInternalMediaRealTime) ->PostDelayedTask(FROM_HERE, base::BindOnce(&FakeWebMediaPlayer::AutoTimeIncrement, base::Unretained(this)), @@ -104,11 +104,11 @@ ScheduleTimeIncrement(); // Run V8 Microtasks (update OfficialPlaybackPosition) - Microtask::PerformCheckpoint(document_->GetIsolate()); + Microtask::PerformCheckpoint(context_->GetIsolate()); } WebMediaPlayerClient* client_; - WeakPersistent<Document> document_; + WeakPersistent<ExecutionContext> context_; mutable double current_time_ = 0; bool playing_ = false; bool auto_increment_current_time_ = false; @@ -122,7 +122,8 @@ HTMLMediaElement& element, const WebMediaPlayerSource&, WebMediaPlayerClient* client) override { - return std::make_unique<FakeWebMediaPlayer>(client, &element.GetDocument()); + return std::make_unique<FakeWebMediaPlayer>(client, + element.GetExecutionContext()); } };
diff --git a/third_party/blink/renderer/core/html/parser/html_parser_options.cc b/third_party/blink/renderer/core/html/parser/html_parser_options.cc index a5c4119..d18a002 100644 --- a/third_party/blink/renderer/core/html/parser/html_parser_options.cc +++ b/third_party/blink/renderer/core/html/parser/html_parser_options.cc
@@ -26,18 +26,20 @@ #include "third_party/blink/renderer/core/html/parser/html_parser_options.h" #include "third_party/blink/renderer/core/dom/document.h" +#include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/settings.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" namespace blink { HTMLParserOptions::HTMLParserOptions(Document* document) { - if (!document || !document->GetFrame()) + if (!document || !document->domWindow()) return; - scripting_flag = (document->GetSettings()->GetParserScriptingFlagPolicy() == - ParserScriptingFlagPolicy::kEnabled) || - document->CanExecuteScripts(kNotAboutToExecuteScript); + scripting_flag = + (document->GetSettings()->GetParserScriptingFlagPolicy() == + ParserScriptingFlagPolicy::kEnabled) || + document->domWindow()->CanExecuteScripts(kNotAboutToExecuteScript); priority_hints_origin_trial_enabled = RuntimeEnabledFeatures::PriorityHintsEnabled(document); }
diff --git a/third_party/blink/renderer/core/inspector/inspector_style_sheet.cc b/third_party/blink/renderer/core/inspector/inspector_style_sheet.cc index 8f3ba7d..342e219 100644 --- a/third_party/blink/renderer/core/inspector/inspector_style_sheet.cc +++ b/third_party/blink/renderer/core/inspector/inspector_style_sheet.cc
@@ -998,8 +998,8 @@ bool InspectorStyleSheet::SetText(const String& text, ExceptionState& exception_state) { - InnerSetText(text, true); page_style_sheet_->SetText(text, CSSImportRules::kAllow); + InnerSetText(text, true); OnStyleSheetTextChanged(); return true; } @@ -1114,8 +1114,10 @@ style = style_rule->style(); else style = To<CSSKeyframeRule>(rule)->style(); - style->setCSSText(page_style_sheet_->OwnerDocument()->GetExecutionContext(), - text, exception_state); + + ExecutionContext* execution_context = + page_style_sheet_->OwnerDocument()->GetExecutionContext(); + style->setCSSText(execution_context, text, exception_state); ReplaceText(source_data->rule_body_range, text, new_range, old_text); OnStyleSheetTextChanged(); @@ -1400,8 +1402,7 @@ InnerSetText(sheet_text, true); } -void InspectorStyleSheet::InnerSetText(const String& text, - bool mark_as_locally_modified) { +void InspectorStyleSheet::ParseText(const String& text) { CSSRuleSourceDataList* rule_tree = MakeGarbageCollected<CSSRuleSourceDataList>(); auto* style_sheet = MakeGarbageCollected<StyleSheetContents>( @@ -1430,6 +1431,34 @@ source_data_ = MakeGarbageCollected<CSSRuleSourceDataList>(); FlattenSourceData(*rule_tree, source_data_.Get()); +} + +String InspectorStyleSheet::MergeCSSOMRulesWithText(const String& text) { + SourceRange last_range; + String merged_text = text; + for (unsigned i = 0; i < page_style_sheet_->length(); i++) { + CSSRuleSourceData* source_data = + SourceDataForRule(page_style_sheet_->item(i)); + if (source_data) { + last_range = SourceRange(source_data->rule_body_range.start, + source_data->rule_body_range.end + 1); + continue; + } + SourceRange next(last_range.end, last_range.end); + String rule_text = CanonicalCSSText(page_style_sheet_->item(i)); + merged_text.replace(next.start, next.length(), rule_text); + last_range = SourceRange(next.start, next.start + rule_text.length()); + } + rule_to_source_data_.clear(); + source_data_to_rule_.clear(); + cssom_flat_rules_.clear(); + return merged_text; +} + +void InspectorStyleSheet::InnerSetText(const String& text, + bool mark_as_locally_modified) { + ParseText(text); + text_ = text; if (mark_as_locally_modified) { @@ -1879,7 +1908,8 @@ return false; KURL url(page_style_sheet_->href()); - if (resource_container_->LoadStyleSheetContent(url, result)) + if (page_style_sheet_->href() && + resource_container_->LoadStyleSheetContent(url, result)) return true; bool base64_encoded; @@ -1903,8 +1933,7 @@ String InspectorStyleSheet::CollectStyleSheetRules() { StringBuilder builder; for (unsigned i = 0; i < page_style_sheet_->length(); i++) { - String css_text = page_style_sheet_->item(i)->cssText(); - builder.Append(css_text); + builder.Append(CanonicalCSSText(page_style_sheet_->item(i))); builder.Append('\n'); } return builder.ToString(); @@ -1918,15 +1947,26 @@ return true; } -bool InspectorStyleSheet::InlineStyleSheetText(String* result) { +bool InspectorStyleSheet::InlineStyleSheetText(String* out) { Element* owner_element = OwnerStyleElement(); + bool result = false; if (!owner_element) - return false; - if (resource_container_->LoadStyleElementContent( - DOMNodeIds::IdForNode(owner_element), result)) - return true; - *result = owner_element->textContent(); - return true; + return result; + + result = resource_container_->LoadStyleElementContent( + DOMNodeIds::IdForNode(owner_element), out); + + if (!result) { + *out = owner_element->textContent(); + result = true; + } + + if (result && page_style_sheet_->Contents()->IsMutable()) { + ParseText(*out); + *out = MergeCSSOMRulesWithText(*out); + } + + return result; } bool InspectorStyleSheet::InspectorStyleSheetText(String* result) {
diff --git a/third_party/blink/renderer/core/inspector/inspector_style_sheet.h b/third_party/blink/renderer/core/inspector/inspector_style_sheet.h index 0578e637..cc7f9b1 100644 --- a/third_party/blink/renderer/core/inspector/inspector_style_sheet.h +++ b/third_party/blink/renderer/core/inspector/inspector_style_sheet.h
@@ -226,6 +226,8 @@ SourceRange* new_range, String* old_text); void InnerSetText(const String& new_text, bool mark_as_locally_modified); + void ParseText(const String& text); + String MergeCSSOMRulesWithText(const String& text); Element* OwnerStyleElement(); Member<InspectorResourceContainer> resource_container_;
diff --git a/third_party/blink/renderer/core/inspector/main_thread_debugger.cc b/third_party/blink/renderer/core/inspector/main_thread_debugger.cc index a7d3ab1..bfe3491 100644 --- a/third_party/blink/renderer/core/inspector/main_thread_debugger.cc +++ b/third_party/blink/renderer/core/inspector/main_thread_debugger.cc
@@ -310,7 +310,7 @@ bool MainThreadDebugger::canExecuteScripts(int context_group_id) { LocalFrame* frame = WeakIdentifierMap<LocalFrame>::Lookup(context_group_id); - return frame->GetDocument()->CanExecuteScripts(kNotAboutToExecuteScript); + return frame->DomWindow()->CanExecuteScripts(kNotAboutToExecuteScript); } void MainThreadDebugger::runIfWaitingForDebugger(int context_group_id) {
diff --git a/third_party/blink/renderer/core/layout/layout_block_flow_line.cc b/third_party/blink/renderer/core/layout/layout_block_flow_line.cc index 1cb284a..3a102d8 100644 --- a/third_party/blink/renderer/core/layout/layout_block_flow_line.cc +++ b/third_party/blink/renderer/core/layout/layout_block_flow_line.cc
@@ -2468,9 +2468,41 @@ LayoutUnit end_padding = HasOverflowClip() ? PaddingEnd() : LayoutUnit(); // FIXME: Need to find another way to do this, since scrollbars could show // when we don't want them to. + // The test[1] verifies this. + // [1] editing/input/editable-container-with-word-wrap-normal.html if (HasOverflowClip() && !end_padding && GetNode() && - IsRootEditableElement(*GetNode()) && StyleRef().IsLeftToRightDirection()) + IsRootEditableElement(*GetNode()) && + StyleRef().IsLeftToRightDirection()) { + if (const NGPhysicalBoxFragment* fragment = CurrentFragment()) { + if (const NGFragmentItems* items = fragment->Items()) { + for (NGInlineCursor cursor(*items); cursor; + cursor.MoveToNextSkippingChildren()) { + if (!cursor.Current().IsLineBox()) + continue; + const NGFragmentItem& child = *cursor.CurrentItem(); + LogicalRect logical_rect = fragment->ConvertToLogical( + child.RectInContainerBlock(), child.Size()); + logical_rect.size.inline_size += 1; + AddLayoutOverflow( + fragment->ConvertToPhysical(logical_rect).ToLayoutRect()); + } + return; + } + // Note: Paint fragment for this block isn't set yet. + for (const NGLink& child : fragment->Children()) { + if (!child->IsLineBox()) + continue; + LogicalRect logical_rect = fragment->ConvertToLogical( + PhysicalRect(child.Offset(), child->Size()), child->Size()); + logical_rect.size.inline_size += 1; + AddLayoutOverflow( + fragment->ConvertToPhysical(logical_rect).ToLayoutRect()); + } + return; + } end_padding = LayoutUnit(1); + } + for (RootInlineBox* curr = FirstRootBox(); curr; curr = curr->NextRootBox()) AddLayoutOverflow(curr->PaddedLayoutOverflowRect(end_padding)); }
diff --git a/third_party/blink/renderer/core/layout/layout_ruby_text.cc b/third_party/blink/renderer/core/layout/layout_ruby_text.cc index f325057..e7b4fdf6 100644 --- a/third_party/blink/renderer/core/layout/layout_ruby_text.cc +++ b/third_party/blink/renderer/core/layout/layout_ruby_text.cc
@@ -42,4 +42,13 @@ return child->IsInline(); } +void LayoutRubyText::StyleDidChange(StyleDifference diff, + const ComputedStyle* old_style) { + if (StyleRef().GetTextAlign() != ETextAlign::kInternalSpaceAround) { + UseCounter::Count(GetDocument(), + WebFeature::kRubyTextWithNonDefaultTextAlign); + } + LayoutBlockFlow::StyleDidChange(diff, old_style); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/layout_ruby_text.h b/third_party/blink/renderer/core/layout/layout_ruby_text.h index 6173119..9d0f69a 100644 --- a/third_party/blink/renderer/core/layout/layout_ruby_text.h +++ b/third_party/blink/renderer/core/layout/layout_ruby_text.h
@@ -48,6 +48,9 @@ bool IsChildAllowed(LayoutObject*, const ComputedStyle&) const override; + void StyleDidChange(StyleDifference diff, + const ComputedStyle* old_style) override; + bool CreatesNewFormattingContext() const final { // Ruby text objects are pushed around after layout, to become flush with // the associated ruby base. As such, we cannot let floats leak out from
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_caret_rect.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_caret_rect.cc index bccd83f..81c4784 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_caret_rect.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_caret_rect.cc
@@ -52,6 +52,27 @@ return PhysicalRect(caret_location, caret_size); } +bool ShouldAlignCaretRight(ETextAlign text_align, TextDirection direction) { + switch (text_align) { + case ETextAlign::kRight: + case ETextAlign::kWebkitRight: + return true; + case ETextAlign::kLeft: + case ETextAlign::kWebkitLeft: + case ETextAlign::kCenter: + case ETextAlign::kWebkitCenter: + return false; + case ETextAlign::kJustify: + case ETextAlign::kInternalSpaceAround: + case ETextAlign::kStart: + return IsRtl(direction); + case ETextAlign::kEnd: + return IsLtr(direction); + } + NOTREACHED(); + return false; +} + PhysicalRect ComputeLocalCaretRectAtTextOffset(const NGInlineCursor& cursor, unsigned offset) { DCHECK(cursor.Current().IsText()); @@ -62,7 +83,8 @@ cursor.Current().GetLayoutObject()->GetDocument().View(); LayoutUnit caret_width = frame_view->CaretWidth(); - const bool is_horizontal = cursor.Current().Style().IsHorizontalWritingMode(); + const ComputedStyle& style = cursor.Current().Style(); + const bool is_horizontal = style.IsHorizontalWritingMode(); LayoutUnit caret_height = is_horizontal ? cursor.Current().Size().height : cursor.Current().Size().width; @@ -90,15 +112,33 @@ line_box.Current().OffsetInContainerBlock(); const PhysicalRect line_box_rect(line_box_offset, line_box.Current().Size()); + const NGInlineBreakToken& break_token = + *line_box.Current().InlineBreakToken(); + const bool is_last_line = + break_token.IsFinished() || break_token.IsForcedBreak(); + const ComputedStyle& block_style = fragmentainer.Style(); + bool should_align_caret_right = + ShouldAlignCaretRight(block_style.GetTextAlign(is_last_line), + block_style.Direction()) && + (style.GetUnicodeBidi() != UnicodeBidi::kPlaintext || + IsLtr(cursor.Current().ResolvedDirection())); + // For horizontal text, adjust the location in the x direction to ensure that // it completely falls in the union of line box and containing block, and // then round it to the nearest pixel. if (is_horizontal) { - const LayoutUnit min_x = std::min(LayoutUnit(), line_box_offset.left); - caret_location.left = std::max(caret_location.left, min_x); - const LayoutUnit max_x = - std::max(fragmentainer.Size().width, line_box_rect.Right()); - caret_location.left = std::min(caret_location.left, max_x - caret_width); + if (should_align_caret_right) { + const LayoutUnit left_edge = std::min(LayoutUnit(), line_box_rect.X()); + caret_location.left = std::max(caret_location.left, left_edge); + caret_location.left = + std::min(caret_location.left, line_box_rect.Right() - caret_width); + } else { + const LayoutUnit right_edge = + std::max(fragmentainer.Size().width, line_box_rect.Right()); + caret_location.left = + std::min(caret_location.left, right_edge - caret_width); + caret_location.left = std::max(caret_location.left, line_box_rect.X()); + } caret_location.left = LayoutUnit(caret_location.left.Round()); return PhysicalRect(caret_location, caret_size); }
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.cc index 515c372..62206b6 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.cc
@@ -655,11 +655,17 @@ pixel_size); } +LogicalRect NGInlineCursorPosition::ConvertToLogical( + const PhysicalRect& physical_rect) const { + return physical_rect.ConvertToLogical(Style().GetWritingMode(), + ResolvedOrBaseDirection(), Size(), + physical_rect.size); +} + PhysicalRect NGInlineCursorPosition::ConvertToPhysical( const LogicalRect& logical_rect) const { - return logical_rect.ConvertToPhysical( - Style().GetWritingMode(), - IsLineBox() ? BaseDirection() : ResolvedDirection(), Size()); + return logical_rect.ConvertToPhysical(Style().GetWritingMode(), + ResolvedOrBaseDirection(), Size()); } PositionWithAffinity NGInlineCursor::PositionForPointInInlineFormattingContext( @@ -691,6 +697,12 @@ const NGFragmentItem* child_item = CurrentItem(); DCHECK(child_item); if (child_item->Type() == NGFragmentItem::kLine) { + if (!CursorForDescendants().TryToMoveToFirstInlineLeafChild()) { + // editing/selection/last-empty-inline.html requires this to skip + // empty <span> with padding. + MoveToNextItemSkippingChildren(); + continue; + } // Try to resolve if |point| falls in a line box in block direction. const LayoutUnit child_block_offset = child_item->OffsetInContainerBlock() @@ -893,6 +905,16 @@ return PositionWithAffinity(); } +PositionWithAffinity NGInlineCursor::PositionForStartOfLine() const { + DCHECK(Current().IsLineBox()); + return PositionForPointInInlineBox(Current().LineStartPoint()); +} + +PositionWithAffinity NGInlineCursor::PositionForEndOfLine() const { + DCHECK(Current().IsLineBox()); + return PositionForPointInInlineBox(Current().LineEndPoint()); +} + void NGInlineCursor::MoveTo(const NGInlineCursorPosition& position) { CheckValid(position); current_ = position; @@ -1208,6 +1230,15 @@ return true; } +bool NGInlineCursor::TryToMoveToFirstInlineLeafChild() { + while (IsNotNull()) { + if (Current().IsInlineLeaf()) + return true; + MoveToNext(); + } + return false; +} + bool NGInlineCursor::TryToMoveToLastChild() { if (!Current().HasChildren()) return false;
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.h b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.h index 3041fcf..690b116 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.h +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.h
@@ -155,6 +155,10 @@ // line. TextDirection BaseDirection() const; + TextDirection ResolvedOrBaseDirection() const { + return IsLineBox() ? BaseDirection() : ResolvedDirection(); + } + // True if the current position is text or atomic inline box. // Note: Because of this function is used for caret rect, hit testing, etc, // this function returns false for hidden for paint, text overflow ellipsis, @@ -171,6 +175,11 @@ PhysicalOffset LineEndPoint() const; // LogicalRect/PhysicalRect conversions + // |logical_rect| and |physical_rect| are converted with |Size()| as + // "outer size". + // TODO(yosin): We want to have better name for |ConvertTo*()| to specify + // "rect" parameters are relative to |this|. + LogicalRect ConvertToLogical(const PhysicalRect& physical_rect) const; PhysicalRect ConvertToPhysical(const LogicalRect& logical_rect) const; private: @@ -306,6 +315,10 @@ PositionWithAffinity PositionForPointInInlineBox( const PhysicalOffset& point) const; + // Returns first/last position of |this| line. |this| should be line box. + PositionWithAffinity PositionForStartOfLine() const; + PositionWithAffinity PositionForEndOfLine() const; + // // Functions to move the current position. // @@ -386,6 +399,9 @@ // Returns true if the current position moves to first child. bool TryToMoveToFirstChild(); + // Returns true if the current position moves to first inline leaf child. + bool TryToMoveToFirstInlineLeafChild(); + // Returns true if the current position moves to last child. bool TryToMoveToLastChild();
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_item_result.h b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_item_result.h index b95a0fa..b751da5 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_item_result.h +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_item_result.h
@@ -58,6 +58,10 @@ // Inline size of this item. LayoutUnit inline_size; + // Pending inline-end overhang amount for RubyRun. + // This is committed if a following item meets conditions. + LayoutUnit pending_end_overhang; + // ShapeResult for text items. Maybe different from NGInlineItem if re-shape // is needed in the line breaker. scoped_refptr<const ShapeResultView> shape_result;
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder.cc index dca11ac..dc2ef90 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder.cc
@@ -894,7 +894,7 @@ RestoreTrailingCollapsibleSpaceIfRemoved(); Append(NGInlineItem::kAtomicInline, kObjectReplacementCharacter, layout_object); - has_ruby_ = layout_object->IsRubyRun(); + has_ruby_ = has_ruby_ || layout_object->IsRubyRun(); // When this atomic inline is inside of an inline box, the height of the // inline box can be different from the height of the atomic inline. Ensure
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder.h b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder.h index 6b60ccaa..dbcbd59 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder.h +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder.h
@@ -227,6 +227,8 @@ const ComputedStyle&, LayoutText*, unsigned* start); + + friend class NGInlineItemsBuilderTest; }; template <>
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder_test.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder_test.cc index 77aff76..7c667618 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder_test.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder_test.cc
@@ -8,6 +8,7 @@ #include "third_party/blink/renderer/core/layout/layout_inline.h" #include "third_party/blink/renderer/core/layout/ng/inline/layout_ng_text.h" #include "third_party/blink/renderer/core/layout/ng/inline/ng_inline_node_data.h" +#include "third_party/blink/renderer/core/layout/ng/layout_ng_ruby_run.h" #include "third_party/blink/renderer/core/layout/ng/ng_layout_test.h" #include "third_party/blink/renderer/core/style/computed_style.h" @@ -48,6 +49,10 @@ return style; } + bool HasRuby(const NGInlineItemsBuilder& builder) const { + return builder.has_ruby_; + } + void AppendText(const String& text, NGInlineItemsBuilder* builder) { LayoutText* layout_text = LayoutText::CreateEmptyAnonymous( GetDocument(), style_.get(), LegacyLayout::kAuto); @@ -62,6 +67,14 @@ builder->AppendAtomicInline(layout_block_flow); } + void AppendRubyRun(NGInlineItemsBuilder* builder) { + LayoutNGRubyRun* ruby_run = new LayoutNGRubyRun(); + ruby_run->SetDocumentForAnonymous(&GetDocument()); + ruby_run->SetStyle(style_); + anonymous_objects_.push_back(ruby_run); + builder->AppendAtomicInline(ruby_run); + } + struct Input { const String text; EWhiteSpace whitespace = EWhiteSpace::kNormal; @@ -509,4 +522,26 @@ isolate_override_rtl->Destroy(); } +TEST_F(NGInlineItemsBuilderTest, HasRuby) { + Vector<NGInlineItem> items; + NGInlineItemsBuilder builder(&items); + EXPECT_FALSE(HasRuby(builder)) << "has_ruby_ should be false initially."; + + AppendText("Hello ", &builder); + EXPECT_FALSE(HasRuby(builder)) + << "Adding non-AtomicInline should not affect it."; + + AppendAtomicInline(&builder); + EXPECT_FALSE(HasRuby(builder)) + << "Adding non-ruby AtomicInline should not affect it."; + + AppendRubyRun(&builder); + EXPECT_TRUE(HasRuby(builder)) + << "Adding a ruby AtomicInline should set it to true."; + + AppendAtomicInline(&builder); + EXPECT_TRUE(HasRuby(builder)) + << "Adding non-ruby AtomicInline should not clear it."; +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm.cc index 5ff9494..ba242484 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm.cc
@@ -420,29 +420,60 @@ annotation_metrics = ComputeAnnotationOverflow( line_box_metrics, LayoutUnit(), line_info->LineStyle()); } + // Borrow the bottom space of the previous line. + if (annotation_metrics.ascent > LayoutUnit() && + ConstraintSpace().BlockStartAnnotationSpace() > LayoutUnit()) { + annotation_metrics.ascent = (annotation_metrics.ascent - + ConstraintSpace().BlockStartAnnotationSpace()) + .ClampNegativeToZero(); + } if (line_info->UseFirstLineStyle()) container_builder_.SetStyleVariant(NGStyleVariant::kFirstLine); container_builder_.SetBaseDirection(line_info->BaseDirection()); container_builder_.SetInlineSize(inline_size); container_builder_.SetMetrics(line_box_metrics); - container_builder_.SetBfcBlockOffset(line_info->BfcOffset().block_offset + - annotation_metrics.ascent); + container_builder_.SetBfcBlockOffset( + line_info->BfcOffset().block_offset + + annotation_metrics.ascent.ClampNegativeToZero()); if (annotation_metrics.descent > LayoutUnit()) container_builder_.SetAnnotationOverflow(annotation_metrics.descent); + else if (annotation_metrics.descent < LayoutUnit()) + container_builder_.SetBlockEndAnnotationSpace(-annotation_metrics.descent); } +// Return value: +// .ascent > 0: The amount of annotation overflow at the line-top side +// .ascent < 0: The amount of annotation space which the next line at the +// line-top side can consume. +// .descent > 0: The amount of annotation overflow at the line-bottom side. +// .descent < 0: The amount of annotation space which the next line at the +// line-bottom side can consume. NGLineHeightMetrics NGInlineLayoutAlgorithm::ComputeAnnotationOverflow( const NGLineHeightMetrics& line_box_metrics, LayoutUnit line_block_start, const ComputedStyle& line_style) { DCHECK(Node().HasRuby()); DCHECK(RuntimeEnabledFeatures::LayoutNGRubyEnabled()); - LayoutUnit annotatin_block_start = line_block_start; + // Min/max position of content without line-height. + LayoutUnit content_block_start = line_block_start + line_box_metrics.ascent; + LayoutUnit content_block_end = content_block_start; + + // Min/max position of annotations. + LayoutUnit annotation_block_start = content_block_start; + LayoutUnit annotation_block_end = content_block_start; + const LayoutUnit line_block_end = line_block_start + line_box_metrics.LineHeight(); - LayoutUnit annotation_block_end = line_block_end; for (const auto& item : line_box_) { + if (item.HasInFlowFragment()) { + content_block_start = + std::min(content_block_start, item.Offset().block_offset); + content_block_end = + std::max(content_block_end, + item.Offset().block_offset + item.Size().block_size); + } + // Accumulate |AnnotationOverflow| from ruby runs. All ruby run items have // |layout_result|. const NGLayoutResult* layout_result = item.layout_result.get(); @@ -450,8 +481,8 @@ continue; const LayoutUnit overflow = layout_result->AnnotationOverflow(); if (overflow < LayoutUnit()) { - annotatin_block_start = std::min( - annotatin_block_start, item.rect.offset.block_offset + overflow); + annotation_block_start = std::min( + annotation_block_start, item.rect.offset.block_offset + overflow); } else if (overflow > LayoutUnit()) { const LayoutUnit block_end = item.rect.offset.block_offset + @@ -463,9 +494,13 @@ std::max(annotation_block_end, block_end + overflow); } } + const LayoutUnit content_or_annotation_block_start = + std::min(content_block_start, annotation_block_start); + const LayoutUnit content_or_annotation_block_end = + std::max(content_block_end, annotation_block_end); return NGLineHeightMetrics( - std::max(line_block_start - annotatin_block_start, LayoutUnit()), - std::max(annotation_block_end - line_block_end, LayoutUnit())); + line_block_start - content_or_annotation_block_start, + content_or_annotation_block_end - line_block_end); } void NGInlineLayoutAlgorithm::PlaceControlItem(const NGInlineItem& item,
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.cc index 9dec9dd..203dd64f 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.cc
@@ -376,7 +376,7 @@ return data && !data->text_content.IsNull(); } -void NGInlineNode::PrepareLayoutIfNeeded() { +void NGInlineNode::PrepareLayoutIfNeeded() const { std::unique_ptr<NGInlineNodeData> previous_data; LayoutBlockFlow* block_flow = GetLayoutBlockFlow(); if (IsPrepareLayoutFinished()) { @@ -391,7 +391,7 @@ } void NGInlineNode::PrepareLayout( - std::unique_ptr<NGInlineNodeData> previous_data) { + std::unique_ptr<NGInlineNodeData> previous_data) const { // Scan list of siblings collecting all in-flow non-atomic inlines. A single // NGInlineNode represent a collection of adjacent non-atomic inlines. NGInlineNodeData* data = MutableData(); @@ -708,12 +708,12 @@ return true; } -const NGInlineNodeData& NGInlineNode::EnsureData() { +const NGInlineNodeData& NGInlineNode::EnsureData() const { PrepareLayoutIfNeeded(); return Data(); } -const NGOffsetMapping* NGInlineNode::ComputeOffsetMappingIfNeeded() { +const NGOffsetMapping* NGInlineNode::ComputeOffsetMappingIfNeeded() const { DCHECK(!GetLayoutBlockFlow()->GetDocument().NeedsLayoutTreeUpdate()); NGInlineNodeData* data = MutableData(); @@ -796,7 +796,7 @@ // parent LayoutInline where possible, and joining all text content in a single // string to allow bidi resolution and shaping of the entire block. void NGInlineNode::CollectInlines(NGInlineNodeData* data, - NGInlineNodeData* previous_data) { + NGInlineNodeData* previous_data) const { DCHECK(data->text_content.IsNull()); DCHECK(data->items.IsEmpty()); LayoutBlockFlow* block = GetLayoutBlockFlow(); @@ -808,7 +808,7 @@ builder.DidFinishCollectInlines(data); } -void NGInlineNode::SegmentText(NGInlineNodeData* data) { +void NGInlineNode::SegmentText(NGInlineNodeData* data) const { SegmentBidiRuns(data); SegmentScriptRuns(data); SegmentFontOrientation(data); @@ -817,7 +817,7 @@ } // Segment NGInlineItem by script, Emoji, and orientation using RunSegmenter. -void NGInlineNode::SegmentScriptRuns(NGInlineNodeData* data) { +void NGInlineNode::SegmentScriptRuns(NGInlineNodeData* data) const { DCHECK_EQ(data->segments, nullptr); String& text_content = data->text_content; @@ -900,7 +900,7 @@ DCHECK_EQ(range.end, text_content.length()); } -void NGInlineNode::SegmentFontOrientation(NGInlineNodeData* data) { +void NGInlineNode::SegmentFontOrientation(NGInlineNodeData* data) const { // Segment by orientation, only if vertical writing mode and items with // 'text-orientation: mixed'. if (GetLayoutBlockFlow()->IsHorizontalWritingMode()) @@ -942,7 +942,7 @@ // Segment bidi runs by resolving bidi embedding levels. // http://unicode.org/reports/tr9/#Resolving_Embedding_Levels -void NGInlineNode::SegmentBidiRuns(NGInlineNodeData* data) { +void NGInlineNode::SegmentBidiRuns(NGInlineNodeData* data) const { if (!data->is_bidi_enabled_) { data->SetBaseDirection(TextDirection::kLtr); return; @@ -987,7 +987,7 @@ void NGInlineNode::ShapeText(NGInlineItemsData* data, const String* previous_text, - const Vector<NGInlineItem>* previous_items) { + const Vector<NGInlineItem>* previous_items) const { const String& text_content = data->text_content; Vector<NGInlineItem>* items = &data->items; @@ -1160,7 +1160,7 @@ } // Create Vector<NGInlineItem> with :first-line rules applied if needed. -void NGInlineNode::ShapeTextForFirstLineIfNeeded(NGInlineNodeData* data) { +void NGInlineNode::ShapeTextForFirstLineIfNeeded(NGInlineNodeData* data) const { // First check if the document has any :first-line rules. DCHECK(!data->first_line_items_); LayoutObject* layout_object = GetLayoutBox(); @@ -1205,7 +1205,7 @@ data->first_line_items_ = std::move(first_line_items); } -void NGInlineNode::AssociateItemsWithInlines(NGInlineNodeData* data) { +void NGInlineNode::AssociateItemsWithInlines(NGInlineNodeData* data) const { #if DCHECK_IS_ON() HashSet<LayoutObject*> associated_objects; #endif @@ -1288,7 +1288,7 @@ scoped_refptr<const NGLayoutResult> NGInlineNode::Layout( const NGConstraintSpace& constraint_space, const NGBreakToken* break_token, - NGInlineChildLayoutContext* context) { + NGInlineChildLayoutContext* context) const { PrepareLayoutIfNeeded(); const auto* inline_break_token = To<NGInlineBreakToken>(break_token); @@ -1646,7 +1646,7 @@ MinMaxSizesResult NGInlineNode::ComputeMinMaxSizes( WritingMode container_writing_mode, const MinMaxSizesInput& input, - const NGConstraintSpace* constraint_space) { + const NGConstraintSpace* constraint_space) const { PrepareLayoutIfNeeded(); // Compute the max of inline sizes of all line boxes with 0 available inline
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.h b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.h index f99e978..e03b6f708 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.h +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.h
@@ -44,14 +44,15 @@ scoped_refptr<const NGLayoutResult> Layout( const NGConstraintSpace&, const NGBreakToken*, - NGInlineChildLayoutContext* context); + NGInlineChildLayoutContext* context) const; // Computes the value of min-content and max-content for this anonymous block // box. min-content is the inline size when lines wrap at every break // opportunity, and max-content is when lines do not wrap at all. - MinMaxSizesResult ComputeMinMaxSizes(WritingMode container_writing_mode, - const MinMaxSizesInput&, - const NGConstraintSpace* = nullptr); + MinMaxSizesResult ComputeMinMaxSizes( + WritingMode container_writing_mode, + const MinMaxSizesInput&, + const NGConstraintSpace* = nullptr) const; // Instruct to re-compute |PrepareLayout| on the next layout. void InvalidatePrepareLayoutForTest() { @@ -98,7 +99,7 @@ // Returns the DOM to text content offset mapping of this block. If it is not // computed before, compute and store it in NGInlineNodeData. // This funciton must be called with clean layout. - const NGOffsetMapping* ComputeOffsetMappingIfNeeded(); + const NGOffsetMapping* ComputeOffsetMappingIfNeeded() const; // Get |NGOffsetMapping| for the |layout_block_flow|. |layout_block_flow| // should be laid out. This function works for both new and legacy layout. @@ -141,22 +142,22 @@ // Prepare inline and text content for layout. Must be called before // calling the Layout method. - void PrepareLayoutIfNeeded(); - void PrepareLayout(std::unique_ptr<NGInlineNodeData> previous_data); + void PrepareLayoutIfNeeded() const; + void PrepareLayout(std::unique_ptr<NGInlineNodeData> previous_data) const; void CollectInlines(NGInlineNodeData*, - NGInlineNodeData* previous_data = nullptr); - void SegmentText(NGInlineNodeData*); - void SegmentScriptRuns(NGInlineNodeData*); - void SegmentFontOrientation(NGInlineNodeData*); - void SegmentBidiRuns(NGInlineNodeData*); + NGInlineNodeData* previous_data = nullptr) const; + void SegmentText(NGInlineNodeData*) const; + void SegmentScriptRuns(NGInlineNodeData*) const; + void SegmentFontOrientation(NGInlineNodeData*) const; + void SegmentBidiRuns(NGInlineNodeData*) const; void ShapeText(NGInlineItemsData*, const String* previous_text = nullptr, - const Vector<NGInlineItem>* previous_items = nullptr); - void ShapeTextForFirstLineIfNeeded(NGInlineNodeData*); - void AssociateItemsWithInlines(NGInlineNodeData*); + const Vector<NGInlineItem>* previous_items = nullptr) const; + void ShapeTextForFirstLineIfNeeded(NGInlineNodeData*) const; + void AssociateItemsWithInlines(NGInlineNodeData*) const; - NGInlineNodeData* MutableData() { + NGInlineNodeData* MutableData() const { return To<LayoutBlockFlow>(box_)->GetNGInlineNodeData(); } const NGInlineNodeData& Data() const { @@ -169,7 +170,7 @@ DCHECK(IsPrepareLayoutFinished()); return *To<LayoutBlockFlow>(box_)->GetNGInlineNodeData(); } - const NGInlineNodeData& EnsureData(); + const NGInlineNodeData& EnsureData() const; static void ComputeOffsetMapping(LayoutBlockFlow* layout_block_flow, NGInlineNodeData* data);
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.cc index 92ac90b..a646397 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.cc
@@ -234,9 +234,6 @@ DCHECK_GE(offset_, item.StartOffset()); DCHECK_GE(end_offset, offset_); DCHECK_LE(end_offset, item.EndOffset()); - if (item.Type() != NGInlineItem::kCloseTag && - item.Type() != NGInlineItem::kOpenTag) - pending_end_overhang_ = LayoutUnit(); NGInlineItemResults* item_results = line_info->MutableResults(); return &item_results->emplace_back( &item, item_index_, offset_, end_offset, break_anywhere_if_overflow_, @@ -558,14 +555,14 @@ return; } - LayoutUnit end_overhang = pending_end_overhang_; NGInlineItemResult* item_result = AddItem(item, line_info); item_result->should_create_line_box = true; - // Try to commit |pending_end_overhang_| set by a prior item. + // Try to commit |pending_end_overhang_| of a prior NGInlineItemResult. // |pending_end_overhang_| doesn't work well with bidi reordering. It's // difficult to compute overhang after bidi reordering because it affect // line breaking. - position_ -= CommitPendingEndOverhang(end_overhang, line_info); + if (maybe_have_end_overhang_) + position_ -= CommitPendingEndOverhang(line_info); if (auto_wrap_) { if (mode_ == NGLineBreakerMode::kMinContent && @@ -1418,7 +1415,10 @@ if (item.IsRubyRun()) { NGAnnotationOverhang overhang = GetOverhang(*item_result); - pending_end_overhang_ = overhang.end; + if (overhang.end > LayoutUnit()) { + item_result->pending_end_overhang = overhang.end; + maybe_have_end_overhang_ = true; + } if (CanApplyStartOverhang(*line_info, overhang.start)) { DCHECK_EQ(item_result->margins.inline_start, LayoutUnit()); @@ -1978,6 +1978,7 @@ item_index_ = first_remove.item_index; offset_ = first_remove.start_offset; trailing_whitespace_ = WhitespaceState::kLeading; + maybe_have_end_overhang_ = false; } SetCurrentStyle(ComputeCurrentStyle(new_end, line_info));
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.h b/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.h index 094da24..32b8724 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.h +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.h
@@ -219,7 +219,6 @@ // that computes position in visual order, this position in logical order. LayoutUnit position_; LayoutUnit available_width_; - LayoutUnit pending_end_overhang_; NGLineLayoutOpportunity line_opportunity_; NGInlineNode node_; @@ -262,6 +261,9 @@ // between images, and between text and images. bool sticky_images_quirk_ = false; + // True if the resultant line contains a RubyRun with inline-end overhang. + bool maybe_have_end_overhang_ = false; + const NGInlineItemsData& items_data_; // The text content of this node. This is same as |items_data_.text_content|
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker_test.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker_test.cc index 38160e6..3799a5e 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker_test.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker_test.cc
@@ -567,6 +567,32 @@ // Pass if |ComputeMinMaxSize| doesn't hit DCHECK failures. } +// crbug.com/1091359 +TEST_F(NGLineBreakerTest, RewindRubyRun) { + NGInlineNode node = CreateInlineNode(R"HTML( +<div id="container"> +<style> +* { + -webkit-text-security:square; + font-size:16px; +} +</style> +<big style="word-wrap: break-word">a +<ruby dir="rtl"> +<rt> +B AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +<svg></svg> +<b> +</rt> +</ruby> + )HTML"); + + node.ComputeMinMaxSizes( + WritingMode::kHorizontalTb, + MinMaxSizesInput(/* percentage_resolution_block_size */ LayoutUnit())); + // This test passes if no CHECK failures. +} + #undef MAYBE_OverflowAtomicInline } // namespace } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_ruby_utils.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_ruby_utils.cc index 04586cc1..4d354a60 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_ruby_utils.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_ruby_utils.cc
@@ -104,37 +104,41 @@ } // See LayoutRubyRun::GetOverhang(). -LayoutUnit CommitPendingEndOverhang(LayoutUnit end_overhang, - NGLineInfo* line_info) { - if (end_overhang <= LayoutUnit()) - return LayoutUnit(); +LayoutUnit CommitPendingEndOverhang(NGLineInfo* line_info) { DCHECK(RuntimeEnabledFeatures::LayoutNGRubyEnabled()); DCHECK(line_info); NGInlineItemResults* items = line_info->MutableResults(); - DCHECK_GE(items->size(), 2U); + if (items->size() < 2U) + return LayoutUnit(); const NGInlineItemResult& text_item = items->back(); DCHECK_EQ(text_item.item->Type(), NGInlineItem::kText); - wtf_size_t ruby_run_index = items->size() - 2; - while ((*items)[ruby_run_index].item->Type() != NGInlineItem::kAtomicInline) { - const auto type = (*items)[ruby_run_index].item->Type(); - DCHECK(type == NGInlineItem::kOpenTag || type == NGInlineItem::kCloseTag) - << type; - --ruby_run_index; + wtf_size_t i = items->size() - 2; + while ((*items)[i].item->Type() != NGInlineItem::kAtomicInline) { + const auto type = (*items)[i].item->Type(); + if (type != NGInlineItem::kOpenTag && type != NGInlineItem::kCloseTag) + return LayoutUnit(); + if (i-- == 0) + return LayoutUnit(); } - NGInlineItemResult& ruby_run_item = (*items)[ruby_run_index]; - DCHECK(ruby_run_item.layout_result->PhysicalFragment().IsRubyRun()); - if (ruby_run_item.item->Style()->FontSize() < + NGInlineItemResult& atomic_inline_item = (*items)[i]; + if (!atomic_inline_item.layout_result->PhysicalFragment().IsRubyRun()) + return LayoutUnit(); + if (atomic_inline_item.pending_end_overhang <= LayoutUnit()) + return LayoutUnit(); + if (atomic_inline_item.item->Style()->FontSize() < text_item.item->Style()->FontSize()) return LayoutUnit(); // Ideally we should refer to inline_size of |text_item| instead of the width // of the NGInlineItem's ShapeResult. However it's impossible to compute // inline_size of |text_item| before calling BreakText(), and BreakText() // requires precise |position_| which takes |end_overhang| into account. - end_overhang = std::min( - end_overhang, LayoutUnit(text_item.item->TextShapeResult()->Width())); - DCHECK_EQ(ruby_run_item.margins.inline_end, LayoutUnit()); - ruby_run_item.margins.inline_end = -end_overhang; - ruby_run_item.inline_size -= end_overhang; + LayoutUnit end_overhang = + std::min(atomic_inline_item.pending_end_overhang, + LayoutUnit(text_item.item->TextShapeResult()->Width())); + DCHECK_EQ(atomic_inline_item.margins.inline_end, LayoutUnit()); + atomic_inline_item.margins.inline_end = -end_overhang; + atomic_inline_item.inline_size -= end_overhang; + atomic_inline_item.pending_end_overhang = LayoutUnit(); return end_overhang; }
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_ruby_utils.h b/third_party/blink/renderer/core/layout/ng/inline/ng_ruby_utils.h index 3f737df..c752267 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_ruby_utils.h +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_ruby_utils.h
@@ -35,8 +35,7 @@ // // This function may update a NGInlineItemResult representing RubyRun // in |line_info| -LayoutUnit CommitPendingEndOverhang(LayoutUnit end_overhang, - NGLineInfo* line_info); +LayoutUnit CommitPendingEndOverhang(NGLineInfo* line_info); } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/ng/layout_ng_block_flow_mixin.cc b/third_party/blink/renderer/core/layout/ng/layout_ng_block_flow_mixin.cc index a7904987..2d0f8c5 100644 --- a/third_party/blink/renderer/core/layout/ng/layout_ng_block_flow_mixin.cc +++ b/third_party/blink/renderer/core/layout/ng/layout_ng_block_flow_mixin.cc
@@ -7,6 +7,7 @@ #include <memory> #include <utility> +#include "third_party/blink/renderer/core/editing/editing_utilities.h" #include "third_party/blink/renderer/core/editing/position_with_affinity.h" #include "third_party/blink/renderer/core/layout/hit_test_location.h" #include "third_party/blink/renderer/core/layout/layout_analyzer.h" @@ -252,6 +253,33 @@ accumulated_offset, action); } +// Move specified position to start/end of non-editable region. +// If it can be found, we prefer a visually equivalent position that is +// editable. +// See also LayoutObject::CreatePositionWithAffinity() +// Example: +// <editable><non-editable>|abc</non-editable></editable> +// => +// <editable>|<non-editable>abc</non-editable></editable> +static PositionWithAffinity AdjustForEditingBoundary( + const PositionWithAffinity& position_with_affinity) { + if (position_with_affinity.IsNull()) + return position_with_affinity; + const Position& position = position_with_affinity.GetPosition(); + const Node& node = *position.ComputeContainerNode(); + if (HasEditableStyle(node)) + return position_with_affinity; + const Position& forward = + MostForwardCaretPosition(position, kCanCrossEditingBoundary); + if (HasEditableStyle(*forward.ComputeContainerNode())) + return PositionWithAffinity(forward); + const Position& backward = + MostBackwardCaretPosition(position, kCanCrossEditingBoundary); + if (HasEditableStyle(*backward.ComputeContainerNode())) + return PositionWithAffinity(backward); + return position_with_affinity; +} + template <typename Base> PositionWithAffinity LayoutNGBlockFlowMixin<Base>::PositionForPoint( const PhysicalOffset& point) const { @@ -272,7 +300,7 @@ Base::OffsetForContents(point_in_contents); if (const PositionWithAffinity position = paint_fragment->PositionForPoint(point_in_contents)) - return position; + return AdjustForEditingBoundary(position); } else if (const NGPhysicalBoxFragment* fragment = CurrentFragment()) { if (const NGFragmentItems* items = fragment->Items()) { // The given offset is relative to this |LayoutBlockFlow|. Convert to the @@ -283,7 +311,7 @@ if (const PositionWithAffinity position = cursor.PositionForPointInInlineFormattingContext( point_in_contents, *fragment)) - return position; + return AdjustForEditingBoundary(position); } }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc index 1a94c83..722f296 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc
@@ -579,6 +579,7 @@ NGPreviousInflowPosition previous_inflow_position = { LayoutUnit(), ConstraintSpace().MarginStrut(), + is_resuming_ ? LayoutUnit() : container_builder_.Padding().block_start, /* self_collapsing_child_had_clearance */ false}; // Do not collapse margins between parent and its child if: @@ -1588,7 +1589,8 @@ /* is_new_fc */ false); NGConstraintSpace child_space = CreateConstraintSpaceForChild( child, child_data, child_available_size_, /* is_new_fc */ false, - forced_bfc_block_offset, has_clearance_past_adjoining_floats); + forced_bfc_block_offset, has_clearance_past_adjoining_floats, + previous_inflow_position->block_end_annotation_space); scoped_refptr<const NGLayoutResult> layout_result = LayoutInflow(child_space, child_break_token, early_break_, &child, inline_child_layout_context); @@ -2071,6 +2073,7 @@ is_self_collapsing); return {logical_block_offset, margin_strut, + layout_result.BlockEndAnnotationSpace(), self_or_sibling_self_collapsing_child_had_clearance}; } @@ -2410,7 +2413,8 @@ const LogicalSize child_available_size, bool is_new_fc, const base::Optional<LayoutUnit> child_bfc_block_offset, - bool has_clearance_past_adjoining_floats) { + bool has_clearance_past_adjoining_floats, + LayoutUnit block_start_annotation_space) { const ComputedStyle& style = Style(); const ComputedStyle& child_style = child.Style(); WritingMode child_writing_mode = @@ -2525,6 +2529,7 @@ // child establishes a new formatting context or not. builder.SetDiscardingMarginStrut(); } + builder.SetBlockStartAnnotationSpace(block_start_annotation_space); if (ConstraintSpace().HasBlockFragmentation()) { LayoutUnit fragmentainer_offset_delta;
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.h b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.h index 0814210..39f31cd6 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.h +++ b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.h
@@ -32,6 +32,7 @@ struct NGPreviousInflowPosition { LayoutUnit logical_block_offset; NGMarginStrut margin_strut; + LayoutUnit block_end_annotation_space; bool self_collapsing_child_had_clearance; }; @@ -113,7 +114,8 @@ const LogicalSize child_available_size, bool is_new_fc, const base::Optional<LayoutUnit> bfc_block_offset = base::nullopt, - bool has_clearance_past_adjoining_floats = false); + bool has_clearance_past_adjoining_floats = false, + LayoutUnit block_start_annotation_space = LayoutUnit()); // @return Estimated BFC block offset for the "to be layout" child. NGInflowChildData ComputeChildData(const NGPreviousInflowPosition&,
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 2dc3284..9ea96e7 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
@@ -351,7 +351,7 @@ scoped_refptr<const NGLayoutResult> NGBlockNode::Layout( const NGConstraintSpace& constraint_space, const NGBlockBreakToken* break_token, - const NGEarlyBreak* early_break) { + const NGEarlyBreak* early_break) const { // Use the old layout code and synthesize a fragment. if (!CanUseNewLayout()) return RunLegacyLayout(constraint_space); @@ -508,7 +508,7 @@ } scoped_refptr<const NGLayoutResult> NGBlockNode::SimplifiedLayout( - const NGPhysicalFragment& previous_fragment) { + const NGPhysicalFragment& previous_fragment) const { scoped_refptr<const NGLayoutResult> previous_result = box_->GetCachedLayoutResult(); DCHECK(previous_result); @@ -587,7 +587,7 @@ return cached_layout_result; } -void NGBlockNode::PrepareForLayout() { +void NGBlockNode::PrepareForLayout() const { auto* block = DynamicTo<LayoutBlock>(box_); if (block && block->HasOverflowClip()) { DCHECK(block->GetScrollableArea()); @@ -605,7 +605,7 @@ LayoutBlockFlow* block_flow, const NGConstraintSpace& constraint_space, const NGBlockBreakToken* break_token, - scoped_refptr<const NGLayoutResult> layout_result) { + scoped_refptr<const NGLayoutResult> layout_result) const { // If we abort layout and don't clear the cached layout-result, we can end // up in a state where the layout-object tree doesn't match fragment tree // referenced by this layout-result. @@ -676,7 +676,7 @@ MinMaxSizesResult NGBlockNode::ComputeMinMaxSizes( WritingMode container_writing_mode, const MinMaxSizesInput& input, - const NGConstraintSpace* constraint_space) { + const NGConstraintSpace* constraint_space) const { // TODO(layoutng) Can UpdateMarkerTextIfNeeded call be moved // somewhere else? List items need up-to-date markers before layout. if (IsListItem()) @@ -918,7 +918,7 @@ void NGBlockNode::CopyFragmentDataToLayoutBox( const NGConstraintSpace& constraint_space, const NGLayoutResult& layout_result, - const NGBlockBreakToken* previous_break_token) { + const NGBlockBreakToken* previous_break_token) const { const auto& physical_fragment = To<NGPhysicalBoxFragment>(layout_result.PhysicalFragment()); @@ -1041,7 +1041,7 @@ void NGBlockNode::PlaceChildrenInLayoutBox( const NGPhysicalBoxFragment& physical_fragment, - const NGBlockBreakToken* previous_break_token) { + const NGBlockBreakToken* previous_break_token) const { LayoutBox* rendered_legend = nullptr; for (const auto& child_fragment : physical_fragment.Children()) { // Skip any line-boxes we have as children, this is handled within @@ -1078,7 +1078,7 @@ } void NGBlockNode::PlaceChildrenInFlowThread( - const NGPhysicalBoxFragment& physical_fragment) { + const NGPhysicalBoxFragment& physical_fragment) const { const NGBlockBreakToken* previous_break_token = nullptr; for (const auto& child : physical_fragment.Children()) { const LayoutObject* child_object = child->GetLayoutObject(); @@ -1102,7 +1102,7 @@ const NGPhysicalBoxFragment& child_fragment, PhysicalOffset offset, const NGPhysicalBoxFragment& container_fragment, - const NGBlockBreakToken* previous_container_break_token) { + const NGBlockBreakToken* previous_container_break_token) const { LayoutBox* layout_box = ToLayoutBox(child_fragment.GetMutableLayoutObject()); if (!layout_box) return; @@ -1140,7 +1140,7 @@ const NGPhysicalContainerFragment& container, LayoutUnit initial_container_width, bool initial_container_is_flipped, - PhysicalOffset offset) { + PhysicalOffset offset) const { DCHECK(!RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled()); for (const auto& child : container.Children()) { if (child->IsContainer()) { @@ -1185,7 +1185,7 @@ void NGBlockNode::CopyFragmentItemsToLayoutBox( const NGPhysicalBoxFragment& container, - const NGFragmentItems& items) { + const NGFragmentItems& items) const { DCHECK(RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled()); bool initial_container_is_flipped = Style().IsFlippedBlocksWritingMode(); @@ -1327,7 +1327,7 @@ } scoped_refptr<const NGLayoutResult> NGBlockNode::RunLegacyLayout( - const NGConstraintSpace& constraint_space) { + const NGConstraintSpace& constraint_space) const { // This is an exit-point from LayoutNG to the legacy engine. This means that // we need to be at a formatting context boundary, since NG and legacy don't // cooperate on e.g. margin collapsing. @@ -1458,7 +1458,7 @@ void NGBlockNode::CopyBaselinesFromLegacyLayout( const NGConstraintSpace& constraint_space, - NGBoxFragmentBuilder* builder) { + NGBoxFragmentBuilder* builder) const { // As the calls to query baselines from legacy layout are potentially // expensive we only ask for them if needed. // TODO(layout-dev): Once we have flexbox, and editing switched over to @@ -1485,7 +1485,7 @@ } LayoutUnit NGBlockNode::AtomicInlineBaselineFromLegacyLayout( - const NGConstraintSpace& constraint_space) { + const NGConstraintSpace& constraint_space) const { LineDirectionMode line_direction = box_->IsHorizontalWritingMode() ? LineDirectionMode::kHorizontalLine : LineDirectionMode::kVerticalLine; @@ -1518,7 +1518,7 @@ // in the parents writing mode. void NGBlockNode::UpdateShapeOutsideInfoIfNeeded( const NGLayoutResult& layout_result, - LayoutUnit percentage_resolution_inline_size) { + LayoutUnit percentage_resolution_inline_size) const { if (!box_->IsFloating() || !box_->GetShapeOutsideInfo()) return; @@ -1556,7 +1556,7 @@ void NGBlockNode::AddColumnResult( scoped_refptr<const NGLayoutResult> result, - const NGBlockBreakToken* incoming_break_token) { + const NGBlockBreakToken* incoming_break_token) const { wtf_size_t index = FragmentIndex(incoming_break_token); GetFlowThread(To<LayoutBlockFlow>(box_))->AddLayoutResult(result, index); }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_node.h b/third_party/blink/renderer/core/layout/ng/ng_block_node.h index a2611077..dc6145d 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_node.h +++ b/third_party/blink/renderer/core/layout/ng/ng_block_node.h
@@ -37,7 +37,7 @@ scoped_refptr<const NGLayoutResult> Layout( const NGConstraintSpace& constraint_space, const NGBlockBreakToken* break_token = nullptr, - const NGEarlyBreak* = nullptr); + const NGEarlyBreak* = nullptr) const; // This method is just for use within the |NGSimplifiedLayoutAlgorithm|. // @@ -45,7 +45,7 @@ // space used to generate the |NGLayoutResult|. // Otherwise it will simply return the previous layout result generated. scoped_refptr<const NGLayoutResult> SimplifiedLayout( - const NGPhysicalFragment& previous_fragment); + const NGPhysicalFragment& previous_fragment) const; // This method is just for use within the |NGOutOfFlowLayoutPart|. // @@ -82,9 +82,10 @@ // The constraint space is also used to perform layout when this block's // writing mode is orthogonal to its parent's, in which case the constraint // space is not optional. - MinMaxSizesResult ComputeMinMaxSizes(WritingMode container_writing_mode, - const MinMaxSizesInput&, - const NGConstraintSpace* = nullptr); + MinMaxSizesResult ComputeMinMaxSizes( + WritingMode container_writing_mode, + const MinMaxSizesInput&, + const NGConstraintSpace* = nullptr) const; MinMaxSizes ComputeMinMaxSizesFromLegacy(const MinMaxSizesInput&) const; @@ -156,7 +157,7 @@ // LayoutObject-less, but we still need to keep the fragments generated // somewhere. void AddColumnResult(scoped_refptr<const NGLayoutResult>, - const NGBlockBreakToken* incoming_break_token); + const NGBlockBreakToken* incoming_break_token) const; static bool CanUseNewLayout(const LayoutBox&); bool CanUseNewLayout() const; @@ -164,11 +165,12 @@ String ToString() const; private: - void PrepareForLayout(); + void PrepareForLayout() const; // Runs layout on the underlying LayoutObject and creates a fragment for the // resulting geometry. - scoped_refptr<const NGLayoutResult> RunLegacyLayout(const NGConstraintSpace&); + scoped_refptr<const NGLayoutResult> RunLegacyLayout( + const NGConstraintSpace&) const; scoped_refptr<const NGLayoutResult> RunSimplifiedLayout( const NGLayoutAlgorithmParams&, @@ -179,37 +181,39 @@ void FinishLayout(LayoutBlockFlow*, const NGConstraintSpace&, const NGBlockBreakToken*, - scoped_refptr<const NGLayoutResult>); + scoped_refptr<const NGLayoutResult>) const; // After we run the layout algorithm, this function copies back the geometry // data to the layout box. void CopyFragmentDataToLayoutBox( const NGConstraintSpace&, const NGLayoutResult&, - const NGBlockBreakToken* previous_break_token); + const NGBlockBreakToken* previous_break_token) const; void CopyFragmentItemsToLayoutBox(const NGPhysicalBoxFragment& container, - const NGFragmentItems& items); + const NGFragmentItems& items) const; void CopyFragmentDataToLayoutBoxForInlineChildren( const NGPhysicalContainerFragment& container, LayoutUnit initial_container_width, bool initial_container_is_flipped, - PhysicalOffset offset = {}); - void PlaceChildrenInLayoutBox(const NGPhysicalBoxFragment&, - const NGBlockBreakToken* previous_break_token); - void PlaceChildrenInFlowThread(const NGPhysicalBoxFragment&); + PhysicalOffset offset = {}) const; + void PlaceChildrenInLayoutBox( + const NGPhysicalBoxFragment&, + const NGBlockBreakToken* previous_break_token) const; + void PlaceChildrenInFlowThread(const NGPhysicalBoxFragment&) const; void CopyChildFragmentPosition( const NGPhysicalBoxFragment& child_fragment, PhysicalOffset, const NGPhysicalBoxFragment& container_fragment, - const NGBlockBreakToken* previous_container_break_token = nullptr); + const NGBlockBreakToken* previous_container_break_token = nullptr) const; void CopyBaselinesFromLegacyLayout(const NGConstraintSpace&, - NGBoxFragmentBuilder*); - LayoutUnit AtomicInlineBaselineFromLegacyLayout(const NGConstraintSpace&); + NGBoxFragmentBuilder*) const; + LayoutUnit AtomicInlineBaselineFromLegacyLayout( + const NGConstraintSpace&) const; void UpdateShapeOutsideInfoIfNeeded( const NGLayoutResult&, - LayoutUnit percentage_resolution_inline_size); + LayoutUnit percentage_resolution_inline_size) const; }; template <>
diff --git a/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h b/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h index 6b49934..aa41739 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h +++ b/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h
@@ -460,6 +460,14 @@ return HasRareData() && rare_data_->is_restricted_block_size_table_cell; } + // The amount of available space for block-start side annotation. + // For the first box, this is the padding-block-start value of the container. + // Otherwise, this comes from NGLayoutResult::BlockEndAnnotationSpace(). + LayoutUnit BlockStartAnnotationSpace() const { + return HasRareData() ? rare_data_->BlockStartAnnotationSpace() + : LayoutUnit(); + } + NGMarginStrut MarginStrut() const { return HasRareData() ? rare_data_->MarginStrut() : NGMarginStrut(); } @@ -676,6 +684,7 @@ : percentage_resolution_size(other.percentage_resolution_size), replaced_percentage_resolution_block_size( other.replaced_percentage_resolution_block_size), + block_start_annotation_space(other.block_start_annotation_space), bfc_offset(other.bfc_offset), fragmentainer_block_size(other.fragmentainer_block_size), fragmentainer_offset_at_bfc(other.fragmentainer_offset_at_bfc), @@ -784,6 +793,14 @@ return stretch_data_.IsInitialForMaySkipLayout(); } + LayoutUnit BlockStartAnnotationSpace() const { + return block_start_annotation_space; + } + + void SetBlockStartAnnotationSpace(LayoutUnit space) { + block_start_annotation_space = space; + } + NGMarginStrut MarginStrut() const { return data_union_type == kBlockData ? block_data_.margin_strut : NGMarginStrut(); @@ -903,6 +920,7 @@ LogicalSize percentage_resolution_size; LayoutUnit replaced_percentage_resolution_block_size; + LayoutUnit block_start_annotation_space; NGBfcOffset bfc_offset; LayoutUnit fragmentainer_block_size = kIndefiniteSize;
diff --git a/third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder.h b/third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder.h index 3065517..5da0ad3 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder.h +++ b/third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder.h
@@ -215,6 +215,11 @@ space_.bitfields_.cache_slot = static_cast<unsigned>(slot); } + void SetBlockStartAnnotationSpace(LayoutUnit space) { + if (space) + space_.EnsureRareData()->SetBlockStartAnnotationSpace(space); + } + void SetMarginStrut(const NGMarginStrut& margin_strut) { #if DCHECK_IS_ON() DCHECK(!is_margin_strut_set_);
diff --git a/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.h b/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.h index 4013a1b..1dede74d 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.h +++ b/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.h
@@ -178,6 +178,11 @@ annotation_overflow_ = overflow; } + // See NGLayoutRsult::BlockEndAnnotatioSpace(). + void SetBlockEndAnnotationSpace(LayoutUnit space) { + block_end_annotation_space_ = space; + } + const NGConstraintSpace* ConstraintSpace() const { return space_; } #if DCHECK_IS_ON() @@ -232,6 +237,8 @@ // See NGLayoutResult::AnnotationOverflow(). LayoutUnit annotation_overflow_; + // See NGLayoutResult::BlockEndAnotationSpace(). + LayoutUnit block_end_annotation_space_; NGAdjoiningObjectTypes adjoining_object_types_ = kAdjoiningNone; bool has_adjoining_object_descendants_ = false;
diff --git a/third_party/blink/renderer/core/layout/ng/ng_layout_input_node.cc b/third_party/blink/renderer/core/layout/ng/ng_layout_input_node.cc index 34f284a5..59706f9 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_layout_input_node.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_layout_input_node.cc
@@ -63,7 +63,7 @@ MinMaxSizesResult NGLayoutInputNode::ComputeMinMaxSizes( WritingMode writing_mode, const MinMaxSizesInput& input, - const NGConstraintSpace* space) { + const NGConstraintSpace* space) const { if (auto* inline_node = DynamicTo<NGInlineNode>(this)) return inline_node->ComputeMinMaxSizes(writing_mode, input, space); return To<NGBlockNode>(*this).ComputeMinMaxSizes(writing_mode, input, space);
diff --git a/third_party/blink/renderer/core/layout/ng/ng_layout_input_node.h b/third_party/blink/renderer/core/layout/ng/ng_layout_input_node.h index 29b1ab0..d8ec263 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_layout_input_node.h +++ b/third_party/blink/renderer/core/layout/ng/ng_layout_input_node.h
@@ -166,9 +166,10 @@ } // Returns the border-box min/max content sizes for the node. - MinMaxSizesResult ComputeMinMaxSizes(WritingMode, - const MinMaxSizesInput&, - const NGConstraintSpace* = nullptr); + MinMaxSizesResult ComputeMinMaxSizes( + WritingMode, + const MinMaxSizesInput&, + const NGConstraintSpace* = nullptr) const; // Returns intrinsic sizing information for replaced elements. // ComputeReplacedSize can use it to compute actual replaced size.
diff --git a/third_party/blink/renderer/core/layout/ng/ng_layout_result.cc b/third_party/blink/renderer/core/layout/ng/ng_layout_result.cc index d8ca58d..637a226 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_layout_result.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_layout_result.cc
@@ -79,8 +79,12 @@ EnsureRareData()->column_spanner = builder->column_spanner_; if (builder->lines_until_clamp_) EnsureRareData()->lines_until_clamp = *builder->lines_until_clamp_; - if (builder->annotation_overflow_ != LayoutUnit()) + if (builder->annotation_overflow_) EnsureRareData()->annotation_overflow = builder->annotation_overflow_; + if (builder->block_end_annotation_space_) { + EnsureRareData()->block_end_annotation_space = + builder->block_end_annotation_space_; + } bitfields_.initial_break_before = static_cast<unsigned>(builder->initial_break_before_); bitfields_.final_break_after =
diff --git a/third_party/blink/renderer/core/layout/ng/ng_layout_result.h b/third_party/blink/renderer/core/layout/ng/ng_layout_result.h index 11a4f0e..8d9d344 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_layout_result.h +++ b/third_party/blink/renderer/core/layout/ng/ng_layout_result.h
@@ -78,6 +78,14 @@ return HasRareData() ? rare_data_->annotation_overflow : LayoutUnit(); } + // The amount of available space for block-start side annotations of the + // next box. + // This never be negative. + LayoutUnit BlockEndAnnotationSpace() const { + return HasRareData() ? rare_data_->block_end_annotation_space + : LayoutUnit(); + } + LogicalOffset OutOfFlowPositionedOffset() const { DCHECK(bitfields_.has_oof_positioned_offset); return HasRareData() ? rare_data_->oof_positioned_offset @@ -384,6 +392,7 @@ scoped_refptr<SerializedScriptValue> custom_layout_data; LayoutUnit overflow_block_size = kIndefiniteSize; LayoutUnit annotation_overflow; + LayoutUnit block_end_annotation_space; #if DCHECK_IS_ON() bool has_tallest_unbreakable_block_size = false; #endif
diff --git a/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.cc b/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.cc index a08c3bb..4a13cc05 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.cc
@@ -520,6 +520,12 @@ Size(), inner_size); } +PhysicalRect NGPhysicalFragment::ConvertToPhysical( + const LogicalRect& logical_rect) const { + return logical_rect.ConvertToPhysical(Style().GetWritingMode(), + Style().Direction(), Size()); +} + String NGPhysicalFragment::ToString() const { StringBuilder output; output.AppendFormat("Type: '%d' Size: '%s'", Type(),
diff --git a/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.h b/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.h index 8b921dc..0bf49c56 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.h +++ b/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.h
@@ -344,6 +344,7 @@ LogicalRect ConvertToLogical(const PhysicalRect& physical_rect, TextDirection direction, PhysicalSize inner_size) const; + PhysicalRect ConvertToPhysical(const LogicalRect& logical_rect) const; // Utility functions for caret painting. Note that carets are painted as part // of the containing block's foreground.
diff --git a/third_party/blink/renderer/core/loader/document_load_timing.cc b/third_party/blink/renderer/core/loader/document_load_timing.cc index 117c13f..5a8c0472b 100644 --- a/third_party/blink/renderer/core/loader/document_load_timing.cc +++ b/third_party/blink/renderer/core/loader/document_load_timing.cc
@@ -138,9 +138,9 @@ NotifyDocumentTimingChanged(); } -void DocumentLoadTiming::MarkLastBackForwardCacheRestoreNavigationStart( +void DocumentLoadTiming::MarkBackForwardCacheRestoreNavigationStart( base::TimeTicks navigation_start) { - last_bfcache_restore_navigation_start_ = navigation_start; + bfcache_restore_navigation_starts_.push_back(navigation_start); NotifyDocumentTimingChanged(); }
diff --git a/third_party/blink/renderer/core/loader/document_load_timing.h b/third_party/blink/renderer/core/loader/document_load_timing.h index 2ab826c..2009765ba 100644 --- a/third_party/blink/renderer/core/loader/document_load_timing.h +++ b/third_party/blink/renderer/core/loader/document_load_timing.h
@@ -53,7 +53,7 @@ void MarkNavigationStart(); void SetNavigationStart(base::TimeTicks); - void MarkLastBackForwardCacheRestoreNavigationStart(base::TimeTicks); + void MarkBackForwardCacheRestoreNavigationStart(base::TimeTicks); void SetInputStart(base::TimeTicks); @@ -82,8 +82,9 @@ base::TimeTicks InputStart() const { return input_start_; } base::TimeTicks NavigationStart() const { return navigation_start_; } - base::TimeTicks LastBackForwardCacheRestoreNavigationStart() const { - return last_bfcache_restore_navigation_start_; + const WTF::Vector<base::TimeTicks>& BackForwardCacheRestoreNavigationStarts() + const { + return bfcache_restore_navigation_starts_; } base::TimeTicks UnloadEventStart() const { return unload_event_start_; } base::TimeTicks UnloadEventEnd() const { return unload_event_end_; } @@ -119,7 +120,7 @@ base::TimeDelta reference_wall_time_; base::TimeTicks input_start_; base::TimeTicks navigation_start_; - base::TimeTicks last_bfcache_restore_navigation_start_; + WTF::Vector<base::TimeTicks> bfcache_restore_navigation_starts_; base::TimeTicks unload_event_start_; base::TimeTicks unload_event_end_; base::TimeTicks redirect_start_;
diff --git a/third_party/blink/renderer/core/loader/frame_loader.cc b/third_party/blink/renderer/core/loader/frame_loader.cc index 3a02383..e69b035 100644 --- a/third_party/blink/renderer/core/loader/frame_loader.cc +++ b/third_party/blink/renderer/core/loader/frame_loader.cc
@@ -800,7 +800,8 @@ if (url.ProtocolIsJavaScript()) { if (!origin_document || - origin_document->CanExecuteScripts(kAboutToExecuteScript)) { + origin_document->GetExecutionContext()->CanExecuteScripts( + kAboutToExecuteScript)) { frame_->GetDocument()->ProcessJavaScriptUrl( url, request.ShouldCheckMainWorldContentSecurityPolicy()); } @@ -1525,7 +1526,6 @@ } void FrameLoader::DispatchDidClearDocumentOfWindowObject() { - DCHECK(frame_->GetDocument()); if (state_machine_.CreatingInitialEmptyDocument()) return; @@ -1535,7 +1535,7 @@ frame_->GetScriptController().WindowProxy(DOMWrapperWorld::MainWorld()); } probe::DidClearDocumentOfWindowObject(frame_); - if (!frame_->GetDocument()->CanExecuteScripts(kNotAboutToExecuteScript)) + if (!frame_->DomWindow()->CanExecuteScripts(kNotAboutToExecuteScript)) return; if (dispatching_did_clear_window_object_in_main_world_) @@ -1548,8 +1548,7 @@ } void FrameLoader::DispatchDidClearWindowObjectInMainWorld() { - DCHECK(frame_->GetDocument()); - if (!frame_->GetDocument()->CanExecuteScripts(kNotAboutToExecuteScript)) + if (!frame_->DomWindow()->CanExecuteScripts(kNotAboutToExecuteScript)) return; if (dispatching_did_clear_window_object_in_main_world_)
diff --git a/third_party/blink/renderer/core/loader/lazy_image_helper.cc b/third_party/blink/renderer/core/loader/lazy_image_helper.cc index 444d8c8f..db0a913 100644 --- a/third_party/blink/renderer/core/loader/lazy_image_helper.cc +++ b/third_party/blink/renderer/core/loader/lazy_image_helper.cc
@@ -8,6 +8,7 @@ #include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/frame/frame_owner.h" +#include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/web_feature.h" #include "third_party/blink/renderer/core/html/html_image_element.h" @@ -103,7 +104,7 @@ // Do not lazyload image elements when JavaScript is disabled, regardless of // the `loading` attribute. - if (!frame.GetDocument()->CanExecuteScripts(kNotAboutToExecuteScript)) + if (!frame.DomWindow()->CanExecuteScripts(kNotAboutToExecuteScript)) return LazyImageHelper::Eligibility::kDisabled; const auto lazy_load_image_setting = frame.GetLazyLoadImageSetting();
diff --git a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc index 438e919..99f42a2 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc
@@ -427,6 +427,9 @@ if (original_phase != PaintPhase::kSelfBlockBackgroundOnly && original_phase != PaintPhase::kSelfOutlineOnly && + // For now all scrollers with overlay overflow controls are + // self-painting layers, so we don't need to traverse descendants + // here. original_phase != PaintPhase::kOverlayOverflowControls) { if (original_phase == PaintPhase::kMask || !box_fragment_.GetLayoutObject()->IsBox()) { @@ -439,6 +442,26 @@ } } + // If the caret's node's fragment's containing block is this block, and + // the paint action is PaintPhaseForeground, then paint the caret. + if (original_phase == PaintPhase::kForeground && + box_fragment_.ShouldPaintCarets()) { + // Apply overflow clip if needed. + // reveal-caret-of-multiline-contenteditable.html needs this. + // TDOO(yoisn): We should share this code with |BlockPainter::Paint()| + base::Optional<ScopedPaintChunkProperties> paint_chunk_properties; + if (const auto* fragment = paint_state.FragmentToPaint()) { + if (const auto* properties = fragment->PaintProperties()) { + if (const auto* overflow_clip = properties->OverflowClip()) { + paint_chunk_properties.emplace( + paint_info.context.GetPaintController(), *overflow_clip, + *box_fragment_.GetLayoutObject(), DisplayItem::kCaret); + } + } + } + PaintCarets(paint_info, paint_offset); + } + if (ShouldPaintSelfOutline(original_phase)) { info.phase = PaintPhase::kSelfOutlineOnly; PaintObject(info, paint_offset); @@ -572,12 +595,6 @@ NGFragmentPainter(box_fragment_, GetDisplayItemClient()) .PaintOutline(paint_info, paint_offset); } - - // If the caret's node's fragment's containing block is this block, and - // the paint action is PaintPhaseForeground, then paint the caret. - if (paint_phase == PaintPhase::kForeground && - physical_box_fragment.ShouldPaintCarets()) - PaintCarets(paint_info, paint_offset); } void NGBoxFragmentPainter::PaintCarets(const PaintInfo& paint_info,
diff --git a/third_party/blink/renderer/core/paint/ng/ng_paint_fragment.cc b/third_party/blink/renderer/core/paint/ng/ng_paint_fragment.cc index f0aa6d3..aabbc25 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_paint_fragment.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_paint_fragment.cc
@@ -46,35 +46,6 @@ static_assert(sizeof(NGPaintFragment) == sizeof(SameSizeAsNGPaintFragment), "NGPaintFragment should stay small."); -LogicalRect ComputeLogicalRectFor(const PhysicalRect& physical_rect, - WritingMode writing_mode, - TextDirection text_direction, - const PhysicalSize& outer_size) { - const LogicalOffset logical_offset = physical_rect.offset.ConvertToLogical( - writing_mode, text_direction, outer_size, physical_rect.size); - const LogicalSize logical_size = - physical_rect.size.ConvertToLogical(writing_mode); - return {logical_offset, logical_size}; -} - -LogicalRect ComputeLogicalRectFor(const PhysicalRect& physical_rect, - const NGPaintFragment& paint_fragment) { - const NGPhysicalFragment& physical_fragment = - paint_fragment.PhysicalFragment(); - return physical_fragment.ConvertToLogical( - physical_rect, physical_fragment.ResolvedDirection(), physical_rect.size); -} - -LogicalRect ComputeLogicalRectFor(const PhysicalRect& physical_rect, - const NGInlineCursor& cursor) { - if (const NGPaintFragment* paint_fragment = cursor.CurrentPaintFragment()) - return ComputeLogicalRectFor(physical_rect, *paint_fragment); - - const NGFragmentItem& item = *cursor.CurrentItem(); - return ComputeLogicalRectFor(physical_rect, item.GetWritingMode(), - item.ResolvedDirection(), item.Size()); -} - LogicalRect ExpandedSelectionRectForSoftLineBreakIfNeeded( const LogicalRect& rect, const NGInlineCursor& cursor, @@ -114,7 +85,7 @@ cursor.Current().OffsetInContainerBlock(), line.Current().Size()); return ExpandSelectionRectToLineHeight( - rect, ComputeLogicalRectFor(line_physical_rect, cursor)); + rect, cursor.Current().ConvertToLogical(line_physical_rect)); } base::Optional<PositionWithAffinity> PositionForPointInChild( @@ -772,7 +743,7 @@ const LayoutSelectionStatus& selection_status) { const PhysicalRect selection_rect = cursor.CurrentLocalRect(selection_status.start, selection_status.end); - LogicalRect logical_rect = ComputeLogicalRectFor(selection_rect, cursor); + LogicalRect logical_rect = cursor.Current().ConvertToLogical(selection_rect); // Let LocalRect for line break have a space width to paint line break // when it is only character in a line or only selected in a line. if (selection_status.start != selection_status.end && @@ -801,7 +772,7 @@ const NGInlineCursor& cursor) { DCHECK(cursor.Current().GetLayoutObject()->IsLayoutReplaced()); const PhysicalRect selection_rect = PhysicalRect({}, cursor.Current().Size()); - LogicalRect logical_rect = ComputeLogicalRectFor(selection_rect, cursor); + LogicalRect logical_rect = cursor.Current().ConvertToLogical(selection_rect); const LogicalRect line_height_expanded_rect = ExpandSelectionRectToLineHeight(logical_rect, cursor); const PhysicalRect physical_rect = @@ -941,8 +912,13 @@ LayoutUnit closest_line_after_block_offset = LayoutUnit::Max(); for (const NGPaintFragment* child : Children()) { - if (!child->PhysicalFragment().IsLineBox() || child->Children().IsEmpty()) + if (!child->PhysicalFragment().IsLineBox()) continue; + if (!NGInlineCursor(*child).TryToMoveToFirstInlineLeafChild()) { + // editing/selection/last-empty-inline.html requires this to skip + // empty <span> with padding. + continue; + } const LogicalRect logical_child_rect = PhysicalFragment().ConvertToLogical( PhysicalRect(child->Offset(), child->Size()), child->Size());
diff --git a/third_party/blink/renderer/core/paint/paint_timing.cc b/third_party/blink/renderer/core/paint/paint_timing.cc index acbb9dd8..8013dc4 100644 --- a/third_party/blink/renderer/core/paint/paint_timing.cc +++ b/third_party/blink/renderer/core/paint/paint_timing.cc
@@ -280,7 +280,13 @@ void PaintTiming::SetFirstPaintAfterBackForwardCacheRestoreSwap( base::TimeTicks stamp) { - first_paint_after_back_forward_cache_restore_swap_ = stamp; + // The last element is already allocated when the page is restored from the + // cache. + size_t last_index = + first_paints_after_back_forward_cache_restore_swap_.size() - 1; + DCHECK(first_paints_after_back_forward_cache_restore_swap_[last_index] + .is_null()); + first_paints_after_back_forward_cache_restore_swap_[last_index] = stamp; NotifyPaintTimingChanged(); } @@ -293,7 +299,10 @@ } void PaintTiming::OnRestoredFromBackForwardCache() { - first_paint_after_back_forward_cache_restore_swap_ = base::TimeTicks(); + // Allocate the last element with 0, which indicates that the first paint + // after this navigation doesn't happen yet. + first_paints_after_back_forward_cache_restore_swap_.push_back( + base::TimeTicks()); RegisterNotifySwapTime(PaintEvent::kFirstPaintAfterBackForwardCacheRestore); }
diff --git a/third_party/blink/renderer/core/paint/paint_timing.h b/third_party/blink/renderer/core/paint/paint_timing.h index 6d6f4d2..0d65cc56 100644 --- a/third_party/blink/renderer/core/paint/paint_timing.h +++ b/third_party/blink/renderer/core/paint/paint_timing.h
@@ -74,8 +74,11 @@ // current document. base::TimeTicks FirstPaint() const { return first_paint_swap_; } - base::TimeTicks FirstPaintAfterBackForwardCacheRestore() const { - return first_paint_after_back_forward_cache_restore_swap_; + // Times when the first paint happens after the page is restored from the + // back-forward cache. If the element value is zero time tick, the first paint + // event did not happen for that navigation. + WTF::Vector<base::TimeTicks> FirstPaintsAfterBackForwardCacheRestore() const { + return first_paints_after_back_forward_cache_restore_swap_; } // FirstContentfulPaint returns the first time that 'contentful' content was @@ -163,7 +166,8 @@ // confirm the deltas and discrepancies look reasonable. base::TimeTicks first_paint_; base::TimeTicks first_paint_swap_; - base::TimeTicks first_paint_after_back_forward_cache_restore_swap_; + WTF::Vector<base::TimeTicks> + first_paints_after_back_forward_cache_restore_swap_; base::TimeTicks first_image_paint_; base::TimeTicks first_image_paint_swap_; base::TimeTicks first_contentful_paint_;
diff --git a/third_party/blink/renderer/core/timing/performance_timing.cc b/third_party/blink/renderer/core/timing/performance_timing.cc index 23e24f4..133d40f 100644 --- a/third_party/blink/renderer/core/timing/performance_timing.cc +++ b/third_party/blink/renderer/core/timing/performance_timing.cc
@@ -321,13 +321,31 @@ return timing->NavigationStart(); } -uint64_t PerformanceTiming::LastBackForwardCacheRestoreNavigationStart() const { - DocumentLoadTiming* timing = GetDocumentLoadTiming(); - if (!timing) - return 0; +PerformanceTiming::BackForwardCacheRestoreTimings +PerformanceTiming::BackForwardCacheRestore() const { + DocumentLoadTiming* load_timing = GetDocumentLoadTiming(); + if (!load_timing) + return {}; - return MonotonicTimeToIntegerMilliseconds( - timing->LastBackForwardCacheRestoreNavigationStart()); + const PaintTiming* paint_timing = GetPaintTiming(); + if (!paint_timing) + return {}; + + WTF::Vector<base::TimeTicks> navigation_starts = + load_timing->BackForwardCacheRestoreNavigationStarts(); + WTF::Vector<base::TimeTicks> first_paints = + paint_timing->FirstPaintsAfterBackForwardCacheRestore(); + DCHECK(navigation_starts.size() == first_paints.size()); + + WTF::Vector<BackForwardCacheRestoreTiming> restore_timings( + navigation_starts.size()); + for (size_t i = 0; i < restore_timings.size(); i++) { + restore_timings[i].navigation_start = + MonotonicTimeToIntegerMilliseconds(navigation_starts[i]); + restore_timings[i].first_paint = + MonotonicTimeToIntegerMilliseconds(first_paints[i]); + } + return restore_timings; } uint64_t PerformanceTiming::FirstPaint() const { @@ -338,15 +356,6 @@ return MonotonicTimeToIntegerMilliseconds(timing->FirstPaint()); } -uint64_t PerformanceTiming::FirstPaintAfterBackForwardCacheRestore() const { - const PaintTiming* timing = GetPaintTiming(); - if (!timing) - return 0; - - return MonotonicTimeToIntegerMilliseconds( - timing->FirstPaintAfterBackForwardCacheRestore()); -} - uint64_t PerformanceTiming::FirstImagePaint() const { const PaintTiming* timing = GetPaintTiming(); if (!timing)
diff --git a/third_party/blink/renderer/core/timing/performance_timing.h b/third_party/blink/renderer/core/timing/performance_timing.h index 830d28ce..4c559035 100644 --- a/third_party/blink/renderer/core/timing/performance_timing.h +++ b/third_party/blink/renderer/core/timing/performance_timing.h
@@ -60,6 +60,14 @@ USING_GARBAGE_COLLECTED_MIXIN(PerformanceTiming); public: + struct BackForwardCacheRestoreTiming { + uint64_t navigation_start; + uint64_t first_paint; + }; + + using BackForwardCacheRestoreTimings = + WTF::Vector<BackForwardCacheRestoreTiming>; + explicit PerformanceTiming(LocalFrame*); uint64_t navigationStart() const; @@ -92,14 +100,10 @@ // fetchStart. Intended to be used for correlation with other events internal // to blink. Not to be exposed to JavaScript. base::TimeTicks NavigationStartAsMonotonicTime() const; - // The latest navigation start time after the page is restored from - // back-forward cache. - uint64_t LastBackForwardCacheRestoreNavigationStart() const; + // The timings after the page is restored from back-forward cache. + BackForwardCacheRestoreTimings BackForwardCacheRestore() const; // The time the first paint operation was performed. uint64_t FirstPaint() const; - // The time the first paint operation was performed after the latest time when - // the page was restored from the back-forward cache. - uint64_t FirstPaintAfterBackForwardCacheRestore() const; // The time the first paint operation for image was performed. uint64_t FirstImagePaint() const; // The time of the first 'contentful' paint. A contentful paint is a paint
diff --git a/third_party/blink/renderer/modules/cache_storage/cache_storage.cc b/third_party/blink/renderer/modules/cache_storage/cache_storage.cc index a1a6bf8..eba3ca6 100644 --- a/third_party/blink/renderer/modules/cache_storage/cache_storage.cc +++ b/third_party/blink/renderer/modules/cache_storage/cache_storage.cc
@@ -51,7 +51,8 @@ MultiCacheQueryOptionsPtr output = MultiCacheQueryOptions::New(); output->query_options = std::move(query_options); - output->cache_name = input->cacheName(); + if (input->hasCacheName()) + output->cache_name = input->cacheName(); return output; } };
diff --git a/third_party/blink/renderer/modules/imagecapture/image_capture.cc b/third_party/blink/renderer/modules/imagecapture/image_capture.cc index dfc7126..1576816 100644 --- a/third_party/blink/renderer/modules/imagecapture/image_capture.cc +++ b/third_party/blink/renderer/modules/imagecapture/image_capture.cc
@@ -268,39 +268,6 @@ return promise; } -ScriptPromise ImageCapture::takePhoto(ScriptState* script_state) { - TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("video_and_image_capture"), - "ImageCapture::takePhoto", TRACE_EVENT_SCOPE_PROCESS); - auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); - ScriptPromise promise = resolver->Promise(); - - if (TrackIsInactive(*stream_track_)) { - resolver->Reject(MakeGarbageCollected<DOMException>( - DOMExceptionCode::kInvalidStateError, - "The associated Track is in an invalid state.")); - return promise; - } - if (!service_.is_bound()) { - resolver->Reject(MakeGarbageCollected<DOMException>( - DOMExceptionCode::kNotFoundError, kNoServiceError)); - return promise; - } - - service_requests_.insert(resolver); - - // m_streamTrack->component()->source()->id() is the renderer "name" of the - // camera; - // TODO(mcasas) consider sending the security origin as well: - // scriptState->getExecutionContext()->getSecurityOrigin()->toString() - TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("video_and_image_capture"), - "ImageCapture::takePhoto", TRACE_EVENT_SCOPE_PROCESS); - service_->TakePhoto( - stream_track_->Component()->Source()->Id(), - WTF::Bind(&ImageCapture::OnMojoTakePhoto, WrapPersistent(this), - WrapPersistent(resolver))); - return promise; -} - ScriptPromise ImageCapture::takePhoto(ScriptState* script_state, const PhotoSettings* photo_settings) { TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("video_and_image_capture"),
diff --git a/third_party/blink/renderer/modules/imagecapture/image_capture.h b/third_party/blink/renderer/modules/imagecapture/image_capture.h index 862b46a..7a5365b2 100644 --- a/third_party/blink/renderer/modules/imagecapture/image_capture.h +++ b/third_party/blink/renderer/modules/imagecapture/image_capture.h
@@ -69,7 +69,6 @@ const PhotoSettings*, bool trigger_take_photo = false); - ScriptPromise takePhoto(ScriptState*); ScriptPromise takePhoto(ScriptState*, const PhotoSettings*); ScriptPromise grabFrame(ScriptState*);
diff --git a/third_party/blink/renderer/modules/imagecapture/image_capture.idl b/third_party/blink/renderer/modules/imagecapture/image_capture.idl index d27b265..9f70ed6 100644 --- a/third_party/blink/renderer/modules/imagecapture/image_capture.idl +++ b/third_party/blink/renderer/modules/imagecapture/image_capture.idl
@@ -13,6 +13,6 @@ [CallWith=ScriptState] Promise<PhotoCapabilities> getPhotoCapabilities(); [CallWith=ScriptState] Promise<PhotoSettings> getPhotoSettings(); - [CallWith=ScriptState] Promise<Blob> takePhoto(optional PhotoSettings photoSettings); + [CallWith=ScriptState] Promise<Blob> takePhoto(optional PhotoSettings photoSettings = {}); [CallWith=ScriptState] Promise<ImageBitmap> grabFrame(); };
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index a5e6f6a..2cda7270 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -1396,7 +1396,9 @@ "text/web_entities.cc", "text/web_entities.h", "text/win/hyphenation_win.cc", + "text/writing_direction_mode.cc", "text/writing_direction_mode.h", + "text/writing_mode.cc", "text/writing_mode.h", "text/writing_mode_utils.h", "timer.cc",
diff --git a/third_party/blink/renderer/platform/graphics/canvas_color_params.cc b/third_party/blink/renderer/platform/graphics/canvas_color_params.cc index 6bf7541..3dc0fb19 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_color_params.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_color_params.cc
@@ -17,20 +17,22 @@ namespace { -gfx::ColorSpace::PrimaryID GetPrimaryID(CanvasColorSpace color_space) { - gfx::ColorSpace::PrimaryID primary_id = gfx::ColorSpace::PrimaryID::BT709; +// The CanvasColorSpace value definitions are specified in the CSS Color Level 4 +// specification. +gfx::ColorSpace CanvasColorSpaceToGfxColorSpace(CanvasColorSpace color_space) { switch (color_space) { case CanvasColorSpace::kSRGB: - primary_id = gfx::ColorSpace::PrimaryID::BT709; + return gfx::ColorSpace::CreateSRGB(); break; case CanvasColorSpace::kRec2020: - primary_id = gfx::ColorSpace::PrimaryID::BT2020; + return gfx::ColorSpace(gfx::ColorSpace::PrimaryID::BT2020, + gfx::ColorSpace::TransferID::GAMMA24); break; case CanvasColorSpace::kP3: - primary_id = gfx::ColorSpace::PrimaryID::SMPTEST432_1; + return gfx::ColorSpace::CreateDisplayP3D65(); break; } - return primary_id; + NOTREACHED(); } } // namespace @@ -88,50 +90,21 @@ } gfx::ColorSpace CanvasColorParams::GetSamplerGfxColorSpace() const { - gfx::ColorSpace::PrimaryID primary_id = GetPrimaryID(color_space_); - - // TODO(ccameron): This needs to take into account whether or not this texture - // will be sampled in linear or nonlinear space. - gfx::ColorSpace::TransferID transfer_id = - gfx::ColorSpace::TransferID::IEC61966_2_1; - if (pixel_format_ == CanvasPixelFormat::kF16) - transfer_id = gfx::ColorSpace::TransferID::LINEAR_HDR; - - return gfx::ColorSpace(primary_id, transfer_id); + // TODO(ccameron): If we add support for uint8srgb as a pixel format, this + // will need to take into account whether or not this texture will be sampled + // in linear or nonlinear space. + return CanvasColorSpaceToGfxColorSpace(color_space_); } gfx::ColorSpace CanvasColorParams::GetStorageGfxColorSpace() const { - gfx::ColorSpace::PrimaryID primary_id = GetPrimaryID(color_space_); - - gfx::ColorSpace::TransferID transfer_id = - gfx::ColorSpace::TransferID::IEC61966_2_1; - // Only sRGB and e-sRGB use sRGB transfer function. Other canvas color spaces, - // i.e., linear-rgb, p3 and rec2020 use linear transfer function. - if (color_space_ != CanvasColorSpace::kSRGB) - transfer_id = gfx::ColorSpace::TransferID::LINEAR_HDR; - - return gfx::ColorSpace(primary_id, transfer_id); + return CanvasColorSpaceToGfxColorSpace(color_space_); } sk_sp<SkColorSpace> CanvasColorParams::GetSkColorSpace() const { static_assert(kN32_SkColorType == kRGBA_8888_SkColorType || kN32_SkColorType == kBGRA_8888_SkColorType, "Unexpected kN32_SkColorType value."); - skcms_Matrix3x3 gamut = SkNamedGamut::kSRGB; - skcms_TransferFunction transferFn = SkNamedTransferFn::kSRGB; - switch (color_space_) { - case CanvasColorSpace::kSRGB: - break; - case CanvasColorSpace::kRec2020: - gamut = SkNamedGamut::kRec2020; - transferFn = SkNamedTransferFn::kLinear; - break; - case CanvasColorSpace::kP3: - gamut = SkNamedGamut::kDisplayP3; - transferFn = SkNamedTransferFn::kLinear; - break; - } - return SkColorSpace::MakeRGB(transferFn, gamut); + return CanvasColorSpaceToGfxColorSpace(color_space_).ToSkColorSpace(); } gfx::BufferFormat CanvasColorParams::GetBufferFormat() const { @@ -198,33 +171,29 @@ return viz::GetResourceFormat(GetBufferFormat()); } -CanvasColorParams::CanvasColorParams(const sk_sp<SkColorSpace> color_space, - SkColorType color_type) { +CanvasColorParams::CanvasColorParams(const sk_sp<SkColorSpace> sk_color_space, + SkColorType sk_color_type) { color_space_ = CanvasColorSpace::kSRGB; pixel_format_ = GetNativeCanvasPixelFormat(); - // When there is no color space information, the SkImage is in legacy mode and - // the color type is kRGBA8 canvas pixel format. - if (!color_space) - return; - // CanvasColorSpace::kSRGB covers sRGB and e-sRGB. We need to check for - // linear-rgb, rec2020 and p3. - if (SkColorSpace::Equals(color_space.get(), - SkColorSpace::MakeRGB(SkNamedTransferFn::kLinear, - SkNamedGamut::kRec2020) - .get())) { - color_space_ = CanvasColorSpace::kRec2020; - } else if (SkColorSpace::Equals( - color_space.get(), - SkColorSpace::MakeRGB(SkNamedTransferFn::kLinear, - SkNamedGamut::kDisplayP3) - .get())) { - color_space_ = CanvasColorSpace::kP3; + CanvasColorSpace color_spaces[] = { + CanvasColorSpace::kSRGB, + CanvasColorSpace::kRec2020, + CanvasColorSpace::kP3, + }; + for (const auto& color_space : color_spaces) { + if (SkColorSpace::Equals(sk_color_space.get(), + CanvasColorSpaceToGfxColorSpace(color_space) + .ToSkColorSpace() + .get())) { + color_space_ = color_space; + break; + } } - if (color_type == kRGBA_F16_SkColorType) + if (sk_color_type == kRGBA_F16_SkColorType) pixel_format_ = CanvasPixelFormat::kF16; - else if (color_type == kRGBA_8888_SkColorType) + else if (sk_color_type == kRGBA_8888_SkColorType) pixel_format_ = CanvasPixelFormat::kRGBA8; }
diff --git a/third_party/blink/renderer/platform/text/writing_direction_mode.cc b/third_party/blink/renderer/platform/text/writing_direction_mode.cc new file mode 100644 index 0000000..7a2f730 --- /dev/null +++ b/third_party/blink/renderer/platform/text/writing_direction_mode.cc
@@ -0,0 +1,15 @@ +// 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 "third_party/blink/renderer/platform/text/writing_direction_mode.h" + +namespace blink { + +std::ostream& operator<<(std::ostream& ostream, + const WritingDirectionMode& writing_direction) { + return ostream << writing_direction.GetWritingMode() << " " + << writing_direction.Direction(); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/platform/text/writing_direction_mode.h b/third_party/blink/renderer/platform/text/writing_direction_mode.h index 0b5511da..710beb7 100644 --- a/third_party/blink/renderer/platform/text/writing_direction_mode.h +++ b/third_party/blink/renderer/platform/text/writing_direction_mode.h
@@ -8,6 +8,7 @@ #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/text/text_direction.h" #include "third_party/blink/renderer/platform/text/writing_mode.h" +#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" namespace blink { @@ -55,11 +56,22 @@ // bool IsHorizontalLtr() const { return IsHorizontal() && IsLtr(); } + bool operator==(const WritingDirectionMode& other) const { + return writing_mode_ == other.writing_mode_ && + direction_ == other.direction_; + } + bool operator!=(const WritingDirectionMode& other) const { + return !operator==(other); + } + private: WritingMode writing_mode_; TextDirection direction_; }; +PLATFORM_EXPORT std::ostream& operator<<(std::ostream&, + const WritingDirectionMode&); + } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_TEXT_WRITING_DIRECTION_MODE_H_
diff --git a/third_party/blink/renderer/platform/text/writing_mode.cc b/third_party/blink/renderer/platform/text/writing_mode.cc new file mode 100644 index 0000000..9b553c7 --- /dev/null +++ b/third_party/blink/renderer/platform/text/writing_mode.cc
@@ -0,0 +1,27 @@ +// 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 "third_party/blink/renderer/platform/text/writing_mode.h" + +#include <ostream> + +namespace blink { + +std::ostream& operator<<(std::ostream& ostream, WritingMode writing_mode) { + switch (writing_mode) { + case WritingMode::kHorizontalTb: + return ostream << "horizontal-tb"; + case WritingMode::kVerticalRl: + return ostream << "vertical-rl"; + case WritingMode::kVerticalLr: + return ostream << "vertical-lr"; + case WritingMode::kSidewaysRl: + return ostream << "sideways-rl"; + case WritingMode::kSidewaysLr: + return ostream << "sideways-lr"; + } + return ostream << static_cast<unsigned>(writing_mode); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/platform/text/writing_mode.h b/third_party/blink/renderer/platform/text/writing_mode.h index 14e7de83..eead446 100644 --- a/third_party/blink/renderer/platform/text/writing_mode.h +++ b/third_party/blink/renderer/platform/text/writing_mode.h
@@ -32,6 +32,8 @@ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_TEXT_WRITING_MODE_H_ #include <cstdint> +#include <iosfwd> +#include "third_party/blink/renderer/platform/platform_export.h" namespace blink { @@ -80,6 +82,8 @@ return (a == WritingMode::kHorizontalTb) == (b == WritingMode::kHorizontalTb); } +PLATFORM_EXPORT std::ostream& operator<<(std::ostream&, WritingMode); + } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_TEXT_WRITING_MODE_H_
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 0fadec2..aac4e363 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -2232,10 +2232,6 @@ crbug.com/751952 virtual/text-antialias/international/complex-text-rectangle.html [ Timeout Pass ] crbug.com/751952 [ Win ] editing/selection/modify_extend/extend_by_character.html [ Failure Pass ] -# Websockets -# Cannot be rebaselined because the output contains a timestamp and a random number. -crbug.com/803200 external/wpt/websockets/opening-handshake/005.html?wss [ Pass Failure Timeout ] - crbug.com/805463 external/wpt/acid/acid3/numbered-tests.html [ Skip ] crbug.com/828506 [ Win ] fast/events/touch/scroll-without-mouse-lacks-mousemove-events.html [ Pass Failure ] @@ -2870,9 +2866,6 @@ crbug.com/626703 [ Linux ] external/wpt/content-dpr/content-dpr-various-elements.html [ Failure ] crbug.com/626703 [ Mac ] external/wpt/content-dpr/content-dpr-various-elements.html [ Failure ] crbug.com/626703 [ Win ] external/wpt/content-dpr/content-dpr-various-elements.html [ Failure ] -crbug.com/626703 [ Linux ] external/wpt/websockets/opening-handshake/005.html [ Timeout ] -crbug.com/626703 [ Mac ] external/wpt/websockets/opening-handshake/005.html [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/opening-handshake/005.html [ Timeout ] crbug.com/626703 [ Mac10.14 ] external/wpt/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-top-left.html [ Timeout ] crbug.com/626703 [ Linux ] external/wpt/workers/abrupt-completion.html [ Timeout ] crbug.com/626703 [ Mac ] external/wpt/workers/abrupt-completion.html [ Timeout ] @@ -4771,7 +4764,6 @@ crbug.com/1069817 fast/ruby/float-overhang-from-ruby-text.html [ Failure ] crbug.com/1069817 fast/ruby/line-break-ruby.html [ Failure ] crbug.com/1069817 fast/ruby/position-after.html [ Failure ] -crbug.com/1069817 fast/ruby/ruby-run-break.html [ Failure ] crbug.com/1069817 fast/ruby/select-ruby.html [ Failure ] crbug.com/1069817 [ Linux ] fast/writing-mode/Kusa-Makura-background-canvas.html [ Failure ] crbug.com/1069817 [ Mac ] fast/writing-mode/Kusa-Makura-background-canvas.html [ Failure ]
diff --git a/third_party/blink/web_tests/editing/deleting/replace_text_in_node_preserving_markers_crash.html b/third_party/blink/web_tests/editing/deleting/replace_text_in_node_preserving_markers_crash.html index 58b2362..8e992ec 100644 --- a/third_party/blink/web_tests/editing/deleting/replace_text_in_node_preserving_markers_crash.html +++ b/third_party/blink/web_tests/editing/deleting/replace_text_in_node_preserving_markers_crash.html
@@ -3,24 +3,20 @@ <script src="../../resources/testharnessreport.js"></script> <script src="../assert_selection.js"></script> <script> -test(() => assert_selection( - [ - // Place each character at own line - '<div contenteditable style="width: 3px;">', - 'abcd efg| hijkl', - '</div>', - ].join(''), - selection => { - // Delete " efg" - selection.document.execCommand('delete'); - selection.document.execCommand('delete'); - selection.document.execCommand('delete'); - selection.document.execCommand('delete'); - }, - [ - '<div contenteditable style="width: 3px;">', - 'abcd|hijkl', - '</div>', - ].join('')), - 'Crash test for replaceTextInNodePreservingMarkers'); +// Crash test for replaceTextInNodePreservingMarkers. +// Atempt to delete " efg" by hitting [Backspace] key four times +const samples = [ + 'abcd efg| hijkl', + 'abcd ef|hijkl', + 'abcd e|hijkl', + 'abcd |hijkl', + 'abcd|hijkl', +]; + +for (let index = 1; index < samples.length; ++index) { + selection_test( + `<div contenteditable style="width: 3px;">${samples[index - 1]}</div>`, + 'Delete', + `<div contenteditable style="width: 3px;">${samples[index]}</div>`); +} </script>
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 862212f..273f6ea 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
@@ -535,14 +535,16 @@ "html": { "canvas": { "element": { - "wide-gamut-canvas": { - "imagedata-no-color-settings-crash.html": [ - "d7fe956e4b8d99421181a714648eaf561dbab735", - [ - null, - {} + "manual": { + "wide-gamut-canvas": { + "imagedata-no-color-settings-crash.html": [ + "d7fe956e4b8d99421181a714648eaf561dbab735", + [ + null, + {} + ] ] - ] + } } } }, @@ -637,6 +639,13 @@ "scripting-1": { "the-template-element": { "template-element": { + "template-construction-in-inactive-document-crash.html": [ + "607b8b0185fe60d7e437dc464c0eda4a927c750c", + [ + null, + {} + ] + ], "template-content-in-inactive-document-crash.html": [ "66c564c77a513f9f4946e38b0729ffcd744918a9", [ @@ -778,6 +787,15 @@ ] } } + }, + "xslt": { + "invalid-output-encoding-crash.html": [ + "d84bb5b3c33fabc7fc4a27a4b9ac66e83dd56da2", + [ + null, + {} + ] + ] } }, "manual": { @@ -6641,15 +6659,6 @@ ] ] }, - "drawing-paths-to-the-canvas": { - "canvas_focus_drawFocusIfNeeded_AAPI_001-manual.html": [ - "bf38fa68b7d0bc0e51a685e0cf0a4c83f36e0419", - [ - null, - {} - ] - ] - }, "drawing-text-to-the-canvas": { "2d.text.draw.fill.basic-manual.html": [ "3652a2191d6c78d3bbf28708eb6e0959708dba86", @@ -6687,6 +6696,17 @@ ] ] }, + "manual": { + "drawing-paths-to-the-canvas": { + "canvas_focus_drawFocusIfNeeded_AAPI_001-manual.html": [ + "bf38fa68b7d0bc0e51a685e0cf0a4c83f36e0419", + [ + null, + {} + ] + ] + } + }, "shadows": { "2d.shadow.blur.high-manual.html": [ "f5acaa97bed1a6b33458470afd03e1c586fe78e6", @@ -45073,7 +45093,7 @@ "rendering": { "dark-color-scheme": { "color-scheme-change-checkbox.html": [ - "ae0dc62b7c8760862fe6c279cec425db0afac474", + "b163b4a40c5ac75b728cf312dbd50e0f48169aa7", [ null, [ @@ -45086,7 +45106,7 @@ ] ], "color-scheme-iframe-background-mismatch-alpha.html": [ - "26c58198c46b0ed2b1c6037aa0ca50ea2e059241", + "bab634cfda765536a4b428146ff64a63cac851a9", [ null, [ @@ -45099,7 +45119,7 @@ ] ], "color-scheme-iframe-background-mismatch-opaque.html": [ - "9e39c0b82769964dce205448775ae4c2c01dc51d", + "d984fdd245f8da340eaee3aa87bbcdef1f15e2e2", [ null, [ @@ -45112,7 +45132,7 @@ ] ], "color-scheme-iframe-background.html": [ - "591044f61803be793e15987a15d1561f5a3088f9", + "caef99cf2d983d91fbe9e2ce7e8a801aa9245bd8", [ null, [ @@ -45125,7 +45145,7 @@ ] ], "color-scheme-visited-link-initial.html": [ - "ba8f10cf23832d986601926abfbd5cf33e9847ce", + "6412acdb9f138d5e37947c8e3113837664392826", [ null, [ @@ -56153,6 +56173,19 @@ {} ] ], + "table-with-float-paint.html": [ + "da78a0a576b375a85f7f63ce97093e9ab90e614b", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square-only.html", + "==" + ] + ], + {} + ] + ], "table-with-infinite-max-intrinsic-width.html": [ "7f4a4645f339e27eacabf8cfae3a9f791ef06ddc", [ @@ -68308,6 +68341,19 @@ {} ] ], + "list-style-image-zoom-dynamic.html": [ + "d0cd9de0aa74e9de24a19834e173f839c3879421", + [ + null, + [ + [ + "/css/css-lists/list-style-image-zoom-dynamic-ref.html", + "==" + ] + ], + {} + ] + ], "list-style-type-string-001a.html": [ "f7ed6e3b342d6cd259b3df61a5445f83ab39b0f9", [ @@ -82128,6 +82174,84 @@ }, "css-sizing": { "aspect-ratio": { + "abspos-001.tentative.html": [ + "e18a0a7c81dbef1b2526793bac31ab6640b33dd7", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], + "abspos-002.tentative.html": [ + "2e14ff3fb9b36f4399ede17d42c90b1bf8dc0329", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], + "abspos-003.tentative.html": [ + "f8602af9fd5a186694067fa814f14e8b36d4c057", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], + "abspos-004.tentative.html": [ + "b7685f1db3836e6785aad5a70dbcff217655ac48", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], + "abspos-005.tentative.html": [ + "a0eaf8c2859fc3c11d1f8bae2e45e1bac46bc788", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], + "abspos-006.tentative.html": [ + "8c9f16f571485d1cfe286fbff91f45cd73c343f7", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], "auto-margins-001.tentative.html": [ "9e89ab6ca7f5220ea030aa537bcb3b64f156043d", [ @@ -98276,7 +98400,59 @@ {} ] ], - "backface-visibility-hidden-animated.html": [ + "backface-visibility-hidden-002.tentative.html": [ + "d30ba64ebb867833f4d93912ac27abb29b416b71", + [ + null, + [ + [ + "/css/css-transforms/backface-visibility-hidden-002-ref.html", + "==" + ] + ], + {} + ] + ], + "backface-visibility-hidden-003.tentative.html": [ + "d104662b26eeb982aa98efd3482774fc4cb3c1d1", + [ + null, + [ + [ + "/css/css-transforms/backface-visibility-hidden-003-ref.html", + "==" + ] + ], + {} + ] + ], + "backface-visibility-hidden-004.tentative.html": [ + "1fb3fffd3d1de3ed55e8b18d21d23e0f47fcdeef", + [ + null, + [ + [ + "/css/css-transforms/backface-visibility-hidden-004-ref.html", + "==" + ] + ], + {} + ] + ], + "backface-visibility-hidden-005.tentative.html": [ + "d53ee1c606f01a70a9f864e648b2b8ffc0ec960a", + [ + null, + [ + [ + "/css/css-transforms/backface-visibility-hidden-005-ref.html", + "==" + ] + ], + {} + ] + ], + "backface-visibility-hidden-animated-001.html": [ "6cdefad6620eef19e3bb61f2b590cbc4597e76c9", [ null, @@ -98289,8 +98465,21 @@ {} ] ], + "backface-visibility-hidden-animated-002.html": [ + "107b79946de4f7930c6776e03060295763369fc4", + [ + null, + [ + [ + "/css/css-transforms/backface-visibility-hidden-004-ref.html", + "==" + ] + ], + {} + ] + ], "composited-under-rotateY-180deg-clip-perspective.html": [ - "c694adf71d16cdfe365756ae05ec1818c61c9a32", + "71b2fd1cb4facf8f4a1d1f6ba6a684792b7d4ba5", [ null, [ @@ -137852,241 +138041,327 @@ }, "canvas": { "element": { - "building-paths": { - "canvas_complexshapes_arcto_001.htm": [ - "c3f2fb6f436da59d43aeda0a7e8a018084557033", - [ - null, + "manual": { + "building-paths": { + "canvas_complexshapes_arcto_001.htm": [ + "c3f2fb6f436da59d43aeda0a7e8a018084557033", [ + null, [ - "/html/canvas/element/building-paths/canvas_complexshapes_arcto_001-ref.htm", - "==" - ] - ], - {} + [ + "/html/canvas/element/manual/building-paths/canvas_complexshapes_arcto_001-ref.htm", + "==" + ] + ], + {} + ] + ], + "canvas_complexshapes_beziercurveto_001.htm": [ + "d04926ebaca2eefae7c9216d26fda5161ef6ec51", + [ + null, + [ + [ + "/html/canvas/element/manual/building-paths/canvas_complexshapes_beziercurveto_001-ref.htm", + "==" + ] + ], + {} + ] ] - ], - "canvas_complexshapes_beziercurveto_001.htm": [ - "d04926ebaca2eefae7c9216d26fda5161ef6ec51", - [ - null, + }, + "compositing": { + "canvas_compositing_globalcompositeoperation_001.htm": [ + "8d6208eb32ec31580cfc50cfa2a7680b3ce836a8", [ + null, [ - "/html/canvas/element/building-paths/canvas_complexshapes_beziercurveto_001-ref.htm", - "==" - ] - ], - {} + [ + "/html/canvas/element/manual/compositing/canvas_compositing_globalcompositeoperation_001-ref.htm", + "==" + ] + ], + {} + ] ] - ] - }, - "compositing": { - "canvas_compositing_globalcompositeoperation_001.htm": [ - "8d6208eb32ec31580cfc50cfa2a7680b3ce836a8", - [ - null, - [ - [ - "/html/canvas/element/compositing/canvas_compositing_globalcompositeoperation_001-ref.htm", - "==" - ] - ], - {} - ] - ] - }, - "drawing-images-to-the-canvas": { - "drawimage_canvas_self.html": [ - "83cf53583ce12716fec3bef5ce483efc4506bfbb", - [ - null, - [ - [ - "/html/canvas/element/drawing-images-to-the-canvas/drawimage_canvas_self_ref.html", - "==" - ] - ], - {} - ] - ], - "image-orientation": { - "drawImage-from-bitmap-orientation-none.tentative.html": [ - "46ce92e3e05c33c2a1ebca7d7fff1edf97d4cde4", + }, + "drawing-images-to-the-canvas": { + "drawimage_canvas_self.html": [ + "83cf53583ce12716fec3bef5ce483efc4506bfbb", [ null, [ [ - "/html/canvas/element/drawing-images-to-the-canvas/image-orientation/reference/drawImage-from-bitmap-orientation-none-ref.html", + "/html/canvas/element/manual/drawing-images-to-the-canvas/drawimage_canvas_self_ref.html", "==" ] ], {} ] ], - "drawImage-from-bitmap-swap-width-height-orientation-none.tentative.html": [ - "efa3d90dbc33f80d16d9405fc58405390ab22182", - [ - null, + "image-orientation": { + "drawImage-from-bitmap-orientation-none.tentative.html": [ + "39ed4a25dcf3e90a3d68ed502f017b5fe605316f", [ + null, [ - "/html/canvas/element/drawing-images-to-the-canvas/image-orientation/reference/drawImage-from-bitmap-swap-width-height-orientation-none-ref.html", - "==" - ] - ], - {} - ] - ], - "drawImage-from-bitmap-swap-width-height.tentative.html": [ - "eabca5faef37a865b9e854f5c25dfbd261c06b46", - [ - null, - [ - [ - "/html/canvas/element/drawing-images-to-the-canvas/image-orientation/reference/drawImage-from-bitmap-swap-width-height-ref.html", - "==" - ] - ], - {} - ] - ], - "drawImage-from-bitmap.tentative.html": [ - "641d0ccca9e74f88b21b64d9ab551ce60e8703e0", - [ - null, - [ - [ - "/html/canvas/element/drawing-images-to-the-canvas/image-orientation/reference/drawImage-from-bitmap-ref.html", - "==" - ] - ], - {} - ] - ], - "drawImage-from-blob.tentative.html": [ - "e84fce715f12715adcd85129155cd1c22c4fbd48", - [ - null, - [ - [ - "/html/canvas/element/drawing-images-to-the-canvas/image-orientation/reference/drawImage-from-blob-ref.html", - "==" - ] - ], - {} - ] - ], - "drawImage-from-element-orientation-none.tentative.html": [ - "d771ee66781f377795e52140a6877f5b599f8b1e", - [ - null, - [ - [ - "/html/canvas/element/drawing-images-to-the-canvas/image-orientation/reference/drawImage-from-element-orientation-none-ref.html", - "==" - ] - ], - {} - ] - ], - "drawImage-from-element-swap-width-height-orientation-none.tentative.html": [ - "ede43989cd02f0b6fd3a6b0820601aa715a8bdbe", - [ - null, - [ - [ - "/html/canvas/element/drawing-images-to-the-canvas/image-orientation/reference/drawImage-from-element-swap-width-height-orientation-none-ref.html", - "==" - ] - ], - {} - ] - ], - "drawImage-from-element-swap-width-height.tentative.html": [ - "6fe69bd4601e4733ed266dff5f7aa453b76e0f54", - [ - null, - [ - [ - "/html/canvas/element/drawing-images-to-the-canvas/image-orientation/reference/drawImage-from-element-swap-width-height-ref.html", - "==" - ] - ], - {} - ] - ], - "drawImage-from-element.tentative.html": [ - "01c8bc575e948a082691b39e4a521967c1146acf", - [ - null, - [ - [ - "/html/canvas/element/drawing-images-to-the-canvas/image-orientation/reference/drawImage-from-element-ref.html", - "==" - ] - ], - {} - ] - ], - "drawImage-with-src-rect.tentative.html": [ - "47d1f8b431b0072b8615ce85ca631a3bd5864698", - [ - null, - [ - [ - "/html/canvas/element/drawing-images-to-the-canvas/image-orientation/reference/drawImage-with-src-rect-ref.html", - "==" - ] - ], - { - "fuzzy": [ [ - null, + "/html/canvas/element/manual/drawing-images-to-the-canvas/image-orientation/drawImage-from-bitmap-orientation-none-ref.html", + "==" + ] + ], + {} + ] + ], + "drawImage-from-bitmap-swap-width-height-orientation-none.tentative.html": [ + "3b16241c97c66cd02457f6e232ca7a5aa87cd286", + [ + null, + [ + [ + "/html/canvas/element/manual/drawing-images-to-the-canvas/image-orientation/drawImage-from-bitmap-swap-width-height-orientation-none-ref.html", + "==" + ] + ], + {} + ] + ], + "drawImage-from-bitmap-swap-width-height.tentative.html": [ + "744ca54f479035ddf32c36a6814a8b57b67281fe", + [ + null, + [ + [ + "/html/canvas/element/manual/drawing-images-to-the-canvas/image-orientation/drawImage-from-bitmap-swap-width-height-ref.html", + "==" + ] + ], + {} + ] + ], + "drawImage-from-bitmap.tentative.html": [ + "632a170b88f54b13f96bf1adb7c46fdc30b2d4fd", + [ + null, + [ + [ + "/html/canvas/element/manual/drawing-images-to-the-canvas/image-orientation/drawImage-from-bitmap-ref.html", + "==" + ] + ], + {} + ] + ], + "drawImage-from-blob.tentative.html": [ + "330b3cbfe5c7448fe2ab50538ce7f9bbf0e49f6d", + [ + null, + [ + [ + "/html/canvas/element/manual/drawing-images-to-the-canvas/image-orientation/drawImage-from-blob-ref.html", + "==" + ] + ], + {} + ] + ], + "drawImage-from-element-orientation-none.tentative.html": [ + "61563da738778f11d9507515b3fd346adfd95689", + [ + null, + [ + [ + "/html/canvas/element/manual/drawing-images-to-the-canvas/image-orientation/drawImage-from-element-orientation-none-ref.html", + "==" + ] + ], + {} + ] + ], + "drawImage-from-element-swap-width-height-orientation-none.tentative.html": [ + "290d7acf3a7843688d7802f4f0511049b24fc08f", + [ + null, + [ + [ + "/html/canvas/element/manual/drawing-images-to-the-canvas/image-orientation/drawImage-from-element-swap-width-height-orientation-none-ref.html", + "==" + ] + ], + {} + ] + ], + "drawImage-from-element-swap-width-height.tentative.html": [ + "20d59358b45324c9a83c253064238e8e4ee552fd", + [ + null, + [ + [ + "/html/canvas/element/manual/drawing-images-to-the-canvas/image-orientation/drawImage-from-element-swap-width-height-ref.html", + "==" + ] + ], + {} + ] + ], + "drawImage-from-element.tentative.html": [ + "62cdf20c79805f9dbd57580c1f11d5dcbdf54a44", + [ + null, + [ + [ + "/html/canvas/element/manual/drawing-images-to-the-canvas/image-orientation/drawImage-from-element-ref.html", + "==" + ] + ], + {} + ] + ], + "drawImage-with-src-rect.tentative.html": [ + "d9d5646aa7460a82c522f8d2aff420310295f761", + [ + null, + [ + [ + "/html/canvas/element/manual/drawing-images-to-the-canvas/image-orientation/drawImage-with-src-rect-ref.html", + "==" + ] + ], + { + "fuzzy": [ [ + null, [ - 30, - 30 - ], - [ - 100, - 100 + [ + 30, + 30 + ], + [ + 100, + 100 + ] ] ] ] + } + ] + ] + } + }, + "line-styles": { + "canvas_linestyles_linecap_001.htm": [ + "583dbc9d134682a778569877e38513e07736dd82", + [ + null, + [ + [ + "/html/canvas/element/manual/line-styles/canvas_linestyles_linecap_001-ref.htm", + "==" ] - } + ], + {} + ] + ], + "lineto_a.html": [ + "7e692f937d375fe517523a64444ef36f5186f164", + [ + null, + [ + [ + "/html/canvas/element/manual/line-styles/lineto_ref.html", + "==" + ] + ], + {} ] ] - } - }, - "line-styles": { - "canvas_linestyles_linecap_001.htm": [ - "583dbc9d134682a778569877e38513e07736dd82", - [ - null, + }, + "shadows": { + "canvas_shadows_002.htm": [ + "908fffea13bfac5a5cd40413797928848cd34dcf", [ + null, [ - "/html/canvas/element/line-styles/canvas_linestyles_linecap_001-ref.htm", - "==" - ] - ], - {} + [ + "/html/canvas/element/manual/shadows/canvas_shadows_002-ref.htm", + "==" + ] + ], + {} + ] ] - ], - "lineto_a.html": [ - "7e692f937d375fe517523a64444ef36f5186f164", - [ - null, + }, + "text-styles": { + "canvas_text_font_001.htm": [ + "923ce71c077c99e61678f1b97759f871324eba03", [ + null, [ - "/html/canvas/element/line-styles/lineto_ref.html", - "==" - ] - ], - {} + [ + "/html/canvas/element/manual/text-styles/canvas_text_font_001-ref.htm", + "==" + ] + ], + {} + ] ] - ] - }, - "manual": { + }, + "the-canvas-state": { + "canvas_state_restore_001.htm": [ + "6d5a3cb20f63ae13366c1b1cdb7bc0efb203ad03", + [ + null, + [ + [ + "/html/canvas/element/manual/the-canvas-state/canvas_state_restore_001-ref.htm", + "==" + ] + ], + {} + ] + ] + }, + "transformations": { + "canvas_transformations_reset_001.html": [ + "c12acbf6f347a9a1a447e356b9ab47c5e51d4109", + [ + null, + [ + [ + "/html/canvas/element/manual/transformations/canvas_transformations_reset_001-ref.html", + "==" + ] + ], + {} + ] + ], + "canvas_transformations_scale_001.htm": [ + "73f71351ea21b19aabbb5ce970d04b4e8ad61057", + [ + null, + [ + [ + "/html/canvas/element/manual/transformations/canvas_transformations_scale_001-ref.htm", + "==" + ] + ], + {} + ] + ], + "transform_a.html": [ + "8c1f59efdafda37b8b2cb1cbbed20b43bc267fa5", + [ + null, + [ + [ + "/html/canvas/element/manual/transformations/transform_ref.html", + "==" + ] + ], + {} + ] + ] + }, "unclosed-canvas-1.htm": [ "5e0c914755b672ae3427f2e433120176494bebf0", [ @@ -138139,92 +138414,6 @@ {} ] ] - }, - "shadows": { - "canvas_shadows_002.htm": [ - "908fffea13bfac5a5cd40413797928848cd34dcf", - [ - null, - [ - [ - "/html/canvas/element/shadows/canvas_shadows_002-ref.htm", - "==" - ] - ], - {} - ] - ] - }, - "text-styles": { - "canvas_text_font_001.htm": [ - "923ce71c077c99e61678f1b97759f871324eba03", - [ - null, - [ - [ - "/html/canvas/element/text-styles/canvas_text_font_001-ref.htm", - "==" - ] - ], - {} - ] - ] - }, - "the-canvas-state": { - "canvas_state_restore_001.htm": [ - "6d5a3cb20f63ae13366c1b1cdb7bc0efb203ad03", - [ - null, - [ - [ - "/html/canvas/element/the-canvas-state/canvas_state_restore_001-ref.htm", - "==" - ] - ], - {} - ] - ] - }, - "transformations": { - "canvas_transformations_reset_001.html": [ - "c12acbf6f347a9a1a447e356b9ab47c5e51d4109", - [ - null, - [ - [ - "/html/canvas/element/transformations/canvas_transformations_reset_001-ref.html", - "==" - ] - ], - {} - ] - ], - "canvas_transformations_scale_001.htm": [ - "73f71351ea21b19aabbb5ce970d04b4e8ad61057", - [ - null, - [ - [ - "/html/canvas/element/transformations/canvas_transformations_scale_001-ref.htm", - "==" - ] - ], - {} - ] - ], - "transform_a.html": [ - "8c1f59efdafda37b8b2cb1cbbed20b43bc267fa5", - [ - null, - [ - [ - "/html/canvas/element/transformations/transform_ref.html", - "==" - ] - ], - {} - ] - ] } } }, @@ -163250,10 +163439,6 @@ [] ], "support": { - "assert-preferred-dark.css": [ - "73671b8a819ed81958b4359a1a3904f86cc98ec6", - [] - ], "dark-frame-alpha.html": [ "cb5e6d66917e4ca061e14a6539e333fb44b2e51a", [] @@ -174457,6 +174642,10 @@ "ae6486147e28502db80f6b887b1a6b16c30184f2", [] ], + "list-style-image-zoom-dynamic-ref.html": [ + "9c4d876c4ad8a189f83abc26059744315c66dc3c", + [] + ], "list-style-type-string-001-ref.html": [ "0d1b1362873483fa1b900e2da3efe603648f791e", [] @@ -182199,6 +182388,22 @@ [] ] }, + "backface-visibility-hidden-002-ref.html": [ + "eab3c4e38b1e832502db2607795caff395caaaed", + [] + ], + "backface-visibility-hidden-003-ref.html": [ + "7dab6b947fb6bf1d927e659fcacce87d8d4fa23e", + [] + ], + "backface-visibility-hidden-004-ref.html": [ + "94c1fc496afb447d6d592e36e85b3445266379d5", + [] + ], + "backface-visibility-hidden-005-ref.html": [ + "bba35ec8fe659eb0a640ca874b454b70ce7531b2", + [] + ], "backface-visibility-hidden-animated-ref.html": [ "3441050a59dd521aa2ad061ea514c8a4e90dc244", [] @@ -183439,6 +183644,10 @@ ] }, "css-transitions": { + "CSSTransition-currentTime.tentative-expected.txt": [ + "52ee69a31249643d3f2d71a4e32b5db53d04485c", + [] + ], "CSSTransition-effect.tentative-expected.txt": [ "e796389bc7886b59067991fcb766836d47cdc19f", [] @@ -183448,7 +183657,7 @@ [] ], "KeyframeEffect-setKeyframes.tentative-expected.txt": [ - "f45b2f68dac9f201a01d779515d4bf6ec66f07c4", + "e06830962a0c385d63018988636bc29edfc171cb", [] ], "META.yml": [ @@ -184062,7 +184271,7 @@ [] ], "appearance-cssom-001-expected.txt": [ - "3c5f1f08b844f2915f1acad7cf75a879d7f605a4", + "e6323a681b5d0ccababe5b1ebdc9c837dd7c61de", [] ], "appearance-revert-ref.html": [ @@ -199596,16 +199805,6 @@ "4a8d81e7c22f31106b942882767350cdd9397d5d", [] ], - "building-paths": { - "canvas_complexshapes_arcto_001-ref.htm": [ - "31ddfcafd9d1e4ba0c29b4297d7f2050f5cc8435", - [] - ], - "canvas_complexshapes_beziercurveto_001-ref.htm": [ - "6be08c0b3c8378cf73e2d115f44b5a46529ddb27", - [] - ] - }, "clear-100x50.png": [ "eeedd0ff05889ffd4468bf19a2e8e9e0a094201c", [] @@ -199866,10 +200065,6 @@ "2d.composite.uncovered.pattern.source-out.png": [ "eeedd0ff05889ffd4468bf19a2e8e9e0a094201c", [] - ], - "canvas_compositing_globalcompositeoperation_001-ref.htm": [ - "70196fb36ae7770d78bd40b905912c0aa32048e7", - [] ] }, "conformance-requirements": { @@ -199886,55 +200081,7 @@ "2d.drawImage.zerosource.image-expected.txt": [ "bbb09e3b2bbc6c66ebc0cc922d19eea8f893be12", [] - ], - "drawimage_canvas_self_ref.html": [ - "9f297cacdcd81bef7093f79ebed6992110dab4d7", - [] - ], - "image-orientation": { - "reference": { - "drawImage-from-bitmap-orientation-none-ref.html": [ - "320a9b81082bcb7e547b2538bc624355c646ac11", - [] - ], - "drawImage-from-bitmap-ref.html": [ - "261d6a0b7c18bfef11ab80b9ce993f065edb4e5a", - [] - ], - "drawImage-from-bitmap-swap-width-height-orientation-none-ref.html": [ - "3a78aad068701f5726b229a70cd53e9d15040dd6", - [] - ], - "drawImage-from-bitmap-swap-width-height-ref.html": [ - "247d7f404931587acb1b5e9c7ebd374f778708bb", - [] - ], - "drawImage-from-blob-ref.html": [ - "2bd6037835406fb2ecb2f3efdade315aa802ac64", - [] - ], - "drawImage-from-element-orientation-none-ref.html": [ - "b847b9eb731865942fa4e3cf997f9a57538dafbd", - [] - ], - "drawImage-from-element-ref.html": [ - "3f4d1e5ff42241e94513a3ecb6136ee4f34a7478", - [] - ], - "drawImage-from-element-swap-width-height-orientation-none-ref.html": [ - "b26154b40a4556ad6bbe2ec60d7d7c9136a2e01e", - [] - ], - "drawImage-from-element-swap-width-height-ref.html": [ - "21f0f88b881d748c8a22986caf2f78b770c80c76", - [] - ], - "drawImage-with-src-rect-ref.html": [ - "19ffcc39c96aecdd212a9f8ca4023e62c91dff2b", - [] - ] - } - } + ] }, "drawing-text-to-the-canvas": { "2d.text.draw.fill.basic.png": [ @@ -200312,31 +200459,131 @@ [] ] }, - "imagebitmap": { - "common.sub.js": [ - "aa1e382a2088fee541a1020a03a4299a3b18d6cd", - [] - ], - "createImageBitmap-worker.js": [ - "67a0904e479323e4a159937f49919580109fbc61", - [] - ], - "transfer-worker.js": [ - "55465a899ca27d5202dfa796ec5200bde845892b", - [] - ] - }, - "line-styles": { - "canvas_linestyles_linecap_001-ref.htm": [ - "f85af9aab2e509416e5105323c82b7bb8da28277", - [] - ], - "lineto_ref.html": [ - "3dc78ff80463c99f712013109b5d3da2ecb319b4", - [] - ] - }, "manual": { + "README.md": [ + "68d877200bdc538e0845683491ed17db282d4789", + [] + ], + "building-paths": { + "canvas_complexshapes_arcto_001-ref.htm": [ + "31ddfcafd9d1e4ba0c29b4297d7f2050f5cc8435", + [] + ], + "canvas_complexshapes_beziercurveto_001-ref.htm": [ + "6be08c0b3c8378cf73e2d115f44b5a46529ddb27", + [] + ] + }, + "compositing": { + "canvas_compositing_globalcompositeoperation_001-ref.htm": [ + "70196fb36ae7770d78bd40b905912c0aa32048e7", + [] + ] + }, + "drawing-images-to-the-canvas": { + "drawimage_canvas_self_ref.html": [ + "9f297cacdcd81bef7093f79ebed6992110dab4d7", + [] + ], + "image-orientation": { + "drawImage-from-bitmap-orientation-none-ref.html": [ + "320a9b81082bcb7e547b2538bc624355c646ac11", + [] + ], + "drawImage-from-bitmap-ref.html": [ + "261d6a0b7c18bfef11ab80b9ce993f065edb4e5a", + [] + ], + "drawImage-from-bitmap-swap-width-height-orientation-none-ref.html": [ + "3a78aad068701f5726b229a70cd53e9d15040dd6", + [] + ], + "drawImage-from-bitmap-swap-width-height-ref.html": [ + "247d7f404931587acb1b5e9c7ebd374f778708bb", + [] + ], + "drawImage-from-blob-ref.html": [ + "2bd6037835406fb2ecb2f3efdade315aa802ac64", + [] + ], + "drawImage-from-element-orientation-none-ref.html": [ + "b847b9eb731865942fa4e3cf997f9a57538dafbd", + [] + ], + "drawImage-from-element-ref.html": [ + "3f4d1e5ff42241e94513a3ecb6136ee4f34a7478", + [] + ], + "drawImage-from-element-swap-width-height-orientation-none-ref.html": [ + "b26154b40a4556ad6bbe2ec60d7d7c9136a2e01e", + [] + ], + "drawImage-from-element-swap-width-height-ref.html": [ + "21f0f88b881d748c8a22986caf2f78b770c80c76", + [] + ], + "drawImage-with-src-rect-ref.html": [ + "19ffcc39c96aecdd212a9f8ca4023e62c91dff2b", + [] + ] + } + }, + "imagebitmap": { + "common.sub.js": [ + "aa1e382a2088fee541a1020a03a4299a3b18d6cd", + [] + ], + "createImageBitmap-worker.js": [ + "67a0904e479323e4a159937f49919580109fbc61", + [] + ], + "transfer-worker.js": [ + "55465a899ca27d5202dfa796ec5200bde845892b", + [] + ] + }, + "line-styles": { + "canvas_linestyles_linecap_001-ref.htm": [ + "f85af9aab2e509416e5105323c82b7bb8da28277", + [] + ], + "lineto_ref.html": [ + "3dc78ff80463c99f712013109b5d3da2ecb319b4", + [] + ] + }, + "shadows": { + "canvas_shadows_002-ref.htm": [ + "0658be808eb9ac1bb69c0e6ab46a1ab72d88b7fc", + [] + ] + }, + "text-styles": { + "canvas_text_font_001-ref.htm": [ + "1a19757e001541f72bf375bd49c595d5a6ce85b0", + [] + ] + }, + "the-canvas-state": { + "canvas_state_restore_001-ref.htm": [ + "aee610d2ec8a8e699d474ef940d2c2a3d52a01b0", + [] + ] + }, + "transformations": { + "canvas_transformations_reset_001-ref.html": [ + "caeea04cef497d6ef8de0c38c84416b35d3d824d", + [] + ], + "canvas_transformations_scale_001-ref.htm": [ + "1201bcca9f818ad678b8a7e363c30d11d6225168", + [] + ], + "transform_ref.html": [ + "2a166c36ce401cc125e4e8981185d8fa39696207", + [] + ] + }, "unclosed-canvas-1-expected.htm": [ "3272f32fb88030747608ce4b794a5bdbeeda5634", [] @@ -200352,7 +200599,193 @@ "unclosed-canvas-4-expected.htm": [ "492449261e722ebaa78196db579656d9b0ec5a34", [] - ] + ], + "wide-gamut-canvas": { + "resources": { + "pattern-semitransparent-p3d65.png": [ + "5eb3f6a15f01a123cb793e7311b50de30a5af31e", + [] + ], + "pattern-semitransparent-rec2020.png": [ + "b64db073791ddbf0ea8188247d1160921753a413", + [] + ], + "pattern-semitransparent-srgb.png": [ + "bfbba8b8e296fe354db953bc9888cd19888ca2d3", + [] + ], + "pattern-srgb-fullcolor.ogv": [ + "43a72bf271be679a932b69a5c2304d8fe547d22e", + [] + ], + "pattern-srgb-transparent.bmp": [ + "9c9561c70464eed928e288f27163c47c1a914977", + [] + ], + "pattern-srgb-transparent.ico": [ + "87e8ff45de76e30bfec9489689830b348ef48903", + [] + ], + "pattern-srgb-transparent.png": [ + "bfbba8b8e296fe354db953bc9888cd19888ca2d3", + [] + ], + "pattern-srgb-transparent.webp": [ + "925646067ad079facaaf2d03481e36eadeb25b6f", + [] + ], + "pattern-srgb.bmp": [ + "465d203d98bf3dcce2fef2f416a1e5b3d2795319", + [] + ], + "pattern-srgb.gif": [ + "25bcefb2bf4be178ae65d4c8391d8a49328e6a14", + [] + ], + "pattern-srgb.ico": [ + "e5375826abdf4616b00349946b5892e34fb630dd", + [] + ], + "pattern-srgb.jpg": [ + "c4579e8f0625719cf61808500c73b3fbe0f95832", + [] + ], + "pattern-srgb.png": [ + "1b5876b5f39954f7ca0b18fae63e2be46e8ce100", + [] + ], + "pattern-srgb.svg": [ + "05171308494195082758b4be205b2c297b968efe", + [] + ], + "pattern-srgb.webp": [ + "b7c0a421dcbc5a4f7ea92306c0f5305d28f04eea", + [] + ], + "png-16bit": { + "2x2_16bit_AdobeRGB_opaque.png": [ + "c4496db19bf4d0d410256ff7e3ba5add0a65d19e", + [] + ], + "2x2_16bit_AdobeRGB_transparent.png": [ + "3b4cfda52c506f9aba9aed6d1e96c1eda2a35f71", + [] + ], + "2x2_16bit_DisplayP3_opaque.png": [ + "e7a142cd2e1481796cebe980b33e8bf9004a5b4d", + [] + ], + "2x2_16bit_DisplayP3_transparent.png": [ + "0b035317c81c4292336c46067eb4e01239059b48", + [] + ], + "2x2_16bit_ProPhoto_opaque.png": [ + "a1dc7ddb0de09ff41dc026aaa9e2a3bf998d229a", + [] + ], + "2x2_16bit_ProPhoto_transparent.png": [ + "be2eb1208e1018d8f293acf71cc6aca51a7cdbc1", + [] + ], + "2x2_16bit_Rec2020_opaque.png": [ + "e2a2d1445187855e5a704ab286867e92ad10b390", + [] + ], + "2x2_16bit_Rec2020_transparent.png": [ + "960d7d8e75dc775c8934029a64a4d146c7761c9e", + [] + ], + "2x2_16bit_interlaced_AdobeRGB_opaque.png": [ + "80cf9785eb0956a2930e19d17ca2347a94b049ff", + [] + ], + "2x2_16bit_interlaced_AdobeRGB_transparent.png": [ + "3ec565f8c29a8a6745c2410d2160e63af9973776", + [] + ], + "2x2_16bit_interlaced_DisplayP3_opaque.png": [ + "5f3134b79cf29e53940e98e166b5cc1a0fb2cb37", + [] + ], + "2x2_16bit_interlaced_DisplayP3_transparent.png": [ + "500a70eff859e7c92f12d08f028cc9dd8c3c884c", + [] + ], + "2x2_16bit_interlaced_ProPhoto_opaque.png": [ + "b5d0e07a7a44a17f7b70fc3c02baa253747304dc", + [] + ], + "2x2_16bit_interlaced_ProPhoto_transparent.png": [ + "e4ec3e44549e01db00d80c0148eff2a5f9848994", + [] + ], + "2x2_16bit_interlaced_Rec2020_opaque.png": [ + "c487d5846f8ef01b80cb16992aa127ff705131bb", + [] + ], + "2x2_16bit_interlaced_Rec2020_transparent.png": [ + "78fe202c0e49244aba855db499d4ac22d23fe6d6", + [] + ], + "2x2_16bit_interlaced_sRGB_opaque.png": [ + "babf232a369205380dd3052a52fab6e173fafb29", + [] + ], + "2x2_16bit_interlaced_sRGB_transparent.png": [ + "30164040096e0f466bba2c742980340ec6f8ddad", + [] + ], + "2x2_16bit_sRGB_opaque.png": [ + "8a665345e9c27cf4c35eb8621bae7219647c20ce", + [] + ], + "2x2_16bit_sRGB_transparent.png": [ + "e51cda77c40f63f8913aa53f40c070a055e493b2", + [] + ], + "2x2_8bit_AdobeRGB_opaque.png": [ + "8b787b5c8729ad2a7a11454aee3ad8195d4c3fc8", + [] + ], + "2x2_8bit_AdobeRGB_transparent.png": [ + "727028e7656b9b9650716ea1f26560f773bf23b7", + [] + ], + "2x2_8bit_DisplayP3_opaque.png": [ + "fe8bdd4963712dd87a4e9d541c1765472c452f7d", + [] + ], + "2x2_8bit_DisplayP3_transparent.png": [ + "b836afebed3208ef181e881e9f3c813f899fbb28", + [] + ], + "2x2_8bit_ProPhoto_opaque.png": [ + "5ecd8686065930ddfb245a2114986546725b3437", + [] + ], + "2x2_8bit_ProPhoto_transparent.png": [ + "85a349dc1d169e22bb0b3ef33c8383526ca51c0d", + [] + ], + "2x2_8bit_Rec2020_opaque.png": [ + "599cd34040e03a0a8a255a9b41f76b8239f2d6ef", + [] + ], + "2x2_8bit_Rec2020_transparent.png": [ + "ecf65c3d460361a7c5d9bdc7be833f3cf217475e", + [] + ], + "2x2_8bit_sRGB_opaque.png": [ + "9cab6d12e6e6dd7e9cc52eb47aaae7ee105b4b09", + [] + ], + "2x2_8bit_sRGB_transparent.png": [ + "5fa01e62c2007b940baace6fe92c34413128f7a9", + [] + ] + } + } + } }, "path-objects": { "2d.path.fill.overlap.png": [ @@ -200430,10 +200863,6 @@ "2d.shadow.pattern.alpha.png": [ "8764e89b371d41428f0ba45d9c0391e41b0dd8a2", [] - ], - "canvas_shadows_002-ref.htm": [ - "0658be808eb9ac1bb69c0e6ab46a1ab72d88b7fc", - [] ] }, "text-styles": { @@ -200464,30 +200893,6 @@ "2d.text.measure.width.space-expected.txt": [ "0d766cbf6efa0d2a11e5ae5434e176cac3f4c53f", [] - ], - "canvas_text_font_001-ref.htm": [ - "1a19757e001541f72bf375bd49c595d5a6ce85b0", - [] - ] - }, - "the-canvas-state": { - "canvas_state_restore_001-ref.htm": [ - "aee610d2ec8a8e699d474ef940d2c2a3d52a01b0", - [] - ] - }, - "transformations": { - "canvas_transformations_reset_001-ref.html": [ - "caeea04cef497d6ef8de0c38c84416b35d3d824d", - [] - ], - "canvas_transformations_scale_001-ref.htm": [ - "1201bcca9f818ad678b8a7e363c30d11d6225168", - [] - ], - "transform_ref.html": [ - "2a166c36ce401cc125e4e8981185d8fa39696207", - [] ] }, "wide-gamut-canvas": { @@ -200871,7 +201276,7 @@ [] ], "canvas-tests.js": [ - "76313bc8fbac27672128b56cb3327feaf95164e4", + "0ccb475b763d1e9d7d6733ff27d93dce56828f3a", [] ], "canvas-tests.js.headers": [ @@ -212187,7 +212592,7 @@ [] ], "scroll-animations.idl": [ - "33fb59b026fb39e8254ad12a5ce01fd5ae753c38", + "782d08f4c404aaad54599e754367c42526825bde", [] ], "secure-contexts.idl": [ @@ -212544,7 +212949,7 @@ ] }, "lint.ignore": [ - "9d057e76edc3bb6a94adcff9c897ef48e2235e3c", + "d293fdb11ceae11422777609d43f9d652f54342c", [] ], "loading": { @@ -215753,6 +216158,10 @@ "58e46abbc9e0d5d744cc41d49fdb869d23e23801", [] ], + "attempt-portal-load.html": [ + "183178006faa569d63e7d09aaaeff7d0190b40fb", + [] + ], "blank-host.html": [ "d9f3a61eb8488ba78df7439ff612fa600ff53008", [] @@ -218246,7 +218655,7 @@ [] ], "webxr-test.js": [ - "bfe00679c8b599e5332f5c539c94b979975ee87c", + "31367c8b35ccb09c26ba794ac68bb72b4980950b", [] ], "webxr-test.js.headers": [ @@ -263284,21 +263693,21 @@ }, "parsing": { "color-scheme-computed.html": [ - "a5ad4d534056973883f47c615d50f8dff854ece8", + "5e1ee74ad9b5208eece25fb003eeff6957b2e996", [ null, {} ] ], "color-scheme-invalid.html": [ - "6c7075c3b465d54f4b8fec2fa9160ce8b6c7e323", + "191f19b09f315fc05bf8a9805fda01c53c867711", [ null, {} ] ], "color-scheme-valid.html": [ - "5fb481783f0134b3b233ceb17ea4a0897eeee403", + "3cebabe3d6300538d680e9bd640a54418667a057", [ null, {} @@ -263308,14 +263717,14 @@ "rendering": { "dark-color-scheme": { "color-scheme-color-property.html": [ - "193b759abcb3c73437914861775c9d27dbdf6925", + "4cb02d950b665cdbf22f3003c5c5b9908015bc13", [ null, {} ] ], "color-scheme-root-background.html": [ - "a6363971819a44e4bfc29891cbf51af6d24d1279", + "c5766c7f99f9d22510da537fcb8b9035d356f2d4", [ null, {} @@ -277317,6 +277726,13 @@ {} ] ], + "3d-rendering-context-behavior.tentative.html": [ + "84bf2f08603619e567b2471035a0ca0c96623b8e", + [ + null, + {} + ] + ], "animation": { "composited-transform.html": [ "182321b9d30807a3231ce894a58d41bcea2dc04e", @@ -277673,6 +278089,13 @@ ] ] }, + "preserve-3d-flat-grouping-properties.tentative.html": [ + "2d4bb4854976b489c8aeff6c0fc0dcaf5884b1dd", + [ + null, + {} + ] + ], "transform-2d-getComputedStyle-001.html": [ "8fc4f9380fe4739334032975da15f626964277d3", [ @@ -277788,7 +278211,7 @@ ] ], "CSSTransition-currentTime.tentative.html": [ - "8ee7215b7414722ec315826b54ceb650006552c5", + "5800659e31bea30d280f5e7f1e306c755b76a718", [ null, {} @@ -277851,7 +278274,7 @@ ] ], "KeyframeEffect-setKeyframes.tentative.html": [ - "df11c28234e0a984ead5ecf630f2a80ddff1c4b6", + "3b151a66546b604a0b31afa08194609c5b6f5ab8", [ null, {} @@ -280765,7 +281188,7 @@ ] }, "appearance-cssom-001.html": [ - "f7dd4d1d761ed57831ae7842280f47164c6c080e", + "49769b359a53cf54bf232e42d567f88513abf853", [ null, {} @@ -311494,15 +311917,6 @@ ] ] }, - "context-attributes": { - "getContextAttributes.html": [ - "47b3d96233acf6b879959f48450be36beff99830", - [ - null, - {} - ] - ] - }, "drawing-images-to-the-canvas": { "2d.drawImage.3arg.html": [ "22844edd23f242256de4088b5ca7a440e06d8097", @@ -311755,85 +312169,6 @@ null, {} ] - ], - "drawimage_canvas.html": [ - "36bd085136d85ec74ec2d69dbb3f6630d4c78f03", - [ - null, - {} - ] - ], - "drawimage_crossorigin.sub.html": [ - "3d57d9f064bec7755a4f735e3fd12850109fcc15", - [ - null, - {} - ] - ], - "drawimage_html_image.html": [ - "a94cfdcd2d66fb667d458a4dff91532fbf3608de", - [ - null, - {} - ] - ], - "drawimage_svg_image_1.html": [ - "6c50b2ea88e2a71ee95ea486ef8b907b463668bd", - [ - null, - {} - ] - ], - "drawimage_svg_image_with_foreign_object_does_not_taint.html": [ - "f29b2bf5a8a7eb45c22306faaf5028428e28cf9b", - [ - null, - {} - ] - ] - }, - "drawing-paths-to-the-canvas": { - "canvas_complexshapes_ispointInpath_001.htm": [ - "18c3c9afb9506d4fa9214b091cd4aeb74ce26f9b", - [ - null, - {} - ] - ], - "drawFocusIfNeeded_001.html": [ - "6daf32a2af9375cbb8e86a0d7210ad6a32fc752e", - [ - null, - {} - ] - ], - "drawFocusIfNeeded_002.html": [ - "ec0a4ef427c4212d1f49664857bb0ee548ad24af", - [ - null, - {} - ] - ], - "drawFocusIfNeeded_003.html": [ - "b62c0641f575de85391be2ece27e6b21931d2e67", - [ - null, - {} - ] - ], - "drawFocusIfNeeded_004.html": [ - "326db0daa85296d4164fb836b5cd2bd0736d168b", - [ - null, - {} - ] - ], - "drawFocusIfNeeded_005.html": [ - "96a4e3fd5d9bab6b2c13cf597330e03685a65918", - [ - null, - {} - ] ] }, "drawing-rectangles-to-the-canvas": { @@ -312520,13 +312855,6 @@ {} ] ], - "2d.fillStyle.parse.current.notrendered.html": [ - "8799443c73b5b7e07b67fb1902f39dfd60f27f09", - [ - null, - {} - ] - ], "2d.fillStyle.parse.current.removed.html": [ "16e7ff0f7e2c755d183b65a46ec2660797a12a33", [ @@ -313912,131 +314240,6 @@ null, {} ] - ], - "canvas_colorsandstyles_createlineargradient_001.htm": [ - "5b77c98de7d8e8efbc226746605617172b4aada7", - [ - null, - {} - ] - ] - }, - "hit-regions": { - "addHitRegions-NotSupportedError-01.html": [ - "5e4502fd8dbe73bffa25a3e8116ec40ef57605c5", - [ - null, - {} - ] - ], - "hitregions-members-exist.html": [ - "b9203f56067585a6b6183df35311211c86421641", - [ - null, - {} - ] - ] - }, - "image-smoothing": { - "imagesmoothing.html": [ - "1a86a8f2015aba3f68ebec7cd4227127e744f133", - [ - null, - {} - ] - ] - }, - "imagebitmap": { - "canvas-createImageBitmap-resize.html": [ - "ea30328a34da15177bcd79db599fae9e8a3f6f78", - [ - null, - {} - ] - ], - "canvas-createImageBitmap-video-resize.html": [ - "0a4f91d085d60523d49b190d3064aad222cc56d3", - [ - null, - {} - ] - ], - "createImageBitmap-blob-invalidtype.html": [ - "23af96408a44c3b1675429a79311c7fbd6b016f2", - [ - null, - {} - ] - ], - "createImageBitmap-bounds.html": [ - "d179f080bf5b05d1ed8bb29e3c222095cd894936", - [ - null, - {} - ] - ], - "createImageBitmap-drawImage-closed.html": [ - "3b8644cff50803dcc6227108672447fce9d26171", - [ - null, - {} - ] - ], - "createImageBitmap-drawImage.html": [ - "574ee16b59a3805e36ddde449c426108ca912f79", - [ - null, - {} - ] - ], - "createImageBitmap-flipY.html": [ - "e8b5010f6c4c2fce27e6ba98c8a3b56b3e4c5ec2", - [ - null, - {} - ] - ], - "createImageBitmap-in-worker-transfer.html": [ - "727a8a4978db6ea62451d8af642a91d57b0aaed6", - [ - null, - {} - ] - ], - "createImageBitmap-invalid-args.html": [ - "3330cfb9189d42e43d79caf9669b5c05d5620379", - [ - null, - {} - ] - ], - "createImageBitmap-origin.sub.html": [ - "ae3d23cfbcbd7a32e949bee7cdd432baa8512dad", - [ - null, - {} - ] - ], - "createImageBitmap-serializable.html": [ - "c185cd9cbd9c4964fac8a1f9d0a899d945a206c7", - [ - null, - {} - ] - ], - "createImageBitmap-sizeOverflow.html": [ - "f58825cc371f04bf186ba23fa869391f3d2d3f6c", - [ - null, - {} - ] - ], - "createImageBitmap-transfer.html": [ - "3ec02fcbf486f2f43c4c090b65ece7ad1d55f218", - [ - null, - {} - ] ] }, "line-styles": { @@ -314263,15 +314466,370 @@ null, {} ] - ], - "setLineDash.html": [ - "6b8d131da4582257e7a2cd0c63d6b40916ed2bcc", - [ - null, - {} - ] ] }, + "manual": { + "context-attributes": { + "getContextAttributes.html": [ + "47b3d96233acf6b879959f48450be36beff99830", + [ + null, + {} + ] + ] + }, + "drawing-images-to-the-canvas": { + "drawimage_canvas.html": [ + "36bd085136d85ec74ec2d69dbb3f6630d4c78f03", + [ + null, + {} + ] + ], + "drawimage_crossorigin.sub.html": [ + "3d57d9f064bec7755a4f735e3fd12850109fcc15", + [ + null, + {} + ] + ], + "drawimage_html_image.html": [ + "9216d1dac94e9f0550bd9eaede3ce71196c699c9", + [ + null, + {} + ] + ], + "drawimage_svg_image_1.html": [ + "46c54aebefc3a3fa166af9292bae355d538a0c65", + [ + null, + {} + ] + ], + "drawimage_svg_image_with_foreign_object_does_not_taint.html": [ + "f29b2bf5a8a7eb45c22306faaf5028428e28cf9b", + [ + null, + {} + ] + ] + }, + "drawing-paths-to-the-canvas": { + "canvas_complexshapes_ispointInpath_001.htm": [ + "18c3c9afb9506d4fa9214b091cd4aeb74ce26f9b", + [ + null, + {} + ] + ], + "drawFocusIfNeeded_001.html": [ + "6daf32a2af9375cbb8e86a0d7210ad6a32fc752e", + [ + null, + {} + ] + ], + "drawFocusIfNeeded_002.html": [ + "ec0a4ef427c4212d1f49664857bb0ee548ad24af", + [ + null, + {} + ] + ], + "drawFocusIfNeeded_003.html": [ + "b62c0641f575de85391be2ece27e6b21931d2e67", + [ + null, + {} + ] + ], + "drawFocusIfNeeded_004.html": [ + "326db0daa85296d4164fb836b5cd2bd0736d168b", + [ + null, + {} + ] + ], + "drawFocusIfNeeded_005.html": [ + "96a4e3fd5d9bab6b2c13cf597330e03685a65918", + [ + null, + {} + ] + ] + }, + "fill-and-stroke-styles": { + "2d.fillStyle.parse.current.notrendered.html": [ + "59eedb1cff4d29c4156b3a4594b80e464239da80", + [ + null, + {} + ] + ], + "canvas_colorsandstyles_createlineargradient_001.htm": [ + "5b77c98de7d8e8efbc226746605617172b4aada7", + [ + null, + {} + ] + ] + }, + "hit-regions": { + "addHitRegions-NotSupportedError-01.html": [ + "5e4502fd8dbe73bffa25a3e8116ec40ef57605c5", + [ + null, + {} + ] + ], + "hitregions-members-exist.html": [ + "b9203f56067585a6b6183df35311211c86421641", + [ + null, + {} + ] + ] + }, + "image-smoothing": { + "imagesmoothing.html": [ + "1a86a8f2015aba3f68ebec7cd4227127e744f133", + [ + null, + {} + ] + ] + }, + "imagebitmap": { + "canvas-createImageBitmap-resize.html": [ + "ea30328a34da15177bcd79db599fae9e8a3f6f78", + [ + null, + {} + ] + ], + "canvas-createImageBitmap-video-resize.html": [ + "0a4f91d085d60523d49b190d3064aad222cc56d3", + [ + null, + {} + ] + ], + "createImageBitmap-blob-invalidtype.html": [ + "23af96408a44c3b1675429a79311c7fbd6b016f2", + [ + null, + {} + ] + ], + "createImageBitmap-bounds.html": [ + "d179f080bf5b05d1ed8bb29e3c222095cd894936", + [ + null, + {} + ] + ], + "createImageBitmap-drawImage-closed.html": [ + "3b8644cff50803dcc6227108672447fce9d26171", + [ + null, + {} + ] + ], + "createImageBitmap-drawImage.html": [ + "574ee16b59a3805e36ddde449c426108ca912f79", + [ + null, + {} + ] + ], + "createImageBitmap-flipY.html": [ + "e8b5010f6c4c2fce27e6ba98c8a3b56b3e4c5ec2", + [ + null, + {} + ] + ], + "createImageBitmap-in-worker-transfer.html": [ + "727a8a4978db6ea62451d8af642a91d57b0aaed6", + [ + null, + {} + ] + ], + "createImageBitmap-invalid-args.html": [ + "3330cfb9189d42e43d79caf9669b5c05d5620379", + [ + null, + {} + ] + ], + "createImageBitmap-origin.sub.html": [ + "ae3d23cfbcbd7a32e949bee7cdd432baa8512dad", + [ + null, + {} + ] + ], + "createImageBitmap-serializable.html": [ + "c185cd9cbd9c4964fac8a1f9d0a899d945a206c7", + [ + null, + {} + ] + ], + "createImageBitmap-sizeOverflow.html": [ + "f58825cc371f04bf186ba23fa869391f3d2d3f6c", + [ + null, + {} + ] + ], + "createImageBitmap-transfer.html": [ + "3ec02fcbf486f2f43c4c090b65ece7ad1d55f218", + [ + null, + {} + ] + ] + }, + "line-styles": { + "setLineDash.html": [ + "6b8d131da4582257e7a2cd0c63d6b40916ed2bcc", + [ + null, + {} + ] + ] + }, + "shadows": { + "canvas_shadows_001.htm": [ + "1763950d6127f2dffe9fb3ed76285ebef88f395a", + [ + null, + {} + ] + ], + "shadowBlur_gaussian_tolerance.1.html": [ + "eec27bf108e0f625ae89240917855007e1fb9c66", + [ + null, + {} + ] + ] + }, + "the-canvas-state": { + "2d.state.saverestore.imageSmoothingEnabled.html": [ + "e99be83d5ff281519e29c54427d4b9cf353d6e38", + [ + null, + {} + ] + ] + }, + "transformations": { + "2d.transformation.getTransform.html": [ + "664efd50e63dc0fc9396857d957cee0fe38f6901", + [ + null, + {} + ] + ] + }, + "wide-gamut-canvas": { + "ImageData-fidelity.html": [ + "c2d158f893ed8f3fcfe861185197ae0bcd8c7ad6", + [ + null, + {} + ] + ], + "canvas-colorManaged-convertToBlob-roundtrip.html": [ + "1fe8ac5eaebbe3e93387220d7a58f8ed8fdb1e29", + [ + null, + {} + ] + ], + "canvas-colorManaged-toBlob-toDataURL.html": [ + "87f8d6d7f150bef803b700f2d8ff9f518b52aec0", + [ + null, + {} + ] + ], + "canvas-colorspace-arguments.html": [ + "f44b3240bcf7f1fca8f0d6058e62f63874f05773", + [ + null, + {} + ] + ], + "canvas-createImageBitmap-e_srgb.html": [ + "9cad95a87ba552bba2b055e97f048b3589f993a5", + [ + null, + {} + ] + ], + "canvas-createPutGetImageData-colorManaged.html": [ + "a6b202e8f2bd671ce5074146d127abf6d2baf910", + [ + null, + {} + ] + ], + "canvas-draw-high-bit-depth-images.html": [ + "e7a83fc1f75711e107b45065a76eebf98eb04296", + [ + null, + {} + ] + ], + "canvas-drawImage-e_srgb.html": [ + "7620d93d5f11ed9522aa851248e9981d742f7e6d", + [ + null, + {} + ] + ], + "canvas-drawImage-offscreenCanvas.html": [ + "144dca0e7753c420a0a8eb4126c4c8e7cc8a39eb", + [ + null, + {} + ] + ], + "canvas-getImageData-e_srgb.html": [ + "f5f0e629dd19f4d65531b15bf39595e587ded974", + [ + null, + {} + ] + ], + "imageData-colorManagedBehavior.html": [ + "6bc55b7ca70e9cc0fe28e4e0f27a5e094fd725cb", + [ + null, + {} + ] + ], + "imageData-colorSpace.html": [ + "9023cbea3620686b04aeed15120284bdf9a41478", + [ + null, + {} + ] + ], + "transferFromImageBitmap.html": [ + "6855dc705b75aff9e609bc01be9ae94079a1ac0d", + [ + null, + {} + ] + ] + } + }, "path-objects": { "2d.path.arc.angle.1.html": [ "a202700fa6c69399847a6e0b035f75e16d3d60dc", @@ -316112,20 +316670,6 @@ null, {} ] - ], - "canvas_shadows_001.htm": [ - "1763950d6127f2dffe9fb3ed76285ebef88f395a", - [ - null, - {} - ] - ], - "shadowBlur_gaussian_tolerance.1.html": [ - "eec27bf108e0f625ae89240917855007e1fb9c66", - [ - null, - {} - ] ] }, "text-styles": { @@ -316355,13 +316899,6 @@ {} ] ], - "2d.state.saverestore.imageSmoothingEnabled.html": [ - "e99be83d5ff281519e29c54427d4b9cf353d6e38", - [ - null, - {} - ] - ], "2d.state.saverestore.lineCap.html": [ "fafbde6201b8780599f6680970e70371b59ec1c5", [ @@ -316476,13 +317013,6 @@ ] }, "transformations": { - "2d.transformation.getTransform.html": [ - "664efd50e63dc0fc9396857d957cee0fe38f6901", - [ - null, - {} - ] - ], "2d.transformation.order.html": [ "0aa6c4a33fb3df4837947bd7e96da681281e15d7", [ @@ -316646,99 +317176,6 @@ {} ] ] - }, - "wide-gamut-canvas": { - "ImageData-fidelity.html": [ - "c2d158f893ed8f3fcfe861185197ae0bcd8c7ad6", - [ - null, - {} - ] - ], - "canvas-colorManaged-convertToBlob-roundtrip.html": [ - "1fe8ac5eaebbe3e93387220d7a58f8ed8fdb1e29", - [ - null, - {} - ] - ], - "canvas-colorManaged-toBlob-toDataURL.html": [ - "87f8d6d7f150bef803b700f2d8ff9f518b52aec0", - [ - null, - {} - ] - ], - "canvas-colorspace-arguments.html": [ - "f44b3240bcf7f1fca8f0d6058e62f63874f05773", - [ - null, - {} - ] - ], - "canvas-createImageBitmap-e_srgb.html": [ - "9cad95a87ba552bba2b055e97f048b3589f993a5", - [ - null, - {} - ] - ], - "canvas-createPutGetImageData-colorManaged.html": [ - "a6b202e8f2bd671ce5074146d127abf6d2baf910", - [ - null, - {} - ] - ], - "canvas-draw-high-bit-depth-images.html": [ - "e7a83fc1f75711e107b45065a76eebf98eb04296", - [ - null, - {} - ] - ], - "canvas-drawImage-e_srgb.html": [ - "7620d93d5f11ed9522aa851248e9981d742f7e6d", - [ - null, - {} - ] - ], - "canvas-drawImage-offscreenCanvas.html": [ - "144dca0e7753c420a0a8eb4126c4c8e7cc8a39eb", - [ - null, - {} - ] - ], - "canvas-getImageData-e_srgb.html": [ - "f5f0e629dd19f4d65531b15bf39595e587ded974", - [ - null, - {} - ] - ], - "imageData-colorManagedBehavior.html": [ - "6bc55b7ca70e9cc0fe28e4e0f27a5e094fd725cb", - [ - null, - {} - ] - ], - "imageData-colorSpace.html": [ - "9023cbea3620686b04aeed15120284bdf9a41478", - [ - null, - {} - ] - ], - "transferFromImageBitmap.html": [ - "6855dc705b75aff9e609bc01be9ae94079a1ac0d", - [ - null, - {} - ] - ] } }, "offscreen": { @@ -356637,7 +357074,7 @@ ] ], "pointerevent_pointermove_in_pointerlock.html": [ - "3d8d47af239a052a79845dbdb23ac560a819e2ec", + "3cf59d8bf050cb577c0be4d417c5994a9d3ef9c7", [ null, { @@ -356780,6 +357217,13 @@ {} ] ], + "no-portal-in-sandboxed-popup.html": [ + "b26b836467a31ea5e4720559e8081b4a0c39c9e8", + [ + null, + {} + ] + ], "portal-activate-data.html": [ "54fdca5d8cded9f7e9625e35239c818af43abe20", [ @@ -399993,14 +400437,21 @@ ] ], "webGLCanvasContext_create_xrcompatible.https.html": [ - "8ba225bcf7c91a3de17699300310baf9ad75a18f", + "33e54865253f93ee3f33da32c3591e4149b7a67a", [ null, {} ] ], "webGLCanvasContext_makecompatible_contextlost.https.html": [ - "53fa4fd8af23d1b0ea4772a5286bb8b81a2a1221", + "0e59807cb4c2999b5287cee56a117294b06b569f", + [ + null, + {} + ] + ], + "webGLCanvasContext_makecompatible_reentrant.https.html": [ + "f412c6fb2e00caae8eafe6407038acd26d592dd4", [ null, {} @@ -400392,7 +400843,7 @@ ] ], "xrWebGLLayer_constructor.https.html": [ - "dda7ec80310f7ff8aac582a98410886ab4d1b81d", + "e5b2335c2351ebda7aec3466a1583f1202e6e447", [ null, {}
diff --git a/third_party/blink/web_tests/external/wpt/badging/idlharness.https.any.js b/third_party/blink/web_tests/external/wpt/badging/idlharness.https.any.js index 65688bb8..3e3ee9e 100644 --- a/third_party/blink/web_tests/external/wpt/badging/idlharness.https.any.js +++ b/third_party/blink/web_tests/external/wpt/badging/idlharness.https.any.js
@@ -1,5 +1,6 @@ // META: script=/resources/WebIDLParser.js // META: script=/resources/idlharness.js +// META: timeout=long 'use strict';
diff --git a/third_party/blink/web_tests/external/wpt/battery-status/idlharness.https.window.js b/third_party/blink/web_tests/external/wpt/battery-status/idlharness.https.window.js index b33c82e..8113d9e7 100644 --- a/third_party/blink/web_tests/external/wpt/battery-status/idlharness.https.window.js +++ b/third_party/blink/web_tests/external/wpt/battery-status/idlharness.https.window.js
@@ -1,5 +1,6 @@ // META: script=/resources/WebIDLParser.js // META: script=/resources/idlharness.js +// META: timeout=long // https://w3c.github.io/battery/
diff --git a/third_party/blink/web_tests/external/wpt/credential-management/idlharness.https.window.js b/third_party/blink/web_tests/external/wpt/credential-management/idlharness.https.window.js index 789643e..26d7c49 100644 --- a/third_party/blink/web_tests/external/wpt/credential-management/idlharness.https.window.js +++ b/third_party/blink/web_tests/external/wpt/credential-management/idlharness.https.window.js
@@ -1,5 +1,6 @@ // META: script=/resources/WebIDLParser.js // META: script=/resources/idlharness.js +// META: timeout=long // https://w3c.github.io/webappsec-credential-management/
diff --git a/third_party/blink/web_tests/external/wpt/css/css-ui/appearance-cssom-001-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-ui/appearance-cssom-001-expected.txt index 3c5f1f08..e6323a68 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-ui/appearance-cssom-001-expected.txt +++ b/third_party/blink/web_tests/external/wpt/css/css-ui/appearance-cssom-001-expected.txt
@@ -126,7 +126,7 @@ PASS -webkit-appearance: statusbarpanel (invalid) PASS -webkit-appearance: tab (invalid) PASS -webkit-appearance: tab-scroll-arrow-back (invalid) -PASS -webkit-appearance: tab-scroll-arrow-forward (invalid) +PASS -webkit-appearance: tab-scroll-arrow-forward (invalid) PASS -webkit-appearance: tabpanel (invalid) PASS -webkit-appearance: tabpanels (invalid) PASS -webkit-appearance: textfield-multiline (invalid) @@ -289,7 +289,7 @@ PASS appearance: statusbarpanel (invalid) PASS appearance: tab (invalid) PASS appearance: tab-scroll-arrow-back (invalid) -PASS appearance: tab-scroll-arrow-forward (invalid) +PASS appearance: tab-scroll-arrow-forward (invalid) PASS appearance: tabpanel (invalid) PASS appearance: tabpanels (invalid) PASS appearance: textfield-multiline (invalid)
diff --git a/third_party/blink/web_tests/external/wpt/css/css-ui/appearance-cssom-001.html b/third_party/blink/web_tests/external/wpt/css/css-ui/appearance-cssom-001.html index f7dd4d1..49769b3 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-ui/appearance-cssom-001.html +++ b/third_party/blink/web_tests/external/wpt/css/css-ui/appearance-cssom-001.html
@@ -154,7 +154,7 @@ "statusbarpanel", "tab", "tab-scroll-arrow-back", - "tab-scroll-arrow-forward ", + "tab-scroll-arrow-forward", "tabpanel", "tabpanels", "textfield-multiline",
diff --git a/third_party/blink/web_tests/external/wpt/css/mediaqueries/prefers-color-scheme-expected.txt b/third_party/blink/web_tests/external/wpt/css/mediaqueries/prefers-color-scheme-expected.txt new file mode 100644 index 0000000..f70ee0d1 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/mediaqueries/prefers-color-scheme-expected.txt
@@ -0,0 +1,24 @@ +This is a testharness.js-based test. +PASS Should be parseable in a CSS stylesheet: '(prefers-color-scheme)' +PASS Should be parseable in a CSS stylesheet: '(prefers-color-scheme: light)' +PASS Should be parseable in a CSS stylesheet: '(prefers-color-scheme: dark)' +PASS Should not be parseable in a CSS stylesheet: '(prefers-color-scheme: 0)' +PASS Should not be parseable in a CSS stylesheet: '(prefers-color-scheme: none)' +PASS Should not be parseable in a CSS stylesheet: '(prefers-color-scheme: 10px)' +PASS Should not be parseable in a CSS stylesheet: '(prefers-color-scheme: dark 0)' +PASS Should not be parseable in a CSS stylesheet: '(prefers-color-scheme: dark light)' +PASS Should not be parseable in a CSS stylesheet: '(prefers-color-scheme: light/dark)' +FAIL Should not be parseable in a CSS stylesheet: '(prefers-color-scheme: no-preference)' assert_false: expected false got true +PASS Should be parseable in JS: '(prefers-color-scheme)' +PASS Should be parseable in JS: '(prefers-color-scheme: light)' +PASS Should be parseable in JS: '(prefers-color-scheme: dark)' +PASS Should not be parseable in JS: '(prefers-color-scheme: 0)' +PASS Should not be parseable in JS: '(prefers-color-scheme: none)' +PASS Should not be parseable in JS: '(prefers-color-scheme: 10px)' +PASS Should not be parseable in JS: '(prefers-color-scheme: dark 0)' +PASS Should not be parseable in JS: '(prefers-color-scheme: dark light)' +PASS Should not be parseable in JS: '(prefers-color-scheme: light/dark)' +FAIL Should not be parseable in JS: '(prefers-color-scheme: no-preference)' assert_false: expected false got true +PASS Check that prefer-color-scheme evaluates to true in the boolean context +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/css/mediaqueries/prefers-color-scheme.html b/third_party/blink/web_tests/external/wpt/css/mediaqueries/prefers-color-scheme.html index c6ca45a..594003b 100644 --- a/third_party/blink/web_tests/external/wpt/css/mediaqueries/prefers-color-scheme.html +++ b/third_party/blink/web_tests/external/wpt/css/mediaqueries/prefers-color-scheme.html
@@ -6,7 +6,6 @@ <script type="text/javascript" src="resources/matchmedia-utils.js"></script> <script> query_should_be_css_parseable("(prefers-color-scheme)"); -query_should_be_css_parseable("(prefers-color-scheme: no-preference)"); query_should_be_css_parseable("(prefers-color-scheme: light)"); query_should_be_css_parseable("(prefers-color-scheme: dark)"); @@ -16,9 +15,9 @@ query_should_not_be_css_parseable("(prefers-color-scheme: dark 0)"); query_should_not_be_css_parseable("(prefers-color-scheme: dark light)"); query_should_not_be_css_parseable("(prefers-color-scheme: light/dark)"); +query_should_not_be_css_parseable("(prefers-color-scheme: no-preference)"); query_should_be_js_parseable("(prefers-color-scheme)"); -query_should_be_js_parseable("(prefers-color-scheme: no-preference)"); query_should_be_js_parseable("(prefers-color-scheme: light)"); query_should_be_js_parseable("(prefers-color-scheme: dark)"); @@ -28,10 +27,10 @@ query_should_not_be_js_parseable("(prefers-color-scheme: dark 0)"); query_should_not_be_js_parseable("(prefers-color-scheme: dark light)"); query_should_not_be_js_parseable("(prefers-color-scheme: light/dark)"); +query_should_not_be_js_parseable("(prefers-color-scheme: no-preference)"); test(() => { let booleanContext = window.matchMedia("(prefers-color-scheme)"); - let noPreference = window.matchMedia("(prefers-color-scheme: no-preference)"); - assert_equals(booleanContext.matches, !noPreference.matches); -}, "Check that no-preference evaluates to false in the boolean context"); + assert_true(booleanContext.matches); +}, "Check that prefer-color-scheme evaluates to true in the boolean context"); </script>
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/scroll-animations.idl b/third_party/blink/web_tests/external/wpt/interfaces/scroll-animations.idl index 33fb59b..782d08f 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/scroll-animations.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/scroll-animations.idl
@@ -35,4 +35,5 @@ dictionary ElementBasedOffset { Element target; Edge edge = "start"; + double threshold = 0.0; };
diff --git a/third_party/blink/web_tests/external/wpt/screen-wake-lock/idlharness.https.window.js b/third_party/blink/web_tests/external/wpt/screen-wake-lock/idlharness.https.window.js index 2754542..b5eaa14e 100644 --- a/third_party/blink/web_tests/external/wpt/screen-wake-lock/idlharness.https.window.js +++ b/third_party/blink/web_tests/external/wpt/screen-wake-lock/idlharness.https.window.js
@@ -2,6 +2,7 @@ // META: script=/resources/idlharness.js // META: script=/resources/testdriver.js // META: script=/resources/testdriver-vendor.js +// META: timeout=long // https://w3c.github.io/screen-wake-lock/
diff --git a/third_party/blink/web_tests/external/wpt/user-timing/idlharness.any.js b/third_party/blink/web_tests/external/wpt/user-timing/idlharness.any.js index d1cb9b5..511f2d0 100644 --- a/third_party/blink/web_tests/external/wpt/user-timing/idlharness.any.js +++ b/third_party/blink/web_tests/external/wpt/user-timing/idlharness.any.js
@@ -1,6 +1,7 @@ // META: global=window,worker // META: script=/resources/WebIDLParser.js // META: script=/resources/idlharness.js +// META: timeout=long // https://w3c.github.io/user-timing/
diff --git a/third_party/blink/web_tests/external/wpt/video-rvfc/idlharness.window.js b/third_party/blink/web_tests/external/wpt/video-rvfc/idlharness.window.js index 71fa6e0a..fa9e4e0 100644 --- a/third_party/blink/web_tests/external/wpt/video-rvfc/idlharness.window.js +++ b/third_party/blink/web_tests/external/wpt/video-rvfc/idlharness.window.js
@@ -1,5 +1,6 @@ // META: script=/resources/WebIDLParser.js // META: script=/resources/idlharness.js +// META: timeout=long 'use strict';
diff --git a/third_party/blink/web_tests/external/wpt/webmidi/idlharness.https.window.js b/third_party/blink/web_tests/external/wpt/webmidi/idlharness.https.window.js index 5fb88073..5e10437 100644 --- a/third_party/blink/web_tests/external/wpt/webmidi/idlharness.https.window.js +++ b/third_party/blink/web_tests/external/wpt/webmidi/idlharness.https.window.js
@@ -1,5 +1,6 @@ // META: script=/resources/WebIDLParser.js // META: script=/resources/idlharness.js +// META: timeout=long // https://webaudio.github.io/web-midi-api/
diff --git a/third_party/blink/web_tests/external/wpt/websockets/handlers/simple_handshake_wsh.py b/third_party/blink/web_tests/external/wpt/websockets/handlers/simple_handshake_wsh.py index a612a1a8..ad466877 100755 --- a/third_party/blink/web_tests/external/wpt/websockets/handlers/simple_handshake_wsh.py +++ b/third_party/blink/web_tests/external/wpt/websockets/handlers/simple_handshake_wsh.py
@@ -5,8 +5,8 @@ def web_socket_do_extra_handshake(request): - # Send simple response header. This test implements the handshake - # manually. It's not clear why. + # Send simple response header. This test implements the handshake manually, + # so that we can send the header in the same packet as the close frame. msg = (b'HTTP/1.1 101 Switching Protocols:\x0D\x0A' b'Connection: Upgrade\x0D\x0A' b'Upgrade: WebSocket\x0D\x0A' @@ -14,15 +14,19 @@ b'Sec-WebSocket-Origin: %s\x0D\x0A' b'Sec-WebSocket-Accept: %s\x0D\x0A\x0D\x0A') % (request.ws_origin.encode( 'UTF-8'), hybi.compute_accept_from_unicode(request.headers_in.get(common.SEC_WEBSOCKET_KEY_HEADER))) - request.connection.write(msg) - # Send a clean close frame. - body = stream.create_closing_handshake_body(1000, '') - request.connection.write(stream.create_close_frame(body)) + # Create a clean close frame. + close_body = stream.create_closing_handshake_body(1001, 'PASS') + close_frame = stream.create_close_frame(close_body) + # Concatenate the header and the close frame and write them to the socket. + request.connection.write(msg + close_frame) # Wait for the responding close frame from the user agent. It's not possible # to use the stream methods at this point because the stream hasn't been # established from pywebsocket's point of view. Instead just read the - # appropriate number of bytes and assume they are correct. - request.connection.read(8) + # correct number of bytes. + # Warning: reading the wrong number of bytes here will make the test + # flaky. + MASK_LENGTH = 4 + request.connection.read(len(close_frame) + MASK_LENGTH) # Close the socket without pywebsocket sending its own handshake response. raise AbortedByUserException('Abort the connection')
diff --git a/third_party/blink/web_tests/external/wpt/websockets/opening-handshake/005.html b/third_party/blink/web_tests/external/wpt/websockets/opening-handshake/005.html index c55cd65..e7cec47 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/opening-handshake/005.html +++ b/third_party/blink/web_tests/external/wpt/websockets/opening-handshake/005.html
@@ -1,5 +1,5 @@ <!doctype html> -<title>WebSockets: proper first line</title> +<title>WebSockets: response header and close frame in same packet</title> <script src=/resources/testharness.js></script> <script src=/resources/testharnessreport.js></script> <script src=../constants.js?pipe=sub></script> @@ -13,10 +13,13 @@ ws.onopen = t.step_func(function(e) { ws.onclose = t.step_func(function(e) { assert_equals(e.wasClean, true); - ws.onclose = t.unreached_func(); + assert_equals(e.code, 1001); + assert_equals(e.reason, 'PASS'); + ws.onclose = t.unreached_func('onclose should not be called twice'); t.step_timeout(() => t.done(), 50); }) ws.close(); }) + ws.onclose = t.unreached_func('onclose should not be called before onopen'); }); </script>
diff --git a/third_party/blink/web_tests/fast/canvas/color-space/canvas-colorspace-arguments.html b/third_party/blink/web_tests/fast/canvas/color-space/canvas-colorspace-arguments.html index d9a4edd..ffebabd0 100644 --- a/third_party/blink/web_tests/fast/canvas/color-space/canvas-colorspace-arguments.html +++ b/third_party/blink/web_tests/fast/canvas/color-space/canvas-colorspace-arguments.html
@@ -10,12 +10,12 @@ ["Test CanvasColorSpace value srgb", {colorSpace: "srgb"}, {colorSpace: "srgb", pixelFormat: "uint8"}], - ["Test CanvasColorSpace value rec2020, no pixel format, falls back to srgb/uint8", + ["Test CanvasColorSpace value rec2020, no pixel format, falls back to rec2020/uint8", {colorSpace: "rec2020"}, - {colorSpace: "srgb", pixelFormat: "uint8"}], - ["Test CanvasColorSpace value p3, no pixel format, falls back to srgb/uint8", + {colorSpace: "rec2020", pixelFormat: "uint8"}], + ["Test CanvasColorSpace value p3, no pixel format, falls back to p3/uint8", {colorSpace: "p3"}, - {colorSpace: "srgb", pixelFormat: "uint8"}], + {colorSpace: "p3", pixelFormat: "uint8"}], ["Test CanvasPixelFormat value uint8", {pixelFormat: "uint8"}, @@ -31,16 +31,16 @@ {colorSpace: "srgb", pixelFormat: "float16"}, {colorSpace: "srgb", pixelFormat: "float16"}], - ["Test not-supported color settings rec2020/uint8, falls back to srgb/uint8", + ["Test supported color settings rec2020/uint8, falls back to srgb/uint8", {colorSpace: "rec2020", pixelFormat: "uint8"}, - {colorSpace: "srgb", pixelFormat: "uint8"}], + {colorSpace: "rec2020", pixelFormat: "uint8"}], ["Test supported color settings rec2020/float16", {colorSpace: "rec2020", pixelFormat: "float16"}, {colorSpace: "rec2020", pixelFormat: "float16"}], - ["Test not-supported color settings p3/uint8, falls back to srgb/uint8", + ["Test supported color settings p3/uint8, falls back to srgb/uint8", {colorSpace: "p3", pixelFormat: "uint8"}, - {colorSpace: "srgb", pixelFormat: "uint8"}], + {colorSpace: "p3", pixelFormat: "uint8"}], ["Test supported color settings p3/float16", {colorSpace: "p3", pixelFormat: "float16"}, {colorSpace: "p3", pixelFormat: "float16"}],
diff --git a/third_party/blink/web_tests/fast/canvas/color-space/canvas-createImageBitmap-p3.html b/third_party/blink/web_tests/fast/canvas/color-space/canvas-createImageBitmap-p3.html index 7f4bf0bb..83b33d0 100644 --- a/third_party/blink/web_tests/fast/canvas/color-space/canvas-createImageBitmap-p3.html +++ b/third_party/blink/web_tests/fast/canvas/color-space/canvas-createImageBitmap-p3.html
@@ -3,49 +3,50 @@ <script src="../../../resources/testharnessreport.js"></script> <script> -// The reference values are generated by calling SkImage::makeColorSpace() -// in a Skia fiddle as this is the API used in ImageBitmap for color conversion. -// Please see: https://fiddle.skia.org/c/94578944d9d52c2b4c2cadda88a4e204 -// For the transparent sRGB color converted values from image, please see: -// https://fiddle.skia.org/c/7e2176335d016e42a84e44a9624ae0ac +// Reference values generated by: +// https://fiddle.skia.org/c/8e7238b69744678e75b3e34715b29e0b var transparentBlack = [0, 0, 0, 0]; -var p3Red = [0.823242, 0.031372, 0.015686, 1]; // sRGB(255,0,0,255) -var p3Green = [0.176392, 0.968262, 0.070557, 1]; // sRGB(0,255,0,255) -var p3Blue = [0, 0, 0.909668, 1]; // sRGB(0,0,255,255) -var p3Black = [0, 0, 0, 1]; // sRGB(0,0,0,255) +// sRGB(255,0,0,255) +var p3Red = [0.91748, 0.19995, 0.13721, 1.00000]; +// sRGB(0,255,0,255) +var p3Green = [0.45874, 0.98389, 0.29785, 1.00000]; +// sRGB(0,0,255,255) +var p3Blue = [0.00000, 0.00000, 0.96045, 1.00000]; +// sRGB(0,0,0,255) +var p3Black = [0.00000, 0.00000, 0.00000, 1.00000]; // sRGB(155,27,27,255) -var p3OpaqueRed = [0.270508, 0.019608, 0.015686, 1]; +var p3OpaqueRed = [0.55664, 0.15686, 0.13330, 1.00000]; // sRGB(27,155,27,255) -var p3OpaqueGreen = [0.066650, 0.317627, 0.035278, 1]; +var p3OpaqueGreen = [0.28613, 0.59961, 0.20386, 1.00000]; // sRGB(27,27,155,255) -var p3OpaqueBlue = [0.011765, 0.011765, 0.297852, 1]; +var p3OpaqueBlue = [0.10583, 0.10583, 0.58398, 1.00000]; // sRGB(27,27,27,255) -var p3OpaqueBlack = [0.011765, 0.011765, 0.011765, 1]; +var p3OpaqueBlack = [0.10583, 0.10583, 0.10583, 1.00000]; // sRGB(155,27,27,128) -var p3TransparentRed = [0.270508, 0.019608, 0.015686, 0.501953]; +var p3TransparentRed = [0.55664, 0.15686, 0.13330, 0.50195]; // sRGB(27,155,27,128) -var p3TransparentGreen = [0.066650, 0.317627, 0.035278, 0.501953]; +var p3TransparentGreen = [0.28613, 0.59961, 0.20386, 0.50195]; // sRGB(27,27,155,128) -var p3TransparentBlue = [0.011765, 0.011765, 0.297852, 0.501953]; +var p3TransparentBlue = [0.10583, 0.10583, 0.58398, 0.50195]; // sRGB(27,27,27,128) -var p3TransparentBlack = [0.011765, 0.011765, 0.011765, 0.501953]; +var p3TransparentBlack = [0.10583, 0.10583, 0.10583, 0.50195]; // sRGB(226,31,31,128) -var p3TransparentRedImage = [0.626465, 0.038055, 0.026062, 0.501953]; +var p3TransparentRedImage = [0.81543, 0.21558, 0.17639, 0.50195]; // sRGB(226,31,31,128) -var p3TransparentGreenImage = [0.145752, 0.733887, 0.067261, 0.501953]; +var p3TransparentGreenImage = [0.41943, 0.87402, 0.29004, 0.50195]; // sRGB(226,31,31,128) -var p3TransparentBlueImage = [0.013336, 0.013329, 0.691895, 0.501953]; +var p3TransparentBlueImage = [0.12152, 0.12152, 0.85059, 0.50195]; // sRGB(226,31,31,128) -var p3TransparentBlackImage = [0.013336, 0.013336, 0.013336, 0.501953]; +var p3TransparentBlackImage = [0.12152, 0.12152, 0.12152, 0.50195]; function testPixels(ctx, tests, sourceType) { - var actual, expected, tolerance = 0.01; + var actual, expected, tolerance = 0.02; if (sourceType == 'video') tolerance = 0.03; for (var i = 0; i < tests.length; i++) {
diff --git a/third_party/blink/web_tests/fast/canvas/color-space/canvas-createImageBitmap-rec2020.html b/third_party/blink/web_tests/fast/canvas/color-space/canvas-createImageBitmap-rec2020.html index 37359351..c35e564 100644 --- a/third_party/blink/web_tests/fast/canvas/color-space/canvas-createImageBitmap-rec2020.html +++ b/third_party/blink/web_tests/fast/canvas/color-space/canvas-createImageBitmap-rec2020.html
@@ -3,51 +3,52 @@ <script src="../../../resources/testharnessreport.js"></script> <script> -// The reference values are generated by calling SkImage::makeColorSpace() -// in a Skia fiddle as this is the API used in ImageBitmap for color conversion. -// Please see: https://fiddle.skia.org/c/94578944d9d52c2b4c2cadda88a4e204 -// For the transparent sRGB color converted values from image, please see: -// https://fiddle.skia.org/c/7e2176335d016e42a84e44a9624ae0ac +// Reference values generated by: +// https://fiddle.skia.org/c/8e7238b69744678e75b3e34715b29e0b var transparentBlack = [0, 0, 0, 0]; -var rec2020Red = [0.627441, 0.070557, 0.015686, 1]; // sRGB(255,0,0,255) -var rec2020Green = [0.329346, 0.917480, 0.086243, 1]; // sRGB(0,255,0,255) -var rec2020Blue = [0.043121, 0.011765, 0.894043, 1]; // sRGB(0,0,255,255) -var rec2020Black = [0, 0, 0, 1]; // sRGB(0,0,0,255) +// sRGB(255,0,0,255) +var rec2020Red = [0.82324, 0.32935, 0.18030, 1.00000]; +// sRGB(0,255,0,255) +var rec2020Green = [0.63135, 0.96436, 0.36450, 1.00000]; +// sRGB(0,0,255,255) +var rec2020Blue = [0.27051, 0.15283, 0.95654, 1.00000]; +// sRGB(0,0,0,255) +var rec2020Black = [0.00000, 0.00000, 0.00000, 1.00000]; // sRGB(155,27,27,255) -var rec2020OpaqueRed = [0.207764, 0.031372, 0.015686, 1]; +var rec2020OpaqueRed = [0.52148, 0.23914, 0.18030, 1.00000]; // sRGB(27,155,27,255) -var rec2020OpaqueGreen = [0.113708, 0.301758, 0.039215, 1]; +var rec2020OpaqueGreen = [0.40771, 0.60742, 0.25879, 1.00000]; // sRGB(27,27,155,255) -var rec2020OpaqueBlue = [0.023529, 0.015686, 0.293945, 1]; +var rec2020OpaqueBlue = [0.21558, 0.17249, 0.59961, 1.00000]; // sRGB(27,27,27,255) -var rec2020OpaqueBlack = [0.011765, 0.011765, 0.011765, 1]; +var rec2020OpaqueBlack = [0.15283, 0.15283, 0.15283, 1.00000]; // sRGB(155,27,27,128) -var rec2020TransparentRed = [0.207764, 0.031372, 0.015686, 0.501953]; +var rec2020TransparentRed = [0.52148, 0.23914, 0.18030, 0.50195]; // sRGB(27,155,27,128) -var rec2020TransparentGreen = [0.113708, 0.301758, 0.039215, 0.501953]; +var rec2020TransparentGreen = [0.40771, 0.60742, 0.25879, 0.50195]; // sRGB(27,27,155,128) -var rec2020TransparentBlue = [0.023529, 0.015686, 0.293945, 0.501953]; +var rec2020TransparentBlue = [0.21558, 0.17249, 0.59961, 0.50195]; // sRGB(27,27,27,128) -var rec2020TransparentBlack = [0.011765, 0.011765, 0.011765, 0.501953]; +var rec2020TransparentBlack = [0.15283, 0.15283, 0.15283, 0.50195]; // sRGB(226,31,31,128) -var rec2020TransparentRedImage = [0.481201, 0.064819, 0.025543, 0.501953]; +var rec2020TransparentRedImage = [0.73682, 0.32153, 0.21960, 0.50195]; // sRGB(226,31,31,128) -var rec2020TransparentGreenImage = [0.258789, 0.698730, 0.078918, 0.501953]; +var rec2020TransparentGreenImage = [0.56836, 0.86230, 0.34888, 0.50195]; // sRGB(226,31,31,128) -var rec2020TransparentBlueImage = [0.045624, 0.021790, 0.681152, 0.501953]; +var rec2020TransparentBlueImage = [0.27832, 0.20386, 0.85059, 0.50195]; // sRGB(226,31,31,128) -var rec2020TransparentBlackImage = [0.013336, 0.013336, 0.013336, 0.501953]; +var rec2020TransparentBlackImage = [0.16858, 0.16858, 0.16858, 0.50195]; function testPixels(ctx, tests, sourceType) { var actual, expected, tolerance = 0.01; if (sourceType === 'video') - tolerance = 0.03; + tolerance = 0.04; for (var i = 0; i < tests.length; i++) { actual = ctx.getImageData(tests[i][0], tests[i][1], 1, 1).dataUnion; expected = tests[i][2];
diff --git a/third_party/blink/web_tests/fast/canvas/color-space/canvas-drawImage-p3.html b/third_party/blink/web_tests/fast/canvas/color-space/canvas-drawImage-p3.html index 8d1dac9b..5955687 100644 --- a/third_party/blink/web_tests/fast/canvas/color-space/canvas-drawImage-p3.html +++ b/third_party/blink/web_tests/fast/canvas/color-space/canvas-drawImage-p3.html
@@ -3,13 +3,17 @@ <script src="../../../resources/testharnessreport.js"></script> <script> -// The reference values are generated by calling SkImage::makeColorSpace() -// in a Skia fiddle. Original colors are picked using gimp. -// Please see: https://fiddle.skia.org/c/7e2176335d016e42a84e44a9624ae0ac -var p3TransparentRed = [0.626465, 0.038055, 0.026062, 0.501953]; -var p3TransparentGreen = [0.145752, 0.733887, 0.067261, 0.501953]; -var p3TransparentBlue = [0.013336, 0.013329, 0.691895, 0.501953]; -var p3TransparentBlack = [0.013336, 0.013336, 0.013336, 0.501953]; +// Reference values generated by: +// https://fiddle.skia.org/c/8e7238b69744678e75b3e34715b29e0b + +// sRGB(155,27,27,255) +var p3OpaqueRed = [0.55664, 0.15686, 0.13330, 1.0]; +// sRGB(27,155,27,255) +var p3OpaqueGreen = [0.28613, 0.59961, 0.20386, 1.0]; +// sRGB(27,27,155,255) +var p3OpaqueBlue = [0.10583, 0.10583, 0.58398, 1.0]; +// sRGB(27,27,27,255) +var p3OpaqueBlack = [0.10583, 0.10583, 0.10583, 1.0]; function testPixels(ctx, tests) { @@ -31,10 +35,10 @@ var ctx = canvas.getContext('2d', {colorSpace: 'p3', pixelFormat:'float16'}); ctx.drawImage(source, 0, 0); - var tests = [{x: 5, y: 5, color: p3TransparentRed}, - {x: 15, y: 5, color: p3TransparentGreen}, - {x: 5, y: 15, color: p3TransparentBlue}, - {x: 15, y: 15, color: p3TransparentBlack}]; + var tests = [{x: 5, y: 5, color: p3OpaqueRed}, + {x: 15, y: 5, color: p3OpaqueGreen}, + {x: 5, y: 15, color: p3OpaqueBlue}, + {x: 15, y: 15, color: p3OpaqueBlack}]; testPixels(ctx, tests); } @@ -44,7 +48,7 @@ image.onload = function() { resolve(image); } - image.src = 'resources/pattern-semitransparent-srgb.png' + image.src = 'resources/pattern-srgb.png' }).then(drawSRGBImageOnP3Canvas); }, 'Draw SRGB image on a P3 canvas and read back the P3 pixels.');
diff --git a/third_party/blink/web_tests/fast/canvas/color-space/canvas-drawImage-rec2020.html b/third_party/blink/web_tests/fast/canvas/color-space/canvas-drawImage-rec2020.html index 9f19d811..28c25a0 100644 --- a/third_party/blink/web_tests/fast/canvas/color-space/canvas-drawImage-rec2020.html +++ b/third_party/blink/web_tests/fast/canvas/color-space/canvas-drawImage-rec2020.html
@@ -3,13 +3,17 @@ <script src="../../../resources/testharnessreport.js"></script> <script> -// The reference values are generated by calling SkImage::makeColorSpace() -// in a Skia fiddle. Original colors are picked using gimp. -// Please see: https://fiddle.skia.org/c/7e2176335d016e42a84e44a9624ae0ac -var rec2020TransparentRed = [0.481201, 0.064819, 0.025543, 0.501953]; -var rec2020TransparentGreen = [0.258789, 0.698730, 0.078918, 0.501953]; -var rec2020TransparentBlue = [0.045624, 0.021790, 0.681152, 0.501953]; -var rec2020TransparentBlack = [0.013336, 0.013336, 0.013336, 0.501953] +// Reference values generated by: +// https://fiddle.skia.org/c/8e7238b69744678e75b3e34715b29e0b + +// sRGB(155,27,27,255) +var rec2020OpaqueRed = [0.52148, 0.23914, 0.18030, 1.0]; +// sRGB(27,155,27,255) +var rec2020OpaqueGreen = [0.40771, 0.60742, 0.25879, 1.0]; +// sRGB(27,27,155,255) +var rec2020OpaqueBlue = [0.21558, 0.17249, 0.59961, 1.0]; +// sRGB(27,27,27,255) +var rec2020OpaqueBlack = [0.15283, 0.15283, 0.15283, 1.0]; function testPixels(ctx, tests) { @@ -31,10 +35,10 @@ var ctx = canvas.getContext('2d', {colorSpace: 'rec2020', pixelFormat:'float16'}); ctx.drawImage(source, 0, 0); - var tests = [{x: 5, y: 5, color: rec2020TransparentRed}, - {x: 15, y: 5, color: rec2020TransparentGreen}, - {x: 5, y: 15, color: rec2020TransparentBlue}, - {x: 15, y: 15, color: rec2020TransparentBlack}]; + var tests = [{x: 5, y: 5, color: rec2020OpaqueRed}, + {x: 15, y: 5, color: rec2020OpaqueGreen}, + {x: 5, y: 15, color: rec2020OpaqueBlue}, + {x: 15, y: 15, color: rec2020OpaqueBlack}]; testPixels(ctx, tests); } @@ -44,7 +48,7 @@ image.onload = function() { resolve(image); } - image.src = 'resources/pattern-semitransparent-srgb.png' + image.src = 'resources/pattern-srgb.png' }).then(drawSRGBImageOnRec2020Canvas); }, 'Draw SRGB image on a Rec2020 canvas and read back the Rec2020 pixels.');
diff --git a/third_party/blink/web_tests/fast/canvas/color-space/canvas-getImageData-p3.html b/third_party/blink/web_tests/fast/canvas/color-space/canvas-getImageData-p3.html index fa5d21d..eabb1d2 100644 --- a/third_party/blink/web_tests/fast/canvas/color-space/canvas-getImageData-p3.html +++ b/third_party/blink/web_tests/fast/canvas/color-space/canvas-getImageData-p3.html
@@ -28,7 +28,7 @@ var pixel = ctx.getImageData(5, 5, 1, 1).dataUnion; // Check against the same color in P3. 0.01 protects the test against // color conversion deviations. - assert_array_approx_equals(pixel, [0.05, 0.12, 0.29, 1], 0.01); + assert_array_approx_equals(pixel, [0.24304, 0.38818, 0.57227, 1], 0.01); } function putImageDataP3ThenGetImageDataP3() { @@ -38,9 +38,9 @@ var ctx = canvas.getContext('2d', {colorSpace: 'p3', pixelFormat:'float16'}) var dataP3 = new Float32Array(4); - dataP3[0] = 0.05; - dataP3[1] = 0.12; - dataP3[2] = 0.29; + dataP3[0] = 0.24304; + dataP3[1] = 0.38818; + dataP3[2] = 0.57227; dataP3[3] = 1; var imageData = ctx.createImageData(dataP3, 1, 1, {colorSpace: 'p3', storageFormat:'float32'}); @@ -48,7 +48,7 @@ var pixel = ctx.getImageData(5, 5, 1, 1).dataUnion; // Check against the same color in P3. 0.001 protects the test against // rounding errors. - assert_array_approx_equals(pixel, [0.05, 0.12, 0.29, 1], 0.001); + assert_array_approx_equals(pixel, [0.24304, 0.38818, 0.57227, 1], 0.001); } function putImageDataSRGBThenGetImageDataP3() { @@ -68,7 +68,7 @@ var pixel = ctx.getImageData(5, 5, 1, 1).dataUnion; // Check against the same color in P3. 0.01 protects the test against // color conversion deviations. - assert_array_approx_equals(pixel, [0.05, 0.12, 0.29, 1], 0.01); + assert_array_approx_equals(pixel, [0.24304, 0.38818, 0.57227, 1], 0.01); } </script> </body>
diff --git a/third_party/blink/web_tests/fast/canvas/color-space/canvas-getImageData-rec2020.html b/third_party/blink/web_tests/fast/canvas/color-space/canvas-getImageData-rec2020.html index ae353bb..f71e2f0 100644 --- a/third_party/blink/web_tests/fast/canvas/color-space/canvas-getImageData-rec2020.html +++ b/third_party/blink/web_tests/fast/canvas/color-space/canvas-getImageData-rec2020.html
@@ -28,7 +28,7 @@ var pixel = ctx.getImageData(5, 5, 1, 1).dataUnion; // Check against the same color in Rec2020. 0.01 protects the test against // color conversion deviations. - assert_array_approx_equals(pixel, [0.07, 0.12, 0.28, 1], 0.01); + assert_array_approx_equals(pixel, [0.34106, 0.41553, 0.59180, 1.00000], 0.01); } function putImageDataRec2020ThenGetImageDataRec2020() { @@ -38,17 +38,17 @@ var ctx = canvas.getContext('2d', {colorSpace: 'rec2020', pixelFormat:'float16'}) var dataRec2020 = new Float32Array(4); - dataRec2020[0] = 0.07; - dataRec2020[1] = 0.12; - dataRec2020[2] = 0.28; - dataRec2020[3] = 1; + dataRec2020[0] = 0.34106; + dataRec2020[1] = 0.41553; + dataRec2020[2] = 0.59180; + dataRec2020[3] = 1.00000; var imageData = ctx.createImageData(dataRec2020, 1, 1, {colorSpace: 'rec2020', storageFormat:'float32'}); ctx.putImageData(imageData, 5, 5); var pixel = ctx.getImageData(5, 5, 1, 1).dataUnion; // Check against the same color in Rec2020. 0.001 protects the test against // rounding errors. - assert_array_approx_equals(pixel, [0.07, 0.12, 0.28, 1], 0.001); + assert_array_approx_equals(pixel, [0.34106, 0.41553, 0.59180, 1.00000], 0.001); } function putImageDataSRGBThenGetImageDataRec2020() { @@ -68,7 +68,7 @@ var pixel = ctx.getImageData(5, 5, 1, 1).dataUnion; // Check against the same color in Rec2020. 0.01 protects the test against // color conversion deviations. - assert_array_approx_equals(pixel, [0.07, 0.12, 0.28, 1], 0.01); + assert_array_approx_equals(pixel, [0.34106, 0.41553, 0.59180, 1.00000], 0.01); } </script> </body>
diff --git a/third_party/blink/web_tests/fast/canvas/color-space/imageData-colorManagedBehavior.html b/third_party/blink/web_tests/fast/canvas/color-space/imageData-colorManagedBehavior.html index f1bda5abf..342a4e5b 100644 --- a/third_party/blink/web_tests/fast/canvas/color-space/imageData-colorManagedBehavior.html +++ b/third_party/blink/web_tests/fast/canvas/color-space/imageData-colorManagedBehavior.html
@@ -3,37 +3,32 @@ <script src="../../../resources/testharnessreport.js"></script> <script> -// The reference values are generated by calling SkImage::makeColorSpace() -// in a Skia fiddle as this is the API used in ImageBitmap for color conversion. -// Please see: https://fiddle.skia.org/c/98bb1e501e016874a090472f9d84eb1e +// Reference values generated by: +// https://fiddle.skia.org/c/8e7238b69744678e75b3e34715b29e0b var srgbPixels = - [[155,27,27,128, "srgbRed"], [27,155,27,128, "srgbGreen"], - [27,27,155,128, "srgbBlue"], [27,27,27,128, "srgbBlack"]]; + [[155,27,27,128, "srgbRed"], + [27,155,27,128, "srgbGreen"], + [27,27,155,128, "srgbBlue"], + [27,27,27,128, "srgbBlack"]]; var e_srgbPixels = - [[0.607422, 0.121521, 0.121521, 0.501953, "e_sRgbRed"], - [0.121521, 0.607422, 0.121521, 0.501953, "e_sRgbGreen"], - [0.121521, 0.121521, 0.607422, 0.501953, "e_sRgbBlue"], - [0.121521, 0.121521, 0.121521, 0.501953, "e_sRgbBlack"]]; - -var linearRgbPixels = - [[0.326904, 0.013336, 0.013336, 0.501953, "linearRgbRed"], - [0.013336, 0.326904, 0.013336, 0.501953, "linearRgbGreen"], - [0.013336, 0.013336, 0.326904, 0.501953, "linearRgbBlue"], - [0.013336, 0.013336, 0.013336, 0.501953, "linearRgbBlack"]]; + [[0.60742, 0.10583, 0.10583, 0.50195, "e_sRgbRed"], + [0.10583, 0.60742, 0.10583, 0.50195, "e_sRgbGreen"], + [0.10583, 0.10583, 0.60742, 0.50195, "e_sRgbBlue"], + [0.10583, 0.10583, 0.10583, 0.50195, "e_sRgbBlack"]]; var rec2020Pixels = - [[0.210205, 0.035004, 0.018463, 0.501953, "rec2020Red"], - [0.116638, 0.301758, 0.040924, 0.501953, "rec2020Green"], - [0.026917, 0.016891, 0.294189, 0.501953, "rec2020Blue"], - [0.013336, 0.013336, 0.013336, 0.501953, "rec2020Black"]]; + [[0.52148, 0.23914, 0.18030, 0.50195, "rec2020Red"], + [0.40771, 0.60742, 0.25879, 0.50195, "rec2020Green"], + [0.21558, 0.17249, 0.59961, 0.50195, "rec2020Blue"], + [0.15283, 0.15283, 0.15283, 0.50195, "rec2020Black"]]; var p3Pixels = - [[0.271240, 0.023743, 0.018692, 0.501953, "p3Red"], - [0.069031, 0.316406, 0.036041, 0.501953, "p3Green"], - [0.013336, 0.013329, 0.298828, 0.501953, "p3Blue"], - [0.013336, 0.013336, 0.013336, 0.501953, "p3Black"]]; + [[0.55664, 0.15686, 0.13330, 0.50195, "p3Red"], + [0.28613, 0.59961, 0.20386, 0.50195, "p3Green"], + [0.10583, 0.10583, 0.58398, 0.50195, "p3Blue"], + [0.10583, 0.10583, 0.10583, 0.50195, "p3Black"]]; var xWidth = xHeight = 2; var colorCorrectionToleranceSRGB = 1;
diff --git a/third_party/blink/web_tests/flag-specific/disable-layout-ng/fast/ruby/ruby-run-break-expected.png b/third_party/blink/web_tests/flag-specific/disable-layout-ng/fast/ruby/ruby-run-break-expected.png new file mode 100644 index 0000000..5fd88fe --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/disable-layout-ng/fast/ruby/ruby-run-break-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/http/tests/devtools/elements/styles-4/cssom-constructed-expected.txt b/third_party/blink/web_tests/http/tests/devtools/elements/styles-4/cssom-constructed-expected.txt index 3792cc20..6824062b 100644 --- a/third_party/blink/web_tests/http/tests/devtools/elements/styles-4/cssom-constructed-expected.txt +++ b/third_party/blink/web_tests/http/tests/devtools/elements/styles-4/cssom-constructed-expected.txt
@@ -4,7 +4,7 @@ element.style { () [expanded] -div { ((index):1 -> :1:6) +div { ((index):1 -> :1:5) color: red; [expanded]
diff --git a/third_party/blink/web_tests/http/tests/devtools/elements/styles-4/cssom-insert-rule-expected.txt b/third_party/blink/web_tests/http/tests/devtools/elements/styles-4/cssom-insert-rule-expected.txt new file mode 100644 index 0000000..7808843 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/devtools/elements/styles-4/cssom-insert-rule-expected.txt
@@ -0,0 +1,26 @@ +Tests that edited stylesheets appear properly. + +[expanded] +element.style { () + +[expanded] +.rule4 { (<style>) + color: white; + +[expanded] +.rule2 { (<style>) +/-- overloaded --/ color: yellow; + +[expanded] +.rule1 { (<style>) +/-- overloaded --/ color: green; + +[expanded] +.rule0 { (<style>) +/-- overloaded --/ color: black; + +[expanded] +div { (user agent stylesheet) + display: block; + +
diff --git a/third_party/blink/web_tests/http/tests/devtools/elements/styles-4/cssom-insert-rule.js b/third_party/blink/web_tests/http/tests/devtools/elements/styles-4/cssom-insert-rule.js new file mode 100644 index 0000000..6af3612 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/devtools/elements/styles-4/cssom-insert-rule.js
@@ -0,0 +1,35 @@ +// 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. + +(async function() { + TestRunner.addResult(`Tests that edited stylesheets appear properly.\n`); + await TestRunner.loadModule('elements_test_runner'); + await TestRunner.showPanel('elements'); + await TestRunner.loadHTML(` + <style> + .rule1 { + color: green; + } + .rule3 { + color: grey; + } + </style> + <div class="rule0 rule1 rule2 rule3 rule4" id="inspected">Text</div> + `); + + await TestRunner.evaluateInPagePromise(` + const sheet = document.querySelector('style').sheet; + sheet.insertRule('.rule0 {color: black}', 0); + sheet.insertRule('.rule2 {color: yellow}', 2); + sheet.insertRule('.rule4 {color: white}', 4); + sheet.deleteRule(3); + `); + + ElementsTestRunner.selectNodeAndWaitForStyles('inspected', dump); + + async function dump() { + await ElementsTestRunner.dumpSelectedElementStyles(true); + TestRunner.completeTest(); + } +})();
diff --git a/third_party/blink/web_tests/platform/linux/fast/ruby/ruby-run-break-expected.png b/third_party/blink/web_tests/platform/linux/fast/ruby/ruby-run-break-expected.png index 5fd88fe..80041ec 100644 --- a/third_party/blink/web_tests/platform/linux/fast/ruby/ruby-run-break-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/ruby/ruby-run-break-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/fast/ruby/ruby-run-break-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/fast/ruby/ruby-run-break-expected.png index e93dc32..8ca7ac7b 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.12/fast/ruby/ruby-run-break-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.12/fast/ruby/ruby-run-break-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/ruby/ruby-run-break-expected.png b/third_party/blink/web_tests/platform/mac/fast/ruby/ruby-run-break-expected.png index 1c2fe3d9..6d6546c4 100644 --- a/third_party/blink/web_tests/platform/mac/fast/ruby/ruby-run-break-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/ruby/ruby-run-break-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/ruby/ruby-run-break-expected.png b/third_party/blink/web_tests/platform/win/fast/ruby/ruby-run-break-expected.png index ecba47e..9a1abb0 100644 --- a/third_party/blink/web_tests/platform/win/fast/ruby/ruby-run-break-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/ruby/ruby-run-break-expected.png Binary files differ
diff --git a/third_party/jstemplate/README.chromium b/third_party/jstemplate/README.chromium index 14b92f3..7d332e6 100644 --- a/third_party/jstemplate/README.chromium +++ b/third_party/jstemplate/README.chromium
@@ -22,3 +22,5 @@ Local modifications: Changed JSDoc annotations and subtle code changes to make it compile with modern versions of Closure Compiler. TODO(dbeam): upstream to google code project. + +Added Trusted Types support to jstemplate.
diff --git a/third_party/jstemplate/compile.py b/third_party/jstemplate/compile.py index 9aef596..26fc928 100755 --- a/third_party/jstemplate/compile.py +++ b/third_party/jstemplate/compile.py
@@ -6,6 +6,7 @@ """Combines the javascript files needed by jstemplate into a single file.""" import httplib +import sys import urllib
diff --git a/third_party/jstemplate/jsevalcontext.js b/third_party/jstemplate/jsevalcontext.js index f958a1e..b517c0d 100644 --- a/third_party/jstemplate/jsevalcontext.js +++ b/third_party/jstemplate/jsevalcontext.js
@@ -303,11 +303,28 @@ /** - * Uninlined string literals for jsEvalToFunction() (IE6 perf). + * This is used to create TrustedScript. + * + * @type {TrustedTypePolicy|undefined} */ -var STRING_a = 'a_'; -var STRING_b = 'b_'; -var STRING_with = 'with (a_) with (b_) return '; +let opaqueScriptPolicy; +if (window.trustedTypes) { + opaqueScriptPolicy = + trustedTypes.createPolicy('jstemplate', { + createScript: opaqueScript => { + // This is relatively safe because attribute's values can + // only reach here with `JsEvalContext` bootstrap. And even + // if opaqueScript calls dangerous sinks (e.g. innerHTML), + // it'll still be subject to type check with Trusted Types. + // This could be exploited if bootstrap is called with an + // event which can be triggered after the page load + // (e.g. onclick). + // TODO(crbug.com/525224): Eliminate the use of jstemplate + // in WebUI + return opaqueScript; + }, + }); +} /** @@ -331,9 +348,16 @@ function jsEvalToFunction(expr) { if (!JsEvalContext.evalToFunctionCache_[expr]) { try { - // NOTE(mesch): The Function constructor is faster than eval(). - JsEvalContext.evalToFunctionCache_[expr] = - new Function(STRING_a, STRING_b, STRING_with + expr); + /** @type {string} */ + const f = `(function(a_, b_) { with (a_) with (b_) return ${expr} })`; + /** @type {!TrustedScript|string} */ + const opaqueExpr = window.trustedTypes ? opaqueScriptPolicy.createScript(f) : f; + + // TODO(crbug.com/1087743): Support Function constructor in Trusted Types + // TODO(crbug.com/1091600): Support TrustedScript type as an argument to + // eval in Closure Compiler + /** @suppress {checkTypes} */ + JsEvalContext.evalToFunctionCache_[expr] = window.eval(opaqueExpr); } catch (e) { log('jsEvalToFunction (' + expr + ') EXCEPTION ' + e); }
diff --git a/third_party/jstemplate/jstemplate_compiled.js b/third_party/jstemplate/jstemplate_compiled.js index d503e90..3c2df30 100644 --- a/third_party/jstemplate/jstemplate_compiled.js +++ b/third_party/jstemplate/jstemplate_compiled.js
@@ -1,10 +1,11 @@ -(function(){var i=null;function k(){return Function.prototype.call.apply(Array.prototype.slice,arguments)}function l(a,b){var c=k(arguments,2);return function(){return b.apply(a,c)}}function m(a,b){var c=new n(b);for(c.f=[a];c.f.length;){var e=c,d=c.f.shift();e.g(d);for(d=d.firstChild;d;d=d.nextSibling)d.nodeType==1&&e.f.push(d)}}function n(a){this.g=a}function o(a){a.style.display=""}function p(a){a.style.display="none"};var q=":",r=/\s*;\s*/;function s(){this.i.apply(this,arguments)}s.prototype.i=function(a,b){if(!this.a)this.a={};if(b){var c=this.a,e=b.a,d;for(d in e)c[d]=e[d]}else for(c in d=this.a,e=t,e)d[c]=e[c];this.a.$this=a;this.a.$context=this;this.d=typeof a!="undefined"&&a!=i?a:"";if(!b)this.a.$top=this.d};var t={$default:i},u=[];function v(a){for(var b in a.a)delete a.a[b];a.d=i;u.push(a)}function w(a,b,c){try{return b.call(c,a.a,a.d)}catch(e){return t.$default}} -function x(a,b,c,e){if(u.length>0){var d=u.pop();s.call(d,b,a);a=d}else a=new s(b,a);a.a.$index=c;a.a.$count=e;return a}var y="a_",z="b_",A="with (a_) with (b_) return ",D={};function E(a){if(!D[a])try{D[a]=new Function(y,z,A+a)}catch(b){}return D[a]}function F(a){for(var b=[],a=a.split(r),c=0,e=a.length;c<e;++c){var d=a[c].indexOf(q);if(!(d<0)){var f;f=a[c].substr(0,d).replace(/^\s+/,"").replace(/\s+$/,"");d=E(a[c].substr(d+1));b.push(f,d)}}return b};var G="jsinstance",H="jsts",I="*",J="div",K="id";function L(){}var M=0,N={0:{}},P={},Q={},R=[];function S(a){a.__jstcache||m(a,function(a){T(a)})}var U=[["jsselect",E],["jsdisplay",E],["jsvalues",F],["jsvars",F],["jseval",function(a){for(var b=[],a=a.split(r),c=0,e=a.length;c<e;++c)if(a[c]){var d=E(a[c]);b.push(d)}return b}],["transclude",function(a){return a}],["jscontent",E],["jsskip",E]]; -function T(a){if(a.__jstcache)return a.__jstcache;var b=a.getAttribute("jstcache");if(b!=i)return a.__jstcache=N[b];for(var b=R.length=0,c=U.length;b<c;++b){var e=U[b][0],d=a.getAttribute(e);Q[e]=d;d!=i&&R.push(e+"="+d)}if(R.length==0)return a.setAttribute("jstcache","0"),a.__jstcache=N[0];var f=R.join("&");if(b=P[f])return a.setAttribute("jstcache",b),a.__jstcache=N[b];for(var h={},b=0,c=U.length;b<c;++b){var d=U[b],e=d[0],g=d[1],d=Q[e];d!=i&&(h[e]=g(d))}b=""+ ++M;a.setAttribute("jstcache",b);N[b]= -h;P[f]=b;return a.__jstcache=h}function V(a,b){a.h.push(b);a.k.push(0)}function W(a){return a.c.length?a.c.pop():[]} -L.prototype.e=function(a,b){var c=X(b),e=c.transclude;if(e)(c=Y(e))?(b.parentNode.replaceChild(c,b),e=W(this),e.push(this.e,a,c),V(this,e)):b.parentNode.removeChild(b);else if(c=c.jsselect){var c=w(a,c,b),d=b.getAttribute(G),f=!1;d&&(d.charAt(0)==I?(d=parseInt(d.substr(1),10),f=!0):d=parseInt(d,10));var h=c!=i&&typeof c=="object"&&typeof c.length=="number",e=h?c.length:1,g=h&&e==0;if(h)if(g)d?b.parentNode.removeChild(b):(b.setAttribute(G,"*0"),p(b));else if(o(b),d===i||d===""||f&&d<e-1){f=W(this); -d=d||0;for(h=e-1;d<h;++d){var j=b.cloneNode(!0);b.parentNode.insertBefore(j,b);Z(j,c,d);g=x(a,c[d],d,e);f.push(this.b,g,j,v,g,i)}Z(b,c,d);g=x(a,c[d],d,e);f.push(this.b,g,b,v,g,i);V(this,f)}else d<e?(f=c[d],Z(b,c,d),g=x(a,f,d,e),f=W(this),f.push(this.b,g,b,v,g,i),V(this,f)):b.parentNode.removeChild(b);else c==i?p(b):(o(b),g=x(a,c,0,1),f=W(this),f.push(this.b,g,b,v,g,i),V(this,f))}else this.b(a,b)}; -L.prototype.b=function(a,b){var c=X(b),e=c.jsdisplay;if(e){if(!w(a,e,b)){p(b);return}o(b)}if(e=c.jsvars)for(var d=0,f=e.length;d<f;d+=2){var h=e[d],g=w(a,e[d+1],b);a.a[h]=g}if(e=c.jsvalues){d=0;for(f=e.length;d<f;d+=2)if(g=e[d],h=w(a,e[d+1],b),g.charAt(0)=="$")a.a[g]=h;else if(g.charAt(0)=="."){for(var g=g.substr(1).split("."),j=b,O=g.length,B=0,$=O-1;B<$;++B){var C=g[B];j[C]||(j[C]={});j=j[C]}j[g[O-1]]=h}else g&&(typeof h=="boolean"?h?b.setAttribute(g,g):b.removeAttribute(g):b.setAttribute(g,""+ -h))}if(e=c.jseval){d=0;for(f=e.length;d<f;++d)w(a,e[d],b)}e=c.jsskip;if(!e||!w(a,e,b))if(c=c.jscontent){if(c=""+w(a,c,b),b.innerHTML!=c){for(;b.firstChild;)e=b.firstChild,e.parentNode.removeChild(e);b.appendChild(this.j.createTextNode(c))}}else{c=W(this);for(e=b.firstChild;e;e=e.nextSibling)e.nodeType==1&&c.push(this.e,a,e);c.length&&V(this,c)}};function X(a){if(a.__jstcache)return a.__jstcache;var b=a.getAttribute("jstcache");if(b)return a.__jstcache=N[b];return T(a)} -function Y(a,b){var c=document;if(b){var e=c.getElementById(a);if(!e){var e=b(),d=H,f=c.getElementById(d);if(!f)f=c.createElement(J),f.id=d,p(f),f.style.position="absolute",c.body.appendChild(f);d=c.createElement(J);f.appendChild(d);d.innerHTML=e;e=c.getElementById(a)}c=e}else c=c.getElementById(a);return c?(S(c),c=c.cloneNode(!0),c.removeAttribute(K),c):i}function Z(a,b,c){c==b.length-1?a.setAttribute(G,I+c):a.setAttribute(G,""+c)};window.jstGetTemplate=Y;window.JsEvalContext=s;window.jstProcess=function(a,b){var c=new L;S(b);c.j=b?b.nodeType==9?b:b.ownerDocument||document:document;var e=l(c,c.e,a,b),d=c.h=[],f=c.k=[];c.c=[];e();for(var h,g,j;d.length;)h=d[d.length-1],e=f[f.length-1],e>=h.length?(e=c,g=d.pop(),g.length=0,e.c.push(g),f.pop()):(g=h[e++],j=h[e++],h=h[e++],f[f.length-1]=e,g.call(c,j,h))}; +(function(){function l(a,b,c){return Function.prototype.call.apply(Array.prototype.slice,arguments)}function m(a,b,c){var e=l(arguments,2);return function(){return b.apply(a,e)}}function n(a,b){var c=new p(b);for(c.h=[a];c.h.length;){var e=c,d=c.h.shift();e.i(d);for(d=d.firstChild;d;d=d.nextSibling)1==d.nodeType&&e.h.push(d)}}function p(a){this.i=a}function q(a){a.style.display=""}function r(a){a.style.display="none"};var t=/\s*;\s*/;function u(a,b){this.l.apply(this,arguments)}u.prototype.l=function(a,b){this.a||(this.a={});if(b){var c=this.a,e=b.a;for(d in e)c[d]=e[d]}else{var d=this.a;e=v;for(c in e)d[c]=e[c]}this.a.$this=a;this.a.$context=this;this.f="undefined"!=typeof a&&null!=a?a:"";b||(this.a.$top=this.f)};var v={$default:null},w=[];function x(a){for(var b in a.a)delete a.a[b];a.f=null;w.push(a)}function y(a,b,c){try{return b.call(c,a.a,a.f)}catch(e){return v.$default}} +u.prototype.clone=function(a,b,c){if(0<w.length){var e=w.pop();u.call(e,a,this);a=e}else a=new u(a,this);a.a.$index=b;a.a.$count=c;return a};var z;window.trustedTypes&&(z=trustedTypes.createPolicy("jstemplate",{createScript:function(a){return a}}));var A={};function B(a){if(!A[a])try{var b="(function(a_, b_) { with (a_) with (b_) return "+a+" })",c=window.trustedTypes?z.createScript(b):b;A[a]=window.eval(c)}catch(e){}return A[a]} +function E(a){var b=[];a=a.split(t);for(var c=0,e=a.length;c<e;++c){var d=a[c].indexOf(":");if(!(0>d)){var g=a[c].substr(0,d).replace(/^\s+/,"").replace(/\s+$/,"");d=B(a[c].substr(d+1));b.push(g,d)}}return b};function F(){}var G=0,H={0:{}},I={},J={},K=[];function L(a){a.__jstcache||n(a,function(b){M(b)})}var N=[["jsselect",B],["jsdisplay",B],["jsvalues",E],["jsvars",E],["jseval",function(a){var b=[];a=a.split(t);for(var c=0,e=a.length;c<e;++c)if(a[c]){var d=B(a[c]);b.push(d)}return b}],["transclude",function(a){return a}],["jscontent",B],["jsskip",B]]; +function M(a){if(a.__jstcache)return a.__jstcache;var b=a.getAttribute("jstcache");if(null!=b)return a.__jstcache=H[b];b=K.length=0;for(var c=N.length;b<c;++b){var e=N[b][0],d=a.getAttribute(e);J[e]=d;null!=d&&K.push(e+"="+d)}if(0==K.length)return a.setAttribute("jstcache","0"),a.__jstcache=H[0];var g=K.join("&");if(b=I[g])return a.setAttribute("jstcache",b),a.__jstcache=H[b];var h={};b=0;for(c=N.length;b<c;++b){d=N[b];e=d[0];var f=d[1];d=J[e];null!=d&&(h[e]=f(d))}b=""+ ++G;a.setAttribute("jstcache", +b);H[b]=h;I[g]=b;return a.__jstcache=h}function P(a,b){a.j.push(b);a.o.push(0)}function Q(a){return a.c.length?a.c.pop():[]} +F.prototype.g=function(a,b){var c=R(b),e=c.transclude;if(e)(c=S(e))?(b.parentNode.replaceChild(c,b),e=Q(this),e.push(this.g,a,c),P(this,e)):b.parentNode.removeChild(b);else if(c=c.jsselect){c=y(a,c,b);var d=b.getAttribute("jsinstance");var g=!1;d&&("*"==d.charAt(0)?(d=parseInt(d.substr(1),10),g=!0):d=parseInt(d,10));var h=null!=c&&"object"==typeof c&&"number"==typeof c.length;e=h?c.length:1;var f=h&&0==e;if(h)if(f)d?b.parentNode.removeChild(b):(b.setAttribute("jsinstance","*0"),r(b));else if(q(b), +null===d||""===d||g&&d<e-1){g=Q(this);d=d||0;for(h=e-1;d<h;++d){var k=b.cloneNode(!0);b.parentNode.insertBefore(k,b);T(k,c,d);f=a.clone(c[d],d,e);g.push(this.b,f,k,x,f,null)}T(b,c,d);f=a.clone(c[d],d,e);g.push(this.b,f,b,x,f,null);P(this,g)}else d<e?(g=c[d],T(b,c,d),f=a.clone(g,d,e),g=Q(this),g.push(this.b,f,b,x,f,null),P(this,g)):b.parentNode.removeChild(b);else null==c?r(b):(q(b),f=a.clone(c,0,1),g=Q(this),g.push(this.b,f,b,x,f,null),P(this,g))}else this.b(a,b)}; +F.prototype.b=function(a,b){var c=R(b),e=c.jsdisplay;if(e){if(!y(a,e,b)){r(b);return}q(b)}if(e=c.jsvars)for(var d=0,g=e.length;d<g;d+=2){var h=e[d],f=y(a,e[d+1],b);a.a[h]=f}if(e=c.jsvalues)for(d=0,g=e.length;d<g;d+=2)if(f=e[d],h=y(a,e[d+1],b),"$"==f.charAt(0))a.a[f]=h;else if("."==f.charAt(0)){f=f.substr(1).split(".");for(var k=b,O=f.length,C=0,U=O-1;C<U;++C){var D=f[C];k[D]||(k[D]={});k=k[D]}k[f[O-1]]=h}else f&&("boolean"==typeof h?h?b.setAttribute(f,f):b.removeAttribute(f):b.setAttribute(f,""+h)); +if(e=c.jseval)for(d=0,g=e.length;d<g;++d)y(a,e[d],b);e=c.jsskip;if(!e||!y(a,e,b))if(c=c.jscontent){if(c=""+y(a,c,b),b.innerHTML!=c){for(;b.firstChild;)e=b.firstChild,e.parentNode.removeChild(e);b.appendChild(this.m.createTextNode(c))}}else{c=Q(this);for(e=b.firstChild;e;e=e.nextSibling)1==e.nodeType&&c.push(this.g,a,e);c.length&&P(this,c)}};function R(a){if(a.__jstcache)return a.__jstcache;var b=a.getAttribute("jstcache");return b?a.__jstcache=H[b]:M(a)} +function S(a,b){var c=document;if(b){var e=c.getElementById(a);if(!e){e=b();var d=c.getElementById("jsts");d||(d=c.createElement("div"),d.id="jsts",r(d),d.style.position="absolute",c.body.appendChild(d));var g=c.createElement("div");d.appendChild(g);g.innerHTML=e;e=c.getElementById(a)}c=e}else c=c.getElementById(a);return c?(L(c),c=c.cloneNode(!0),c.removeAttribute("id"),c):null}function T(a,b,c){c==b.length-1?a.setAttribute("jsinstance","*"+c):a.setAttribute("jsinstance",""+c)};window.jstGetTemplate=S;window.JsEvalContext=u;window.jstProcess=function(a,b){var c=new F;L(b);c.m=b?9==b.nodeType?b:b.ownerDocument||document:document;var e=m(c,c.g,a,b),d=c.j=[],g=c.o=[];c.c=[];e();for(var h,f,k;d.length;)h=d[d.length-1],e=g[g.length-1],e>=h.length?(e=c,f=d.pop(),f.length=0,e.c.push(f),g.pop()):(f=h[e++],k=h[e++],h=h[e++],g[g.length-1]=e,f.call(c,k,h))}; })() \ No newline at end of file
diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec index b69c0f07..68157f8 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec
@@ -113,13 +113,6 @@ "chrome/browser/resources/bookmarks/bookmarks_resources_vulcanized.grd": { "includes": [1300], }, - "chrome/browser/resources/chromeos/camera/camera_resources.grd": { - "includes": [1320], - "structures": [1340], - }, - "chrome/browser/resources/chromeos/camera/src/strings/camera_strings.grd": { - "messages": [1360], - }, "chrome/browser/resources/chromeos/cellular_setup/cellular_setup_resources.grd": { "structures": [1380], }, @@ -284,6 +277,13 @@ "META": {"align": 100}, "messages": [2500], }, + "chromeos/components/camera_app_ui/resources/camera_app_resources.grd": { + "includes": [2505], + "structures": [2510], + }, + "chromeos/components/camera_app_ui/resources/src/strings/camera_strings.grd": { + "messages": [2515], + }, "chromeos/components/help_app_ui/resources/help_app_resources.grd": { "includes": [2520], },
diff --git a/tools/gritsettings/translation_expectations.pyl b/tools/gritsettings/translation_expectations.pyl index 1ab8ed1..921b0e7 100644 --- a/tools/gritsettings/translation_expectations.pyl +++ b/tools/gritsettings/translation_expectations.pyl
@@ -36,12 +36,12 @@ "chrome/app/chromium_strings.grd", "chrome/app/generated_resources.grd", "chrome/app/google_chrome_strings.grd", - "chrome/browser/resources/chromeos/camera/src/strings/camera_strings.grd", "chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings.grd", "chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings.grd", "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", "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 746e410..8afd46e9 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -27632,6 +27632,7 @@ <int value="3310" label="StorageAccessAPI_HasStorageAccess_Method"/> <int value="3311" label="StorageAccessAPI_requestStorageAccess_Method"/> <int value="3312" label="WebBluetoothWatchAdvertisements"/> + <int value="3313" label="RubyTextWithNonDefaultTextAlign"/> </enum> <enum name="FeaturePolicyAllowlistType">
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index b87cbc3..5fb298b3 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -15512,7 +15512,7 @@ <histogram name="Autofill.SuggestionAccepted.OffTheRecord" units="units" expires_after="M85"> <obsolete> - Expired, M85 + Removed, M85 </obsolete> <owner>rhalavati@chromium.org</owner> <owner>chrome-privacy-core@google.com</owner> @@ -15545,7 +15545,7 @@ <histogram name="Autofill.SuggestionShown.OffTheRecord" units="units" expires_after="M85"> <obsolete> - Expired, M85 + Removed, M85 </obsolete> <owner>rhalavati@chromium.org</owner> <owner>chrome-privacy-core@google.com</owner> @@ -22589,6 +22589,9 @@ <histogram name="Bookmarks.AddedPerProfileType" enum="BrowserProfileType" expires_after="M85"> + <obsolete> + Removed, M85 + </obsolete> <owner>rhalavati@chromium.org</owner> <owner>chrome-privacy-core@google.com</owner> <summary> @@ -22598,6 +22601,9 @@ <histogram name="Bookmarks.BookmarkAllTabsWithTabsCount.Incognito" units="tabs" expires_after="M85"> + <obsolete> + Removed, M85 + </obsolete> <owner>rhalavati@chromium.org</owner> <owner>chrome-privacy-core@google.com</owner> <summary> @@ -22608,6 +22614,9 @@ <histogram name="Bookmarks.BookmarkAllTabsWithTabsCount.Regular" units="tabs" expires_after="M85"> + <obsolete> + Removed, M85 + </obsolete> <owner>rhalavati@chromium.org</owner> <owner>chrome-privacy-core@google.com</owner> <summary> @@ -23074,7 +23083,8 @@ </summary> </histogram> -<histogram name="Browser.WindowCount.Guest" units="units" expires_after="M85"> +<histogram name="Browser.WindowCount.Guest" units="units" + expires_after="2021-06-01"> <owner>rhalavati@chromium.org</owner> <owner>chrome-privacy-core@google.com</owner> <summary> @@ -23086,7 +23096,7 @@ </histogram> <histogram name="Browser.WindowCount.Incognito" units="units" - expires_after="M85"> + expires_after="2021-06-01"> <owner>rhalavati@chromium.org</owner> <owner>chrome-privacy-core@google.com</owner> <summary> @@ -74271,8 +74281,10 @@ </histogram> <histogram name="Media.Audio.Capture.Win.InitError" enum="Hresult" - expires_after="M82"> + expires_after="2021-01-01"> <owner>tommi@chromium.org</owner> + <owner>guidou@chromium.org</owner> + <owner>olka@chromium.org</owner> <summary> Error codes from IAudioClient::Initialize() in WASAPIAudioInputStream::InitializeAudioEngine on Windows. @@ -74280,8 +74292,9 @@ </histogram> <histogram name="Media.Audio.Capture.Win.InitError.FormatRelated" - enum="AudioStreamFormatRelatedInitError" expires_after="M85"> - <owner>grunell@chromium.org</owner> + enum="AudioStreamFormatRelatedInitError" expires_after="2021-01-01"> + <owner>guidou@chromium.org</owner> + <owner>olka@chromium.org</owner> <summary> Errors from IAudioClient::Initialize() in WASAPIAudioInputStream::InitializeAudioEngine on Windows that are related to @@ -74612,7 +74625,7 @@ <histogram name="Media.Audio.Render.AudioInputsPerMixer.LatencyExact" units="inputs" expires_after="M85"> <obsolete> - Removed on April 2020. + Removed in June 2020. </obsolete> <owner>guidou@chromium.org</owner> <owner>olka@chromium.org</owner> @@ -74627,6 +74640,9 @@ <histogram name="Media.Audio.Render.AudioInputsPerMixer.LatencyInteractive" units="inputs" expires_after="M85"> + <obsolete> + Removed in June 2020. + </obsolete> <owner>olka@chromium.org</owner> <summary> Number of simultaneous inputs coming to the AudioRendererMixer which renders @@ -74639,6 +74655,9 @@ <histogram name="Media.Audio.Render.AudioInputsPerMixer.LatencyPlayback" units="inputs" expires_after="2020-04-05"> + <obsolete> + Removed in June 2020. + </obsolete> <owner>olka@chromium.org</owner> <summary> Number of simultaneous inputs coming to the AudioRendererMixer which renders @@ -74651,6 +74670,9 @@ <histogram name="Media.Audio.Render.AudioInputsPerMixer.LatencyRtc" units="inputs" expires_after="M85"> + <obsolete> + Removed in June 2020. + </obsolete> <owner>olka@chromium.org</owner> <summary> Number of simultaneous inputs coming to the AudioRendererMixer which renders @@ -75133,8 +75155,9 @@ </histogram> <histogram name="Media.AudioCapturerMissedReadDeadline" units="%" - expires_after="M85"> - <owner>grunell@chromium.org</owner> + expires_after="2021-06-01"> + <owner>gudou@chromium.org</owner> + <owner>olka@chromium.org</owner> <summary> The percentage of input audio data blocks that had to be buffered because there was not room in the shared memory ring buffer on the browser/renderer @@ -75209,8 +75232,9 @@ </histogram> <histogram name="Media.AudioInputControllerSessionSilenceReport" - enum="AudioInputSilenceReport" expires_after="M85"> - <owner>grunell@chromium.org</owner> + enum="AudioInputSilenceReport" expires_after="2021-06-01"> + <owner>guidou@chromium.org</owner> + <owner>olka@chromium.org</owner> <summary> Every 15 seconds during the lifetime of an audio input stream, the sound level is measured, see AudioInputController::CheckAudioPower(). If the level @@ -75388,7 +75412,7 @@ </histogram> <histogram name="Media.AudioOutputStreamProxy.StreamFormat" - enum="AudioOutputProxyStreamFormat" expires_after="M85"> + enum="AudioOutputProxyStreamFormat" expires_after="2021-01-01"> <owner>olka@chromium.org</owner> <summary> Records format used by AudioManager to create audio output stream proxy. If @@ -75463,8 +75487,9 @@ </histogram> <histogram name="Media.AudioRendererMissedDeadline" units="%" - expires_after="M85"> + expires_after="2021-06-01"> <owner>dalecurtis@chromium.org</owner> + <owner>olka@chromium.org</owner> <summary> Percentage of AudioSyncReader::Read() calls where the renderer missed its realtime deadline. @@ -88196,7 +88221,7 @@ </histogram> <histogram name="Navigation.MainFrameProfileType" enum="BrowserProfileType" - expires_after="M85"> + expires_after="2021-06-01"> <owner>rhalavati@chromium.org</owner> <owner>chrome-privacy-core@google.com</owner> <summary> @@ -112700,7 +112725,7 @@ </histogram> <histogram name="Omnibox.Search.OffTheRecord" enum="BooleanOffTheRecord" - expires_after="M85"> + expires_after="2021-06-01"> <owner>rhalavati@chromium.org</owner> <owner>chrome-privacy-core@google.com</owner> <summary> @@ -121094,7 +121119,7 @@ <histogram name="PasswordManager.DropdownShown.OffTheRecord" units="units" expires_after="M85"> <obsolete> - Expired, M85 + Removed, M85 </obsolete> <owner>rhalavati@chromium.org</owner> <owner>chrome-privacy-core@google.com</owner> @@ -121590,7 +121615,7 @@ <histogram name="PasswordManager.ItemSelected.OffTheRecord" units="units" expires_after="M85"> <obsolete> - Expired, M85 + Removed, M85 </obsolete> <owner>rhalavati@chromium.org</owner> <owner>chrome-privacy-core@google.com</owner> @@ -134543,7 +134568,7 @@ </histogram> <histogram name="Profile.Incognito.Lifetime" units="minutes" - expires_after="M85"> + expires_after="2021-06-01"> <owner>rhalavati@chromium.org</owner> <owner>chrome-privacy-core@google.com</owner> <summary> @@ -170598,7 +170623,7 @@ </summary> </histogram> -<histogram name="Tab.Count.Guest" units="units" expires_after="M85"> +<histogram name="Tab.Count.Guest" units="units" expires_after="2021-06-01"> <owner>rhalavati@chromium.org</owner> <owner>chrome-privacy-core@google.com</owner> <summary> @@ -170611,7 +170636,7 @@ </summary> </histogram> -<histogram name="Tab.Count.Incognito" units="units" expires_after="M85"> +<histogram name="Tab.Count.Incognito" units="units" expires_after="2021-06-01"> <owner>rhalavati@chromium.org</owner> <owner>chrome-privacy-core@google.com</owner> <summary>
diff --git a/tools/origin_trials/check_token.py b/tools/origin_trials/check_token.py index 29ad934..9fdbef28 100755 --- a/tools/origin_trials/check_token.py +++ b/tools/origin_trials/check_token.py
@@ -46,6 +46,9 @@ VERSION2 = "\x02" VERSION3 = "\x03" +# Only empty string and "subset" are supported in alternative usage restriction. +USAGE_RESTRICTION = ["", "subset"] + # Chrome public key, used by default to validate signatures # - Copied from chrome/common/origin_trials/chrome_origin_trial_policy.cc CHROME_PUBLIC_KEY = [ @@ -212,7 +215,18 @@ is_subdomain = token_data.get("isSubdomain") is_third_party = token_data.get("isThirdParty") if (is_third_party is not None and version != VERSION3): - print("isThirdParty flag can only be be set in Version 3 token.") + print("The isThirdParty field can only be be set in Version 3 token.") + sys.exit(1) + + usage_restriction = token_data.get("usage") + if (usage_restriction is not None and version != VERSION3): + print("The usage field can only be be set in Version 3 token.") + sys.exit(1) + if (usage_restriction is not None and not is_third_party): + print("Only third party token supports alternative usage restriction.") + sys.exit(1) + if (usage_restriction not in USAGE_RESTRICTION): + print("Only empty string and \"subset\" are supported in the usage field.") sys.exit(1) # Output the token details @@ -222,6 +236,7 @@ print(" Is Subdomain: %s" % is_subdomain) if (version == VERSION3): print(" Is Third Party: %s" % is_third_party) + print(" Usage Restriction: %s" % usage_restriction) print(" Feature: %s" % trial_name) print(" Expiry: %d (%s UTC)" % (expiry, datetime.utcfromtimestamp(expiry))) print(" Signature: %s" % ", ".join('0x%02x' % ord(x) for x in signature))
diff --git a/tools/origin_trials/generate_token.py b/tools/origin_trials/generate_token.py index befb051..a337810 100755 --- a/tools/origin_trials/generate_token.py +++ b/tools/origin_trials/generate_token.py
@@ -10,6 +10,7 @@ --expire-timestamp EXPIRE_TIMESTAMP] [--is_subdomain | --no-subdomain] [--is_third-party | --no-third-party] + [--usage-restriction USAGE_RESTRICTION] --version=VERSION origin trial_name @@ -41,6 +42,10 @@ # This script generates Version 2 and 3 tokens. VERSION = {"2": (2, "\x02"), "3": (3, "\x03")} +# Only empty string and "subset" are currently supoprted in alternative usage +# resetriction. +USAGE_RESTRICTION = ["", "subset"] + # Default key file, relative to script_dir. DEFAULT_KEY_FILE = 'eftest.key' @@ -106,15 +111,17 @@ def GenerateTokenData(version, origin, is_subdomain, is_third_party, - feature_name, expiry): + usage_restriction, feature_name, expiry): data = {"origin": origin, "feature": feature_name, "expiry": expiry} if is_subdomain is not None: data["isSubdomain"] = is_subdomain - # Only version 3 token supports is_third_party flag. + # Only version 3 token supports fields: is_third_party, usage. if version == 3 and is_third_party is not None: data["isThirdParty"] = is_third_party + if version == 3 and usage_restriction is not None: + data["usage"] = usage_restriction return json.dumps(data).encode('utf-8') def GenerateDataToSign(version, data): @@ -177,6 +184,11 @@ action="store_false") parser.set_defaults(is_third_party=None) + parser.add_argument("--usage-restriction", + help="Alternative token usage resctriction. This option " + "is only available for token version 3. Currently only " + "subset exclusion is supported.") + expiry_group = parser.add_mutually_exclusive_group() expiry_group.add_argument("--expire-days", help="Days from now when the token should expire", @@ -209,9 +221,23 @@ print("Only version 3 token supports is_third_party flag.") sys.exit(1) + if (args.usage_restriction is not None): + if (args.version[0] != 3): + print("Only version 3 token supports alternative usage restriction.") + sys.exit(1) + if (not args.is_third_party): + print("Only third party token supports alternative usage restriction.") + sys.exit(1) + if (args.usage_restriction not in USAGE_RESTRICTION): + print( + "Only empty string and \"subset\" are supported in alternative usage " + "restriction.") + sys.exit(1) + token_data = GenerateTokenData(args.version[0], args.origin, args.is_subdomain, args.is_third_party, - args.trial_name, expiry) + args.usage_restriction, args.trial_name, + expiry) data_to_sign = GenerateDataToSign(args.version[1], token_data) signature = Sign(private_key, data_to_sign) @@ -231,6 +257,7 @@ print(" Is Subdomain: %s" % args.is_subdomain) if args.version[0] == 3: print(" Is Third Party: %s" % args.is_third_party) + print(" Usage Restriction: %s" % args.usage_restriction) print(" Feature: %s" % args.trial_name) print(" Expiry: %d (%s UTC)" % (expiry, datetime.utcfromtimestamp(expiry))) print(" Signature: %s" % ", ".join('0x%02x' % ord(x) for x in signature))
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 28fd8bf9..4bdf3686 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -10,7 +10,7 @@ }, "linux": { "hash": "e761278db51e8f2d20fa0f43921f3f85090dfbc9", - "remote_path": "perfetto_binaries/trace_processor_shell/linux/3755aca72039c54e42fded4b16a1f2ac2c48fbf5/trace_processor_shell" + "remote_path": "perfetto_binaries/trace_processor_shell/linux/080c1b433d370e62a2cdd9912f473391f7d40da9/trace_processor_shell" } } } \ No newline at end of file
diff --git a/ui/chromeos/translations/ui_chromeos_strings_iw.xtb b/ui/chromeos/translations/ui_chromeos_strings_iw.xtb index 5d9ec8f64..7250d96 100644 --- a/ui/chromeos/translations/ui_chromeos_strings_iw.xtb +++ b/ui/chromeos/translations/ui_chromeos_strings_iw.xtb
@@ -164,6 +164,7 @@ <translation id="2924296707677495905">תעתוק (namaskaram → ನಮಸ್ಕಾರ)</translation> <translation id="2925966894897775835">גיליונות אלקטרוניים</translation> <translation id="2938685643439809023">מונגולית</translation> +<translation id="2939410873710774399">כדי לפתוח קבצים בעזרת <ph name="APP_NAME" /> (<ph name="VM_SOFTWARE_NAME" />), קודם צריך להעביר אותם אל התיקייה <ph name="FOLDER_NAME" />.</translation> <translation id="2942290791863759244">מקלדת גרמנית NEO 2</translation> <translation id="2943400156390503548">שקופיות</translation> <translation id="2943503720238418293">השם צריך להיות קצר יותר</translation> @@ -324,6 +325,7 @@ <translation id="4839847978919684242"><ph name="SELCTED_FILES_COUNT" /> פריטים נבחרו</translation> <translation id="4850886885716139402">הצגה</translation> <translation id="485316830061041779">גרמנית</translation> +<translation id="4859297381873413734">כדי לפתוח קבצים בעזרת <ph name="APP_NAME" /> (<ph name="VM_SOFTWARE_NAME" />), קודם צריך להעתיק אותם אל התיקייה <ph name="FOLDER_NAME" />.</translation> <translation id="4867079195717347957">יש ללחוץ כדי למיין את העמודה בסדר יורד.</translation> <translation id="4873265419374180291"><ph name="NUMBER_OF_BYTES" /> בייטים</translation> <translation id="4880214202172289027">מחוון עוצמת קול</translation>
diff --git a/ui/chromeos/translations/ui_chromeos_strings_mk.xtb b/ui/chromeos/translations/ui_chromeos_strings_mk.xtb index 5903e1a5..be6a684 100644 --- a/ui/chromeos/translations/ui_chromeos_strings_mk.xtb +++ b/ui/chromeos/translations/ui_chromeos_strings_mk.xtb
@@ -164,6 +164,7 @@ <translation id="2924296707677495905">Транслитерација (namaskaram → ನಮಸ್ಕಾರ)</translation> <translation id="2925966894897775835">Табели</translation> <translation id="2938685643439809023">монголски</translation> +<translation id="2939410873710774399">За да отворате датотеки со <ph name="APP_NAME" /> (<ph name="VM_SOFTWARE_NAME" />), прво преместете ги во папката <ph name="FOLDER_NAME" />.</translation> <translation id="2942290791863759244">германска тастатура NEO 2</translation> <translation id="2943400156390503548">Слајдови</translation> <translation id="2943503720238418293">Користете пократко име</translation> @@ -324,6 +325,7 @@ <translation id="4839847978919684242">Избрани ставки: <ph name="SELCTED_FILES_COUNT" /></translation> <translation id="4850886885716139402">Приказ</translation> <translation id="485316830061041779">германски</translation> +<translation id="4859297381873413734">За да отворате датотеко со <ph name="APP_NAME" /> (<ph name="VM_SOFTWARE_NAME" />), прво ископирајте ги во папката <ph name="FOLDER_NAME" />.</translation> <translation id="4867079195717347957">Кликнете за подредување на колоната по опаѓачки редослед.</translation> <translation id="4873265419374180291"><ph name="NUMBER_OF_BYTES" /> бајти</translation> <translation id="4880214202172289027">Лизгач за јачина на звук</translation>
diff --git a/ui/gfx/linux/client_native_pixmap_dmabuf.cc b/ui/gfx/linux/client_native_pixmap_dmabuf.cc index 2ba91d10..a7fd94a 100644 --- a/ui/gfx/linux/client_native_pixmap_dmabuf.cc +++ b/ui/gfx/linux/client_native_pixmap_dmabuf.cc
@@ -102,6 +102,20 @@ } #endif + bool disable_yuv_biplanar = true; +#if defined(OS_CHROMEOS) + // IsConfigurationSupported(SCANOUT_CPU_READ_WRITE) is used by the renderer + // to tell whether the platform supports sampling a given format. Zero-copy + // video capture and encoding requires gfx::BufferFormat::YUV_420_BIPLANAR to + // be supported by the renderer. Most of Chrome OS platforms support it, so + // enable it by default, with a switch that allows an explicit disable on + // platforms known to have problems, e.g. the Tegra-based nyan." + // TODO(crbug.com/982201): move gfx::BufferFormat::YUV_420_BIPLANAR out + // of if defined(ARCH_CPU_X86_FAMLIY) when Tegra is no longer supported. + disable_yuv_biplanar = base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDisableYuv420Biplanar); +#endif + switch (usage) { case gfx::BufferUsage::GPU_READ: return format == gfx::BufferFormat::BGR_565 || @@ -124,10 +138,15 @@ if (format == gfx::BufferFormat::RG_88 && !AllowCpuMappableBuffers()) return false; + if (!disable_yuv_biplanar && + format == gfx::BufferFormat::YUV_420_BIPLANAR) { + return true; + } + return #if defined(ARCH_CPU_X86_FAMILY) - // Currently only Intel driver (i.e. minigbm and Mesa) supports - // R_8 RG_88, NV12 and XB30/XR30. + // The minigbm backends and Mesa drivers commonly used on x86 systems + // support the following formats. format == gfx::BufferFormat::R_8 || format == gfx::BufferFormat::RG_88 || format == gfx::BufferFormat::YUV_420_BIPLANAR || @@ -145,10 +164,16 @@ case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: if (!AllowCpuMappableBuffers()) return false; + + if (!disable_yuv_biplanar && + format == gfx::BufferFormat::YUV_420_BIPLANAR) { + return true; + } + return #if defined(ARCH_CPU_X86_FAMILY) - // Only the Intel stack (i.e. minigbm and Mesa) supports the formats - // below. + // The minigbm backends and Mesa drivers commonly used on x86 systems + // support the following formats. format == gfx::BufferFormat::R_8 || format == gfx::BufferFormat::RG_88 || format == gfx::BufferFormat::YUV_420_BIPLANAR ||
diff --git a/ui/gfx/switches.cc b/ui/gfx/switches.cc index 0f746ea..16eeda0d 100644 --- a/ui/gfx/switches.cc +++ b/ui/gfx/switches.cc
@@ -16,6 +16,10 @@ const char kDisableFontSubpixelPositioning[] = "disable-font-subpixel-positioning"; +// Disable a NV12 format buffer allocation with +// gfx::BufferUsage::SCANOUT_CPU_READ_WRITE usage. +const char kDisableYuv420Biplanar[] = "disable-yuv420-biplanar"; + // Enable native CPU-mappable GPU memory buffer support on Linux. const char kEnableNativeGpuMemoryBuffers[] = "enable-native-gpu-memory-buffers";
diff --git a/ui/gfx/switches.h b/ui/gfx/switches.h index abe0a58..fa86fc52 100644 --- a/ui/gfx/switches.h +++ b/ui/gfx/switches.h
@@ -12,10 +12,10 @@ GFX_SWITCHES_EXPORT extern const char kAnimationDurationScale[]; GFX_SWITCHES_EXPORT extern const char kDisableFontSubpixelPositioning[]; +GFX_SWITCHES_EXPORT extern const char kDisableYuv420Biplanar[]; GFX_SWITCHES_EXPORT extern const char kEnableNativeGpuMemoryBuffers[]; GFX_SWITCHES_EXPORT extern const char kForcePrefersReducedMotion[]; GFX_SWITCHES_EXPORT extern const char kHeadless[]; - } // namespace switches #endif // UI_GFX_SWITCHES_H_
diff --git a/ui/native_theme/themed_vector_icon.cc b/ui/native_theme/themed_vector_icon.cc index 3881f84..bf3b0e65 100644 --- a/ui/native_theme/themed_vector_icon.cc +++ b/ui/native_theme/themed_vector_icon.cc
@@ -43,13 +43,14 @@ ThemedVectorIcon& ThemedVectorIcon::operator=(ThemedVectorIcon&&) = default; -const gfx::ImageSkia ThemedVectorIcon::GetImageSkia(NativeTheme* theme) const { +const gfx::ImageSkia ThemedVectorIcon::GetImageSkia( + const NativeTheme* theme) const { DCHECK(!empty()); return icon_size_ > 0 ? CreateVectorIcon(*icon_, icon_size_, GetColor(theme)) : CreateVectorIcon(*icon_, GetColor(theme)); } -const gfx::ImageSkia ThemedVectorIcon::GetImageSkia(NativeTheme* theme, +const gfx::ImageSkia ThemedVectorIcon::GetImageSkia(const NativeTheme* theme, int icon_size) const { DCHECK(!empty()); return CreateVectorIcon(*icon_, icon_size, GetColor(theme)); @@ -61,7 +62,7 @@ : CreateVectorIcon(*icon_, color); } -SkColor ThemedVectorIcon::GetColor(NativeTheme* theme) const { +SkColor ThemedVectorIcon::GetColor(const NativeTheme* theme) const { DCHECK(color_id_ || color_); return color_id_ ? theme->GetSystemColor(color_id_.value()) : color_.value(); }
diff --git a/ui/native_theme/themed_vector_icon.h b/ui/native_theme/themed_vector_icon.h index e65348c..bf929d6a 100644 --- a/ui/native_theme/themed_vector_icon.h +++ b/ui/native_theme/themed_vector_icon.h
@@ -40,12 +40,13 @@ void clear() { icon_ = nullptr; } bool empty() const { return !icon_; } - const gfx::ImageSkia GetImageSkia(NativeTheme* theme) const; - const gfx::ImageSkia GetImageSkia(NativeTheme* theme, int icon_size) const; + const gfx::ImageSkia GetImageSkia(const NativeTheme* theme) const; + const gfx::ImageSkia GetImageSkia(const NativeTheme* theme, + int icon_size) const; const gfx::ImageSkia GetImageSkia(SkColor color) const; private: - SkColor GetColor(NativeTheme* theme) const; + SkColor GetColor(const NativeTheme* theme) const; const gfx::VectorIcon* icon_ = nullptr; int icon_size_ = 0;
diff --git a/ui/views/controls/combobox/combobox.cc b/ui/views/controls/combobox/combobox.cc index 9e1ef9c..c412fd7 100644 --- a/ui/views/controls/combobox/combobox.cc +++ b/ui/views/controls/combobox/combobox.cc
@@ -23,6 +23,7 @@ #include "ui/gfx/scoped_canvas.h" #include "ui/gfx/text_utils.h" #include "ui/native_theme/native_theme.h" +#include "ui/native_theme/themed_vector_icon.h" #include "ui/views/animation/flood_fill_ink_drop_ripple.h" #include "ui/views/animation/ink_drop_impl.h" #include "ui/views/background.h" @@ -54,6 +55,15 @@ return style::GetColor(combobox, style::CONTEXT_TEXTFIELD, style); } +gfx::ImageSkia GetImageSkiaFromImageModel(const ui::ImageModel* model, + const ui::NativeTheme* native_theme) { + DCHECK(model); + DCHECK(!model->IsEmpty()); + return model->IsImage() ? model->GetImage().AsImageSkia() + : ui::ThemedVectorIcon(model->GetVectorIcon()) + .GetImageSkia(native_theme); +} + // The transparent button which holds a button state but is not rendered. class TransparentButton : public Button { public: @@ -570,11 +580,12 @@ // Draw the icon. ui::ImageModel icon = model()->GetIconAt(selected_index_); if (!icon.IsEmpty()) { - gfx::Image icon_image = icon.GetImage(); - int icon_y = y + (contents_height - icon_image.Height()) / 2; - canvas->DrawImageInt(icon_image.AsImageSkia(), x, icon_y); - x += icon_image.Width() + LayoutProvider::Get()->GetDistanceMetric( - DISTANCE_RELATED_LABEL_HORIZONTAL); + gfx::ImageSkia icon_skia = + GetImageSkiaFromImageModel(&icon, GetNativeTheme()); + int icon_y = y + (contents_height - icon_skia.height()) / 2; + canvas->DrawImageInt(icon_skia, x, icon_y); + x += icon_skia.width() + LayoutProvider::Get()->GetDistanceMetric( + DISTANCE_RELATED_LABEL_HORIZONTAL); } // Draw the text. @@ -665,11 +676,14 @@ if (size_to_largest_label_ || i == selected_index_) { int item_width = gfx::GetStringWidth(model()->GetItemAt(i), font_list); - if (!model()->GetIconAt(i).IsEmpty()) { - gfx::Image icon = model()->GetIconAt(i).GetImage(); - item_width += icon.Width() + LayoutProvider::Get()->GetDistanceMetric( - DISTANCE_RELATED_LABEL_HORIZONTAL); - height = std::max(height, icon.Height()); + ui::ImageModel icon = model()->GetIconAt(i); + if (!icon.IsEmpty()) { + gfx::ImageSkia icon_skia = + GetImageSkiaFromImageModel(&icon, GetNativeTheme()); + item_width += + icon_skia.width() + LayoutProvider::Get()->GetDistanceMetric( + DISTANCE_RELATED_LABEL_HORIZONTAL); + height = std::max(height, icon_skia.height()); } width = std::max(width, item_width); }
diff --git a/weblayer/BUILD.gn b/weblayer/BUILD.gn index 335bec0..968b0da 100644 --- a/weblayer/BUILD.gn +++ b/weblayer/BUILD.gn
@@ -169,6 +169,10 @@ "browser/http_auth_handler_impl.h", "browser/i18n_util.cc", "browser/i18n_util.h", + "browser/infobar_android.cc", + "browser/infobar_android.h", + "browser/infobar_container_android.cc", + "browser/infobar_container_android.h", "browser/javascript_tab_modal_dialog_manager_delegate_android.cc", "browser/javascript_tab_modal_dialog_manager_delegate_android.h", "browser/navigation_controller_impl.cc",
diff --git a/weblayer/browser/infobar_android.cc b/weblayer/browser/infobar_android.cc new file mode 100644 index 0000000..4aa24af9 --- /dev/null +++ b/weblayer/browser/infobar_android.cc
@@ -0,0 +1,91 @@ +// 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 "weblayer/browser/infobar_android.h" + +#include <utility> + +#include "base/android/jni_android.h" +#include "base/android/jni_string.h" +#include "base/strings/string_util.h" +#include "components/infobars/core/infobar.h" +#include "components/infobars/core/infobar_delegate.h" +#include "weblayer/browser/android/resource_mapper.h" +#include "weblayer/browser/java/jni/InfoBar_jni.h" + +using base::android::JavaParamRef; +using base::android::JavaRef; + +namespace weblayer { + +// InfoBarAndroid ------------------------------------------------------------- + +InfoBarAndroid::InfoBarAndroid( + std::unique_ptr<infobars::InfoBarDelegate> delegate) + : infobars::InfoBar(std::move(delegate)) {} + +InfoBarAndroid::~InfoBarAndroid() { + if (!java_info_bar_.is_null()) { + JNIEnv* env = base::android::AttachCurrentThread(); + Java_InfoBar_onNativeDestroyed(env, java_info_bar_); + } +} + +void InfoBarAndroid::ReassignJavaInfoBar(InfoBarAndroid* replacement) { + DCHECK(replacement); + if (!java_info_bar_.is_null()) { + replacement->SetJavaInfoBar(java_info_bar_); + java_info_bar_.Reset(); + } +} + +void InfoBarAndroid::SetJavaInfoBar( + const base::android::JavaRef<jobject>& java_info_bar) { + DCHECK(java_info_bar_.is_null()); + java_info_bar_.Reset(java_info_bar); + JNIEnv* env = base::android::AttachCurrentThread(); + Java_InfoBar_setNativeInfoBar(env, java_info_bar, + reinterpret_cast<intptr_t>(this)); +} + +const JavaRef<jobject>& InfoBarAndroid::GetJavaInfoBar() { + return java_info_bar_; +} + +bool InfoBarAndroid::HasSetJavaInfoBar() const { + return !java_info_bar_.is_null(); +} + +int InfoBarAndroid::GetInfoBarIdentifier(JNIEnv* env, + const JavaParamRef<jobject>& obj) { + return delegate()->GetIdentifier(); +} + +void InfoBarAndroid::OnButtonClicked(JNIEnv* env, + const JavaParamRef<jobject>& obj, + jint action) { + ProcessButton(action); +} + +void InfoBarAndroid::OnCloseButtonClicked(JNIEnv* env, + const JavaParamRef<jobject>& obj) { + if (!owner()) + return; // We're closing; don't call anything, it might access the owner. + delegate()->InfoBarDismissed(); + RemoveSelf(); +} + +void InfoBarAndroid::CloseJavaInfoBar() { + if (!java_info_bar_.is_null()) { + JNIEnv* env = base::android::AttachCurrentThread(); + Java_InfoBar_closeInfoBar(env, java_info_bar_); + java_info_bar_.Reset(nullptr); + } +} + +int InfoBarAndroid::GetJavaIconId() { + return weblayer::MapToJavaDrawableId(delegate()->GetIconId()); +} + +} // namespace weblayer
diff --git a/weblayer/browser/infobar_android.h b/weblayer/browser/infobar_android.h new file mode 100644 index 0000000..5c319688 --- /dev/null +++ b/weblayer/browser/infobar_android.h
@@ -0,0 +1,86 @@ +// 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 WEBLAYER_BROWSER_INFOBAR_ANDROID_H_ +#define WEBLAYER_BROWSER_INFOBAR_ANDROID_H_ + +#include <string> + +#include "base/android/scoped_java_ref.h" +#include "base/macros.h" +#include "components/infobars/core/infobar.h" + +namespace infobars { +class InfoBarDelegate; +} + +namespace weblayer { + +class InfoBarAndroid : public infobars::InfoBar { + public: + // A Java counterpart will be generated for this enum. + // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.weblayer_private + // GENERATED_JAVA_PREFIX_TO_STRIP: ACTION_ + enum ActionType { + ACTION_NONE = 0, + // Confirm infobar + ACTION_OK = 1, + ACTION_CANCEL = 2, + // Translate infobar + ACTION_TRANSLATE = 3, + ACTION_TRANSLATE_SHOW_ORIGINAL = 4, + }; + + explicit InfoBarAndroid(std::unique_ptr<infobars::InfoBarDelegate> delegate); + ~InfoBarAndroid() override; + + // InfoBar: + virtual base::android::ScopedJavaLocalRef<jobject> CreateRenderInfoBar( + JNIEnv* env) = 0; + + virtual void SetJavaInfoBar( + const base::android::JavaRef<jobject>& java_info_bar); + const base::android::JavaRef<jobject>& GetJavaInfoBar(); + bool HasSetJavaInfoBar() const; + + // Tells the Java-side counterpart of this InfoBar to point to the replacement + // InfoBar instead of this one. + void ReassignJavaInfoBar(InfoBarAndroid* replacement); + + int GetInfoBarIdentifier(JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj); + virtual void OnLinkClicked(JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj) {} + void OnButtonClicked(JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj, + jint action); + void OnCloseButtonClicked(JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj); + + void CloseJavaInfoBar(); + + // Maps from a Chromium ID (IDR_TRANSLATE) to a Drawable ID. + int GetJavaIconId(); + + // Acquire the java infobar from a different one. This is used to do in-place + // replacements. + virtual void PassJavaInfoBar(InfoBarAndroid* source) {} + + protected: + // Derived classes must implement this method to process the corresponding + // action. + virtual void ProcessButton(int action) = 0; + + void CloseInfoBar(); + InfoBarAndroid* infobar_android() { return this; } + + private: + base::android::ScopedJavaGlobalRef<jobject> java_info_bar_; + + DISALLOW_COPY_AND_ASSIGN(InfoBarAndroid); +}; + +} // namespace weblayer + +#endif // WEBLAYER_BROWSER_INFOBAR_ANDROID_H_
diff --git a/weblayer/browser/infobar_container_android.cc b/weblayer/browser/infobar_container_android.cc new file mode 100644 index 0000000..368ab76 --- /dev/null +++ b/weblayer/browser/infobar_container_android.cc
@@ -0,0 +1,114 @@ +// 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 "weblayer/browser/infobar_container_android.h" + +#include "base/android/jni_android.h" +#include "base/check.h" +#include "base/metrics/histogram_functions.h" +#include "base/notreached.h" +#include "components/infobars/core/infobar.h" +#include "components/infobars/core/infobar_delegate.h" +#include "content/public/browser/web_contents.h" +#include "weblayer/browser/infobar_android.h" +#include "weblayer/browser/infobar_service.h" +#include "weblayer/browser/java/jni/InfoBarContainer_jni.h" + +using base::android::JavaParamRef; + +namespace weblayer { + +// InfoBarContainerAndroid ---------------------------------------------------- + +InfoBarContainerAndroid::InfoBarContainerAndroid(JNIEnv* env, jobject obj) + : infobars::InfoBarContainer(NULL), + weak_java_infobar_container_(env, obj) {} + +InfoBarContainerAndroid::~InfoBarContainerAndroid() { + RemoveAllInfoBarsForDestruction(); +} + +void InfoBarContainerAndroid::SetWebContents( + JNIEnv* env, + const JavaParamRef<jobject>& obj, + const JavaParamRef<jobject>& web_contents) { + weblayer::InfoBarService* infobar_service = + web_contents + ? weblayer::InfoBarService::FromWebContents( + content::WebContents::FromJavaWebContents(web_contents)) + : nullptr; + ChangeInfoBarManager(infobar_service); +} + +void InfoBarContainerAndroid::Destroy(JNIEnv* env, + const JavaParamRef<jobject>& obj) { + delete this; +} + +void InfoBarContainerAndroid::PlatformSpecificAddInfoBar( + infobars::InfoBar* infobar, + size_t position) { + DCHECK(infobar); + InfoBarAndroid* android_bar = static_cast<InfoBarAndroid*>(infobar); + if (!android_bar) { + // TODO(bulach): CLANK: implement other types of InfoBars. + NOTIMPLEMENTED() << "CLANK: infobar identifier " + << infobar->delegate()->GetIdentifier(); + return; + } + + AttachJavaInfoBar(android_bar); +} + +void InfoBarContainerAndroid::AttachJavaInfoBar(InfoBarAndroid* android_bar) { + if (android_bar->HasSetJavaInfoBar()) + return; + JNIEnv* env = base::android::AttachCurrentThread(); + + if (Java_InfoBarContainer_hasInfoBars( + env, weak_java_infobar_container_.get(env))) { + base::UmaHistogramSparse("InfoBar.Shown.Hidden", + android_bar->delegate()->GetIdentifier()); + infobars::InfoBarDelegate::InfoBarIdentifier identifier = + static_cast<infobars::InfoBarDelegate::InfoBarIdentifier>( + Java_InfoBarContainer_getTopInfoBarIdentifier( + env, weak_java_infobar_container_.get(env))); + if (identifier != infobars::InfoBarDelegate::InfoBarIdentifier::INVALID) { + base::UmaHistogramSparse("InfoBar.Shown.Hiding", identifier); + } + } else { + base::UmaHistogramSparse("InfoBar.Shown.Visible", + android_bar->delegate()->GetIdentifier()); + } + + base::android::ScopedJavaLocalRef<jobject> java_infobar = + android_bar->CreateRenderInfoBar(env); + android_bar->SetJavaInfoBar(java_infobar); + Java_InfoBarContainer_addInfoBar(env, weak_java_infobar_container_.get(env), + java_infobar); +} + +void InfoBarContainerAndroid::PlatformSpecificReplaceInfoBar( + infobars::InfoBar* old_infobar, + infobars::InfoBar* new_infobar) { + static_cast<InfoBarAndroid*>(new_infobar) + ->PassJavaInfoBar(static_cast<InfoBarAndroid*>(old_infobar)); +} + +void InfoBarContainerAndroid::PlatformSpecificRemoveInfoBar( + infobars::InfoBar* infobar) { + InfoBarAndroid* android_infobar = static_cast<InfoBarAndroid*>(infobar); + android_infobar->CloseJavaInfoBar(); +} + +// Native JNI methods --------------------------------------------------------- + +static jlong JNI_InfoBarContainer_Init(JNIEnv* env, + const JavaParamRef<jobject>& obj) { + InfoBarContainerAndroid* infobar_container = + new InfoBarContainerAndroid(env, obj); + return reinterpret_cast<intptr_t>(infobar_container); +} + +} // namespace weblayer
diff --git a/weblayer/browser/infobar_container_android.h b/weblayer/browser/infobar_container_android.h new file mode 100644 index 0000000..4069cf6 --- /dev/null +++ b/weblayer/browser/infobar_container_android.h
@@ -0,0 +1,58 @@ +// 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 WEBLAYER_BROWSER_INFOBAR_CONTAINER_ANDROID_H_ +#define WEBLAYER_BROWSER_INFOBAR_CONTAINER_ANDROID_H_ + +#include <stddef.h> + +#include <map> +#include <string> + +#include "base/android/jni_weak_ref.h" +#include "base/android/scoped_java_ref.h" +#include "base/compiler_specific.h" +#include "base/macros.h" +#include "components/infobars/core/infobar_container.h" + +namespace weblayer { + +class InfoBarAndroid; + +class InfoBarContainerAndroid : public infobars::InfoBarContainer { + public: + InfoBarContainerAndroid(JNIEnv* env, jobject infobar_container); + void SetWebContents(JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj, + const base::android::JavaParamRef<jobject>& web_contents); + void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); + + JavaObjectWeakGlobalRef java_container() const { + return weak_java_infobar_container_; + } + + private: + ~InfoBarContainerAndroid() override; + + // InfobarContainer: + void PlatformSpecificAddInfoBar(infobars::InfoBar* infobar, + size_t position) override; + void PlatformSpecificRemoveInfoBar(infobars::InfoBar* infobar) override; + void PlatformSpecificReplaceInfoBar(infobars::InfoBar* old_infobar, + infobars::InfoBar* new_infobar) override; + + // Create the Java equivalent of |android_bar| and add it to the java + // container. + void AttachJavaInfoBar(InfoBarAndroid* android_bar); + + // We're owned by the java infobar, need to use a weak ref so it can destroy + // us. + JavaObjectWeakGlobalRef weak_java_infobar_container_; + + DISALLOW_COPY_AND_ASSIGN(InfoBarContainerAndroid); +}; + +} // namespace weblayer + +#endif // WEBLAYER_BROWSER_INFOBAR_CONTAINER_ANDROID_H_
diff --git a/weblayer/browser/java/BUILD.gn b/weblayer/browser/java/BUILD.gn index 6b1b5c09..36169c73 100644 --- a/weblayer/browser/java/BUILD.gn +++ b/weblayer/browser/java/BUILD.gn
@@ -12,6 +12,7 @@ "res/layout/site_settings_layout.xml", "res/layout/weblayer_url_bar.xml", "res/values/dimens.xml", + "res/values/ids.xml", "res/values/styles.xml", ] custom_package = "org.chromium.weblayer_private" @@ -52,6 +53,7 @@ java_cpp_enum("generated_enums") { sources = [ "//weblayer/browser/controls_visibility_reason.h", + "//weblayer/browser/infobar_android.h", "//weblayer/public/download.h", "//weblayer/public/navigation.h", "//weblayer/public/new_tab_delegate.h", @@ -80,6 +82,15 @@ "org/chromium/weblayer_private/FragmentAndroidPermissionDelegate.java", "org/chromium/weblayer_private/FragmentWindowAndroid.java", "org/chromium/weblayer_private/FullscreenCallbackProxy.java", + "org/chromium/weblayer_private/InfoBar.java", + "org/chromium/weblayer_private/InfoBarCompactLayout.java", + "org/chromium/weblayer_private/InfoBarContainer.java", + "org/chromium/weblayer_private/InfoBarContainerLayout.java", + "org/chromium/weblayer_private/InfoBarContainerView.java", + "org/chromium/weblayer_private/InfoBarInteractionHandler.java", + "org/chromium/weblayer_private/InfoBarMessageView.java", + "org/chromium/weblayer_private/InfoBarUiItem.java", + "org/chromium/weblayer_private/InfoBarWrapper.java", "org/chromium/weblayer_private/IntentUtils.java", "org/chromium/weblayer_private/InterceptNavigationDelegateClientImpl.java", "org/chromium/weblayer_private/LocaleChangedBroadcastReceiver.java", @@ -93,6 +104,7 @@ "org/chromium/weblayer_private/ProfileManager.java", "org/chromium/weblayer_private/RemoteFragmentImpl.java", "org/chromium/weblayer_private/SiteSettingsFragmentImpl.java", + "org/chromium/weblayer_private/SwipableOverlayView.java", "org/chromium/weblayer_private/TabCallbackProxy.java", "org/chromium/weblayer_private/TabImpl.java", "org/chromium/weblayer_private/UrlBarControllerImpl.java", @@ -142,6 +154,7 @@ "//components/embedder_support/android/metrics:java", "//components/external_intents/android:java", "//components/find_in_page/android:java", + "//components/infobars/core:infobar_enums_java", "//components/javascript_dialogs/android:java", "//components/location/android:settings_java", "//components/metrics:metrics_java", @@ -162,6 +175,8 @@ "//services/network/public/mojom:cookies_mojom_java", "//services/network/public/mojom:mojom_java", "//services/service_manager/public/java:service_manager_java", + "//third_party/android_deps:androidx_appcompat_appcompat_java", + "//third_party/android_deps:androidx_appcompat_appcompat_resources_java", "//third_party/android_deps:androidx_core_core_java", "//third_party/android_deps:androidx_fragment_fragment_java", "//third_party/android_deps:androidx_preference_preference_java", @@ -233,6 +248,8 @@ "org/chromium/weblayer_private/DownloadImpl.java", "org/chromium/weblayer_private/ErrorPageCallbackProxy.java", "org/chromium/weblayer_private/FullscreenCallbackProxy.java", + "org/chromium/weblayer_private/InfoBar.java", + "org/chromium/weblayer_private/InfoBarContainer.java", "org/chromium/weblayer_private/LocaleChangedBroadcastReceiver.java", "org/chromium/weblayer_private/MediaStreamManager.java", "org/chromium/weblayer_private/MojoInterfaceRegistrar.java",
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/InfoBar.java b/weblayer/browser/java/org/chromium/weblayer_private/InfoBar.java new file mode 100644 index 0000000..0720cdd --- /dev/null +++ b/weblayer/browser/java/org/chromium/weblayer_private/InfoBar.java
@@ -0,0 +1,320 @@ +// 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. + +package org.chromium.weblayer_private; + +import android.content.Context; +import android.graphics.Bitmap; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.ColorRes; +import androidx.annotation.Nullable; + +import org.chromium.base.annotations.CalledByNative; +import org.chromium.base.annotations.JNINamespace; +import org.chromium.base.annotations.NativeMethods; +import org.chromium.chrome.browser.infobar.InfoBarIdentifier; +import org.chromium.ui.modelutil.PropertyModel; + +/** + * The base class for all InfoBar classes. + * Note that infobars expire by default when a new navigation occurs. + * Make sure to use setExpireOnNavigation(false) if you want an infobar to be sticky. + */ +@JNINamespace("weblayer") +public abstract class InfoBar implements InfoBarInteractionHandler, InfoBarUiItem { + private static final String TAG = "InfoBar"; + + /** + * Interface for InfoBar to interact with its container. + */ + public interface Container { + /** + * @return True if the infobar is in front. + */ + boolean isFrontInfoBar(InfoBar infoBar); + + /** + * Remove the infobar from its container. + * @param infoBar InfoBar to remove from the View hierarchy. + */ + void removeInfoBar(InfoBar infoBar); + + /** + * Notifies that an infobar's View ({@link InfoBar#getView}) has changed. + */ + void notifyInfoBarViewChanged(); + + /** + * @return True if the container's destroy() method has been called. + */ + boolean isDestroyed(); + } + + private final int mIconDrawableId; + private final Bitmap mIconBitmap; + private final @ColorRes int mIconTintId; + private final CharSequence mMessage; + + private @Nullable Container mContainer; + private @Nullable View mView; + private @Nullable Context mContext; + + private boolean mIsDismissed; + private boolean mControlsEnabled = true; + + private @Nullable PropertyModel mModel; + + // This points to the InfoBarAndroid class not any of its subclasses. + private long mNativeInfoBarPtr; + + /** + * Constructor for regular infobars. + * @param iconDrawableId ID of the resource to use for the Icon. If 0, no icon will be shown. + * @param iconTintId The {@link ColorRes} used as tint for the {@code iconDrawableId}. + * @param message The message to show in the infobar. + * @param iconBitmap Icon to draw, in bitmap form. Used mainly for generated icons. + */ + public InfoBar( + int iconDrawableId, @ColorRes int iconTintId, CharSequence message, Bitmap iconBitmap) { + mIconDrawableId = iconDrawableId; + mIconBitmap = iconBitmap; + mIconTintId = iconTintId; + mMessage = message; + } + + /** + * Stores a pointer to the native-side counterpart of this InfoBar. + * @param nativeInfoBarPtr Pointer to the native InfoBarAndroid, not to its subclass. + */ + @CalledByNative + private final void setNativeInfoBar(long nativeInfoBarPtr) { + mNativeInfoBarPtr = nativeInfoBarPtr; + } + + @CalledByNative + protected void onNativeDestroyed() { + mNativeInfoBarPtr = 0; + } + + /** + * Sets the Context used when creating the InfoBar. + */ + public void setContext(Context context) { + mContext = context; + } + + /** + * @return The {@link Context} used to create the InfoBar. This will be null before the InfoBar + * is added to an {@link InfoBarContainer}, or after the InfoBar is closed. + */ + @Nullable + protected Context getContext() { + return mContext; + } + + /** + * Creates the View that represents the InfoBar. + * @return The View representing the InfoBar. + */ + public final View createView() { + assert mContext != null; + + if (usesCompactLayout()) { + InfoBarCompactLayout layout = new InfoBarCompactLayout( + mContext, this, mIconDrawableId, mIconTintId, mIconBitmap); + createCompactLayoutContent(layout); + mView = layout; + } else { + // WebLayer supports only compact infobars. + assert false; + } + + return mView; + } + + /** + * @return The model for this infobar if one was created. + */ + @Nullable + PropertyModel getModel() { + return mModel; + } + + /** + * If this returns true, the infobar contents will be replaced with a one-line layout. + * When overriding this, also override {@link #getAccessibilityMessage}. + */ + protected boolean usesCompactLayout() { + return false; + } + + /** + * Prepares and inserts views into an {@link InfoBarCompactLayout}. + * {@link #usesCompactLayout} must return 'true' for this function to be called. + * @param layout Layout to plug views into. + */ + protected void createCompactLayoutContent(InfoBarCompactLayout layout) {} + + /** + * Replaces the View currently shown in the infobar with the given View. Triggers the swap + * animation via the InfoBarContainer. + */ + protected void replaceView(View newView) { + mView = newView; + mContainer.notifyInfoBarViewChanged(); + } + + /** + * Returns the View shown in this infobar. Only valid after createView() has been called. + */ + @Override + public View getView() { + return mView; + } + + /** + * Returns the accessibility message to announce when this infobar is first shown. + * Override this if the InfoBar doesn't have {@link R.id.infobar_message}. It is usually the + * case when it is in CompactLayout. + */ + protected CharSequence getAccessibilityMessage(CharSequence defaultTitle) { + return defaultTitle == null ? "" : defaultTitle; + } + + @Override + public CharSequence getAccessibilityText() { + if (mView == null) return ""; + + CharSequence title = null; + TextView messageView = (TextView) mView.findViewById(R.id.infobar_message); + if (messageView != null) { + title = messageView.getText(); + } + title = getAccessibilityMessage(title); + if (title.length() > 0) { + title = title + " "; + } + // TODO(crbug/773717): Avoid string concatenation due to i18n. + return title + mContext.getString(R.string.weblayer_bottom_bar_screen_position); + } + + @Override + public int getPriority() { + return InfoBarPriority.PAGE_TRIGGERED; + } + + @Override + @InfoBarIdentifier + public int getInfoBarIdentifier() { + if (mNativeInfoBarPtr == 0) return InfoBarIdentifier.INVALID; + return InfoBarJni.get().getInfoBarIdentifier(mNativeInfoBarPtr, InfoBar.this); + } + + /** + * @return whether the infobar actually needed closing. + */ + @CalledByNative + private boolean closeInfoBar() { + if (!mIsDismissed) { + mIsDismissed = true; + if (!mContainer.isDestroyed()) { + // If the container was destroyed, it's already been emptied of all its infobars. + onStartedHiding(); + mContainer.removeInfoBar(this); + } + mContainer = null; + mView = null; + mContext = null; + return true; + } + return false; + } + + /** + * @return If the infobar is the front infobar (i.e. visible and not hidden behind other + * infobars). + */ + public boolean isFrontInfoBar() { + return mContainer.isFrontInfoBar(this); + } + + /** + * Called just before the Java infobar has begun hiding. Give the chance to clean up any child + * UI that may remain open. + */ + protected void onStartedHiding() {} + + /** + * Returns pointer to native InfoBarAndroid instance. + * TODO(crbug/1056346): The function is used in subclasses typically to get Tab reference. When + * Tab is modularized, replace this function with the one that returns Tab reference. + */ + protected long getNativeInfoBarPtr() { + return mNativeInfoBarPtr; + } + + /** + * Sets the Container that displays the InfoBar. + */ + public void setContainer(Container container) { + mContainer = container; + } + + /** + * @return Whether or not this InfoBar is already dismissed (i.e. closed). + */ + protected boolean isDismissed() { + return mIsDismissed; + } + + @Override + public boolean areControlsEnabled() { + return mControlsEnabled; + } + + @Override + public void setControlsEnabled(boolean state) { + mControlsEnabled = state; + } + + @Override + public void onClick() { + setControlsEnabled(false); + } + + @Override + public void onButtonClicked(boolean isPrimaryButton) {} + + @Override + public void onLinkClicked() { + if (mNativeInfoBarPtr != 0) InfoBarJni.get().onLinkClicked(mNativeInfoBarPtr, InfoBar.this); + } + + /** + * Performs some action related to the button being clicked. + * @param action The type of action defined in {@link ActionType} in this class. + */ + protected void onButtonClicked(@ActionType int action) { + if (mNativeInfoBarPtr != 0) { + InfoBarJni.get().onButtonClicked(mNativeInfoBarPtr, InfoBar.this, action); + } + } + + @Override + public void onCloseButtonClicked() { + if (mNativeInfoBarPtr != 0 && !mIsDismissed) { + InfoBarJni.get().onCloseButtonClicked(mNativeInfoBarPtr, InfoBar.this); + } + } + + @NativeMethods + interface Natives { + int getInfoBarIdentifier(long nativeInfoBarAndroid, InfoBar caller); + void onLinkClicked(long nativeInfoBarAndroid, InfoBar caller); + void onButtonClicked(long nativeInfoBarAndroid, InfoBar caller, int action); + void onCloseButtonClicked(long nativeInfoBarAndroid, InfoBar caller); + } +}
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/InfoBarCompactLayout.java b/weblayer/browser/java/org/chromium/weblayer_private/InfoBarCompactLayout.java new file mode 100644 index 0000000..1edc13ae --- /dev/null +++ b/weblayer/browser/java/org/chromium/weblayer_private/InfoBarCompactLayout.java
@@ -0,0 +1,230 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.weblayer_private; + +import android.content.Context; +import android.content.res.ColorStateList; +import android.content.res.Resources; +import android.content.res.TypedArray; +import android.graphics.Bitmap; +import android.graphics.drawable.Drawable; +import android.text.SpannableString; +import android.text.SpannableStringBuilder; +import android.text.Spanned; +import android.text.method.LinkMovementMethod; +import android.view.Gravity; +import android.view.View; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.ColorRes; +import androidx.annotation.StringRes; +import androidx.appcompat.content.res.AppCompatResources; + +import org.chromium.base.ApiCompatibilityUtils; +import org.chromium.base.Callback; +import org.chromium.ui.text.NoUnderlineClickableSpan; +import org.chromium.ui.widget.ChromeImageButton; + +/** + * Lays out controls along a line, sandwiched between an (optional) icon and close button. + * This should only be used by the {@link InfoBar} class, and is created when the InfoBar subclass + * declares itself to be using a compact layout via {@link InfoBar#usesCompactLayout}. + */ +public class InfoBarCompactLayout extends LinearLayout implements View.OnClickListener { + private final InfoBarInteractionHandler mInfoBar; + private final int mCompactInfoBarSize; + private final int mIconWidth; + private final View mCloseButton; + + /** + * Constructs a compat layout for the specified infobar. + * @param context The context used to render. + * @param infoBar {@link InfoBarInteractionHandler} that listens to events. + * @param iconResourceId Resource ID of the icon to use for the infobar. + * @param iconTintId The {@link ColorRes} used as tint for {@code iconResourceId}. + * @param iconBitmap Bitmap for the icon to use, if {@code iconResourceId} is not set. + */ + // TODO(crbug/1056346): ctor is made public to allow access from InfoBar. Once + // InfoBar is modularized, restore access to package private. + public InfoBarCompactLayout(Context context, InfoBarInteractionHandler infoBar, + int iconResourceId, @ColorRes int iconTintId, Bitmap iconBitmap) { + super(context); + mInfoBar = infoBar; + mCompactInfoBarSize = + context.getResources().getDimensionPixelOffset(R.dimen.infobar_compact_size); + mIconWidth = context.getResources().getDimensionPixelOffset(R.dimen.infobar_big_icon_size); + + setOrientation(LinearLayout.HORIZONTAL); + setGravity(Gravity.CENTER_VERTICAL); + + prepareIcon(iconResourceId, iconTintId, iconBitmap); + mCloseButton = prepareCloseButton(); + } + + @Override + public void onClick(View view) { + if (view.getId() == R.id.infobar_close_button) { + mInfoBar.onCloseButtonClicked(); + } else { + assert false; + } + } + + /** + * Inserts a view before the close button. + * @param view View to insert. + * @param weight Weight to assign to it. + */ + // TODO(crbug/1056346): addContent is made public to allow access from InfoBar. Once + // InfoBar is modularized, restore access to protected. + public void addContent(View view, float weight) { + LinearLayout.LayoutParams params; + if (weight <= 0.0f) { + params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, mCompactInfoBarSize); + } else { + params = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT, weight); + } + view.setMinimumHeight(mCompactInfoBarSize); + params.gravity = Gravity.BOTTOM; + addView(view, indexOfChild(mCloseButton), params); + } + + /** + * Adds an icon to the start of the infobar, if the infobar requires one. + * @param iconResourceId Resource ID of the icon to use. + * @param iconTintId The {@link ColorRes} used as tint for {@code iconResourceId}. + * @param iconBitmap Raw {@link Bitmap} to use instead of a resource. + */ + private void prepareIcon(int iconResourceId, @ColorRes int iconTintId, Bitmap iconBitmap) { + // TODO(crbug.com/1025620): Port over //chrome's impl of prepareIcon(). This will require + // porting //chrome's InfoBarLayout.createIconView() into this file. + } + + /** + * Creates a close button that can be inserted into an infobar. + * NOTE: This was forked from //chrome's InfoBarLayout.java, as WebLayer supports only compact + * infobars and does not have a corresponding InfoBarLayout.java. + * @param context Context to grab resources from. + * @return {@link ImageButton} that represents a close button. + */ + static ImageButton createCloseButton(Context context) { + final ColorStateList tint = + AppCompatResources.getColorStateList(context, R.color.default_icon_color); + TypedArray a = + context.obtainStyledAttributes(new int[] {android.R.attr.selectableItemBackground}); + Drawable closeButtonBackground = a.getDrawable(0); + a.recycle(); + + ChromeImageButton closeButton = new ChromeImageButton(context); + closeButton.setId(R.id.infobar_close_button); + closeButton.setImageResource(R.drawable.btn_close); + ApiCompatibilityUtils.setImageTintList(closeButton, tint); + closeButton.setBackground(closeButtonBackground); + closeButton.setContentDescription(context.getString(R.string.weblayer_infobar_close)); + closeButton.setScaleType(ImageView.ScaleType.CENTER_INSIDE); + + return closeButton; + } + + /** Adds a close button to the end of the infobar. */ + private View prepareCloseButton() { + ImageButton closeButton = createCloseButton(getContext()); + closeButton.setOnClickListener(this); + LinearLayout.LayoutParams closeParams = + new LinearLayout.LayoutParams(mCompactInfoBarSize, mCompactInfoBarSize); + addView(closeButton, closeParams); + return closeButton; + } + + /** + * Helps building a standard message to display in a compact InfoBar. The message can feature + * a link to perform and action from this infobar. + */ + public static class MessageBuilder { + private final InfoBarCompactLayout mLayout; + private CharSequence mMessage; + private CharSequence mLink; + + /** @param layout The layout we are building a message view for. */ + public MessageBuilder(InfoBarCompactLayout layout) { + mLayout = layout; + } + + public MessageBuilder withText(CharSequence message) { + assert mMessage == null; + mMessage = message; + + return this; + } + + public MessageBuilder withText(@StringRes int messageResId) { + assert mMessage == null; + mMessage = mLayout.getResources().getString(messageResId); + + return this; + } + + /** Appends a link after the main message, its displayed text being the specified string. */ + public MessageBuilder withLink(CharSequence label, Callback<View> onTapCallback) { + assert mLink == null; + + final Resources resources = mLayout.getResources(); + SpannableString link = new SpannableString(label); + link.setSpan(new NoUnderlineClickableSpan(resources, onTapCallback), 0, label.length(), + Spanned.SPAN_INCLUSIVE_EXCLUSIVE); + mLink = link; + + return this; + } + + /** + * Appends a link after the main message, its displayed text being constructed from the + * given resource ID. + */ + public MessageBuilder withLink(@StringRes int textResId, Callback<View> onTapCallback) { + final Resources resources = mLayout.getResources(); + String label = resources.getString(textResId); + return withLink(label, onTapCallback); + } + + /** Finalizes the message view as set up in the builder and inserts it into the layout. */ + public void buildAndInsert() { + mLayout.addContent(build(), 1f); + } + + /** + * Finalizes the message view as set up in the builder. The caller is responsible for adding + * it to the parent layout. + */ + public View build() { + // TODO(dgn): Should be able to handle ReaderMode and Survey infobars but they have non + // standard interaction models (no button/link, whole bar is a button) or style (large + // rather than default text). Revisit after snowflake review. + + assert mMessage != null; + + final int messagePadding = mLayout.getResources().getDimensionPixelOffset( + R.dimen.infobar_compact_message_vertical_padding); + + SpannableStringBuilder builder = new SpannableStringBuilder(); + builder.append(mMessage); + if (mLink != null) builder.append(" ").append(mLink); + + TextView prompt = new InfoBarMessageView(mLayout.getContext()); + ApiCompatibilityUtils.setTextAppearance( + prompt, R.style.TextAppearance_TextMedium_Primary); + prompt.setText(builder); + prompt.setGravity(Gravity.CENTER_VERTICAL); + prompt.setPadding(0, messagePadding, 0, messagePadding); + + if (mLink != null) prompt.setMovementMethod(LinkMovementMethod.getInstance()); + + return prompt; + } + } +}
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/InfoBarContainer.java b/weblayer/browser/java/org/chromium/weblayer_private/InfoBarContainer.java new file mode 100644 index 0000000..27d3db4 --- /dev/null +++ b/weblayer/browser/java/org/chromium/weblayer_private/InfoBarContainer.java
@@ -0,0 +1,474 @@ +// 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. + +package org.chromium.weblayer_private; + +import android.content.Context; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; + +import org.chromium.base.ObserverList; +import org.chromium.base.annotations.CalledByNative; +import org.chromium.base.annotations.JNINamespace; +import org.chromium.base.annotations.NativeMethods; +import org.chromium.chrome.browser.infobar.InfoBarIdentifier; +import org.chromium.content_public.browser.WebContents; +import org.chromium.ui.KeyboardVisibilityDelegate.KeyboardVisibilityListener; + +import java.util.ArrayList; + +/** + * A container for all the infobars of a specific tab. + * Note that infobars creation can be initiated from Java or from native code. + * When initiated from native code, special code is needed to keep the Java and native infobar in + * sync, see NativeInfoBar. + */ +@JNINamespace("weblayer") +public class InfoBarContainer implements KeyboardVisibilityListener, InfoBar.Container { + private static final String TAG = "InfoBarContainer"; + + // TODO(crbug.com/1025620): Port over //chrome's listening to AccessibilityUtil if/as needed. + + /** + * A listener for the InfoBar animations. + */ + public interface InfoBarAnimationListener { + public static final int ANIMATION_TYPE_SHOW = 0; + public static final int ANIMATION_TYPE_SWAP = 1; + public static final int ANIMATION_TYPE_HIDE = 2; + + /** + * Notifies the subscriber when an animation is completed. + */ + void notifyAnimationFinished(int animationType); + + /** + * Notifies the subscriber when all animations are finished. + * @param frontInfoBar The frontmost infobar or {@code null} if none are showing. + */ + void notifyAllAnimationsFinished(InfoBarUiItem frontInfoBar); + } + + /** + * An observer that is notified of changes to a {@link InfoBarContainer} object. + */ + public interface InfoBarContainerObserver { + /** + * Called when an {@link InfoBar} is about to be added (before the animation). + * @param container The notifying {@link InfoBarContainer} + * @param infoBar An {@link InfoBar} being added + * @param isFirst Whether the infobar container was empty + */ + void onAddInfoBar(InfoBarContainer container, InfoBar infoBar, boolean isFirst); + + /** + * Called when an {@link InfoBar} is about to be removed (before the animation). + * @param container The notifying {@link InfoBarContainer} + * @param infoBar An {@link InfoBar} being removed + * @param isLast Whether the infobar container is going to be empty + */ + void onRemoveInfoBar(InfoBarContainer container, InfoBar infoBar, boolean isLast); + + /** + * Called when the InfobarContainer is attached to the window. + * @param hasInfobars True if infobar container has infobars to show. + */ + void onInfoBarContainerAttachedToWindow(boolean hasInfobars); + + /** + * A notification that the shown ratio of the infobar container has changed. + * @param container The notifying {@link InfoBarContainer} + * @param shownRatio The shown ratio of the infobar container. + */ + void onInfoBarContainerShownRatioChanged(InfoBarContainer container, float shownRatio); + } + + // TODO(crbug.com/1025620): Observe WebContents to reset the state of the InfoBarContainer when + // the user navigates, a la //chrome's observing of Tab here. Additionally, notify infobar + // container when activity is changed. + + /** + * Adds/removes the {@link InfoBarContainer} when the tab's view is attached/detached. This is + * mostly to ensure the infobars are not shown in tab switcher overview mode. + */ + private final View.OnAttachStateChangeListener mAttachedStateListener = + new View.OnAttachStateChangeListener() { + @Override + public void onViewDetachedFromWindow(View v) { + if (mInfoBarContainerView == null) return; + mInfoBarContainerView.removeFromParentView(); + } + + @Override + public void onViewAttachedToWindow(View v) { + if (mInfoBarContainerView == null) return; + mInfoBarContainerView.addToParentView(); + } + }; + + /** The list of all InfoBars in this container, regardless of whether they've been shown yet. */ + private final ArrayList<InfoBar> mInfoBars = new ArrayList<>(); + + private final ObserverList<InfoBarContainerObserver> mObservers = new ObserverList<>(); + private final ObserverList<InfoBarAnimationListener> mAnimationListeners = new ObserverList<>(); + + private final InfoBarContainerView.ContainerViewObserver mContainerViewObserver = + new InfoBarContainerView.ContainerViewObserver() { + @Override + public void notifyAnimationFinished(int animationType) { + for (InfoBarAnimationListener listener : mAnimationListeners) { + listener.notifyAnimationFinished(animationType); + } + } + + @Override + public void notifyAllAnimationsFinished(InfoBarUiItem frontInfoBar) { + for (InfoBarAnimationListener listener : mAnimationListeners) { + listener.notifyAllAnimationsFinished(frontInfoBar); + } + } + + @Override + public void onShownRatioChanged(float shownFraction) { + for (InfoBarContainer.InfoBarContainerObserver observer : mObservers) { + observer.onInfoBarContainerShownRatioChanged( + InfoBarContainer.this, shownFraction); + } + } + }; + + /** The tab that hosts this infobar container. */ + private final TabImpl mTab; + + /** Native InfoBarContainer pointer which will be set by InfoBarContainerJni.get().init(). */ + private long mNativeInfoBarContainer; + + /** True when this container has been emptied and its native counterpart has been destroyed. */ + private boolean mDestroyed; + + /** Whether or not this View should be hidden. */ + private boolean mIsHidden; + + /** + * The view that {@link Tab#getView()} returns. It will be null when the {@link Tab} is + * detached from a {@link ChromeActivity}. + */ + private @Nullable View mTabView; + + /** + * The view for this {@link InfoBarContainer}. It will be null when the {@link Tab} is detached + * from a {@link ChromeActivity}. + */ + private @Nullable InfoBarContainerView mInfoBarContainerView; + + InfoBarContainer(TabImpl tab) { + // TODO(crbug.com/1025620): Determine if this is the correct View to use here. + mTabView = tab.getBrowser().getViewAndroidDelegateContainerView(); + mTab = tab; + + Context context = tab.getBrowser().getContext(); + if (context != null) initializeContainerView(context); + + // Chromium's InfoBarContainer may add an InfoBar immediately during this initialization + // call, so make sure everything in the InfoBarContainer is completely ready beforehand. + mNativeInfoBarContainer = InfoBarContainerJni.get().init(InfoBarContainer.this); + } + + /** + * Adds an {@link InfoBarContainerObserver}. + * @param observer The {@link InfoBarContainerObserver} to add. + */ + public void addObserver(InfoBarContainerObserver observer) { + mObservers.addObserver(observer); + } + + /** + * Removes a {@link InfoBarContainerObserver}. + * @param observer The {@link InfoBarContainerObserver} to remove. + */ + public void removeObserver(InfoBarContainerObserver observer) { + mObservers.removeObserver(observer); + } + + /** + * Sets the parent {@link ViewGroup} that contains the {@link InfoBarContainer}. + */ + public void setParentView(ViewGroup parent) { + if (mInfoBarContainerView != null) mInfoBarContainerView.setParentView(parent); + } + + @VisibleForTesting + public void addAnimationListener(InfoBarAnimationListener listener) { + mAnimationListeners.addObserver(listener); + } + + /** + * Removes the passed in {@link InfoBarAnimationListener} from the {@link InfoBarContainer}. + */ + public void removeAnimationListener(InfoBarAnimationListener listener) { + mAnimationListeners.removeObserver(listener); + } + + /** + * Adds an InfoBar to the view hierarchy. + * @param infoBar InfoBar to add to the View hierarchy. + */ + @CalledByNative + private void addInfoBar(InfoBar infoBar) { + assert !mDestroyed; + if (infoBar == null) { + return; + } + if (mInfoBars.contains(infoBar)) { + assert false : "Trying to add an info bar that has already been added."; + return; + } + + infoBar.setContext(mInfoBarContainerView.getContext()); + infoBar.setContainer(this); + + // We notify observers immediately (before the animation starts). + for (InfoBarContainerObserver observer : mObservers) { + observer.onAddInfoBar(this, infoBar, mInfoBars.isEmpty()); + } + + assert mInfoBarContainerView != null : "The container view is null when adding an InfoBar"; + + // We add the infobar immediately to mInfoBars but we wait for the animation to end to + // notify it's been added, as tests rely on this notification but expects the infobar view + // to be available when they get the notification. + mInfoBars.add(infoBar); + + mInfoBarContainerView.addInfoBar(infoBar); + } + + /** + * Adds an InfoBar to the view hierarchy. + * @param infoBar InfoBar to add to the View hierarchy. + */ + @VisibleForTesting + public void addInfoBarForTesting(InfoBar infoBar) { + addInfoBar(infoBar); + } + + @Override + public void notifyInfoBarViewChanged() { + assert !mDestroyed; + if (mInfoBarContainerView != null) mInfoBarContainerView.notifyInfoBarViewChanged(); + } + + /** + * Sets the visibility for the {@link InfoBarContainerView}. + * @param visibility One of {@link View#GONE}, {@link View#INVISIBLE}, or {@link View#VISIBLE}. + */ + public void setVisibility(int visibility) { + if (mInfoBarContainerView != null) mInfoBarContainerView.setVisibility(visibility); + } + + /** + * @return The visibility of the {@link InfoBarContainerView}. + */ + public int getVisibility() { + return mInfoBarContainerView != null ? mInfoBarContainerView.getVisibility() : View.GONE; + } + + @Override + public void removeInfoBar(InfoBar infoBar) { + assert !mDestroyed; + + if (!mInfoBars.remove(infoBar)) { + assert false : "Trying to remove an InfoBar that is not in this container."; + return; + } + + // Notify observers immediately, before any animations begin. + for (InfoBarContainerObserver observer : mObservers) { + observer.onRemoveInfoBar(this, infoBar, mInfoBars.isEmpty()); + } + + assert mInfoBarContainerView + != null : "The container view is null when removing an InfoBar."; + mInfoBarContainerView.removeInfoBar(infoBar); + } + + @Override + public boolean isDestroyed() { + return mDestroyed; + } + + public void destroy() { + destroyContainerView(); + if (mNativeInfoBarContainer != 0) { + InfoBarContainerJni.get().destroy(mNativeInfoBarContainer, InfoBarContainer.this); + mNativeInfoBarContainer = 0; + } + mDestroyed = true; + } + + /** + * @return all of the InfoBars held in this container. + */ + @VisibleForTesting + public ArrayList<InfoBar> getInfoBarsForTesting() { + return mInfoBars; + } + + /** + * @return True if the container has any InfoBars. + */ + @CalledByNative + public boolean hasInfoBars() { + return !mInfoBars.isEmpty(); + } + + /** + * @return InfoBarIdentifier of the InfoBar which is currently at the top of the infobar stack, + * or InfoBarIdentifier.INVALID if there are no infobars. + */ + @CalledByNative + private @InfoBarIdentifier int getTopInfoBarIdentifier() { + if (!hasInfoBars()) return InfoBarIdentifier.INVALID; + return mInfoBars.get(0).getInfoBarIdentifier(); + } + + /** + * Hides or stops hiding this View. + * + * @param isHidden Whether this View is should be hidden. + */ + public void setHidden(boolean isHidden) { + mIsHidden = isHidden; + if (mInfoBarContainerView == null) return; + mInfoBarContainerView.setHidden(isHidden); + } + + /** + * Sets whether the InfoBarContainer is allowed to auto-hide when the user scrolls the page. + * Expected to be called when Touch Exploration is enabled. + * @param isAllowed Whether auto-hiding is allowed. + */ + private static void setIsAllowedToAutoHide(boolean isAllowed) { + InfoBarContainerView.setIsAllowedToAutoHide(isAllowed); + } + + // KeyboardVisibilityListener implementation. + @Override + public void keyboardVisibilityChanged(boolean isKeyboardShowing) { + assert mInfoBarContainerView != null; + boolean isShowing = (mInfoBarContainerView.getVisibility() == View.VISIBLE); + if (isKeyboardShowing) { + if (isShowing) { + mInfoBarContainerView.setVisibility(View.INVISIBLE); + } + } else { + if (!isShowing && !mIsHidden) { + mInfoBarContainerView.setVisibility(View.VISIBLE); + } + } + } + + private void updateWebContents() { + // When the tab is detached, we don't update the InfoBarContainer web content so that it + // stays null until the tab is attached to some ChromeActivity. + if (mInfoBarContainerView == null) return; + WebContents webContents = mTab.getWebContents(); + + if (webContents != null && webContents != mInfoBarContainerView.getWebContents()) { + mInfoBarContainerView.setWebContents(webContents); + if (mNativeInfoBarContainer != 0) { + InfoBarContainerJni.get().setWebContents( + mNativeInfoBarContainer, InfoBarContainer.this, webContents); + } + } + + if (mTabView != null) mTabView.removeOnAttachStateChangeListener(mAttachedStateListener); + // TODO(crbug.com/1025620): Determine if this is the correct View to use here. + mTabView = mTab.getBrowser().getViewAndroidDelegateContainerView(); + if (mTabView != null) mTabView.addOnAttachStateChangeListener(mAttachedStateListener); + } + + private void initializeContainerView(Context chromeActivity) { + assert chromeActivity + != null + : "ChromeActivity should not be null when initializing InfoBarContainerView"; + mInfoBarContainerView = new InfoBarContainerView(chromeActivity, mContainerViewObserver, + // TODO(crbug.com/1025620): Determine how to get information of whether we're on a + // tablet. + false); + + mInfoBarContainerView.addOnAttachStateChangeListener( + new View.OnAttachStateChangeListener() { + @Override + public void onViewAttachedToWindow(View view) { + for (InfoBarContainer.InfoBarContainerObserver observer : mObservers) { + observer.onInfoBarContainerAttachedToWindow(!mInfoBars.isEmpty()); + } + } + + @Override + public void onViewDetachedFromWindow(View view) {} + }); + + mInfoBarContainerView.setHidden(mIsHidden); + // TODO(crbug.com/1025620): Determine the correct View to set as the parent. + // setParentView(mTab.getBrowser().getViewController().getView()); + + mTab.getBrowser().getWindowAndroid().getKeyboardDelegate().addKeyboardVisibilityListener( + this); + } + + private void destroyContainerView() { + if (mInfoBarContainerView != null) { + mInfoBarContainerView.setWebContents(null); + if (mNativeInfoBarContainer != 0) { + InfoBarContainerJni.get().setWebContents( + mNativeInfoBarContainer, InfoBarContainer.this, null); + } + mInfoBarContainerView.destroy(); + mInfoBarContainerView = null; + } + + mTab.getBrowser().getWindowAndroid().getKeyboardDelegate().removeKeyboardVisibilityListener( + this); + + if (mTabView != null) { + mTabView.removeOnAttachStateChangeListener(mAttachedStateListener); + mTabView = null; + } + } + + @Override + public boolean isFrontInfoBar(InfoBar infoBar) { + if (mInfoBars.isEmpty()) return false; + return mInfoBars.get(0) == infoBar; + } + + /** + * Returns true if any animations are pending or in progress. + */ + @VisibleForTesting + public boolean isAnimating() { + assert mInfoBarContainerView != null; + return mInfoBarContainerView.isAnimating(); + } + + /** + * @return The {@link InfoBarContainerView} this class holds. + */ + @VisibleForTesting + public InfoBarContainerView getContainerViewForTesting() { + return mInfoBarContainerView; + } + + @NativeMethods + interface Natives { + long init(InfoBarContainer caller); + void setWebContents(long nativeInfoBarContainerAndroid, InfoBarContainer caller, + WebContents webContents); + void destroy(long nativeInfoBarContainerAndroid, InfoBarContainer caller); + } +}
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/InfoBarContainerLayout.java b/weblayer/browser/java/org/chromium/weblayer_private/InfoBarContainerLayout.java new file mode 100644 index 0000000..9845285 --- /dev/null +++ b/weblayer/browser/java/org/chromium/weblayer_private/InfoBarContainerLayout.java
@@ -0,0 +1,854 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.weblayer_private; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.AnimatorSet; +import android.animation.ObjectAnimator; +import android.animation.ValueAnimator; +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.res.Resources; +import android.text.TextUtils; +import android.view.Gravity; +import android.view.MotionEvent; +import android.view.View; +import android.widget.FrameLayout; + +import org.chromium.ui.widget.OptimizedFrameLayout; +import org.chromium.weblayer_private.InfoBarContainer.InfoBarAnimationListener; + +import java.util.ArrayList; + +/** + * Layout that displays infobars in a stack. Handles all the animations when adding or removing + * infobars and when swapping infobar contents. + * + * The first infobar to be added is visible at the front of the stack. Later infobars peek up just + * enough behind the front infobar to signal their existence; their contents aren't visible at all. + * The stack has a max depth of three infobars. If additional infobars are added beyond this, they + * won't be visible at all until infobars in front of them are dismissed. + * + * Animation details: + * - Newly added infobars slide up from the bottom and then their contents fade in. + * - Disappearing infobars slide down and away. The remaining infobars, if any, resize to the + * new front infobar's size, then the content of the new front infobar fades in. + * - When swapping the front infobar's content, the old content fades out, the infobar resizes to + * the new content's size, then the new content fades in. + * - Only a single animation happens at a time. If several infobars are added and/or removed in + * quick succession, the animations will be queued and run sequentially. + * + * Note: this class depends only on Android view code; it intentionally does not depend on any other + * infobar code. This is an explicit design decision and should remain this way. + * + * TODO(newt): what happens when detached from window? Do animations run? Do animations jump to end + * values? Should they jump to end values? Does requestLayout() get called when detached + * from window? Probably not; it probably just gets called later when reattached. + * + * TODO(newt): use hardware acceleration? See + * http://blog.danlew.net/2015/10/20/using-hardware-layers-to-improve-animation-performance/ + * and http://developer.android.com/guide/topics/graphics/hardware-accel.html#layers + * + * TODO(newt): handle tall infobars on small devices. Use a ScrollView inside the InfoBarWrapper? + * Make sure InfoBarContainerLayout doesn't extend into tabstrip on tablet. + * + * TODO(newt): Disable key events during animations, perhaps by overriding dispatchKeyEvent(). + * Or can we just call setEnabled() false on the infobar wrapper? Will this cause the buttons + * visual state to change (i.e. to turn gray)? + * + * TODO(newt): finalize animation timings and interpolators. + */ +public class InfoBarContainerLayout extends OptimizedFrameLayout { + /** + * Creates an empty InfoBarContainerLayout. + */ + InfoBarContainerLayout(Context context, Runnable makeContainerVisibleRunnable, + InfoBarAnimationListener animationListener) { + super(context, null); + Resources res = context.getResources(); + mBackInfobarHeight = res.getDimensionPixelSize(R.dimen.infobar_peeking_height); + mFloatingBehavior = new FloatingBehavior(this); + mAnimationListener = animationListener; + mMakeContainerVisibleRunnable = makeContainerVisibleRunnable; + } + + /** + * Adds an infobar to the container. The infobar appearing animation will happen after the + * current animation, if any, finishes. + */ + void addInfoBar(InfoBarUiItem item) { + mItems.add(findInsertIndex(item), item); + processPendingAnimations(); + } + + /** + * Finds the appropriate index in the infobar stack for inserting this item. + * @param item The infobar to be inserted. + */ + private int findInsertIndex(InfoBarUiItem item) { + for (int i = 0; i < mItems.size(); ++i) { + if (item.getPriority() < mItems.get(i).getPriority()) { + return i; + } + } + + return mItems.size(); + } + + /** + * Removes an infobar from the container. The infobar will be animated off the screen if it's + * currently visible. + */ + void removeInfoBar(InfoBarUiItem item) { + mItems.remove(item); + processPendingAnimations(); + } + + /** + * Notifies that an infobar's View ({@link InfoBarUiItem#getView}) has changed. If the infobar + * is visible in the front of the stack, the infobar will fade out the old contents, resize, + * then fade in the new contents. + */ + void notifyInfoBarViewChanged() { + processPendingAnimations(); + } + + /** + * Returns true if any animations are pending or in progress. + */ + boolean isAnimating() { + return mAnimation != null; + } + + ///////////////////////////////////////// + // Implementation details + ///////////////////////////////////////// + + /** The maximum number of infobars visible at any time. */ + private static final int MAX_STACK_DEPTH = 3; + + // Animation durations. + private static final int DURATION_SLIDE_UP_MS = 250; + private static final int DURATION_SLIDE_DOWN_MS = 250; + private static final int DURATION_FADE_MS = 100; + private static final int DURATION_FADE_OUT_MS = 200; + + /** + * Base class for animations inside the InfoBarContainerLayout. + * + * Provides a standardized way to prepare for, run, and clean up after animations. Each subclass + * should implement prepareAnimation(), createAnimator(), and onAnimationEnd() as needed. + */ + private abstract class InfoBarAnimation { + private Animator mAnimator; + + final boolean isStarted() { + return mAnimator != null; + } + + final void start() { + Animator.AnimatorListener listener = new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + InfoBarAnimation.this.onAnimationEnd(); + mAnimation = null; + mAnimationListener.notifyAnimationFinished(getAnimationType()); + processPendingAnimations(); + } + }; + + mAnimator = createAnimator(); + mAnimator.addListener(listener); + mAnimator.start(); + } + + /** + * Returns an animator that animates an InfoBarWrapper's y-translation from its current + * value to endValue and updates the side shadow positions on each frame. + */ + ValueAnimator createTranslationYAnimator(final InfoBarWrapper wrapper, float endValue) { + ValueAnimator animator = ValueAnimator.ofFloat(wrapper.getTranslationY(), endValue); + animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator animation) { + wrapper.setTranslationY((float) animation.getAnimatedValue()); + mFloatingBehavior.updateShadowPosition(); + } + }); + return animator; + } + + /** + * Called before the animation begins. This is the time to add views to the hierarchy and + * adjust layout parameters. + */ + void prepareAnimation() {} + + /** + * Called to create an Animator which will control the animation. Called after + * prepareAnimation() and after a subsequent layout has happened. + */ + abstract Animator createAnimator(); + + /** + * Called after the animation completes. This is the time to do post-animation cleanup, such + * as removing views from the hierarchy. + */ + void onAnimationEnd() {} + + /** + * Returns the InfoBarAnimationListener.ANIMATION_TYPE_* constant that corresponds to this + * type of animation (showing, swapping, etc). + */ + abstract int getAnimationType(); + } + + /** + * The animation to show the first infobar. The infobar slides up from the bottom; then its + * content fades in. + */ + private class FirstInfoBarAppearingAnimation extends InfoBarAnimation { + private InfoBarUiItem mFrontItem; + private InfoBarWrapper mFrontWrapper; + private View mFrontContents; + + FirstInfoBarAppearingAnimation(InfoBarUiItem frontItem) { + mFrontItem = frontItem; + } + + @Override + void prepareAnimation() { + mFrontContents = mFrontItem.getView(); + mFrontWrapper = new InfoBarWrapper(getContext(), mFrontItem); + mFrontWrapper.addView(mFrontContents); + addWrapper(mFrontWrapper); + } + + @Override + Animator createAnimator() { + mFrontWrapper.setTranslationY(mFrontWrapper.getHeight()); + mFrontContents.setAlpha(0f); + + AnimatorSet animator = new AnimatorSet(); + animator.playSequentially( + createTranslationYAnimator(mFrontWrapper, 0f).setDuration(DURATION_SLIDE_UP_MS), + ObjectAnimator.ofFloat(mFrontContents, View.ALPHA, 1f) + .setDuration(DURATION_FADE_MS)); + return animator; + } + + @Override + void onAnimationEnd() { + announceForAccessibility(mFrontItem.getAccessibilityText()); + } + + @Override + int getAnimationType() { + return InfoBarAnimationListener.ANIMATION_TYPE_SHOW; + } + } + + /** + * The animation to show the a new front-most infobar in front of existing visible infobars. The + * infobar slides up from the bottom; then its content fades in. The previously visible infobars + * will be resized simulatenously to the new desired size. + */ + private class FrontInfoBarAppearingAnimation extends InfoBarAnimation { + private InfoBarUiItem mFrontItem; + private InfoBarWrapper mFrontWrapper; + private InfoBarWrapper mOldFrontWrapper; + private View mFrontContents; + + FrontInfoBarAppearingAnimation(InfoBarUiItem frontItem) { + mFrontItem = frontItem; + } + + @Override + void prepareAnimation() { + mOldFrontWrapper = mInfoBarWrappers.get(0); + + mFrontContents = mFrontItem.getView(); + mFrontWrapper = new InfoBarWrapper(getContext(), mFrontItem); + mFrontWrapper.addView(mFrontContents); + addWrapperToFront(mFrontWrapper); + } + + @Override + Animator createAnimator() { + // After adding the new wrapper, the new front item's view, and the old front item's + // view are both in their wrappers, and the height of the stack as determined by + // FrameLayout will take both into account. This means the height of the container will + // be larger than it needs to be, if the previous old front item is larger than the sum + // of the new front item and mBackInfobarHeight. + // + // First work out how much the container will grow or shrink by. + int heightDelta = + mFrontWrapper.getHeight() + mBackInfobarHeight - mOldFrontWrapper.getHeight(); + + // Now work out where to animate the new front item to / from. + int newFrontStart = mFrontWrapper.getHeight(); + int newFrontEnd = 0; + if (heightDelta < 0) { + // If the container is shrinking, this won't be reflected in the layout just yet. + // The layout will have extra space in it for the previous front infobar, which the + // animation of the new front infobar has to take into account. + newFrontStart -= heightDelta; + newFrontEnd -= heightDelta; + } + mFrontWrapper.setTranslationY(newFrontStart); + mFrontContents.setAlpha(0f); + + // Since we are adding the infobar to the top of the stack, make the container fully + // visible since it could be at hidden or partially hidden state. + mMakeContainerVisibleRunnable.run(); + + AnimatorSet animator = new AnimatorSet(); + animator.play(createTranslationYAnimator(mFrontWrapper, newFrontEnd) + .setDuration(DURATION_SLIDE_UP_MS)); + + // If the container is shrinking, the back infobars need to animate down (from 0 to the + // positive delta). Otherwise they have to animate up (from the negative delta to 0). + int backStart = Math.max(0, heightDelta); + int backEnd = Math.max(-heightDelta, 0); + for (int i = 1; i < mInfoBarWrappers.size(); i++) { + mInfoBarWrappers.get(i).setTranslationY(backStart); + animator.play(createTranslationYAnimator(mInfoBarWrappers.get(i), backEnd) + .setDuration(DURATION_SLIDE_UP_MS)); + } + + animator.play(ObjectAnimator.ofFloat(mFrontContents, View.ALPHA, 1f) + .setDuration(DURATION_FADE_MS)) + .after(DURATION_SLIDE_UP_MS); + + return animator; + } + + @Override + void onAnimationEnd() { + // Remove the old front wrappers view so it won't affect the height of the container any + // more. + mOldFrontWrapper.removeAllViews(); + + // Now set any Y offsets to 0 as there is no need to account for the old front wrapper + // making the container higher than it should be. + for (int i = 0; i < mInfoBarWrappers.size(); i++) { + mInfoBarWrappers.get(i).setTranslationY(0); + } + updateLayoutParams(); + announceForAccessibility(mFrontItem.getAccessibilityText()); + } + + @Override + int getAnimationType() { + return InfoBarAnimationListener.ANIMATION_TYPE_SHOW; + } + } + + /** + * The animation to show a back infobar. The infobar slides up behind the existing infobars, so + * its top edge peeks out just a bit. + */ + private class BackInfoBarAppearingAnimation extends InfoBarAnimation { + private InfoBarWrapper mAppearingWrapper; + + BackInfoBarAppearingAnimation(InfoBarUiItem appearingItem) { + mAppearingWrapper = new InfoBarWrapper(getContext(), appearingItem); + } + + @Override + void prepareAnimation() { + addWrapper(mAppearingWrapper); + } + + @Override + Animator createAnimator() { + mAppearingWrapper.setTranslationY(mAppearingWrapper.getHeight()); + return createTranslationYAnimator(mAppearingWrapper, 0f) + .setDuration(DURATION_SLIDE_UP_MS); + } + + @Override + public void onAnimationEnd() { + mAppearingWrapper.removeView(mAppearingWrapper.getItem().getView()); + } + + @Override + int getAnimationType() { + return InfoBarAnimationListener.ANIMATION_TYPE_SHOW; + } + } + + /** + * The animation to hide the front infobar and reveal the second-to-front infobar. The front + * infobar slides down and off the screen. The back infobar(s) will adjust to the size of the + * new front infobar, and then the new front infobar's contents will fade in. + */ + private class FrontInfoBarDisappearingAndRevealingAnimation extends InfoBarAnimation { + private InfoBarWrapper mOldFrontWrapper; + private InfoBarWrapper mNewFrontWrapper; + private View mNewFrontContents; + + @Override + void prepareAnimation() { + mOldFrontWrapper = mInfoBarWrappers.get(0); + mNewFrontWrapper = mInfoBarWrappers.get(1); + mNewFrontContents = mNewFrontWrapper.getItem().getView(); + mNewFrontWrapper.addView(mNewFrontContents); + } + + @Override + Animator createAnimator() { + // The amount by which mNewFrontWrapper will grow (negative value indicates shrinking). + int deltaHeight = (mNewFrontWrapper.getHeight() - mBackInfobarHeight) + - mOldFrontWrapper.getHeight(); + int startTranslationY = Math.max(deltaHeight, 0); + int endTranslationY = Math.max(-deltaHeight, 0); + + // Slide the front infobar down and away. + AnimatorSet animator = new AnimatorSet(); + mOldFrontWrapper.setTranslationY(startTranslationY); + animator.play(createTranslationYAnimator( + mOldFrontWrapper, startTranslationY + mOldFrontWrapper.getHeight()) + .setDuration(DURATION_SLIDE_UP_MS)); + + // Slide the other infobars to their new positions. + // Note: animator.play() causes these animations to run simultaneously. + for (int i = 1; i < mInfoBarWrappers.size(); i++) { + mInfoBarWrappers.get(i).setTranslationY(startTranslationY); + animator.play(createTranslationYAnimator(mInfoBarWrappers.get(i), endTranslationY) + .setDuration(DURATION_SLIDE_UP_MS)); + } + + mNewFrontContents.setAlpha(0f); + animator.play(ObjectAnimator.ofFloat(mNewFrontContents, View.ALPHA, 1f) + .setDuration(DURATION_FADE_MS)) + .after(DURATION_SLIDE_UP_MS); + + return animator; + } + + @Override + void onAnimationEnd() { + mOldFrontWrapper.removeAllViews(); + removeWrapper(mOldFrontWrapper); + for (int i = 0; i < mInfoBarWrappers.size(); i++) { + mInfoBarWrappers.get(i).setTranslationY(0); + } + announceForAccessibility(mNewFrontWrapper.getItem().getAccessibilityText()); + } + + @Override + int getAnimationType() { + return InfoBarAnimationListener.ANIMATION_TYPE_HIDE; + } + } + + /** + * The animation to hide the backmost infobar, or the front infobar if there's only one infobar. + * The infobar simply slides down out of the container. + */ + private class InfoBarDisappearingAnimation extends InfoBarAnimation { + private InfoBarWrapper mDisappearingWrapper; + + @Override + void prepareAnimation() { + mDisappearingWrapper = mInfoBarWrappers.get(mInfoBarWrappers.size() - 1); + } + + @Override + Animator createAnimator() { + return createTranslationYAnimator( + mDisappearingWrapper, mDisappearingWrapper.getHeight()) + .setDuration(DURATION_SLIDE_DOWN_MS); + } + + @Override + void onAnimationEnd() { + mDisappearingWrapper.removeAllViews(); + removeWrapper(mDisappearingWrapper); + } + + @Override + int getAnimationType() { + return InfoBarAnimationListener.ANIMATION_TYPE_HIDE; + } + } + + /** + * The animation to swap the contents of the front infobar. The current contents fade out, + * then the infobar resizes to fit the new contents, then the new contents fade in. + */ + private class FrontInfoBarSwapContentsAnimation extends InfoBarAnimation { + private InfoBarWrapper mFrontWrapper; + private View mOldContents; + private View mNewContents; + + @Override + void prepareAnimation() { + mFrontWrapper = mInfoBarWrappers.get(0); + mOldContents = mFrontWrapper.getChildAt(0); + mNewContents = mFrontWrapper.getItem().getView(); + mFrontWrapper.addView(mNewContents); + } + + @Override + Animator createAnimator() { + int deltaHeight = mNewContents.getHeight() - mOldContents.getHeight(); + InfoBarContainerLayout.this.setTranslationY(Math.max(0, deltaHeight)); + mNewContents.setAlpha(0f); + + AnimatorSet animator = new AnimatorSet(); + animator.playSequentially(ObjectAnimator.ofFloat(mOldContents, View.ALPHA, 0f) + .setDuration(DURATION_FADE_OUT_MS), + ObjectAnimator + .ofFloat(InfoBarContainerLayout.this, View.TRANSLATION_Y, + Math.max(0, -deltaHeight)) + .setDuration(DURATION_SLIDE_UP_MS), + ObjectAnimator.ofFloat(mNewContents, View.ALPHA, 1f) + .setDuration(DURATION_FADE_OUT_MS)); + return animator; + } + + @Override + void onAnimationEnd() { + mFrontWrapper.removeViewAt(0); + InfoBarContainerLayout.this.setTranslationY(0f); + mFrontWrapper.getItem().setControlsEnabled(true); + announceForAccessibility(mFrontWrapper.getItem().getAccessibilityText()); + } + + @Override + int getAnimationType() { + return InfoBarAnimationListener.ANIMATION_TYPE_SWAP; + } + } + + /** + * Controls whether infobars fill the full available width, or whether they "float" in the + * middle of the available space. The latter case happens if the available space is wider than + * the max width allowed for infobars. + * + * Also handles the shadows on the sides of the infobars in floating mode. The side shadows are + * separate views -- rather than being part of each InfoBarWrapper -- to avoid a double-shadow + * effect, which would happen during animations when two InfoBarWrappers overlap each other. + */ + private static class FloatingBehavior { + /** The InfoBarContainerLayout. */ + private FrameLayout mLayout; + + /** + * The max width of the infobars. If the available space is wider than this, the infobars + * will switch to floating mode. + */ + private final int mMaxWidth; + + /** The width of the left and right shadows. */ + private final int mShadowWidth; + + /** Whether the layout is currently floating. */ + private boolean mIsFloating; + + /** The shadows that appear on the sides of the infobars in floating mode. */ + private View mLeftShadowView; + private View mRightShadowView; + + FloatingBehavior(FrameLayout layout) { + mLayout = layout; + Resources res = mLayout.getContext().getResources(); + mMaxWidth = res.getDimensionPixelSize(R.dimen.infobar_max_width); + mShadowWidth = res.getDimensionPixelSize(R.dimen.infobar_shadow_width); + } + + /** + * This should be called in onMeasure() before super.onMeasure(). The return value is a new + * widthMeasureSpec that should be passed to super.onMeasure(). + */ + int beforeOnMeasure(int widthMeasureSpec) { + int width = MeasureSpec.getSize(widthMeasureSpec); + boolean isFloating = width > mMaxWidth; + if (isFloating != mIsFloating) { + mIsFloating = isFloating; + onIsFloatingChanged(); + } + + if (isFloating) { + int mode = MeasureSpec.getMode(widthMeasureSpec); + width = Math.min(width, mMaxWidth + 2 * mShadowWidth); + widthMeasureSpec = MeasureSpec.makeMeasureSpec(width, mode); + } + return widthMeasureSpec; + } + + /** + * This should be called in onMeasure() after super.onMeasure(). + */ + void afterOnMeasure(int measuredHeight) { + if (!mIsFloating) return; + // Measure side shadows to match the parent view's height. + int widthSpec = MeasureSpec.makeMeasureSpec(mShadowWidth, MeasureSpec.EXACTLY); + int heightSpec = MeasureSpec.makeMeasureSpec(measuredHeight, MeasureSpec.EXACTLY); + mLeftShadowView.measure(widthSpec, heightSpec); + mRightShadowView.measure(widthSpec, heightSpec); + } + + /** + * This should be called whenever the Y-position of an infobar changes. + */ + void updateShadowPosition() { + if (!mIsFloating) return; + float minY = mLayout.getHeight(); + int childCount = mLayout.getChildCount(); + for (int i = 0; i < childCount; i++) { + View child = mLayout.getChildAt(i); + if (child != mLeftShadowView && child != mRightShadowView) { + minY = Math.min(minY, child.getY()); + } + } + mLeftShadowView.setY(minY); + mRightShadowView.setY(minY); + } + + private void onIsFloatingChanged() { + if (mIsFloating) { + initShadowViews(); + mLayout.setPadding(mShadowWidth, 0, mShadowWidth, 0); + mLayout.setClipToPadding(false); + mLayout.addView(mLeftShadowView); + mLayout.addView(mRightShadowView); + } else { + mLayout.setPadding(0, 0, 0, 0); + mLayout.removeView(mLeftShadowView); + mLayout.removeView(mRightShadowView); + } + } + + @SuppressLint("RtlHardcoded") + private void initShadowViews() { + if (mLeftShadowView != null) return; + + mLeftShadowView = new View(mLayout.getContext()); + // TODO(crbug.com/1025620): Bring in infobar shadow + // mLeftShadowView.setBackgroundResource(R.drawable.infobar_shadow_left); + LayoutParams leftLp = new FrameLayout.LayoutParams(0, 0, Gravity.LEFT); + leftLp.leftMargin = -mShadowWidth; + mLeftShadowView.setLayoutParams(leftLp); + + mRightShadowView = new View(mLayout.getContext()); + // TODO(crbug.com/1025620): Bring in infobar shadow + // mRightShadowView.setBackgroundResource(R.drawable.infobar_shadow_left); + LayoutParams rightLp = new FrameLayout.LayoutParams(0, 0, Gravity.RIGHT); + rightLp.rightMargin = -mShadowWidth; + mRightShadowView.setScaleX(-1f); + mRightShadowView.setLayoutParams(rightLp); + } + } + + /** + * The height of back infobars, i.e. the distance between the top of the front infobar and the + * top of the next infobar back. + */ + private final int mBackInfobarHeight; + + /** + * All the Items, in front to back order. + * This list is updated immediately when addInfoBar(), removeInfoBar(), and swapInfoBar() are + * called; so during animations, it does *not* match the currently visible views. + */ + private final ArrayList<InfoBarUiItem> mItems = new ArrayList<>(); + + /** + * The currently visible InfoBarWrappers, in front to back order. + */ + private final ArrayList<InfoBarWrapper> mInfoBarWrappers = new ArrayList<>(); + + /** A observer that is notified when animations finish. */ + private final InfoBarAnimationListener mAnimationListener; + + /** The current animation, or null if no animation is happening currently. */ + private InfoBarAnimation mAnimation; + + private FloatingBehavior mFloatingBehavior; + + /** The runnable to make infobar container fully visible. */ + private Runnable mMakeContainerVisibleRunnable; + + /** + * Determines whether any animations need to run in order to make the visible views match the + * current list of Items in mItems. If so, kicks off the next animation that's needed. + */ + private void processPendingAnimations() { + // If an animation is running, wait until it finishes before beginning the next animation. + if (mAnimation != null) return; + + // The steps below are ordered to minimize movement during animations. In particular, + // removals happen before additions or swaps, and changes are made to back infobars before + // front infobars. + + // First, remove any infobars that are no longer in mItems, if any. Check the back infobars + // before the front. + for (int i = mInfoBarWrappers.size() - 1; i >= 0; i--) { + InfoBarUiItem visibleItem = mInfoBarWrappers.get(i).getItem(); + if (!mItems.contains(visibleItem)) { + if (i == 0 && mInfoBarWrappers.size() >= 2) { + // Remove the front infobar and reveal the second-to-front infobar. + runAnimation(new FrontInfoBarDisappearingAndRevealingAnimation()); + return; + + } else { + // Move the infobar to the very back if it's not already there. + InfoBarWrapper wrapper = mInfoBarWrappers.get(i); + if (i != mInfoBarWrappers.size() - 1) { + removeWrapper(wrapper); + addWrapper(wrapper); + } + + // Remove the backmost infobar (which may be the front infobar). + runAnimation(new InfoBarDisappearingAnimation()); + return; + } + } + } + + // Second, run swap animation on front infobar if needed. + if (!mInfoBarWrappers.isEmpty()) { + InfoBarUiItem frontItem = mInfoBarWrappers.get(0).getItem(); + View frontContents = mInfoBarWrappers.get(0).getChildAt(0); + if (frontContents != frontItem.getView()) { + runAnimation(new FrontInfoBarSwapContentsAnimation()); + return; + } + } + + // Third, check if we should add any infobars in front of visible infobars. This can happen + // if an infobar has been inserted into mItems, in front of the currently visible item. To + // detect this the items at the beginning of mItems are compared against the first item in + // mInfoBarWrappers. + if (!mInfoBarWrappers.isEmpty()) { + // Find the infobar with the highest index that isn't currently being shown. + InfoBarUiItem currentVisibleItem = mInfoBarWrappers.get(0).getItem(); + InfoBarUiItem itemToInsert = null; + for (int checkIndex = 0; checkIndex < mItems.size(); checkIndex++) { + if (mItems.get(checkIndex) == currentVisibleItem) { + // There are no remaining infobars that can possibly override the + // currently displayed one. + break; + } else { + // Found an infobar that isn't being displayed yet. Track it so that + // it can be animated in. + itemToInsert = mItems.get(checkIndex); + } + } + if (itemToInsert != null) { + runAnimation(new FrontInfoBarAppearingAnimation(itemToInsert)); + return; + } + } + + // Fourth, check if we should add any infobars at the back. + int desiredChildCount = Math.min(mItems.size(), MAX_STACK_DEPTH); + if (mInfoBarWrappers.size() < desiredChildCount) { + InfoBarUiItem itemToShow = mItems.get(mInfoBarWrappers.size()); + runAnimation(mInfoBarWrappers.isEmpty() + ? new FirstInfoBarAppearingAnimation(itemToShow) + : new BackInfoBarAppearingAnimation(itemToShow)); + return; + } + + // Fifth, now that we've stabilized, let listeners know that we have no more animations. + InfoBarUiItem frontItem = + mInfoBarWrappers.size() > 0 ? mInfoBarWrappers.get(0).getItem() : null; + mAnimationListener.notifyAllAnimationsFinished(frontItem); + } + + private void runAnimation(InfoBarAnimation animation) { + mAnimation = animation; + mAnimation.prepareAnimation(); + if (isLayoutRequested()) { + // onLayout() will call mAnimation.start(). + } else { + mAnimation.start(); + } + } + + private void addWrapper(InfoBarWrapper wrapper) { + addView(wrapper, 0, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); + mInfoBarWrappers.add(wrapper); + updateLayoutParams(); + } + + private void addWrapperToFront(InfoBarWrapper wrapper) { + addView(wrapper, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); + mInfoBarWrappers.add(0, wrapper); + updateLayoutParams(); + } + + private void removeWrapper(InfoBarWrapper wrapper) { + removeView(wrapper); + mInfoBarWrappers.remove(wrapper); + updateLayoutParams(); + } + + private void updateLayoutParams() { + // Stagger the top margins so the back infobars peek out a bit. + int childCount = mInfoBarWrappers.size(); + for (int i = 0; i < childCount; i++) { + View child = mInfoBarWrappers.get(i); + LayoutParams lp = (LayoutParams) child.getLayoutParams(); + lp.topMargin = (childCount - 1 - i) * mBackInfobarHeight; + child.setLayoutParams(lp); + } + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + widthMeasureSpec = mFloatingBehavior.beforeOnMeasure(widthMeasureSpec); + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + mFloatingBehavior.afterOnMeasure(getMeasuredHeight()); + } + + @Override + public void announceForAccessibility(CharSequence text) { + if (TextUtils.isEmpty(text)) return; + super.announceForAccessibility(text); + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + super.onLayout(changed, left, top, right, bottom); + mFloatingBehavior.updateShadowPosition(); + + // Animations start after a layout has completed, at which point all views are guaranteed + // to have valid sizes and positions. + if (mAnimation != null && !mAnimation.isStarted()) { + mAnimation.start(); + } + } + + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + // Trap any attempts to fiddle with the infobars while we're animating. + return super.onInterceptTouchEvent(ev) || mAnimation != null + || (!mInfoBarWrappers.isEmpty() + && !mInfoBarWrappers.get(0).getItem().areControlsEnabled()); + } + + @Override + @SuppressLint("ClickableViewAccessibility") + public boolean onTouchEvent(MotionEvent event) { + super.onTouchEvent(event); + // Consume all touch events so they do not reach the ContentView. + return true; + } + + @Override + public boolean onHoverEvent(MotionEvent event) { + super.onHoverEvent(event); + // Consume all hover events so they do not reach the ContentView. In touch exploration mode, + // this prevents the user from interacting with the part of the ContentView behind the + // infobars. http://crbug.com/430701 + return true; + } +}
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/InfoBarContainerView.java b/weblayer/browser/java/org/chromium/weblayer_private/InfoBarContainerView.java new file mode 100644 index 0000000..24c2592f --- /dev/null +++ b/weblayer/browser/java/org/chromium/weblayer_private/InfoBarContainerView.java
@@ -0,0 +1,233 @@ +// 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. + +package org.chromium.weblayer_private; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.content.Context; +import android.view.Gravity; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; + +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; + +import org.chromium.ui.display.DisplayAndroid; +import org.chromium.ui.display.DisplayUtil; + +/** + * The {@link View} for the {@link InfoBarContainer}. + */ +public class InfoBarContainerView extends SwipableOverlayView { + /** + * Observes container view changes. + */ + public interface ContainerViewObserver extends InfoBarContainer.InfoBarAnimationListener { + /** + * Called when the height of shown content changed. + * @param shownFraction The ratio of height of shown content to the height of the container + * view. + */ + void onShownRatioChanged(float shownFraction); + } + + /** Top margin, including the toolbar and tabstrip height and 48dp of web contents. */ + private static final int TOP_MARGIN_PHONE_DP = 104; + private static final int TOP_MARGIN_TABLET_DP = 144; + + /** Length of the animation to fade the InfoBarContainer back into View. */ + private static final long REATTACH_FADE_IN_MS = 250; + + /** Whether or not the InfoBarContainer is allowed to hide when the user scrolls. */ + private static boolean sIsAllowedToAutoHide = true; + + private final ContainerViewObserver mContainerViewObserver; + private final InfoBarContainerLayout mLayout; + + /** Parent view that contains the InfoBarContainerLayout. */ + private ViewGroup mParentView; + + /** Animation used to snap the container to the nearest state if scroll direction changes. */ + private Animator mScrollDirectionChangeAnimation; + + /** Whether or not the current scroll is downward. */ + private boolean mIsScrollingDownward; + + /** Tracks the previous event's scroll offset to determine if a scroll is up or down. */ + private int mLastScrollOffsetY; + + /** + * @param context The {@link Context} that this view is attached to. + * @param containerViewObserver The {@link ContainerViewObserver} that gets notified on + * container view changes. + * @param isTablet Whether this view is displayed on tablet or not. + */ + InfoBarContainerView(@NonNull Context context, + @NonNull ContainerViewObserver containerViewObserver, boolean isTablet) { + super(context, null); + mContainerViewObserver = containerViewObserver; + + // TODO(newt): move this workaround into the infobar views if/when they're scrollable. + // Workaround for http://crbug.com/407149. See explanation in onMeasure() below. + setVerticalScrollBarEnabled(false); + + updateLayoutParams(context, isTablet); + + Runnable makeContainerVisibleRunnable = () -> runUpEventAnimation(true); + mLayout = new InfoBarContainerLayout(context, makeContainerVisibleRunnable, + new InfoBarContainer.InfoBarAnimationListener() { + @Override + public void notifyAnimationFinished(int animationType) { + mContainerViewObserver.notifyAnimationFinished(animationType); + } + + @Override + public void notifyAllAnimationsFinished(InfoBarUiItem frontInfoBar) { + mContainerViewObserver.notifyAllAnimationsFinished(frontInfoBar); + } + }); + + addView(mLayout, + new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, + Gravity.CENTER_HORIZONTAL)); + } + + void destroy() { + removeFromParentView(); + } + + // SwipableOverlayView implementation. + @Override + protected boolean isAllowedToAutoHide() { + return sIsAllowedToAutoHide; + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + if (getVisibility() != View.GONE) { + setVisibility(VISIBLE); + setAlpha(0f); + animate().alpha(1f).setDuration(REATTACH_FADE_IN_MS); + } + } + + @Override + protected boolean shouldConsumeScroll(int scrollOffsetY, int scrollExtentY) { + // TODO(crbug.com/1025620): Determine if any custom logic is needed here to support + // interaction with the bottom toolbar. + return true; + } + + @Override + protected void runUpEventAnimation(boolean visible) { + if (mScrollDirectionChangeAnimation != null) mScrollDirectionChangeAnimation.cancel(); + super.runUpEventAnimation(visible); + } + + @Override + protected boolean isIndependentlyAnimating() { + return mScrollDirectionChangeAnimation != null; + } + + // View implementation. + @Override + public void setTranslationY(float translationY) { + super.setTranslationY(translationY); + float shownFraction = getHeight() > 0 ? 1f - (translationY / getHeight()) : 0; + mContainerViewObserver.onShownRatioChanged(shownFraction); + } + + /** + * Sets whether the InfoBarContainer is allowed to auto-hide when the user scrolls the page. + * Expected to be called when Touch Exploration is enabled. + * @param isAllowed Whether auto-hiding is allowed. + */ + public static void setIsAllowedToAutoHide(boolean isAllowed) { + sIsAllowedToAutoHide = isAllowed; + } + + /** + * Notifies that an infobar's View ({@link InfoBar#getView}) has changed. If the infobar is + * visible, a view swapping animation will be run. + */ + void notifyInfoBarViewChanged() { + mLayout.notifyInfoBarViewChanged(); + } + + /** + * Sets the parent {@link ViewGroup} that contains the {@link InfoBarContainer}. + */ + void setParentView(ViewGroup parent) { + mParentView = parent; + // Don't attach the container to the new parent if it is not previously attached. + if (removeFromParentView()) addToParentView(); + } + + /** + * Adds this class to the parent view {@link #mParentView}. + */ + void addToParentView() { + super.addToParentView(mParentView); + } + + /** + * Adds an {@link InfoBar} to the layout. + * @param infoBar The {@link InfoBar} to be added. + */ + void addInfoBar(InfoBar infoBar) { + infoBar.createView(); + mLayout.addInfoBar(infoBar); + } + + /** + * Removes an {@link InfoBar} from the layout. + * @param infoBar The {@link InfoBar} to be removed. + */ + void removeInfoBar(InfoBar infoBar) { + mLayout.removeInfoBar(infoBar); + } + + /** + * Hides or stops hiding this View. + * @param isHidden Whether this View is should be hidden. + */ + void setHidden(boolean isHidden) { + setVisibility(isHidden ? View.GONE : View.VISIBLE); + } + + /** + * Run an animation when the scrolling direction of a gesture has changed (this does not mean + * the gesture has ended). + * @param visible Whether or not the view should be visible. + */ + private void runDirectionChangeAnimation(boolean visible) { + mScrollDirectionChangeAnimation = createVerticalSnapAnimation(visible); + mScrollDirectionChangeAnimation.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + mScrollDirectionChangeAnimation = null; + } + }); + mScrollDirectionChangeAnimation.start(); + } + + private void updateLayoutParams(Context context, boolean isTablet) { + LayoutParams lp = new LayoutParams( + LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM); + int topMarginDp = isTablet ? TOP_MARGIN_TABLET_DP : TOP_MARGIN_PHONE_DP; + lp.topMargin = DisplayUtil.dpToPx(DisplayAndroid.getNonMultiDisplay(context), topMarginDp); + setLayoutParams(lp); + } + + /** + * Returns true if any animations are pending or in progress. + */ + @VisibleForTesting + public boolean isAnimating() { + return mLayout.isAnimating(); + } +}
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/InfoBarInteractionHandler.java b/weblayer/browser/java/org/chromium/weblayer_private/InfoBarInteractionHandler.java new file mode 100644 index 0000000..601e8b62 --- /dev/null +++ b/weblayer/browser/java/org/chromium/weblayer_private/InfoBarInteractionHandler.java
@@ -0,0 +1,31 @@ +// 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. + +package org.chromium.weblayer_private; + +/** + * Functions needed to display an InfoBar UI. + */ +public interface InfoBarInteractionHandler { + /** + * Handles click on the infobar. It is invoked before one of the following functions. + */ + public void onClick(); + + /** + * Takes some action related to the link being clicked. + */ + public void onLinkClicked(); + + /** + * Takes some action related to the close button being clicked. + */ + public void onCloseButtonClicked(); + + /** + * Performs some action related to either the primary or secondary button being pressed. + * @param isPrimaryButton True if the primary button was clicked, false otherwise. + */ + public void onButtonClicked(boolean isPrimaryButton); +}
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/InfoBarMessageView.java b/weblayer/browser/java/org/chromium/weblayer_private/InfoBarMessageView.java new file mode 100644 index 0000000..1b577f9 --- /dev/null +++ b/weblayer/browser/java/org/chromium/weblayer_private/InfoBarMessageView.java
@@ -0,0 +1,53 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.weblayer_private; + +import android.content.Context; +import android.text.style.ClickableSpan; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.ViewConfiguration; + +import org.chromium.ui.widget.TextViewWithClickableSpans; + +/** + * Handles the additional message view responsibilities needed for InfoBars. + * - Makes the full text view clickable if there is just a single link. + */ +public class InfoBarMessageView extends TextViewWithClickableSpans { + private boolean mExternalOnClickListenerSet; + private long mMotionEventDownTime; + + public InfoBarMessageView(Context context) { + super(context); + } + + public InfoBarMessageView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + boolean retVal = super.onTouchEvent(event); + if (!mExternalOnClickListenerSet && event.getActionMasked() == MotionEvent.ACTION_UP) { + long downDuration = event.getEventTime() - event.getDownTime(); + boolean validClickEvent = downDuration >= ViewConfiguration.getTapTimeout() + && downDuration <= ViewConfiguration.getLongPressTimeout(); + + ClickableSpan[] spans = getClickableSpans(); + if (validClickEvent && spans != null && spans.length == 1 + && !touchIntersectsAnyClickableSpans(event)) { + spans[0].onClick(this); + } + } + return retVal; + } + + @Override + public final void setOnClickListener(OnClickListener l) { + super.setOnClickListener(l); + if (l != null) mExternalOnClickListenerSet = true; + } +}
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/InfoBarUiItem.java b/weblayer/browser/java/org/chromium/weblayer_private/InfoBarUiItem.java new file mode 100644 index 0000000..5a653d0 --- /dev/null +++ b/weblayer/browser/java/org/chromium/weblayer_private/InfoBarUiItem.java
@@ -0,0 +1,69 @@ +// 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. + +package org.chromium.weblayer_private; + +import android.view.View; + +import androidx.annotation.IntDef; + +import org.chromium.chrome.browser.infobar.InfoBarIdentifier; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** + * An interface for items that can be added to an InfoBarContainerLayout. + */ +public interface InfoBarUiItem { + // The infobar priority. + @IntDef({InfoBarPriority.CRITICAL, InfoBarPriority.USER_TRIGGERED, + InfoBarPriority.PAGE_TRIGGERED, InfoBarPriority.BACKGROUND}) + @Retention(RetentionPolicy.SOURCE) + public @interface InfoBarPriority { + int CRITICAL = 0; + int USER_TRIGGERED = 1; + int PAGE_TRIGGERED = 2; + int BACKGROUND = 3; + } + + /** + * Returns the View that represents this infobar. This should have no background or borders; + * a background and shadow will be added by a wrapper view. + */ + View getView(); + + /** + * Returns whether controls for this View should be clickable. If false, all input events on + * this item will be ignored. + */ + boolean areControlsEnabled(); + + /** + * Sets whether or not controls for this View should be clickable. This does not affect the + * visual state of the infobar. + * @param state If false, all input events on this Item will be ignored. + */ + void setControlsEnabled(boolean state); + + /** + * Returns the accessibility text to announce when this infobar is first shown. + */ + CharSequence getAccessibilityText(); + + /** + * Returns the priority of an infobar. High priority infobar is shown in front of low + * priority infobar. If infobars have the same priorities, the most recently added one + * is shown behind previous ones. + * + */ + int getPriority(); + + /** + * Returns the type of infobar, as best as can be determined at this time. See + * components/infobars/core/infobar_delegate.h. + */ + @InfoBarIdentifier + int getInfoBarIdentifier(); +}
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/InfoBarWrapper.java b/weblayer/browser/java/org/chromium/weblayer_private/InfoBarWrapper.java new file mode 100644 index 0000000..d5e33b9c --- /dev/null +++ b/weblayer/browser/java/org/chromium/weblayer_private/InfoBarWrapper.java
@@ -0,0 +1,46 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.weblayer_private; + +import android.content.Context; +import android.content.res.Resources; +import android.view.Gravity; +import android.view.View; +import android.widget.FrameLayout; + +/** + * Layout that holds an infobar's contents and provides a background color and a top shadow. + */ +class InfoBarWrapper extends FrameLayout { + private final InfoBarUiItem mItem; + + /** + * Constructor for inflating from Java. + */ + InfoBarWrapper(Context context, InfoBarUiItem item) { + super(context); + mItem = item; + Resources res = context.getResources(); + int peekingHeight = res.getDimensionPixelSize(R.dimen.infobar_peeking_height); + int shadowHeight = res.getDimensionPixelSize(R.dimen.infobar_shadow_height); + setMinimumHeight(peekingHeight + shadowHeight); + + // TODO(crbug.com/1025620): Bring in infobar background rather than just setting background + // to gray. setBackgroundResource() changes the padding, so call setPadding() second. + // setBackgroundResource(R.drawable.infobar_wrapper_bg); + setBackgroundColor(0xFFD3D3D3); + setPadding(0, shadowHeight, 0, 0); + } + + InfoBarUiItem getItem() { + return mItem; + } + + @Override + public void onViewAdded(View child) { + child.setLayoutParams(new LayoutParams( + LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, Gravity.TOP)); + } +}
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/SwipableOverlayView.java b/weblayer/browser/java/org/chromium/weblayer_private/SwipableOverlayView.java new file mode 100644 index 0000000..e773366d --- /dev/null +++ b/weblayer/browser/java/org/chromium/weblayer_private/SwipableOverlayView.java
@@ -0,0 +1,421 @@ +// 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. + +package org.chromium.weblayer_private; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ObjectAnimator; +import android.content.Context; +import android.graphics.Region; +import android.util.AttributeSet; +import android.view.Gravity; +import android.view.View; +import android.view.ViewGroup; +import android.view.animation.DecelerateInterpolator; +import android.view.animation.Interpolator; +import android.widget.FrameLayout; + +import androidx.annotation.IntDef; + +import org.chromium.base.MathUtils; +import org.chromium.content_public.browser.GestureListenerManager; +import org.chromium.content_public.browser.GestureStateListenerWithScroll; +import org.chromium.content_public.browser.WebContents; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** + * View that slides up from the bottom of the page and slides away as the user scrolls the page. + * Meant to be tacked onto the {@link org.chromium.content_public.browser.WebContents}'s view and + * alerted when either the page scroll position or viewport size changes. + * + * GENERAL BEHAVIOR + * This View is brought onto the screen by sliding upwards from the bottom of the screen. Afterward + * the View slides onto and off of the screen vertically as the user scrolls upwards or + * downwards on the page. + * + * As the scroll offset or the viewport height are updated via a scroll or fling, the difference + * from the initial value is used to determine the View's Y-translation. If a gesture is stopped, + * the View will be snapped back into the center of the screen or entirely off of the screen, based + * on how much of the View is visible, or where the user is currently located on the page. + */ +public abstract class SwipableOverlayView extends FrameLayout { + private static final float FULL_THRESHOLD = 0.5f; + private static final float VERTICAL_FLING_SHOW_THRESHOLD = 0.2f; + private static final float VERTICAL_FLING_HIDE_THRESHOLD = 0.9f; + + @IntDef({Gesture.NONE, Gesture.SCROLLING, Gesture.FLINGING}) + @Retention(RetentionPolicy.SOURCE) + private @interface Gesture { + int NONE = 0; + int SCROLLING = 1; + int FLINGING = 2; + } + + private static final long ANIMATION_DURATION_MS = 250; + + /** Detects when the user is dragging the WebContents. */ + private final GestureStateListenerWithScroll mGestureStateListener; + + /** Listens for changes in the layout. */ + private final View.OnLayoutChangeListener mLayoutChangeListener; + + /** Interpolator used for the animation. */ + private final Interpolator mInterpolator; + + /** Tracks whether the user is scrolling or flinging. */ + private @Gesture int mGestureState; + + /** Animation currently being used to translate the View. */ + private Animator mCurrentAnimation; + + /** Used to determine when the layout has changed and the Viewport must be updated. */ + private int mParentHeight; + + /** Offset from the top of the page when the current gesture was first started. */ + private int mInitialOffsetY; + + /** How tall the View is, including its margins. */ + private int mTotalHeight; + + /** Whether or not the View ever been fully displayed. */ + private boolean mIsBeingDisplayedForFirstTime; + + /** The WebContents to which the overlay is added. */ + private WebContents mWebContents; + + /** + * Creates a SwipableOverlayView. + * @param context Context for acquiring resources. + * @param attrs Attributes from the XML layout inflation. + */ + public SwipableOverlayView(Context context, AttributeSet attrs) { + super(context, attrs); + mGestureStateListener = createGestureStateListener(); + mGestureState = Gesture.NONE; + mLayoutChangeListener = createLayoutChangeListener(); + mInterpolator = new DecelerateInterpolator(1.0f); + + // We make this view 'draw' to provide a placeholder for its animations. + setWillNotDraw(false); + } + + /** + * Set the given WebContents for scrolling changes. + */ + public void setWebContents(WebContents webContents) { + if (mWebContents != null) { + GestureListenerManager.fromWebContents(mWebContents) + .removeListener(mGestureStateListener); + } + + mWebContents = webContents; + // See comment in onLayout() as to why the listener is only attached if mTotalHeight is > 0. + if (mWebContents != null && mTotalHeight > 0) { + GestureListenerManager.fromWebContents(mWebContents).addListener(mGestureStateListener); + } + } + + public WebContents getWebContents() { + return mWebContents; + } + + protected void addToParentView(ViewGroup parentView) { + if (parentView == null) return; + if (getParent() == null) { + parentView.addView(this, createLayoutParams()); + + // Listen for the layout to know when to animate the View coming onto the screen. + addOnLayoutChangeListener(mLayoutChangeListener); + } + } + + /** + * Removes the SwipableOverlayView from its parent and stops monitoring the WebContents. + * @return Whether the View was removed from its parent. + */ + public boolean removeFromParentView() { + if (getParent() == null) return false; + + ((ViewGroup) getParent()).removeView(this); + removeOnLayoutChangeListener(mLayoutChangeListener); + return true; + } + + /** + * Creates a set of LayoutParams that makes the View hug the bottom of the screen. Override it + * for other types of behavior. + * @return LayoutParams for use when adding the View to its parent. + */ + public ViewGroup.MarginLayoutParams createLayoutParams() { + return new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, + Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL); + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + if (!isAllowedToAutoHide()) setTranslationY(0.0f); + } + + @Override + public void onWindowFocusChanged(boolean hasWindowFocus) { + super.onWindowFocusChanged(hasWindowFocus); + if (!isAllowedToAutoHide()) setTranslationY(0.0f); + } + + /** + * See {@link #android.view.ViewGroup.onLayout(boolean, int, int, int, int)}. + */ + @Override + protected void onLayout(boolean changed, int l, int t, int r, int b) { + // Update the viewport height when the parent View's height changes (e.g. after rotation). + int currentParentHeight = getParent() == null ? 0 : ((View) getParent()).getHeight(); + if (mParentHeight != currentParentHeight) { + mParentHeight = currentParentHeight; + mGestureState = Gesture.NONE; + if (mCurrentAnimation != null) mCurrentAnimation.end(); + } + + // Update the known effective height of the View. + MarginLayoutParams params = (MarginLayoutParams) getLayoutParams(); + mTotalHeight = getMeasuredHeight() + params.topMargin + params.bottomMargin; + + // Adding a listener to GestureListenerManager results in extra IPCs on every frame, which + // is very costly. Only attach the listener if needed. + if (mWebContents != null) { + if (mTotalHeight > 0) { + GestureListenerManager.fromWebContents(mWebContents) + .addListener(mGestureStateListener); + } else { + GestureListenerManager.fromWebContents(mWebContents) + .removeListener(mGestureStateListener); + } + } + + super.onLayout(changed, l, t, r, b); + } + + /** + * Creates a listener than monitors the WebContents for scrolls and flings. + * The listener updates the location of this View to account for the user's gestures. + * @return GestureStateListenerWithScroll to send to the WebContents. + */ + private GestureStateListenerWithScroll createGestureStateListener() { + return new GestureStateListenerWithScroll() { + /** Tracks the previous event's scroll offset to determine if a scroll is up or down. */ + private int mLastScrollOffsetY; + + /** Location of the View when the current gesture was first started. */ + private float mInitialTranslationY; + + /** The initial extent of the scroll when triggered. */ + private float mInitialExtentY; + + @Override + public void onFlingStartGesture(int scrollOffsetY, int scrollExtentY) { + if (!isAllowedToAutoHide() || !cancelCurrentAnimation()) return; + resetInternalScrollState(scrollOffsetY, scrollExtentY); + mGestureState = Gesture.FLINGING; + } + + @Override + public void onFlingEndGesture(int scrollOffsetY, int scrollExtentY) { + if (mGestureState != Gesture.FLINGING) return; + mGestureState = Gesture.NONE; + + updateTranslation(scrollOffsetY, scrollExtentY); + + boolean isScrollingDownward = scrollOffsetY > mLastScrollOffsetY; + + boolean isVisibleInitially = mInitialTranslationY < mTotalHeight; + float percentageVisible = 1.0f - (getTranslationY() / mTotalHeight); + float visibilityThreshold = isVisibleInitially ? VERTICAL_FLING_HIDE_THRESHOLD + : VERTICAL_FLING_SHOW_THRESHOLD; + boolean isVisibleEnough = percentageVisible > visibilityThreshold; + boolean isNearTopOfPage = scrollOffsetY < (mTotalHeight * FULL_THRESHOLD); + + boolean show = (!isScrollingDownward && isVisibleEnough) || isNearTopOfPage; + + runUpEventAnimation(show); + } + + @Override + public void onScrollStarted(int scrollOffsetY, int scrollExtentY) { + if (!isAllowedToAutoHide() || !cancelCurrentAnimation()) return; + resetInternalScrollState(scrollOffsetY, scrollExtentY); + mLastScrollOffsetY = scrollOffsetY; + mGestureState = Gesture.SCROLLING; + } + + @Override + public void onScrollEnded(int scrollOffsetY, int scrollExtentY) { + if (mGestureState != Gesture.SCROLLING) return; + mGestureState = Gesture.NONE; + + updateTranslation(scrollOffsetY, scrollExtentY); + + runUpEventAnimation(shouldSnapToVisibleState(scrollOffsetY)); + } + + @Override + public void onScrollOffsetOrExtentChanged(int scrollOffsetY, int scrollExtentY) { + mLastScrollOffsetY = scrollOffsetY; + + if (!shouldConsumeScroll(scrollOffsetY, scrollExtentY)) { + resetInternalScrollState(scrollOffsetY, scrollExtentY); + return; + } + + // This function is called for both fling and scrolls. + if (mGestureState == Gesture.NONE || !cancelCurrentAnimation() + || isIndependentlyAnimating()) { + return; + } + + updateTranslation(scrollOffsetY, scrollExtentY); + } + + private void updateTranslation(int scrollOffsetY, int scrollExtentY) { + float scrollDiff = + (scrollOffsetY - mInitialOffsetY) + (scrollExtentY - mInitialExtentY); + float translation = + MathUtils.clamp(mInitialTranslationY + scrollDiff, mTotalHeight, 0); + + // If the container has reached the completely shown position, reset the initial + // scroll so any movement will start hiding it again. + if (translation <= 0f) resetInternalScrollState(scrollOffsetY, scrollExtentY); + + setTranslationY(translation); + } + + /** + * Resets the internal values that a scroll or fling will base its calculations off of. + */ + private void resetInternalScrollState(int scrollOffsetY, int scrollExtentY) { + mInitialOffsetY = scrollOffsetY; + mInitialExtentY = scrollExtentY; + mInitialTranslationY = getTranslationY(); + } + }; + } + + /** + * @param scrollOffsetY The current scroll offset on the Y axis. + * @param scrollExtentY The current scroll extent on the Y axis. + * @return Whether or not the scroll should be consumed by the view. + */ + protected boolean shouldConsumeScroll(int scrollOffsetY, int scrollExtentY) { + return true; + } + + /** + * @param scrollOffsetY The current scroll offset on the Y axis. + * @return Whether the view should snap to a visible state. + */ + protected boolean shouldSnapToVisibleState(int scrollOffsetY) { + boolean isNearTopOfPage = scrollOffsetY < (mTotalHeight * FULL_THRESHOLD); + boolean isVisibleEnough = getTranslationY() < mTotalHeight * FULL_THRESHOLD; + return isNearTopOfPage || isVisibleEnough; + } + + /** + * @return Whether or not the view is animating independent of the user's scroll position. + */ + protected boolean isIndependentlyAnimating() { + return false; + } + + /** + * Creates a listener that is used only to animate the View coming onto the screen. + * @return The SimpleOnGestureListener that will monitor the View. + */ + private View.OnLayoutChangeListener createLayoutChangeListener() { + return new View.OnLayoutChangeListener() { + @Override + public void onLayoutChange(View v, int left, int top, int right, int bottom, + int oldLeft, int oldTop, int oldRight, int oldBottom) { + removeOnLayoutChangeListener(mLayoutChangeListener); + + // Animate the View coming in from the bottom of the screen. + setTranslationY(mTotalHeight); + mIsBeingDisplayedForFirstTime = true; + runUpEventAnimation(true); + } + }; + } + + /** + * Create an animation that snaps the View into position vertically. + * @param visible If true, snaps the View to the bottom-center of the screen. If false, + * translates the View below the bottom-center of the screen so that it is + * effectively invisible. + * @return An animator with the snap animation. + */ + protected Animator createVerticalSnapAnimation(boolean visible) { + float targetTranslationY = visible ? 0.0f : mTotalHeight; + float yDifference = Math.abs(targetTranslationY - getTranslationY()) / mTotalHeight; + long duration = Math.max(0, (long) (ANIMATION_DURATION_MS * yDifference)); + + Animator animator = ObjectAnimator.ofFloat(this, View.TRANSLATION_Y, targetTranslationY); + animator.setDuration(duration); + animator.setInterpolator(mInterpolator); + + return animator; + } + + /** + * Run an animation when a gesture has ended (an 'up' motion event). + * @param visible Whether or not the view should be visible. + */ + protected void runUpEventAnimation(boolean visible) { + if (mCurrentAnimation != null) mCurrentAnimation.cancel(); + mCurrentAnimation = createVerticalSnapAnimation(visible); + mCurrentAnimation.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + mGestureState = Gesture.NONE; + mCurrentAnimation = null; + mIsBeingDisplayedForFirstTime = false; + } + }); + mCurrentAnimation.start(); + } + + /** + * Cancels the current animation, unless the View is coming onto the screen for the first time. + * @return True if the animation was canceled or wasn't running, false otherwise. + */ + private boolean cancelCurrentAnimation() { + if (mIsBeingDisplayedForFirstTime) return false; + if (mCurrentAnimation != null) mCurrentAnimation.cancel(); + return true; + } + + /** + * @return Whether the SwipableOverlayView is allowed to hide itself on scroll. + */ + protected boolean isAllowedToAutoHide() { + return true; + } + + /** + * Override gatherTransparentRegion to make this view's layout a placeholder for its + * animations. This is only called during layout, so it doesn't really make sense to apply + * post-layout properties like it does by default. Together with setWillNotDraw(false), + * this ensures no child animation within this view's layout will be clipped by a SurfaceView. + */ + @Override + public boolean gatherTransparentRegion(Region region) { + float translationY = getTranslationY(); + setTranslationY(0); + boolean result = super.gatherTransparentRegion(region); + // Restoring TranslationY invalidates this view unnecessarily. However, this function + // is called as part of layout, which implies a full redraw is about to occur anyway. + setTranslationY(translationY); + return result; + } +}
diff --git a/weblayer/browser/java/res/values/dimens.xml b/weblayer/browser/java/res/values/dimens.xml index dfce8d8e..6d36e5b0 100644 --- a/weblayer/browser/java/res/values/dimens.xml +++ b/weblayer/browser/java/res/values/dimens.xml
@@ -6,4 +6,21 @@ <resources> <dimen name="security_status_icon_size">18dp</dimen> <dimen name="url_text_edge_padding">5dp</dimen> -</resources> \ No newline at end of file + + <!-- Infobar dimensions --> + <!-- Maximum width of an infobar. --> + <dimen name="infobar_max_width">600dp</dimen> + <!-- Width of side shadows on floating infobars. --> + <dimen name="infobar_shadow_width">8dp</dimen> + <!-- Height of top shadow on each infobar. --> + <dimen name="infobar_shadow_height">8dp</dimen> + <!-- Distance that a back infobar peeks out above the front infobar. --> + <dimen name="infobar_peeking_height">10dp</dimen> + + <!-- Dimensions for compact infobars are a little shorter. --> + <dimen name="infobar_compact_size">56dp</dimen> + <dimen name="infobar_compact_message_vertical_padding">8dp</dimen> + + <!-- Dimensions applied to InfoBars with differently sized icons. --> + <dimen name="infobar_big_icon_size">48dp</dimen> +</resources>
diff --git a/weblayer/browser/java/res/values/ids.xml b/weblayer/browser/java/res/values/ids.xml new file mode 100644 index 0000000..e9fdf83 --- /dev/null +++ b/weblayer/browser/java/res/values/ids.xml
@@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. --> +<resources> + <!-- InfoBar constants --> + <item type="id" name="infobar_icon" /> + <item type="id" name="infobar_close_button" /> + <item type="id" name="infobar_message" /> +</resources>
diff --git a/weblayer/browser/java/weblayer_strings.grd b/weblayer/browser/java/weblayer_strings.grd index cd1e72c..188affe 100644 --- a/weblayer/browser/java/weblayer_strings.grd +++ b/weblayer/browser/java/weblayer_strings.grd
@@ -172,6 +172,12 @@ <message name="IDS_WEBLAYER_NOTIFICATION_CHANNEL_GROUP_NAME" desc="The user-facing label for the notification channel group used for notifications arising from web browsing activity."> Web browser activity </message> + <message name="IDS_WEBLAYER_BOTTOM_BAR_SCREEN_POSITION" desc="Accessibility label to inform users about the InfoBar location"> + Options available near bottom of the screen + </message> + <message name="IDS_WEBLAYER_INFOBAR_CLOSE" desc="Accessibility label for the dismiss infobar Button"> + Close + </message> </messages> </release> </grit>