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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 service->IsExtensionEnabled(extension->id()) && | 153 service->IsExtensionEnabled(extension->id()) && |
154 !extensions::ExtensionRegistry::Get(service->GetBrowserContext()) | 154 !extensions::ExtensionRegistry::Get(service->GetBrowserContext()) |
155 ->GetExtensionById(extension->id(), | 155 ->GetExtensionById(extension->id(), |
156 extensions::ExtensionRegistry::TERMINATED); | 156 extensions::ExtensionRegistry::TERMINATED); |
157 extensions::GetExtensionBasicInfo(extension, enabled, value); | 157 extensions::GetExtensionBasicInfo(extension, enabled, value); |
158 | 158 |
159 value->SetBoolean("mayDisable", extensions::ExtensionSystem::Get( | 159 value->SetBoolean("mayDisable", extensions::ExtensionSystem::Get( |
160 service->profile())->management_policy()->UserMayModifySettings( | 160 service->profile())->management_policy()->UserMayModifySettings( |
161 extension, NULL)); | 161 extension, NULL)); |
162 | 162 |
163 bool icon_big_exists = true; | |
164 // Instead of setting grayscale here, we do it in apps_page.js. | 163 // Instead of setting grayscale here, we do it in apps_page.js. |
165 GURL icon_big = extensions::ExtensionIconSource::GetIconURL( | 164 GURL icon = extensions::ExtensionIconSource::GetIconURL( |
166 extension, | 165 extension, extension_misc::EXTENSION_ICON_LARGE, |
167 extension_misc::EXTENSION_ICON_LARGE, | 166 ExtensionIconSet::MATCH_BIGGER, false); |
168 ExtensionIconSet::MATCH_BIGGER, | 167 DCHECK_NE(GURL(), icon); |
169 false, | 168 value->SetString("icon", icon.spec()); |
170 &icon_big_exists); | |
171 value->SetString("icon_big", icon_big.spec()); | |
172 value->SetBoolean("icon_big_exists", icon_big_exists); | |
173 bool icon_small_exists = true; | |
174 GURL icon_small = extensions::ExtensionIconSource::GetIconURL( | |
175 extension, | |
176 extension_misc::EXTENSION_ICON_BITTY, | |
177 ExtensionIconSet::MATCH_BIGGER, | |
178 false, | |
179 &icon_small_exists); | |
180 value->SetString("icon_small", icon_small.spec()); | |
181 value->SetBoolean("icon_small_exists", icon_small_exists); | |
182 value->SetInteger("launch_container", | 169 value->SetInteger("launch_container", |
183 extensions::AppLaunchInfo::GetLaunchContainer(extension)); | 170 extensions::AppLaunchInfo::GetLaunchContainer(extension)); |
184 ExtensionPrefs* prefs = ExtensionPrefs::Get(service->profile()); | 171 ExtensionPrefs* prefs = ExtensionPrefs::Get(service->profile()); |
185 value->SetInteger("launch_type", extensions::GetLaunchType(prefs, extension)); | 172 value->SetInteger("launch_type", extensions::GetLaunchType(prefs, extension)); |
186 value->SetBoolean("is_component", | 173 value->SetBoolean("is_component", |
187 extension->location() == extensions::Manifest::COMPONENT); | 174 extension->location() == extensions::Manifest::COMPONENT); |
188 value->SetBoolean("is_webstore", | 175 value->SetBoolean("is_webstore", |
189 extension->id() == extensions::kWebStoreAppId); | 176 extension->id() == extensions::kWebStoreAppId); |
190 | 177 |
191 AppSorting* sorting = ExtensionSystem::Get(service->profile())->app_sorting(); | 178 AppSorting* sorting = ExtensionSystem::Get(service->profile())->app_sorting(); |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 base::FundamentalValue(!extension_id_prompting_.empty())); | 880 base::FundamentalValue(!extension_id_prompting_.empty())); |
894 } | 881 } |
895 | 882 |
896 bool AppLauncherHandler::ShouldShow(const Extension* extension) const { | 883 bool AppLauncherHandler::ShouldShow(const Extension* extension) const { |
897 if (ignore_changes_ || !has_loaded_apps_ || !extension->is_app()) | 884 if (ignore_changes_ || !has_loaded_apps_ || !extension->is_app()) |
898 return false; | 885 return false; |
899 | 886 |
900 Profile* profile = Profile::FromWebUI(web_ui()); | 887 Profile* profile = Profile::FromWebUI(web_ui()); |
901 return extensions::ui_util::ShouldDisplayInNewTabPage(extension, profile); | 888 return extensions::ui_util::ShouldDisplayInNewTabPage(extension, profile); |
902 } | 889 } |
OLD | NEW |