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/metrics_names.h" | 9 #include "apps/metrics_names.h" |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 const Extension* extension = extension_service_->GetInstalledExtension(*it); | 371 const Extension* extension = extension_service_->GetInstalledExtension(*it); |
372 if (extension && extensions::ui_util::ShouldDisplayInNewTabPage( | 372 if (extension && extensions::ui_util::ShouldDisplayInNewTabPage( |
373 extension, profile)) { | 373 extension, profile)) { |
374 base::DictionaryValue* app_info = GetAppInfo(extension); | 374 base::DictionaryValue* app_info = GetAppInfo(extension); |
375 list->Append(app_info); | 375 list->Append(app_info); |
376 } | 376 } |
377 } | 377 } |
378 | 378 |
379 dictionary->Set("apps", list); | 379 dictionary->Set("apps", list); |
380 | 380 |
381 // TODO(estade): remove these settings when the old NTP is removed. The new | |
382 // NTP does it in js. | |
383 #if defined(OS_MACOSX) | |
384 // App windows are not yet implemented on mac. | |
385 dictionary->SetBoolean("disableAppWindowLaunch", true); | |
386 dictionary->SetBoolean("disableCreateAppShortcut", true); | |
387 #endif | |
388 | |
389 #if defined(OS_CHROMEOS) | |
390 // Making shortcut does not make sense on ChromeOS because it does not have | |
391 // a desktop. | |
392 dictionary->SetBoolean("disableCreateAppShortcut", true); | |
393 #endif | |
394 | |
395 const base::ListValue* app_page_names = | 381 const base::ListValue* app_page_names = |
396 prefs->GetList(prefs::kNtpAppPageNames); | 382 prefs->GetList(prefs::kNtpAppPageNames); |
397 if (!app_page_names || !app_page_names->GetSize()) { | 383 if (!app_page_names || !app_page_names->GetSize()) { |
398 ListPrefUpdate update(prefs, prefs::kNtpAppPageNames); | 384 ListPrefUpdate update(prefs, prefs::kNtpAppPageNames); |
399 base::ListValue* list = update.Get(); | 385 base::ListValue* list = update.Get(); |
400 list->Set(0, new base::StringValue( | 386 list->Set(0, new base::StringValue( |
401 l10n_util::GetStringUTF16(IDS_APP_DEFAULT_PAGE_NAME))); | 387 l10n_util::GetStringUTF16(IDS_APP_DEFAULT_PAGE_NAME))); |
402 dictionary->Set("appPageNames", | 388 dictionary->Set("appPageNames", |
403 static_cast<base::ListValue*>(list->DeepCopy())); | 389 static_cast<base::ListValue*>(list->DeepCopy())); |
404 } else { | 390 } else { |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { | 834 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { |
849 if (!extension_uninstall_dialog_.get()) { | 835 if (!extension_uninstall_dialog_.get()) { |
850 Browser* browser = chrome::FindBrowserWithWebContents( | 836 Browser* browser = chrome::FindBrowserWithWebContents( |
851 web_ui()->GetWebContents()); | 837 web_ui()->GetWebContents()); |
852 extension_uninstall_dialog_.reset( | 838 extension_uninstall_dialog_.reset( |
853 ExtensionUninstallDialog::Create(extension_service_->profile(), | 839 ExtensionUninstallDialog::Create(extension_service_->profile(), |
854 browser, this)); | 840 browser, this)); |
855 } | 841 } |
856 return extension_uninstall_dialog_.get(); | 842 return extension_uninstall_dialog_.get(); |
857 } | 843 } |
OLD | NEW |