| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } | 82 } |
| 83 | 83 |
| 84 void ExtensionsDOMHandler::HandleRequestExtensionsData(const Value* value) { | 84 void ExtensionsDOMHandler::HandleRequestExtensionsData(const Value* value) { |
| 85 DictionaryValue results; | 85 DictionaryValue results; |
| 86 | 86 |
| 87 // Add the extensions to the results structure. | 87 // Add the extensions to the results structure. |
| 88 ListValue *extensions_list = new ListValue(); | 88 ListValue *extensions_list = new ListValue(); |
| 89 const ExtensionList* extensions = extensions_service_->extensions(); | 89 const ExtensionList* extensions = extensions_service_->extensions(); |
| 90 for (ExtensionList::const_iterator extension = extensions->begin(); | 90 for (ExtensionList::const_iterator extension = extensions->begin(); |
| 91 extension != extensions->end(); ++extension) { | 91 extension != extensions->end(); ++extension) { |
| 92 extensions_list->Append(CreateExtensionDetailValue( | 92 // Don't show the themes since this page's UI isn't really useful for |
| 93 // themes. |
| 94 if (!(*extension)->IsTheme()) { |
| 95 extensions_list->Append(CreateExtensionDetailValue( |
| 93 *extension, GetActivePagesForExtension((*extension)->id()))); | 96 *extension, GetActivePagesForExtension((*extension)->id()))); |
| 97 } |
| 94 } | 98 } |
| 95 results.Set(L"extensions", extensions_list); | 99 results.Set(L"extensions", extensions_list); |
| 96 | 100 |
| 97 // Add any error log lines to the result structure. | |
| 98 ListValue *errors_list = new ListValue(); | |
| 99 const std::vector<std::string>* errors = | |
| 100 ExtensionErrorReporter::GetInstance()->GetErrors(); | |
| 101 for (std::vector<std::string>::const_iterator error = errors->begin(); | |
| 102 error != errors->end(); ++error) { | |
| 103 errors_list->Append(Value::CreateStringValue(*error)); | |
| 104 } | |
| 105 results.Set(L"errors", errors_list); | |
| 106 | |
| 107 dom_ui_->CallJavascriptFunction(L"returnExtensionsData", results); | 101 dom_ui_->CallJavascriptFunction(L"returnExtensionsData", results); |
| 108 } | 102 } |
| 109 | 103 |
| 110 void ExtensionsDOMHandler::HandleInspectMessage(const Value* value) { | 104 void ExtensionsDOMHandler::HandleInspectMessage(const Value* value) { |
| 111 std::string render_process_id_str; | 105 std::string render_process_id_str; |
| 112 std::string render_view_id_str; | 106 std::string render_view_id_str; |
| 113 int render_process_id; | 107 int render_process_id; |
| 114 int render_view_id; | 108 int render_view_id; |
| 115 CHECK(value->IsType(Value::TYPE_LIST)); | 109 CHECK(value->IsType(Value::TYPE_LIST)); |
| 116 const ListValue* list = static_cast<const ListValue*>(value); | 110 const ListValue* list = static_cast<const ListValue*>(value); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 AddMessageHandler(handler); | 263 AddMessageHandler(handler); |
| 270 handler->Attach(this); | 264 handler->Attach(this); |
| 271 | 265 |
| 272 ExtensionsUIHTMLSource* html_source = new ExtensionsUIHTMLSource(); | 266 ExtensionsUIHTMLSource* html_source = new ExtensionsUIHTMLSource(); |
| 273 | 267 |
| 274 // Set up the chrome://extensions/ source. | 268 // Set up the chrome://extensions/ source. |
| 275 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, | 269 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, |
| 276 NewRunnableMethod(&chrome_url_data_manager, | 270 NewRunnableMethod(&chrome_url_data_manager, |
| 277 &ChromeURLDataManager::AddDataSource, html_source)); | 271 &ChromeURLDataManager::AddDataSource, html_source)); |
| 278 } | 272 } |
| OLD | NEW |