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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_ERROR_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_ERROR_HANDLER_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/weak_ptr.h"
13 #include "content/public/browser/web_ui_message_handler.h"
16 class DictionaryValue;
21 class WebUIDataSource;
26 namespace extensions {
30 // The handler page for the Extension Commands UI overlay.
31 class ExtensionErrorHandler : public content::WebUIMessageHandler {
33 explicit ExtensionErrorHandler(Profile* profile);
34 virtual ~ExtensionErrorHandler();
36 // Fetches the localized values for the page and deposits them into |source|.
37 void GetLocalizedValues(content::WebUIDataSource* source);
39 // WebUIMessageHandler implementation.
40 virtual void RegisterMessages() OVERRIDE;
43 friend class ManifestHighlightUnitTest;
45 // Handle the "requestFileSource" call.
46 void HandleRequestFileSource(const base::ListValue* args);
48 // Called when |error_ui_util::HandleRequestFileSource| finishes.
49 void OnFileSourceHandled(const base::DictionaryValue& source);
51 // Handle the "openDevTools" call.
52 void HandleOpenDevTools(const base::ListValue* args);
54 // Populate the results for a manifest file's content in response to the
55 // "requestFileSource" call. Highlight the part of the manifest which
56 // corresponds to the given |key| and |specific| locations. Caller owns
58 void GetManifestFileCallback(base::DictionaryValue* dict,
59 const std::string& key,
60 const std::string& specific,
61 const std::string& contents);
63 // Populate the results for a source file's content in response to the
64 // "requestFileSource" call. Highlight the part of the source which
65 // corresponds to the given |line_number|.
66 void GetSourceFileCallback(base::DictionaryValue* results,
68 const std::string& contents);
70 // The profile with which this Handler is associated.
73 // Weak pointer factory for posting background tasks.
74 base::WeakPtrFactory<ExtensionErrorHandler> weak_ptr_factory_;
76 DISALLOW_COPY_AND_ASSIGN(ExtensionErrorHandler);
79 } // namespace extensions
81 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_ERROR_HANDLER_H_