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

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

Issue 2332393003: mash: Remove shelf util functions; use WmWindow properties. (Closed)
Patch Set: Address comments. Created 4 years, 3 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 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 "ash/aura/wm_window_aura.h"
8 #include "ash/common/shelf/shelf_item_types.h"
9 #include "ash/common/wm_window_property.h"
7 #include "ash/resources/grit/ash_resources.h" 10 #include "ash/resources/grit/ash_resources.h"
8 #include "ash/shelf/shelf_util.h"
9 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 13 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
12 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 14 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
13 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_list.h" 16 #include "chrome/browser/ui/browser_list.h"
15 #include "chrome/browser/ui/browser_tabstrip.h" 17 #include "chrome/browser/ui/browser_tabstrip.h"
16 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
17 #include "chrome/browser/ui/settings_window_manager.h" 19 #include "chrome/browser/ui/settings_window_manager.h"
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" 20 #include "chrome/browser/ui/tabs/tab_strip_model.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 81
80 // Remove settings window icons not associated with this profile and create 82 // Remove settings window icons not associated with this profile and create
81 // icons for windows associated with the current profile. 83 // icons for windows associated with the current profile.
82 for (BrowserList::const_iterator it = browser_list->begin(); 84 for (BrowserList::const_iterator it = browser_list->begin();
83 it != browser_list->end(); ++it) { 85 it != browser_list->end(); ++it) {
84 Browser* browser = *it; 86 Browser* browser = *it;
85 if (!chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser( 87 if (!chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser(
86 browser)) { 88 browser)) {
87 continue; 89 continue;
88 } 90 }
91 aura::Window* aura_window = browser->window()->GetNativeWindow();
89 if (multi_user_util::IsProfileFromActiveUser(browser->profile())) { 92 if (multi_user_util::IsProfileFromActiveUser(browser->profile())) {
90 ash::SetShelfItemDetailsForDialogWindow( 93 ash::ShelfItemDetails item_details;
91 browser->window()->GetNativeWindow(), 94 item_details.type = ash::TYPE_DIALOG;
92 IDR_ASH_SHELF_ICON_SETTINGS, 95 item_details.image_resource_id = IDR_ASH_SHELF_ICON_SETTINGS;
93 l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE)); 96 item_details.title = l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE);
97 ash::WmWindowAura::Get(aura_window)->SetShelfItemDetails(item_details);
94 } else { 98 } else {
95 ash::ClearShelfItemDetailsForWindow(browser->window()->GetNativeWindow()); 99 ash::WmWindowAura::Get(aura_window)->ClearShelfItemDetails();
96 } 100 }
97 } 101 }
98 102
99 // Update the browser state since some of the removals / adds above might have 103 // Update the browser state since some of the removals / adds above might have
100 // had an impact on the browser item. 104 // had an impact on the browser item.
101 UpdateBrowserItemState(); 105 UpdateBrowserItemState();
102 } 106 }
103 107
104 void MultiProfileBrowserStatusMonitor::AddV1AppToShelf(Browser* browser) { 108 void MultiProfileBrowserStatusMonitor::AddV1AppToShelf(Browser* browser) {
105 DCHECK(browser->is_type_popup() && browser->is_app()); 109 DCHECK(browser->is_type_popup() && browser->is_app());
(...skipping 27 matching lines...) Expand all
133 137
134 void MultiProfileBrowserStatusMonitor::DisconnectV1AppFromLauncher( 138 void MultiProfileBrowserStatusMonitor::DisconnectV1AppFromLauncher(
135 Browser* browser) { 139 Browser* browser) {
136 // Removing a V1 app from the launcher requires to remove the content and 140 // Removing a V1 app from the launcher requires to remove the content and
137 // the launcher item. 141 // the launcher item.
138 launcher_controller_->UpdateAppState( 142 launcher_controller_->UpdateAppState(
139 browser->tab_strip_model()->GetActiveWebContents(), 143 browser->tab_strip_model()->GetActiveWebContents(),
140 ChromeLauncherController::APP_STATE_REMOVED); 144 ChromeLauncherController::APP_STATE_REMOVED);
141 BrowserStatusMonitor::RemoveV1AppFromShelf(browser); 145 BrowserStatusMonitor::RemoveV1AppFromShelf(browser);
142 } 146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698