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

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

Issue 9702072: Second try for (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/window_util.cc ('k') | chrome/browser/ui/views/ash/launcher/launcher_updater.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 id_to_item_map_[id].pinned = updater == NULL; 200 id_to_item_map_[id].pinned = updater == NULL;
201 201
202 if (app_type != APP_TYPE_PANEL) 202 if (app_type != APP_TYPE_PANEL)
203 app_icon_loader_->FetchImage(app_id); 203 app_icon_loader_->FetchImage(app_id);
204 return id; 204 return id;
205 } 205 }
206 206
207 void ChromeLauncherDelegate::SetItemStatus(ash::LauncherID id, 207 void ChromeLauncherDelegate::SetItemStatus(ash::LauncherID id,
208 ash::LauncherItemStatus status) { 208 ash::LauncherItemStatus status) {
209 int index = model_->ItemIndexByID(id); 209 int index = model_->ItemIndexByID(id);
210 DCHECK_GE(index, 0);
210 ash::LauncherItem item = model_->items()[index]; 211 ash::LauncherItem item = model_->items()[index];
211 item.status = status; 212 item.status = status;
212 model_->Set(index, item); 213 model_->Set(index, item);
213 } 214 }
214 215
215 void ChromeLauncherDelegate::ConvertAppToTabbed(ash::LauncherID id) { 216 void ChromeLauncherDelegate::ConvertAppToTabbed(ash::LauncherID id) {
216 DCHECK(id_to_item_map_.find(id) != id_to_item_map_.end()); 217 DCHECK(id_to_item_map_.find(id) != id_to_item_map_.end());
217 DCHECK_EQ(TYPE_APP, id_to_item_map_[id].item_type); 218 DCHECK_EQ(TYPE_APP, id_to_item_map_[id].item_type);
218 DCHECK(!id_to_item_map_[id].pinned); 219 DCHECK(!id_to_item_map_[id].pinned);
219 id_to_item_map_[id].item_type = TYPE_TABBED_BROWSER; 220 id_to_item_map_[id].item_type = TYPE_TABBED_BROWSER;
(...skipping 17 matching lines...) Expand all
237 model_->Set(model_->ItemIndexByID(id), item); 238 model_->Set(model_->ItemIndexByID(id), item);
238 239
239 app_icon_loader_->FetchImage(app_id); 240 app_icon_loader_->FetchImage(app_id);
240 } 241 }
241 242
242 void ChromeLauncherDelegate::LauncherItemClosed(ash::LauncherID id) { 243 void ChromeLauncherDelegate::LauncherItemClosed(ash::LauncherID id) {
243 DCHECK(id_to_item_map_.find(id) != id_to_item_map_.end()); 244 DCHECK(id_to_item_map_.find(id) != id_to_item_map_.end());
244 if (id_to_item_map_[id].pinned) { 245 if (id_to_item_map_[id].pinned) {
245 // The item is pinned, leave it in the launcher. 246 // The item is pinned, leave it in the launcher.
246 id_to_item_map_[id].updater = NULL; 247 id_to_item_map_[id].updater = NULL;
247 printf("ChromeLauncherDelegate::LauncherItemClosed\n");
248 SetItemStatus(id, ash::STATUS_CLOSED); 248 SetItemStatus(id, ash::STATUS_CLOSED);
249 } else { 249 } else {
250 id_to_item_map_.erase(id); 250 id_to_item_map_.erase(id);
251 model_->RemoveItemAt(model_->ItemIndexByID(id)); 251 model_->RemoveItemAt(model_->ItemIndexByID(id));
252 } 252 }
253 } 253 }
254 254
255 void ChromeLauncherDelegate::AppIDChanged(ash::LauncherID id, 255 void ChromeLauncherDelegate::AppIDChanged(ash::LauncherID id,
256 const std::string& app_id) { 256 const std::string& app_id) {
257 DCHECK(id_to_item_map_.find(id) != id_to_item_map_.end()); 257 DCHECK(id_to_item_map_.find(id) != id_to_item_map_.end());
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 Profile* ChromeLauncherDelegate::GetProfileForNewWindows() { 520 Profile* ChromeLauncherDelegate::GetProfileForNewWindows() {
521 Profile* profile = ProfileManager::GetDefaultProfile(); 521 Profile* profile = ProfileManager::GetDefaultProfile();
522 if (browser_defaults::kAlwaysOpenIncognitoWindow && 522 if (browser_defaults::kAlwaysOpenIncognitoWindow &&
523 IncognitoModePrefs::ShouldLaunchIncognito( 523 IncognitoModePrefs::ShouldLaunchIncognito(
524 *CommandLine::ForCurrentProcess(), 524 *CommandLine::ForCurrentProcess(),
525 profile->GetPrefs())) { 525 profile->GetPrefs())) {
526 profile = profile->GetOffTheRecordProfile(); 526 profile = profile->GetOffTheRecordProfile();
527 } 527 }
528 return profile; 528 return profile;
529 } 529 }
OLDNEW
« no previous file with comments | « ash/wm/window_util.cc ('k') | chrome/browser/ui/views/ash/launcher/launcher_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698