-
Notifications
You must be signed in to change notification settings - Fork 904
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2242 from brave/location-bar-focus-0.64.x
Avoid clobering user input on newtab
- Loading branch information
Showing
18 changed files
with
168 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc | ||
index 939a669e01d34f83247786cd0a940cbc93cdc6f1..0a66f41df4fd551f907b4b4cadc4e7dda9dbe7e6 100644 | ||
--- a/chrome/browser/ui/browser.cc | ||
+++ b/chrome/browser/ui/browser.cc | ||
@@ -1121,7 +1121,7 @@ void Browser::SetFocusToLocationBar() { | ||
// the focus. FocusLocationBar() is only reached when the location bar is | ||
// focusable, but this may be reached at other times, e.g. while in | ||
// fullscreen mode, where we need to leave focus in a consistent state. | ||
- window_->SetFocusToLocationBar(); | ||
+ window_->SetFocusToLocationBar(false); | ||
} | ||
|
||
content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc | ||
index 662ff6224d64249902fac4099b4326df83149997..c2cdd1def36a20747b9b9d056bbf26432926178e 100644 | ||
--- a/chrome/browser/ui/browser_commands.cc | ||
+++ b/chrome/browser/ui/browser_commands.cc | ||
@@ -1105,7 +1105,7 @@ void FocusToolbar(Browser* browser) { | ||
|
||
void FocusLocationBar(Browser* browser) { | ||
base::RecordAction(UserMetricsAction("FocusLocation")); | ||
- browser->window()->SetFocusToLocationBar(); | ||
+ browser->window()->SetFocusToLocationBar(true); | ||
} | ||
|
||
void FocusSearch(Browser* browser) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h | ||
index 3f42805e9b42a5bf104b8b37c4fe6e20dbb777e6..f5c499c8c37645888764c79dedbfcfc62c02f408 100644 | ||
--- a/chrome/browser/ui/browser_window.h | ||
+++ b/chrome/browser/ui/browser_window.h | ||
@@ -241,7 +241,7 @@ class BrowserWindow : public ui::BaseWindow { | ||
|
||
// Tries to focus the location bar. Clears the window focus (to avoid | ||
// inconsistent state) if this fails. | ||
- virtual void SetFocusToLocationBar() = 0; | ||
+ virtual void SetFocusToLocationBar(bool select_all) = 0; | ||
|
||
// Informs the view whether or not a load is in progress for the current tab. | ||
// The view can use this notification to update the reload/stop button. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 10 additions & 1 deletion
11
patches/chrome-browser-ui-location_bar-location_bar.h.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
patches/chrome-browser-ui-views-frame-browser_view.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc | ||
index 5d0eb9abffb86b584d96b89feec0b25119b883e7..ddf77fc72f61c9c9f18648410c0972795d89c4a1 100644 | ||
--- a/chrome/browser/ui/views/frame/browser_view.cc | ||
+++ b/chrome/browser/ui/views/frame/browser_view.cc | ||
@@ -1121,7 +1121,7 @@ LocationBar* BrowserView::GetLocationBar() const { | ||
return GetLocationBarView(); | ||
} | ||
|
||
-void BrowserView::SetFocusToLocationBar() { | ||
+void BrowserView::SetFocusToLocationBar(bool select_all) { | ||
// On Windows, changing focus to the location bar causes the browser window to | ||
// become active. This can steal focus if the user has another window open | ||
// already. On Chrome OS, changing focus makes a view believe it has a focus | ||
@@ -1133,7 +1133,7 @@ void BrowserView::SetFocusToLocationBar() { | ||
#endif | ||
|
||
LocationBarView* location_bar = GetLocationBarView(); | ||
- location_bar->FocusLocation(); | ||
+ location_bar->FocusLocation(select_all); | ||
if (!location_bar->omnibox_view()->HasFocus()) { | ||
// If none of location bar got focus, then clear focus. | ||
views::FocusManager* focus_manager = GetFocusManager(); |
13 changes: 13 additions & 0 deletions
13
patches/chrome-browser-ui-views-frame-browser_view.h.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h | ||
index 417ba26f75d9637856ace03b791b4fd6b5aad822..2c35cf8efc2785ef96e7ef5650ea1624b675082d 100644 | ||
--- a/chrome/browser/ui/views/frame/browser_view.h | ||
+++ b/chrome/browser/ui/views/frame/browser_view.h | ||
@@ -341,7 +341,7 @@ class BrowserView : public BrowserWindow, | ||
bool IsFullscreenBubbleVisible() const override; | ||
PageActionIconContainer* GetPageActionIconContainer() override; | ||
LocationBar* GetLocationBar() const override; | ||
- void SetFocusToLocationBar() override; | ||
+ void SetFocusToLocationBar(bool select_all) override; | ||
void UpdateReloadStopState(bool is_loading, bool force) override; | ||
void UpdateToolbar(content::WebContents* contents) override; | ||
void UpdateToolbarVisibility(bool visible, bool animate) override; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
patches/chrome-browser-ui-views-toolbar-toolbar_view.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc | ||
index fa70d696076a6bc031ce5980d291d0443c3fa2b0..c5d8d916ce0d3431cf367511ef88d5fb6ed35334 100644 | ||
--- a/chrome/browser/ui/views/toolbar/toolbar_view.cc | ||
+++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc | ||
@@ -593,7 +593,7 @@ void ToolbarView::ChildPreferredSizeChanged(views::View* child) { | ||
bool ToolbarView::SetPaneFocusAndFocusDefault() { | ||
if (!location_bar_->HasFocus()) { | ||
SetPaneFocus(location_bar_); | ||
- location_bar_->FocusLocation(); | ||
+ location_bar_->FocusLocation(true); | ||
return true; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
diff --git a/chrome/test/base/test_browser_window.h b/chrome/test/base/test_browser_window.h | ||
index 72d532db62eda2618ab5b581ee9ffbde68b9d05b..2745c291a6b0bbdfa099b763546089bb4fd85462 100644 | ||
--- a/chrome/test/base/test_browser_window.h | ||
+++ b/chrome/test/base/test_browser_window.h | ||
@@ -88,7 +88,7 @@ class TestBrowserWindow : public BrowserWindow { | ||
bool IsFullscreenBubbleVisible() const override; | ||
LocationBar* GetLocationBar() const override; | ||
PageActionIconContainer* GetPageActionIconContainer() override; | ||
- void SetFocusToLocationBar() override {} | ||
+ void SetFocusToLocationBar(bool select_all) override {} | ||
void UpdateReloadStopState(bool is_loading, bool force) override {} | ||
void UpdateToolbar(content::WebContents* contents) override {} | ||
void UpdateToolbarVisibility(bool visible, bool animate) override {} | ||
@@ -195,7 +195,7 @@ class TestBrowserWindow : public BrowserWindow { | ||
base::TimeTicks GetMatchSelectionTimestamp() const override; | ||
void AcceptInput() override {} | ||
void AcceptInput(base::TimeTicks match_selection_timestamp) override {} | ||
- void FocusLocation() override {} | ||
+ void FocusLocation(bool select_all) override {} | ||
void FocusSearch() override {} | ||
void UpdateContentSettingsIcons() override {} | ||
void UpdateSaveCreditCardIcon() override {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters