Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/ash/launcher/chrome_launcher_delegate.h" | 5 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_delegate.h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher_model.h" | 7 #include "ash/launcher/launcher_model.h" |
| 8 #include "ash/launcher/launcher_types.h" | 8 #include "ash/launcher/launcher_types.h" |
| 9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 id_to_item_map_[id].pinned = updater == NULL; | 195 id_to_item_map_[id].pinned = updater == NULL; |
| 196 | 196 |
| 197 if (app_type != APP_TYPE_PANEL) | 197 if (app_type != APP_TYPE_PANEL) |
| 198 app_icon_loader_->FetchImage(app_id); | 198 app_icon_loader_->FetchImage(app_id); |
| 199 return id; | 199 return id; |
| 200 } | 200 } |
| 201 | 201 |
| 202 void ChromeLauncherDelegate::SetItemStatus(ash::LauncherID id, | 202 void ChromeLauncherDelegate::SetItemStatus(ash::LauncherID id, |
| 203 ash::LauncherItemStatus status) { | 203 ash::LauncherItemStatus status) { |
| 204 int index = model_->ItemIndexByID(id); | 204 int index = model_->ItemIndexByID(id); |
| 205 DCHECK(index >= 0); | |
|
sky
2012/03/14 04:05:44
DCHECK_GE
DaveMoore
2012/03/14 19:54:58
Done.
| |
| 205 ash::LauncherItem item = model_->items()[index]; | 206 ash::LauncherItem item = model_->items()[index]; |
| 206 item.status = status; | 207 item.status = status; |
| 207 model_->Set(index, item); | 208 model_->Set(index, item); |
| 208 } | 209 } |
| 209 | 210 |
| 210 void ChromeLauncherDelegate::ConvertAppToTabbed(ash::LauncherID id) { | 211 void ChromeLauncherDelegate::ConvertAppToTabbed(ash::LauncherID id) { |
| 211 DCHECK(id_to_item_map_.find(id) != id_to_item_map_.end()); | 212 DCHECK(id_to_item_map_.find(id) != id_to_item_map_.end()); |
| 212 DCHECK_EQ(TYPE_APP, id_to_item_map_[id].item_type); | 213 DCHECK_EQ(TYPE_APP, id_to_item_map_[id].item_type); |
| 213 DCHECK(!id_to_item_map_[id].pinned); | 214 DCHECK(!id_to_item_map_[id].pinned); |
| 214 id_to_item_map_[id].item_type = TYPE_TABBED_BROWSER; | 215 id_to_item_map_[id].item_type = TYPE_TABBED_BROWSER; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 230 model_->Set(model_->ItemIndexByID(id), item); | 231 model_->Set(model_->ItemIndexByID(id), item); |
| 231 | 232 |
| 232 app_icon_loader_->FetchImage(app_id); | 233 app_icon_loader_->FetchImage(app_id); |
| 233 } | 234 } |
| 234 | 235 |
| 235 void ChromeLauncherDelegate::LauncherItemClosed(ash::LauncherID id) { | 236 void ChromeLauncherDelegate::LauncherItemClosed(ash::LauncherID id) { |
| 236 DCHECK(id_to_item_map_.find(id) != id_to_item_map_.end()); | 237 DCHECK(id_to_item_map_.find(id) != id_to_item_map_.end()); |
| 237 if (id_to_item_map_[id].pinned) { | 238 if (id_to_item_map_[id].pinned) { |
| 238 // The item is pinned, leave it in the launcher. | 239 // The item is pinned, leave it in the launcher. |
| 239 id_to_item_map_[id].updater = NULL; | 240 id_to_item_map_[id].updater = NULL; |
| 240 printf("ChromeLauncherDelegate::LauncherItemClosed\n"); | |
| 241 SetItemStatus(id, ash::STATUS_CLOSED); | 241 SetItemStatus(id, ash::STATUS_CLOSED); |
| 242 } else { | 242 } else { |
| 243 id_to_item_map_.erase(id); | 243 id_to_item_map_.erase(id); |
| 244 model_->RemoveItemAt(model_->ItemIndexByID(id)); | 244 model_->RemoveItemAt(model_->ItemIndexByID(id)); |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 | 247 |
| 248 void ChromeLauncherDelegate::AppIDChanged(ash::LauncherID id, | 248 void ChromeLauncherDelegate::AppIDChanged(ash::LauncherID id, |
| 249 const std::string& app_id) { | 249 const std::string& app_id) { |
| 250 DCHECK(id_to_item_map_.find(id) != id_to_item_map_.end()); | 250 DCHECK(id_to_item_map_.find(id) != id_to_item_map_.end()); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 503 Profile* ChromeLauncherDelegate::GetProfileForNewWindows() { | 503 Profile* ChromeLauncherDelegate::GetProfileForNewWindows() { |
| 504 Profile* profile = ProfileManager::GetDefaultProfile(); | 504 Profile* profile = ProfileManager::GetDefaultProfile(); |
| 505 if (browser_defaults::kAlwaysOpenIncognitoWindow && | 505 if (browser_defaults::kAlwaysOpenIncognitoWindow && |
| 506 IncognitoModePrefs::ShouldLaunchIncognito( | 506 IncognitoModePrefs::ShouldLaunchIncognito( |
| 507 *CommandLine::ForCurrentProcess(), | 507 *CommandLine::ForCurrentProcess(), |
| 508 profile->GetPrefs())) { | 508 profile->GetPrefs())) { |
| 509 profile = profile->GetOffTheRecordProfile(); | 509 profile = profile->GetOffTheRecordProfile(); |
| 510 } | 510 } |
| 511 return profile; | 511 return profile; |
| 512 } | 512 } |
| OLD | NEW |