| 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/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 ++i; | 327 ++i; |
| 328 if (current->second.app_id == app_id && IsPinned(current->first)) | 328 if (current->second.app_id == app_id && IsPinned(current->first)) |
| 329 Unpin(current->first); | 329 Unpin(current->first); |
| 330 } | 330 } |
| 331 } | 331 } |
| 332 | 332 |
| 333 void ChromeLauncherDelegate::CreateNewTab() { | 333 void ChromeLauncherDelegate::CreateNewTab() { |
| 334 Browser *last_browser = BrowserList::FindTabbedBrowser( | 334 Browser *last_browser = BrowserList::FindTabbedBrowser( |
| 335 GetProfileForNewWindows(), true); | 335 GetProfileForNewWindows(), true); |
| 336 | 336 |
| 337 if (last_browser) { | 337 if (!last_browser) { |
| 338 last_browser->NewTab(); | 338 CreateNewWindow(); |
| 339 aura::Window* window = last_browser->window()->GetNativeHandle(); | 339 return; |
| 340 window->Show(); | |
| 341 ash::wm::ActivateWindow(window); | |
| 342 } else { | |
| 343 Browser::NewEmptyWindow(GetProfileForNewWindows()); | |
| 344 } | 340 } |
| 341 |
| 342 last_browser->NewTab(); |
| 343 aura::Window* window = last_browser->window()->GetNativeHandle(); |
| 344 window->Show(); |
| 345 ash::wm::ActivateWindow(window); |
| 346 } |
| 347 |
| 348 void ChromeLauncherDelegate::CreateNewWindow() { |
| 349 printf("ChromeLauncherDelegate::CreateNewWindow\n"); |
| 350 Browser::NewEmptyWindow(GetProfileForNewWindows()); |
| 345 } | 351 } |
| 346 | 352 |
| 347 void ChromeLauncherDelegate::ItemClicked(const ash::LauncherItem& item) { | 353 void ChromeLauncherDelegate::ItemClicked(const ash::LauncherItem& item) { |
| 348 DCHECK(id_to_item_map_.find(item.id) != id_to_item_map_.end()); | 354 DCHECK(id_to_item_map_.find(item.id) != id_to_item_map_.end()); |
| 349 Open(item.id); | 355 Open(item.id); |
| 350 } | 356 } |
| 351 | 357 |
| 352 int ChromeLauncherDelegate::GetBrowserShortcutResourceId() { | 358 int ChromeLauncherDelegate::GetBrowserShortcutResourceId() { |
| 353 return IDR_PRODUCT_LOGO_32; | 359 return IDR_PRODUCT_LOGO_32; |
| 354 } | 360 } |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 } | 463 } |
| 458 } | 464 } |
| 459 | 465 |
| 460 void ChromeLauncherDelegate::SetAppIconLoaderForTest(AppIconLoader* loader) { | 466 void ChromeLauncherDelegate::SetAppIconLoaderForTest(AppIconLoader* loader) { |
| 461 app_icon_loader_.reset(loader); | 467 app_icon_loader_.reset(loader); |
| 462 } | 468 } |
| 463 | 469 |
| 464 Profile* ChromeLauncherDelegate::GetProfileForNewWindows() { | 470 Profile* ChromeLauncherDelegate::GetProfileForNewWindows() { |
| 465 return ProfileManager::GetDefaultProfileOrOffTheRecord(); | 471 return ProfileManager::GetDefaultProfileOrOffTheRecord(); |
| 466 } | 472 } |
| OLD | NEW |