| Index: chrome/browser/ui/ash/launcher/browser_status_monitor.cc
|
| diff --git a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc
|
| index 4b7d06bf0940463cdeacea7fdc76d440398c972e..1484c08d4d84ec83a92c397a0dfcf900805bbcc3 100644
|
| --- a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc
|
| +++ b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc
|
| @@ -259,8 +259,9 @@ void BrowserStatusMonitor::AddV1AppToShelf(Browser* browser) {
|
| std::string app_id =
|
| web_app::GetExtensionIdFromApplicationName(browser->app_name());
|
| if (!app_id.empty()) {
|
| + if (!IsV1AppInShelfWithAppId(app_id))
|
| + launcher_controller_->SetV1AppStatus(app_id, ash::STATUS_RUNNING);
|
| browser_to_app_id_map_[browser] = app_id;
|
| - launcher_controller_->LockV1AppWithID(app_id);
|
| }
|
| }
|
|
|
| @@ -268,9 +269,12 @@ void BrowserStatusMonitor::RemoveV1AppFromShelf(Browser* browser) {
|
| DCHECK(browser->is_type_popup() && browser->is_app());
|
| DCHECK(initialized_);
|
|
|
| - if (browser_to_app_id_map_.find(browser) != browser_to_app_id_map_.end()) {
|
| - launcher_controller_->UnlockV1AppWithID(browser_to_app_id_map_[browser]);
|
| - browser_to_app_id_map_.erase(browser);
|
| + auto iter = browser_to_app_id_map_.find(browser);
|
| + if (iter != browser_to_app_id_map_.end()) {
|
| + std::string app_id = iter->second;
|
| + browser_to_app_id_map_.erase(iter);
|
| + if (!IsV1AppInShelfWithAppId(app_id))
|
| + launcher_controller_->SetV1AppStatus(app_id, ash::STATUS_CLOSED);
|
| }
|
| }
|
|
|
| @@ -278,6 +282,14 @@ bool BrowserStatusMonitor::IsV1AppInShelf(Browser* browser) {
|
| return browser_to_app_id_map_.find(browser) != browser_to_app_id_map_.end();
|
| }
|
|
|
| +bool BrowserStatusMonitor::IsV1AppInShelfWithAppId(const std::string& app_id) {
|
| + for (const auto& iter : browser_to_app_id_map_) {
|
| + if (iter.second == app_id)
|
| + return true;
|
| + }
|
| + return false;
|
| +}
|
| +
|
| void BrowserStatusMonitor::AddWebContentsObserver(
|
| content::WebContents* contents) {
|
| if (webcontents_to_observer_map_.find(contents) ==
|
|
|