Yue Zhang | 32468b8 | 2023-10-31 18:09:19 | [diff] [blame^] | 1 | // Copyright 2023 The Chromium Authors |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #import "components/commerce/ios/browser/web_extractor_impl.h" |
| 6 | |
| 7 | #import "base/strings/utf_string_conversions.h" |
| 8 | #import "components/grit/components_resources.h" |
| 9 | #import "ui/base/resource/resource_bundle.h" |
| 10 | |
| 11 | namespace commerce { |
| 12 | |
| 13 | WebExtractorImpl::WebExtractorImpl() = default; |
| 14 | WebExtractorImpl::~WebExtractorImpl() = default; |
| 15 | |
| 16 | void WebExtractorImpl::ExtractMetaInfo( |
| 17 | WebWrapper* web_wrapper, |
| 18 | base::OnceCallback<void(const base::Value)> callback) { |
| 19 | std::string script = |
| 20 | ui::ResourceBundle::GetSharedInstance().LoadDataResourceString( |
| 21 | IDR_QUERY_SHOPPING_META_JS); |
| 22 | |
| 23 | web_wrapper->RunJavascript(base::UTF8ToUTF16(script), std::move(callback)); |
| 24 | } |
| 25 | |
| 26 | } // namespace commerce |