OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_LOADER_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_LOADER_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_LOADER_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_LOADER_HANDLER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/callback.h" | |
14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
15 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
16 #include "base/macros.h" | 17 #include "base/macros.h" |
17 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
18 #include "base/scoped_observer.h" | 19 #include "base/scoped_observer.h" |
19 #include "base/values.h" | 20 #include "base/values.h" |
20 #include "chrome/browser/extensions/extension_error_reporter.h" | 21 #include "chrome/browser/extensions/extension_error_reporter.h" |
21 #include "content/public/browser/reload_type.h" | 22 #include "content/public/browser/reload_type.h" |
22 #include "content/public/browser/web_contents_observer.h" | 23 #include "content/public/browser/web_contents_observer.h" |
23 #include "content/public/browser/web_ui_message_handler.h" | 24 #include "content/public/browser/web_ui_message_handler.h" |
24 | 25 |
25 namespace content { | 26 namespace content { |
26 class WebUIDataSource; | 27 class WebUIDataSource; |
27 } | 28 } |
28 | 29 |
29 class Profile; | 30 class Profile; |
30 | 31 |
31 namespace extensions { | 32 namespace extensions { |
32 | 33 |
33 class Extension; | 34 class Extension; |
34 | 35 |
35 // The handler page for the Extension Commands UI overlay. | 36 // The handler page for the Extension Commands UI overlay. |
36 class ExtensionLoaderHandler : public content::WebUIMessageHandler, | 37 class ExtensionLoaderHandler : public content::WebUIMessageHandler, |
37 public ExtensionErrorReporter::Observer, | 38 public ExtensionErrorReporter::Observer, |
38 public content::WebContentsObserver { | 39 public content::WebContentsObserver { |
39 public: | 40 public: |
41 using GetManifestErrorCallback = | |
42 base::Callback<void(const base::FilePath& file_path, | |
43 const std::string& error, | |
44 size_t line_number, | |
45 const std::string& manifest)>; | |
46 | |
40 explicit ExtensionLoaderHandler(Profile* profile); | 47 explicit ExtensionLoaderHandler(Profile* profile); |
41 ~ExtensionLoaderHandler() override; | 48 ~ExtensionLoaderHandler() override; |
42 | 49 |
43 // Fetches the localized values for the page and deposits them into |source|. | 50 // Fetches the localized values for the page and deposits them into |source|. |
44 void GetLocalizedValues(content::WebUIDataSource* source); | 51 void GetLocalizedValues(content::WebUIDataSource* source); |
45 | 52 |
46 // WebUIMessageHandler implementation. | 53 // WebUIMessageHandler implementation. |
47 void RegisterMessages() override; | 54 void RegisterMessages() override; |
48 | 55 |
56 // TODO(devlin): Move this out of here into developerPrivate. | |
lazyboy
2017/03/22 21:38:46
optional nit: "Move this to developerPrivate."
Devlin
2017/03/23 01:30:59
Done.
| |
57 static void GetManifestError(const std::string& error, | |
58 const base::FilePath& extension_path, | |
59 const GetManifestErrorCallback& callback); | |
60 | |
49 private: | 61 private: |
50 // Handle the 'extensionLoaderRetry' message. | 62 // Handle the 'extensionLoaderRetry' message. |
51 void HandleRetry(const base::ListValue* args); | 63 void HandleRetry(const base::ListValue* args); |
52 | 64 |
53 // Handle the 'extensionLoaderIgnoreFailure' message. | 65 // Handle the 'extensionLoaderIgnoreFailure' message. |
54 void HandleIgnoreFailure(const base::ListValue* args); | 66 void HandleIgnoreFailure(const base::ListValue* args); |
55 | 67 |
56 // Handle the 'extensionLoaderDisplayFailures' message. | 68 // Handle the 'extensionLoaderDisplayFailures' message. |
57 void HandleDisplayFailures(const base::ListValue* args); | 69 void HandleDisplayFailures(const base::ListValue* args); |
58 | 70 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 | 111 |
100 // Weak pointer factory for posting background tasks. | 112 // Weak pointer factory for posting background tasks. |
101 base::WeakPtrFactory<ExtensionLoaderHandler> weak_ptr_factory_; | 113 base::WeakPtrFactory<ExtensionLoaderHandler> weak_ptr_factory_; |
102 | 114 |
103 DISALLOW_COPY_AND_ASSIGN(ExtensionLoaderHandler); | 115 DISALLOW_COPY_AND_ASSIGN(ExtensionLoaderHandler); |
104 }; | 116 }; |
105 | 117 |
106 } // namespace extensions | 118 } // namespace extensions |
107 | 119 |
108 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_LOADER_HANDLER_H_ | 120 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_LOADER_HANDLER_H_ |
OLD | NEW |