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

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

Issue 10829268: chromeos: Sync animation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit_tests crash + rebase 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"
11 #include "ash/launcher/launcher_types.h" 11 #include "ash/launcher/launcher_types.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "ash/wm/window_util.h" 13 #include "ash/wm/window_util.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/browser/defaults.h" 17 #include "chrome/browser/defaults.h"
18 #include "chrome/browser/extensions/extension_service.h" 18 #include "chrome/browser/extensions/extension_service.h"
19 #include "chrome/browser/extensions/pending_extension_manager.h"
19 #include "chrome/browser/prefs/incognito_mode_prefs.h" 20 #include "chrome/browser/prefs/incognito_mode_prefs.h"
20 #include "chrome/browser/prefs/pref_service.h" 21 #include "chrome/browser/prefs/pref_service.h"
21 #include "chrome/browser/prefs/scoped_user_pref_update.h" 22 #include "chrome/browser/prefs/scoped_user_pref_update.h"
22 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/profiles/profile_manager.h" 24 #include "chrome/browser/profiles/profile_manager.h"
25 #include "chrome/browser/sync/profile_sync_service.h"
26 #include "chrome/browser/sync/profile_sync_service_factory.h"
24 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" 27 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h"
25 #include "chrome/browser/ui/ash/extension_utils.h" 28 #include "chrome/browser/ui/ash/extension_utils.h"
26 #include "chrome/browser/ui/ash/launcher/browser_launcher_item_controller.h" 29 #include "chrome/browser/ui/ash/launcher/browser_launcher_item_controller.h"
27 #include "chrome/browser/ui/ash/launcher/launcher_app_icon_loader.h" 30 #include "chrome/browser/ui/ash/launcher/launcher_app_icon_loader.h"
28 #include "chrome/browser/ui/ash/launcher/launcher_app_tab_helper.h" 31 #include "chrome/browser/ui/ash/launcher/launcher_app_tab_helper.h"
29 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" 32 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h"
30 #include "chrome/browser/ui/browser.h" 33 #include "chrome/browser/ui/browser.h"
31 #include "chrome/browser/ui/browser_commands.h" 34 #include "chrome/browser/ui/browser_commands.h"
32 #include "chrome/browser/ui/browser_finder.h" 35 #include "chrome/browser/ui/browser_finder.h"
33 #include "chrome/browser/ui/browser_window.h" 36 #include "chrome/browser/ui/browser_window.h"
34 #include "chrome/browser/ui/extensions/shell_window.h" 37 #include "chrome/browser/ui/extensions/shell_window.h"
35 #include "chrome/browser/ui/tab_contents/tab_contents.h" 38 #include "chrome/browser/ui/tab_contents/tab_contents.h"
36 #include "chrome/browser/ui/tabs/tab_strip_model.h" 39 #include "chrome/browser/ui/tabs/tab_strip_model.h"
37 #include "chrome/browser/web_applications/web_app.h" 40 #include "chrome/browser/web_applications/web_app.h"
38 #include "chrome/common/chrome_notification_types.h" 41 #include "chrome/common/chrome_notification_types.h"
39 #include "chrome/common/chrome_switches.h" 42 #include "chrome/common/chrome_switches.h"
40 #include "chrome/common/extensions/extension.h" 43 #include "chrome/common/extensions/extension.h"
41 #include "chrome/common/extensions/extension_resource.h" 44 #include "chrome/common/extensions/extension_resource.h"
42 #include "chrome/common/pref_names.h" 45 #include "chrome/common/pref_names.h"
43 #include "content/public/browser/notification_service.h" 46 #include "content/public/browser/notification_service.h"
44 #include "content/public/browser/web_contents.h" 47 #include "content/public/browser/web_contents.h"
45 #include "grit/theme_resources.h" 48 #include "grit/theme_resources.h"
46 #include "ui/aura/client/activation_client.h" 49 #include "ui/aura/client/activation_client.h"
47 #include "ui/aura/window.h" 50 #include "ui/aura/window.h"
48 #include "ui/views/widget/widget.h" 51 #include "ui/views/widget/widget.h"
49 52
50 using extensions::Extension; 53 using extensions::Extension;
51 54
55 namespace {
56
57 // Max loading animation time in milliseconds.
58 const int kMaxLoadingTimeMs = 60 * 1000;
59
60 } // namespace
61
52 // ChromeLauncherController::Item ---------------------------------------------- 62 // ChromeLauncherController::Item ----------------------------------------------
53 63
54 ChromeLauncherController::Item::Item() 64 ChromeLauncherController::Item::Item()
55 : item_type(TYPE_TABBED_BROWSER), 65 : item_type(TYPE_TABBED_BROWSER),
56 controller(NULL) { 66 controller(NULL) {
57 } 67 }
58 68
59 ChromeLauncherController::Item::~Item() { 69 ChromeLauncherController::Item::~Item() {
60 } 70 }
61 71
62 // ChromeLauncherController ---------------------------------------------------- 72 // ChromeLauncherController ----------------------------------------------------
63 73
64 // static 74 // static
65 ChromeLauncherController* ChromeLauncherController::instance_ = NULL; 75 ChromeLauncherController* ChromeLauncherController::instance_ = NULL;
66 76
67 ChromeLauncherController::ChromeLauncherController(Profile* profile, 77 ChromeLauncherController::ChromeLauncherController(Profile* profile,
68 ash::LauncherModel* model) 78 ash::LauncherModel* model)
69 : model_(model), 79 : model_(model),
70 profile_(profile), 80 profile_(profile),
71 activation_client_(NULL) { 81 activation_client_(NULL),
82 observed_sync_service_(NULL) {
72 if (!profile_) { 83 if (!profile_) {
73 // Use the original profile as on chromeos we may get a temporary off the 84 // Use the original profile as on chromeos we may get a temporary off the
74 // record profile. 85 // record profile.
75 profile_ = ProfileManager::GetDefaultProfile()->GetOriginalProfile(); 86 profile_ = ProfileManager::GetDefaultProfile()->GetOriginalProfile();
87
88 // Monitor app sync on chromeos.
89 if (!IsLoggedInAsGuest()) {
90 observed_sync_service_ =
91 ProfileSyncServiceFactory::GetForProfile(profile_);
92 if (observed_sync_service_) {
93 observed_sync_service_->AddObserver(this);
94 StartLoadingAnimation();
95 }
96 }
76 } 97 }
98
77 instance_ = this; 99 instance_ = this;
78 model_->AddObserver(this); 100 model_->AddObserver(this);
79 extensions::ShellWindowRegistry::Get(profile_)->AddObserver(this); 101 extensions::ShellWindowRegistry::Get(profile_)->AddObserver(this);
80 app_tab_helper_.reset(new LauncherAppTabHelper(profile_)); 102 app_tab_helper_.reset(new LauncherAppTabHelper(profile_));
81 app_icon_loader_.reset(new LauncherAppIconLoader(profile_, this)); 103 app_icon_loader_.reset(new LauncherAppIconLoader(profile_, this));
82 104
83 notification_registrar_.Add(this, 105 notification_registrar_.Add(this,
84 chrome::NOTIFICATION_EXTENSION_LOADED, 106 chrome::NOTIFICATION_EXTENSION_LOADED,
85 content::Source<Profile>(profile_)); 107 content::Source<Profile>(profile_));
86 notification_registrar_.Add(this, 108 notification_registrar_.Add(this,
(...skipping 17 matching lines...) Expand all
104 if (activation_client_) 126 if (activation_client_)
105 activation_client_->RemoveObserver(this); 127 activation_client_->RemoveObserver(this);
106 128
107 for (WindowToIDMap::iterator i = window_to_id_map_.begin(); 129 for (WindowToIDMap::iterator i = window_to_id_map_.begin();
108 i != window_to_id_map_.end(); ++i) { 130 i != window_to_id_map_.end(); ++i) {
109 i->first->RemoveObserver(this); 131 i->first->RemoveObserver(this);
110 } 132 }
111 133
112 if (ash::Shell::HasInstance()) 134 if (ash::Shell::HasInstance())
113 ash::Shell::GetInstance()->RemoveShellObserver(this); 135 ash::Shell::GetInstance()->RemoveShellObserver(this);
136
137 if (observed_sync_service_)
138 observed_sync_service_->RemoveObserver(this);
114 } 139 }
115 140
116 void ChromeLauncherController::Init() { 141 void ChromeLauncherController::Init() {
117 // TODO(xiyuan): Remove migration code and kUseDefaultPinnedApp after M20. 142 // TODO(xiyuan): Remove migration code and kUseDefaultPinnedApp after M20.
118 // Migration cases: 143 // Migration cases:
119 // - Users that unpin all apps: 144 // - Users that unpin all apps:
120 // - have default pinned apps 145 // - have default pinned apps
121 // - kUseDefaultPinnedApps set to false 146 // - kUseDefaultPinnedApps set to false
122 // Migrate them by setting an empty list for kPinnedLauncherApps. 147 // Migrate them by setting an empty list for kPinnedLauncherApps.
123 // 148 //
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 void ChromeLauncherController::Open(ash::LauncherID id, int event_flags) { 281 void ChromeLauncherController::Open(ash::LauncherID id, int event_flags) {
257 if (id_to_item_map_.find(id) == id_to_item_map_.end()) 282 if (id_to_item_map_.find(id) == id_to_item_map_.end())
258 return; // In case invoked from menu and item closed while menu up. 283 return; // In case invoked from menu and item closed while menu up.
259 284
260 BrowserLauncherItemController* controller = id_to_item_map_[id].controller; 285 BrowserLauncherItemController* controller = id_to_item_map_[id].controller;
261 if (controller) { 286 if (controller) {
262 controller->window()->Show(); 287 controller->window()->Show();
263 ash::wm::ActivateWindow(controller->window()); 288 ash::wm::ActivateWindow(controller->window());
264 } else { 289 } else {
265 DCHECK_EQ(TYPE_APP, id_to_item_map_[id].item_type); 290 DCHECK_EQ(TYPE_APP, id_to_item_map_[id].item_type);
266
267 // Do nothing for pending app shortcut.
268 if (GetItemStatus(id) == ash::STATUS_IS_PENDING)
269 return;
270
271 OpenAppID(id_to_item_map_[id].app_id, event_flags); 291 OpenAppID(id_to_item_map_[id].app_id, event_flags);
272 } 292 }
273 } 293 }
274 294
275 void ChromeLauncherController::OpenAppID( 295 void ChromeLauncherController::OpenAppID(
276 const std::string& app_id, 296 const std::string& app_id,
277 int event_flags) { 297 int event_flags) {
278 ash::LauncherID launcher_id = GetLauncherIDForAppID(app_id); 298 ash::LauncherID launcher_id = GetLauncherIDForAppID(app_id);
279 // Check if this item has any windows in the activation list. 299 // Check if this item has any windows in the activation list.
280 for (WindowList::const_iterator i = platform_app_windows_.begin(); 300 for (WindowList::const_iterator i = platform_app_windows_.begin();
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 aura::Window* window_to_activate = 626 aura::Window* window_to_activate =
607 id_to_item_map_[id].controller->window(); 627 id_to_item_map_[id].controller->window();
608 if (window_to_activate && ash::wm::IsActiveWindow(window_to_activate)) 628 if (window_to_activate && ash::wm::IsActiveWindow(window_to_activate))
609 return; 629 return;
610 window_to_activate->Show(); 630 window_to_activate->Show();
611 ash::wm::ActivateWindow(window_to_activate); 631 ash::wm::ActivateWindow(window_to_activate);
612 } 632 }
613 } 633 }
614 } 634 }
615 635
636 void ChromeLauncherController::LauncherStatusChanged() {
637 }
638
616 void ChromeLauncherController::Observe( 639 void ChromeLauncherController::Observe(
617 int type, 640 int type,
618 const content::NotificationSource& source, 641 const content::NotificationSource& source,
619 const content::NotificationDetails& details) { 642 const content::NotificationDetails& details) {
620 switch (type) { 643 switch (type) {
621 case chrome::NOTIFICATION_EXTENSION_LOADED: { 644 case chrome::NOTIFICATION_EXTENSION_LOADED: {
622 UpdateAppLaunchersFromPref(); 645 UpdateAppLaunchersFromPref();
646 CheckAppSync();
623 break; 647 break;
624 } 648 }
625 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { 649 case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
626 const content::Details<extensions::UnloadedExtensionInfo> unload_info( 650 const content::Details<extensions::UnloadedExtensionInfo> unload_info(
627 details); 651 details);
628 const Extension* extension = unload_info->extension; 652 const Extension* extension = unload_info->extension;
629 if (IsAppPinned(extension->id())) { 653 if (IsAppPinned(extension->id()))
630 if (unload_info->reason == extension_misc::UNLOAD_REASON_UPDATE) 654 DoUnpinAppsWithID(extension->id());
631 MarkAppPending(extension->id());
632 else
633 DoUnpinAppsWithID(extension->id());
634 }
635 break; 655 break;
636 } 656 }
637 case chrome::NOTIFICATION_PREF_CHANGED: { 657 case chrome::NOTIFICATION_PREF_CHANGED: {
638 const std::string& pref_name( 658 const std::string& pref_name(
639 *content::Details<std::string>(details).ptr()); 659 *content::Details<std::string>(details).ptr());
640 if (pref_name == prefs::kPinnedLauncherApps) 660 if (pref_name == prefs::kPinnedLauncherApps)
641 UpdateAppLaunchersFromPref(); 661 UpdateAppLaunchersFromPref();
642 else if (pref_name == prefs::kShelfAlignment) 662 else if (pref_name == prefs::kShelfAlignment)
643 SetShelfAlignmentFromPrefs(); 663 SetShelfAlignmentFromPrefs();
644 else if (pref_name == prefs::kShelfAutoHideBehavior) 664 else if (pref_name == prefs::kShelfAutoHideBehavior)
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 case ash::SHELF_ALIGNMENT_LEFT: 757 case ash::SHELF_ALIGNMENT_LEFT:
738 pref_value = ash::kShelfAlignmentLeft; 758 pref_value = ash::kShelfAlignmentLeft;
739 break; 759 break;
740 case ash::SHELF_ALIGNMENT_RIGHT: 760 case ash::SHELF_ALIGNMENT_RIGHT:
741 pref_value = ash::kShelfAlignmentRight; 761 pref_value = ash::kShelfAlignmentRight;
742 break; 762 break;
743 } 763 }
744 profile_->GetPrefs()->SetString(prefs::kShelfAlignment, pref_value); 764 profile_->GetPrefs()->SetString(prefs::kShelfAlignment, pref_value);
745 } 765 }
746 766
767 void ChromeLauncherController::OnStateChanged() {
768 DCHECK(observed_sync_service_);
769 CheckAppSync();
770 }
771
747 void ChromeLauncherController::PersistPinnedState() { 772 void ChromeLauncherController::PersistPinnedState() {
748 // It is a coding error to call PersistPinnedState() if the pinned apps are 773 // It is a coding error to call PersistPinnedState() if the pinned apps are
749 // not user-editable. The code should check earlier and not perform any 774 // not user-editable. The code should check earlier and not perform any
750 // modification actions that trigger persisting the state. 775 // modification actions that trigger persisting the state.
751 if (!CanPin()) { 776 if (!CanPin()) {
752 NOTREACHED() << "Can't pin but pinned state being updated"; 777 NOTREACHED() << "Can't pin but pinned state being updated";
753 return; 778 return;
754 } 779 }
755 780
756 // Set kUseDefaultPinnedApps to false and use pinned apps list from prefs 781 // Set kUseDefaultPinnedApps to false and use pinned apps list from prefs
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 } 818 }
794 819
795 ash::LauncherItemStatus ChromeLauncherController::GetItemStatus( 820 ash::LauncherItemStatus ChromeLauncherController::GetItemStatus(
796 ash::LauncherID id) const { 821 ash::LauncherID id) const {
797 int index = model_->ItemIndexByID(id); 822 int index = model_->ItemIndexByID(id);
798 DCHECK_GE(index, 0); 823 DCHECK_GE(index, 0);
799 const ash::LauncherItem& item = model_->items()[index]; 824 const ash::LauncherItem& item = model_->items()[index];
800 return item.status; 825 return item.status;
801 } 826 }
802 827
803 void ChromeLauncherController::MarkAppPending(const std::string& app_id) {
804 for (IDToItemMap::const_iterator i = id_to_item_map_.begin();
805 i != id_to_item_map_.end(); ++i) {
806 if (i->second.item_type == TYPE_APP && i->second.app_id == app_id) {
807 if (GetItemStatus(i->first) == ash::STATUS_CLOSED)
808 SetItemStatus(i->first, ash::STATUS_IS_PENDING);
809
810 break;
811 }
812 }
813 }
814
815 void ChromeLauncherController::DoPinAppWithID(const std::string& app_id) { 828 void ChromeLauncherController::DoPinAppWithID(const std::string& app_id) {
816 // If there is an item, do nothing and return. 829 // If there is an item, do nothing and return.
817 if (IsAppPinned(app_id)) 830 if (IsAppPinned(app_id))
818 return; 831 return;
819 832
820 // Otherwise, create an item for it. 833 // Otherwise, create an item for it.
821 CreateAppLauncherItem(NULL, app_id, ash::STATUS_CLOSED); 834 CreateAppLauncherItem(NULL, app_id, ash::STATUS_CLOSED);
822 if (CanPin()) 835 if (CanPin())
823 PersistPinnedState(); 836 PersistPinnedState();
824 } 837 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 // delete all app launcher entries in between. 875 // delete all app launcher entries in between.
863 if (IsAppPinned(*pref_app_id)) { 876 if (IsAppPinned(*pref_app_id)) {
864 for (; index < model_->item_count(); ++index) { 877 for (; index < model_->item_count(); ++index) {
865 const ash::LauncherItem& item(model_->items()[index]); 878 const ash::LauncherItem& item(model_->items()[index]);
866 if (item.type != ash::TYPE_APP_SHORTCUT) 879 if (item.type != ash::TYPE_APP_SHORTCUT)
867 continue; 880 continue;
868 881
869 IDToItemMap::const_iterator entry(id_to_item_map_.find(item.id)); 882 IDToItemMap::const_iterator entry(id_to_item_map_.find(item.id));
870 if (entry != id_to_item_map_.end() && 883 if (entry != id_to_item_map_.end() &&
871 entry->second.app_id == *pref_app_id) { 884 entry->second.app_id == *pref_app_id) {
872 // Current item will be kept. Reset its pending state and ensure
873 // its icon is loaded since it has to be valid to be in |pinned_apps|.
874 if (item.status == ash::STATUS_IS_PENDING) {
875 SetItemStatus(item.id, ash::STATUS_CLOSED);
876 app_icon_loader_->FetchImage(*pref_app_id);
877 }
878
879 ++pref_app_id; 885 ++pref_app_id;
880 break; 886 break;
881 } else { 887 } else {
882 LauncherItemClosed(item.id); 888 LauncherItemClosed(item.id);
883 --index; 889 --index;
884 } 890 }
885 } 891 }
886 // If the item wasn't found, that means id_to_item_map_ is out of sync. 892 // If the item wasn't found, that means id_to_item_map_ is out of sync.
887 DCHECK(index < model_->item_count()); 893 DCHECK(index < model_->item_count());
888 } else { 894 } else {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 } else if (controller->type() == 971 } else if (controller->type() ==
966 BrowserLauncherItemController::TYPE_APP_PANEL || 972 BrowserLauncherItemController::TYPE_APP_PANEL ||
967 controller->type() == 973 controller->type() ==
968 BrowserLauncherItemController::TYPE_EXTENSION_PANEL) { 974 BrowserLauncherItemController::TYPE_EXTENSION_PANEL) {
969 item.type = ash::TYPE_APP_PANEL; 975 item.type = ash::TYPE_APP_PANEL;
970 } else { 976 } else {
971 item.type = ash::TYPE_TABBED; 977 item.type = ash::TYPE_TABBED;
972 } 978 }
973 item.is_incognito = false; 979 item.is_incognito = false;
974 item.image = Extension::GetDefaultIcon(true); 980 item.image = Extension::GetDefaultIcon(true);
975 if (item.type == ash::TYPE_APP_SHORTCUT && 981
976 !app_tab_helper_->IsValidID(app_id)) { 982 TabContents* active_tab = GetLastActiveTabContents(app_id);
977 item.status = ash::STATUS_IS_PENDING; 983 if (active_tab) {
978 } else { 984 Browser* browser = browser::FindBrowserWithWebContents(
979 TabContents* active_tab = GetLastActiveTabContents(app_id); 985 active_tab->web_contents());
980 if (active_tab) { 986 DCHECK(browser);
981 Browser* browser = browser::FindBrowserWithWebContents( 987 if (browser->window()->IsActive())
982 active_tab->web_contents()); 988 status = ash::STATUS_ACTIVE;
983 DCHECK(browser); 989 else
984 if (browser->window()->IsActive()) 990 status = ash::STATUS_RUNNING;
985 status = ash::STATUS_ACTIVE;
986 else
987 status = ash::STATUS_RUNNING;
988 }
989 item.status = status;
990 } 991 }
992 item.status = status;
993
991 model_->AddAt(index, item); 994 model_->AddAt(index, item);
992 995
993 if (!controller || controller->type() != 996 if (!controller || controller->type() !=
994 BrowserLauncherItemController::TYPE_EXTENSION_PANEL) { 997 BrowserLauncherItemController::TYPE_EXTENSION_PANEL) {
995 if (item.status != ash::STATUS_IS_PENDING) 998 app_icon_loader_->FetchImage(app_id);
996 app_icon_loader_->FetchImage(app_id);
997 } 999 }
1000
998 return id; 1001 return id;
999 } 1002 }
1003
1004 void ChromeLauncherController::CheckAppSync() {
1005 if (!observed_sync_service_)
1006 return;
1007
1008 const bool synced = observed_sync_service_->ShouldPushChanges();
1009 const bool has_pending_extension = profile_->GetExtensionService()->
1010 pending_extension_manager()->HasPendingExtensionFromSync();
1011
1012 if (synced && !has_pending_extension)
1013 StopLoadingAnimation();
1014 }
1015
1016 void ChromeLauncherController::StartLoadingAnimation() {
1017 DCHECK(observed_sync_service_);
1018 loading_timer_.Start(
1019 FROM_HERE,
1020 base::TimeDelta::FromMilliseconds(kMaxLoadingTimeMs),
1021 this, &ChromeLauncherController::StopLoadingAnimation);
1022 model_->SetStatus(ash::LauncherModel::STATUS_LOADING);
1023 }
1024
1025 void ChromeLauncherController::StopLoadingAnimation() {
1026 DCHECK(observed_sync_service_);
1027
1028 model_->SetStatus(ash::LauncherModel::STATUS_NORMAL);
1029 loading_timer_.Stop();
1030 observed_sync_service_->RemoveObserver(this);
1031 observed_sync_service_ = NULL;
1032 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698