Commit 2bc7961a authored by Tommy Li's avatar Tommy Li Committed by Commit Bot

[omnibox] Don't focus omnibox for view-source of NTP

Currently, we have code to focus the omnibox when opening the NTP
(New Tab Page).

This is all well and good, but we also need to add a check to not do
this when viewing the source of the NTP.

Bug: 970185
Change-Id: Ib488e0cc8e8607bd2f9b8d2f8ddec0f0066ecee5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1754151Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Commit-Queue: Tommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#687320}
parent f0aff178
...@@ -206,6 +206,7 @@ ...@@ -206,6 +206,7 @@
#include "content/public/common/content_features.h" #include "content/public/common/content_features.h"
#include "content/public/common/page_zoom.h" #include "content/public/common/page_zoom.h"
#include "content/public/common/profiling.h" #include "content/public/common/profiling.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/webplugininfo.h" #include "content/public/common/webplugininfo.h"
#include "content/public/common/window_container_type.mojom-shared.h" #include "content/public/common/window_container_type.mojom-shared.h"
#include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_prefs.h"
...@@ -1580,6 +1581,10 @@ bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) { ...@@ -1580,6 +1581,10 @@ bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) {
if (entry) { if (entry) {
const GURL& url = entry->GetURL(); const GURL& url = entry->GetURL();
const GURL& virtual_url = entry->GetVirtualURL(); const GURL& virtual_url = entry->GetVirtualURL();
if (virtual_url.SchemeIs(content::kViewSourceScheme))
return false;
if ((url.SchemeIs(content::kChromeUIScheme) && if ((url.SchemeIs(content::kChromeUIScheme) &&
url.host_piece() == chrome::kChromeUINewTabHost) || url.host_piece() == chrome::kChromeUINewTabHost) ||
(virtual_url.SchemeIs(content::kChromeUIScheme) && (virtual_url.SchemeIs(content::kChromeUIScheme) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment