#include "chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.h"
#include <memory>
#include <utility>
#include "base/check_op.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/task_manager/web_contents_tags.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
#include "chrome/browser/ui/views/payments/payment_request_views_util.h"
#include "chrome/grit/generated_resources.h"
#include "components/omnibox/browser/location_bar_model_util.h"
#include "components/payments/content/icon/icon_size.h"
#include "components/payments/content/payment_handler_navigation_throttle.h"
#include "components/payments/content/ssl_validity_checker.h"
#include "components/payments/core/features.h"
#include "components/payments/core/native_error_strings.h"
#include "components/payments/core/payments_experimental_features.h"
#include "components/payments/core/url_util.h"
#include "components/security_state/core/security_state.h"
#include "components/strings/grit/components_strings.h"
#include "components/url_formatter/elide_url.h"
#include "components/vector_icons/vector_icons.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/image_button_factory.h"
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/progress_bar.h"
#include "ui/views/controls/separator.h"
#include "ui/views/controls/webview/webview.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/table_layout.h"
#include "ui/views/view_class_properties.h"
#include "url/origin.h"
#include "url/url_constants.h"
namespace payments {
namespace {
std::u16string GetPaymentHandlerDialogTitle(
content::WebContents* web_contents) { … }
SkColor GetContrastingGoogleColor(SkColor light_mode_color,
SkColor dark_mode_color,
SkColor background_color,
float contrast_ratio) { … }
}
class PaymentHandlerCloseButton : public views::ImageButton { … };
BEGIN_METADATA(…)
PaymentHandlerWebFlowViewController::PaymentHandlerWebFlowViewController(
base::WeakPtr<PaymentRequestSpec> spec,
base::WeakPtr<PaymentRequestState> state,
base::WeakPtr<PaymentRequestDialogView> dialog,
content::WebContents* payment_request_web_contents,
Profile* profile,
GURL target,
PaymentHandlerOpenWindowCallback first_navigation_complete_callback)
: … { … }
PaymentHandlerWebFlowViewController::~PaymentHandlerWebFlowViewController() { … }
std::u16string PaymentHandlerWebFlowViewController::GetSheetTitle() { … }
void PaymentHandlerWebFlowViewController::FillContentView(
views::View* content_view) { … }
bool PaymentHandlerWebFlowViewController::ShouldShowPrimaryButton() { … }
bool PaymentHandlerWebFlowViewController::ShouldShowSecondaryButton() { … }
void PaymentHandlerWebFlowViewController::PopulateSheetHeaderView(
views::View* container) { … }
bool PaymentHandlerWebFlowViewController::GetSheetId(DialogViewID* sheet_id) { … }
bool PaymentHandlerWebFlowViewController::
DisplayDynamicBorderForHiddenContents() { … }
bool PaymentHandlerWebFlowViewController::CanContentViewBeScrollable() { … }
base::WeakPtr<PaymentRequestSheetController>
PaymentHandlerWebFlowViewController::GetWeakPtr() { … }
void PaymentHandlerWebFlowViewController::VisibleSecurityStateChanged(
content::WebContents* source) { … }
content::WebContents* PaymentHandlerWebFlowViewController::AddNewContents(
content::WebContents* source,
std::unique_ptr<content::WebContents> new_contents,
const GURL& target_url,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& window_features,
bool user_gesture,
bool* was_blocked) { … }
bool PaymentHandlerWebFlowViewController::HandleKeyboardEvent(
content::WebContents* source,
const input::NativeWebKeyboardEvent& event) { … }
void PaymentHandlerWebFlowViewController::DidFinishNavigation(
content::NavigationHandle* navigation_handle) { … }
void PaymentHandlerWebFlowViewController::LoadProgressChanged(double progress) { … }
void PaymentHandlerWebFlowViewController::TitleWasSet(
content::NavigationEntry* entry) { … }
void PaymentHandlerWebFlowViewController::AbortPayment() { … }
std::unique_ptr<views::Background>
PaymentHandlerWebFlowViewController::GetHeaderBackground(
views::View* header_view) { … }
}