Chromium Code Reviews| 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 void AppLauncherHandler::HandleSetLaunchType(const ListValue* args) { | 413 void AppLauncherHandler::HandleSetLaunchType(const ListValue* args) { |
| 414 std::string extension_id; | 414 std::string extension_id; |
| 415 double launch_type; | 415 double launch_type; |
| 416 CHECK(args->GetString(0, &extension_id)); | 416 CHECK(args->GetString(0, &extension_id)); |
| 417 CHECK(args->GetDouble(1, &launch_type)); | 417 CHECK(args->GetDouble(1, &launch_type)); |
| 418 | 418 |
| 419 const Extension* extension = | 419 const Extension* extension = |
| 420 extensions_service_->GetExtensionById(extension_id, true); | 420 extensions_service_->GetExtensionById(extension_id, true); |
| 421 CHECK(extension); | 421 CHECK(extension); |
| 422 | 422 |
| 423 // Don't update the page; it already knows about the launch type change. | |
| 424 scoped_ptr<AutoReset<bool> > auto_reset; | |
|
csilv
2011/06/22 21:21:30
I assume that space is needed to prevent the the c
| |
| 425 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4)) | |
| 426 auto_reset.reset(new AutoReset<bool>(&ignore_changes_, true)); | |
| 427 | |
| 423 extensions_service_->extension_prefs()->SetLaunchType( | 428 extensions_service_->extension_prefs()->SetLaunchType( |
| 424 extension_id, | 429 extension_id, |
| 425 static_cast<ExtensionPrefs::LaunchType>( | 430 static_cast<ExtensionPrefs::LaunchType>( |
| 426 static_cast<int>(launch_type))); | 431 static_cast<int>(launch_type))); |
| 427 } | 432 } |
| 428 | 433 |
| 429 void AppLauncherHandler::HandleUninstallApp(const ListValue* args) { | 434 void AppLauncherHandler::HandleUninstallApp(const ListValue* args) { |
| 430 std::string extension_id = UTF16ToUTF8(ExtractStringValue(args)); | 435 std::string extension_id = UTF16ToUTF8(ExtractStringValue(args)); |
| 431 const Extension* extension = extensions_service_->GetExtensionById( | 436 const Extension* extension = extensions_service_->GetExtensionById( |
| 432 extension_id, false); | 437 extension_id, false); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 652 | 657 |
| 653 void AppLauncherHandler::UninstallDefaultApps() { | 658 void AppLauncherHandler::UninstallDefaultApps() { |
| 654 AppsPromo* apps_promo = extensions_service_->apps_promo(); | 659 AppsPromo* apps_promo = extensions_service_->apps_promo(); |
| 655 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); | 660 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); |
| 656 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); | 661 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); |
| 657 iter != app_ids.end(); ++iter) { | 662 iter != app_ids.end(); ++iter) { |
| 658 if (extensions_service_->GetExtensionById(*iter, true)) | 663 if (extensions_service_->GetExtensionById(*iter, true)) |
| 659 extensions_service_->UninstallExtension(*iter, false, NULL); | 664 extensions_service_->UninstallExtension(*iter, false, NULL); |
| 660 } | 665 } |
| 661 } | 666 } |
| OLD | NEW |