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

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

Issue 83173007: Fixing M32 crasher where closing of a windowed V1 app on a visiting desktop will cause crashes late… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/multi_profile_browser_status_monitor.h" 5 #include "chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/profiles/profile_manager.h" 8 #include "chrome/browser/profiles/profile_manager.h"
9 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 9 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
10 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 10 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
(...skipping 12 matching lines...) Expand all
23 MultiProfileBrowserStatusMonitor::~MultiProfileBrowserStatusMonitor() { 23 MultiProfileBrowserStatusMonitor::~MultiProfileBrowserStatusMonitor() {
24 } 24 }
25 25
26 void MultiProfileBrowserStatusMonitor::ActiveUserChanged( 26 void MultiProfileBrowserStatusMonitor::ActiveUserChanged(
27 const std::string& user_email) { 27 const std::string& user_email) {
28 // Handle windowed apps. 28 // Handle windowed apps.
29 for (AppList::iterator it = app_list_.begin(); it != app_list_.end(); ++it) { 29 for (AppList::iterator it = app_list_.begin(); it != app_list_.end(); ++it) {
30 bool owned = multi_user_util::IsProfileFromActiveUser((*it)->profile()); 30 bool owned = multi_user_util::IsProfileFromActiveUser((*it)->profile());
31 bool shown = IsV1AppInShelf(*it); 31 bool shown = IsV1AppInShelf(*it);
32 if (owned && !shown) 32 if (owned && !shown)
33 BrowserStatusMonitor::AddV1AppToShelf(*it); 33 ConnectV1AppToLauncher(*it);
34 else if (!owned && shown) 34 else if (!owned && shown)
35 BrowserStatusMonitor::RemoveV1AppFromShelf(*it); 35 DisconnectV1AppFromLauncher(*it);
36 } 36 }
37 37
38 // Handle apps in browser tabs: Add the new applications. 38 // Handle apps in browser tabs: Add the new applications.
39 BrowserList* browser_list = 39 BrowserList* browser_list =
40 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); 40 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH);
41 41
42 // Remove old (tabbed V1) applications. 42 // Remove old (tabbed V1) applications.
43 for (BrowserList::const_iterator it = browser_list->begin(); 43 for (BrowserList::const_iterator it = browser_list->begin();
44 it != browser_list->end(); ++it) { 44 it != browser_list->end(); ++it) {
45 Browser* browser = *it; 45 Browser* browser = *it;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 void MultiProfileBrowserStatusMonitor::RemoveV1AppFromShelf(Browser* browser) { 90 void MultiProfileBrowserStatusMonitor::RemoveV1AppFromShelf(Browser* browser) {
91 DCHECK(browser->is_type_popup() && browser->is_app()); 91 DCHECK(browser->is_type_popup() && browser->is_app());
92 AppList::iterator it = std::find(app_list_.begin(), app_list_.end(), browser); 92 AppList::iterator it = std::find(app_list_.begin(), app_list_.end(), browser);
93 DCHECK(it != app_list_.end()); 93 DCHECK(it != app_list_.end());
94 app_list_.erase(it); 94 app_list_.erase(it);
95 if (multi_user_util::IsProfileFromActiveUser(browser->profile())) { 95 if (multi_user_util::IsProfileFromActiveUser(browser->profile())) {
96 BrowserStatusMonitor::RemoveV1AppFromShelf(browser); 96 BrowserStatusMonitor::RemoveV1AppFromShelf(browser);
97 } 97 }
98 } 98 }
99
100 void MultiProfileBrowserStatusMonitor::ConnectV1AppToLauncher(
101 Browser* browser) {
102 // Adding a V1 app to the launcher consists of two actions: Add the browser
103 // (launcher item) and add the content (launcher item status).
104 BrowserStatusMonitor::AddV1AppToShelf(browser);
105 launcher_controller_->UpdateAppState(
106 browser->tab_strip_model()->GetActiveWebContents(),
107 ChromeLauncherController::APP_STATE_INACTIVE);
108 }
109
110 void MultiProfileBrowserStatusMonitor::DisconnectV1AppFromLauncher(
111 Browser* browser) {
112 // Removing a V1 app from the launcher requires to remove the content and
113 // the launcher item.
114 launcher_controller_->UpdateAppState(
115 browser->tab_strip_model()->GetActiveWebContents(),
116 ChromeLauncherController::APP_STATE_REMOVED);
117 BrowserStatusMonitor::RemoveV1AppFromShelf(browser);
118 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698