| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 jstemplate_builder::AppendI18nTemplateProcessHtml(&full_html); | 184 jstemplate_builder::AppendI18nTemplateProcessHtml(&full_html); |
| 185 jstemplate_builder::AppendJsTemplateSourceHtml(&full_html); | 185 jstemplate_builder::AppendJsTemplateSourceHtml(&full_html); |
| 186 | 186 |
| 187 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 187 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); |
| 188 html_bytes->data.resize(full_html.size()); | 188 html_bytes->data.resize(full_html.size()); |
| 189 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); | 189 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); |
| 190 | 190 |
| 191 SendResponse(request_id, html_bytes); | 191 SendResponse(request_id, html_bytes); |
| 192 } | 192 } |
| 193 | 193 |
| 194 std::string ExtensionsUIHTMLSource::GetMimeType(const std::string&) const { |
| 195 return "text/html"; |
| 196 } |
| 194 | 197 |
| 195 //////////////////////////////////////////////////////////////////////////////// | 198 //////////////////////////////////////////////////////////////////////////////// |
| 196 // | 199 // |
| 197 // ExtensionsDOMHandler::IconLoader | 200 // ExtensionsDOMHandler::IconLoader |
| 198 // | 201 // |
| 199 //////////////////////////////////////////////////////////////////////////////// | 202 //////////////////////////////////////////////////////////////////////////////// |
| 200 | 203 |
| 201 ExtensionsDOMHandler::IconLoader::IconLoader(ExtensionsDOMHandler* handler) | 204 ExtensionsDOMHandler::IconLoader::IconLoader(ExtensionsDOMHandler* handler) |
| 202 : handler_(handler) { | 205 : handler_(handler) { |
| 203 } | 206 } |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 | 672 |
| 670 | 673 |
| 671 void ExtensionsDOMHandler::FileSelected(const FilePath& path, int index, | 674 void ExtensionsDOMHandler::FileSelected(const FilePath& path, int index, |
| 672 void* params) { | 675 void* params) { |
| 673 // Add the extensions to the results structure. | 676 // Add the extensions to the results structure. |
| 674 ListValue results; | 677 ListValue results; |
| 675 results.Append(Value::CreateStringValue(path.value())); | 678 results.Append(Value::CreateStringValue(path.value())); |
| 676 dom_ui_->CallJavascriptFunction(L"window.handleFilePathSelected", results); | 679 dom_ui_->CallJavascriptFunction(L"window.handleFilePathSelected", results); |
| 677 } | 680 } |
| 678 | 681 |
| 682 void ExtensionsDOMHandler::MultiFilesSelected( |
| 683 const std::vector<FilePath>& files, void* params) { |
| 684 NOTREACHED(); |
| 685 } |
| 686 |
| 679 void ExtensionsDOMHandler::Observe(NotificationType type, | 687 void ExtensionsDOMHandler::Observe(NotificationType type, |
| 680 const NotificationSource& source, | 688 const NotificationSource& source, |
| 681 const NotificationDetails& details) { | 689 const NotificationDetails& details) { |
| 682 switch (type.value) { | 690 switch (type.value) { |
| 683 // We listen for notifications that will result in the page being | 691 // We listen for notifications that will result in the page being |
| 684 // repopulated with data twice for the same event in certain cases. | 692 // repopulated with data twice for the same event in certain cases. |
| 685 // For instance, EXTENSION_LOADED & EXTENSION_PROCESS_CREATED because | 693 // For instance, EXTENSION_LOADED & EXTENSION_PROCESS_CREATED because |
| 686 // we don't know about the views for an extension at EXTENSION_LOADED, but | 694 // we don't know about the views for an extension at EXTENSION_LOADED, but |
| 687 // if we only listen to EXTENSION_PROCESS_CREATED, we'll miss extensions | 695 // if we only listen to EXTENSION_PROCESS_CREATED, we'll miss extensions |
| 688 // that don't have a process at startup. Similarly, NAV_ENTRY_COMMITTED & | 696 // that don't have a process at startup. Similarly, NAV_ENTRY_COMMITTED & |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 // static | 959 // static |
| 952 RefCountedMemory* ExtensionsUI::GetFaviconResourceBytes() { | 960 RefCountedMemory* ExtensionsUI::GetFaviconResourceBytes() { |
| 953 return ResourceBundle::GetSharedInstance(). | 961 return ResourceBundle::GetSharedInstance(). |
| 954 LoadDataResourceBytes(IDR_PLUGIN); | 962 LoadDataResourceBytes(IDR_PLUGIN); |
| 955 } | 963 } |
| 956 | 964 |
| 957 // static | 965 // static |
| 958 void ExtensionsUI::RegisterUserPrefs(PrefService* prefs) { | 966 void ExtensionsUI::RegisterUserPrefs(PrefService* prefs) { |
| 959 prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode, false); | 967 prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode, false); |
| 960 } | 968 } |
| OLD | NEW |