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

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

Issue 2790803002: mash: Remove V1 app shelf item locking; monitor running status instead. (Closed)
Patch Set: spelling Created 3 years, 9 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
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) ==
« no previous file with comments | « chrome/browser/ui/ash/launcher/browser_status_monitor.h ('k') | chrome/browser/ui/ash/launcher/chrome_launcher_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698