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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "apps/app_launcher.h" | 9 #include "apps/app_launcher.h" |
10 #include "apps/metrics_names.h" | 10 #include "apps/metrics_names.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 #if defined(OS_CHROMEOS) | 368 #if defined(OS_CHROMEOS) |
369 // Making shortcut does not make sense on ChromeOS because it does not have | 369 // Making shortcut does not make sense on ChromeOS because it does not have |
370 // a desktop. | 370 // a desktop. |
371 dictionary->SetBoolean("disableCreateAppShortcut", true); | 371 dictionary->SetBoolean("disableCreateAppShortcut", true); |
372 #endif | 372 #endif |
373 | 373 |
374 const ListValue* app_page_names = prefs->GetList(prefs::kNtpAppPageNames); | 374 const ListValue* app_page_names = prefs->GetList(prefs::kNtpAppPageNames); |
375 if (!app_page_names || !app_page_names->GetSize()) { | 375 if (!app_page_names || !app_page_names->GetSize()) { |
376 ListPrefUpdate update(prefs, prefs::kNtpAppPageNames); | 376 ListPrefUpdate update(prefs, prefs::kNtpAppPageNames); |
377 ListValue* list = update.Get(); | 377 ListValue* list = update.Get(); |
378 list->Set(0, Value::CreateStringValue( | 378 list->Set(0, new base::StringValue( |
379 l10n_util::GetStringUTF16(IDS_APP_DEFAULT_PAGE_NAME))); | 379 l10n_util::GetStringUTF16(IDS_APP_DEFAULT_PAGE_NAME))); |
380 dictionary->Set("appPageNames", | 380 dictionary->Set("appPageNames", |
381 static_cast<ListValue*>(list->DeepCopy())); | 381 static_cast<ListValue*>(list->DeepCopy())); |
382 } else { | 382 } else { |
383 dictionary->Set("appPageNames", | 383 dictionary->Set("appPageNames", |
384 static_cast<ListValue*>(app_page_names->DeepCopy())); | 384 static_cast<ListValue*>(app_page_names->DeepCopy())); |
385 } | 385 } |
386 } | 386 } |
387 | 387 |
388 DictionaryValue* AppLauncherHandler::GetAppInfo(const Extension* extension) { | 388 DictionaryValue* AppLauncherHandler::GetAppInfo(const Extension* extension) { |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 string16 name; | 645 string16 name; |
646 CHECK(args->GetString(0, &name)); | 646 CHECK(args->GetString(0, &name)); |
647 | 647 |
648 double page_index; | 648 double page_index; |
649 CHECK(args->GetDouble(1, &page_index)); | 649 CHECK(args->GetDouble(1, &page_index)); |
650 | 650 |
651 base::AutoReset<bool> auto_reset(&ignore_changes_, true); | 651 base::AutoReset<bool> auto_reset(&ignore_changes_, true); |
652 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 652 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
653 ListPrefUpdate update(prefs, prefs::kNtpAppPageNames); | 653 ListPrefUpdate update(prefs, prefs::kNtpAppPageNames); |
654 ListValue* list = update.Get(); | 654 ListValue* list = update.Get(); |
655 list->Set(static_cast<size_t>(page_index), Value::CreateStringValue(name)); | 655 list->Set(static_cast<size_t>(page_index), new base::StringValue(name)); |
656 } | 656 } |
657 | 657 |
658 void AppLauncherHandler::HandleGenerateAppForLink(const ListValue* args) { | 658 void AppLauncherHandler::HandleGenerateAppForLink(const ListValue* args) { |
659 std::string url; | 659 std::string url; |
660 CHECK(args->GetString(0, &url)); | 660 CHECK(args->GetString(0, &url)); |
661 GURL launch_url(url); | 661 GURL launch_url(url); |
662 | 662 |
663 string16 title; | 663 string16 title; |
664 CHECK(args->GetString(1, &title)); | 664 CHECK(args->GetString(1, &title)); |
665 | 665 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { | 900 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { |
901 if (!extension_uninstall_dialog_.get()) { | 901 if (!extension_uninstall_dialog_.get()) { |
902 Browser* browser = chrome::FindBrowserWithWebContents( | 902 Browser* browser = chrome::FindBrowserWithWebContents( |
903 web_ui()->GetWebContents()); | 903 web_ui()->GetWebContents()); |
904 extension_uninstall_dialog_.reset( | 904 extension_uninstall_dialog_.reset( |
905 ExtensionUninstallDialog::Create(extension_service_->profile(), | 905 ExtensionUninstallDialog::Create(extension_service_->profile(), |
906 browser, this)); | 906 browser, this)); |
907 } | 907 } |
908 return extension_uninstall_dialog_.get(); | 908 return extension_uninstall_dialog_.get(); |
909 } | 909 } |
OLD | NEW |