OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 extension_enable_flow_.reset(); | 1363 extension_enable_flow_.reset(); |
1364 } | 1364 } |
1365 | 1365 |
1366 ChromeLauncherAppMenuItems ChromeLauncherController::GetApplicationList( | 1366 ChromeLauncherAppMenuItems ChromeLauncherController::GetApplicationList( |
1367 const ash::ShelfItem& item, | 1367 const ash::ShelfItem& item, |
1368 int event_flags) { | 1368 int event_flags) { |
1369 // Make sure that there is a controller associated with the id and that the | 1369 // Make sure that there is a controller associated with the id and that the |
1370 // extension itself is a valid application and not a panel. | 1370 // extension itself is a valid application and not a panel. |
1371 LauncherItemController* controller = GetLauncherItemController(item.id); | 1371 LauncherItemController* controller = GetLauncherItemController(item.id); |
1372 if (!controller || !GetShelfIDForAppID(controller->app_id())) | 1372 if (!controller || !GetShelfIDForAppID(controller->app_id())) |
1373 return ChromeLauncherAppMenuItems().Pass(); | 1373 return ChromeLauncherAppMenuItems(); |
1374 | 1374 |
1375 return controller->GetApplicationList(event_flags); | 1375 return controller->GetApplicationList(event_flags); |
1376 } | 1376 } |
1377 | 1377 |
1378 std::vector<content::WebContents*> | 1378 std::vector<content::WebContents*> |
1379 ChromeLauncherController::GetV1ApplicationsFromAppId( | 1379 ChromeLauncherController::GetV1ApplicationsFromAppId( |
1380 const std::string& app_id) { | 1380 const std::string& app_id) { |
1381 ash::ShelfID id = GetShelfIDForAppID(app_id); | 1381 ash::ShelfID id = GetShelfIDForAppID(app_id); |
1382 | 1382 |
1383 // If there is no such an item pinned to the launcher, no menu gets created. | 1383 // If there is no such an item pinned to the launcher, no menu gets created. |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2170 } | 2170 } |
2171 } | 2171 } |
2172 | 2172 |
2173 void ChromeLauncherController::SetShelfItemDelegate( | 2173 void ChromeLauncherController::SetShelfItemDelegate( |
2174 ash::ShelfID id, | 2174 ash::ShelfID id, |
2175 ash::ShelfItemDelegate* item_delegate) { | 2175 ash::ShelfItemDelegate* item_delegate) { |
2176 DCHECK_GT(id, 0); | 2176 DCHECK_GT(id, 0); |
2177 DCHECK(item_delegate); | 2177 DCHECK(item_delegate); |
2178 DCHECK(item_delegate_manager_); | 2178 DCHECK(item_delegate_manager_); |
2179 item_delegate_manager_->SetShelfItemDelegate( | 2179 item_delegate_manager_->SetShelfItemDelegate( |
2180 id, scoped_ptr<ash::ShelfItemDelegate>(item_delegate).Pass()); | 2180 id, scoped_ptr<ash::ShelfItemDelegate>(item_delegate)); |
2181 } | 2181 } |
2182 | 2182 |
2183 void ChromeLauncherController::AttachProfile(Profile* profile) { | 2183 void ChromeLauncherController::AttachProfile(Profile* profile) { |
2184 profile_ = profile; | 2184 profile_ = profile; |
2185 // Either add the profile to the list of known profiles and make it the active | 2185 // Either add the profile to the list of known profiles and make it the active |
2186 // one for some functions of AppTabHelper or create a new one. | 2186 // one for some functions of AppTabHelper or create a new one. |
2187 if (!app_tab_helper_.get()) | 2187 if (!app_tab_helper_.get()) |
2188 app_tab_helper_.reset(new LauncherAppTabHelper(profile_)); | 2188 app_tab_helper_.reset(new LauncherAppTabHelper(profile_)); |
2189 else | 2189 else |
2190 app_tab_helper_->SetCurrentUser(profile_); | 2190 app_tab_helper_->SetCurrentUser(profile_); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2231 void ChromeLauncherController::ReleaseProfile() { | 2231 void ChromeLauncherController::ReleaseProfile() { |
2232 if (app_sync_ui_state_) | 2232 if (app_sync_ui_state_) |
2233 app_sync_ui_state_->RemoveObserver(this); | 2233 app_sync_ui_state_->RemoveObserver(this); |
2234 | 2234 |
2235 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); | 2235 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); |
2236 | 2236 |
2237 PrefServiceSyncableFromProfile(profile_)->RemoveObserver(this); | 2237 PrefServiceSyncableFromProfile(profile_)->RemoveObserver(this); |
2238 | 2238 |
2239 pref_change_registrar_.RemoveAll(); | 2239 pref_change_registrar_.RemoveAll(); |
2240 } | 2240 } |
OLD | NEW |