| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/extension_error_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/extension_error_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
| 15 #include "chrome/browser/extensions/extension_system.h" | 15 #include "chrome/browser/extensions/extension_system.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
| 18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 19 #include "content/public/browser/web_ui.h" | 19 #include "content/public/browser/web_ui.h" |
| 20 #include "content/public/browser/web_ui_data_source.h" | 20 #include "content/public/browser/web_ui_data_source.h" |
| 21 #include "extensions/browser/extension_error.h" | 21 #include "extensions/browser/extension_error.h" |
| 22 #include "extensions/browser/file_highlighter.h" | 22 #include "extensions/browser/file_highlighter.h" |
| 23 #include "extensions/common/constants.h" | 23 #include "extensions/common/constants.h" |
| 24 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 26 | 26 |
| 27 namespace extensions { | 27 namespace extensions { |
| 28 | 28 |
| 29 namespace { | |
| 30 | |
| 31 // Keys for objects passed to and from extension error UI. | 29 // Keys for objects passed to and from extension error UI. |
| 32 const char kFileTypeKey[] = "fileType"; | |
| 33 const char kManifestFileType[] = "manifest"; | |
| 34 const char kPathSuffixKey[] = "pathSuffix"; | 30 const char kPathSuffixKey[] = "pathSuffix"; |
| 35 const char kSourceFileType[] = "source"; | |
| 36 const char kTitleKey[] = "title"; | 31 const char kTitleKey[] = "title"; |
| 37 | 32 |
| 38 } // namespace | |
| 39 | |
| 40 ExtensionErrorHandler::ExtensionErrorHandler(Profile* profile) | 33 ExtensionErrorHandler::ExtensionErrorHandler(Profile* profile) |
| 41 : profile_(profile) { | 34 : profile_(profile) { |
| 42 } | 35 } |
| 43 | 36 |
| 44 ExtensionErrorHandler::~ExtensionErrorHandler() { | 37 ExtensionErrorHandler::~ExtensionErrorHandler() { |
| 45 } | 38 } |
| 46 | 39 |
| 47 void ExtensionErrorHandler::GetLocalizedValues( | 40 void ExtensionErrorHandler::GetLocalizedValues( |
| 48 content::WebUIDataSource* source) { | 41 content::WebUIDataSource* source) { |
| 49 source->AddString( | 42 source->AddString( |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 base::DictionaryValue* results, | 171 base::DictionaryValue* results, |
| 179 int line_number, | 172 int line_number, |
| 180 std::string* contents) { | 173 std::string* contents) { |
| 181 SourceHighlighter highlighter(*contents, line_number); | 174 SourceHighlighter highlighter(*contents, line_number); |
| 182 highlighter.SetHighlightedRegions(results); | 175 highlighter.SetHighlightedRegions(results); |
| 183 web_ui()->CallJavascriptFunction( | 176 web_ui()->CallJavascriptFunction( |
| 184 "extensions.ExtensionErrorOverlay.requestFileSourceResponse", *results); | 177 "extensions.ExtensionErrorOverlay.requestFileSourceResponse", *results); |
| 185 } | 178 } |
| 186 | 179 |
| 187 } // namespace extensions | 180 } // namespace extensions |
| OLD | NEW |