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

Side by Side Diff: chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.cc

Issue 2791463002: mash: Remove ShelfDelegate; move functions to ShelfModel. (Closed)
Patch Set: Sync and rebase; cleanup. Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll er.h" 5 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll er.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/resources/grit/ash_resources.h" 10 #include "ash/resources/grit/ash_resources.h"
11 #include "ash/shelf/shelf_delegate.h"
12 #include "ash/shelf/shelf_model.h" 11 #include "ash/shelf/shelf_model.h"
13 #include "ash/shell.h" 12 #include "ash/shell.h"
14 #include "ash/wm/window_properties.h" 13 #include "ash/wm/window_properties.h"
15 #include "ash/wm/window_util.h" 14 #include "ash/wm/window_util.h"
16 #include "ash/wm_window.h" 15 #include "ash/wm_window.h"
17 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
18 #include "chrome/browser/chrome_notification_types.h" 17 #include "chrome/browser/chrome_notification_types.h"
19 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 19 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" 20 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 return ash::SHELF_ACTION_WINDOW_ACTIVATED; 353 return ash::SHELF_ACTION_WINDOW_ACTIVATED;
355 } 354 }
356 355
357 bool BrowserShortcutLauncherItemController::IsBrowserRepresentedInBrowserList( 356 bool BrowserShortcutLauncherItemController::IsBrowserRepresentedInBrowserList(
358 Browser* browser) { 357 Browser* browser) {
359 // Only Ash desktop browser windows for the active user are represented. 358 // Only Ash desktop browser windows for the active user are represented.
360 if (!browser || !IsBrowserFromActiveUser(browser)) 359 if (!browser || !IsBrowserFromActiveUser(browser))
361 return false; 360 return false;
362 361
363 // v1 App popup windows with a valid app id have their own icon. 362 // v1 App popup windows with a valid app id have their own icon.
364 ash::ShelfDelegate* delegate = ash::Shell::Get()->shelf_delegate(); 363 ash::ShelfModel* model = ash::Shell::Get()->shelf_model();
365 if (browser->is_app() && browser->is_type_popup() && delegate && 364 if (browser->is_app() && browser->is_type_popup() && model &&
James Cook 2017/04/19 00:23:47 I don't think you need the null check, since Shell
msw 2017/04/19 20:56:07 Done.
366 delegate->GetShelfIDForAppID(web_app::GetExtensionIdFromApplicationName( 365 model->GetShelfIDForAppID(web_app::GetExtensionIdFromApplicationName(
367 browser->app_name())) > 0) { 366 browser->app_name())) > 0) {
368 return false; 367 return false;
369 } 368 }
370 369
371 // Settings browsers have their own icon. 370 // Settings browsers have their own icon.
372 if (IsSettingsBrowser(browser)) 371 if (IsSettingsBrowser(browser))
373 return false; 372 return false;
374 373
375 // Tabbed browser and other popup windows are all represented. 374 // Tabbed browser and other popup windows are all represented.
376 return true; 375 return true;
(...skipping 27 matching lines...) Expand all
404 Browser* browser = content::Source<Browser>(source).ptr(); 403 Browser* browser = content::Source<Browser>(source).ptr();
405 DCHECK(browser); 404 DCHECK(browser);
406 BrowserList::BrowserVector::iterator item = std::find( 405 BrowserList::BrowserVector::iterator item = std::find(
407 browser_menu_items_.begin(), browser_menu_items_.end(), browser); 406 browser_menu_items_.begin(), browser_menu_items_.end(), browser);
408 DCHECK(item != browser_menu_items_.end()); 407 DCHECK(item != browser_menu_items_.end());
409 // Clear the entry for the closed browser and leave other indices intact. 408 // Clear the entry for the closed browser and leave other indices intact.
410 *item = nullptr; 409 *item = nullptr;
411 registrar_.Remove(this, chrome::NOTIFICATION_BROWSER_CLOSING, 410 registrar_.Remove(this, chrome::NOTIFICATION_BROWSER_CLOSING,
412 content::Source<Browser>(browser)); 411 content::Source<Browser>(browser));
413 } 412 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698