[omnibox] Enable the IDC_FOCUS_LOCATION command in popup windows.

Before this cl, the command was disabled for fullscreen windows which hide the toolbar and popup windows. This cl enables the command in popup windows. The command is bound to the (ctrl/cmd + l) and (alt + d) shortcuts.

Bug: 165660
Change-Id: I4093edbb5e07af363de22834162d6d6e0ae637f4
Reviewed-on: https://chromium-review.googlesource.com/c/1244166
Reviewed-by: Wei Li <[email protected]>
Reviewed-by: Trent Apted <[email protected]>
Commit-Queue: manuk hovanesian <[email protected]>
Cr-Commit-Position: refs/heads/master@{#602737}
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
index cb2b2af..cb6812d 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -821,8 +821,11 @@
 };
 
 bool BrowserCommandController::IsShowingMainUI() {
-  bool should_hide_ui = window() && window()->ShouldHideUIForFullscreen();
-  return browser_->is_type_tabbed() && !should_hide_ui;
+  return browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP);
+}
+
+bool BrowserCommandController::IsShowingLocationBar() {
+  return browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR);
 }
 
 void BrowserCommandController::InitCommandState() {
@@ -1155,6 +1158,8 @@
 
   const bool is_fullscreen = window() && window()->IsFullscreen();
   const bool show_main_ui = IsShowingMainUI();
+  const bool show_location_bar = IsShowingLocationBar();
+
   const bool main_not_fullscreen = show_main_ui && !is_fullscreen;
 
   // Navigation commands
@@ -1167,7 +1172,7 @@
 
   // Focus various bits of UI
   command_updater_.UpdateCommandEnabled(IDC_FOCUS_TOOLBAR, show_main_ui);
-  command_updater_.UpdateCommandEnabled(IDC_FOCUS_LOCATION, show_main_ui);
+  command_updater_.UpdateCommandEnabled(IDC_FOCUS_LOCATION, show_location_bar);
   command_updater_.UpdateCommandEnabled(IDC_FOCUS_SEARCH, show_main_ui);
   command_updater_.UpdateCommandEnabled(
       IDC_FOCUS_MENU_BAR, main_not_fullscreen);