OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 } else { | 552 } else { |
553 // Look at preference to find the right launch container. If no preference | 553 // Look at preference to find the right launch container. If no preference |
554 // is set, launch as a regular tab. | 554 // is set, launch as a regular tab. |
555 extension_misc::LaunchContainer launch_container = | 555 extension_misc::LaunchContainer launch_container = |
556 extension_service_->extension_prefs()->GetLaunchContainer( | 556 extension_service_->extension_prefs()->GetLaunchContainer( |
557 extension, ExtensionPrefs::LAUNCH_REGULAR); | 557 extension, ExtensionPrefs::LAUNCH_REGULAR); |
558 | 558 |
559 // To give a more "launchy" experience when using the NTP launcher, we close | 559 // To give a more "launchy" experience when using the NTP launcher, we close |
560 // it automatically. | 560 // it automatically. |
561 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); | 561 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); |
562 TabContents* old_contents = NULL; | 562 WebContents* old_contents = NULL; |
563 if (browser) | 563 if (browser) |
564 old_contents = browser->GetSelectedTabContents(); | 564 old_contents = browser->GetSelectedWebContents(); |
565 | 565 |
566 TabContents* new_contents = Browser::OpenApplication( | 566 WebContents* new_contents = Browser::OpenApplication( |
567 profile, extension, launch_container, GURL(url), | 567 profile, extension, launch_container, GURL(url), |
568 old_contents ? CURRENT_TAB : NEW_FOREGROUND_TAB); | 568 old_contents ? CURRENT_TAB : NEW_FOREGROUND_TAB); |
569 | 569 |
570 // This will also destroy the handler, so do not perform any actions after. | 570 // This will also destroy the handler, so do not perform any actions after. |
571 if (new_contents != old_contents && browser && browser->tab_count() > 1) | 571 if (new_contents != old_contents && browser && browser->tab_count() > 1) |
572 browser->CloseTabContents(old_contents); | 572 browser->CloseTabContents(old_contents); |
573 } | 573 } |
574 } | 574 } |
575 | 575 |
576 void AppLauncherHandler::HandleSetLaunchType(const ListValue* args) { | 576 void AppLauncherHandler::HandleSetLaunchType(const ListValue* args) { |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 | 983 |
984 void AppLauncherHandler::UninstallDefaultApps() { | 984 void AppLauncherHandler::UninstallDefaultApps() { |
985 AppsPromo* apps_promo = extension_service_->apps_promo(); | 985 AppsPromo* apps_promo = extension_service_->apps_promo(); |
986 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); | 986 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); |
987 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); | 987 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); |
988 iter != app_ids.end(); ++iter) { | 988 iter != app_ids.end(); ++iter) { |
989 if (extension_service_->GetExtensionById(*iter, true)) | 989 if (extension_service_->GetExtensionById(*iter, true)) |
990 extension_service_->UninstallExtension(*iter, false, NULL); | 990 extension_service_->UninstallExtension(*iter, false, NULL); |
991 } | 991 } |
992 } | 992 } |
OLD | NEW |