| 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_launcher_info.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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 107     const Extension* extension, | 108     const Extension* extension, | 
| 108     const extensions::AppNotification* notification, | 109     const extensions::AppNotification* notification, | 
| 109     ExtensionService* service, | 110     ExtensionService* service, | 
| 110     DictionaryValue* value) { | 111     DictionaryValue* value) { | 
| 111   value->Clear(); | 112   value->Clear(); | 
| 112 | 113 | 
| 113   // The Extension class 'helpfully' wraps bidi control characters that | 114   // The Extension class 'helpfully' wraps bidi control characters that | 
| 114   // impede our ability to determine directionality. | 115   // impede our ability to determine directionality. | 
| 115   string16 name = UTF8ToUTF16(extension->name()); | 116   string16 name = UTF8ToUTF16(extension->name()); | 
| 116   base::i18n::UnadjustStringForLocaleDirection(&name); | 117   base::i18n::UnadjustStringForLocaleDirection(&name); | 
| 117   NewTabUI::SetUrlTitleAndDirection(value, name, extension->GetFullLaunchURL()); | 118   NewTabUI::SetUrlTitleAndDirection( | 
|  | 119       value, name, extensions::AppLauncherInfo::GetFullLaunchURL(extension)); | 
| 118 | 120 | 
| 119   bool enabled = service->IsExtensionEnabled(extension->id()) && | 121   bool enabled = service->IsExtensionEnabled(extension->id()) && | 
| 120       !service->GetTerminatedExtension(extension->id()); | 122       !service->GetTerminatedExtension(extension->id()); | 
| 121   extension->GetBasicInfo(enabled, value); | 123   extension->GetBasicInfo(enabled, value); | 
| 122 | 124 | 
| 123   value->SetBoolean("mayDisable", extensions::ExtensionSystem::Get( | 125   value->SetBoolean("mayDisable", extensions::ExtensionSystem::Get( | 
| 124       service->profile())->management_policy()->UserMayModifySettings( | 126       service->profile())->management_policy()->UserMayModifySettings( | 
| 125       extension, NULL)); | 127       extension, NULL)); | 
| 126 | 128 | 
| 127   bool icon_big_exists = true; | 129   bool icon_big_exists = true; | 
| 128   // Instead of setting grayscale here, we do it in apps_page.js. | 130   // Instead of setting grayscale here, we do it in apps_page.js. | 
| 129   GURL icon_big = | 131   GURL icon_big = | 
| 130       ExtensionIconSource::GetIconURL(extension, | 132       ExtensionIconSource::GetIconURL(extension, | 
| 131                                       extension_misc::EXTENSION_ICON_LARGE, | 133                                       extension_misc::EXTENSION_ICON_LARGE, | 
| 132                                       ExtensionIconSet::MATCH_BIGGER, | 134                                       ExtensionIconSet::MATCH_BIGGER, | 
| 133                                       false, &icon_big_exists); | 135                                       false, &icon_big_exists); | 
| 134   value->SetString("icon_big", icon_big.spec()); | 136   value->SetString("icon_big", icon_big.spec()); | 
| 135   value->SetBoolean("icon_big_exists", icon_big_exists); | 137   value->SetBoolean("icon_big_exists", icon_big_exists); | 
| 136   bool icon_small_exists = true; | 138   bool icon_small_exists = true; | 
| 137   GURL icon_small = | 139   GURL icon_small = | 
| 138       ExtensionIconSource::GetIconURL(extension, | 140       ExtensionIconSource::GetIconURL(extension, | 
| 139                                       extension_misc::EXTENSION_ICON_BITTY, | 141                                       extension_misc::EXTENSION_ICON_BITTY, | 
| 140                                       ExtensionIconSet::MATCH_BIGGER, | 142                                       ExtensionIconSet::MATCH_BIGGER, | 
| 141                                       false, &icon_small_exists); | 143                                       false, &icon_small_exists); | 
| 142   value->SetString("icon_small", icon_small.spec()); | 144   value->SetString("icon_small", icon_small.spec()); | 
| 143   value->SetBoolean("icon_small_exists", icon_small_exists); | 145   value->SetBoolean("icon_small_exists", icon_small_exists); | 
| 144   value->SetInteger("launch_container", extension->launch_container()); | 146   value->SetInteger("launch_container", | 
|  | 147                     extensions::AppLauncherInfo::GetLaunchContainer(extension)); | 
| 145   ExtensionPrefs* prefs = service->extension_prefs(); | 148   ExtensionPrefs* prefs = service->extension_prefs(); | 
| 146   value->SetInteger("launch_type", | 149   value->SetInteger("launch_type", | 
| 147       prefs->GetLaunchType(extension, | 150       prefs->GetLaunchType(extension, | 
| 148                            ExtensionPrefs::LAUNCH_DEFAULT)); | 151                            ExtensionPrefs::LAUNCH_DEFAULT)); | 
| 149   value->SetBoolean("is_component", | 152   value->SetBoolean("is_component", | 
| 150                     extension->location() == extensions::Manifest::COMPONENT); | 153                     extension->location() == extensions::Manifest::COMPONENT); | 
| 151   value->SetBoolean("is_webstore", | 154   value->SetBoolean("is_webstore", | 
| 152       extension->id() == extension_misc::kWebStoreAppId); | 155       extension->id() == extension_misc::kWebStoreAppId); | 
| 153 | 156 | 
| 154   if (extension->HasAPIPermission( | 157   if (extension->HasAPIPermission( | 
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 897 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { | 900 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { | 
| 898   if (!extension_uninstall_dialog_.get()) { | 901   if (!extension_uninstall_dialog_.get()) { | 
| 899     Browser* browser = chrome::FindBrowserWithWebContents( | 902     Browser* browser = chrome::FindBrowserWithWebContents( | 
| 900         web_ui()->GetWebContents()); | 903         web_ui()->GetWebContents()); | 
| 901     extension_uninstall_dialog_.reset( | 904     extension_uninstall_dialog_.reset( | 
| 902         ExtensionUninstallDialog::Create(extension_service_->profile(), | 905         ExtensionUninstallDialog::Create(extension_service_->profile(), | 
| 903                                          browser, this)); | 906                                          browser, this)); | 
| 904   } | 907   } | 
| 905   return extension_uninstall_dialog_.get(); | 908   return extension_uninstall_dialog_.get(); | 
| 906 } | 909 } | 
| OLD | NEW | 
|---|