OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/extensions_ui.h" | 5 #include "chrome/browser/extensions/extensions_ui.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/thread.h" | 10 #include "base/thread.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 ExtensionsUIHTMLSource::ExtensionsUIHTMLSource() | 46 ExtensionsUIHTMLSource::ExtensionsUIHTMLSource() |
47 : DataSource(chrome::kChromeUIExtensionsHost, MessageLoop::current()) { | 47 : DataSource(chrome::kChromeUIExtensionsHost, MessageLoop::current()) { |
48 } | 48 } |
49 | 49 |
50 void ExtensionsUIHTMLSource::StartDataRequest(const std::string& path, | 50 void ExtensionsUIHTMLSource::StartDataRequest(const std::string& path, |
51 int request_id) { | 51 int request_id) { |
52 DictionaryValue localized_strings; | 52 DictionaryValue localized_strings; |
53 localized_strings.SetString(L"title", | 53 localized_strings.SetString(L"title", |
54 l10n_util::GetString(IDS_EXTENSIONS_TITLE)); | 54 l10n_util::GetString(IDS_EXTENSIONS_TITLE)); |
55 localized_strings.SetString(L"devToolsLink", | 55 localized_strings.SetString(L"devModeLink", |
56 l10n_util::GetString(IDS_EXTENSIONS_DEVELOPER_TOOLS_LINK)); | 56 l10n_util::GetString(IDS_EXTENSIONS_DEVELOPER_MODE_LINK)); |
57 localized_strings.SetString(L"devToolsPrefix", | 57 localized_strings.SetString(L"devModePrefix", |
58 l10n_util::GetString(IDS_EXTENSIONS_DEVELOPER_TOOLS_PREFIX)); | 58 l10n_util::GetString(IDS_EXTENSIONS_DEVELOPER_MODE_PREFIX)); |
59 localized_strings.SetString(L"loadUnpackedButton", | 59 localized_strings.SetString(L"loadUnpackedButton", |
60 l10n_util::GetString(IDS_EXTENSIONS_LOAD_UNPACKED_BUTTON)); | 60 l10n_util::GetString(IDS_EXTENSIONS_LOAD_UNPACKED_BUTTON)); |
61 localized_strings.SetString(L"packButton", | 61 localized_strings.SetString(L"packButton", |
62 l10n_util::GetString(IDS_EXTENSIONS_PACK_BUTTON)); | 62 l10n_util::GetString(IDS_EXTENSIONS_PACK_BUTTON)); |
63 localized_strings.SetString(L"updateButton", | 63 localized_strings.SetString(L"updateButton", |
64 l10n_util::GetString(IDS_EXTENSIONS_UPDATE_BUTTON)); | 64 l10n_util::GetString(IDS_EXTENSIONS_UPDATE_BUTTON)); |
65 localized_strings.SetString(L"noExtensions", | 65 localized_strings.SetString(L"noExtensions", |
66 l10n_util::GetString(IDS_EXTENSIONS_NONE_INSTALLED)); | 66 l10n_util::GetString(IDS_EXTENSIONS_NONE_INSTALLED)); |
67 localized_strings.SetString(L"extensionDisabled", | 67 localized_strings.SetString(L"extensionDisabled", |
68 l10n_util::GetString(IDS_EXTENSIONS_DISABLED_EXTENSION)); | 68 l10n_util::GetString(IDS_EXTENSIONS_DISABLED_EXTENSION)); |
| 69 localized_strings.SetString(L"inDevelopment", |
| 70 l10n_util::GetString(IDS_EXTENSIONS_IN_DEVELOPMENT)); |
69 localized_strings.SetString(L"extensionId", | 71 localized_strings.SetString(L"extensionId", |
70 l10n_util::GetString(IDS_EXTENSIONS_ID)); | 72 l10n_util::GetString(IDS_EXTENSIONS_ID)); |
71 localized_strings.SetString(L"extensionVersion", | 73 localized_strings.SetString(L"extensionVersion", |
72 l10n_util::GetString(IDS_EXTENSIONS_VERSION)); | 74 l10n_util::GetString(IDS_EXTENSIONS_VERSION)); |
73 localized_strings.SetString(L"inspectViews", | 75 localized_strings.SetString(L"inspectViews", |
74 l10n_util::GetString(IDS_EXTENSIONS_INSPECT_VIEWS)); | 76 l10n_util::GetString(IDS_EXTENSIONS_INSPECT_VIEWS)); |
75 localized_strings.SetString(L"disable", | 77 localized_strings.SetString(L"disable", |
76 l10n_util::GetString(IDS_EXTENSIONS_DISABLE)); | 78 l10n_util::GetString(IDS_EXTENSIONS_DISABLE)); |
77 localized_strings.SetString(L"enable", | 79 localized_strings.SetString(L"enable", |
78 l10n_util::GetString(IDS_EXTENSIONS_ENABLE)); | 80 l10n_util::GetString(IDS_EXTENSIONS_ENABLE)); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 DictionaryValue* ExtensionsDOMHandler::CreateExtensionDetailValue( | 463 DictionaryValue* ExtensionsDOMHandler::CreateExtensionDetailValue( |
462 const Extension *extension, const std::vector<ExtensionPage>& pages, | 464 const Extension *extension, const std::vector<ExtensionPage>& pages, |
463 bool enabled) { | 465 bool enabled) { |
464 DictionaryValue* extension_data = new DictionaryValue(); | 466 DictionaryValue* extension_data = new DictionaryValue(); |
465 | 467 |
466 extension_data->SetString(L"id", extension->id()); | 468 extension_data->SetString(L"id", extension->id()); |
467 extension_data->SetString(L"name", extension->name()); | 469 extension_data->SetString(L"name", extension->name()); |
468 extension_data->SetString(L"description", extension->description()); | 470 extension_data->SetString(L"description", extension->description()); |
469 extension_data->SetString(L"version", extension->version()->GetString()); | 471 extension_data->SetString(L"version", extension->version()->GetString()); |
470 extension_data->SetBoolean(L"enabled", enabled); | 472 extension_data->SetBoolean(L"enabled", enabled); |
| 473 |
| 474 // Determine the sort order: Extensions loaded through --load-extensions show |
| 475 // up at the top. Disabled extensions show up at the bottom. |
| 476 if (extension->location() == Extension::LOAD) |
| 477 extension_data->SetInteger(L"order", 1); |
| 478 else |
| 479 extension_data->SetInteger(L"order", 2); |
| 480 |
471 if (!extension->options_url().is_empty()) | 481 if (!extension->options_url().is_empty()) |
472 extension_data->SetString(L"options_url", extension->options_url().spec()); | 482 extension_data->SetString(L"options_url", extension->options_url().spec()); |
473 | 483 |
474 // Try to fetch the medium sized icon, then (if missing) go for the large one. | 484 // Try to fetch the medium sized icon, then (if missing) go for the large one. |
475 const std::map<int, std::string>& icons = extension->icons(); | 485 const std::map<int, std::string>& icons = extension->icons(); |
476 std::map<int, std::string>::const_iterator iter = | 486 std::map<int, std::string>::const_iterator iter = |
477 icons.find(Extension::EXTENSION_ICON_MEDIUM); | 487 icons.find(Extension::EXTENSION_ICON_MEDIUM); |
478 if (iter == icons.end()) | 488 if (iter == icons.end()) |
479 iter = icons.find(Extension::EXTENSION_ICON_LARGE); | 489 iter = icons.find(Extension::EXTENSION_ICON_LARGE); |
480 if (iter != icons.end()) | 490 if (iter != icons.end()) |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 // static | 576 // static |
567 RefCountedMemory* ExtensionsUI::GetFaviconResourceBytes() { | 577 RefCountedMemory* ExtensionsUI::GetFaviconResourceBytes() { |
568 return ResourceBundle::GetSharedInstance(). | 578 return ResourceBundle::GetSharedInstance(). |
569 LoadImageResourceBytes(IDR_PLUGIN); | 579 LoadImageResourceBytes(IDR_PLUGIN); |
570 } | 580 } |
571 | 581 |
572 // static | 582 // static |
573 void ExtensionsUI::RegisterUserPrefs(PrefService* prefs) { | 583 void ExtensionsUI::RegisterUserPrefs(PrefService* prefs) { |
574 prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode, false); | 584 prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode, false); |
575 } | 585 } |
OLD | NEW |