| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 last_browser->NewTab(); | 426 last_browser->NewTab(); |
| 427 aura::Window* window = last_browser->window()->GetNativeHandle(); | 427 aura::Window* window = last_browser->window()->GetNativeHandle(); |
| 428 window->Show(); | 428 window->Show(); |
| 429 ash::wm::ActivateWindow(window); | 429 ash::wm::ActivateWindow(window); |
| 430 } | 430 } |
| 431 | 431 |
| 432 void ChromeLauncherDelegate::CreateNewWindow() { | 432 void ChromeLauncherDelegate::CreateNewWindow() { |
| 433 Browser::NewEmptyWindow(GetProfileForNewWindows()); | 433 Browser::NewEmptyWindow(GetProfileForNewWindows()); |
| 434 } | 434 } |
| 435 | 435 |
| 436 void ChromeLauncherDelegate::CreateNewIncognitoWindow() { |
| 437 Browser::NewEmptyWindow(GetProfileForNewWindows()->GetOffTheRecordProfile()); |
| 438 } |
| 439 |
| 436 void ChromeLauncherDelegate::ItemClicked(const ash::LauncherItem& item) { | 440 void ChromeLauncherDelegate::ItemClicked(const ash::LauncherItem& item) { |
| 437 DCHECK(id_to_item_map_.find(item.id) != id_to_item_map_.end()); | 441 DCHECK(id_to_item_map_.find(item.id) != id_to_item_map_.end()); |
| 438 LauncherUpdater* updater = id_to_item_map_[item.id].updater; | 442 LauncherUpdater* updater = id_to_item_map_[item.id].updater; |
| 439 if (updater) { | 443 if (updater) { |
| 440 views::Widget* widget = | 444 views::Widget* widget = |
| 441 views::Widget::GetWidgetForNativeView(updater->window()); | 445 views::Widget::GetWidgetForNativeView(updater->window()); |
| 442 if (widget && widget->IsActive()) { | 446 if (widget && widget->IsActive()) { |
| 443 widget->Minimize(); | 447 widget->Minimize(); |
| 444 return; | 448 return; |
| 445 } | 449 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 ash::LauncherID ChromeLauncherDelegate::GetIDByWindow( | 484 ash::LauncherID ChromeLauncherDelegate::GetIDByWindow( |
| 481 aura::Window* window) { | 485 aura::Window* window) { |
| 482 for (IDToItemMap::const_iterator i = id_to_item_map_.begin(); | 486 for (IDToItemMap::const_iterator i = id_to_item_map_.begin(); |
| 483 i != id_to_item_map_.end(); ++i) { | 487 i != id_to_item_map_.end(); ++i) { |
| 484 if (i->second.updater && i->second.updater->window() == window) | 488 if (i->second.updater && i->second.updater->window() == window) |
| 485 return i->first; | 489 return i->first; |
| 486 } | 490 } |
| 487 return 0; | 491 return 0; |
| 488 } | 492 } |
| 489 | 493 |
| 494 bool ChromeLauncherDelegate::IsLoggedInAsGuest() { |
| 495 return ProfileManager::GetDefaultProfileOrOffTheRecord()->IsOffTheRecord(); |
| 496 } |
| 497 |
| 490 void ChromeLauncherDelegate::LauncherItemAdded(int index) { | 498 void ChromeLauncherDelegate::LauncherItemAdded(int index) { |
| 491 } | 499 } |
| 492 | 500 |
| 493 void ChromeLauncherDelegate::LauncherItemRemoved(int index, | 501 void ChromeLauncherDelegate::LauncherItemRemoved(int index, |
| 494 ash::LauncherID id) { | 502 ash::LauncherID id) { |
| 495 } | 503 } |
| 496 | 504 |
| 497 void ChromeLauncherDelegate::LauncherItemMoved( | 505 void ChromeLauncherDelegate::LauncherItemMoved( |
| 498 int start_index, | 506 int start_index, |
| 499 int target_index) { | 507 int target_index) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 while (!pending_pinned_apps_.empty()) { | 582 while (!pending_pinned_apps_.empty()) { |
| 575 const Item& item = pending_pinned_apps_.front(); | 583 const Item& item = pending_pinned_apps_.front(); |
| 576 | 584 |
| 577 if (!app_icon_loader_->IsValidID(item.app_id)) | 585 if (!app_icon_loader_->IsValidID(item.app_id)) |
| 578 return; | 586 return; |
| 579 | 587 |
| 580 PinAppWithID(item.app_id); | 588 PinAppWithID(item.app_id); |
| 581 pending_pinned_apps_.pop(); | 589 pending_pinned_apps_.pop(); |
| 582 } | 590 } |
| 583 } | 591 } |
| OLD | NEW |