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

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

Issue 10825240: Refactor ShellWindow to separate platform-specific code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 8 years, 4 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
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/ash/launcher/chrome_launcher_controller.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/launcher/launcher_model.h" 10 #include "ash/launcher/launcher_model.h"
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 else 646 else
647 NOTREACHED() << "Unexpected pref change for " << pref_name; 647 NOTREACHED() << "Unexpected pref change for " << pref_name;
648 break; 648 break;
649 } 649 }
650 default: 650 default:
651 NOTREACHED() << "Unexpected notification type=" << type; 651 NOTREACHED() << "Unexpected notification type=" << type;
652 } 652 }
653 } 653 }
654 654
655 void ChromeLauncherController::OnShellWindowAdded(ShellWindow* shell_window) { 655 void ChromeLauncherController::OnShellWindowAdded(ShellWindow* shell_window) {
656 aura::Window* window = shell_window->GetNativeWindow(); 656 aura::Window* window = shell_window->GetBaseWindow()->GetNativeWindow();
657 ash::LauncherItemStatus status = ash::wm::IsActiveWindow(window) ? 657 ash::LauncherItemStatus status = ash::wm::IsActiveWindow(window) ?
658 ash::STATUS_ACTIVE : ash::STATUS_RUNNING; 658 ash::STATUS_ACTIVE : ash::STATUS_RUNNING;
659 window->AddObserver(this); 659 window->AddObserver(this);
660 const std::string app_id = shell_window->extension()->id(); 660 const std::string app_id = shell_window->extension()->id();
661 ash::LauncherID id = 0; 661 ash::LauncherID id = 0;
662 for (IDToItemMap::const_iterator i = id_to_item_map_.begin(); 662 for (IDToItemMap::const_iterator i = id_to_item_map_.begin();
663 i != id_to_item_map_.end(); ++i) { 663 i != id_to_item_map_.end(); ++i) {
664 if (i->second.app_id == app_id) { 664 if (i->second.app_id == app_id) {
665 id = i->first; 665 id = i->first;
666 SetItemStatus(id, status); 666 SetItemStatus(id, status);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 706
707 DCHECK(id_to_item_map_.find(id) != id_to_item_map_.end()); 707 DCHECK(id_to_item_map_.find(id) != id_to_item_map_.end());
708 platform_app_windows_.remove(window); 708 platform_app_windows_.remove(window);
709 extensions::ShellWindowRegistry::ShellWindowSet remaining_windows = 709 extensions::ShellWindowRegistry::ShellWindowSet remaining_windows =
710 extensions::ShellWindowRegistry::Get(profile_)->GetShellWindowsForApp( 710 extensions::ShellWindowRegistry::Get(profile_)->GetShellWindowsForApp(
711 id_to_item_map_[id].app_id); 711 id_to_item_map_[id].app_id);
712 712
713 // We can't count on getting called before or after the ShellWindowRegistry. 713 // We can't count on getting called before or after the ShellWindowRegistry.
714 if (remaining_windows.size() > 1 || 714 if (remaining_windows.size() > 1 ||
715 (remaining_windows.size() == 1 && 715 (remaining_windows.size() == 1 &&
716 (*remaining_windows.begin())->GetNativeWindow() != window)) { 716 (*remaining_windows.begin())->GetBaseWindow()->GetNativeWindow() !=
717 window)) {
717 return; 718 return;
718 } 719 }
719 720
720 // Close or remove item. 721 // Close or remove item.
721 int index = model_->ItemIndexByID(id); 722 int index = model_->ItemIndexByID(id);
722 DCHECK_GE(index, 0); 723 DCHECK_GE(index, 0);
723 ash::LauncherItem item = model_->items()[index]; 724 ash::LauncherItem item = model_->items()[index];
724 if (item.type == ash::TYPE_APP_SHORTCUT) 725 if (item.type == ash::TYPE_APP_SHORTCUT)
725 SetItemStatus(id, ash::STATUS_CLOSED); 726 SetItemStatus(id, ash::STATUS_CLOSED);
726 else 727 else
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 } 990 }
990 model_->AddAt(index, item); 991 model_->AddAt(index, item);
991 992
992 if (!controller || controller->type() != 993 if (!controller || controller->type() !=
993 BrowserLauncherItemController::TYPE_EXTENSION_PANEL) { 994 BrowserLauncherItemController::TYPE_EXTENSION_PANEL) {
994 if (item.status != ash::STATUS_IS_PENDING) 995 if (item.status != ash::STATUS_IS_PENDING)
995 app_icon_loader_->FetchImage(app_id); 996 app_icon_loader_->FetchImage(app_id);
996 } 997 }
997 return id; 998 return id;
998 } 999 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/shell_window_registry.cc ('k') | chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698