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/ash/launcher/chrome_launcher_controller_per_app.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/launcher/launcher_model.h" | 9 #include "ash/launcher/launcher_model.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 427 |
428 void ChromeLauncherControllerPerApp::ActivateApp(const std::string& app_id, | 428 void ChromeLauncherControllerPerApp::ActivateApp(const std::string& app_id, |
429 int event_flags) { | 429 int event_flags) { |
430 if (app_id == extension_misc::kChromeAppId) { | 430 if (app_id == extension_misc::kChromeAppId) { |
431 OnBrowserShortcutClicked(event_flags); | 431 OnBrowserShortcutClicked(event_flags); |
432 return; | 432 return; |
433 } | 433 } |
434 | 434 |
435 // If there is an existing non-shortcut controller for this app, open it. | 435 // If there is an existing non-shortcut controller for this app, open it. |
436 ash::LauncherID id = GetLauncherIDForAppID(app_id); | 436 ash::LauncherID id = GetLauncherIDForAppID(app_id); |
| 437 if (id) { |
| 438 LauncherItemController* controller = id_to_item_controller_map_[id]; |
| 439 controller->Activate(); |
| 440 return; |
| 441 } |
437 | 442 |
438 // Only pinned applications will be handled. | 443 // Otherwise launch the app. |
439 if (!id) | 444 LaunchApp(app_id, event_flags); |
440 return; | |
441 | |
442 LauncherItemController* controller = id_to_item_controller_map_[id]; | |
443 controller->Activate(); | |
444 } | 445 } |
445 | 446 |
446 extensions::ExtensionPrefs::LaunchType | 447 extensions::ExtensionPrefs::LaunchType |
447 ChromeLauncherControllerPerApp::GetLaunchType(ash::LauncherID id) { | 448 ChromeLauncherControllerPerApp::GetLaunchType(ash::LauncherID id) { |
448 DCHECK(HasItemController(id)); | 449 DCHECK(HasItemController(id)); |
449 | 450 |
450 const Extension* extension = GetExtensionForAppID( | 451 const Extension* extension = GetExtensionForAppID( |
451 id_to_item_controller_map_[id]->app_id()); | 452 id_to_item_controller_map_[id]->app_id()); |
452 return profile_->GetExtensionService()->extension_prefs()->GetLaunchType( | 453 return profile_->GetExtensionService()->extension_prefs()->GetLaunchType( |
453 extension, | 454 extension, |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 FaviconTabHelper* favicon_tab_helper = | 1235 FaviconTabHelper* favicon_tab_helper = |
1235 FaviconTabHelper::FromWebContents(web_contents); | 1236 FaviconTabHelper::FromWebContents(web_contents); |
1236 gfx::Image app_icon = favicon_tab_helper->GetFavicon(); | 1237 gfx::Image app_icon = favicon_tab_helper->GetFavicon(); |
1237 items->push_back(new ChromeLauncherAppMenuItemBrowser( | 1238 items->push_back(new ChromeLauncherAppMenuItemBrowser( |
1238 web_contents->GetTitle(), | 1239 web_contents->GetTitle(), |
1239 app_icon.IsEmpty() ? NULL : &app_icon, | 1240 app_icon.IsEmpty() ? NULL : &app_icon, |
1240 browser)); | 1241 browser)); |
1241 } | 1242 } |
1242 return items; | 1243 return items; |
1243 } | 1244 } |
OLD | NEW |