Skip to content

Commit ef63cc7

Browse files
committed
feat(address-bar): route Back button through chrome::GoBack for back-to-opener
1 parent 67b931d commit ef63cc7

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/dao/browser/ui/views/dao_address_bar_view.cc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include "base/strings/utf_string_conversions.h"
88
#include "chrome/browser/ui/browser.h"
9+
#include "chrome/browser/ui/browser_commands.h"
910
#include "chrome/browser/ui/tabs/tab_strip_model.h"
1011
#include "chrome/browser/ui/views/frame/browser_view.h"
1112
#include "content/public/browser/navigation_controller.h"
@@ -626,13 +627,11 @@ void DaoAddressBarView::OnToggleButtonPressed() {
626627
}
627628

628629
void DaoAddressBarView::OnBackButtonPressed() {
629-
if (!tab_strip_model_) {
630+
if (!browser_) {
630631
return;
631632
}
632-
content::WebContents* contents =
633-
tab_strip_model_->GetActiveWebContents();
634-
if (contents && contents->GetController().CanGoBack()) {
635-
contents->GetController().GoBack();
633+
if (chrome::CanGoBack(browser_)) {
634+
chrome::GoBack(browser_, WindowOpenDisposition::CURRENT_TAB);
636635
}
637636
}
638637

@@ -684,7 +683,7 @@ void DaoAddressBarView::UpdateNavButtonEnabled() {
684683
return;
685684
}
686685
content::WebContents* contents = tab_strip_model_->GetActiveWebContents();
687-
bool can_back = contents && contents->GetController().CanGoBack();
686+
bool can_back = browser_ && chrome::CanGoBack(browser_);
688687
bool can_forward = contents && contents->GetController().CanGoForward();
689688

690689
if (back_button_) {

0 commit comments

Comments
 (0)