[NextBrowser] Passkey code cleanup 82/315882/2
authorjmroman <jm.roman@samsung.com>
Thu, 5 Dec 2024 12:51:01 +0000 (20:51 +0800)
committerBot Blink <blinkbot@samsung.com>
Wed, 11 Dec 2024 12:07:18 +0000 (12:07 +0000)
Change-Id: I9794467b7e0d01115e1d710aa713905290a34274
Signed-off-by: jmroman <jm.roman@samsung.com>
chrome/browser/ui/views/samsung/passkey/passkey_bubble_view.cc
chrome/browser/ui/views/samsung/passkey/passkey_bubble_view.h

index 6094f8e68634e91bd83c95c6cf3899af93e55efe..f368051499f4c40401f0b3324a6b1f48a8e785d6 100644 (file)
@@ -16,6 +16,10 @@ void SamsungPasskeyBubbleDialogView::Show(
 
   auto passkey_controller =
       samsung_browser_main::SamsungBrowserCore::instance()->PasskeyController();
+  if (!passkey_controller) {
+    LOG(INFO) << "passkey_controller is null";
+    return;
+  }
   passkey_controller->SetPasskeyPopup(widget);
 }
 
@@ -28,13 +32,11 @@ SamsungPasskeyBubbleDialogView::SamsungPasskeyBubbleDialogView(
     : BubbleDialogDelegateView(anchor_view, anchor_position),
       web_contents_(web_contents) {
   std::u16string title = u"Scan the QR Code";
-  std::u16string okay = u"";
   gfx::Image image = ReadBitmap(base::FilePath("/tmp/webauthn-qrcode.png"));
   ui::ImageModel model = ui::ImageModel::FromImage(image);
   SetModalType(ui::ModalType::MODAL_TYPE_WINDOW);
   SetTitle(title);
   SetMainImage(model);
-  SetButtonLabel(ui::DIALOG_BUTTON_OK, okay);
   SetShowCloseButton(false);
   SetButtonEnabled(ui::DIALOG_BUTTON_OK, false);
   SetCancelCallback(
@@ -51,14 +53,6 @@ SamsungPasskeyBubbleDialogView::SamsungPasskeyBubbleDialogView(
       provider->GetDistanceMetric(views::DISTANCE_RELATED_LABEL_HORIZONTAL);
 
   SetLayoutManager(std::make_unique<views::TableLayout>())
-      //   ->AddColumn(views::LayoutAlignment::kStart,
-      //   views::LayoutAlignment::kStretch,
-      //               views::TableLayout::kFixedSize,
-      //               views::TableLayout::ColumnSize::kUsePreferred, 0, 0)
-      //   .AddPaddingColumn(views::TableLayout::kFixedSize, label_padding)
-      //   .AddColumn(views::LayoutAlignment::kStretch,
-      //   views::LayoutAlignment::kStretch, 1.0,
-      //              views::TableLayout::ColumnSize::kUsePreferred, 0, 0)
       ->AddRows(1, views::TableLayout::kFixedSize)
       .AddPaddingRow(views::TableLayout::kFixedSize, related_control_padding)
       .AddRows(1, views::TableLayout::kFixedSize);
@@ -91,16 +85,24 @@ void SamsungPasskeyBubbleDialogView::CancelAuthentication() {
   content::RenderWidgetHostViewAura* rwhva =
       static_cast<content::RenderWidgetHostViewAura*>(
           web_contents_->GetRenderWidgetHostView());
-  if (!rwhva)
-    return;  // TO DO, MAKE A BETTER CHECK AND RETURN
+  if (!rwhva) {
+    LOG(INFO) << "rwhva is null";
+    return;
+  }
 
   auto efl_helper = rwhva->aura_efl_helper();
-  if (!efl_helper)
-    return;  // TO DO, MAKE A BETTER CHECK AND RETURN
+  if (!efl_helper) {
+    LOG(INFO) << "efl_helper is null";
+    return;
+  }
 
   efl_helper->CancelAuthentication();
 
   auto passkey_controller =
       samsung_browser_main::SamsungBrowserCore::instance()->PasskeyController();
+  if (!passkey_controller) {
+    LOG(INFO) << "passkey_controller is null";
+    return;
+  }
   passkey_controller->ClearPasskeyPopup();
 }
\ No newline at end of file
index 1af0810618c94f73d11314af8ac743a11f40e09c..ec45a89049dc1d6f2659272d23e79dc3c4829743 100644 (file)
@@ -45,4 +45,4 @@ class SamsungPasskeyBubbleDialogView : public views::BubbleDialogDelegateView {
   content::WebContents* web_contents_;
 };
 
-#endif  // LOGIN_BUBBLE_DIALOG_EXAMPLE_H_
\ No newline at end of file
+#endif  // CHROME_BROWSER_UI_VIEWS_SAMSUNG_PASSKEY_PASSKEY_BUBBLE_VIEW_H_
\ No newline at end of file