| 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 810a42a37de4174f582a99b28d97ea04aec2b11c..f35fdf9f54fb4d65e561008aeeb5ecdf611cbd72 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
|
| @@ -15,7 +15,6 @@
|
| #include "ash/wm/window_properties.h"
|
| #include "ash/wm/window_util.h"
|
| #include "base/memory/ptr_util.h"
|
| -#include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
|
| #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h"
|
| @@ -33,7 +32,6 @@
|
| #include "chrome/grit/chromium_strings.h"
|
| #include "chrome/grit/generated_resources.h"
|
| #include "components/strings/grit/components_strings.h"
|
| -#include "content/public/browser/notification_service.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/common/url_constants.h"
|
| #include "ui/aura/window.h"
|
| @@ -219,7 +217,7 @@ void BrowserShortcutLauncherItemController::ItemSelected(
|
| MenuItemList BrowserShortcutLauncherItemController::GetAppMenuItems(
|
| int event_flags) {
|
| browser_menu_items_.clear();
|
| - registrar_.RemoveAll();
|
| + BrowserList::RemoveObserver(this);
|
|
|
| MenuItemList items;
|
| bool found_tabbed_browser = false;
|
| @@ -250,15 +248,14 @@ MenuItemList BrowserShortcutLauncherItemController::GetAppMenuItems(
|
| }
|
| }
|
| browser_menu_items_.push_back(browser);
|
| - registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSING,
|
| - content::Source<Browser>(browser));
|
| + BrowserList::AddObserver(this);
|
| }
|
| // If only windowed applications are open, we return an empty list to
|
| // enforce the creation of a new browser.
|
| if (!found_tabbed_browser) {
|
| items.clear();
|
| browser_menu_items_.clear();
|
| - registrar_.RemoveAll();
|
| + BrowserList::RemoveObserver(this);
|
| }
|
| return items;
|
| }
|
| @@ -291,7 +288,7 @@ void BrowserShortcutLauncherItemController::ExecuteCommand(
|
| }
|
|
|
| browser_menu_items_.clear();
|
| - registrar_.RemoveAll();
|
| + BrowserList::RemoveObserver(this);
|
| }
|
|
|
| void BrowserShortcutLauncherItemController::Close() {
|
| @@ -393,18 +390,12 @@ BrowserShortcutLauncherItemController::GetListOfActiveBrowsers() {
|
| return active_browsers;
|
| }
|
|
|
| -void BrowserShortcutLauncherItemController::Observe(
|
| - int type,
|
| - const content::NotificationSource& source,
|
| - const content::NotificationDetails& details) {
|
| - DCHECK_EQ(chrome::NOTIFICATION_BROWSER_CLOSING, type);
|
| - Browser* browser = content::Source<Browser>(source).ptr();
|
| +void BrowserShortcutLauncherItemController::OnBrowserCloseStarted(
|
| + Browser* browser) {
|
| DCHECK(browser);
|
| BrowserList::BrowserVector::iterator item = std::find(
|
| browser_menu_items_.begin(), browser_menu_items_.end(), browser);
|
| DCHECK(item != browser_menu_items_.end());
|
| // Clear the entry for the closed browser and leave other indices intact.
|
| *item = nullptr;
|
| - registrar_.Remove(this, chrome::NOTIFICATION_BROWSER_CLOSING,
|
| - content::Source<Browser>(browser));
|
| }
|
|
|