| 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/webui/ntp/app_launcher_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 // is set, launch as a regular tab. | 562 // is set, launch as a regular tab. |
| 563 extension_misc::LaunchContainer launch_container = | 563 extension_misc::LaunchContainer launch_container = |
| 564 extension_service_->extension_prefs()->GetLaunchContainer( | 564 extension_service_->extension_prefs()->GetLaunchContainer( |
| 565 extension, ExtensionPrefs::LAUNCH_REGULAR); | 565 extension, ExtensionPrefs::LAUNCH_REGULAR); |
| 566 | 566 |
| 567 // To give a more "launchy" experience when using the NTP launcher, we close | 567 // To give a more "launchy" experience when using the NTP launcher, we close |
| 568 // it automatically. | 568 // it automatically. |
| 569 Browser* browser = browser::FindLastActiveWithProfile(profile); | 569 Browser* browser = browser::FindLastActiveWithProfile(profile); |
| 570 WebContents* old_contents = NULL; | 570 WebContents* old_contents = NULL; |
| 571 if (browser) | 571 if (browser) |
| 572 old_contents = browser->GetSelectedWebContents(); | 572 old_contents = browser->GetActiveWebContents(); |
| 573 | 573 |
| 574 WebContents* new_contents = application_launch::OpenApplication( | 574 WebContents* new_contents = application_launch::OpenApplication( |
| 575 profile, extension, launch_container, GURL(url), | 575 profile, extension, launch_container, GURL(url), |
| 576 old_contents ? CURRENT_TAB : NEW_FOREGROUND_TAB, NULL); | 576 old_contents ? CURRENT_TAB : NEW_FOREGROUND_TAB, NULL); |
| 577 | 577 |
| 578 // This will also destroy the handler, so do not perform any actions after. | 578 // This will also destroy the handler, so do not perform any actions after. |
| 579 if (new_contents != old_contents && browser && browser->tab_count() > 1) | 579 if (new_contents != old_contents && browser && browser->tab_count() > 1) |
| 580 browser->CloseTabContents(old_contents); | 580 browser->CloseTabContents(old_contents); |
| 581 } | 581 } |
| 582 } | 582 } |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 | 991 |
| 992 void AppLauncherHandler::UninstallDefaultApps() { | 992 void AppLauncherHandler::UninstallDefaultApps() { |
| 993 AppsPromo* apps_promo = extension_service_->apps_promo(); | 993 AppsPromo* apps_promo = extension_service_->apps_promo(); |
| 994 const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps(); | 994 const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps(); |
| 995 for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin(); | 995 for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin(); |
| 996 iter != app_ids.end(); ++iter) { | 996 iter != app_ids.end(); ++iter) { |
| 997 if (extension_service_->GetExtensionById(*iter, true)) | 997 if (extension_service_->GetExtensionById(*iter, true)) |
| 998 extension_service_->UninstallExtension(*iter, false, NULL); | 998 extension_service_->UninstallExtension(*iter, false, NULL); |
| 999 } | 999 } |
| 1000 } | 1000 } |
| OLD | NEW |