Chromium Code Reviews| Index: chrome/browser/ui/views/ash/launcher/launcher_updater.cc |
| diff --git a/chrome/browser/ui/views/ash/launcher/launcher_updater.cc b/chrome/browser/ui/views/ash/launcher/launcher_updater.cc |
| index 5b1fe229a781af3f542e8e29d4c40209c49f9ef2..705a8c2bd0baef62ebddbb3137903aedc2ae8cd9 100644 |
| --- a/chrome/browser/ui/views/ash/launcher/launcher_updater.cc |
| +++ b/chrome/browser/ui/views/ash/launcher/launcher_updater.cc |
| @@ -59,16 +59,20 @@ void LauncherUpdater::Init() { |
| item_id_ = launcher_delegate_->CreateAppLauncherItem( |
| this, app_id_, app_type); |
| } else { |
| + bool is_private = false; |
| // Determine if we have any tabs that should get launcher items. |
| std::vector<TabContentsWrapper*> app_tabs; |
| for (int i = 0; i < tab_model_->count(); ++i) { |
| TabContentsWrapper* tab = tab_model_->GetTabContentsAt(i); |
| if (!launcher_delegate_->GetAppID(tab).empty()) |
| app_tabs.push_back(tab); |
| + else if (tab->profile()->GetOriginalProfile() != tab->profile()) |
| + is_private = true; |
| } |
| - if (static_cast<int>(app_tabs.size()) != tab_model_->count()) |
| - CreateTabbedItem(); |
| + if (static_cast<int>(app_tabs.size()) != tab_model_->count()) { |
| + CreateTabbedItem(is_private); |
| + } |
|
oshima
2012/03/09 17:54:02
remove {}
Zachary Kuznia
2012/03/09 22:17:35
Done.
|
| // Create items for the app tabs. |
| for (size_t i = 0; i < app_tabs.size(); ++i) |
| @@ -227,6 +231,7 @@ void LauncherUpdater::UpdateLauncher(TabContentsWrapper* tab) { |
| void LauncherUpdater::UpdateAppTabState(TabContentsWrapper* tab, |
| UpdateType update_type) { |
| + bool private_tab = (tab->profile()->GetOriginalProfile() != tab->profile()); |
| bool showing_app_item = app_map_.find(tab) != app_map_.end(); |
| std::string app_id = update_type == UPDATE_TAB_REMOVED ? |
| std::string() : launcher_delegate_->GetAppID(tab); |
| @@ -235,7 +240,7 @@ void LauncherUpdater::UpdateAppTabState(TabContentsWrapper* tab, |
| if (!show_app) { |
| if (item_id_ == -1 && update_type == UPDATE_TAB_INSERTED) { |
| // A new non-app tab was added and we have no app tabs. Add one now. |
| - CreateTabbedItem(); |
| + CreateTabbedItem(private_tab); |
| } else if (item_id_ != -1 && update_type == UPDATE_TAB_REMOVED && |
| tab_model_->count() == (static_cast<int>(app_map_.size()))) { |
| launcher_delegate_->LauncherItemClosed(item_id_); |
| @@ -270,9 +275,9 @@ void LauncherUpdater::UpdateAppTabState(TabContentsWrapper* tab, |
| // If the app is pinned we have to leave it and create a new tabbed |
| // item. |
| launcher_delegate_->LauncherItemClosed(launcher_id); |
| - CreateTabbedItem(); |
| + CreateTabbedItem(private_tab); |
| } |
| - ash::LauncherItem item(ash::TYPE_TABBED); |
| + ash::LauncherItem item(ash::TYPE_TABBED, private_tab); |
| item.num_tabs = tab_model_->count(); |
| launcher_model()->Set(launcher_model()->ItemIndexByID(item_id_), item); |
| } else { |
| @@ -321,9 +326,9 @@ void LauncherUpdater::RegisterAppItem(ash::LauncherID id, |
| app_map_[tab] = details; |
| } |
| -void LauncherUpdater::CreateTabbedItem() { |
| +void LauncherUpdater::CreateTabbedItem(bool is_private) { |
| DCHECK_EQ(-1, item_id_); |
| - item_id_ = launcher_delegate_->CreateTabbedLauncherItem(this); |
| + item_id_ = launcher_delegate_->CreateTabbedLauncherItem(this, is_private); |
| } |
| bool LauncherUpdater::ContainsID(ash::LauncherID id, TabContentsWrapper** tab) { |