Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.cc

Issue 2719233002: Fix browser window shelf id init; re-enable browser test. (Closed)
Patch Set: Add shelf_delegate null check. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.cc
diff --git a/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.cc b/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.cc
index 5e043d9260d3db65460162063b25622c24203ac6..4efb236edb71b1acb5f63f159f8dfb543d9f3485 100644
--- a/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.cc
+++ b/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.cc
@@ -66,7 +66,17 @@ BrowserShortcutLauncherItemController::BrowserShortcutLauncherItemController(
: LauncherItemController(extension_misc::kChromeAppId,
std::string(),
launcher_controller),
- shelf_model_(shelf_model) {}
+ shelf_model_(shelf_model) {
+ // Tag all open browser windows with the appropriate shelf id property. This
+ // associates each window with the shelf item for the active web contents.
+ for (auto* browser : *BrowserList::GetInstance()) {
+ if (IsBrowserRepresentedInBrowserList(browser) &&
+ browser->tab_strip_model()->GetActiveWebContents()) {
+ SetShelfIDForBrowserWindowContents(
+ browser, browser->tab_strip_model()->GetActiveWebContents());
+ }
+ }
+}
BrowserShortcutLauncherItemController::
~BrowserShortcutLauncherItemController() {}
@@ -279,10 +289,12 @@ bool BrowserShortcutLauncherItemController::IsBrowserRepresentedInBrowserList(
return false;
// v1 App popup windows with a valid app id have their own icon.
- if (browser->is_app() && browser->is_type_popup() &&
- ash::WmShell::Get()->shelf_delegate()->GetShelfIDForAppID(
- web_app::GetExtensionIdFromApplicationName(browser->app_name())) > 0)
+ ash::ShelfDelegate* delegate = ash::WmShell::Get()->shelf_delegate();
+ if (browser->is_app() && browser->is_type_popup() && delegate &&
+ delegate->GetShelfIDForAppID(web_app::GetExtensionIdFromApplicationName(
+ browser->app_name())) > 0) {
return false;
+ }
// Settings browsers have their own icon.
if (IsSettingsBrowser(browser))
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698