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/extensions/api/developer_private/developer_private_api.
h" | 5 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/command_line.h" |
8 #include "base/file_util.h" | 9 #include "base/file_util.h" |
9 #include "base/i18n/file_util_icu.h" | 10 #include "base/i18n/file_util_icu.h" |
10 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "chrome/browser/devtools/devtools_window.h" | 14 #include "chrome/browser/devtools/devtools_window.h" |
14 #include "chrome/browser/extensions/api/developer_private/developer_private_api_
factory.h" | 15 #include "chrome/browser/extensions/api/developer_private/developer_private_api_
factory.h" |
15 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" | 16 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" |
16 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 17 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
17 #include "chrome/browser/extensions/extension_disabled_ui.h" | 18 #include "chrome/browser/extensions/extension_disabled_ui.h" |
18 #include "chrome/browser/extensions/extension_error_reporter.h" | 19 #include "chrome/browser/extensions/extension_error_reporter.h" |
19 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
20 #include "chrome/browser/extensions/extension_system.h" | 21 #include "chrome/browser/extensions/extension_system.h" |
21 #include "chrome/browser/extensions/management_policy.h" | 22 #include "chrome/browser/extensions/management_policy.h" |
22 #include "chrome/browser/extensions/shell_window_registry.h" | 23 #include "chrome/browser/extensions/shell_window_registry.h" |
23 #include "chrome/browser/extensions/unpacked_installer.h" | 24 #include "chrome/browser/extensions/unpacked_installer.h" |
24 #include "chrome/browser/extensions/updater/extension_updater.h" | 25 #include "chrome/browser/extensions/updater/extension_updater.h" |
25 #include "chrome/browser/platform_util.h" | 26 #include "chrome/browser/platform_util.h" |
26 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
27 #include "chrome/browser/sync_file_system/drive_file_sync_service.h" | 28 #include "chrome/browser/sync_file_system/drive_file_sync_service.h" |
28 #include "chrome/browser/ui/chrome_select_file_policy.h" | 29 #include "chrome/browser/ui/chrome_select_file_policy.h" |
29 #include "chrome/browser/ui/extensions/shell_window.h" | 30 #include "chrome/browser/ui/extensions/shell_window.h" |
30 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 31 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 32 #include "chrome/common/chrome_switches.h" |
31 #include "chrome/common/extensions/api/developer_private.h" | 33 #include "chrome/common/extensions/api/developer_private.h" |
32 #include "chrome/common/extensions/background_info.h" | 34 #include "chrome/common/extensions/background_info.h" |
33 #include "chrome/common/extensions/extension_icon_set.h" | 35 #include "chrome/common/extensions/extension_icon_set.h" |
34 #include "chrome/common/extensions/incognito_handler.h" | 36 #include "chrome/common/extensions/incognito_handler.h" |
35 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" | 37 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" |
36 #include "chrome/common/extensions/manifest_handlers/offline_enabled_info.h" | 38 #include "chrome/common/extensions/manifest_handlers/offline_enabled_info.h" |
37 #include "chrome/common/extensions/manifest_url_handler.h" | 39 #include "chrome/common/extensions/manifest_url_handler.h" |
38 #include "content/public/browser/browser_thread.h" | 40 #include "content/public/browser/browser_thread.h" |
39 #include "content/public/browser/render_process_host.h" | 41 #include "content/public/browser/render_process_host.h" |
40 #include "content/public/browser/render_view_host.h" | 42 #include "content/public/browser/render_view_host.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 for (ExtensionSet::const_iterator iter = items.begin(); | 405 for (ExtensionSet::const_iterator iter = items.begin(); |
404 iter != items.end(); ++iter) { | 406 iter != items.end(); ++iter) { |
405 const Extension& item = **iter; | 407 const Extension& item = **iter; |
406 | 408 |
407 ExtensionResource item_resource = | 409 ExtensionResource item_resource = |
408 IconsInfo::GetIconResource(&item, | 410 IconsInfo::GetIconResource(&item, |
409 48, | 411 48, |
410 ExtensionIconSet::MATCH_BIGGER); | 412 ExtensionIconSet::MATCH_BIGGER); |
411 id_to_icon[item.id()] = item_resource; | 413 id_to_icon[item.id()] = item_resource; |
412 | 414 |
413 if (item.location() == Manifest::COMPONENT) | 415 // Don't show component extensions because they are only extensions as an |
414 continue; // Skip built-in extensions / apps; | 416 // implementation detail of Chrome. |
| 417 if (item.location() == Manifest::COMPONENT && |
| 418 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 419 switches::kShowComponentExtensionOptions)) { |
| 420 continue; |
| 421 } |
| 422 |
| 423 // Don't show apps that aren't visible in either launcher or ntp. |
| 424 if (item.is_app() && !item.ShouldDisplayInAppLauncher() && |
| 425 !item.ShouldDisplayInNewTabPage() && |
| 426 !Manifest::IsUnpackedLocation(item.location())) { |
| 427 continue; |
| 428 } |
| 429 |
415 item_list.push_back(make_linked_ptr<developer::ItemInfo>( | 430 item_list.push_back(make_linked_ptr<developer::ItemInfo>( |
416 CreateItemInfo( | 431 CreateItemInfo( |
417 item, service->IsExtensionEnabled(item.id())).release())); | 432 item, service->IsExtensionEnabled(item.id())).release())); |
418 } | 433 } |
419 | 434 |
420 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE, | 435 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE, |
421 base::Bind(&DeveloperPrivateGetItemsInfoFunction::GetIconsOnFileThread, | 436 base::Bind(&DeveloperPrivateGetItemsInfoFunction::GetIconsOnFileThread, |
422 this, | 437 this, |
423 item_list, | 438 item_list, |
424 id_to_icon)); | 439 id_to_icon)); |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 | 1297 |
1283 #undef SET_STRING | 1298 #undef SET_STRING |
1284 return true; | 1299 return true; |
1285 } | 1300 } |
1286 | 1301 |
1287 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} | 1302 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} |
1288 | 1303 |
1289 } // namespace api | 1304 } // namespace api |
1290 | 1305 |
1291 } // namespace extensions | 1306 } // namespace extensions |
OLD | NEW |