| 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 "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/browser/ui/browser_finder.h" | 30 #include "chrome/browser/ui/browser_finder.h" |
| 31 #include "chrome/browser/ui/browser_tabstrip.h" | 31 #include "chrome/browser/ui/browser_tabstrip.h" |
| 32 #include "chrome/browser/ui/browser_window.h" | 32 #include "chrome/browser/ui/browser_window.h" |
| 33 #include "chrome/browser/ui/extensions/application_launch.h" | 33 #include "chrome/browser/ui/extensions/application_launch.h" |
| 34 #include "chrome/browser/ui/extensions/extension_enable_flow.h" | 34 #include "chrome/browser/ui/extensions/extension_enable_flow.h" |
| 35 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 35 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 36 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 36 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 37 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 37 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 38 #include "chrome/common/chrome_notification_types.h" | 38 #include "chrome/common/chrome_notification_types.h" |
| 39 #include "chrome/common/extensions/app_launch_manifest_handler.h" |
| 39 #include "chrome/common/extensions/extension.h" | 40 #include "chrome/common/extensions/extension.h" |
| 40 #include "chrome/common/extensions/extension_constants.h" | 41 #include "chrome/common/extensions/extension_constants.h" |
| 41 #include "chrome/common/extensions/extension_icon_set.h" | 42 #include "chrome/common/extensions/extension_icon_set.h" |
| 42 #include "chrome/common/extensions/extension_resource.h" | 43 #include "chrome/common/extensions/extension_resource.h" |
| 43 #include "chrome/common/pref_names.h" | 44 #include "chrome/common/pref_names.h" |
| 44 #include "chrome/common/url_constants.h" | 45 #include "chrome/common/url_constants.h" |
| 45 #include "chrome/common/web_apps.h" | 46 #include "chrome/common/web_apps.h" |
| 46 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
| 47 #include "content/public/browser/web_ui.h" | 48 #include "content/public/browser/web_ui.h" |
| 48 #include "content/public/common/favicon_url.h" | 49 #include "content/public/common/favicon_url.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 const Extension* extension, | 96 const Extension* extension, |
| 96 const extensions::AppNotification* notification, | 97 const extensions::AppNotification* notification, |
| 97 ExtensionService* service, | 98 ExtensionService* service, |
| 98 DictionaryValue* value) { | 99 DictionaryValue* value) { |
| 99 value->Clear(); | 100 value->Clear(); |
| 100 | 101 |
| 101 // The Extension class 'helpfully' wraps bidi control characters that | 102 // The Extension class 'helpfully' wraps bidi control characters that |
| 102 // impede our ability to determine directionality. | 103 // impede our ability to determine directionality. |
| 103 string16 name = UTF8ToUTF16(extension->name()); | 104 string16 name = UTF8ToUTF16(extension->name()); |
| 104 base::i18n::UnadjustStringForLocaleDirection(&name); | 105 base::i18n::UnadjustStringForLocaleDirection(&name); |
| 105 NewTabUI::SetUrlTitleAndDirection(value, name, extension->GetFullLaunchURL()); | 106 NewTabUI::SetUrlTitleAndDirection( |
| 107 value, name, extensions::AppLaunchInfo::GetFullLaunchURL(extension)); |
| 106 | 108 |
| 107 bool enabled = service->IsExtensionEnabled(extension->id()) && | 109 bool enabled = service->IsExtensionEnabled(extension->id()) && |
| 108 !service->GetTerminatedExtension(extension->id()); | 110 !service->GetTerminatedExtension(extension->id()); |
| 109 extension->GetBasicInfo(enabled, value); | 111 extension->GetBasicInfo(enabled, value); |
| 110 | 112 |
| 111 value->SetBoolean("mayDisable", extensions::ExtensionSystem::Get( | 113 value->SetBoolean("mayDisable", extensions::ExtensionSystem::Get( |
| 112 service->profile())->management_policy()->UserMayModifySettings( | 114 service->profile())->management_policy()->UserMayModifySettings( |
| 113 extension, NULL)); | 115 extension, NULL)); |
| 114 | 116 |
| 115 bool icon_big_exists = true; | 117 bool icon_big_exists = true; |
| 116 // Instead of setting grayscale here, we do it in apps_page.js. | 118 // Instead of setting grayscale here, we do it in apps_page.js. |
| 117 GURL icon_big = | 119 GURL icon_big = |
| 118 ExtensionIconSource::GetIconURL(extension, | 120 ExtensionIconSource::GetIconURL(extension, |
| 119 extension_misc::EXTENSION_ICON_LARGE, | 121 extension_misc::EXTENSION_ICON_LARGE, |
| 120 ExtensionIconSet::MATCH_BIGGER, | 122 ExtensionIconSet::MATCH_BIGGER, |
| 121 false, &icon_big_exists); | 123 false, &icon_big_exists); |
| 122 value->SetString("icon_big", icon_big.spec()); | 124 value->SetString("icon_big", icon_big.spec()); |
| 123 value->SetBoolean("icon_big_exists", icon_big_exists); | 125 value->SetBoolean("icon_big_exists", icon_big_exists); |
| 124 bool icon_small_exists = true; | 126 bool icon_small_exists = true; |
| 125 GURL icon_small = | 127 GURL icon_small = |
| 126 ExtensionIconSource::GetIconURL(extension, | 128 ExtensionIconSource::GetIconURL(extension, |
| 127 extension_misc::EXTENSION_ICON_BITTY, | 129 extension_misc::EXTENSION_ICON_BITTY, |
| 128 ExtensionIconSet::MATCH_BIGGER, | 130 ExtensionIconSet::MATCH_BIGGER, |
| 129 false, &icon_small_exists); | 131 false, &icon_small_exists); |
| 130 value->SetString("icon_small", icon_small.spec()); | 132 value->SetString("icon_small", icon_small.spec()); |
| 131 value->SetBoolean("icon_small_exists", icon_small_exists); | 133 value->SetBoolean("icon_small_exists", icon_small_exists); |
| 132 value->SetInteger("launch_container", extension->launch_container()); | 134 value->SetInteger("launch_container", |
| 135 extensions::AppLaunchInfo::GetLaunchContainer(extension)); |
| 133 ExtensionPrefs* prefs = service->extension_prefs(); | 136 ExtensionPrefs* prefs = service->extension_prefs(); |
| 134 value->SetInteger("launch_type", | 137 value->SetInteger("launch_type", |
| 135 prefs->GetLaunchType(extension, | 138 prefs->GetLaunchType(extension, |
| 136 ExtensionPrefs::LAUNCH_DEFAULT)); | 139 ExtensionPrefs::LAUNCH_DEFAULT)); |
| 137 value->SetBoolean("is_component", | 140 value->SetBoolean("is_component", |
| 138 extension->location() == extensions::Manifest::COMPONENT); | 141 extension->location() == extensions::Manifest::COMPONENT); |
| 139 value->SetBoolean("is_webstore", | 142 value->SetBoolean("is_webstore", |
| 140 extension->id() == extension_misc::kWebStoreAppId); | 143 extension->id() == extension_misc::kWebStoreAppId); |
| 141 | 144 |
| 142 if (extension->HasAPIPermission( | 145 if (extension->HasAPIPermission( |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { | 888 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { |
| 886 if (!extension_uninstall_dialog_.get()) { | 889 if (!extension_uninstall_dialog_.get()) { |
| 887 Browser* browser = chrome::FindBrowserWithWebContents( | 890 Browser* browser = chrome::FindBrowserWithWebContents( |
| 888 web_ui()->GetWebContents()); | 891 web_ui()->GetWebContents()); |
| 889 extension_uninstall_dialog_.reset( | 892 extension_uninstall_dialog_.reset( |
| 890 ExtensionUninstallDialog::Create(extension_service_->profile(), | 893 ExtensionUninstallDialog::Create(extension_service_->profile(), |
| 891 browser, this)); | 894 browser, this)); |
| 892 } | 895 } |
| 893 return extension_uninstall_dialog_.get(); | 896 return extension_uninstall_dialog_.get(); |
| 894 } | 897 } |
| OLD | NEW |